From a1f08feb1685fb31922d3bb3e9f02e2b7397dcec Mon Sep 17 00:00:00 2001 From: DongZeLiang <2746733890@qq.com> Date: Thu, 7 Mar 2024 10:34:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E5=85=B1=E6=9C=89=E5=85=83?= =?UTF-8?q?=E7=B4=A0=20-=20=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/product/info/index.vue | 41 +++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/src/views/product/info/index.vue b/src/views/product/info/index.vue index a69600e..e3b250f 100644 --- a/src/views/product/info/index.vue +++ b/src/views/product/info/index.vue @@ -241,9 +241,9 @@ - - - + + + @@ -278,9 +278,9 @@ 选择属性 - - - + + + {{attribute.name}} @@ -291,9 +291,9 @@ - - - + + + @@ -396,6 +396,7 @@ export default { }, customPropertiesFormStatus: false, + attributeIdCheckedList: [], attributeCheckedList: [], categoryCommonElement: { templateAttributeGroupList: [], @@ -438,6 +439,28 @@ export default { this.getList(); }, methods: { + attributeCheckedFun(checkedValue) { + console.log(checkedValue) + // attributeIdCheckedList -> attributeCheckedList 不在 + // 1 -> ID 1 : attributeCheckedList[] -> 1 + // 2 -> ID 3 : attributeCheckedList[1] -> 3 + let attributeId =this.attributeIdCheckedList + .find(attributeId => + this.attributeCheckedList.map(attributeChecked => attributeChecked.id).indexOf(attributeId) === -1 + ) + if (attributeId !== undefined){ + let attributeInfo = this.categoryCommonElement.attributeList.find(attributeInfo => attributeInfo.id === attributeId); + this.attributeCheckedList.push(attributeInfo); + }else { + // attributeIdCheckedList [3] : attributeCheckedList [] -> [3] + // attributeIdCheckedList [3,5] : attributeCheckedList [3] -> [3,5] + // attributeIdCheckedList [3,5,9] : attributeCheckedList [3,5] -> [3,5,9] + // attributeIdCheckedList [3,9] : attributeCheckedList [3,5,9] -> [3,9] + // attributeCheckedList 集合 不在 attributeIdCheckedList 集合的元素,然后删除 + + } + + }, initRuleList(){ listRule({"params[isPage]": false}).then(response => { this.ruleList = response.data;