| | |
| | | <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" |
| | |
| | | </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, |
| | | }, |
| | |
| | | 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("删除失败"); |