| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="filters" :inline="true"> |
| | | <el-form-item label="采购合同号"> |
| | | <el-form-item label="采购单号"> |
| | | <el-input |
| | | v-model="filters.purchaseContractNumber" |
| | | style="width: 240px" |
| | |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | @click="downLoadFile(row)" |
| | | @click="openEdit(row)" |
| | | > |
| | | 附件 |
| | | 编辑 |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | | link |
| | | @click="openEdit(row)" |
| | | @click="downLoadFile(row)" |
| | | > |
| | | 编辑 |
| | | 附件 |
| | | </el-button> |
| | | <el-button |
| | | type="primary" |
| | |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | <FileListDialog |
| | | ref="fileListRef" |
| | | <FileListDialog |
| | | ref="fileListRef" |
| | | v-model="fileListDialogVisible" |
| | | title="附件列表" |
| | | :showUploadButton="true" |
| | |
| | | } = usePaginationApi( |
| | | productRecordPage, |
| | | { |
| | | purchaseContractNumber: undefined, // 采购合同号 |
| | | purchaseContractNumber: undefined, // 采购单号 |
| | | supplierName: undefined, // 供应商 |
| | | createdAt: [], // 来票日期 |
| | | }, |
| | | [ |
| | | { |
| | | label: "采购合同号", |
| | | label: "采购单号", |
| | | prop: "purchaseContractNumber", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "销售合同号", |
| | | label: "销售单号", |
| | | prop: "salesContractNo", |
| | | width: 150, |
| | | }, |
| | |
| | | label: "供应商名称", |
| | | prop: "supplierName", |
| | | width: 240, |
| | | }, |
| | | { |
| | | label: "产品大类", |
| | | prop: "productCategory", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "规格型号", |
| | |
| | | } |
| | | ); |
| | | |
| | | // 主表合计方法 |
| | | const summarizeMainTable = (param) => { |
| | | return proxy.summarizeTable( |
| | | const sums = proxy.summarizeTable( |
| | | param, |
| | | [ |
| | | "taxInclusiveTotalPrice", |
| | | "ticketsAmount", |
| | | "unTicketsPrice", |
| | | "invoiceAmount", |
| | | ], |
| | | ["ticketsAmount", "unTicketsPrice", "invoiceAmount"], |
| | | { |
| | | ticketsNum: { noDecimal: true }, // 不保留小数 |
| | | futureTickets: { noDecimal: true }, // 不保留小数 |
| | | ticketsNum: { noDecimal: true }, |
| | | futureTickets: { noDecimal: true }, |
| | | } |
| | | ); |
| | | |
| | | const keySet = new Set(); |
| | | let taxInclusiveSum = 0; |
| | | (param.data || []).forEach((row) => { |
| | | const key = `${row.purchaseContractNumber ?? ""}\n${row.salesContractNo ?? ""}\n${row.productCategory ?? ""}\n${row.specificationModel ?? ""}`; |
| | | if (keySet.has(key)) return; |
| | | keySet.add(key); |
| | | const val = Number(row.taxInclusiveTotalPrice); |
| | | if (!isNaN(val)) taxInclusiveSum += val; |
| | | }); |
| | | const taxInclusiveIndex = (param.columns || []).findIndex( |
| | | (c) => c.property === "taxInclusiveTotalPrice" |
| | | ); |
| | | if (taxInclusiveIndex !== -1) { |
| | | sums[taxInclusiveIndex] = taxInclusiveSum.toFixed(2); |
| | | } |
| | | return sums; |
| | | }; |
| | | |
| | | const handleSelectionChange = (val) => { |
| | |
| | | proxy.$modal.msgWarning("缺少登记ID,无法保存附件"); |
| | | return; |
| | | } |
| | | |
| | | |
| | | return new Promise((resolve) => { |
| | | // 创建一个隐藏的文件输入元素 |
| | | const input = document.createElement('input'); |
| | |
| | | resolve(null); |
| | | return; |
| | | } |
| | | |
| | | |
| | | try { |
| | | // 使用 FormData 上传文件 |
| | | const formData = new FormData(); |
| | | formData.append('file', file); |
| | | formData.append('type', '4'); // type 参数,用户未指定具体值,先传空字符串 |
| | | formData.append('id', currentRowId.value); // 当前行的 id |
| | | |
| | | |
| | | const uploadRes = await request({ |
| | | url: '/file/uploadByCommon', |
| | | method: 'post', |
| | |
| | | Authorization: `Bearer ${getToken()}` |
| | | } |
| | | }); |
| | | |
| | | |
| | | if (uploadRes.code === 200) { |
| | | proxy.$modal.msgSuccess("附件上传成功"); |
| | | |
| | | |
| | | // 刷新列表获取最新数据 |
| | | await new Promise((resolveRefresh) => { |
| | | // 调用 API 获取最新列表数据 |
| | |
| | | // 更新数据列表 |
| | | dataList.value = data.records; |
| | | pagination.total = data.total; |
| | | |
| | | |
| | | // 从外部数据获取 commonFiles |
| | | const currentRow = dataList.value.find(row => row.id === currentRowId.value); |
| | | if (currentRow && fileListRef.value) { |
| | |
| | | resolveRefresh(); |
| | | }); |
| | | }); |
| | | |
| | | |
| | | resolve({ |
| | | name: uploadRes.data?.originalName || file.name, |
| | | url: uploadRes.data?.tempPath || uploadRes.data?.url, |
| | |
| | | document.body.removeChild(input); |
| | | } |
| | | }; |
| | | |
| | | |
| | | document.body.appendChild(input); |
| | | input.click(); |
| | | }); |
| | |
| | | try { |
| | | await delCommonFile([file.id]); |
| | | proxy.$modal.msgSuccess("删除成功"); |
| | | |
| | | |
| | | // 刷新列表获取最新数据 |
| | | await new Promise((resolveRefresh) => { |
| | | // 调用 API 获取最新列表数据 |
| | |
| | | // 更新数据列表 |
| | | dataList.value = data.records; |
| | | pagination.total = data.total; |
| | | |
| | | |
| | | // 从外部数据获取 commonFiles |
| | | const currentRow = dataList.value.find(row => row.id === currentRowId.value); |
| | | if (currentRow && fileListRef.value) { |
| | |
| | | resolveRefresh(); |
| | | }); |
| | | }); |
| | | |
| | | |
| | | return true; |
| | | } catch (error) { |
| | | proxy.$modal.msgError("删除失败"); |