zhouwenxuan
2024-02-19 18aff5cd709785bb357ec8c22b4074680cadf0d0
src/views/safetyReview/projectManage/components/siteCheckRcd.vue
@@ -48,7 +48,7 @@
      <el-row :gutter="30">
        <el-col :span="24" v-if="state.formData.isSafetyCheck == 1">
          <el-form-item label="安全检查表上传" prop="assAccessoryFiles">
            <el-upload 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)" :before-remove="beforeRemove">
            <el-upload 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>
@@ -71,7 +71,7 @@
      <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/*" :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)" :before-remove="beforeRemove">
            <el-upload accept="image/*" :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">上传照片尺寸小于5M,最多可上传10张</div>
@@ -83,7 +83,7 @@
      <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/*" :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)" :before-remove="beforeRemove">
            <el-upload accept="image/*" :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>
@@ -95,7 +95,7 @@
      <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-upload 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)" :before-remove="beforeRemove">
            <el-upload 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>
@@ -194,54 +194,63 @@
  if(userInfo.identity === 0){
    isAmin.value = true;
  }
  if(props.projectId){
    getDetail(props.projectId)
  }
});
const getDetail = async (val) => {
  const res = await getSiteCheckDetail({projectId: val});
  if(res.code == 200){
    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.fileName,
        url: import.meta.env.VITE_APP_BASE_API + '/' + i.path,
        id: i.id,
        projectId: i.projectId,
        moduleType: i.moduleType
      }
    })
  }else {
    ElMessage.warning(res.message)
  }
}
const riskOpen = async (type,val) => {
  state.formData.projectId = val
  state.projectId = val
  if(type === 'detail' || type === 'edit' ){
    const res = await getSiteCheckDetail({projectId: val});
    if(res.code == 200){
      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.fileName,
          url: import.meta.env.VITE_APP_BASE_API + '/' + i.path,
          id: i.id,
          projectId: i.projectId,
          moduleType: i.moduleType
        }
      })
    }else {
      ElMessage.warning(res.message)
    }
    // await getDetail(val)
  }
  if(type === 'add' || type === 'clickEdit') {
    const valid = await formRef.value.validate();
@@ -271,7 +280,7 @@
            }
          }
          formRef.value.clearValidate();
          emit('getNextStatus', res.data);
          emit('getNextStatus', state.projectId);
        } else {
          ElMessage.warning(res.message)
        }