完善电池复投管理功能迁移
Some checks failed
Release pipeline / publish (push) Has been cancelled
Release pipeline / Always run job (push) Has been cancelled

This commit is contained in:
sheng
2026-06-25 16:46:38 +08:00
parent 44d5c084e1
commit 5cb8e0a91d
3 changed files with 83 additions and 26 deletions

View File

@@ -3080,7 +3080,7 @@
"end_time": "结束时间"
},
"rework_management": {
"active": "激活",
"active": "激活",
"not_activated": "未激活",
"reset": "重置",
"battery_id": "电池条码",

View File

@@ -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>

View File

@@ -44,7 +44,6 @@
:pagination="null"
:table-attrs="{ size: 'mini', rowKey: 'battery_id', highlightCurrentRow: true }"
auto-height
@selection-change="onSelectionChange"
>
<template #col-active="{ row }">
<el-tag :type="Number(row.active) === 0 ? 'info' : 'success'" size="mini">
@@ -56,17 +55,11 @@
</template>
</page-table>
<el-dialog :title="$t(key('multi_battery_input'))" :visible.sync="dialogVisible" width="520px">
<el-form>
<el-form-item :label="$t(key('input_rule'))">
<el-input v-model="dialogBatteryIds" type="textarea" :rows="8" />
</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>
<battery-input-dialog
:visible.sync="dialogVisible"
:value="dialogBatteryIds"
@confirm="confirmBatchInput"
/>
</d2-container>
</template>
@@ -74,12 +67,13 @@
import { useTableColumns } from '@/composables/useTableColumns'
import { i18nMixin } from '@/composables/useI18n'
import PageTable from '@/components/page-table'
import BatteryInputDialog from './components/BatteryInputDialog'
import { sendWorkerman } from '@/api/production-master-data/workerman'
import { verifyBatteryRebatchInfo } from '@/api/planning-production/rework-management'
export default {
name: 'planning-production-rework-management',
components: { PageTable },
components: { PageTable, BatteryInputDialog },
mixins: [i18nMixin('page.planning_production.production_monitoring.rework_management')],
data () {
return {
@@ -88,7 +82,6 @@ export default {
battery_ids: ''
},
tableData: [],
selectedRows: [],
dialogVisible: false,
dialogBatteryIds: ''
}
@@ -133,17 +126,34 @@ export default {
this.dialogBatteryIds = ''
this.dialogVisible = true
},
confirmBatchInput () {
this.form.battery_ids = this.normalizeBatteryIds(this.dialogBatteryIds)
this.dialogVisible = false
confirmBatchInput (value) {
this.dialogBatteryIds = value
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 () {
if (!this.ensureBatteryInput()) return
this.loading = true
verifyBatteryRebatchInfo(this.form)
.then(res => {
const data = res && res.data ? res.data : res
this.tableData = data.data || []
const data = this.normalizeVerifyPayload(res)
this.tableData = this.normalizeVerifyRows(data)
})
.finally(() => {
this.loading = false
@@ -151,8 +161,7 @@ export default {
},
setBatteryRebatch () {
if (!this.ensureBatteryInput()) return
const sourceRows = this.selectedRows.length ? this.selectedRows : this.tableData
const batteryIds = sourceRows.map(item => item.battery_id).filter(Boolean)
const batteryIds = this.tableData.map(item => item.battery_id).filter(Boolean)
if (!batteryIds.length) {
this.$message.warning(this.$t(this.key('verify_data_before_action')))
return
@@ -189,11 +198,7 @@ export default {
resetForm () {
if (this.$refs.form) this.$refs.form.resetFields()
this.tableData = []
this.selectedRows = []
this.dialogBatteryIds = ''
},
onSelectionChange (rows) {
this.selectedRows = rows
}
}
}