fix:玻纤快速报工
This commit is contained in:
parent
44672d2778
commit
6b9962a8ee
|
|
@ -311,8 +311,8 @@
|
|||
>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 输出物料 -->
|
||||
<el-card style="width: 100%;margin-bottom:1vh" header="输出物料" shadow="never">
|
||||
<!-- 输出物料 输出物料追踪类型为批次-->
|
||||
<el-card v-if="mlogItem.material_out_&&mlogItem.material_out_.tracking==10" style="width: 100%;margin-bottom:1vh" header="输出物料" shadow="never">
|
||||
<scTable
|
||||
ref="tableOut"
|
||||
:apiObj="apiObj"
|
||||
|
|
@ -365,30 +365,142 @@
|
|||
</el-table-column>
|
||||
</scTable>
|
||||
</el-card>
|
||||
<!-- 工段物料库存 -->
|
||||
<!-- <el-card style="width: 100%" header="工段物料列表" shadow="never">
|
||||
<scTable
|
||||
ref="tableWm"
|
||||
:apiObj="apiObjWm"
|
||||
:params="paramsWm"
|
||||
stripe
|
||||
hidePagination
|
||||
<!-- 输出物料 输出物料追踪类型为单个-->
|
||||
<el-card v-else style="width: 100%;margin-bottom:1vh" header="输出物料" shadow="never">
|
||||
<check-table
|
||||
v-if="checkTableShow"
|
||||
:mlogId="mlogId"
|
||||
:qct="mlogItem.qct"
|
||||
:wm = "wm"
|
||||
:dept="deptId"
|
||||
:mgroup="mgroup"
|
||||
:material_in="mlogItem.material_in"
|
||||
:material_out="mlogItem.material_out"
|
||||
:mgroupName= "mlogItem.mgroup_name"
|
||||
:isSubmit="isSubmit"
|
||||
:batchNumber="batchNumber"
|
||||
:handle_user="handle_user"
|
||||
:handle_date="handle_date"
|
||||
:processType="processType"
|
||||
style="width: 100%;height: 500px;"
|
||||
></check-table>
|
||||
<!-- <sc-form-table
|
||||
hideDelete
|
||||
id="mlogbwlist"
|
||||
v-model="mlogbwlist"
|
||||
:addTemplate="addTemplate"
|
||||
placeholder="暂无数据"
|
||||
:hideAdd="hideAdd"
|
||||
>
|
||||
<el-table-column label="物料名称" prop="material_name" show-overflow-tooltip>
|
||||
<el-table-column prop="mlogb__batch" label="物料批次" fixed min-width="80px">
|
||||
</el-table-column>
|
||||
<el-table-column label="批次号" prop="batch">
|
||||
<el-table-column prop="number" label="物料编号" fixed min-width="80px">
|
||||
</el-table-column>
|
||||
<el-table-column label="数量" prop="count">
|
||||
</el-table-column>
|
||||
<el-table-column label="不合格标记" prop="notok_sign_name">
|
||||
</el-table-column>
|
||||
<el-table-column width="100">
|
||||
<template #default="scope">
|
||||
<el-button :underline="false" @click="printMaterial(scope.row)" type="primary">物料标签</el-button>
|
||||
<el-table-column prop="note" :label="item.testitem_name" v-for="item in qct_testitems" :key="item.id" width="150px">
|
||||
<template #default="scope">
|
||||
<span v-if="!scope.row.isEdit">{{ scope.row[item.testitem_name] }}</span>
|
||||
<el-input-number
|
||||
v-if="item.testitem_field_type=='input-number'&&scope.row.isEdit"
|
||||
v-model="scope.row[item.testitem_name]"
|
||||
class="width-100"
|
||||
controls-position="right"
|
||||
@change="defectCountSun(scope.row)"
|
||||
></el-input-number>
|
||||
<el-input-number
|
||||
v-if="item.testitem_field_type=='input-int'&&scope.row.isEdit"
|
||||
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'&&scope.row.isEdit"
|
||||
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'&&scope.row.isEdit"
|
||||
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'&&scope.row.isEdit"
|
||||
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>
|
||||
</scTable>
|
||||
</el-card> -->
|
||||
<el-table-column prop="note" :label="item.defect_name" v-for="item in qct_defects" :key="item.id" width="120px">
|
||||
<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="备注" width="80px">
|
||||
<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 label="操作" width="160" align="center" fixed="right" v-if="!isSubmit">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-if="scope.row.isEdit"
|
||||
type="success"
|
||||
@click="formTableSave(scope.row)"
|
||||
>保存</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.isEdit&&scope.row.id"
|
||||
type="danger"
|
||||
style="margin-left: 5px;"
|
||||
@click="formTableCancel(scope.row)"
|
||||
>取消</el-button>
|
||||
<el-button
|
||||
v-if="!scope.row.isEdit"
|
||||
type="primary"
|
||||
@click="formTableEdit(scope.row)"
|
||||
>编辑</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.isEdit&&!scope.row.id"
|
||||
type="danger"
|
||||
style="margin-left: 5px;"
|
||||
@click="formTableDelet(scope.row)"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
v-if="!scope.row.isEdit"
|
||||
type="danger"
|
||||
style="margin-left: 5px;"
|
||||
@click="formTableDel(scope.row.id)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</sc-form-table> -->
|
||||
</el-card>
|
||||
<save-dialog
|
||||
v-if="dialog.save"
|
||||
ref="saveDialog"
|
||||
|
|
@ -457,6 +569,7 @@ import editDialog from "./mlog_form.vue";
|
|||
import saveDialog from "./mlogb_form.vue";
|
||||
import checkDialog from "./mlogb_check.vue";
|
||||
import scheckDialog from "./mlogbw_check.vue";
|
||||
import checkTable from "./mlogbw_check_table.vue";
|
||||
import print from "./../setting/print/A4.vue";
|
||||
export default {
|
||||
props: {
|
||||
|
|
@ -482,6 +595,7 @@ export default {
|
|||
}
|
||||
},
|
||||
components: {
|
||||
checkTable,
|
||||
editDialog,
|
||||
saveDialog,
|
||||
checkDialog,
|
||||
|
|
@ -527,21 +641,27 @@ export default {
|
|||
count_pn_jgqbl: 0,
|
||||
},
|
||||
fileList:[],
|
||||
tableDataWm:[],
|
||||
oinfo_json:[],
|
||||
processOptions:[],
|
||||
test_file:'',
|
||||
deptId: "",
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
options: [],
|
||||
tableData:[],
|
||||
tableData2:[],
|
||||
oinfo_json:[],
|
||||
mlogbwlist:[],
|
||||
shiftOtions:[],
|
||||
tableDataWm:[],
|
||||
qct_defects:[],
|
||||
defectOptions:[],
|
||||
qct_testitems:[],
|
||||
processOptions:[],
|
||||
test_file:'',
|
||||
deptId: "",
|
||||
isSingle:true,
|
||||
saveInDialog: false,
|
||||
hideAdd: true,
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
canMultiple:false,
|
||||
printVisible:false,
|
||||
saveInDialog: false,
|
||||
checkTableShow:false,
|
||||
saveMuserDialog:false,
|
||||
setFiltersVisible: false,
|
||||
rules: {
|
||||
|
|
@ -595,6 +715,11 @@ export default {
|
|||
let that = this;
|
||||
that.$API.wpm.mlog.item.req(that.mlogId).then((res) => {
|
||||
that.mlogItem = res;
|
||||
that.checkTableShow = true;
|
||||
if(that.processType=='10'&&that.mlogItem.material_out_&&that.mlogItem.material_out_.tracking==20){
|
||||
that.getMlogbw();
|
||||
that.getdefects(that.mlogItem.qct);
|
||||
}
|
||||
if(res.route!==null){
|
||||
that.hasRoute = true;
|
||||
}
|
||||
|
|
@ -613,9 +738,6 @@ export default {
|
|||
that.fileList = [{name:res.test_file,url:res.test_file}];
|
||||
that.form.test_file = res.test_file;
|
||||
}
|
||||
// that.mgroup = res.mgroup;
|
||||
// that.paramsWm.mgroup = res.mgroup;
|
||||
// that.paramsWm.search = that.batchContains;
|
||||
that.materialIn = res.material_in;
|
||||
that.deptId = res.belong_dept;
|
||||
that.apiObjWm = that.$API.wpm.wmaterial.list;
|
||||
|
|
@ -643,6 +765,192 @@ export default {
|
|||
that.shiftOtions = res;
|
||||
});
|
||||
},
|
||||
getdefects(qct){
|
||||
let that = this;
|
||||
if(qct!==''&&qct!==null){//输出
|
||||
that.$API.qm.qct.item.req(qct).then((res) => {
|
||||
that.qct_defects = [];
|
||||
that.testdefectss(res);
|
||||
})
|
||||
}else{
|
||||
that.$API.qm.qct.getQct.req({ material: that.mlogItem.material_out,type:'out',tag:'process' }).then((res) => {
|
||||
that.testdefectss(res);
|
||||
}).catch(()=>{
|
||||
// that.getList();
|
||||
})
|
||||
}
|
||||
},
|
||||
testdefectss(res){
|
||||
let that = this;
|
||||
res.qct_defects.forEach((item) => {
|
||||
that.addTemplate[item.defect_name] = false;
|
||||
let obj = Object.assign({}, item);
|
||||
that.qct_defects.push(obj);
|
||||
})
|
||||
that.qct_defects_origin = that.qct_defects;
|
||||
that.qct_testitems = [];
|
||||
res.qct_testitems.forEach((item2) => {
|
||||
if(item2.testitem_type!=='20'){
|
||||
let obj2 = Object.assign({}, item2);
|
||||
obj2.value = '';
|
||||
obj2.addto_wpr = item2.addto_wpr;
|
||||
if(item2.testitem_field_type=='input-number'||item2.testitem_field_type=='input-int'){
|
||||
obj2.value = null;
|
||||
that.addTemplate[item2.testitem_name] = null;
|
||||
}
|
||||
if(item2.testitem_field_type=='select-text'||item2.testitem_field_type=='selects-text'){
|
||||
let str = obj2.testitem_choices.replace(/'/g, '"');
|
||||
let arr = JSON.parse(str);
|
||||
obj2.testitem_choices = arr;
|
||||
that.addTemplate[item2.testitem_name] = null;
|
||||
}
|
||||
that.qct_testitems.push(obj2);
|
||||
}
|
||||
})
|
||||
that.qct_testitems_origin = that.qct_testitems;
|
||||
// that.getList();
|
||||
},
|
||||
//获取生产工序的mlogbw
|
||||
getMlogbw(){
|
||||
let that = this;
|
||||
let params = {};
|
||||
that.mlogbwlist = [];
|
||||
params.page = 0;
|
||||
params.type = 'out';
|
||||
params.mlogb__mlog = that.mlogId;
|
||||
that.$API.wpm.mlogbw.list.req(params).then((res) => {
|
||||
if(res.length>0){
|
||||
res.forEach((item) => {
|
||||
let obj = {};
|
||||
obj = Object.assign({},item);
|
||||
obj.isEdit = false;
|
||||
if(item.ftest!=null){
|
||||
if(item.ftest.ftestdefects!==undefined&&item.ftest.ftestdefects!==''&&item.ftest.ftestdefects!==null&&item.ftest.ftestdefects.length>0){
|
||||
item.ftest.ftestdefects.forEach((item1) => {
|
||||
obj[item1.defect_name] = item1.has;
|
||||
})
|
||||
}
|
||||
if(item.ftest.ftestitems!==undefined&&item.ftest.ftestitems!==''&&item.ftest.ftestitems!==null&&item.ftest.ftestitems.length>0){
|
||||
item.ftest.ftestitems.forEach((item2) => {
|
||||
obj[item2.testitem_name] = item2.test_val_json;
|
||||
})
|
||||
}
|
||||
}else{
|
||||
that.qct_defects.forEach((item1) => {
|
||||
obj[item1.defect_name] = false;
|
||||
})
|
||||
that.qct_testitems.forEach((item2) => {
|
||||
obj[item2.testitem_name] = null;
|
||||
})
|
||||
}
|
||||
that.mlogbwlist.push(obj);
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//输出编辑
|
||||
formTableEdit(row) {
|
||||
let that = this;
|
||||
that.mlogbwlist.forEach((item, index) => {
|
||||
if (item.id == row.id) {
|
||||
that.mlogbwlist[index].isEdit = true;
|
||||
let date = new Date();
|
||||
if(that.mlogbwlist[index].work_start_time==''||that.mlogbwlist[index].work_start_time==null){
|
||||
that.mlogbwlist[index].work_start_time = that.$TOOL.dateFormat(date, 'yyyy-MM-dd hh:mm:ss');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//输出保存
|
||||
formTableSave(row) {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.number = row.number;
|
||||
obj.mlogb = row.mlogb;
|
||||
obj.wpr = row.wpr;
|
||||
obj.note = row.note;
|
||||
//qct不为空,有检验表
|
||||
if(that.qct!==''&&that.qct!==null){
|
||||
that.qct_defects_origin.forEach(item => {
|
||||
if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){
|
||||
let str = item.rule_expression.replace(/`/g, '');
|
||||
str = str.replace(/\${(.*?)}/g, 'row.\$1')
|
||||
let judge = eval(str);
|
||||
row[item.defect_name] = judge;
|
||||
}
|
||||
});
|
||||
obj.ftest = {};
|
||||
obj.ftest.ftestitems = [];
|
||||
obj.ftest.ftestdefects = [];
|
||||
obj.ftest.qct = that.qct;
|
||||
obj.ftest.test_date = that.handle_date!=null?that.handle_date:that.currentDate;
|
||||
obj.ftest.test_user = that.handle_user;
|
||||
if(that.qct_defects.length>0){
|
||||
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);
|
||||
})
|
||||
}
|
||||
if(that.qct_testitems.length>0){
|
||||
that.qct_testitems.forEach((item1) => {
|
||||
let itemObj1 = {};
|
||||
itemObj1.testitem = item1.testitem;
|
||||
itemObj1.test_user = that.handle_user;
|
||||
itemObj1.addto_wpr = item1.addto_wpr;
|
||||
itemObj1.test_val_json = row[item1.testitem_name];
|
||||
obj.ftest.ftestitems.push(itemObj1);
|
||||
})
|
||||
}
|
||||
}else{
|
||||
obj.ftest = null;
|
||||
}
|
||||
if(row.id!==''&&row.id!==undefined&&row.id!==null){
|
||||
obj.id = row.id;
|
||||
that.$API.wpm.mlogbw.update.req(row.id,obj).then((res) => {
|
||||
that.$message.success("保存成功");
|
||||
that.getMlogbw();
|
||||
return res;
|
||||
}).catch((err) => {
|
||||
return err;
|
||||
});
|
||||
}else{
|
||||
that.$API.wpm.mlogbw.create.req(obj).then((res) => {
|
||||
that.$message.success("添加成功");
|
||||
that.getMlogbw();
|
||||
return res;
|
||||
}).catch((err) => {
|
||||
return err;
|
||||
});
|
||||
}
|
||||
},
|
||||
//输出取消编辑
|
||||
formTableCancel(row){
|
||||
this.mlogbwlist.forEach((item, index) => {
|
||||
if (item.id == row.id) {
|
||||
this.mlogbwlist[index].isEdit = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
formTableDelet(row){
|
||||
this.mlogbwlist.pop();
|
||||
},
|
||||
//删除
|
||||
formTableDel(id) {
|
||||
let that = this;
|
||||
that.$confirm(`确定删除吗?`, "提示", {
|
||||
type: "warning",
|
||||
}).then(() => {
|
||||
that.$API.wpm.mlogbw.delete.req(id).then((res) => {
|
||||
// that.getList();
|
||||
that.$message.success("删除成功");
|
||||
}).catch((err) => {
|
||||
return err;
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
//表单注入数据
|
||||
setData(data) {
|
||||
Object.assign(this.form, data);
|
||||
|
|
@ -734,6 +1042,7 @@ export default {
|
|||
that.$refs.checkDialogSingle.open(type,that.qct);
|
||||
});
|
||||
},
|
||||
|
||||
//表单提交方法
|
||||
mlogSubmit() {
|
||||
let that = this;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,292 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
title="新建报工"
|
||||
v-model="visible"
|
||||
style="width: 80%;"
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
@closed="$emit('closed')"
|
||||
>
|
||||
<el-container v-loading="loading">
|
||||
<el-main>
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="right"
|
||||
label-width="100px"
|
||||
style="padding: 0 10px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item>
|
||||
<el-input
|
||||
ref="codeInput"
|
||||
v-model="wm_in"
|
||||
clearable
|
||||
@change="formWminChange(wm_in)"
|
||||
style="width: 100%;top: -7px;"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="12" :xs="24">
|
||||
<el-form-item label="处理人:">
|
||||
<el-input v-model="form.handle_user" clearable ></el-input>
|
||||
<!-- {{ form.handle_user_name }} -->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="12" :xs="24">
|
||||
<el-form-item label="操作日期:">
|
||||
<el-date-picker
|
||||
v-model="form.handle_date"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"
|
||||
popper-append-to-body
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="12" :xs="24">
|
||||
<el-form-item label="批号:">
|
||||
<el-input v-model="form.batch" clearable ></el-input>
|
||||
<!-- {{ form.handle_user_name }} -->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="12" :xs="24">
|
||||
<el-form-item label="数量:">
|
||||
<el-input v-model="form.count" clearable ></el-input>
|
||||
<!-- {{ form.handle_user_name }} -->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="12" :xs="24">
|
||||
<el-form-item label="工艺路线:">
|
||||
<el-select
|
||||
v-model="form.route"
|
||||
placeholder="工艺路线"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in routeOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
<!-- {{ form.handle_user_name }} -->
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-main>
|
||||
<el-footer>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const defaultForm = {
|
||||
wm_in: "",
|
||||
mgroup:'',
|
||||
count_use: "",
|
||||
handle_user: "",
|
||||
is_fix:false,
|
||||
handle_user: null,
|
||||
handle_user_name: "",
|
||||
work_start_time: "",
|
||||
};
|
||||
|
||||
export default {
|
||||
props: {
|
||||
process: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
mgroupName:{
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
mgroup: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
dept: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
mgroupMtype: {
|
||||
type: String,
|
||||
default: "",
|
||||
}
|
||||
},
|
||||
emits: ["success", "closed"],
|
||||
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
mode: "add",
|
||||
//表单数据
|
||||
form: Object.assign({}, defaultForm),
|
||||
//验证规则
|
||||
rules: {
|
||||
supplier: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择供应商",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
},
|
||||
wm_in: "",
|
||||
route_code:"",
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
userOptions: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.route_code = this.$route.path.split("/")[2];
|
||||
this.form.handle_date = this.$TOOL.dateFormat2(new Date());
|
||||
},
|
||||
methods: {
|
||||
//获取
|
||||
getUser() {
|
||||
this.$API.system.user.list.req({ depts: this.dept }).then((res) => {
|
||||
this.userOptions = res.results;
|
||||
});
|
||||
},
|
||||
//显示
|
||||
open(mode = "add") {
|
||||
let that = this;
|
||||
this.mode = mode;
|
||||
if(mode == "add"){
|
||||
let userInfo = that.$TOOL.data.get("USER_INFO");
|
||||
this.form.handle_user = userInfo.id;
|
||||
this.form.handle_user_name = userInfo.name;
|
||||
}
|
||||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
//扫描后处理方法
|
||||
// 扫描后会有两种情况,一种是扫描物料,一种是扫描用户;物料扫描后需要判断
|
||||
formWminChange(code){
|
||||
console.log('code',code);
|
||||
let that = this,codeId='',arr=[];
|
||||
code = code.replace(/(^\s*)|(\s*$)/g, "");
|
||||
if(code.indexOf("#")>-1){
|
||||
let arrs = code.split("#");
|
||||
codeId = arrs[1];
|
||||
that.scanKyes = arrs[0];
|
||||
if(that.scanKyes=="user"){
|
||||
//请求用户信息
|
||||
that.$API.system.user.item.req(codeId).then((res) => {
|
||||
console.log('userres',res);
|
||||
that.form.handle_user = res.id;
|
||||
that.form.handle_user_name = res.name;
|
||||
})
|
||||
}else if(that.scanKyes=="mat"){
|
||||
//请求物料信息
|
||||
this.$API.cm.labelmat.item.req(codeId).then((res) => {
|
||||
if(res){
|
||||
arr = that.materialOptions.filter((item) => {
|
||||
return item.batch == res.batch&&item.state==res.state;
|
||||
})
|
||||
if (arr.length > 0) {
|
||||
that.form.batch = arr[0].batch;
|
||||
that.form.wm_in = arr[0].id;
|
||||
that.form.count_use = arr[0].count;
|
||||
that.wm_in = arr[0].batch;
|
||||
}else{
|
||||
that.wm_in = '';
|
||||
that.$message.error("批次号不存在");
|
||||
}
|
||||
}else{
|
||||
that.wm_in = '';
|
||||
}
|
||||
}).catch((err) => {
|
||||
that.wm_in = '';
|
||||
that.$message.error("批次号不存在");
|
||||
});
|
||||
}
|
||||
}else{
|
||||
that.scanKyes = "";
|
||||
that.$API.wpm.wpr.list.req({number:code,page:0}).then((res) => {
|
||||
if(res.length>0){
|
||||
let index = res.length-1;//最后一条记录
|
||||
let bwitem = {};
|
||||
bwitem.mlogb="";
|
||||
bwitem.number=res[index].number;
|
||||
bwitem.wpr=res[index].id;
|
||||
let arr = that.materialOptions.filter((item) => {
|
||||
return item.id == res[index].wm;
|
||||
})
|
||||
if(arr.length>0){ //车间存在该批次
|
||||
let batch = arr[0].batch;
|
||||
that.wm_in = arr[0].batch;
|
||||
that.mlogbInCount = arr[0].count;//该批次数量
|
||||
//判断日志中是否存在该批次
|
||||
let arr0= that.mlogbIns.filter((item)=>{
|
||||
return item.batch == batch;
|
||||
})
|
||||
let arr1 = that.bwItemForms.filter((item)=>{
|
||||
return item.number == bwitem.number;
|
||||
})
|
||||
if (arr0.length > 0) {
|
||||
that.hasMlogbIn = true;
|
||||
that.form.count_use = 1;
|
||||
that.mlogbId = arr0[0].id;
|
||||
bwitem.mlogb = arr0[0].id;
|
||||
}else{
|
||||
if(arr1.length>0){
|
||||
that.wm_in = '';
|
||||
that.$message.error("已存在");
|
||||
}else{
|
||||
that.form.batch = arr[0].batch;
|
||||
that.form.wm_in = arr[0].id;
|
||||
that.form.count_use += 1;
|
||||
that.wm_in = '';
|
||||
that.batchs = arr[0].id;
|
||||
}
|
||||
}
|
||||
that.bwItemForms.push(bwitem);
|
||||
}else{
|
||||
that.wm_in = '';
|
||||
that.$message.error("批次号不存在");
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
//表单提交方法
|
||||
submit() {
|
||||
let that = this;
|
||||
that.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
that.isSaveing = true;
|
||||
that.form.mgroup = that.mgroup;
|
||||
that.$API.wpm.mlog.quick.req(that.form).then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success");
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
}).catch(()=>{
|
||||
that.isSaveing = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
//设置过滤项
|
||||
setFilters(filters) {
|
||||
this.selectionFilters = filters;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
|
@ -0,0 +1,991 @@
|
|||
<template>
|
||||
<el-container v-if="visible">
|
||||
<el-header v-if="descriptionVisible">
|
||||
<div style="display: flex;align-items: center;justify-content: space-between;width: 100%;">
|
||||
<div>检验人:{{setForm.test_user_name}}</div>
|
||||
<div>检验设备:{{setForm.equipment_name}}</div>
|
||||
<div>缺陷项:
|
||||
<span v-for="(item1,index1) in defectlists" :key="item1.id">{{ item1.defect_name }}
|
||||
<span v-if="index1 < defectlists.length-1">、</span>
|
||||
</span>
|
||||
</div>
|
||||
<div>检测项:
|
||||
<span v-for="(item2,index2) in testitemlists" :key="item2.id">{{ item2.testitem_name }}
|
||||
<span v-if="index2 < testitemlists.length-1">、</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main id="mlogbwMain">
|
||||
<el-button type="primary" v-if="!isSubmit&&processType=='20'" @click="check_start" style="position: relative;">检验</el-button>
|
||||
<el-button type="primary" v-if="multipleSet" @click="check_set" style="position: relative;left: 210px;">批量操作</el-button>
|
||||
<el-input v-if="multipleSet" v-model="wprInputText" @change="wprinputChange" style="width:200px;position: relative;left: 308px;"></el-input>
|
||||
<sc-form-table
|
||||
hideDelete
|
||||
id="mlogbwlist"
|
||||
v-model="mlogbwlist"
|
||||
placeholder="暂无数据"
|
||||
:hideAdd="hideAdd"
|
||||
:addTemplate="addTemplate"
|
||||
:tableHeight="tableHeight"
|
||||
:canMultiple = "canMultiple"
|
||||
@selectChange="selectChange"
|
||||
@selectAllChange="selectAllChange"
|
||||
@add="rowAdd"
|
||||
>
|
||||
<el-table-column prop="number" label="物料编号" fixed min-width="80px">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.number }}</span>
|
||||
<span v-if="scope.row.wpr_number_out!==null&&scope.row.wpr_number_out!==undefined">——{{ scope.row.wpr_number_out }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="note" :label="item.testitem_name" v-for="item in qct_testitems" :key="item.id" width="150px">
|
||||
<template #default="scope">
|
||||
<span v-if="!scope.row.isEdit||!item.canEdit">{{ scope.row[item.testitem_name] }}</span>
|
||||
<el-input-number
|
||||
v-if="item.testitem_field_type=='input-number'&&scope.row.isEdit&&item.canEdit"
|
||||
v-model="scope.row[item.testitem_name]"
|
||||
class="width-100"
|
||||
controls-position="right"
|
||||
@change="defectCountSun(scope.row)"
|
||||
></el-input-number>
|
||||
<el-input-number
|
||||
v-if="item.testitem_field_type=='input-int'&&scope.row.isEdit&&item.canEdit"
|
||||
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'&&scope.row.isEdit&&item.canEdit"
|
||||
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'&&scope.row.isEdit&&item.canEdit"
|
||||
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'&&scope.row.isEdit&&item.canEdit"
|
||||
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" width="120px">
|
||||
<template #default="scope">
|
||||
<el-switch
|
||||
:disabled="!scope.row.isEdit||!item.canEdit"
|
||||
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="备注" width="80px">
|
||||
<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 label="操作" width="160" align="center" fixed="right" v-if="!isSubmit">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-if="scope.row.isEdit"
|
||||
type="success"
|
||||
@click="formTableSave(scope.row)"
|
||||
>保存</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.isEdit&&scope.row.id"
|
||||
type="danger"
|
||||
style="margin-left: 5px;"
|
||||
@click="formTableCancel(scope.row)"
|
||||
>取消</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.isEdit&&setForm.cd_req_addr!=null"
|
||||
type="warning"
|
||||
style="margin-left: 5px;"
|
||||
@click="getEqData(scope.$index)"
|
||||
>重取数据</el-button>
|
||||
<el-button
|
||||
v-if="!scope.row.isEdit"
|
||||
type="primary"
|
||||
@click="formTableEdit(scope.row)"
|
||||
>编辑</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.isEdit&&!scope.row.id"
|
||||
type="danger"
|
||||
style="margin-left: 5px;"
|
||||
@click="formTableDelet(scope.row)"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
v-if="!scope.row.isEdit"
|
||||
type="danger"
|
||||
style="margin-left: 5px;"
|
||||
@click="formTableDel(scope.row.id)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</sc-form-table>
|
||||
</el-main>
|
||||
</el-container>
|
||||
<el-dialog
|
||||
title="检验"
|
||||
v-model="checkVisible"
|
||||
destroy-on-close
|
||||
>
|
||||
<el-container>
|
||||
<el-main>
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="80px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="12" :xs="24">
|
||||
<el-form-item label="操作人" prop="test_user">
|
||||
<ehsSelect
|
||||
v-model="form.test_user"
|
||||
:showName="test_user_name"
|
||||
:apiObj="this.$API.system.user.list"
|
||||
:params="{ depts: dept }"
|
||||
style="width: 100%"
|
||||
@change="userChange"
|
||||
></ehsSelect>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="12" :xs="24">
|
||||
<el-form-item label="设备">
|
||||
<el-select
|
||||
v-model="form.equipment"
|
||||
placeholder="设备"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
@change="equipmentChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in equipmentOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
<span style="float:left">{{item.name}}</span>
|
||||
<span style="float:right">{{item.number}}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="12" :xs="24">
|
||||
<el-form-item label="检测项">
|
||||
<el-select
|
||||
v-model="form.testitemids"
|
||||
placeholder="检测项"
|
||||
clearable
|
||||
filterable
|
||||
multiple
|
||||
style="width: 100%"
|
||||
@change="testitemidsChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in qct_testitems"
|
||||
:key="item.testitem"
|
||||
:label="item.testitem_name"
|
||||
:value="item.testitem"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="12" :xs="24">
|
||||
<el-form-item label="缺陷项">
|
||||
<el-select
|
||||
v-model="form.defectids"
|
||||
placeholder="缺陷项"
|
||||
clearable
|
||||
filterable
|
||||
multiple
|
||||
style="width: 100%"
|
||||
@change="defectidsChange"
|
||||
>
|
||||
<template #header>
|
||||
<el-checkbox
|
||||
v-model="checkAll"
|
||||
:indeterminate="indeterminate"
|
||||
@change="handleCheckAll"
|
||||
>全部</el-checkbox>
|
||||
</template>
|
||||
<el-option
|
||||
v-for="item in qct_defects"
|
||||
:key="item.defect"
|
||||
:label="item.defect_name"
|
||||
:value="item.defect"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-footer>
|
||||
<el-button type="primary" :loading="isSaveing" @click.stop="checkSetting" save>确定</el-button>
|
||||
<el-button @click="saveCancel">取消</el-button>
|
||||
</el-footer>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="批量检验"
|
||||
v-model="setVisible"
|
||||
destroy-on-close
|
||||
style="height:100%;width:80%"
|
||||
>
|
||||
<el-container>
|
||||
<el-main>
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="150px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col v-for="item2 in defectlists" :key="item2.id" :span="12">
|
||||
<el-form-item :label="item2.defect_name">
|
||||
<el-switch v-model="item2.value"></el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col>
|
||||
<!-- 扫描物料的number 根据number对比list里的物料-->
|
||||
<el-form-item label="检测物料" label-width="70px">
|
||||
<el-input v-model="wprNumber" @change="wprChange(wprNumber)"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-row>
|
||||
<el-table :data="selectWpr" border>
|
||||
<el-table-column prop="number" label="物料编号"></el-table-column>
|
||||
<el-table-column v-for="item2 in defectlists" :key="item2.id" :label="item2.defect_name">
|
||||
<el-switch v-model="item2.value" disabled></el-switch>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="90" align="center" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button type="danger" size="small" @click="selectWprDel(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-row>
|
||||
<el-footer>
|
||||
<el-button type="primary" :loading="isSaveing" @click.stop="saveSetting" save>保存</el-button>
|
||||
<el-button @click="saveCancel">取消</el-button>
|
||||
</el-footer>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
qct: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
mlogId: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
wm: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
handle_user:{
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
handle_date:{
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
batchNumber:{
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
mgroup:{
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
mgroupName:{
|
||||
type:String,
|
||||
default:"",
|
||||
},
|
||||
dept:{
|
||||
type:String,
|
||||
default:"",
|
||||
},
|
||||
isSubmit:{
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
material_out:{
|
||||
type:String,
|
||||
default:"",
|
||||
},
|
||||
material_in:{
|
||||
type:String,
|
||||
default:"",
|
||||
},
|
||||
processType:{
|
||||
type:String,
|
||||
default:"",
|
||||
}
|
||||
},
|
||||
emits: ["success", "closed"],
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
headTitle:{
|
||||
ins:'输入物料详情',
|
||||
outs:'输出物料详情',
|
||||
},
|
||||
mode:'',
|
||||
//表单数据
|
||||
form: {
|
||||
test_user:"",
|
||||
equipment:"",
|
||||
cd_req_addr:null,//请求数据接口地址
|
||||
equipment_name:"",
|
||||
testitemids : [],
|
||||
defectids : [],
|
||||
},
|
||||
test_user_name:"",
|
||||
year:"",
|
||||
month:"",
|
||||
values:"",
|
||||
wprNumber:"",
|
||||
route_code:"",
|
||||
wprInputText:"",
|
||||
canMultiple:false,
|
||||
checkAll: false,
|
||||
hideAdd: true,
|
||||
visible: false,
|
||||
setVisible:false,
|
||||
multipleSet:false,
|
||||
checkVisible:false,
|
||||
hasWpr:false,
|
||||
descriptionVisible:false,
|
||||
options:[],
|
||||
qct_defects:[],
|
||||
qct_testitems:[],
|
||||
mlogbwlist:[],
|
||||
testitems:[],
|
||||
equipmentOptions:[],
|
||||
addTemplate:{
|
||||
mlogb: "",
|
||||
number: "",
|
||||
note: "",
|
||||
isEdit: true,
|
||||
},
|
||||
setForm:{
|
||||
test_user:"",
|
||||
equipment:"",
|
||||
equipment_name:"",
|
||||
testitemids : [],
|
||||
defectids : [],
|
||||
},
|
||||
rules: {
|
||||
test_user: [{ required: true, message: "请选择操作人" }],
|
||||
|
||||
},
|
||||
optionsEq:[],
|
||||
defectlists:[],
|
||||
testitemlists:[],
|
||||
selectWprList:[],
|
||||
qct_defects_origin:[],
|
||||
selectWpr:[],
|
||||
tableHeight:500,
|
||||
apiObjPrint:this.$API.cm.labelmat.fromWm,
|
||||
printer_name:localStorage.getItem("printer_name")
|
||||
};
|
||||
},
|
||||
watch: {},
|
||||
mounted() {
|
||||
let that = this;
|
||||
console.log('that.material_out',that.material_out)
|
||||
if(that.processType=='20'){
|
||||
that.canMultiple = true;
|
||||
}
|
||||
if(that.qct!==''&&that.qct!==null){//输出
|
||||
that.getdefects();
|
||||
}else{
|
||||
that.$API.qm.qct.getQct.req({ material: that.material_out,type:'out',tag:'process' }).then((res) => {
|
||||
that.testdefectss(res);
|
||||
}).catch(()=>{
|
||||
that.getList();
|
||||
})
|
||||
}
|
||||
that.visible = true;
|
||||
setTimeout(() => {
|
||||
that.tableHeight = document.getElementById('mlogbwMain').clientHeight-20;
|
||||
},500)
|
||||
that.route_code = that.$route.path.split("/")[2];
|
||||
that.hideAdd = that.isSubmit;
|
||||
that.currentDate = that.$TOOL.dateFormat2(new Date());
|
||||
},
|
||||
methods: {
|
||||
rowAdd(data){
|
||||
let that = this;
|
||||
let years = that.year+'';
|
||||
years = years.slice(2,4);
|
||||
let months = that.month<10?'0'+that.month:that.month;
|
||||
let num = data.number.slice(-4);
|
||||
num = Number(num)+1;
|
||||
if(num<10){
|
||||
num = "000"+num;
|
||||
}else if(num<100){
|
||||
num = "00"+num;
|
||||
}else if(num<1000){
|
||||
num = "0"+num;
|
||||
}
|
||||
if(that.mgroupName=='排一次棒'){
|
||||
that.addTemplate.number = years+months+num;
|
||||
}
|
||||
if(that.mgroupName=='排板'){
|
||||
that.addTemplate.number = years+ months + that.material_model+num;
|
||||
}
|
||||
},
|
||||
selectChange(rows){
|
||||
console.log('rowsrows',rows)
|
||||
let that = this;
|
||||
that.selectWprList = rows;
|
||||
},
|
||||
selectAllChange(datas){
|
||||
console.log('datas',datas)
|
||||
let that = this;
|
||||
that.selectWprList = datas;
|
||||
},
|
||||
getEquipment4() {
|
||||
let that = this;
|
||||
that.$API.em.equipment.list.req({page:0,cate__code:"4",query:"{id,name,number}"}).then((res) => {
|
||||
that.optionsEq = res.reverse();
|
||||
})
|
||||
},
|
||||
getEquipments(){
|
||||
let that = this;
|
||||
that.$API.em.equipment.list.req({page:0,cate__code:"6"}).then((res) => {
|
||||
that.equipmentOptions = res;
|
||||
})
|
||||
},
|
||||
getdefects(){
|
||||
let that = this;
|
||||
that.$API.qm.qct.item.req(that.qct).then((res) => {
|
||||
that.qct_defects = [];
|
||||
that.testdefectss(res);
|
||||
})
|
||||
},
|
||||
testdefectss(res){
|
||||
let that = this;
|
||||
res.qct_defects.forEach((item) => {
|
||||
that.addTemplate[item.defect_name] = false;
|
||||
let obj = Object.assign({}, item);
|
||||
obj.canEdit = that.processType=='20'?false:true;
|
||||
that.qct_defects.push(obj);
|
||||
})
|
||||
that.qct_defects_origin = that.qct_defects;
|
||||
that.qct_testitems = [];
|
||||
res.qct_testitems.forEach((item2) => {
|
||||
if(item2.testitem_type!=='20'){
|
||||
let obj2 = Object.assign({}, item2);
|
||||
obj2.value = '';
|
||||
obj2.canEdit = that.processType=='20'?false:true;
|
||||
|
||||
obj2.addto_wpr = item2.addto_wpr;
|
||||
if(item2.testitem_field_type=='input-number'||item2.testitem_field_type=='input-int'){
|
||||
obj2.value = null;
|
||||
that.addTemplate[item2.testitem_name] = null;
|
||||
}
|
||||
if(item2.testitem_field_type=='select-text'||item2.testitem_field_type=='selects-text'){
|
||||
let str = obj2.testitem_choices.replace(/'/g, '"');
|
||||
let arr = JSON.parse(str);
|
||||
obj2.testitem_choices = arr;
|
||||
that.addTemplate[item2.testitem_name] = null;
|
||||
}
|
||||
that.qct_testitems.push(obj2);
|
||||
}
|
||||
})
|
||||
that.qct_testitems_origin = that.qct_testitems;
|
||||
that.getList();
|
||||
},
|
||||
getOptions(){
|
||||
let that = this;
|
||||
that.$API.wpm.wpr.list.req({wm:that.wm,page:0,query:"{id,number}"}).then((res) => {
|
||||
that.options = res;
|
||||
})
|
||||
},
|
||||
optionChange(row){
|
||||
let that = this;
|
||||
that.options.forEach((item) => {
|
||||
if(item.id == row.wpr){
|
||||
let index = that.mlogbwlist.indexOf(row);
|
||||
that.mlogbwlist[index].number = item.number;
|
||||
}
|
||||
})
|
||||
},
|
||||
getList(){
|
||||
let that = this;
|
||||
let params = {};
|
||||
that.mlogbwlist = [];
|
||||
params.page = 0;
|
||||
params.type = 'out';
|
||||
params.mlogb__mlog = that.mlogId;
|
||||
that.$API.wpm.mlogbw.list.req(params).then((res) => {
|
||||
that.mlogbwlist = [];
|
||||
if(res.length>0){
|
||||
res.forEach((item) => {
|
||||
let obj = {};
|
||||
obj = Object.assign({},item);
|
||||
obj.isEdit = false;
|
||||
if(that.qct!=''){
|
||||
if(item.ftest!=null){
|
||||
if(item.ftest.ftestdefects!==undefined&&item.ftest.ftestdefects!==''&&item.ftest.ftestdefects!==null&&item.ftest.ftestdefects.length>0){
|
||||
item.ftest.ftestdefects.forEach((item1) => {
|
||||
obj[item1.defect_name] = item1.has;
|
||||
})
|
||||
}
|
||||
if(item.ftest.ftestitems!==undefined&&item.ftest.ftestitems!==''&&item.ftest.ftestitems!==null&&item.ftest.ftestitems.length>0){
|
||||
item.ftest.ftestitems.forEach((item2) => {
|
||||
obj[item2.testitem_name] = item2.test_val_json;
|
||||
})
|
||||
}
|
||||
}else{
|
||||
that.qct_defects.forEach((item1) => {
|
||||
obj[item1.defect_name] = false;
|
||||
})
|
||||
that.qct_testitems.forEach((item2) => {
|
||||
obj[item2.testitem_name] = null;
|
||||
})
|
||||
}
|
||||
}
|
||||
that.mlogbwlist.push(obj);
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//添加
|
||||
formTableSave(row) {
|
||||
let that = this;
|
||||
let obj = {};
|
||||
obj.number = row.number;
|
||||
obj.mlogb = row.mlogb;
|
||||
obj.wpr = row.wpr;
|
||||
obj.note = row.note;
|
||||
//qct不为空,有检验表
|
||||
if(that.qct!==''&&that.qct!==null){
|
||||
that.qct_defects_origin.forEach(item => {
|
||||
if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){
|
||||
let str = item.rule_expression.replace(/`/g, '');
|
||||
str = str.replace(/\${(.*?)}/g, 'row.\$1')
|
||||
let judge = eval(str);
|
||||
row[item.defect_name] = judge;
|
||||
}
|
||||
});
|
||||
obj.ftest = {};
|
||||
obj.ftest.ftestitems = [];
|
||||
obj.ftest.ftestdefects = [];
|
||||
obj.ftest.qct = that.qct;
|
||||
obj.ftest.test_date = that.handle_date!=null?that.handle_date:that.currentDate;
|
||||
obj.ftest.test_user = that.handle_user;
|
||||
if(that.qct_defects.length>0){
|
||||
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);
|
||||
})
|
||||
}
|
||||
if(that.qct_testitems.length>0){
|
||||
that.qct_testitems.forEach((item1) => {
|
||||
let itemObj1 = {};
|
||||
itemObj1.testitem = item1.testitem;
|
||||
itemObj1.test_user = that.handle_user;
|
||||
itemObj1.addto_wpr = item1.addto_wpr;
|
||||
itemObj1.test_val_json = row[item1.testitem_name];
|
||||
obj.ftest.ftestitems.push(itemObj1);
|
||||
})
|
||||
}
|
||||
}else{
|
||||
obj.ftest = null;
|
||||
}
|
||||
if(row.id!==''&&row.id!==undefined&&row.id!==null){
|
||||
obj.id = row.id;
|
||||
that.$API.wpm.mlogbw.update.req(row.id,obj).then((res) => {
|
||||
that.$message.success("保存成功");
|
||||
that.getList();
|
||||
return res;
|
||||
}).catch((err) => {
|
||||
return err;
|
||||
});
|
||||
}else{
|
||||
that.$API.wpm.mlogbw.create.req(obj).then((res) => {
|
||||
that.$message.success("添加成功");
|
||||
that.getList();
|
||||
return res;
|
||||
}).catch((err) => {
|
||||
return err;
|
||||
});
|
||||
}
|
||||
},
|
||||
formTableCancel(row){
|
||||
this.mlogbwlist.forEach((item, index) => {
|
||||
if (item.id == row.id) {
|
||||
this.mlogbwlist[index].isEdit = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
formTableEdit(row) {
|
||||
let that = this;
|
||||
if(that.route_code=='niuzhuan'&&that.optionsEq.length==0){
|
||||
that.getEquipment4();
|
||||
}
|
||||
that.mlogbwlist.forEach((item, index) => {
|
||||
if (item.id == row.id) {
|
||||
that.mlogbwlist[index].isEdit = true;
|
||||
let date = new Date();
|
||||
if(that.mlogbwlist[index].work_start_time==''||that.mlogbwlist[index].work_start_time==null){
|
||||
that.mlogbwlist[index].work_start_time = that.$TOOL.dateFormat(date, 'yyyy-MM-dd hh:mm:ss');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
formTableDelet(row){
|
||||
this.mlogbwlist.pop();
|
||||
},
|
||||
//删除
|
||||
formTableDel(id) {
|
||||
let that = this;
|
||||
that.$confirm(`确定删除吗?`, "提示", {
|
||||
type: "warning",
|
||||
}).then(() => {
|
||||
that.$API.wpm.mlogbw.delete.req(id).then((res) => {
|
||||
that.getList();
|
||||
that.$message.success("删除成功");
|
||||
}).catch((err) => {
|
||||
return err;
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
switchChange(row,item){
|
||||
let that = this;
|
||||
let index = that.mlogbwlist.indexOf(row);
|
||||
that.mlogbwlist[index][item.defect_name] = row[item.defect_name];
|
||||
},
|
||||
//表单提交方法
|
||||
mlogbSubmit() {
|
||||
let that = this;
|
||||
that.$API.wpm.mlogb.submit.req(that.mlogb).then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
});
|
||||
},
|
||||
defectCountSun(row){
|
||||
let that = this;
|
||||
let index = that.mlogbwlist.indexOf(row);
|
||||
that.qct_defects_origin.forEach(item => {
|
||||
if(item.rule_expression!==''&&item.rule_expression!==undefined&&item.rule_expression!==null){
|
||||
let str = item.rule_expression.replace(/`/g, '');
|
||||
str = str.replace(/\${(.*?)}/g, 'row.\$1')
|
||||
let judge = eval(str);
|
||||
that.mlogbwlist[index][item.defect_name] = judge;
|
||||
}else{
|
||||
that.mlogbwlist[index][item.defect_name] = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
//设置过滤项
|
||||
setFilters(filters) {
|
||||
this.selectionFilters = filters;
|
||||
this.setFiltersVisible = true;
|
||||
},
|
||||
handlePrint(){
|
||||
let that = this;
|
||||
that.printVisible = true;
|
||||
},
|
||||
//打印物料标签
|
||||
printMaterial(row){
|
||||
let that = this;
|
||||
that.apiObjPrint.req({tid:row.id}).then((res) => {
|
||||
let code = res.code_label;
|
||||
let str = [
|
||||
"SIZE 40 mm,70 mm",
|
||||
"GAP 7 mm,7 mm",
|
||||
"CLS",
|
||||
"REFERENCE 0,0",
|
||||
'QRCODE 30,400,H,5,A,0,"' +code +'"',
|
||||
"WINTEXT 200,550,28,90,0,0,Simhei," + res.material_name,
|
||||
"WINTEXT 240,550,28,90,0,0,Simhei," +"批次号:" + res.batch,
|
||||
"WINTEXT 280,550,28,90,0,0,Simhei," +"数量:" + row.count,
|
||||
"PRINT 1",
|
||||
];
|
||||
let obj = {};
|
||||
obj.printer_commands = str;
|
||||
obj.printer_name = that.printer_name;
|
||||
that.$API.wpm.prints.req(obj).then((response) => {
|
||||
that.$message.success("打印成功");
|
||||
});
|
||||
})
|
||||
},
|
||||
userChange(val){
|
||||
let that = this;
|
||||
that.$API.system.user.item.req(val).then((res) => {
|
||||
that.setForm.test_user_name = res.name;
|
||||
})
|
||||
},
|
||||
equipmentChange(){
|
||||
let that = this;
|
||||
that.equipmentOptions.forEach(item => {
|
||||
if(item.id == that.form.equipment){
|
||||
that.form.equipment_name = item.name;
|
||||
that.form.cd_req_addr=item.cd_req_addr;
|
||||
}
|
||||
});
|
||||
},
|
||||
testitemidsChange(){
|
||||
let that = this;
|
||||
that.testitemlists = [];
|
||||
that.qct_testitems.forEach(item => {
|
||||
if(that.form.testitemids.indexOf(item.testitem) > -1){
|
||||
item.canEdit = true;
|
||||
item.value=null;
|
||||
that.testitemlists.push(item);
|
||||
}
|
||||
});
|
||||
},
|
||||
defectidsChange(){
|
||||
let that = this;
|
||||
that.defectlists = [];
|
||||
that.qct_defects.forEach(item => {
|
||||
if(that.form.defectids.indexOf(item.defect) > -1){
|
||||
item.canEdit = true;
|
||||
item.value=null;
|
||||
that.defectlists.push(item);
|
||||
}
|
||||
})
|
||||
if(that.defectlists.length == that.qct_defects.length){
|
||||
that.checkAll = true;
|
||||
}else{
|
||||
that.checkAll = false;
|
||||
}
|
||||
},
|
||||
handleCheckAll(){
|
||||
let that = this;
|
||||
that.defectlists = [];
|
||||
that.form.defectids = [];
|
||||
if(that.checkAll){
|
||||
that.qct_defects.forEach(item => {
|
||||
item.canEdit = true;
|
||||
item.value=null;
|
||||
that.defectlists.push(item);
|
||||
that.form.defectids.push(item.defect);
|
||||
})
|
||||
}
|
||||
},
|
||||
check_start(){
|
||||
this.checkVisible=true;
|
||||
this.getEquipments();
|
||||
},
|
||||
checkSetting(){
|
||||
let that = this;
|
||||
that.isSaveing = true;
|
||||
that.$refs.dialogForm.validate((valid) => {
|
||||
if (valid) {
|
||||
Object.assign(that.setForm,that.form);
|
||||
that.mlogbwlist.forEach(item => {
|
||||
if(item.ftest!==null){
|
||||
item.ftest.ftestdefects.forEach(defect => {
|
||||
if(that.setForm.defectids.indexOf(defect.defect) > -1){
|
||||
defect.test_user = that.setForm.test_user;
|
||||
}
|
||||
})
|
||||
item.ftest.ftestitems.forEach(testitem => {
|
||||
if(that.setForm.testitemids.indexOf(testitem.testitem) > -1){
|
||||
testitem.test_user = that.setForm.test_user;
|
||||
testitem.test_equip = that.setForm.equipment;
|
||||
}
|
||||
})
|
||||
}else{
|
||||
let ftest = {};
|
||||
ftest.ftestitems = [];
|
||||
ftest.ftestdefects = [];
|
||||
ftest.qct = that.qct;
|
||||
ftest.test_date =that.handle_date!=null?that.handle_date:that.currentDate;
|
||||
ftest.test_user = that.handle_user;
|
||||
that.qct_defects.forEach((item0) => {
|
||||
let itemObj = {};
|
||||
itemObj.defect = item0.defect;
|
||||
itemObj.has = false;
|
||||
if(that.setForm.defectids.indexOf(item0.defect) > -1){
|
||||
itemObj.test_user = that.setForm.test_user;
|
||||
}else{
|
||||
itemObj.test_user = that.handle_user;
|
||||
}
|
||||
ftest.ftestdefects.push(itemObj);
|
||||
})
|
||||
that.qct_testitems.forEach((item1) => {
|
||||
let itemObj1 = {};
|
||||
itemObj1.testitem = item1.testitem;
|
||||
itemObj1.addto_wpr = item1.addto_wpr;
|
||||
itemObj1.test_val_json = "";
|
||||
if(that.setForm.testitemids.indexOf(item1.testitem) > -1){
|
||||
itemObj1.test_user = that.setForm.test_user;
|
||||
itemObj1.test_equip = that.setForm.equipment;
|
||||
}else{
|
||||
itemObj1.test_user = that.handle_user;
|
||||
}
|
||||
ftest.ftestitems.push(itemObj1);
|
||||
})
|
||||
item.ftest = ftest;
|
||||
}
|
||||
});
|
||||
that.$API.wpm.mlogbw.update.req("bulk",that.mlogbwlist).then((res) => {
|
||||
that.form = {};
|
||||
that.checkVisible = false;
|
||||
that.multipleSet = true;
|
||||
that.descriptionVisible = true;
|
||||
that.qct_defects = [];
|
||||
that.qct_defects = that.defectlists;
|
||||
that.qct_testitems = [];
|
||||
that.qct_testitems = that.testitemlists;
|
||||
that.tableHeight = document.getElementById('mlogbwMain').clientHeight-80;
|
||||
that.isSaveing = false;
|
||||
that.getList();
|
||||
}).catch((err) => {
|
||||
that.isSaveing = false;
|
||||
return err;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
saveCancel(){
|
||||
this.form = {};
|
||||
this.form.test_user = "";
|
||||
this.form.equipment = "";
|
||||
this.form.testitemids = [];
|
||||
this.form.defectids = [];
|
||||
this.checkVisible = false;
|
||||
},
|
||||
check_set(){
|
||||
this.wprNumber = "";
|
||||
this.selectWpr = [];
|
||||
if(this.selectWprList.length>0){
|
||||
this.selectWpr = this.selectWprList;
|
||||
}
|
||||
this.setVisible=true;
|
||||
},
|
||||
//扫描物料将这一行放到第一行并编辑这一行
|
||||
wprinputChange(){
|
||||
let that = this;
|
||||
that.mlogbwlist.forEach((item,index) => {
|
||||
let indexs = item.number.indexOf(that.wprInputText)
|
||||
if(indexs>-1&&that.wprInputText !== ""){
|
||||
let obj = Object.assign({},item);
|
||||
obj.isEdit = true;
|
||||
that.mlogbwlist.splice(index,1);
|
||||
that.wprInputText = "";
|
||||
that.mlogbwlist.unshift(obj);
|
||||
if(that.setForm.cd_req_addr!==null){
|
||||
//执行cd_req_addr,获取检测设备的数据
|
||||
that.getEqData(0);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
getEqData(index){
|
||||
let that = this;
|
||||
that.$API.em.cd.req({method:that.setForm.cd_req_addr}).then((res) => {
|
||||
that.qct_testitems.forEach(item0 => {
|
||||
if(item0.testitem_cd_expr!=null){
|
||||
that.mlogbwlist[index][item0.testitem_name]= eval(item0.testitem_cd_expr);
|
||||
}
|
||||
})
|
||||
}).catch((err) => {
|
||||
return err;
|
||||
});
|
||||
},
|
||||
wprChange(wprNumber){
|
||||
let that = this;
|
||||
that.mlogbwlist.forEach(item => {
|
||||
if(item.number == wprNumber){
|
||||
that.selectWpr.push(item);
|
||||
that.wprNumber = "";
|
||||
}
|
||||
});
|
||||
},
|
||||
selectWprDel(row){
|
||||
let that = this;
|
||||
that.selectWpr.forEach((item,index) => {
|
||||
if(item.number == row.number){
|
||||
that.selectWpr.splice(index,1);
|
||||
}
|
||||
});
|
||||
},
|
||||
saveSetting(){
|
||||
let that = this;
|
||||
that.$refs.dialogForm.validate((valid) => {
|
||||
if (valid) {
|
||||
that.selectWpr.forEach(item => {
|
||||
item.ftest.ftestdefects.forEach(defect => {
|
||||
let defectindex = that.setForm.defectids.indexOf(defect.defect);
|
||||
if(defectindex > -1){
|
||||
defect.has = that.defectlists[defectindex].value;
|
||||
}
|
||||
})
|
||||
item.ftest.ftestitems.forEach(testitem => {
|
||||
let testitemindex = that.setForm.testitemids.indexOf(testitem.testitem);
|
||||
if( testitemindex > -1){
|
||||
testitem.test_val_json = that.testitemlists[testitemindex].value;
|
||||
}
|
||||
})
|
||||
});
|
||||
that.$API.wpm.mlogbw.update.req("bulk",that.selectWpr).then((res) => {
|
||||
that.setVisible = false;
|
||||
that.getList();
|
||||
}).catch((err) => {
|
||||
return err;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
#mlogbwMain{
|
||||
position: relative;
|
||||
}
|
||||
.width-100{
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -2,20 +2,24 @@
|
|||
<el-container>
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="table_add2"
|
||||
v-auth="'mlog.create'"
|
||||
>快速报工</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="table_add"
|
||||
v-auth="'mlog.create'"
|
||||
>新增</el-button
|
||||
>
|
||||
>新增</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="table_rework"
|
||||
v-auth="'mlog.create'"
|
||||
>返工</el-button
|
||||
>
|
||||
>返工</el-button>
|
||||
</div>
|
||||
|
||||
<div class="right-panel">
|
||||
|
|
@ -194,6 +198,18 @@
|
|||
@closed="dialog.save = false"
|
||||
>
|
||||
</save-dialog>
|
||||
<saves-dialog
|
||||
v-if="dialog.save2"
|
||||
ref="saveDialog2"
|
||||
:process="process"
|
||||
:mgroup="mgroupId"
|
||||
:dept="deptId"
|
||||
:mgroupName = "mgroupName"
|
||||
:mgroupMtype="mgroupMtype"
|
||||
@success="handleSaveSuccess"
|
||||
@closed="dialog.save2 = false"
|
||||
>
|
||||
</saves-dialog>
|
||||
<detail-drawer
|
||||
v-if="dialog.detail"
|
||||
ref="detailDialog"
|
||||
|
|
@ -217,6 +233,7 @@
|
|||
</template>
|
||||
<script>
|
||||
import saveDialog from "./mlog_form.vue";
|
||||
import savesDialog from "./mlog_form2.vue";
|
||||
import detailDrawer from "./mlog_detail.vue";
|
||||
import monitorDrawer from "./monitor_detail.vue";
|
||||
|
||||
|
|
@ -255,7 +272,8 @@ export default {
|
|||
components: {
|
||||
saveDialog,
|
||||
detailDrawer,
|
||||
monitorDrawer
|
||||
monitorDrawer,
|
||||
savesDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -266,6 +284,7 @@ export default {
|
|||
query: {submit_time__isnull:true},
|
||||
dialog: {
|
||||
save: false,
|
||||
save2: false,
|
||||
detail: false,
|
||||
monitor:false,
|
||||
},
|
||||
|
|
@ -356,6 +375,13 @@ export default {
|
|||
this.$refs.saveDialog.open("add");
|
||||
});
|
||||
},
|
||||
//添加日志
|
||||
table_add2() {
|
||||
this.dialog.save2 = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog2.open("add");
|
||||
});
|
||||
},
|
||||
table_rework(){
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue