迁移设备点检项目模块
This commit is contained in:
10
docs/功能测试-设备点检项目.md
Normal file
10
docs/功能测试-设备点检项目.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# 设备点检项目功能测试任务列表
|
||||||
|
|
||||||
|
- [ ] 进入 `设备模型 / 设备点检 / 设备点检项目`,页面正常加载,无控制台报错。
|
||||||
|
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||||
|
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||||
|
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||||
|
- [ ] 点击新增,填写表单并保存,保存成功后列表刷新。
|
||||||
|
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||||
|
- [ ] 点击删除,确认后记录删除并刷新列表。
|
||||||
|
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
> 根据 `后台Webman界面截图对照表.md` 生成。状态以当前 V2 项目中已落地的页面目录为准。
|
> 根据 `后台Webman界面截图对照表.md` 生成。状态以当前 V2 项目中已落地的页面目录为准。
|
||||||
|
|
||||||
- 总功能数:79
|
- 总功能数:79
|
||||||
- 已迁移:36
|
- 已迁移:37
|
||||||
- 未迁移:43
|
- 未迁移:42
|
||||||
|
|
||||||
| 状态 | 一级模块 | 二级模块 | 三级模块 | 功能说明 | V2 目标路径 |
|
| 状态 | 一级模块 | 二级模块 | 三级模块 | 功能说明 | V2 目标路径 |
|
||||||
|:---:|---|---|---|---|---|
|
|:---:|---|---|---|---|---|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
| ⬜ | 生产配置 (Production Master Data) | 班组模型 (Team Model) | 排班日历 (Scheduling Calendar) | 查看排班日历 | 待确认 |
|
| ⬜ | 生产配置 (Production Master Data) | 班组模型 (Team Model) | 排班日历 (Scheduling Calendar) | 查看排班日历 | 待确认 |
|
||||||
| ✅ | 设备模型 (Equipment Management) | 设备类别 (Equipment Category) | 设备类别 (Equipment Category) | 管理设备类别 | `src/views/equipment-management/equipment-model/equipment-category/` |
|
| ✅ | 设备模型 (Equipment Management) | 设备类别 (Equipment Category) | 设备类别 (Equipment Category) | 管理设备类别 | `src/views/equipment-management/equipment-model/equipment-category/` |
|
||||||
| ✅ | 设备模型 (Equipment Management) | 设备信息 (Equipment Management) | 设备信息 (Equipment Registry) | 管理设备信息 | `src/views/equipment-management/equipment-model/equipment-registry/` |
|
| ✅ | 设备模型 (Equipment Management) | 设备信息 (Equipment Management) | 设备信息 (Equipment Registry) | 管理设备信息 | `src/views/equipment-management/equipment-model/equipment-registry/` |
|
||||||
| ⬜ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检项目 (Inspection Items) | 点检项目管理 | 待确认 |
|
| ✅ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检项目 (Inspection Items) | 点检项目管理 | `src/views/equipment-management/inspection-management/inspection-items/` |
|
||||||
| ⬜ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检记录 (Inspection Records) | 点检记录管理 | 待确认 |
|
| ⬜ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检记录 (Inspection Records) | 点检记录管理 | 待确认 |
|
||||||
| ⬜ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检日志 (Inspection Logs) | 点检日志查询 | 待确认 |
|
| ⬜ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检日志 (Inspection Logs) | 点检日志查询 | 待确认 |
|
||||||
| ⬜ | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养项目 (Maintenance Items) | 保养项目管理 | 待确认 |
|
| ⬜ | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养项目 (Maintenance Items) | 保养项目管理 | 待确认 |
|
||||||
|
|||||||
29
src/api/equipment-management/inspection-items.js
Normal file
29
src/api/equipment-management/inspection-items.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import { request } from '@/api/_service'
|
||||||
|
|
||||||
|
const BASE = 'device_management/device_check/device_check_items/'
|
||||||
|
|
||||||
|
function params (method, data = {}) { return { method, platform: 'background', ...data } }
|
||||||
|
|
||||||
|
export function getAll (data) {
|
||||||
|
return request({ url: BASE + 'all', method: 'get', params: params('device_management_device_check_device_check_items_all', data) })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getList (data) {
|
||||||
|
return request({ url: BASE + 'list', method: 'get', params: params('device_management_device_check_device_check_items_list', data) })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createItem (data) {
|
||||||
|
return request({ url: BASE + 'create', method: 'post', data: params('device_management_device_check_device_check_items_create', data) })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function editItem (data) {
|
||||||
|
return request({ url: BASE + 'edit', method: 'put', data: params('device_management_device_check_device_check_items_edit', data) })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteItem (data) {
|
||||||
|
return request({ url: BASE + 'delete', method: 'delete', data: params('device_management_device_check_device_check_items_delete', data) })
|
||||||
|
}
|
||||||
|
|
||||||
|
export function batchDeleteItems (data) {
|
||||||
|
return request({ url: BASE + 'batch_delete', method: 'delete', data: params('device_management_device_check_device_check_items_batch_delete', data) })
|
||||||
|
}
|
||||||
@@ -25,6 +25,12 @@ export default {
|
|||||||
name: `${pre}equipment_model-equipment_registry`,
|
name: `${pre}equipment_model-equipment_registry`,
|
||||||
meta: { ...meta, cache: true, title: '设备信息' },
|
meta: { ...meta, cache: true, title: '设备信息' },
|
||||||
component: _import('equipment-management/equipment-model/equipment-registry')
|
component: _import('equipment-management/equipment-model/equipment-registry')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'device_check/device_check_items',
|
||||||
|
name: `${pre}device_check-device_check_items`,
|
||||||
|
meta: { ...meta, cache: true, title: '设备点检项目' },
|
||||||
|
component: _import('equipment-management/inspection-management/inspection-items')
|
||||||
}
|
}
|
||||||
])('device_management-')
|
])('device_management-')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,140 @@
|
|||||||
|
<template>
|
||||||
|
<d2-container>
|
||||||
|
<template #header>
|
||||||
|
<div class="search-bar">
|
||||||
|
<el-form :inline="true" :model="search" size="mini">
|
||||||
|
<el-form-item label="关键字">
|
||||||
|
<el-input v-model.trim="search.keyword" placeholder="请输入关键字" clearable style="width:180px" @keyup.enter.native="onSearch" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" :disabled="loading" @click="onSearch">查询</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" :disabled="loading" @click="onReset">重置</el-button>
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="openDialog()">新增</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 displayColumns" :key="column.prop" :prop="column.prop" :label="column.label" min-width="150" show-overflow-tooltip />
|
||||||
|
<el-table-column v-if="canEdit || canDelete" label="操作" fixed="right" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button v-if="canEdit" type="text" size="mini" @click="openDialog(scope.row)">编辑</el-button>
|
||||||
|
<el-button v-if="canDelete" type="text" size="mini" class="danger" @click="remove(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<template #empty><el-empty description="暂无数据" :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>
|
||||||
|
|
||||||
|
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="640px">
|
||||||
|
<el-form ref="form" :model="form" label-width="130px" size="mini">
|
||||||
|
<el-form-item v-for="field in formFields" :key="field.prop" :label="field.label" :prop="field.prop">
|
||||||
|
<el-input v-model="form[field.prop]" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button size="mini" @click="dialogVisible=false">取消</el-button>
|
||||||
|
<el-button type="primary" size="mini" :loading="saving" @click="save">确定</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</d2-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getList, createItem, editItem, deleteItem } from '@/api/equipment-management/inspection-items'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'equipment-management-inspection-items',
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
loading: false,
|
||||||
|
saving: false,
|
||||||
|
canCreate: true,
|
||||||
|
canEdit: true,
|
||||||
|
canDelete: true,
|
||||||
|
canExport: false,
|
||||||
|
search: { keyword: '' },
|
||||||
|
tableData: [],
|
||||||
|
pagination: { current: 1, size: 10, total: 0 },
|
||||||
|
columns: [
|
||||||
|
{ prop: 'device_check_item_code', label: '点检项目编码' },
|
||||||
|
{ prop: 'device_check_item_name', label: '点检项目名称' },
|
||||||
|
{ prop: 'device_name', label: '设备名称' },
|
||||||
|
{ prop: 'cycle', label: '点检周期' },
|
||||||
|
{ prop: 'standard', label: '点检标准' },
|
||||||
|
{ prop: 'remark', label: '备注' }
|
||||||
|
],
|
||||||
|
formFields: [
|
||||||
|
{ prop: 'device_check_item_code', label: '点检项目编码' },
|
||||||
|
{ prop: 'device_check_item_name', label: '点检项目名称' },
|
||||||
|
{ prop: 'device_id', label: '设备ID' },
|
||||||
|
{ prop: 'cycle', label: '点检周期' },
|
||||||
|
{ prop: 'standard', label: '点检标准' },
|
||||||
|
{ prop: 'remark', label: '备注' }
|
||||||
|
],
|
||||||
|
form: {},
|
||||||
|
dialogVisible: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
dialogTitle () { return this.form && this.form.id ? '编辑设备点检项目' : '新增设备点检项目' },
|
||||||
|
displayColumns () {
|
||||||
|
const keys = new Set(this.columns.map(item => item.prop))
|
||||||
|
const extra = Object.keys(this.tableData[0] || {}).filter(key => !keys.has(key) && key !== 'id').slice(0, 8).map(key => ({ prop: key, label: key }))
|
||||||
|
return [...this.columns, ...extra]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted () { this.fetchData() },
|
||||||
|
methods: {
|
||||||
|
responseData (res) { return res && res.data !== undefined ? res.data : res },
|
||||||
|
normalizeList (data) {
|
||||||
|
if (Array.isArray(data)) return { list: data, total: data.length }
|
||||||
|
if (data && Array.isArray(data.data)) return { list: data.data, total: Number(data.count || data.total || data.data.length) }
|
||||||
|
if (data && data.data && Array.isArray(data.data.data)) return { list: data.data.data, total: Number(data.data.count || data.data.total || data.data.data.length) }
|
||||||
|
return { list: [], total: 0 }
|
||||||
|
},
|
||||||
|
buildParams () { return { ...this.search, page_no: this.pagination.current, page_size: this.pagination.size } },
|
||||||
|
async fetchData () {
|
||||||
|
this.loading = true
|
||||||
|
try {
|
||||||
|
const res = await getList(this.buildParams())
|
||||||
|
const data = this.normalizeList(this.responseData(res))
|
||||||
|
this.tableData = data.list
|
||||||
|
this.pagination.total = data.total
|
||||||
|
} finally { this.loading = false }
|
||||||
|
},
|
||||||
|
onSearch () { this.pagination.current = 1; this.fetchData() },
|
||||||
|
onReset () { this.search = { keyword: '' }; this.pagination.current = 1; this.fetchData() },
|
||||||
|
changePage (page) { this.pagination.current = page; this.fetchData() },
|
||||||
|
changeSize (size) { this.pagination.size = size; this.pagination.current = 1; this.fetchData() },
|
||||||
|
openDialog (row) { this.form = row ? { ...row } : {}; this.dialogVisible = true },
|
||||||
|
async save () {
|
||||||
|
this.saving = true
|
||||||
|
try {
|
||||||
|
if (this.form.id) await editItem(this.form)
|
||||||
|
else await createItem(this.form)
|
||||||
|
this.$message.success('操作成功')
|
||||||
|
this.dialogVisible = false
|
||||||
|
this.fetchData()
|
||||||
|
} finally { this.saving = false }
|
||||||
|
},
|
||||||
|
async remove (row) {
|
||||||
|
await this.$confirm('确认删除该记录?', '提示', { type: 'warning' })
|
||||||
|
await deleteItem({ id: row.id })
|
||||||
|
this.$message.success('删除成功')
|
||||||
|
this.fetchData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.search-bar { margin-bottom: -18px; }
|
||||||
|
.pager { padding-top: 10px; text-align: right; }
|
||||||
|
.danger { color: #f56c6c; }
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user