From 183ce0e0adb68fc0ef2f56045dbf3a1b374dd767 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期二, 03 三月 2026 10:10:51 +0800
Subject: [PATCH] fix: 工序工时定额添加单位
---
src/views/salesManagement/receiptPayment/index.vue | 41 +++++++++++++++++++++++++++++++++++++----
1 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/src/views/salesManagement/receiptPayment/index.vue b/src/views/salesManagement/receiptPayment/index.vue
index 40e6f14..83cf942 100644
--- a/src/views/salesManagement/receiptPayment/index.vue
+++ b/src/views/salesManagement/receiptPayment/index.vue
@@ -40,6 +40,7 @@
<el-table
:data="tableData"
border
+ ref="tableRef"
v-loading="tableLoading"
@selection-change="handleSelectionChange"
:row-key="(row) => row.id"
@@ -313,6 +314,7 @@
});
const total = ref(0);
const expandedRowKeys = ref([]);
+const tableRef = ref(null);
// 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
const dialogFormVisible = ref(false);
@@ -335,7 +337,7 @@
const getStatusTagType = (statusName = '') => {
const normalized = statusName.trim();
if (!normalized) return 'info';
- return normalized === '鏈畬鎴愬洖娆�' ? 'danger' : 'success';
+ return normalized === '鏈畬鎴愪粯娆�' ? 'danger' : 'success';
};
// 鏌ヨ鍒楄〃
/** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -421,7 +423,11 @@
proxy.$modal.msgError("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
return;
}
- const validRows = selectedRows.value.filter((item) => item.noReceiptAmount !== 0);
+ // 浠呭厑璁糕�滃緟鍥炴閲戦 > 0鈥濈殑璁板綍杩涘叆鏂板鍥炴寮圭獥锛屽苟杩囨护鎺夊彲鑳芥贩鍏ョ殑绌哄璞�
+ const validRows = selectedRows.value.filter((item) => {
+ if (!item || !item.id) return false;
+ return Number(item.pendingInvoiceTotal ?? 0) > 0;
+ });
if (validRows.length === 0) {
proxy.$modal.msgWarning("鎵�閫夎褰曞潎鏃犻渶鍥炴");
return;
@@ -433,7 +439,8 @@
specificationModel: row.specificationModel || "",
pendingInvoiceTotal: Number(row.pendingInvoiceTotal || 0),
taxRate: row.taxRate ?? "",
- receiptPaymentAmount: "",
+ // 榛樿鏈鍥炴閲戦 = 寰呭洖娆鹃噾棰�
+ receiptPaymentAmount: Number(row.pendingInvoiceTotal || 0),
receiptPaymentType: "",
registrant: userStore.nickName,
receiptPaymentDate: "",
@@ -484,6 +491,9 @@
const closeDia = () => {
forms.value = [];
dialogFormVisible.value = false;
+ // 閬垮厤浜屾鎵撳紑寮圭獥鏃朵粛鎼哄甫涓婁竴娆$殑閫夋嫨瀵艰嚧鈥滃鍑轰竴琛�/鑴忔暟鎹��
+ selectedRows.value = [];
+ tableRef.value?.clearSelection();
};
// 鍒犻櫎鍥炴璁板綍
@@ -518,12 +528,35 @@
// 淇濆瓨鍥炴璁板綍
const saveReceiptPayment = (row) => {
+ // 瀛愯〃鍥炴閲戦鍚堣鏍¢獙锛氭墍鏈夊洖娆捐褰曢噾棰濅箣鍜屼笉鑳藉ぇ浜庣埗鏁版嵁鍚堝悓閲戦
+ // 杩欓噷鐖舵暟鎹�滃悎鍚岄噾棰濃�濇寜锛氬凡鍥炴閲戦( invoiceTotal ) + 寰呭洖娆鹃噾棰�( pendingInvoiceTotal ) 璁$畻
+ const findParentRowByChildId = (childId) => {
+ return tableData.value.find((p) =>
+ Array.isArray(p.children) && p.children.some((c) => c.id === childId)
+ );
+ };
+ const parentRow = findParentRowByChildId(row.id);
+ if (parentRow) {
+ const contractAmount =
+ Number(parentRow.invoiceTotal || 0) + Number(parentRow.pendingInvoiceTotal || 0);
+ const sumReceipt = (parentRow.children || []).reduce((sum, item) => {
+ const val = Number(item?.receiptPaymentAmount ?? 0);
+ return sum + (Number.isFinite(val) ? val : 0);
+ }, 0);
+ if (sumReceipt > contractAmount) {
+ proxy.$modal.msgError(
+ `鍥炴閲戦鍚堣(${sumReceipt.toFixed(2)})涓嶈兘澶т簬鍚堝悓閲戦(${contractAmount.toFixed(2)})`
+ );
+ return;
+ }
+ }
+
let updateData = {
id: row.id,
receiptPaymentType: row.receiptPaymentType,
receiptPaymentAmount: row.receiptPaymentAmount,
};
- receiptPaymentSaveOrUpdate(updateData).then((res) => {
+ receiptPaymentSaveOrUpdate([updateData]).then((res) => {
row.editType = !row.editType;
getList();
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
--
Gitblit v1.9.3