From 561000160e359c6dddd4e0313316dd0037f4493a Mon Sep 17 00:00:00 2001 From: 20300 <643145201@qq.com> Date: Mon, 11 Mar 2024 20:55:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=88=B6=E5=AD=90=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=BC=A0=E5=80=BC=E7=9A=84=E9=97=AE=E9=A2=98,=20?= =?UTF-8?q?=E5=B9=B6=E4=B8=94=E5=9C=A8=E7=88=B6=E7=BB=84=E4=BB=B6=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E5=AD=90=E7=BB=84=E4=BB=B6=E6=96=B9=E6=B3=95,?= =?UTF-8?q?=E6=9D=A5=E8=BF=9B=E8=A1=8C=E7=BD=AE=E7=A9=BA,=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=88=B6=E7=BA=A7=E5=93=81=E7=B1=BB=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/product/category.js | 21 +++++ src/components/CheckAttribute/index.vue | 38 +++++++-- src/components/CheckAttributeGroup/index.vue | 34 +++++++- src/components/CheckBrand/index.vue | 32 +++++++- .../product/attribute/attributeGroup.vue | 10 ++- src/views/product/attribute/index.vue | 9 ++- src/views/product/brand/index.vue | 9 ++- src/views/product/category/index.vue | 81 ++++++++++++++----- src/views/product/upload/uploadPic.vue | 3 + 9 files changed, 195 insertions(+), 42 deletions(-) diff --git a/src/api/product/category.js b/src/api/product/category.js index ba0f4d7..63036de 100644 --- a/src/api/product/category.js +++ b/src/api/product/category.js @@ -16,3 +16,24 @@ export function insertCategory(insertCategoryReq) { }) } +export function getAllCategoryAttribute(categoryId) { + return request({ + url: '/product/category/getAllCategoryAttribute?categoryId='+categoryId, + method: 'get' + }) +} + +export function getAllCategoryAttributeGroup(categoryId) { + return request({ + url: '/product/category/getAllCategoryAttributeGroup?categoryId='+categoryId, + method: 'get' + }) +} + +export function getAllCategoryBrand(categoryId) { + return request({ + url: '/product/category/getAllCategoryBrand?categoryId='+categoryId, + method: 'get' + }) +} + diff --git a/src/components/CheckAttribute/index.vue b/src/components/CheckAttribute/index.vue index cdfdb7e..a057ff8 100644 --- a/src/components/CheckAttribute/index.vue +++ b/src/components/CheckAttribute/index.vue @@ -3,11 +3,11 @@
- 选择品牌关联关系 + 选择属性关联关系
- 已选品牌 + 已选属性
- 可选品牌 + 可选属性
{ + console.log("属性已选中:",res) + this.selectAttributeList = [] + this.parentSelectAttributeList = res.data + this.attributeList.forEach( + attr => { + this.parentSelectAttributeList.forEach( + parentSelect => { + if (attr.id == parentSelect.id){ + console.log("添加了吗?") + this.selectAttributeList.push(attr) + } + } + ) + } + ) + console.log("属性:",res) + } + ) + }, setAttributeListToParent(newVal) { this.$emit("setCheckAttributeList", newVal) }, diff --git a/src/components/CheckAttributeGroup/index.vue b/src/components/CheckAttributeGroup/index.vue index 5276525..44483e6 100644 --- a/src/components/CheckAttributeGroup/index.vue +++ b/src/components/CheckAttributeGroup/index.vue @@ -23,6 +23,7 @@
可选属性组 +
{ + this.parentSelectAttributeGroupList = res.data + this.selectAttributeGroupList = [] + this.attributeGroupList.forEach( + attrGroup => { + this.parentSelectAttributeGroupList.forEach( + parentSelect => { + if (attrGroup.id == parentSelect.id){ + this.selectAttributeGroupList.push(attrGroup) + } + } + ) + } + ) + console.log("属性组",res) + } + ) + }, setAttributeGroupListToParent(newVal) { - this.$emit("setCheckAttributeList", newVal) + this.$emit("setCheckAttributeGroupList", newVal) }, handleClose(tag) { this.selectAttributeGroupList.splice(this.selectAttributeGroupList.indexOf(tag), 1); diff --git a/src/components/CheckBrand/index.vue b/src/components/CheckBrand/index.vue index 4664919..a9814fa 100644 --- a/src/components/CheckBrand/index.vue +++ b/src/components/CheckBrand/index.vue @@ -23,6 +23,7 @@
可选品牌 +
{ + this.parentSelectBrandList = res.data + this.selectBrandList = [] + if (this.parentSelectBrandList.length > 0){ + this.parentSelectBrandList.forEach(parentSelect => this.brandList.forEach( + brand => { + if (brand.id == parentSelect.id){ + this.selectBrandList.push(brand) + } + } + )) + } + } + ) + }, //像父组件中传递数据的方法 setBrandListToParent(newVal) { this.$emit("setCheckBrandList",newVal) diff --git a/src/views/product/attribute/attributeGroup.vue b/src/views/product/attribute/attributeGroup.vue index 8f96426..65f997c 100644 --- a/src/views/product/attribute/attributeGroup.vue +++ b/src/views/product/attribute/attributeGroup.vue @@ -120,7 +120,9 @@ export default { name: "attributeGroup", //import引入的组件需要注入到对象中才能使用" components: {}, - props: {}, + props: { + + }, data() { //这里存放数据" @@ -138,7 +140,6 @@ export default { //未选中 attributeList: [], attr:{} - }; }, //计算属性 类似于data概念", @@ -147,6 +148,7 @@ export default { watch: {}, //方法集合", methods: { + //修改 handleDelete(index, row) { this.isOpenAddAttributeGroup = true @@ -215,7 +217,7 @@ export default { }, //得到属性组列表 getAttributeGroupList(){ - getAttributeGroupList(this.attributeName).then( + getAttributeGroupList(0).then( res => { console.log(res); this.attributeGroupList = res.data @@ -233,7 +235,7 @@ export default { }, queryAttributeList(){ this.isOpenAddAttributeGroup = true - list(this.attributeQueryName).then( + list(0).then( res => { this.attributeList = res.data } diff --git a/src/views/product/attribute/index.vue b/src/views/product/attribute/index.vue index 41d675e..856d7ba 100644 --- a/src/views/product/attribute/index.vue +++ b/src/views/product/attribute/index.vue @@ -76,6 +76,7 @@ +