商品模块属性组增删改
parent
b3ce31f749
commit
019dfc754c
|
@ -151,6 +151,7 @@ export default {
|
||||||
handleUploadSuccess(res, file) {
|
handleUploadSuccess(res, file) {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.uploadList.push({name: res.data.url, url: res.data.url});
|
this.uploadList.push({name: res.data.url, url: res.data.url});
|
||||||
|
console.log(res.data.url)
|
||||||
this.uploadedSuccessfully();
|
this.uploadedSuccessfully();
|
||||||
} else {
|
} else {
|
||||||
this.number--;
|
this.number--;
|
||||||
|
|
|
@ -117,11 +117,18 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listAttribute, getAttribute, delAttribute, addAttribute, updateAttribute } from "@/api/product/attribute";
|
import { listAttribute, getAttribute, delAttribute, addAttribute, updateAttribute } from "@/api/product/attribute";
|
||||||
|
import {listAttributeGroup} from "@/api/product/attributeGroup";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Attribute",
|
name: "Attribute",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
queryParam: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null,
|
||||||
|
states: null
|
||||||
|
},
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
|
|
|
@ -217,6 +217,13 @@ import {listAttribute} from "@/api/product/attribute";
|
||||||
export default {
|
export default {
|
||||||
name: "AttributeGroup",
|
name: "AttributeGroup",
|
||||||
dicts: ['sys_yes_no'],
|
dicts: ['sys_yes_no'],
|
||||||
|
watch: {
|
||||||
|
'form.attributeIdList':{
|
||||||
|
handler(val) {
|
||||||
|
console.log(val)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
@ -245,7 +252,8 @@ export default {
|
||||||
states: null
|
states: null
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {
|
||||||
|
},
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
|
@ -270,6 +278,9 @@ export default {
|
||||||
attributeList: []
|
attributeList: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
activated() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
|
@ -283,6 +294,9 @@ export default {
|
||||||
this.checkedAttributeList.push(attribute);
|
this.checkedAttributeList.push(attribute);
|
||||||
}else {
|
}else {
|
||||||
// 删除
|
// 删除
|
||||||
|
console.log(this.checkedAttributeList)
|
||||||
|
console.log(attribute)
|
||||||
|
console.log(this.checkedAttributeList.indexOf(attribute))
|
||||||
this.checkedAttributeList.splice(
|
this.checkedAttributeList.splice(
|
||||||
this.checkedAttributeList.indexOf(attribute), 1
|
this.checkedAttributeList.indexOf(attribute), 1
|
||||||
)
|
)
|
||||||
|
@ -293,9 +307,10 @@ export default {
|
||||||
* @param index
|
* @param index
|
||||||
*/
|
*/
|
||||||
removeChecked(index){
|
removeChecked(index){
|
||||||
console.log(index)
|
console.log(this.form.attributeIdList)
|
||||||
this.checkedAttributeList.splice(index, 1);
|
this.checkedAttributeList.splice(index, 1);
|
||||||
this.form.attributeIdList.splice(index, 1);
|
this.form.attributeIdList.splice(index, 1);
|
||||||
|
console.log(this.form.attributeIdList)
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -320,6 +335,7 @@ export default {
|
||||||
// 取消按钮
|
// 取消按钮
|
||||||
cancel() {
|
cancel() {
|
||||||
this.open = false;
|
this.open = false;
|
||||||
|
this.getList()
|
||||||
this.reset();
|
this.reset();
|
||||||
},
|
},
|
||||||
// 表单重置
|
// 表单重置
|
||||||
|
@ -360,11 +376,18 @@ export default {
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
this.checkedAttributeList = row.attributeInfoList
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
getAttributeGroup(id).then(response => {
|
getAttributeGroup(id).then(response => {
|
||||||
|
const att = this.form.attributeIdList
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改属性组";
|
this.title = "修改属性组";
|
||||||
|
this.form.attributeIdList = att
|
||||||
|
row.attributeInfoList.forEach(att => {
|
||||||
|
this.form.attributeIdList.push(att.id)
|
||||||
|
})
|
||||||
|
this.queryAttribute();
|
||||||
});
|
});
|
||||||
this.queryAttribute();
|
this.queryAttribute();
|
||||||
},
|
},
|
||||||
|
|
|
@ -116,7 +116,13 @@
|
||||||
<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>
|
||||||
<el-form-item label="是否启用" prop="start">
|
<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>
|
||||||
<el-form-item label="介绍">
|
<el-form-item label="介绍">
|
||||||
<editor v-model="form.introduction" :min-height="192"/>
|
<editor v-model="form.introduction" :min-height="192"/>
|
||||||
|
@ -140,6 +146,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Category",
|
name: "Category",
|
||||||
|
dicts: ["sys_yes_no"],
|
||||||
components: {
|
components: {
|
||||||
Treeselect
|
Treeselect
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue