lct
Your Name
2022-08-15 87edc55a377c3fca459ab48010a9716b0311c4a8
src/views/accidentManagementSystem/workInjuryDeclaration/component/openAdd.vue
@@ -81,7 +81,8 @@
               </el-col>
               <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
                  <el-form-item label="相关附件">
                     <uploaderImg :fileList="fileList" :disabled="disabled"></uploaderImg>
                     <uploaderImg :fileList="fileList" :name="INCIDENT_MANAGE"
                               @successUploader="successUploader" :disabled="disabled"></uploaderImg>
                  </el-form-item>
               </el-col>
               <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
@@ -184,10 +185,35 @@
               .then((res) => {
                  if (res.data.code == 200) {
                     ruleForm.value = res.data.data;
                     fileList.value = (res.data.data.fileList?res.data.data.fileList:[])
                     initFileListData()
                  }
               });
         }
      };
      const initFileListData = async () => {
         for(var a = 0;a<fileList.value.length;a++){
            await goalManagementApi()
                  .searchFile(fileList.value[a].fileName)
                  .then((res) => {
                     fileList.value[a].url = res.data
                  })
         }
      }
      // 上传成功组装数据
      const successUploader = (list) =>{
         fileList.value = list
         const formFileList = []
         for(var a = 0;a<fileList.value.length;a++){
            formFileList.push(
                  {
                     fileName:fileList.value[a].fileName,
                     fileUrl:''
                  }
            )
         }
         ruleForm.value.fileList = formFileList
      }
      //日期选择器
      const value1 = ref('');
      // 上传附件
@@ -241,6 +267,7 @@
      // 关闭弹窗
      const closeDialog = (formEl: FormInstance | undefined) => {
         formEl.resetFields();
         fileList.value=[]
         isShowDialog.value = false;
      };
      // 必填项提示
@@ -346,12 +373,14 @@
      };
      // 表单提交验证必填项
      const submitForm = async (title: string, formEl: FormInstance | undefined) => {
         if(!ruleForm.value.fileList){
            ruleForm.value.fileList = []
         }
         if (title == '新建工伤申报') {
            if (!formEl) return;
            await formEl.validate((valid, fields) => {
               if (valid) {
                  isShowDialog.value = false;
                  ruleForm.value.fileList=[]
                  delete ruleForm.value.accidentName
                  delete ruleForm.value.occurrenceTime
                  delete ruleForm.value.id
@@ -384,7 +413,6 @@
            await formEl.validate((valid, fields) => {
               if (valid) {
                  isShowDialog.value = false;
                  ruleForm.value.fileList=[]
                  delete ruleForm.value.accidentName
                  delete ruleForm.value.occurrenceTime
                  accidentManagementSystemApi()
@@ -491,7 +519,9 @@
         newTreeList,
         propse,
         closeDialog,
         uploaderImg
         uploaderImg,
         successUploader,
         initFileListData
      };
   },
});