6车间日志编辑

This commit is contained in:
shijing 2023-10-25 12:35:32 +08:00
parent d15cc32e7d
commit fbc7806a73
1 changed files with 41 additions and 21 deletions

View File

@ -26,7 +26,7 @@
<sc-form-table ref="table" v-model="formList" :addTemplate="addTemplate" drag-sort placeholder="暂无数据">
<el-table-column prop="type" label="工序" min-width="100">
<template #default="scope">
<span v-if="!scope.row.change">{{ scope.row.batchName }}</span>
<span v-if="!scope.row.change">{{ scope.row.mgroup_name }}</span>
<el-select v-else v-model="scope.row.batch" placeholder="请选择">
<el-option v-for="item in options" :key="item" :label="item" :value="item"></el-option>
</el-select>
@ -100,10 +100,11 @@
edit: "编辑记录",
show: "查看记录",
},
obj:{},
form:{batch:''},
addTemplate: {
batch: '',
batchName: '',
mgroup_name: '',
count_use:1,
count_ok: 1,
count_notok: 1,
@ -116,8 +117,10 @@
change:true
},
handleDate:'',
related:[],
userList:[],
formList: [],
recordId:'',
visible: false,
isSaveing: false,
setFiltersVisible: false,
@ -144,28 +147,27 @@
getUserList(){
let that = this;
this.$API.system.user.list.req({belong_dept:'3423857962907983872',page:0}).then(res=>{
debugger;
that.userList = res;
console.log(res)
});
},
getFormList(){
this.$API.pm.mtask.related.req(this.mtask).then(res=>{
this.related = res;
res.forEach(item=>{
let obj = {
mtask:item.id,
batch: item.mgroup,
batchName: item.mgroup_name,
count_use:1,
count_ok: 1,
count_notok: 1,
count_notok1: 1,
count_notok2: 1,
count_notok3: 1,
handle_user:'',
change:false
}
this.formList.push(obj)
let obj = {
mtask:item.id,
batch: '',
mgroup_name: item.mgroup_name,
count_use:1,
count_ok: 1,
count_notok: 1,
count_notok1: 1,
count_notok2: 1,
count_notok3: 1,
handle_user:'',
change:false
}
this.formList.push(obj)
})
})
},
@ -180,7 +182,7 @@
pushRow(){
let obj = {
batch: '',
batchName:"",
mgroup_name:"",
count_use:1,
count_ok: 1,
count_notok: 1,
@ -223,7 +225,7 @@
if (this.mode == "add") {
res = await this.$API.wpm.mlog.create.req(this.formList);
} else if (this.mode == "edit") {
res = await this.$API.wpm.mlog.update.req(this.formList.id,this.formList);
res = await this.$API.wpm.mlog.update.req(this.recordId,this.formList);
}
this.isSaveing = false;
this.visible = false;
@ -238,7 +240,25 @@
},
//
setData(data) {
Object.assign(this.form, data);
console.log('data:',data)
this.form.batch = data.batch;
this.recordId = data.id;
let obj = {};
obj.batch = data.batch;
obj.handle_date = data.handle_date;
obj.mtask__mgroup__belong_dept__name = '6车间';
this.$API.wpm.mlog.list.req(obj).then(res=>{
let data = res.results;
for(let i=0;i<this.formList.length;i++){
data.forEach(item=>{
if(item.mgroup_name==this.formList[i].mgroup_name){
Object.assign(this.formList[i],item)
}
})
}
console.log('formList:',this.formList)
console.log('data:',data)
})
},
//
setFilters(filters) {