From 3173c73267ba584d72c7862ab159392c5d372216 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期二, 23 七月 2024 15:25:29 +0800
Subject: [PATCH] bug修改

---
 src/layout/components/Register/index.vue                                   |    4 
 src/views/safetyReview/expertManage/fillForm/index.vue                     |   58 ++++----
 src/views/safetyReview/projectManage/components/confirmEndDialog.vue       |   40 +++--
 src/views/safetyReview/userManage/expertUsers/components/expertDialog.vue  |   75 +++++-----
 src/views/safetyReview/expertManage/applyRecords/components/expertForm.vue |   60 ++++----
 src/views/safetyReview/projectManage/components/projectArchive.vue         |   12 +
 src/views/safetyReview/projectManage/components/siteCheckRcd.vue           |   27 ++-
 src/views/safetyReview/projectManage/components/processCtrlReview.vue      |   54 ++++---
 src/views/safetyReview/projectManage/components/uploadReviewRcd.vue        |   57 ++++---
 9 files changed, 206 insertions(+), 181 deletions(-)

diff --git a/src/layout/components/Register/index.vue b/src/layout/components/Register/index.vue
index e419bde..9b2590f 100644
--- a/src/layout/components/Register/index.vue
+++ b/src/layout/components/Register/index.vue
@@ -664,6 +664,9 @@
 }
 
 const handleRemove = async (file, uploadFiles,type) => {
+  if(file && file.status == 'success'){
+
+
   let path = '';
   if(type === '上报表'){
     path = state.registerForm.agency.reportPath;
@@ -682,6 +685,7 @@
       message: res.message
     })
   }
+  }
 }
 
 function handleRegister() {
diff --git a/src/views/safetyReview/expertManage/applyRecords/components/expertForm.vue b/src/views/safetyReview/expertManage/applyRecords/components/expertForm.vue
index 32790b9..5e88339 100644
--- a/src/views/safetyReview/expertManage/applyRecords/components/expertForm.vue
+++ b/src/views/safetyReview/expertManage/applyRecords/components/expertForm.vue
@@ -641,35 +641,37 @@
   }
 
   const handleRemove = (file, uploadFiles,type) => {
-    ElMessageBox.confirm(
-        '该操作将永久删除此文件内容,是否继续?',
-        '提示',
-        {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning',
-        })
-        .then(async() => {
-          let path = ''
-          if(type == '证件照'){
-            path = state.form.electronicPhoto
-          }else{
-            path = file.name
-          }
-          const res = await delPic({path: path})
-          if(res.code == 200){
-            ElMessage({
-              type: 'success',
-              message: '文件已删除'
-            })
-            state.hasDeleteFile = true
-          }else{
-            ElMessage({
-              type: 'warning',
-              message: res.message
-            })
-          }
-        })
+    if(file && file.status == 'success') {
+      ElMessageBox.confirm(
+          '该操作将永久删除此文件内容,是否继续?',
+          '提示',
+          {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning',
+          })
+          .then(async () => {
+            let path = ''
+            if (type == '证件照') {
+              path = state.form.electronicPhoto
+            } else {
+              path = file.name
+            }
+            const res = await delPic({path: path})
+            if (res.code == 200) {
+              ElMessage({
+                type: 'success',
+                message: '文件已删除'
+              })
+              state.hasDeleteFile = true
+            } else {
+              ElMessage({
+                type: 'warning',
+                message: res.message
+              })
+            }
+          })
+    }
   }
 
 const onSubmit = async (formEl)=> {
diff --git a/src/views/safetyReview/expertManage/fillForm/index.vue b/src/views/safetyReview/expertManage/fillForm/index.vue
index 2e08534..543b20b 100644
--- a/src/views/safetyReview/expertManage/fillForm/index.vue
+++ b/src/views/safetyReview/expertManage/fillForm/index.vue
@@ -498,34 +498,36 @@
   }
 
   const handleRemove = (file, uploadFiles,type) => {
-    ElMessageBox.confirm(
-        '该操作将永久删除此文件内容,是否继续?',
-        '提示',
-        {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning',
-        })
-        .then(async() => {
-          let path = ''
-          if(type == '证件照'){
-            path = state.form.electronicPhoto
-          }else{
-            path = file.name
-          }
-          const res = await delPic({path: path})
-          if(res.code == 200){
-            ElMessage({
-              type: 'success',
-              message: '文件已删除'
-            })
-          }else{
-            ElMessage({
-              type: 'warning',
-              message: res.message
-            })
-          }
-        })
+    if(file && file.status == 'success') {
+      ElMessageBox.confirm(
+          '该操作将永久删除此文件内容,是否继续?',
+          '提示',
+          {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning',
+          })
+          .then(async () => {
+            let path = ''
+            if (type == '证件照') {
+              path = state.form.electronicPhoto
+            } else {
+              path = file.name
+            }
+            const res = await delPic({path: path})
+            if (res.code == 200) {
+              ElMessage({
+                type: 'success',
+                message: '文件已删除'
+              })
+            } else {
+              ElMessage({
+                type: 'warning',
+                message: res.message
+              })
+            }
+          })
+    }
   }
 
 const onSubmit = async (formEl)=> {
diff --git a/src/views/safetyReview/projectManage/components/confirmEndDialog.vue b/src/views/safetyReview/projectManage/components/confirmEndDialog.vue
index cdb3bbc..9638674 100644
--- a/src/views/safetyReview/projectManage/components/confirmEndDialog.vue
+++ b/src/views/safetyReview/projectManage/components/confirmEndDialog.vue
@@ -185,25 +185,29 @@
   }
 }
 const handleRemove = async (file, uploadFiles) => {
-  console.log("file",file)
-  let accessoryFileId = "";
-  if(file.id){
-    accessoryFileId = file.id
-  }else {
-    accessoryFileId = file.response.data.id
+  if(file && file.status == 'success') {
 
-  }
-  const res = await delAccessoryFile(accessoryFileId)
-  if(res.code == 200){
-    ElMessage({
-      type: 'success',
-      message: '文件已删除'
-    })
-  }else{
-    ElMessage({
-      type: 'warning',
-      message: res.message
-    })
+
+    console.log("file", file)
+    let accessoryFileId = "";
+    if (file.id) {
+      accessoryFileId = file.id
+    } else {
+      accessoryFileId = file.response.data.id
+
+    }
+    const res = await delAccessoryFile(accessoryFileId)
+    if (res.code == 200) {
+      ElMessage({
+        type: 'success',
+        message: '文件已删除'
+      })
+    } else {
+      ElMessage({
+        type: 'warning',
+        message: res.message
+      })
+    }
   }
 }
 
diff --git a/src/views/safetyReview/projectManage/components/processCtrlReview.vue b/src/views/safetyReview/projectManage/components/processCtrlReview.vue
index 4cd1243..f135f03 100644
--- a/src/views/safetyReview/projectManage/components/processCtrlReview.vue
+++ b/src/views/safetyReview/projectManage/components/processCtrlReview.vue
@@ -318,32 +318,34 @@
 }
 
 const handleRemove = async (file, uploadFile) => {
-  ElMessageBox.confirm(
-      '确定删除该附件?',
-      '提示',
-      {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning',
-      })
-      .then( async() => {
-        const res = await delFile(file.id)
-        if(res.code == 200){
-          ElMessage({
-            type: 'success',
-            message: '文件已删除'
-          })
-          await getProcessFiles()
-        }else{
-          ElMessage({
-            type: 'warning',
-            message: res.message
-          })
-        }
-      })
-      .catch(()=>{
-        getProcessFiles()
-      })
+  if(file && file.status == 'success') {
+    ElMessageBox.confirm(
+        '确定删除该附件?',
+        '提示',
+        {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning',
+        })
+        .then(async () => {
+          const res = await delFile(file.id)
+          if (res.code == 200) {
+            ElMessage({
+              type: 'success',
+              message: '文件已删除'
+            })
+            await getProcessFiles()
+          } else {
+            ElMessage({
+              type: 'warning',
+              message: res.message
+            })
+          }
+        })
+        .catch(() => {
+          getProcessFiles()
+        })
+  }
 }
 
 defineExpose({
diff --git a/src/views/safetyReview/projectManage/components/projectArchive.vue b/src/views/safetyReview/projectManage/components/projectArchive.vue
index 5dc2e13..4175ebb 100644
--- a/src/views/safetyReview/projectManage/components/projectArchive.vue
+++ b/src/views/safetyReview/projectManage/components/projectArchive.vue
@@ -350,27 +350,29 @@
 }
 
 const handleRemove = async (file, uploadFiles) => {
-  console.log("file",file)
+  if (file && file.status == 'success') {
+  console.log("file", file)
   let accessoryFileId = "";
-  if(file.id){
+  if (file.id) {
     accessoryFileId = file.id
-  }else {
+  } else {
     accessoryFileId = file.response.data.id
 
   }
   const res = await delAccessoryFile(accessoryFileId)
-  if(res.code == 200){
+  if (res.code == 200) {
     // ElMessage({
     //   type: 'success',
     //   message: '文件已删除'
     // })
-  }else{
+  } else {
     ElMessage({
       type: 'warning',
       message: res.message
     })
   }
 }
+}
 
 defineExpose({
   riskOpen
diff --git a/src/views/safetyReview/projectManage/components/siteCheckRcd.vue b/src/views/safetyReview/projectManage/components/siteCheckRcd.vue
index 9ec1e3e..b752ba4 100644
--- a/src/views/safetyReview/projectManage/components/siteCheckRcd.vue
+++ b/src/views/safetyReview/projectManage/components/siteCheckRcd.vue
@@ -614,7 +614,7 @@
 }
 
 const handleRemove = async (file, uploadFiles,type) => {
-
+  if(file && file.status == 'success') {
     ElMessageBox.confirm(
         '确定删除该附件?',
         '提示',
@@ -623,39 +623,39 @@
           cancelButtonText: '取消',
           type: 'warning',
         })
-        .then( async() => {
+        .then(async () => {
           const res = await delFile(file.id)
-          if(res.code == 200){
+          if (res.code == 200) {
             ElMessage({
               type: 'success',
               message: '文件已删除'
             })
-            if(type == 1){
+            if (type == 1) {
               const index = state.formData.deviceImages.findIndex(v => v.id === file.id)
-              state.formData.deviceImages.splice(index,1);
+              state.formData.deviceImages.splice(index, 1);
 
             }
-            if(type == 2){
+            if (type == 2) {
               const index = state.formData.investingationImages.findIndex(v => v.id === file.id)
-              state.formData.investingationImages.splice(index,1);
+              state.formData.investingationImages.splice(index, 1);
 
             }
-            if(type == 3){
+            if (type == 3) {
               const index = state.formData.companyImages.findIndex(v => v.id === file.id)
-              state.formData.companyImages.splice(index,1);
+              state.formData.companyImages.splice(index, 1);
             }
-            if(type == 5){
+            if (type == 5) {
               const index = state.formData.assAccessoryFiles.findIndex(v => v.id === file.id)
-              state.formData.assAccessoryFiles.splice(index,1);
+              state.formData.assAccessoryFiles.splice(index, 1);
             }
-          }else{
+          } else {
             ElMessage({
               type: 'warning',
               message: res.message
             })
           }
         })
-        .catch(()=>{
+        .catch(() => {
           // if(type == 1){
           //   getBeforeFiles()
           // }
@@ -669,6 +669,7 @@
           //   getSafetyFiles()
           // }
         })
+  }
 
 }
 
diff --git a/src/views/safetyReview/projectManage/components/uploadReviewRcd.vue b/src/views/safetyReview/projectManage/components/uploadReviewRcd.vue
index 7df918f..e528f9b 100644
--- a/src/views/safetyReview/projectManage/components/uploadReviewRcd.vue
+++ b/src/views/safetyReview/projectManage/components/uploadReviewRcd.vue
@@ -7,7 +7,7 @@
             <el-upload :disabled="projectType === 'view' || isEnd" accept="image/*,.pdf,.doc,.docx" :action="state.uploadUrl" :data="{moduleType: 6,projectId: props.projectId}" :headers="state.header" method="post" :on-success="handleAvatarSuccess" :on-exceed="showTip" v-model:file-list="state.fileList" :before-upload="picSize" :on-remove="handleRemove">
               <el-button type="primary">上传评审记录</el-button>
               <template #tip>
-                <div class="el-upload__tip">上传文件尺寸尺寸小于2M</div>
+                <div class="el-upload__tip">上传文件尺寸尺寸小于5M</div>
               </template>
             </el-upload>
           </el-form-item>
@@ -177,32 +177,35 @@
 }
 
 const handleRemove = async (file, uploadFiles) => {
-  ElMessageBox.confirm(
-      '确定删除该附件?',
-      '提示',
-      {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning',
-      })
-      .then( async() => {
-        const res = await delFile(file.id)
-        if(res.code == 200){
-          ElMessage({
-            type: 'success',
-            message: '文件已删除'
-          })
-          await getReviewFiles()
-        }else{
-          ElMessage({
-            type: 'warning',
-            message: res.message
-          })
-        }
-      })
-      .catch(()=>{
-        getReviewFiles()
-      })
+  if(file && file.status == 'success'){
+    ElMessageBox.confirm(
+        '确定删除该附件?',
+        '提示',
+        {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning',
+        })
+        .then( async() => {
+          const res = await delFile(file.id)
+          if(res.code == 200){
+            ElMessage({
+              type: 'success',
+              message: '文件已删除'
+            })
+            await getReviewFiles()
+          }else{
+            ElMessage({
+              type: 'warning',
+              message: res.message
+            })
+          }
+        })
+        .catch(()=>{
+          getReviewFiles()
+        })
+  }
+
 }
 
 const checkFile = async (file)=>{
diff --git a/src/views/safetyReview/userManage/expertUsers/components/expertDialog.vue b/src/views/safetyReview/userManage/expertUsers/components/expertDialog.vue
index 0948596..45aebc7 100644
--- a/src/views/safetyReview/userManage/expertUsers/components/expertDialog.vue
+++ b/src/views/safetyReview/userManage/expertUsers/components/expertDialog.vue
@@ -671,23 +671,24 @@
 }
 
 const handlePhotoRemove = async (file) => {
+  if (file && file.status == 'success') {
   // state.form.idPhoto = ''
 
   let path = ""
-  if(file.response && file.response.data){
+  if (file.response && file.response.data) {
     path = file.response.data.path
-  }else {
+  } else {
     const base = import.meta.env.VITE_APP_BASE_API
-    path = file.url.substring(base.length+1,file.url.length )
+    path = file.url.substring(base.length + 1, file.url.length)
   }
   await delPic({path: path}).then(res => {
-    if(res.code == 200){
+    if (res.code == 200) {
       // ElMessage({
       //   type: 'success',
       //   message: '文件已删除'
       // })
       state.form.idPhoto = ''
-    }else{
+    } else {
       ElMessage({
         type: 'warning',
         message: res.message
@@ -696,6 +697,7 @@
   }).catch(() => {
     state.form.idPhoto = ''
   });
+}
 
 
   // const res = await delPic({path: path})
@@ -716,43 +718,46 @@
 
 
 const handleRemove = async (file, uploadFiles,type) => {
+  if(file && file.status == 'success') {
+
     let path = ""
-    if(state.title === '编辑') {
-        const base = import.meta.env.VITE_APP_BASE_API
-        path = file.url.substring(base.length+1,file.url.length )
-    }else {
-        path = file.response.data.path
+    if (state.title === '编辑') {
+      const base = import.meta.env.VITE_APP_BASE_API
+      path = file.url.substring(base.length + 1, file.url.length)
+    } else {
+      path = file.response.data.path
     }
 
-  await delPic({path: path}).then(res => {
-    if(res.code == 200){
-      // ElMessage({
-      //   type: 'success',
-      //   message: '文件已删除'
-      // })
-    }else{
-      ElMessage({
-        type: 'warning',
-        message: res.message
-      })
-    }
+    await delPic({path: path}).then(res => {
+      if (res.code == 200) {
+        // ElMessage({
+        //   type: 'success',
+        //   message: '文件已删除'
+        // })
+      } else {
+        ElMessage({
+          type: 'warning',
+          message: res.message
+        })
+      }
     }).catch(() => {
-    if(type === 1){
-      state.form.socialAttach = state.form.socialAttach.filter(item => item.path !== path)
-    }else if(type === 2){
-      state.form.medicalAttach = state.form.medicalAttach.filter(item => item.path !== path)
-    }else {
-      state.form.salaryAttach = state.form.salaryAttach.filter(item => item.path !== path)
-    }
+      if (type === 1) {
+        state.form.socialAttach = state.form.socialAttach.filter(item => item.path !== path)
+      } else if (type === 2) {
+        state.form.medicalAttach = state.form.medicalAttach.filter(item => item.path !== path)
+      } else {
+        state.form.salaryAttach = state.form.salaryAttach.filter(item => item.path !== path)
+      }
     });
 
-    if(type === 1){
-        state.form.socialAttach = state.form.socialAttach.filter(item => item.path !== path)
-    }else if(type === 2){
-        state.form.medicalAttach = state.form.medicalAttach.filter(item => item.path !== path)
-    }else {
-        state.form.salaryAttach = state.form.salaryAttach.filter(item => item.path !== path)
+    if (type === 1) {
+      state.form.socialAttach = state.form.socialAttach.filter(item => item.path !== path)
+    } else if (type === 2) {
+      state.form.medicalAttach = state.form.medicalAttach.filter(item => item.path !== path)
+    } else {
+      state.form.salaryAttach = state.form.salaryAttach.filter(item => item.path !== path)
     }
+  }
 }
 const finshed = ref(false)
 const getAgency = async (type) => {

--
Gitblit v1.9.2