fix:产品入库为空保存报错问题解决

This commit is contained in:
zhangxuanming 2024-12-20 15:43:58 +08:00
parent a47f980817
commit f09dc5ad83

View File

@ -34,7 +34,7 @@
v-if="optType != 'view'"
v-hasPermi="['mes:wm:productrecpt:remove']"
>删除</el-button>
</el-col>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -70,7 +70,7 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -81,7 +81,7 @@
<!-- 添加或修改产品入库记录行对话框 -->
<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-row>
<el-col :span="8">
<el-form-item label="产品物料编码" prop="itemCode">
@ -126,7 +126,7 @@
:options="warehouseOptions"
:props="warehouseProps"
@change="handleWarehouseChanged"
>
>
</el-cascader>
</el-form-item>
</el-col>
@ -225,6 +225,9 @@ export default {
quantityRecived: [
{ required: true, message: "入库数量不能为空", trigger: "blur" }
],
itemCode: [
{ required: true, message: "产品物料编码不能为空", trigger: "blur" }
]
}
};
},
@ -243,16 +246,16 @@ export default {
});
},
getWarehouseList(){
getTreeList().then( response =>{
getTreeList().then( response =>{
this.warehouseOptions = response.data;
this.warehouseOptions.map(w =>{
w.children.map(l =>{
let lstr =JSON.stringify(l.children).replace(/locationId/g,'lId').replace(/areaId/g, 'pId').replace(/areaName/g,'pName');
let lstr =JSON.stringify(l.children).replace(/locationId/g,'lId').replace(/areaId/g, 'pId').replace(/areaName/g,'pName');
l.children = JSON.parse(lstr);
});
let wstr = JSON.stringify(w.children).replace(/warehouseId/g,'wId').replace(/locationId/g, 'pId').replace(/locationName/g,'pName');
w.children = JSON.parse(wstr);
let wstr = JSON.stringify(w.children).replace(/warehouseId/g,'wId').replace(/locationId/g, 'pId').replace(/locationName/g,'pName');
w.children = JSON.parse(wstr);
});
let ostr=JSON.stringify(this.warehouseOptions).replace(/warehouseId/g,'pId').replace(/warehouseName/g, 'pName');
@ -378,14 +381,14 @@ export default {
this.form.itemCode = obj.itemCode;
this.form.itemName = obj.itemName;
this.form.specification = obj.specification;
this.form.unitOfMeasure = obj.unitOfMeasure;
this.form.unitOfMeasure = obj.unitOfMeasure;
this.form.batchCode = obj.batchCode;
this.form.quantityRecived = obj.quantityOnhand;
this.form.quantityMax = obj.quantityOnhand;
}
},
//
handleWarehouseChanged(obj){
handleWarehouseChanged(obj){
if(obj !=null){
this.form.warehouseId = obj[0];
this.form.locationId = obj[1];