testRecordandshowgantt

This commit is contained in:
shijing 2021-12-16 23:37:32 +08:00
parent bab19a707d
commit 3a6c31ea77
7 changed files with 274 additions and 208 deletions

View File

@ -283,13 +283,13 @@ export function createOutputs(data) {
export function recordInit(id) { export function recordInit(id) {
return request({ return request({
url: `/wpm/operation_record/${id}/init/`, url: `/wpm/operation_record/${id}/`,
method: 'GET', method: 'GET',
}) })
} }
//半产品复检 //testInit
export function wproductReview(data) { export function testInit(data) {
return request({ return request({
url: '/wpm/wproduct/test_init/', url: '/wpm/wproduct/test_init/',
method: 'post', method: 'post',

View File

@ -155,9 +155,9 @@
<el-radio v-model="is_testok" :label="testokFalse">检查不合格</el-radio> <el-radio v-model="is_testok" :label="testokFalse">检查不合格</el-radio>
</el-form-item> </el-form-item>
<div class="dialog-footer" style="text-align: right"> <div class="dialog-footer" style="text-align: right">
<el-button @click="innerVisible = false"> </el-button> <el-button @click="recordCancel"> </el-button>
<el-button type="primary" @click="submitfield('1')">保存</el-button> <el-button type="primary" @click="submitfield('1')">保存</el-button>
<el-button type="primary" @click="submitfield('2')">提交</el-button> <el-button type="warning" @click="submitfield('2')">提交</el-button>
</div> </div>
</el-row> </el-row>
@ -188,21 +188,12 @@
type:Number, type:Number,
default:null default:null
}, },
origin_test: {
type:Number,
default:null
},
hasPicture:{ hasPicture:{
type:Boolean, type:Boolean,
default:false default:false
},
recordItem:{
type:Boolean,
default:false
} }
}, },
mounted() { mounted() {
debugger;
let that = this; let that = this;
that.checkForm = {}; that.checkForm = {};
this.form = this.formID; this.form = this.formID;
@ -214,7 +205,6 @@
that.formData.push(obj) that.formData.push(obj)
}); });
that.formData=[...formData]; that.formData=[...formData];
debugger;
for(let i=0;i<this.results.length;i++){ for(let i=0;i<this.results.length;i++){
let key = this.results[i].field_key; let key = this.results[i].field_key;
//checkForm接收表单数据的对象 //checkForm接收表单数据的对象
@ -280,9 +270,10 @@
}, },
methods:{ methods:{
filterBlock(parent,rule,index,field_key){ filterBlock(parent,rule,index,field_key){
// debugger; debugger;
let that = this; let that = this;
if(parent!==''&&parent!==null&&parent!==undefined){ if(parent!==''&&parent!==null&&parent!==undefined){
debugger;
if(rule!==''&&rule!==null&&rule!==undefined){ if(rule!==''&&rule!==null&&rule!==undefined){
let reg = /\{(.+?)\}/g; let reg = /\{(.+?)\}/g;
//let str = rule.replace(temp,'').replace('$','');//=='' //let str = rule.replace(temp,'').replace('$','');//==''
@ -706,47 +697,28 @@
let that = this; let that = this;
that.field = []; //检查项目 that.field = []; //检查项目
let submit = isSubmit=='1'?false:true; let submit = isSubmit=='1'?false:true;
if(that.recordItem){//有记录 that.formData.forEach((item) => {
that.formData.forEach((item) => { if(!item.is_hidden){
if(!item.is_hidden){ that.field.push({
that.field.push({ id: item.id,
id: item.id, field_value: that.checkForm[item.field_key],
field_value: that.checkForm[item.field_key], is_testok: item.is_testok,//单项检查结果
is_testok: item.is_testok,//单项检查结果 is_hidden: item.is_hidden
is_hidden: item.is_hidden });
});
}
});
that.testrecord.record_data = that.field;//检查项列表
that.testrecord.is_testok = that.is_testok;//检查表检查结果
that.testrecord.id = that.recordId;//记录id
if(submit){//提交
this.$emit('recordSubmit',that.testrecord);
}else {//保存
this.$emit('recordSave',that.testrecord);
} }
}else{//第一次操作时 });
that.formData.forEach((item) => { that.testrecord.record_data = that.field;//检查项列表
if(!item.is_hidden){ that.testrecord.is_testok = that.is_testok;//检查表检查结果
that.field.push({ that.testrecord.id = that.recordId;//记录id
form_field: item.id, if(submit){//提交
field_value: that.checkForm[item.field_key], this.$emit('recordSubmit',that.testrecord);
is_testok: item.is_testok,//单项检查结果 }else {//保存
is_hidden: item.is_hidden this.$emit('recordSave',that.testrecord);
});
}
});
if(that.origin_test!==null){
that.testrecord.origin_test = that.origin_test;
}
that.testrecord.record_data = that.field;//检查项列表
that.testrecord.is_testok = that.is_testok;//检查表检查结果
that.testrecord.form = that.formID;//检查表
that.testrecord.wproduct = that.wproductId;//半成品ID
that.testrecord.is_submited = submit;//提交状态false保存
this.$emit('formFunc',that.testrecord);//第一次保存或提交
} }
}, },
recordCancel(){
this.$emit('recordCancel','')
},
} }
} }
</script> </script>

View File

@ -9,7 +9,7 @@
<el-row> <el-row>
<el-col <el-col
v-for="(item, $index) in formData" v-for="(item, $index) in formData"
v-show="filterBlock(item.parent,item.display_expression)" v-show="filterBlock(item.parent,item.display_expression,$index,item.field_key)"
:key="$index" :key="$index"
:span="12" :span="12"
style="position: relative" style="position: relative"
@ -22,7 +22,7 @@
<el-input <el-input
disabled disabled
class="halfWidth originBlock" class="halfWidth originBlock"
v-model="originForm[item.field_key]" v-model="item.origin_value"
placeholder="请输入" placeholder="请输入"
@input="keyChange($index,item.field_key)" @input="keyChange($index,item.field_key)"
/> />
@ -40,7 +40,7 @@
<el-input <el-input
disabled disabled
class="halfWidth originBlock" class="halfWidth originBlock"
v-model="originForm[item.field_key]" v-model="item.origin_value"
type="number" type="number"
placeholder="请输入" placeholder="请输入"
@input="keyChange($index,item.field_key)" @input="keyChange($index,item.field_key)"
@ -60,7 +60,7 @@
<el-input <el-input
disabled disabled
class="halfWidth originBlock" class="halfWidth originBlock"
v-model="originForm[item.field_key]" v-model="item.origin_value"
type="number" type="number"
placeholder="请输入" placeholder="请输入"
@input="keyChange($index,item.field_key)" @input="keyChange($index,item.field_key)"
@ -79,7 +79,7 @@
> >
<el-date-picker <el-date-picker
disabled disabled
v-model="originForm[item.field_key]" v-model="item.origin_value"
class="halfWidth originBlock" class="halfWidth originBlock"
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
@ -101,7 +101,7 @@
> >
<el-date-picker <el-date-picker
disabled disabled
v-model="originForm[item.field_key]" v-model="item.origin_value"
class="halfWidth originBlock" class="halfWidth originBlock"
type="datetime" type="datetime"
placeholder="选择日期" placeholder="选择日期"
@ -123,7 +123,7 @@
> >
<el-select <el-select
disabled disabled
v-model="originForm[item.field_key]" v-model="item.origin_value"
class="halfWidth originBlock" class="halfWidth originBlock"
placeholder="请选择" placeholder="请选择"
@change="keyChange($index,item.field_key)" @change="keyChange($index,item.field_key)"
@ -155,7 +155,7 @@
> >
<el-select <el-select
disabled disabled
v-model="originForm[item.field_key]" v-model="item.origin_value"
class="halfWidth originBlock" class="halfWidth originBlock"
multiple multiple
placeholder="请选择" placeholder="请选择"
@ -225,8 +225,10 @@
<el-radio v-model="is_testok" :label="testokFalse">检查不合格</el-radio> <el-radio v-model="is_testok" :label="testokFalse">检查不合格</el-radio>
</el-form-item> </el-form-item>
<div class="dialog-footer" style="text-align: right"> <div class="dialog-footer" style="text-align: right">
<el-button @click="innerVisible = false"> </el-button> <el-button @click="recordCancel"> </el-button>
<el-button type="primary" @click="submitfield">提交检查项目</el-button> <!--<el-button type="primary" @click="submitfield">提交检查项目</el-button>-->
<el-button type="primary" @click="submitfield('1')">保存</el-button>
<el-button type="warning" @click="submitfield('2')">提交</el-button>
</div> </div>
</el-row> </el-row>
</el-form> </el-form>
@ -257,7 +259,7 @@
type:Number, type:Number,
default:0 default:0
}, },
origintest: { recordId: {
type:Number, type:Number,
default:0 default:0
}, },
@ -268,9 +270,9 @@
}, },
mounted() { mounted() {
let that = this; let that = this;
this.form = this.formID; that.form = this.formID;
let formData=this.results; let formData=this.results;
this.origins=this.originList; // that.origins=this.originList;
that.wproductId=this.wproduct; that.wproductId=this.wproduct;
that.origin_test=this.origintest; that.origin_test=this.origintest;
formData.forEach(item => { formData.forEach(item => {
@ -297,11 +299,11 @@
that.judgeList.push(obj) that.judgeList.push(obj)
}); });
//原始表的数据 //原始表的数据
for(let i=0;i<this.origins.length;i++){ /*for(let i=0;i<this.origins.length;i++){
let key = this.origins[i].field_key; let key = this.origins[i].field_key;
that.originForm[key]=this.origins[i].field_key; that.originForm[key]=this.origins[i].field_key;
that.$set(that.originForm,key,this.origins[i].field_value) that.$set(that.originForm,key,this.origins[i].field_value)
} }*/
//图片地址 //图片地址
let imag= this.formData.filter(item => { let imag= this.formData.filter(item => {
return item.field_type === 'draw'; return item.field_type === 'draw';
@ -361,7 +363,7 @@
} }
}, },
methods:{ methods:{
filterBlock(parent,rule){ filterBlock(parent,rule,index,field_key){
// debugger; // debugger;
let that = this; let that = this;
if(parent!==''&&parent!==null&&parent!==undefined){ if(parent!==''&&parent!==null&&parent!==undefined){
@ -408,6 +410,12 @@
rea = true; rea = true;
} }
} }
if(rea){
that.formData[index].is_hidden = false;
}else{
that.formData[index].is_hidden = true;
that.checkForm[field_key] = null;
}
return rea; return rea;
}else{ }else{
let temp =rule.match(reg)[0]; let temp =rule.match(reg)[0];
@ -415,13 +423,21 @@
let a = rule.replace(key, 'yy'); let a = rule.replace(key, 'yy');
a = a.replace(key, 'yy'); a = a.replace(key, 'yy');
let yy = "'"+that.checkForm[key]+"'"; let yy = "'"+that.checkForm[key]+"'";
if(eval(eval(a))){
that.formData[index].is_hidden = false;
}else{
that.formData[index].is_hidden = true;
that.checkForm[field_key] = null;
}
return eval(eval(a)); return eval(eval(a));
// return eval("'"+y+"'"+str);
} }
}else{ }else{
that.formData[index].is_hidden = true;
that.checkForm[field_key] = null;
return false; return false;
} }
}else{ }else{
that.formData[index].is_hidden = false;
return true; return true;
} }
}, },
@ -741,7 +757,7 @@
} }
}, },
//提交检查项目 //提交检查项目
submitfield() { submitfield(isSubmit) {
let that = this; let that = this;
let drawArr = that.formData.filter(item=>{ let drawArr = that.formData.filter(item=>{
return item.field_type==='draw'; return item.field_type==='draw';
@ -765,24 +781,38 @@
} }
}); });
}else{ }else{
that.fieldData(); that.fieldData(isSubmit);
} }
}, },
fieldData(){ fieldData(isSubmit){
let that = this; let that = this;
that.field = []; //检查项目 that.field = []; //检查项目
let submit = isSubmit=='1'?false:true;
that.formData.forEach((item) => { that.formData.forEach((item) => {
that.field.push({ if(!item.is_hidden){
form_field: item.id, that.field.push({
field_value: that.checkForm[item.field_key], id: item.id,
is_testok: item.is_testok//单项检查结果 field_value: that.checkForm[item.field_key],
}); is_testok: item.is_testok,//单项检查结果
is_hidden: item.is_hidden
});
}
}); });
that.testrecord.form = that.formID;//检查表 // that.testrecord.form = that.formID;//检查表
that.testrecord.record_data = that.field;//检查项列表 that.testrecord.record_data = that.field;//检查项列表
that.testrecord.is_testok = that.is_testok;//检查表检查结果 that.testrecord.is_testok = that.is_testok;//检查表检查结果
that.testrecord.wproduct = that.wproductId;//半成品ID // that.testrecord.wproduct = that.wproductId;//半成品ID
this.$emit('formFunc',that.testrecord); // that.testrecord.is_submited = true;
that.testrecord.id = that.recordId;
if(submit){//提交
this.$emit('recordSubmit',that.testrecord);
}else {//保存
this.$emit('recordSave',that.testrecord);
}
},
recordCancel(){
this.$emit('recordCancel','')
}, },
} }
} }

View File

@ -183,8 +183,8 @@ export const asyncRoutes = [
path: 'gantt', path: 'gantt',
name: 'gantt', name: 'gantt',
component: () => import('@/views/pm/gantt'), component: () => import('@/views/pm/gantt'),
meta: { title: '甘特图', perms: ['vendor_manage'] }, meta: { title: '甘特图', icon: 'example',perms: ['vendor_manage'] },
hidden: true // hidden: true
} }
] ]
} }

View File

@ -388,9 +388,11 @@
obj.top=20; obj.top=20;
obj.startTime=startTime; obj.startTime=startTime;
obj.endTime=endTime; obj.endTime=endTime;
obj.planTime = [startTime,endTime];
obj.per=item.count; obj.per=item.count;
obj.per1=item.count_real; obj.per1=item.count_real;
obj.type=3; obj.type=3;
obj.isShow= true;
arr.push(obj); arr.push(obj);
} else if (item.children && item.children.length >= 1) { } else if (item.children && item.children.length >= 1) {
let startTime = new Date(item.start_date).getTime(); let startTime = new Date(item.start_date).getTime();
@ -409,6 +411,7 @@
objChild.parentId=parentId; objChild.parentId=parentId;
objChild.startTime = start; objChild.startTime = start;
objChild.endTime = end; objChild.endTime = end;
objChild.planTime = [start,end];
objChild.per = child.count; objChild.per = child.count;
objChild.per1 = child.count_real; objChild.per1 = child.count_real;
objChild.type = 1; objChild.type = 1;
@ -422,6 +425,7 @@
obj.top=20; obj.top=20;
obj.startTime=startTime; obj.startTime=startTime;
obj.endTime=endTime; obj.endTime=endTime;
obj.planTime = [startTime,endTime];
obj.per=item.count; obj.per=item.count;
obj.per1=item.count_real; obj.per1=item.count_real;
obj.type=3; obj.type=3;
@ -515,7 +519,7 @@
if (item.children.length > 0) { if (item.children.length > 0) {
item.children.forEach((z, o) => { item.children.forEach((z, o) => {
z.planTime = []; z.planTime = [];
z.top = item.top + o * 40; z.top = item.top + o * 40+40;
z.isShow = true; z.isShow = true;
z.left = this.computedTimeWidth(z.startTime); z.left = this.computedTimeWidth(z.startTime);
z.widthMe = z.widthChild = this.computedTimeWidth( z.widthMe = z.widthChild = this.computedTimeWidth(
@ -564,17 +568,6 @@
} }
this.resetTop(rowIndex, !expand, true); this.resetTop(rowIndex, !expand, true);
}, },
//分组添加子集
handleGroupAdd(row) {
this.$nextTick(() => {
this.$refs.dialogAdd.resetFields();
});
this.currentListIndex = this.list.findIndex(item => {
return item.id == row.id;
});
this.dialogVal = true;
this.isChildren = true;
},
// 根据时间计算距离 // 根据时间计算距离
computedTimeWidth(startTime, endTime) { computedTimeWidth(startTime, endTime) {
let start = new Date(startTime).getTime(); let start = new Date(startTime).getTime();

View File

@ -39,7 +39,7 @@
</el-link> </el-link>
<el-link <el-link
v-if="scope.row.test!==null" v-if="scope.row.test!==null"
@click="checkRecord(scope)" @click="checkRecord(scope,'1')"
>检验记录 >检验记录
</el-link> </el-link>
</template> </template>
@ -84,11 +84,22 @@
<el-table-column align="center" label="操作" width="220px"> <el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['warehouse_update'])&&scope.row.test===null"
@click="handleInspection(scope,'2')"
>检验
</el-link>
<el-link
v-if="scope.row.test!==null"
@click="checkRecord(scope,'2')"
>检验记录
</el-link>
<!--<el-link
v-if="checkPermission(['warehouse_update'])" v-if="checkPermission(['warehouse_update'])"
@click="handleInspection(scope,'2')" @click="handleInspection(scope,'2')"
> >
检验 检验
</el-link> </el-link>-->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -145,8 +156,12 @@
v-if="checkPermission(['warehouse_update'])" v-if="checkPermission(['warehouse_update'])"
@click="handlePutin(scope)" @click="handlePutin(scope)"
>入库 >入库
</el-link </el-link>
> <el-link
v-if="scope.row.test!==null"
@click="checkRecord(scope)"
>检验记录
</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -193,8 +208,12 @@
v-if="checkPermission(['warehouse_update'])" v-if="checkPermission(['warehouse_update'])"
@click="handleInspection(scope)" @click="handleInspection(scope)"
>检验 >检验
</el-link </el-link>
> <el-link
v-if="scope.row.test!==null"
@click="checkRecord(scope,'1')"
>检验记录
</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -219,7 +238,7 @@
> >
</el-option> </el-option>
</el-select> </el-select>
<!--第一次操作时的展示--> <!-- &lt;!&ndash;第一次操作时的展示&ndash;&gt;
<el-dialog <el-dialog
width="60%" width="60%"
:title="formName" :title="formName"
@ -231,11 +250,12 @@
:hasPicture="hasPicture" :hasPicture="hasPicture"
:formID="recordform" :formID="recordform"
:wproduct="wproduct" :wproduct="wproduct"
:origin_test="origin_test" :recordId="recordId"
@formFunc="formFunc" @recordSubmit="recordSubmit"
@recordSave="recordSave"
/> />
</el-dialog> </el-dialog>
<!--复检检验表单--> &lt;!&ndash;复检检验表单&ndash;&gt;
<el-dialog <el-dialog
width="60%" width="60%"
:title="formName" :title="formName"
@ -247,12 +267,11 @@
:originList="originList" :originList="originList"
:formID="recordform" :formID="recordform"
:hasPicture="hasPicture" :hasPicture="hasPicture"
:recordItem="recordItem"
:wproduct="wproduct" :wproduct="wproduct"
:origintest="origintest" :origintest="origintest"
@formFunc="formFunc" @formFunc="formFunc"
/> />
</el-dialog> </el-dialog>-->
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="outerVisible = false"> <el-button @click="outerVisible = false">
@ -260,22 +279,42 @@
<el-button type="primary" @click="submitrecordform(innerIndex)">填写检查项目</el-button> <el-button type="primary" @click="submitrecordform(innerIndex)">填写检查项目</el-button>
</div> </div>
</el-dialog> </el-dialog>
<!--保存过的检查表显示--> <!--复检检验表单-->
<el-dialog
width="60%"
:title="formName"
@close="recordCancel"
:visible.sync="limitedReview"
:close-on-click-modal="false"
>
<reviewForm
:results="fieldList"
:originList="originList"
:formID="recordform"
:hasPicture="hasPicture"
:wproduct="wproduct"
:recordId="recordId"
@recordSubmit="recordSubmit"
@recordCancel="recordCancel"
/>
</el-dialog>
<!--非检查表显示-->
<el-dialog <el-dialog
width="60%" width="60%"
:title="formName" :title="formName"
:visible.sync="recordVisible" :visible.sync="recordVisible"
:close-on-click-modal="false"
@close="recordCancel"
> >
<customForm <customForm
v-if="recordVisible"
:results="fieldList" :results="fieldList"
:hasPicture="hasPicture" :hasPicture="hasPicture"
:formID="recordform" :formID="recordform"
:wproduct="wproduct" :wproduct="wproduct"
:recordId="recordId" :recordId="recordId"
:recordItem="recordItem"
@recordSubmit="recordSubmit" @recordSubmit="recordSubmit"
@recordSave="recordSave" @recordSave="recordSave"
@recordCancel="recordCancel"
/> />
</el-dialog> </el-dialog>
@ -313,8 +352,6 @@
:data="recordList" :data="recordList"
border border
height="400" height="400"
@close="pageRefresh"
@closed="pageRefresh"
> >
<el-table-column type="index" width="50"/> <el-table-column type="index" width="50"/>
<el-table-column label="表单名称"> <el-table-column label="表单名称">
@ -386,7 +423,7 @@
<script> <script>
import customForm from '@/components/customForm/index'; import customForm from '@/components/customForm/index';
import reviewForm from '@/components/customForm/review'; import reviewForm from '@/components/customForm/review';
import {getwproductList, wproductTest, wproductPutin, createputins,wproductReview} from "@/api/wpm"; import {getwproductList, wproductTest, wproductPutin, createputins,testInit} from "@/api/wpm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import {getWarehouseList} from "@/api/inm"; import {getWarehouseList} from "@/api/inm";
import {getMaterialList, getrecordformList, getrffieldList} from "@/api/mtm"; import {getMaterialList, getrecordformList, getrffieldList} from "@/api/mtm";
@ -480,7 +517,6 @@
isPost: false, isPost: false,
origin_test: null, origin_test: null,
hasPicture: false, hasPicture: false,
recordItem: false,
outerVisible: false, outerVisible: false,
innerVisible: false, innerVisible: false,
limitedReview: false, limitedReview: false,
@ -553,7 +589,7 @@
}, },
//批量入库 //批量入库
putins() { putins() {
let _this = this let _this = this;
_this.mutipID = [] _this.mutipID = []
this.$refs.multipleTable.selection.forEach((item) => { this.$refs.multipleTable.selection.forEach((item) => {
_this.mutipID.push(item.id); _this.mutipID.push(item.id);
@ -584,28 +620,43 @@
//点击检验:如果有一个直接进入如果有多个表再进行选择 //点击检验:如果有一个直接进入如果有多个表再进行选择
handleInspection(scope,index) { handleInspection(scope,index) {
//调该物料对应的检查表 //调该物料对应的检查表
debugger;
let that = this; let that = this;
this.innerIndex = index; this.innerIndex = index;
this.outerVisible = true; // this.outerVisible = true;
this.wproduct = scope.row.id;//半成品ID this.wproduct = scope.row.id;//半成品ID
this.wproductactstate = scope.row.act_state;//半成品状态 this.listQueryrecordform.material = scope.row.material_.id;//
this.listQueryrecordform.material = scope.row.material;//
this.listQueryrecordform.type = 2; this.listQueryrecordform.type = 2;
this.recordform = null; this.recordform = null;
getrecordformList(this.listQueryrecordform).then((response) => { getrecordformList(this.listQueryrecordform).then((response) => {
if (response.data) { if (response.data) {
debugger;
this.recordformList = response.data; this.recordformList = response.data;
if(response.data.length===1){ if(response.data.length===1){
that.recordform = response.data[0].id; that.recordform = response.data[0].id;
that.formName = response.data[0].name; that.formName = response.data[0].name;
that.submitrecordform(index); that.submitrecordform(index);
}else{
//弹出列表选择框
this.outerVisible = true;
} }
} }
}); });
}, },
//检验记录 //选择物料检查表
checkRecord(scope){ recordformChange() {
let that = this; let that = this;
let arr = this.recordformList.filter(item => {
return item.id === that.recordform;
});
that.formName = arr[0].name;
// this.outerVisible = false;
// that.submitrecordform(that.innerIndex);
},
//检验记录
checkRecord(scope,index){
let that = this;
that.innerIndex = index;
that.wproduct = scope.row.id;//半成品ID that.wproduct = scope.row.id;//半成品ID
that.limitedCheckRecord = true; that.limitedCheckRecord = true;
getTestRecord({wproduct:scope.row.id}).then(res=>{ getTestRecord({wproduct:scope.row.id}).then(res=>{
@ -619,46 +670,79 @@
}, },
//点击记录里的检验 //点击记录里的检验
handleInspectionRecord(scope){ handleInspectionRecord(scope){
debugger;
let that =this; let that =this;
that.recordVisible = false; that.recordVisible = false;
that.recordId = scope.row.id; that.recordId = scope.row.id;
that.recordform = scope.row.form; that.recordform = scope.row.form;
getrffieldList({form: this.recordform, page: 1, page_size: 100}).then((response) => { that.formName = scope.row.form_.name;
if (response.data) { if(that.innerIndex==='1'){//非复检
that.hasPicture = false; getrffieldList({form: this.recordform, page: 1, page_size: 100}).then((response) => {
let fieldList = response.data.results; if (response.data) {
that.fieldList = [...fieldList]; that.hasPicture = false;
let arr = fieldList.filter(item => { let fieldList = response.data.results;
return item.field_type === 'draw' that.fieldList = [...fieldList];
}); let arr = fieldList.filter(item => {
if (arr.length > 0) { return item.field_type === 'draw'
that.hasPicture = true; });
if (arr.length > 0) {
that.hasPicture = true;
}
getTestRecordItem(scope.row.id).then((res) => {
debugger;
let arr = [];
let fieldList = res.data.record_data;
for(let i=0;i<that.fieldList.length;i++){
let obj = that.fieldList[i];
obj.is_testok = null;
for(let j=0;j<fieldList.length;j++){
if(that.fieldList[i].field_key===fieldList[j].field_key){
obj.id = fieldList[j].id;
obj.is_testok = fieldList[j].is_testok;
obj.field_value = fieldList[j].field_value;
}
}
arr.push(obj)
}
that.fieldList = arr;
that.$nextTick(()=>{
that.recordVisible = true;
});
})
} }
getTestRecordItem(scope.row.id).then((res) => { });
debugger; }else if(that.innerIndex==='2'){//复检
let arr = []; getTestRecordItem(scope.row.id).then((res) => {
if (res.data) {
that.hasPicture = false;
let fieldList = res.data.record_data; let fieldList = res.data.record_data;
for(let i=0;i<that.fieldList.length;i++){ that.fieldList = [...fieldList];
that.origintest = res.data.origin_test;
that.recordform = res.data.origin_test_.form;
let originList = res.data.origin_test_.record_data;
that.originList = [...originList];
for (let i = 0; i < that.fieldList.length; i++) {
let obj = that.fieldList[i]; let obj = that.fieldList[i];
obj.is_testok = null; obj.is_testok = null;
for(let j=0;j<fieldList.length;j++){ for (let j = 0; j < originList.length; j++) {
if(that.fieldList[i].field_key===fieldList[j].field_key){ if (that.fieldList[i].field_key === originList[j].field_key) {
obj.id = fieldList[j].id; obj.id = originList[j].id;
obj.is_testok = fieldList[j].is_testok; obj.is_testok = originList[j].is_testok;
obj.field_value = fieldList[j].field_value; obj.field_value = originList[j].field_value;
obj.origin_value = originList[j].field_value;
} }
} }
arr.push(obj) let arr = fieldList.filter(item => {
return item.field_type === 'draw'
});
if (arr.length > 0) {
that.hasPicture = true;
}
this.limitedReview = true;
} }
that.fieldList = arr; }
that.recordItem = true; })
that.$nextTick(()=>{ }
that.recordVisible = true;
});
})
}
});
}, },
//点击记录里的查看 //点击记录里的查看
handleRecordDetail(scope){ handleRecordDetail(scope){
@ -667,7 +751,7 @@
//半产品复检 //半产品复检
handleReview() { handleReview() {
let that = this; let that = this;
wproductReview({ wproduct: this.wproduct,form: that.recordform}).then((response) => { testInit({ wproduct: this.wproduct,form: that.recordform}).then((response) => {
if (response.data) { if (response.data) {
that.hasPicture = false; that.hasPicture = false;
that.formName = response.data.name; that.formName = response.data.name;
@ -687,47 +771,34 @@
} }
}); });
}, },
//选择物料检查表
recordformChange() {
let that = this;
let arr = this.recordformList.filter(item => {
return item.id === that.recordform;
});
that.formName = arr[0].name;
},
//根据选择的表渲染检查项目 //根据选择的表渲染检查项目
submitrecordform(index) { submitrecordform(index) {
let that = this; let that = this;
this.outerVisible = false;
if (that.recordform != "") { if (that.recordform != "") {
if(index==='1'){ if(index==='1'){//非复检
wproductReview({ wproduct: that.wproduct,form: that.recordform}).then((response) => { testInit({ wproduct: that.wproduct,form: that.recordform}).then((response) => {
if (response.data) { if (response.data) {
debugger;
that.hasPicture = false; that.hasPicture = false;
that.origin_test = response.data.origin_test; that.recordId = response.data.id;
that.formName = response.data.name; getTestRecordItem(response.data.id).then((res) => {
/* let fieldList = response.data.form_fields; that.formName = res.data.form_.name;
that.fieldList = [...fieldList];*/ let fieldList = res.data.record_data;
let list = []; that.fieldList = [...fieldList];
let fieldList = response.data.form_fields; let arr = fieldList.filter(item => {
for(let i=0;i<fieldList.length;i++){ return item.field_type === 'draw'
let obj = fieldList[i]; });
obj.is_testok = true; if (arr.length > 0) {
obj.field_value = null; that.hasPicture = true;
list.push(obj) }
} that.$nextTick(()=>{
that.fieldList = list; that.recordVisible = true;
let arr = fieldList.filter(item => { });
return item.field_type === 'draw' })
});
if (arr.length > 0) {
that.hasPicture = true;
}
that.recordItem =false;
that.innerVisible = true;
} }
}); });
}else if(index==='2'){ }else if(index==='2'){//复检
that.handleReview(); that.handleReview();
} }
} else this.$message.error("请选择检查表!"); } else this.$message.error("请选择检查表!");
@ -760,6 +831,10 @@
if(res.code>=200){ if(res.code>=200){
that.$message.success("成功"); that.$message.success("成功");
that.refreshRecord(); that.refreshRecord();
that.getList();
that.getList2();
that.getList1();
that.getList3();
}else{ }else{
this.$message.error(res.msg); this.$message.error(res.msg);
} }
@ -780,7 +855,7 @@
} }
}) })
}, },
//记录保存检查项目 //保存检查项目
recordSave(value) { recordSave(value) {
let that = this; let that = this;
let id = value.id; let id = value.id;
@ -790,7 +865,10 @@
putTestRecordItem(id,params).then((res) => { putTestRecordItem(id,params).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
that.recordVisible = false; that.recordVisible = false;
that.reload(); that.getList();
that.getList2();
that.getList1();
that.getList3();
that.refreshRecord(); that.refreshRecord();
}else{ }else{
this.$message.error(res.msg) this.$message.error(res.msg)
@ -811,7 +889,10 @@
subTestRecordItem(id,params).then((res) => { subTestRecordItem(id,params).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
that.recordVisible = false; that.recordVisible = false;
that.reload(); that.getList();
that.getList2();
that.getList1();
that.getList3();
that.refreshRecord(); that.refreshRecord();
} }
}); });
@ -823,23 +904,13 @@
}); });
}, },
//第一次保存提交检查项目 //第一次保存提交检查项目
formFunc(value) { recordCancel() {
let that = this; this.recordVisible = false;
if(that.isPost){ this.limitedReview = false;
return; this.getList();
}else{ this.getList2();
that.isPost = true; this.getList1();
wproductTest(value).then((res) => { this.getList3();
that.isPost = false;
if (res.code >= 200) {
that.innerVisible = false;
that.outerVisible = false;
that.reload()
}
}).catch(()=>{
this.isPost = true;
});
}
}, },
pageRefresh(){ pageRefresh(){
this.reload() this.reload()

View File

@ -178,7 +178,7 @@
:title="fieldList.name" :title="fieldList.name"
> >
<el-form label-width="80px" label-position="right"> <el-form label-width="80px" label-position="right">
<el-row v-for="(item, $index) in fieldList.form_fields" :key="$index"> <el-row v-for="(item, $index) in fieldList.record_data" :key="$index">
<el-form-item <el-form-item
v-if="item.field_type === 'string'" v-if="item.field_type === 'string'"
:label="item.field_name" :label="item.field_name"
@ -779,10 +779,10 @@ export default {
recordconfirm() { recordconfirm() {
let _this = this; let _this = this;
_this.record_data = []; //检查项目 _this.record_data = []; //检查项目
this.fieldList.form_fields.forEach((item) => { this.fieldList.record_data.forEach((item) => {
_this.record_data.push({ _this.record_data.push({
form_field: item.id, id: item.id,
field_value: item.sort, field_value: item.field_value,
}); });
}); });
this.record.record_data = _this.record_data; this.record.record_data = _this.record_data;