shj
2022-08-09 c64c8f43ec1a3d88feb1f915fd488040b6358e7d
src/views/contingencyManagement/contingency/component/addEmergencyPersonnel.vue
@@ -20,10 +20,9 @@
          <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
            <el-form-item label="选择人员" prop="name">
              <el-input
                  v-model="ruleForm.name"
                  v-model="ruleForm.userName"
                  placeholder="请选择"
                  class="input-with-select"
                  disabled
              >
                <template #append>
                  <el-button :icon="Search" @click="openUser"/>
@@ -90,7 +89,7 @@
  FullScreen,
} from '@element-plus/icons-vue'
import DailogSearchUserManger from "/@/components/DailogSearchUserManger/index.vue"
import {contingencyApi} from "/@/api/contingency";
import {contingencyApi} from "/@/api/contingencyManagement/contingency";
export default defineComponent({
  name: 'addTeamLeader',
@@ -104,6 +103,7 @@
    const ruleForm = ref ({
      teamId: '',
      userUid: '',
      userName:'',
      gender: '',
      jobNumber: '', // 人员工号
      name: '', // 人员名称
@@ -154,78 +154,6 @@
      emit('myAdd', ruleForm.value);
      formEl.resetFields();
    }
    // const submitForm = async (title: string, formEl: FormInstance | undefined) => {
    //   if (title == '新建应急队伍人员') {
    //     if (!formEl) return;
    //     await formEl.validate((valid, fields) => {
    //       if (valid) {
    //         isShowDialog.value = false;
    //         contingencyApi()
    //             .addEmergencyTeamPersonnel(ruleForm.value)
    //             .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);
    //               }
    //               formEl.resetFields();
    //             });
    //       } else {
    //         console.log('error submit!', fields);
    //       }
    //     });
    //   }
    //   else if (title == '修改应急队伍人员') {
    //     if (!formEl) return;
    //     await formEl.validate((valid, fields) => {
    //       if (valid) {
    //         isShowDialog.value = false;
    //         contingencyApi()
    //             .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 = {
    //       teamId: '',
    //       userUid: 1,
    //       gender: '',
    //       jobNumber: '', // 人员工号
    //       name: '', // 人员名称
    //       phone: '', // 手机号码
    //       position: '', // 职位
    //     };
    //   }
    // }
    const submitForm = async (title: string, formEl: FormInstance | undefined) => {
      if (title == '新建应急队伍人员') {
        if (!formEl) return;
@@ -292,6 +220,7 @@
        ruleForm.value = {
          teamId: '',
          userUid: '',
          userName:'',
          gender: '',
          jobNumber: '', // 人员工号
          name: '', // 人员名称
@@ -330,7 +259,12 @@
    };
    const onUser = (e:any) => {
      ruleForm.value.userUid=e[0].uid
      ruleForm.value.name=e[0].realName
      ruleForm.value.userName=e[0].realName
      ruleForm.value.gender=e[0].sex
      ruleForm.value.name=e[0].username
      ruleForm.value.jobNumber=e[0].jobNumber
      ruleForm.value.phone=e[0].phone
      ruleForm.value.position=e[0].position
    };
    //全屏
    const full = ref(false);