| | |
| | | destroy-on-close |
| | | :close-on-click-modal="false" |
| | | > |
| | | <div class="detail-container" v-if="dialogReadonly"> |
| | | <div class="detail-container detail-container1" v-if="dialogReadonly"> |
| | | <el-row class="detail-row-view"> |
| | | <el-col :span="12"> |
| | | <div class="label">标题</div> |
| | |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <div class="label">相关附件</div> |
| | | <div class="val">{{ formData.attachName || '暂无附件' }}</div> |
| | | <div class="val">{{ formData.attachNames || '暂无附件' }}</div> |
| | | </el-col> |
| | | <el-col :span="12" v-if="detailObjectionStatus === '2'"> |
| | | <div class="label">其他异议详情</div> |
| | |
| | | <div class="val">{{ formData.reviewOpinion }}</div> |
| | | </el-col> |
| | | </el-row> |
| | | <div v-if=" detailObjectionStatus === '1'"> |
| | | <div v-if=" detailObjectionStatus === '1' && !requesterProvider"> |
| | | <div class="detail-title" :style="{ marginTop:pxToRem(20)}">异议反馈</div> |
| | | <el-form ref="feedbackFormRef" class="gd-dialog-form" :model="feedbackFormData" |
| | | :rules="feedbackRules" label-width="140px"> |
| | |
| | | <div class="upload-container"> |
| | | <el-upload |
| | | :http-request="handleHttpRequest" |
| | | :limit="3" |
| | | :on-success="handleUploadSuccess" |
| | | :on-error="handleUploadError" |
| | | :on-remove="handleFileRemove" |
| | |
| | | <el-button type="primary">选择文件</el-button> |
| | | </template> |
| | | <template #tip> |
| | | <div class="el-upload__tip">支持上传 (.zip/.rar/.7z/.tar/.gz)格式文件</div> |
| | | <div class="el-upload__tip">支持上传 (.zip/.rar/.7z/.tar/.gz)格式</div> |
| | | </template> |
| | | </el-upload> |
| | | </div> |
| | |
| | | <template #footer> |
| | | <template v-if="!dialogReadonly"> |
| | | <el-button |
| | | class="save-btn" |
| | | color="#4C34FF" |
| | | v-if="!dialogReadonly" |
| | | :loading="submitting" |
| | | :disabled="submitting" |
| | | @click="handleSubmit" |
| | | > |
| | | 保存 |
| | | </el-button> |
| | | <el-button color="#F2F3F5" :loading="submitting" :disabled="submitting" @click="handleApply">申请</el-button> |
| | | color="#F2F3F5" |
| | | |
| | | v-if="!dialogReadonly" |
| | | :loading="submitting || uploading" |
| | | :disabled="submitting || uploading" |
| | | @click="handleSubmit" |
| | | > |
| | | 保存 |
| | | </el-button> |
| | | <el-button class="" color="#4C34FF" :loading="submitting || uploading" :disabled="submitting || uploading" @click="handleApply">申请</el-button> |
| | | </template> |
| | | <template v-if="dialogReadonly && detailObjectionStatus === '1'"> |
| | | <template v-if="dialogReadonly && detailObjectionStatus === '1' && !requesterProvider"> |
| | | <el-button color="#F2F3F5" :loading="submitting" :disabled="submitting" @click="visible = false">取消</el-button> |
| | | |
| | | <el-button |
| | | class="save-btn" |
| | | class="" |
| | | color="#4C34FF" |
| | | |
| | | :loading="submitting" |
| | |
| | | > |
| | | 反馈 |
| | | </el-button> |
| | | <el-button |
| | | class="" |
| | | color="#4C34FF" |
| | | |
| | | :loading="submitting" |
| | | :disabled="submitting" |
| | | @click="handleDownloadAttach" |
| | | |
| | | > |
| | | 下载附件 |
| | | </el-button> |
| | | </template> |
| | | <template v-if="detailDemandStatus === '2'"> |
| | | <el-button color="#F2F3F5" :loading="submitting" :disabled="submitting" @click="visible = false">关闭</el-button> |
| | | <template v-if="detailObjectionStatus === '2'"> |
| | | <!-- <el-button color="#F2F3F5" :loading="submitting" :disabled="submitting" @click="visible = false">关闭</el-button>--> |
| | | </template> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | import { |
| | | gdDataObjectionDetailApi, |
| | | gdDataObjectionSubmitApi, |
| | | getAttachDetailApi, |
| | | } from '@/views/orderView/orderDataManage/dataObjection/dataObjectionApi' |
| | | import { putFileAttachApi } from '@/views/orderView/orderDataManage/supplyAdd/supplyAddApi' |
| | | import { pxToRem } from '@/utils/rem' |
| | | import { useStore } from 'vuex' |
| | | const store = useStore() |
| | | const requesterProvider = computed(() => store.state.user.userInfo?.role_id === '2014158512610869250') |
| | | // 初始化表单数据 |
| | | const initForm = () => ({ |
| | | id:'', |
| | | title: '', |
| | | objectionType: '', |
| | | submitter: '', |
| | |
| | | const titleEnum = ref({ edit: '编辑', view: '查看', add: '数据异议申请' }) |
| | | const fileList = ref([]) // 上传文件列表 |
| | | const uploadedFiles = ref([]) // 已上传文件列表 |
| | | const attachmentDetailsList = ref([]) |
| | | const uploading = ref(false) // 文件上传中状态 |
| | | |
| | | // 表单校验规则 |
| | | const rules = { |
| | |
| | | catalogResourceName: fieldRules(true), |
| | | objectionDesc: fieldRules(true), |
| | | objectionBasis: fieldRules(true), |
| | | // attachId: dialogMode.value === 'add' ? fieldRules(true) : fieldRules(false) |
| | | |
| | | } |
| | | |
| | | // 异议反馈表单校验规则 |
| | |
| | | |
| | | // 自定义上传请求 |
| | | const handleHttpRequest = async options => { |
| | | uploading.value = true |
| | | try { |
| | | const formDataObj = new FormData() |
| | | formDataObj.append('file', options.file) |
| | |
| | | } catch (error) { |
| | | options.onError(error) |
| | | console.error('文件上传失败:', error) |
| | | } finally { |
| | | uploading.value = false |
| | | } |
| | | } |
| | | |
| | | // 文件移除 |
| | | const handleFileRemove = (file, fileListVal) => { |
| | | if (file.response && file.response.attachId) { |
| | | uploadedFiles.value = uploadedFiles.value.filter(item => item.attachId !== file.response.attachId) |
| | | } |
| | | // 更新formData中的附件信息 |
| | | formData.value.attachId = uploadedFiles.value.map(f => f.attachId).join(',') |
| | | formData.value.attachName = uploadedFiles.value.map(f => f.originalName).join(',') |
| | | uploadedFiles.value = fileListVal |
| | | } |
| | | |
| | | // 上传前验证 |
| | |
| | | ElMessage.error('只能上传压缩文件格式:.zip/.rar/.7z/.tar/.gz') |
| | | return false |
| | | } |
| | | const maxSize = 100 * 1024 * 1024 // 100MB |
| | | if (file.size > maxSize) { |
| | | ElMessage.error('文件大小不能超过100MB') |
| | | return false |
| | | } |
| | | // const maxSize = 100 * 1024 * 1024 // 100MB |
| | | // if (file.size > maxSize) { |
| | | // ElMessage.error('文件大小不能超过100MB') |
| | | // return false |
| | | // } |
| | | return true |
| | | } |
| | | |
| | |
| | | link: fileData.link, |
| | | attachId: fileData.attachId, |
| | | }) |
| | | // 更新formData中的附件信息 |
| | | formData.value.attachId = uploadedFiles.value.map(f => f.attachId).join(',') |
| | | formData.value.attachName = uploadedFiles.value.map(f => f.originalName).join(',') |
| | | ElMessage.success('文件上传成功!') |
| | | } |
| | | } |
| | |
| | | async function submitForm(objectionStatus) { |
| | | const isValid = await formRef.value?.validate().catch(() => false) |
| | | if (!isValid) return |
| | | // 只在新增时校验附件是否上传 |
| | | if (dialogMode.value === 'add' && uploadedFiles.value.length === 0) { |
| | | ElMessage.warning('请上传附件') |
| | | return |
| | | } |
| | | submitting.value = true |
| | | |
| | | try { |
| | | // 构建符合接口要求的提交数据 |
| | | const submitData = { |
| | | // 编辑模式下传递id |
| | | ...(formData.value.id && { id: formData.value.id }), |
| | | title: formData.value.title, |
| | | objectionType: formData.value.objectionType, |
| | | submitter: formData.value.submitter, |
| | |
| | | objectionBasis: formData.value.objectionBasis, |
| | | areaCode: formData.value.areaCode || '', |
| | | handleUnit: formData.value.handleUnit || '', |
| | | // 构建附件列表 |
| | | attachmentList: uploadedFiles.value.map(file => ({ |
| | | attachId: file.attachId, |
| | | attachName: file.originalName, |
| | | })), |
| | | // 只在有附件时才构建附件列表 |
| | | ...(uploadedFiles.value.length > 0 && { |
| | | attachmentList: uploadedFiles.value.map(file => ({ |
| | | attachId: file.attachId, |
| | | attachName: file.originalName, |
| | | })), |
| | | }), |
| | | objectionStatus: objectionStatus |
| | | } |
| | | await gdDataObjectionSubmitApi(submitData) |
| | |
| | | if (!formData.value.id) return |
| | | const res = await gdDataObjectionDetailApi({ id: formData.value.id }) |
| | | formData.value = res?.data?.data ?? {} |
| | | if (formData.value.attachIds) { |
| | | getAttachDetail(formData.value.attachIds) |
| | | } |
| | | } |
| | | // 获取附件详情 |
| | | async function getAttachDetail(attachIds) { |
| | | // 如果 attachIds 是字符串,尝试分割成数组 |
| | | const ids = typeof attachIds === 'string' ? attachIds.split(',') : Array.isArray(attachIds) ? attachIds : [attachIds] |
| | | const detailPromises = ids.map(id => getAttachDetailApi({ id })) |
| | | const results = await Promise.all(detailPromises) |
| | | attachmentDetailsList.value = results.map(res => res.data.data).filter(Boolean) |
| | | } |
| | | // 处理附件下载 |
| | | async function handleDownloadAttach() { |
| | | if (attachmentDetailsList.value.length === 0) { |
| | | ElMessage.warning('没有可下载的附件') |
| | | return |
| | | } |
| | | |
| | | // 遍历所有附件并下载 |
| | | attachmentDetailsList.value.forEach(attach => { |
| | | if (attach.link) { |
| | | const link = document.createElement('a') |
| | | link.href = attach.link |
| | | link.download = attach.originalName || attach.name |
| | | link.style.display = 'none' |
| | | document.body.appendChild(link) |
| | | link.click() |
| | | document.body.removeChild(link) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | |
| | | // 打开弹框 |
| | | async function open({ mode = 'add', row } = {}) { |
| | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .detail-container { |
| | | padding: 20px; |
| | | .detail-container1 { |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | .upload-container { |
| | | width: 100%; |
| | | .el-upload__tip { |
| | | display: inline; |
| | | } |
| | | } |
| | | .label { |
| | | width: 120px !important; |