<template>
|
<view>
|
<page-nav title="入厂检验"></page-nav>
|
|
<view class="mainContent">
|
<view>
|
<u-gap height="10" bgColor="#eff0f1"></u-gap>
|
<view class="head">
|
<view class="head_block">
|
<view class="head_left">
|
<view class="head_bar"></view>
|
<view class="head_title" style="font-weight: bolder;">
|
物料信息
|
</view>
|
</view>
|
</view>
|
|
<view class="marginLeft20 marginRight20">
|
<view class="marginBottom20" style="display: flex;">
|
<view class="flex_column titleFont">
|
<view>单据编号:</view>
|
<view>物料标签:</view>
|
<view>物料编码:</view>
|
<view>物料名称:</view>
|
<view>物料规格:</view>
|
<view>供方信息:</view>
|
<view>采购批次:</view>
|
<view>质量状态:</view>
|
<view>物料数量:</view>
|
</view>
|
<view class="flex_column contentFont">
|
<view>{{purchorderArr.hbillno}}</view>
|
<view>{{purchorderArr.labcode}}</view>
|
<view>{{purchorderArr.partcode}}</view>
|
<view>{{purchorderArr.partname}}</view>
|
<view>{{purchorderArr.partspec}}</view>
|
<view class="ellipsis" style="width: 460rpx;">{{purchorderArr.customername}}</view>
|
<view>{{purchorderArr.hbatchno}}</view>
|
<view style="display: flex;align-items: center;">
|
<u-icon :name="isPlain?'checkmark-circle-fill':'close-circle-fill'"
|
:color="isPlain?'#55ff00':'#FF0000'" size="20"></u-icon>
|
<view style="margin-left: 10rpx;">
|
{{isPlain?'合格':'不合格'}}
|
</view>
|
|
|
</view>
|
<view>{{purchorderArr.hqty}}</view>
|
</view>
|
</view>
|
</view>
|
|
|
</view>
|
|
<u-gap height="20" bgColor="#eff0f1"></u-gap>
|
<view class="head">
|
<view class="head_block">
|
<view class="head_left">
|
<view class="head_bar"></view>
|
<view class="head_title" style="font-weight: bolder;">
|
检验结果
|
</view>
|
</view>
|
</view>
|
|
<view class="marginLeft20 marginRight20 marginBottom20">
|
<view class="" style="display: flex;">
|
<view class="flex_column titleFont">
|
<view>样本数量:</view>
|
<view>合格数量:</view>
|
<view>不合格数量:</view>
|
</view>
|
<view class="flex_column contentFont">
|
<view>{{purchorderArr.sampleqty}} 个</view>
|
<view>{{purchorderArr.goodqty}} 个</view>
|
<view>{{purchorderArr.sampleqty-purchorderArr.goodqty}} 个</view>
|
</view>
|
</view>
|
|
|
<view style="display: flex;margin-top: 30rpx;">
|
<u-button type="primary" @click="isPlain=true" style="width: 200rpx;margin-left: 0%; "
|
:plain="!isPlain" text="合格"></u-button>
|
<u-button type="warning" @click="isPlain=false" style="width: 200rpx;margin-left: 10%; "
|
:plain="isPlain" text="不合格"></u-button>
|
</view>
|
|
</view>
|
|
|
</view>
|
|
|
<u-gap height="20" bgColor="#eff0f1"></u-gap>
|
|
<view class="head">
|
<view class="head_block marginBottom10">
|
<view class="head_left">
|
<view class="head_bar"></view>
|
<view class="head_title" style="font-weight: bolder;">
|
同步至相同批次
|
</view>
|
</view>
|
<view class="marginRight20">
|
<u-switch v-model="switchValue" size="23"></u-switch>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
|
<u-button type="primary" size='large' :hairline="true" :loading="isDisabledSubmitButton" @click="submit"
|
loadingText="正在提交,请稍等..." text="确认提交"></u-button>
|
|
</view>
|
</template>
|
|
|
<script>
|
// import {
|
|
|
// } from '../../config/api.js';
|
const App = getApp()
|
export default {
|
onLoad(option) {
|
|
let t1 = JSON.parse(JSON.parse(option.passPurchorderObj))
|
|
let t2 = JSON.parse(option.purchorderDetailArr)
|
|
let t3 = JSON.parse(option.purchorderObj)
|
|
let t4 = JSON.parse(option.passToNext)
|
|
console.log(t1, 1)
|
console.log(t2, 2)
|
console.log(t3, 3)
|
console.log(t4, 4)
|
|
this.purchorderArr.hbillno = t1.hbillno
|
this.purchorderArr.partcode = t1.partcode
|
this.purchorderArr.partname = t1.partname
|
this.purchorderArr.partspec = t1.partspec ? t1.partspec : '/'
|
|
|
|
this.purchorderArr.customercode = t4.hcustomercode
|
this.purchorderArr.customername = t4.hcustomername
|
this.purchorderArr.hqty = t4.hqty
|
this.purchorderArr.sampmethod = t4.sampmethod
|
this.purchorderArr.labcode = t4.hbarcode
|
this.purchorderArr.hbatchno = t4.hbatchno ? t4.hbatchno : '/'
|
|
|
|
this.purchorderArr.sampleqty = option.sampleqty
|
this.purchorderArr.goodqty = option.goodqty
|
|
|
this.passPurchorderDetailArr = t2
|
|
this.passPurchorderBZObj = t3
|
|
|
|
},
|
|
onPullDownRefresh() {
|
setTimeout(() => {
|
this.init(() => {
|
uni.stopPullDownRefresh();
|
})
|
}, 1000);
|
},
|
|
data() {
|
return {
|
isDisabledSubmitButton: false,
|
|
purchorderArr: {
|
hbillno: 'CG20221018000001', //单据编号
|
labcode: 'ZG20221018000001', //物料标签
|
partcode: 'ZG-Y-001', //物料编码
|
partname: 'ZG原材料001', //物料名称
|
partspec: 'ZG#30*50', //物料规格
|
customername: 'ZG外协供应商', //供方信息
|
customercode: '0101101', //供方编码
|
hbatchno: '/', //采购批次
|
qualitystatus: '/', //质量状态
|
hqty: 0, //物料数量
|
|
|
sampleqty: 0, //抽样数量
|
goodqty: 0, //合格数量
|
ngqty: 0, //不合格数量
|
},
|
|
passPurchorderDetailArr: [], //页面二传过来的值 每个子项的值
|
|
passPurchorderBZObj: [], //页面二传过来的值 每个子项的值
|
|
|
isPlain: true,
|
switchValue: true,
|
}
|
},
|
created() {
|
|
},
|
mounted() {
|
this.init()
|
|
|
this.isPlain = this.purchorderArr.sampleqty === this.purchorderArr.goodqty
|
|
},
|
methods: {
|
init() {
|
uni.stopPullDownRefresh();
|
},
|
submit() {
|
const header = {
|
// 'Content-Type': 'multipart/form-data',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
'rediskey': uni.getStorageSync('rediskey'),
|
'admin': uni.getStorageSync('usercode'),
|
'username': encodeURIComponent(uni.getStorageSync('username')),
|
'navTabId': uni.getStorageSync('usercode'),
|
'userid': uni.getStorageSync('userid'),
|
'guid': uni.getStorageSync('guid'),
|
'usertype': 'APP'
|
}
|
|
let checkitemcont = []
|
|
|
this.passPurchorderDetailArr.forEach((i, index) => {
|
checkitemcont.push({
|
checknum: i.checkNumber + '/' + this.passPurchorderDetailArr.length / this
|
.passPurchorderDetailArr.filter(j => j.checkNumber === 1).length,
|
checkiem_seq: i.stepcheckitem_seq,
|
checkitem_code: i.code,
|
checkitem_name: i.name,
|
check_value: i.real_value ? i.real_value : '',
|
check_result: i.isPlain ? 'OK' : 'NG',
|
checkitem_descr: i.stepcheckitem_remark
|
})
|
})
|
|
|
let formData = {
|
hbillno: this.purchorderArr.hbillno,
|
labcode: this.purchorderArr.labcode,
|
checkstandcode: this.passPurchorderBZObj.checkstandcode,
|
check_type: 'InCheck',
|
sampmethod: this.passPurchorderBZObj.sampmethod,
|
partcode: this.purchorderArr.partcode,
|
customercode: this.purchorderArr.customercode,
|
batchno: this.purchorderArr.hbatchno === '/' ? '' : this.purchorderArr.hbatchno, //批次
|
qualitystatus: this.isPlain ? 'OK' : 'NG',
|
labqty: parseFloat(this.purchorderArr.hqty),
|
|
sampleqty: parseFloat(this.purchorderArr.sampleqty),
|
goodqty: parseFloat(this.purchorderArr.goodqty),
|
ngqty: parseFloat(this.purchorderArr.sampleqty) - parseFloat(this.purchorderArr.goodqty),
|
issyncbatch: this.switchValue ? 'Y' : 'N', //是否同批次
|
|
admin: uni.getStorageSync('usercode'),
|
checkitemcont: JSON.stringify(checkitemcont)
|
}
|
|
console.log(formData, 888)
|
|
this.isDisabledSubmitButton = true
|
uni.uploadFile({
|
url: this.$baseUrl + '/AppQualityManagement/InFactoryCheckSave',
|
files: [{
|
"uri": "/"
|
}],
|
header: header,
|
formData: formData,
|
success: (res) => {
|
console.log(res, 999)
|
let result = JSON.parse(res.data)
|
if (res.statusCode == 200 && result.code == '200') {
|
uni.$u.toast('提交成功!')
|
|
// uni.navigateTo({
|
// url: './rcjy?partcode=' + this.purchorderArr.partcode + '&hbatchno=' +
|
// this.purchorderArr.hbatchno + '&issyncbatch=' + this.switchValue +
|
// '&labcode=' + this.purchorderArr.labcode + '&hbillno=' + this
|
// .purchorderArr.hbillno
|
// })
|
|
|
let prevPage = getCurrentPages()[getCurrentPages().length - 3]; // 上上一页面实例
|
const data = {
|
issyncbatch: this.switchValue ? 'Y' : 'N',
|
partcode: this.purchorderArr.partcode,
|
hbatchno: this.purchorderArr.hbatchno,
|
labcode: this.purchorderArr.labcode,
|
hbillno: this.purchorderArr.hbillno
|
}
|
prevPage.$vm.fromSubmitData(data) // 调用上上一页 定义的方法
|
uni.navigateBack({
|
delta: 2, //返回层数,2则上上页 使用这种方法以免感觉页面跳动的感觉
|
})
|
|
} else {
|
uni.$u.toast(result.Message)
|
}
|
this.isDisabledSubmitButton = false
|
},
|
fail(res) {
|
console.log(res, 1000)
|
uni.$u.toast('提交失败!')
|
this.isDisabledSubmitButton = false
|
},
|
})
|
|
|
|
|
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import url('@/style/global.css');
|
|
::v-deep .uicon-arrow-left>span {
|
display: block;
|
}
|
</style>
|