Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop
This commit is contained in:
commit
b76b32665a
|
@ -47,4 +47,13 @@ export default {
|
||||||
.bigDialog .el-dialog{
|
.bigDialog .el-dialog{
|
||||||
width: 70%!important;
|
width: 70%!important;
|
||||||
}
|
}
|
||||||
|
.fail input.el-input__inner{
|
||||||
|
border: 1px solid #ff0000!important;
|
||||||
|
}
|
||||||
|
.adopt input.el-input__inner{
|
||||||
|
border: 1px solid #46ce7a!important;
|
||||||
|
}
|
||||||
|
#customerForm .el-form-item{
|
||||||
|
margin-bottom: 30px!important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -288,5 +288,14 @@ export function recordInit(id) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//半产品复检
|
||||||
|
export function wproductReview(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wpm/wproduct/test_init/',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<el-form
|
<el-form
|
||||||
|
id="customerForm"
|
||||||
ref="checkForm"
|
ref="checkForm"
|
||||||
label-width="100px"
|
label-width="100px"
|
||||||
:model="checkForm"
|
:model="checkForm"
|
||||||
|
@ -11,6 +12,8 @@
|
||||||
v-show="filterBlock(item.parent,item.display_expression)"
|
v-show="filterBlock(item.parent,item.display_expression)"
|
||||||
:key="$index"
|
:key="$index"
|
||||||
:span="12"
|
:span="12"
|
||||||
|
style="position: relative"
|
||||||
|
:class="item.need_judge&&item.is_testok===true?'adopt':item.need_judge&&item.is_testok===false?'fail':''"
|
||||||
>
|
>
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-if="item.field_type === 'string'"
|
v-if="item.field_type === 'string'"
|
||||||
|
@ -112,6 +115,9 @@
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<span v-show="item.help_text" class="helpText">说明:{{item.help_text}}</span>
|
||||||
|
<span v-if="item.need_judge&&item.is_testok===true" class="adoptTip">合格</span>
|
||||||
|
<span v-if="item.need_judge&&item.is_testok===false" class="failTip">不合格</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row v-show="hasPicture">
|
<el-row v-show="hasPicture">
|
||||||
|
@ -130,7 +136,7 @@
|
||||||
<div class="canvasBtn" @click="error1">标记</div>
|
<div class="canvasBtn" @click="error1">标记</div>
|
||||||
<div class="canvasBtn" @click="word1()">文字</div>
|
<div class="canvasBtn" @click="word1()">文字</div>
|
||||||
<div class="canvasBtn" @click="back()">回退</div>
|
<div class="canvasBtn" @click="back()">回退</div>
|
||||||
<div class="canvasBtn" @click="saveTu()">保存</div>
|
<!--<div class="canvasBtn" @click="saveTu()">保存</div>-->
|
||||||
</div>
|
</div>
|
||||||
<div id="res"></div>
|
<div id="res"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -168,6 +174,10 @@
|
||||||
default: () => {
|
default: () => {
|
||||||
return []
|
return []
|
||||||
}} ,
|
}} ,
|
||||||
|
step: {
|
||||||
|
type:String,
|
||||||
|
default:''
|
||||||
|
},
|
||||||
formID: {
|
formID: {
|
||||||
type:Number,
|
type:Number,
|
||||||
default:0
|
default:0
|
||||||
|
@ -185,11 +195,12 @@
|
||||||
let that = this;
|
let that = this;
|
||||||
this.form = this.formID;
|
this.form = this.formID;
|
||||||
let formData=this.results;
|
let formData=this.results;
|
||||||
|
this.checkType=this.step;
|
||||||
that.wproductId=this.wproduct;
|
that.wproductId=this.wproduct;
|
||||||
formData.forEach(item => {
|
formData.forEach(item => {
|
||||||
let obj = new Object();
|
let obj = new Object();
|
||||||
obj = item;
|
obj = item;
|
||||||
obj.is_testok = true;//是否合格
|
obj.is_testok = null;//是否合格
|
||||||
that.formData.push(obj)
|
that.formData.push(obj)
|
||||||
});
|
});
|
||||||
that.formData=[...that.formData];
|
that.formData=[...that.formData];
|
||||||
|
@ -232,8 +243,10 @@
|
||||||
heights:0,
|
heights:0,
|
||||||
lineW:3,
|
lineW:3,
|
||||||
colorF:"#e42343",
|
colorF:"#e42343",
|
||||||
|
imgUrl:'',
|
||||||
imgData:'',
|
imgData:'',
|
||||||
canvasImg:'',
|
canvasImg:'',
|
||||||
|
checkType:'',
|
||||||
formData:[],//表单数组
|
formData:[],//表单数组
|
||||||
judgeList:[],//判定数组
|
judgeList:[],//判定数组
|
||||||
is_testok:true,
|
is_testok:true,
|
||||||
|
@ -344,19 +357,23 @@
|
||||||
if(item.indexOf('&&')>-1){
|
if(item.indexOf('&&')>-1){
|
||||||
if(str.indexOf('false')>-1){
|
if(str.indexOf('false')>-1){
|
||||||
that.formData[index].is_testok = true;
|
that.formData[index].is_testok = true;
|
||||||
|
that.$set(that.formData[index],'is_testok',true)
|
||||||
}else{
|
}else{
|
||||||
that.formData[index].is_testok = false;
|
that.formData[index].is_testok = false;
|
||||||
|
that.$set(that.formData[index],'is_testok',false)
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(str.indexOf('true')>-1){
|
if(str.indexOf('true')>-1){
|
||||||
that.formData[index].is_testok = false;
|
that.formData[index].is_testok = false;
|
||||||
|
that.$set(that.formData[index],'is_testok',false)
|
||||||
}else{
|
}else{
|
||||||
that.formData[index].is_testok = true;
|
that.formData[index].is_testok = true;
|
||||||
|
that.$set(that.formData[index],'is_testok',true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
that.$forceUpdate();
|
||||||
that.formData[index].is_testok = true;
|
|
||||||
}
|
}
|
||||||
|
that.$forceUpdate();
|
||||||
that.judgeList = that.formData.filter(item => {
|
that.judgeList = that.formData.filter(item => {
|
||||||
return item.need_judge === true;
|
return item.need_judge === true;
|
||||||
});
|
});
|
||||||
|
@ -528,6 +545,7 @@
|
||||||
},
|
},
|
||||||
//保存
|
//保存
|
||||||
saveTu(){
|
saveTu(){
|
||||||
|
let that = this;
|
||||||
this.word.style.display="none";
|
this.word.style.display="none";
|
||||||
this.Txt.style.display="none";
|
this.Txt.style.display="none";
|
||||||
let canvas = document.getElementById('canvas');
|
let canvas = document.getElementById('canvas');
|
||||||
|
@ -538,7 +556,9 @@
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
formData.append('file', file);
|
formData.append('file', file);
|
||||||
upFile(formData).then((res) => {
|
upFile(formData).then((res) => {
|
||||||
res;
|
debugger;
|
||||||
|
console.log(res);
|
||||||
|
that.imgUrl=res.data.field;
|
||||||
// console.log(res);
|
// console.log(res);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -618,22 +638,41 @@
|
||||||
//提交检查项目
|
//提交检查项目
|
||||||
submitfield() {
|
submitfield() {
|
||||||
let that = this;
|
let that = this;
|
||||||
debugger;
|
let drawArr = that.formData.filter(item=>{
|
||||||
console.log(that.checkForm);
|
return item.field_type==='draw';
|
||||||
debugger;
|
});
|
||||||
|
if(drawArr.length>0){
|
||||||
|
that.word.style.display="none";
|
||||||
|
that.Txt.style.display="none";
|
||||||
|
let canvas = document.getElementById('canvas');
|
||||||
|
let image = new Image();
|
||||||
|
image = canvas.toDataURL('image/png');
|
||||||
|
that.canvasImg = image;
|
||||||
|
let file = that.base64ToFile(image);
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append('file', file);
|
||||||
|
upFile(formData).then((res) => {
|
||||||
|
if(res){
|
||||||
|
let key = drawArr[0].field_key;
|
||||||
|
that.imgUrl=res.data.file;
|
||||||
|
that.checkForm[key] = that.imgUrl;
|
||||||
|
that.fieldData();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
that.fieldData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fieldData(){
|
||||||
|
let that = this;
|
||||||
that.field = []; //检查项目
|
that.field = []; //检查项目
|
||||||
that.formData.forEach((item) => {
|
that.formData.forEach((item) => {
|
||||||
debugger;
|
|
||||||
console.log(that.checkForm[item.field_key]);
|
|
||||||
debugger;
|
|
||||||
that.field.push({
|
that.field.push({
|
||||||
form_field: item.id,
|
form_field: 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//单项检查结果
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
console.log(that.field);
|
|
||||||
debugger;
|
|
||||||
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;//检查表检查结果
|
||||||
|
@ -708,4 +747,23 @@
|
||||||
#res {
|
#res {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
.helpText{
|
||||||
|
position: absolute;
|
||||||
|
top: 40px;
|
||||||
|
left: 100px;
|
||||||
|
}
|
||||||
|
.adoptTip{
|
||||||
|
position: absolute;
|
||||||
|
top: 38px;
|
||||||
|
right: 0;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #46ce7a;
|
||||||
|
}
|
||||||
|
.failTip{
|
||||||
|
position: absolute;
|
||||||
|
top: 38px;
|
||||||
|
right: 0;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #ff0000;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -405,6 +405,9 @@
|
||||||
<el-form-item label="字段父级">
|
<el-form-item label="字段父级">
|
||||||
<treeselect v-model="field.parent" :multiple="false" :options="treeDate" placeholder="字段父级"/>
|
<treeselect v-model="field.parent" :multiple="false" :options="treeDate" placeholder="字段父级"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="字段说明">
|
||||||
|
<el-input v-model="field.help_text" placeholder="字段名称"/>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="是否需要判定" prop="need_judge">
|
<el-form-item label="是否需要判定" prop="need_judge">
|
||||||
<el-switch v-model="field.need_judge"></el-switch>
|
<el-switch v-model="field.need_judge"></el-switch>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -500,14 +503,12 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div style="text-align: right">
|
<div style="text-align: right">
|
||||||
<el-button type="danger" @click="dialogVisible1 = false"
|
<el-button type="danger" @click="dialogVisible1 = false">
|
||||||
>取消
|
取消
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
<el-button type="primary" @click="fieldconfirm('Form')">
|
||||||
<el-button type="primary" @click="fieldconfirm('Form')"
|
确认
|
||||||
>确认
|
</el-button>
|
||||||
</el-button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -568,6 +569,7 @@
|
||||||
field_name: "",
|
field_name: "",
|
||||||
sort: "",
|
sort: "",
|
||||||
parent: "",
|
parent: "",
|
||||||
|
help_text: "",
|
||||||
draw_template: "",//图片模板
|
draw_template: "",//图片模板
|
||||||
field_choice: [""],
|
field_choice: [""],
|
||||||
},
|
},
|
||||||
|
@ -829,22 +831,7 @@
|
||||||
});
|
});
|
||||||
that.fieldLists();
|
that.fieldLists();
|
||||||
},
|
},
|
||||||
/*canvasInit() {
|
|
||||||
let that = this;
|
|
||||||
preDrawAry = [];
|
|
||||||
that.canvas = document.getElementById('canvas');
|
|
||||||
that.ctx = that.canvas.getContext('2d');
|
|
||||||
that.myCanvas_rect = that.canvas.getBoundingClientRect();
|
|
||||||
that.Txt = document.getElementById('txt');
|
|
||||||
that.word = document.getElementById('word');
|
|
||||||
that.widths = that.myCanvas_rect.width;
|
|
||||||
that.heights = that.myCanvas_rect.height;
|
|
||||||
setTimeout(function () {
|
|
||||||
that.draw();
|
|
||||||
}, 500);
|
|
||||||
},*/
|
|
||||||
checkPermission,
|
checkPermission,
|
||||||
|
|
||||||
handleCurrentChange(row) {
|
handleCurrentChange(row) {
|
||||||
this.formID = row.id;
|
this.formID = row.id;
|
||||||
this.fieldLists();
|
this.fieldLists();
|
||||||
|
@ -884,252 +871,6 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/*draw() {
|
|
||||||
let canvasImg = document.getElementById("canvasImg");
|
|
||||||
canvasImg.style.width = '300px';
|
|
||||||
canvasImg.style.height = '200px';
|
|
||||||
this.ctx.drawImage(canvasImg, 0, 0, 300, 200);
|
|
||||||
},
|
|
||||||
// 叉号
|
|
||||||
error1() {
|
|
||||||
let canvas1 = document.getElementById('canvas');
|
|
||||||
let ctx1 = canvas1.getContext('2d');
|
|
||||||
this.Txt.style.display = "none";
|
|
||||||
document.getElementById('word').style.display = "none";
|
|
||||||
ctx1.closePath();
|
|
||||||
canvas1.onmousedown = function () {
|
|
||||||
this.imgData = ctx1.getImageData(0, 0, canvas1.width, canvas1.height);
|
|
||||||
preDrawAry.push(this.imgData);
|
|
||||||
ctx1.beginPath();
|
|
||||||
ctx1.strokeStyle = "#e42343";
|
|
||||||
ctx1.lineWidth = "3";
|
|
||||||
ctx1.lineJoin = "round";
|
|
||||||
};
|
|
||||||
//鼠标按下的位置
|
|
||||||
canvas1.onmouseup = function (ev) {
|
|
||||||
let oldX = ev.offsetX;
|
|
||||||
let oldY = ev.offsetY;
|
|
||||||
ctx1.moveTo(oldX, oldY);
|
|
||||||
ctx1.lineTo(ev.offsetX + 10, ev.offsetY + 10);
|
|
||||||
ctx1.moveTo(ev.offsetX + 10, ev.offsetY);
|
|
||||||
ctx1.lineTo(ev.offsetX, ev.offsetY + 10);
|
|
||||||
ctx1.stroke();
|
|
||||||
};
|
|
||||||
this.ctx.closePath();
|
|
||||||
},
|
|
||||||
|
|
||||||
// 文字先写字
|
|
||||||
text() {
|
|
||||||
let canvas2 = document.getElementById('canvas');
|
|
||||||
let ctx2 = canvas2.getContext('2d');
|
|
||||||
let Txt2 = document.getElementById('txt');
|
|
||||||
Txt2.style.display = "block";
|
|
||||||
document.getElementById('word').style.display = "none";
|
|
||||||
ctx2.font = "16px Microsoft Yahei";
|
|
||||||
canvas2.onmousedown = function (ev) {
|
|
||||||
this.imgData = ctx2.getImageData(0, 0, canvas2.width, canvas2.height);
|
|
||||||
preDrawAry.push(this.imgData);
|
|
||||||
var v = Txt2.value;
|
|
||||||
// console.log(v);
|
|
||||||
if (v != '') {
|
|
||||||
var oldX = ev.offsetX;
|
|
||||||
var oldY = ev.offsetY;
|
|
||||||
// console.log(oldX,oldY);
|
|
||||||
ctx2.moveTo(oldX, oldY);
|
|
||||||
canvas2.onmouseup = function () {
|
|
||||||
ctx2.fillStyle = this.colorF;
|
|
||||||
ctx2.fillText(v, oldX, oldY);
|
|
||||||
canvas2.TextAutoLine(v, canvas2, oldX, oldY, 20);
|
|
||||||
// Txt.value = "";
|
|
||||||
Txt2.style.display = "none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 文字
|
|
||||||
word1() {
|
|
||||||
let canvas3 = document.getElementById('canvas');
|
|
||||||
let ctx3 = canvas3.getContext('2d');
|
|
||||||
let Txt3 = document.getElementById('txt');
|
|
||||||
let word3 = document.getElementById('word');
|
|
||||||
Txt3.style.display = "none";
|
|
||||||
ctx3.font = "16px Microsoft Yahei";
|
|
||||||
canvas3.onmousedown = function () {
|
|
||||||
ctx3.closePath();
|
|
||||||
}
|
|
||||||
canvas3.onmouseup = function (ev) {
|
|
||||||
var inputV = document.getElementById('inputV').value;
|
|
||||||
if (inputV == 1) {
|
|
||||||
document.getElementById('word').focus();
|
|
||||||
// console.log(ev.offsetX,ev.offsetY);
|
|
||||||
var oldX = ev.offsetX;
|
|
||||||
var oldY = ev.offsetY;
|
|
||||||
word3.style.display = "block";
|
|
||||||
word3.style.left = oldX + 'px';
|
|
||||||
word3.style.top = oldY + 'px';
|
|
||||||
|
|
||||||
word3.onblur = function () {
|
|
||||||
let v = word3.value;
|
|
||||||
if (v != '' && v != ' ') {
|
|
||||||
this.imgData = ctx3.getImageData(0, 0, canvas3.width, canvas3.height);
|
|
||||||
let img = ctx3.getImageData(0, 0, canvas3.width, canvas3.height);
|
|
||||||
debugger;
|
|
||||||
preDrawAry.push(img);
|
|
||||||
ctx3.moveTo(oldX, oldY);
|
|
||||||
ctx3.fillStyle = "#e42343";
|
|
||||||
let lineWidth = 0;
|
|
||||||
let canvasWidth = canvas3.width;
|
|
||||||
let lastSubStrIndex = 0;
|
|
||||||
for (let i = 0; i < v.length; i++) {
|
|
||||||
lineWidth += ctx3.measureText(v[i]).width;
|
|
||||||
if (lineWidth > canvasWidth - oldX) {
|
|
||||||
ctx3.fillText(v.substring(lastSubStrIndex, i), oldX, (oldY + 10));
|
|
||||||
oldY += 20;
|
|
||||||
lineWidth = 0;
|
|
||||||
lastSubStrIndex = i;
|
|
||||||
}
|
|
||||||
if (i == v.length - 1) {
|
|
||||||
ctx3.fillText(v.substring(lastSubStrIndex, i + 1), oldX, (oldY + 10));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inputV = "2";
|
|
||||||
word3.value = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 文字过长超出换行toDataURL()
|
|
||||||
canvasTextAutoLine(str, canvas, initX, initY, lineHeight) {
|
|
||||||
let ctx = canvas.getContext("2d");
|
|
||||||
let lineWidth = 0;
|
|
||||||
let canvasWidth = canvas.width;
|
|
||||||
let lastSubStrIndex = 0;
|
|
||||||
for (let i = 0; i < str.length; i++) {
|
|
||||||
lineWidth += ctx.measureText(str[i]).width;
|
|
||||||
if (lineWidth > canvasWidth - initX) {
|
|
||||||
ctx.fillText(str.substring(lastSubStrIndex, i), initX, initY);
|
|
||||||
initY += lineHeight;
|
|
||||||
lineWidth = 0;
|
|
||||||
lastSubStrIndex = i;
|
|
||||||
}
|
|
||||||
if (i == str.length - 1) {
|
|
||||||
ctx.fillText(str.substring(lastSubStrIndex, i + 1), initX, initY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/!* // 删除批注
|
|
||||||
restuya(){
|
|
||||||
this.word.style.display="none";
|
|
||||||
this.Txt.style.display="none";
|
|
||||||
this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);
|
|
||||||
window.location.reload();
|
|
||||||
},*!/
|
|
||||||
|
|
||||||
// 撤销
|
|
||||||
back() {
|
|
||||||
this.word.style.display = "none";
|
|
||||||
this.Txt.style.display = "none";
|
|
||||||
if (preDrawAry.length > 0) {
|
|
||||||
var popData = preDrawAry.pop();
|
|
||||||
this.ctx.putImageData(popData, 0, 0);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 回退一次
|
|
||||||
put() {
|
|
||||||
this.ctx.putImageData(this.imgData, 0, 0);
|
|
||||||
},
|
|
||||||
|
|
||||||
//保存
|
|
||||||
saveTu() {
|
|
||||||
let canvas = document.getElementById('canvas');
|
|
||||||
let image = new Image();
|
|
||||||
image = canvas.toDataURL('image/png');
|
|
||||||
this.canvasImg = image;
|
|
||||||
let file = this.base64ToFile(image);
|
|
||||||
let formData = new FormData();
|
|
||||||
formData.append('file', file);
|
|
||||||
upFile(formData).then((res) => {
|
|
||||||
debugger;
|
|
||||||
console.log(res);
|
|
||||||
debugger;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
base64ToFile(baseUrl) {
|
|
||||||
let arr = baseUrl.split(',');
|
|
||||||
// let type = arr[0].match(/:(.*?);/)[1]; // 解锁图片类型
|
|
||||||
let bytes = atob(arr[1]); // 解码base64
|
|
||||||
let n = bytes.length;
|
|
||||||
let bufferArray = new Uint8Array(n);
|
|
||||||
while (n--) {
|
|
||||||
bufferArray[n] = bytes.charCodeAt(n);
|
|
||||||
}
|
|
||||||
// let fileOfBlob = new File([bufferArray], new Date()+'.jpg');
|
|
||||||
return new File([bufferArray], 'draw.jpg');
|
|
||||||
},
|
|
||||||
judgeForm() {
|
|
||||||
let that = this,
|
|
||||||
reg = /\{(.+?)\}/g,
|
|
||||||
judgeList = this.judgeList;
|
|
||||||
debugger;
|
|
||||||
console.log(judgeList);
|
|
||||||
for (let i = 0; i < judgeList.length; i++) {
|
|
||||||
let arr = [], str = '';
|
|
||||||
let item = judgeList[i].rule_expression.replace(/`/g, '');
|
|
||||||
if (item.indexOf('||') > -1) {
|
|
||||||
arr = item.split('||');
|
|
||||||
} else if (item.indexOf('&&') > -1) {
|
|
||||||
arr = item.split('&&');
|
|
||||||
} else {
|
|
||||||
arr.push(item);
|
|
||||||
}
|
|
||||||
debugger;
|
|
||||||
console.log(arr);
|
|
||||||
//对每个条件进行判定,如果符合,
|
|
||||||
for (let i = 0; i < arr.length; i++) {
|
|
||||||
//获取判断依据
|
|
||||||
let a = '`' + arr[i] + '`';
|
|
||||||
let tem = a.match(reg)[0];
|
|
||||||
let ky = tem.replace(/\{|\}/g, '');//qipao
|
|
||||||
debugger;
|
|
||||||
console.log(that.checkForm[ky]);
|
|
||||||
//有值时进行判断
|
|
||||||
if (that.checkForm[ky] !== '' && that.checkForm[ky] !== null && that.checkForm[ky] !== undefined) {
|
|
||||||
//替换变量
|
|
||||||
a = a.replace(ky, 'yyy');
|
|
||||||
let yyy = "'" + that.checkForm[ky] + "'";
|
|
||||||
debugger;
|
|
||||||
if (eval(eval(a))) {
|
|
||||||
str += 'true';
|
|
||||||
} else {
|
|
||||||
str += 'false';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
debugger;
|
|
||||||
console.log(str);
|
|
||||||
if (str.indexOf('true') > -1) {
|
|
||||||
that.judgeList[i].judge = true;
|
|
||||||
} else {
|
|
||||||
that.judgeList[i].judge = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let real = that.judgeList.filter(item => {
|
|
||||||
return item.judge == true;
|
|
||||||
});
|
|
||||||
debugger;
|
|
||||||
console.log(that.judgeList);
|
|
||||||
console.log(real);
|
|
||||||
if (real.length > 0) {
|
|
||||||
alert("检验不合格!")
|
|
||||||
} else {
|
|
||||||
alert("检验合格!")
|
|
||||||
}
|
|
||||||
},*/
|
|
||||||
//新增记录表
|
//新增记录表
|
||||||
handleCreate() {
|
handleCreate() {
|
||||||
this.recordform = Object.assign({}, defaultrecordform);
|
this.recordform = Object.assign({}, defaultrecordform);
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['warehouse_update'])"
|
v-if="checkPermission(['warehouse_update'])"
|
||||||
@click="handleInspection(scope)"
|
@click="handleInspection(scope,'view')"
|
||||||
>检验
|
>检验
|
||||||
</el-link
|
</el-link
|
||||||
>
|
>
|
||||||
|
@ -82,10 +82,10 @@
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['warehouse_update'])"
|
v-if="checkPermission(['warehouse_update'])"
|
||||||
@click="handleInspection(scope)"
|
@click="handleInspection(scope,'review')"
|
||||||
>检验
|
|
||||||
</el-link
|
|
||||||
>
|
>
|
||||||
|
检验
|
||||||
|
</el-link>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -100,10 +100,9 @@
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="已合格半成品">
|
<el-tab-pane label="已合格半成品">
|
||||||
<el-card style="margin-top: 2px">
|
<el-card style="margin-top: 2px">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
<el-button type="primary" icon="el-icon-plus" @click="handleCreate">
|
||||||
>批量入库
|
批量入库
|
||||||
</el-button
|
</el-button>
|
||||||
>
|
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="listLoading"
|
v-loading="listLoading"
|
||||||
:data="wproductList1.results"
|
:data="wproductList1.results"
|
||||||
|
@ -211,15 +210,14 @@
|
||||||
<el-select style="width: 100%" v-model="recordform" placeholder="请选择" @change="recordformChange">
|
<el-select style="width: 100%" v-model="recordform" placeholder="请选择" @change="recordformChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in recordformList"
|
v-for="item in recordformList"
|
||||||
:key="item.id"
|
:key="item.name"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
>
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
width="50%"
|
width="60%"
|
||||||
:title="formName"
|
:title="formName"
|
||||||
:visible.sync="innerVisible"
|
:visible.sync="innerVisible"
|
||||||
append-to-body
|
append-to-body
|
||||||
|
@ -228,12 +226,15 @@
|
||||||
:results="fieldList"
|
:results="fieldList"
|
||||||
:hasPicture="hasPicture"
|
:hasPicture="hasPicture"
|
||||||
:formID="recordform"
|
:formID="recordform"
|
||||||
|
:step="step"
|
||||||
:wproduct="wproduct"
|
:wproduct="wproduct"
|
||||||
@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>
|
<el-button @click="outerVisible = false">
|
||||||
|
取 消
|
||||||
|
</el-button>
|
||||||
<el-button type="primary" @click="submitrecordform">填写检查项目</el-button>
|
<el-button type="primary" @click="submitrecordform">填写检查项目</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
@ -295,7 +296,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import customForm from '@/components/customForm/index';
|
import customForm from '@/components/customForm/index';
|
||||||
import {getwproductList, wproductTest, wproductPutin, createputins} from "@/api/wpm";
|
import {getwproductList, wproductTest, wproductPutin, createputins,wproductReview} 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";
|
||||||
|
@ -360,17 +361,18 @@
|
||||||
],
|
],
|
||||||
options: [],
|
options: [],
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
fieldList: "",
|
fieldList: [],
|
||||||
is_testok: "true",
|
is_testok: "true",
|
||||||
field: [],
|
field: [],
|
||||||
recordformList: [],
|
recordformList: [],
|
||||||
recordform: "",
|
recordform: null,
|
||||||
fifo_detail: "",
|
fifo_detail: "",
|
||||||
listQueryrecordform: {
|
listQueryrecordform: {
|
||||||
page: 0,
|
page: 0,
|
||||||
},
|
},
|
||||||
|
step:'view',
|
||||||
mutipID: [],
|
mutipID: [],
|
||||||
wproduct:null,
|
wproduct: null,
|
||||||
hasPicture: false,
|
hasPicture: false,
|
||||||
outerVisible: false,
|
outerVisible: false,
|
||||||
innerVisible: false,
|
innerVisible: false,
|
||||||
|
@ -378,7 +380,7 @@
|
||||||
dialogFormVisibles: false,
|
dialogFormVisibles: false,
|
||||||
testrecord: {},
|
testrecord: {},
|
||||||
WarehouseData: "",
|
WarehouseData: "",
|
||||||
formName:'项目检查表',
|
formName: '项目检查表',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
|
@ -474,8 +476,9 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleInspection(scope) {
|
handleInspection(scope,step) {
|
||||||
//调该物料对应的检查表
|
//调该物料对应的检查表
|
||||||
|
this.step = step;
|
||||||
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.wproductactstate = scope.row.act_state;//半成品状态
|
||||||
|
@ -488,31 +491,50 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
recordformChange(){
|
recordformChange() {
|
||||||
let that = this;
|
let that = this;
|
||||||
let arr = this.recordformList.filter(item=>{
|
let arr = this.recordformList.filter(item => {
|
||||||
return item.id=that.recordform;
|
return item.id === that.recordform;
|
||||||
})
|
});
|
||||||
that.formName = arr[0].name;
|
that.formName = arr[0].name;
|
||||||
},
|
},
|
||||||
//根据选择的表,渲染检查项目
|
//根据选择的表,渲染检查项目
|
||||||
submitrecordform() {
|
submitrecordform() {
|
||||||
let that = this;
|
let that = this;
|
||||||
if (this.recordform != "") {
|
if (that.recordform != "") {
|
||||||
getrffieldList({form: this.recordform, page: 1, page_size: 100}).then((response) => {
|
if(that.step==='view'){
|
||||||
if (response.data) {
|
getrffieldList({form: this.recordform, page: 1, page_size: 100}).then((response) => {
|
||||||
that.hasPicture = false;
|
if (response.data) {
|
||||||
let fieldList = response.data.results;
|
that.hasPicture = false;
|
||||||
that.fieldList = [...fieldList];
|
let fieldList = response.data.results;
|
||||||
let arr = fieldList.filter(item => {
|
that.fieldList = [...fieldList];
|
||||||
return item.field_type === 'draw'
|
let arr = fieldList.filter(item => {
|
||||||
});
|
return item.field_type === 'draw'
|
||||||
if (arr.length > 0) {
|
});
|
||||||
that.hasPicture = true;
|
if (arr.length > 0) {
|
||||||
|
that.hasPicture = true;
|
||||||
|
}
|
||||||
|
that.innerVisible = true;
|
||||||
}
|
}
|
||||||
that.innerVisible = true;
|
});
|
||||||
}
|
}else{
|
||||||
});
|
wproductReview({form: this.recordform, wproduct: this.wproduct}).then((response) => {
|
||||||
|
if (response.data) {
|
||||||
|
debugger;
|
||||||
|
console.log(response);
|
||||||
|
that.hasPicture = false;
|
||||||
|
let fieldList = response.data.form_fields;
|
||||||
|
that.fieldList = [...fieldList];
|
||||||
|
let arr = fieldList.filter(item => {
|
||||||
|
return item.field_type === 'draw'
|
||||||
|
});
|
||||||
|
if (arr.length > 0) {
|
||||||
|
that.hasPicture = true;
|
||||||
|
}
|
||||||
|
that.innerVisible = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
} else this.$message.error("请选择检查表!");
|
} else this.$message.error("请选择检查表!");
|
||||||
},
|
},
|
||||||
//提交检查项目
|
//提交检查项目
|
||||||
|
|
Loading…
Reference in New Issue