From f3590d3b29112c8d18315c1f7e93c8a57b27e3ec Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 10 六月 2026 17:19:00 +0800
Subject: [PATCH] feat:销售台账顺序和导出顺序优化

---
 src/views/salesManagement/salesLedger/index.vue |   47 +++++++++++++++++++++++++----------------------
 1 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 9762553..3498e5c 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -149,8 +149,7 @@
               </el-dropdown-menu>
             </template>
           </el-dropdown>
-          <el-button @click="handleOut"
-                     :disabled="isBatchButtonDisabled('export')">瀵煎嚭</el-button>
+          <el-button @click="handleOut">瀵煎嚭</el-button>
           <el-button type="danger"
                      plain
                      @click="handleDelete"
@@ -4317,30 +4316,34 @@
     proxy.$refs["importUploadRef"].submit();
   };
 
-  // 瀵煎嚭
+  // 瀵煎嚭锛堟寜褰撳墠鏌ヨ鏉′欢瀵煎嚭锛�
   const handleOut = () => {
-    if (selectedRows.value.length === 0) {
-      proxy.$modal.msgWarning("璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹繘琛屽鍑�");
-      return;
+    // 鏋勫缓鏌ヨ鍙傛暟锛堜笌 getList 淇濇寔涓�鑷达級
+    const { entryDate, ...rest } = searchForm;
+    const params = { ...rest };
+
+    // 澶勭悊褰曞叆鏃ユ湡鑼冨洿
+    if (entryDate && entryDate.length === 2) {
+      params.entryDateStart = entryDate[0];
+      params.entryDateEnd = entryDate[1];
     }
-    const hasUnapproved = selectedRows.value.some(
-      row => Number(row.reviewStatus) !== 1
+
+    // 澶勭悊瀹㈡埛鍚嶇О鏌ヨ
+    const selectedCustomer = (customerOption.value || []).find(
+      item => String(item?.id ?? "") === String(params.customerId ?? "")
     );
-    if (hasUnapproved) {
-      proxy.$modal.msgWarning("閫変腑鐨勬暟鎹腑鍖呭惈鏈鏍搁」锛屾棤娉曞鍑�");
-      return;
+    if (selectedCustomer?.customerName) {
+      params.customerName = String(selectedCustomer.customerName).trim();
     }
-    ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�", "瀵煎嚭", {
-      confirmButtonText: "纭",
-      cancelButtonText: "鍙栨秷",
-      type: "warning",
-    })
-      .then(() => {
-        proxy.download("/sales/ledger/export", {}, "閿�鍞彴璐�.xlsx");
-      })
-      .catch(() => {
-        proxy.$modal.msg("宸插彇娑�");
-      });
+    delete params.customerId;
+
+    // 澶勭悊浜у搧瀹介珮鏌ヨ鍙傛暟
+    const widthValue = params.width != null ? String(params.width).trim() : "";
+    const heightValue = params.height != null ? String(params.height).trim() : "";
+    if (!widthValue) delete params.width;
+    if (!heightValue) delete params.height;
+
+    proxy.download("/sales/ledger/exportWithProducts", params, "閿�鍞彴璐�.xlsx");
   };
   /** 鍒ゆ柇鍗曚釜浜у搧鏄惁宸插彂璐э紙鏍规嵁shippingStatus鍒ゆ柇锛屽凡鍙戣揣鎴栧鏍搁�氳繃涓嶅彲缂栬緫鍜屽垹闄わ級 */
   const isProductShipped = product => {

--
Gitblit v1.9.3