| | |
| | | <template> |
| | | <div class="riskBox"> |
| | | <el-form ref="formRef" :model="state.formData" :rules="state.rules" class="register-form" label-position="top"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="18"> |
| | | <el-form-item> |
| | | <el-upload accept=".pdf,.doc,.docx" |
| | | :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" |
| | | > |
| | | <el-button type="primary">附件上传</el-button> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-form-item prop="conclusion" label="评价结论"> |
| | | <el-input |
| | | v-model="state.formData.conclusion" |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <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-button type="primary">附件上传</el-button> |
| | | <template #tip> |
| | | <div class="el-upload__tip">上传文件尺寸小于5M,最多可上传1份</div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </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 {addRate, addRisk, editRate, editRisk, getRateDetail, getRiskDetail} from "@/api/projectManage/riskAnalysis" |
| | | import {delPic} from "@/api/login" |
| | |
| | | import Cookies from "js-cookie" |
| | | import {delAccessoryFile, getAccessoryFile} from "@/api/projectManage/project"; |
| | | import axios from "axios"; |
| | | import {delFile, getFiles} from "@/api/projectManage/siteCheckRcd"; |
| | | const emit = defineEmits(["getNextStatus"]); |
| | | |
| | | const state = reactive({ |
| | |
| | | if(Cookies.get('projectId')){ |
| | | const val = Cookies.get('projectId'); |
| | | state.uploadData.projectId = 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) |
| | | } |
| | | } |
| | | 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) |
| | | // } |
| | | // } |
| | | } |
| | | }) |
| | | |
| | |
| | | |
| | | const handleAvatarSuccess = (res) => { |
| | | if(res.code === 200){ |
| | | getProcessFiles() |
| | | console.log("if",state.fileList) |
| | | ElMessage({ |
| | | type: 'success', |
| | |
| | | } |
| | | }) |
| | | } |
| | | const getProcessFiles = async (id)=>{ |
| | | const res = await getFiles({projectId: id ? id : state.uploadData.projectId ,moduleType: 7}) |
| | | if(res.code == 200){ |
| | | if(res.data && res.data.length>0){ |
| | | state.fileList = res.data.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 |
| | | } |
| | | }) |
| | | }else{ |
| | | state.fileList = [] |
| | | } |
| | | }else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | |
| | | const handleRemove = async (file, uploadFiles) => { |
| | | console.log("file",file) |
| | | ElMessageBox.confirm( |
| | | '确定删除该附件?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then( async() => { |
| | | let accessoryFileId = ""; |
| | | if(file.id){ |
| | | accessoryFileId = file.id |
| | | }else { |
| | | accessoryFileId = file.response.data.id |
| | | |
| | | } |
| | | const res = await delAccessoryFile(accessoryFileId) |
| | | if(res.code == 200){ |
| | |
| | | type: 'success', |
| | | message: '文件已删除' |
| | | }) |
| | | await getProcessFiles() |
| | | }else{ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.message |
| | | }) |
| | | } |
| | | }) |
| | | .catch(()=>{ |
| | | getProcessFiles() |
| | | }) |
| | | } |
| | | |
| | | defineExpose({ |