商品模块属性组增删改
parent
019dfc754c
commit
f42ac8c85d
|
@ -0,0 +1,143 @@
|
||||||
|
<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: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value: {
|
||||||
|
handler(val) {
|
||||||
|
if (val.toString() !== this.attributeIdList.toString()){
|
||||||
|
this.attributeIdList = val
|
||||||
|
this.checkedAttributeList = []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
attributeIdList: [],
|
||||||
|
checkedAttributeList: [],
|
||||||
|
attributeQuery: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
code: null,
|
||||||
|
name: null
|
||||||
|
},
|
||||||
|
attributeTotal: 0,
|
||||||
|
attributeList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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,139 @@
|
||||||
|
<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.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: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value: {
|
||||||
|
handler(val) {
|
||||||
|
if (val.toString() !== this.attributeGroupIdList.toString()){
|
||||||
|
this.attributeGroupIdList = val
|
||||||
|
this.checkedAttributeGroupList = []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
attributeGroupIdList: [],
|
||||||
|
checkedAttributeGroupList: [],
|
||||||
|
attributeGroupQuery: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null
|
||||||
|
},
|
||||||
|
attributeGroupTotal: 0,
|
||||||
|
attributeGroupList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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,139 @@
|
||||||
|
<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.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 {
|
||||||
|
name: "CheckBrand",
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: Array,
|
||||||
|
default: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
vlue: {
|
||||||
|
handler(val) {
|
||||||
|
if (val.toString() !== this.brandIdList.toString()){
|
||||||
|
this.brandIdList = val
|
||||||
|
this.checkedBrandList = []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
brandIdList: [],
|
||||||
|
checkedBrandList: [],
|
||||||
|
brandQuery: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null
|
||||||
|
},
|
||||||
|
brandTotal: 0,
|
||||||
|
brandList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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>
|
|
@ -37,6 +37,12 @@ import DictTag from '@/components/DictTag'
|
||||||
import VueMeta from 'vue-meta'
|
import VueMeta from 'vue-meta'
|
||||||
// 字典数据组件
|
// 字典数据组件
|
||||||
import DictData from '@/components/DictData'
|
import DictData from '@/components/DictData'
|
||||||
|
// 属性选择
|
||||||
|
import CheckAttribute from "@/components/CheckAttribute/index.vue";
|
||||||
|
// 属性组选择
|
||||||
|
import CheckAttributeGroup from "@/components/CheckAttributeGroup/index.vue";
|
||||||
|
// 品牌选择
|
||||||
|
import CheckBrand from "@/components/CheckBrand/index.vue";
|
||||||
|
|
||||||
// 全局方法挂载
|
// 全局方法挂载
|
||||||
Vue.prototype.getDicts = getDicts
|
Vue.prototype.getDicts = getDicts
|
||||||
|
@ -57,6 +63,9 @@ Vue.component('Editor', Editor)
|
||||||
Vue.component('FileUpload', FileUpload)
|
Vue.component('FileUpload', FileUpload)
|
||||||
Vue.component('ImageUpload', ImageUpload)
|
Vue.component('ImageUpload', ImageUpload)
|
||||||
Vue.component('ImagePreview', ImagePreview)
|
Vue.component('ImagePreview', ImagePreview)
|
||||||
|
Vue.component('CheckAttribute', CheckAttribute)
|
||||||
|
Vue.component('CheckAttributeGroup', CheckAttributeGroup)
|
||||||
|
Vue.component('CheckBrand', CheckBrand)
|
||||||
|
|
||||||
Vue.use(directive)
|
Vue.use(directive)
|
||||||
Vue.use(plugins)
|
Vue.use(plugins)
|
||||||
|
|
|
@ -106,30 +106,61 @@
|
||||||
<!-- 添加或修改品类信息对话框 -->
|
<!-- 添加或修改品类信息对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="80%" 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-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-form-item label="品类名称" prop="name">
|
|
||||||
<el-input v-model="form.name" placeholder="请输入品类名称" />
|
<el-row>
|
||||||
</el-form-item>
|
<el-col :span="12">
|
||||||
<el-form-item label="图片" prop="image">
|
<el-form-item label="父级品类" prop="parentId">
|
||||||
<image-upload v-model="form.image"/>
|
<treeselect v-model="form.parentId" :options="categoryOptions" :normalizer="normalizer" placeholder="请选择父级品类" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="父级品类" prop="parentId">
|
</el-col>
|
||||||
<treeselect v-model="form.parentId" :options="categoryOptions" :normalizer="normalizer" placeholder="请选择父级品类" />
|
<el-col :span="12">
|
||||||
</el-form-item>
|
<el-form-item label="品类名称" prop="name">
|
||||||
<el-form-item label="是否启用" prop="start">
|
<el-input v-model="form.name" placeholder="请输入品类名称" />
|
||||||
<el-radio-group v-model="form.start">
|
</el-form-item>
|
||||||
<el-radio
|
</el-col>
|
||||||
v-for="dict in dict.type.sys_yes_no"
|
</el-row>
|
||||||
:key="dict.value"
|
<el-row>
|
||||||
:label="dict.value"
|
<el-col :span="12">
|
||||||
>{{dict.label}}</el-radio>
|
<el-form-item label="是否启用" prop="start">
|
||||||
</el-radio-group>
|
<el-radio-group v-model="form.start">
|
||||||
</el-form-item>
|
<el-radio
|
||||||
<el-form-item label="介绍">
|
v-for="dict in dict.type.sys_yes_no"
|
||||||
<editor v-model="form.introduction" :min-height="192"/>
|
:key="dict.value"
|
||||||
</el-form-item>
|
:label="dict.value"
|
||||||
<el-form-item label="备注" prop="remark">
|
>{{dict.label}}</el-radio>
|
||||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="图片" prop="image">
|
||||||
|
<image-upload v-model="form.image" :limit="1" :is-show-tip="false"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="介绍">
|
||||||
|
<editor v-model="form.introduction" :min-height="80"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-tabs value="attribute" type="card" >
|
||||||
|
<el-tab-pane label="商品属性" name="attribute">
|
||||||
|
<CheckAttribute v-model="form.attributeIdList"/>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="商品属性组" name="attributeGroup">
|
||||||
|
<CheckAttributeGroup v-model="form.attributeGroupIdList"/>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="商品品牌" name="brand">
|
||||||
|
<CheckBrand v-model="form.brandIdList"/>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
</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>
|
||||||
|
|
Loading…
Reference in New Issue