| | |
| | | </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> |
| | |
| | | <template #footer> |
| | | <template v-if="!dialogReadonly"> |
| | | <el-button |
| | | class="save-btn" |
| | | color="#4C34FF" |
| | | color="#F2F3F5" |
| | | |
| | | v-if="!dialogReadonly" |
| | | :loading="submitting" |
| | | :disabled="submitting" |
| | |
| | | > |
| | | 保存 |
| | | </el-button> |
| | | <el-button color="#F2F3F5" :loading="submitting" :disabled="submitting" @click="handleApply">申请</el-button> |
| | | <el-button class="save-btn" color="#4C34FF" :loading="submitting" :disabled="submitting" @click="handleApply">申请</el-button> |
| | | </template> |
| | | <template v-if="dialogReadonly && detailObjectionStatus === '1'"> |
| | | <el-button color="#F2F3F5" :loading="submitting" :disabled="submitting" @click="visible = false">取消</el-button> |
| | |
| | | > |
| | | 反馈 |
| | | </el-button> |
| | | <el-button |
| | | class="save-btn" |
| | | 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' |
| | |
| | | const titleEnum = ref({ edit: '编辑', view: '查看', add: '数据异议申请' }) |
| | | const fileList = ref([]) // 上传文件列表 |
| | | const uploadedFiles = ref([]) // 已上传文件列表 |
| | | const attachmentDetailsList = ref([]) |
| | | |
| | | // 表单校验规则 |
| | | const rules = { |
| | |
| | | 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(',') |
| | | } |
| | | |
| | | // 上传前验证 |
| | |
| | | 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('文件上传成功!') |
| | | } |
| | | } |
| | |
| | | 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) |
| | | console.log('附件详情', attachmentDetailsList.value) |
| | | } |
| | | // 处理附件下载 |
| | | 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 } = {}) { |