迁移电池详情报表模块
This commit is contained in:
23
docs/功能测试-电池详情报表.md
Normal file
23
docs/功能测试-电池详情报表.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# 功能测试 - 电池详情报表
|
||||
|
||||
> 模块:数据中台 / 生产报表 / 电池详情报表 (Battery Detail Report)
|
||||
> 路由:`/data_middleground/produce/report/battery-detail`
|
||||
|
||||
## 测试任务列表
|
||||
|
||||
| 序号 | 测试项 | 操作步骤 | 预期结果 |
|
||||
|---:|---|---|---|
|
||||
| 1 | 页面入口 | 进入电池详情报表页面 | 页面显示工艺流程、批次、工序、托盘、时间筛选项 |
|
||||
| 2 | 工艺选择 | 选择工艺流程 | 批次和工序下拉数据按工艺刷新 |
|
||||
| 3 | 批次必填校验 | 不选批次点击查询 | 页面提示请选择批次 |
|
||||
| 4 | 查询报表 | 选择批次和筛选条件后查询 | 表格按动态表头展示电池详情数据 |
|
||||
| 5 | 分页切换 | 查询出多页数据后切换分页 | 当前页数据刷新,总数正确 |
|
||||
| 6 | 导出任务 | 选择批次后点击导出并确认 | 创建导出任务成功并跳转任务页面 |
|
||||
| 7 | 重置功能 | 点击重置 | 筛选项、动态表头、表格和分页清空 |
|
||||
| 8 | 国际化检查 | 切换中英文语言 | 页面文案随语言切换 |
|
||||
|
||||
## 回归关注点
|
||||
|
||||
- 查询前必须先获取动态表头。
|
||||
- 导出任务 action 必须为 `download`。
|
||||
- 后端返回嵌套表头时需要展开为可展示列。
|
||||
@@ -3,8 +3,8 @@
|
||||
> 根据 `后台Webman界面截图对照表.md` 生成。状态以当前 V2 项目中已落地的页面目录为准。
|
||||
|
||||
- 总功能数:79
|
||||
- 已迁移:33
|
||||
- 未迁移:46
|
||||
- 已迁移:34
|
||||
- 未迁移:45
|
||||
|
||||
| 状态 | 一级模块 | 二级模块 | 三级模块 | 功能说明 | V2 目标路径 |
|
||||
|:---:|---|---|---|---|---|
|
||||
@@ -85,7 +85,7 @@
|
||||
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 托盘追溯 (Tray Traceability) | 托盘追溯 | `src/views/data-platform/traceability/tray/` |
|
||||
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 电池追溯 (Battery Traceability) | 电池追溯 | `src/views/data-platform/traceability/battery/` |
|
||||
| ✅ | 数据中台 (Data Platform) | 生产报表 (Production Reports) | 设备履历报表 (Equipment History Report) | 设备履历报表 | `src/views/data-platform/production-reports/equipment-history/` |
|
||||
| ⬜ | 数据中台 (Data Platform) | 生产报表 (Production Reports) | 电池详情报表 (Battery Detail Report) | | 待确认 |
|
||||
| ✅ | 数据中台 (Data Platform) | 生产报表 (Production Reports) | 电池详情报表 (Battery Detail Report) | 电池详情报表 | `src/views/data-platform/production-reports/battery-detail/` |
|
||||
| ⬜ | 数据中台 (Data Platform) | 相关性分析 (Correlation Analysis) | 鹰眼 (Hawkeye) | | 待确认 |
|
||||
|
||||
## 状态说明
|
||||
|
||||
23
src/api/data-platform/production-reports/battery-detail.js
Normal file
23
src/api/data-platform/production-reports/battery-detail.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'planning_production/produce/battery_details_report/'
|
||||
|
||||
function dataParams (method, data = {}, platform = 'api') {
|
||||
return { method, platform, ...data }
|
||||
}
|
||||
|
||||
export function getBatteryDetailTitle (data) {
|
||||
return request({ url: BASE + 'battery_details_title', method: 'post', data: dataParams('production_report_battery_details_title', data) })
|
||||
}
|
||||
|
||||
export function getBatteryDetailList (data) {
|
||||
return request({ url: BASE + 'battery_details_list', method: 'post', data: dataParams('production_report_battery_details_list', data) })
|
||||
}
|
||||
|
||||
export function getBatteryDetailFlowBatch (data) {
|
||||
return request({ url: BASE + 'battery_details_flow_batch', method: 'get', params: dataParams('production_report_battery_details_flow_batch', data) })
|
||||
}
|
||||
|
||||
export function createBatteryDetailExportTask (data) {
|
||||
return request({ url: BASE + 'battery_details_task', method: 'post', data: dataParams('system_exporttask_battery_details_task', data, 'admin') })
|
||||
}
|
||||
@@ -1356,6 +1356,27 @@
|
||||
"duration": "Duration",
|
||||
"remark": "Remark",
|
||||
"no_data": "No data"
|
||||
},
|
||||
"battery_detail": {
|
||||
"query": "Search",
|
||||
"reset": "Reset",
|
||||
"export": "Export",
|
||||
"flow": "Process Flow",
|
||||
"select_flow": "Select process flow",
|
||||
"batch": "Batch",
|
||||
"select_batch": "Select batch",
|
||||
"process": "Process",
|
||||
"select_process": "Select process",
|
||||
"tray_no": "Tray No.",
|
||||
"enter_tray_no": "Enter tray no.",
|
||||
"time": "Completion Time",
|
||||
"start_date": "Start Time",
|
||||
"end_date": "End Time",
|
||||
"no_data": "No data",
|
||||
"please_select_batch": "Select batch",
|
||||
"export_confirm": "Create battery detail export task?",
|
||||
"prompt": "Prompt",
|
||||
"create_download_task_success": "Download task created successfully"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1356,6 +1356,27 @@
|
||||
"duration": "持续时长",
|
||||
"remark": "备注",
|
||||
"no_data": "暂无数据"
|
||||
},
|
||||
"battery_detail": {
|
||||
"query": "查询",
|
||||
"reset": "重置",
|
||||
"export": "导出",
|
||||
"flow": "工艺流程",
|
||||
"select_flow": "请选择工艺流程",
|
||||
"batch": "批次",
|
||||
"select_batch": "请选择批次",
|
||||
"process": "工序",
|
||||
"select_process": "请选择工序",
|
||||
"tray_no": "托盘号",
|
||||
"enter_tray_no": "请输入托盘号",
|
||||
"time": "完成时间",
|
||||
"start_date": "开始时间",
|
||||
"end_date": "结束时间",
|
||||
"no_data": "暂无数据",
|
||||
"please_select_batch": "请选择批次",
|
||||
"export_confirm": "确认创建电池详情报表导出任务?",
|
||||
"prompt": "提示",
|
||||
"create_download_task_success": "创建下载任务成功"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,12 @@ export default {
|
||||
name: `${pre}report-equipment-history`,
|
||||
meta: { ...meta, cache: true, title: '设备履历报表' },
|
||||
component: _import('data-platform/production-reports/equipment-history')
|
||||
},
|
||||
{
|
||||
path: 'produce/report/battery-detail',
|
||||
name: `${pre}report-battery-detail`,
|
||||
meta: { ...meta, cache: true, title: '电池详情报表' },
|
||||
component: _import('data-platform/production-reports/battery-detail')
|
||||
}
|
||||
])('data_middleground-')
|
||||
}
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
<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('flow'))" prop="flow_idx">
|
||||
<el-select v-model="search.flow_idx" :placeholder="$t(key('select_flow'))" clearable filterable style="width:180px" @change="onFlowChange">
|
||||
<el-option v-for="(item, index) in flowOptions" :key="item.id || index" :label="item.name" :value="index" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t(key('batch'))" prop="batch">
|
||||
<el-select v-model="search.batch" :placeholder="$t(key('select_batch'))" multiple collapse-tags clearable filterable style="width:220px">
|
||||
<el-option v-for="item in batchOptions" :key="item.id || item.batch" :label="item.batch" :value="item.batch" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t(key('process'))" prop="process_id">
|
||||
<el-select v-model="search.process_id" :placeholder="$t(key('select_process'))" multiple collapse-tags clearable filterable style="width:220px">
|
||||
<el-option v-for="item in processOptions" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t(key('tray_no'))" prop="tray">
|
||||
<el-input v-model.trim="search.tray" :placeholder="$t(key('enter_tray_no'))" clearable style="width:180px" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t(key('time'))" prop="time">
|
||||
<el-date-picker v-model="search.time" type="datetimerange" value-format="yyyy-MM-dd HH:mm:ss" :start-placeholder="$t(key('start_date'))" :end-placeholder="$t(key('end_date'))" style="width:330px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" :disabled="loading" @click="onSearch">{{ $t(key('query')) }}</el-button>
|
||||
<el-button icon="el-icon-refresh" :disabled="loading" @click="onReset">{{ $t(key('reset')) }}</el-button>
|
||||
<el-button type="primary" icon="el-icon-download" :disabled="loading" @click="exportTask">{{ $t(key('export')) }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="tableData" size="mini" border height="calc(100vh - 220px)">
|
||||
<el-table-column type="index" width="55" />
|
||||
<el-table-column v-for="column in flatColumns" :key="column.prop" :prop="column.prop" :label="column.label" min-width="160" show-overflow-tooltip />
|
||||
<template #empty><el-empty :description="$t(key('no_data'))" :image-size="80" /></template>
|
||||
</el-table>
|
||||
<div class="pager">
|
||||
<el-pagination background layout="total, sizes, prev, pager, next, jumper" :current-page="pagination.current" :page-size="pagination.size" :total="pagination.total" @current-change="changePage" @size-change="changeSize" />
|
||||
</div>
|
||||
</d2-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { i18nMixin } from '@/composables/useI18n'
|
||||
import { createBatteryDetailExportTask, getBatteryDetailFlowBatch, getBatteryDetailList, getBatteryDetailTitle } from '@/api/data-platform/production-reports/battery-detail'
|
||||
|
||||
export default {
|
||||
name: 'data-platform-production-reports-battery-detail',
|
||||
mixins: [i18nMixin('page.data_platform.production_reports.battery_detail')],
|
||||
data () {
|
||||
return { loading: false, search: { flow_idx: '', flow_id: '', batch: [], process_id: [], tray: '', time: [] }, flowOptions: [], batchOptions: [], processOptions: [], title: [], tableData: [], pagination: { current: 1, size: 10, total: 0 } }
|
||||
},
|
||||
computed: {
|
||||
flatColumns () {
|
||||
const result = []
|
||||
const walk = list => {
|
||||
;(Array.isArray(list) ? list : []).forEach(item => {
|
||||
if (Array.isArray(item.child) && item.child.length) walk(item.child)
|
||||
else if (item.prop) result.push({ prop: item.prop, label: item.label || item.prop })
|
||||
})
|
||||
}
|
||||
walk(this.title)
|
||||
if (result.length) return result
|
||||
const first = this.tableData[0] || {}
|
||||
return Object.keys(first).slice(0, 30).map(key => ({ prop: key, label: key }))
|
||||
}
|
||||
},
|
||||
mounted () { this.loadOptions() },
|
||||
methods: {
|
||||
responseData (res) { return res && res.data !== undefined ? res.data : res },
|
||||
async loadOptions () {
|
||||
const res = await getBatteryDetailFlowBatch({ action: 'where_data', batch: 'batch' })
|
||||
this.flowOptions = this.responseData(res) || []
|
||||
},
|
||||
onFlowChange (index) {
|
||||
const flow = this.flowOptions[index] || {}
|
||||
this.search.flow_id = flow.id || ''
|
||||
this.search.batch = []
|
||||
this.search.process_id = []
|
||||
this.batchOptions = Array.isArray(flow.batch_manage) ? flow.batch_manage : []
|
||||
this.processOptions = Array.isArray(flow.process) ? flow.process : []
|
||||
},
|
||||
buildParams () {
|
||||
const time = Array.isArray(this.search.time) ? this.search.time : []
|
||||
return { ...this.search, start_time: time[0], end_time: time[1], page_no: this.pagination.current, page_size: this.pagination.size }
|
||||
},
|
||||
async fetchData () {
|
||||
if (!this.search.batch || !this.search.batch.length) { this.$message.warning(this.$t(this.key('please_select_batch'))); return }
|
||||
this.loading = true
|
||||
try {
|
||||
const params = this.buildParams()
|
||||
const titleRes = await getBatteryDetailTitle(params)
|
||||
this.title = this.responseData(titleRes) || []
|
||||
const res = await getBatteryDetailList({ ...params, action: 'get_data' })
|
||||
const data = this.responseData(res)
|
||||
const list = data && data.data && Array.isArray(data.data.data) ? data.data.data : (Array.isArray(data && data.data) ? data.data : (Array.isArray(data) ? data : []))
|
||||
this.tableData = list
|
||||
this.pagination.total = Number(data && data.data && data.data.count) || Number(data && data.count) || list.length
|
||||
} finally { this.loading = false }
|
||||
},
|
||||
onSearch () { this.pagination.current = 1; this.fetchData() },
|
||||
onReset () { this.search = { flow_idx: '', flow_id: '', batch: [], process_id: [], tray: '', time: [] }; this.batchOptions = []; this.processOptions = []; this.title = []; this.tableData = []; this.pagination.current = 1; this.pagination.total = 0 },
|
||||
changePage (page) { this.pagination.current = page; this.fetchData() },
|
||||
changeSize (size) { this.pagination.size = size; this.pagination.current = 1; this.fetchData() },
|
||||
async exportTask () {
|
||||
if (!this.search.batch || !this.search.batch.length) { this.$message.warning(this.$t(this.key('please_select_batch'))); return }
|
||||
await this.$confirm(this.$t(this.key('export_confirm')), this.$t(this.key('prompt')), { type: 'warning' })
|
||||
await createBatteryDetailExportTask({ ...this.buildParams(), action: 'download' })
|
||||
this.$message.success(this.$t(this.key('create_download_task_success')))
|
||||
this.$router.push({ name: 'task' })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.search-bar { margin-bottom: -18px; }
|
||||
.pager { padding-top: 10px; text-align: right; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user