fix:mlog中添加操作项

This commit is contained in:
shijing 2025-01-17 09:20:19 +08:00
parent 29c5eeb514
commit 3de4874cf4
2 changed files with 92 additions and 9 deletions

View File

@ -119,6 +119,61 @@
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-for="item in testitems" :key="item.id">
<el-form-item :label="item.name">
<el-input-number
v-if="item.field_type=='input-number'"
v-model="item.value"
:min="0"
class="width-100"
controls-position="right"
>
</el-input-number>
<el-input-number
v-if="item.field_type=='input-int'"
v-model="item.value"
:min="0"
class="width-100"
controls-position="right"
>
</el-input-number>
<el-input
v-if="item.field_type=='input-text'"
v-model="item.value"
class="width-100"
>
</el-input>
<el-select
v-if="item.field_type=='select-text'"
v-model="item.value"
clearable
class="width-100"
>
<el-option
v-for="item0 in item.choices"
:key="item0"
:label="item0"
:value="item0"
>
</el-option>
</el-select>
<el-select
v-if="item.field_type=='selects-text'"
v-model="item.value"
clearable
multiple
class="width-100"
>
<el-option
v-for="item1 in item.choices"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="开始时间"
@ -188,6 +243,7 @@ const defaultForm = {
note:'',
mgroup:'',
mtask:'',
oinfo_json:{},
};
export default {
@ -267,6 +323,7 @@ export default {
visible: false,
isSaveing: false,
options: [],
testitems:[],
routeOptions: [],
userOptions: [],
mtaskOptions:[],
@ -280,12 +337,23 @@ export default {
this.getSupplier();
this.getEquipment();
this.getMtask();
this.gettestitem();
},
methods: {
disabledDateFn(time) {
return time.getTime() > new Date().getTime();
},
gettestitem(){
let that = this;
that.$API.qm.testitem.list.req({ process: that.process,type:20 }).then((res) => {
res.results.forEach((item) => {
let obj = {};
Object.assign(obj, item);
obj.value = '';
that.testitems.push(obj);
})
});
},
//
getUser() {
this.$API.system.user.list.req({ depts: this.dept }).then((res) => {
@ -337,12 +405,26 @@ export default {
},
//
setData(data) {
let that = this;
console.log("data", data);
Object.assign(this.form, data);
if(data.test_file!==null){
this.form.test_file = data.test_file;
this.fileList = [{name:data.test_file,url:data.test_file}];
}
if(data.oinfo_json!==null){
if(that.testitems.length>0){
that.testitems.forEach((item) => {
item.value = data.oinfo_json[item.id];
});
}else{
setTimeout(() => {
that.testitems.forEach((item) => {
item.value = data.oinfo_json[item.id];
});
},500)
}
}
this.getRoute(data.id);
},
changeMtask(){
@ -365,6 +447,11 @@ export default {
if (valid) {
that.isSaveing = true;
that.form.mgroup = that.mgroup;
let oinfo_json = {};
that.testitems.forEach((item) => {
oinfo_json[item.id] = item.value;
})
that.form.oinfo_json = oinfo_json;
if (that.mode === "add") {
that.$API.wpm.mlog.init.req(that.form).then((res) => {
that.isSaveing = false;

View File

@ -146,7 +146,7 @@
:process="processId"
:mgroup="mgroupId"
:dept="deptId"
:mgroup_name = "mgroup_name"
:mgroupName = "mgroupName"
@success="handleSaveSuccess"
@closed="dialog.save = false"
>
@ -155,6 +155,7 @@
v-if="dialog.detail"
ref="detailDialog"
:mlogId="mlogId"
:process="processId"
:mtask="mtask"
@closed="detailClose"
>
@ -197,7 +198,6 @@ export default {
deptId: null,
processId: "",
processCate: "",
mgroup_name:''
};
},
watch: {
@ -206,8 +206,7 @@ export default {
let that = this;
that.params.mgroup = "";
that.apiObj = null;
that.mgroup_name = newval;
// that.getMgroupInfo();
that.getMgroupInfo();
},
},
},
@ -215,9 +214,7 @@ export default {
let that = this;
that.params.mgroup =that.mgroupId;
that.apiObj = that.$API.wpm.mlog.list;
// this.mgroup_name = this.mgroupName;
// this.getMgroupInfo();
// console.log("mgroupName",this.mgroupName);
this.getMgroupInfo();
},
methods: {
getMgroupInfo(){
@ -227,7 +224,6 @@ export default {
that.$message.error("获取工段错误");
return;
}
that.mgroupId = res.id;
that.deptId = res.belong_dept;
that.processId = res.process;
that.processCate = res.process_cate;