From 07f9f8657d057a38792c3822acc9b08d83478967 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 07 五月 2026 14:23:10 +0800
Subject: [PATCH] 合并代码
---
src/views/procurementManagement/procurementInvoiceLedger/index.vue | 201 ++++++++++----------------------------------------
1 files changed, 40 insertions(+), 161 deletions(-)
diff --git a/src/views/procurementManagement/procurementInvoiceLedger/index.vue b/src/views/procurementManagement/procurementInvoiceLedger/index.vue
index b90ef0d..c94d8c2 100644
--- a/src/views/procurementManagement/procurementInvoiceLedger/index.vue
+++ b/src/views/procurementManagement/procurementInvoiceLedger/index.vue
@@ -62,16 +62,16 @@
<el-button
type="primary"
link
- @click="downLoadFile(row)"
+ @click="openEdit(row)"
>
- 闄勪欢
+ 缂栬緫
</el-button>
<el-button
type="primary"
link
- @click="openEdit(row)"
+ @click="openFileDialog(row)"
>
- 缂栬緫
+ 闄勪欢
</el-button>
<el-button
type="primary"
@@ -83,16 +83,7 @@
</template>
</PIMTable>
</div>
- <FileListDialog
- ref="fileListRef"
- v-model="fileListDialogVisible"
- title="闄勪欢鍒楄〃"
- :showUploadButton="true"
- :showDeleteButton="true"
- :deleteMethod="handleDeleteFile"
- :uploadMethod="handleFileUpload"
- :rulesRegulationsManagementId="currentRowId"
- />
+ <FileList v-if="fileDialogVisible" v-model:visible="fileDialogVisible" record-type="ticket_registration" :record-id="recordId" />
<EditModal ref="editmodalRef" @success="getTableData"></EditModal>
</div>
</template>
@@ -113,9 +104,9 @@
import { onMounted } from "vue";
import { ElMessageBox } from "element-plus";
import EditModal from "./Modal/EditModal.vue";
-import FileListDialog from '@/components/Dialog/FileListDialog.vue';
import useUserStore from "@/store/modules/user.js";
const userStore = useUserStore();
+const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
defineOptions({
name: "鏉ョエ鍙拌处",
@@ -164,6 +155,11 @@
label: "渚涘簲鍟嗗悕绉�",
prop: "supplierName",
width: 240,
+ },
+ {
+ label: "浜у搧澶х被",
+ prop: "productCategory",
+ width: 150,
},
{
label: "瑙勬牸鍨嬪彿",
@@ -232,21 +228,32 @@
}
);
-// 涓昏〃鍚堣鏂规硶
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) => {
@@ -274,143 +281,15 @@
onCurrentChange(page);
};
-const downLoadFile = row => {
- currentRowId.value = row.id;
- if (fileListRef.value) {
- fileListRef.value.open(row.commonFiles || []);
- }
-};
+// 鎵撳紑闄勪欢寮圭獥
+const recordId =ref(0)
+const fileDialogVisible = ref(false)
-// 涓婁紶闄勪欢锛堣嚜瀹氫箟涓婁紶鏂规硶锛�
-const handleFileUpload = async () => {
- if (!currentRowId.value) {
- proxy.$modal.msgWarning("缂哄皯鐧昏ID锛屾棤娉曚繚瀛橀檮浠�");
- return;
- }
-
- return new Promise((resolve) => {
- // 鍒涘缓涓�涓殣钘忕殑鏂囦欢杈撳叆鍏冪礌
- const input = document.createElement('input');
- input.type = 'file';
- input.style.display = 'none';
- input.onchange = async (e) => {
- const file = e.target.files[0];
- if (!file) {
- 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',
- data: formData,
- headers: {
- 'Content-Type': 'multipart/form-data',
- Authorization: `Bearer ${getToken()}`
- }
- });
-
- if (uploadRes.code === 200) {
- proxy.$modal.msgSuccess("闄勪欢涓婁紶鎴愬姛");
-
- // 鍒锋柊鍒楄〃鑾峰彇鏈�鏂版暟鎹�
- await new Promise((resolveRefresh) => {
- // 璋冪敤 API 鑾峰彇鏈�鏂板垪琛ㄦ暟鎹�
- productRecordPage({
- ...filters,
- current: pagination.currentPage,
- size: pagination.pageSize
- }).then(({ code, data }) => {
- if (code === 200) {
- // 鏇存柊鏁版嵁鍒楄〃
- dataList.value = data.records;
- pagination.total = data.total;
-
- // 浠庡閮ㄦ暟鎹幏鍙� commonFiles
- const currentRow = dataList.value.find(row => row.id === currentRowId.value);
- if (currentRow && fileListRef.value) {
- // 鍒锋柊闄勪欢鍒楄〃锛屼娇鐢ㄤ粠澶栭儴鑾峰彇鐨勬渶鏂� commonFiles
- fileListRef.value.open(currentRow.commonFiles || []);
- }
- resolveRefresh();
- } else {
- resolveRefresh();
- }
- }).catch(() => {
- resolveRefresh();
- });
- });
-
- resolve({
- name: uploadRes.data?.originalName || file.name,
- url: uploadRes.data?.tempPath || uploadRes.data?.url,
- id: uploadRes.data?.id
- });
- } else {
- proxy.$modal.msgError(uploadRes.msg || "鏂囦欢涓婁紶澶辫触");
- resolve(null);
- }
- } catch (error) {
- console.error("闄勪欢涓婁紶澶辫触:", error);
- proxy.$modal.msgError("闄勪欢涓婁紶澶辫触");
- resolve(null);
- } finally {
- document.body.removeChild(input);
- }
- };
-
- document.body.appendChild(input);
- input.click();
- });
-};
-
-// 鍒犻櫎闄勪欢
-const handleDeleteFile = async (file) => {
- try {
- await delCommonFile([file.id]);
- proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-
- // 鍒锋柊鍒楄〃鑾峰彇鏈�鏂版暟鎹�
- await new Promise((resolveRefresh) => {
- // 璋冪敤 API 鑾峰彇鏈�鏂板垪琛ㄦ暟鎹�
- productRecordPage({
- ...filters,
- current: pagination.currentPage,
- size: pagination.pageSize
- }).then(({ code, data }) => {
- if (code === 200) {
- // 鏇存柊鏁版嵁鍒楄〃
- dataList.value = data.records;
- pagination.total = data.total;
-
- // 浠庡閮ㄦ暟鎹幏鍙� commonFiles
- const currentRow = dataList.value.find(row => row.id === currentRowId.value);
- if (currentRow && fileListRef.value) {
- // 鍒锋柊闄勪欢鍒楄〃锛屼娇鐢ㄤ粠澶栭儴鑾峰彇鐨勬渶鏂� commonFiles
- fileListRef.value.open(currentRow.commonFiles || []);
- }
- resolveRefresh();
- } else {
- resolveRefresh();
- }
- }).catch(() => {
- resolveRefresh();
- });
- });
-
- return true;
- } catch (error) {
- proxy.$modal.msgError("鍒犻櫎澶辫触");
- return false;
- }
-};
+// 鎵撳紑闄勪欢寮规
+const openFileDialog = async (row) => {
+ recordId.value = row.id
+ fileDialogVisible.value = true
+}
const openEdit = (row) => {
editmodalRef.value.open(row);
--
Gitblit v1.9.3