From 3f6bf89b1985b6668f02ffcc9af577b412e92e45 Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期一, 24 三月 2025 17:17:45 +0800 Subject: [PATCH] bug修改 --- src/views/safetyReview/projectManage/components/uploadReviewRcd.vue | 73 +++++++++++++++++++++--------------- 1 files changed, 43 insertions(+), 30 deletions(-) diff --git a/src/views/safetyReview/projectManage/components/uploadReviewRcd.vue b/src/views/safetyReview/projectManage/components/uploadReviewRcd.vue index 58a404b..e528f9b 100644 --- a/src/views/safetyReview/projectManage/components/uploadReviewRcd.vue +++ b/src/views/safetyReview/projectManage/components/uploadReviewRcd.vue @@ -4,10 +4,10 @@ <el-row :gutter="30"> <el-col :span="18"> <el-form-item label="附件上传"> - <el-upload accept="image/*,.pdf,.doc,.docx" :action="state.uploadUrl" :data="{moduleType: 6,projectId: props.projectId}" :headers="state.header" method="post" :on-success="handleAvatarSuccess" :on-exceed="showTip" v-model:file-list="state.fileList" :before-upload="picSize" :on-remove="handleRemove"> + <el-upload :disabled="projectType === 'view' || isEnd" accept="image/*,.pdf,.doc,.docx" :action="state.uploadUrl" :data="{moduleType: 6,projectId: props.projectId}" :headers="state.header" method="post" :on-success="handleAvatarSuccess" :on-exceed="showTip" v-model:file-list="state.fileList" :before-upload="picSize" :on-remove="handleRemove"> <el-button type="primary">上传评审记录</el-button> <template #tip> - <div class="el-upload__tip">上传文件尺寸尺寸小于2M</div> + <div class="el-upload__tip">上传文件尺寸尺寸小于5M</div> </template> </el-upload> </el-form-item> @@ -19,7 +19,7 @@ <el-table-column label="操作" header-align="center" class-name="small-padding fixed-width" width="120"> <template #default="scope"> <el-button link type="primary" @click="checkFile(scope.row)">查看</el-button> - <el-button link type="danger" @click="handleRemove(scope.row,[])">删除</el-button> + <el-button link type="danger" @click="handleRemove(scope.row,[])" :disabled="projectType === 'view'">删除</el-button> </template> </el-table-column> </el-table> @@ -35,6 +35,8 @@ import { getToken } from "@/utils/auth"; import Cookies from "js-cookie" import axios from 'axios' +import { useRoute } from 'vue-router' +const route = useRoute() const emit = defineEmits(["getNextStatus"]); const props = defineProps(['projectId']) const state = reactive({ @@ -56,12 +58,19 @@ isAmin.value = true; } getReviewFiles(props.projectId) + isEnd.value = Cookies.get('end') + projectType.value = route.query.type; }) +const projectType = ref(''); +const isEnd = ref('') const riskOpen = async (type,val) => { + projectType.value = route.query.type; + isEnd.value = Cookies.get('end') if(type === 'detail' || type === 'edit' ){ await getReviewFiles } + if(type === 'add' || type === 'clickEdit') { const valid = await formRef.value.validate(); if(valid){ @@ -159,40 +168,44 @@ if(res.code == 200){ getReviewFiles() }else{ + state.fileList.splice(state.fileList.indexOf(uploadFile),1) ElMessage({ type: 'warning', - message: '文件上传失败' + message: res.message }) } } const handleRemove = async (file, uploadFiles) => { - ElMessageBox.confirm( - '确定删除该附件?', - '提示', - { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - }) - .then( async() => { - const res = await delFile(file.id) - if(res.code == 200){ - ElMessage({ - type: 'success', - message: '文件已删除' - }) - await getReviewFiles() - }else{ - ElMessage({ - type: 'warning', - message: res.message - }) - } - }) - .catch(()=>{ - getReviewFiles() - }) + if(file && file.status == 'success'){ + ElMessageBox.confirm( + '确定删除该附件?', + '提示', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + .then( async() => { + const res = await delFile(file.id) + if(res.code == 200){ + ElMessage({ + type: 'success', + message: '文件已删除' + }) + await getReviewFiles() + }else{ + ElMessage({ + type: 'warning', + message: res.message + }) + } + }) + .catch(()=>{ + getReviewFiles() + }) + } + } const checkFile = async (file)=>{ -- Gitblit v1.9.2