From 0311f3bf35ba7687313a20df8c66681f292d28b4 Mon Sep 17 00:00:00 2001
From: xiaohuang <1559741705@qq.com>
Date: Tue, 2 Apr 2024 17:33:40 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E6=A0=BC=E5=B1=9E=E6=80=A7=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/CheckAttribute/index.vue | 296 +++++++++----------
src/components/CheckAttributeGroup/index.vue | 101 +++----
src/views/product/category/index.vue | 6 +-
src/views/product/rule/index.vue | 256 ++++++++++++----
4 files changed, 376 insertions(+), 283 deletions(-)
diff --git a/src/components/CheckAttribute/index.vue b/src/components/CheckAttribute/index.vue
index 5d6397d..5b20ab3 100644
--- a/src/components/CheckAttribute/index.vue
+++ b/src/components/CheckAttribute/index.vue
@@ -1,176 +1,156 @@
-
-
-
-
-
- 选择属性关联关系
-
-
-
- 已选择属性
-
-
-
-
-
-
-
-
-
-
-
-
- {{attribute.name}}
-
-
-
-
-
-
-
-
-
-
-
-
- 未选属性
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 查询
-
-
-
-
-
-
- {{attribute.name}}
-
-
-
-
-
-
-
+
+
+
+ 选择属性关联关系
+
+
+
+ 已选择属性
+
+
+
+
+ {{ attribute.name }}
+
+
+
+
+
+
+
+ 未选属性
+
+
+
+
+
+
+
+
+
+
+ 查询
+
+
+
+
+
+ {{ attribute.name }}
+
+
+
+
+
+
+
-
diff --git a/src/components/CheckAttributeGroup/index.vue b/src/components/CheckAttributeGroup/index.vue
index 2945f3a..d857d81 100644
--- a/src/components/CheckAttributeGroup/index.vue
+++ b/src/components/CheckAttributeGroup/index.vue
@@ -1,6 +1,4 @@
-
-
@@ -10,55 +8,33 @@
已选择属性组
-
-
-
-
-
-
-
-
- {{attributeGroup.name}}
+ {{ attributeGroup.name }}
-
-
-
-
-
未选属性组
-
-
-
+
+
-
-
-
-
-
-
-
查询
-
-
+
{{attributeGroup.name}}
+ border>{{ attributeGroup.name }}
+
-
import {listAttributeGroup} from "@/api/product/attributeGroup";
-
export default {
name: "CheckAttributeGroup",
- props:{
- value:{
- type:Array,
+ props: {
+ value: {
+ type: Array,
default: []
+ },
+ checkedList: {
+ type: Array,
+ default: null
}
},
-
-
- data(){
- return{
+ data() {
+ return {
attributeGroupIdList: [],
checkedAttributeGroupList: [],
- attributeGroupQuery:{
+ attributeGroupQuery: {
pageNum: 1,
pageSize: 10,
- code: null,
name: null
},
attributeGroupTotal: 0,
attributeGroupList: []
}
},
-
watch: {
value: {
- handler(val){
+ handler(val) {
if (val.toString() !== this.attributeGroupIdList.toString()){
this.attributeGroupIdList = val;
this.checkedAttributeGroupList = []
}
},
- immediate :true,
+ immediate: true,
+ },
+ checkedList: {
+ handler(val){
+ if (val !== undefined && val.length > 0){
+ this.checkedAttributeGroupList = val;
+ this.attributeGroupIdList = this.checkedAttributeGroupList.map(checked => checked.id);
+ }
+ },
+ immediate: true
}
},
-
created() {
this.queryAttributeGroup();
},
-
methods: {
/**
* 选中值触发方法
*/
- checkedAttributeGroup(attributeGroup){
+ checkedAttributeGroup(attributeGroup) {
let isCheck = this.attributeGroupIdList.indexOf(attributeGroup.id) > -1;
- if (isCheck){
+ if (isCheck) {
this.checkedAttributeGroupList.push(attributeGroup);
- }else {
- //删除
+ } else {
+ // 删除
this.checkedAttributeGroupList.splice(
- this.checkedAttributeGroupList.indexOf(attributeGroup),1
+ this.checkedAttributeGroupList.indexOf(attributeGroup), 1
)
}
this.$emit("input", this.attributeGroupIdList);
},
-
-
/**
* 删除选中值
* @param index
*/
- removeChecked(index){
- console.log(index)
- this.checkedAttributeGroupList.splice(index,1);
- this.attributeGroupIdList.splice(index,1);
+ removeChecked(index) {
+ this.checkedAttributeGroupList.splice(index, 1);
+ this.attributeGroupIdList.splice(index, 1);
},
/**
- * 查詢屬性
+ * 查询属性
*/
- queryAttributeGroup(){
-
+ queryAttributeGroup() {
listAttributeGroup(this.attributeGroupQuery).then(response => {
this.attributeGroupList = response.data.rows;
this.total = response.data.total;
- this.loading = false;
});
},
-
}
}
-
-
diff --git a/src/views/product/category/index.vue b/src/views/product/category/index.vue
index ef2d5aa..f2015df 100644
--- a/src/views/product/category/index.vue
+++ b/src/views/product/category/index.vue
@@ -152,15 +152,15 @@
-
+
-
+
-
+
diff --git a/src/views/product/rule/index.vue b/src/views/product/rule/index.vue
index 6d23546..102c54a 100644
--- a/src/views/product/rule/index.vue
+++ b/src/views/product/rule/index.vue
@@ -116,54 +116,107 @@
-
-
-
- {{ruleAttr.name}}
-
-
-
-
- {{ruleProperty}}
-
- 添加
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ruleAttr.name}}
+
+
+
+
+
+ {{ruleProperty}}
+
+
+ 添加
+
+
+
+
+
+
+
+
添加规格
+
+
+
添加
+
+
+