Compare commits
5 Commits
fef7d25e3c
...
38f22ef8bd
| Author | SHA1 | Date | |
|---|---|---|---|
| 38f22ef8bd | |||
| a08ca8985a | |||
|
|
e92cab555f | ||
| b8b06a881a | |||
| 3f2c486f04 |
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`
|
||||
);
|
||||
@@ -0,0 +1,85 @@
|
||||
-- MES 胶料小料锁定日志 + 锁定原因字段 reason_desc:可整文件一次执行
|
||||
-- 若已执行 V3.9.2_119 Flyway 可只跑本脚本补菜单/字段(幂等)
|
||||
-- 权限前缀:mes:mes_xsl_rubber_small_lock_log:*
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @reason_desc_exists := (
|
||||
SELECT COUNT(1)
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'mes_xsl_rubber_small_lock_reason'
|
||||
AND COLUMN_NAME = 'reason_desc'
|
||||
);
|
||||
SET @ddl_reason_desc := IF(
|
||||
@reason_desc_exists = 0,
|
||||
'ALTER TABLE `mes_xsl_rubber_small_lock_reason` ADD COLUMN `reason_desc` varchar(500) NOT NULL DEFAULT '''' COMMENT ''原因(手动输入,必填)'' AFTER `barcode_type`',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE stmt_reason_desc FROM @ddl_reason_desc;
|
||||
EXECUTE stmt_reason_desc;
|
||||
DEALLOCATE PREPARE stmt_reason_desc;
|
||||
|
||||
UPDATE `mes_xsl_rubber_small_lock_reason` SET `reason_desc` = CONCAT('原因', `reason_code`) WHERE `reason_desc` = '' OR `reason_desc` IS NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_small_lock_log` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`lock_reason_id` varchar(32) NOT NULL COMMENT '锁定原因ID',
|
||||
`barcode_type` varchar(16) NOT NULL COMMENT '条码类型',
|
||||
`barcode` varchar(128) NOT NULL COMMENT '条码',
|
||||
`lock_type` varchar(16) NOT NULL COMMENT '状态',
|
||||
`reason_desc` varchar(500) NOT NULL COMMENT '原因',
|
||||
`log_date` date NOT NULL COMMENT '日期',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mrsl_log_tenant_date` (`tenant_id`, `log_date`),
|
||||
KEY `idx_mrsl_log_barcode` (`tenant_id`, `barcode_type`, `barcode`),
|
||||
KEY `idx_mrsl_log_reason` (`lock_reason_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料小料锁定日志';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_quality_pid = IFNULL(
|
||||
(SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1),
|
||||
'1860000000000000162'
|
||||
);
|
||||
|
||||
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 ('1860000000000000215', @mes_quality_pid, '胶料小料锁定日志', '/xslmes/mesXslRubberSmallLockLog', 'xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLogList', 'MesXslRubberSmallLockLogList', 1, NULL, '1', 7, 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`),
|
||||
`sort_no` = VALUES(`sort_no`), `is_leaf` = 0, `status` = '1', `del_flag` = 0, `keep_alive` = VALUES(`keep_alive`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:file-text-outlined' WHERE `id` = '1860000000000000215' AND `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000216', '1860000000000000215', '新增', 2, 'mes:mes_xsl_rubber_small_lock_log:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000217', '1860000000000000215', '编辑', 2, 'mes:mes_xsl_rubber_small_lock_log:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000218', '1860000000000000215', '删除', 2, 'mes:mes_xsl_rubber_small_lock_log:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000219', '1860000000000000215', '批量删除', 2, 'mes:mes_xsl_rubber_small_lock_log:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000220', '1860000000000000215', '导出', 2, 'mes:mes_xsl_rubber_small_lock_log:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000221', '1860000000000000215', '导入', 2, 'mes:mes_xsl_rubber_small_lock_log:importExcel', '1', 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`),
|
||||
`is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
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 (
|
||||
'1860000000000000215',
|
||||
'1860000000000000216', '1860000000000000217', '1860000000000000218', '1860000000000000219',
|
||||
'1860000000000000220', '1860000000000000221'
|
||||
)
|
||||
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,87 @@
|
||||
-- MES 胶料小料锁定原因:字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权(可整文件一次执行)
|
||||
-- 权限前缀:mes:mes_xsl_rubber_small_lock_reason:*
|
||||
-- 菜单 ID 段:1860000000000000208(按钮 209-214)
|
||||
-- 修改租户:改 SET @mes_tenant_id
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES胶料小料锁定类型', 'xslmes_rubber_small_lock_type', '锁定/解锁', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_small_lock_type' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '锁定', 'lock', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_small_lock_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'lock');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '解锁', 'unlock', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_small_lock_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'unlock');
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES胶料小料锁定条码类型', 'xslmes_rubber_small_lock_barcode_type', '小料/胶料', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '小料', 'small', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'small');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '胶料', 'rubber', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'rubber');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_small_lock_reason` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`reason_code` varchar(16) NOT NULL COMMENT '编号(租户内从001递增自动生成,只读)',
|
||||
`lock_type` varchar(16) NOT NULL COMMENT '类型(字典xslmes_rubber_small_lock_type:lock锁定unlock解锁)',
|
||||
`barcode_type` varchar(16) NOT NULL COMMENT '条码类型(字典xslmes_rubber_small_lock_barcode_type:small小料rubber胶料)',
|
||||
`reason_desc` varchar(500) NOT NULL COMMENT '原因(手动输入,必填)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mrslr_tenant_code` (`tenant_id`, `reason_code`),
|
||||
KEY `idx_mrslr_tenant_lock` (`tenant_id`, `lock_type`, `barcode_type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料小料锁定原因';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_quality_pid = IFNULL(
|
||||
(SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1),
|
||||
'1860000000000000162'
|
||||
);
|
||||
|
||||
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 ('1860000000000000208', @mes_quality_pid, '胶料小料锁定原因', '/xslmes/mesXslRubberSmallLockReason', 'xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReasonList', 'MesXslRubberSmallLockReasonList', 1, NULL, '1', 6, 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`), `sort_no` = VALUES(`sort_no`), `is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0, `keep_alive` = VALUES(`keep_alive`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:lock-outlined' WHERE `id` = '1860000000000000208' AND `del_flag` = 0;
|
||||
|
||||
INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
|
||||
('1860000000000000209', '1860000000000000208', '新增', 2, 'mes:mes_xsl_rubber_small_lock_reason:add', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000210', '1860000000000000208', '编辑', 2, 'mes:mes_xsl_rubber_small_lock_reason:edit', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000211', '1860000000000000208', '删除', 2, 'mes:mes_xsl_rubber_small_lock_reason:delete', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000212', '1860000000000000208', '批量删除', 2, 'mes:mes_xsl_rubber_small_lock_reason:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000213', '1860000000000000208', '导出', 2, 'mes:mes_xsl_rubber_small_lock_reason:exportXls', '1', 1, '1', 0, 'admin', NOW()),
|
||||
('1860000000000000214', '1860000000000000208', '导入', 2, 'mes:mes_xsl_rubber_small_lock_reason:importExcel', '1', 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`),
|
||||
`is_leaf` = 1, `status` = '1', `del_flag` = 0;
|
||||
|
||||
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 (
|
||||
'1860000000000000208',
|
||||
'1860000000000000209', '1860000000000000210', '1860000000000000211', '1860000000000000212',
|
||||
'1860000000000000213', '1860000000000000214'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM `sys_role_permission` rp
|
||||
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
|
||||
);
|
||||
@@ -586,3 +586,95 @@ jeecgboot-vue3/src/views/xslmes/mesXslWeightRecord/MesXslWeightRecord.data.ts
|
||||
yy-admin-master/YY.Admin.Core/Entity/MesXslWeightRecord.cs
|
||||
yy-admin-master/YY.Admin.Services/Service/WeightRecord/WeightRecordService.cs
|
||||
yy-admin-master/YY.Admin/Views/WeightRecord/WeightRecordListView.xaml
|
||||
|
||||
-- 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
|
||||
|
||||
-- author:jiangxh---date:20250602--for: 【MES】胶料小料锁定原因(质量管理菜单、编号001自增、类型与条码类型字典) ---
|
||||
jeecg-boot/db/mes-xsl-rubber-small-lock-reason-menu-permission.sql
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_118__mes_xsl_rubber_small_lock_reason.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberSmallLockReason.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberSmallLockReasonMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberSmallLockReasonService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberSmallLockReasonServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberSmallLockReasonController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReason.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReason.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReasonList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/components/MesXslRubberSmallLockReasonModal.vue
|
||||
|
||||
-- author:jiangxh---date:20250602--for: 【MES】锁定原因增加原因字段、新增胶料小料锁定日志 ---
|
||||
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_119__mes_xsl_rubber_small_lock_reason_desc_and_log.sql
|
||||
jeecg-boot/db/mes-xsl-rubber-small-lock-log-menu-permission.sql
|
||||
jeecg-boot/db/mes-xsl-rubber-small-lock-reason-menu-permission.sql
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberSmallLockReason.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberSmallLockReasonServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberSmallLockReasonController.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberSmallLockLog.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberSmallLockLogMapper.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberSmallLockLogService.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberSmallLockLogServiceImpl.java
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberSmallLockLogController.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReason.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReason.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLog.data.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLog.api.ts
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLogList.vue
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslRubberSmallLockLog/components/MesXslRubberSmallLockLogModal.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,117 @@
|
||||
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 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.exception.JeecgBootException;
|
||||
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.MesXslRubberSmallLockLog;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberSmallLockLogService;
|
||||
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/mesXslRubberSmallLockLog")
|
||||
@Slf4j
|
||||
public class MesXslRubberSmallLockLogController
|
||||
extends JeecgController<MesXslRubberSmallLockLog, IMesXslRubberSmallLockLogService> {
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberSmallLockLogService mesXslRubberSmallLockLogService;
|
||||
|
||||
@Operation(summary = "MES胶料小料锁定日志-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslRubberSmallLockLog>> queryPageList(
|
||||
MesXslRubberSmallLockLog model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslRubberSmallLockLog> queryWrapper =
|
||||
QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslRubberSmallLockLog> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslRubberSmallLockLog> pageList = mesXslRubberSmallLockLogService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料小料锁定日志-添加")
|
||||
@Operation(summary = "MES胶料小料锁定日志-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_log:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslRubberSmallLockLog model) {
|
||||
try {
|
||||
mesXslRubberSmallLockLogService.save(model);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料小料锁定日志-编辑")
|
||||
@Operation(summary = "MES胶料小料锁定日志-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_log:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslRubberSmallLockLog model) {
|
||||
try {
|
||||
mesXslRubberSmallLockLogService.updateById(model);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料小料锁定日志-删除")
|
||||
@Operation(summary = "MES胶料小料锁定日志-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_log:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslRubberSmallLockLogService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料小料锁定日志-批量删除")
|
||||
@Operation(summary = "MES胶料小料锁定日志-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_log:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslRubberSmallLockLogService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES胶料小料锁定日志-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslRubberSmallLockLog> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslRubberSmallLockLog entity = mesXslRubberSmallLockLogService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_log:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberSmallLockLog model) {
|
||||
return super.exportXls(request, model, MesXslRubberSmallLockLog.class, "MES胶料小料锁定日志");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_log:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, MesXslRubberSmallLockLog.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
package org.jeecg.modules.xslmes.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
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.exception.JeecgBootException;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockReason;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberSmallLockReasonService;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* MES 胶料小料锁定原因
|
||||
*/
|
||||
@Tag(name = "MES胶料小料锁定原因")
|
||||
@RestController
|
||||
@RequestMapping("/xslmes/mesXslRubberSmallLockReason")
|
||||
@Slf4j
|
||||
public class MesXslRubberSmallLockReasonController
|
||||
extends JeecgController<MesXslRubberSmallLockReason, IMesXslRubberSmallLockReasonService> {
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberSmallLockReasonService mesXslRubberSmallLockReasonService;
|
||||
|
||||
@Operation(summary = "MES胶料小料锁定原因-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<MesXslRubberSmallLockReason>> queryPageList(
|
||||
MesXslRubberSmallLockReason model,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<MesXslRubberSmallLockReason> queryWrapper =
|
||||
QueryGenerator.initQueryWrapper(model, req.getParameterMap());
|
||||
Page<MesXslRubberSmallLockReason> page = new Page<>(pageNo, pageSize);
|
||||
IPage<MesXslRubberSmallLockReason> pageList = mesXslRubberSmallLockReasonService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料小料锁定原因-添加")
|
||||
@Operation(summary = "MES胶料小料锁定原因-添加")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody MesXslRubberSmallLockReason model) {
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因新增校验与自动编号-----------
|
||||
if (oConvertUtils.isEmpty(model.getLockType())) {
|
||||
return Result.error("类型不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getBarcodeType())) {
|
||||
return Result.error("条码类型不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getReasonDesc()) || model.getReasonDesc().trim().isEmpty()) {
|
||||
return Result.error("原因不能为空");
|
||||
}
|
||||
model.setReasonCode(null);
|
||||
try {
|
||||
mesXslRubberSmallLockReasonService.save(model);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因新增校验与自动编号-----------
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料小料锁定原因-编辑")
|
||||
@Operation(summary = "MES胶料小料锁定原因-编辑")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody MesXslRubberSmallLockReason model) {
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因编辑仅改类型与条码类型、编号只读-----------
|
||||
if (oConvertUtils.isEmpty(model.getId())) {
|
||||
return Result.error("缺少主键");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getLockType())) {
|
||||
return Result.error("类型不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getBarcodeType())) {
|
||||
return Result.error("条码类型不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(model.getReasonDesc()) || model.getReasonDesc().trim().isEmpty()) {
|
||||
return Result.error("原因不能为空");
|
||||
}
|
||||
MesXslRubberSmallLockReason old = mesXslRubberSmallLockReasonService.getById(model.getId());
|
||||
if (old == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
old.setLockType(model.getLockType());
|
||||
old.setBarcodeType(model.getBarcodeType());
|
||||
old.setReasonDesc(model.getReasonDesc().trim());
|
||||
try {
|
||||
mesXslRubberSmallLockReasonService.updateById(old);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因编辑仅改类型与条码类型、编号只读-----------
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料小料锁定原因-删除")
|
||||
@Operation(summary = "MES胶料小料锁定原因-通过id删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
mesXslRubberSmallLockReasonService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
@AutoLog(value = "MES胶料小料锁定原因-批量删除")
|
||||
@Operation(summary = "MES胶料小料锁定原因-批量删除")
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
mesXslRubberSmallLockReasonService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
@Operation(summary = "MES胶料小料锁定原因-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MesXslRubberSmallLockReason> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MesXslRubberSmallLockReason entity = mesXslRubberSmallLockReasonService.getById(id);
|
||||
if (entity == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Operation(summary = "预览下一编号(001起)")
|
||||
@GetMapping(value = "/nextReasonCode")
|
||||
public Result<String> nextReasonCode() {
|
||||
MesXslRubberSmallLockReason ctx = new MesXslRubberSmallLockReason();
|
||||
return Result.OK(mesXslRubberSmallLockReasonService.generateNextReasonCode(ctx));
|
||||
}
|
||||
|
||||
@Operation(summary = "按条码类型查询锁定原因选项(日志表单联动)")
|
||||
@GetMapping(value = "/optionsByBarcodeType")
|
||||
public Result<List<MesXslRubberSmallLockReason>> optionsByBarcodeType(
|
||||
@RequestParam(name = "barcodeType", required = true) String barcodeType) {
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】锁定日志按条码类型加载原因选项-----------
|
||||
if (oConvertUtils.isEmpty(barcodeType)) {
|
||||
return Result.error("条码类型不能为空");
|
||||
}
|
||||
LambdaQueryWrapper<MesXslRubberSmallLockReason> w = new LambdaQueryWrapper<>();
|
||||
w.eq(MesXslRubberSmallLockReason::getBarcodeType, barcodeType.trim());
|
||||
w.and(
|
||||
q ->
|
||||
q.eq(MesXslRubberSmallLockReason::getDelFlag, CommonConstant.DEL_FLAG_0)
|
||||
.or()
|
||||
.isNull(MesXslRubberSmallLockReason::getDelFlag));
|
||||
w.orderByAsc(MesXslRubberSmallLockReason::getReasonCode);
|
||||
return Result.OK(mesXslRubberSmallLockReasonService.list(w));
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】锁定日志按条码类型加载原因选项-----------
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberSmallLockReason model) {
|
||||
return super.exportXls(request, model, MesXslRubberSmallLockReason.class, "MES胶料小料锁定原因");
|
||||
}
|
||||
|
||||
@RequiresPermissions("mes:mes_xsl_rubber_small_lock_reason:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因导入:类型与条码类型必填,编号可空则自动生成-----------
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> ent : fileMap.entrySet()) {
|
||||
MultipartFile file = ent.getValue();
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MesXslRubberSmallLockReason> list =
|
||||
ExcelImportUtil.importExcel(file.getInputStream(), MesXslRubberSmallLockReason.class, params);
|
||||
if (list == null) {
|
||||
list = List.of();
|
||||
}
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
MesXslRubberSmallLockReason row = list.get(i);
|
||||
int rowNo = i + 1;
|
||||
if (row == null) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(row.getLockType())) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条类型不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(row.getBarcodeType())) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条条码类型不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(row.getReasonDesc()) || row.getReasonDesc().trim().isEmpty()) {
|
||||
return Result.error("文件导入失败:第 " + rowNo + " 条原因不能为空");
|
||||
}
|
||||
if (oConvertUtils.isNotEmpty(row.getReasonCode())) {
|
||||
row.setReasonCode(row.getReasonCode().trim());
|
||||
} else {
|
||||
row.setReasonCode(null);
|
||||
}
|
||||
}
|
||||
for (MesXslRubberSmallLockReason row : list) {
|
||||
try {
|
||||
mesXslRubberSmallLockReasonService.save(row);
|
||||
} catch (JeecgBootException e) {
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
log.info("胶料小料锁定原因Excel导入完成,行数={}", list.size());
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg, e);
|
||||
return Result.error("文件导入失败:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因导入:类型与条码类型必填,编号可空则自动生成-----------
|
||||
return Result.error("文件导入失败!");
|
||||
}
|
||||
}
|
||||
@@ -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,79 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
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 胶料小料锁定日志
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_rubber_small_lock_log")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES胶料小料锁定日志")
|
||||
public class MesXslRubberSmallLockLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Schema(description = "锁定原因ID")
|
||||
private String lockReasonId;
|
||||
|
||||
@Excel(name = "类型", width = 12, dicCode = "xslmes_rubber_small_lock_barcode_type")
|
||||
@Dict(dicCode = "xslmes_rubber_small_lock_barcode_type")
|
||||
@Schema(description = "条码类型")
|
||||
private String barcodeType;
|
||||
|
||||
@Excel(name = "条码", width = 20)
|
||||
@Schema(description = "条码")
|
||||
private String barcode;
|
||||
|
||||
@Excel(name = "状态", width = 12, dicCode = "xslmes_rubber_small_lock_type")
|
||||
@Dict(dicCode = "xslmes_rubber_small_lock_type")
|
||||
@Schema(description = "状态(来自锁定原因类型)")
|
||||
private String lockType;
|
||||
|
||||
@Excel(name = "原因", width = 40)
|
||||
@Schema(description = "原因(来自锁定原因)")
|
||||
private String reasonDesc;
|
||||
|
||||
@Excel(name = "日期", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@Schema(description = "日期")
|
||||
private Date logDate;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
|
||||
@Excel(name = "创建人", width = 12)
|
||||
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;
|
||||
|
||||
@Excel(name = "修改人", width = 12)
|
||||
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;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package org.jeecg.modules.xslmes.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
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 胶料小料锁定原因
|
||||
*/
|
||||
@Data
|
||||
@TableName("mes_xsl_rubber_small_lock_reason")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "MES胶料小料锁定原因")
|
||||
public class MesXslRubberSmallLockReason implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
@Excel(name = "编号", width = 12)
|
||||
@Schema(description = "编号(租户内从001递增自动生成,只读)")
|
||||
private String reasonCode;
|
||||
|
||||
@Excel(name = "类型", width = 12, dicCode = "xslmes_rubber_small_lock_type")
|
||||
@Dict(dicCode = "xslmes_rubber_small_lock_type")
|
||||
@Schema(description = "类型(字典:lock锁定 unlock解锁)")
|
||||
private String lockType;
|
||||
|
||||
@Excel(name = "条码类型", width = 12, dicCode = "xslmes_rubber_small_lock_barcode_type")
|
||||
@Dict(dicCode = "xslmes_rubber_small_lock_barcode_type")
|
||||
@Schema(description = "条码类型(字典:small小料 rubber胶料)")
|
||||
private String barcodeType;
|
||||
|
||||
@Excel(name = "原因", width = 40)
|
||||
@Schema(description = "原因(手动输入,必填)")
|
||||
private String reasonDesc;
|
||||
|
||||
private Integer tenantId;
|
||||
private String sysOrgCode;
|
||||
|
||||
@Excel(name = "创建人", width = 12)
|
||||
private String createBy;
|
||||
|
||||
@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")
|
||||
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;
|
||||
|
||||
@TableLogic
|
||||
@Schema(description = "删除状态(0正常 1已删除)")
|
||||
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,8 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockLog;
|
||||
|
||||
@Mapper
|
||||
public interface MesXslRubberSmallLockLogMapper extends BaseMapper<MesXslRubberSmallLockLog> {}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.jeecg.modules.xslmes.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockReason;
|
||||
|
||||
/**
|
||||
* MES 胶料小料锁定原因 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface MesXslRubberSmallLockReasonMapper extends BaseMapper<MesXslRubberSmallLockReason> {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因租户内最大三位数字编号-----------
|
||||
@Select(
|
||||
"SELECT IFNULL(MAX(CAST(reason_code AS UNSIGNED)), 0) FROM mes_xsl_rubber_small_lock_reason "
|
||||
+ "WHERE del_flag = 0 AND reason_code REGEXP '^[0-9]+$' "
|
||||
+ "AND (#{tenantId} IS NULL OR tenant_id = #{tenantId})")
|
||||
Integer selectMaxNumericReasonCode(@Param("tenantId") Integer tenantId);
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因租户内最大三位数字编号-----------
|
||||
}
|
||||
@@ -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,6 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockLog;
|
||||
|
||||
public interface IMesXslRubberSmallLockLogService extends IService<MesXslRubberSmallLockLog> {}
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.jeecg.modules.xslmes.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockReason;
|
||||
|
||||
public interface IMesXslRubberSmallLockReasonService extends IService<MesXslRubberSmallLockReason> {
|
||||
|
||||
/** 生成下一编号(001 起,三位数字,租户维度) */
|
||||
String generateNextReasonCode(MesXslRubberSmallLockReason context);
|
||||
}
|
||||
@@ -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,72 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockLog;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockReason;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberSmallLockLogMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberSmallLockLogService;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberSmallLockReasonService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class MesXslRubberSmallLockLogServiceImpl
|
||||
extends ServiceImpl<MesXslRubberSmallLockLogMapper, MesXslRubberSmallLockLog>
|
||||
implements IMesXslRubberSmallLockLogService {
|
||||
|
||||
@Autowired
|
||||
private IMesXslRubberSmallLockReasonService mesXslRubberSmallLockReasonService;
|
||||
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定日志保存时从原因主数据带出状态与原因-----------
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean save(MesXslRubberSmallLockLog entity) {
|
||||
fillAndValidate(entity);
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateById(MesXslRubberSmallLockLog entity) {
|
||||
if (oConvertUtils.isEmpty(entity.getId())) {
|
||||
throw new JeecgBootException("缺少主键");
|
||||
}
|
||||
fillAndValidate(entity);
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
private void fillAndValidate(MesXslRubberSmallLockLog entity) {
|
||||
if (entity == null) {
|
||||
throw new JeecgBootException("数据不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(entity.getBarcodeType())) {
|
||||
throw new JeecgBootException("类型(条码类型)不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(entity.getBarcode()) || entity.getBarcode().trim().isEmpty()) {
|
||||
throw new JeecgBootException("条码不能为空");
|
||||
}
|
||||
entity.setBarcode(entity.getBarcode().trim());
|
||||
if (entity.getBarcode().length() > 128) {
|
||||
throw new JeecgBootException("条码长度不能超过128个字符");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(entity.getLockReasonId())) {
|
||||
throw new JeecgBootException("请选择锁定原因");
|
||||
}
|
||||
if (entity.getLogDate() == null) {
|
||||
throw new JeecgBootException("日期不能为空");
|
||||
}
|
||||
MesXslRubberSmallLockReason reason = mesXslRubberSmallLockReasonService.getById(entity.getLockReasonId());
|
||||
if (reason == null) {
|
||||
throw new JeecgBootException("锁定原因不存在或已删除");
|
||||
}
|
||||
if (!entity.getBarcodeType().equals(reason.getBarcodeType())) {
|
||||
throw new JeecgBootException("所选锁定原因与条码类型不一致");
|
||||
}
|
||||
entity.setLockType(reason.getLockType());
|
||||
entity.setReasonDesc(reason.getReasonDesc());
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定日志保存时从原因主数据带出状态与原因-----------
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package org.jeecg.modules.xslmes.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.xslmes.common.MesXslTenantUtils;
|
||||
import org.jeecg.modules.xslmes.entity.MesXslRubberSmallLockReason;
|
||||
import org.jeecg.modules.xslmes.mapper.MesXslRubberSmallLockReasonMapper;
|
||||
import org.jeecg.modules.xslmes.service.IMesXslRubberSmallLockReasonService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
public class MesXslRubberSmallLockReasonServiceImpl
|
||||
extends ServiceImpl<MesXslRubberSmallLockReasonMapper, MesXslRubberSmallLockReason>
|
||||
implements IMesXslRubberSmallLockReasonService {
|
||||
|
||||
//update-begin---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因编号001递增、类型与条码类型必填-----------
|
||||
@Override
|
||||
public String generateNextReasonCode(MesXslRubberSmallLockReason context) {
|
||||
Integer tenantId = MesXslTenantUtils.resolveTenantId(context != null ? context.getTenantId() : null);
|
||||
Integer max = baseMapper.selectMaxNumericReasonCode(tenantId);
|
||||
int next = (max == null ? 0 : max) + 1;
|
||||
if (next > 999) {
|
||||
throw new IllegalStateException("编号已超过999,请联系管理员");
|
||||
}
|
||||
return String.format("%03d", next);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean save(MesXslRubberSmallLockReason entity) {
|
||||
validateRequiredFields(entity);
|
||||
if (oConvertUtils.isEmpty(entity.getReasonCode())) {
|
||||
entity.setReasonCode(generateNextReasonCode(entity));
|
||||
}
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateById(MesXslRubberSmallLockReason entity) {
|
||||
if (oConvertUtils.isEmpty(entity.getId())) {
|
||||
throw new JeecgBootException("缺少主键");
|
||||
}
|
||||
validateRequiredFields(entity);
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
private void validateRequiredFields(MesXslRubberSmallLockReason entity) {
|
||||
if (entity == null) {
|
||||
throw new JeecgBootException("数据不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(entity.getLockType())) {
|
||||
throw new JeecgBootException("类型不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(entity.getBarcodeType())) {
|
||||
throw new JeecgBootException("条码类型不能为空");
|
||||
}
|
||||
if (oConvertUtils.isEmpty(entity.getReasonDesc()) || entity.getReasonDesc().trim().isEmpty()) {
|
||||
throw new JeecgBootException("原因不能为空");
|
||||
}
|
||||
String desc = entity.getReasonDesc().trim();
|
||||
if (desc.length() > 500) {
|
||||
throw new JeecgBootException("原因长度不能超过500个字符");
|
||||
}
|
||||
entity.setReasonDesc(desc);
|
||||
}
|
||||
//update-end---author:jiangxh ---date:20250602 for:【MES】胶料小料锁定原因编号001递增、类型与条码类型必填-----------
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -571,3 +571,21 @@ jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules
|
||||
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslMixerMaterialTareStrategy.java
|
||||
jeecgboot-vue3/src/views/xslmes/mesXslMixerMaterialTareStrategy/MesXslMixerMaterialTareStrategy.data.ts
|
||||
yy-admin-master/YY.Admin/Views/MixerMaterialTareStrategy/MixerMaterialTareStrategyEditDialogView.xaml
|
||||
|
||||
-- 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,82 @@
|
||||
-- MES 胶料小料锁定原因:字典 + 建表 + 菜单(质量管理下)+ 按钮 + 租户 admin 授权
|
||||
-- 权限前缀:mes:mes_xsl_rubber_small_lock_reason:*
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES胶料小料锁定类型', 'xslmes_rubber_small_lock_type', '锁定/解锁', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_small_lock_type' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '锁定', 'lock', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_small_lock_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'lock');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '解锁', 'unlock', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_small_lock_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'unlock');
|
||||
|
||||
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`)
|
||||
SELECT REPLACE(UUID(), '-', ''), 'MES胶料小料锁定条码类型', 'xslmes_rubber_small_lock_barcode_type', '小料/胶料', 0, 'admin', NOW(), 0, 0
|
||||
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND `del_flag` = 0);
|
||||
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '小料', 'small', 1, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'small');
|
||||
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
|
||||
SELECT REPLACE(UUID(), '-', ''), d.id, '胶料', 'rubber', 2, 1, 'admin', NOW() FROM `sys_dict` d
|
||||
WHERE d.`dict_code` = 'xslmes_rubber_small_lock_barcode_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'rubber');
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_small_lock_reason` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`reason_code` varchar(16) NOT NULL COMMENT '编号(租户内从001递增自动生成,只读)',
|
||||
`lock_type` varchar(16) NOT NULL COMMENT '类型(字典xslmes_rubber_small_lock_type:lock锁定unlock解锁)',
|
||||
`barcode_type` varchar(16) NOT NULL COMMENT '条码类型(字典xslmes_rubber_small_lock_barcode_type:small小料rubber胶料)',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建日期',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mrslr_tenant_code` (`tenant_id`, `reason_code`),
|
||||
KEY `idx_mrslr_tenant_lock` (`tenant_id`, `lock_type`, `barcode_type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料小料锁定原因';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_quality_pid = IFNULL(
|
||||
(SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1),
|
||||
'1860000000000000162'
|
||||
);
|
||||
|
||||
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 ('1860000000000000208', @mes_quality_pid, '胶料小料锁定原因', '/xslmes/mesXslRubberSmallLockReason', 'xslmes/mesXslRubberSmallLockReason/MesXslRubberSmallLockReasonList', 'MesXslRubberSmallLockReasonList', 1, NULL, '1', 6, 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`), `sort_no` = VALUES(`sort_no`), `is_leaf` = 0, `keep_alive` = VALUES(`keep_alive`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:lock-outlined' WHERE `id` = '1860000000000000208' 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
|
||||
('1860000000000000209', '1860000000000000208', '新增', 2, 'mes:mes_xsl_rubber_small_lock_reason:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000210', '1860000000000000208', '编辑', 2, 'mes:mes_xsl_rubber_small_lock_reason:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000211', '1860000000000000208', '删除', 2, 'mes:mes_xsl_rubber_small_lock_reason:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000212', '1860000000000000208', '批量删除', 2, 'mes:mes_xsl_rubber_small_lock_reason:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000213', '1860000000000000208', '导出', 2, 'mes:mes_xsl_rubber_small_lock_reason:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000214', '1860000000000000208', '导入', 2, 'mes:mes_xsl_rubber_small_lock_reason:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE `perms` = VALUES(`perms`), `name` = VALUES(`name`);
|
||||
|
||||
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 (
|
||||
'1860000000000000208',
|
||||
'1860000000000000209', '1860000000000000210', '1860000000000000211', '1860000000000000212',
|
||||
'1860000000000000213', '1860000000000000214'
|
||||
)
|
||||
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,82 @@
|
||||
-- MES 胶料小料锁定原因增加原因字段 + 胶料小料锁定日志(质量管理菜单)
|
||||
-- 权限前缀:mes:mes_xsl_rubber_small_lock_log:*
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
SET @reason_desc_exists := (
|
||||
SELECT COUNT(1)
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'mes_xsl_rubber_small_lock_reason'
|
||||
AND COLUMN_NAME = 'reason_desc'
|
||||
);
|
||||
SET @ddl_reason_desc := IF(
|
||||
@reason_desc_exists = 0,
|
||||
'ALTER TABLE `mes_xsl_rubber_small_lock_reason` ADD COLUMN `reason_desc` varchar(500) NOT NULL DEFAULT '''' COMMENT ''原因(手动输入,必填)'' AFTER `barcode_type`',
|
||||
'SELECT 1'
|
||||
);
|
||||
PREPARE stmt_reason_desc FROM @ddl_reason_desc;
|
||||
EXECUTE stmt_reason_desc;
|
||||
DEALLOCATE PREPARE stmt_reason_desc;
|
||||
|
||||
UPDATE `mes_xsl_rubber_small_lock_reason` SET `reason_desc` = CONCAT('原因', `reason_code`) WHERE `reason_desc` = '' OR `reason_desc` IS NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_small_lock_log` (
|
||||
`id` varchar(32) NOT NULL COMMENT '主键',
|
||||
`lock_reason_id` varchar(32) NOT NULL COMMENT '锁定原因ID mes_xsl_rubber_small_lock_reason.id',
|
||||
`barcode_type` varchar(16) NOT NULL COMMENT '条码类型(字典xslmes_rubber_small_lock_barcode_type)',
|
||||
`barcode` varchar(128) NOT NULL COMMENT '条码',
|
||||
`lock_type` varchar(16) NOT NULL COMMENT '状态(字典xslmes_rubber_small_lock_type,来自锁定原因)',
|
||||
`reason_desc` varchar(500) NOT NULL COMMENT '原因(来自锁定原因冗余)',
|
||||
`log_date` date NOT NULL COMMENT '日期',
|
||||
`tenant_id` int DEFAULT NULL COMMENT '租户',
|
||||
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
|
||||
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(32) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
`del_flag` int DEFAULT '0' COMMENT '删除标记(0正常1删除)',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_mrsl_log_tenant_date` (`tenant_id`, `log_date`),
|
||||
KEY `idx_mrsl_log_barcode` (`tenant_id`, `barcode_type`, `barcode`),
|
||||
KEY `idx_mrsl_log_reason` (`lock_reason_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料小料锁定日志';
|
||||
|
||||
SET @mes_tenant_id = 1002;
|
||||
|
||||
SET @mes_quality_pid = IFNULL(
|
||||
(SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1),
|
||||
'1860000000000000162'
|
||||
);
|
||||
|
||||
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 ('1860000000000000215', @mes_quality_pid, '胶料小料锁定日志', '/xslmes/mesXslRubberSmallLockLog', 'xslmes/mesXslRubberSmallLockLog/MesXslRubberSmallLockLogList', 'MesXslRubberSmallLockLogList', 1, NULL, '1', 7, 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`), `sort_no` = VALUES(`sort_no`), `is_leaf` = 0, `keep_alive` = VALUES(`keep_alive`);
|
||||
|
||||
UPDATE `sys_permission` SET `icon` = 'ant-design:file-text-outlined' WHERE `id` = '1860000000000000215' 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
|
||||
('1860000000000000216', '1860000000000000215', '新增', 2, 'mes:mes_xsl_rubber_small_lock_log:add', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000217', '1860000000000000215', '编辑', 2, 'mes:mes_xsl_rubber_small_lock_log:edit', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000218', '1860000000000000215', '删除', 2, 'mes:mes_xsl_rubber_small_lock_log:delete', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000219', '1860000000000000215', '批量删除', 2, 'mes:mes_xsl_rubber_small_lock_log:deleteBatch', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000220', '1860000000000000215', '导出', 2, 'mes:mes_xsl_rubber_small_lock_log:exportXls', '1', '1', 0, 'admin', NOW()),
|
||||
('1860000000000000221', '1860000000000000215', '导入', 2, 'mes:mes_xsl_rubber_small_lock_log:importExcel', '1', '1', 0, 'admin', NOW())
|
||||
ON DUPLICATE KEY UPDATE `perms` = VALUES(`perms`), `name` = VALUES(`name`);
|
||||
|
||||
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 (
|
||||
'1860000000000000215',
|
||||
'1860000000000000216', '1860000000000000217', '1860000000000000218', '1860000000000000219',
|
||||
'1860000000000000220', '1860000000000000221'
|
||||
)
|
||||
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,6 +1,56 @@
|
||||
<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="请选择设备类别"
|
||||
|
||||
@@ -64,23 +114,56 @@
|
||||
|
||||
<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"
|
||||
@@ -88,6 +171,7 @@
|
||||
v-auth="'mes:mes_xsl_equipment_ledger:importExcel'"
|
||||
|
||||
preIcon="ant-design:import-outlined"
|
||||
|
||||
@click="onImportXls"
|
||||
|
||||
>
|
||||
@@ -109,7 +193,65 @@
|
||||
删除
|
||||
|
||||
</a-menu-item>
|
||||
const [registerTable, { reload, getSelectRows }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
|
||||
</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';
|
||||
|
||||
@@ -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 });
|
||||
|
||||
@@ -68,6 +68,20 @@ export const searchFormSchema: FormSchema[] = [
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
|
||||
label: '转子类型',
|
||||
|
||||
field: 'rotorType',
|
||||
|
||||
component: 'JDictSelectTag',
|
||||
|
||||
componentProps: { dictCode: 'xslmes_rubber_quick_test_rotor_type', placeholder: '大转子/小转子' },
|
||||
|
||||
colProps: { span: 6 },
|
||||
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,57 @@ export const columns: BasicColumn[] = [
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '单号', field: 'recordNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '胶料名称', field: 'rubberMaterialName', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '生产机台',
|
||||
field: 'prodEquipmentLedgerId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id', placeholder: '请选择生产机台' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '检验机台',
|
||||
field: 'inspectEquipmentLedgerId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'mes_xsl_equipment_ledger,equipment_name,id', placeholder: '请选择检验机台' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '班次',
|
||||
field: 'workShift',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_quick_test_work_shift', placeholder: '请选择班次' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '班组',
|
||||
field: 'workTeam',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_quick_test_work_team', placeholder: '请选择班组' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '检验类型',
|
||||
field: 'quickTestTypeId',
|
||||
component: 'JSearchSelect',
|
||||
componentProps: {
|
||||
dict: 'mes_xsl_rubber_quick_test_type,type_name,id',
|
||||
async: true,
|
||||
placeholder: '请选择检验类型',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '检验人',
|
||||
field: 'inspectorUserId',
|
||||
component: 'JSelectUser',
|
||||
componentProps: {
|
||||
rowKey: 'id',
|
||||
labelKey: 'realname',
|
||||
isRadioSelection: true,
|
||||
maxSelectCount: 1,
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '生产计划号', field: 'productionPlanNo', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '胶料批次', field: 'rubberBatchNo', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
|
||||
@@ -26,8 +26,31 @@ export const columns: BasicColumn[] = [
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{ label: '实验标准名称', field: 'stdName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '实验方法', field: 'testMethodName', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '胶料名称', field: 'rubberMaterialName', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '实验方法',
|
||||
field: 'testMethodId',
|
||||
component: 'JSearchSelect',
|
||||
componentProps: {
|
||||
dict: 'mes_xsl_rubber_quick_test_method,method_name,id',
|
||||
async: true,
|
||||
placeholder: '请选择实验方法',
|
||||
},
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '密炼机类型',
|
||||
field: 'mixerType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_quick_test_mixer_type', placeholder: '请选择密炼机类型' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '胶料名称',
|
||||
field: 'rubberMaterialId',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'mes_material,material_name,id', placeholder: '请选择胶料信息' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '启用状态',
|
||||
field: 'enableStatus',
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslRubberSmallLockLog/list',
|
||||
save = '/xslmes/mesXslRubberSmallLockLog/add',
|
||||
edit = '/xslmes/mesXslRubberSmallLockLog/edit',
|
||||
deleteOne = '/xslmes/mesXslRubberSmallLockLog/delete',
|
||||
deleteBatch = '/xslmes/mesXslRubberSmallLockLog/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslRubberSmallLockLog/importExcel',
|
||||
exportXls = '/xslmes/mesXslRubberSmallLockLog/exportXls',
|
||||
queryById = '/xslmes/mesXslRubberSmallLockLog/queryById',
|
||||
}
|
||||
|
||||
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 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,110 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '类型', align: 'center', dataIndex: 'barcodeType_dictText', width: 90 },
|
||||
{ title: '条码', align: 'center', dataIndex: 'barcode', width: 140 },
|
||||
{ title: '状态', align: 'center', dataIndex: 'lockType_dictText', width: 90 },
|
||||
{ title: '原因', align: 'center', dataIndex: 'reasonDesc', width: 200, ellipsis: true },
|
||||
{ title: '日期', align: 'center', dataIndex: 'logDate', width: 110 },
|
||||
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100 },
|
||||
{ title: '修改人', align: 'center', dataIndex: 'updateBy', width: 100 },
|
||||
{
|
||||
title: '修改日期',
|
||||
align: 'center',
|
||||
dataIndex: 'updateTime',
|
||||
width: 165,
|
||||
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
|
||||
},
|
||||
];
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
label: '类型',
|
||||
field: 'barcodeType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_barcode_type', placeholder: '请选择类型' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{ label: '条码', field: 'barcode', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '状态',
|
||||
field: 'lockType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_type', placeholder: '请选择状态' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '日期',
|
||||
field: 'logDate',
|
||||
component: 'DatePicker',
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '类型',
|
||||
field: 'barcodeType',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_barcode_type', placeholder: '请选择条码类型' },
|
||||
},
|
||||
{
|
||||
label: '条码',
|
||||
field: 'barcode',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
componentProps: { placeholder: '请输入条码', maxlength: 128 },
|
||||
},
|
||||
{
|
||||
label: '锁定原因',
|
||||
field: 'lockReasonId',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
slot: 'lockReasonSelect',
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
field: 'lockType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_type', disabled: true, placeholder: '选择锁定原因后自动带出' },
|
||||
},
|
||||
{
|
||||
label: '原因',
|
||||
field: 'reasonDesc',
|
||||
component: 'InputTextArea',
|
||||
componentProps: { rows: 2, readonly: true, placeholder: '选择锁定原因后自动带出' },
|
||||
},
|
||||
{
|
||||
label: '日期',
|
||||
field: 'logDate',
|
||||
component: 'DatePicker',
|
||||
required: true,
|
||||
defaultValue: dayjs().format('YYYY-MM-DD'),
|
||||
componentProps: { valueFormat: 'YYYY-MM-DD', style: { width: '100%' } },
|
||||
},
|
||||
{
|
||||
label: '创建人',
|
||||
field: 'createBy',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true },
|
||||
ifShow: ({ values }) => !!values?.id,
|
||||
},
|
||||
{
|
||||
label: '修改人',
|
||||
field: 'updateBy',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true },
|
||||
ifShow: ({ values }) => !!values?.id,
|
||||
},
|
||||
{
|
||||
label: '修改日期',
|
||||
field: 'updateTime',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true },
|
||||
ifShow: ({ values }) => !!values?.id,
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_rubber_small_lock_log:add'"
|
||||
@click="handleAdd"
|
||||
preIcon="ant-design:plus-outlined"
|
||||
>
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_rubber_small_lock_log:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_rubber_small_lock_log: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_rubber_small_lock_log: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_rubber_small_lock_log:edit',
|
||||
},
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslRubberSmallLockLogModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslRubberSmallLockLog" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslRubberSmallLockLogModal from './components/MesXslRubberSmallLockLogModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslRubberSmallLockLog.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberSmallLockLog.api';
|
||||
|
||||
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 }, { 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 });
|
||||
}
|
||||
|
||||
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_rubber_small_lock_log:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,121 @@
|
||||
<template>
|
||||
<BasicModal @register="registerModal" :title="title" width="640px" v-bind="$attrs" destroyOnClose @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #lockReasonSelect="{ model, field }">
|
||||
<a-select
|
||||
v-model:value="model[field]"
|
||||
:options="reasonOptions"
|
||||
:disabled="isDetail || !model.barcodeType"
|
||||
allow-clear
|
||||
show-search
|
||||
option-filter-prop="label"
|
||||
placeholder="请先选择类型,再选择锁定原因"
|
||||
style="width: 100%"
|
||||
@change="(val) => onLockReasonChange(val, model)"
|
||||
/>
|
||||
</template>
|
||||
</BasicForm>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../MesXslRubberSmallLockLog.data';
|
||||
import { saveOrUpdate } from '../MesXslRubberSmallLockLog.api';
|
||||
import { optionsByBarcodeType } from '../../mesXslRubberSmallLockReason/MesXslRubberSmallLockReason.api';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(false);
|
||||
const isDetail = ref(false);
|
||||
const reasonOptions = ref<{ label: string; value: string; lockType?: string; reasonDesc?: string }[]>([]);
|
||||
const reasonMap = ref<Record<string, { lockType?: string; reasonDesc?: string }>>({});
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue, updateSchema }] = useForm({
|
||||
labelWidth: 110,
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
|
||||
async function loadReasonOptions(barcodeType?: string, keepReasonId?: string) {
|
||||
reasonOptions.value = [];
|
||||
reasonMap.value = {};
|
||||
if (!barcodeType) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const list = await optionsByBarcodeType({ barcodeType });
|
||||
const rows = Array.isArray(list) ? list : [];
|
||||
reasonOptions.value = rows.map((r: Recordable) => {
|
||||
const label = `${r.reasonCode || ''} ${r.reasonDesc || ''}`.trim();
|
||||
reasonMap.value[r.id] = { lockType: r.lockType, reasonDesc: r.reasonDesc };
|
||||
return { label, value: r.id, lockType: r.lockType, reasonDesc: r.reasonDesc };
|
||||
});
|
||||
if (keepReasonId && reasonMap.value[keepReasonId]) {
|
||||
onLockReasonChange(keepReasonId, getFieldsValue());
|
||||
}
|
||||
} catch {
|
||||
reasonOptions.value = [];
|
||||
}
|
||||
}
|
||||
|
||||
function onLockReasonChange(val: string | undefined, model: Recordable) {
|
||||
if (!val) {
|
||||
model.lockType = undefined;
|
||||
model.reasonDesc = undefined;
|
||||
return;
|
||||
}
|
||||
const row = reasonMap.value[val];
|
||||
if (row) {
|
||||
model.lockType = row.lockType;
|
||||
model.reasonDesc = row.reasonDesc;
|
||||
}
|
||||
}
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
await resetFields();
|
||||
reasonOptions.value = [];
|
||||
reasonMap.value = {};
|
||||
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
isDetail.value = !data?.showFooter;
|
||||
if (unref(isUpdate)) {
|
||||
const record = { ...data.record };
|
||||
await setFieldsValue(record);
|
||||
await loadReasonOptions(record.barcodeType, record.lockReasonId);
|
||||
} else {
|
||||
await setFieldsValue({ logDate: dayjs().format('YYYY-MM-DD') });
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
updateSchema({
|
||||
field: 'barcodeType',
|
||||
componentProps: {
|
||||
dictCode: 'xslmes_rubber_small_lock_barcode_type',
|
||||
placeholder: '请选择条码类型',
|
||||
disabled: !data?.showFooter,
|
||||
onChange: async (val: string) => {
|
||||
await setFieldsValue({ lockReasonId: undefined, lockType: undefined, reasonDesc: undefined });
|
||||
await loadReasonOptions(val);
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增胶料小料锁定日志' : unref(isDetail) ? '锁定日志详情' : '编辑胶料小料锁定日志',
|
||||
);
|
||||
|
||||
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,55 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
|
||||
const { createConfirm } = useMessage();
|
||||
|
||||
enum Api {
|
||||
list = '/xslmes/mesXslRubberSmallLockReason/list',
|
||||
nextReasonCode = '/xslmes/mesXslRubberSmallLockReason/nextReasonCode',
|
||||
save = '/xslmes/mesXslRubberSmallLockReason/add',
|
||||
edit = '/xslmes/mesXslRubberSmallLockReason/edit',
|
||||
deleteOne = '/xslmes/mesXslRubberSmallLockReason/delete',
|
||||
deleteBatch = '/xslmes/mesXslRubberSmallLockReason/deleteBatch',
|
||||
importExcel = '/xslmes/mesXslRubberSmallLockReason/importExcel',
|
||||
exportXls = '/xslmes/mesXslRubberSmallLockReason/exportXls',
|
||||
queryById = '/xslmes/mesXslRubberSmallLockReason/queryById',
|
||||
optionsByBarcodeType = '/xslmes/mesXslRubberSmallLockReason/optionsByBarcodeType',
|
||||
}
|
||||
|
||||
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 fetchNextReasonCode = () => defHttp.get({ url: Api.nextReasonCode }, { successMessageMode: 'none' });
|
||||
|
||||
export const optionsByBarcodeType = (params: { barcodeType: string }) =>
|
||||
defHttp.get({ url: Api.optionsByBarcodeType, params }, { successMessageMode: 'none' });
|
||||
|
||||
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,81 @@
|
||||
import { BasicColumn, FormSchema } from '/@/components/Table';
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{ title: '编号', align: 'center', dataIndex: 'reasonCode', width: 100 },
|
||||
{ title: '类型', align: 'center', dataIndex: 'lockType_dictText', width: 100 },
|
||||
{ title: '条码类型', align: 'center', dataIndex: 'barcodeType_dictText', width: 100 },
|
||||
{ title: '原因', align: 'center', dataIndex: 'reasonDesc', width: 220, ellipsis: true },
|
||||
{ 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: 'reasonCode', component: 'Input', colProps: { span: 6 } },
|
||||
{ label: '原因', field: 'reasonDesc', component: 'Input', colProps: { span: 6 } },
|
||||
{
|
||||
label: '类型',
|
||||
field: 'lockType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_type', placeholder: '请选择类型' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
{
|
||||
label: '条码类型',
|
||||
field: 'barcodeType',
|
||||
component: 'JDictSelectTag',
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_barcode_type', placeholder: '请选择条码类型' },
|
||||
colProps: { span: 6 },
|
||||
},
|
||||
];
|
||||
|
||||
export const formSchema: FormSchema[] = [
|
||||
{ label: '', field: 'id', component: 'Input', show: false },
|
||||
{
|
||||
label: '编号',
|
||||
field: 'reasonCode',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true, placeholder: '保存时从001起自动生成' },
|
||||
},
|
||||
{
|
||||
label: '类型',
|
||||
field: 'lockType',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_type', placeholder: '请选择类型' },
|
||||
},
|
||||
{
|
||||
label: '条码类型',
|
||||
field: 'barcodeType',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: { dictCode: 'xslmes_rubber_small_lock_barcode_type', placeholder: '请选择条码类型' },
|
||||
},
|
||||
{
|
||||
label: '原因',
|
||||
field: 'reasonDesc',
|
||||
component: 'InputTextArea',
|
||||
required: true,
|
||||
colProps: { span: 24 },
|
||||
componentProps: { rows: 3, maxlength: 500, showCount: true, placeholder: '请输入原因' },
|
||||
},
|
||||
{
|
||||
label: '创建人',
|
||||
field: 'createBy',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true },
|
||||
ifShow: ({ values }) => !!values?.id,
|
||||
},
|
||||
{
|
||||
label: '创建日期',
|
||||
field: 'createTime',
|
||||
component: 'Input',
|
||||
componentProps: { readonly: true },
|
||||
ifShow: ({ values }) => !!values?.id,
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #tableTitle>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_rubber_small_lock_reason:add'"
|
||||
@click="handleAdd"
|
||||
preIcon="ant-design:plus-outlined"
|
||||
>
|
||||
新增
|
||||
</a-button>
|
||||
<a-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_rubber_small_lock_reason:exportXls'"
|
||||
preIcon="ant-design:export-outlined"
|
||||
@click="onExportXls"
|
||||
>
|
||||
导出
|
||||
</a-button>
|
||||
<j-upload-button
|
||||
type="primary"
|
||||
v-auth="'mes:mes_xsl_rubber_small_lock_reason: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_rubber_small_lock_reason: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_rubber_small_lock_reason:edit',
|
||||
},
|
||||
]"
|
||||
:dropDownActions="getDropDownAction(record)"
|
||||
/>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<MesXslRubberSmallLockReasonModal @register="registerModal" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="xslmes-mesXslRubberSmallLockReason" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import Icon from '/@/components/Icon';
|
||||
import MesXslRubberSmallLockReasonModal from './components/MesXslRubberSmallLockReasonModal.vue';
|
||||
import { columns, searchFormSchema } from './MesXslRubberSmallLockReason.data';
|
||||
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberSmallLockReason.api';
|
||||
|
||||
const [registerModal, { openModal }] = useModal();
|
||||
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '胶料小料锁定原因',
|
||||
api: list,
|
||||
columns,
|
||||
canResize: true,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
labelWidth: 120,
|
||||
autoSubmitOnEnter: true,
|
||||
showAdvancedButton: true,
|
||||
},
|
||||
actionColumn: {
|
||||
width: 200,
|
||||
fixed: 'right',
|
||||
},
|
||||
},
|
||||
exportConfig: {
|
||||
name: '胶料小料锁定原因',
|
||||
url: getExportUrl,
|
||||
},
|
||||
importConfig: {
|
||||
url: getImportUrl,
|
||||
success: handleSuccess,
|
||||
},
|
||||
});
|
||||
|
||||
const [registerTable, { reload }, { 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 });
|
||||
}
|
||||
|
||||
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_rubber_small_lock_reason:delete',
|
||||
},
|
||||
];
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<BasicModal @register="registerModal" :title="title" width="50%" v-bind="$attrs" destroyOnClose @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, unref } from 'vue';
|
||||
import { BasicModal, useModalInner } from '/@/components/Modal';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from '../MesXslRubberSmallLockReason.data';
|
||||
import { fetchNextReasonCode, saveOrUpdate } from '../MesXslRubberSmallLockReason.api';
|
||||
|
||||
const emit = defineEmits(['register', 'success']);
|
||||
const isUpdate = ref(true);
|
||||
const isDetail = ref(false);
|
||||
|
||||
const [registerForm, { resetFields, setFieldsValue, validate, setProps }] = useForm({
|
||||
labelWidth: 120,
|
||||
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 {
|
||||
try {
|
||||
const nextCode = await fetchNextReasonCode();
|
||||
await setFieldsValue({ reasonCode: nextCode });
|
||||
} catch {
|
||||
await setFieldsValue({ reasonCode: '' });
|
||||
}
|
||||
}
|
||||
setProps({ disabled: !data?.showFooter });
|
||||
});
|
||||
|
||||
const title = computed(() =>
|
||||
!unref(isUpdate) ? '新增胶料小料锁定原因' : unref(isDetail) ? '锁定原因详情' : '编辑胶料小料锁定原因',
|
||||
);
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate();
|
||||
setModalProps({ confirmLoading: true });
|
||||
await saveOrUpdate(values, isUpdate.value);
|
||||
closeModal();
|
||||
emit('success');
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -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