fix:交接记录显示问题&检验时物料批次的排序

This commit is contained in:
shijing 2024-09-19 15:46:44 +08:00
parent 45497e82a1
commit ffcbe833cf
2 changed files with 40 additions and 9 deletions

View File

@ -558,22 +558,49 @@ export default {
} }
this.form.count_ok = this.form.count - this.form.count_notok; this.form.count_ok = this.form.count - this.form.count_notok;
}, },
compare(name){
return function(a,b){
let value1 = a[name];
let value2 = b[name];
return value2 - value1
}
},
// //
getMaterialBatch() { getMaterialBatch() {
let that = this; let that = this;
let obj = {page: 0, count__gte: 0, count_xtest__gte: 0}; let obj = {page: 0, count__gte: 0, count_xtest__gte: 0};
if(that.mode == "sizeAdd"||that.mode == "sizeEdit"||that.mode == "sizeShow"){ if(that.mode == "sizeAdd"||that.mode == "sizeEdit"||that.mode == "sizeShow"){
console.log('sizeAdd') console.log('sizeAdd')
obj.material__process__name = '一次超洗' that.$API.system.dept.list.req({name__contains:'尺寸',page:0}).then((res) => {
if(res.length>0){
obj.belong_dept=res[0].id;
that.getMaterials(obj);
}
})
// obj.material__process__name = ''
}else { }else {
console.log('facadeAdd') console.log('facadeAdd')
obj.material__process__name = '二次超洗' // obj.material__process__name = ''
that.$API.system.dept.list.req({name__contains:'外观',page:0}).then((res) => {
if(res.length>0){
obj.belong_dept=res[0].id;
that.getMaterials(obj);
}
})
} }
that.$API.wpm.wmaterial.list // that.$API.wpm.wmaterial.list.req(obj).then((res) => {
.req(obj) // res.sort(that.compare("count"));
.then((res) => { // console.log('res',res)
that.options = res; // that.options = res;
}); // });
},
getMaterials(obj){
let that = this;
that.$API.wpm.wmaterial.list.req(obj).then((res) => {
res.sort(that.compare("count"));
console.log('res',res)
that.options = res;
});
}, },
handleChange(val) { handleChange(val) {
let that = this; let that = this;

View File

@ -116,13 +116,14 @@
</el-row> </el-row>
<el-row> <el-row>
<el-form-item label="交接物料"> <el-form-item label="交接物料">
<el-button type="primary" icon="el-icon-plus" @click="addMaterial"></el-button> <el-button type="primary" icon="el-icon-plus" @click="addMaterial" v-if="mode!=='show'"></el-button>
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem"> <el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
<el-col :span="11"> <el-col :span="11">
<el-form-item label="交接物料"> <el-form-item label="交接物料">
<el-select <el-select
v-if="mode!=='show'"
v-model="listItem.wm" v-model="listItem.wm"
placeholder="交接物料" placeholder="交接物料"
filterable filterable
@ -144,6 +145,7 @@
</div> </div>
</el-option> </el-option>
</el-select> </el-select>
<el-input v-else v-model="listItem.batch" disabled></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="11"> <el-col :span="11">
@ -153,6 +155,7 @@
controls-position="right" controls-position="right"
:min="0" :min="0"
step="1" step="1"
:disabled="mode==='show'"
:step-strictly="true" :step-strictly="true"
style="width: 100%" style="width: 100%"
placeholder="交接数量" placeholder="交接数量"
@ -160,7 +163,7 @@
</el-input-number> </el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2" v-if="mode!=='show'">
<el-button type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button> <el-button type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button>
</el-col> </el-col>
</el-row> </el-row>
@ -483,6 +486,7 @@ export default {
// //
setData(data) { setData(data) {
Object.assign(this.form, data); Object.assign(this.form, data);
console.log('this.form',this.form);
if(data.type==30){ if(data.type==30){
this.getUserList3(); this.getUserList3();
}else{ }else{