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 | 74 ++++++++++++++++++++++++++++++++++++
1 files changed, 73 insertions(+), 1 deletions(-)
diff --git a/src/views/basicData/product/index.vue b/src/views/basicData/product/index.vue
index c9058aa..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)"
@@ -73,7 +81,7 @@
<el-button type="primary" @click="openModelDia('add')">
鏂板瑙勬牸鍨嬪彿
</el-button>
- <ImportExcel @uploadSuccess="getModelList" />
+ <ImportExcel :product-id="currentId" @uploadSuccess="getModelList" />
<el-button
type="danger"
@click="handleDelete"
@@ -140,6 +148,18 @@
>
<el-row>
<el-col :span="24">
+ <el-form-item label="鏂欏彿锛�" prop="materialCode">
+ <el-input
+ v-model="modelForm.materialCode"
+ placeholder="璇疯緭鍏ユ枡鍙�"
+ clearable
+ @keydown.enter.prevent
+ />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
<el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model">
<el-input
v-model="modelForm.model"
@@ -183,6 +203,7 @@
delProductModel,
modelListPage,
productTreeList,
+ downCopyProductModel,
} from "@/api/basicData/product.js";
import ImportExcel from "./ImportExcel/index.vue";
@@ -201,6 +222,10 @@
const list = ref([]);
const expandedKeys = ref([]);
const tableColumn = ref([
+ {
+ label: "鏂欏彿",
+ prop: "materialCode",
+ },
{
label: "瑙勬牸鍨嬪彿",
prop: "model",
@@ -244,10 +269,12 @@
],
},
modelForm: {
+ materialCode: "",
model: "",
unit: "",
},
modelRules: {
+ materialCode: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }, { max: 200, message: "鐗╂枡缂栧彿涓嶈兘瓒呰繃200涓瓧绗�", trigger: "blur" }],
model: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
unit: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
},
@@ -344,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) => {
// 鍒ゆ柇鏄惁涓哄彾瀛愯妭鐐�
@@ -351,6 +421,7 @@
// 鍙湁鍙跺瓙鑺傜偣鎵嶆墽琛屼互涓嬮�昏緫
currentId.value = val.id;
currentParentId.value = val.parentId;
+ selectedRows.value = [];
getModelList();
};
@@ -385,6 +456,7 @@
};
const getModelList = () => {
tableLoading.value = true;
+ selectedRows.value = [];
modelListPage({
id: currentId.value,
current: page.current,
--
Gitblit v1.9.3