From b13a739a890be68bdb597fb4602fd009c88503bb Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 21 九月 2026 11:14:45 +0800
Subject: [PATCH] fix: 销售订单未下发/发货则可以进行编辑

---
 src/views/salesManagement/salesLedger/index.vue |   37 +++++++++++++++++++++++++++++--------
 1 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index f6408a5..5f6da46 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -270,11 +270,17 @@
                        type="primary"
                        @click="openForm('view', scope.row)">璇︽儏
             </el-button>
-            <el-button link
-                       type="primary"
-                       @click="openForm('edit', scope.row)"
-                       :disabled="!scope.row.isEdit || scope.row.hasProductionRecord || !canEditLedger(scope.row)">缂栬緫
-            </el-button>
+            <el-tooltip :content="editDisabledReason(scope.row)"
+                        :disabled="!editDisabledReason(scope.row)"
+                        placement="top">
+              <span>
+                <el-button link
+                           type="primary"
+                           @click="openForm('edit', scope.row)"
+                           :disabled="isLedgerEditDisabled(scope.row)">缂栬緫
+                </el-button>
+              </span>
+            </el-tooltip>
             <el-button link
                        type="primary"
                        @click="openFileDialog(scope.row)">闄勪欢
@@ -1557,6 +1563,18 @@
   };
   const canEditLedger = row => isCurrentUserMaintainer(row);
   const canDeleteLedger = row => isCurrentUserMaintainer(row);
+  /**
+   * 闇�瑕佺敓浜х殑璁㈠崟锛氱敓浜ц鍒掑凡涓嬪彂锛堝惈閮ㄥ垎涓嬪彂锛夊悗涓嶅彲缂栬緫锛�
+   * 璧板簱瀛樼殑璁㈠崟锛氬凡鍙戣揣鍚庝笉鍙紪杈戯紝鍚﹀垯鍙互缂栬緫銆�
+   */
+  const editDisabledReason = row => {
+    if (!row) return "";
+    if (!canEditLedger(row)) return "褰撳墠绯荤粺鐧诲綍浜轰笉鏄淮鎶や汉锛屼笉鑳界紪杈戞暟鎹�";
+    if (row.hasProductionRecord) return "鐢熶骇璁″垝宸蹭笅鍙戯紝涓嶈兘缂栬緫";
+    if (!row.isEdit) return "璁㈠崟宸插彂璐э紝涓嶈兘缂栬緫";
+    return "";
+  };
+  const isLedgerEditDisabled = row => !!editDisabledReason(row);
   const sensitiveAmountFormatter = (row, column, cellValue) => {
     if (!isCurrentUserMaintainer(row)) {
       return "*****";
@@ -1733,9 +1751,12 @@
   };
   // 鎵撳紑寮规
   const openForm = async (type, row) => {
-    if (type === "edit" && row && !canEditLedger(row)) {
-      proxy.$modal.msgWarning("褰撳墠绯荤粺鐧诲綍浜轰笉鏄淮鎶や汉锛屼笉鑳界紪杈戞暟鎹�");
-      return;
+    if (type === "edit" && row) {
+      const disabledReason = editDisabledReason(row);
+      if (disabledReason) {
+        proxy.$modal.msgWarning(disabledReason);
+        return;
+      }
     }
     operationType.value = type;
     form.value = {};

--
Gitblit v1.9.3