停机记录新增,设备管理查询条件完善
This commit is contained in:
82
jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql
Normal file
82
jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql
Normal file
@@ -0,0 +1,82 @@
|
||||
-- MES 停机记录:建表 + 菜单 + 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀:mes:mes_xsl_downtime_record:*
|
||||
-- 依赖:mes_xsl_equipment_ledger、mes_xsl_downtime_type;父菜单 设备管理
|
||||
-- Flyway:V3.9.2_117__mes_xsl_downtime_record.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_record` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`equipment_ledger_id` varchar(32) NOT NULL COMMENT '设备台账主键 mes_xsl_equipment_ledger.id',
|
||||
`equipment_code` varchar(500) DEFAULT NULL COMMENT '设备编号冗余',
|
||||
`equipment_name` varchar(500) DEFAULT NULL COMMENT '设备名称冗余',
|
||||
`downtime_type_id` varchar(32) NOT NULL COMMENT '停机类型主键 mes_xsl_downtime_type.id',
|
||||
`downtime_type_name` varchar(500) DEFAULT NULL COMMENT '停机类型名称冗余',
|
||||
`start_time` datetime NOT NULL COMMENT '开始时间',
|
||||
`end_time` datetime DEFAULT NULL COMMENT '结束时间',
|
||||
`equipment_part_id` varchar(32) DEFAULT NULL COMMENT '设备部位主键 mes_xsl_equipment_part.id',
|
||||
`equipment_part_name` varchar(500) DEFAULT NULL COMMENT '设备部位名称冗余',
|
||||
`inspect_maintain_item_id` varchar(32) DEFAULT NULL COMMENT '点检及保养项目主键 mes_xsl_inspect_maintain_item.id',
|
||||
`inspect_maintain_item_name` varchar(500) DEFAULT NULL COMMENT '点检项目名称冗余',
|
||||
`maintenance_result` varchar(500) DEFAULT NULL COMMENT '维修结果',
|
||||
`maintainer_user_id` varchar(32) DEFAULT NULL COMMENT '维修人用户ID',
|
||||
`maintainer_username` varchar(500) DEFAULT NULL COMMENT '维修人账号',
|
||||
`maintainer_realname` varchar(500) DEFAULT NULL COMMENT '维修人姓名',
|
||||
`maintenance_filled_flag` varchar(1) DEFAULT '0' COMMENT '是否已录入维修结果(字典yn:1是0否)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdr_equipment` (`equipment_ledger_id`),
|
||||
KEY `idx_mdr_downtime_type` (`downtime_type_id`),
|
||||
KEY `idx_mdr_start_time` (`start_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机记录';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_equip_pid = (
|
||||
SELECT `id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
VALUES ('1860000000000000201', @mes_equip_pid, '停机记录', '/xslmes/mesXslDowntimeRecord', 'xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList', 'MesXslDowntimeRecordList', 1, NULL, '1', 12, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`),
|
||||
`menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`), `sort_no` = VALUES(`sort_no`),
|
||||
`is_route` = VALUES(`is_route`), `is_leaf` = VALUES(`is_leaf`), `hidden` = VALUES(`hidden`), `status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`),
|
||||
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`), `icon` = 'ant-design:history-outlined';
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:history-outlined' WHERE `id` = '1860000000000000201' AND `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000202', '1860000000000000201', '新增', 2, 'mes:mes_xsl_downtime_record:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000203', '1860000000000000201', '编辑', 2, 'mes:mes_xsl_downtime_record:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000204', '1860000000000000201', '删除', 2, 'mes:mes_xsl_downtime_record:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000205', '1860000000000000201', '批量删除', 2, 'mes:mes_xsl_downtime_record:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000206', '1860000000000000201', '导出', 2, 'mes:mes_xsl_downtime_record:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000207', '1860000000000000201', '导入', 2, 'mes:mes_xsl_downtime_record:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `menu_type` = VALUES(`menu_type`), `perms` = VALUES(`perms`), `perms_type` = VALUES(`perms_type`),
|
||||
`status` = VALUES(`status`), `del_flag` = VALUES(`del_flag`);
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000201',
|
||||
'1860000000000000202', '1860000000000000203', '1860000000000000204', '1860000000000000205',
|
||||
'1860000000000000206', '1860000000000000207'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
@@ -521,3 +521,63 @@ jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules
|
||||
|
||||
-- author:GHT---date:20260529--for: 【QH-MES审批流设计】审批IM消息升级为可跳转业务卡片(biz_record):点击可定位到对应单据,无法定位功能页时退回纯文本 ---
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/approval/controller/MesXslApprovalLaunchController.java
|
||||
|
||||
-- author:jiangxh---date:20250602--for: 【MES】停机记录:建表+菜单+CRUD+列表录入维修结果弹窗 ---
|
||||
jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_117__mes_xsl_downtime_record.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeRecord.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslDowntimeRecordMaintenanceDTO.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeRecordMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeRecordService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeRecordServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeRecordController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslInspectMaintainItemController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordMaintenanceModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeTypeSelectModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslInspectMaintainItemSelectModal.vue
|
||||
|
||||
-- author:jiangxh---date:20250602--for: 【MES】停机记录弹窗日期时间选择器下拉被裁剪导致点击无反应 ---
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts
|
||||
|
||||
-- author:jiangxh---date:20250602--for: 【MES】停机记录维修项目按设备部位筛选(点检保养项目均含小部位) ---
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslInspectMaintainItemSelectModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordMaintenanceModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeRecordServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslInspectMaintainItemController.java
|
||||
|
||||
-- author:jiangxh---date:20250602--for: 【MES】设备台账列表所属工序查询改为工序选择器 ---
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedgerList.vue
|
||||
|
||||
-- author:jiangxh---date:20250602--for: 【MES】设备管理各功能列表查询与表单一致改为选择器 ---
|
||||
jeecgboot-vue3/src/views/xslmes/components/MesSearchPickerInput.vue
|
||||
jeecgboot-vue3/src/views/xslmes/utils/mesSearchPickerUtil.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentCategory/MesXslEquipmentCategory.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentCategory/MesXslEquipmentCategoryList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentType/MesXslEquipmentType.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentType/MesXslEquipmentTypeList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/MesXslEquipmentPart.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentPart/MesXslEquipmentPartList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentSubPart/MesXslEquipmentSubPart.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentSubPart/MesXslEquipmentSubPartList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedgerList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslSparePart/MesXslSparePart.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslSparePart/MesXslSparePartList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainType.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeMainType/MesXslDowntimeMainTypeList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeType/MesXslDowntimeTypeList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslInspectMaintainItem/MesXslInspectMaintainItem.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslInspectMaintainItem/MesXslInspectMaintainItemList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfig.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectConfig/MesXslEquipInspectConfigList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecord.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecordList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList.vue
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeRecord;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeType;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentLedger;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeRecordService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeTypeService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentLedgerService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslDowntimeRecordMaintenanceDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 停机记录
|
||||
*/
|
||||
@Tag(name = "MES停机记录")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslDowntimeRecord")
|
||||
@Slf4j
|
||||
public class MesXslDowntimeRecordController extends JeecgController<MesXslDowntimeRecord, IMesXslDowntimeRecordService> {
|
||||
|
||||
@Autowired
|
||||
private IMesXslDowntimeRecordService mesXslDowntimeRecordService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslEquipmentLedgerService mesXslEquipmentLedgerService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslDowntimeTypeService mesXslDowntimeTypeService;
|
||||
|
||||
@Operation(summary = "MES停机记录-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslDowntimeRecord>> queryPageList(
|
||||
MesXslDowntimeRecord model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslDowntimeRecord> queryWrapper = QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】停机记录列表默认按开始时间倒序-----------
|
||||
queryWrapper.orderByDesc("start_time").orderByDesc("create_time");
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】停机记录列表默认按开始时间倒序-----------
|
||||
Page<MesXslDowntimeRecord> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslDowntimeRecord> pageList = mesXslDowntimeRecordService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机记录-添加")
|
||||
@Operation(summary = "MES停机记录-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_record:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslDowntimeRecord model) {
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】停机记录保存前校验-----------
|
||||
String err = validateForSave(model);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
clearMaintenanceFieldsForFormSave(model);
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】停机记录保存前校验-----------
|
||||
mesXslDowntimeRecordService.save(model);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机记录-编辑")
|
||||
@Operation(summary = "MES停机记录-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_record:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslDowntimeRecord model) {
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】停机记录保存前校验-----------
|
||||
String err = validateForSave(model);
|
||||
if (err != null) {
|
||||
return Result.error(err);
|
||||
}
|
||||
MesXslDowntimeRecord old = mesXslDowntimeRecordService.getById(model.getId());
|
||||
if (old == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
preserveMaintenanceFields(model, old);
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】停机记录保存前校验-----------
|
||||
mesXslDowntimeRecordService.updateById(model);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机记录-录入维修结果")
|
||||
@Operation(summary = "MES停机记录-录入维修结果")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_record:edit")
|
||||
@PostMapping(value = "/saveMaintenanceResult")
|
||||
public Result<String> saveMaintenanceResult(@RequestBody MesXslDowntimeRecordMaintenanceDTO dto) {
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】停机记录录入维修结果-----------
|
||||
mesXslDowntimeRecordService.saveMaintenanceResult(dto);
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】停机记录录入维修结果-----------
|
||||
return Result.OK("录入成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机记录-删除")
|
||||
@Operation(summary = "MES停机记录-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_record:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslDowntimeRecordService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES停机记录-批量删除")
|
||||
@Operation(summary = "MES停机记录-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_record:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslDowntimeRecordService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES停机记录-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslDowntimeRecord> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslDowntimeRecord entity = mesXslDowntimeRecordService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_record:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslDowntimeRecord model) {
|
||||
return super.exportXls(request, model, MesXslDowntimeRecord.class, "MES停机记录");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_downtime_record:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, MesXslDowntimeRecord.class);
|
||||
}
|
||||
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】停机记录保存前校验、关联设备与停机类型回填-----------
|
||||
private String validateForSave(MesXslDowntimeRecord model) {
|
||||
if (model == null) {
|
||||
return "参数无效";
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getEquipmentLedgerId())) {
|
||||
return "请选择机台";
|
||||
}
|
||||
MesXslEquipmentLedger ledger = mesXslEquipmentLedgerService.getById(model.getEquipmentLedgerId());
|
||||
if (ledger == null
|
||||
|| (ledger.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(ledger.getDelFlag()))) {
|
||||
return "所选设备不存在";
|
||||
}
|
||||
model.setEquipmentCode(ledger.getEquipmentCode());
|
||||
model.setEquipmentName(ledger.getEquipmentName());
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getDowntimeTypeId())) {
|
||||
return "请选择停机原因";
|
||||
}
|
||||
MesXslDowntimeType downtimeType = mesXslDowntimeTypeService.getById(model.getDowntimeTypeId());
|
||||
if (downtimeType == null
|
||||
|| (downtimeType.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(downtimeType.getDelFlag()))) {
|
||||
return "所选停机类型不存在";
|
||||
}
|
||||
if (!"0".equals(downtimeType.getStatus())) {
|
||||
return "所选停机类型未启用";
|
||||
}
|
||||
model.setDowntimeTypeName(downtimeType.getDowntimeType());
|
||||
|
||||
if (model.getStartTime() == null) {
|
||||
return "开始时间不能为空";
|
||||
}
|
||||
Date endTime = model.getEndTime();
|
||||
if (endTime != null && endTime.before(model.getStartTime())) {
|
||||
return "结束时间不能早于开始时间";
|
||||
}
|
||||
|
||||
if (oConvertUtils.isEmpty(model.getMaintenanceFilledFlag())) {
|
||||
model.setMaintenanceFilledFlag("0");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void clearMaintenanceFieldsForFormSave(MesXslDowntimeRecord model) {
|
||||
model.setEquipmentPartId(null);
|
||||
model.setEquipmentPartName(null);
|
||||
model.setInspectMaintainItemId(null);
|
||||
model.setInspectMaintainItemName(null);
|
||||
model.setMaintenanceResult(null);
|
||||
model.setMaintainerUserId(null);
|
||||
model.setMaintainerUsername(null);
|
||||
model.setMaintainerRealname(null);
|
||||
model.setMaintenanceFilledFlag("0");
|
||||
}
|
||||
|
||||
private void preserveMaintenanceFields(MesXslDowntimeRecord model, MesXslDowntimeRecord old) {
|
||||
model.setEquipmentPartId(old.getEquipmentPartId());
|
||||
model.setEquipmentPartName(old.getEquipmentPartName());
|
||||
model.setInspectMaintainItemId(old.getInspectMaintainItemId());
|
||||
model.setInspectMaintainItemName(old.getInspectMaintainItemName());
|
||||
model.setMaintenanceResult(old.getMaintenanceResult());
|
||||
model.setMaintainerUserId(old.getMaintainerUserId());
|
||||
model.setMaintainerUsername(old.getMaintainerUsername());
|
||||
model.setMaintainerRealname(old.getMaintainerRealname());
|
||||
model.setMaintenanceFilledFlag(
|
||||
oConvertUtils.isEmpty(old.getMaintenanceFilledFlag()) ? "0" : old.getMaintenanceFilledFlag());
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】停机记录保存前校验、关联设备与停机类型回填-----------
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* MES 停机记录(表 mes_xsl_downtime_record)
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_downtime_record")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES停机记录")
|
||||
public class MesXslDowntimeRecord implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "设备台账主键 mes_xsl_equipment_ledger.id")
|
||||
private String equipmentLedgerId;
|
||||
|
||||
@Excel(name = "设备编号", width = 18)
|
||||
@Schema(description = "设备编号冗余")
|
||||
private String equipmentCode;
|
||||
|
||||
@Excel(name = "机台", width = 22)
|
||||
@Schema(description = "设备名称冗余")
|
||||
private String equipmentName;
|
||||
|
||||
@Schema(description = "停机类型主键 mes_xsl_downtime_type.id")
|
||||
private String downtimeTypeId;
|
||||
|
||||
@Excel(name = "停机原因", width = 24)
|
||||
@Schema(description = "停机类型名称冗余")
|
||||
private String downtimeTypeName;
|
||||
|
||||
@Excel(name = "开始时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "开始时间")
|
||||
private Date startTime;
|
||||
|
||||
@Excel(name = "结束时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "结束时间")
|
||||
private Date endTime;
|
||||
|
||||
@Schema(description = "设备部位主键 mes_xsl_equipment_part.id")
|
||||
private String equipmentPartId;
|
||||
|
||||
@Excel(name = "设备部位", width = 18)
|
||||
@Schema(description = "设备部位名称冗余")
|
||||
private String equipmentPartName;
|
||||
|
||||
@Schema(description = "点检及保养项目主键 mes_xsl_inspect_maintain_item.id")
|
||||
private String inspectMaintainItemId;
|
||||
|
||||
@Excel(name = "维修项目", width = 22)
|
||||
@Schema(description = "点检项目名称冗余")
|
||||
private String inspectMaintainItemName;
|
||||
|
||||
@Excel(name = "维修结果", width = 28)
|
||||
@Schema(description = "维修结果")
|
||||
private String maintenanceResult;
|
||||
|
||||
@Schema(description = "维修人用户ID")
|
||||
private String maintainerUserId;
|
||||
|
||||
@Schema(description = "维修人账号")
|
||||
private String maintainerUsername;
|
||||
|
||||
@Excel(name = "维修人", width = 12)
|
||||
@Schema(description = "维修人姓名")
|
||||
private String maintainerRealname;
|
||||
|
||||
@Excel(name = "是否已录入维修", width = 14, dicCode = "yn")
|
||||
@Dict(dicCode = "yn")
|
||||
@Schema(description = "是否已录入维修结果(字典yn:1是0否)")
|
||||
private String maintenanceFilledFlag;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
private String createBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
private String updateBy;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeRecord;
|
||||
|
||||
/**
|
||||
* MES 停机记录
|
||||
*/
|
||||
public interface MesXslDowntimeRecordMapper extends BaseMapper<MesXslDowntimeRecord> {}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeRecord;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslDowntimeRecordMaintenanceDTO;
|
||||
|
||||
/**
|
||||
* MES 停机记录
|
||||
*/
|
||||
public interface IMesXslDowntimeRecordService extends IService<MesXslDowntimeRecord> {
|
||||
|
||||
/**
|
||||
* 录入维修结果
|
||||
*/
|
||||
void saveMaintenanceResult(MesXslDowntimeRecordMaintenanceDTO dto);
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslDowntimeRecord;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslEquipmentPart;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslInspectMaintainItem;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslDowntimeRecordMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslDowntimeRecordService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslEquipmentPartService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslInspectMaintainItemService;
|
||||
import org.jeecg.modules.xslmes.vo.MesXslDowntimeRecordMaintenanceDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* MES 停机记录
|
||||
*/
|
||||
@Service
|
||||
public class MesXslDowntimeRecordServiceImpl extends ServiceImpl<MesXslDowntimeRecordMapper, MesXslDowntimeRecord>
|
||||
implements IMesXslDowntimeRecordService {
|
||||
|
||||
@Autowired
|
||||
private IMesXslEquipmentPartService mesXslEquipmentPartService;
|
||||
|
||||
@Autowired
|
||||
private IMesXslInspectMaintainItemService mesXslInspectMaintainItemService;
|
||||
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】停机记录录入维修结果-----------
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveMaintenanceResult(MesXslDowntimeRecordMaintenanceDTO dto) {
|
||||
if (dto == null || oConvertUtils.isEmpty(dto.getId())) {
|
||||
throw new JeecgBootException("停机记录不存在");
|
||||
}
|
||||
MesXslDowntimeRecord record = this.getById(dto.getId());
|
||||
if (record == null
|
||||
|| (record.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(record.getDelFlag()))) {
|
||||
throw new JeecgBootException("停机记录不存在");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(dto.getEquipmentPartId())) {
|
||||
throw new JeecgBootException("请选择设备部位");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(dto.getInspectMaintainItemId())) {
|
||||
throw new JeecgBootException("请选择维修项目");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(dto.getMaintenanceResult()) || dto.getMaintenanceResult().trim().isEmpty()) {
|
||||
throw new JeecgBootException("维修结果不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(dto.getMaintainerUserId())) {
|
||||
throw new JeecgBootException("请选择维修人");
|
||||
}
|
||||
|
||||
MesXslEquipmentPart part = mesXslEquipmentPartService.getById(dto.getEquipmentPartId());
|
||||
if (part == null
|
||||
|| (part.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(part.getDelFlag()))) {
|
||||
throw new JeecgBootException("设备部位不存在");
|
||||
}
|
||||
|
||||
MesXslInspectMaintainItem item = mesXslInspectMaintainItemService.getById(dto.getInspectMaintainItemId());
|
||||
if (item == null
|
||||
|| (item.getDelFlag() != null && CommonConstant.DEL_FLAG_1.equals(item.getDelFlag()))) {
|
||||
throw new JeecgBootException("维修项目不存在");
|
||||
}
|
||||
if (!dto.getEquipmentPartId().equals(item.getEquipmentPartId())) {
|
||||
throw new JeecgBootException("维修项目与所选设备部位不匹配");
|
||||
}
|
||||
|
||||
record.setEquipmentPartId(part.getId());
|
||||
record.setEquipmentPartName(part.getPartName());
|
||||
record.setInspectMaintainItemId(item.getId());
|
||||
record.setInspectMaintainItemName(item.getItemName());
|
||||
record.setMaintenanceResult(dto.getMaintenanceResult().trim());
|
||||
record.setMaintainerUserId(dto.getMaintainerUserId());
|
||||
record.setMaintainerUsername(trimToNull(dto.getMaintainerUsername()));
|
||||
record.setMaintainerRealname(trimToNull(dto.getMaintainerRealname()));
|
||||
record.setMaintenanceFilledFlag("1");
|
||||
this.updateById(record);
|
||||
}
|
||||
|
||||
private static String trimToNull(String value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
String v = value.trim();
|
||||
return v.isEmpty() ? null : v;
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】停机记录录入维修结果-----------
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.jeecg.modules.xslmes.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 停机记录-录入维修结果入参
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "停机记录-录入维修结果")
|
||||
public class MesXslDowntimeRecordMaintenanceDTO {
|
||||
|
||||
@Schema(description = "停机记录主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "设备部位主键")
|
||||
private String equipmentPartId;
|
||||
|
||||
@Schema(description = "点检及保养项目主键")
|
||||
private String inspectMaintainItemId;
|
||||
|
||||
@Schema(description = "维修结果")
|
||||
private String maintenanceResult;
|
||||
|
||||
@Schema(description = "维修人用户ID")
|
||||
private String maintainerUserId;
|
||||
|
||||
@Schema(description = "维修人账号")
|
||||
private String maintainerUsername;
|
||||
|
||||
@Schema(description = "维修人姓名")
|
||||
private String maintainerRealname;
|
||||
}
|
||||
@@ -540,3 +540,21 @@ jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTes
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/MesXslRubberQuickTestRecord.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestRecord/components/MesXslRubberQuickTestRecordModal.vue
|
||||
jeecgboot-vue3/src/views/mes/material/MesMaterialList.vue
|
||||
|
||||
-- author:jiangxh---date:20250602--for: 【MES】停机记录:建表+菜单+CRUD+列表录入维修结果弹窗 ---
|
||||
jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_117__mes_xsl_downtime_record.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslDowntimeRecord.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslDowntimeRecordMaintenanceDTO.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslDowntimeRecordMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslDowntimeRecordService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslDowntimeRecordServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslDowntimeRecordController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslInspectMaintainItemController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecord.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeRecordMaintenanceModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslDowntimeTypeSelectModal.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslDowntimeRecord/components/MesXslInspectMaintainItemSelectModal.vue
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
-- MES 停机记录:建表 + 菜单 + 按钮 + 租户 admin 授权
|
||||
-- 权限前缀:mes:mes_xsl_downtime_record:*
|
||||
-- 父菜单:设备管理;依赖设备台账、停机类型
|
||||
-- 独立脚本:jeecg-boot/db/mes-xsl-downtime-record-menu-permission.sql
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_downtime_record` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`equipment_ledger_id` varchar(32) NOT NULL COMMENT '设备台账主键 mes_xsl_equipment_ledger.id',
|
||||
`equipment_code` varchar(500) DEFAULT NULL COMMENT '设备编号冗余',
|
||||
`equipment_name` varchar(500) DEFAULT NULL COMMENT '设备名称冗余',
|
||||
`downtime_type_id` varchar(32) NOT NULL COMMENT '停机类型主键 mes_xsl_downtime_type.id',
|
||||
`downtime_type_name` varchar(500) DEFAULT NULL COMMENT '停机类型名称冗余',
|
||||
`start_time` datetime NOT NULL COMMENT '开始时间',
|
||||
`end_time` datetime DEFAULT NULL COMMENT '结束时间',
|
||||
`equipment_part_id` varchar(32) DEFAULT NULL COMMENT '设备部位主键 mes_xsl_equipment_part.id',
|
||||
`equipment_part_name` varchar(500) DEFAULT NULL COMMENT '设备部位名称冗余',
|
||||
`inspect_maintain_item_id` varchar(32) DEFAULT NULL COMMENT '点检及保养项目主键 mes_xsl_inspect_maintain_item.id',
|
||||
`inspect_maintain_item_name` varchar(500) DEFAULT NULL COMMENT '点检项目名称冗余',
|
||||
`maintenance_result` varchar(500) DEFAULT NULL COMMENT '维修结果',
|
||||
`maintainer_user_id` varchar(32) DEFAULT NULL COMMENT '维修人用户ID',
|
||||
`maintainer_username` varchar(500) DEFAULT NULL COMMENT '维修人账号',
|
||||
`maintainer_realname` varchar(500) DEFAULT NULL COMMENT '维修人姓名',
|
||||
`maintenance_filled_flag` varchar(1) DEFAULT '0' COMMENT '是否已录入维修结果(字典yn:1是0否)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(500) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(500) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(500) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mdr_equipment` (`equipment_ledger_id`),
|
||||
KEY `idx_mdr_downtime_type` (`downtime_type_id`),
|
||||
KEY `idx_mdr_start_time` (`start_time`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES停机记录';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_equip_pid = (
|
||||
SELECT `id` FROM `sys_permission`
|
||||
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '设备管理'
|
||||
LIMIT 1
|
||||
);
|
||||
SET @mes_equip_pid = IFNULL(@mes_equip_pid, '1860000000000000133');
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `url`, `component`, `component_name`, `menu_type`, `perms`, `perms_type`, `sort_no`, `is_route`, `is_leaf`, `hidden`, `status`, `del_flag`, `keep_alive`, `internal_or_external`, `create_by`, `create_time`)
|
||||
SELECT '1860000000000000201', @mes_equip_pid, '停机记录', '/xslmes/mesXslDowntimeRecord', 'xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList', 'MesXslDowntimeRecordList', 1, NULL, '1', 12, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW()
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000201');
|
||||
|
||||
UPDATE `sys_permission` SET
|
||||
`parent_id` = @mes_equip_pid, `name` = '停机记录', `url` = '/xslmes/mesXslDowntimeRecord',
|
||||
`component` = 'xslmes/mesXslDowntimeRecord/MesXslDowntimeRecordList', `component_name` = 'MesXslDowntimeRecordList',
|
||||
`menu_type` = 1, `sort_no` = 12, `is_route` = 1, `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
|
||||
`keep_alive` = 1, `internal_or_external` = 0, `icon` = 'ant-design:history-outlined'
|
||||
WHERE `id` = '1860000000000000201';
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`)
|
||||
SELECT '1860000000000000202', '1860000000000000201', '新增', 2, 'mes:mes_xsl_downtime_record:add', '1', '1', 0, 'admin', NOW()
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000202');
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`)
|
||||
SELECT '1860000000000000203', '1860000000000000201', '编辑', 2, 'mes:mes_xsl_downtime_record:edit', '1', '1', 0, 'admin', NOW()
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000203');
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`)
|
||||
SELECT '1860000000000000204', '1860000000000000201', '删除', 2, 'mes:mes_xsl_downtime_record:delete', '1', '1', 0, 'admin', NOW()
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000204');
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`)
|
||||
SELECT '1860000000000000205', '1860000000000000201', '批量删除', 2, 'mes:mes_xsl_downtime_record:deleteBatch', '1', '1', 0, 'admin', NOW()
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000205');
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`)
|
||||
SELECT '1860000000000000206', '1860000000000000201', '导出', 2, 'mes:mes_xsl_downtime_record:exportXls', '1', '1', 0, 'admin', NOW()
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000206');
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `status`, `del_flag`, `create_by`, `create_time`)
|
||||
SELECT '1860000000000000207', '1860000000000000201', '导入', 2, 'mes:mes_xsl_downtime_record:importExcel', '1', '1', 0, 'admin', NOW()
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_permission` WHERE `id` = '1860000000000000207');
|
||||
|
||||
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`)
|
||||
SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
|
||||
FROM `sys_role` r
|
||||
CROSS JOIN `sys_permission` p
|
||||
WHERE r.`tenant_id` = @mes_tenant_id
|
||||
AND r.`role_code` = 'admin'
|
||||
AND p.`id` IN (
|
||||
'1860000000000000201',
|
||||
'1860000000000000202', '1860000000000000203', '1860000000000000204', '1860000000000000205',
|
||||
'1860000000000000206', '1860000000000000207'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only :placeholder="placeholder" style="flex: 1" />
|
||||
<a-button type="primary" @click="emit('open')">选择</a-button>
|
||||
<a-button v-if="showClear" @click="emit('clear')">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
defineProps<{
|
||||
model: Recordable;
|
||||
field: string;
|
||||
placeholder?: string;
|
||||
showClear?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{ (e: 'open'): void; (e: 'clear'): void }>();
|
||||
</script>
|
||||
@@ -44,7 +44,14 @@ export const columns: BasicColumn[] = [
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'processOperationId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属工序',
|
||||
field: 'processOperationName',
|
||||
component: 'Input',
|
||||
slot: 'processOperationPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '是否启用',
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-processOperationPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择工序"
|
||||
:show-clear="!!model.processOperationId"
|
||||
@open="openProcessSelect"
|
||||
@clear="clearModelFields(model, ['processOperationId', 'processOperationName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_downtime_main_type:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +56,7 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslDowntimeMainTypeModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -54,11 +65,17 @@
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslDowntimeMainTypeModal from './components/MesXslDowntimeMainTypeModal.vue';
|
||||
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslDowntimeMainType.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslDowntimeMainType.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [{ idField: 'processOperationId', nameField: 'processOperationName' }];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -66,6 +83,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
@@ -87,7 +105,19 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openProcessSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openProcessModal(true, { processOperationId: v.processOperationId });
|
||||
}
|
||||
|
||||
function onProcessSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
processOperationId: payload.processOperationId || '',
|
||||
processOperationName: payload.processOperationName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslDowntimeRecord/list',
|
||||
save = '/xslmes/mesXslDowntimeRecord/add',
|
||||
edit = '/xslmes/mesXslDowntimeRecord/edit',
|
||||
deleteOne = '/xslmes/mesXslDowntimeRecord/delete',
|
||||
deleteBatch = '/xslmes/mesXslDowntimeRecord/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslDowntimeRecord/importExcel',
|
||||
exportXls = '/xslmes/mesXslDowntimeRecord/exportXls',
|
||||
queryById = '/xslmes/mesXslDowntimeRecord/queryById',
|
||||
saveMaintenanceResult = '/xslmes/mesXslDowntimeRecord/saveMaintenanceResult',
|
||||
}
|
||||
|
||||
export const getExportUrl = Api.exportXls;
|
||||
export const getImportUrl = Api.importExcel;
|
||||
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
|
||||
|
||||
export const saveMaintenanceResult = (params) => defHttp.post({ url: Api.saveMaintenanceResult, params });
|
||||
|
||||
export const deleteOne = (params, handleSuccess) => {
|
||||
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
};
|
||||
|
||||
export const batchDelete = (params, handleSuccess) => {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '确认删除',
|
||||
content: '是否删除选中数据',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: () => {
|
||||
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||
handleSuccess();
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const saveOrUpdate = (params, isUpdate) => {
|
||||
const url = isUpdate ? Api.edit : Api.save;
|
||||
return defHttp.post({ url, params });
|
||||
};
|
||||
@@ -0,0 +1,177 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
/** 弹窗内日期时间选择:下拉挂到 body,避免被 Modal 滚动区裁剪 */
|
||||
const dateTimePickerProps = {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||
style: { width: '100%' },
|
||||
getPopupContainer: () => document.body,
|
||||
};
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '机台', align: 'center', dataIndex: 'equipmentName', width: 150 },
|
||||
{ title: '设备编号', align: 'center', dataIndex: 'equipmentCode', width: 130 },
|
||||
{ title: '停机原因', align: 'center', dataIndex: 'downtimeTypeName', width: 150 },
|
||||
{
|
||||
title: '开始时间',
|
||||
align: 'center',
|
||||
dataIndex: 'startTime',
|
||||
width: 165,
|
||||
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||
},
|
||||
{
|
||||
title: '结束时间',
|
||||
align: 'center',
|
||||
dataIndex: 'endTime',
|
||||
width: 165,
|
||||
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||
},
|
||||
{ title: '设备部位', align: 'center', dataIndex: 'equipmentPartName', width: 120 },
|
||||
{ title: '维修项目', align: 'center', dataIndex: 'inspectMaintainItemName', width: 140 },
|
||||
{ title: '维修结果', align: 'center', dataIndex: 'maintenanceResult', width: 160, ellipsis: true },
|
||||
{ title: '维修人', align: 'center', dataIndex: 'maintainerRealname', width: 100 },
|
||||
{ title: '是否已录入维修', align: 'center', dataIndex: 'maintenanceFilledFlag_dictText', width: 120 },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||
{
|
||||
title: '创建时间',
|
||||
align: 'center',
|
||||
dataIndex: 'createTime',
|
||||
width: 165,
|
||||
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '', field: 'equipmentLedgerId', component: 'Input', show: false },
|
||||
{
|
||||
label: '机台',
|
||||
field: 'equipmentName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'downtimeTypeId', component: 'Input', show: false },
|
||||
{
|
||||
label: '停机原因',
|
||||
field: 'downtimeTypeName',
|
||||
component: 'Input',
|
||||
slot: 'downtimeTypePicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '是否已录入维修',
|
||||
field: 'maintenanceFilledFlag',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'yn' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '',
|
||||
field: 'equipmentLedgerId',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
dynamicRules: () => [{ required: true, message: '请选择机台' }],
|
||||
},
|
||||
{
|
||||
label: '机台',
|
||||
field: 'equipmentName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentPicker',
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
field: 'downtimeTypeId',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
dynamicRules: () => [{ required: true, message: '请选择停机原因' }],
|
||||
},
|
||||
{
|
||||
label: '停机原因',
|
||||
field: 'downtimeTypeName',
|
||||
component: 'Input',
|
||||
slot: 'downtimeTypePicker',
|
||||
},
|
||||
{
|
||||
label: '开始时间',
|
||||
field: 'startTime',
|
||||
component: 'DatePicker',
|
||||
required: true,
|
||||
componentProps: { ...dateTimePickerProps, placeholder: '请选择开始时间' },
|
||||
},
|
||||
{
|
||||
label: '结束时间',
|
||||
field: 'endTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: { ...dateTimePickerProps, placeholder: '请选择结束时间' },
|
||||
},
|
||||
];
|
||||
|
||||
/** 录入维修结果弹窗 */
|
||||
export const maintenanceFormSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{ label: '', field: 'equipmentLedgerId', component: 'Input', show: false },
|
||||
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
|
||||
{ label: '', field: 'equipmentTypeId', component: 'Input', show: false },
|
||||
{ label: '', field: 'maintainerUsername', component: 'Input', show: false },
|
||||
{ label: '', field: 'maintainerRealname', component: 'Input', show: false },
|
||||
{
|
||||
label: '',
|
||||
field: 'equipmentPartId',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
dynamicRules: () => [{ required: true, message: '请选择设备部位' }],
|
||||
},
|
||||
{
|
||||
label: '设备部位',
|
||||
field: 'equipmentPartName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentPartPicker',
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
field: 'inspectMaintainItemId',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
dynamicRules: () => [{ required: true, message: '请选择维修项目' }],
|
||||
},
|
||||
{
|
||||
label: '维修项目',
|
||||
field: 'inspectMaintainItemName',
|
||||
component: 'Input',
|
||||
slot: 'inspectItemPicker',
|
||||
},
|
||||
{
|
||||
label: '维修结果',
|
||||
field: 'maintenanceResult',
|
||||
component: 'InputTextArea',
|
||||
required: true,
|
||||
componentProps: { rows: 3, placeholder: '手输维修结果' },
|
||||
},
|
||||
{
|
||||
label: '维修人',
|
||||
field: 'maintainerUserId',
|
||||
component: 'JSelectUser',
|
||||
required: true,
|
||||
componentProps: ({ formActionType }) => ({
|
||||
rowKey: 'id',
|
||||
labelKey: 'realname',
|
||||
isRadioSelection: true,
|
||||
maxSelectCount: 1,
|
||||
onOptionsChange: (options) => {
|
||||
const row = options?.[0];
|
||||
if (row && formActionType) {
|
||||
formActionType.setFieldsValue({
|
||||
maintainerUsername: row.username,
|
||||
maintainerRealname: row.realname,
|
||||
});
|
||||
}
|
||||
},
|
||||
}),
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,198 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-equipmentPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择设备"
|
||||
:show-clear="!!model.equipmentLedgerId"
|
||||
@open="openEquipmentSelect"
|
||||
@clear="clearModelFields(model, ['equipmentLedgerId', 'equipmentName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #form-downtimeTypePicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择停机类型"
|
||||
:show-clear="!!model.downtimeTypeId"
|
||||
@open="openDowntimeTypeSelect"
|
||||
@clear="clearModelFields(model, ['downtimeTypeId', 'downtimeTypeName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_downtime_record:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_downtime_record:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_downtime_record:importExcel'"
|
||||
preIcon="ant-design:import-outlined"
|
||||
@click="onImportXls"
|
||||
>
|
||||
导入
|
||||
</j-upload-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined" />
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button v-auth="'mes:mes_xsl_downtime_record:deleteBatch'">
|
||||
批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableActions(record)" :dropDownActions="getDropDownAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslDowntimeRecordModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslDowntimeRecordMaintenanceModal @register="registerMaintenanceModal" @success="handleSuccess" />
|
||||
<MesXslEquipmentLedgerSelectModal @register="registerEquipmentModal" @select="onEquipmentSelect" />
|
||||
<MesXslDowntimeTypeSelectModal @register="registerDowntimeTypeModal" @select="onDowntimeTypeSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslDowntimeRecord" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslDowntimeRecordModal from './components/MesXslDowntimeRecordModal.vue';
|
||||
import MesXslDowntimeRecordMaintenanceModal from './components/MesXslDowntimeRecordMaintenanceModal.vue';
|
||||
import MesXslEquipmentLedgerSelectModal from '/@/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipmentLedgerSelectModal.vue';
|
||||
import MesXslDowntimeTypeSelectModal from './components/MesXslDowntimeTypeSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslDowntimeRecord.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslDowntimeRecord.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
{ idField: 'equipmentLedgerId', nameField: 'equipmentName' },
|
||||
{ idField: 'downtimeTypeId', nameField: 'downtimeTypeName' },
|
||||
];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerMaintenanceModal, { openModal: openMaintenanceModal }] = useModal();
|
||||
const [registerEquipmentModal, { openModal: openEquipmentModal }] = useModal();
|
||||
const [registerDowntimeTypeModal, { openModal: openDowntimeTypeModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '停机记录',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
width: 260,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '停机记录',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openEquipmentSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openEquipmentModal(true, { equipmentLedgerId: v.equipmentLedgerId });
|
||||
}
|
||||
|
||||
function onEquipmentSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentLedgerId: payload.equipmentLedgerId || '',
|
||||
equipmentName: payload.equipmentName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function openDowntimeTypeSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openDowntimeTypeModal(true, { downtimeTypeId: v.downtimeTypeId });
|
||||
}
|
||||
|
||||
function onDowntimeTypeSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
downtimeTypeId: payload.downtimeTypeId || '',
|
||||
downtimeTypeName: payload.downtimeTypeName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
}
|
||||
|
||||
function handleEnterMaintenance(record: Recordable) {
|
||||
openMaintenanceModal(true, { record });
|
||||
}
|
||||
|
||||
function getTableActions(record: Recordable) {
|
||||
return [
|
||||
{
|
||||
label: '录入维修结果',
|
||||
onClick: handleEnterMaintenance.bind(null, record),
|
||||
auth: 'mes:mes_xsl_downtime_record:edit',
|
||||
},
|
||||
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_xsl_downtime_record:edit' },
|
||||
];
|
||||
}
|
||||
|
||||
async function handleDelete(record) {
|
||||
await deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
async function batchHandleDelete() {
|
||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
selectedRowKeys.value = [];
|
||||
reload();
|
||||
}
|
||||
|
||||
function getDropDownAction(record) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'mes:mes_xsl_downtime_record:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" destroyOnClose title="录入维修结果" width="640px" @register="registerModal" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #equipmentPartPicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请选择设备部位(非小部位)" style="flex: 1" />
|
||||
<a-button type="primary" @click="openPartSelect">选择部位</a-button>
|
||||
<a-button v-if="model.equipmentPartId" @click="clearPart">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
<template #inspectItemPicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请先选部位,再选点检项目" style="flex: 1" />
|
||||
<a-button type="primary" :disabled="!model.equipmentPartId" @click="openItemSelect">选择项目</a-button>
|
||||
<a-button v-if="model.inspectMaintainItemId" @click="clearItem">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<MesXslEquipmentPartSelectModal @register="registerPartModal" @select="onPartSelect" />
|
||||
<MesXslInspectMaintainItemSelectModal @register="registerItemModal" @select="onItemSelect" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { maintenanceFormSchema } from '../MesXslDowntimeRecord.data';
|
||||
import { saveMaintenanceResult } from '../MesXslDowntimeRecord.api';
|
||||
import { queryById as queryEquipmentById } from '/@/views/xslmes/mesXslEquipmentLedger/MesXslEquipmentLedger.api';
|
||||
import MesXslEquipmentPartSelectModal from '/@/views/xslmes/mesXslEquipmentSubPart/components/MesXslEquipmentPartSelectModal.vue';
|
||||
import MesXslInspectMaintainItemSelectModal from './MesXslInspectMaintainItemSelectModal.vue';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const [registerPartModal, { openModal: openPartModal }] = useModal();
|
||||
const [registerItemModal, { openModal: openItemModal }] = useModal();
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, getFieldsValue }] = useForm({
|
||||
labelWidth: 100,
|
||||
schemas: maintenanceFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
baseColProps: { span: 24 },
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false });
|
||||
const record = data?.record;
|
||||
if (!record?.id) {
|
||||
return;
|
||||
}
|
||||
let equipmentCategoryId = '';
|
||||
let equipmentTypeId = '';
|
||||
if (record.equipmentLedgerId) {
|
||||
try {
|
||||
const raw = await queryEquipmentById({ id: record.equipmentLedgerId });
|
||||
const ledger = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
equipmentCategoryId = ledger?.equipmentCategoryId || '';
|
||||
equipmentTypeId = ledger?.equipmentTypeId || '';
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
await setFieldsValue({
|
||||
id: record.id,
|
||||
equipmentLedgerId: record.equipmentLedgerId,
|
||||
equipmentCategoryId,
|
||||
equipmentTypeId,
|
||||
equipmentPartId: record.equipmentPartId,
|
||||
equipmentPartName: record.equipmentPartName,
|
||||
inspectMaintainItemId: record.inspectMaintainItemId,
|
||||
inspectMaintainItemName: record.inspectMaintainItemName,
|
||||
maintenanceResult: record.maintenanceResult,
|
||||
maintainerUserId: record.maintainerUserId,
|
||||
maintainerUsername: record.maintainerUsername,
|
||||
maintainerRealname: record.maintainerRealname,
|
||||
});
|
||||
});
|
||||
|
||||
function openPartSelect() {
|
||||
const vals = getFieldsValue();
|
||||
if (!vals.equipmentCategoryId) {
|
||||
createMessage.warning('无法获取设备类别,请确认停机记录已关联有效设备');
|
||||
return;
|
||||
}
|
||||
openPartModal(true, {
|
||||
equipmentCategoryId: vals.equipmentCategoryId,
|
||||
equipmentPartId: vals.equipmentPartId,
|
||||
});
|
||||
}
|
||||
|
||||
function clearPart() {
|
||||
setFieldsValue({
|
||||
equipmentPartId: '',
|
||||
equipmentPartName: '',
|
||||
inspectMaintainItemId: '',
|
||||
inspectMaintainItemName: '',
|
||||
});
|
||||
}
|
||||
|
||||
function onPartSelect(payload: { equipmentPartId?: string; equipmentPartName?: string }) {
|
||||
const vals = getFieldsValue();
|
||||
const pid = payload.equipmentPartId || '';
|
||||
if (vals.inspectMaintainItemId && vals.equipmentPartId && vals.equipmentPartId !== pid) {
|
||||
setFieldsValue({
|
||||
equipmentPartId: pid,
|
||||
equipmentPartName: payload.equipmentPartName || '',
|
||||
inspectMaintainItemId: '',
|
||||
inspectMaintainItemName: '',
|
||||
});
|
||||
} else {
|
||||
setFieldsValue({
|
||||
equipmentPartId: pid,
|
||||
equipmentPartName: payload.equipmentPartName || '',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function openItemSelect() {
|
||||
const vals = getFieldsValue();
|
||||
if (!vals.equipmentPartId) {
|
||||
createMessage.warning('请先选择设备部位');
|
||||
return;
|
||||
}
|
||||
openItemModal(true, {
|
||||
equipmentPartId: vals.equipmentPartId,
|
||||
equipmentTypeId: vals.equipmentTypeId,
|
||||
inspectMaintainItemId: vals.inspectMaintainItemId,
|
||||
});
|
||||
}
|
||||
|
||||
function clearItem() {
|
||||
setFieldsValue({ inspectMaintainItemId: '', inspectMaintainItemName: '' });
|
||||
}
|
||||
|
||||
function onItemSelect(payload: { inspectMaintainItemId?: string; inspectMaintainItemName?: string }) {
|
||||
setFieldsValue({
|
||||
inspectMaintainItemId: payload.inspectMaintainItemId || '',
|
||||
inspectMaintainItemName: payload.inspectMaintainItemName || '',
|
||||
});
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
if (!values.maintainerUserId) {
|
||||
createMessage.warning('请选择维修人');
|
||||
return;
|
||||
}
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveMaintenanceResult(values);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<BasicModal @register="registerModal" :title="title" width="720" v-bind="$attrs" destroyOnClose @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #equipmentPicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请选择设备" style="flex: 1" />
|
||||
<a-button type="primary" :disabled="isDetail" @click="openEquipmentSelect">选择设备</a-button>
|
||||
<a-button v-if="model.equipmentLedgerId && !isDetail" @click="clearEquipment">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
<template #downtimeTypePicker="{ model, field }">
|
||||
<a-input-group compact style="display: flex; width: 100%">
|
||||
<a-input v-model:value="model[field]" read-only placeholder="请选择停机类型" style="flex: 1" />
|
||||
<a-button type="primary" :disabled="isDetail" @click="openDowntimeTypeSelect">选择停机类型</a-button>
|
||||
<a-button v-if="model.downtimeTypeId && !isDetail" @click="clearDowntimeType">清除</a-button>
|
||||
</a-input-group>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<MesXslEquipmentLedgerSelectModal @register="registerEquipmentModal" @select="onEquipmentSelect" />
|
||||
<MesXslDowntimeTypeSelectModal @register="registerDowntimeTypeModal" @select="onDowntimeTypeSelect" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../MesXslDowntimeRecord.data';
|
||||
import { saveOrUpdate } from '../MesXslDowntimeRecord.api';
|
||||
import MesXslEquipmentLedgerSelectModal from '/@/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipmentLedgerSelectModal.vue';
|
||||
import MesXslDowntimeTypeSelectModal from './MesXslDowntimeTypeSelectModal.vue';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
|
||||
const [registerEquipmentModal, { openModal: openEquipmentModal }] = useModal();
|
||||
const [registerDowntimeTypeModal, { openModal: openDowntimeTypeModal }] = useModal();
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
|
||||
labelWidth: 110,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
await resetFields();
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !data?.showFooter;
|
||||
if (unref(isUpdate)) {
|
||||
await setFieldsValue({ ...data.record });
|
||||
} else {
|
||||
await setFieldsValue({ startTime: dayjs().format('YYYY-MM-DD HH:mm:ss') });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增停机记录' : unref(isDetail) ? '停机记录详情' : '编辑停机记录',
|
||||
);
|
||||
|
||||
function openEquipmentSelect() {
|
||||
const vals = getFieldsValue();
|
||||
openEquipmentModal(true, { equipmentLedgerId: vals.equipmentLedgerId });
|
||||
}
|
||||
|
||||
function clearEquipment() {
|
||||
setFieldsValue({ equipmentLedgerId: '', equipmentName: '', equipmentCode: '' });
|
||||
}
|
||||
|
||||
function onEquipmentSelect(payload: { equipmentLedgerId?: string; equipmentName?: string; equipmentCode?: string }) {
|
||||
setFieldsValue({
|
||||
equipmentLedgerId: payload.equipmentLedgerId || '',
|
||||
equipmentName: payload.equipmentName || '',
|
||||
equipmentCode: payload.equipmentCode || '',
|
||||
});
|
||||
}
|
||||
|
||||
function openDowntimeTypeSelect() {
|
||||
const vals = getFieldsValue();
|
||||
openDowntimeTypeModal(true, { downtimeTypeId: vals.downtimeTypeId });
|
||||
}
|
||||
|
||||
function clearDowntimeType() {
|
||||
setFieldsValue({ downtimeTypeId: '', downtimeTypeName: '' });
|
||||
}
|
||||
|
||||
function onDowntimeTypeSelect(payload: { downtimeTypeId?: string; downtimeTypeName?: string }) {
|
||||
setFieldsValue({
|
||||
downtimeTypeId: payload.downtimeTypeId || '',
|
||||
downtimeTypeName: payload.downtimeTypeName || '',
|
||||
});
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" title="选择停机类型" :width="1000" @register="registerModal" @ok="handleOk">
|
||||
<BasicTable @register="registerTable" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicTable, useTable } from '/@/components/Table';
|
||||
import { list, queryById } from '/@/views/xslmes/mesXslDowntimeType/MesXslDowntimeType.api';
|
||||
|
||||
const emit = defineEmits(['register', 'select']);
|
||||
|
||||
const selectedRow = ref<Recordable | null>(null);
|
||||
|
||||
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
|
||||
selectedRow.value = rows?.[0] ?? null;
|
||||
}
|
||||
|
||||
function fetchTypePage(params: Recordable) {
|
||||
return list({ ...params, status: '0' });
|
||||
}
|
||||
|
||||
const [registerTable, { reload, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] = useTable({
|
||||
api: fetchTypePage,
|
||||
columns: [
|
||||
{ title: '工序名称', dataIndex: 'processOperationName', width: 140 },
|
||||
{ title: '所属主类型', dataIndex: 'downtimeMainTypeName', width: 140 },
|
||||
{ title: '停机类型', dataIndex: 'downtimeType', width: 160 },
|
||||
{ title: '故障等级', dataIndex: 'faultLevel', width: 100 },
|
||||
],
|
||||
rowKey: 'id',
|
||||
useSearchForm: true,
|
||||
formConfig: {
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{ label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 8 } },
|
||||
],
|
||||
},
|
||||
pagination: { pageSize: 10 },
|
||||
canResize: false,
|
||||
showIndexColumn: false,
|
||||
immediate: true,
|
||||
rowSelection: {
|
||||
type: 'radio',
|
||||
columnWidth: 48,
|
||||
onChange: handleSelectionChange,
|
||||
},
|
||||
clickToRowSelect: true,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
selectedRow.value = null;
|
||||
clearSelectedRowKeys?.();
|
||||
setModalProps({ confirmLoading: false });
|
||||
const tid = data?.downtimeTypeId as string | undefined;
|
||||
if (tid) {
|
||||
setSelectedRowKeys?.([tid]);
|
||||
try {
|
||||
const raw = await queryById({ id: tid });
|
||||
const row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
if (row) {
|
||||
selectedRow.value = row;
|
||||
}
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
reload();
|
||||
});
|
||||
|
||||
async function handleOk() {
|
||||
const keys = (getSelectRowKeys?.() || []) as string[];
|
||||
let row = selectedRow.value || ((getSelectRows?.() || []) as Recordable[])[0];
|
||||
if (!row && keys.length) {
|
||||
try {
|
||||
const raw = await queryById({ id: keys[0] });
|
||||
row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
if (!row?.id) {
|
||||
emit('select', { downtimeTypeId: '', downtimeTypeName: '' });
|
||||
closeModal();
|
||||
return;
|
||||
}
|
||||
emit('select', {
|
||||
downtimeTypeId: row.id,
|
||||
downtimeTypeName: row.downtimeType || '',
|
||||
});
|
||||
closeModal();
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<BasicModal v-bind="$attrs" title="选择维修项目" :width="1000" @register="registerModal" @ok="handleOk">
|
||||
<BasicTable @register="registerTable" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicTable, useTable } from '/@/components/Table';
|
||||
import { list, queryById } from '/@/views/xslmes/mesXslInspectMaintainItem/MesXslInspectMaintainItem.api';
|
||||
|
||||
const emit = defineEmits(['register', 'select']);
|
||||
|
||||
const selectedRow = ref<Recordable | null>(null);
|
||||
const filterEquipmentPartId = ref('');
|
||||
const filterEquipmentTypeId = ref('');
|
||||
|
||||
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
|
||||
selectedRow.value = rows?.[0] ?? null;
|
||||
}
|
||||
|
||||
function fetchItemPage(params: Recordable) {
|
||||
const p: Recordable = { ...params };
|
||||
if (filterEquipmentPartId.value) {
|
||||
p.equipmentPartId = filterEquipmentPartId.value;
|
||||
}
|
||||
if (filterEquipmentTypeId.value) {
|
||||
p.equipmentTypeId = filterEquipmentTypeId.value;
|
||||
}
|
||||
return list(p);
|
||||
}
|
||||
|
||||
const [registerTable, { reload, getSelectRowKeys, getSelectRows, setSelectedRowKeys, clearSelectedRowKeys }] = useTable({
|
||||
api: fetchItemPage,
|
||||
columns: [
|
||||
{ title: '项目编号', dataIndex: 'itemCode', width: 120 },
|
||||
{ title: '项目名称', dataIndex: 'itemName', width: 140 },
|
||||
{ title: '项目类别', dataIndex: 'itemCategory_dictText', width: 90 },
|
||||
{ title: '设备部位', dataIndex: 'equipmentPartName', width: 120 },
|
||||
{ title: '设备小部位', dataIndex: 'equipmentSubPartName', width: 120 },
|
||||
{ title: '点检方式', dataIndex: 'inspectMethod_dictText', width: 90 },
|
||||
{ title: '判断基准', dataIndex: 'judgmentCriteria', width: 160, ellipsis: true },
|
||||
],
|
||||
rowKey: 'id',
|
||||
useSearchForm: true,
|
||||
formConfig: {
|
||||
labelWidth: 90,
|
||||
schemas: [
|
||||
{ label: '项目编号', field: 'itemCode', component: 'Input', colProps: { span: 8 } },
|
||||
{ label: '项目名称', field: 'itemName', component: 'Input', colProps: { span: 8 } },
|
||||
{
|
||||
label: '项目类别',
|
||||
field: 'itemCategory',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_im_item_category', placeholder: '点检/保养' },
|
||||
colProps: { span: 8 },
|
||||
},
|
||||
],
|
||||
},
|
||||
pagination: { pageSize: 10 },
|
||||
canResize: false,
|
||||
showIndexColumn: false,
|
||||
immediate: true,
|
||||
rowSelection: {
|
||||
type: 'radio',
|
||||
columnWidth: 48,
|
||||
onChange: handleSelectionChange,
|
||||
},
|
||||
clickToRowSelect: true,
|
||||
});
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
filterEquipmentPartId.value = data?.equipmentPartId ? String(data.equipmentPartId) : '';
|
||||
filterEquipmentTypeId.value = data?.equipmentTypeId ? String(data.equipmentTypeId) : '';
|
||||
selectedRow.value = null;
|
||||
clearSelectedRowKeys?.();
|
||||
setModalProps({ confirmLoading: false });
|
||||
const iid = data?.inspectMaintainItemId as string | undefined;
|
||||
if (iid) {
|
||||
setSelectedRowKeys?.([iid]);
|
||||
try {
|
||||
const raw = await queryById({ id: iid });
|
||||
const row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
if (row) {
|
||||
selectedRow.value = row;
|
||||
}
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
reload();
|
||||
});
|
||||
|
||||
async function handleOk() {
|
||||
const keys = (getSelectRowKeys?.() || []) as string[];
|
||||
let row = selectedRow.value || ((getSelectRows?.() || []) as Recordable[])[0];
|
||||
if (!row && keys.length) {
|
||||
try {
|
||||
const raw = await queryById({ id: keys[0] });
|
||||
row = (raw as any)?.id != null ? raw : (raw as any)?.result;
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
if (!row?.id) {
|
||||
emit('select', { inspectMaintainItemId: '', inspectMaintainItemName: '' });
|
||||
closeModal();
|
||||
return;
|
||||
}
|
||||
emit('select', {
|
||||
inspectMaintainItemId: row.id,
|
||||
inspectMaintainItemName: row.itemName || '',
|
||||
});
|
||||
closeModal();
|
||||
}
|
||||
</script>
|
||||
@@ -47,8 +47,22 @@ export const columns: BasicColumn[] = [
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '主类型', field: 'downtimeMainTypeName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'processOperationId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属工序',
|
||||
field: 'processOperationName',
|
||||
component: 'Input',
|
||||
slot: 'processOperationPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'downtimeMainTypeId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属主类型',
|
||||
field: 'downtimeMainTypeName',
|
||||
component: 'Input',
|
||||
slot: 'downtimeMainTypePicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '停机类型', field: 'downtimeType', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '是否启用',
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-processOperationPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择工序"
|
||||
:show-clear="!!model.processOperationId"
|
||||
@open="openProcessSelect"
|
||||
@clear="clearProcess(model)"
|
||||
/>
|
||||
</template>
|
||||
<template #form-downtimeMainTypePicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请先选工序,再选主类型"
|
||||
:show-clear="!!model.downtimeMainTypeId"
|
||||
@open="openMainTypeSelect"
|
||||
@clear="clearModelFields(model, ['downtimeMainTypeId', 'downtimeMainTypeName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_downtime_type:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +66,8 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslDowntimeTypeModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
|
||||
<MesXslDowntimeMainTypeSelectModal @register="registerMainTypeModal" @select="onMainTypeSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -53,12 +75,26 @@
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslDowntimeTypeModal from './components/MesXslDowntimeTypeModal.vue';
|
||||
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
|
||||
import MesXslDowntimeMainTypeSelectModal from './components/MesXslDowntimeMainTypeSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslDowntimeType.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslDowntimeType.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
{ idField: 'processOperationId', nameField: 'processOperationName' },
|
||||
{ idField: 'downtimeMainTypeId', nameField: 'downtimeMainTypeName' },
|
||||
];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
|
||||
const [registerMainTypeModal, { openModal: openMainTypeModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -66,6 +102,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
@@ -87,7 +124,58 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openProcessSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openProcessModal(true, { processOperationId: v.processOperationId });
|
||||
}
|
||||
|
||||
function clearProcess(model: Recordable) {
|
||||
clearModelFields(model, [
|
||||
'processOperationId',
|
||||
'processOperationName',
|
||||
'downtimeMainTypeId',
|
||||
'downtimeMainTypeName',
|
||||
]);
|
||||
}
|
||||
|
||||
function onProcessSelect(payload: Recordable) {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
const pid = payload.processOperationId || '';
|
||||
if (v.downtimeMainTypeId && v.processOperationId && v.processOperationId !== pid) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
processOperationId: pid,
|
||||
processOperationName: payload.processOperationName || '',
|
||||
downtimeMainTypeId: '',
|
||||
downtimeMainTypeName: '',
|
||||
});
|
||||
} else {
|
||||
getForm()?.setFieldsValue?.({
|
||||
processOperationId: pid,
|
||||
processOperationName: payload.processOperationName || '',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function openMainTypeSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
if (!v.processOperationId) {
|
||||
createMessage.warning('请先选择所属工序');
|
||||
return;
|
||||
}
|
||||
openMainTypeModal(true, {
|
||||
processOperationId: v.processOperationId,
|
||||
downtimeMainTypeId: v.downtimeMainTypeId,
|
||||
});
|
||||
}
|
||||
|
||||
function onMainTypeSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
downtimeMainTypeId: payload.downtimeMainTypeId || '',
|
||||
downtimeMainTypeName: payload.downtimeMainTypeName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -16,7 +16,14 @@ export const columns: BasicColumn[] = [
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'equipmentLedgerId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'equipmentName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentLedgerPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '类型',
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-equipmentLedgerPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择设备台账"
|
||||
:show-clear="!!model.equipmentLedgerId"
|
||||
@open="openLedgerSelect"
|
||||
@clear="clearModelFields(model, ['equipmentLedgerId', 'equipmentName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
@@ -51,6 +61,7 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipInspectConfigModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslEquipmentLedgerSelectModal @register="registerLedgerModal" @select="onLedgerSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -59,11 +70,17 @@
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslEquipInspectConfigModal from './components/MesXslEquipInspectConfigModal.vue';
|
||||
import MesXslEquipmentLedgerSelectModal from './components/MesXslEquipmentLedgerSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslEquipInspectConfig.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipInspectConfig.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [{ idField: 'equipmentLedgerId', nameField: 'equipmentName' }];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerLedgerModal, { openModal: openLedgerModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -71,6 +88,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
@@ -92,7 +110,19 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openLedgerSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openLedgerModal(true, { equipmentLedgerId: v.equipmentLedgerId });
|
||||
}
|
||||
|
||||
function onLedgerSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentLedgerId: payload.equipmentLedgerId || '',
|
||||
equipmentName: payload.equipmentName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -25,7 +25,14 @@ export const columns: BasicColumn[] = [
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '记录编号', field: 'recordNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '计划单号', field: 'planNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'equipmentLedgerId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备名称',
|
||||
field: 'equipmentName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentLedgerPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '类型',
|
||||
field: 'recordType',
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-equipmentLedgerPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择设备台账"
|
||||
:show-clear="!!model.equipmentLedgerId"
|
||||
@open="openLedgerSelect"
|
||||
@clear="clearModelFields(model, ['equipmentLedgerId', 'equipmentName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
@@ -31,6 +41,7 @@
|
||||
</BasicTable>
|
||||
<MesXslEquipInspectRecordModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslEquipInspectRecordHandleModal @register="registerHandleModal" @success="handleSuccess" />
|
||||
<MesXslEquipmentLedgerSelectModal @register="registerLedgerModal" @select="onLedgerSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -40,15 +51,21 @@
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslEquipInspectRecordModal from './components/MesXslEquipInspectRecordModal.vue';
|
||||
import MesXslEquipInspectRecordHandleModal from './components/MesXslEquipInspectRecordHandleModal.vue';
|
||||
import MesXslEquipmentLedgerSelectModal from '/@/views/xslmes/mesXslEquipInspectConfig/components/MesXslEquipmentLedgerSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslEquipInspectRecord.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl } from './MesXslEquipInspectRecord.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [{ idField: 'equipmentLedgerId', nameField: 'equipmentName' }];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerHandleModal, { openModal: openHandleModal }] = useModal();
|
||||
const [registerLedgerModal, { openModal: openLedgerModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -56,6 +73,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
@@ -73,7 +91,19 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openLedgerSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openLedgerModal(true, { equipmentLedgerId: v.equipmentLedgerId });
|
||||
}
|
||||
|
||||
function onLedgerSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentLedgerId: payload.equipmentLedgerId || '',
|
||||
equipmentName: payload.equipmentName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleEnterResult(record: Recordable) {
|
||||
if (record.recordStatus !== 'pending') {
|
||||
|
||||
@@ -19,7 +19,14 @@ export const columns: BasicColumn[] = [
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '类别名称', field: 'categoryName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'processOperationId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属工序',
|
||||
field: 'processOperationName',
|
||||
component: 'Input',
|
||||
slot: 'processOperationPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '点检区分',
|
||||
field: 'inspectDistinct',
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-processOperationPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择工序"
|
||||
:show-clear="!!model.processOperationId"
|
||||
@open="openProcessSelect"
|
||||
@clear="clearModelFields(model, ['processOperationId', 'processOperationName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_category:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +56,7 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipmentCategoryModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -54,11 +65,17 @@
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslEquipmentCategoryModal from './components/MesXslEquipmentCategoryModal.vue';
|
||||
import MesXslProcessOperationSelectModal from './components/MesXslProcessOperationSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentCategory.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentCategory.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [{ idField: 'processOperationId', nameField: 'processOperationName' }];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -66,6 +83,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 120,
|
||||
@@ -87,7 +105,19 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openProcessSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openProcessModal(true, { processOperationId: v.processOperationId });
|
||||
}
|
||||
|
||||
function onProcessSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
processOperationId: payload.processOperationId || '',
|
||||
processOperationName: payload.processOperationName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -20,7 +20,14 @@ export const columns: BasicColumn[] = [
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '设备编号', field: 'equipmentCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '设备名称', field: 'equipmentName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'processOperationId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属工序',
|
||||
field: 'processOperationName',
|
||||
component: 'Input',
|
||||
slot: 'processOperationPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '设备状态',
|
||||
field: 'equipmentStatus',
|
||||
@@ -35,6 +42,38 @@ export const searchFormSchema: FormSchema[] = [
|
||||
componentProps: { dictCode: 'yn' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'manufacturerId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备厂家',
|
||||
field: 'manufacturerName',
|
||||
component: 'Input',
|
||||
slot: 'manufacturerPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备类别',
|
||||
field: 'equipmentCategoryName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentCategoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentTypeId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备类型',
|
||||
field: 'equipmentTypeName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentTypePicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'factoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属工厂',
|
||||
field: 'factoryName',
|
||||
component: 'Input',
|
||||
slot: 'factoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
|
||||
@@ -1,189 +1,331 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_ledger:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equip_inspect_record:add'"
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
preIcon="ant-design:audit-outlined"
|
||||
@click="handleBatchCreateRecord('inspect')"
|
||||
>
|
||||
点检
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equip_inspect_record:add'"
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
preIcon="ant-design:tool-outlined"
|
||||
@click="handleBatchCreateRecord('maintain')"
|
||||
>
|
||||
保养
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equipment_ledger:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_equipment_ledger:importExcel'"
|
||||
preIcon="ant-design:import-outlined"
|
||||
@click="onImportXls"
|
||||
>
|
||||
导入
|
||||
</j-upload-button>
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
<Icon icon="ant-design:delete-outlined" />
|
||||
删除
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<a-button v-auth="'mes:mes_xsl_equipment_ledger:deleteBatch'">
|
||||
批量操作
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<TableAction
|
||||
:actions="[
|
||||
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_xsl_equipment_ledger:edit' },
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipmentLedgerModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslEquipmentLedger" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslEquipmentLedgerModal from './components/MesXslEquipmentLedgerModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentLedger.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentLedger.api';
|
||||
import { batchCreateFromEquipment } from '../mesXslEquipInspectRecord/MesXslEquipInspectRecord.api';
|
||||
|
||||
const { createMessage, createConfirm } = useMessage();
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '设备台账',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '设备台账',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload, getSelectRows }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
}
|
||||
|
||||
function handleEdit(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: true });
|
||||
}
|
||||
|
||||
function handleDetail(record: Recordable) {
|
||||
openModal(true, { record, isUpdate: true, showFooter: false });
|
||||
}
|
||||
|
||||
function handleDelete(record: Recordable) {
|
||||
deleteOne({ id: record.id }, handleSuccess);
|
||||
}
|
||||
|
||||
function batchHandleDelete() {
|
||||
batchDelete({ ids: selectedRowKeys.value.join(',') }, handleSuccess);
|
||||
}
|
||||
|
||||
function handleSuccess() {
|
||||
reload();
|
||||
selectedRowKeys.value = [];
|
||||
}
|
||||
|
||||
function handleBatchCreateRecord(recordType: 'inspect' | 'maintain') {
|
||||
const rows = (getSelectRows?.() || []) as Recordable[];
|
||||
if (!rows.length) {
|
||||
createMessage.warning('请先勾选设备');
|
||||
return;
|
||||
}
|
||||
const ids = rows.map((r) => r.id).filter(Boolean);
|
||||
const typeLabel = recordType === 'inspect' ? '点检' : '保养';
|
||||
createConfirm({
|
||||
iconType: 'info',
|
||||
title: `生成${typeLabel}记录`,
|
||||
content: `确定为选中的 ${ids.length} 台设备各生成一条${typeLabel}记录?`,
|
||||
okText: '确定',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
try {
|
||||
const res = await batchCreateFromEquipment({ equipmentLedgerIds: ids, recordType });
|
||||
const data = (res as any)?.result ?? res;
|
||||
const failList: string[] = data?.failMessages || [];
|
||||
const successCount = data?.successCount ?? 0;
|
||||
if (successCount > 0 && !failList.length) {
|
||||
createMessage.success(`成功生成 ${successCount} 条${typeLabel}记录`);
|
||||
handleSuccess();
|
||||
} else if (successCount > 0 && failList.length) {
|
||||
createMessage.warning(`成功生成 ${successCount} 条;未生成:${failList.join(';')}`);
|
||||
handleSuccess();
|
||||
} else if (failList.length) {
|
||||
createMessage.warning(failList.join(';'));
|
||||
} else {
|
||||
createMessage.warning((res as any)?.message || `未生成任何${typeLabel}记录`);
|
||||
}
|
||||
} catch (e: any) {
|
||||
const errMsg =
|
||||
e?.response?.data?.message || e?.message || `生成${typeLabel}记录失败`;
|
||||
createMessage.warning(errMsg);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function getDropDownAction(record: Recordable) {
|
||||
return [
|
||||
{ label: '详情', onClick: handleDetail.bind(null, record) },
|
||||
{
|
||||
label: '删除',
|
||||
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
|
||||
auth: 'mes:mes_xsl_equipment_ledger:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
||||
<div>
|
||||
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
|
||||
<template #form-processOperationPicker="{ model, field }">
|
||||
|
||||
<MesSearchPickerInput
|
||||
|
||||
:model="model"
|
||||
|
||||
:field="field"
|
||||
|
||||
placeholder="请选择工序"
|
||||
|
||||
:show-clear="!!model.processOperationId"
|
||||
|
||||
@open="openProcessSelect"
|
||||
|
||||
@clear="clearModelFields(model, ['processOperationId', 'processOperationName'])"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
<template #form-manufacturerPicker="{ model, field }">
|
||||
|
||||
<MesSearchPickerInput
|
||||
|
||||
:model="model"
|
||||
|
||||
:field="field"
|
||||
|
||||
placeholder="请选择设备厂家"
|
||||
|
||||
:show-clear="!!model.manufacturerId"
|
||||
|
||||
@open="openManufacturerSelect('manufacturer')"
|
||||
|
||||
@clear="clearModelFields(model, ['manufacturerId', 'manufacturerName'])"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
<template #form-equipmentCategoryPicker="{ model, field }">
|
||||
|
||||
<MesSearchPickerInput
|
||||
|
||||
:model="model"
|
||||
|
||||
:field="field"
|
||||
|
||||
placeholder="请选择设备类别"
|
||||
|
||||
:show-clear="!!model.equipmentCategoryId"
|
||||
|
||||
@open="openCategorySelect"
|
||||
|
||||
@clear="clearModelFields(model, ['equipmentCategoryId', 'equipmentCategoryName'])"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
<template #form-equipmentTypePicker="{ model, field }">
|
||||
|
||||
<MesSearchPickerInput
|
||||
|
||||
:model="model"
|
||||
|
||||
:field="field"
|
||||
|
||||
placeholder="请选择设备类型"
|
||||
|
||||
:show-clear="!!model.equipmentTypeId"
|
||||
|
||||
@open="openTypeSelect"
|
||||
|
||||
@clear="clearModelFields(model, ['equipmentTypeId', 'equipmentTypeName'])"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
<template #form-factoryPicker="{ model, field }">
|
||||
|
||||
<MesSearchPickerInput
|
||||
|
||||
:model="model"
|
||||
|
||||
:field="field"
|
||||
|
||||
placeholder="请选择所属工厂"
|
||||
|
||||
:show-clear="!!model.factoryId"
|
||||
|
||||
@open="openManufacturerSelect('factory')"
|
||||
|
||||
@clear="clearModelFields(model, ['factoryId', 'factoryName'])"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
<template #tableTitle>
|
||||
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_ledger:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
|
||||
新增
|
||||
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_equip_inspect_record:add'"
|
||||
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
|
||||
preIcon="ant-design:audit-outlined"
|
||||
|
||||
@click="handleBatchCreateRecord('inspect')"
|
||||
|
||||
>
|
||||
|
||||
点检
|
||||
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_equip_inspect_record:add'"
|
||||
|
||||
:disabled="selectedRowKeys.length === 0"
|
||||
|
||||
preIcon="ant-design:tool-outlined"
|
||||
|
||||
@click="handleBatchCreateRecord('maintain')"
|
||||
|
||||
>
|
||||
|
||||
保养
|
||||
|
||||
</a-button>
|
||||
|
||||
<a-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_equipment_ledger:exportXls'"
|
||||
|
||||
preIcon="ant-design:export-outlined"
|
||||
|
||||
@click="onExportXls"
|
||||
|
||||
>
|
||||
|
||||
导出
|
||||
|
||||
</a-button>
|
||||
|
||||
<j-upload-button
|
||||
|
||||
type="primary"
|
||||
|
||||
v-auth="'mes:mes_xsl_equipment_ledger:importExcel'"
|
||||
|
||||
preIcon="ant-design:import-outlined"
|
||||
|
||||
@click="onImportXls"
|
||||
|
||||
>
|
||||
|
||||
导入
|
||||
|
||||
</j-upload-button>
|
||||
|
||||
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||
|
||||
<template #overlay>
|
||||
|
||||
<a-menu>
|
||||
|
||||
<a-menu-item key="1" @click="batchHandleDelete">
|
||||
|
||||
<Icon icon="ant-design:delete-outlined" />
|
||||
|
||||
删除
|
||||
|
||||
</a-menu-item>
|
||||
|
||||
</a-menu>
|
||||
|
||||
</template>
|
||||
|
||||
<a-button v-auth="'mes:mes_xsl_equipment_ledger:deleteBatch'">
|
||||
|
||||
批量操作
|
||||
|
||||
<Icon icon="mdi:chevron-down" />
|
||||
|
||||
</a-button>
|
||||
|
||||
</a-dropdown>
|
||||
|
||||
</template>
|
||||
|
||||
<template #action="{ record }">
|
||||
|
||||
<TableAction
|
||||
|
||||
:actions="[
|
||||
|
||||
{ label: '编辑', onClick: handleEdit.bind(null, record), auth: 'mes:mes_xsl_equipment_ledger:edit' },
|
||||
|
||||
]"
|
||||
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
|
||||
/>
|
||||
|
||||
</template>
|
||||
|
||||
</BasicTable>
|
||||
|
||||
<MesXslEquipmentLedgerModal @register="registerModal" @success="handleSuccess" />
|
||||
|
||||
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSearchSelect" />
|
||||
|
||||
<MesXslManufacturerSelectModal
|
||||
|
||||
@register="registerManufacturerModal"
|
||||
|
||||
:modal-title="manufacturerModalTitle"
|
||||
|
||||
@select="onManufacturerSearchSelect"
|
||||
|
||||
/>
|
||||
|
||||
<MesXslEquipmentCategorySelectModal @register="registerCategoryModal" @select="onCategorySearchSelect" />
|
||||
|
||||
<MesXslEquipmentTypeSelectModal @register="registerTypeModal" @select="onTypeSearchSelect" />
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslEquipmentLedger" setup>
|
||||
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
|
||||
import { useModal } from '/@/components/Modal';
|
||||
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
import Icon from '/@/components/Icon';
|
||||
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
|
||||
import MesXslEquipmentLedgerModal from './components/MesXslEquipmentLedgerModal.vue';
|
||||
|
||||
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
|
||||
|
||||
import MesXslManufacturerSelectModal from './components/MesXslManufacturerSelectModal.vue';
|
||||
|
||||
import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue';
|
||||
|
||||
import MesXslEquipmentTypeSelectModal from './components/MesXslEquipmentTypeSelectModal.vue';
|
||||
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentLedger.data';
|
||||
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentLedger.api';
|
||||
|
||||
import { batchCreateFromEquipment } from '../mesXslEquipInspectRecord/MesXslEquipInspectRecord.api';
|
||||
|
||||
|
||||
|
||||
const { createMessage, createConfirm } = useMessage();
|
||||
|
||||
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
|
||||
{ idField: 'processOperationId', nameField: 'processOperationName' },
|
||||
|
||||
{ idField: 'manufacturerId', nameField: 'manufacturerName' },
|
||||
|
||||
{ idField: 'equipmentCategoryId', nameField: 'equipmentCategoryName' },
|
||||
|
||||
{ idField: 'equipmentTypeId', nameField: 'equipmentTypeName' },
|
||||
|
||||
{ idField: 'factoryId', nameField: 'factoryName' },
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
const manufacturerPickTarget = ref<'manufacturer' | 'factory'>('manufacturer');
|
||||
|
||||
|
||||
|
||||
const manufacturerModalTitle = computed(() =>
|
||||
|
||||
manufacturerPickTarget.value === 'factory' ? '选择所属工厂' : '选择设备厂家',
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
|
||||
|
||||
const [registerManufacturerModal, { openModal: openManufacturerModal }] = useModal();
|
||||
|
||||
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
|
||||
|
||||
const [registerTypeModal, { openModal: openTypeModal }] = useModal();
|
||||
|
||||
@@ -20,7 +20,14 @@ export const columns: BasicColumn[] = [
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '部位代码', field: 'partCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '类别名称', field: 'equipmentCategoryName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属类别',
|
||||
field: 'equipmentCategoryName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentCategoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '部位名称', field: 'partName', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '是否启用',
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-equipmentCategoryPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择设备类别"
|
||||
:show-clear="!!model.equipmentCategoryId"
|
||||
@open="openCategorySelect"
|
||||
@clear="clearModelFields(model, ['equipmentCategoryId', 'equipmentCategoryName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_part:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +56,7 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipmentPartModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslEquipmentCategorySelectModal @register="registerCategoryModal" @select="onCategorySelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -54,11 +65,17 @@
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslEquipmentPartModal from './components/MesXslEquipmentPartModal.vue';
|
||||
import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentPart.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentPart.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [{ idField: 'equipmentCategoryId', nameField: 'equipmentCategoryName' }];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -66,6 +83,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 120,
|
||||
@@ -87,7 +105,19 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openCategorySelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openCategoryModal(true, { equipmentCategoryId: v.equipmentCategoryId });
|
||||
}
|
||||
|
||||
function onCategorySelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentCategoryId: payload.equipmentCategoryId || '',
|
||||
equipmentCategoryName: payload.equipmentCategoryName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -21,8 +21,22 @@ export const columns: BasicColumn[] = [
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '小部位代码', field: 'subPartCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '类别名称', field: 'equipmentCategoryName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '大部位名称', field: 'equipmentPartName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属类别',
|
||||
field: 'equipmentCategoryName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentCategoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentPartId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属大部位',
|
||||
field: 'equipmentPartName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentPartPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '小部位名称', field: 'subPartName', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '是否启用',
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-equipmentCategoryPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择设备类别"
|
||||
:show-clear="!!model.equipmentCategoryId"
|
||||
@open="openCategorySelect"
|
||||
@clear="clearCategory(model)"
|
||||
/>
|
||||
</template>
|
||||
<template #form-equipmentPartPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择设备大部位"
|
||||
:show-clear="!!model.equipmentPartId"
|
||||
@open="openPartSelect"
|
||||
@clear="clearModelFields(model, ['equipmentPartId', 'equipmentPartName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_sub_part:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +66,8 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipmentSubPartModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslEquipmentCategorySelectModal @register="registerCategoryModal" @select="onCategorySelect" />
|
||||
<MesXslEquipmentPartSelectModal @register="registerPartModal" @select="onPartSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -53,12 +75,26 @@
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslEquipmentSubPartModal from './components/MesXslEquipmentSubPartModal.vue';
|
||||
import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue';
|
||||
import MesXslEquipmentPartSelectModal from './components/MesXslEquipmentPartSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentSubPart.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentSubPart.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
{ idField: 'equipmentCategoryId', nameField: 'equipmentCategoryName' },
|
||||
{ idField: 'equipmentPartId', nameField: 'equipmentPartName' },
|
||||
];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
|
||||
const [registerPartModal, { openModal: openPartModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -66,6 +102,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 120,
|
||||
@@ -87,7 +124,44 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openCategorySelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openCategoryModal(true, { equipmentCategoryId: v.equipmentCategoryId });
|
||||
}
|
||||
|
||||
function clearCategory(model: Recordable) {
|
||||
clearModelFields(model, ['equipmentCategoryId', 'equipmentCategoryName', 'equipmentPartId', 'equipmentPartName']);
|
||||
}
|
||||
|
||||
function onCategorySelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentCategoryId: payload.equipmentCategoryId || '',
|
||||
equipmentCategoryName: payload.equipmentCategoryName || '',
|
||||
equipmentPartId: '',
|
||||
equipmentPartName: '',
|
||||
});
|
||||
}
|
||||
|
||||
function openPartSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
if (!v.equipmentCategoryId) {
|
||||
createMessage.warning('请先选择所属设备类别');
|
||||
return;
|
||||
}
|
||||
openPartModal(true, {
|
||||
equipmentCategoryId: v.equipmentCategoryId,
|
||||
equipmentPartId: v.equipmentPartId,
|
||||
});
|
||||
}
|
||||
|
||||
function onPartSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentPartId: payload.equipmentPartId || '',
|
||||
equipmentPartName: payload.equipmentPartName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -18,8 +18,22 @@ export const columns: BasicColumn[] = [
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '类型名称', field: 'typeName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '工序名称', field: 'processOperationName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '类别名称', field: 'equipmentCategoryName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'processOperationId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属工序',
|
||||
field: 'processOperationName',
|
||||
component: 'Input',
|
||||
slot: 'processOperationPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属类别',
|
||||
field: 'equipmentCategoryName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentCategoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-processOperationPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择工序"
|
||||
:show-clear="!!model.processOperationId"
|
||||
@open="openProcessSelect"
|
||||
@clear="clearModelFields(model, ['processOperationId', 'processOperationName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #form-equipmentCategoryPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择设备类别"
|
||||
:show-clear="!!model.equipmentCategoryId"
|
||||
@open="openCategorySelect"
|
||||
@clear="clearModelFields(model, ['equipmentCategoryId', 'equipmentCategoryName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_equipment_type:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +66,8 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslEquipmentTypeModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslProcessOperationSelectModal @register="registerProcessModal" @select="onProcessSelect" />
|
||||
<MesXslEquipmentCategorySelectModal @register="registerCategoryModal" @select="onCategorySelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -54,11 +76,22 @@
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslEquipmentTypeModal from './components/MesXslEquipmentTypeModal.vue';
|
||||
import MesXslProcessOperationSelectModal from '/@/views/xslmes/mesXslEquipmentCategory/components/MesXslProcessOperationSelectModal.vue';
|
||||
import MesXslEquipmentCategorySelectModal from './components/MesXslEquipmentCategorySelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslEquipmentType.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslEquipmentType.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
{ idField: 'processOperationId', nameField: 'processOperationName' },
|
||||
{ idField: 'equipmentCategoryId', nameField: 'equipmentCategoryName' },
|
||||
];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerProcessModal, { openModal: openProcessModal }] = useModal();
|
||||
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -66,6 +99,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 120,
|
||||
@@ -87,7 +121,31 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openProcessSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openProcessModal(true, { processOperationId: v.processOperationId });
|
||||
}
|
||||
|
||||
function onProcessSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
processOperationId: payload.processOperationId || '',
|
||||
processOperationName: payload.processOperationName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function openCategorySelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openCategoryModal(true, { equipmentCategoryId: v.equipmentCategoryId });
|
||||
}
|
||||
|
||||
function onCategorySelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentCategoryId: payload.equipmentCategoryId || '',
|
||||
equipmentCategoryName: payload.equipmentCategoryName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -26,7 +26,38 @@ export const columns: BasicColumn[] = [
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '项目名称', field: 'itemName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '项目编号', field: 'itemCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '设备类别', field: 'equipmentCategoryName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'equipmentCategoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备类别',
|
||||
field: 'equipmentCategoryName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentCategoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentTypeId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备类型',
|
||||
field: 'equipmentTypeName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentTypePicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentPartId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备部位',
|
||||
field: 'equipmentPartName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentPartPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'equipmentSubPartId', component: 'Input', show: false },
|
||||
{
|
||||
label: '设备小部位',
|
||||
field: 'equipmentSubPartName',
|
||||
component: 'Input',
|
||||
slot: 'equipmentSubPartPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '项目类别',
|
||||
field: 'itemCategory',
|
||||
|
||||
@@ -1,6 +1,46 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-equipmentCategoryPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择设备类别"
|
||||
:show-clear="!!model.equipmentCategoryId"
|
||||
@open="openCategorySelect"
|
||||
@clear="clearCategory(model)"
|
||||
/>
|
||||
</template>
|
||||
<template #form-equipmentTypePicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请先选类别,再选类型"
|
||||
:show-clear="!!model.equipmentTypeId"
|
||||
@open="openTypeSelect"
|
||||
@clear="clearModelFields(model, ['equipmentTypeId', 'equipmentTypeName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #form-equipmentPartPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请先选类别,再选部位"
|
||||
:show-clear="!!model.equipmentPartId"
|
||||
@open="openPartSelect"
|
||||
@clear="clearPart(model)"
|
||||
/>
|
||||
</template>
|
||||
<template #form-equipmentSubPartPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请先选类别与部位,再选小部位"
|
||||
:show-clear="!!model.equipmentSubPartId"
|
||||
@open="openSubPartSelect"
|
||||
@clear="clearModelFields(model, ['equipmentSubPartId', 'equipmentSubPartName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
@@ -51,6 +91,10 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslInspectMaintainItemModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslEquipmentCategorySelectModal @register="registerCategoryModal" @select="onCategorySelect" />
|
||||
<MesXslEquipmentTypeFilterSelectModal @register="registerTypeModal" @select="onTypeSelect" />
|
||||
<MesXslEquipmentPartSelectModal @register="registerPartModal" @select="onPartSelect" />
|
||||
<MesXslEquipmentSubPartFilterSelectModal @register="registerSubPartModal" @select="onSubPartSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -58,12 +102,32 @@
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslInspectMaintainItemModal from './components/MesXslInspectMaintainItemModal.vue';
|
||||
import MesXslEquipmentCategorySelectModal from '/@/views/xslmes/mesXslEquipmentType/components/MesXslEquipmentCategorySelectModal.vue';
|
||||
import MesXslEquipmentPartSelectModal from '/@/views/xslmes/mesXslEquipmentSubPart/components/MesXslEquipmentPartSelectModal.vue';
|
||||
import MesXslEquipmentTypeFilterSelectModal from './components/MesXslEquipmentTypeFilterSelectModal.vue';
|
||||
import MesXslEquipmentSubPartFilterSelectModal from './components/MesXslEquipmentSubPartFilterSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslInspectMaintainItem.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslInspectMaintainItem.api';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
{ idField: 'equipmentCategoryId', nameField: 'equipmentCategoryName' },
|
||||
{ idField: 'equipmentTypeId', nameField: 'equipmentTypeName' },
|
||||
{ idField: 'equipmentPartId', nameField: 'equipmentPartName' },
|
||||
{ idField: 'equipmentSubPartId', nameField: 'equipmentSubPartName' },
|
||||
];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
|
||||
const [registerTypeModal, { openModal: openTypeModal }] = useModal();
|
||||
const [registerPartModal, { openModal: openPartModal }] = useModal();
|
||||
const [registerSubPartModal, { openModal: openSubPartModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -71,6 +135,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 100,
|
||||
@@ -92,7 +157,106 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function clearCategory(model: Recordable) {
|
||||
clearModelFields(model, [
|
||||
'equipmentCategoryId',
|
||||
'equipmentCategoryName',
|
||||
'equipmentTypeId',
|
||||
'equipmentTypeName',
|
||||
'equipmentPartId',
|
||||
'equipmentPartName',
|
||||
'equipmentSubPartId',
|
||||
'equipmentSubPartName',
|
||||
]);
|
||||
}
|
||||
|
||||
function clearPart(model: Recordable) {
|
||||
clearModelFields(model, ['equipmentPartId', 'equipmentPartName', 'equipmentSubPartId', 'equipmentSubPartName']);
|
||||
}
|
||||
|
||||
function openCategorySelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openCategoryModal(true, { equipmentCategoryId: v.equipmentCategoryId });
|
||||
}
|
||||
|
||||
function onCategorySelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentCategoryId: payload.equipmentCategoryId || '',
|
||||
equipmentCategoryName: payload.equipmentCategoryName || '',
|
||||
equipmentTypeId: '',
|
||||
equipmentTypeName: '',
|
||||
equipmentPartId: '',
|
||||
equipmentPartName: '',
|
||||
equipmentSubPartId: '',
|
||||
equipmentSubPartName: '',
|
||||
});
|
||||
}
|
||||
|
||||
function openTypeSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
if (!v.equipmentCategoryId) {
|
||||
createMessage.warning('请先选择设备类别');
|
||||
return;
|
||||
}
|
||||
openTypeModal(true, {
|
||||
equipmentCategoryId: v.equipmentCategoryId,
|
||||
equipmentTypeId: v.equipmentTypeId,
|
||||
});
|
||||
}
|
||||
|
||||
function onTypeSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentTypeId: payload.equipmentTypeId || '',
|
||||
equipmentTypeName: payload.equipmentTypeName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function openPartSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
if (!v.equipmentCategoryId) {
|
||||
createMessage.warning('请先选择设备类别');
|
||||
return;
|
||||
}
|
||||
openPartModal(true, {
|
||||
equipmentCategoryId: v.equipmentCategoryId,
|
||||
equipmentPartId: v.equipmentPartId,
|
||||
});
|
||||
}
|
||||
|
||||
function onPartSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentPartId: payload.equipmentPartId || '',
|
||||
equipmentPartName: payload.equipmentPartName || '',
|
||||
equipmentSubPartId: '',
|
||||
equipmentSubPartName: '',
|
||||
});
|
||||
}
|
||||
|
||||
function openSubPartSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
if (!v.equipmentCategoryId) {
|
||||
createMessage.warning('请先选择设备类别');
|
||||
return;
|
||||
}
|
||||
if (!v.equipmentPartId) {
|
||||
createMessage.warning('请先选择设备部位');
|
||||
return;
|
||||
}
|
||||
openSubPartModal(true, {
|
||||
equipmentCategoryId: v.equipmentCategoryId,
|
||||
equipmentPartId: v.equipmentPartId,
|
||||
equipmentSubPartId: v.equipmentSubPartId,
|
||||
});
|
||||
}
|
||||
|
||||
function onSubPartSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
equipmentSubPartId: payload.equipmentSubPartId || '',
|
||||
equipmentSubPartName: payload.equipmentSubPartName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
@@ -21,7 +21,22 @@ export const columns: BasicColumn[] = [
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '备品件名称', field: 'sparePartName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '类别名称', field: 'sparePartsCategoryName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '', field: 'sparePartsCategoryId', component: 'Input', show: false },
|
||||
{
|
||||
label: '所属类别',
|
||||
field: 'sparePartsCategoryName',
|
||||
component: 'Input',
|
||||
slot: 'sparePartsCategoryPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '', field: 'unitId', component: 'Input', show: false },
|
||||
{
|
||||
label: '单位',
|
||||
field: 'unitName',
|
||||
component: 'Input',
|
||||
slot: 'unitPicker',
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '规格型号', field: 'specModel', component: 'Input', colProps: { span: 6 } },
|
||||
];
|
||||
|
||||
|
||||
@@ -1,6 +1,26 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #form-sparePartsCategoryPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择备品件类别"
|
||||
:show-clear="!!model.sparePartsCategoryId"
|
||||
@open="openCategorySelect"
|
||||
@clear="clearModelFields(model, ['sparePartsCategoryId', 'sparePartsCategoryName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #form-unitPicker="{ model, field }">
|
||||
<MesSearchPickerInput
|
||||
:model="model"
|
||||
:field="field"
|
||||
placeholder="请选择单位"
|
||||
:show-clear="!!model.unitId"
|
||||
@open="openUnitSelect"
|
||||
@clear="clearModelFields(model, ['unitId', 'unitName'])"
|
||||
/>
|
||||
</template>
|
||||
<template #tableTitle>
|
||||
<a-button type="primary" v-auth="'mes:mes_xsl_spare_part:add'" @click="handleAdd" preIcon="ant-design:plus-outlined">
|
||||
新增
|
||||
@@ -46,6 +66,8 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslSparePartModal @register="registerModal" @success="handleSuccess" />
|
||||
<MesXslSparePartsCategorySelectModal @register="registerCategoryModal" @select="onCategorySelect" />
|
||||
<MesXslUnitSelectModal @register="registerUnitModal" @select="onUnitSelect" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -54,11 +76,22 @@
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesSearchPickerInput from '../components/MesSearchPickerInput.vue';
|
||||
import MesXslSparePartModal from './components/MesXslSparePartModal.vue';
|
||||
import MesXslSparePartsCategorySelectModal from '/@/views/xslmes/mesXslSparePartsCategory/components/MesXslSparePartsCategorySelectModal.vue';
|
||||
import MesXslUnitSelectModal from '/@/views/xslmes/mesXslVehicle/components/MesXslUnitSelectModal.vue';
|
||||
import { clearModelFields, createStripIdNameBeforeFetch } from '../utils/mesSearchPickerUtil';
|
||||
import { columns, searchFormSchema } from './MesXslSparePart.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslSparePart.api';
|
||||
|
||||
const SEARCH_ID_NAME_PAIRS = [
|
||||
{ idField: 'sparePartsCategoryId', nameField: 'sparePartsCategoryName' },
|
||||
{ idField: 'unitId', nameField: 'unitName' },
|
||||
];
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
const [registerCategoryModal, { openModal: openCategoryModal }] = useModal();
|
||||
const [registerUnitModal, { openModal: openUnitModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
@@ -66,6 +99,7 @@
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
beforeFetch: createStripIdNameBeforeFetch(SEARCH_ID_NAME_PAIRS),
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 110,
|
||||
@@ -87,7 +121,31 @@
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const [registerTable, { reload, getForm }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
function openCategorySelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openCategoryModal(true, { sparePartsCategoryId: v.sparePartsCategoryId });
|
||||
}
|
||||
|
||||
function onCategorySelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
sparePartsCategoryId: payload.sparePartsCategoryId || '',
|
||||
sparePartsCategoryName: payload.sparePartsCategoryName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function openUnitSelect() {
|
||||
const v = getForm()?.getFieldsValue?.() || {};
|
||||
openUnitModal(true, { unitId: v.unitId });
|
||||
}
|
||||
|
||||
function onUnitSelect(payload: Recordable) {
|
||||
getForm()?.setFieldsValue?.({
|
||||
unitId: payload.unitId || '',
|
||||
unitName: payload.unitName || '',
|
||||
});
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
openModal(true, { isUpdate: false, showFooter: true });
|
||||
|
||||
21
jeecgboot-vue3/src/views/xslmes/utils/mesSearchPickerUtil.ts
Normal file
21
jeecgboot-vue3/src/views/xslmes/utils/mesSearchPickerUtil.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/** 列表查询:有 id 时去掉冗余 name 字段,避免模糊查询 */
|
||||
export type MesIdNamePair = { idField: string; nameField: string };
|
||||
|
||||
export function stripIdNameQueryParams(params: Recordable, pairs: MesIdNamePair[]) {
|
||||
for (const { idField, nameField } of pairs) {
|
||||
if (params[idField]) {
|
||||
delete params[nameField];
|
||||
}
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
export function createStripIdNameBeforeFetch(pairs: MesIdNamePair[]) {
|
||||
return (params: Recordable) => stripIdNameQueryParams(params, pairs);
|
||||
}
|
||||
|
||||
export function clearModelFields(model: Recordable, fields: string[]) {
|
||||
for (const field of fields) {
|
||||
model[field] = '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user