迁移电池追溯模块
This commit is contained in:
31
docs/功能测试-电池追溯.md
Normal file
31
docs/功能测试-电池追溯.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# 功能测试 - 电池追溯
|
||||
|
||||
> 模块:数据中台 / 基础追溯 / 电池追溯 (Battery Traceability)
|
||||
> 路由:`/data_middleground/produce/traceability/battery`
|
||||
|
||||
## 测试前置条件
|
||||
|
||||
- 测试账号具备访问“电池追溯”的菜单权限。
|
||||
- 准备至少 1 个存在工序过程数据的电池条码。
|
||||
- 准备 1 个已激活电池和 1 个 NG 且未激活电池,用于验证操作按钮。
|
||||
|
||||
## 测试任务列表
|
||||
|
||||
| 序号 | 测试项 | 操作步骤 | 预期结果 |
|
||||
|---:|---|---|---|
|
||||
| 1 | 页面入口 | 进入“电池追溯”页面 | 页面显示电池条码输入框、查询、重置按钮和列表区域 |
|
||||
| 2 | 电池查询 | 输入有效电池条码并查询 | 表格展示批次、托盘、LOT、激活状态、GOOD/NG、等级、不良信息、当前工序 |
|
||||
| 3 | URL 参数查询 | 访问路由并携带 `?battery_id=xxx` | 页面自动按该电池条码查询 |
|
||||
| 4 | 打开电池详情 | 点击某行“电池详情” | 弹出全屏详情,左侧展示工序列表,右侧展示默认工序数据 |
|
||||
| 5 | 切换工序 | 在详情中点击不同工序 | 右侧工序数据按选中工序刷新 |
|
||||
| 6 | 工序数据搜索 | 在详情中输入项目名称关键字 | 工序数据表按项目名称过滤 |
|
||||
| 7 | 取消激活 | 对已激活电池点击取消激活并确认 | 调用取消激活接口,行状态更新为停止 |
|
||||
| 8 | 复投激活 | 对 NG 且未激活电池点击复投激活并确认 | 调用 Workerman 复投接口,成功后刷新该电池数据 |
|
||||
| 9 | 重置功能 | 查询后点击重置 | 电池条码、列表和分页状态清空 |
|
||||
| 10 | 国际化检查 | 切换中英文语言后重新进入页面 | 页面按钮、表格列和弹窗文案随语言切换显示 |
|
||||
|
||||
## 回归关注点
|
||||
|
||||
- 工序详情接口必须携带当前行的批次、电池条码、托盘、LOT 和工序信息。
|
||||
- 取消激活接口参数 `batterData` 必须是数组 JSON。
|
||||
- 复投激活必须发送 `set_battery_rebatch` action。
|
||||
@@ -3,8 +3,8 @@
|
||||
> 根据 `后台Webman界面截图对照表.md` 生成。状态以当前 V2 项目中已落地的页面目录为准。
|
||||
|
||||
- 总功能数:79
|
||||
- 已迁移:31
|
||||
- 未迁移:48
|
||||
- 已迁移:32
|
||||
- 未迁移:47
|
||||
|
||||
| 状态 | 一级模块 | 二级模块 | 三级模块 | 功能说明 | V2 目标路径 |
|
||||
|:---:|---|---|---|---|---|
|
||||
@@ -83,7 +83,7 @@
|
||||
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 正向追溯 (Forward Traceability) | 正向追溯 | `src/views/data-platform/traceability/forward/` |
|
||||
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 电池曲线 (Battery Curve) | 电池曲线 | `src/views/data-platform/traceability/battery-curve/` |
|
||||
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 托盘追溯 (Tray Traceability) | 托盘追溯 | `src/views/data-platform/traceability/tray/` |
|
||||
| ⬜ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 电池追溯 (Battery Traceability) | | 待确认 |
|
||||
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 电池追溯 (Battery Traceability) | 电池追溯 | `src/views/data-platform/traceability/battery/` |
|
||||
| ⬜ | 数据中台 (Data Platform) | 生产报表 (Production Reports) | 设备履历报表 (Equipment History Report) | | 待确认 |
|
||||
| ⬜ | 数据中台 (Data Platform) | 生产报表 (Production Reports) | 电池详情报表 (Battery Detail Report) | | 待确认 |
|
||||
| ⬜ | 数据中台 (Data Platform) | 相关性分析 (Correlation Analysis) | 鹰眼 (Hawkeye) | | 待确认 |
|
||||
|
||||
31
src/api/data-platform/traceability/battery.js
Normal file
31
src/api/data-platform/traceability/battery.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'planning_production/produce/traceability/'
|
||||
|
||||
function apiParams (method, data = {}) {
|
||||
return { method, platform: 'background', ...data }
|
||||
}
|
||||
|
||||
export function getBatteryTraceList (data) {
|
||||
return request({
|
||||
url: BASE + 'battery',
|
||||
method: 'get',
|
||||
params: apiParams('planning_production_produce_traceability_battery', data)
|
||||
})
|
||||
}
|
||||
|
||||
export function getBatteryProcessData (data) {
|
||||
return request({
|
||||
url: BASE + 'batteryProcess',
|
||||
method: 'get',
|
||||
params: apiParams('planning_production_produce_traceability_batteryProcess', data)
|
||||
})
|
||||
}
|
||||
|
||||
export function cancelBatteryActive (data) {
|
||||
return request({
|
||||
url: BASE + 'batteryactive',
|
||||
method: 'get',
|
||||
params: apiParams('planning_production_produce_traceability_batteryactive', data)
|
||||
})
|
||||
}
|
||||
@@ -1304,6 +1304,37 @@
|
||||
"grade": "Grade",
|
||||
"please_select_at_least_one_battery": "Select at least one battery",
|
||||
"cancel_success": "Cancel active successfully"
|
||||
},
|
||||
"battery": {
|
||||
"query": "Search",
|
||||
"reset": "Reset",
|
||||
"battery_code": "Battery Barcode",
|
||||
"enter_battery_code": "Enter battery barcode",
|
||||
"login_batch": "Login Batch",
|
||||
"tray_no": "Tray No.",
|
||||
"lot": "LOT",
|
||||
"is_active": "Active",
|
||||
"activated": "Activated",
|
||||
"stopped": "Stopped",
|
||||
"good_or_ng": "GOOD/NG",
|
||||
"grade": "Grade",
|
||||
"ng_info": "NG Info",
|
||||
"current_process_code": "Current Process Code",
|
||||
"battery_detail": "Battery Detail",
|
||||
"cancel_activation": "Cancel Active",
|
||||
"reinvestment_activation": "Rework Activation",
|
||||
"no_data": "No data",
|
||||
"title": "Battery [{battery_id}] Traceability Detail",
|
||||
"process_label": "Process",
|
||||
"process_data": "Process Data",
|
||||
"item_name": "Item Name",
|
||||
"content": "Content",
|
||||
"search_item_name": "Search item name",
|
||||
"prompt": "Prompt",
|
||||
"cancel_active_confirm": "Cancel activation for this battery?",
|
||||
"activation_confirm": "Execute rework activation?",
|
||||
"cancel_success": "Cancel active successfully",
|
||||
"activation_success": "Rework activation successfully"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1304,6 +1304,37 @@
|
||||
"grade": "等级",
|
||||
"please_select_at_least_one_battery": "请至少选择一个电池",
|
||||
"cancel_success": "取消激活成功"
|
||||
},
|
||||
"battery": {
|
||||
"query": "查询",
|
||||
"reset": "重置",
|
||||
"battery_code": "电池条码",
|
||||
"enter_battery_code": "请输入电池条码",
|
||||
"login_batch": "登录批次",
|
||||
"tray_no": "托盘号",
|
||||
"lot": "LOT",
|
||||
"is_active": "是否激活",
|
||||
"activated": "已激活",
|
||||
"stopped": "已停止",
|
||||
"good_or_ng": "良品/不良",
|
||||
"grade": "等级",
|
||||
"ng_info": "不良信息",
|
||||
"current_process_code": "当前工序编码",
|
||||
"battery_detail": "电池详情",
|
||||
"cancel_activation": "取消激活",
|
||||
"reinvestment_activation": "复投激活",
|
||||
"no_data": "暂无数据",
|
||||
"title": "电池【{battery_id}】追溯详情",
|
||||
"process_label": "工序",
|
||||
"process_data": "工序数据",
|
||||
"item_name": "项目名称",
|
||||
"content": "内容",
|
||||
"search_item_name": "搜索项目名称",
|
||||
"prompt": "提示",
|
||||
"cancel_active_confirm": "确认取消该电池激活?",
|
||||
"activation_confirm": "确认执行复投激活?",
|
||||
"cancel_success": "取消激活成功",
|
||||
"activation_success": "复投激活成功"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,12 @@ export default {
|
||||
name: `${pre}traceability-tray`,
|
||||
meta: { ...meta, cache: true, title: '托盘追溯' },
|
||||
component: _import('data-platform/traceability/tray')
|
||||
},
|
||||
{
|
||||
path: 'produce/traceability/battery',
|
||||
name: `${pre}traceability-battery`,
|
||||
meta: { ...meta, cache: true, title: '电池追溯' },
|
||||
component: _import('data-platform/traceability/battery')
|
||||
}
|
||||
])('data_middleground-')
|
||||
}
|
||||
|
||||
222
src/views/data-platform/traceability/battery/index.vue
Normal file
222
src/views/data-platform/traceability/battery/index.vue
Normal file
@@ -0,0 +1,222 @@
|
||||
<template>
|
||||
<d2-container>
|
||||
<template #header>
|
||||
<div class="search-bar">
|
||||
<el-form ref="searchForm" :inline="true" :model="search" size="mini">
|
||||
<el-form-item :label="$t(key('battery_code'))" prop="battery_id">
|
||||
<el-input v-model.trim="search.battery_id" :placeholder="$t(key('enter_battery_code'))" clearable style="width:240px" @keyup.enter.native="fetchData" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" :disabled="loading" @click="fetchData">{{ $t(key('query')) }}</el-button>
|
||||
<el-button icon="el-icon-refresh" :disabled="loading" @click="resetSearch">{{ $t(key('reset')) }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<page-table
|
||||
:columns="columns"
|
||||
:data="tableData"
|
||||
:loading="loading"
|
||||
:toolbar-buttons="[]"
|
||||
:row-buttons="rowButtons"
|
||||
:pagination="pagination"
|
||||
:table-attrs="{ size: 'mini', rowKey: 'battery_id', highlightCurrentRow: true }"
|
||||
auto-height
|
||||
@page-change="onPageChange"
|
||||
>
|
||||
<template #col-active="{ row }">
|
||||
<el-tag :type="Number(row.active) === 1 ? 'success' : 'warning'" size="mini">{{ Number(row.active) === 1 ? $t(key('activated')) : $t(key('stopped')) }}</el-tag>
|
||||
</template>
|
||||
<template #col-class="{ row }">
|
||||
<el-tag v-if="row.class === 'GOOD'" type="success" size="mini">GOOD</el-tag>
|
||||
<el-tag v-else-if="row.class === 'NG'" type="warning" size="mini">NG</el-tag>
|
||||
<span v-else>{{ row.class || '-' }}</span>
|
||||
</template>
|
||||
<template #empty>
|
||||
<el-empty :description="$t(key('no_data'))" :image-size="80" />
|
||||
</template>
|
||||
</page-table>
|
||||
|
||||
<el-dialog :visible.sync="detailVisible" :show-close="false" fullscreen append-to-body>
|
||||
<div slot="title">
|
||||
<el-page-header @back="closeDetail" :content="detailTitle" />
|
||||
</div>
|
||||
<div class="detail-layout">
|
||||
<aside class="process-list">
|
||||
<el-card shadow="never">
|
||||
<div slot="header">{{ $t(key('process_label')) }}</div>
|
||||
<el-button
|
||||
v-for="(item, index) in processList"
|
||||
:key="index"
|
||||
class="process-button"
|
||||
:type="activeProcessIndex === index ? 'primary' : 'default'"
|
||||
@click="selectProcess(index)"
|
||||
>
|
||||
{{ item.process_name || item.process_code || '-' }}
|
||||
</el-button>
|
||||
</el-card>
|
||||
</aside>
|
||||
<main class="process-detail">
|
||||
<el-card shadow="never">
|
||||
<div slot="header">【{{ activeProcessName }}】{{ $t(key('process_data')) }}</div>
|
||||
<el-input v-model.trim="detailKeyword" size="mini" clearable :placeholder="$t(key('search_item_name'))" class="detail-search" />
|
||||
<el-table :data="filteredGridData" border size="mini" height="calc(100vh - 230px)">
|
||||
<el-table-column type="index" width="60" />
|
||||
<el-table-column prop="name" :label="$t(key('item_name'))" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column prop="content" :label="$t(key('content'))" min-width="220" show-overflow-tooltip />
|
||||
</el-table>
|
||||
</el-card>
|
||||
</main>
|
||||
</div>
|
||||
</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 { cancelBatteryActive, getBatteryProcessData, getBatteryTraceList } from '@/api/data-platform/traceability/battery'
|
||||
|
||||
export default {
|
||||
name: 'data-platform-traceability-battery',
|
||||
components: { PageTable },
|
||||
mixins: [i18nMixin('page.data_platform.traceability.battery')],
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
search: { battery_id: this.$route.query.battery_id || '' },
|
||||
tableData: [],
|
||||
pagination: { current: 1, size: 10, total: 0 },
|
||||
detailVisible: false,
|
||||
activeBattery: {},
|
||||
processList: [],
|
||||
activeProcessIndex: -1,
|
||||
gridData: [],
|
||||
detailKeyword: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
columns () {
|
||||
return useTableColumns([
|
||||
{ prop: 'battery_id', label: this.key('battery_code'), minWidth: 180, showOverflowTooltip: true },
|
||||
{ prop: 'batch', label: this.key('login_batch'), minWidth: 140, showOverflowTooltip: true },
|
||||
{ prop: 'tray', label: this.key('tray_no'), minWidth: 130, showOverflowTooltip: true },
|
||||
{ prop: 'lot', label: this.key('lot'), minWidth: 120, showOverflowTooltip: true },
|
||||
{ prop: 'active', label: this.key('is_active'), minWidth: 110, slot: 'active' },
|
||||
{ prop: 'class', label: this.key('good_or_ng'), minWidth: 110, slot: 'class' },
|
||||
{ prop: 'classname', label: this.key('grade'), minWidth: 120, showOverflowTooltip: true },
|
||||
{ prop: 'explain', label: this.key('ng_info'), minWidth: 160, showOverflowTooltip: true },
|
||||
{ prop: 'next_process_code', label: this.key('current_process_code'), minWidth: 160, showOverflowTooltip: true }
|
||||
], { selectionWidth: 0, indexWidth: 55, operationWidth: 260 })
|
||||
},
|
||||
rowButtons () {
|
||||
return [
|
||||
{ key: 'detail', label: this.key('battery_detail'), type: 'primary', icon: 'el-icon-document', size: 'mini', onClick: this.openDetail },
|
||||
{ key: 'cancel', label: this.key('cancel_activation'), type: 'warning', icon: 'el-icon-close', size: 'mini', visible: row => Number(row.active) === 1, onClick: this.cancelActive },
|
||||
{ key: 'rebatch', label: this.key('reinvestment_activation'), type: 'success', icon: 'el-icon-refresh-right', size: 'mini', visible: row => Number(row.active) === 0 && row.class === 'NG', onClick: this.reinvestmentActivation }
|
||||
]
|
||||
},
|
||||
detailTitle () {
|
||||
return this.$t(this.key('title'), { battery_id: this.activeBattery.battery_id || '' })
|
||||
},
|
||||
activeProcessName () {
|
||||
const item = this.processList[this.activeProcessIndex] || {}
|
||||
return item.process_name || item.process_code || '-'
|
||||
},
|
||||
filteredGridData () {
|
||||
const keyword = String(this.detailKeyword || '').toLowerCase()
|
||||
return this.gridData.filter(item => !keyword || String(item.name || '').toLowerCase().includes(keyword))
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$route.query.battery_id' (value) {
|
||||
if (value) {
|
||||
this.search.battery_id = value
|
||||
this.fetchData()
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if (this.search.battery_id) this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
responseData (res) { return res && res.data !== undefined ? res.data : res },
|
||||
async fetchData () {
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await getBatteryTraceList({ ...this.search, action: 'battery_traceability_search', page_no: this.pagination.current, page_size: this.pagination.size })
|
||||
const data = this.responseData(res)
|
||||
this.tableData = Array.isArray(data) ? data : []
|
||||
this.pagination.total = Number(data && data.count) || this.tableData.length
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
resetSearch () {
|
||||
this.search.battery_id = ''
|
||||
this.tableData = []
|
||||
this.pagination.current = 1
|
||||
this.pagination.total = 0
|
||||
},
|
||||
onPageChange (page) {
|
||||
this.pagination = { ...this.pagination, ...page }
|
||||
this.fetchData()
|
||||
},
|
||||
openDetail (row) {
|
||||
this.activeBattery = row
|
||||
this.processList = Array.isArray(row.process) ? row.process : []
|
||||
this.activeProcessIndex = -1
|
||||
this.gridData = []
|
||||
this.detailKeyword = ''
|
||||
this.detailVisible = true
|
||||
if (this.processList.length) this.selectProcess(0)
|
||||
},
|
||||
closeDetail () {
|
||||
this.detailVisible = false
|
||||
},
|
||||
async selectProcess (index) {
|
||||
const process = this.processList[index]
|
||||
if (!process) return
|
||||
this.activeProcessIndex = index
|
||||
const res = await getBatteryProcessData({
|
||||
process_code: process.process_code,
|
||||
process_id: process.process_id,
|
||||
batch: this.activeBattery.batch,
|
||||
battery_id: this.activeBattery.battery_id,
|
||||
tray: this.activeBattery.tray,
|
||||
lot: this.activeBattery.lot,
|
||||
action: 'get_one_battery_data'
|
||||
})
|
||||
const data = this.responseData(res)
|
||||
this.gridData = Array.isArray(data) ? data : []
|
||||
},
|
||||
async cancelActive (row) {
|
||||
await this.$confirm(this.$t(this.key('cancel_active_confirm')), this.$t(this.key('prompt')), { type: 'warning' })
|
||||
const batterData = [{ batch: row.batch, tray: row.tray, lot: row.lot, battery_id: row.battery_id }]
|
||||
await cancelBatteryActive({ batterData: JSON.stringify(batterData) })
|
||||
row.active = 0
|
||||
this.$message.success(this.$t(this.key('cancel_success')))
|
||||
},
|
||||
async reinvestmentActivation (row) {
|
||||
await this.$confirm(this.$t(this.key('activation_confirm')), this.$t(this.key('prompt')), { type: 'warning' })
|
||||
const sendData = { action: 'set_battery_rebatch', param: { battery_ids: [row.battery_id] } }
|
||||
await sendWorkerman({ sendData })
|
||||
this.$message.success(this.$t(this.key('activation_success')))
|
||||
this.search.battery_id = row.battery_id
|
||||
this.fetchData()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.search-bar { margin-bottom: -18px; }
|
||||
.detail-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; }
|
||||
.process-list { max-height: calc(100vh - 150px); overflow: auto; }
|
||||
.process-button { display: block; width: 100%; margin: 0 0 10px; }
|
||||
.process-detail { min-width: 0; }
|
||||
.detail-search { width: 260px; margin-bottom: 12px; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user