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/views/safetyReview/userManage/expertUsers/components/expertDialog.vue |   75 ++++++++++++++++++++-----------------
 1 files changed, 40 insertions(+), 35 deletions(-)

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