Commit 8073d4b1 by lixiaomin

修改规格

parent fb33385c
......@@ -15,7 +15,7 @@
<el-table-column label="原料数量" align="center">
<template slot-scope="scope">
<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">
<span> {{scope.row.unit}}</span>
</div>
......@@ -127,7 +127,8 @@ export default {
});
},
openModal() {
this.getList();
//this.getList();
this.handleQuery();
this.open = true;
},
// 取消按钮
......@@ -139,31 +140,53 @@ export default {
handleQuery() {
this.queryParams.pageNum = 1;
listMaterial(this.queryParams).then((response) => {
this.materialList = response.rows;
this.total = response.total;
this.loading = false;
for(let j=0;j<response.rows.length;j++){
let row = response.rows[j];
row.quantity="";
if(this.ids.length>0){
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].id==this.materialList[j].id){
this.materialList[j].quantity=this.ids[i].quantity
if(this.ids[i].id==row.id){
row.quantity=this.ids[i].quantity
}
}
}
}
}
this.materialList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 多选框选中数据
handleSelectionChange(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() {
let subTag=true;
console.log("this.ids",this.ids);
this.ids.map((item) => {
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;
this.$message.error(''+name+"原料名称的原料数量不能为空!");
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