|
@@ -57,7 +57,7 @@
|
|
|
<template slot="append">{{ form.measureUnit }}</template>
|
|
<template slot="append">{{ form.measureUnit }}</template>
|
|
|
</el-input>
|
|
</el-input>
|
|
|
</template>
|
|
</template>
|
|
|
- <template v-slot:sampleNoQualifiedNumber="{ row }">
|
|
|
|
|
|
|
+ <!-- <template v-slot:sampleNoQualifiedNumber="{ row }">
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="row.sampleNoQualifiedNumber"
|
|
v-model="row.sampleNoQualifiedNumber"
|
|
|
@input="formSampleNoQualifiedNumberChange"
|
|
@input="formSampleNoQualifiedNumberChange"
|
|
@@ -67,7 +67,7 @@
|
|
|
>
|
|
>
|
|
|
<template slot="append">{{ form.measureUnit }}</template>
|
|
<template slot="append">{{ form.measureUnit }}</template>
|
|
|
</el-input>
|
|
</el-input>
|
|
|
- </template>
|
|
|
|
|
|
|
+ </template> -->
|
|
|
</ele-pro-table>
|
|
</ele-pro-table>
|
|
|
<ele-pro-table
|
|
<ele-pro-table
|
|
|
:needPage="false"
|
|
:needPage="false"
|
|
@@ -212,6 +212,7 @@
|
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
:disabled="type == 'detail'"
|
|
:disabled="type == 'detail'"
|
|
|
|
|
+ @change="(val) => handleQualityResultsChange(val, row, $index)"
|
|
|
>
|
|
>
|
|
|
<el-option
|
|
<el-option
|
|
|
v-for="item in qualityResultsList"
|
|
v-for="item in qualityResultsList"
|
|
@@ -428,6 +429,13 @@
|
|
|
slot: 'sampleNoQualifiedNumber',
|
|
slot: 'sampleNoQualifiedNumber',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
label: '样品不合格数',
|
|
label: '样品不合格数',
|
|
|
|
|
+ formatter: (row) => {
|
|
|
|
|
+ if (row.sampleNoQualifiedNumber) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ row.sampleNoQualifiedNumber + (this.form.measureUnit || '')
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
showOverflowTooltip: true
|
|
showOverflowTooltip: true
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -976,6 +984,58 @@
|
|
|
) {
|
|
) {
|
|
|
this.setNumber(item, index, type, '留样', 'retainedSampleQuantity');
|
|
this.setNumber(item, index, type, '留样', 'retainedSampleQuantity');
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ handleQualityResultsChange(val, row, index) {
|
|
|
|
|
+ //切换到合格:把不合格数移到合格数
|
|
|
|
|
+ if (val == 1) {
|
|
|
|
|
+ if (
|
|
|
|
|
+ row.qualifiedQuantity == 0 &&
|
|
|
|
|
+ row.noQualifiedQuantity &&
|
|
|
|
|
+ row.noQualifiedQuantity != 0
|
|
|
|
|
+ ) {
|
|
|
|
|
+ this.$set(row, 'qualifiedQuantity', row.noQualifiedQuantity);
|
|
|
|
|
+ this.$set(row, 'noQualifiedQuantity', 0);
|
|
|
|
|
+ this.isQualifiedQuantity(row, index, 'qualifiedQuantity');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //切换到不合格:把合格数移到不合格数
|
|
|
|
|
+ if (val == 2) {
|
|
|
|
|
+ if (
|
|
|
|
|
+ row.noQualifiedQuantity == 0 &&
|
|
|
|
|
+ row.qualifiedQuantity &&
|
|
|
|
|
+ row.qualifiedQuantity != 0
|
|
|
|
|
+ ) {
|
|
|
|
|
+ this.$set(row, 'noQualifiedQuantity', row.qualifiedQuantity);
|
|
|
|
|
+ this.$set(row, 'qualifiedQuantity', 0);
|
|
|
|
|
+ this.isQualifiedQuantity(row, index, 'noQualifiedQuantity');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ watch: {
|
|
|
|
|
+ tableData: {
|
|
|
|
|
+ deep: true,
|
|
|
|
|
+ handler(newVal) {
|
|
|
|
|
+ if (!newVal || !newVal.length) {
|
|
|
|
|
+ this.form.sampleNoQualifiedNumber = 0;
|
|
|
|
|
+ this.form.sampleQualifiedNumber = this.form.sampleQuantity || 0;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ const totalQualified = newVal.reduce((sum, item) => {
|
|
|
|
|
+ return sum + (Number(item.qualifiedQuantity) || 0);
|
|
|
|
|
+ }, 0);
|
|
|
|
|
+ const totalNoQualified = newVal.reduce((sum, item) => {
|
|
|
|
|
+ return sum + (Number(item.noQualifiedQuantity) || 0);
|
|
|
|
|
+ }, 0);
|
|
|
|
|
+ this.$set(this.form, 'sampleNoQualifiedNumber', totalNoQualified);
|
|
|
|
|
+ const qualifiedNumber = totalQualified - totalNoQualified;
|
|
|
|
|
+ if (qualifiedNumber < 0) {
|
|
|
|
|
+ this.$message.warning('样品合格数不能小于0');
|
|
|
|
|
+ this.$set(this.form, 'sampleQualifiedNumber', 0);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$set(this.form, 'sampleQualifiedNumber', qualifiedNumber);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|