Files
GX.O3.WMS/APK/APP_Report/pages/views/SFC_FirstInpection/O3RP03Detail.vue
T

632 lines
23 KiB
Vue
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="content">
<view class="list-card">
<view class="list-card-Info" style="justify-content: start;">
<!-- <image class="list-card-img-left" src="../../../static/report/unCheck.png"></image> -->
<view class="list-card-Info-item" style="margin-left: 32rpx;">
<text class="list-card-Info-item-text">任务单号:{{checkOrderInfo.FICMONO}}</text>
<text class="list-card-Info-item-text">产品名称:{{checkOrderInfo.FMaterialName}}</text>
<text class="list-card-Info-item-text">创建时间:{{checkOrderInfo.CreateTime}}</text>
</view>
<view class="list-card-Info-item" style="margin-left: 90rpx;">
<text class="list-card-Info-item-text">流转卡号:{{checkOrderInfo.FFlowCardNo}}</text>
<text class="list-card-Info-item-text">资源代码:{{checkOrderInfo.FResourceNo}}</text>
<text><span style="color: #FFFFFF;">占位符</span></text>
</view>
</view>
</view>
<view class="list-card" style="padding-left: 32rpx;padding-right: 32rpx;">
<view class="list-card-Info">
<view class="list-card-Info-item-mid">
<view class="window-content-item">
<span class="check-mid-text">检验方式</span>
<view class="uni-input" @click="pickerShowClick('','','checkTyp')" style="background-color: #FFFFFF;padding-left: 0;">
<view style="background-color: #FFFFFF;border: none;padding-left: 0;margin-left: 10rpx;">{{checkTypeSelected}}</view>
<image src="../../../static/report/arrow_down.png" style="height: 32rpx;width: 32rpx;flex-shrink: 0;"></image>
</view>
</view>
<view class="window-content-item">
<span class="check-mid-text">送检数量</span>
<input v-model="sendCheckQty" type="number" @input="numberInput($event,'sendCheckQty')"/>
</view>
<view class="window-content-item">
<span class="check-mid-text">检验数量</span>
<input class="uni-input" v-model="checkedQty" type="number" @input="numberInput($event,'sendCheckQty')"/>
</view>
</view>
<view class="list-card-Info-item-mid">
<view class="window-content-item">
<span class="check-mid-text">合格数量</span>
<input v-model="acceptQty" type="number" @input="numberInput($event,'sendCheckQty')"/>
</view>
<view class="window-content-item">
<span class="check-mid-text">不合格数量</span>
<input class="uni-input" v-model="deafultQty" type="number" @input="numberInput($event,'sendCheckQty')"/>
</view>
<view class="window-content-item">
<span class="check-mid-text">检验结果</span>
<view class="uni-input" @click="pickerShowClick('','','checkResultTyp')" style="background-color: #FFFFFF;padding-left: 0;">
<view style="background-color: #FFFFFF;border: none;padding-left: 0;margin-left: 10rpx;">{{checkResultSelected}}</view>
<image src="../../../static/report/arrow_down.png" style="height: 32rpx;width: 32rpx;flex-shrink: 0;"></image>
</view>
</view>
</view>
</view>
</view>
<view class="change-label">
<view class="label-type">
<view @click="spanClick(1)"
:class="[spanSelected==1?'change-label-first-selected':'change-label-first-unselect']">检验明细</view>
<view @click="spanClick(2)"
:class="[spanSelected==2?'change-label-second-selected':'change-label-second-unselect']">不合格品登记</view>
</view>
<view class="add-btn" v-if="spanSelected==1" @click="addCheckDetail">增加样品</view>
<view class="add-btn" v-if="spanSelected==2" @click="addDeafultProduct">提交</view>
</view>
<view class="list-card" v-if="spanSelected==1">
<scroll-view scroll-x="true" style="width: 100%;">
<view class="list-card-Info-table" style="background-color: #f5f9ff;width: 1000px;">
<view class="list-card-Info-item-table" style="width: 300rpx;margin-left: 20rpx;">
<text class="table-text">项目序号</text>
</view>
<view class="list-card-Info-item-table" style="width: 300rpx;">
<text class="table-text">检验项目</text>
</view>
<view class="list-card-Info-item-table" style="width: 300rpx;">
<text class="table-text">分析方法</text>
</view>
<view class="list-card-Info-item-table" style="width: 300rpx;">
<text class="table-text">检验值</text>
</view>
<view class="list-card-Info-item-table" style="width: 300rpx;">
<text class="table-text">检验结果</text>
</view>
<view class="list-card-Info-item-table" style="width: 200rpx;">
<text class="table-text">目标值</text>
</view>
<view class="list-card-Info-item-table" style="width: 200rpx;">
<text class="table-text">上限值</text>
</view>
<view class="list-card-Info-item-table" style="width: 200rpx;">
<text class="table-text">下限值</text>
</view>
<view class="list-card-Info-item-table" style="width: 200rpx;">
<text class="table-text">操作</text>
</view>
</view>
<view class="list-card-Info-table" v-for="(item,index) in checkDetailList" style="width: 1000px;">
<view class="list-card-Info-item-table" style="width: 300rpx;margin-left: 20rpx;">
<span class="table-text">{{index+1}}</span>
</view>
<view class="list-card-Info-item-table" style="width: 300rpx;">
<span class="table-text">{{item.FTestProjectName}}</span>
</view>
<view class="list-card-Info-item-table" style="width: 300rpx;">
<span class="table-text">{{item.FAnalysisWay==1?'定性分析':'定量分析'}}</span>
</view>
<view class="list-card-Info-item-table" style="width: 300rpx;">
<!-- <span class="table-text">{{item.FTestValue}}</span> -->
<input v-if="item.FAnalysisWay!=1" class="table-text" v-model="item.FTestValue" />
<input v-if="item.FAnalysisWay==1" class="table-text" :disabled="true" />
</view>
<view class="list-card-Info-item-table" @click="pickerShowClick(item,index,'detailCheckResultTyp')"
style="width: 300rpx; display: flex;flex-direction: row;align-items: center;" >
<view style="background-color: #FFFFFF;border: none;padding-left: 0;width: 100rpx;"
:style="{'color':(item.FTestResult==2)?'red':''}">{{item.FTestResult==1?'合格':(item.FTestResult==2?'不合格':" ")}}</view>
<image src="../../../static/report/arrow_down.png" style="height: 32rpx;width: 32rpx;flex-shrink: 0;margin-left: 20rpx;"></image>
</view>
<view class="list-card-Info-item-table" style="width: 200rpx;">
<span class="table-text">{{item.TargetValue}}</span>
<!-- <input class="table-text" v-model="item.TargetValue" type="number"/> -->
</view>
<view class="list-card-Info-item-table" style="width: 200rpx;">
<span class="table-text">{{item.FUpperLimit}}</span>
<!-- <input class="table-text" v-model="item.FUpperLimit" type="number"/> -->
</view>
<view class="list-card-Info-item-table" style="width: 200rpx;">
<span class="table-text">{{item.FLwerLimit}}</span>
<!-- <input class="table-text" v-model="item.FLwerLimit" type="number"/> -->
</view>
<view class="list-card-Info-item-table" style="width: 200rpx;color: red;" @click="delItem(index)">
<span class="table-text" style="color: red;">删除</span>
</view>
</view>
</scroll-view>
</view>
<view class="list-card" v-if="spanSelected==2">
<view class="list-card-Info">
<view class="list-card-Info-item-mid">
<view class="window-content-item">
<text>不合格原因</text>
<view class="uni-input" @click="pickerShowClick('','','deafultReasonType')" style="background-color: #FFFFFF;padding-left: 0;">
<view style="background-color: #FFFFFF;border: none;padding-left: 0;margin-left: 10rpx;">{{deafultReasonSelected}}</view>
<image src="../../../static/report/arrow_down.png" style="height: 32rpx;width: 32rpx;flex-shrink: 0;"></image>
</view>
</view>
</view>
<view class="list-card-Info-item-mid">
<view class="window-content-item">
<text>不合格数量</text>
<input v-model="deafultProdectQty" type="number" @input="numberInput($event,'sendCheckQty')"/>
</view>
</view>
</view>
<view class="list-card-Info-table" style="background-color: #f5f9ff;width: 100%;" :key="key">
<view class="list-card-Info-item-table" style="width: 10%;margin-left: 20rpx;">
<text class="table-text">序号</text>
</view>
<view class="list-card-Info-item-table" style="width: 40%;">
<text class="table-text">不合格原因</text>
</view>
<view class="list-card-Info-item-table" style="width: 40%;">
<text class="table-text">不合格数量</text>
</view>
<view class="list-card-Info-item-table" style="width: 10%;">
<text class="table-text">操作</text>
</view>
</view>
<view class="list-card-Info-table" v-for="(item,index) in deafultproductList" style="width: 100%;">
<view class="list-card-Info-item-table" style="width: 10%;margin-left: 20rpx;">
<span class="table-text">{{index+1}}</span>
</view>
<view class="list-card-Info-item-table" style="width: 40%;">
<input class="table-text" v-model="item.FFaultReasonName" />
</view>
<view class="list-card-Info-item-table" style="width: 40%;">
<input class="table-text" v-model="item.FFaultQty" />
</view>
<view class="list-card-Info-item-table" style="width: 10%;color: red;" @click="delDeafultItem(index)">
<span class="table-text" style="color: red;">删除</span>
</view>
</view>
</view>
<view class="bottom-btn" @click="save(0)" v-if="isCanSave">保存</view>
<view class="gray-layer" v-if="showGrayLayer" @click="hideGrayLayer"></view>
<view class="bottom-select" v-if="showCheckTypeSel">
<view class="bottom-select-head">
<view class="bottom_select-head-cancel">选择检验方式</view>
<image class="search-img"></image>
</view>
<scroll-view scroll-y="true" style="height: 150px;">
<view class="bottom-select-list" v-for="(item,index) in checkType">
<view class="bottom-select-list-item" @click="pickerItemSel(item,'checkTypeSel')">{{item}}</view>
</view>
</scroll-view>
</view>
<view class="bottom-select" v-if="showCheckResultSel">
<view class="bottom-select-head">
<view class="bottom_select-head-cancel">选择检验结果</view>
<image class="search-img"></image>
</view>
<scroll-view scroll-y="true" style="height: 150px;">
<view class="bottom-select-list" v-for="(item,index) in checkResult">
<view class="bottom-select-list-item" @click="pickerItemSel(item,'checkResultSel')">{{item}}</view>
</view>
</scroll-view>
</view>
<view class="bottom-select" v-if="showDeafultReasonSel">
<view class="bottom-select-head">
<view class="bottom_select-head-cancel">选择不合格原因</view>
<image class="search-img"></image>
</view>
<scroll-view scroll-y="true" style="height: 150px;">
<view class="bottom-select-list" v-for="(item,index) in deafultReasonType">
<view class="bottom-select-list-item" @click="pickerItemSel(item,'deafultReasonSel')">{{item.FName}}</view>
</view>
</scroll-view>
</view>
<view class="bottom-select" v-if="showDetailCheckResultTypSel">
<view class="bottom-select-head">
<view class="bottom_select-head-cancel">选择检查结果</view>
<image class="search-img"></image>
</view>
<scroll-view scroll-y="true" style="height: 150px;">
<view class="bottom-select-list" v-for="(item,index) in checkResult">
<view class="bottom-select-list-item" @click="pickerItemSel(item,'detailCheckResultSel')">{{item}}</view>
</view>
</scroll-view>
</view>
</view>
</template>
<script>
import errorUtil from '@/common/errorutil.js'
import {
mapState,
mapMutations
} from 'vuex'
export default {
data() {
return {
key:1,
showGrayLayer:false,
showSourceList:false,
showCheckTypeSel:false,
showCheckResultSel:false,
showDeafultReasonSel:false,
showDetailCheckResultTypSel:false,
showCreatOrderWindow:false,
checkOrderInfo:[],
deafultQty:'',
checkedQty:'',
sendCheckQty:'',
acceptQty:'',
checkType:['全检','抽检'],//1-全检,2-抽检
checkTypeSelected:'选择检验方式',
checkResult:['合格','不合格'],//1-合格,2-不合格
checkResultSelected:'选择检验结果',
spanSelected:1,
checkDetailList:[],
currDetailListIndex:'',
deafultproductList:[],
deafultproductListSel:[],
deafultReasonType:[],
deafultReasonSelected:'选择不合格原因',
deafultProdectQty:'',
isCanSave:true
}
},
components:{
},
onLoad() {
this.checkOrderInfo = uni.getStorageSync('currCheckInfo');
this.checkDetailList = this.checkOrderInfo.TestItemData;
this.deafultReasonType = uni.getStorageSync('defultReasonInfo');
this.deafultReasonType = this.deafultReasonType.filter(v => v.FPROCESSNO == this.checkOrderInfo.FResourceNo);
this.deafultproductList = this.checkOrderInfo.BadReasonsData;
this.sumArrayFun();
this.deafultQty = this.checkOrderInfo.FUnAcceptQty;
this.checkedQty = this.checkOrderInfo.FQty;
this.sendCheckQty = this.checkOrderInfo.FCount;
this.acceptQty = this.checkOrderInfo.FAcceptQty;
if(this.checkOrderInfo.FStatus == 40){
this.isCanSave = false;
}
this.checkTypeSelected = (this.checkOrderInfo.FTestType==1)?'全检':'抽检';
this.checkResultSelected = (this.checkOrderInfo.FTestResult==1)?'合格':'不合格';
},
methods: {
numberInput(e,inputType){
console.log(e,inputType)
if (e.detail.value<0){
uni.showToast({
title:'数量不能小于0',
icon:'none'
});
switch (inputType){
case 'sendCheckQty':
this.sendCheckQty = 0;
break;
case 'checkedQty':
this.checkedQty = 0;
break;
case 'acceptQty':
this.acceptQty = 0;
break;
case 'deafultQty':
this.deafultQty = 0;
break;
case 'deafultProdectQty':
this.deafultProdectQty = 0;
break;
default:
break;
}
}
},
hideGrayLayer(){
this.showGrayLayer = false;
this.showSourceList = false;
this.showCheckTypeSel = false;
this.showCheckResultSel = false;
this.showDeafultReasonSel = false;
this.showDetailCheckResultTypSel = false;
this.showCreatOrderWindow = false;
},
//检验方式,检验结果,不合格原因选择
pickerShowClick(item,index,type){
if(type == 'checkTyp'){
this.showGrayLayer = true;
this.showCheckTypeSel = true;
}
if(type == 'checkResultTyp'){
this.showGrayLayer = true;
this.showCheckResultSel = true;
}
if(type == 'deafultReasonType'){
this.showGrayLayer = true;
this.showDeafultReasonSel = true;
}
if(type == 'detailCheckResultTyp'){
this.currDetailListIndex = index;
this.showGrayLayer = true;
this.showDetailCheckResultTypSel = true;
}
},
pickerItemSel(item,type){
if(type == 'checkTypeSel'){
this.checkTypeSelected = item;
this.showGrayLayer = false;
this.showCheckTypeSel = false;
}
if(type == 'checkResultSel'){
this.checkResultSelected = item;
this.showGrayLayer = false;
this.showCheckResultSel = false;
}
if(type == 'deafultReasonSel'){
this.deafultReasonSelected = item.FName;
this.deafultproductListSel = item;
this.showGrayLayer = false;
this.showDeafultReasonSel = false;
}
if(type == 'detailCheckResultSel'){
if(item == '合格'){
this.checkDetailList[this.currDetailListIndex].FTestResult = 1;
}
if(item == '不合格'){
this.checkDetailList[this.currDetailListIndex].FTestResult = 2;
}
this.showGrayLayer = false;
this.showDetailCheckResultTypSel = false;
}
},
//资源
sourceSelClick(){
this.showSourceList = true;
this.showGrayLayer = true;
},
//页签
spanClick(type){
this.spanSelected = type;
},
//增加检验明细
addCheckDetail(){
let _self = this;
this.checkOrderInfo.TestWay.forEach(function(el){
//深copy
var elString = JSON.stringify(el);
var newEl = JSON.parse(elString);
_self.checkDetailList.push(newEl)
})
// this.checkDetailList.push(arr);
},
//不合格品登记
addDeafultProduct(){
if(!this.deafultProdectQty){
uni.showToast({
title:'不合格数量不能为空',
icon:'none'
})
return
}
let addDeafult = {
"FDetailID":"",
"FEntryID":'',
"FFaultReason":this.deafultproductListSel.FName,
"FFaultReasonID":this.deafultproductListSel.FID,
"FFaultQty":this.deafultProdectQty};
// let tempList =
this.deafultproductList.push(addDeafult)
this.sumArrayFun();
},
//保存
save(count){
// this.sumArrayFun();
let _self = this;
if (count) {
count = count + 1;
if (count > 4) {
return
}
} else {
count = 1;
}
let checkedQty = parseInt(this.checkedQty);
let acceptQty = parseInt(this.acceptQty);
let deafultQty = parseInt(this.deafultQty);
if(this.deafultQty.length==0){
uni.showToast({
title:'不合格数量不能为空',
icon:'none'
})
return
}
if(this.checkedQty.length==0){
uni.showToast({
title:'检验数量不能为空',
icon:'none'
})
return
}
if(this.sendCheckQty.length==0){
uni.showToast({
title:'送检数量不能为空',
icon:'none'
})
return
}
if(this.acceptQty.length==0){
uni.showToast({
title:'合格数量不能为空',
icon:'none'
})
return
}
if(checkedQty<=0){
uni.showToast({
title:'检验数需大于0',
icon:'none'
})
return
}
if(checkedQty != (acceptQty+deafultQty)){
uni.showToast({
title:'检验数量需等于合格数量与不合格之和',
icon:'none'
})
return
}
if(this.checkDetailList.length>0){
this.checkDetailList.forEach(function(el,index){
el.FEntryID = index+1;
})
}
let submitData = {"testItemData":this.checkDetailList,"badReasonsData":this.deafultproductList};
let requestParams;
requestParams = {
"FInterID":this.checkOrderInfo.FInterID,
"FTestType":(this.checkTypeSelected == '全检')?1:2,
"FQty":this.checkedQty,
"FCount":this.sendCheckQty,
"FAcceptQty":this.acceptQty,
"FUnAcceptQty":this.deafultQty,
"FTestResult":(this.checkResultSelected == '合格')?1:2,
"testItemData":this.checkDetailList,
"badReasonsData":this.deafultproductList
};
this.$request.post('/Inspection/SaveFirstInspection',requestParams).then(res => {
// debugger
let data = res;
// if(data == '保存成功!'){
uni.showToast({
title:data,
icon:'none'
})
// }
}).catch(err => {
uni.hideLoading();
errorUtil.handle(err);
});
},
delItem:function(index){
this.checkDetailList.splice(index,1)
uni.showToast({
title:"删除成功",
icon:'none'
})
this.$forceUpdate();
},
delDeafultItem:function(index){
this.deafultproductList.splice(index,1)
uni.showToast({
title:"删除成功",
icon:'none'
})
this.$forceUpdate();
},
//分组求和
sumArrayFun(){
let _self = this;
//分组字段
let spera = this.deafultproductList.map(function(el){
return el.FFaultReasonID
})
spera = [...new Set(spera)];
//求和
let summaryArry = [];
spera.forEach(function(el){
let count = 0;
let FFaultReasonID = el;
let FDetailID = '';
let FEntryID = '';
let FFaultReason = '';
let FFaultQty = 0;
let FFaultReasonName = '';
_self.deafultproductList.forEach(function(subEl){
if(subEl.FFaultReasonID == FFaultReasonID){
subEl.FFaultQty = parseInt(subEl.FFaultQty);
count = count +subEl.FFaultQty;
FDetailID = subEl.FDetailID;
FEntryID = subEl.FEntryID;
FFaultReason = subEl.FFaultReason;
FFaultReasonID = subEl.FFaultReasonID;
FFaultReasonName = subEl.FFaultReasonName;
}
})
let arr = {
"FDetailID":FDetailID,
"FEntryID":FEntryID,
"FFaultReason":FFaultReason,
"FFaultReasonID":FFaultReasonID,
"FFaultQty":count,
"FFaultReasonName":FFaultReasonName
};
summaryArry.push(arr);
})
// debugger
this.deafultproductList = summaryArry;
this.deafultproductList.forEach(function(e,index) {
e.FEntryID = index+1;
})
// console.log(this.deafultproductList)
// this.key = this.key + 1;
},
}
}
</script>
<style>
page{background-color: #F7F7F7;}
.content{overflow-x: hidden;}
.list-card-Info-item-mid{display: flex;flex-direction: column;flex-shrink: 0;align-items: flex-start;width: 50%;}
.list-card-img-left {
height: 80rpx;
width: 80rpx;
flex-shrink: 0;
margin: 0 90rpx 0 90rpx;
}
.list-card-img-right {
height: 28rpx;
width: 28rpx;
flex-shrink: 0;
margin-right: 64rpx;
}
.window-content-item{display: flex;flex-direction: row;align-items: center;height: 72rpx;margin:0 0;padding-bottom: 32rpx;position: relative;width: 100%;}
.window-content-item text{width: 140rpx;font-size: 28rpx;font-family: PingFangSC, PingFangSC-Regular;
font-weight: 400;text-align: right;color: #727171;margin-bottom: 0;}
.window-content-item view{height: 72rpx;line-height: 72rpx;margin-left: 20rpx;font-size: 28rpx;
background: #e9e9e9;border: 1px solid rgba(60,60,67,0.29);border-radius: 12rpx;
font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;color: #727171;padding: 0 16rpx;}
.window-content-item input{height: 72rpx;margin-left: 20rpx;font-size: 28rpx;background: #FFFFFF;border: 1px solid rgba(60,60,67,0.29);
border-radius: 12rpx;font-family: PingFangSC, PingFangSC-Regular;font-weight: 400;color: #727171;padding: 0 16rpx;flex-grow: 1;}
.list-card-btn{padding: 20rpx 0;}
.list-card-Info-table{display: flex;flex-direction: row;align-items: center;height: 64rpx;}
.list-card-Info-item-table uni-text{margin-bottom: 0;}
.list-card-Info-item-table{width: 100%;}
</style>