Commit 36fde3cc authored by Marcus's avatar Marcus

品牌管理-最后一个商标不能删除

http://zentao.jdshangmen.com/bug-view-692.html
parent d51359b4
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<el-form ref="form" :model="form" label-width="80px"> <el-form ref="form" :model="form" label-width="80px">
<el-card class="box-card" style="margin-bottom: 15px"> <el-card class="box-card" style="margin-bottom: 15px">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<el-button style="float: right; padding: 3px 0" type="text" @click="$emit('delete')">删除</el-button> <el-button v-show="isShowDelete" style="float: right; padding: 3px 0" type="text" @click="$emit('delete')">删除</el-button>
</div> </div>
<el-form-item :label="'商标' + (index + 1)"> <el-form-item :label="'商标' + (index + 1)">
<el-input v-model="form.brandName" placeholder="商标"></el-input> <el-input v-model="form.brandName" placeholder="商标"></el-input>
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
export default { export default {
name: "BrandForm", name: "BrandForm",
props: { props: {
isShowDelete: {
type: Boolean,
default: true
},
productTypeList: { productTypeList: {
type: Array, type: Array,
default: [] default: []
......
...@@ -110,6 +110,7 @@ ...@@ -110,6 +110,7 @@
<h3>包含商标列表</h3> <h3>包含商标列表</h3>
<brand-form <brand-form
:is-show-delete="form.trademarkList.length > 1"
v-for="(item, index) in form.trademarkList" v-for="(item, index) in form.trademarkList"
v-model="form.trademarkList[index]" v-model="form.trademarkList[index]"
:index="index" :index="index"
...@@ -119,9 +120,9 @@ ...@@ -119,9 +120,9 @@
@delete="form.trademarkList.splice(index, 1)"></brand-form> @delete="form.trademarkList.splice(index, 1)"></brand-form>
<el-button type="primary" @click="form.trademarkList.push({ <el-button type="primary" @click="form.trademarkList.push({
brandName: '', brandName: form.titleZh,
productBrandId: form.id, productBrandId: form.id,
trademarkCategoryRelList: [] trademarkCategoryRelList: [{productCategoryId:0, productId:0}]
})">添加商标</el-button> })">添加商标</el-button>
<div slot="footer" style="text-align: center"> <div slot="footer" style="text-align: center">
...@@ -287,21 +288,26 @@ export default { ...@@ -287,21 +288,26 @@ export default {
if (!valid) { if (!valid) {
return; return;
} }
// 修改的提交 if (this.form.trademarkList?.length > 0){
if (this.form.id != null) { // 修改的提交
updateProductBrank(this.form).then(response => { if (this.form.id != null) {
this.$modal.msgSuccess("修改成功"); updateProductBrank(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
// 添加的提交
createProductBrank(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
return; } else {
this.$modal.alert('请至少添加一个商标')
} }
// 添加的提交
createProductBrank(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}); });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment