From b5207f617870bb7e6a513abd430e3f68c9ed0ea1 Mon Sep 17 00:00:00 2001
From: zhaojiale <631455805@qq.com>
Date: 星期六, 06 八月 2022 18:02:00 +0800
Subject: [PATCH] 应急演练修改

---
 src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/openAdd.vue |  270 +++++++++++++++++++++++++++--------------------------
 1 files changed, 137 insertions(+), 133 deletions(-)

diff --git a/src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/openAdd.vue b/src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/openAdd.vue
index 207411a..7a6c8ea 100644
--- a/src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/openAdd.vue
+++ b/src/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/openAdd.vue
@@ -6,6 +6,7 @@
         width="769px"
         draggable
         :fullscreen="full"
+        @close="resetForm(ruleFormRef)"
     >
       <el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button>
       <el-form
@@ -41,16 +42,17 @@
           <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
             <el-form-item label="演练方式" prop="drillWay">
               <el-select v-model="ruleForm.drillWay" class="w100" placeholder="请选择">
-                <el-option label="综合" value="综合"></el-option>
-                <el-option label="桌面" value="桌面"></el-option>
-                <el-option label="专项" value="专项"></el-option>
+
+                <el-option label="综合" value="0"></el-option>
+                <el-option label="桌面" value="1"></el-option>
+                <el-option label="专项" value="2"></el-option>
               </el-select>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
-            <el-form-item label="应急预案" prop="planId" >
+            <el-form-item label="应急预案" prop="planName" >
               <el-input
-                  v-model="ruleForm.planId"
+                  v-model="ruleForm.planName"
                   placeholder="请选择"
                   class="input-with-select"
               >
@@ -63,9 +65,9 @@
           <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
             <el-form-item label="演练级别" prop="drillLevel">
               <el-select v-model="ruleForm.drillLevel" class="w100" placeholder="请选择">
-                <el-option label="公司级" value="公司级"></el-option>
-                <el-option label="分厂级" value="分厂级"></el-option>
-                <el-option label="车间级" value="车间级"></el-option>
+                <el-option label="公司级" value="1"></el-option>
+                <el-option label="分厂级" value="2"></el-option>
+                <el-option label="车间级" value="3"></el-option>
               </el-select>
             </el-form-item>
           </el-col>
@@ -80,13 +82,13 @@
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
-            <el-form-item label="修改时间" prop="updateDate">
-              <el-date-picker v-model="ruleForm.updateDate" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="选择日期时间" style="width: 100%" />
+            <el-form-item label="修改时间" prop="gmtModitify">
+              <el-date-picker v-model="ruleForm.gmtModitify" value-format="YYYY-MM-DD HH:mm:ss" type="datetime" placeholder="选择日期时间" style="width: 100%" />
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
-            <el-form-item label="计划定制人" prop="makingUserUid">
-              <el-input v-model="ruleForm.makingUserUid" placeholder="请填写计划定制人" disabled></el-input>
+            <el-form-item label="计划定制人" prop="makingUserName">
+              <el-input v-model="ruleForm.makingUserName" placeholder="请填写计划定制人" disabled></el-input>
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
@@ -102,14 +104,14 @@
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
-            <el-form-item label="演练人员" prop="telephone" >
+            <el-form-item label="演练人员" prop="userListString" >
               <el-input
-                  v-model="ruleForm.teamLeader"
+                  v-model="ruleForm.userListString"
                   placeholder="请选择"
                   class="input-with-select"
               >
                 <template #append>
-                  <el-button :icon="Search" @click="openUser"/>
+                  <el-button :icon="Search" @click="openUser(0)"/>
                 </template>
               </el-input>
             </el-form-item>
@@ -126,14 +128,14 @@
             </el-form-item>
           </el-col>
           <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
-            <el-form-item label="演练负责人" prop="telephone" >
+            <el-form-item label="演练负责人" prop="chargeUserListString" >
               <el-input
-                  v-model="ruleForm.teamLeader"
+                  v-model="ruleForm.chargeUserListString"
                   placeholder="请选择"
                   class="input-with-select"
               >
                 <template #append>
-                  <el-button :icon="Search" @click="openUser"/>
+                  <el-button :icon="Search" @click="openUser(1)"/>
                 </template>
               </el-input>
             </el-form-item>
@@ -161,20 +163,20 @@
           </el-col>
           <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20" style="margin-bottom: 0!important;">
             <el-form-item label="预案附件">
-              <el-upload
-                  v-model:file-list="fileList"
-                  class="upload-demo"
-                  action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
-                  :on-change="handleChange"
-              >
-                <el-button type="primary"
-                >点击上传</el-button>
-                <template #tip>
-                  <div class="el-upload__tip">
-                    添加相关附件
-                  </div>
-                </template>
-              </el-upload>
+              <!--<el-upload-->
+                  <!--v-model:file-list="fileList"-->
+                  <!--class="upload-demo"-->
+                  <!--action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"-->
+                  <!--:on-change="handleChange"-->
+              <!--&gt;-->
+                <!--<el-button type="primary"-->
+                <!--&gt;点击上传</el-button>-->
+                <!--<template #tip>-->
+                  <!--<div class="el-upload__tip">-->
+                    <!--添加相关附件-->
+                  <!--</div>-->
+                <!--</template>-->
+              <!--</el-upload>-->
             </el-form-item>
           </el-col>
         </el-row>
@@ -186,8 +188,9 @@
 				</span>
       </template>
     </el-dialog>
-    <RegionsDialog ref="Shows" @SearchUser="onUser"/>
-    <UserCheckbox ref="userRef"/>
+    <RegionsDialog ref="Shows" @SearchUser="onUser" />
+    <DailogSearchUser ref="userRef" @SearchUser="SearchUser" />
+    <DailogSearchUser ref="userFZRef" @SearchUser="SearchFZUser" />
   </div>
 </template>
 
@@ -208,16 +211,17 @@
   Search,
   FullScreen
 } from '@element-plus/icons-vue'
-import UserCheckbox from "/@/components/userCheckbox/index.vue"
+import DailogSearchUser from "/@/components/DailogSearchUser/index.vue"
 import RegionsDialog from "/@/views/contingencyManagement/emergencyDrill/releaseOfDrillPlan/component/regionsDialog.vue"
 import {releaseDrillPlanApi} from "/@/api/emergencyDrillPlan";
 import {goalManagementApi} from "/@/api/goalManagement";
+import { Session } from '/@/utils/storage';
 
 export default defineComponent({
   name: 'openAdd',
   components: {
     RegionsDialog,
-    UserCheckbox,
+    DailogSearchUser
   },
   setup(props, { emit }) {
     const isShowDialog = ref(false)
@@ -228,8 +232,10 @@
       makingPlanDate: '', // 计划制定日期
       drillPlanDate: '', //计划演练日期
       makingUserUid: '', //计划制定人ID
+      makingUserName: '', //计划制定人Name
       makingDepartmentId: '', // 计划制定部门ID
       planId: '', // 应急预案ID
+      planName: '', // 应急预案name
       departmentId: '', // 主办部门ID
       drillExpense: '', // 演练经费
       drillLevel: '', //演练级别
@@ -240,26 +246,19 @@
       remark: '', // 备注
       purpose: '', // 演练目的
       fileList: [
-        {
-          fileName: 'name',
-          fileUrl: 'url',
-        }
       ],
       userList: [
-        {
-          userUid: '',
-          type: 1
-        },
-        {
-          userUid: '',
-          type: 2
-        }
-      ]
+      ],
+      chargeUserList:[],
+      userListString:'',//演练人员字段(回填使用)
+      chargeUserListString:'',//演练负责人字段(回填使用)
     });
     const titles = ref();
     const disabled = ref();
     // 打开弹窗
     const openDialog = (title: string, id: number, type: boolean) => {
+      ruleForm.value.makingUserUid = Session.get('uid');
+      ruleForm.value.makingUserName = Session.get('realName');
       isShowDialog.value = true;
       titles.value = title;
       disabled.value = type;
@@ -269,6 +268,20 @@
             .then((res) => {
               if (res.data.code == 200) {
                 ruleForm.value = res.data.data;
+                ruleForm.value.userListString=''
+                ruleForm.value.chargeUserListString=''
+                for(var a = 0;a<res.data.data.userList.length;a++){
+                  if(res.data.data.userList[a].type==1){
+                    ruleForm.value.userListString += res.data.data.userList[a].userName+';'
+                  }
+                  // if(res.data.data.userList[a].type==2){
+                  //   ruleForm.value.chargeUserListString += res.data.data.userList[a].userName+';'
+                  // }
+                }
+                // alert(res.data.data.chargeUserList.length)
+                for(var a = 0;a<res.data.data.chargeUserList.length;a++){
+                  ruleForm.value.chargeUserListString += res.data.data.chargeUserList[a].userName+';'
+                }
               }
             });
       }
@@ -280,74 +293,6 @@
     // 可选择树
     const treeSelect = ref()
     const tree = [
-      {
-        value: '1',
-        label: 'Level one 1',
-        children: [
-          {
-            value: '11',
-            label: 'Level two 1-1',
-            children: [
-              {
-                value: '111',
-                label: 'Level three 1-1-1',
-              },
-            ],
-          },
-        ],
-      },
-      {
-        value: '2',
-        label: 'Level one 2',
-        children: [
-          {
-            value: '22',
-            label: 'Level two 2-1',
-            children: [
-              {
-                value: '222',
-                label: 'Level three 2-1-1',
-              },
-            ],
-          },
-          {
-            value: '223',
-            label: 'Level two 2-2',
-            children: [
-              {
-                value: '2233',
-                label: 'Level three 2-2-1',
-              },
-            ],
-          },
-        ],
-      },
-      {
-        value: '3',
-        label: 'Level one 3',
-        children: [
-          {
-            value: '33',
-            label: 'Level two 3-1',
-            children: [
-              {
-                value: '3333',
-                label: 'Level three 3-1-1',
-              },
-            ],
-          },
-          {
-            value: '3334',
-            label: 'Level two 3-2',
-            children: [
-              {
-                value: '333',
-                label: 'Level three 3-2-1',
-              },
-            ],
-          },
-        ],
-      },
     ]
     //部门树
     const department = () => {
@@ -374,6 +319,7 @@
     });
     // 表单提交验证必填项
     const submitForm = async (title: string, formEl: FormInstance | undefined) => {
+      ruleForm.value.userList = ruleForm.value.userList.concat(ruleForm.value.chargeUserList)
       if (title == '新建应急演练计划发布') {
         if (!formEl) return;
         await formEl.validate((valid, fields) => {
@@ -440,6 +386,7 @@
           makingUserUid: '', //计划制定人ID
           makingDepartmentId: '', // 计划制定部门ID
           planId: '', // 应急预案ID
+          planName: '', // 应急预案name
           departmentId: '', // 主办部门ID
           drillExpense: '', // 演练经费
           drillLevel: '', //演练级别
@@ -450,27 +397,42 @@
           remark: '', // 备注
           purpose: '', // 演练目的
           fileList: [
-            {
-              fileName: 'name',
-              fileUrl: 'url',
-            }
           ],
           userList: [
-            {
-              userUid: '',
-              type: 1
-            },
-            {
-              userUid: '',
-              type: 2
-            }
-          ]
+          ],
+          chargeUserList:[],
+          userListString:'',//演练人员字段(回填使用)
+          chargeUserListString:'',//演练负责人字段(回填使用)
         };
       }
     }
     const resetForm = (formEl: FormInstance | undefined) => {
       isShowDialog.value = false;
       if (!formEl) return;
+      ruleForm.value = {
+        makingPlanDate: '', // 计划制定日期
+        drillPlanDate: '', //计划演练日期
+        makingUserUid: '', //计划制定人ID
+        makingDepartmentId: '', // 计划制定部门ID
+        planId: '', // 应急预案ID
+        planName: '', // 应急预案name
+        departmentId: '', // 主办部门ID
+        drillExpense: '', // 演练经费
+        drillLevel: '', //演练级别
+        drillAddress: '', //演练地点
+        drillName: '', // 演练名称
+        drillWay: '', // 演练方式
+        insuranceMeasures: '', // 保险措施
+        remark: '', // 备注
+        purpose: '', // 演练目的
+        fileList: [
+        ],
+        userList: [
+        ],
+        chargeUserList:[],
+        userListString:'',//演练人员字段(回填使用)
+        chargeUserListString:'',//演练负责人字段(回填使用)
+      };
       formEl.resetFields();
     };
     // 应急队伍弹窗
@@ -480,14 +442,53 @@
     }
     const onUser = (e:any) => {
       ruleForm.value.planId=e.id
+      ruleForm.value.planName=e.name
     };
     // 打开用户选择弹窗
     const userRef = ref();
-    const openUser = () => {
-      userRef.value.openDialog();
+    const userFZRef = ref();
+    //打开演练人员和演练负责人弹窗  type 0 演练人员  1 演练负责人
+    const openUser = (type:number) => {
+      if(type==0){
+        userRef.value.openDailog(0);
+      }else if(type==1){
+        userFZRef.value.openDailog(0);
+      }
+    };
+    const SearchUser = (e:any) => {
+      console.log('演练人员',e)
+      ruleForm.value.userListString=''
+      ruleForm.value.userList=[]
+      for(var a = 0;a<e.length;a++){
+        ruleForm.value.userList.push(
+          {
+            type: 1,
+            userName: e[a].realName,
+            userUid: e[a].uid,
+          }
+        )
+        ruleForm.value.userListString+=e[a].realName+';'
+      }
+
+    };
+    const SearchFZUser = (e:any) => {
+      console.log('演练负责人员',e[0].userName)
+      ruleForm.value.chargeUserListString=''
+      ruleForm.value.chargeUserList=[]
+      // ruleForm.value.chargeUserList = []
+      for(var a = 0;a<e.length;a++){
+        ruleForm.value.chargeUserList.push(
+          {
+            type: 2,
+            userName: e[a].realName,
+            userUid: e[a].uid,
+          }
+        )
+        ruleForm.value.chargeUserListString+=e[a].realName+';'
+      }
     };
     // 计划定制日期
-    const datetime = ref('')
+    const datetime = ref('');
     //全屏
     const full = ref(false);
     const toggleFullscreen = () => {
@@ -525,6 +526,9 @@
       resetForm,
       emit,
       onUser,
+      userFZRef,
+      SearchUser,
+      SearchFZUser
     };
   },
 });

--
Gitblit v1.9.2