|
|
@@ -7,7 +7,7 @@
|
|
|
<view class="herder_item">
|
|
|
<view class="herder_text"></view>
|
|
|
<view class="herder_view" style="font-size: 32rpx;">
|
|
|
- 检验信息
|
|
|
+ 检验信息({{form.status==1?'已检':form.status==2?'已派单':form.status==3?'已请托':'待检'}})
|
|
|
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -35,14 +35,27 @@
|
|
|
<view class="marginTop20 defValue">
|
|
|
{{form.defaultValue}}
|
|
|
</view>
|
|
|
+ <view class="herder_item marginTop20">
|
|
|
+ <view class="herder_text"></view>
|
|
|
+ <view class="herder_view">
|
|
|
+ 工单剩余样品数
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="marginTop20 ">
|
|
|
+ <u-input disabled class="marginTop20" placeholder=" " border="surround"
|
|
|
+ v-model="workData.remainingSampleCount">
|
|
|
+ <template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}
|
|
|
+ </template>
|
|
|
+ </u-input>
|
|
|
+ </view>
|
|
|
<view class="herder_item marginTop20">
|
|
|
<view class="herder_text"></view>
|
|
|
<view class="herder_view">
|
|
|
质检内容
|
|
|
</view>
|
|
|
</view>
|
|
|
- <u-input @input="handleInput(form, form.qualityResultContent)" class="marginTop20" placeholder="请输入内容"
|
|
|
- border="surround" v-model="form.qualityResultContent">
|
|
|
+ <u-input :disabled='form.status==1' @change="handleInput(form, form.qualityResultContent)"
|
|
|
+ class="marginTop20" placeholder="请输入内容" border="surround" v-model="form.qualityResultContent">
|
|
|
<template slot="suffix" v-if="form.unitName">{{form.unitName}}</template>
|
|
|
</u-input>
|
|
|
<view class="herder_item marginTop20">
|
|
|
@@ -51,8 +64,8 @@
|
|
|
样品数
|
|
|
</view>
|
|
|
</view>
|
|
|
- <u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround"
|
|
|
- v-model="form.sampleQuantity">
|
|
|
+ <u-input :disabled='form.status==1' @change="inputValue('sampleQuantity')" type="number" class="marginTop20"
|
|
|
+ placeholder="请输入内容" border="surround" v-model="form.sampleQuantity">
|
|
|
<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
|
|
|
</u-input>
|
|
|
<view class="herder_item marginTop20">
|
|
|
@@ -61,8 +74,8 @@
|
|
|
合格数
|
|
|
</view>
|
|
|
</view>
|
|
|
- <u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround"
|
|
|
- v-model="form.qualifiedQuantity">
|
|
|
+ <u-input :disabled='form.status==1' type="number" @change="inputValue('qualifiedQuantity')"
|
|
|
+ class="marginTop20" placeholder="请输入内容" border="surround" v-model="form.qualifiedQuantity">
|
|
|
<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
|
|
|
</u-input>
|
|
|
<view class="herder_item marginTop20">
|
|
|
@@ -71,8 +84,8 @@
|
|
|
不合格数
|
|
|
</view>
|
|
|
</view>
|
|
|
- <u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround"
|
|
|
- v-model="form.noQualifiedQuantity">
|
|
|
+ <u-input :disabled='form.status==1' type="number" @change="inputValue('noQualifiedQuantity')"
|
|
|
+ class="marginTop20" placeholder="请输入内容" border="surround" v-model="form.noQualifiedQuantity">
|
|
|
<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
|
|
|
</u-input>
|
|
|
<view class="herder_item marginTop20">
|
|
|
@@ -81,7 +94,8 @@
|
|
|
损耗数(合格品)
|
|
|
</view>
|
|
|
</view>
|
|
|
- <u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround" v-model="form.lossNumber">
|
|
|
+ <u-input :disabled='form.status==1' @change="inputValue('lossNumber')" type="number" class="marginTop20"
|
|
|
+ placeholder="请输入内容" border="surround" v-model="form.lossNumber">
|
|
|
<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
|
|
|
</u-input>
|
|
|
<view class="herder_item marginTop20">
|
|
|
@@ -90,8 +104,8 @@
|
|
|
损耗数(不合格品)
|
|
|
</view>
|
|
|
</view>
|
|
|
- <u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround"
|
|
|
- v-model="form.lossNumberUnqualified">
|
|
|
+ <u-input :disabled='form.status==1' @change="inputValue('lossNumberUnqualified')" type="number"
|
|
|
+ class="marginTop20" placeholder="请输入内容" border="surround" v-model="form.lossNumberUnqualified">
|
|
|
<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
|
|
|
</u-input>
|
|
|
<view class="herder_item marginTop20">
|
|
|
@@ -100,8 +114,8 @@
|
|
|
留样数(合格品)
|
|
|
</view>
|
|
|
</view>
|
|
|
- <u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround"
|
|
|
- v-model="form.retainedSampleQuantity">
|
|
|
+ <u-input :disabled='form.status==1' @change="inputValue('retainedSampleQuantity')" type="number"
|
|
|
+ class="marginTop20" placeholder="请输入内容" border="surround" v-model="form.retainedSampleQuantity">
|
|
|
<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
|
|
|
</u-input>
|
|
|
<view class="herder_item marginTop20">
|
|
|
@@ -110,8 +124,8 @@
|
|
|
留样数(不合格品)
|
|
|
</view>
|
|
|
</view>
|
|
|
- <u-input type="number" class="marginTop20" placeholder="请输入内容" border="surround"
|
|
|
- v-model="form.retainedSampleUnqualified">
|
|
|
+ <u-input :disabled='form.status==1' type="number" @change="inputValue('retainedSampleUnqualified')"
|
|
|
+ class="marginTop20" placeholder="请输入内容" border="surround" v-model="form.retainedSampleUnqualified">
|
|
|
<template slot="suffix" v-if="form.measureUnit">{{form.measureUnit}}</template>
|
|
|
</u-input>
|
|
|
<view class="herder_item marginTop20">
|
|
|
@@ -120,18 +134,21 @@
|
|
|
质检结果
|
|
|
</view>
|
|
|
</view>
|
|
|
- <uni-data-picker class="marginTop20" v-model="form.qualityResults" placeholder="请选择"
|
|
|
+ <uni-data-picker v-if='form.status!=1' class="marginTop20" v-model="form.qualityResults" placeholder="请选择"
|
|
|
:localdata="acceptUnpackList">
|
|
|
</uni-data-picker>
|
|
|
+ <u-input disabled v-else class="marginTop20" placeholder="请输入内容" border="surround"
|
|
|
+ :value="acceptUnpackList.find(item=>item.value==form.qualityResults).text">
|
|
|
+ </u-input>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="footerButton">
|
|
|
<u-button type="default" text="返回" @click="back"></u-button>
|
|
|
- <u-button type="primary" @click="save" text="保存"></u-button>
|
|
|
+ <u-button v-if="form.status!=1" type="primary" @click="exeReportWorkBySingleTemplate" text="保存"></u-button>
|
|
|
</view>
|
|
|
<view style="width:100%;height: 100rpx;"></view>
|
|
|
-
|
|
|
+ <u-toast ref="uToast"></u-toast>
|
|
|
|
|
|
</view>
|
|
|
</template>
|
|
|
@@ -140,7 +157,7 @@
|
|
|
import dictMixns from '@/mixins/dictMixins'
|
|
|
import {
|
|
|
getById,
|
|
|
- update
|
|
|
+ exeReportWorkBySingleTemplate
|
|
|
} from '@/api/inspectionWork/index.js'
|
|
|
import {
|
|
|
handleInput
|
|
|
@@ -195,19 +212,108 @@
|
|
|
},
|
|
|
methods: {
|
|
|
|
|
|
- update() {
|
|
|
- let params = JSON.parse(JSON.stringify(this.workData))
|
|
|
- let index= params.templateList.findIndex(item=>item.id==this.form.id)
|
|
|
- params.templateList[index]=this.form
|
|
|
- params.
|
|
|
- update(params)
|
|
|
+ exeReportWorkBySingleTemplate() {
|
|
|
+ // let params = JSON.parse(JSON.stringify(this.workData))
|
|
|
+ // let index = params.templateList.findIndex(item => item.id == this.form.id)
|
|
|
+ // params.templateList[index] = this.form
|
|
|
+ // params.
|
|
|
+ if (!this.form.qualityResultContent) {
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ type: "error",
|
|
|
+ icon: false,
|
|
|
+ message: "请填写质检内容!",
|
|
|
+ }, )
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!this.form.sampleQuantity) {
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ type: "error",
|
|
|
+ icon: false,
|
|
|
+ message: "请填写样品数!",
|
|
|
+ }, )
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.form.status = 1
|
|
|
+ exeReportWorkBySingleTemplate({
|
|
|
+ id: this.workData.id,
|
|
|
+ planTemplateList: [this.form]
|
|
|
+ })
|
|
|
.then((msg) => {
|
|
|
-
|
|
|
+ this.back()
|
|
|
})
|
|
|
.catch((e) => {
|
|
|
+ this.back()
|
|
|
});
|
|
|
},
|
|
|
+ valueInit(data) {
|
|
|
+ ['lossNumber', 'lossNumberUnqualified', 'retainedSampleQuantity', 'retainedSampleUnqualified'].forEach(
|
|
|
+ key => {
|
|
|
+ data[key] = 0
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
+ inputValue(type) {
|
|
|
+ console.log(type, 'type')
|
|
|
+ let data = JSON.parse(JSON.stringify((this.form)))
|
|
|
+ if (data[type] < 0) {
|
|
|
+ data[type] = 0;
|
|
|
+ }
|
|
|
+ //样品数
|
|
|
+ if (type == 'sampleQuantity') {
|
|
|
+ if (+data[type] > this.workData.remainingSampleCount) {
|
|
|
+ data[type] = 0
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ type: "error",
|
|
|
+ icon: false,
|
|
|
+ message: "样品数不能大于工单剩余样品数",
|
|
|
+ }, )
|
|
|
+ }
|
|
|
+ data.qualifiedQuantity = data[type]
|
|
|
+ data.noQualifiedQuantity = 0
|
|
|
+ this.valueInit(data)
|
|
|
+ }
|
|
|
+ //样品合格数、不合格数
|
|
|
+ if (type == 'qualifiedQuantity' || type == 'noQualifiedQuantity') {
|
|
|
+ if (+data[type] > data.sampleQuantity) {
|
|
|
+ data[type] = 0
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ type: "error",
|
|
|
+ icon: false,
|
|
|
+ message: (type == 'qualifiedQuantity' ? '合格' : '不合格') + "数不能大于样品数",
|
|
|
+ }, )
|
|
|
+ }
|
|
|
+ let key = type == 'qualifiedQuantity' ? 'noQualifiedQuantity' : 'qualifiedQuantity'
|
|
|
+ data[key] = data.sampleQuantity - data[type]
|
|
|
+ this.valueInit(data)
|
|
|
+ }
|
|
|
+ //损耗数 留样数
|
|
|
+ if (['lossNumber', 'lossNumberUnqualified', 'retainedSampleQuantity', 'retainedSampleUnqualified']
|
|
|
+ .includes(type)) {
|
|
|
+ if (type == 'lossNumber' || type == 'retainedSampleQuantity') {
|
|
|
+ if (Number(data.lossNumber) + Number(data.retainedSampleQuantity) > data.qualifiedQuantity) {
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ type: "error",
|
|
|
+ icon: false,
|
|
|
+ message: "损耗合格数与留样合格数之和不能大于样品合格数",
|
|
|
+ }, )
|
|
|
+ data[type] = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if (Number(data.lossNumberUnqualified) + Number(data.retainedSampleUnqualified) > data
|
|
|
+ .noQualifiedQuantity) {
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ type: "error",
|
|
|
+ icon: false,
|
|
|
+ message: "损耗不合格数与留样不合格数之和不能大于样品不合格数",
|
|
|
+ }, )
|
|
|
+ data[type] = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$set(this, 'form', JSON.parse(JSON.stringify((data))))
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|