needCheckForm

This commit is contained in:
shijing 2021-12-06 13:18:20 +08:00
parent 269ce6b9bc
commit 7555ef9dba
2 changed files with 530 additions and 517 deletions

View File

@ -19,7 +19,7 @@
<el-input
v-model="checkForm[item.field_key]"
placeholder="请输入"
@input="keyChange(item.field_key)"
@input="keyChange($index,item.field_key)"
/>
</el-form-item>
<el-form-item
@ -30,7 +30,7 @@
v-model="checkForm[item.field_key]"
type="number"
placeholder="请输入"
@input="keyChange(item.field_key)"
@input="keyChange($index,item.field_key)"
/>
</el-form-item>
<el-form-item
@ -41,7 +41,7 @@
v-model="checkForm[item.field_key]"
type="number"
placeholder="请输入"
@input="keyChange(item.field_key)"
@input="keyChange($index,item.field_key)"
/>
</el-form-item>
<el-form-item
@ -54,7 +54,7 @@
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width: 100%"
@change="keyChange(item.field_key)"
@change="keyChange($index,item.field_key)"
/>
<!--</el-date-picker>-->
</el-form-item>
@ -68,7 +68,7 @@
placeholder="选择日期"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
@change="keyChange(item.field_key)"
@change="keyChange($index,item.field_key)"
/>
<!--</el-date-picker>-->
</el-form-item>
@ -80,7 +80,7 @@
v-model="checkForm[item.field_key]"
style="width: 100%"
placeholder="请选择"
@change="keyChange(item.field_key)"
@change="keyChange($index,item.field_key)"
>
<el-option
v-for="item1 in item.field_choice"
@ -100,12 +100,14 @@
style="width: 100%"
multiple
placeholder="请选择"
@change="keyChange($index,item.field_key)"
>
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
@change="keyChange($index,item.field_key)"
>
</el-option>
</el-select>
@ -135,11 +137,22 @@
</div>
</el-form-item>
</el-row>
<div style="text-align: right">
<el-button type="primary" @click="judgeForm">
合格验证
</el-button>
</div>
<el-row>
<el-form-item label="是否合格">
<!--<el-radio-group v-model="is_testok">
<el-radio :label="testokTrue">检查合格</el-radio>
<el-radio :label="testokFalse">检查不合格</el-radio>
</el-radio-group>-->
<el-radio v-model="is_testok" :label="testokTrue">检查合格</el-radio>
<el-radio v-model="is_testok" :label="testokFalse">检查不合格</el-radio>
</el-form-item>
<div class="dialog-footer" style="text-align: right">
<el-button @click="innerVisible = false"> </el-button>
<el-button type="primary" @click="submitfield">提交检查项目</el-button>
</div>
</el-row>
</el-form>
</div>
</template>
@ -159,6 +172,10 @@
type:Number,
default:0
},
wproduct: {
type:Number,
default:0
},
hasPicture:{
type:Boolean,
default:false
@ -167,24 +184,28 @@
mounted() {
let that = this;
this.form = this.formID;
// debugger;
// console.log(this.results);
this.formData=this.results;
this.formData=[...this.formData];
let formData=this.results;
that.wproductId=this.wproduct;
formData.forEach(item => {
let obj = new Object();
obj = item;
obj.is_testok = true;//是否合格
that.formData.push(obj)
});
that.formData=[...that.formData];
for(let i=0;i<this.results.length;i++){
let key = this.results[i].field_key;
//checkForm接收表单数据的对象
that.checkForm[key]='';
that.$set(that.checkForm,key,'')
}
// debugger;
// console.log(that.checkForm);
let listJudge = this.formData.filter(item => {
return item.need_judge === true;
});
listJudge.forEach(item => {
let obj = new Object();
obj = item;
obj.judge = false;
that.judgeList.push(obj)
});
setTimeout(function(){
@ -193,8 +214,16 @@
},
data(){
return{
field:[],
checkForm:{},
testrecord:{
form:this.formID,
record_data:[],
is_testok:true,
wproduct:null,
},
canvas:null,
wproductId:null,
ctx:null,
myCanvas_rect:null,
Txt:null,
@ -207,6 +236,9 @@
canvasImg:'',
formData:[],//表单数组
judgeList:[],//判定数组
is_testok:true,
testokTrue:true,
testokFalse:false,
}
},
methods:{
@ -276,15 +308,63 @@
return true;
}
},
keyChange(key){
key;
this.$forceUpdate();
/* debugger;
let y = this.checkForm[key];
this.$set(this.checkForm,key,y);*/
// this.filterBlock();
keyChange(index,key){
let that = this;
let reg = /\{(.+?)\}/g;
that.$forceUpdate();
that.$nextTick(()=>{
if(that.formData[index].need_judge===true){
let arr = [],str = '';
let item = that.formData[index].rule_expression.replace(/`/g,'');
if(item.indexOf('||')>-1){
arr = item.split('||');
}else if(item.indexOf('&&')>-1){
arr = item.split('&&');
}else{
arr.push(item);
}
//对每个条件进行判定如果符合
for (let i = 0;i<arr.length;i++){
//获取判断依据
let a = '`'+ arr[i]+'`';
let tem =a.match(reg)[0];
let ky = tem.replace(/\{|\}/g, '');//qipao
//有值时进行判断
if(that.checkForm[ky]!==''&&that.checkForm[ky]!==null&&that.checkForm[ky]!==undefined){
//替换变量
a = a.replace(ky, 'yyy');
let yyy = "'"+that.checkForm[ky]+"'";
if(eval(eval( a))){
str += 'true';
}else{
str += 'false';
}
}
}
if(item.indexOf('&&')>-1){
if(str.indexOf('false')>-1){
that.formData[index].is_testok = true;
}else{
that.formData[index].is_testok = false;
}
}else{
if(str.indexOf('true')>-1){
that.formData[index].is_testok = false;
}else{
that.formData[index].is_testok = true;
}
}
}else{
that.formData[index].is_testok = true;
}
that.judgeList = that.formData.filter(item => {
return item.need_judge === true;
});
that.judgeForm();
})
},
/* base64ToFile */
/* 图片保存 */
//初始化canvas
canvasInit(){
let that = this;
preDrawAry = [];
@ -299,6 +379,7 @@
that.draw();
},500);
},
//画布添加背景模板图
draw(){
let canvasImg = document.getElementById("canvasImg");
canvasImg.style.width = '500px';
@ -360,7 +441,6 @@
}
}
},
// 文字
word1(){
let canvas3 = document.getElementById('canvas');
@ -462,6 +542,7 @@
// console.log(res);
})
},
//base64ToFile
base64ToFile(baseUrl) {
let arr = baseUrl.split(',');
// let type = arr[0].match(/:(.*?);/)[1]; // 解锁图片类型
@ -474,7 +555,8 @@
// let fileOfBlob = new File([bufferArray], new Date()+'.jpg');
return new File([bufferArray ],'draw.jpg');
},
/* base64ToFile */
/* 图片保存 */
//最终表格判定
judgeForm(){
let that = this ,
reg = /\{(.+?)\}/g,
@ -508,21 +590,56 @@
}
}
}
if(str.indexOf('true')>-1){
that.judgeList[i].judge = true;
if(item.indexOf('&&')>-1){
if(str.indexOf('false')>-1){
that.judgeList[i].is_testok = true;
}else{
that.judgeList[i].is_testok = false;
}
}else{
that.judgeList[i].judge = false;
if(str.indexOf('true')>-1){
that.judgeList[i].is_testok = false;
}else{
that.judgeList[i].is_testok = true;
}
}
}
let real = that.judgeList.filter(item=>{
return item.judge==true;
return item.is_testok===false;
});
if(real.length>0){
that.is_testok = false;
alert("检验不合格!")
}else{
that.is_testok = true;
alert("检验合格!")
}
},
//提交检查项目
submitfield() {
let that = this;
debugger;
console.log(that.checkForm);
debugger;
that.field = []; //检查项目
that.formData.forEach((item) => {
debugger;
console.log(that.checkForm[item.field_key]);
debugger;
that.field.push({
form_field: item.id,
field_value: that.checkForm[item.field_key],
is_testok: item.is_testok//单项检查结果
});
});
console.log(that.field);
debugger;
that.testrecord.form = that.formID;//检查表
that.testrecord.record_data = that.field;//检查项列表
that.testrecord.is_testok = that.is_testok;//检查表检查结果
that.testrecord.wproduct = that.wproductId;//半成品ID
this.$emit('formFunc',that.testrecord);
},
}
}
</script>

View File

@ -1,152 +1,155 @@
<template>
<div class="app-container">
<el-tabs type="border-card">
<el-tab-pane label="待检半成品">
<el-card style="margin-top: 2px">
<el-table
v-loading="listLoading"
:data="wproductList.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-tab-pane label="待检半成品">
<el-card style="margin-top: 2px">
<el-table
v-loading="listLoading"
:data="wproductList.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50"/>
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="半成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="检测状态">
<template slot-scope="scope">
{{ actstate_[scope.row.act_state] }}
</template>
</el-table-column>
<el-table-column label="半成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="检测状态">
<template slot-scope="scope">
{{ actstate_[scope.row.act_state] }}
</template>
</el-table-column>
<el-table-column label="所在子工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column label="所在子工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleInspection(scope)"
>检验</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="wproductList.count > 0"
:total="wproductList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
</el-tab-pane>
<el-tab-pane label="复检半成品">
<el-card style="margin-top: 2px">
<el-table
v-loading="listLoading"
:data="wproductList2.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleInspection(scope)"
>检验
</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="wproductList.count > 0"
:total="wproductList.count"
:page.sync="listQuery.page"
:limit.sync="listQuery.page_size"
@pagination="getList"
/>
</el-card>
</el-tab-pane>
<el-tab-pane label="复检半成品">
<el-card style="margin-top: 2px">
<el-table
v-loading="listLoading"
:data="wproductList2.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50"/>
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="半成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="检测状态">
<template slot-scope="scope">
{{ actstate_[scope.row.act_state] }}
</template>
</el-table-column>
<el-table-column label="半成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="检测状态">
<template slot-scope="scope">
{{ actstate_[scope.row.act_state] }}
</template>
</el-table-column>
<el-table-column label="所在子工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column label="所在子工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleInspection(scope)"
>检验</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="wproductList2.count > 0"
:total="wproductList2.count"
:page.sync="listQuery2.page"
:limit.sync="listQuery2.page_size"
@pagination="getList2"
/>
</el-card>
</el-tab-pane>
<el-tab-pane label="已合格半成品">
<el-card style="margin-top: 2px">
<el-table
v-loading="listLoading"
:data="wproductList1.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50" />
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handleInspection(scope)"
>检验
</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="wproductList2.count > 0"
:total="wproductList2.count"
:page.sync="listQuery2.page"
:limit.sync="listQuery2.page_size"
@pagination="getList2"
/>
</el-card>
</el-tab-pane>
<el-tab-pane label="已合格半成品">
<el-card style="margin-top: 2px">
<el-table
v-loading="listLoading"
:data="wproductList1.results"
border
fit
stripe
highlight-current-row
max-height="600"
>
<el-table-column type="index" width="50"/>
<el-table-column label="半成品名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column>
<el-table-column label="半成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="检测状态">
<template slot-scope="scope">
{{ actstate_[scope.row.act_state] }}
</template>
</el-table-column>
<el-table-column label="半成品编号">
<template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="检测状态">
<template slot-scope="scope">
{{ actstate_[scope.row.act_state] }}
</template>
</el-table-column>
<el-table-column label="所在子工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column label="所在子工序">
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
</el-table-column>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handlePutin(scope)"
>入库
</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="wproductList1.count > 0"
:total="wproductList1.count"
:page.sync="listQuery1.page"
:limit.sync="listQuery1.page_size"
@pagination="getList1"
/>
</el-card>
</el-tab-pane>
</el-tabs>
<el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['warehouse_update'])"
@click="handlePutin(scope)"
>入库</el-link
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="wproductList1.count > 0"
:total="wproductList1.count"
:page.sync="listQuery1.page"
:limit.sync="listQuery1.page_size"
@pagination="getList1"
/>
</el-card>
</el-tab-pane>
</el-tabs>
<el-dialog title="物料检查表" :close-on-click-modal="false" :visible.sync="outerVisible">
<el-select style="width: 100%" v-model="recordform" placeholder="请选择">
<el-option
@ -154,383 +157,276 @@
:key="item.id"
:label="item.name"
:value="item.id"
@change="recordformChange(item)"
@select="recordformChange(item)"
>
</el-option>
</el-select>
<el-dialog
width="50%"
title="检查项目"
:title="formName"
:visible.sync="innerVisible"
append-to-body
>
<el-form label-width="100px" label-position="right">
<el-row
:gutter="2"
v-for="(item, $index) in fieldList"
:key="$index"
>
<el-col :span="12">
<el-form-item
v-if="item.field_type === 'string'"
:label="item.field_name"
>
<el-input placeholder="请输入" v-model="item.sort" />
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'int'"
:label="item.field_name"
>
<el-input
width="120"
type="number"
placeholder="请输入"
v-model="item.sort"
/>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'float'"
:label="item.field_name"
>
<el-input
type="number"
placeholder="请输入"
v-model="item.sort"
/>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'date'"
:label="item.field_name"
>
<el-date-picker
v-model="item.create_time"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'datetime'"
:label="item.field_name"
>
<el-date-picker
v-model="item.create_time"
type="datetime"
placeholder="选择日期"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'select'"
:label="item.field_name"
>
<el-select
style="width: 100%"
v-model="item.sort"
placeholder="请选择"
>
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'selects'"
:label="item.field_name"
>
<el-select
style="width: 100%"
v-model="optio"
multiple
placeholder="请选择"
>
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="是否检验合格" width="50px">
<el-select
style="width: 100%"
v-model="item.is_testok"
placeholder="请选择"
>
<el-option
v-for="item in choice"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-form-item label="是否合格" prop="sort_str">
<el-radio v-model="is_testok" label="true">检查合格</el-radio>
<el-radio v-model="is_testok" label="false">检查不合格</el-radio>
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="innerVisible = false"> </el-button>
<el-button type="primary" @click="submitfield"
>提交检查项目</el-button
>
</div>
<customForm
:results="fieldList"
:hasPicture="hasPicture"
:formID="recordform"
:wproduct="wproduct"
@formFunc="formFunc"
/>
</el-dialog>
<div slot="footer" class="dialog-footer">
<el-button @click="outerVisible = false"> </el-button>
<el-button type="primary" @click="submitrecordform"
>填写检查项目</el-button
>
<el-button type="primary" @click="submitrecordform">填写检查项目</el-button>
</div>
</el-dialog>
<el-dialog title="半成品入库" :close-on-click-modal="false" :visible.sync="dialogFormVisible">
<el-form :model="form">
<el-form-item label="仓库" :label-width="formLabelWidth">
<el-select
style="width: 100%"
v-model="form.warehouse"
placeholder="请选择仓库"
>
<el-option
v-for="item in WarehouseData"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" :label-width="formLabelWidth">
<el-input v-model="form.remark" ></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="putin"> </el-button>
</div>
</el-dialog>
<el-form :model="form">
<!--<el-form-item label="仓库" :label-width="formLabelWidth">-->
<el-form-item label="仓库">
<el-select
style="width: 100%"
v-model="form.warehouse"
placeholder="请选择仓库"
>
<el-option
v-for="item in WarehouseData"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" >
<!--<el-form-item label="备注" :label-width="formLabelWidth">-->
<el-input v-model="form.remark"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="putin"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getwproductList ,wproductTest,wproductPutin} from "@/api/wpm";
import checkPermission from "@/utils/permission";
import { getWarehouseList } from "@/api/inm";
import { getMaterialList, getrecordformList, getrffieldList } from "@/api/mtm";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultetestitem = {};
export default {
components: { Pagination },
data() {
return {
testitem: defaultetestitem,
form:{},
wproductList: {
count: 0,
},
wproductList1: {
count: 0,
},
wproductList2: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
import customForm from '@/components/customForm/index';
import {getwproductList, wproductTest, wproductPutin} from "@/api/wpm";
import checkPermission from "@/utils/permission";
import {getWarehouseList} from "@/api/inm";
import {getMaterialList, getrecordformList, getrffieldList} from "@/api/mtm";
import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultetestitem = {};
export default {
components: {Pagination,customForm},
data() {
return {
wproduct:null,
testitem: defaultetestitem,
form: {},
wproductList: {
count: 0,
},
wproductList1: {
count: 0,
},
wproductList2: {
count: 0,
},
listQuery: {
page: 1,
page_size: 20,
},
listQuery1: {
page: 1,
page_size: 20,
},
listQuery2: {
page: 1,
page_size: 20,
},
actstate_: {
6: "待复检",
10: "生产中",
20: "待检验",
30: "已合格",
40: "库存中",
50: "不合格",
60: "待成品检验",
},
choice: [
{
value: true,
label: "合格",
page: 1,
page_size: 20,
},
{
value: false,
label: "不合格",
listQuery2: {
page: 1,
page_size: 20,
},
],
options: [],
listLoading: true,
fieldList: "",
is_testok: "true",
field: [],
recordformList: [],
recordform: "",
fifo_detail: "",
listQueryrecordform: {
page: 0,
},
outerVisible: false,
innerVisible: false,
dialogFormVisible:false,
testrecord: {},
WarehouseData:"",
};
},
computed: {},
watch: {},
created() {
this.getList();
this.getList2();
this.getList1();
this.getLists();
},
methods: {
checkPermission,
//待检半成品列表
getList() {
this.listLoading = true;
this.listQuery.act_state = 20;
getwproductList(this.listQuery).then((response) => {
if (response.data) {
this.wproductList = response.data;
}
this.listLoading = false;
});
actstate_: {
6: "待复检",
10: "生产中",
20: "待检验",
30: "已合格",
40: "库存中",
50: "不合格",
60: "待成品检验",
},
choice: [
{
value: true,
label: "合格",
},
{
value: false,
label: "不合格",
},
],
checkForm: {
hhh: '',
},
formName:'项目检查表',
options: [],
listLoading: true,
fieldList: "",
is_testok: "true",
field: [],
recordformList: [],
recordform: "",
fifo_detail: "",
listQueryrecordform: {
page: 0,
},
hasPicture: false,
outerVisible: false,
innerVisible: false,
dialogFormVisible: false,
testrecord: {},
WarehouseData: "",
};
},
//复检半成品列表
getList2() {
this.listQuery2.act_state = 6;
getwproductList(this.listQuery2).then((response) => {
if (response.data) {
this.wproductList2 = response.data;
}
});
computed: {},
watch: {},
created() {
this.getList();
this.getList2();
this.getList1();
// this.getLists();
},
//已合格半成品
getList1() {
this.listQuery1.act_state = 30;
getwproductList(this.listQuery1).then((response) => {
if (response.data) {
this.wproductList1 = response.data;
}
});
},
//仓库列表
getWarehouseLists(){
getWarehouseList({page:0}).then((response) => {
if (response.data) {
this.WarehouseData = response.data;
}
});
},
handleInspection(scope) {
//调该物料对应的检查表
this.outerVisible = true;
this.wproduct=scope.row.id;//半成品ID
this.wproductactstate=scope.row.act_state;//半成品状态
this.listQueryrecordform.material = scope.row.material;//
this.listQueryrecordform.type = 2;
this.recordform="";
getrecordformList(this.listQueryrecordform).then((response) => {
if (response.data) {
this.recordformList = response.data;
}
});
},
//根据选择的表渲染检查项目
submitrecordform() {
if (this.recordform != "") {
getrffieldList({ form: this.recordform, page: 0 }).then((response) => {
if (response.data) {
this.fieldList = response.data;
this.innerVisible = true;
methods: {
formFunc(value) {
wproductTest(value).then((res) => {
if (res.code >= 200) {
this.innerVisible = false;
this.outerVisible = false;
this.getList();
this.getList1();
this.getList2();
}
});
} else this.$message.error("请选择检查表!");
},
//提交检查项目
submitfield() {
let _this = this;
_this.field = []; //检查项目
this.fieldList.forEach((item) => {
_this.field.push({
form_field:item.id,
field_value:item.sort,
is_testok:item.is_testok//单项检查结果
},
checkPermission,
//待检半成品列表
getList() {
this.listLoading = true;
this.listQuery.act_state = 20;
getwproductList(this.listQuery).then((response) => {
if (response.data) {
this.wproductList = response.data;
}
this.listLoading = false;
});
});
},
//复检半成品列表
getList2() {
console.log(this.recordform);
this.testrecord.form = this.recordform;//检查表
this.testrecord.record_data = _this.field;//检查项列表
this.testrecord.is_testok = this.is_testok;//检查表检查结果
this.testrecord.wproduct = this.wproduct;//半成品ID
this.listQuery2.act_state = 6;
getwproductList(this.listQuery2).then((response) => {
if (response.data) {
this.wproductList2 = response.data;
}
wproductTest(this.testrecord).then((res) => {
if (res.code >= 200) {
this.innerVisible = false;
this.outerVisible = false;
this.getList();
this.getList1();
this.getList2();
}
});
});
},
//已合格半成品
getList1() {
this.listQuery1.act_state = 30;
getwproductList(this.listQuery1).then((response) => {
if (response.data) {
this.wproductList1 = response.data;
}
});
},
//仓库列表
getWarehouseLists() {
getWarehouseList({page: 0}).then((response) => {
if (response.data) {
this.WarehouseData = response.data;
}
});
},
handleInspection(scope) {
//调该物料对应的检查表
this.outerVisible = true;
this.wproduct = scope.row.id;//半成品ID
this.wproductactstate = scope.row.act_state;//半成品状态
this.listQueryrecordform.material = scope.row.material;//
this.listQueryrecordform.type = 2;
this.recordform = "";
getrecordformList(this.listQueryrecordform).then((response) => {
if (response.data) {
this.recordformList = response.data;
}
});
},
recordformChange(item){
let that = this;
let arr = this.recordformList.filter(item=>{
return item.id=that.recordform;
})
that.formName = arr[0].name;
},
//根据选择的表渲染检查项目
submitrecordform() {
let that = this;
if (that.recordform != "") {
getrffieldList({form: that.recordform, page: 1,page_size:100}).then((response) => {
if (response.data) {
that.hasPicture = false;
let fieldList = response.data.results;
that.fieldList = [...fieldList];
let arr = fieldList.filter(item => {
return item.field_type === 'draw'
});
that.judgeList = [];
let listJudge = fieldList.filter(item => {
return item.need_judge === true;
});
listJudge.forEach(item => {
let obj = new Object();
obj = item;
obj.judge = false;
that.judgeList.push(obj)
});
if (arr.length > 0) {
that.hasPicture = true;
}
for (let i = 0; i < fieldList.length; i++) {
let key = fieldList[i].field_key;
that.checkForm[key] = '';
that.$set(that.checkForm, key, '')
}
that.innerVisible = true;
}
});
} else that.$message.error("请选择检查表!");
},
//半成品入库
handlePutin(scope) {
this.dialogFormVisible = true;
this.getWarehouseLists();//仓库
this.id = scope.row.id;//半成品id
},
putin() {
wproductPutin(this.id, this.form).then((res) => {
if (res.code >= 200) {
this.$message.success("入库成功!");
this.dialogFormVisible = false;
this.getList1();
}
});
}
},
//半成品入库
handlePutin(scope){
this.dialogFormVisible=true;
this.getWarehouseLists();//仓库
this.id=scope.row.id;//半成品id
},
putin(){
wproductPutin(this.id,this.form).then((res) => {
if (res.code >= 200) {
this.$message.success("入库成功!");
this.dialogFormVisible=false;
this.getList1();
}
});
}
},
};
};
</script>