From ea7fb9cc590a198d438d44a2aec7b0393194a07d Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 21 九月 2026 20:52:43 +0800
Subject: [PATCH] 新疆-融邦环保 1.新增到货记录模块:销售台账页入口,车辆随出库单联动,到货上限=该台账分摊量,附件走永久链接
---
src/views/salesManagement/deliveryLedger/index.vue | 124 ++++++++---------------------------------
1 files changed, 24 insertions(+), 100 deletions(-)
diff --git a/src/views/salesManagement/deliveryLedger/index.vue b/src/views/salesManagement/deliveryLedger/index.vue
index c238f77..83a49e5 100644
--- a/src/views/salesManagement/deliveryLedger/index.vue
+++ b/src/views/salesManagement/deliveryLedger/index.vue
@@ -45,18 +45,13 @@
<el-button type="danger" plain @click="handleDelete">鍒犻櫎</el-button>
</div>
</div>
- <!-- 娌瑰搧鍑哄簱鐖惰鐨� children 鏄埌璐ц褰曪紝闈� row-key + children 娓叉煋鎴愬瓙琛� -->
+ <!-- 鍒拌揣璁板綍涓嶅湪鍒楄〃閲屽睍寮�锛屽彧鍦ㄨ鎯呭脊妗嗗睍绀� -->
<el-table
:data="tableData"
border
v-loading="tableLoading"
@selection-change="handleSelectionChange"
- :row-key="
- (row) =>
- row.source
- ? `${row.source}-${row.stockOutRecordId ?? row.id}`
- : `arrival-${row.id}`
- "
+ :row-key="deliveryRowKey"
style="width: 100%"
height="calc(100vh - 21.5em)"
>
@@ -171,18 +166,6 @@
show-overflow-tooltip
/>
<el-table-column
- label="瀹℃牳鐘舵��"
- prop="status"
- align="center"
- width="100"
- >
- <template #default="scope">
- <el-tag :type="getApprovalStatusType(scope.row.status)">
- {{ getApprovalStatusText(scope.row.status) }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column
label="鍑哄簱鍗曞彿"
prop="outboundBatches"
show-overflow-tooltip
@@ -197,7 +180,6 @@
<!-- @click="openForm('edit', scope.row)">鍙戣揣-->
<!-- </el-button>-->
<el-button
- v-if="!isArrivalRow(scope.row)"
link
type="primary"
style="color: #67c23a"
@@ -317,9 +299,6 @@
<el-descriptions-item label="鍙戣揣鏃ユ湡">{{
detailRow.shippingDate || "--"
}}</el-descriptions-item>
- <el-descriptions-item label="瀹℃牳鐘舵��">{{
- getApprovalStatusText(detailRow.status)
- }}</el-descriptions-item>
<el-descriptions-item label="鍙戣揣杞︾墝鍙�">{{
detailRow.shippingCarNumber || "--"
}}</el-descriptions-item>
@@ -431,8 +410,10 @@
const detailDialogVisible = ref(false);
const detailRow = ref(null);
const detailProductList = ref([]);
-// 娌瑰搧鍑哄簱鐖惰鐨勫埌璐ц褰曪紙瀛愯锛�
+// 娌瑰搧鍑哄簱鐖惰鐨勫埌璐ц褰曪細鍒楄〃涓嶅睍寮�锛屽彧鍦ㄨ鎯呭脊妗嗛噷灞曠ず
const detailArrivalList = ref([]);
+// 鐖惰 row-key -> 璇ヨ鐨勫埌璐ц褰曪紝鍒楄〃鎺ュ彛鐨� children 鎽樹笅鏉ユ斁杩欓噷
+const arrivalMap = new Map();
// 鍒拌揣闄勪欢鍚庣瀛� JSON 瀛楃涓诧紝鍑哄弬鍙兘鏄暟缁勪篃鍙兘鏄覆
const toAttachmentList = (value) => {
@@ -462,7 +443,7 @@
const data = reactive({
searchForm: {
shippingNo: "", // 鍙戣揣鍗曞彿锛堜袱绫绘潵婧愰兘鍖归厤锛�
- salesContractNo: "", // 閿�鍞悎鍚屽彿锛堝彧鍖归厤鍙戣揣鍗曡锛�
+ salesContractNo: "", // 閿�鍞悎鍚屽彿锛堝鍙拌处鍑哄簱鍛戒腑浠讳竴鍚堝悓鍙峰嵆杩斿洖璇ヨ锛�
shippingCarNumber: "", // 杞︾墝鍙�
},
form: {
@@ -505,7 +486,17 @@
deliveryLedgerListPage({ ...searchForm.value, ...page })
.then((res) => {
tableLoading.value = false;
- tableData.value = res.data.records || [];
+ const records = res.data.records || [];
+ // 鍒拌揣璁板綍涓嶅仛灞傜骇灞曞紑锛坋l-table 瑙佸埌 children 灏变細娓叉煋鎴愬瓙琛岋級锛�
+ // 浣嗚鎯呭脊妗嗚繕瑕佸睍绀猴紝鍏堟寜鐖惰鎽樺嚭鏉ュ瓨鐫�
+ arrivalMap.clear();
+ records.forEach((row) => {
+ if (Array.isArray(row.children) && row.children.length) {
+ arrivalMap.set(deliveryRowKey(row), row.children);
+ }
+ delete row.children;
+ });
+ tableData.value = records;
total.value = res.data.total || 0;
})
.catch(() => {
@@ -516,17 +507,12 @@
// 娌瑰搧鍑哄簱琛屾潵鑷� stock_out_record锛宨d 涓� shipping_info 浼氭挒鍙凤紝
// 鍙戣揣/鍒犻櫎/璇︽儏绛夋帴鍙h儗鍚庨兘鏄� shipping_info锛屼笉鑳界敤浜庤繖绫昏
const isOilOutRow = (row) => row?.source === "oilOut";
-// 灞傜骇灞曠ず鏃跺埌璐ц褰曟寕鍦ㄧ埗琛岀殑 children 涓婏紝瀛愯娌℃湁 source
-const isArrivalRow = (row) => !row?.source;
-const sourceLabel = (row) => {
- if (isArrivalRow(row)) return "鍒拌揣";
- return isOilOutRow(row) ? "娌瑰搧鍑哄簱" : "鍙戣揣鍗�";
-};
-const sourceTagType = (row) => {
- if (isArrivalRow(row)) return "warning";
- return isOilOutRow(row) ? "success" : "info";
-};
-const isRowSelectable = (row) => !isOilOutRow(row) && !isArrivalRow(row);
+// 涓や釜鏉ユ簮鐨� id 涓嶅悓鍩燂紝row-key 蹇呴』甯︿笂鏉ユ簮锛涘埌璐ц褰曡鑳芥寜鐖惰鍙嶆煡鍥炴潵
+const deliveryRowKey = (row) =>
+ `${row?.source ?? "shipping"}-${row?.stockOutRecordId ?? row?.id}`;
+const sourceLabel = (row) => (isOilOutRow(row) ? "娌瑰搧鍑哄簱" : "鍙戣揣鍗�");
+const sourceTagType = (row) => (isOilOutRow(row) ? "success" : "info");
+const isRowSelectable = (row) => !isOilOutRow(row);
// 琛ㄦ牸閫夋嫨鏁版嵁
const handleSelectionChange = (selection) => {
@@ -560,7 +546,7 @@
const openDetail = async (row) => {
detailRow.value = row || null;
detailProductList.value = [];
- detailArrivalList.value = Array.isArray(row?.children) ? row.children : [];
+ detailArrivalList.value = arrivalMap.get(deliveryRowKey(row)) || [];
detailDialogVisible.value = true;
// 娌瑰搧鍑哄簱琛屼笉璧板彂璐у崟璇︽儏鎺ュ彛锛坕d 浼氭挒鍙凤級锛岀洿鎺ョ敤鍒楄〃琛屾暟鎹睍绀�
if (!row?.id || isOilOutRow(row)) return;
@@ -819,68 +805,6 @@
}
}
}
-
-// 鑾峰彇瀹℃牳鐘舵�佹枃鏈�
-const getApprovalStatusText = (status) => {
- if (status === null || status === undefined || status === "") {
- return "寰呭鏍�";
- }
- // 濡傛灉鏄暟瀛�
- if (typeof status === "number") {
- const statusMap = {
- 0: "寰呭鏍�",
- 1: "瀹℃牳涓�",
- 2: "瀹℃牳鎷掔粷",
- 3: "瀹℃牳閫氳繃",
- };
- return statusMap[status] || "寰呭鏍�";
- }
- // 濡傛灉鏄瓧绗︿覆锛岀洿鎺ヨ繑鍥炴垨鏄犲皠
- const statusStr = String(status).trim();
- const statusTextMap = {
- 寰呭鏍�: "寰呭鏍�",
- 瀹℃牳涓�: "瀹℃牳涓�",
- 瀹℃牳鎷掔粷: "瀹℃牳鎷掔粷",
- 瀹℃牳閫氳繃: "瀹℃牳閫氳繃",
- 宸插彂璐�: "宸插彂璐�",
- 0: "寰呭鏍�",
- 1: "瀹℃牳涓�",
- 2: "瀹℃牳鎷掔粷",
- 3: "瀹℃牳閫氳繃",
- };
- return statusTextMap[statusStr] || statusStr || "寰呭鏍�";
-};
-
-// 鑾峰彇瀹℃牳鐘舵�佹爣绛剧被鍨嬶紙棰滆壊锛�
-const getApprovalStatusType = (status) => {
- if (status === null || status === undefined || status === "") {
- return "info";
- }
- // 濡傛灉鏄暟瀛�
- if (typeof status === "number") {
- const typeMap = {
- 0: "info", // 寰呭鏍� - 鐏拌壊
- 1: "warning", // 瀹℃牳涓� - 榛勮壊
- 2: "danger", // 瀹℃牳鎷掔粷 - 绾㈣壊
- 3: "success", // 瀹℃牳閫氳繃 - 缁胯壊
- };
- return typeMap[status] || "info";
- }
- // 濡傛灉鏄瓧绗︿覆
- const statusStr = String(status).trim();
- const typeTextMap = {
- 寰呭鏍�: "info",
- 瀹℃牳涓�: "warning",
- 瀹℃牳鎷掔粷: "danger",
- 瀹℃牳閫氳繃: "success",
- 宸插彂璐�: "success",
- 0: "info",
- 1: "warning",
- 2: "danger",
- 3: "success",
- };
- return typeTextMap[statusStr] || "info";
-};
// 妫�鏌ュ鏍哥姸鎬佹槸鍚︿负"瀹℃牳閫氳繃"
const isApproved = (status) => {
--
Gitblit v1.9.3