商品模块属性组增删改

yaoxin 2024-03-01 19:25:49 +08:00
parent b3ce31f749
commit 019dfc754c
4 changed files with 41 additions and 3 deletions

View File

@ -151,6 +151,7 @@ export default {
handleUploadSuccess(res, file) {
if (res.code === 200) {
this.uploadList.push({name: res.data.url, url: res.data.url});
console.log(res.data.url)
this.uploadedSuccessfully();
} else {
this.number--;

View File

@ -117,11 +117,18 @@
<script>
import { listAttribute, getAttribute, delAttribute, addAttribute, updateAttribute } from "@/api/product/attribute";
import {listAttributeGroup} from "@/api/product/attributeGroup";
export default {
name: "Attribute",
data() {
return {
queryParam: {
pageNum: 1,
pageSize: 10,
name: null,
states: null
},
//
loading: true,
//

View File

@ -217,6 +217,13 @@ import {listAttribute} from "@/api/product/attribute";
export default {
name: "AttributeGroup",
dicts: ['sys_yes_no'],
watch: {
'form.attributeIdList':{
handler(val) {
console.log(val)
}
}
},
data() {
return {
//
@ -245,7 +252,8 @@ export default {
states: null
},
//
form: {},
form: {
},
//
rules: {
name: [
@ -270,6 +278,9 @@ export default {
attributeList: []
};
},
activated() {
this.getList();
},
created() {
this.getList();
},
@ -283,6 +294,9 @@ export default {
this.checkedAttributeList.push(attribute);
}else {
//
console.log(this.checkedAttributeList)
console.log(attribute)
console.log(this.checkedAttributeList.indexOf(attribute))
this.checkedAttributeList.splice(
this.checkedAttributeList.indexOf(attribute), 1
)
@ -293,9 +307,10 @@ export default {
* @param index
*/
removeChecked(index){
console.log(index)
console.log(this.form.attributeIdList)
this.checkedAttributeList.splice(index, 1);
this.form.attributeIdList.splice(index, 1);
console.log(this.form.attributeIdList)
},
/**
@ -320,6 +335,7 @@ export default {
//
cancel() {
this.open = false;
this.getList()
this.reset();
},
//
@ -360,11 +376,18 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.checkedAttributeList = row.attributeInfoList
const id = row.id || this.ids
getAttributeGroup(id).then(response => {
const att = this.form.attributeIdList
this.form = response.data;
this.open = true;
this.title = "修改属性组";
this.form.attributeIdList = att
row.attributeInfoList.forEach(att => {
this.form.attributeIdList.push(att.id)
})
this.queryAttribute();
});
this.queryAttribute();
},

View File

@ -116,7 +116,13 @@
<treeselect v-model="form.parentId" :options="categoryOptions" :normalizer="normalizer" placeholder="请选择父级品类" />
</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="介绍">
<editor v-model="form.introduction" :min-height="192"/>
@ -140,6 +146,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Category",
dicts: ["sys_yes_no"],
components: {
Treeselect
},