zhouwx
2024-06-12 bcc1ce55aa699450905c68f957198428ed251c48
src/views/safetyReview/projectManage/components/rateConclusion.vue
@@ -23,22 +23,25 @@
      <el-row :gutter="30">
        <el-col :span="18">
          <el-form-item>
            <el-upload accept="image/*,.pdf,.doc,.docx,.xlsx,.xls"
                       :action="state.uploadUrl"
                       :disabled="state.disabled"
                       :headers="state.header"
                       method="post"
                       :on-success="handleAvatarSuccess"
                       :on-exceed="showTip"
                       v-model:file-list="state.fileList"
                       :on-remove="handleRemove"
                       :data="state.uploadData"
                       :on-preview="handlePreview"
                       :limit='1'
            <el-upload
                v-if="state.formData.isReviseManual === 1"
                accept="image/*,.pdf,.doc,.docx,.xlsx,.xls"
                 :action="state.uploadUrl"
                :disabled="projectType === 'view' || isEnd"
                 :headers="state.header"
                 method="post"
                :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile)"
                 :on-exceed="showTip"
                 v-model:file-list="state.fileList"
                 :on-remove="handleRemove"
                 :data="state.uploadData"
                 :on-preview="handlePreview"
                 :limit='15'
                 :before-upload="picSize"
            >
              <el-button type="primary">附件上传</el-button>
              <el-button type="primary">评价报告上传</el-button>
              <template #tip>
                <div class="el-upload__tip">上传文件尺寸小于5M,最多可上传1份</div>
                <div class="el-upload__tip">上传文件尺寸小于15M,最多可上传15份,多张图片建议合并为PDF文件规范上传。</div>
              </template>
            </el-upload>
          </el-form-item>
@@ -59,6 +62,8 @@
import {delAccessoryFile, getAccessoryFile} from "@/api/projectManage/project";
import axios from "axios";
import {delFile, getFiles} from "@/api/projectManage/siteCheckRcd";
import { useRoute } from 'vue-router'
const route = useRoute()
const emit = defineEmits(["getNextStatus"]);
const prop = defineProps(['projectId'])
const state = reactive({
@@ -96,10 +101,16 @@
    state.uploadData.projectId = val;
    getProcessFiles(val);
  }
  isEnd.value = Cookies.get('end')
  projectType.value = route.query.type;
})
const projectType = ref('');
const isEnd = ref('')
const riskOpen = async (type,val) => {
  state.uploadData.projectId = val;
  projectType.value = route.query.type;
  isEnd.value = Cookies.get('end')
  if(type === 'detail' || type === 'edit' ){
    if(type === 'detail'){
      state.disabled = true
@@ -163,29 +174,30 @@
}
const picSize = async (rawFile) => {
  if(rawFile.size / 1024 / 1024 > 2){
  if(rawFile.size / 1024 / 1024 > 15){
    ElMessage({
      type: 'warning',
      message: '文件大小不能超过2M'
      message: '文件大小不能超过15M'
    });
    return false
  }
};
const handleAvatarSuccess = (res) => {
const handleAvatarSuccess = (res,uploadFile) => {
  if(res.code === 200){
    getProcessFiles()
    console.log("if",state.fileList)
    // ElMessage({
    //   type: 'success',
    //   message: '文件上传成功'
    // })
    ElMessage({
      type: 'success',
      message: '文件上传成功'
    })
  }else {
    state.fileList.splice(state.fileList.indexOf(uploadFile),1)
    ElMessage({
      type: 'warning',
      message: '文件上传失败'
      message: res.message
    })
  }
}
const handlePreview = (file) => {
  let path = "";