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