fix:玻纤原料入库检验
This commit is contained in:
parent
eff75a7c86
commit
397587bbeb
|
|
@ -0,0 +1,352 @@
|
|||
<template>
|
||||
<el-drawer
|
||||
v-model="visible"
|
||||
title="检验"
|
||||
:size="'90%'"
|
||||
destroy-on-close
|
||||
@closed="$emit('closed')"
|
||||
>
|
||||
<el-container v-loading="loading">
|
||||
<el-main style="padding: 0 20px 20px 20px">
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="formbw"
|
||||
:rules="rules"
|
||||
label-width="140px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="检验时间" prop="test_date">
|
||||
<el-date-picker
|
||||
v-model="formbw.test_date"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="检验员" prop="test_user">
|
||||
<el-select
|
||||
v-model="formbw.test_user"
|
||||
placeholder="检验员"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="formbw.note"> </el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 检测项 -->
|
||||
<el-row>
|
||||
<el-col>检测项</el-col>
|
||||
<el-col v-for="(item) in qct_testitems" :key="item.id" :md="12" :sm="24">
|
||||
<el-form-item :label="item.testitem_name">
|
||||
<el-input-number
|
||||
v-if="item.testitem_field_type=='input-number'"
|
||||
v-model="formbw[item.testitem_name]"
|
||||
:min="0"
|
||||
class="width-100"
|
||||
controls-position="right"
|
||||
@change="defectCountSun"
|
||||
>
|
||||
</el-input-number>
|
||||
<el-input-number
|
||||
v-if="item.testitem_field_type=='input-int'"
|
||||
v-model="formbw[item.testitem_name]"
|
||||
:min="0"
|
||||
class="width-100"
|
||||
controls-position="right"
|
||||
@change="defectCountSun"
|
||||
>
|
||||
</el-input-number>
|
||||
<el-input
|
||||
v-if="item.testitem_field_type=='input-text'"
|
||||
v-model="formbw[item.testitem_name]"
|
||||
class="width-100"
|
||||
@change="defectCountSun"
|
||||
>
|
||||
</el-input>
|
||||
<el-select
|
||||
v-if="item.testitem_field_type=='select-text'"
|
||||
v-model="formbw[item.testitem_name]"
|
||||
clearable
|
||||
class="width-100"
|
||||
@change="defectCountSun"
|
||||
>
|
||||
<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="formbw[item.testitem_name]"
|
||||
clearable
|
||||
multiple
|
||||
class="width-100"
|
||||
@change="defectCountSun"
|
||||
>
|
||||
<el-option
|
||||
v-for="item1 in item.testitem_choices"
|
||||
:key="item1"
|
||||
:label="item1"
|
||||
:value="item1"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 缺陷项 -->
|
||||
<el-row>
|
||||
<el-col>缺陷项</el-col>
|
||||
<el-col v-for="item in qct_defects" :key="item.id" :md="12" :sm="24">
|
||||
<el-form-item :label="item.defect_name">
|
||||
<el-switch v-model="formbw[item.defect_name]" style="--el-switch-on-color: #FF0000; --el-switch-off-color: green;"></el-switch>
|
||||
<span v-if="item.note!==null&&item.note!==''" style="font-size: 12px; color: #a9a7a7;">({{ item.note }})</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-main>
|
||||
<el-footer v-if="mode == 'add'">
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">提交</el-button>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</el-drawer>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
emits: ["success", "closed"],
|
||||
props: {
|
||||
material: { type: String, default: "" },
|
||||
mioitemw: { type: Object, default: () => {} },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
form: {
|
||||
weight_kgs: [],
|
||||
ftestitems: [],
|
||||
},
|
||||
rules: {
|
||||
test_date: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择检验日期",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
test_time: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择检验时间",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
test_user: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择检验人",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
},
|
||||
formbw:{
|
||||
number:'',
|
||||
note:'',
|
||||
mioitem:'',
|
||||
test_date:'',
|
||||
test_user:'',
|
||||
},
|
||||
project_code: null,
|
||||
mioItem: {},
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
userList: [],
|
||||
qct_testitems:[],
|
||||
qct_defects:[],
|
||||
qctId:'',
|
||||
mioitemwId:'',
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
qct_testitems: {
|
||||
handler() {
|
||||
// 初始化表单字段,确保每个字段都有默认值
|
||||
this.qct_testitems.forEach(item => {
|
||||
if (!(item.testitem_name in this.form)) {
|
||||
this.form[item.testitem_name] = ''
|
||||
}
|
||||
});
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
qct_defects: {
|
||||
handler() {
|
||||
this.qct_defects.forEach(item => {
|
||||
if (!(item.defect_name in this.form)) {
|
||||
this.form[item.defect_name] = false;
|
||||
// let str = item.rule_expression.replace(/`/g, '');
|
||||
// this.form[item.defect_name] = str.replace(/\${(.*?)}/g, 'this.form.\$1')?'是':'否';
|
||||
}
|
||||
});
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
let config_base = that.$TOOL.data.get("BASE_INFO").base;
|
||||
that.project_code = config_base.base_code;
|
||||
that.getUserList();
|
||||
that.mioitemwId = that.mioitemw.id;
|
||||
that.formbw.number = that.mioitemw.number;
|
||||
that.formbw.mioitem = that.mioitemw.mioitem;
|
||||
this.getQctDetail();
|
||||
},
|
||||
methods: {
|
||||
//显示
|
||||
open(mode = "add") {
|
||||
this.mode = mode;
|
||||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
//根据物料关联的检测表获取检测项和不合格项
|
||||
getQctDetail(){
|
||||
let that = this;
|
||||
that.$API.qm.qct.list.req({ qctmat__material: that.material,page:0 }).then((res) => {
|
||||
if(res.length>0){
|
||||
that.qctId = res[0].id;
|
||||
that.$API.qm.qct.item.req(that.qctId).then((res0) => {
|
||||
//这里可以得到testitem和defectitem
|
||||
that.qct_defects = [];
|
||||
that.qct_testitems = [];
|
||||
if(res0.qct_defects.length>0){
|
||||
res0.qct_defects.forEach((item1) => {
|
||||
let obj = Object.assign({}, item1);
|
||||
obj.value = '';
|
||||
that.qct_defects.push(obj);
|
||||
})
|
||||
}else{
|
||||
that.qct_defects = [];
|
||||
}
|
||||
if(res0.qct_testitems.length>0){
|
||||
res0.qct_testitems.forEach((item2) => {
|
||||
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);
|
||||
})
|
||||
}else{
|
||||
that.qct_testitems = [];
|
||||
}
|
||||
that.defectCountSun();
|
||||
})
|
||||
}
|
||||
});
|
||||
},
|
||||
//获取员工
|
||||
getUserList() {
|
||||
let that = this;
|
||||
this.$API.system.user.list
|
||||
.req({ page: 0, posts__code__contains: "check" })
|
||||
.then((res) => {
|
||||
that.userList = res;
|
||||
});
|
||||
},
|
||||
defectCountSun(){
|
||||
let that = this;
|
||||
that.qct_defects.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, 'this.formbw.\$1');
|
||||
let judge = eval(str);
|
||||
that.formbw[item.defect_name] = judge;
|
||||
}else{
|
||||
that.formbw[item.defect_name] = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
//提交
|
||||
submit() {
|
||||
let that = this;
|
||||
let ftestdefects = [],ftestitems = [];
|
||||
that.qct_testitems.forEach((item) => {
|
||||
let obj0 = {};
|
||||
obj0.testitem = item.testitem;
|
||||
obj0.test_user = that.formbw.test_user;
|
||||
obj0.testitem_name = item.testitem_name;
|
||||
obj0.test_val_json = that.formbw[item.testitem_name];
|
||||
ftestitems.push(obj0);
|
||||
})
|
||||
that.qct_defects.forEach((item1) => {
|
||||
let obj1 = {};
|
||||
obj1.defect = item1.defect;
|
||||
obj1.test_user = that.formbw.test_user;
|
||||
obj1.defect_name = item1.defect_name;
|
||||
obj1.has = that.formbw[item1.defect_name];
|
||||
ftestdefects.push(obj1);
|
||||
})
|
||||
that.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
that.isSaveing = true;
|
||||
let obj = {};
|
||||
obj.ftest = {};
|
||||
obj.note = that.formbw.note;
|
||||
obj.number = that.formbw.number;
|
||||
obj.mioitem = that.formbw.mioitem;
|
||||
obj.ftest.qct = that.qctId;
|
||||
obj.ftest.test_user = that.formbw.test_user;
|
||||
obj.ftest.test_date = that.formbw.test_date;
|
||||
obj.ftest.ftestitems = ftestitems;
|
||||
obj.ftest.ftestdefects = ftestdefects;
|
||||
that.$API.inm.mioitemw.update.req(that.mioitemwId,obj).then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success");
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
}).catch((err) => {
|
||||
that.isSaveing = false;
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//表单注入数据
|
||||
setData(data) {
|
||||
let that = this;
|
||||
Object.assign(that.formbw, data);
|
||||
data.ftestitems.forEach((item) => {
|
||||
that.formbw[item.testitem_name] = item.test_val_json;
|
||||
})
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.width-100{
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -751,159 +751,56 @@
|
|||
>
|
||||
<el-container v-loading="loading">
|
||||
<el-main style="padding: 0 20px 20px 20px">
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="140px"
|
||||
>
|
||||
<!-- 入厂检验 -->
|
||||
<el-row v-if="type == 'pur_in'">
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="产品名称:">
|
||||
{{ objitem.material_name }}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="入厂批次号:">
|
||||
{{ objitem.batch }}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="检验时间" prop="test_time">
|
||||
<el-date-picker
|
||||
v-model="form.test_time"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="检验员" prop="test_user">
|
||||
<el-select
|
||||
v-model="form.test_user"
|
||||
placeholder="检验员"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in userList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="检验合格" prop="is_testok">
|
||||
<el-select
|
||||
v-model="form.is_testok"
|
||||
placeholder="检验合格"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option label="是" :value="true" />
|
||||
<el-option label="否" :value="false" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="form.test_note"> </el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 检测项 -->
|
||||
<el-row>
|
||||
<el-col>检测项</el-col>
|
||||
<el-col v-for="(item) in qct_testitems" :key="item.id" :md="12" :sm="24">
|
||||
<el-form-item :label="item.testitem_name">
|
||||
<el-input-number
|
||||
v-if="item.testitem_field_type=='input-number'"
|
||||
v-model="form[item.testitem_name]"
|
||||
:min="0"
|
||||
class="width-100"
|
||||
controls-position="right"
|
||||
@change="defectCountSun"
|
||||
>
|
||||
</el-input-number>
|
||||
<el-input-number
|
||||
v-if="item.testitem_field_type=='input-int'"
|
||||
v-model="form[item.testitem_name]"
|
||||
:min="0"
|
||||
class="width-100"
|
||||
controls-position="right"
|
||||
@change="defectCountSun"
|
||||
>
|
||||
</el-input-number>
|
||||
<el-input
|
||||
v-if="item.testitem_field_type=='input-text'"
|
||||
v-model="form[item.testitem_name]"
|
||||
class="width-100"
|
||||
@change="defectCountSun"
|
||||
>
|
||||
</el-input>
|
||||
<el-select
|
||||
v-if="item.testitem_field_type=='select-text'"
|
||||
v-model="form[item.testitem_name]"
|
||||
clearable
|
||||
class="width-100"
|
||||
@change="defectCountSun"
|
||||
>
|
||||
<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="form[item.testitem_name]"
|
||||
clearable
|
||||
multiple
|
||||
class="width-100"
|
||||
@change="defectCountSun"
|
||||
>
|
||||
<el-option
|
||||
v-for="item1 in item.testitem_choices"
|
||||
:key="item1"
|
||||
:label="item1"
|
||||
:value="item1"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 缺陷项 -->
|
||||
<el-row>
|
||||
<el-col>缺陷项</el-col>
|
||||
<el-col v-for="item in qct_defects" :key="item.id" :md="12" :sm="24">
|
||||
<el-form-item :label="item.defect_name">
|
||||
<span v-if="form[item.defect_name]" style="background: red;width: 10px;height: 10px;border-radius: 5px;"></span>
|
||||
<span v-else style="background: green;width: 10px;height: 10px;border-radius: 5px;"></span>
|
||||
<!-- <el-input v-model="form[item.defect_name]" class="width-100"></el-input> -->
|
||||
<span v-if="item.note!==null&&item.note!==''" style="font-size: 12px; color: #a9a7a7;">({{ item.note }})</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<el-table :data="mioitemwList" border>
|
||||
<el-table-column label="物料编号" prop="number">
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="130">
|
||||
<template #default="scope">
|
||||
<el-button @click="changeCheckItem(scope.row)" type="text">检验</el-button>
|
||||
<el-button @click="changeCheckRecord(scope.row)" type="text">检验记录</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<scTable v-if="checkRecordShow" :data="recordList" row-key="id" height="300px" stripe>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="检验日期" prop="test_date"></el-table-column>
|
||||
<el-table-column label="检验人" prop="test_user_name"></el-table-column>
|
||||
<el-table-column label="是否合格" prop="is_ok">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.is_ok" type="success">合格</el-tag>
|
||||
<el-tag v-else type="warning">不合格</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" width="80">
|
||||
<template #default="scope">
|
||||
<el-button @click="checkFormDetail(scope.row)" type="text">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
<el-footer v-if="mode == 'add'">
|
||||
<!-- <el-footer v-if="mode == 'add'">
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">提交</el-button>
|
||||
<el-button @click="visibleDrawer = false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-footer> -->
|
||||
</el-container>
|
||||
</el-drawer>
|
||||
<checkform-dialog
|
||||
v-if="checkShow"
|
||||
ref="checkFormDialog"
|
||||
:material="objitem.material"
|
||||
:mioitemw="mioitemw"
|
||||
@success="checkFormSuccess"
|
||||
@closed="checkShow= false"
|
||||
>
|
||||
</checkform-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import checkformDialog from "./mioitemCheckForm.vue";
|
||||
export default {
|
||||
emits: ["success", "closed"],
|
||||
components: {
|
||||
checkformDialog
|
||||
},
|
||||
props: {
|
||||
mioitemId: { type: String, default: "" },
|
||||
type: { type: String, default: "" },
|
||||
|
|
@ -912,13 +809,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
addTemplate: {
|
||||
name: "",
|
||||
sort: "",
|
||||
user: "",
|
||||
post: "",
|
||||
dept: "",
|
||||
},
|
||||
tableData:[],
|
||||
loading: false,
|
||||
form: {
|
||||
weight_kgs: [],
|
||||
|
|
@ -947,12 +838,23 @@ export default {
|
|||
},
|
||||
],
|
||||
},
|
||||
formbw:{
|
||||
number:'',
|
||||
note:'',
|
||||
mioitem:'',
|
||||
test_date:'',
|
||||
test_user:'',
|
||||
},
|
||||
project_code: null,
|
||||
mioItem: {},
|
||||
weight_kgs: [{ value: 0 }],
|
||||
checkShow:false,
|
||||
checkShowsss:false,
|
||||
visible: false,
|
||||
visibleDrawer:false,
|
||||
isSaveing: false,
|
||||
checkRecordShow:false,
|
||||
recordList:[],
|
||||
userList: [],
|
||||
processOptions: [],
|
||||
deptOptions: [],
|
||||
|
|
@ -960,46 +862,21 @@ export default {
|
|||
setFiltersVisible: false,
|
||||
belong_dept_options: [],
|
||||
group: [],
|
||||
qct_testitems:[],
|
||||
qct_defects:[],
|
||||
mioitemwList:[],
|
||||
qctId:'',
|
||||
wproductId:'',
|
||||
mioitemwId:'',
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
qct_testitems: {
|
||||
handler() {
|
||||
// 初始化表单字段,确保每个字段都有默认值
|
||||
this.qct_testitems.forEach(item => {
|
||||
if (!(item.testitem_name in this.form)) {
|
||||
this.form[item.testitem_name] = ''
|
||||
}
|
||||
});
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
qct_defects: {
|
||||
handler() {
|
||||
this.qct_defects.forEach(item => {
|
||||
if (!(item.defect_name in this.form)) {
|
||||
this.form[item.defect_name] = false;
|
||||
// let str = item.rule_expression.replace(/`/g, '');
|
||||
// this.form[item.defect_name] = str.replace(/\${(.*?)}/g, 'this.form.\$1')?'是':'否';
|
||||
}
|
||||
});
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
let that = this;
|
||||
let config_base = that.$TOOL.data.get("BASE_INFO").base;
|
||||
that.project_code = config_base.base_code;
|
||||
that.getUserList();
|
||||
if(that.project_code=='bxerp'){
|
||||
that.wproductId = that.objitem.mioitemw[0].wpr;
|
||||
// that.wproductId = that.objitem.wproducts[0].id;
|
||||
this.getQctDetail();
|
||||
that.mioitemwId = that.objitem.mioitemw[0].id;
|
||||
that.formbw.number = that.objitem.mioitemw[0].number;
|
||||
that.formbw.mioitem = that.objitem.mioitemw[0].mioitem;
|
||||
this.getMioitemw();
|
||||
}else{
|
||||
if (that.type == "pur_in") {
|
||||
console.log("objitem", that.objitem);
|
||||
|
|
@ -1066,42 +943,37 @@ export default {
|
|||
}
|
||||
return this;
|
||||
},
|
||||
//根据物料关联的检测表获取检测项和不合格项
|
||||
getQctDetail(){
|
||||
changeCheckItem(row){
|
||||
let that = this;
|
||||
that.$API.qm.qct.list.req({ qctmat__material: that.objitem.material,page:0 }).then((res) => {
|
||||
if(res.length>0){
|
||||
that.qctId = res[0].id;
|
||||
that.$API.qm.qct.item.req(that.qctId).then((res0) => {
|
||||
//这里可以得到testitem和defectitem
|
||||
that.qct_defects = [];
|
||||
that.qct_testitems = [];
|
||||
if(res0.qct_defects.length>0){
|
||||
res0.qct_defects.forEach((item1) => {
|
||||
let obj = Object.assign({}, item1);
|
||||
obj.value = '';
|
||||
that.qct_defects.push(obj);
|
||||
})
|
||||
}else{
|
||||
that.qct_defects = [];
|
||||
}
|
||||
if(res0.qct_testitems.length>0){
|
||||
res0.qct_testitems.forEach((item2) => {
|
||||
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);
|
||||
})
|
||||
}else{
|
||||
that.qct_testitems = [];
|
||||
}
|
||||
that.defectCountSun();
|
||||
})
|
||||
}
|
||||
that.mioitemw = row;
|
||||
that.checkShow = true;
|
||||
console.log("row",row);
|
||||
console.log("checkFormDialog");
|
||||
that.$nextTick(() => {
|
||||
that.$refs.checkFormDialog.open("add");
|
||||
})
|
||||
},
|
||||
checkFormDetail(row){
|
||||
let that = this;
|
||||
that.mioitemw = row;
|
||||
that.checkShow = true;
|
||||
that.$nextTick(() => {
|
||||
that.$refs.checkFormDialog.open("show").setData(row);
|
||||
})
|
||||
},
|
||||
changeCheckRecord(row){
|
||||
let that = this;
|
||||
this.mioitemwWpr = row.wpr;
|
||||
that.$API.qm.ftest.list.req({ mioitemw_ftest__wpr: row.wpr,page:0 }).then((res) => {
|
||||
that.recordList = res;
|
||||
})
|
||||
that.checkShow = false;
|
||||
that.checkRecordShow = true;
|
||||
},
|
||||
getMioitemw(){
|
||||
let that = this;
|
||||
that.$API.inm.mioitemw.list.req({ mioitem: that.mioitemId,page:0 }).then((res) => {
|
||||
that.mioitemwList = res;
|
||||
});
|
||||
},
|
||||
//获取员工
|
||||
|
|
@ -1121,18 +993,6 @@ export default {
|
|||
this.weight_kgs.splice(index, 1);
|
||||
this.form.count_sampling = this.weight_kgs.length;
|
||||
},
|
||||
defectCountSun(){
|
||||
let that = this;
|
||||
that.qct_defects.forEach(item => {
|
||||
console.log(item.defect_name,':',item.rule_expression);
|
||||
let str = item.rule_expression.replace(/`/g, '');
|
||||
str = str.replace(/\${(.*?)}/g, 'this.form.\$1')
|
||||
console.log(item.defect_name,':',str);
|
||||
let judge = eval(str);
|
||||
console.log(item.defect_name,':',judge);
|
||||
that.form[item.defect_name] = judge;
|
||||
});
|
||||
},
|
||||
countSun() {
|
||||
let that = this;
|
||||
let sum = 0;
|
||||
|
|
@ -1195,125 +1055,88 @@ export default {
|
|||
//提交
|
||||
submit() {
|
||||
let that = this;
|
||||
if(that.project_code=='bxerp'){
|
||||
let defect_json = [],test_json = {};
|
||||
that.qct_testitems.forEach((item) => {
|
||||
let val = that.form[item.testitem_name];
|
||||
let obj0 = {};
|
||||
obj0.testitem_name = item.testitem_name;
|
||||
obj0.val = val;
|
||||
test_json[item.id] =obj0;
|
||||
})
|
||||
that.qct_defects.forEach((item) => {
|
||||
if(that.form[item.defect_name]){
|
||||
defect_json.push(item.id);
|
||||
}
|
||||
})
|
||||
that.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
that.isSaveing = true;
|
||||
let obj = {};
|
||||
obj.test_user = that.form.test_user;
|
||||
obj.test_time = that.form.test_time;
|
||||
obj.is_testok = that.form.is_testok;
|
||||
obj.qct = that.qctId;
|
||||
obj.note = that.form.test_note;
|
||||
obj.test_json = test_json;//
|
||||
obj.defect_json = defect_json;//defect为true的id数组
|
||||
that.$API.inm.mioitem.wtest.req(that.wproductId,obj).then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success");
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
}).catch((err) => {
|
||||
that.isSaveing = false;
|
||||
})
|
||||
}
|
||||
})
|
||||
}else{
|
||||
if (
|
||||
(that.type == "do_in" && that.cate == "halfgood") ||
|
||||
that.type == "other_in"
|
||||
) {
|
||||
this.form.count_notok =
|
||||
this.form.count_n_zw +
|
||||
this.form.count_n_tw +
|
||||
this.form.count_n_qp +
|
||||
this.form.count_n_wq +
|
||||
this.form.count_n_dl +
|
||||
this.form.count_n_pb +
|
||||
this.form.count_n_dxt +
|
||||
this.form.count_n_js +
|
||||
this.form.count_n_qx +
|
||||
this.form.count_n_hs +
|
||||
this.form.count_n_ysq +
|
||||
this.form.count_n_zz +
|
||||
this.form.count_n_b +
|
||||
this.form.count_n_qt;
|
||||
}
|
||||
if (that.type == "do_in" && that.cate == "good") {
|
||||
this.form.count_notok =
|
||||
this.form.count_n_hs +
|
||||
this.form.count_n_cs +
|
||||
this.form.count_n_zz +
|
||||
this.form.count_n_tw +
|
||||
this.form.count_n_d +
|
||||
this.form.count_n_zdd +
|
||||
this.form.count_n_zw +
|
||||
this.form.count_n_dl +
|
||||
//棒
|
||||
this.form.count_n_qp +
|
||||
this.form.count_n_bl +
|
||||
this.form.count_n_hw +
|
||||
this.form.count_n_yp +
|
||||
this.form.count_n_bp +
|
||||
this.form.count_n_sc +
|
||||
//管
|
||||
this.form.count_n_qx +
|
||||
this.form.count_n_js +
|
||||
this.form.count_n_tydd +
|
||||
this.form.count_n_sw +
|
||||
this.form.count_n_bhpcd +
|
||||
this.form.count_n_wq;
|
||||
}
|
||||
that.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
that.isSaveing = true;
|
||||
try {
|
||||
if (that.type == "pur_in") {
|
||||
console.log(that.form);
|
||||
let arr = [];
|
||||
that.weight_kgs.forEach((item) => {
|
||||
arr.push(item.value);
|
||||
});
|
||||
that.form.weight_kgs = arr;
|
||||
console.log('that.form',that.form);
|
||||
that.$API.inm.mioitem.testpurin
|
||||
.req(that.mioitemId, that.form)
|
||||
.then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success");
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
});
|
||||
} else {
|
||||
that.$API.inm.mioitem.test
|
||||
.req(that.mioitemId, that.form)
|
||||
.then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success");
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
//可以处理校验错误
|
||||
this.isSaveing = false;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (
|
||||
(that.type == "do_in" && that.cate == "halfgood") ||
|
||||
that.type == "other_in"
|
||||
) {
|
||||
this.form.count_notok =
|
||||
this.form.count_n_zw +
|
||||
this.form.count_n_tw +
|
||||
this.form.count_n_qp +
|
||||
this.form.count_n_wq +
|
||||
this.form.count_n_dl +
|
||||
this.form.count_n_pb +
|
||||
this.form.count_n_dxt +
|
||||
this.form.count_n_js +
|
||||
this.form.count_n_qx +
|
||||
this.form.count_n_hs +
|
||||
this.form.count_n_ysq +
|
||||
this.form.count_n_zz +
|
||||
this.form.count_n_b +
|
||||
this.form.count_n_qt;
|
||||
}
|
||||
if (that.type == "do_in" && that.cate == "good") {
|
||||
this.form.count_notok =
|
||||
this.form.count_n_hs +
|
||||
this.form.count_n_cs +
|
||||
this.form.count_n_zz +
|
||||
this.form.count_n_tw +
|
||||
this.form.count_n_d +
|
||||
this.form.count_n_zdd +
|
||||
this.form.count_n_zw +
|
||||
this.form.count_n_dl +
|
||||
//棒
|
||||
this.form.count_n_qp +
|
||||
this.form.count_n_bl +
|
||||
this.form.count_n_hw +
|
||||
this.form.count_n_yp +
|
||||
this.form.count_n_bp +
|
||||
this.form.count_n_sc +
|
||||
//管
|
||||
this.form.count_n_qx +
|
||||
this.form.count_n_js +
|
||||
this.form.count_n_tydd +
|
||||
this.form.count_n_sw +
|
||||
this.form.count_n_bhpcd +
|
||||
this.form.count_n_wq;
|
||||
}
|
||||
that.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
that.isSaveing = true;
|
||||
try {
|
||||
if (that.type == "pur_in") {
|
||||
console.log(that.form);
|
||||
let arr = [];
|
||||
that.weight_kgs.forEach((item) => {
|
||||
arr.push(item.value);
|
||||
});
|
||||
that.form.weight_kgs = arr;
|
||||
console.log('that.form',that.form);
|
||||
that.$API.inm.mioitem.testpurin
|
||||
.req(that.mioitemId, that.form)
|
||||
.then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success");
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
});
|
||||
} else {
|
||||
that.$API.inm.mioitem.test
|
||||
.req(that.mioitemId, that.form)
|
||||
.then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success");
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
//可以处理校验错误
|
||||
this.isSaveing = false;
|
||||
return err;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
//表单注入数据
|
||||
setData(data) {
|
||||
|
|
@ -1334,6 +1157,7 @@ export default {
|
|||
(sum / data.weight_kgs.length) * data.count_bag;
|
||||
}
|
||||
},
|
||||
checkFormSuccess(){},
|
||||
//设置过滤项
|
||||
setFilters(filters) {
|
||||
this.selectionFilters = filters;
|
||||
|
|
|
|||
Loading…
Reference in New Issue