| | |
| | | <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> |
| | |
| | | </template> |
| | | <script setup> |
| | | |
| | | import {defineEmits, onMounted, reactive, ref} from "vue"; |
| | | import {defineEmits, defineProps, onMounted, reactive, ref} from "vue"; |
| | | import {ElMessage, ElMessageBox} from "element-plus"; |
| | | import {Search} from '@element-plus/icons-vue' |
| | | import {addRate, addRisk, editRate, editRisk, getRateDetail, getRiskDetail} from "@/api/projectManage/riskAnalysis" |
| | |
| | | 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({ |
| | | formData: { |
| | | isReviseManual: 0, |
| | |
| | | if(userInfo.identity === 0){ |
| | | isAmin.value = true; |
| | | } |
| | | if(Cookies.get('projectId')){ |
| | | const val = Cookies.get('projectId'); |
| | | if(prop.projectId){ |
| | | const val = prop.projectId; |
| | | state.uploadData.projectId = val; |
| | | getProcessFiles(val); |
| | | // const res = getAccessoryFile({projectId: val,moduleType: 7}); |
| | | // if(res.code == 200){ |
| | | // if(res.data){ |
| | | // state.fileList = res.data.accessoryFiles.map(item => { |
| | | // return { |
| | | // ...item, |
| | | // name: item.originName, |
| | | // } |
| | | // }) |
| | | // }else { |
| | | // ElMessage.warning(res.message) |
| | | // } |
| | | // } |
| | | } |
| | | 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 |
| | |
| | | } |
| | | |
| | | 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: '文件上传成功' |
| | | }) |
| | | }else { |
| | | state.fileList.splice(state.fileList.indexOf(uploadFile),1) |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '文件上传失败' |
| | | message: res.message |
| | | }) |
| | | } |
| | | |
| | | } |
| | | const handlePreview = (file) => { |
| | | let path = ""; |
| | |
| | | }) |
| | | } |
| | | const getProcessFiles = async (id)=>{ |
| | | const res = await getFiles({projectId: id ? id : state.uploadData.projectId ,moduleType: 7}) |
| | | const res = await getFiles({projectId: id ? id : prop.projectId ,moduleType: 7}) |
| | | if(res.code == 200){ |
| | | if(res.data && res.data.length>0){ |
| | | state.fileList = res.data.map(i=>{ |