马宇豪
2023-04-21 754f2fa9c8076a5d13ad7476eb9bc5984f78c99c
src/views/experiment/developing/components/developDialog.vue
@@ -230,6 +230,7 @@
import SelectRoom from "/@/views/experiment/project/components/selectRoom.vue";
import {useUserInfo} from "/@/stores/userInfo";
import {storeToRefs} from "pinia";
import {checkChineseName, verifyPhone} from "/@/utils/toolsValidate";
const SelectEquipment = defineAsyncComponent(() => import('../../project/components/selectEquipment.vue'))
const SelectMaterial = defineAsyncComponent(() => import('../../project/components/selectMaterial.vue'))
const SelectDanger = defineAsyncComponent(() => import('../../project/components/selectDanger.vue'))
@@ -397,6 +398,62 @@
    ProjectFormRef.value.validate(async(valid: boolean) => {
        if(valid){
            if(projectDialogState.title === '新增'){
                if(checkChineseName(projectDialogState.projectForm.safeLiabilityUser) == false){
                  ElMessage({
                    type: 'warning',
                    message: '安全负责人姓名格式有误',
                    duration: 1000
                  });
                  return
                }
                if(verifyPhone(projectDialogState.projectForm.safeLiabilityUserPhone) == false || verifyPhone(projectDialogState.projectForm.liabilityUserPhone) == false){
                  ElMessage({
                    type: 'warning',
                    message: '请输入正确的手机号',
                    duration: 1000
                  });
                  return
                }
                if(projectDialogState.projectForm.siteList.length === 0){
                  ElMessage({
                    type: 'warning',
                    message: '请至少添加一处实验场所',
                    duration: 1000
                  });
                  return
                }
                if(projectDialogState.projectForm.stuffList.length === 0){
                  ElMessage({
                    type: 'warning',
                    message: '请至少选择一种试剂/材料',
                    duration: 1000
                  });
                  return
                }
                if(projectDialogState.projectForm.deviceList.length === 0){
                  ElMessage({
                    type: 'warning',
                    message: '请至少选择一种仪器/设备',
                    duration: 1000
                  });
                  return
                }
                if(projectDialogState.projectForm.hazardousWasteList.length === 0){
                  ElMessage({
                    type: 'warning',
                    message: '请选择添加危废数据',
                    duration: 1000
                  });
                  return
                }
                if(projectDialogState.projectForm.persons.length === 0){
                  ElMessage({
                    type: 'warning',
                    message: '请至少添加一名实验人员',
                    duration: 1000
                  });
                  return
                }
                projectDialogState.projectForm.persons = selectPersonRef.value.dataList
                projectDialogState.projectForm.hazardousWasteList = selectDangerRef.value.dataList
                projectDialogState.projectForm.siteList = selectRoomRef.value.dataList.map(({siteId}) => ({siteId}))
@@ -445,12 +502,15 @@
const getPersonList = async () => {
    let res = await userApi().getUserList({
        roleId: 1,
        usePage: false,
        pageIndex: 1,
        pageSize: 10
        pageSize: 99999,
        searchParams:{
          roleId: null,
          name: '',
          realName: ''
        }
    });
    if(res.data.code === 100){
    if(res.data.code === 200){
        projectDialogState.systemPersonList = JSON.parse(JSON.stringify(res.data.data));
    }else{
        ElMessage({