fix:coding交接变动

This commit is contained in:
shijing 2024-11-21 13:27:54 +08:00
parent 4d8bf81be3
commit 0752000f24
1 changed files with 167 additions and 46 deletions

View File

@ -113,6 +113,11 @@
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="处理备注">
<el-input v-model="form.note" placeholder="处理备注"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-form-item label="交接物料">
@ -121,7 +126,58 @@
<!-- <el-button type="primary" @click="scanCode" v-if="mode!=='show'">扫码添加</el-button> -->
</el-form-item>
</el-row>
<el-col v-if="addShow">
<el-form-item label="">
<xtSelect
:apiObj="listApiObj"
:params = "listParams"
v-model="optionNames"
v-model:obj="optionItems"
style="width: 100%"
:multiple="true"
>
<el-table-column label="id" prop="id"></el-table-column>
<el-table-column label="批次" prop="batch"></el-table-column>
<el-table-column label="数量" prop="count_cando"></el-table-column>
</xtSelect>
</el-form-item>
</el-col>
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
<el-col :span="10">
<el-form-item label="交接物料">
<el-input v-model="listItem.batch" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="总数量">
<span>{{ listItem.count_cando }}</span>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="交接数量">
<el-input-number
v-model="listItem.count"
controls-position="right"
:min="0"
step="1"
:max="listItem.count_cando"
:disabled="mode==='show'"
:step-strictly="true"
style="width: 100%"
placeholder="交接数量"
@change="countChange"
>
</el-input-number>
</el-form-item>
</el-col>
<el-col :span="2" v-if="mode!=='show'">
<el-button type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button>
</el-col>
</el-row>
<el-row>
<div class="total-count">总计{{ totalCount }}</div>
</el-row>
<!-- <el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
<el-col :span="10">
<el-form-item label="交接物料">
<el-select
@ -175,7 +231,7 @@
<el-col :span="2" v-if="mode!=='show'">
<el-button type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button>
</el-col>
</el-row>
</el-row> -->
</el-form>
<el-footer v-if="mode!=='show'">
<el-button type="primary" v-loading="isSaveing" @click="submit">确定</el-button>
@ -273,18 +329,50 @@ export default {
},
],
},
listParams:{
},
totalCount: 0,
optionNames:[""],
optionItems:[],
deptID:'',
userList: [],
userList2: [],
deptOptions:[],
mgroupOptions: [],
materialOptions: [],
addShow: false,
visible: false,
scanVisible:false,
isSaveing: false,
setFiltersVisible: false,
listApiObj:this.$API.wpm.wmaterial.list,
};
},
watch: {
optionItems: {
handler: function (val) {
let that = this;
that.optionNames = [];
that.form.handoverb = [];
let totalCount = 0;
val.forEach(item=>{
let obj = new Object();
obj.wm = item.id;
obj.batch = item.batch;
obj.name = item.material_name;
obj.count_cando = item.count_cando;
obj.count = item.count_cando;
obj.notok_sign = item.notok_sign;
that.form.handoverb.push(obj);
that.optionNames.push(item.id)
totalCount += item.count_cando;
})
that.totalCount = totalCount;
},
deep: true,
},
},
mounted() {
let that = this;
that.form.type = that.type;
@ -347,51 +435,53 @@ export default {
count_xtest__isnull:1
};
if(that.mgroupName=="size"){
that.$API.system.dept.list.req({name__contains:'尺寸',page:0}).then((res) => {
if(res.length>0){
req.belong_dept=res[0].id;
this.$API.wpm.wmaterial.list.req(req).then((res) => {
let arr = [];
res.forEach(item=>{
let obj = {};
Object.assign(obj,item);
obj.label = item.batch;
arr.push(obj);
})
that.materialOptions = arr;
});
}
})
}else if(that.mgroupName=="facade"){
that.$API.system.dept.list.req({name__contains:'外观',page:0}).then((res) => {
if(res.length>0){
req.belong_dept=res[0].id;
this.$API.wpm.wmaterial.list.req(req).then((res) => {
let arr = [];
res.forEach(item=>{
let obj = {};
Object.assign(obj,item);
obj.label = item.batch;
arr.push(obj);
})
that.materialOptions = arr;
});
}
})
}else{
req.mgroupx = that.mgroupId;
this.$API.wpm.wmaterial.list.req(req).then((res) => {
let arr = [];
res.forEach(item=>{
let obj = {};
Object.assign(obj,item);
obj.label = item.batch;
arr.push(obj);
that.$API.system.dept.list.req({name__contains:'尺寸',page:0}).then((res) => {
if(res.length>0){
req.belong_dept=res[0].id;
that.listParams = req;
this.$API.wpm.wmaterial.list.req(req).then((res) => {
let arr = [];
res.forEach(item=>{
let obj = {};
Object.assign(obj,item);
obj.label = item.batch;
arr.push(obj);
})
that.materialOptions = arr;
});
}
})
that.materialOptions = arr;
});
}
}else if(that.mgroupName=="facade"){
that.$API.system.dept.list.req({name__contains:'外观',page:0}).then((res) => {
if(res.length>0){
req.belong_dept=res[0].id;
that.listParams = req;
this.$API.wpm.wmaterial.list.req(req).then((res) => {
let arr = [];
res.forEach(item=>{
let obj = {};
Object.assign(obj,item);
obj.label = item.batch;
arr.push(obj);
})
that.materialOptions = arr;
});
}
})
}else{
req.mgroupx = that.mgroupId;
that.listParams = req;
this.$API.wpm.wmaterial.list.req(req).then((res) => {
let arr = [];
res.forEach(item=>{
let obj = {};
Object.assign(obj,item);
obj.label = item.batch;
arr.push(obj);
})
that.materialOptions = arr;
});
}
},
//
getMaterialNotok() {
@ -402,6 +492,7 @@ export default {
notok_sign__isnull : 0,
count_xtest__isnull:1
};
that.listParams = req;
this.$API.wpm.wmaterial.list.req(req).then((res) => {
let arr = [];
res.forEach(item=>{
@ -451,10 +542,12 @@ export default {
});
},
addMaterial(){
this.form.handoverb.push({wm:'',count:'',counts:null});
this.addShow = true;
// this.form.handoverb.push({wm:'',count:'',counts:null});
},
delMaterial(index){
this.form.handoverb.splice(index,1);
this.countChange();
},
//
open(mode = "add") {
@ -471,6 +564,28 @@ export default {
this.form.handoverb[index].counts = data[0].count;
this.form.handoverb[index].count = data[0].count;
},
countChange(){
let that = this;
let totalCount = 0;
if(this.form.handoverb.length>0){
this.form.handoverb.forEach(item=>{
totalCount += item.count;
})
that.totalCount = totalCount;
}
},
//
init() {
this.form = {
handoverb: [],
handovera: [],
handoverc: [],
handoverd: [],
}
this.form.handoverb.forEach(item=>{
})
},
//
submit() {
let that = this;
@ -577,4 +692,10 @@ export default {
margin-bottom: 10px;
font-weight: 600;
}
.total-count{
width: 100%;
text-align: right;
height: 50px;
line-height: 50px;
}
</style>