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