属性组功能完善

day-04
Saisai Liu 2024-03-03 16:02:26 +08:00
parent f764ff6e0e
commit b4e6334c46
1 changed files with 22 additions and 13 deletions

View File

@ -67,15 +67,20 @@
<el-table v-loading="loading" :data="groupList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="groupList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" /> <el-table-column label="组名" align="center" prop="name" width="155"/>
<el-table-column label="组名" align="center" prop="name" /> <el-table-column label="属性" align="center" prop="attributeList" >
<el-table-column label="属性" align="center" prop="name" />
<el-table-column label="状态" align="center" prop="states">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-attribute :options="dict.type.sys_yes_no" :value="scope.row.states"/> <el-tag v-for="attribute in scope.row.attributeList">
{{attribute.name}}
</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="说明" align="center" prop="remark" /> <el-table-column label="品牌启用" align="center" prop="status" style="width: 20px;">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.states"/>
</template>
</el-table-column>
<el-table-column label="说明" align="center" prop="remark" style="width: 30px;"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@ -141,6 +146,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>已选属性</span> <span>已选属性</span>
{{this.form.checkedAttributeIds}} {{this.form.checkedAttributeIds}}
{{this.form.attributeList}}
</div> </div>
<el-row :gutter="20" style="height: 100px"> <el-row :gutter="20" style="height: 100px">
<el-col :span="3" v-for="(attribute,index) in checkedAttribute"> <el-col :span="3" v-for="(attribute,index) in checkedAttribute">
@ -153,7 +159,6 @@
</el-tag> </el-tag>
</el-col> </el-col>
</el-row> </el-row>
</el-card> </el-card>
<el-divider></el-divider> <el-divider></el-divider>
<el-card class="box-card"> <el-card class="box-card">
@ -161,7 +166,8 @@
<span>可选属性</span> <span>可选属性</span>
</div> </div>
<el-row> <el-row>
<el-col :span="3" v-for="attribute in attributeList"> <el-col :span="3"
v-for="attribute in attributeList">
<el-checkbox <el-checkbox
v-model="form.checkedAttributeIds" v-model="form.checkedAttributeIds"
:value="attribute.id" :value="attribute.id"
@ -169,7 +175,6 @@
:label="attribute.id" :label="attribute.id"
@change="handleCheckedAttributeChange(attribute)" @change="handleCheckedAttributeChange(attribute)"
border> border>
{{attribute.id}}
{{attribute.name}} {{attribute.name}}
</el-checkbox> </el-checkbox>
</el-col> </el-col>
@ -177,7 +182,6 @@
</el-card> </el-card>
</el-card> </el-card>
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -190,6 +194,7 @@
<script> <script>
import { listGroup, getGroup, delGroup, addGroup, updateGroup } from "@/api/product/attribute_group"; import { listGroup, getGroup, delGroup, addGroup, updateGroup } from "@/api/product/attribute_group";
import {listAttribute} from "@/api/product/attribute"; import {listAttribute} from "@/api/product/attribute";
import attribute from "@/views/product/attribute/index.vue";
export default { export default {
name: "Group", name: "Group",
@ -276,6 +281,8 @@ export default {
/** 查询属性列表 */ /** 查询属性列表 */
getAttribute(){ getAttribute(){
listAttribute(this.queryParams).then(response => { listAttribute(this.queryParams).then(response => {
console.log('属性集合')
console.log(response)
this.attributeList = response.data.rows; this.attributeList = response.data.rows;
this.total = response.data.total; this.total = response.data.total;
this.loading = false; this.loading = false;
@ -327,17 +334,19 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
console.log(row) // console.log('')
this.getAttribute(); // console.log(row)
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(('id'))
console.log(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= [] this.checkedAttribute = response.data.attributeList
}); });
this.getAttribute();
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {