From 1888b426ff2b6a529f5fdef0f0453dadef71824b Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期三, 17 四月 2024 10:17:38 +0800 Subject: [PATCH] 隐藏多单位的问题 --- src/views/productManage/product/components/bomDialog.vue | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/views/productManage/product/components/bomDialog.vue b/src/views/productManage/product/components/bomDialog.vue index 3e75b28..1d4faa7 100644 --- a/src/views/productManage/product/components/bomDialog.vue +++ b/src/views/productManage/product/components/bomDialog.vue @@ -32,7 +32,8 @@ style="margin-left: 16px; color: #fff; background-color: #ee790c" >鏂板</el-button > --> - <el-button @click="shutdown">鍙栨秷</el-button><el-button type="primary" @click="handleConfirmSave()" + <el-button @click="shutdown">鍙栨秷</el-button> + <el-button type="primary" @click="handleConfirmSave()" style="margin-left: 16px; color: #fff; background-color: #2a78fb">纭畾</el-button> </div> </el-dialog> @@ -52,6 +53,7 @@ default: () => { return { editDialogVisible: false, + BomTableData:[] }; }, }, @@ -64,7 +66,9 @@ thatEditRow:this.editRow, isTableShow: true, form: {}, - // BomTableData: JSON.parse(this.thatEditRow.BomTableData), + BomTableData:[], + // BomTableData: this.editRow.BomTableData, + // BomTableData: JSON.parse(this.editRow.BomTableData), // BomTableData: [{ id: 303, createdAt: "2024-02-05 18:02:47", updatedAt: "2024-02-05 18:02:47",name: "kg", isDefault: false }], work: 1, flag: "add", @@ -101,29 +105,25 @@ }; }, watch: { - // editDialogVisible(newVal) { - // console.log(newVal,"鐪嬬湅val") - // if (newVal) { - // this.BomTableData = this.workList; - // } - // }, - // workList(newVal) { - // console.log(newVal) - // this.BomTableData = this.workList; - // }, }, created() { - console.log(this.thatEditRow,"thatEditRow") }, - mounted() { }, + mounted() { + }, methods: { handleAdd() { + this.BomTableData=this.thatEditRow.BomTableData this.BomTableData.push({ name: "", isDefault: false }); }, handleDelete(id) { - this.BomTableData = this.BomTableData.filter((i) => { + if (this.BomTableData.length === 1) { + this.$message.warning("鑷冲皯淇濈暀涓�鏉℃暟鎹�"); + return; + } + this.BomTableData = this.thatEditRow.BomTableData.filter((i) => { return i.id != id; }); + this.thatEditRow.BomTableData=this.BomTableData }, async getCodeStandardList() { const res = await getCodeStandardList(this.obj); @@ -148,6 +148,7 @@ console.log(this.codenumberList.replace(/,/g, "")); }, switchChange(scope, val) { + this.BomTableData=this.thatEditRow.BomTableData let arr = []; for (let i in this.BomTableData) { if (this.BomTableData[i].isDefault) { @@ -186,7 +187,7 @@ let fn = this.flag == "set" ? updateMaterial : addMaterial; const res = await fn(this.form); this.shutdown(); - this.$sucessSet("sucessSet"); + // this.$sucessSet("sucessSet"); if (res.code == 200) { this.$message({ message: this.flag == "set" ? "淇敼鎴愬姛锛�" : "娣诲姞鎴愬姛锛�", -- Gitblit v1.8.0