<template>
|
<view class="inspection">
|
<div class="inspection_list">
|
<div class="inspection_list_item">
|
<span>检验类型</span>
|
<div class="right">
|
<div class="right_item active">完工检</div>
|
<!-- <div class="right_item active" v-if="form.status == '1'">巡检</div>
|
<div class="right_item active" v-if="form.status == '2'">完工检</div> -->
|
</div>
|
</div>
|
</div>
|
<div class="x"></div>
|
<div class="inspection_list">
|
<div class="inspection_list_item" @click="jumpGD">
|
<span>检验工单</span>
|
<div class="right1">
|
<span :style="form.gdmc ? 'color: #000;' : ''">{{ form.gdmc ? form.gdmc : '点击选择检验工单'}}</span>
|
<u-icon name="arrow-right" color="#999999" size="18" />
|
</div>
|
</div>
|
<div class="inspection_list_item" v-if="form.gdmc">
|
<span>计划数量</span>
|
<div class="right1">
|
<span style="color: black;">{{info.planNum}}{{info.umodel ? info.umodel.name : ''}}</span>
|
</div>
|
</div>
|
</div>
|
<div class="x"></div>
|
<div class="inspection_list">
|
<div class="inspection_list_item">
|
<span>良品数</span>
|
<div class="right1">
|
<input type="number" v-model="form.hgsl" placeholder="0" />
|
<span class="dw" v-if="info.umodel">{{info.umodel.name}}</span>
|
</div>
|
</div>
|
<div class="inspection_list_item">
|
<span>不良数量</span>
|
<div class="right1">
|
<input type="number" v-model="form.blsl" placeholder="0" />
|
<span class="dw" v-if="info.umodel">{{info.umodel.name}}</span>
|
</div>
|
</div>
|
<div class="inspection_list_item" @click="selectBad" v-if="form.blsl > 0">
|
<span>不良说明</span>
|
<div class="right1">
|
<span :style="form.blsm ? 'color: #000;' : ''">{{ form.blsm ? form.blsm : '点击选择不良原因'}}</span>
|
<u-icon name="arrow-right" color="#999999" size="18" />
|
</div>
|
</div>
|
</div>
|
<div class="inspection_footer">
|
<button class="inspection_footer_sub" @click="submit" v-preventReClick>提交</button>
|
</div>
|
<u-picker :show="show1" title="请选择不良说明" :columns="columns" keyName="name" @cancel="show1=false"
|
@confirm="badConfirm">
|
</u-picker>
|
</view>
|
</template>
|
|
<script>
|
import {
|
createStandard
|
} from '@/util/api/QualityAPI'
|
import {
|
checkAllList
|
} from "@/util/api/WorkOrderAPI"
|
import { REGULAR } from '@/util/utils'
|
export default {
|
data() {
|
return {
|
info: {},
|
show1: false,
|
columns: [],
|
form: {
|
status: '2',
|
gdid: '',
|
gdmc: '',
|
jygz: '',
|
jygzmc: '',
|
hgsl: 0,
|
blsl: 0,
|
blgz: '',
|
blgzmc: '',
|
blsm: '',
|
dw: ''
|
}
|
};
|
},
|
onLoad() {
|
checkAllList({
|
bmodelCateType: '3'
|
})
|
.then(res => {
|
let bad = res.data.map(item => {
|
return {
|
name: item.combinationName,
|
id: item.id
|
}
|
})
|
this.columns = [bad]
|
})
|
uni.$on('workOrder', (data) => {
|
this.form.gdmc = data.mmodel.name + '-' + data.pgmodel.name
|
this.form.gdid = data.id
|
this.info = data
|
|
})
|
},
|
methods: {
|
jumpGD() {
|
uni.navigateTo({
|
url: '/pages/selectWorkOrder/selectWorkOrder?type=2'
|
})
|
},
|
selectBad() {
|
this.show1 = true
|
},
|
badConfirm({
|
value
|
}) {
|
this.form.blsm = value[0].name
|
this.show1 = false
|
},
|
submit() {
|
if (!this.form.gdid) return uni.$u.toast('工单不能为空')
|
|
if (this.form.hgsl || this.form.blsl) {
|
if (this.form.hgsl) {
|
if (this.form.dw == '0') { // 整数
|
if (!REGULAR.positiveInteger.test(this.form.hgsl)) return uni.$u.toast('良品数量只能为正整数')
|
} else if (this.form.dw == '1') { // 小数
|
if (!REGULAR.number.test(this.form.hgsl)) uni.$u.toast('良品数量只能为正整数或四位小数')
|
}
|
}
|
if (this.form.blsl) {
|
if (this.form.dw == '0') { // 整数
|
if (!REGULAR.positiveInteger.test(this.form.blsl)) return uni.$u.toast('不良数量只能为正整数')
|
} else if (this.form.dw == '1') { // 小数
|
if (!REGULAR.number.test(this.form.blsl)) {
|
return uni.$u.toast('不良数量只能为正整数或四位小数')
|
}
|
}
|
}
|
} else {
|
return uni.$u.toast('良品和不良不能同时为空')
|
}
|
let total = (this.form.hgsl ? Number(this.form.hgsl) : 0) + (this.form.blsl ? Number(this.form.blsl) : 0)
|
if (total > this.info.planNum) {
|
return uni.$u.toast('合格不良相加不能超过计划数量')
|
}
|
if (Number(this.form.blsl) > 0) {
|
if (!this.form.blsm) return uni.$u.toast('不良说明不能为空')
|
}
|
createStandard({
|
workorderId: this.form.gdid,
|
qualifiedNum: this.form.hgsl ? this.form.hgsl : 0,
|
unqualifiedNum: this.form.blsl ? this.form.blsl : 0,
|
checkInfo: this.form.blsm,
|
checkType: this.form.status
|
}).then(res => {
|
if (res.code === 200) {
|
uni.$u.toast('检验成功')
|
uni.navigateBack()
|
}
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.inspection {
|
width: 100%;
|
height: 100%;
|
position: absolute;
|
background: #F7F7F7;
|
|
.x {
|
height: 20rpx;
|
}
|
|
.inspection_list {
|
padding: 0 30rpx;
|
background: white;
|
|
.inspection_list_item {
|
height: 98rpx;
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
border-bottom: 1rpx solid #E5E5E5;
|
|
&:last-child {
|
border: none;
|
}
|
|
span {
|
font-size: 30rpx;
|
font-weight: 400;
|
color: #222222;
|
}
|
|
.right1 {
|
display: flex;
|
align-items: center;
|
|
span {
|
font-size: 28rpx;
|
font-weight: 400;
|
color: #999999;
|
margin-right: 10rpx;
|
}
|
|
input {
|
width: 180rpx;
|
height: 60rpx;
|
border-radius: 8rpx;
|
border: 1rpx solid #CCCCCC;
|
margin-right: 10rpx;
|
padding: 0 30rpx;
|
box-sizing: border-box;
|
font-size: 28rpx;
|
}
|
|
input::-webkit-input-placeholder {
|
font-size: 28rpx;
|
font-weight: 400;
|
color: #999999;
|
}
|
|
.dw {
|
font-size: 28rpx;
|
font-weight: 400;
|
color: #666666;
|
}
|
}
|
|
.right {
|
display: flex;
|
align-items: center;
|
|
.active {
|
background: $nav-color !important;
|
color: #ffffff !important;
|
}
|
|
.right_item {
|
padding: 18rpx 32rpx;
|
background: #F2F2F2;
|
border-radius: 8rpx;
|
font-size: 26rpx;
|
font-weight: 400;
|
color: #333333;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
margin-left: 20rpx;
|
}
|
}
|
}
|
}
|
|
.inspection_footer {
|
position: fixed;
|
bottom: 0;
|
left: 0;
|
width: calc(100% - 60rpx);
|
padding: 30rpx 30rpx 68rpx 30rpx;
|
background: #F7F7F7;
|
|
.inspection_footer_sub {
|
width: 100%;
|
height: 88rpx;
|
background: #4275FC;
|
box-shadow: 0 0 12rpx 0 rgba(0, 0, 0, 0.0800);
|
border-radius: 8rpx;
|
font-size: 30rpx;
|
font-weight: 500;
|
color: #FFFFFF;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
border: none;
|
}
|
}
|
}
|
</style>
|