zhaojiale
2022-08-04 aeef44031f90e5a7b0cb05da884b38f5047e7d21
src/views/contingencyManagement/panManagement/component/openAdd.vue
@@ -48,8 +48,8 @@
          <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
            <el-form-item label="危险源关联" prop="associatedDanger">
              <el-select v-model="ruleForm.associatedDanger" class="w100" placeholder="请选择">
                <el-option :label="true">是</el-option>
                <el-option :label="false">否</el-option>
                <el-option label="是" :value="false"></el-option>
                <el-option label="否" :value="true"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
@@ -65,7 +65,7 @@
          <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
            <el-form-item label="编写人" prop="authorId" >
              <el-input
                  v-model="ruleForm.authorId"
                  v-model="ruleForm.authorUid"
                  placeholder="请选择"
                  class="input-with-select"
              >
@@ -130,19 +130,19 @@
              </el-upload>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
            <el-form-item label="区域名称" prop="areaName">
              <el-input
                  v-model="ruleForm.areaName"
                  placeholder="请选择"
                  class="input-with-select"
              >
                <template #append>
                  <el-button :icon="Search" @click="regionsDialog"/>
                </template>
              </el-input>
            </el-form-item>
          </el-col>
<!--          <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">-->
<!--            <el-form-item label="区域名称" prop="areaName">-->
<!--              <el-input-->
<!--                  v-model="ruleForm.areaName"-->
<!--                  placeholder="请选择"-->
<!--                  class="input-with-select"-->
<!--              >-->
<!--                <template #append>-->
<!--                  <el-button :icon="Search" @click="regionsDialog"/>-->
<!--                </template>-->
<!--              </el-input>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
        </el-row>
      </el-form>
      <template #footer>
@@ -179,6 +179,8 @@
import RegionsDialog from '/@/components/regionsDialog/index.vue'
import {emergencyPlanApi} from "/@/api/emergencyPlan";
import {goalManagementApi} from "/@/api/goalManagement";
import {emergencyPlanLogApi} from "/@/api/emergencyPlanLog";
import {contingencyApi} from "/@/api/contingency";
export default defineComponent({
  name: 'openAdd',
@@ -195,7 +197,7 @@
      type: '', //预案类型
      associatedDanger: '', // 危险源关联
      level: '', // 预案级别
      authorId: '', // 编写人
      authorUid: '', // 编写人
      authorDeptId: '', // 编写部门
      releaseDate: '', // 发布实施日期
      fileList: [
@@ -230,6 +232,15 @@
      isShowDialog.value = true;
      titles.value = title;
      disabled.value = type;
      if (title == '查看应急预案管理' || title == '修改应急预案管理') {
        emergencyPlanApi()
            .seeEmergencyTeam(id)
            .then((res) => {
              if (res.data.code == 200) {
                ruleForm.value = res.data.data;
              }
            });
      }
    };
    //日期选择器
    const releaseDate = ref('')
@@ -257,76 +268,6 @@
    onMounted(() => {
      department();
    });
    // 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: '21',
    //         label: 'Level two 2-1',
    //         children: [
    //           {
    //             value: '211',
    //             label: 'Level three 2-1-1',
    //           },
    //         ],
    //       },
    //       {
    //         value: '22',
    //         label: 'Level two 2-2',
    //         children: [
    //           {
    //             value: '221',
    //             label: 'Level three 2-2-1',
    //           },
    //         ],
    //       },
    //     ],
    //   },
    //   {
    //     value: '3',
    //     label: 'Level one 3',
    //     children: [
    //       {
    //         value: '31',
    //         label: 'Level two 3-1',
    //         children: [
    //           {
    //             value: '311',
    //             label: 'Level three 3-1-1',
    //           },
    //         ],
    //       },
    //       {
    //         value: '32',
    //         label: 'Level two 3-2',
    //         children: [
    //           {
    //             value: '321',
    //             label: 'Level three 3-2-1',
    //           },
    //         ],
    //       },
    //     ],
    //   },
    // ]
    //定义树形下拉框
    const responsibleDepartment = ref()
    const data = ref();
@@ -362,6 +303,69 @@
          }
        })
      }
      else if (title == '修改应急预案管理') {
        if (!formEl) return;
        await formEl.validate((valid, fields) => {
          if (valid) {
            isShowDialog.value = false;
            emergencyPlanApi()
                .editEmergencyTeam(ruleForm.value)
                .then((res) => {
                  if (res.data.code == 200) {
                    ElMessage({
                      showClose: true,
                      message: '修改成功',
                      type: 'success',
                    });
                    emit('myAdd', true);
                  } else {
                    ElMessage({
                      showClose: true,
                      message: res.data.msg,
                      type: 'error',
                    });
                    emit('myAdd', true);
                  }
                  formEl.resetFields();
                });
          } else {
            console.log('error submit!', fields);
          }
        });
        formEl.resetFields();
        ruleForm.value = {
          name: '', // 预案名称
          type: '', //预案类型
          associatedDanger: '', // 危险源关联
          level: '', // 预案级别
          authorUid: '', // 编写人
          authorDeptId: '', // 编写部门
          releaseDate: '', // 发布实施日期
          fileList: [
            {
              fileUrl: 'url',
              fileName: 'name',
            }
          ],
          emergencyTeam: '', //应急队伍
          areaList: [
            {
              areaId: '',
            }
          ],  //区域列表
          areaName: '',  //区域名称
          teamList: [
            {
              teamId: '',
            }
          ],
          deptList: [
            {
              departmentId: '',
            }
          ]
        };
      }
    };
    const resetForm = (formEl: FormInstance | undefined) => {
      isShowDialog.value = false;
@@ -384,7 +388,7 @@
      userRef.value.openDailog();
    };
    const onUser = (e:any) => {
      ruleForm.value.authorId=e.id
      ruleForm.value.authorUid=e.uid
    };
    //全屏
    const full = ref(false);