添加商品页面增加商品备注,增加批量修改范围限制,修复批量修改时数据变化视图未更新问题

This commit is contained in:
YeMingfei666 2024-07-26 14:12:41 +08:00
parent 432ba32b4e
commit 8d5a54fe6f
1 changed files with 13 additions and 3 deletions

View File

@ -16,6 +16,9 @@
<el-form-item label="商品名称" prop="name"> <el-form-item label="商品名称" prop="name">
<el-input v-model="form.name" placeholder="请输入商品名称" style="width: 500px;"></el-input> <el-input v-model="form.name" placeholder="请输入商品名称" style="width: 500px;"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品介绍" prop="shortTitle">
<el-input v-model="form.shortTitle" type="textarea" placeholder="请输入商品介绍" style="width: 500px;"></el-input>
</el-form-item>
<el-form-item label="单位" prop="unitId"> <el-form-item label="单位" prop="unitId">
<el-select v-model="form.unitId" placeholder="请选择单位" style="width: 500px;" @change="selectUnitt"> <el-select v-model="form.unitId" placeholder="请选择单位" style="width: 500px;" @change="selectUnitt">
<el-option :label="item.name" :value="item.id" v-for="item in units" :key="item.id"></el-option> <el-option :label="item.name" :value="item.id" v-for="item in units" :key="item.id"></el-option>
@ -323,7 +326,7 @@
<el-dialog title="批量修改" width="400px" :visible.sync="showBatchModal"> <el-dialog title="批量修改" width="400px" :visible.sync="showBatchModal">
<el-form :model="batchNumberForm"> <el-form :model="batchNumberForm">
<el-form-item> <el-form-item>
<el-input-number v-model="batchNumberForm.batchNumber" :min="0" controls-position="right" <el-input-number @change="priceFormat(batchNumberForm,'batchNumber')" @blur="priceFormat(batchNumberForm,'batchNumber')" v-model="batchNumberForm.batchNumber" controls-position="right"
style="width: 100%;"></el-input-number> style="width: 100%;"></el-input-number>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -402,6 +405,7 @@ export default {
id: "", id: "",
typeEnum: "normal", typeEnum: "normal",
name: "", name: "",
shortTitle:"",//
unitId: "", unitId: "",
unitName: "", unitName: "",
categoryId: "", // id categoryId: "", // id
@ -563,8 +567,14 @@ export default {
}, },
// //
batchNumberFormConfirm() { batchNumberFormConfirm() {
this.form.skuList.map(item => { console.log(this.form.skuList)
item[this.batchNumberKey] = this.batchNumberForm.batchNumber; this.form.skuList.map((item,index) => {
//vue2
let newitem = {...item}
newitem[this.batchNumberKey] = this.batchNumberForm.batchNumber;
this.$set( this.form.skuList, index, {...newitem})
// item[this.batchNumberKey] = this.batchNumberForm.batchNumber;
}); });
this.showBatchModal = false; this.showBatchModal = false;
this.batchNumberForm.batchNumber = 0; this.batchNumberForm.batchNumber = 0;