From da57fbd8e7fa021614fb32502fb1520ea4e34e1e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 18 五月 2026 11:35:16 +0800
Subject: [PATCH] 浪潮 1.样式修改
---
src/views/basicData/product/index.vue | 58 +++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 45 insertions(+), 13 deletions(-)
diff --git a/src/views/basicData/product/index.vue b/src/views/basicData/product/index.vue
index 99ab028..2188044 100644
--- a/src/views/basicData/product/index.vue
+++ b/src/views/basicData/product/index.vue
@@ -43,12 +43,12 @@
<el-button type="primary"
link
:disabled="isTopLevelNode(data, node)"
- @click="openProDia('edit', data)">
+ @click="openProDia('edit', data, node)">
缂栬緫
</el-button>
<el-button type="primary"
link
- @click="openProDia('add', data)">
+ @click="openProDia('add', data, node)">
娣诲姞浜у搧
</el-button>
<el-button v-if="!node.childNodes.length"
@@ -161,6 +161,17 @@
placeholder="璇疯緭鍏ュ崟浣�"
clearable
@keydown.enter.prevent />
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="搴撳瓨閲忥細"
+ prop="stockInventory">
+ <el-input-number v-model="modelForm.stockInventory"
+ :min="0"
+ style="width: 100%"
+ placeholder="璇疯緭鍏ュ簱瀛橀噺"
+ controls-position="right"
+ @keydown.enter.prevent />
</el-form-item>
</el-col>
</el-row>
@@ -285,6 +296,8 @@
const search = ref("");
const currentId = ref("");
const currentParentId = ref("");
+ /** 浜у搧寮圭獥锛歛dd 瀛樼埗鑺傜偣 id锛沞dit 瀛樺綋鍓嶈妭鐐� id 涓� parentId锛堜笉渚濊禆鏍戦�変腑椤癸級 */
+ const productDialogTarget = ref(null);
const operationType = ref("");
const treeLoad = ref(false);
const list = ref([]);
@@ -301,6 +314,10 @@
{
label: "鍗曚綅",
prop: "unit",
+ },
+ {
+ label: "搴撳瓨閲�",
+ prop: "stockInventory",
},
{
dataType: "action",
@@ -340,18 +357,18 @@
model: "",
unit: "",
productCode: "",
+ stockInventory: 0,
},
modelRules: {
model: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
unit: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- productCode: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
},
});
const { form, rules, modelForm, modelRules } = toRefs(data);
// 鏌ヨ浜у搧鏍�
const getProductTreeList = () => {
treeLoad.value = true;
- productTreeList()
+ productTreeList({ productType: "鎴愬搧" })
.then(res => {
list.value = res || [];
normalizeExpandedKeys(list.value);
@@ -388,17 +405,28 @@
return [null, undefined, "", 0, "0"].includes(data?.parentId);
};
// 鎵撳紑浜у搧寮规
- const openProDia = (type, data) => {
- if (data && type === "edit" && isTopLevelNode(data)) {
+ const openProDia = (type, data, node) => {
+ if (data && type === "edit" && isTopLevelNode(data, node)) {
proxy.$modal.msgWarning("涓�绾ц妭鐐逛笉鑳界紪杈戞垨鍒犻櫎");
return;
}
operationType.value = type;
- productDia.value = true;
- form.value.productName = "";
- if (type === "edit") {
- form.value.productName = data.productName;
+ productDialogTarget.value = null;
+ if (type === "add" && data) {
+ productDialogTarget.value = { parentId: data.id };
+ } else if (type === "edit" && data) {
+ let parentId = data.parentId;
+ if (
+ [null, undefined, ""].includes(parentId) &&
+ node?.parent?.data?.id != null
+ ) {
+ parentId = node.parent.data.id;
+ }
+ productDialogTarget.value = { id: data.id, parentId };
}
+ productDia.value = true;
+ form.value.productName =
+ type === "edit" && data ? data.productName : "";
};
// 鎵撳紑瑙勬牸鍨嬪彿寮规
const openModelDia = (type, data) => {
@@ -407,6 +435,7 @@
modelForm.value.model = "";
modelForm.value.unit = "";
modelForm.value.productCode = "";
+ modelForm.value.stockInventory = 0;
modelForm.value.id = "";
if (type === "edit") {
modelForm.value = { ...data };
@@ -417,14 +446,16 @@
proxy.$refs.formRef.validate(valid => {
if (valid) {
if (operationType.value === "add") {
- form.value.parentId = currentId.value;
+ form.value.parentId =
+ productDialogTarget.value?.parentId ?? currentId.value;
form.value.id = "";
} else if (operationType.value === "addOne") {
form.value.id = "";
form.value.parentId = "";
} else {
- form.value.id = currentId.value;
- form.value.parentId = "";
+ form.value.id =
+ productDialogTarget.value?.id ?? currentId.value;
+ form.value.parentId = productDialogTarget.value?.parentId ?? "";
}
addOrEditProduct(form.value).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
@@ -437,6 +468,7 @@
// 鍏抽棴浜у搧寮规
const closeProDia = () => {
proxy.$refs.formRef.resetFields();
+ productDialogTarget.value = null;
productDia.value = false;
};
--
Gitblit v1.9.3