|
|
|
@ -2,7 +2,7 @@ |
|
|
|
<el-dialog |
|
|
|
:title="$t('qc.iqcPage.dataCollectEquipmentTitle')" |
|
|
|
:visible.sync="innerVisible" |
|
|
|
width="520px" |
|
|
|
width="780px" |
|
|
|
append-to-body |
|
|
|
:close-on-click-modal="false" |
|
|
|
custom-class="qc-data-acquisition-dialog"> |
|
|
|
@ -17,7 +17,7 @@ |
|
|
|
:label="$t('qc.iqcPage.equipmentType')" |
|
|
|
header-align="center" |
|
|
|
align="left" |
|
|
|
min-width="240" |
|
|
|
min-width="180" |
|
|
|
show-overflow-tooltip> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span class="equipment-type-text">{{ scope.row.equipmentDesc || scope.row.equipmentNo }}</span> |
|
|
|
@ -27,13 +27,46 @@ |
|
|
|
:label="$t('qc.iqcPage.whetherCollect')" |
|
|
|
header-align="center" |
|
|
|
align="center" |
|
|
|
width="110"> |
|
|
|
width="100"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-switch |
|
|
|
v-model="scope.row.collectFlag" |
|
|
|
:active-text="$t('qc.common.yes')" |
|
|
|
:inactive-text="$t('qc.common.no')" |
|
|
|
class="collect-flag-switch"> |
|
|
|
class="collect-flag-switch" |
|
|
|
@change="onCollectFlagChange(scope.row)"> |
|
|
|
</el-switch> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
:label="$t('qc.iqcPage.accumulateCollect')" |
|
|
|
header-align="center" |
|
|
|
align="center" |
|
|
|
width="110"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-switch |
|
|
|
v-model="scope.row.accumulateCollect" |
|
|
|
:disabled="!scope.row.collectFlag" |
|
|
|
:active-text="$t('qc.common.yes')" |
|
|
|
:inactive-text="$t('qc.common.no')" |
|
|
|
class="collect-flag-switch" |
|
|
|
@change="onAccumulateChange(scope.row)"> |
|
|
|
</el-switch> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
:label="$t('qc.iqcPage.deleteAfterCollect')" |
|
|
|
header-align="center" |
|
|
|
align="center" |
|
|
|
width="120"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-switch |
|
|
|
v-model="scope.row.deleteAfterCollect" |
|
|
|
:disabled="!scope.row.collectFlag" |
|
|
|
:active-text="$t('qc.common.yes')" |
|
|
|
:inactive-text="$t('qc.common.no')" |
|
|
|
class="collect-flag-switch" |
|
|
|
@change="onDeleteAfterChange(scope.row)"> |
|
|
|
</el-switch> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
@ -89,6 +122,47 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
normalizeCollectMode (item) { |
|
|
|
const accumulate = item.accumulateCollect === true || item.accumulateCollect === 1 |
|
|
|
const deleteAfter = item.deleteAfterCollect === true || item.deleteAfterCollect === 1 |
|
|
|
if (accumulate && !deleteAfter) { |
|
|
|
item.accumulateCollect = true |
|
|
|
item.deleteAfterCollect = false |
|
|
|
} else { |
|
|
|
item.accumulateCollect = false |
|
|
|
item.deleteAfterCollect = true |
|
|
|
} |
|
|
|
return item |
|
|
|
}, |
|
|
|
onCollectFlagChange (row) { |
|
|
|
if (row.collectFlag) { |
|
|
|
if (!row.accumulateCollect && !row.deleteAfterCollect) { |
|
|
|
row.deleteAfterCollect = true |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
onAccumulateChange (row) { |
|
|
|
if (!row.collectFlag) { |
|
|
|
row.accumulateCollect = false |
|
|
|
return |
|
|
|
} |
|
|
|
if (row.accumulateCollect) { |
|
|
|
row.deleteAfterCollect = false |
|
|
|
} else { |
|
|
|
row.deleteAfterCollect = true |
|
|
|
} |
|
|
|
}, |
|
|
|
onDeleteAfterChange (row) { |
|
|
|
if (!row.collectFlag) { |
|
|
|
row.deleteAfterCollect = false |
|
|
|
return |
|
|
|
} |
|
|
|
if (row.deleteAfterCollect) { |
|
|
|
row.accumulateCollect = false |
|
|
|
} else { |
|
|
|
row.accumulateCollect = true |
|
|
|
} |
|
|
|
}, |
|
|
|
loadEquipmentList () { |
|
|
|
this.loading = true |
|
|
|
this.equipmentList = [] |
|
|
|
@ -100,7 +174,7 @@ export default { |
|
|
|
this.loading = false |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.firstTime = !!data.firstTime |
|
|
|
this.equipmentList = (data.rows || []).map(item => ({ |
|
|
|
this.equipmentList = (data.rows || []).map(item => this.normalizeCollectMode({ |
|
|
|
...item, |
|
|
|
collectFlag: item.collectFlag !== false |
|
|
|
})) |
|
|
|
@ -118,24 +192,34 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
handleCollect () { |
|
|
|
const selected = this.equipmentList |
|
|
|
.filter(item => item.collectFlag) |
|
|
|
.map(item => item.equipmentNo) |
|
|
|
.filter(Boolean) |
|
|
|
const selectedRows = this.equipmentList.filter(item => item.collectFlag) |
|
|
|
const selected = selectedRows.map(item => item.equipmentNo).filter(Boolean) |
|
|
|
if (!selected.length) { |
|
|
|
this.$message.warning(this.$t('qc.entry.dataCollectSelectEquipment')) |
|
|
|
return |
|
|
|
} |
|
|
|
this.doCollect(selected, false) |
|
|
|
const invalid = selectedRows.some(item => !item.accumulateCollect && !item.deleteAfterCollect) |
|
|
|
if (invalid) { |
|
|
|
this.$message.warning(this.$t('qc.entry.dataCollectSelectMode')) |
|
|
|
return |
|
|
|
} |
|
|
|
this.doCollect(selectedRows, false) |
|
|
|
}, |
|
|
|
doCollect (equipmentNoList, confirmNewBatch) { |
|
|
|
doCollect (selectedRows, confirmNewBatch) { |
|
|
|
this.submitting = true |
|
|
|
const equipmentNoList = selectedRows.map(item => item.equipmentNo).filter(Boolean) |
|
|
|
const equipmentCollectList = selectedRows.map(item => ({ |
|
|
|
equipmentNo: item.equipmentNo, |
|
|
|
accumulateCollect: !!item.accumulateCollect, |
|
|
|
deleteAfterCollect: !!item.deleteAfterCollect |
|
|
|
})) |
|
|
|
dataAcquisition({ |
|
|
|
site: this.site, |
|
|
|
buNo: this.buNo, |
|
|
|
inspectionNo: this.inspectionNo, |
|
|
|
flag: this.flag, |
|
|
|
equipmentNoList, |
|
|
|
equipmentCollectList, |
|
|
|
confirmNewBatch |
|
|
|
}).then(({ data }) => { |
|
|
|
if (data && data.code === 0 && data.needConfirm) { |
|
|
|
@ -149,7 +233,7 @@ export default { |
|
|
|
type: 'warning' |
|
|
|
} |
|
|
|
).then(() => { |
|
|
|
this.doCollect(equipmentNoList, true) |
|
|
|
this.doCollect(selectedRows, true) |
|
|
|
}).catch(() => {}) |
|
|
|
return |
|
|
|
} |
|
|
|
|