From 137910cf4fc73a3a2787a3a02718f1e1f637c368 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期五, 14 六月 2024 16:01:17 +0800
Subject: [PATCH] bug修改

---
 src/views/safetyReview/projectManage/components/siteCheckRcd.vue |  611 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 532 insertions(+), 79 deletions(-)

diff --git a/src/views/safetyReview/projectManage/components/siteCheckRcd.vue b/src/views/safetyReview/projectManage/components/siteCheckRcd.vue
index 1230979..f5d5883 100644
--- a/src/views/safetyReview/projectManage/components/siteCheckRcd.vue
+++ b/src/views/safetyReview/projectManage/components/siteCheckRcd.vue
@@ -2,12 +2,25 @@
   <div class="riskBox">
     <el-form ref="formRef" :model="state.formData" :rules="state.rules" class="register-form" label-position="top">
       <el-row :gutter="30" style="margin-bottom: 20px">
-        <el-col :span="18">
+        <el-col :span="28">
           <el-alert title="说明:现场勘验记录由项目组成员通过APP端进行信息填报,组长完成现场勘验并在APP端提交后,电脑可对资料信息完善并进行下一步操作。" type="warning" />
         </el-col>
-        <el-col :span="6" style="display:flex;justify-content: right">
-          <el-button type="primary">全部查看</el-button>
-          <el-button type="primary">全部下载</el-button>
+<!--        <el-col :span="6" style="display:flex;justify-content: right">-->
+<!--          <el-button type="primary">全部查看</el-button>-->
+<!--          <el-button type="primary">全部下载</el-button>-->
+<!--        </el-col>-->
+      </el-row>
+      <el-row :gutter="30" style="margin-bottom: 30px" v-if="state.data.length>0">
+        <el-col :span="28">
+          <div style="display: flex;align-items: center">
+            <span style="font-size: 22px;font-weight: 600;margin-top: 10px;">记录编号:{{ chooseItem.index }}(提交时间:{{chooseItem.createTime}})</span>
+            <div style="display: flex;align-items: center;flex-wrap: wrap">
+              <div v-for="(item,index) in state.data">
+                <el-check-tag style="margin-left: 20px;margin-top:10px;cursor: pointer;padding: 15px 25px" :checked="chooseItem.id === item.id" size="large" @click="chooseRecord(item,index)">记录编号{{ index+1 }}</el-check-tag>
+              </div>
+            </div>
+          </div>
+
         </el-col>
       </el-row>
       <el-row :gutter="30">
@@ -15,7 +28,7 @@
           <el-form-item prop="investigationDate" label="现场勘验时间">
             <el-date-picker
                 style="width: 100%"
-                v-model="state.formData.investigationPlanDate"
+                v-model="state.formData.investigationDate"
                 type="date"
                 value-format="YYYY-MM-DD 00:00:00"
                 placeholder="选择日期"
@@ -24,12 +37,14 @@
           </el-form-item>
         </el-col>
         <el-col :span="12">
-          <el-form-item prop="investigationDate" label="现场勘验位置">
+          <el-form-item prop="location" label="现场勘验位置">
             <el-input
                 v-model="state.formData.location"
                 size="large"
                 placeholder="请填写现场勘验位置"
+                @focus="openLocation"
             >
+
               <template #append>
                 <el-button :icon="Search" @click="openLocation"/>
               </template>
@@ -38,71 +53,164 @@
         </el-col>
         <el-col :span="6">
           <el-form-item prop="isSafetyCheck" label="编制现场安全检查表">
-            <el-radio-group v-model="state.formData.isSafetyCheck" size="large">
-              <el-radio :label="true" size="large">是</el-radio>
-              <el-radio :label="false" size="large">否</el-radio>
+            <el-radio-group v-model="state.formData.isSafetyCheck" size="large" @change="changeRadio" :disabled="projectType==='view' || isEnd">
+              <el-radio :label="1" size="large">是</el-radio>
+              <el-radio :label="0" size="large">否</el-radio>
             </el-radio-group>
           </el-form-item>
         </el-col>
       </el-row>
       <el-row :gutter="30">
-        <el-col :span="6">
-          <el-form-item label="附件上传">
-            <el-upload accept="image/*" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="handleAvatarSuccess" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='state.imgLimit' v-model:file-list="state.fileList" list-type="picture-card" :before-upload="picSize" :on-remove="handleRemove" :before-remove="beforeRemove">
+        <el-col :span="24" v-if="state.formData.isSafetyCheck == 1">
+          <el-form-item label="安全检查表上传" prop="assAccessoryFiles">
+            <el-upload  :disabled="projectType==='view' || isEnd" accept="image/*,.pdf,.doc,.docx,.xlsx,.xls" :action="state.uploadUrl" :data="{moduleType: 5,projectId: props.projectId}" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile,5)" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='1' v-model:file-list="state.safetyList" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles,5)">
+              <el-button type="primary">附件上传</el-button>
+              <template #tip>
+                <div class="el-upload__tip">上传文件尺寸小于5M,最多可上传1份</div>
+              </template>
+            </el-upload>
+          </el-form-item>
+        </el-col>
+        <el-col :span="24" v-if="state.formData.isSafetyCheck == 0">
+          <el-form-item prop="recordData" label="现场勘验记录">
+            <el-input
+                v-model="state.formData.recordData"
+                :autosize="{ minRows: 6 }"
+                maxlength="200"
+                show-word-limit
+                type="textarea">
+            </el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row style="border: 1px dashed #999;border-radius: 4px;padding: 10px;margin-top: 20px">
+        <el-col :span="24">
+          <el-form-item label="主要装置前合影照片" prop="deviceImages">
+            <el-upload accept="image/*" :disabled="projectType === 'view' || isEnd" :action="state.uploadUrl" :data="{moduleType: 1,projectId: props.projectId}" list-type="picture-card" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile,1)" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='10' v-model:file-list="state.beforeDeviceList" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles,1)" >
               <el-icon><Plus /></el-icon>
               <template #tip>
-                <div class="el-upload__tip">上传jpg/png图片尺寸小于5M,最多可上传1张</div>
+                <div class="el-upload__tip">上传照片尺寸小于5M,最多可上传10张</div>
               </template>
             </el-upload>
           </el-form-item>
         </el-col>
       </el-row>
-      <el-form-item prop="recordData" label="现场勘验记录">
-        <el-input
-            v-model="state.formData.recordData"
-            :autosize="{ minRows: 6 }"
-            maxlength="200"
-            show-word-limit
-            type="textarea">
-        </el-input>
-      </el-form-item>
-      <el-form-item label="企业陪同照片">
-
-      </el-form-item>
+      <el-row style="border: 1px dashed #999;border-radius: 4px;padding: 10px;margin-top: 20px">
+        <el-col :span="24">
+          <el-form-item label="现场勘验照片" prop="investingationImages">
+            <el-upload accept="image/*" :disabled="projectType === 'view' || isEnd" :action="state.uploadUrl" :data="{moduleType: 2,projectId: props.projectId}" list-type="picture-card" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile,2)" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='10' v-model:file-list="state.siteCheckList" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles,2)" >
+              <el-icon><Plus /></el-icon>
+              <template #tip>
+                <div class="el-upload__tip">上传照片尺寸小于5M,最多可上传10张</div>
+              </template>
+            </el-upload>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row style="border: 1px dashed #999;border-radius: 4px;padding: 10px;margin-top: 20px;margin-bottom: 20px">
+        <el-col :span="24">
+          <el-form-item label="企业陪同人员照片" prop="companyImages">
+            <el-upload :disabled="projectType === 'view' || isEnd" accept="image/*" :action="state.uploadUrl" :data="{moduleType: 3,projectId: props.projectId}" list-type="picture-card" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile,3)" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='10' v-model:file-list="state.companyList" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles,3)" >
+              <el-icon><Plus /></el-icon>
+              <template #tip>
+                <div class="el-upload__tip">上传照片尺寸小于5M,最多可上传10张</div>
+              </template>
+            </el-upload>
+          </el-form-item>
+        </el-col>
+      </el-row>
     </el-form>
+    <el-dialog v-model="state.imgDialog">
+      <img style="width: 100%" :src="state.imgUrl" alt="Preview Image" />
+    </el-dialog>
     <map-location ref="mapLocationRef" @giveLatLng="achieveLatLng"></map-location>
   </div>
 </template>
 <script setup>
 
 import {defineEmits, onMounted, reactive, ref} from "vue"
-import {ElMessage} from "element-plus"
+import {ElMessage, ElMessageBox} from "element-plus"
 import {Search} from '@element-plus/icons-vue'
-import {addRisk, editRisk, getRiskDetail} from "@/api/projectManage/riskAnalysis"
-import {delPic} from "@/api/login"
+import {
+  addSiteCheck,
+  editSiteCheck,
+  getSiteCheckDetail,
+  delFile,
+  getFiles,
+  getDetailById, doSiteCheck
+} from "@/api/projectManage/siteCheckRcd";
 import { getToken } from "@/utils/auth";
 import Cookies from "js-cookie"
+import { useRoute } from 'vue-router'
+const route = useRoute()
+const props = defineProps(['projectId'])
 const emit = defineEmits(["getNextStatus"])
 import MapLocation from "./mapLocation.vue"
+const direction = ref('rtl');
+const size = ref('400px')
+const showDrawer = ref(false);
+let checkSafetyFiles = (rule, value, callback)=>{
+  if(state.safetyList.length === 0){
+    callback(new Error('请上传现场安全检查表'))
+  }else{
+    callback()
+  }
+}
+
+let checkInvestFiles = (rule, value, callback)=>{
+  if(state.siteCheckList.length === 0){
+    callback(new Error('请上传现场勘验照片'))
+  }else{
+    callback()
+  }
+}
+
+let checkCompanyFiles = (rule, value, callback)=>{
+  if(state.companyList.length === 0){
+    callback(new Error('请上传企业陪同人员照片'))
+  }else{
+    callback()
+  }
+}
+
+
 
 const state = reactive({
+  data: [],
   formData: {
     id: null,
     projectId: null,
     investigationDate: '',
     location: '',
     isSafetyCheck: null,
-    recordData: ''
+    recordData: '',
+    assAccessoryFiles: [],
+    deviceImages: [],
+    investingationImages: [],
+    companyImages:[]
   },
+  projectId: null,
   planPersons: [],
   rules: {
-    recordData: [{required: true, message: '请填写现场勘验记录', trigger: 'blur'}]
+    investigationDate: [{required: true, message: '请选择现场勘验时间', trigger: 'blur'}],
+    location: [{required: true, message: '请选择现场勘验位置', trigger: 'change'}],
+    isSafetyCheck: [{required: true, message: '请选择是否编制现场安全检查表', trigger: 'blur'}],
+    recordData: [{required: true, message: '请填写现场勘验记录', trigger: 'blur'}],
+    assAccessoryFiles: [{required: true, validator: checkSafetyFiles, trigger: 'blur'}],
+    // investingationImages: [{required: true, validator: checkInvestFiles, trigger: 'blur'}],
+    // ccompanyImages: [{required: true, validator: checkCompanyFiles, trigger: 'blur'}]
   },
+  beforeDeviceList: [],
+  siteCheckList: [],
+  companyList: [],
+  safetyList: [],
   imgLimit: 1,
-  uploadUrl: import.meta.env.VITE_APP_BASE_API + '/system/common/uploadFile',
+  uploadUrl: import.meta.env.VITE_APP_BASE_API + '/manage/accessory-file/uploadFile',
   header: {
-    Authorization: 'Bearer ' + getToken()
-  }
+    Authorization: getToken()
+  },
+  imgDialog: false,
+  imgUrl: ''
 })
 
 const isAmin = ref(false)
@@ -113,19 +221,121 @@
   if(userInfo.identity === 0){
     isAmin.value = true;
   }
+  if(props.projectId){
+    getDetail(props.projectId)
+  }
+  isEnd.value = Cookies.get('end')
+  projectType.value = route.query.type;
+
 });
 
-const riskOpen = async (type,val) => {
-  console.log("type",type,val)
-  if(type === 'detail' || type === 'edit' ){
-    const res = await getRiskDetail({projectId: val});
-    if(res.code == 200){
-      state.formData = res.data;
-      state.formData.project.business = parseInt(res.data.project.business);
-      state.formData.project.area = [res.data.project.province,res.data.project.city];
-    }else {
-      ElMessage.warning(res.message)
+const chooseRecord = async (item, index) => {
+  state.formData = item;
+  state.data.forEach((i,index) => {
+    if(i.id === item.id){
+      chooseItem.value = i;
+      chooseItem.value.index = index+1;
+
     }
+  })
+  await getPicDetail(item.id);
+  showDrawer.value = false;
+}
+
+const chooseItem = ref();
+const getDetail = async (val) => {
+  const res = await getSiteCheckDetail({projectId: val});
+  if(res.code == 200){
+    if(res.data && res.data.length > 0){
+      Cookies.set('btn','变更')
+      state.data = res.data;
+      state.formData = res.data[0];
+      chooseItem.value = state.formData;
+      chooseItem.value.index = 1;
+
+      await getPicDetail(state.formData.id)
+    }else {
+      Cookies.set('btn','保存')
+    }
+
+  }else {
+    ElMessage.warning(res.message)
+  }
+}
+const getPicDetail = async (val) => {
+  const res = await getDetailById(val);
+  if(res.code == 200){
+    if(res.data){
+      state.formData = res.data;
+      doPic(res.data)
+    }
+  }else {
+    ElMessage.warning(res.message)
+  }
+}
+
+const doPic = (val) => {
+  state.beforeDeviceList = val.deviceImages?.map(i=>{
+    return {
+      name: i.fileName,
+      url: import.meta.env.VITE_APP_BASE_API + '/' + i.path,
+      id: i.id,
+      projectId: i.projectId,
+      moduleType: i.moduleType
+    }
+  })
+  state.siteCheckList = val.investingationImages?.map(i=>{
+    return {
+      name: i.fileName,
+      url: import.meta.env.VITE_APP_BASE_API + '/' + i.path,
+      id: i.id,
+      projectId: i.projectId,
+      moduleType: i.moduleType
+    }
+  })
+  state.companyList = val.companyImages?.map(i=>{
+    return {
+      name: i.fileName,
+      url: import.meta.env.VITE_APP_BASE_API + '/' + i.path,
+      id: i.id,
+      projectId: i.projectId,
+      moduleType: i.moduleType
+    }
+  })
+  state.safetyList = val.assAccessoryFiles?.map(i=>{
+    return {
+      name: i.originName,
+      url: import.meta.env.VITE_APP_BASE_API + '/' + i.path,
+      id: i.id,
+      projectId: i.projectId,
+      moduleType: i.moduleType
+    }
+  })
+}
+
+const changeRadio = () => {
+  if(state.formData.isSafetyCheck == 1){
+    getSafetyFiles()
+  }
+}
+
+const projectType = ref('');
+const isEnd = ref('')
+const riskOpen = async (type,val) => {
+  state.formData.projectId = val
+  isEnd.value = Cookies.get('end')
+  state.projectId = val
+  projectType.value = route.query.type;
+  if(type === 'sixEnd') {
+    const res = await doSiteCheck({projectId: val});
+    if(res.code == 200) {
+      emit('getNextStatus', val);
+      }else {
+        ElMessage.warning(res.message)
+      }
+  }
+  if(type === 'detail' || type === 'edit' ){
+    // await getDetail(val)
   }
   if(type === 'add' || type === 'clickEdit') {
     const valid = await formRef.value.validate();
@@ -135,28 +345,174 @@
         return;
       }
       if(type === 'add'){
-        const {projectId, ...data} = JSON.parse(JSON.stringify(state.formData))
-        const res = await addRisk(data);
-        if (res.code == 200) {
-          ElMessage.success('保存成功')
-          formRef.value.clearValidate();
-          emit('getNextStatus', res.data);
-
-        } else {
-          ElMessage.warning(res.message)
+        if(!state.data.length >0){
+         await saveData(val);
+        }else {
+          await editData();
         }
       }else if(type === 'clickEdit'){
-        const { ...data} = JSON.parse(JSON.stringify(state.formData))
-        const res = await editRisk(data);
-        if (res.code == 200) {
-          ElMessage.success('变更成功')
-          formRef.value.clearValidate();
-          // emit('getNextStatus', data.project.id);
-        } else {
-          ElMessage.warning(res.message)
+          await editData();
+      }
+    }
+  }
+}
+
+const saveData = async (val) => {
+
+  if(state.formData.isSafetyCheck == 1){
+    state.formData.recordData = ''
+  }
+  const {id, ...data} = JSON.parse(JSON.stringify(state.formData))
+  const res = await addSiteCheck(data);
+  if (res.code == 200) {
+    ElMessage.success('保存成功')
+    // const res = await doSiteCheck({projectId: val});
+    // if(res.code == 200) {
+    if(state.formData.isSafetyCheck == 0){
+      if(state.safetyList && state.safetyList.length >0){
+        console.log('删除原有附件',state.safetyList[0])
+        let id = state.safetyList[0].response.data.id
+        const res = await delFile(id)
+        if(res.code == 200){
+          console.log('删除原有附件')
+          await getSafetyFiles()
+        }else{
+          ElMessage({
+            type: 'warning',
+            message: res.message
+          })
         }
       }
     }
+    await getDetail(val)
+    formRef.value.clearValidate();
+    // emit('getNextStatus', val);
+    // }else {
+    //   ElMessage.warning(res.message)
+    // }
+
+  } else {
+    ElMessage.warning(res.message)
+  }
+}
+const editData = async () => {
+
+  if(state.formData.isSafetyCheck == 1){
+    state.formData.recordData = ''
+  }
+  const { ...data} = JSON.parse(JSON.stringify(state.formData))
+  const res = await editSiteCheck(data);
+  if (res.code == 200) {
+    ElMessage.success('变更成功')
+    if(state.formData.isSafetyCheck == 0 && state.safetyList.length>0){
+      const res = await delFile(state.safetyList[0].id)
+      if(res.code == 200){
+        await getSafetyFiles()
+      }else{
+        ElMessage({
+          type: 'warning',
+          message: res.message
+        })
+      }
+    }
+    await getPicDetail(chooseItem.value.id)
+    formRef.value.clearValidate();
+    // emit('getNextStatus', data.project.id);
+  } else {
+    ElMessage.warning(res.message)
+  }
+}
+
+
+const getBeforeFiles = async (id)=>{
+  const res = await getFiles({projectId: id ? id : props.projectId,moduleType: 1,processId:chooseItem.value.id })
+  if(res.code == 200){
+    if(res.data && res.data.length>0){
+      state.beforeDeviceList = res.data.map(i=>{
+        return {
+          name: i.fileName,
+          url: import.meta.env.VITE_APP_BASE_API + '/' + i.path,
+          id: i.id,
+          processId: state.formData.id,
+          projectId: i.projectId,
+          moduleType: i.moduleType
+        }
+      })
+     state.formData.deviceImages = state.beforeDeviceList;
+    }else{
+      state.beforeDeviceList=[]
+    }
+  }else {
+    ElMessage.warning(res.message)
+  }
+}
+
+const getSiteCheckFiles = async (id)=>{
+  const res = await getFiles({projectId: id ? id : props.projectId,moduleType: 2,processId:chooseItem.value.id})
+  if(res.code == 200){
+    if(res.data && res.data.length>0){
+      state.siteCheckList = res.data.map(i=>{
+        return {
+          name: i.fileName,
+          url: import.meta.env.VITE_APP_BASE_API + '/' + i.path,
+          id: i.id,
+          processId: state.formData.id,
+          projectId: i.projectId,
+          moduleType: i.moduleType
+        }
+      })
+      state.formData.investingationImages = state.siteCheckList;
+    }else{
+      state.siteCheckList = []
+    }
+  }else {
+    ElMessage.warning(res.message)
+  }
+}
+
+const getCompanyFiles = async (id)=>{
+  const res = await getFiles({projectId: id ? id : props.projectId,moduleType: 3,processId:chooseItem.value.id})
+  if(res.code == 200){
+    if(res.data && res.data.length>0){
+      state.companyList = res.data.map(i=>{
+        return {
+          name: i.fileName,
+          url: import.meta.env.VITE_APP_BASE_API + '/' + i.path,
+          id: i.id,
+          processId: state.formData.id,
+          projectId: i.projectId,
+          moduleType: i.moduleType
+        }
+      })
+      state.formData.companyImages = state.companyList;
+    }else{
+      state.companyList=[]
+    }
+  }else {
+    ElMessage.warning(res.message)
+  }
+}
+
+const getSafetyFiles = async (id)=>{
+  const res = await getFiles({projectId: id ? id : props.projectId,moduleType: 5,processId: chooseItem.value? chooseItem.value.id:''})
+  if(res.code == 200){
+    if(res.data && res.data.length>0){
+      state.safetyList = res.data.map(i=>{
+        return {
+          name: i.originName,
+          url: import.meta.env.VITE_APP_BASE_API + '/' + i.path,
+          id: i.id,
+          processId: state.formData.id,
+          projectId: i.projectId,
+          moduleType: i.moduleType
+        }
+      })
+      state.formData.assAccessoryFiles = state.safetyList
+    }else{
+      state.safetyList = []
+    }
+  }else {
+    ElMessage.warning(res.message)
   }
 }
 
@@ -187,35 +543,128 @@
 };
 
 const handlePictureCardPreview = (uploadFile) => {
-  state.dialogImageUrl = uploadFile.url
-  state.dialogImg = true
+  console.log(uploadFile,'file')
+  state.imgUrl = uploadFile.url
+  state.imgDialog = true
 };
 
 
-const handleAvatarSuccess = (res, uploadFile) => {
+const handleAvatarSuccess = (res, uploadFile, type) => {
   if(res.code == 200){
-    // state.registerForm.agency.reportPath = res.data.path
-  }else{
-    ElMessage({
-      type: 'warning',
-      message: '文件上传失败'
-    })
-  }
-}
-
-const handleRemove = async (file, uploadFiles) => {
-  const res = await delPic({path: state.registerForm.agency.reportPath})
-  if(res.code == 200){
-    ElMessage({
-      type: 'success',
-      message: '文件已删除'
-    })
+    if(type == 1){
+      let obj = {
+        name: res.data.fileName,
+        url: import.meta.env.VITE_APP_BASE_API + '/' + res.data.path,
+        id: res.data.id,
+        processId: state.formData.id,
+        projectId: res.data.projectId,
+        moduleType: res.data.moduleType
+      }
+      state.formData.deviceImages.push(obj);
+      // getBeforeFiles()
+    }
+    if(type == 2){
+      let obj = {
+        name: res.data.fileName,
+        url: import.meta.env.VITE_APP_BASE_API + '/' + res.data.path,
+        id: res.data.id,
+        processId: state.formData.id,
+        projectId: res.data.projectId,
+        moduleType: res.data.moduleType
+      }
+      state.formData.investingationImages.push(obj);
+      // getSiteCheckFiles()
+    }
+    if(type == 3){
+      let obj = {
+        name: res.data.fileName,
+        url: import.meta.env.VITE_APP_BASE_API + '/' + res.data.path,
+        id: res.data.id,
+        processId: state.formData.id,
+        projectId: res.data.projectId,
+        moduleType: res.data.moduleType
+      }
+      state.formData.companyImages.push(obj);
+      // getCompanyFiles()
+    }
+    if(type == 5){
+      let obj = {
+        name: res.data.fileName,
+        url: import.meta.env.VITE_APP_BASE_API + '/' + res.data.path,
+        id: res.data.id,
+        processId: state.formData.id,
+        projectId: res.data.projectId,
+        moduleType: res.data.moduleType
+      }
+      state.formData.assAccessoryFiles.push(obj);
+      console.log(res,'res')
+      // getSafetyFiles()
+    }
   }else{
     ElMessage({
       type: 'warning',
       message: res.message
     })
   }
+}
+
+const handleRemove = async (file, uploadFiles,type) => {
+
+    ElMessageBox.confirm(
+        '确定删除该附件?',
+        '提示',
+        {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning',
+        })
+        .then( async() => {
+          const res = await delFile(file.id)
+          if(res.code == 200){
+            ElMessage({
+              type: 'success',
+              message: '文件已删除'
+            })
+            if(type == 1){
+              const index = state.formData.deviceImages.findIndex(v => v.id === file.id)
+              state.formData.deviceImages.splice(index,1);
+
+            }
+            if(type == 2){
+              const index = state.formData.investingationImages.findIndex(v => v.id === file.id)
+              state.formData.investingationImages.splice(index,1);
+
+            }
+            if(type == 3){
+              const index = state.formData.companyImages.findIndex(v => v.id === file.id)
+              state.formData.companyImages.splice(index,1);
+            }
+            if(type == 5){
+              const index = state.formData.assAccessoryFiles.findIndex(v => v.id === file.id)
+              state.formData.assAccessoryFiles.splice(index,1);
+            }
+          }else{
+            ElMessage({
+              type: 'warning',
+              message: res.message
+            })
+          }
+        })
+        .catch(()=>{
+          // if(type == 1){
+          //   getBeforeFiles()
+          // }
+          // if(type == 2){
+          //   getSiteCheckFiles()
+          // }
+          // if(type == 3){
+          //   getCompanyFiles()
+          // }
+          // if(type == 5){
+          //   getSafetyFiles()
+          // }
+        })
+
 }
 
 defineExpose({
@@ -230,5 +679,9 @@
     font-size: 15px;
   }
 }
+.textColor{
+  color: #3b82f6;
+}
+
 
 </style>

--
Gitblit v1.9.2