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

- 新增计划与生产电池复投管理 V2 页面

- 新增复投验证接口、旧路径路由和中英文文案

- 更新迁移任务列表并补充人工功能测试清单
This commit is contained in:
sheng
2026-06-22 16:26:05 +08:00
parent 9863bf1113
commit e3fd31e33d
7 changed files with 331 additions and 3 deletions

View File

@@ -0,0 +1,209 @@
<template>
<d2-container>
<template #header>
<div class="search-bar">
<el-form ref="form" :inline="true" :model="form" size="mini">
<el-form-item :label="$t(key('battery_id'))" prop="battery_ids">
<el-input
v-model="form.battery_ids"
:placeholder="$t(key('enter_battery_id'))"
class="battery-input"
clearable
@keyup.enter.native="verifyData"
>
<el-button slot="append" icon="el-icon-document-add" @click="openBatchInput" />
</el-input>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
:disabled="loading"
:loading="loading"
@click="verifyData"
>
{{ $t(key('verify_data')) }}
</el-button>
<el-button icon="el-icon-refresh" :disabled="loading" @click="resetForm">
{{ $t(key('reset')) }}
</el-button>
<el-button type="warning" :disabled="loading" @click="setBatteryRebatch">
{{ $t(key('re_activate')) }}
</el-button>
</el-form-item>
</el-form>
</div>
</template>
<page-table
:columns="columns"
:data="tableData"
:loading="loading"
:toolbar-buttons="[]"
:row-buttons="[]"
: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">
{{ Number(row.active) === 0 ? $t(key('not_activated')) : $t(key('active')) }}
</el-tag>
</template>
<template #empty>
<el-empty :description="$t('暂无数据')" :image-size="80" />
</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>
</d2-container>
</template>
<script>
import { useTableColumns } from '@/composables/useTableColumns'
import { i18nMixin } from '@/composables/useI18n'
import PageTable from '@/components/page-table'
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 },
mixins: [i18nMixin('page.planning_production.production_monitoring.rework_management')],
data () {
return {
loading: false,
form: {
battery_ids: ''
},
tableData: [],
selectedRows: [],
dialogVisible: false,
dialogBatteryIds: ''
}
},
computed: {
columns () {
return useTableColumns([
{ prop: 'battery_id', label: this.key('battery_id'), minWidth: 180, showOverflowTooltip: true },
{ prop: 'batch', label: this.key('batch'), minWidth: 150, showOverflowTooltip: true },
{ prop: 'tray', label: this.key('tray'), minWidth: 110, showOverflowTooltip: true },
{ prop: 'lot', label: this.key('lot'), minWidth: 90, showOverflowTooltip: true },
{ prop: 'active', label: this.key('active_status'), width: 120, slot: 'active' },
{ prop: 'class', label: this.key('class_type'), minWidth: 90, showOverflowTooltip: true },
{ prop: 'classname', label: this.key('class'), minWidth: 90, showOverflowTooltip: true },
{ prop: 'process_code', label: this.key('previous_process'), minWidth: 180, showOverflowTooltip: true },
{ prop: 'next_process_code', label: this.key('current_process'), minWidth: 180, showOverflowTooltip: true }
], {
selectionWidth: 55,
indexWidth: 55
}).map(col => {
if (col.type === 'index') col.label = this.key('sort')
return col
})
}
},
methods: {
normalizeBatteryIds (value) {
return String(value || '')
.split(/[\n,\s]+/)
.map(item => item.trim())
.filter(Boolean)
.join(',')
},
ensureBatteryInput () {
this.form.battery_ids = this.normalizeBatteryIds(this.form.battery_ids)
if (this.form.battery_ids) return true
this.$message.warning(this.$t(this.key('enter_battery_data')))
return false
},
openBatchInput () {
this.form.battery_ids = ''
this.dialogBatteryIds = ''
this.dialogVisible = true
},
confirmBatchInput () {
this.form.battery_ids = this.normalizeBatteryIds(this.dialogBatteryIds)
this.dialogVisible = false
},
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 || []
})
.finally(() => {
this.loading = false
})
},
setBatteryRebatch () {
if (!this.ensureBatteryInput()) return
const sourceRows = this.selectedRows.length ? this.selectedRows : this.tableData
const batteryIds = sourceRows.map(item => item.battery_id).filter(Boolean)
if (!batteryIds.length) {
this.$message.warning(this.$t(this.key('verify_data_before_action')))
return
}
this.$confirm(this.$t(this.key('re_activate_warning')), this.$t(this.key('prompt')), {
confirmButtonText: this.$t(this.key('confirm')),
cancelButtonText: this.$t(this.key('cancel')),
type: 'warning',
closeOnClickModal: false
}).then(() => {
this.loading = true
return sendWorkerman({
sendData: {
action: 'set_battery_rebatch',
param: {
battery_ids: batteryIds
}
}
}).then(res => {
const data = res && res.data ? res.data : res
if (data.code !== undefined && Number(data.code) !== 0) {
this.$message.warning(data.errmsg || data.msg || this.$t(this.key('rethrow_activation_failed')))
return
}
this.$message.success(this.$t(this.key('re_activate_success')))
}).catch(error => {
this.$message.warning(`${this.$t(this.key('rethrow_activation_failed'))}: ${error}`)
}).finally(() => {
this.loading = false
})
}).catch(() => {})
},
resetForm () {
if (this.$refs.form) this.$refs.form.resetFields()
this.tableData = []
this.selectedRows = []
this.dialogBatteryIds = ''
},
onSelectionChange (rows) {
this.selectedRows = rows
}
}
}
</script>
<style scoped>
.search-bar {
margin-bottom: -18px;
}
.battery-input {
width: 360px;
}
</style>