diff --git a/src/api/product/category.js b/src/api/product/category.js index a8ab19f..e1fd1e6 100644 --- a/src/api/product/category.js +++ b/src/api/product/category.js @@ -17,6 +17,13 @@ export function getCategory(id) { }) } +export function parentCommonElement(id) { + return request({ + url: '/product/category/parentCommonElement/' + id, + method: 'get' + }) +} + // 新增品类信息 export function addCategory(data) { return request({ diff --git a/src/components/CheckAttribute/index.vue b/src/components/CheckAttribute/index.vue index 81fb799..c798636 100644 --- a/src/components/CheckAttribute/index.vue +++ b/src/components/CheckAttribute/index.vue @@ -69,7 +69,11 @@ export default { props: { value: { type: Array, - default: [] + default: () => [] + }, + checkedList: { + type: Array, + default: null } }, watch: { @@ -81,6 +85,15 @@ export default { } }, immediate: true + }, + checkedList: { + handler(val) { + if (val !== undefined && val.length >0){ + this.checkedAttributeList = val + this.attributeIdList = this.checkedAttributeList.map(checked => checked.id); + } + }, + immediate: true } }, data() { diff --git a/src/components/CheckAttributeGroup/index.vue b/src/components/CheckAttributeGroup/index.vue index a047454..628d622 100644 --- a/src/components/CheckAttributeGroup/index.vue +++ b/src/components/CheckAttributeGroup/index.vue @@ -66,7 +66,11 @@ export default { props: { value: { type: Array, - default: [] + default: () => [] + }, + checkedList: { + type: Array, + default: null } }, watch: { @@ -78,6 +82,15 @@ export default { } }, immediate: true + }, + checkedList: { + handler(val) { + if (val !== null && val.length >0){ + this.checkedAttributeGroupList = val + this.attributeGroupIdList = this.checkedAttributeGroupList.map(checked => checked.id); + } + }, + immediate: true } }, data() { diff --git a/src/components/CheckBrand/index.vue b/src/components/CheckBrand/index.vue index 6692cfe..3826612 100644 --- a/src/components/CheckBrand/index.vue +++ b/src/components/CheckBrand/index.vue @@ -66,7 +66,11 @@ export default { props: { value: { type: Array, - default: [] + default: () => [] + }, + checkedList: { + type: Array, + default: null } }, watch: { @@ -78,6 +82,15 @@ export default { } }, immediate: true + }, + checkedList: { + handler(val){ + if (val !== null && val.length > 0){ + this.checkedBrandList = val + this.brandIdList = this.checkedBrandList.map(checked => checked.id); + } + }, + immediate: true } }, data() { diff --git a/src/views/product/attributeGroup/index.vue b/src/views/product/attributeGroup/index.vue index 1d69250..f46eca7 100644 --- a/src/views/product/attributeGroup/index.vue +++ b/src/views/product/attributeGroup/index.vue @@ -294,11 +294,14 @@ export default { this.checkedAttributeList.push(attribute); }else { // 删除 - console.log(this.checkedAttributeList) - console.log(attribute) - console.log(this.checkedAttributeList.indexOf(attribute)) + let att =undefined + this.checkedAttributeList.forEach(checked => { + if (checked.id == attribute.id){ + att = checked + } + }) this.checkedAttributeList.splice( - this.checkedAttributeList.indexOf(attribute), 1 + this.checkedAttributeList.indexOf(att), 1 ) } }, diff --git a/src/views/product/category/index.vue b/src/views/product/category/index.vue index 59992ed..0995973 100644 --- a/src/views/product/category/index.vue +++ b/src/views/product/category/index.vue @@ -151,13 +151,13 @@ - + - + - + @@ -171,7 +171,7 @@