ui-new
parent
cb57edddd1
commit
6874ae2edc
|
@ -12,7 +12,7 @@ export function listAttributeGroup(query) {
|
|||
// 查询商品属性组详细
|
||||
export function getAttributeGroup(id) {
|
||||
return request({
|
||||
url: '/product/attributeGroup/' + id,
|
||||
url: '/product/attributeGroup/getInfo?id='+ id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -17,6 +17,15 @@ export function getCategory(id) {
|
|||
})
|
||||
}
|
||||
|
||||
//通过父类id 查询品类详情
|
||||
export function parentCategoryCommon(id) {
|
||||
return request({
|
||||
url: '/product/category/parentCategoryCommon/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 新增品类信息
|
||||
export function addCategory(data) {
|
||||
return request({
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
<template>
|
||||
<el-row>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>选择属性关联关系</span>
|
||||
</div>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>已选择属性</span>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="2" v-for="(attribute, index) in checkedAttributeList">
|
||||
<el-tag
|
||||
style="margin: 5px 10px"
|
||||
:key="attribute.name"
|
||||
closable @close="removeChecked(index)">
|
||||
{{ attribute.name }}
|
||||
</el-tag>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<el-divider></el-divider>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>未选属性</span>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-form :inline="true" :model="attributeQuery" class="demo-form-inline">
|
||||
<el-form-item label="属性编码">
|
||||
<el-input v-model="attributeQuery.code" placeholder="属性编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性名称">
|
||||
<el-input v-model="attributeQuery.name" placeholder="属性名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="queryAttribute">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col style="padding: 5px 10px" :span="3" v-for="attribute in attributeList">
|
||||
<el-checkbox
|
||||
v-model="attributeIdList"
|
||||
:key="attribute.id"
|
||||
:value="attribute.id"
|
||||
:label="attribute.id"
|
||||
@change="checkedAttribute(attribute)"
|
||||
border>{{ attribute.name }}
|
||||
</el-checkbox>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="attributeQuery.pageNum"
|
||||
:limit.sync="attributeQuery.pageSize"
|
||||
@pagination="queryAttribute"
|
||||
/>
|
||||
</el-card>
|
||||
</el-card>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listAttribute} from "@/api/product/attribute";
|
||||
|
||||
export default {
|
||||
name: "CheckAttribute",
|
||||
props: {
|
||||
value: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
checkedList: {
|
||||
type: Array,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler(val) {
|
||||
if (val.toString() !== this.attributeIdList.toString()){
|
||||
this.attributeIdList = val;
|
||||
this.checkedAttributeList = []
|
||||
}
|
||||
},
|
||||
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() {
|
||||
return {
|
||||
attributeIdList: [],
|
||||
checkedAttributeList: [],
|
||||
attributeQuery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
code: null,
|
||||
name: null
|
||||
},
|
||||
attributeTotal: 0,
|
||||
attributeList: [],
|
||||
total: 0,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.queryAttribute();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 选中值触发方法
|
||||
*/
|
||||
checkedAttribute(attribute) {
|
||||
let isCheck = this.attributeIdList.indexOf(attribute.id) > -1;
|
||||
if (isCheck) {
|
||||
this.checkedAttributeList.push(attribute);
|
||||
} else {
|
||||
// 删除
|
||||
this.checkedAttributeList.splice(
|
||||
this.checkedAttributeList.indexOf(attribute), 1
|
||||
)
|
||||
}
|
||||
this.$emit("input", this.attributeIdList);
|
||||
},
|
||||
/**
|
||||
* 删除选中值
|
||||
* @param index
|
||||
*/
|
||||
removeChecked(index) {
|
||||
this.checkedAttributeList.splice(index, 1);
|
||||
this.attributeIdList.splice(index, 1);
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询属性
|
||||
*/
|
||||
queryAttribute() {
|
||||
listAttribute(this.attributeQuery).then(response => {
|
||||
this.attributeList = response.data.rows;
|
||||
this.total = response.data.total;
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,157 @@
|
|||
<template>
|
||||
<el-row>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>选择属性关联关系</span>
|
||||
</div>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>已选择属性</span>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="2" v-for="(attributeGroup, index) in checkedAttributeGroupList">
|
||||
<el-tag
|
||||
style="margin: 5px 10px"
|
||||
:key="attributeGroup.name"
|
||||
closable @close="removeChecked(index)">
|
||||
{{ attributeGroup.name }}
|
||||
</el-tag>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<el-divider></el-divider>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>未选属性</span>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-form :inline="true" :model="attributeGroupQuery" class="demo-form-inline">
|
||||
<el-form-item label="属性编码">
|
||||
<el-input v-model="attributeGroupQuery.code" placeholder="属性编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="属性名称">
|
||||
<el-input v-model="attributeGroupQuery.name" placeholder="属性名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="queryAttributeGroup">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col style="padding: 5px 10px" :span="3" v-for="attributeGroup in attributeGroupList">
|
||||
<el-checkbox
|
||||
v-model="attributeGroupIdList"
|
||||
:key="attributeGroup.id"
|
||||
:value="attributeGroup.id"
|
||||
:label="attributeGroup.id"
|
||||
@change="checkedAttributeGroup(attributeGroup)"
|
||||
border>{{ attributeGroup.name }}
|
||||
</el-checkbox>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="attributeGroupQuery.pageNum"
|
||||
:limit.sync="attributeGroupQuery.pageSize"
|
||||
@pagination="queryAttributeGroup"
|
||||
/>
|
||||
</el-card>
|
||||
</el-card>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listAttributeGroup} from "@/api/product/attributeGroup";
|
||||
|
||||
export default {
|
||||
name: "CheckAttributeGroup",
|
||||
props: {
|
||||
value: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
checkedList: {
|
||||
type: Array,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler(val) {
|
||||
if (val.toString() !== this.attributeGroupIdList.toString()){
|
||||
this.attributeGroupIdList = val;
|
||||
this.checkedAttributeGroupList = []
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
checkedList: {
|
||||
handler(val){
|
||||
if (val !== undefined && val.length > 0){
|
||||
this.checkedAttributeGroupList = val;
|
||||
this.attributeGroupIdList = this.checkedAttributeGroupList.map(checked => checked.id);
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
attributeGroupIdList: [],
|
||||
checkedAttributeGroupList: [],
|
||||
attributeGroupQuery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
code: null,
|
||||
name: null
|
||||
},
|
||||
attributeGroupTotal: 0,
|
||||
attributeGroupList: [],
|
||||
total: 0,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.queryAttributeGroup();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 选中值触发方法
|
||||
*/
|
||||
checkedAttributeGroup(attributeGroup) {
|
||||
let isCheck = this.attributeGroupIdList.indexOf(attributeGroup.id) > -1;
|
||||
if (isCheck) {
|
||||
this.checkedAttributeGroupList.push(attributeGroup);
|
||||
} else {
|
||||
// 删除
|
||||
this.checkedAttributeGroupList.splice(
|
||||
this.checkedAttributeGroupList.indexOf(attributeGroup), 1
|
||||
)
|
||||
}
|
||||
this.$emit("input", this.attributeGroupIdList);
|
||||
},
|
||||
/**
|
||||
* 删除选中值
|
||||
* @param index
|
||||
*/
|
||||
removeChecked(index) {
|
||||
this.checkedAttributeGroupList.splice(index, 1);
|
||||
this.attributeGroupIdList.splice(index, 1);
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询属性
|
||||
*/
|
||||
queryAttributeGroup() {
|
||||
listAttributeGroup(this.attributeGroupQuery).then(response => {
|
||||
this.attributeGroupList = response.data.rows;
|
||||
this.total = response.data.total;
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,157 @@
|
|||
<template>
|
||||
<el-row>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>选择品牌关联关系</span>
|
||||
</div>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>已选择品牌</span>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-col :span="2" v-for="(brand, index) in checkedBrandList">
|
||||
<el-tag
|
||||
style="margin: 5px 10px"
|
||||
:key="brand.nam"
|
||||
closable @close="removeChecked(index)">
|
||||
{{ brand.nam }}
|
||||
</el-tag>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<el-divider></el-divider>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>未选品牌</span>
|
||||
</div>
|
||||
<el-row>
|
||||
<el-form :inline="true" :model="brandQuery" class="demo-form-inline">
|
||||
<el-form-item label="品牌编码">
|
||||
<el-input v-model="brandQuery.code" placeholder="品牌编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="品牌名称">
|
||||
<el-input v-model="brandQuery.nam" placeholder="品牌名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="queryBrand">查询</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col style="padding: 5px 10px" :span="3" v-for="brand in brandList">
|
||||
<el-checkbox
|
||||
v-model="brandIdList"
|
||||
:key="brand.id"
|
||||
:value="brand.id"
|
||||
:label="brand.id"
|
||||
@change="checkedBrand(brand)"
|
||||
border>{{ brand.nam }}
|
||||
</el-checkbox>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="brandQuery.pageNum"
|
||||
:limit.sync="brandQuery.pageSize"
|
||||
@pagination="queryBrand"
|
||||
/>
|
||||
</el-card>
|
||||
</el-card>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {listBrand} from "@/api/product/brand";
|
||||
|
||||
export default {
|
||||
nam: "CheckBrand",
|
||||
props: {
|
||||
value: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
checkedList: {
|
||||
type: Array,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler(val) {
|
||||
if (val.toString() !== this.brandIdList.toString()){
|
||||
this.brandIdList = val;
|
||||
this.checkedBrandList = []
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
checkedList: {
|
||||
handler(val){
|
||||
if (val !== undefined && val.length > 0){
|
||||
this.checkedBrandList = val;
|
||||
this.brandIdList = this.checkedBrandList.map(checked => checked.id);
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
brandIdList: [],
|
||||
checkedBrandList: [],
|
||||
brandQuery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
code: null,
|
||||
nam: null
|
||||
},
|
||||
brandTotal: 0,
|
||||
brandList: [],
|
||||
total: 0,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.queryBrand();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 选中值触发方法
|
||||
*/
|
||||
checkedBrand(brand) {
|
||||
let isCheck = this.brandIdList.indexOf(brand.id) > -1;
|
||||
if (isCheck) {
|
||||
this.checkedBrandList.push(brand);
|
||||
} else {
|
||||
// 删除
|
||||
this.checkedBrandList.splice(
|
||||
this.checkedBrandList.indexOf(brand), 1
|
||||
)
|
||||
}
|
||||
this.$emit("input", this.brandIdList);
|
||||
},
|
||||
/**
|
||||
* 删除选中值
|
||||
* @param index
|
||||
*/
|
||||
removeChecked(index) {
|
||||
this.checkedBrandList.splice(index, 1);
|
||||
this.brandIdList.splice(index, 1);
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询品牌
|
||||
*/
|
||||
queryBrand() {
|
||||
listBrand(this.brandQuery).then(response => {
|
||||
this.brandList = response.data.rows;
|
||||
this.total = response.data.total;
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
14
src/main.js
14
src/main.js
|
@ -38,6 +38,17 @@ import VueMeta from 'vue-meta'
|
|||
// 字典数据组件
|
||||
import DictData from '@/components/DictData'
|
||||
|
||||
|
||||
// 属性选择
|
||||
import Attribute from "@/components/Attribute/index.vue";
|
||||
|
||||
// 品牌选择
|
||||
import Brand from "@/components/Brand/index.vue";
|
||||
|
||||
// 品牌选择
|
||||
import AttributeGroup from "@/components/AttributeGroup/index.vue";
|
||||
|
||||
|
||||
// 全局方法挂载
|
||||
Vue.prototype.getDicts = getDicts
|
||||
Vue.prototype.getConfigKey = getConfigKey
|
||||
|
@ -48,6 +59,9 @@ Vue.prototype.selectDictLabel = selectDictLabel
|
|||
Vue.prototype.selectDictLabels = selectDictLabels
|
||||
Vue.prototype.download = download
|
||||
Vue.prototype.handleTree = handleTree
|
||||
Vue.component('Attribute', Attribute)
|
||||
Vue.component('Brand', Brand)
|
||||
Vue.component('AttributeGroup', AttributeGroup)
|
||||
|
||||
// 全局组件挂载
|
||||
Vue.component('DictTag', DictTag)
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
|
||||
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="属性编码" prop="code">
|
||||
<el-input
|
||||
|
@ -178,6 +181,7 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
|
||||
/** 查询商品属性列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
|
|
@ -80,7 +80,6 @@
|
|||
<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"/>
|
||||
<el-table-column label="属性组" align="center" prop="attributeIds"/>
|
||||
|
||||
<el-table-column label="组内属性" align="center" prop="attributeInfoList" >
|
||||
<template slot-scope="scope">
|
||||
|
@ -103,7 +102,7 @@
|
|||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['product:attributeGroup:edit']"
|
||||
v-hasPermi="['product:attributeGroup:query']"
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
|
@ -134,6 +133,9 @@
|
|||
<!-- 添加或修改商品属性组对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body >
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
|
||||
|
||||
<!--属性名 状态-->
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="属性名" prop="name">
|
||||
|
@ -154,24 +156,24 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
|
||||
<!--备注-->
|
||||
<el-row>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
|
||||
|
||||
<el-row>
|
||||
|
||||
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>已选属性</span>
|
||||
</div>
|
||||
|
||||
<div slot="header" class="clearfix">
|
||||
<el-col :span="2" v-for="(item ,index) in attributeList">
|
||||
<el-tag
|
||||
v-if="attributeids.indexOf(item.id) > -1"
|
||||
v-if="attributeIdList.indexOf(item.id) > -1"
|
||||
style="margin: 5px 10px"
|
||||
:key="item.name"
|
||||
closable @close="handleClose(index)">
|
||||
|
@ -179,17 +181,14 @@
|
|||
</el-tag>
|
||||
</el-col>
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card">
|
||||
|
||||
<div slot="header" class="clearfix">
|
||||
<span>未选属性</span>
|
||||
</div>
|
||||
|
||||
|
||||
<div slot="header" class="clearfix">
|
||||
|
||||
<el-form :inline="true" :model="attribute" class="demo-form-inline">
|
||||
<el-form-item label="属性编码">
|
||||
<el-input v-model="attribute.code" placeholder="属性编码"></el-input>
|
||||
|
@ -208,7 +207,7 @@
|
|||
<el-col style="padding: 5px 10px" :span="3" v-for="item in attributeList">
|
||||
|
||||
<el-checkbox
|
||||
v-model="attributeids"
|
||||
v-model="attributeIdList"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
:label="item.id"
|
||||
|
@ -224,7 +223,7 @@
|
|||
:limit.sync="attribute.pageSize"
|
||||
@pagination="getList1"
|
||||
/>
|
||||
{{ attributeids }}
|
||||
{{ attributeIdList }}
|
||||
</el-card>
|
||||
|
||||
|
||||
|
@ -262,7 +261,7 @@ export default {
|
|||
],
|
||||
attributeTotal: 0,
|
||||
attributeList: [],
|
||||
attributeids: [],
|
||||
attributeIdList: [],
|
||||
attribute: {
|
||||
pageNum: 1,
|
||||
pageSize: 6,
|
||||
|
@ -322,7 +321,7 @@ export default {
|
|||
});
|
||||
},
|
||||
handleClose(index) {
|
||||
this.attributeids.splice(this.attributeids.indexOf(index), 1)
|
||||
this.attributeIdList.splice(this.attributeIdList.indexOf(index), 1)
|
||||
},
|
||||
/** 查询商品属性列表 */
|
||||
getList1() {
|
||||
|
@ -335,7 +334,6 @@ export default {
|
|||
getList() {
|
||||
this.loading = true;
|
||||
listAttributeGroup(this.queryParams).then(response => {
|
||||
console.log(response)
|
||||
this.attributeGroupList = response.data.rows;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
|
@ -357,7 +355,7 @@ export default {
|
|||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
attributeids:null,
|
||||
attributeIdList:null,
|
||||
attributeIds:null,
|
||||
};
|
||||
this.resetForm("form");
|
||||
|
@ -389,11 +387,8 @@ export default {
|
|||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getAttributeGroup(id).then(response => {
|
||||
console.log(response)
|
||||
this.form = response.data;
|
||||
let str = response.data.attributeIds;
|
||||
this.attributeids = str.split(',').map(Number);
|
||||
console.log(this.form)
|
||||
this.attributeIdList=response.data.attributeIdList
|
||||
this.open = true;
|
||||
this.title = "修改商品属性组";
|
||||
});
|
||||
|
@ -403,8 +398,7 @@ export default {
|
|||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
let str = this.attributeids.join(',');
|
||||
this.form.attributeIds=str
|
||||
this.form.attributeIdList=this.attributeIdList
|
||||
updateAttributeGroup(this.form).then(response => {
|
||||
console.log(this.form)
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
|
@ -412,18 +406,18 @@ export default {
|
|||
this.getList();
|
||||
this.reset();
|
||||
this.form.attributeIds=''
|
||||
this.attributeids=[]
|
||||
this.attributeIdList=[]
|
||||
});
|
||||
} else {
|
||||
let str = this.attributeids.join(',');
|
||||
this.form.attributeIds=str
|
||||
|
||||
this.form.attributeIdList=this.attributeIdList
|
||||
addAttributeGroup(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
this.reset();
|
||||
this.form.attributeIds=''
|
||||
this.attributeids=[]
|
||||
this.attributeIdList=[]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,12 +10,14 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="start">
|
||||
<el-input
|
||||
v-model="queryParams.start"
|
||||
placeholder="请输入是否启用"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
<el-select v-model="queryParams.start" placeholder="请选择是否启用" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_yes_no"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
|
@ -73,8 +75,16 @@
|
|||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键" align="center" prop="id" />
|
||||
<el-table-column label="品牌名称" align="center" prop="nam" />
|
||||
<el-table-column label="LOGO" align="center" prop="logo" />
|
||||
<el-table-column label="是否启用" align="center" prop="start" />
|
||||
<el-table-column label="LOGO" align="center" prop="logo" width="100">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.logo" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="是否启用" align="center" prop="start">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.start"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="介绍" align="center" prop="introduction" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
|
@ -112,10 +122,16 @@
|
|||
<el-input v-model="form.nam" placeholder="请输入品牌名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="LOGO" prop="logo">
|
||||
<el-input v-model="form.logo" type="textarea" placeholder="请输入内容" />
|
||||
<image-upload v-model="form.logo"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="start">
|
||||
<el-input v-model="form.start" placeholder="请输入是否启用" />
|
||||
<el-radio-group v-model="form.start">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.sys_yes_no"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="介绍" prop="introduction">
|
||||
<el-input v-model="form.introduction" type="textarea" placeholder="请输入内容" />
|
||||
|
@ -137,6 +153,7 @@ import { listBrand, getBrand, delBrand, addBrand, updateBrand } from "@/api/prod
|
|||
|
||||
export default {
|
||||
name: "Brand",
|
||||
dicts: ['sys_yes_no'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
|
@ -177,7 +194,7 @@ export default {
|
|||
{ required: true, message: "LOGO不能为空", trigger: "blur" }
|
||||
],
|
||||
start: [
|
||||
{ required: true, message: "是否启用不能为空", trigger: "blur" }
|
||||
{ required: true, message: "是否启用不能为空", trigger: "change" }
|
||||
],
|
||||
createBy: [
|
||||
{ required: true, message: "创建人不能为空", trigger: "blur" }
|
||||
|
|
|
@ -40,7 +40,8 @@
|
|||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['product:category:add']"
|
||||
>新增</el-button>
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
|
@ -49,7 +50,8 @@
|
|||
icon="el-icon-sort"
|
||||
size="mini"
|
||||
@click="toggleExpandAll"
|
||||
>展开/折叠</el-button>
|
||||
>展开/折叠
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
@ -84,30 +86,37 @@
|
|||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['product:category:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-plus"
|
||||
@click="handleAdd(scope.row)"
|
||||
v-hasPermi="['product:category:add']"
|
||||
>新增</el-button>
|
||||
>新增
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['product:category:remove']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 添加或修改品类信息对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="父级品类" prop="parentId">
|
||||
<treeselect v-model="form.parentId" :options="categoryOptions" :normalizer="normalizer" placeholder="请选择父级品类" />
|
||||
<treeselect v-model="form.parentId" :options="categoryOptions" :normalizer="normalizer"
|
||||
placeholder="请选择父级品类"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="品牌名称" prop="name">
|
||||
|
@ -116,22 +125,43 @@
|
|||
<el-form-item label="图片" prop="image">
|
||||
<image-upload v-model="form.image"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="states">
|
||||
<el-radio-group v-model="form.start">
|
||||
<el-radio
|
||||
v-for="dict in dict.type.sys_yes_no"
|
||||
:key="dict.value"
|
||||
:label="dict.value"
|
||||
>{{dict.label}}</el-radio>
|
||||
>{{ dict.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="介绍" prop="introduction">
|
||||
<el-input v-model="form.introduction" type="textarea" placeholder="请输入内容"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<editor v-model="form.remark" :min-height="192"/>
|
||||
<editor v-model="form.remark" :min-height="80"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-tabs value="">
|
||||
<el-tab-pane label="商品属性" name="attribute">
|
||||
<Attribute v-model="form.attributeIdList" :checked-list="attributeInfoList"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="商品属性组" name="attributeGroup">
|
||||
<AttributeGroup v-model="form.attributeGroupIdList" :checked-list="attributeGroupList"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="商品品牌" name="band">
|
||||
<Brand v-model="form.brandIdList" :checked-list="brandInfoList"/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-row>
|
||||
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
|
@ -142,7 +172,14 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { listCategory, getCategory, delCategory, addCategory, updateCategory } from "@/api/product/category";
|
||||
import {
|
||||
listCategory,
|
||||
getCategory,
|
||||
delCategory,
|
||||
addCategory,
|
||||
updateCategory,
|
||||
parentCategoryCommon
|
||||
} from "@/api/product/category";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
|
||||
|
@ -200,9 +237,28 @@ export default {
|
|||
createTime: [
|
||||
{required: true, message: "创建时间不能为空", trigger: "blur"}
|
||||
],
|
||||
}
|
||||
},
|
||||
attributeInfoList: [],
|
||||
brandInfoList: [],
|
||||
attributeGroupList: [],
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'form.parentId': {
|
||||
handler(val) {
|
||||
if (val !== undefined && val !== 0) {
|
||||
parentCategoryCommon(val).then(
|
||||
response => {
|
||||
this.attributeInfoList = response.data.attributeInfoList;
|
||||
this.attributeGroupList = response.data.attributeGroupList;
|
||||
this.brandInfoList = response.data.brandInfoList;
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
|
@ -248,12 +304,7 @@ export default {
|
|||
image: null,
|
||||
parentId: null,
|
||||
start: null,
|
||||
introduction: null,
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
introduction: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
@ -311,6 +362,7 @@ export default {
|
|||
});
|
||||
} else {
|
||||
addCategory(this.form).then(response => {
|
||||
console.log(this.form)
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
|
@ -326,7 +378,8 @@ export default {
|
|||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue