fix:mlogbw提交

This commit is contained in:
shijing 2025-01-09 10:52:11 +08:00
parent 2dfc51b67d
commit f93eb0fe89
3 changed files with 298 additions and 33 deletions

View File

@ -1,3 +1,4 @@
<!-- 日志详情 mlog信息以及mlogb -->
<template>
<el-drawer
title="日志详情"
@ -8,7 +9,6 @@
>
<div>
<el-card style="width: 100%" header="基本信息" shadow="never">
<!-- <el-button type="primary" @click="handlePrint" style="position: absolute;right: 20px;">打印</el-button> -->
<el-descriptions>
<el-descriptions-item label="工艺路线">{{
mlogItem.routepack_name
@ -97,11 +97,11 @@
<el-table-column label="主要批次" prop="is_main_batchin">
<template #default="scope">
<el-tag :type="scope.row.parent==null ? 'success': 'info'">
{{scope.row.is_main_batchin==null ? '是' : '否'}}
{{scope.row.parent==null ? '是' : '否'}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="加工前不良" prop="count_pn_jgqbl">
<el-table-column label="加工前不良" prop="count_pn_jgqbl">
</el-table-column>
<el-table-column
label="创建时间"
@ -116,27 +116,29 @@
width="100px"
>
<template #default="scope">
<el-button
link
<el-link
:underline="false"
type="primary"
@click="table_in_edit(scope.row)"
v-if="mlogItem.submit_time== null&&mlogItem.material_in_&&mlogItem.material_in_.tracking==10"
>
编辑
</el-button>
<el-button
link type="primary"
</el-link>
<el-link
:underline="false"
type="primary"
v-if="mlogItem.submit_time == null&&mlogItem.material_in_&&mlogItem.material_in_.tracking==20"
@click="table_out_check_single(scope.row,'ins')"
>详情</el-button>
<el-button
link
>详情</el-link>
<el-link
:underline="false"
:disabled="mlogItem.submit_time !== null"
type="danger"
style="margin-left: 10px;"
@click="table_in_del(scope.row)"
>
删除
</el-button>
</el-link>
</template>
</el-table-column>
</scTable>
@ -160,7 +162,7 @@
/>
</el-form-item>
</el-col>
<el-col :span="23">
<el-col :span="23" v-if="base_code!=='bxerp'">
<el-form-item label="加工前不良" prop="count_pn_jgqbl">
<el-input-number
v-model="saveInForm.count_pn_jgqbl"
@ -170,6 +172,63 @@
/>
</el-form-item>
</el-col>
<!-- <sc-form-table
hideDelete
:tableHeight="300"
v-model="defectlist"
:addTemplate="addTemplate"
placeholder="暂无数据"
>
<el-table-column prop="number" label="不合格项">
<template #default="scope">
<el-select
v-model="scope.row.defect"
placeholder="不合格项"
clearable
style="width: 100%"
>
<el-option
v-for="item in defectOptions"
:key="item.defect"
:label="item.defect_name"
:value="item.defect"
>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="数量">
<template #default="scope">
<el-input-number
v-model="scope.row.count"
:min="0"
class="width-100"
controls-position="right"
>
</el-input-number>
</template>
</el-table-column>
<el-table-column prop="open" label="操作" width="60" align="center">
<template #default="scope">
<el-button
v-if="scope.row.id"
text
type="danger"
size="small"
@click="formTableDel(scope.row.id)"
>删除</el-button
>
<el-button
v-else
text
type="primary"
size="small"
@click="formTableSave(scope.row)"
>保存</el-button
>
</template>
</el-table-column>
</sc-form-table> -->
</el-row>
</el-form>
<template #footer>
@ -231,17 +290,19 @@
>
<template #default="scope">
<!-- 批次 -->
<el-button
link type="primary"
<el-link
:underline="false"
type="primary"
v-if="mlogItem.submit_time == null&&mlogItem.material_out_&&mlogItem.material_out_.tracking==10"
@click="table_out_check(scope.row)"
>详情</el-button>
>详情</el-link>
<!-- 单个 -->
<el-button
link type="primary"
<el-link
:underline="false"
type="primary"
v-if="mlogItem.submit_time == null&&mlogItem.material_out_&&mlogItem.material_out_.tracking==20"
@click="table_out_check_single(scope.row,'outs')"
>详情</el-button>
>详情</el-link>
</template>
</el-table-column>
</scTable>
@ -265,7 +326,7 @@
</el-table-column>
<el-table-column width="100">
<template #default="scope">
<el-button @click="printMaterial(scope.row)" type="text">物料标签</el-button>
<el-link :underline="false" @click="printMaterial(scope.row)" type="primary">物料标签</el-link>
</template>
</el-table-column>
</scTable>
@ -296,6 +357,8 @@
:mlogb="mlogb"
:wm = "wm"
:qct="qct"
:handle_user="handle_user"
:handle_date="handle_date"
@success="handlesCheckSuccess"
@closed="dialog.check_single = false"
>
@ -338,6 +401,7 @@ export default {
emits: ["success", "closed"],
data() {
return {
base_code: this.$TOOL.data.get('BASE_INFO').base.base_code,
loading: false,
//
form: {},
@ -383,6 +447,7 @@ export default {
options: [],
tableData:[],
tableData2:[],
defectOptions:[],
isSingle:true,
saveInDialog: false,
printVisible:false,
@ -396,11 +461,20 @@ export default {
},
],
},
handle_date:'',
handle_user:'',
wm:'',
materialOut:'',
batchContains:'',
apiObjPrint:this.$API.cm.labelmat.fromWm,
printer_name:localStorage.getItem("printer_name")
printer_name:localStorage.getItem("printer_name"),
addTemplate:{
defect: "",
count: 1,
mlogb: "",
isEdit: true,
},
defectlist:[],
};
},
mounted() {
@ -471,7 +545,25 @@ export default {
table_in_edit(row) {
this.saveInForm = row;
this.saveInDialog = true;
// this.getdefects(row.qct);
},
// getdefects(qct){
// let that = this;
// that.$API.qm.qct.item.req(qct).then((res) => {
// that.defectOptions = [];
// that.defectOptions = res.qct_defects;
// })
// },
// formTableSave(row){
// let that = this;
// let obj = new Object();
// obj.count = row.count;
// obj.defect = row.defect;
// obj.mlogb = that.saveInForm.id;
// that.$API.wpm.mlogbdefect.create.req(obj).then((res) => {
// })
// },
//
saveInSubmit() {
let that = this;
@ -518,13 +610,12 @@ export default {
});
},
table_out_check_single(row,type){
this.dialog.check_single = true;
this.mlogb = row.id;
this.wm = row.wm_in;
this.qct = row.qct;
let obj = {};
Object.assign(obj, row);
obj.mgroup_name = this.mlogItem.mgroup_name;
this.handle_date=this.mlogItem.handle_date;
this.handle_user = this.mlogItem.handle_user;
this.dialog.check_single = true;
this.$nextTick(() => {
this.$refs.checkDialogSingle.open(type);
});

View File

@ -1,3 +1,4 @@
<!-- 新增mlogbIn -->
<template>
<el-dialog
title="添加日志详情"
@ -184,6 +185,7 @@ export default {
return item.batch == wm_in;
});
if (arr.length > 0) {
that.form.batch = wm_in;
that.form.wm_in = arr[0].id;
that.form.count_use = arr[0].count;
if(that.tracking==10){}else{
@ -202,9 +204,10 @@ export default {
that.$message.success("添加成功");
that.$emit("success");
that.wm_in = '';
that.mtask = '';
that.batch = '';
that.parent = '';
that.form.mtask = '';
that.form.batch = '';
that.form.parent = '';
that.form.count_use = 0;
}).catch((err) => {});
},
//

View File

@ -35,13 +35,83 @@
</el-select>
</template>
</el-table-column>
<el-table-column prop="note" :label="item.testitem_name" v-for="item in qct_testitems" :key="item.id">
<template #default="scope">
<el-input-number
v-if="item.testitem_field_type=='input-number'"
v-model="scope.row[item.testitem_name]"
:min="0"
class="width-100"
controls-position="right"
@change="defectCountSun(scope.row)"
>
</el-input-number>
<el-input-number
v-if="item.testitem_field_type=='input-int'"
v-model="scope.row[item.testitem_name]"
:min="0"
class="width-100"
controls-position="right"
@change="defectCountSun(scope.row)"
>
</el-input-number>
<el-input
v-if="item.testitem_field_type=='input-text'"
v-model="scope.row[item.testitem_name]"
class="width-100"
@change="defectCountSun(scope.row)"
>
</el-input>
<el-select
v-if="item.testitem_field_type=='select-text'"
v-model="scope.row[item.testitem_name]"
clearable
class="width-100"
@change="defectCountSun(scope.row)"
>
<el-option
v-for="item0 in item.testitem_choices"
:key="item0"
:label="item0"
:value="item0"
>
</el-option>
</el-select>
<el-select
v-if="item.testitem_field_type=='selects-text'"
v-model="scope.row[item.testitem_name]"
clearable
multiple
class="width-100"
@change="defectCountSun(scope.row)"
>
<el-option
v-for="item1 in item.testitem_choices"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="note" :label="item.defect_name" v-for="item in qct_defects" :key="item.id">
<template #default="scope">
<el-switch
:disabled="!scope.row.isEdit"
v-model="scope.row[item.defect_name]"
style="--el-switch-on-color: red"
@change="switchChange(scope.row, item)"
></el-switch>
</template>
</el-table-column>
<el-table-column prop="note" label="备注">
<template #default="scope">
<span v-if="!scope.row.isEdit">{{ scope.row.note }}</span>
<el-input v-else v-model="scope.row.note" placeholder="备注"></el-input>
</template>
</el-table-column>
<el-table-column prop="open" label="操作" width="125" align="center">
<el-table-column prop="open" label="操作" width="60" align="center">
<template #default="scope">
<el-button
v-if="scope.row.isEdit"
@ -67,7 +137,6 @@
@click="formTableDel(scope.row.id)"
>删除</el-button
>
</template>
</el-table-column>
</sc-form-table>
@ -85,6 +154,18 @@ export default {
type: String,
default: "",
},
qct: {
type: String,
default: "",
},
handle_user:{
type: String,
default: "",
},
handle_date:{
type: String,
default: "",
},
},
emits: ["success", "closed"],
data() {
@ -101,6 +182,8 @@ export default {
params: {mlogb:'',page:0},
visible: false,
options:[],
qct_defects:[],
qct_testitems:[],
mlogbwlist:[],
addTemplate:{
mlogb: "",
@ -117,6 +200,7 @@ export default {
that.params.mlogb = that.addTemplate.mlogb = that.mlogb;
that.getList();
that.getOptions();
that.getdefects();
},
methods: {
open(mode = "ins") {
@ -124,6 +208,28 @@ export default {
console.log(this.mode);
this.visible = true;
},
getdefects(){
let that = this;
that.$API.qm.qct.item.req(that.qct).then((res) => {
that.qct_defects = [];
res.qct_defects.forEach((item) => {
that.addTemplate[item.defect_name] = false;
})
that.qct_defects = res.qct_defects;
that.qct_testitems = [];
res.qct_testitems.forEach((item2) => {
that.addTemplate[item2.testitem_name] = '';
let obj2 = Object.assign({}, item2);
obj2.value = '';
if(obj2.testitem_field_type=='select-text'||obj2.testitem_field_type=='selects-text'){
let str = obj2.testitem_choices.replace(/'/g, '"');
let arr = JSON.parse(str);
obj2.testitem_choices = arr;
}
that.qct_testitems.push(obj2);
})
})
},
getOptions(){
let that = this;
that.$API.wpm.wpr.req({wm:that.wm,page:0}).then((res) => {
@ -148,6 +254,16 @@ export default {
res.forEach((item) => {
let obj = Object.assign({},item);
obj.isEdit = false;
if(item.ftest.ftestdefects.length>0){
item.ftest.ftestdefects.forEach((item1) => {
obj[item1.defect_name] = item1.has;
})
}
if(item.ftest.ftestitems.length>0){
item.ftest.ftestitems.forEach((item2) => {
obj[item2.testitem_name] = item2.test_val_json;
})
}
that.mlogbwlist.push(obj);
})
}
@ -156,8 +272,37 @@ export default {
//
formTableSave(row) {
let that = this;
let obj = {};
obj.number = row.number;
obj.mlogb = row.mlogb;
obj.note = row.note;
obj.ftest = {};
obj.ftest.test_date = that.handle_date;
obj.ftest.test_user = that.handle_user;
obj.ftest.qct = that.qct;
obj.ftest.ftestitems = [];
obj.ftest.ftestdefects = [];
if(row.id!=''&&row.id!==undefined&&row.id!==null){
obj.id = row.id;
}
that.qct_defects.forEach((item) => {
let itemObj = {};
itemObj.defect = item.defect;
itemObj.test_user = that.handle_user;
itemObj.has = row[item.defect_name]?row[item.defect_name]:false;
obj.ftest.ftestdefects.push(itemObj);
})
that.qct_testitems.forEach((item1) => {
let itemObj1 = {};
itemObj1.testitem = item1.testitem;
itemObj1.test_user = that.handle_user;
itemObj1.test_val_json = row[item1.testitem_name];
obj.ftest.ftestitems.push(itemObj1);
})
console.log('row',row);
console.log('obj',obj);
if(row.id!==''&&row.id!==undefined&&row.id!==null){
that.$API.wpm.mlogbw.update.req(row.id,row).then((res) => {
that.$API.wpm.mlogbw.update.req(row.id,obj).then((res) => {
that.$message.success("保存成功");
that.getList();
return res;
@ -165,7 +310,7 @@ export default {
return err;
});
}else{
that.$API.wpm.mlogbw.create.req(row).then((res) => {
that.$API.wpm.mlogbw.create.req(obj).then((res) => {
that.$message.success("添加成功");
that.getList();
return res;
@ -196,6 +341,18 @@ export default {
});
}).catch(() => {});
},
switchChange(row,item){
let that = this;
let obj = {};
obj = Object.assign({},item);
// that.$API.wpm.mlogbw.update.req(row.id,obj).then((res) => {
// })
},
//
mlogbwSubmit() {
let that = this;
},
//
mlogbSubmit() {
let that = this;
@ -205,6 +362,16 @@ export default {
that.$message.success("操作成功");
});
},
defectCountSun(row){
let that = this;
let index = that.mlogbwlist.indexOf(row);
that.qct_defects.forEach(item => {
let str = item.rule_expression.replace(/`/g, '');
str = str.replace(/\${(.*?)}/g, 'row.\$1')
let judge = eval(str);
that.mlogbwlist[index][item.defect_name] = judge;
});
},
//
setFilters(filters) {
this.selectionFilters = filters;
@ -241,4 +408,8 @@ export default {
};
</script>
<style></style>
<style scoped>
.width-100{
width: 100%;
}
</style>