From 4bc0d3e1611da659c853a3589d84cf41d91f13d2 Mon Sep 17 00:00:00 2001
From: zhouwenxuan <1175765986@qq.com>
Date: 星期三, 10 四月 2024 09:55:08 +0800
Subject: [PATCH] bug修改

---
 src/views/safetyReview/projectManage/components/evaluatePlan.vue      |    2 
 src/views/safetyReview/projectManage/components/confirmEnd.vue        |    2 
 src/views/safetyReview/projectManage/components/projectArchive.vue    |    2 
 src/views/safetyReview/projectManage/components/siteCheckRcd.vue      |  379 ++++++++++++++++++++++++++-----------
 src/api/projectManage/siteCheckRcd.js                                 |   19 +
 src/views/safetyReview/projectManage/components/uploadReviewRcd.vue   |    2 
 src/components/Tinymce/Tinymce.vue                                    |   30 +-
 src/layout/components/Register/index.vue                              |   44 +++
 src/utils/request.js                                                  |    9 
 src/views/safetyReview/institution/components/viewInstitution.vue     |   15 +
 src/views/safetyReview/projectManage/process.vue                      |   47 ++++
 src/views/safetyReview/projectManage/components/processCtrlReview.vue |    2 
 src/views/safetyReview/projectManage/components/rateConclusion.vue    |    2 
 src/views/safetyReview/projectManage/index.vue                        |    1 
 14 files changed, 414 insertions(+), 142 deletions(-)

diff --git a/src/api/projectManage/siteCheckRcd.js b/src/api/projectManage/siteCheckRcd.js
index 7f02b73..2ee4bfa 100644
--- a/src/api/projectManage/siteCheckRcd.js
+++ b/src/api/projectManage/siteCheckRcd.js
@@ -8,6 +8,14 @@
     })
 }
 
+export function doSiteCheck(data) {
+    return request({
+        url: '/manage/investigation/doProcess',
+        method: 'post',
+        data: data
+    })
+}
+
 export function editSiteCheck(params) {
     return request({
         url: `/manage/investigation/edit`,
@@ -23,6 +31,15 @@
         params: data
     })
 }
+
+export function getDetailById(data) {
+    return request({
+        url: '/manage/investigation/detail/' + data,
+        method: 'get'
+    })
+}
+
+
 
 export function getFiles(data) {
     return request({
@@ -45,4 +62,4 @@
         method: 'post',
         data: data
     })
-}
\ No newline at end of file
+}
diff --git a/src/components/Tinymce/Tinymce.vue b/src/components/Tinymce/Tinymce.vue
index 5ea8a09..a544c53 100644
--- a/src/components/Tinymce/Tinymce.vue
+++ b/src/components/Tinymce/Tinymce.vue
@@ -73,13 +73,14 @@
                     let res = await upload(formData); // 调取 接口
                     console.log(res);
                     if (res.code == 200) {
-                        // const path = import.meta.env.VITE_APP_BASE_API + '/' + res.data.path
-                        let path = "";
-                        if(import.meta.env.VITE_APP_ENV == 'development') {
-                            path = import.meta.env.VITE_APP_BASE_API + '/' + res.data.path
-                        }else {
-                            path = '/api/' + res.data.path
-                        }
+
+                        const path = import.meta.env.VITE_APP_BASE_API + '/' + res.data.path
+                        // let path = "";
+                        // if(import.meta.env.VITE_APP_ENV == 'development') {
+                        //     path = import.meta.env.VITE_APP_BASE_API + '/' + res.data.path
+                        // }else {
+                        //     path = '/api/' + res.data.path
+                        // }
 
                         success(path);
                     } else {
@@ -93,15 +94,14 @@
                     await upload(formData).then(res => {
                         console.log(res);
                         if (res.code == 200) {
+                          const path = import.meta.env.VITE_APP_BASE_API + '/' + res.data.path
+                            // let path = "";
+                            // if(import.meta.env.VITE_APP_ENV == 'development') {
+                            //     path = import.meta.env.VITE_APP_BASE_API + '/' + res.data.path
+                            // }else {
+                            //     path = '/api/' + res.data.path
+                            // }
 
-                            let path = "";
-                            if(import.meta.env.VITE_APP_ENV == 'development') {
-                                path = import.meta.env.VITE_APP_BASE_API + '/' + res.data.path
-                            }else {
-                                path = '/api/' + res.data.path
-                            }
-                            // const path = import.meta.env.VITE_APP_BASE_API + '/' + res.data.path
-                            // const path = '/api/' + res.data.path
                             success(path,res.data);
                         } else {
                             console.log("上传失败");
diff --git a/src/layout/components/Register/index.vue b/src/layout/components/Register/index.vue
index e284428..1b29454 100644
--- a/src/layout/components/Register/index.vue
+++ b/src/layout/components/Register/index.vue
@@ -139,6 +139,18 @@
         </el-row>
         <el-row :gutter="30">
           <el-col :span="8">
+            <el-form-item prop="agency.certPath" label="资质证书">
+              <el-upload accept="image/*" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile,'证书')" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='state.imgLimit' v-model:file-list="state.certList" list-type="picture-card" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles,'证书')" >
+                <el-icon><Plus /></el-icon>
+                <template #tip>
+                  <div class="el-upload__tip">上传jpg/png图片尺寸小于5M,最多可上传1张</div>
+                </template>
+              </el-upload>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="8">
             <el-form-item prop="agency.assetValue" label="固定资产总值">
               <el-input
                   v-model="registerForm.agency.assetValue"
@@ -213,7 +225,7 @@
               <!--                  </div>-->
               <!--                </template>-->
               <!--              </el-upload>-->
-              <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-upload accept="image/*" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile,'上报表')" :on-exceed="showTip" :on-preview="handlePictureCardPreview" :limit='state.imgLimit' v-model:file-list="state.fileList" list-type="picture-card" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles,'上报表')" >
                 <el-icon><Plus /></el-icon>
                 <template #tip>
                   <div class="el-upload__tip">上传jpg/png图片尺寸小于5M,最多可上传1张</div>
@@ -320,6 +332,7 @@
   areaList: [],
   busList: [],
   fileList: [],
+  certList: [],
   imgLimit: 1,
   uploadUrl: import.meta.env.VITE_APP_BASE_API + '/system/common/uploadFile',
   header: {
@@ -351,6 +364,7 @@
       regAddress: '',
       business: '',
       reportPath: '',
+      certPath: ''
     },
     username: '',
     phone: '',
@@ -476,6 +490,7 @@
   "agency.regAddress": [{required: true, trigger: "blur", message: "请输入注册地址"}],
   "agency.business": [{required: true, trigger: "blur", message: "请选择申请的法定安全评价业务范围"}],
   "agency.reportPath": [{required: true, trigger: "blur", message: "请上传加盖公章的《机构信息上报表》"}],
+  "agency.certPath": [{required: true, trigger: "blur", message: "请上传资质证书"}],
   username: [{ required: true, trigger: "blur", validator: validateUsername }],
   phone: [{ required: true, trigger: "blur", validator: validateUserPhone }],
   password: [{ required: true, trigger: "blur", validator: validatePwd }],
@@ -537,6 +552,10 @@
           if(res.data.reportPath) {
               const imgUrl = import.meta.env.VITE_APP_BASE_API + "/" +  res.data.reportPath
               state.fileList = imgUrl ? imgUrl.split(',').map(url => {return {url} }) : []
+          }
+          if(res.data.certPath) {
+            const imgUrl = import.meta.env.VITE_APP_BASE_API + "/" +  res.data.certPath
+            state.certList = imgUrl ? imgUrl.split(',').map(url => {return {url} }) : []
           }
 
       }else{
@@ -613,9 +632,15 @@
 };
 
 
-const handleAvatarSuccess = (res, uploadFile) => {
+const handleAvatarSuccess = (res, uploadFile,type) => {
   if(res.code == 200){
-    state.registerForm.agency.reportPath = res.data.path
+    console.log("type",type)
+    if(type === '上报表'){
+      state.registerForm.agency.reportPath = res.data.path
+    }else {
+      state.registerForm.agency.certPath = res.data.path
+    }
+
   }else{
     ElMessage({
       type: 'warning',
@@ -624,8 +649,14 @@
   }
 }
 
-const handleRemove = async (file, uploadFiles) => {
-  const res = await delPic({path: state.registerForm.agency.reportPath})
+const handleRemove = async (file, uploadFiles,type) => {
+  let path = '';
+  if(type === '上报表'){
+    path = state.registerForm.agency.reportPath;
+  }else {
+    path = state.registerForm.agency.certPath;
+  }
+  const res = await delPic({path: path})
   if(res.code == 200){
     ElMessage({
       type: 'success',
@@ -663,6 +694,7 @@
               proxy.$refs.registerRef.resetFields()
               proxy.$refs.registerRef.clearValidate()
               state.fileList = []
+              state.certList = []
                 loading.value = false
               // router.push("/homePage")
             }).catch(() => {})
@@ -694,6 +726,7 @@
                   proxy.$refs.registerRef.resetFields()
                   proxy.$refs.registerRef.clearValidate()
                   state.fileList = []
+                  state.certList = []
                   loading.value = false
 
               }else{
@@ -715,6 +748,7 @@
   proxy.$refs.registerRef.resetFields()
   proxy.$refs.registerRef.clearValidate()
   state.fileList = []
+  state.certList = []
 }
 
 defineExpose({
diff --git a/src/utils/request.js b/src/utils/request.js
index 3a8d1b5..5f7ce45 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -105,6 +105,15 @@
       return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
     } else if (code === 500) {
       ElMessage({ message: msg, type: 'error' })
+      if(msg === 'Token已失效,请重新登录!' || msg === 'token非法无效!'){
+        ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
+          isRelogin.show = false;
+          removeToken()
+          location.href = '/homePage';
+        }).catch(() => {
+        });
+      }
+
       return Promise.reject(new Error(msg))
     } else if (code === 601) {
       ElMessage({ message: msg, type: 'warning' })
diff --git a/src/views/safetyReview/institution/components/viewInstitution.vue b/src/views/safetyReview/institution/components/viewInstitution.vue
index 9c58bf5..aa9a569 100644
--- a/src/views/safetyReview/institution/components/viewInstitution.vue
+++ b/src/views/safetyReview/institution/components/viewInstitution.vue
@@ -140,6 +140,15 @@
                     </el-form-item>
                 </el-col>
             </el-row>
+          <el-row :gutter="30">
+            <el-col :span="8">
+              <el-form-item prop="agency.certPath" label="资质证书">
+                <el-upload  disabled :limit='state.imgLimit' :show-file-list="false" list-type="picture-card" >
+                  <el-image  v-if="certImageUrl"  :src="certImageUrl" :preview-src-list="certList" style="width: 100%;max-height: 146px;" />
+                </el-upload>
+              </el-form-item>
+            </el-col>
+          </el-row>
             <el-row :gutter="30">
                 <el-col :span="8">
                     <el-form-item prop="agency.assetValue" label="固定资产总值">
@@ -249,7 +258,9 @@
 import {getDict} from "@/api/login";
 import {getRegionTree} from "@/api/area";
 const imageUrl = ref("");
+const certImageUrl = ref("");
 const srcList = ref([]);
+const certList = ref([]);
 const registerForm = ref({
     agency:{
         name: "",
@@ -347,6 +358,9 @@
         registerForm.value.agency.business = res.data.business.split(",").map(Number)
         imageUrl.value = import.meta.env.VITE_APP_BASE_API + "/" +  res.data.reportPath
         srcList.value.push(imageUrl.value)
+        certImageUrl.value = import.meta.env.VITE_APP_BASE_API + "/" +  res.data.certPath
+        certList.value.push(certImageUrl.value)
+
 
     }else{
         ElMessage.warning(res.message)
@@ -359,6 +373,7 @@
     dialogVisible.value = false;
     state.fileList = []
     srcList.value = []
+    certList.value = []
 }
 
 defineExpose({
diff --git a/src/views/safetyReview/projectManage/components/confirmEnd.vue b/src/views/safetyReview/projectManage/components/confirmEnd.vue
index b6aec5b..46d0c33 100644
--- a/src/views/safetyReview/projectManage/components/confirmEnd.vue
+++ b/src/views/safetyReview/projectManage/components/confirmEnd.vue
@@ -79,6 +79,8 @@
     getList(state.formData.projectId);
     getStatus(state.formData.projectId);
   }
+  isEnd.value = Cookies.get('end')
+  projectType.value = route.query.type;
 
 
 });
diff --git a/src/views/safetyReview/projectManage/components/evaluatePlan.vue b/src/views/safetyReview/projectManage/components/evaluatePlan.vue
index 6079e74..b376069 100644
--- a/src/views/safetyReview/projectManage/components/evaluatePlan.vue
+++ b/src/views/safetyReview/projectManage/components/evaluatePlan.vue
@@ -278,6 +278,8 @@
     await getWorksList(props.projectId)
     await getDeviceList(props.projectId)
   }
+  isEnd.value = Cookies.get('end')
+  projectType.value = route.query.type;
 })
 
 const projectType = ref('');
diff --git a/src/views/safetyReview/projectManage/components/processCtrlReview.vue b/src/views/safetyReview/projectManage/components/processCtrlReview.vue
index da77470..4cd1243 100644
--- a/src/views/safetyReview/projectManage/components/processCtrlReview.vue
+++ b/src/views/safetyReview/projectManage/components/processCtrlReview.vue
@@ -150,6 +150,8 @@
     isAmin.value = true;
   }
   getProcessFiles(props.projectId)
+  isEnd.value = Cookies.get('end')
+  projectType.value = route.query.type;
 })
 
 const projectType = ref('');
diff --git a/src/views/safetyReview/projectManage/components/projectArchive.vue b/src/views/safetyReview/projectManage/components/projectArchive.vue
index c34a031..64a25ec 100644
--- a/src/views/safetyReview/projectManage/components/projectArchive.vue
+++ b/src/views/safetyReview/projectManage/components/projectArchive.vue
@@ -160,6 +160,8 @@
     // const res = await  getAccessoryFile({projectId: val,moduleType: 9});
     // console.log('res',res)
   }
+  isEnd.value = Cookies.get('end')
+  projectType.value = route.query.type;
 });
 
 const getRecord = async (val) =>{
diff --git a/src/views/safetyReview/projectManage/components/rateConclusion.vue b/src/views/safetyReview/projectManage/components/rateConclusion.vue
index 6cfc327..e51a75d 100644
--- a/src/views/safetyReview/projectManage/components/rateConclusion.vue
+++ b/src/views/safetyReview/projectManage/components/rateConclusion.vue
@@ -100,6 +100,8 @@
     state.uploadData.projectId = val;
     getProcessFiles(val);
   }
+  isEnd.value = Cookies.get('end')
+  projectType.value = route.query.type;
 })
 
 const projectType = ref('');
diff --git a/src/views/safetyReview/projectManage/components/siteCheckRcd.vue b/src/views/safetyReview/projectManage/components/siteCheckRcd.vue
index 0f63da0..2e83829 100644
--- a/src/views/safetyReview/projectManage/components/siteCheckRcd.vue
+++ b/src/views/safetyReview/projectManage/components/siteCheckRcd.vue
@@ -2,13 +2,26 @@
   <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>-->
+      </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">记录编号:{{ 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" :checked="chooseItem.id === item.id" type="primary" @click="chooseRecord(item,index)">记录编号{{ index+1 }}</el-check-tag>
+              </div>
+            </div>
+          </div>
+
+        </el-col>
       </el-row>
       <el-row :gutter="30">
         <el-col :span="6">
@@ -94,7 +107,7 @@
       </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="ccompanyImages">
+          <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>
@@ -116,7 +129,14 @@
 import {defineEmits, onMounted, reactive, ref} from "vue"
 import {ElMessage, ElMessageBox} from "element-plus"
 import {Search} from '@element-plus/icons-vue'
-import {addSiteCheck,editSiteCheck,getSiteCheckDetail, delFile, getFiles} from "@/api/projectManage/siteCheckRcd";
+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'
@@ -124,7 +144,9 @@
 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('请上传现场安全检查表'))
@@ -152,6 +174,7 @@
 
 
 const state = reactive({
+  data: [],
   formData: {
     id: null,
     projectId: null,
@@ -162,7 +185,7 @@
     assAccessoryFiles: [],
     deviceImages: [],
     investingationImages: [],
-    ccompanyImages:[]
+    companyImages:[]
   },
   projectId: null,
   planPersons: [],
@@ -199,56 +222,95 @@
   if(props.projectId){
     getDetail(props.projectId)
   }
+  isEnd.value = Cookies.get('end')
+  projectType.value = route.query.type;
 
 });
 
+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){
-      state.formData = res.data;
-      state.beforeDeviceList = res.data.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 = res.data.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 = res.data.ccompanyImages.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 = res.data.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
-        }
-      })
+    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()
@@ -262,6 +324,14 @@
   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)
   }
@@ -273,63 +343,87 @@
         return;
       }
       if(type === 'add'){
-        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('保存成功')
-          if(state.formData.isSafetyCheck == 0){
-            if(state.safetyList && state.safetyList.length >0){
-              const res = await delFile(state.safetyList[0].id)
-              if(res.code == 200){
-                console.log('删除原有附件')
-                await getSafetyFiles()
-              }else{
-                ElMessage({
-                  type: 'warning',
-                  message: res.message
-                })
-              }
-            }
-          }
-          formRef.value.clearValidate();
-          emit('getNextStatus', val);
-        } else {
-          ElMessage.warning(res.message)
+        if(!state.data.length >0){
+         await saveData(val);
+        }else {
+          await editData();
         }
       }else if(type === 'clickEdit'){
-        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){
-            const res = await delFile(state.safetyList[0].id)
-            if(res.code == 200){
-              await getSafetyFiles()
-            }else{
-              ElMessage({
-                type: 'warning',
-                message: res.message
-              })
-            }
-          }
-          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})
+  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=>{
@@ -337,10 +431,12 @@
           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=[]
     }
@@ -350,7 +446,7 @@
 }
 
 const getSiteCheckFiles = async (id)=>{
-  const res = await getFiles({projectId: id ? id : props.projectId,moduleType: 2})
+  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=>{
@@ -358,10 +454,12 @@
           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 = []
     }
@@ -371,7 +469,7 @@
 }
 
 const getCompanyFiles = async (id)=>{
-  const res = await getFiles({projectId: id ? id : props.projectId,moduleType: 3})
+  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=>{
@@ -379,10 +477,12 @@
           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=[]
     }
@@ -392,7 +492,7 @@
 }
 
 const getSafetyFiles = async (id)=>{
-  const res = await getFiles({projectId: id ? id : props.projectId,moduleType: 5})
+  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=>{
@@ -400,10 +500,12 @@
           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 = []
     }
@@ -448,22 +550,58 @@
 const handleAvatarSuccess = (res, uploadFile, type) => {
   if(res.code == 200){
     if(type == 1){
-      getBeforeFiles()
+      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){
-      getSiteCheckFiles()
+      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){
-      getCompanyFiles()
+      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()
+      // getSafetyFiles()
     }
   }else{
     ElMessage({
       type: 'warning',
-      message: '文件上传失败'
+      message: res.message
     })
   }
 }
@@ -486,16 +624,22 @@
               message: '文件已删除'
             })
             if(type == 1){
-              await getBeforeFiles()
+              const index = state.formData.deviceImages.findIndex(v => v.id === file.id)
+              state.formData.deviceImages.splice(index,1);
+
             }
             if(type == 2){
-              await getSiteCheckFiles()
+              const index = state.formData.investingationImages.findIndex(v => v.id === file.id)
+              state.formData.investingationImages.splice(index,1);
+
             }
             if(type == 3){
-              await getCompanyFiles()
+              const index = state.formData.companyImages.findIndex(v => v.id === file.id)
+              state.formData.companyImages.splice(index,1);
             }
             if(type == 5){
-              await getSafetyFiles()
+              const index = state.formData.assAccessoryFiles.findIndex(v => v.id === file.id)
+              state.formData.assAccessoryFiles.splice(index,1);
             }
           }else{
             ElMessage({
@@ -505,18 +649,18 @@
           }
         })
         .catch(()=>{
-          if(type == 1){
-            getBeforeFiles()
-          }
-          if(type == 2){
-            getSiteCheckFiles()
-          }
-          if(type == 3){
-            getCompanyFiles()
-          }
-          if(type == 5){
-            getSafetyFiles()
-          }
+          // if(type == 1){
+          //   getBeforeFiles()
+          // }
+          // if(type == 2){
+          //   getSiteCheckFiles()
+          // }
+          // if(type == 3){
+          //   getCompanyFiles()
+          // }
+          // if(type == 5){
+          //   getSafetyFiles()
+          // }
         })
 
 }
@@ -533,6 +677,9 @@
     font-size: 15px;
   }
 }
+.textColor{
+  color: #3b82f6;
+}
 
 
 </style>
diff --git a/src/views/safetyReview/projectManage/components/uploadReviewRcd.vue b/src/views/safetyReview/projectManage/components/uploadReviewRcd.vue
index f67dd19..7df918f 100644
--- a/src/views/safetyReview/projectManage/components/uploadReviewRcd.vue
+++ b/src/views/safetyReview/projectManage/components/uploadReviewRcd.vue
@@ -58,6 +58,8 @@
     isAmin.value = true;
   }
   getReviewFiles(props.projectId)
+  isEnd.value = Cookies.get('end')
+  projectType.value = route.query.type;
 })
 
 const projectType = ref('');
diff --git a/src/views/safetyReview/projectManage/index.vue b/src/views/safetyReview/projectManage/index.vue
index 5f2280b..9168df7 100644
--- a/src/views/safetyReview/projectManage/index.vue
+++ b/src/views/safetyReview/projectManage/index.vue
@@ -290,6 +290,7 @@
 onMounted(() => {
   Cookies.remove('projectId')
   Cookies.remove('end')
+  Cookies.remove('btn')
   getList();
   getStatistics();
   getArea();
diff --git a/src/views/safetyReview/projectManage/process.vue b/src/views/safetyReview/projectManage/process.vue
index 357da79..5f0f05e 100644
--- a/src/views/safetyReview/projectManage/process.vue
+++ b/src/views/safetyReview/projectManage/process.vue
@@ -57,7 +57,7 @@
           </div>
           <div style="display: flex;align-items: center;justify-content: center;margin-bottom: -30px;margin-top: 10px">
             <el-button type="primary" v-if="selectedObj.id !== 1" style="width: 80px" @click="back">上一步</el-button>
-            <el-button type="warning" style="width: 80px"  v-if="(projectStatus === 'add'   && selectedObj.status === 1 && selectedObj.id !== 14)||(projectStatus === 'edit' && selectedObj.status === 1 && selectedObj.id !== 14) " @click="save">保存</el-button>
+            <el-button type="warning" style="width: 80px"  v-if="(projectStatus === 'add'   && selectedObj.status === 1 && selectedObj.id !== 14)||(projectStatus === 'edit' && selectedObj.status === 1 && selectedObj.id !== 14)  " @click="save">保存</el-button>
             <el-button type="warning" style="width: 80px"  v-if="(projectStatus === 'edit' && selectedObj.status !== 1 && selectedObj.id !== 13 && selectedObj.id !== 14 && reportProcess != 14) || (projectStatus === 'add'   && selectedObj.status !== 1 && selectedObj.id !== 14 && reportProcess != 14) " @click="clickEdit">变更</el-button>
             <el-button type="warning" style="width: 80px" v-if="selectedObj.id === 14 && selectedObj.status === 1 && reportProcess != 14" @click="confirm">确认完结</el-button>
             <el-button type="primary" style="width: 80px" v-if="selectedObj.id !== 14" @click="next">下一步</el-button>
@@ -76,7 +76,7 @@
 <script setup>
 
 import {onMounted, ref} from "vue";
-import {ElMessage} from "element-plus";
+import {ElMessage, ElMessageBox} from "element-plus";
 import rickAnalysis from "./components/riskAnalysis.vue"
 import contractManage from "./components/contractManage.vue"
 import evaluateTaskNotice from "./components/evaluateTaskNotice.vue"
@@ -102,6 +102,7 @@
 import SignConfirm from "./components/signConfirm"
 import ConfirmEnd from "./components/confirmEnd"
 import Cookies from "js-cookie"
+import {delMonitor} from "@/api/sysUsers";
 const route = useRoute()
 const menuList = ref([
   {
@@ -450,6 +451,7 @@
   link.click()
 }
 
+const sixBtn = ref("");
 const chooseSubMenu = (val,flag) => {
   if(val.status === 0) {
     setTimeout(() => {
@@ -494,6 +496,10 @@
     }, 10)
   }else if (val.status === 4) {
     setTimeout(() => {
+      if(val.id === 6){
+        sixBtn.value = Cookies.get('btn')
+      }
+      console.log('sixBtn.value',sixBtn.value)
       isShowMenu.value = false;
       nextObj.value = selectedObj.value;
       selectedObj.value = val;
@@ -517,7 +523,21 @@
     }else if (selectedObj.value.id+ 1 >11){
       nextMenu(4)
     }
-  }else {
+  }else if(selectedObj.value.id === 6){
+    if(selectedObj.value.id === 6) {
+      ElMessageBox.confirm(
+          '确定结束现场勘验?',
+          '提示',
+          {
+            confirmButtonText: '确定',
+            cancelButtonText: '取消',
+            type: 'warning',
+          })
+          .then( async() => {
+            goRouter(selectedObj.value.id,'sixEnd')
+          })
+    }
+  } else {
     setTimeout(() => {
       isShowMenu.value = false;
       ElMessage({
@@ -697,7 +717,22 @@
 }
 
 const save = () => {
-  goRouter(selectedObj.value.id,'add')
+  // if(selectedObj.value.id === 6) {
+  //   ElMessageBox.confirm(
+  //       '确定结束现场勘验?',
+  //       '提示',
+  //       {
+  //         confirmButtonText: '确定',
+  //         cancelButtonText: '取消',
+  //         type: 'warning',
+  //       })
+  //       .then( async() => {
+  //         goRouter(selectedObj.value.id,'add')
+  //       })
+  // }else {
+    goRouter(selectedObj.value.id,'add')
+  // }
+
 
 }
 const confirm = () => {
@@ -781,7 +816,9 @@
         siteCheckRcdRef.value.riskOpen('add',projectId.value);
       }else if (type === 'clickEdit'){
         siteCheckRcdRef.value.riskOpen('clickEdit',projectId.value);
-      }else {
+      }else if (type === 'sixEnd'){
+        siteCheckRcdRef.value.riskOpen('sixEnd',projectId.value);
+      } else {
         if(projectStatus.value === 'view' || projectStatus.value === 'add'){
           siteCheckRcdRef.value.riskOpen('detail',projectId.value);
         }else if(projectStatus.value === 'edit'){

--
Gitblit v1.9.2