完善电池复投管理功能迁移
This commit is contained in:
@@ -3080,7 +3080,7 @@
|
|||||||
"end_time": "结束时间"
|
"end_time": "结束时间"
|
||||||
},
|
},
|
||||||
"rework_management": {
|
"rework_management": {
|
||||||
"active": "激活",
|
"active": "已激活",
|
||||||
"not_activated": "未激活",
|
"not_activated": "未激活",
|
||||||
"reset": "重置",
|
"reset": "重置",
|
||||||
"battery_id": "电池条码",
|
"battery_id": "电池条码",
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:title="$t(key('multi_battery_input'))"
|
||||||
|
:visible.sync="visibleProxy"
|
||||||
|
width="520px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
@open="onOpen"
|
||||||
|
>
|
||||||
|
<el-form>
|
||||||
|
<el-form-item :label="$t(key('input_rule'))">
|
||||||
|
<el-input v-model="inputValue" type="textarea" :rows="8" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer">
|
||||||
|
<el-button size="mini" @click="visibleProxy = false">{{ $t(key('cancel')) }}</el-button>
|
||||||
|
<el-button size="mini" type="primary" @click="onConfirm">{{ $t(key('confirm')) }}</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { i18nMixin } from '@/composables/useI18n'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'BatteryInputDialog',
|
||||||
|
mixins: [i18nMixin('page.planning_production.production_monitoring.rework_management')],
|
||||||
|
props: {
|
||||||
|
visible: { type: Boolean, default: false },
|
||||||
|
value: { type: String, default: '' }
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
inputValue: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
visibleProxy: {
|
||||||
|
get () { return this.visible },
|
||||||
|
set (value) { this.$emit('update:visible', value) }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onOpen () {
|
||||||
|
this.inputValue = this.value
|
||||||
|
},
|
||||||
|
onConfirm () {
|
||||||
|
this.$emit('confirm', this.inputValue)
|
||||||
|
this.visibleProxy = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -44,7 +44,6 @@
|
|||||||
:pagination="null"
|
:pagination="null"
|
||||||
:table-attrs="{ size: 'mini', rowKey: 'battery_id', highlightCurrentRow: true }"
|
:table-attrs="{ size: 'mini', rowKey: 'battery_id', highlightCurrentRow: true }"
|
||||||
auto-height
|
auto-height
|
||||||
@selection-change="onSelectionChange"
|
|
||||||
>
|
>
|
||||||
<template #col-active="{ row }">
|
<template #col-active="{ row }">
|
||||||
<el-tag :type="Number(row.active) === 0 ? 'info' : 'success'" size="mini">
|
<el-tag :type="Number(row.active) === 0 ? 'info' : 'success'" size="mini">
|
||||||
@@ -56,17 +55,11 @@
|
|||||||
</template>
|
</template>
|
||||||
</page-table>
|
</page-table>
|
||||||
|
|
||||||
<el-dialog :title="$t(key('multi_battery_input'))" :visible.sync="dialogVisible" width="520px">
|
<battery-input-dialog
|
||||||
<el-form>
|
:visible.sync="dialogVisible"
|
||||||
<el-form-item :label="$t(key('input_rule'))">
|
:value="dialogBatteryIds"
|
||||||
<el-input v-model="dialogBatteryIds" type="textarea" :rows="8" />
|
@confirm="confirmBatchInput"
|
||||||
</el-form-item>
|
/>
|
||||||
</el-form>
|
|
||||||
<span slot="footer">
|
|
||||||
<el-button size="mini" @click="dialogVisible = false">{{ $t(key('cancel')) }}</el-button>
|
|
||||||
<el-button size="mini" type="primary" @click="confirmBatchInput">{{ $t(key('confirm')) }}</el-button>
|
|
||||||
</span>
|
|
||||||
</el-dialog>
|
|
||||||
</d2-container>
|
</d2-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -74,12 +67,13 @@
|
|||||||
import { useTableColumns } from '@/composables/useTableColumns'
|
import { useTableColumns } from '@/composables/useTableColumns'
|
||||||
import { i18nMixin } from '@/composables/useI18n'
|
import { i18nMixin } from '@/composables/useI18n'
|
||||||
import PageTable from '@/components/page-table'
|
import PageTable from '@/components/page-table'
|
||||||
|
import BatteryInputDialog from './components/BatteryInputDialog'
|
||||||
import { sendWorkerman } from '@/api/production-master-data/workerman'
|
import { sendWorkerman } from '@/api/production-master-data/workerman'
|
||||||
import { verifyBatteryRebatchInfo } from '@/api/planning-production/rework-management'
|
import { verifyBatteryRebatchInfo } from '@/api/planning-production/rework-management'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'planning-production-rework-management',
|
name: 'planning-production-rework-management',
|
||||||
components: { PageTable },
|
components: { PageTable, BatteryInputDialog },
|
||||||
mixins: [i18nMixin('page.planning_production.production_monitoring.rework_management')],
|
mixins: [i18nMixin('page.planning_production.production_monitoring.rework_management')],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@@ -88,7 +82,6 @@ export default {
|
|||||||
battery_ids: ''
|
battery_ids: ''
|
||||||
},
|
},
|
||||||
tableData: [],
|
tableData: [],
|
||||||
selectedRows: [],
|
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogBatteryIds: ''
|
dialogBatteryIds: ''
|
||||||
}
|
}
|
||||||
@@ -133,17 +126,34 @@ export default {
|
|||||||
this.dialogBatteryIds = ''
|
this.dialogBatteryIds = ''
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
},
|
},
|
||||||
confirmBatchInput () {
|
confirmBatchInput (value) {
|
||||||
this.form.battery_ids = this.normalizeBatteryIds(this.dialogBatteryIds)
|
this.dialogBatteryIds = value
|
||||||
this.dialogVisible = false
|
this.form.battery_ids = this.normalizeBatteryIds(value)
|
||||||
|
},
|
||||||
|
normalizeVerifyPayload (res) {
|
||||||
|
const payload = res && res.code !== undefined && res.data !== undefined ? res.data : res
|
||||||
|
if (
|
||||||
|
payload &&
|
||||||
|
!Array.isArray(payload) &&
|
||||||
|
payload.data &&
|
||||||
|
!Array.isArray(payload.data) &&
|
||||||
|
payload.data.data
|
||||||
|
) {
|
||||||
|
return payload.data
|
||||||
|
}
|
||||||
|
return payload || {}
|
||||||
|
},
|
||||||
|
normalizeVerifyRows (payload) {
|
||||||
|
if (Array.isArray(payload)) return payload
|
||||||
|
return Array.isArray(payload.data) ? payload.data : []
|
||||||
},
|
},
|
||||||
verifyData () {
|
verifyData () {
|
||||||
if (!this.ensureBatteryInput()) return
|
if (!this.ensureBatteryInput()) return
|
||||||
this.loading = true
|
this.loading = true
|
||||||
verifyBatteryRebatchInfo(this.form)
|
verifyBatteryRebatchInfo(this.form)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const data = res && res.data ? res.data : res
|
const data = this.normalizeVerifyPayload(res)
|
||||||
this.tableData = data.data || []
|
this.tableData = this.normalizeVerifyRows(data)
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
@@ -151,8 +161,7 @@ export default {
|
|||||||
},
|
},
|
||||||
setBatteryRebatch () {
|
setBatteryRebatch () {
|
||||||
if (!this.ensureBatteryInput()) return
|
if (!this.ensureBatteryInput()) return
|
||||||
const sourceRows = this.selectedRows.length ? this.selectedRows : this.tableData
|
const batteryIds = this.tableData.map(item => item.battery_id).filter(Boolean)
|
||||||
const batteryIds = sourceRows.map(item => item.battery_id).filter(Boolean)
|
|
||||||
if (!batteryIds.length) {
|
if (!batteryIds.length) {
|
||||||
this.$message.warning(this.$t(this.key('verify_data_before_action')))
|
this.$message.warning(this.$t(this.key('verify_data_before_action')))
|
||||||
return
|
return
|
||||||
@@ -189,11 +198,7 @@ export default {
|
|||||||
resetForm () {
|
resetForm () {
|
||||||
if (this.$refs.form) this.$refs.form.resetFields()
|
if (this.$refs.form) this.$refs.form.resetFields()
|
||||||
this.tableData = []
|
this.tableData = []
|
||||||
this.selectedRows = []
|
|
||||||
this.dialogBatteryIds = ''
|
this.dialogBatteryIds = ''
|
||||||
},
|
|
||||||
onSelectionChange (rows) {
|
|
||||||
this.selectedRows = rows
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user