Merge branch 'master' of http://119.91.43.128:3001/sheng/mes-ui-d2
This commit is contained in:
33
docs/功能测试-正向追溯.md
Normal file
33
docs/功能测试-正向追溯.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# 功能测试 - 正向追溯
|
||||||
|
|
||||||
|
> 模块:数据中台 / 基础追溯 / 正向追溯 (Forward Traceability)
|
||||||
|
> 路由:`/data_middleground/basic_traceability/positive_direction_traceability`
|
||||||
|
|
||||||
|
## 测试前置条件
|
||||||
|
|
||||||
|
- 测试账号具备访问“正向追溯”和“反向追溯”的菜单权限。
|
||||||
|
- 准备至少一组可查询到数据的物料编码和物料批次。
|
||||||
|
- 准备至少一个可查询到数据的半成品码。
|
||||||
|
- 后端接口 `data_middleground/basic_traceability/positive_direction_traceability/list` 和 `export_task` 可正常访问。
|
||||||
|
|
||||||
|
## 测试任务列表
|
||||||
|
|
||||||
|
| 序号 | 测试项 | 操作步骤 | 预期结果 |
|
||||||
|
|---:|---|---|---|
|
||||||
|
| 1 | 页面入口 | 从菜单进入“正向追溯”,或直接访问路由 | 页面正常打开,显示物料编码、物料批次、半成品码筛选项和查询、导出、重置按钮 |
|
||||||
|
| 2 | 初始查询 | 进入页面后等待默认查询完成 | 表格正常渲染,空数据时显示空态,不出现脚本错误 |
|
||||||
|
| 3 | 物料编码校验 | 只输入物料编码,不输入物料批次,点击查询 | 页面提示请输入物料批次,不发起有效查询 |
|
||||||
|
| 4 | 物料批次查询 | 输入物料编码和物料批次,点击查询 | 表格展示匹配数据,包含电池条码、批次号、物料、设备、工序和完成时间 |
|
||||||
|
| 5 | 半成品码查询 | 输入半成品码,点击查询 | 表格展示匹配数据或空态,页面不报错 |
|
||||||
|
| 6 | 分页切换 | 查询出多条数据后切换分页 | 当前页数据正确变化,总数显示正确 |
|
||||||
|
| 7 | 跳转反向追溯 | 点击某行“反向追溯” | 跳转到反向追溯页面,并携带当前行电池条码自动查询 |
|
||||||
|
| 8 | 导出前校验 | 不输入任何筛选条件时点击导出 | 页面提示请选择筛选条件 |
|
||||||
|
| 9 | 创建导出任务 | 输入筛选条件后点击导出并确认 | 调用导出任务接口,提示创建下载任务成功,并跳转任务页面 |
|
||||||
|
| 10 | 重置功能 | 输入筛选条件并查询后点击重置 | 筛选项清空,分页回到第一页并重新加载数据 |
|
||||||
|
| 11 | 国际化检查 | 切换中英文语言后重新进入页面 | 页面按钮、表格列名和提示文案随语言切换显示 |
|
||||||
|
|
||||||
|
## 回归关注点
|
||||||
|
|
||||||
|
- 物料编码存在时必须同时输入物料批次。
|
||||||
|
- 导出任务必须携带当前筛选条件、总数和 `action=download`。
|
||||||
|
- 反向追溯跳转必须使用行数据中的 `battery_id`。
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
> 根据 `后台Webman界面截图对照表.md` 生成。状态以当前 V2 项目中已落地的页面目录为准。
|
> 根据 `后台Webman界面截图对照表.md` 生成。状态以当前 V2 项目中已落地的页面目录为准。
|
||||||
|
|
||||||
- 总功能数:79
|
- 总功能数:79
|
||||||
- 已迁移:28
|
- 已迁移:29
|
||||||
- 未迁移:51
|
- 未迁移:50
|
||||||
|
|
||||||
| 状态 | 一级模块 | 二级模块 | 三级模块 | 功能说明 | V2 目标路径 |
|
| 状态 | 一级模块 | 二级模块 | 三级模块 | 功能说明 | V2 目标路径 |
|
||||||
|:---:|---|---|---|---|---|
|
|:---:|---|---|---|---|---|
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
| ⬜ | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | CChart (C Chart) | | 待确认 |
|
| ⬜ | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | CChart (C Chart) | | 待确认 |
|
||||||
| ⬜ | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | UChart (U Chart) | | 待确认 |
|
| ⬜ | 质量管理 (Quality Management) | SPC计数型报表 (SPC Attribute Charts) | UChart (U Chart) | | 待确认 |
|
||||||
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 反向追溯 (Backward Traceability) | 反向追溯 | `src/views/data-platform/traceability/backward/` |
|
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 反向追溯 (Backward Traceability) | 反向追溯 | `src/views/data-platform/traceability/backward/` |
|
||||||
| ⬜ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 正向追溯 (Forward Traceability) | | 待确认 |
|
| ✅ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 正向追溯 (Forward Traceability) | 正向追溯 | `src/views/data-platform/traceability/forward/` |
|
||||||
| ⬜ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 电池曲线 (Battery Curve) | | 待确认 |
|
| ⬜ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 电池曲线 (Battery Curve) | | 待确认 |
|
||||||
| ⬜ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 托盘追溯 (Tray Traceability) | | 待确认 |
|
| ⬜ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 托盘追溯 (Tray Traceability) | | 待确认 |
|
||||||
| ⬜ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 电池追溯 (Battery Traceability) | | 待确认 |
|
| ⬜ | 数据中台 (Data Platform) | 基础追溯 (Traceability) | 电池追溯 (Battery Traceability) | | 待确认 |
|
||||||
|
|||||||
27
src/api/data-platform/traceability/forward.js
Normal file
27
src/api/data-platform/traceability/forward.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import { request } from '@/api/_service'
|
||||||
|
|
||||||
|
const BASE = 'data_middleground/basic_traceability/positive_direction_traceability/'
|
||||||
|
|
||||||
|
function apiParams (method, data = {}) {
|
||||||
|
return {
|
||||||
|
method,
|
||||||
|
platform: 'background',
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getForwardTraceabilityList (data) {
|
||||||
|
return request({
|
||||||
|
url: BASE + 'list',
|
||||||
|
method: 'get',
|
||||||
|
params: apiParams('data_middleground_basic_traceability_positive_direction_traceability_list', data)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createForwardTraceabilityExportTask (data) {
|
||||||
|
return request({
|
||||||
|
url: BASE + 'export_task',
|
||||||
|
method: 'post',
|
||||||
|
data: apiParams('data_middleground_basic_traceability_positive_direction_traceability_export_task', data)
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1291,6 +1291,33 @@
|
|||||||
"device_code": "Device Code",
|
"device_code": "Device Code",
|
||||||
"node_not_found": "No matching node found",
|
"node_not_found": "No matching node found",
|
||||||
"query_before_export": "Query traceability data before export"
|
"query_before_export": "Query traceability data before export"
|
||||||
|
},
|
||||||
|
"forward": {
|
||||||
|
"query": "Search",
|
||||||
|
"reset": "Reset",
|
||||||
|
"export": "Export",
|
||||||
|
"item_code": "Material Code",
|
||||||
|
"enter_item_code": "Enter material code",
|
||||||
|
"item_batch": "Material Batch",
|
||||||
|
"enter_item_batch": "Enter material batch",
|
||||||
|
"item_id": "Semi-finished ID",
|
||||||
|
"enter_item_id": "Enter semi-finished ID",
|
||||||
|
"battery_id": "Battery Barcode",
|
||||||
|
"batch_id": "Batch No.",
|
||||||
|
"item_name": "Material Name",
|
||||||
|
"device_code": "Device Code",
|
||||||
|
"work_unit": "Process Unit",
|
||||||
|
"process_code": "Process Code",
|
||||||
|
"finish_time": "Completion Time",
|
||||||
|
"operation": "Operation",
|
||||||
|
"reverse": "Reverse Traceability",
|
||||||
|
"no_data": "No data",
|
||||||
|
"export_confirm": "Create forward traceability export task?",
|
||||||
|
"prompt": "Prompt",
|
||||||
|
"confirm": "Confirm",
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"please_select_filter_condition": "Select at least one filter condition",
|
||||||
|
"create_download_task_success": "Download task created successfully"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1291,6 +1291,33 @@
|
|||||||
"device_code": "设备编码",
|
"device_code": "设备编码",
|
||||||
"node_not_found": "未找到匹配节点",
|
"node_not_found": "未找到匹配节点",
|
||||||
"query_before_export": "请先查询追溯数据后再导出"
|
"query_before_export": "请先查询追溯数据后再导出"
|
||||||
|
},
|
||||||
|
"forward": {
|
||||||
|
"query": "查询",
|
||||||
|
"reset": "重置",
|
||||||
|
"export": "导出",
|
||||||
|
"item_code": "物料编码",
|
||||||
|
"enter_item_code": "请输入物料编码",
|
||||||
|
"item_batch": "物料批次",
|
||||||
|
"enter_item_batch": "请输入物料批次",
|
||||||
|
"item_id": "半成品码",
|
||||||
|
"enter_item_id": "请输入半成品码",
|
||||||
|
"battery_id": "电池条码",
|
||||||
|
"batch_id": "批次号",
|
||||||
|
"item_name": "物料名称",
|
||||||
|
"device_code": "设备编码",
|
||||||
|
"work_unit": "工序单元",
|
||||||
|
"process_code": "工序编码",
|
||||||
|
"finish_time": "完成时间",
|
||||||
|
"operation": "操作",
|
||||||
|
"reverse": "反向追溯",
|
||||||
|
"no_data": "暂无数据",
|
||||||
|
"export_confirm": "确认创建正向追溯数据导出任务?",
|
||||||
|
"prompt": "提示",
|
||||||
|
"confirm": "确定",
|
||||||
|
"cancel": "取消",
|
||||||
|
"please_select_filter_condition": "请选择筛选条件",
|
||||||
|
"create_download_task_success": "创建下载任务成功"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ export default {
|
|||||||
name: `${pre}basic_traceability-reverse_direction_traceability`,
|
name: `${pre}basic_traceability-reverse_direction_traceability`,
|
||||||
meta: { ...meta, cache: true, title: '反向追溯' },
|
meta: { ...meta, cache: true, title: '反向追溯' },
|
||||||
component: _import('data-platform/traceability/backward')
|
component: _import('data-platform/traceability/backward')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'basic_traceability/positive_direction_traceability',
|
||||||
|
name: `${pre}basic_traceability-positive_direction_traceability`,
|
||||||
|
meta: { ...meta, cache: true, title: '正向追溯' },
|
||||||
|
component: _import('data-platform/traceability/forward')
|
||||||
}
|
}
|
||||||
])('data_middleground-')
|
])('data_middleground-')
|
||||||
}
|
}
|
||||||
|
|||||||
217
src/views/data-platform/traceability/forward/index.vue
Normal file
217
src/views/data-platform/traceability/forward/index.vue
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
<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('item_code'))" prop="item_code">
|
||||||
|
<el-input
|
||||||
|
v-model.trim="search.item_code"
|
||||||
|
:placeholder="$t(key('enter_item_code'))"
|
||||||
|
clearable
|
||||||
|
style="width:220px"
|
||||||
|
@keyup.enter.native="onSearch"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t(key('item_batch'))" prop="item_batch">
|
||||||
|
<el-input
|
||||||
|
v-model.trim="search.item_batch"
|
||||||
|
:placeholder="$t(key('enter_item_batch'))"
|
||||||
|
clearable
|
||||||
|
style="width:220px"
|
||||||
|
@keyup.enter.native="onSearch"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item :label="$t(key('item_id'))" prop="item_id">
|
||||||
|
<el-input
|
||||||
|
v-model.trim="search.item_id"
|
||||||
|
:placeholder="$t(key('enter_item_id'))"
|
||||||
|
clearable
|
||||||
|
style="width:220px"
|
||||||
|
@keyup.enter.native="onSearch"
|
||||||
|
/>
|
||||||
|
</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-download" :disabled="loading" @click="exportTask">
|
||||||
|
{{ $t(key('export')) }}
|
||||||
|
</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" :disabled="loading" @click="onReset">
|
||||||
|
{{ $t(key('reset')) }}
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<page-table
|
||||||
|
:columns="columns"
|
||||||
|
:data="pagedData"
|
||||||
|
:loading="loading"
|
||||||
|
:toolbar-buttons="[]"
|
||||||
|
:row-buttons="rowButtons"
|
||||||
|
:pagination="pagination"
|
||||||
|
:table-attrs="{ size: 'mini', rowKey: rowKey, highlightCurrentRow: true }"
|
||||||
|
auto-height
|
||||||
|
@page-change="onPageChange"
|
||||||
|
>
|
||||||
|
<template #empty>
|
||||||
|
<el-empty :description="$t(key('no_data'))" :image-size="80" />
|
||||||
|
</template>
|
||||||
|
</page-table>
|
||||||
|
</d2-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { useTableColumns } from '@/composables/useTableColumns'
|
||||||
|
import { i18nMixin } from '@/composables/useI18n'
|
||||||
|
import PageTable from '@/components/page-table'
|
||||||
|
import {
|
||||||
|
createForwardTraceabilityExportTask,
|
||||||
|
getForwardTraceabilityList
|
||||||
|
} from '@/api/data-platform/traceability/forward'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'data-platform-traceability-forward',
|
||||||
|
components: { PageTable },
|
||||||
|
mixins: [i18nMixin('page.data_platform.traceability.forward')],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
search: {
|
||||||
|
item_code: '',
|
||||||
|
item_batch: '',
|
||||||
|
item_id: ''
|
||||||
|
},
|
||||||
|
tableData: [],
|
||||||
|
pagination: {
|
||||||
|
current: 1,
|
||||||
|
size: 10,
|
||||||
|
total: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
columns () {
|
||||||
|
return useTableColumns([
|
||||||
|
{ prop: 'battery_id', label: this.key('battery_id'), minWidth: 170, showOverflowTooltip: true },
|
||||||
|
{ prop: 'batch', label: this.key('batch_id'), minWidth: 150, showOverflowTooltip: true },
|
||||||
|
{ prop: 'item_name', label: this.key('item_name'), minWidth: 180, showOverflowTooltip: true },
|
||||||
|
{ prop: 'item_code', label: this.key('item_code'), minWidth: 170, showOverflowTooltip: true },
|
||||||
|
{ prop: 'item_batch', label: this.key('item_batch'), minWidth: 170, showOverflowTooltip: true },
|
||||||
|
{ prop: 'device_code', label: this.key('device_code'), minWidth: 150, showOverflowTooltip: true },
|
||||||
|
{ prop: 'workingsubclass', label: this.key('work_unit'), minWidth: 150, showOverflowTooltip: true },
|
||||||
|
{ prop: 'process_code', label: this.key('process_code'), minWidth: 150, showOverflowTooltip: true },
|
||||||
|
{ prop: 'finish_time', label: this.key('finish_time'), minWidth: 170, showOverflowTooltip: true }
|
||||||
|
], {
|
||||||
|
selectionWidth: 0,
|
||||||
|
indexWidth: 55,
|
||||||
|
operationWidth: 120
|
||||||
|
})
|
||||||
|
},
|
||||||
|
rowButtons () {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
key: 'reverse',
|
||||||
|
label: this.key('reverse'),
|
||||||
|
type: 'primary',
|
||||||
|
icon: 'el-icon-position',
|
||||||
|
size: 'mini',
|
||||||
|
onClick: this.goBackwardTraceability
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
pagedData () {
|
||||||
|
const start = (this.pagination.current - 1) * this.pagination.size
|
||||||
|
return this.tableData.slice(start, start + this.pagination.size)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created () {
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
rowKey (row) {
|
||||||
|
return row.id || `${row.battery_id || ''}-${row.item_code || ''}-${row.item_batch || ''}-${row.finish_time || ''}`
|
||||||
|
},
|
||||||
|
responseData (res) {
|
||||||
|
return res && res.data !== undefined ? res.data : res
|
||||||
|
},
|
||||||
|
buildParams () {
|
||||||
|
return {
|
||||||
|
...this.search,
|
||||||
|
page_no: this.pagination.current,
|
||||||
|
page_size: this.pagination.size
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validateSearch () {
|
||||||
|
if (this.search.item_code && !this.search.item_batch) {
|
||||||
|
this.$message.error(this.$t(this.key('enter_item_batch')))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
async fetchData () {
|
||||||
|
if (!this.validateSearch()) return
|
||||||
|
this.loading = true
|
||||||
|
try {
|
||||||
|
const res = await getForwardTraceabilityList(this.buildParams())
|
||||||
|
const data = this.responseData(res)
|
||||||
|
this.tableData = Array.isArray(data) ? data : []
|
||||||
|
this.pagination.total = this.tableData.length
|
||||||
|
} finally {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onSearch () {
|
||||||
|
this.pagination.current = 1
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
onReset () {
|
||||||
|
this.search = {
|
||||||
|
item_code: '',
|
||||||
|
item_batch: '',
|
||||||
|
item_id: ''
|
||||||
|
}
|
||||||
|
this.pagination.current = 1
|
||||||
|
this.fetchData()
|
||||||
|
},
|
||||||
|
onPageChange (page) {
|
||||||
|
this.pagination = { ...this.pagination, ...page }
|
||||||
|
},
|
||||||
|
hasFilter () {
|
||||||
|
return Object.keys(this.search).some(key => this.search[key])
|
||||||
|
},
|
||||||
|
async exportTask () {
|
||||||
|
if (!this.hasFilter()) {
|
||||||
|
this.$message.error(this.$t(this.key('please_select_filter_condition')))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await this.$confirm(this.$t(this.key('export_confirm')), this.$t(this.key('prompt')), {
|
||||||
|
type: 'warning',
|
||||||
|
confirmButtonText: this.$t(this.key('confirm')),
|
||||||
|
cancelButtonText: this.$t(this.key('cancel'))
|
||||||
|
})
|
||||||
|
await createForwardTraceabilityExportTask({
|
||||||
|
...this.search,
|
||||||
|
total: this.pagination.total,
|
||||||
|
action: 'download'
|
||||||
|
})
|
||||||
|
this.$message.success(this.$t(this.key('create_download_task_success')))
|
||||||
|
this.$router.push({ name: 'task' })
|
||||||
|
},
|
||||||
|
goBackwardTraceability (row) {
|
||||||
|
this.$router.push({
|
||||||
|
name: 'data_middleground-basic_traceability-reverse_direction_traceability',
|
||||||
|
params: { battery_id: row.battery_id }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.search-bar {
|
||||||
|
margin-bottom: -18px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user