| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515 |
- <template>
- <view class="mainBox">
- <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="检验项目" @clickLeft="back">
- </uni-nav-bar>
- <view class="wrapper">
- <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>
- <text class="marginTop20 tag">
- {{form.inspectionName}}
- </text>
- <view class="marginTop20 workValue">
- {{workData.productName}}/{{workData.code}}/{{workData.productCode}}
- </view>
- <view class="herder_item marginTop20">
- <view class="herder_text"></view>
- <view class="herder_view">
- 执行标准
- </view>
- </view>
- <u--input suffixIcon="arrow-right" style="background-color:#fff ;" :disabledColor="'#ffffff'"
- :disabled="true" class="marginTop20" placeholder=" " border="surround"
- :value="getDictValue('质检标准类型', form.qualityStandardType+'')"></u--input>
- <view class="herder_item marginTop20">
- <view class="herder_text"></view>
- <view class="herder_view">
- 工艺参数
- </view>
- </view>
- <view class="marginTop20 defValue">
- <text v-if="form.textType != 8">{{ form.symbol }}</text>
- <text v-if="form.textType == 3">
- {{ form.minValue }}-{{ form.maxValue }}
- </text>
- <text v-else-if="form.textType == 8">
- 标准值:{{form.defaultValue}}{{ form.unitName||'' }} 下限:{{ form.minValue||0 }}{{ form.unitName||'' }}
- 上限:{{ form.minValue||0 }}{{ form.unitName||'' }}
- </text>
- <text v-else>
- <text>{{ form.defaultValue }}</text>
- </text>
- <text v-if="form.textType != 8">
- <text>{{ form.unitName }}</text>
- </text>
- </view>
- <view class="herder_item marginTop20" v-if="form.executionMethod==2">
- <view class="herder_text"></view>
- <view class="herder_view">
- 实验数据
- </view>
- </view>
- <view class="marginTop20" v-if="form.executionMethod==2">
- <view style="width:150rpx">
- <u-button style="width:100rpx" type="primary" @click="open"
- :text="type=='edit'?'编辑':'查看'"></u-button>
- </view>
- </view>
- <view class="herder_item marginTop20" v-if="type=='edit'">
- <view class="herder_text"></view>
- <view class="herder_view">
- 工单剩余样品数
- </view>
- </view>
- <view class="marginTop20 " v-if="type=='edit'">
- <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 :disabled='type=="view"' @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">
- <view class="herder_text"></view>
- <view class="herder_view">
- 样品数
- </view>
- </view>
- <u-input :disabled='type=="view"' @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">
- <view class="herder_text"></view>
- <view class="herder_view">
- 合格数
- </view>
- </view>
- <u-input :disabled='type=="view"' 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">
- <view class="herder_text"></view>
- <view class="herder_view">
- 不合格数
- </view>
- </view>
- <u-input :disabled='type=="view"' 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">
- <view class="herder_text"></view>
- <view class="herder_view">
- 损耗数(合格品)
- </view>
- </view>
- <u-input :disabled='type=="view"' @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">
- <view class="herder_text"></view>
- <view class="herder_view">
- 损耗数(不合格品)
- </view>
- </view>
- <u-input :disabled='type=="view"' @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">
- <view class="herder_text"></view>
- <view class="herder_view">
- 留样数(合格品)
- </view>
- </view>
- <u-input :disabled='type=="view"' @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">
- <view class="herder_text"></view>
- <view class="herder_view">
- 留样数(不合格品)
- </view>
- </view>
- <u-input :disabled='type=="view"' 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">
- <view class="herder_text"></view>
- <view class="herder_view">
- 检验图片
- </view>
- </view>
- <fileMain class="marginTop20" v-model="form.inspectImage" :type="type=='view'?'view':'add'"></fileMain>
- <view class="herder_item marginTop20">
- <view class="herder_text"></view>
- <view class="herder_view">
- 附件
- </view>
- </view>
- <fileMain class="marginTop20" v-model="form.imgUrl" type="view"></fileMain>
- <view class="herder_item marginTop20">
- <view class="herder_text"></view>
- <view class="herder_view">
- 质检结果
- </view>
- </view>
- <uni-data-picker v-if="type=='edit'" class="marginTop20" v-model="form.qualityResults" placeholder="请选择"
- :localdata="acceptUnpackList">
- </uni-data-picker>
- <u-input disabled v-else class="marginTop20" placeholder="请输入内容" border="surround"
- :value="form.qualityResults&&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 v-if="type=='edit'" type="primary" @click="exeReportWorkBySingleTemplate" text="保存"></u-button>
- </view>
- <view style="width:100%;height: 100rpx;"></view>
- <u-toast ref="uToast"></u-toast>
- <experimentReport ref="experimentReportRef" @success="experimentReportSuccess" :type="type"></experimentReport>
- </view>
- </template>
- <script>
- import dictMixns from '@/mixins/dictMixins'
- import experimentReport from './experimentReport.vue'
- import fileMain from "@/pages/doc/index.vue";
- import {
- getById,
- exeReportWorkBySingleTemplate,
- exeReportWorkBySingleTaskmonad,
- exeReportWorkBySingleRequestentrust,
- getRequestentrustById,
- getTaskmonadById,
- verificationQualityInspector
- } from '@/api/inspectionWork/index.js'
- import {
- handleInput
- } from './unit.js';
- export default {
- components: {
- experimentReport,
- fileMain
- },
- mixins: [dictMixns],
- data() {
- return {
- handleInput,
- show: false,
- type: 'view',
- form: {
- lossNumber: '',
- lossNumberUnqualified: '',
- retainedSampleQuantity: '',
- retainedSampleUnqualified: '',
- qualifiedQuantity: '',
- noQualifiedQuantity: '',
- sampleQuantity: '',
- experimentId: '',
- inspectImage: []
- },
- acceptUnpackList: [{
- text: "合格",
- value: 1
- },
- {
- text: "不合格",
- value: 2
- }, {
- text: "让步接收",
- value: 3
- },
- ],
- pageName: '',
- workData: {}
- }
- },
- computed: {
- },
- onLoad(data) {
- this.requestDict('质检计划类型');
- this.requestDict('取样类型');
- this.requestDict('质检标准类型');
- this.pageName = data.pageName
- if (data) {
- this.init(data)
- }
- },
- onShow() {
- },
- methods: {
- init(data) {
- let api = this.pageName == 'myInspectionProjectTask' ? getTaskmonadById : this.pageName ==
- 'myInspectionProjectEntrusted' ? getRequestentrustById : getById
- api(data.workId).then(res => {
- this.workData = res
- this.$set(this, 'form', res.templateList.find(item => item.id == data.projectId))
- if (this.pageName == 'myInspectionProjectTask' && this.form.status == 2) {
- this.type = 'edit'
- }
- if (this.pageName == 'myInspectionProjectEntrusted' && this.form.status == 3) {
- this.type = 'edit'
- }
- if (this.form.status == 0) {
- this.type = 'edit'
- }
- this.form.measureUnit = data.sampleMeasureUnit || res.qualitySampleList[0]?.measureUnit
- })
- },
- experimentReportSuccess(data) {
- let api = this.pageName == 'myInspectionProjectTask' ? getTaskmonadById : this.pageName ==
- 'myInspectionProjectEntrusted' ? getRequestentrustById : getById
- api(data.workId).then(res => {
- this.$set(this.form, 'experimentId', res.templateList.find(item => item.id == data.projectId)
- ?.experimentId)
- })
- },
- open() {
- this.$refs.experimentReportRef.open({
- ...this.form,
- qualityWorkOrderId: this.workData.id
- })
- },
- async exeReportWorkBySingleTemplate() {
- if (!this.pageName) {
- const code = await verificationQualityInspector(this.workData.id);
- if (code == '-1') {
- return;
- }
- }
- 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
- let data = {
- id: this.workData.id,
- }
- let api = exeReportWorkBySingleTemplate
- if (this.pageName == 'myInspectionProjectTask') {
- api = exeReportWorkBySingleTaskmonad
- data.templateList = [this.form]
- } else if (this.pageName == "myInspectionProjectEntrusted") {
- api = exeReportWorkBySingleRequestentrust
- data.templateList = [this.form]
- } else {
- data.planTemplateList = [this.form]
- }
- api(data)
- .then((msg) => {
- uni.$emit('successInit')
- this.back()
- })
- .catch((e) => {
- this.back()
- });
- },
- valueInit(data) {
- ['lossNumber', 'lossNumberUnqualified', 'retainedSampleQuantity', 'retainedSampleUnqualified'].forEach(
- key => {
- data[key] = ''
- })
- },
- inputValue(type) {
- if (this.type == 'view') {
- return
- }
- let data = JSON.parse(JSON.stringify((this.form)))
- if (data[type] < 0) {
- data[type] = '';
- }
- //样品数
- 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] = ''
- }
- } else {
- if (Number(data.lossNumberUnqualified) + Number(data.retainedSampleUnqualified) > data
- .noQualifiedQuantity) {
- this.$refs.uToast.show({
- type: "error",
- icon: false,
- message: "损耗不合格数与留样不合格数之和不能大于样品不合格数",
- }, )
- data[type] = ''
- }
- }
- }
- this.$nextTick(() => {
- this.$set(this, 'form', JSON.parse(JSON.stringify((data))))
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .mainBox {
- background-color: #f3f8fb;
- height: 100vh;
- font-size: 27rpx;
- overflow-y: auto;
- }
- .wrapper {
- width: 720rpx;
- background: #fff;
- margin: 20rpx auto 0;
- border-radius: 30rpx;
- padding: 26rpx;
- }
- .footerButton {
- width: 100%;
- height: 84rpx;
- display: flex;
- position: fixed;
- bottom: 0;
- z-index: 10;
- background-color: #fff;
- /deep/.u-button {
- height: 100%;
- }
- >view {
- flex: 1;
- }
- }
- .workValue {
- word-break: break-all;
- font-weight: bold;
- }
- .tag {
- // font-size: 24rpx;
- color: #fff;
- padding: 12rpx;
- border-radius: 10rpx;
- background: #979797;
- display: inline-block;
- }
- /deep/.input-value {
- font-size: 28rpx !important;
- }
- .defValue {
- color: #c1353c;
- text-indent: 2ch;
- }
- .marginTop20 {
- margin-top: 30rpx;
- }
- .herder_item {
- display: flex;
- font-weight: bold;
- // font-size: 26rpx;
- .herder_text {
- min-width: 10rpx;
- height: 32rpx;
- border-radius: 10rpx;
- background: #00c0a1;
- margin-right: 12rpx;
- margin-top: 5rpx;
- }
- }
- </style>
|