回显优化

master
‘mahaoran’ 2024-11-21 10:26:28 +08:00
parent 246109ddca
commit a7640afbc0
3 changed files with 23 additions and 19 deletions

View File

@ -36,7 +36,7 @@ export function addInfo(data) {
// 修改商品信息 // 修改商品信息
export function updateInfo(data) { export function updateInfo(data) {
return request({ return request({
url: '/product/info/'+data.id, url: '/product/info/'+data.projectAddModel.id,
method: 'put', method: 'put',
data: data data: data
}) })

View File

@ -153,14 +153,15 @@
<CheckAttribute v-model="form.attributeIdList" :checked-list="attributeInfoList"/> <CheckAttribute v-model="form.attributeIdList" :checked-list="attributeInfoList"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="商品属性组" name="attributeGroup"> <el-tab-pane label="商品属性组" name="attributeGroup">
<CheckAttributeGroup v-model="form.attributeGroupIdList" :checked-list="form.attributeGroupList"/> <CheckAttributeGroup v-model="form.attributeGroupIdList" :checked-list="attributeGroupList"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="商品品牌" name="brand"> <el-tab-pane label="商品品牌" name="brand">
<CheckBrand v-model="form.brandIdList" :checked-list="brandInfoList"/> <CheckBrand v-model="form.brandIdList" :checked-list="brandInfoList"/>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
{{form}}
</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>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
@ -198,9 +199,7 @@ export default {
// //
categoryOptions: [], categoryOptions: [],
// attributeInfoList:[],
// attributeGroupList:[],
// brandInfoList:[],
// //
title: "", title: "",
// //
@ -363,7 +362,7 @@ export default {
this.reset(); this.reset();
this.getTreeselect(); this.getTreeselect();
if (row != null) { if (row != null) {
this.form.parentId = row.parentId; this.form.parentId = row.id;
} }
getCategory(row.id).then(response => { getCategory(row.id).then(response => {
this.form = response.data; this.form = response.data;

View File

@ -92,9 +92,9 @@
<el-table-column label="主键" align="center" prop="id" /> <el-table-column label="主键" align="center" prop="id" />
<el-table-column label="商品名称" align="center" prop="name" /> <el-table-column label="商品名称" align="center" prop="name" />
<el-table-column label="商品描述" align="center" prop="introduction" /> <el-table-column label="商品描述" align="center" prop="introduction" />
<el-table-column label="主类型" align="center" prop="mianType" /> <el-table-column label="主类型" align="center" prop="mianTypeName" />
<el-table-column label="父类型" align="center" prop="parentType" /> <el-table-column label="父类型" align="center" prop="parentTypeName" />
<el-table-column label="商品类型" align="center" prop="type" /> <el-table-column label="商品类型" align="center" prop="typeName" />
<el-table-column label="商品图片" align="center" prop="image" width="100"> <el-table-column label="商品图片" align="center" prop="image" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<image-preview :src="scope.row.image" :width="50" :height="50"/> <image-preview :src="scope.row.image" :width="50" :height="50"/>
@ -110,8 +110,8 @@
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.status"/> <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="规格" align="center" prop="ruleId" /> <el-table-column label="规格" align="center" prop="ruleName" />
<el-table-column label="品牌" align="center" prop="brandId" /> <el-table-column label="品牌" align="center" prop="brandName" />
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<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">
@ -233,8 +233,8 @@
</div> </div>
<div style="height: 200px; width: 100%;"> <div style="height: 200px; width: 100%;">
<el-form ref="templateAttributeGroupForm" label-width="80px"> <el-form ref="templateAttributeGroupForm" label-width="80px">
<el-form-item :label="attribute.name" v-for="attribute in templateAttributeGroup.attributeList"> <el-form-item :label="attribute.code" v-for="attribute in templateAttributeGroup.attributeList">
<el-input v-model="attribute.value"></el-input> <el-input v-model="attribute.name"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -723,6 +723,11 @@ export default {
const id = row.id || this.ids const id = row.id || this.ids
getInfo(id).then(response => { getInfo(id).then(response => {
this.form = response.data; this.form = response.data;
this.categoryOptionValue = [
this.form.mianType ,
this.form.parentType ,
this.form.type ,
]
this.open = true; this.open = true;
this.title = "修改商品信息"; this.title = "修改商品信息";
}); });
@ -733,11 +738,11 @@ export default {
if (valid) { if (valid) {
let attrValueList = []; let attrValueList = [];
for (const templateAttributeGroup of this.categoryCommonElement.templateAttributeGroupList) { for (const templateAttributeGroup of this.categoryCommonElement.templateAttributeGroupList) {
templateAttributeGroup.attributeList.map(attribute => attrValueList.push({id: attribute.id, value: attribute.value})) templateAttributeGroup.attributeList.map(attribute => attrValueList.push({id: attribute.id, name: attribute.name}))
} }
this.categoryCommonElement.templateAttributeList.map(attribute => attrValueList.push({id: attribute.id, value: attribute.value})) this.categoryCommonElement.templateAttributeList.map(attribute => attrValueList.push({id: attribute.id, name: attribute.name}))
this.attributeCheckedList.map(attribute => attrValueList.push({id: attribute.id, value: attribute.value})) this.attributeCheckedList.map(attribute => attrValueList.push({id: attribute.id, name: attribute.name}))
let ruleInfo = this.ruleList.find(ruleInfo => ruleInfo.id === this.form.ruleId); let ruleInfo = this.ruleList.find(ruleInfo => ruleInfo.id === this.form.ruleId);
const {ruleAttrList} = ruleInfo; const {ruleAttrList} = ruleInfo;
let ruleAttrSize = ruleAttrList.length; let ruleAttrSize = ruleAttrList.length;
@ -766,13 +771,13 @@ export default {
console.log(productAddReq) console.log(productAddReq)
if (this.form.id != null) { if (this.form.id != null) {
updateInfo(productAddReq).then(response => { updateInfo(productAddReq).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess(response.msg);
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addInfo(productAddReq).then(response => { addInfo(productAddReq).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess(response.msg);
this.open = false; this.open = false;
this.getList(); this.getList();
}); });