From 0c4429a719f5c95a7690fae51efaaa799ef4e77d Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 25 五月 2026 10:02:48 +0800
Subject: [PATCH] fix: 投入重量改成投入重量/数量

---
 src/views/basicData/product/index.vue |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/src/views/basicData/product/index.vue b/src/views/basicData/product/index.vue
index d934b08..7552721 100644
--- a/src/views/basicData/product/index.vue
+++ b/src/views/basicData/product/index.vue
@@ -44,6 +44,14 @@
               </span>
               <div>
                 <el-button
+                  v-if="node.level > 1"
+                  type="success"
+                  link
+                  @click.stop="handleDownCopy(node, data)"
+                >
+                  鍚戜笅澶嶅埗
+                </el-button>
+                <el-button
                   type="primary"
                   link
                   @click="openProDia('edit', data)"
@@ -195,6 +203,7 @@
   delProductModel,
   modelListPage,
   productTreeList,
+  downCopyProductModel,
 } from "@/api/basicData/product.js";
 import ImportExcel from "./ImportExcel/index.vue";
 
@@ -362,6 +371,49 @@
       proxy.$modal.msg("宸插彇娑�");
     });
 };
+
+// 鍚戜笅澶嶅埗
+const handleDownCopy = (node, data) => {
+  if (currentId.value !== data.id) {
+    proxy.$modal.msgWarning("璇峰厛閫変腑褰撳墠浜у搧骞跺嬀閫夐渶瑕佸鍒剁殑鍨嬪彿");
+    return;
+  }
+
+  // 鑾峰彇鍚屽眰绾ц妭鐐�
+  const parent = node.parent;
+  const siblings = parent.childNodes || [];
+  // 鎵惧埌褰撳墠鑺傜偣鍦ㄥ悓灞傜骇涓殑绱㈠紩
+  const currentIndex = siblings.findIndex(item => item.data.id === data.id);
+  // 鑾峰彇涓嬩竴琛岃妭鐐�
+  const nextNode = siblings[currentIndex + 1];
+
+  if (!nextNode) {
+    proxy.$modal.msgWarning("褰撳墠鑺傜偣鏄悓灞傜骇鏈�鍚庝竴涓紝娌℃湁涓嬩竴琛屾暟鎹彲澶嶅埗");
+    return;
+  }
+
+  const modelListId = selectedRows.value.map((item) => item.id);
+  if (!modelListId.length) {
+    proxy.$modal.msgWarning("娌℃湁閫夋嫨瑕佸鍒剁殑鍨嬪彿");
+    return;
+  }
+
+  ElMessageBox.confirm("纭灏嗗綋鍓嶈妭鐐圭殑瑙勬牸鍨嬪彿澶嶅埗鍒颁笅涓�琛岃妭鐐癸紵", "鍚戜笅澶嶅埗", {
+    confirmButtonText: "纭",
+    cancelButtonText: "鍙栨秷",
+    type: "info",
+  })
+    .then(() => {
+      downCopyProductModel({
+        productId: data.id,
+        targetProductId: nextNode.data.id,
+        modelListId,
+      }).then(() => {
+        proxy.$modal.msgSuccess("澶嶅埗鎴愬姛");
+      });
+    })
+    .catch(() => {});
+};
 // 閫夋嫨浜у搧
 const handleNodeClick = (val, node, el) => {
   // 鍒ゆ柇鏄惁涓哄彾瀛愯妭鐐�
@@ -369,6 +421,7 @@
   // 鍙湁鍙跺瓙鑺傜偣鎵嶆墽琛屼互涓嬮�昏緫
   currentId.value = val.id;
   currentParentId.value = val.parentId;
+  selectedRows.value = [];
   getModelList();
 };
 
@@ -403,6 +456,7 @@
 };
 const getModelList = () => {
   tableLoading.value = true;
+  selectedRows.value = [];
   modelListPage({
     id: currentId.value,
     current: page.current,

--
Gitblit v1.9.3