| | |
| | | <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 label="附件上传"> |
| | | <el-upload accept=".pdf,.doc,.docx" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="handleAvatarSuccess" :on-exceed="showTip" :limit='state.imgLimit' v-model:file-list="state.fileList" :before-upload="picSize" :on-remove="handleRemove" :before-remove="beforeRemove"> |
| | | <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> |
| | | <template #tip> |
| | | <div class="el-upload__tip">支持上传pdf/word/doc/docx格式文件,尺寸小于2M,最多可上传3张</div> |
| | | </template> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-form-item prop="technology" label="评价结论"> |
| | | <el-form-item prop="conclusion" label="评价结论"> |
| | | <el-input |
| | | v-model="state.formData.technology" |
| | | v-model="state.formData.conclusion" |
| | | :autosize="{ minRows: 6 }" |
| | | maxlength="500" |
| | | show-word-limit |
| | |
| | | </el-form-item> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="9"> |
| | | <el-form-item prop="technology" label="是否有评价报告修改说明"> |
| | | <el-radio-group v-model="state.formData.status" > |
| | | <el-form-item prop="isReviseManual" label="是否有评价报告修改说明"> |
| | | <el-radio-group v-model="state.formData.isReviseManual" > |
| | | <el-radio :label="1">是</el-radio> |
| | | <el-radio :label="0">否</el-radio> |
| | | </el-radio-group> |
| | |
| | | import {defineEmits, onMounted, reactive, ref} from "vue"; |
| | | import {ElMessage} from "element-plus"; |
| | | import {Search} from '@element-plus/icons-vue' |
| | | import {addRisk, editRisk, getRiskDetail} from "@/api/projectManage/riskAnalysis" |
| | | import {addRate, addRisk, editRate, editRisk, getRateDetail, getRiskDetail} from "@/api/projectManage/riskAnalysis" |
| | | import {delPic} from "@/api/login" |
| | | import { getToken } from "@/utils/auth"; |
| | | import Cookies from "js-cookie" |
| | | import {delAccessoryFile} from "@/api/projectManage/project"; |
| | | import axios from "axios"; |
| | | const emit = defineEmits(["getNextStatus"]); |
| | | |
| | | const state = reactive({ |
| | | formData: { |
| | | id: '', |
| | | leader: { |
| | | name: '' |
| | | }, |
| | | leaderId: null, |
| | | linkMan: '', |
| | | transmitPerson: '', |
| | | transmitDate: '' |
| | | isReviseManual: 0, |
| | | }, |
| | | rules: { |
| | | "leader.name": [{required: true, message: '请选择项目负责人', trigger: 'blur'}], |
| | | linkMan: [{required: true, message: '请输入联系人', trigger: 'blur'}], |
| | | linkPhone: [{required: true, message: '请输入联系电话', trigger: 'blur'}], |
| | | transmitDate: [{required: true, message: '请选择任务下达时间', trigger: 'blur'}] |
| | | conclusion: [{required: true, message: '请输入评价结论', trigger: 'blur'}], |
| | | }, |
| | | tableData: [], |
| | | imgLimit: 3, |
| | | uploadUrl: import.meta.env.VITE_APP_BASE_API + '/system/common/uploadFile', |
| | | uploadUrl: import.meta.env.VITE_APP_BASE_API + '/manage/accessory-file/uploadFile', |
| | | header: { |
| | | Authorization: 'Bearer ' + getToken() |
| | | } |
| | | Authorization: getToken() |
| | | }, |
| | | fileList: [], |
| | | uploadData: { |
| | | moduleType: 7 |
| | | }, |
| | | disabled: false |
| | | }) |
| | | const props = { |
| | | expandTrigger: 'hover', |
| | |
| | | if(userInfo.identity === 0){ |
| | | isAmin.value = true; |
| | | } |
| | | if(Cookies.get('projectId')){ |
| | | state.uploadData.projectId = Cookies.get('projectId') |
| | | } |
| | | }) |
| | | |
| | | const riskOpen = async (type,val) => { |
| | | state.uploadData.projectId = val; |
| | | if(type === 'detail' || type === 'edit' ){ |
| | | const res = await getRiskDetail({projectId: val}); |
| | | if(type === 'detail'){ |
| | | state.disabled = true |
| | | } |
| | | const res = await getRateDetail({projectId: val}); |
| | | if(res.code == 200){ |
| | | state.formData = res.data; |
| | | state.formData.isReviseManual = res.data.isReviseManual ? 1 : 0 |
| | | state.fileList = res.data.accessoryFiles.map(item => { |
| | | return { |
| | | ...item, |
| | | name: item.originName, |
| | | } |
| | | }) |
| | | }else { |
| | | ElMessage.warning(res.message) |
| | | } |
| | |
| | | return; |
| | | } |
| | | if(type === 'add'){ |
| | | const {id, ...data} = JSON.parse(JSON.stringify(state.formData)) |
| | | const res = await addRisk(data); |
| | | const {id,attachments, ...data} = JSON.parse(JSON.stringify(state.formData)) |
| | | data.projectId = val; |
| | | const res = await addRate(data); |
| | | if (res.code == 200) { |
| | | ElMessage.success('保存成功') |
| | | formRef.value.clearValidate(); |
| | |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }else if(type === 'clickEdit'){ |
| | | const { ...data} = JSON.parse(JSON.stringify(state.formData)) |
| | | const res = await editRisk(data); |
| | | const { attachments, ...data} = JSON.parse(JSON.stringify(state.formData)) |
| | | const res = await editRate(data); |
| | | if (res.code == 200) { |
| | | ElMessage.success('变更成功') |
| | | formRef.value.clearValidate(); |
| | |
| | | } |
| | | } |
| | | |
| | | // 图片上传 |
| | | // 上传 |
| | | const showTip =()=>{ |
| | | ElMessage({ |
| | | type: 'warning', |
| | |
| | | } |
| | | }; |
| | | |
| | | const handleAvatarSuccess = (res, uploadFile) => { |
| | | if(res.code == 200){ |
| | | // state.registerForm.agency.reportPath = res.data.path |
| | | }else{ |
| | | const handleAvatarSuccess = (res) => { |
| | | if(res.code === 200){ |
| | | console.log("if",state.fileList) |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: '文件上传成功' |
| | | }) |
| | | }else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '文件上传失败' |
| | | }) |
| | | } |
| | | } |
| | | const handlePreview = (file) => { |
| | | let path = ""; |
| | | if(file.path){ |
| | | path = file.path |
| | | }else { |
| | | path = file.response.data.path |
| | | |
| | | } |
| | | const url = import.meta.env.VITE_APP_BASE_API + '/' + path |
| | | axios.get( url,{ |
| | | headers: |
| | | { |
| | | 'Content-Type': 'application/json', |
| | | 'Authorization':getToken(), |
| | | }, |
| | | responseType: 'blob' |
| | | } |
| | | ).then(res=>{ |
| | | if (res) { |
| | | const link = document.createElement('a') |
| | | let blob = new Blob([res.data],{type: res.data.type}) |
| | | link.style.display = "none"; |
| | | link.href = URL.createObjectURL(blob); // 创建URL |
| | | link.setAttribute("download", file.name); |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | document.body.removeChild(link); |
| | | } else { |
| | | this.$message.error('获取文件失败') |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleRemove = async (file, uploadFiles) => { |
| | | const res = await delPic({path: state.registerForm.agency.reportPath}) |
| | | console.log("file",file) |
| | | let accessoryFileId = ""; |
| | | if(file.id){ |
| | | accessoryFileId = file.id |
| | | }else { |
| | | accessoryFileId = file.response.data.id |
| | | |
| | | } |
| | | const res = await delAccessoryFile(accessoryFileId) |
| | | if(res.code == 200){ |
| | | ElMessage({ |
| | | type: 'success', |