Merge branch 'master' of http://119.91.43.128:3001/sheng/mes-ui-d2
This commit is contained in:
9
docs/功能测试-设备保养日志.md
Normal file
9
docs/功能测试-设备保养日志.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# 设备保养日志功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备保养 / 设备保养日志`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||
- [ ] 点击导出,系统可创建导出任务或返回成功提示。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
10
docs/功能测试-设备保养详情.md
Normal file
10
docs/功能测试-设备保养详情.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# 设备保养详情功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备保养 / 设备保养详情`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击新增,填写表单并保存,保存成功后列表刷新。
|
||||
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||
- [ ] 点击删除,确认后记录删除并刷新列表。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
10
docs/功能测试-设备保养项目.md
Normal file
10
docs/功能测试-设备保养项目.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# 设备保养项目功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备保养 / 设备保养项目`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击新增,填写表单并保存,保存成功后列表刷新。
|
||||
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||
- [ ] 点击删除,确认后记录删除并刷新列表。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
11
docs/功能测试-设备信息.md
Normal file
11
docs/功能测试-设备信息.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# 设备信息功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备信息 / 设备信息`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击新增,填写表单并保存,保存成功后列表刷新。
|
||||
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||
- [ ] 点击删除,确认后记录删除并刷新列表。
|
||||
- [ ] 如当前账号有导出权限,点击导出可创建导出任务。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
11
docs/功能测试-设备损耗品寿命管理.md
Normal file
11
docs/功能测试-设备损耗品寿命管理.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# 设备损耗品寿命管理功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备损耗品 / 设备损耗品寿命管理`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击新增,填写表单并保存,保存成功后列表刷新。
|
||||
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||
- [ ] 点击删除,确认后记录删除并刷新列表。
|
||||
- [ ] 点击导出,系统可创建导出任务或返回成功提示。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
11
docs/功能测试-设备损耗品更换日志.md
Normal file
11
docs/功能测试-设备损耗品更换日志.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# 设备损耗品更换日志功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备损耗品 / 设备损耗品更换日志`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击新增,填写表单并保存,保存成功后列表刷新。
|
||||
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||
- [ ] 点击删除,确认后记录删除并刷新列表。
|
||||
- [ ] 点击导出,系统可创建导出任务或返回成功提示。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
11
docs/功能测试-设备损耗品类别.md
Normal file
11
docs/功能测试-设备损耗品类别.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# 设备损耗品类别功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备损耗品 / 设备损耗品类别`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击新增,填写表单并保存,保存成功后列表刷新。
|
||||
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||
- [ ] 点击删除,确认后记录删除并刷新列表。
|
||||
- [ ] 点击导出,系统可创建导出任务或返回成功提示。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
11
docs/功能测试-设备损耗品项目.md
Normal file
11
docs/功能测试-设备损耗品项目.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# 设备损耗品项目功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备损耗品 / 设备损耗品项目`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击新增,填写表单并保存,保存成功后列表刷新。
|
||||
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||
- [ ] 点击删除,确认后记录删除并刷新列表。
|
||||
- [ ] 点击导出,系统可创建导出任务或返回成功提示。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
8
docs/功能测试-设备点检日志.md
Normal file
8
docs/功能测试-设备点检日志.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# 设备点检日志功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备点检 / 设备点检日志`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击导出,系统可创建导出任务或返回成功提示。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
9
docs/功能测试-设备点检记录.md
Normal file
9
docs/功能测试-设备点检记录.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# 设备点检记录功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备点检 / 设备点检记录`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击新增,填写表单并保存,保存成功后列表刷新。
|
||||
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
10
docs/功能测试-设备点检项目.md
Normal file
10
docs/功能测试-设备点检项目.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# 设备点检项目功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备点检 / 设备点检项目`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击新增,填写表单并保存,保存成功后列表刷新。
|
||||
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||
- [ ] 点击删除,确认后记录删除并刷新列表。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
11
docs/功能测试-设备维修日志.md
Normal file
11
docs/功能测试-设备维修日志.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# 设备维修日志功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备维修 / 设备维修日志`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击新增,填写表单并保存,保存成功后列表刷新。
|
||||
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||
- [ ] 点击删除,确认后记录删除并刷新列表。
|
||||
- [ ] 点击导出,系统可创建导出任务或返回成功提示。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
11
docs/功能测试-设备维修管理.md
Normal file
11
docs/功能测试-设备维修管理.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# 设备维修管理功能测试任务列表
|
||||
|
||||
- [ ] 进入 `设备模型 / 设备维修 / 设备维修管理`,页面正常加载,无控制台报错。
|
||||
- [ ] 点击查询,列表按分页加载数据,表格字段显示完整。
|
||||
- [ ] 输入关键字后点击查询,列表按条件刷新。
|
||||
- [ ] 点击重置,查询条件清空并重新加载列表。
|
||||
- [ ] 点击新增,填写表单并保存,保存成功后列表刷新。
|
||||
- [ ] 点击编辑,表单带出当前行数据,修改后保存成功。
|
||||
- [ ] 点击删除,确认后记录删除并刷新列表。
|
||||
- [ ] 点击导出,系统可创建导出任务或返回成功提示。
|
||||
- [ ] 分页切换页码和每页条数时,列表数据刷新正常。
|
||||
@@ -3,8 +3,8 @@
|
||||
> 根据 `后台Webman界面截图对照表.md` 生成。状态以当前 V2 项目中已落地的页面目录为准。
|
||||
|
||||
- 总功能数:79
|
||||
- 已迁移:35
|
||||
- 未迁移:44
|
||||
- 已迁移:48
|
||||
- 未迁移:31
|
||||
|
||||
| 状态 | 一级模块 | 二级模块 | 三级模块 | 功能说明 | V2 目标路径 |
|
||||
|:---:|---|---|---|---|---|
|
||||
@@ -30,19 +30,19 @@
|
||||
| ⬜ | 生产配置 (Production Master Data) | 班组模型 (Team Model) | 班次管理 (Shift Management) | 管理生产班次 | 待确认 |
|
||||
| ⬜ | 生产配置 (Production Master Data) | 班组模型 (Team Model) | 排班日历 (Scheduling Calendar) | 查看排班日历 | 待确认 |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备类别 (Equipment Category) | 设备类别 (Equipment Category) | 管理设备类别 | `src/views/equipment-management/equipment-model/equipment-category/` |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备信息 (Equipment Management) | 设备信息 (Equipment Registry) | 管理设备信息 | 待确认 |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检项目 (Inspection Items) | 点检项目管理 | 待确认 |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检记录 (Inspection Records) | 点检记录管理 | 待确认 |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检日志 (Inspection Logs) | 点检日志查询 | 待确认 |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养项目 (Maintenance Items) | 保养项目管理 | 待确认 |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养详情 (Maintenance Details) | 保养详情管理 | 待确认 |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养日志 (Maintenance Logs) | 保养日志查询 | 待确认 |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备维修 (Repair Management) | 设备维修管理 (Repair Management) | 维修管理 | 待确认 |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备维修 (Repair Management) | 设备维修日志 (Repair Logs) | 维修日志查询 | 待确认 |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品类别 (Consumables Category) | 损耗品分类管理 | 待确认 |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品项目 (Consumables Items) | 损耗品项目管理 | 待确认 |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品寿命管理 (Consumables Lifecycle Management) | 寿命管理 | 待确认 |
|
||||
| ⬜ | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品更换日志 (Replacement Logs) | 更换记录查询 | 待确认 |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备信息 (Equipment Management) | 设备信息 (Equipment Registry) | 管理设备信息 | `src/views/equipment-management/equipment-model/equipment-registry/` |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检项目 (Inspection Items) | 点检项目管理 | `src/views/equipment-management/inspection-management/inspection-items/` |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检记录 (Inspection Records) | 点检记录管理 | `src/views/equipment-management/inspection-management/inspection-records/` |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备点检 (Inspection Management) | 设备点检日志 (Inspection Logs) | 点检日志查询 | `src/views/equipment-management/inspection-management/inspection-logs/` |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养项目 (Maintenance Items) | 保养项目管理 | `src/views/equipment-management/maintenance-management/maintenance-items/` |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养详情 (Maintenance Details) | 保养详情管理 | `src/views/equipment-management/maintenance-management/maintenance-details/` |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备保养 (Maintenance Management) | 设备保养日志 (Maintenance Logs) | 保养日志查询 | `src/views/equipment-management/maintenance-management/maintenance-logs/` |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备维修 (Repair Management) | 设备维修管理 (Repair Management) | 维修管理 | `src/views/equipment-management/repair-management/repair-management/` |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备维修 (Repair Management) | 设备维修日志 (Repair Logs) | 维修日志查询 | `src/views/equipment-management/repair-management/repair-logs/` |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品类别 (Consumables Category) | 损耗品分类管理 | `src/views/equipment-management/consumables-management/consumables-category/` |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品项目 (Consumables Items) | 损耗品项目管理 | `src/views/equipment-management/consumables-management/consumables-items/` |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品寿命管理 (Consumables Lifecycle Management) | 寿命管理 | `src/views/equipment-management/consumables-management/consumables-lifecycle/` |
|
||||
| ✅ | 设备模型 (Equipment Management) | 设备损耗品 (Consumables Management) | 设备损耗品更换日志 (Replacement Logs) | 更换记录查询 | `src/views/equipment-management/consumables-management/replacement-logs/` |
|
||||
| ✅ | 计划与生产 (Planning & Production) | 生产批次管理 (Batch Management) | 批次列表 (Batch List) | 批次管理 | `src/views/planning-production/batch-management/batch-list/` |
|
||||
| ✅ | 计划与生产 (Planning & Production) | 生产批次管理 (Batch Management) | 批次托盘 (Tray Tracking) | 托盘跟踪与操作 | `src/views/planning-production/batch-management/tray-tracking/` |
|
||||
| ✅ | 计划与生产 (Planning & Production) | 生产批次管理 (Batch Management) | 生产批次不良报表 (Batch Defect Report) | 不良报表 | `src/views/planning-production/batch-management/batch-defect-report/` |
|
||||
|
||||
29
src/api/equipment-management/consumables-category.js
Normal file
29
src/api/equipment-management/consumables-category.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'device_management/device_consumables/device_consumables_category/'
|
||||
|
||||
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_consumables_device_consumables_category_all', data) })
|
||||
}
|
||||
|
||||
export function getList (data) {
|
||||
return request({ url: BASE + 'list', method: 'get', params: params('device_management_device_consumables_device_consumables_category_list', data) })
|
||||
}
|
||||
|
||||
export function createItem (data) {
|
||||
return request({ url: BASE + 'create', method: 'post', data: params('device_management_device_consumables_device_consumables_category_create', data) })
|
||||
}
|
||||
|
||||
export function editItem (data) {
|
||||
return request({ url: BASE + 'edit', method: 'put', data: params('device_management_device_consumables_device_consumables_category_edit', data) })
|
||||
}
|
||||
|
||||
export function deleteItem (data) {
|
||||
return request({ url: BASE + 'delete', method: 'delete', data: params('device_management_device_consumables_device_consumables_category_delete', data) })
|
||||
}
|
||||
|
||||
export function createExportTask (data) {
|
||||
return request({ url: BASE + 'data_export_task', method: 'post', data: params('device_management_device_consumables_device_consumables_category_data_export_task', data) })
|
||||
}
|
||||
29
src/api/equipment-management/consumables-items.js
Normal file
29
src/api/equipment-management/consumables-items.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'device_management/device_consumables/device_consumables_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_consumables_device_consumables_items_all', data) })
|
||||
}
|
||||
|
||||
export function getList (data) {
|
||||
return request({ url: BASE + 'list', method: 'get', params: params('device_management_device_consumables_device_consumables_items_list', data) })
|
||||
}
|
||||
|
||||
export function createItem (data) {
|
||||
return request({ url: BASE + 'create', method: 'post', data: params('device_management_device_consumables_device_consumables_items_create', data) })
|
||||
}
|
||||
|
||||
export function editItem (data) {
|
||||
return request({ url: BASE + 'edit', method: 'put', data: params('device_management_device_consumables_device_consumables_items_edit', data) })
|
||||
}
|
||||
|
||||
export function deleteItem (data) {
|
||||
return request({ url: BASE + 'delete', method: 'delete', data: params('device_management_device_consumables_device_consumables_items_delete', data) })
|
||||
}
|
||||
|
||||
export function createExportTask (data) {
|
||||
return request({ url: BASE + 'data_export_task', method: 'post', data: params('device_management_device_consumables_device_consumables_items_data_export_task', data) })
|
||||
}
|
||||
29
src/api/equipment-management/consumables-lifecycle.js
Normal file
29
src/api/equipment-management/consumables-lifecycle.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'device_management/device_consumables/device_consumables_lifetime_management/'
|
||||
|
||||
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_consumables_device_consumables_lifetime_management_all', data) })
|
||||
}
|
||||
|
||||
export function getList (data) {
|
||||
return request({ url: BASE + 'list', method: 'get', params: params('device_management_device_consumables_device_consumables_lifetime_management_list', data) })
|
||||
}
|
||||
|
||||
export function createItem (data) {
|
||||
return request({ url: BASE + 'create', method: 'post', data: params('device_management_device_consumables_device_consumables_lifetime_management_create', data) })
|
||||
}
|
||||
|
||||
export function editItem (data) {
|
||||
return request({ url: BASE + 'edit', method: 'put', data: params('device_management_device_consumables_device_consumables_lifetime_management_edit', data) })
|
||||
}
|
||||
|
||||
export function deleteItem (data) {
|
||||
return request({ url: BASE + 'delete', method: 'delete', data: params('device_management_device_consumables_device_consumables_lifetime_management_delete', data) })
|
||||
}
|
||||
|
||||
export function createExportTask (data) {
|
||||
return request({ url: BASE + 'data_export_task', method: 'post', data: params('device_management_device_consumables_device_consumables_lifetime_management_data_export_task', data) })
|
||||
}
|
||||
33
src/api/equipment-management/equipment-registry.js
Normal file
33
src/api/equipment-management/equipment-registry.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'production_configuration/device_model/device_management/'
|
||||
|
||||
function params (method, data = {}) { return { method, platform: 'background', ...data } }
|
||||
|
||||
export function getAll (data) {
|
||||
return request({ url: BASE + 'all', method: 'get', params: params('production_configuration_device_model_device_management_all', data) })
|
||||
}
|
||||
|
||||
export function getList (data) {
|
||||
return request({ url: BASE + 'list', method: 'get', params: params('production_configuration_device_model_device_management_list', data) })
|
||||
}
|
||||
|
||||
export function createItem (data) {
|
||||
return request({ url: BASE + 'create', method: 'post', data: params('production_configuration_device_model_device_management_create', data) })
|
||||
}
|
||||
|
||||
export function editItem (data) {
|
||||
return request({ url: BASE + 'edit', method: 'put', data: params('production_configuration_device_model_device_management_edit', data) })
|
||||
}
|
||||
|
||||
export function deleteItem (data) {
|
||||
return request({ url: BASE + 'delete', method: 'delete', data: params('production_configuration_device_model_device_management_delete', data) })
|
||||
}
|
||||
|
||||
export function batchDeleteItems (data) {
|
||||
return request({ url: BASE + 'batch_delete', method: 'delete', data: params('production_configuration_device_model_device_management_batch_delete', data) })
|
||||
}
|
||||
|
||||
export function createExportTask (data) {
|
||||
return request({ url: BASE + 'device_data_export_task', method: 'post', data: params('production_configuration_device_model_device_management_device_export_task', data) })
|
||||
}
|
||||
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) })
|
||||
}
|
||||
13
src/api/equipment-management/inspection-logs.js
Normal file
13
src/api/equipment-management/inspection-logs.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'device_management/device_check/device_check_items_log/'
|
||||
|
||||
function params (method, data = {}) { return { method, platform: 'background', ...data } }
|
||||
|
||||
export function getList (data) {
|
||||
return request({ url: BASE + 'list', method: 'get', params: params('device_management_device_check_device_check_items_log_list', data) })
|
||||
}
|
||||
|
||||
export function createExportTask (data) {
|
||||
return request({ url: BASE + 'export', method: 'post', data: params('device_management_device_check_device_check_items_log_export', data) })
|
||||
}
|
||||
17
src/api/equipment-management/inspection-records.js
Normal file
17
src/api/equipment-management/inspection-records.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'device_management/device_check/device_check_record/'
|
||||
|
||||
function params (method, data = {}) { return { method, platform: 'background', ...data } }
|
||||
|
||||
export function getList (data) {
|
||||
return request({ url: BASE + 'list', method: 'get', params: params('device_management_device_check_device_check_record_list', data) })
|
||||
}
|
||||
|
||||
export function createItem (data) {
|
||||
return request({ url: BASE + 'create_record', method: 'post', data: params('device_management_device_check_device_check_create_record', data) })
|
||||
}
|
||||
|
||||
export function editItem (data) {
|
||||
return request({ url: BASE + 'create_record', method: 'put', data: params('device_management_device_check_device_check_create_record', data) })
|
||||
}
|
||||
25
src/api/equipment-management/maintenance-details.js
Normal file
25
src/api/equipment-management/maintenance-details.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'device_management/device_maintain/device_maintain_items_details/'
|
||||
|
||||
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_maintain_device_maintain_items_details_all', data) })
|
||||
}
|
||||
|
||||
export function getList (data) {
|
||||
return request({ url: BASE + 'list', method: 'get', params: params('device_management_device_maintain_device_maintain_items_details_list', data) })
|
||||
}
|
||||
|
||||
export function createItem (data) {
|
||||
return request({ url: BASE + 'create', method: 'post', data: params('device_management_device_maintain_device_maintain_items_details_create', data) })
|
||||
}
|
||||
|
||||
export function editItem (data) {
|
||||
return request({ url: BASE + 'edit', method: 'put', data: params('device_management_device_maintain_device_maintain_items_details_edit', data) })
|
||||
}
|
||||
|
||||
export function deleteItem (data) {
|
||||
return request({ url: BASE + 'delete', method: 'delete', data: params('device_management_device_maintain_device_maintain_items_details_delete', data) })
|
||||
}
|
||||
29
src/api/equipment-management/maintenance-items.js
Normal file
29
src/api/equipment-management/maintenance-items.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'device_management/device_maintain/device_maintain_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_maintain_device_maintain_items_all', data) })
|
||||
}
|
||||
|
||||
export function getList (data) {
|
||||
return request({ url: BASE + 'list', method: 'get', params: params('device_management_device_maintain_device_maintain_items_list', data) })
|
||||
}
|
||||
|
||||
export function createItem (data) {
|
||||
return request({ url: BASE + 'create', method: 'post', data: params('device_management_device_maintain_device_maintain_items_create', data) })
|
||||
}
|
||||
|
||||
export function editItem (data) {
|
||||
return request({ url: BASE + 'edit', method: 'put', data: params('device_management_device_maintain_device_maintain_items_edit', data) })
|
||||
}
|
||||
|
||||
export function deleteItem (data) {
|
||||
return request({ url: BASE + 'delete', method: 'delete', data: params('device_management_device_maintain_device_maintain_items_delete', data) })
|
||||
}
|
||||
|
||||
export function batchDeleteItems (data) {
|
||||
return request({ url: BASE + 'batch_delete', method: 'delete', data: params('device_management_device_maintain_device_maintain_items_batch_delete', data) })
|
||||
}
|
||||
21
src/api/equipment-management/maintenance-logs.js
Normal file
21
src/api/equipment-management/maintenance-logs.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'device_management/device_maintain/device_maintain_items_log/'
|
||||
|
||||
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_maintain_device_maintain_items_log_all', data) })
|
||||
}
|
||||
|
||||
export function getList (data) {
|
||||
return request({ url: BASE + 'list', method: 'get', params: params('device_management_device_maintain_device_maintain_items_log_list', data) })
|
||||
}
|
||||
|
||||
export function editItem (data) {
|
||||
return request({ url: BASE + 'edit', method: 'put', data: params('device_management_device_maintain_device_maintain_items_log_edit', data) })
|
||||
}
|
||||
|
||||
export function createExportTask (data) {
|
||||
return request({ url: BASE + 'export', method: 'post', data: params('device_management_device_maintain_device_maintain_items_log_export', data) })
|
||||
}
|
||||
29
src/api/equipment-management/repair-logs.js
Normal file
29
src/api/equipment-management/repair-logs.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'device_management/device_repair/device_repair_log/'
|
||||
|
||||
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_repair_device_repair_log_all', data) })
|
||||
}
|
||||
|
||||
export function getList (data) {
|
||||
return request({ url: BASE + 'list', method: 'get', params: params('device_management_device_repair_device_repair_log_list', data) })
|
||||
}
|
||||
|
||||
export function createItem (data) {
|
||||
return request({ url: BASE + 'create', method: 'post', data: params('device_management_device_repair_device_repair_log_create', data) })
|
||||
}
|
||||
|
||||
export function editItem (data) {
|
||||
return request({ url: BASE + 'edit', method: 'put', data: params('device_management_device_repair_device_repair_log_edit', data) })
|
||||
}
|
||||
|
||||
export function deleteItem (data) {
|
||||
return request({ url: BASE + 'delete', method: 'delete', data: params('device_management_device_repair_device_repair_log_delete', data) })
|
||||
}
|
||||
|
||||
export function createExportTask (data) {
|
||||
return request({ url: BASE + 'create_data_export_task', method: 'post', data: params('device_management_device_repair_device_repair_log_create_data_export_task', data) })
|
||||
}
|
||||
29
src/api/equipment-management/repair-management.js
Normal file
29
src/api/equipment-management/repair-management.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'device_management/device_repair/device_repair_management/'
|
||||
|
||||
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_repair_device_repair_management_all', data) })
|
||||
}
|
||||
|
||||
export function getList (data) {
|
||||
return request({ url: BASE + 'list', method: 'get', params: params('device_management_device_repair_device_repair_management_list', data) })
|
||||
}
|
||||
|
||||
export function createItem (data) {
|
||||
return request({ url: BASE + 'create', method: 'post', data: params('device_management_device_repair_device_repair_management_create', data) })
|
||||
}
|
||||
|
||||
export function editItem (data) {
|
||||
return request({ url: BASE + 'edit', method: 'put', data: params('device_management_device_repair_device_repair_management_edit', data) })
|
||||
}
|
||||
|
||||
export function deleteItem (data) {
|
||||
return request({ url: BASE + 'delete', method: 'delete', data: params('device_management_device_repair_device_repair_management_delete', data) })
|
||||
}
|
||||
|
||||
export function createExportTask (data) {
|
||||
return request({ url: BASE + 'create_data_export_task', method: 'post', data: params('device_management_device_repair_device_repair_management_create_data_export_task', data) })
|
||||
}
|
||||
29
src/api/equipment-management/replacement-logs.js
Normal file
29
src/api/equipment-management/replacement-logs.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import { request } from '@/api/_service'
|
||||
|
||||
const BASE = 'device_management/device_consumables/device_consumables_replace_log/'
|
||||
|
||||
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_consumables_device_consumables_replace_log_all', data) })
|
||||
}
|
||||
|
||||
export function getList (data) {
|
||||
return request({ url: BASE + 'list', method: 'get', params: params('device_management_device_consumables_device_consumables_replace_log_list', data) })
|
||||
}
|
||||
|
||||
export function createItem (data) {
|
||||
return request({ url: BASE + 'create', method: 'post', data: params('device_management_device_consumables_device_consumables_replace_log_create', data) })
|
||||
}
|
||||
|
||||
export function editItem (data) {
|
||||
return request({ url: BASE + 'edit', method: 'put', data: params('device_management_device_consumables_device_consumables_replace_log_edit', data) })
|
||||
}
|
||||
|
||||
export function deleteItem (data) {
|
||||
return request({ url: BASE + 'delete', method: 'delete', data: params('device_management_device_consumables_device_consumables_replace_log_delete', data) })
|
||||
}
|
||||
|
||||
export function createExportTask (data) {
|
||||
return request({ url: BASE + 'data_export_task', method: 'post', data: params('device_management_device_consumables_device_consumables_replace_log_data_export_task', data) })
|
||||
}
|
||||
@@ -19,6 +19,84 @@ export default {
|
||||
name: `${pre}equipment_model-equipment_category`,
|
||||
meta: { ...meta, cache: true, title: '设备类别' },
|
||||
component: _import('equipment-management/equipment-model/equipment-category')
|
||||
},
|
||||
{
|
||||
path: 'device_model/device_management',
|
||||
name: `${pre}equipment_model-equipment_registry`,
|
||||
meta: { ...meta, cache: true, title: '设备信息' },
|
||||
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')
|
||||
},
|
||||
{
|
||||
path: 'device_check/device_check_record',
|
||||
name: `${pre}device_check-device_check_record`,
|
||||
meta: { ...meta, cache: true, title: '设备点检记录' },
|
||||
component: _import('equipment-management/inspection-management/inspection-records')
|
||||
},
|
||||
{
|
||||
path: 'device_check/device_check_items_log',
|
||||
name: `${pre}device_check-device_check_items_log`,
|
||||
meta: { ...meta, cache: true, title: '设备点检日志' },
|
||||
component: _import('equipment-management/inspection-management/inspection-logs')
|
||||
},
|
||||
{
|
||||
path: 'device_maintain/device_maintain_items',
|
||||
name: `${pre}device_maintain-device_maintain_items`,
|
||||
meta: { ...meta, cache: true, title: '设备保养项目' },
|
||||
component: _import('equipment-management/maintenance-management/maintenance-items')
|
||||
},
|
||||
{
|
||||
path: 'device_maintain/device_maintain_items_details',
|
||||
name: `${pre}device_maintain-device_maintain_items_details`,
|
||||
meta: { ...meta, cache: true, title: '设备保养详情' },
|
||||
component: _import('equipment-management/maintenance-management/maintenance-details')
|
||||
},
|
||||
{
|
||||
path: 'device_maintain/device_maintain_items_log',
|
||||
name: `${pre}device_maintain-device_maintain_items_log`,
|
||||
meta: { ...meta, cache: true, title: '设备保养日志' },
|
||||
component: _import('equipment-management/maintenance-management/maintenance-logs')
|
||||
},
|
||||
{
|
||||
path: 'device_repair/device_repair_management',
|
||||
name: `${pre}device_repair-device_repair_management`,
|
||||
meta: { ...meta, cache: true, title: '设备维修管理' },
|
||||
component: _import('equipment-management/repair-management/repair-management')
|
||||
},
|
||||
{
|
||||
path: 'device_repair/device_repair_log',
|
||||
name: `${pre}device_repair-device_repair_log`,
|
||||
meta: { ...meta, cache: true, title: '设备维修日志' },
|
||||
component: _import('equipment-management/repair-management/repair-logs')
|
||||
},
|
||||
{
|
||||
path: 'device_consumables/device_consumables_category',
|
||||
name: `${pre}device_consumables-device_consumables_category`,
|
||||
meta: { ...meta, cache: true, title: '设备损耗品类别' },
|
||||
component: _import('equipment-management/consumables-management/consumables-category')
|
||||
},
|
||||
{
|
||||
path: 'device_consumables/device_consumables_items',
|
||||
name: `${pre}device_consumables-device_consumables_items`,
|
||||
meta: { ...meta, cache: true, title: '设备损耗品项目' },
|
||||
component: _import('equipment-management/consumables-management/consumables-items')
|
||||
},
|
||||
{
|
||||
path: 'device_consumables/device_consumables_lifetime_management',
|
||||
name: `${pre}device_consumables-device_consumables_lifetime_management`,
|
||||
meta: { ...meta, cache: true, title: '设备损耗品寿命管理' },
|
||||
component: _import('equipment-management/consumables-management/consumables-lifecycle')
|
||||
},
|
||||
{
|
||||
path: 'device_consumables/device_consumables_replace_log',
|
||||
name: `${pre}device_consumables-device_consumables_replace_log`,
|
||||
meta: { ...meta, cache: true, title: '设备损耗品更换日志' },
|
||||
component: _import('equipment-management/consumables-management/replacement-logs')
|
||||
}
|
||||
])('device_management-')
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<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-button icon="el-icon-download" :disabled="loading" @click="exportTask">导出</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, createExportTask } from '@/api/equipment-management/consumables-category'
|
||||
export default {
|
||||
name: 'equipment-management-consumables-category',
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
saving: false,
|
||||
canCreate: true,
|
||||
canEdit: true,
|
||||
canDelete: true,
|
||||
canExport: true,
|
||||
search: { keyword: '' },
|
||||
tableData: [],
|
||||
pagination: { current: 1, size: 10, total: 0 },
|
||||
columns: [
|
||||
{ prop: 'device_consumables_category_code', label: '类别编码' },
|
||||
{ prop: 'device_consumables_category_name', label: '类别名称' },
|
||||
{ prop: 'remark', label: '备注' },
|
||||
{ prop: 'create_time', label: '创建时间' }
|
||||
],
|
||||
formFields: [
|
||||
{ prop: 'device_consumables_category_code', label: '类别编码' },
|
||||
{ prop: 'device_consumables_category_name', 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() },
|
||||
async exportTask () { await this.$confirm('确认创建导出任务?', '提示', { type: 'warning' }); await createExportTask(this.buildParams()); this.$message.success('导出任务创建成功') }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>.search-bar { margin-bottom: -18px; }.pager { padding-top: 10px; text-align: right; }.danger { color: #f56c6c; }</style>
|
||||
@@ -0,0 +1,69 @@
|
||||
<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-button icon="el-icon-download" :disabled="loading" @click="exportTask">导出</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, createExportTask } from '@/api/equipment-management/consumables-items'
|
||||
export default {
|
||||
name: 'equipment-management-consumables-items',
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
saving: false,
|
||||
canCreate: true,
|
||||
canEdit: true,
|
||||
canDelete: true,
|
||||
canExport: true,
|
||||
search: { keyword: '' },
|
||||
tableData: [],
|
||||
pagination: { current: 1, size: 10, total: 0 },
|
||||
columns: [
|
||||
{ prop: 'device_consumables_item_code', label: '损耗品编码' },
|
||||
{ prop: 'device_consumables_item_name', label: '损耗品名称' },
|
||||
{ prop: 'device_consumables_category_name', label: '损耗品类别' },
|
||||
{ prop: 'specification', label: '规格' },
|
||||
{ prop: 'remark', label: '备注' }
|
||||
],
|
||||
formFields: [
|
||||
{ prop: 'device_consumables_item_code', label: '损耗品编码' },
|
||||
{ prop: 'device_consumables_item_name', label: '损耗品名称' },
|
||||
{ prop: 'device_consumables_category_id', label: '类别ID' },
|
||||
{ prop: 'specification', 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() },
|
||||
async exportTask () { await this.$confirm('确认创建导出任务?', '提示', { type: 'warning' }); await createExportTask(this.buildParams()); this.$message.success('导出任务创建成功') }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>.search-bar { margin-bottom: -18px; }.pager { padding-top: 10px; text-align: right; }.danger { color: #f56c6c; }</style>
|
||||
@@ -0,0 +1,71 @@
|
||||
<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-button icon="el-icon-download" :disabled="loading" @click="exportTask">导出</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, createExportTask } from '@/api/equipment-management/consumables-lifecycle'
|
||||
export default {
|
||||
name: 'equipment-management-consumables-lifecycle',
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
saving: false,
|
||||
canCreate: true,
|
||||
canEdit: true,
|
||||
canDelete: true,
|
||||
canExport: true,
|
||||
search: { keyword: '' },
|
||||
tableData: [],
|
||||
pagination: { current: 1, size: 10, total: 0 },
|
||||
columns: [
|
||||
{ prop: 'device_consumables_item_name', label: '损耗品项目' },
|
||||
{ prop: 'device_name', label: '关联设备' },
|
||||
{ prop: 'standard_life', label: '标准寿命' },
|
||||
{ prop: 'warning_life', label: '预警寿命' },
|
||||
{ prop: 'used_life', label: '已用寿命' },
|
||||
{ prop: 'replace_time', label: '更换时间' }
|
||||
],
|
||||
formFields: [
|
||||
{ prop: 'device_consumables_item_id', label: '损耗品项目ID' },
|
||||
{ prop: 'device_id', label: '设备ID' },
|
||||
{ prop: 'standard_life', label: '标准寿命' },
|
||||
{ prop: 'warning_life', label: '预警寿命' },
|
||||
{ prop: 'used_life', 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() },
|
||||
async exportTask () { await this.$confirm('确认创建导出任务?', '提示', { type: 'warning' }); await createExportTask(this.buildParams()); this.$message.success('导出任务创建成功') }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>.search-bar { margin-bottom: -18px; }.pager { padding-top: 10px; text-align: right; }.danger { color: #f56c6c; }</style>
|
||||
@@ -0,0 +1,72 @@
|
||||
<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-button icon="el-icon-download" :disabled="loading" @click="exportTask">导出</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, createExportTask } from '@/api/equipment-management/replacement-logs'
|
||||
export default {
|
||||
name: 'equipment-management-replacement-logs',
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
saving: false,
|
||||
canCreate: true,
|
||||
canEdit: true,
|
||||
canDelete: true,
|
||||
canExport: true,
|
||||
search: { keyword: '' },
|
||||
tableData: [],
|
||||
pagination: { current: 1, size: 10, total: 0 },
|
||||
columns: [
|
||||
{ prop: 'device_consumables_item_name', label: '损耗品项目' },
|
||||
{ prop: 'device_name', label: '关联设备' },
|
||||
{ prop: 'replace_user', label: '更换人员' },
|
||||
{ prop: 'replace_time', label: '更换时间' },
|
||||
{ prop: 'replace_reason', label: '更换原因' },
|
||||
{ prop: 'replace_duration', label: '更换耗时' }
|
||||
],
|
||||
formFields: [
|
||||
{ prop: 'device_consumables_item_id', label: '损耗品项目ID' },
|
||||
{ prop: 'device_id', label: '设备ID' },
|
||||
{ prop: 'replace_user', label: '更换人员' },
|
||||
{ prop: 'replace_time', label: '更换时间' },
|
||||
{ prop: 'replace_reason', label: '更换原因' },
|
||||
{ prop: 'replace_duration', 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() },
|
||||
async exportTask () { await this.$confirm('确认创建导出任务?', '提示', { type: 'warning' }); await createExportTask(this.buildParams()); this.$message.success('导出任务创建成功') }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>.search-bar { margin-bottom: -18px; }.pager { padding-top: 10px; text-align: right; }.danger { color: #f56c6c; }</style>
|
||||
@@ -0,0 +1,186 @@
|
||||
<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-button v-if="hasExport" icon="el-icon-download" :disabled="loading" @click="exportTask">导出</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 label="操作" fixed="right" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="openDialog(scope.row)">编辑</el-button>
|
||||
<el-button 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="120px" 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 { createExportTask, createItem, deleteItem, editItem, getList } from '@/api/equipment-management/equipment-registry'
|
||||
|
||||
export default {
|
||||
name: 'equipment-management-equipment-registry',
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
saving: false,
|
||||
search: { keyword: '' },
|
||||
tableData: [],
|
||||
pagination: { current: 1, size: 10, total: 0 },
|
||||
columns: [
|
||||
{
|
||||
prop: 'device_code',
|
||||
label: '设备编码'
|
||||
},
|
||||
{
|
||||
prop: 'device_name',
|
||||
label: '设备名称'
|
||||
},
|
||||
{
|
||||
prop: 'device_type_name',
|
||||
label: '设备类别'
|
||||
},
|
||||
{
|
||||
prop: 'device_status',
|
||||
label: '设备状态'
|
||||
},
|
||||
{
|
||||
prop: 'area_name',
|
||||
label: '所属区域'
|
||||
},
|
||||
{
|
||||
prop: 'line_name',
|
||||
label: '所属产线'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注'
|
||||
}
|
||||
],
|
||||
formFields: [
|
||||
{
|
||||
prop: 'device_code',
|
||||
label: '设备编码'
|
||||
},
|
||||
{
|
||||
prop: 'device_name',
|
||||
label: '设备名称'
|
||||
},
|
||||
{
|
||||
prop: 'device_type_id',
|
||||
label: '设备类别ID'
|
||||
},
|
||||
{
|
||||
prop: 'device_status',
|
||||
label: '设备状态'
|
||||
},
|
||||
{
|
||||
prop: 'area_id',
|
||||
label: '区域ID'
|
||||
},
|
||||
{
|
||||
prop: 'line_id',
|
||||
label: '产线ID'
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注'
|
||||
}
|
||||
],
|
||||
form: {},
|
||||
dialogVisible: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialogTitle () { return this.form && this.form.id ? '编辑设备信息' : '新增设备信息' },
|
||||
hasExport () { return typeof createExportTask === 'function' },
|
||||
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()
|
||||
},
|
||||
async exportTask () {
|
||||
await this.$confirm('确认创建导出任务?', '提示', { type: 'warning' })
|
||||
await createExportTask(this.buildParams())
|
||||
this.$message.success('导出任务创建成功')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.search-bar { margin-bottom: -18px; }
|
||||
.pager { padding-top: 10px; text-align: right; }
|
||||
.danger { color: #f56c6c; }
|
||||
</style>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,83 @@
|
||||
<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 icon="el-icon-download" :disabled="loading" @click="exportTask">导出</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, createExportTask } from '@/api/equipment-management/inspection-logs'
|
||||
export default {
|
||||
name: 'equipment-management-inspection-logs',
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
saving: false,
|
||||
canCreate: false,
|
||||
canEdit: false,
|
||||
canDelete: false,
|
||||
canExport: true,
|
||||
search: { keyword: '' },
|
||||
tableData: [],
|
||||
pagination: { current: 1, size: 10, total: 0 },
|
||||
columns: [
|
||||
{ prop: 'device_code', label: '设备编码' },
|
||||
{ prop: 'device_name', label: '设备名称' },
|
||||
{ prop: 'check_item_name', label: '点检项目' },
|
||||
{ prop: 'check_result', label: '点检结果' },
|
||||
{ prop: 'check_user', label: '点检人员' },
|
||||
{ prop: 'check_time', label: '点检时间' }
|
||||
],
|
||||
formFields: [
|
||||
|
||||
],
|
||||
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 exportTask () {
|
||||
await this.$confirm('确认创建导出任务?', '提示', { type: 'warning' })
|
||||
await createExportTask(this.buildParams())
|
||||
this.$message.success('导出任务创建成功')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.search-bar { margin-bottom: -18px; }
|
||||
.pager { padding-top: 10px; text-align: right; }
|
||||
.danger { color: #f56c6c; }
|
||||
</style>
|
||||
@@ -0,0 +1,92 @@
|
||||
<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 } from '@/api/equipment-management/inspection-records'
|
||||
export default {
|
||||
name: 'equipment-management-inspection-records',
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
saving: false,
|
||||
canCreate: true,
|
||||
canEdit: true,
|
||||
canDelete: false,
|
||||
canExport: false,
|
||||
search: { keyword: '' },
|
||||
tableData: [],
|
||||
pagination: { current: 1, size: 10, total: 0 },
|
||||
columns: [
|
||||
{ prop: 'device_code', label: '设备编码' },
|
||||
{ prop: 'device_name', label: '设备名称' },
|
||||
{ prop: 'check_status', label: '点检状态' },
|
||||
{ prop: 'check_user', label: '点检人员' },
|
||||
{ prop: 'check_time', label: '点检时间' },
|
||||
{ prop: 'remark', label: '备注' }
|
||||
],
|
||||
formFields: [
|
||||
{ prop: 'device_id', label: '设备ID' },
|
||||
{ prop: 'check_status', label: '点检状态' },
|
||||
{ prop: 'check_user', label: '点检人员' },
|
||||
{ prop: 'check_time', 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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.search-bar { margin-bottom: -18px; }
|
||||
.pager { padding-top: 10px; text-align: right; }
|
||||
.danger { color: #f56c6c; }
|
||||
</style>
|
||||
@@ -0,0 +1,97 @@
|
||||
<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/maintenance-details'
|
||||
export default {
|
||||
name: 'equipment-management-maintenance-details',
|
||||
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_name', label: '设备名称' },
|
||||
{ prop: 'device_maintain_item_name', label: '保养项目' },
|
||||
{ prop: 'maintain_content', label: '保养内容' },
|
||||
{ prop: 'maintain_standard', label: '保养标准' },
|
||||
{ prop: 'remark', label: '备注' }
|
||||
],
|
||||
formFields: [
|
||||
{ prop: 'device_id', label: '设备ID' },
|
||||
{ prop: 'device_maintain_item_id', label: '保养项目ID' },
|
||||
{ prop: 'maintain_content', label: '保养内容' },
|
||||
{ prop: 'maintain_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>
|
||||
@@ -0,0 +1,99 @@
|
||||
<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/maintenance-items'
|
||||
export default {
|
||||
name: 'equipment-management-maintenance-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_maintain_item_code', label: '保养项目编码' },
|
||||
{ prop: 'device_maintain_item_name', label: '保养项目名称' },
|
||||
{ prop: 'device_name', label: '设备名称' },
|
||||
{ prop: 'maintain_cycle', label: '保养周期' },
|
||||
{ prop: 'standard', label: '保养标准' },
|
||||
{ prop: 'remark', label: '备注' }
|
||||
],
|
||||
formFields: [
|
||||
{ prop: 'device_maintain_item_code', label: '保养项目编码' },
|
||||
{ prop: 'device_maintain_item_name', label: '保养项目名称' },
|
||||
{ prop: 'device_id', label: '设备ID' },
|
||||
{ prop: 'maintain_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>
|
||||
@@ -0,0 +1,97 @@
|
||||
<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 icon="el-icon-download" :disabled="loading" @click="exportTask">导出</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, editItem, createExportTask } from '@/api/equipment-management/maintenance-logs'
|
||||
export default {
|
||||
name: 'equipment-management-maintenance-logs',
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
saving: false,
|
||||
canCreate: false,
|
||||
canEdit: true,
|
||||
canDelete: false,
|
||||
canExport: true,
|
||||
search: { keyword: '' },
|
||||
tableData: [],
|
||||
pagination: { current: 1, size: 10, total: 0 },
|
||||
columns: [
|
||||
{ prop: 'device_code', label: '设备编码' },
|
||||
{ prop: 'device_name', label: '设备名称' },
|
||||
{ prop: 'device_maintain_item_name', label: '保养项目' },
|
||||
{ prop: 'maintain_user', label: '保养人员' },
|
||||
{ prop: 'maintain_time', label: '保养时间' },
|
||||
{ prop: 'maintain_result', label: '保养结果' }
|
||||
],
|
||||
formFields: [
|
||||
{ prop: 'id', label: 'ID' },
|
||||
{ prop: 'maintain_time', label: '保养时间' },
|
||||
{ prop: 'maintain_user', label: '保养人员' },
|
||||
{ prop: 'maintain_result', 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) { this.$message.warning('请选择需要编辑的记录'); return }
|
||||
await editItem(this.form)
|
||||
this.$message.success('操作成功')
|
||||
this.dialogVisible = false
|
||||
this.fetchData()
|
||||
} finally { this.saving = false }
|
||||
},
|
||||
async exportTask () {
|
||||
await this.$confirm('确认创建导出任务?', '提示', { type: 'warning' })
|
||||
await createExportTask(this.buildParams())
|
||||
this.$message.success('导出任务创建成功')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.search-bar { margin-bottom: -18px; }
|
||||
.pager { padding-top: 10px; text-align: right; }
|
||||
.danger { color: #f56c6c; }
|
||||
</style>
|
||||
@@ -0,0 +1,71 @@
|
||||
<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-button icon="el-icon-download" :disabled="loading" @click="exportTask">导出</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, createExportTask } from '@/api/equipment-management/repair-logs'
|
||||
export default {
|
||||
name: 'equipment-management-repair-logs',
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
saving: false,
|
||||
canCreate: true,
|
||||
canEdit: true,
|
||||
canDelete: true,
|
||||
canExport: true,
|
||||
search: { keyword: '' },
|
||||
tableData: [],
|
||||
pagination: { current: 1, size: 10, total: 0 },
|
||||
columns: [
|
||||
{ prop: 'order_no', label: '维修单号' },
|
||||
{ prop: 'device_code', label: '设备编码' },
|
||||
{ prop: 'device_name', label: '设备名称' },
|
||||
{ prop: 'repair_user', label: '维修人员' },
|
||||
{ prop: 'repair_time', label: '维修时间' },
|
||||
{ prop: 'repair_result', label: '维修结果' }
|
||||
],
|
||||
formFields: [
|
||||
{ prop: 'order_no', label: '维修单号' },
|
||||
{ prop: 'device_id', label: '设备ID' },
|
||||
{ prop: 'repair_user', label: '维修人员' },
|
||||
{ prop: 'repair_time', label: '维修时间' },
|
||||
{ prop: 'repair_result', 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() },
|
||||
async exportTask () { await this.$confirm('确认创建导出任务?', '提示', { type: 'warning' }); await createExportTask(this.buildParams()); this.$message.success('导出任务创建成功') }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>.search-bar { margin-bottom: -18px; }.pager { padding-top: 10px; text-align: right; }.danger { color: #f56c6c; }</style>
|
||||
@@ -0,0 +1,70 @@
|
||||
<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-button icon="el-icon-download" :disabled="loading" @click="exportTask">导出</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, createExportTask } from '@/api/equipment-management/repair-management'
|
||||
export default {
|
||||
name: 'equipment-management-repair-management',
|
||||
data () {
|
||||
return {
|
||||
loading: false,
|
||||
saving: false,
|
||||
canCreate: true,
|
||||
canEdit: true,
|
||||
canDelete: true,
|
||||
canExport: true,
|
||||
search: { keyword: '' },
|
||||
tableData: [],
|
||||
pagination: { current: 1, size: 10, total: 0 },
|
||||
columns: [
|
||||
{ prop: 'order_no', label: '报修单号' },
|
||||
{ prop: 'device_code', label: '设备编码' },
|
||||
{ prop: 'device_name', label: '设备名称' },
|
||||
{ prop: 'fault_desc', label: '故障描述' },
|
||||
{ prop: 'repair_status', label: '维修状态' },
|
||||
{ prop: 'create_time', label: '创建时间' }
|
||||
],
|
||||
formFields: [
|
||||
{ prop: 'order_no', label: '报修单号' },
|
||||
{ prop: 'device_id', label: '设备ID' },
|
||||
{ prop: 'fault_desc', label: '故障描述' },
|
||||
{ prop: 'repair_status', 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() },
|
||||
async exportTask () { await this.$confirm('确认创建导出任务?', '提示', { type: 'warning' }); await createExportTask(this.buildParams()); this.$message.success('导出任务创建成功') }
|
||||
}
|
||||
}
|
||||
</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