| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975 |
- <!-- 用户编辑弹窗 -->
- <template>
- <ele-modal
- :title="title + (type == 'detail' ? '详情' : '报工')"
- :visible.sync="visible"
- :before-close="handleClose"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- width="80%"
- resizable
- :maxable="true"
- >
- <ele-pro-table
- :needPage="false"
- :columns="workColumns"
- :datasource="[form]"
- >
- <template v-slot:toolbar>
- 样品总数:{{ form.workSampleCount }}{{ form.measureUnit }}
- </template>
- <template v-slot:craftFiles="{ row }">
- <el-link type="primary" :underline="false" @click="craftFiles(row)"
- >工艺文件</el-link
- >
- </template>
- <template v-slot:isRequired="{ column }">
- <span class="is-required">{{ column.label }}</span>
- </template>
- <template v-slot:qualityType="{ row }">
- {{ getDictValue('质检计划类型', row.qualityType) }}
- </template>
- <template v-slot:qualityMode="{ row }">
- {{ getDictValue('取样类型', row.qualityMode) }}
- </template>
- <template v-slot:hours="{ row }">
- <el-input
- v-model="row.hours"
- placeholder="请输入"
- type="number"
- :disabled="type == 'detail'"
- >
- </el-input>
- </template>
- <template v-slot:accessory="{ row }">
- <fileMain v-model="row.accessory" type="view"></fileMain>
- </template>
- <template v-slot:sampleQuantity="{ row }">
- <el-input
- v-model="row.sampleQuantity"
- placeholder="请输入"
- type="number"
- @input="formSampleQuantityChange"
- :disabled="type == 'detail'"
- >
- <template slot="append">{{ form.measureUnit }}</template>
- </el-input>
- </template>
- <template v-slot:sampleNoQualifiedNumber="{ row }">
- <el-input
- v-model="row.sampleNoQualifiedNumber"
- @input="formSampleNoQualifiedNumberChange"
- placeholder="请输入"
- type="number"
- :disabled="type == 'detail'"
- >
- <template slot="append">{{ form.measureUnit }}</template>
- </el-input>
- </template>
- </ele-pro-table>
- <ele-pro-table
- :needPage="false"
- :columns="tableColumns"
- :datasource="tableData"
- >
- <template v-slot:toolbar>
- <div
- style="
- display: flex;
- justify-content: space-between;
- align-items: center;
- "
- >
- <span>
- 当前检测剩余样品数:{{ form.sampleQuantity
- }}{{ form.measureUnit }}</span
- >
- <el-button
- type="primary"
- v-if="type != 'detail'"
- @click="handleOneKeyQualified"
- style="margin-right: 10px"
- >
- 一键合格
- </el-button>
- </div>
- </template>
- <template v-slot:qualityStandardType="{ row }">
- {{ getDictValue('质检标准类型', row.qualityStandardType) }}
- </template>
- <template v-slot:executionMethod="{ row }">
- <el-select
- v-model="row.executionMethod"
- style="width: 100%"
- :disabled="type == 'detail' || !!row.experimentCode"
- >
- <el-option :value="1" label="常规检验"></el-option>
- <el-option :value="2" label="实验"></el-option>
- </el-select>
- </template>
- <template v-slot:useTools="{ row }">
- <toolButtom v-model="row.useTools" :type="type" :sList="row.toolList" />
- </template>
- <template v-slot:qualityResultContent="{ row }">
- <el-input
- v-model="row.qualityResultContent"
- placeholder="请输入内容"
- :disabled="type == 'detail'"
- @input="handleInput(row, row.qualityResultContent)"
- >
- <template slot="append" v-if="row.unitName">
- {{ row.unitName }}
- </template>
- </el-input>
- </template>
- <template v-slot:sampleQuantity="{ row, $index }">
- <el-input
- v-model="row.sampleQuantity"
- placeholder="请输入"
- :disabled="type == 'detail'"
- type="number"
- @input="inputValue('sampleQuantity', row, $index)"
- >
- <template slot="append">{{ form.measureUnit }}</template>
- </el-input>
- </template>
- <template v-slot:qualifiedQuantity="{ row, $index }">
- <el-input
- v-model="row.qualifiedQuantity"
- placeholder="请输入"
- :disabled="type == 'detail'"
- type="number"
- @input="inputValue('qualifiedQuantity', row, $index)"
- >
- <template slot="append">{{ form.measureUnit }}</template>
- </el-input>
- </template>
- <template v-slot:noQualifiedQuantity="{ row, $index }">
- <el-input
- v-model="row.noQualifiedQuantity"
- placeholder="请输入"
- :disabled="type == 'detail'"
- type="number"
- @input="inputValue('noQualifiedQuantity', row, $index)"
- >
- <template slot="append">{{ form.measureUnit }}</template>
- </el-input>
- </template>
- <template v-slot:lossNumber="{ row, $index }">
- <el-input
- v-model="row.lossNumber"
- placeholder="请输入"
- :disabled="type == 'detail'"
- type="number"
- @input="inputValue('lossNumber', row, $index)"
- @click.native="curretNum = row.lossNumber"
- >
- <template slot="append">{{ form.measureUnit }}</template>
- </el-input>
- </template>
- <template v-slot:lossNumberUnqualified="{ row, $index }">
- <el-input
- v-model="row.lossNumberUnqualified"
- placeholder="请输入"
- :disabled="type == 'detail'"
- type="number"
- @input="inputValue('lossNumberUnqualified', row, $index)"
- @click.native="curretNum = row.lossNumberUnqualified"
- >
- <template slot="append">{{ form.measureUnit }}</template>
- </el-input>
- </template>
- <template v-slot:retainedSampleQuantity="{ row, $index }">
- <el-input
- v-model="row.retainedSampleQuantity"
- placeholder="请输入"
- :disabled="type == 'detail'"
- type="number"
- @input="inputValue('retainedSampleQuantity', row, $index)"
- @click.native="curretNum = row.retainedSampleQuantity"
- >
- <template slot="append">{{ form.measureUnit }}</template>
- </el-input>
- </template>
- <template v-slot:retainedSampleUnqualified="{ row, $index }">
- <el-input
- v-model="row.retainedSampleUnqualified"
- placeholder="请输入"
- :disabled="type == 'detail'"
- type="number"
- @input="inputValue('retainedSampleUnqualified', row, $index)"
- @click.native="curretNum = row.retainedSampleUnqualified"
- >
- <template slot="append">{{ form.measureUnit }}</template>
- </el-input>
- </template>
- <template v-slot:qualityResults="{ row, $index }">
- <el-select
- v-model="row.qualityResults"
- placeholder="请选择"
- style="width: 100%"
- :disabled="type == 'detail'"
- >
- <el-option
- v-for="item in qualityResultsList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </template>
- <template v-slot:inspectImage="{ row, $index }">
- <fileMain
- v-model="row.inspectImage"
- :type="type == 'detail' ? 'view' : 'add'"
- ></fileMain>
- </template>
- <template v-slot:imgUrl="{ row, $index }">
- <fileMain v-model="row.imgUrl" type="view"></fileMain>
- </template>
- <template v-slot:defaultValue="{ row }">
- <div style="display: flex; justify-content: center">
- <span>{{ row.symbol }}</span>
- <span v-if="row.textType == 3">
- {{ row.minValue }}-{{ row.maxValue }}
- </span>
- <span v-else>
- <span>{{ row.defaultValue }}</span>
- </span>
- {{ row.unitName }}
- </div>
- </template>
- <template v-slot:isRequired="{ column }">
- <span class="is-required">{{ column.label }}</span>
- </template>
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- @click="experimentReport(row, 'report')"
- v-if="row.executionMethod == 2"
- >
- 实验
- </el-link>
- </template>
- </ele-pro-table>
- <template v-slot:footer>
- <el-button @click="handleClose">取消</el-button>
- <el-button type="primary" @click="handleConfirm" v-if="type != 'detail'">
- 确认
- </el-button>
- </template>
- <experimentReport
- ref="experimentReport"
- @done="experimentReportDone"
- :pageName="pageName"
- ></experimentReport>
- <wokePopup ref="wokePopupRef"></wokePopup>
- </ele-modal>
- </template>
- <script>
- import dictMixins from '@/mixins/dictMixins';
- import detailMixins from '../mixins/detailMixins';
- import toolButtom from './toolButtom.vue';
- import experimentReport from './experimentReport.vue';
- import { handleInput } from './unit.js';
- import {
- exeTaskReportWork,
- exeEntrustReportWork
- } from '@/api/inspectionProjectTask';
- import wokePopup from '@/components/workList/wokePopup.vue';
- import { parameterGetByCode } from '@/api/main/index';
- import { craftFiles } from '@/api/inspectionWork';
- export default {
- mixins: [dictMixins, detailMixins],
- components: { toolButtom, experimentReport, wokePopup },
- data() {
- return {
- handleInput,
- type: 'report',
- title: '检测项工单',
- visible: false,
- form: {},
- tableData: [],
- rowIndex: [],
- curretNum: 0,
- qms_qualityResultContent: 1,
- workColumns: [
- {
- minWidth: 150,
- prop: 'code',
- align: 'center',
- label: '检测项工单号',
- showOverflowTooltip: true
- },
- {
- minWidth: 150,
- prop: 'qualityWorkOrderCode',
- align: 'center',
- label: '检测工单编码',
- showOverflowTooltip: true
- },
- {
- minWidth: 150,
- prop: 'qualityWorkOrderName',
- align: 'center',
- label: '检测工单名称',
- showOverflowTooltip: true
- },
- {
- minWidth: 150,
- prop: 'qualityWorkOrderCode',
- align: 'center',
- label: '来源单号',
- showOverflowTooltip: true
- },
- {
- minWidth: 100,
- prop: 'qualityType',
- slot: 'qualityType',
- align: 'center',
- label: '类型',
- showOverflowTooltip: true
- },
- {
- minWidth: 100,
- slot: 'qualityMode',
- prop: 'qualityMode',
- align: 'center',
- label: '检测方式',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'productCode',
- align: 'center',
- label: '编码',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'productName',
- align: 'center',
- label: '名称',
- showOverflowTooltip: true
- },
- {
- minWidth: 100,
- prop: 'batchNo',
- align: 'center',
- label: '批次号',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'specification',
- align: 'center',
- label: '规格',
- showOverflowTooltip: true
- },
- {
- minWidth: 100,
- prop: 'brandNo',
- align: 'center',
- label: '牌号',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'produceTaskName',
- align: 'center',
- label: '工序名称',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'total',
- align: 'center',
- label: '总数量',
- formatter: (row) => {
- if (row.total) {
- return row.total + this.form.measureUnit || '';
- }
- },
- showOverflowTooltip: true
- },
- {
- minWidth: 180,
- prop: 'sampleQuantity',
- headerSlot: 'isRequired',
- slot: 'sampleQuantity',
- align: 'center',
- label: '样品数',
- showOverflowTooltip: true
- },
- {
- minWidth: 180,
- prop: 'sampleNoQualifiedNumber',
- slot: 'sampleNoQualifiedNumber',
- align: 'center',
- label: '样品不合格数',
- showOverflowTooltip: true
- },
- {
- minWidth: 140,
- prop: 'sampleQualifiedNumber',
- headerSlot: 'isRequired',
- slot: 'sampleQualifiedNumber',
- align: 'center',
- formatter: (row) => {
- if (row.sampleQualifiedNumber) {
- return (
- row.sampleQualifiedNumber + (this.form.measureUnit || '')
- );
- }
- },
- label: '样品合格数',
- showOverflowTooltip: true
- },
- {
- minWidth: 140,
- prop: 'lossNumber',
- slot: 'lossNumber',
- align: 'center',
- formatter: (row) => {
- if (row.lossNumber) {
- return row.lossNumber + (this.form.measureUnit || '');
- }
- },
- label: '损耗数(合格品)',
- showOverflowTooltip: true
- },
- {
- minWidth: 140,
- prop: 'lossNumberUnqualified',
- slot: 'lossNumberUnqualified',
- align: 'center',
- formatter: (row) => {
- if (row.lossNumberUnqualified) {
- return (
- row.lossNumberUnqualified + (this.form.measureUnit || '')
- );
- }
- },
- label: '损耗数(不合格品)',
- showOverflowTooltip: true
- },
- {
- minWidth: 140,
- prop: 'retainedSampleQuantity',
- slot: 'retainedSampleQuantity',
- align: 'center',
- formatter: (row) => {
- if (row.retainedSampleQuantity) {
- return (
- row.retainedSampleQuantity + (this.form.measureUnit || '')
- );
- }
- },
- label: '留样数(合格品)',
- showOverflowTooltip: true
- },
- {
- minWidth: 140,
- prop: 'retainedSampleUnqualified',
- slot: 'retainedSampleUnqualified',
- align: 'center',
- formatter: (row) => {
- if (row.retainedSampleUnqualified) {
- return (
- row.retainedSampleUnqualified + (this.form.measureUnit || '')
- );
- }
- },
- label: '留样数(不合格品)',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'hours',
- slot: 'hours',
- align: 'center',
- label: '工时',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'accessory',
- slot: 'accessory',
- align: 'center',
- label: '附件',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'qualityNames',
- slot: 'qualityNames',
- align: 'center',
- label: '检测人',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'qualityTimeEnd',
- slot: 'qualityTimeEnd',
- align: 'center',
- label: '检测时间',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'craftFiles',
- slot: 'craftFiles',
- align: 'center',
- label: '工艺文件',
- fixed: 'right',
- showOverflowTooltip: true
- }
- ],
- qualityResultsList: [
- {
- value: 1,
- label: '合格'
- },
- {
- value: 2,
- label: '不合格'
- },
- {
- value: 3,
- label: '让步接收'
- }
- ],
- sList: [], //质检工具筛选
- pageName: ''
- };
- },
- computed: {
- tableColumns() {
- return [
- {
- width: 45,
- type: 'index',
- columnKey: 'index',
- align: 'center',
- fixed: 'left'
- },
- {
- minWidth: 150,
- prop: 'qualitySchemeTemplateCode',
- align: 'center',
- label: '检测方案编码',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'qualitySchemeTemplateName',
- align: 'center',
- label: '检测方案名称',
- showOverflowTooltip: true
- },
- {
- minWidth: 100,
- prop: 'categoryLevelClassName',
- align: 'center',
- label: '检测类型',
- showOverflowTooltip: true
- },
- {
- minWidth: 130,
- prop: 'inspectionCode',
- align: 'center',
- label: '检测项编码',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'inspectionName',
- align: 'center',
- label: '检测项名称',
- showOverflowTooltip: true
- },
- {
- minWidth: 100,
- prop: 'qualityStandardType',
- slot: 'qualityStandardType',
- align: 'center',
- label: '执行标准',
- showOverflowTooltip: true
- },
- {
- minWidth: 150,
- slot: 'defaultValue',
- prop: 'defaultValue',
- align: 'center',
- label: '工艺参数',
- showOverflowTooltip: true
- },
- {
- minWidth: 130,
- prop: 'executionMethod',
- slot: 'executionMethod',
- align: 'center',
- label: '执行方法',
- showOverflowTooltip: true
- },
- {
- minWidth: 100,
- prop: 'useTools',
- slot: 'useTools',
- align: 'center',
- label: '检测工具',
- showOverflowTooltip: true
- },
- {
- minWidth: 200,
- prop: 'qualityResultContent',
- align: 'center',
- slot: 'qualityResultContent',
- headerSlot: this.qms_qualityResultContent == 1 ? 'isRequired' : '',
- label: '检测内容',
- showOverflowTooltip: true
- },
- {
- minWidth: 180,
- prop: 'sampleQuantity',
- slot: 'sampleQuantity',
- headerSlot: 'isRequired',
- align: 'center',
- label: '样品数',
- showOverflowTooltip: true
- },
- {
- minWidth: 180,
- prop: 'qualifiedQuantity',
- align: 'center',
- slot: 'qualifiedQuantity',
- label: '合格数',
- showOverflowTooltip: true
- },
- {
- minWidth: 180,
- prop: 'noQualifiedQuantity',
- slot: 'noQualifiedQuantity',
- align: 'center',
- label: '不合格数',
- showOverflowTooltip: true
- },
- {
- minWidth: 180,
- prop: 'lossNumber',
- slot: 'lossNumber',
- align: 'center',
- label: '损耗数(合格品)',
- showOverflowTooltip: true
- },
- {
- minWidth: 180,
- prop: 'lossNumberUnqualified',
- slot: 'lossNumberUnqualified',
- align: 'center',
- label: '损耗数(不合格品)',
- showOverflowTooltip: true
- },
- {
- minWidth: 180,
- prop: 'retainedSampleQuantity',
- slot: 'retainedSampleQuantity',
- align: 'center',
- label: '留样数(合格品)',
- showOverflowTooltip: true
- },
- {
- minWidth: 180,
- prop: 'retainedSampleUnqualified',
- slot: 'retainedSampleUnqualified',
- align: 'center',
- label: '留样数(不合格品)',
- showOverflowTooltip: true
- },
- {
- minWidth: 130,
- prop: 'qualityResults',
- slot: 'qualityResults',
- align: 'center',
- label: '检测结果',
- showOverflowTooltip: true,
- fixed: 'right'
- },
- {
- minWidth: 150,
- prop: 'experimentCode',
- align: 'center',
- label: '实验编号',
- showOverflowTooltip: true
- },
- {
- minWidth: 120,
- prop: 'inspectImage',
- slot: 'inspectImage',
- align: 'center',
- label: '检验图片',
- showOverflowTooltip: true
- },
- {
- minWidth: 100,
- prop: 'imgUrl',
- slot: 'imgUrl',
- align: 'center',
- label: '附件',
- showOverflowTooltip: true
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 120,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true,
- fixed: 'right'
- }
- ];
- },
- getSampleQuantityCount() {
- return this.form.sampleQuantity;
- }
- },
- created() {
- this.requestDict('质检计划类型');
- this.requestDict('取样类型');
- this.requestDict('质检标准类型');
- parameterGetByCode({
- code: 'qms_qualityResultContent'
- }).then((res) => {
- this.qms_qualityResultContent = res?.value;
- });
- },
- methods: {
- async craftFiles(row) {
- const res = await parameterGetByCode({
- code: 'mes_craft_file_by_category_code'
- });
- const byCategory = res?.value === '1';
- if (byCategory) {
- this.$refs.wokePopupRef.openTwo(row);
- } else {
- const data = row.qualityWorkOrderId
- ? await craftFiles(row.qualityWorkOrderId)
- : [];
- this.$refs.wokePopupRef.open(data.map((item) => item.id));
- }
- },
- experimentReport(row, type) {
- console.log(this.getSampleQuantityCount, 'this.form');
- this.$refs.experimentReport.open(
- {
- ...row,
- batchNo: this.form.batchNo,
- qualityWorkOrderId: this.form.qualityWorkOrderId,
- getSampleQuantityCount: this.form.sampleQuantity
- },
- type
- );
- },
- experimentReportDone(data) {
- console.log(data);
- let index = this.tableData.findIndex((item) => item.id == data.id);
- this.$set(this.tableData, index, data);
- console.log(this.tableData);
- // this.initData();
- },
- async open({ workData, row, list }, type, pageName) {
- this.tableData = [];
- this.pageName = pageName;
- this.type = type;
- if (pageName == 'inspectionProjectTask') {
- this.title = '检测项任务单';
- }
- if (pageName == 'inspectionProjectRequest') {
- this.title = '检测项受托单';
- }
- if (type == 'report') {
- let data = { ...row, ...workData };
- console.log(data, workData);
- data.sampleQuantity = row.sampleQuantity || data.workSampleCount;
- data.sampleNoQualifiedNumber = row.sampleNoQualifiedNumber || 0;
- data.sampleQualifiedNumber =
- row.sampleQualifiedNumber ||
- data.sampleQuantity - data.sampleNoQualifiedNumber ||
- 0;
- this.$set(this, 'form', JSON.parse(JSON.stringify(data)));
- console.log(this.form, 'this.form');
- this.tableData = JSON.parse(JSON.stringify(list));
- this.tableData.forEach((item, index) => {
- if (item.experimentCode) {
- this.$set(this.tableData[index], 'executionMethod', 2);
- }
- this.$set(
- this.tableData[index],
- 'executionMethod',
- item.executionMethod || 1
- );
- });
- // if (row.sampleQuantity) {
- // this.form.remainingSampleCount =
- // Number(row.sampleQuantity) +
- // Number(this.form.remainingSampleCount);
- // }
- } else {
- this.$set(this, 'form', JSON.parse(JSON.stringify(workData)));
- this.$set(
- this.form,
- 'sampleNoQualifiedNumber',
- this.form.sampleNoQualifiedNumber || 0
- );
- this.$set(
- this.form,
- 'sampleQualifiedNumber',
- this.form.sampleQualifiedNumber ||
- this.form.sampleQuantity - this.form.sampleNoQualifiedNumber ||
- 0
- );
- this.tableData = JSON.parse(JSON.stringify(list));
- // if (this.form.qualityWorkOrderId) {
- // this.form.remainingSampleCount =
- // this.form.sampleQuantity + this.form.remainingSampleCount;
- // }
- }
- this.visible = true;
- },
- handleOneKeyQualified() {
- this.tableData.forEach((item, index) => {
- this.$set(this.tableData[index], 'qualityResults', 1);
- });
- },
- formSampleQuantityChange() {
- if (this.form.sampleQuantity < 0) {
- this.form.sampleQuantity = 0;
- }
- if (this.form.sampleQuantity > this.form.workSampleCount) {
- this.form.sampleQuantity = this.form.workSampleCount;
- }
- if (
- this.form.sampleQuantity <
- Math.max(...this.tableData.map((item) => item.sampleQuantity))
- ) {
- this.tableData.forEach((item, index) => {
- this.resetData(item, index, [
- 'qualifiedQuantity',
- 'noQualifiedQuantity',
- 'sampleQuantity'
- ]);
- });
- }
- this.form.sampleQualifiedNumber = this.form.sampleQuantity;
- this.form.sampleNoQualifiedNumber = 0;
- },
- formSampleNoQualifiedNumberChange() {
- if (+this.form.sampleNoQualifiedNumber < 0) {
- this.form.sampleNoQualifiedNumber = 0;
- }
- if (+this.form.sampleNoQualifiedNumber > this.form.sampleQuantity) {
- this.form.sampleNoQualifiedNumber = this.form.sampleQuantity;
- }
- this.form.sampleQualifiedNumber =
- this.form.sampleQuantity - this.form.sampleNoQualifiedNumber;
- },
- handleClose() {
- this.visible = false;
- if (this.$refs.wokePopupRef) {
- this.$refs.wokePopupRef.visible = false;
- }
- },
- handleConfirm() {
- let isHandleConfirm = false;
- if (!this.form.sampleQuantity) {
- return this.$message.error('样品数不能为空!');
- }
- this.tableData.forEach((item, index) => {
- item.status = 1;
- if (!item.qualityResultContent) {
- isHandleConfirm = true;
- }
- });
- if (!this.pageName) {
- this.$emit('success', { data: this.form, tableData: this.tableData });
- this.visible = false;
- } else {
- if (isHandleConfirm && this.qms_qualityResultContent == 1) {
- return this.$message.error('检测内容不能为空!');
- }
- let api =
- this.pageName == 'inspectionProjectTask'
- ? exeTaskReportWork
- : exeEntrustReportWork;
- api({
- ...this.form,
- templateList: this.tableData
- }).then((res) => {
- this.$message.success('操作成功');
- this.$emit('reload');
- this.visible = false;
- });
- }
- },
- inputValue(type, item, index) {
- if (item[type] < 0) {
- item[type] = 0;
- }
- //样品数
- if (type == 'sampleQuantity') {
- this.isSampleQuantity(item, index);
- }
- //样品合格数、不合格数
- if (type == 'qualifiedQuantity' || type == 'noQualifiedQuantity') {
- this.isQualifiedQuantity(item, index, type);
- }
- //损耗数
- if (type == 'lossNumber' || type == 'lossNumberUnqualified') {
- this.setNumber(item, index, type, '损耗', 'lossNumber');
- }
- //留样数
- if (
- type == 'retainedSampleQuantity' ||
- type == 'retainedSampleUnqualified'
- ) {
- this.setNumber(item, index, type, '留样', 'retainedSampleQuantity');
- }
- }
- }
- };
- </script>
- <style scoped lang="scss">
- ::v-deep .warn {
- color: red;
- .el-input__inner {
- color: red;
- }
- }
- </style>
|