Commit 8073d4b1 by lixiaomin

修改规格

parent fb33385c
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<el-table-column label="原料数量" align="center"> <el-table-column label="原料数量" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<el-input v-model="scope.row.quantity" placeholder="请输入原料数量" /> <el-input v-model="scope.row.quantity" placeholder="请输入原料数量" @change="((val)=>{quanChange(val, scope.row)})"/>
<div style="margin-left: 5px"> <div style="margin-left: 5px">
<span> {{scope.row.unit}}</span> <span> {{scope.row.unit}}</span>
</div> </div>
...@@ -127,7 +127,8 @@ export default { ...@@ -127,7 +127,8 @@ export default {
}); });
}, },
openModal() { openModal() {
this.getList(); //this.getList();
this.handleQuery();
this.open = true; this.open = true;
}, },
// 取消按钮 // 取消按钮
...@@ -139,31 +140,53 @@ export default { ...@@ -139,31 +140,53 @@ export default {
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
listMaterial(this.queryParams).then((response) => { listMaterial(this.queryParams).then((response) => {
this.materialList = response.rows; for(let j=0;j<response.rows.length;j++){
this.total = response.total; let row = response.rows[j];
this.loading = false; row.quantity="";
if(this.ids.length>0){ if(this.ids.length>0){
for(let i=0;i<this.ids.length;i++){ for(let i=0;i<this.ids.length;i++){
for(let j=0;j<this.materialList.length;j++){
if(this.ids[i].quantity!=""){ if(this.ids[i].quantity!=""){
if(this.ids[i].id==this.materialList[j].id){ if(this.ids[i].id==row.id){
this.materialList[j].quantity=this.ids[i].quantity row.quantity=this.ids[i].quantity
} }
} }
}
} }
} }
}
this.materialList = response.rows;
this.total = response.total;
this.loading = false;
}); });
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection; this.ids = selection;
}, },
quanChange(val,row){
for(let i=0;i<this.ids.length;i++){
if(row.id==this.ids[i].id){
row.quantity = val;
this.ids[i].quantity = val
}
}
},
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
let subTag=true; let subTag=true;
console.log("this.ids",this.ids);
this.ids.map((item) => { this.ids.map((item) => {
if(item.quantity==="" || item.quantity==undefined){ if(item.quantity==="" || item.quantity==undefined){
//selection 没有变化时,this.ids值还是上一次选择变化的值,将新的变化的值重新赋值
for(let i=0;i<this.materialList.length;i++){
if(item.id==this.materialList[i].id){
item.quantity = this.materialList[i].quantity;
}
}
let name=item.name; let name=item.name;
this.$message.error(''+name+"原料名称的原料数量不能为空!"); this.$message.error(''+name+"原料名称的原料数量不能为空!");
subTag=false; subTag=false;
......
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