属性组多选及取消
parent
02662998c0
commit
f764ff6e0e
|
@ -137,19 +137,21 @@
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span>属性关联关系</span>
|
<span>属性关联关系</span>
|
||||||
</div>
|
</div>
|
||||||
<el-card class="box-card" >
|
<el-card class="box-card" >
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span>已选属性</span>
|
<span>已选属性</span>
|
||||||
|
{{this.form.checkedAttributeIds}}
|
||||||
</div>
|
</div>
|
||||||
<el-row :gutter="20" style="margin: 0 10px">
|
<el-row :gutter="20" style="height: 100px">
|
||||||
|
<el-col :span="3" v-for="(attribute,index) in checkedAttribute">
|
||||||
<el-tag
|
<el-tag
|
||||||
v-for="attribute in checkedAttribute"
|
style="margin: 0 10px"
|
||||||
:key="attribute.id"
|
:key="attribute.name"
|
||||||
closable
|
closable
|
||||||
@close="handleClose(attribute)">
|
@close="removeCheck(index)">
|
||||||
{{attribute.name}}
|
{{attribute.name}}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -158,18 +160,20 @@
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span>可选属性</span>
|
<span>可选属性</span>
|
||||||
</div>
|
</div>
|
||||||
<el-checkbox-group
|
<el-row>
|
||||||
v-model="checkedAttribute">
|
<el-col :span="3" v-for="attribute in attributeList">
|
||||||
<el-checkbox
|
<el-checkbox
|
||||||
v-for="attribute in attributeList"
|
v-model="form.checkedAttributeIds"
|
||||||
:value="attribute"
|
:value="attribute.id"
|
||||||
:key="attribute.id"
|
:key="attribute.id"
|
||||||
:label="attribute"
|
:label="attribute.id"
|
||||||
@change="handleCheckedAttributeChange(attribute)"
|
@change="handleCheckedAttributeChange(attribute)"
|
||||||
>
|
border>
|
||||||
{{attribute.name}}
|
{{attribute.id}}
|
||||||
</el-checkbox>
|
{{attribute.name}}
|
||||||
</el-checkbox-group>
|
</el-checkbox>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
@ -195,6 +199,7 @@ export default {
|
||||||
inputVisible: false,
|
inputVisible: false,
|
||||||
//已选属性数组
|
//已选属性数组
|
||||||
checkedAttribute: [],
|
checkedAttribute: [],
|
||||||
|
//所选属性id集合
|
||||||
//商品属性表
|
//商品属性表
|
||||||
attributeList: [],
|
attributeList: [],
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
@ -241,13 +246,23 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
//属性复选框选择事件
|
//属性复选框选择事件
|
||||||
handleCheckedAttributeChange(attribute){
|
handleCheckedAttributeChange(attribute){
|
||||||
console.log(this.checkedAttribute)
|
let isChecked = this.form.checkedAttributeIds.indexOf(attribute.id) > -1;
|
||||||
console.log(attribute)
|
if (isChecked){
|
||||||
|
this.checkedAttribute.push(attribute)
|
||||||
|
}else {
|
||||||
|
//删除属性
|
||||||
|
this.checkedAttribute.splice(
|
||||||
|
this.checkedAttribute.indexOf(attribute),1
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// this.checkedAttribute.splice(this.checkedAttributeIds.indexOf(attribute.id),1)
|
||||||
},
|
},
|
||||||
//关闭标签
|
//关闭标签
|
||||||
handleClose(attribute) {
|
removeCheck(index) {
|
||||||
this.checkedAttribute.splice(this.checkedAttribute.indexOf(attribute), 1);
|
console.log(index)
|
||||||
|
this.checkedAttribute.splice(index,1);
|
||||||
|
this.form.checkedAttributeIds.splice(index,1)
|
||||||
},
|
},
|
||||||
/** 查询属性组列表 */
|
/** 查询属性组列表 */
|
||||||
getList() {
|
getList() {
|
||||||
|
@ -281,9 +296,11 @@ export default {
|
||||||
createBy: null,
|
createBy: null,
|
||||||
createTime: null,
|
createTime: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
updateTime: null
|
updateTime: null,
|
||||||
|
checkedAttributeIds: [],
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
|
this.checkedAttribute= []
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
|
@ -310,13 +327,16 @@ export default {
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
|
console.log(row)
|
||||||
this.getAttribute();
|
this.getAttribute();
|
||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
getGroup(id).then(response => {
|
getGroup(id).then(response => {
|
||||||
|
console.log(response)
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改属性组";
|
this.title = "修改属性组";
|
||||||
|
this.form.checkedAttributeIds= []
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
|
|
Loading…
Reference in New Issue