From 2cf2beb6505c866607fd6e88483a37c9ed368051 Mon Sep 17 00:00:00 2001
From: 13937891274 <kxc0822>
Date: 星期六, 06 八月 2022 18:02:05 +0800
Subject: [PATCH] 应急预案管理数据对接

---
 src/components/checkTemplate/index.vue                                      |   58 ++++++++++++++++---
 src/api/contingency/index.ts                                                |    1 
 src/api/emergencyPlan/index.ts                                              |   10 +++
 src/views/contingencyManagement/panManagement/component/approvalProcess.vue |   40 +++---------
 src/views/contingencyManagement/panManagement/index.vue                     |    2 
 src/views/contingencyManagement/panManagement/component/approval.vue        |   49 ++++++++++------
 6 files changed, 101 insertions(+), 59 deletions(-)

diff --git a/src/api/contingency/index.ts b/src/api/contingency/index.ts
index 52d8628..d3222b2 100644
--- a/src/api/contingency/index.ts
+++ b/src/api/contingency/index.ts
@@ -2,6 +2,7 @@
 
 export function contingencyApi(){
     return{
+        //应急队伍一览
         getTeamManagementList: (params: object) => {
             return request({
                 url: `/emergencyTeam/page/list`,
diff --git a/src/api/emergencyPlan/index.ts b/src/api/emergencyPlan/index.ts
index 30ce773..fb79a63 100644
--- a/src/api/emergencyPlan/index.ts
+++ b/src/api/emergencyPlan/index.ts
@@ -71,7 +71,7 @@
                 data: params
             });
         },
-        // 应急预案管理审批流程
+        // 应急预案管理审批查看
         approvalProcessEmergencyPlan: (params: number) => {
             return request({
                 url: `/emergencyWorkApprove/info/${params}`,
@@ -79,5 +79,13 @@
                 data: params
             });
         },
+        // 审批一览
+        processEmergencyPlan: (params: object) => {
+            return request({
+                url: `/emergencyWorkApprove/page/list`,
+                method: 'post',
+                data: params
+            });
+        },
     }
 }
\ No newline at end of file
diff --git a/src/components/checkTemplate/index.vue b/src/components/checkTemplate/index.vue
index 695cb6d..50a3420 100644
--- a/src/components/checkTemplate/index.vue
+++ b/src/components/checkTemplate/index.vue
@@ -7,7 +7,7 @@
           <el-col :span="24">
             <el-form ref="ruleFormRef" :inline="true" status-icon>
               <el-form-item>
-                <el-input size="default" v-model="listQuery.searchParams.id" placeholder="id"  style="max-width: 215px;"/>
+                <el-input size="default" v-model="listQuery.searchParams.authorUid" placeholder="id"  style="max-width: 215px;"/>
               </el-form-item>
               <el-form-item>
                 <el-input size="default" v-model="listQuery.searchParams.teamName" placeholder="队伍名称"  style="max-width: 215px;padding: 0 12px;"/>
@@ -19,15 +19,22 @@
             </el-form>
           </el-col>
           <el-col :span="24">
-            <el-button size="default" :icon="Delete" style="margin-top: 15px;">清除选择</el-button>
+            <el-button size="default" :icon="Delete" style="margin-top: 15px;" @click="submitReset">清除选择</el-button>
           </el-col>
         </el-row>
         <el-table
             :data="tableData"
             ref="multipleTableRef"
             style="width: 100%;margin-top:20px"
+            @cell-click="radio"
         >
-          <el-table-column type="selection" width="55" />
+          <el-table-column width="55">
+            <template #default="scope">
+              <el-radio-group v-model="radio1">
+                <el-radio :label="scope.row" size="large">{{ null }}</el-radio>
+              </el-radio-group>
+            </template>
+          </el-table-column>
           <el-table-column align="center" prop="date" label="id" />
           <el-table-column align="center" prop="name" label="队伍名称"/>
         </el-table>
@@ -44,15 +51,25 @@
         </div>
       </el-col>
       <el-col :span="6" style="padding-left: 15px">
-        <el-tag v-for="tag in dynamicTags" :key="tag" class="mx-1" style="margin:5px" closable :disable-transitions="false" @close="handleClose(tag)">
-          {{ tag }}
-        </el-tag>
+        <div v-if="dynamicTags[0] == '' ? false : true">
+          <el-tag
+              v-for="tag in dynamicTags"
+              :key="tag"
+              class="mx-1"
+              style="margin: 5px"
+              closable
+              :disable-transitions="false"
+              @close="handleClose(tag)"
+          >
+            {{ tag.name }}
+          </el-tag>
+        </div>
       </el-col>
     </el-row>
     <template #footer>
 			<span class="dialog-footer">
 				<el-button @click="dialogVisible = false" size="default">关闭</el-button>
-				<el-button type="primary" @click="dialogVisible = false" size="default">确定</el-button>
+				<el-button type="primary" @click="submitForm" size="default">确定</el-button>
 			</span>
     </template>
   </el-dialog>
@@ -62,6 +79,7 @@
   defineComponent,
   reactive,
   ref,
+  onMounted,
 } from 'vue';
 import {
   Delete,
@@ -73,10 +91,11 @@
 import {contingencyApi} from "/@/api/contingency";
 
 export default defineComponent({
-  setup() {
+  setup(props, { emit }) {
     const dialogVisible = ref<boolean>(false);
     const openDailog = () => {
       dialogVisible.value = true;
+      onSubmit();
     };
     // 搜索条件
     const listQuery = reactive({
@@ -103,10 +122,17 @@
         })
       }
     }
+    const submitForm = () => {
+      let obj = JSON.parse(JSON.stringify(dynamicTags.value));
+      emit('SearchUser', obj[0]);
+      dialogVisible.value = false;
+    };
     // 重置
     const submitReset = () => {
       listQuery.searchParams.teamName = '';
       listQuery.searchParams.teamType = '';
+      radio1.value=""
+      dynamicTags.value[0]=""
       onSubmit();
     };
     // 表格
@@ -124,10 +150,18 @@
       onSubmit();
     }
     // 右方点击添加后显示标签
-    const dynamicTags = ref(['应急救援组', '工艺抢险组', '后勤保障组']);
+    const dynamicTags = ref(['']);
     const handleClose = (tag: string) => {
       dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1);
+      radio1.value = '';
     };
+    const radio1 = ref('');
+    const radio = (event: any) => {
+      dynamicTags.value[0] = event;
+    };
+    onMounted(() => {
+      onSubmit();
+    });
     //全屏
     const full = ref(false);
     const toggleFullscreen = () => {
@@ -154,7 +188,11 @@
       onSubmit,
       listQuery,
       submitReset,
-      total
+      total,
+      radio,
+      radio1,
+      submitForm,
+
     };
   },
 });
diff --git a/src/views/contingencyManagement/panManagement/component/approval.vue b/src/views/contingencyManagement/panManagement/component/approval.vue
index 0e97074..03d32fd 100644
--- a/src/views/contingencyManagement/panManagement/component/approval.vue
+++ b/src/views/contingencyManagement/panManagement/component/approval.vue
@@ -5,7 +5,7 @@
 			<el-form ref="ruleFormRef" :model="ruleForm" size="default" label-width="120px" :disabled="disabled">
 				<el-row :gutter="35">
 					<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
-						<el-form-item label="审批名称" prop="name">
+						<el-form-item label="审批名称" prop="workName">
 							<el-input v-model="ruleForm.workName" placeholder="请填写队伍名称"></el-input>
 						</el-form-item>
 					</el-col>
@@ -46,17 +46,17 @@
 					</el-col>
           <el-col v-if="ruleForm.complete" :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
             <el-form-item label="审批名称" prop="workName">
-              <el-input v-model="ruleForm.workName" placeholder="请填写队伍名称"></el-input>
+              <el-input v-model="ruleForm.twoWorkName" placeholder="请填写队伍名称"></el-input>
             </el-form-item>
           </el-col>
           <el-col v-if="ruleForm.complete" :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
             <el-form-item label="审批标题" prop="title">
-              <el-input v-model="ruleForm.title" placeholder="请填写审批名称"></el-input>
+              <el-input v-model="ruleForm.twoTitle" placeholder="请填写审批名称"></el-input>
             </el-form-item>
           </el-col>
 					<el-col v-if="ruleForm.complete" :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
 						<el-form-item label="审批人" prop="authorUid">
-							<el-input v-model="ruleForm.approvePersonName" placeholder="请选择" class="input-with-select">
+							<el-input v-model="ruleForm.twoApprovePersonName" placeholder="请选择" class="input-with-select">
 								<template #append>
 									<el-button :icon="Search" @click="openUser" />
 								</template>
@@ -99,29 +99,41 @@
       title: '', //审批标题
       approvePersonId: '', //
       approvePersonName: '', // 审批人
-      approveStatus: 2,
-      relateType: 1,
-      approveResult: false,
-      approveMemo: '',
+      approveStatus: 2, //审批状态
+      relateType: 1, //业务类型
+      approveResult: false, //审批结果
+      approveMemo: '', //审批意见
       relateId: '',
+      twoWorkName:'',
+      twoTitle:'',
+      twoApprovePersonId:'',
+      twoApprovePersonName:''
 		});
 		const titles = ref();
 		const disabled = ref();
-
+    const uid = ref();
 		// 打开弹窗
 		const openDialog = (title: string, id: number, type: boolean) => {
 			isShowDialog.value = true;
 			titles.value = title;
 			disabled.value = type;
-      emergencyPlanApi()
-          .approvalProcessEmergencyPlan(id)
-          .then((res) => {
-            if (res.data.code == 200) {
-              ruleForm.value = res.data.data;
-            }
-          });
+      ruleForm.value.relateId = id;
+      uid.value = id;
+      if(title == '查看审批' || title == '修改审批') {
+        emergencyPlanApi()
+            .approvalProcessEmergencyPlan(id)
+            .then((res) => {
+              if (res.data.code == 200) {
+                ruleForm.value = res.data.data;
+              }
+            });
+      }
 		};
 		const submitForm = async () => {
+      ruleForm.value.workName = ruleForm.value.twoWorkName
+      ruleForm.value.title = ruleForm.value.twoTitle
+      ruleForm.value.approvePersonId = ruleForm.value.twoApprovePersonId
+      ruleForm.value.approvePersonName = ruleForm.value.twoApprovePersonName
       isShowDialog.value = false;
       emergencyPlanApi()
           .editApprovalEmergencyPlan(ruleForm.value)
@@ -153,8 +165,8 @@
 		};
 		//回显
 		const onUser = (e: any) => {
-      ruleForm.value.approvePersonId = e[0].uid;
-      ruleForm.value.approvePersonName = e[0].realName;
+      ruleForm.value.twoApprovePersonId = e[0].uid;
+      ruleForm.value.twoApprovePersonName = e[0].realName;
 		};
 		const typeChang = () => {
 			console.log('tag', ruleForm);
@@ -186,6 +198,7 @@
 			resetForm,
 			onUser,
 			typeChang,
+      uid,
 		};
 	},
 });
diff --git a/src/views/contingencyManagement/panManagement/component/approvalProcess.vue b/src/views/contingencyManagement/panManagement/component/approvalProcess.vue
index 5c4ac6c..201a65e 100644
--- a/src/views/contingencyManagement/panManagement/component/approvalProcess.vue
+++ b/src/views/contingencyManagement/panManagement/component/approvalProcess.vue
@@ -11,10 +11,10 @@
               :model="formInline"
               :header-cell-style="{ background: '#f6f7fa', color: '#909399' }"
           >
-            <el-table-column prop="name" label="审批人" show-overflow-tooltip sortable></el-table-column>
-            <el-table-column prop="type" label="审批标题" show-overflow-tooltip sortable></el-table-column>
-            <el-table-column prop="authorUid" label="编写人" show-overflow-tooltip sortable></el-table-column>
-            <el-table-column prop="releaseDate" label="发布实施日期" show-overflow-tooltip sortable></el-table-column>
+            <el-table-column prop="workName" label="审批人" show-overflow-tooltip sortable></el-table-column>
+            <el-table-column prop="title" label="审批标题" show-overflow-tooltip sortable></el-table-column>
+            <el-table-column prop="approvePersonName" label="编写人" show-overflow-tooltip sortable></el-table-column>
+            <el-table-column prop="approveMemo" label="审批意见" show-overflow-tooltip sortable></el-table-column>
             <el-table-column label="操作" width="200" align="center">
               <template #default="scope">
                 <el-button size="small" text type="primary" @click="onReduction(scope.row.id)">还原</el-button>
@@ -66,16 +66,19 @@
       pageIndex: 1,
       pageSize: 10,
       searchParams: {
-        abolishStatus: true,
+        relateType: 1,
+        relateId: '',
+        startTime: '',
+        endTime: '',
       },
     });
     // 定义表格数据
     const tableData = ref([]);
 
     // 列表数据请求
-    const openDialog = async (id: number) => {
+    const openDialog = async () => {
       isShowDialog.value = true;
-      let res = await emergencyPlanApi().approvalProcessEmergencyPlan(id);
+      let res = await emergencyPlanApi().processEmergencyPlan(listQuery);
       if (res.data.code === '200') {
         tableData.value = res.data.data;
         pageIndex.value = res.data.pageIndex;
@@ -105,29 +108,8 @@
     const onCancel = () => {
       closeDialog();
     };
-    const onReduction = async (id) => {
+    const onReduction = async () => {
       isShowDialog.value = false;
-      // emergencyPlanApi()
-      //     .approvalProcessEmergencyPlan(id)
-      //     .then((res) => {
-      //       if (res.data.code == 200) {
-      //         ElMessage({
-      //           showClose: true,
-      //           message: res.data.msg,
-      //           type: 'success',
-      //         });
-      //         emit('myAdd', true);
-      //       } else {
-      //         ElMessage({
-      //           showClose: true,
-      //           message: res.data.msg,
-      //           type: 'error',
-      //         });
-      //         emit('myAdd', true);
-      //         openDialog();
-      //       }
-      //     })
-      //     .catch(() => {});
     };
     // 分页
     const pageIndex = ref();
diff --git a/src/views/contingencyManagement/panManagement/index.vue b/src/views/contingencyManagement/panManagement/index.vue
index 41c09cb..4d4ed2b 100644
--- a/src/views/contingencyManagement/panManagement/index.vue
+++ b/src/views/contingencyManagement/panManagement/index.vue
@@ -94,7 +94,7 @@
 							text
 							type="primary"
 							v-if="scope.row.approveStatus === 2 && scope.row.checkApprove === true"
-							@click="onApproval('修改',scope.row.id)"
+							@click="onApproval('修改',scope.row.approveId)"
 						>
 							审批
 						</el-button>

--
Gitblit v1.9.2