快检实验方法新增

This commit is contained in:
2026-05-25 11:01:26 +08:00
parent af8bf14b5e
commit a6579f019a
12 changed files with 1938 additions and 969 deletions

View File

@@ -1,147 +1,294 @@
-- 胶料快检实验方法主子表字典 + 建表 + 菜单质量管理下+ 按钮 + 租户 admin 授权 -- 胶料快检实验方法主子表字典 + 建表 + 菜单质量管理下+ 按钮 + 租户 admin 授权
-- 权限前缀mes:mes_xsl_rubber_quick_test_method:* -- 权限前缀mes:mes_xsl_rubber_quick_test_method:*
-- 菜单 ID 1860000000000000177与数据点 170 段区分 -- 菜单 ID 1860000000000000177与数据点 170 段区分
-- 可与 Flyway V3.9.2_102 重复执行ON DUPLICATE / IF NOT EXISTS -- 可与 Flyway V3.9.2_102 重复执行ON DUPLICATE / IF NOT EXISTS
-- SET @mes_tenant_id多租户 admin 授权目标租户 -- SET @mes_tenant_id多租户 admin 授权目标租户
SET NAMES utf8mb4; SET NAMES utf8mb4;
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`) 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_quick_test_rotor_type', '1大转子2小转子', 0, 'admin', NOW(), 0, 0 SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检转子类型', 'xslmes_rubber_quick_test_rotor_type', '1大转子2小转子', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND `del_flag` = 0); WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND `del_flag` = 0);
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
SELECT REPLACE(UUID(), '-', ''), d.id, '大转子', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d SELECT REPLACE(UUID(), '-', ''), d.id, '大转子', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1'); WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
SELECT REPLACE(UUID(), '-', ''), d.id, '小转子', '2', 2, 1, 'admin', NOW() FROM `sys_dict` d SELECT REPLACE(UUID(), '-', ''), d.id, '小转子', '2', 2, 1, 'admin', NOW() FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2'); WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2');
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`) 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_quick_test_torque_unit', 'Ib.indNmkg.cmNmmdm', 0, 'admin', NOW(), 0, 0 SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检扭矩单位', 'xslmes_rubber_quick_test_torque_unit', 'Ib.indNmkg.cmNmmdm', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_torque_unit' AND `del_flag` = 0); WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_torque_unit' AND `del_flag` = 0);
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW() SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW()
FROM `sys_dict` d FROM `sys_dict` d
CROSS JOIN ( CROSS JOIN (
SELECT 'Ib.in' AS txt, 'Ib.in' AS val, 1 AS ord UNION ALL SELECT 'Ib.in' AS txt, 'Ib.in' AS val, 1 AS ord UNION ALL
SELECT 'dNm', 'dNm', 2 UNION ALL SELECT 'dNm', 'dNm', 2 UNION ALL
SELECT 'kg.cm', 'kg.cm', 3 UNION ALL SELECT 'kg.cm', 'kg.cm', 3 UNION ALL
SELECT 'Nm', 'Nm', 4 UNION ALL SELECT 'Nm', 'Nm', 4 UNION ALL
SELECT 'mdm', 'mdm', 5 SELECT 'mdm', 'mdm', 5
) v ) v
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_torque_unit' WHERE d.`dict_code` = 'xslmes_rubber_quick_test_torque_unit'
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val); AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`) 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_quick_test_time_unit', 'secminm:s', 0, 'admin', NOW(), 0, 0 SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检时间单位', 'xslmes_rubber_quick_test_time_unit', 'secminm:s', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_time_unit' AND `del_flag` = 0); WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_time_unit' AND `del_flag` = 0);
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW() SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW()
FROM `sys_dict` d FROM `sys_dict` d
CROSS JOIN ( CROSS JOIN (
SELECT 'sec' AS txt, 'sec' AS val, 1 AS ord UNION ALL SELECT 'sec' AS txt, 'sec' AS val, 1 AS ord UNION ALL
SELECT 'min', 'min', 2 UNION ALL SELECT 'min', 'min', 2 UNION ALL
SELECT 'm:s', 'm:s', 3 SELECT 'm:s', 'm:s', 3
) v ) v
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_time_unit' WHERE d.`dict_code` = 'xslmes_rubber_quick_test_time_unit'
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val); AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`) 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_quick_test_mooney_unit', 'MU', 0, 'admin', NOW(), 0, 0 SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检门尼单位', 'xslmes_rubber_quick_test_mooney_unit', 'MU', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_mooney_unit' AND `del_flag` = 0); WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_mooney_unit' AND `del_flag` = 0);
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
SELECT REPLACE(UUID(), '-', ''), d.id, 'MU', 'MU', 1, 1, 'admin', NOW() FROM `sys_dict` d SELECT REPLACE(UUID(), '-', ''), d.id, 'MU', 'MU', 1, 1, 'admin', NOW() FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_mooney_unit' WHERE d.`dict_code` = 'xslmes_rubber_quick_test_mooney_unit'
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'MU'); AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'MU');
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method` ( CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method` (
`id` varchar(32) NOT NULL COMMENT '主键', `id` varchar(32) NOT NULL COMMENT '主键',
`method_code` varchar(16) NOT NULL COMMENT '方法编号租户内从001递增自动生成', `method_code` varchar(16) NOT NULL COMMENT '方法编号租户内从001递增自动生成',
`method_name` varchar(128) NOT NULL COMMENT '实验方法名称同租户未删除唯一', `method_name` varchar(128) NOT NULL COMMENT '实验方法名称同租户未删除唯一',
`quick_test_type_id` varchar(32) NOT NULL COMMENT '实验类型 mes_xsl_rubber_quick_test_type.id', `quick_test_type_id` varchar(32) NOT NULL COMMENT '实验类型 mes_xsl_rubber_quick_test_type.id',
`quick_test_type_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余', `quick_test_type_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
`test_temp_c` decimal(12,2) DEFAULT NULL COMMENT '实验温度°C', `test_temp_c` decimal(12,2) DEFAULT NULL COMMENT '实验温度°C',
`preheat_time_min` decimal(12,2) DEFAULT NULL COMMENT '预热时间min', `preheat_time_min` decimal(12,2) DEFAULT NULL COMMENT '预热时间min',
`test_time_min` decimal(12,2) DEFAULT NULL COMMENT '实验时间min', `test_time_min` decimal(12,2) DEFAULT NULL COMMENT '实验时间min',
`test_angle_deg` decimal(12,2) DEFAULT NULL COMMENT '实验角度Deg', `test_angle_deg` decimal(12,2) DEFAULT NULL COMMENT '实验角度Deg',
`test_freq_hz` decimal(12,2) DEFAULT NULL COMMENT '实验频率Hz', `test_freq_hz` decimal(12,2) DEFAULT NULL COMMENT '实验频率Hz',
`rotor_type` varchar(2) DEFAULT NULL COMMENT '转子类型字典xslmes_rubber_quick_test_rotor_type1大转子2小转子', `rotor_type` varchar(2) DEFAULT NULL COMMENT '转子类型字典xslmes_rubber_quick_test_rotor_type1大转子2小转子',
`rotor_speed_rpm` decimal(12,2) DEFAULT NULL COMMENT '转子速度rpm', `rotor_speed_rpm` decimal(12,2) DEFAULT NULL COMMENT '转子速度rpm',
`method_desc` varchar(500) DEFAULT NULL COMMENT '方法描述', `method_desc` varchar(500) DEFAULT NULL COMMENT '方法描述',
`tenant_id` int DEFAULT NULL COMMENT '租户', `tenant_id` int DEFAULT NULL COMMENT '租户',
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门', `sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人', `create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间', `create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人', `update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间', `update_time` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int DEFAULT '0' COMMENT '删除标记0正常1删除', `del_flag` int DEFAULT '0' COMMENT '删除标记0正常1删除',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_mrqtm_tenant_code` (`tenant_id`, `method_code`), KEY `idx_mrqtm_tenant_code` (`tenant_id`, `method_code`),
KEY `idx_mrqtm_type` (`quick_test_type_id`), KEY `idx_mrqtm_type` (`quick_test_type_id`),
UNIQUE KEY `uk_mrqtm_tenant_name_del` (`tenant_id`, `method_name`, `del_flag`) UNIQUE KEY `uk_mrqtm_tenant_name_del` (`tenant_id`, `method_name`, `del_flag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法';
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method_line` ( CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method_line` (
`id` varchar(32) NOT NULL COMMENT '主键', `id` varchar(32) NOT NULL COMMENT '主键',
`method_id` varchar(32) NOT NULL COMMENT '主表 mes_xsl_rubber_quick_test_method.id', `method_id` varchar(32) NOT NULL COMMENT '主表 mes_xsl_rubber_quick_test_method.id',
`data_point_id` varchar(32) NOT NULL COMMENT '数据点 mes_xsl_rubber_quick_test_data_point.id', `data_point_id` varchar(32) NOT NULL COMMENT '数据点 mes_xsl_rubber_quick_test_data_point.id',
`point_name` varchar(128) DEFAULT NULL COMMENT '数据点名称冗余只读带出', `point_name` varchar(128) DEFAULT NULL COMMENT '数据点名称冗余只读带出',
`unit_type` varchar(64) DEFAULT NULL COMMENT '单位类型冗余只读带出', `unit_type` varchar(64) DEFAULT NULL COMMENT '单位类型冗余只读带出',
`torque_unit_type` varchar(32) DEFAULT NULL COMMENT '扭矩单位类型字典xslmes_rubber_quick_test_torque_unit', `torque_unit_type` varchar(32) DEFAULT NULL COMMENT '扭矩单位类型字典xslmes_rubber_quick_test_torque_unit',
`time_unit_type` varchar(32) DEFAULT NULL COMMENT '时间单位类型字典xslmes_rubber_quick_test_time_unit', `time_unit_type` varchar(32) DEFAULT NULL COMMENT '时间单位类型字典xslmes_rubber_quick_test_time_unit',
`mooney_unit_type` varchar(32) DEFAULT NULL COMMENT '门尼单位类型字典xslmes_rubber_quick_test_mooney_unit', `mooney_unit_type` varchar(32) DEFAULT NULL COMMENT '门尼单位类型字典xslmes_rubber_quick_test_mooney_unit',
`sort_no` int DEFAULT NULL COMMENT '排序号', `sort_no` int DEFAULT NULL COMMENT '排序号',
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人', `create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间', `create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人', `update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间', `update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_mrqtml_method` (`method_id`), KEY `idx_mrqtml_method` (`method_id`),
UNIQUE KEY `uk_mrqtml_method_point` (`method_id`, `data_point_id`) UNIQUE KEY `uk_mrqtml_method_point` (`method_id`, `data_point_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法明细'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法明细';
SET @mes_tenant_id = 1002; SET @mes_tenant_id = 1002;
SET @mes_quality_pid = IFNULL( SET @mes_quality_pid = IFNULL(
(SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1), (SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1),
'1860000000000000162' '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`) 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 ('1860000000000000177', @mes_quality_pid, '胶料快检实验方法', '/xslmes/mesXslRubberQuickTestMethod', 'xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList', 'MesXslRubberQuickTestMethodList', 1, NULL, '1', 3, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW()) VALUES ('1860000000000000177', @mes_quality_pid, '胶料快检实验方法', '/xslmes/mesXslRubberQuickTestMethod', 'xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList', 'MesXslRubberQuickTestMethodList', 1, NULL, '1', 3, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`), `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`), `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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0, `is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`); `keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
UPDATE `sys_permission` SET `icon` = 'ant-design:profile-outlined' WHERE `id` = '1860000000000000177' AND `del_flag` = 0; UPDATE `sys_permission` SET `icon` = 'ant-design:profile-outlined' WHERE `id` = '1860000000000000177' 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 INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000178', '1860000000000000177', '新增', 2, 'mes:mes_xsl_rubber_quick_test_method:add', '1', 1, '1', 0, 'admin', NOW()), ('1860000000000000178', '1860000000000000177', '新增', 2, 'mes:mes_xsl_rubber_quick_test_method:add', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000179', '1860000000000000177', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_method:edit', '1', 1, '1', 0, 'admin', NOW()), ('1860000000000000179', '1860000000000000177', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_method:edit', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000180', '1860000000000000177', '删除', 2, 'mes:mes_xsl_rubber_quick_test_method:delete', '1', 1, '1', 0, 'admin', NOW()), ('1860000000000000180', '1860000000000000177', '删除', 2, 'mes:mes_xsl_rubber_quick_test_method:delete', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000181', '1860000000000000177', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_method:deleteBatch', '1', 1, '1', 0, 'admin', NOW()), ('1860000000000000181', '1860000000000000177', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_method:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000182', '1860000000000000177', '导出', 2, 'mes:mes_xsl_rubber_quick_test_method:exportXls', '1', 1, '1', 0, 'admin', NOW()), ('1860000000000000182', '1860000000000000177', '导出', 2, 'mes:mes_xsl_rubber_quick_test_method:exportXls', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000183', '1860000000000000177', '导入', 2, 'mes:mes_xsl_rubber_quick_test_method:importExcel', '1', 1, '1', 0, 'admin', NOW()) ('1860000000000000183', '1860000000000000177', '导入', 2, 'mes:mes_xsl_rubber_quick_test_method:importExcel', '1', 1, '1', 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE 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`), `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; `is_leaf` = 1, `status` = '1', `del_flag` = 0;
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`) 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' SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
FROM `sys_role` r FROM `sys_role` r
CROSS JOIN `sys_permission` p CROSS JOIN `sys_permission` p
WHERE r.`tenant_id` = @mes_tenant_id WHERE r.`tenant_id` = @mes_tenant_id
AND r.`role_code` = 'admin' AND r.`role_code` = 'admin'
AND p.`id` IN ( AND p.`id` IN (
'1860000000000000177', '1860000000000000177',
'1860000000000000178', '1860000000000000179', '1860000000000000180', '1860000000000000181', '1860000000000000178', '1860000000000000179', '1860000000000000180', '1860000000000000181',
'1860000000000000182', '1860000000000000183' '1860000000000000182', '1860000000000000183'
) )
AND NOT EXISTS ( AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id` WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
); );

View File

@@ -1,104 +1,208 @@
package org.jeecg.modules.xslmes.entity; package org.jeecg.modules.xslmes.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic; import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict; import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
/** /**
* MES 胶料快检实验方法主表 * MES 胶料快检实验方法主表
*/ */
@Data @Data
@TableName("mes_xsl_rubber_quick_test_method") @TableName("mes_xsl_rubber_quick_test_method")
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Schema(description = "MES胶料快检实验方法") @Schema(description = "MES胶料快检实验方法")
public class MesXslRubberQuickTestMethod implements Serializable { public class MesXslRubberQuickTestMethod implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
private String id; private String id;
@Excel(name = "方法编号", width = 14) @Excel(name = "方法编号", width = 14)
@Schema(description = "方法编号租户内从001递增自动生成只读") @Schema(description = "方法编号租户内从001递增自动生成只读")
private String methodCode; private String methodCode;
@Excel(name = "实验方法名称", width = 24) @Excel(name = "实验方法名称", width = 24)
@Schema(description = "实验方法名称(同租户未删除唯一)") @Schema(description = "实验方法名称(同租户未删除唯一)")
private String methodName; private String methodName;
@Excel(name = "实验类型", width = 20, dictTable = "mes_xsl_rubber_quick_test_type", dicText = "type_name", dicCode = "id") @Excel(name = "实验类型", width = 20, dictTable = "mes_xsl_rubber_quick_test_type", dicText = "type_name", dicCode = "id")
@Dict(dictTable = "mes_xsl_rubber_quick_test_type", dicText = "type_name", dicCode = "id") @Dict(dictTable = "mes_xsl_rubber_quick_test_type", dicText = "type_name", dicCode = "id")
@Schema(description = "实验类型ID") @Schema(description = "实验类型ID")
private String quickTestTypeId; private String quickTestTypeId;
@Excel(name = "实验类型名称", width = 20) @Excel(name = "实验类型名称", width = 20)
@Schema(description = "实验类型名称冗余") @Schema(description = "实验类型名称冗余")
private String quickTestTypeName; private String quickTestTypeName;
@Excel(name = "实验温度°C", width = 14, type = 10) @Excel(name = "实验温度°C", width = 14, type = 10)
@Schema(description = "实验温度°C") @Schema(description = "实验温度°C")
private BigDecimal testTempC; private BigDecimal testTempC;
@Excel(name = "预热时间min", width = 14, type = 10) @Excel(name = "预热时间min", width = 14, type = 10)
@Schema(description = "预热时间min") @Schema(description = "预热时间min")
private BigDecimal preheatTimeMin; private BigDecimal preheatTimeMin;
@Excel(name = "实验时间min", width = 14, type = 10) @Excel(name = "实验时间min", width = 14, type = 10)
@Schema(description = "实验时间min") @Schema(description = "实验时间min")
private BigDecimal testTimeMin; private BigDecimal testTimeMin;
@Excel(name = "实验角度Deg", width = 14, type = 10) @Excel(name = "实验角度Deg", width = 14, type = 10)
@Schema(description = "实验角度Deg") @Schema(description = "实验角度Deg")
private BigDecimal testAngleDeg; private BigDecimal testAngleDeg;
@Excel(name = "实验频率Hz", width = 14, type = 10) @Excel(name = "实验频率Hz", width = 14, type = 10)
@Schema(description = "实验频率Hz") @Schema(description = "实验频率Hz")
private BigDecimal testFreqHz; private BigDecimal testFreqHz;
@Excel(name = "转子类型", width = 12, dicCode = "xslmes_rubber_quick_test_rotor_type") @Excel(name = "转子类型", width = 12, dicCode = "xslmes_rubber_quick_test_rotor_type")
@Dict(dicCode = "xslmes_rubber_quick_test_rotor_type") @Dict(dicCode = "xslmes_rubber_quick_test_rotor_type")
@Schema(description = "转子类型字典xslmes_rubber_quick_test_rotor_type") @Schema(description = "转子类型字典xslmes_rubber_quick_test_rotor_type")
private String rotorType; private String rotorType;
@Excel(name = "转子速度rpm", width = 14, type = 10) @Excel(name = "转子速度rpm", width = 14, type = 10)
@Schema(description = "转子速度rpm") @Schema(description = "转子速度rpm")
private BigDecimal rotorSpeedRpm; private BigDecimal rotorSpeedRpm;
@Excel(name = "方法描述", width = 40) @Excel(name = "方法描述", width = 40)
@Schema(description = "方法描述") @Schema(description = "方法描述")
private String methodDesc; private String methodDesc;
private Integer tenantId; private Integer tenantId;
private String sysOrgCode; private String sysOrgCode;
private String createBy; private String createBy;
@JsonFormat(timezone = "GMT+8", pattern = "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") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
private String updateBy; private String updateBy;
@JsonFormat(timezone = "GMT+8", pattern = "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") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
@TableLogic @TableLogic
@Schema(description = "删除状态0正常 1已删除") @Schema(description = "删除状态0正常 1已删除")
private Integer delFlag; private Integer delFlag;
@TableField(exist = false) @TableField(exist = false)
@Schema(description = "数据点明细") @Schema(description = "数据点明细")
private List<MesXslRubberQuickTestMethodLine> lineList; private List<MesXslRubberQuickTestMethodLine> lineList;
} }

View File

@@ -1,64 +1,128 @@
package org.jeecg.modules.xslmes.entity; package org.jeecg.modules.xslmes.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict; import org.jeecg.common.aspect.annotation.Dict;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
/** /**
* MES 胶料快检实验方法明细 * MES 胶料快检实验方法明细
*/ */
@Data @Data
@TableName("mes_xsl_rubber_quick_test_method_line") @TableName("mes_xsl_rubber_quick_test_method_line")
@Accessors(chain = true) @Accessors(chain = true)
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Schema(description = "MES胶料快检实验方法明细") @Schema(description = "MES胶料快检实验方法明细")
public class MesXslRubberQuickTestMethodLine implements Serializable { public class MesXslRubberQuickTestMethodLine implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
private String id; private String id;
@Schema(description = "主表主键 mes_xsl_rubber_quick_test_method.id") @Schema(description = "主表主键 mes_xsl_rubber_quick_test_method.id")
private String methodId; private String methodId;
@Schema(description = "数据点主键 mes_xsl_rubber_quick_test_data_point.id") @Schema(description = "数据点主键 mes_xsl_rubber_quick_test_data_point.id")
private String dataPointId; private String dataPointId;
@Schema(description = "数据点名称冗余(只读带出)") @Schema(description = "数据点名称冗余(只读带出)")
private String pointName; private String pointName;
@Schema(description = "单位类型冗余(只读带出)") @Schema(description = "单位类型冗余(只读带出)")
private String unitType; private String unitType;
@Dict(dicCode = "xslmes_rubber_quick_test_torque_unit") @Dict(dicCode = "xslmes_rubber_quick_test_torque_unit")
@Schema(description = "扭矩单位类型") @Schema(description = "扭矩单位类型")
private String torqueUnitType; private String torqueUnitType;
@Dict(dicCode = "xslmes_rubber_quick_test_time_unit") @Dict(dicCode = "xslmes_rubber_quick_test_time_unit")
@Schema(description = "时间单位类型") @Schema(description = "时间单位类型")
private String timeUnitType; private String timeUnitType;
@Dict(dicCode = "xslmes_rubber_quick_test_mooney_unit") @Dict(dicCode = "xslmes_rubber_quick_test_mooney_unit")
@Schema(description = "门尼单位类型") @Schema(description = "门尼单位类型")
private String mooneyUnitType; private String mooneyUnitType;
private Integer sortNo; private Integer sortNo;
private String createBy; private String createBy;
@JsonFormat(timezone = "GMT+8", pattern = "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") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime; private Date createTime;
private String updateBy; private String updateBy;
@JsonFormat(timezone = "GMT+8", pattern = "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") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime;
} }

View File

@@ -1,8 +1,16 @@
package org.jeecg.modules.xslmes.mapper; package org.jeecg.modules.xslmes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine; import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
@Mapper @Mapper
public interface MesXslRubberQuickTestMethodLineMapper extends BaseMapper<MesXslRubberQuickTestMethodLine> {} public interface MesXslRubberQuickTestMethodLineMapper extends BaseMapper<MesXslRubberQuickTestMethodLine> {}

View File

@@ -1,19 +1,38 @@
package org.jeecg.modules.xslmes.mapper; package org.jeecg.modules.xslmes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod; import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
@Mapper @Mapper
public interface MesXslRubberQuickTestMethodMapper extends BaseMapper<MesXslRubberQuickTestMethod> { public interface MesXslRubberQuickTestMethodMapper extends BaseMapper<MesXslRubberQuickTestMethod> {
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法租户内最大三位数字编号----------- //update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法租户内最大三位数字编号-----------
@Select( @Select(
"SELECT IFNULL(MAX(CAST(method_code AS UNSIGNED)), 0) FROM mes_xsl_rubber_quick_test_method " "SELECT IFNULL(MAX(CAST(method_code AS UNSIGNED)), 0) FROM mes_xsl_rubber_quick_test_method "
+ "WHERE del_flag = 0 AND method_code REGEXP '^[0-9]+$' " + "WHERE del_flag = 0 AND method_code REGEXP '^[0-9]+$' "
+ "AND (#{tenantId} IS NULL OR tenant_id = #{tenantId})") + "AND (#{tenantId} IS NULL OR tenant_id = #{tenantId})")
Integer selectMaxNumericMethodCode(@Param("tenantId") Integer tenantId); Integer selectMaxNumericMethodCode(@Param("tenantId") Integer tenantId);
//update-end---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法租户内最大三位数字编号----------- //update-end---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法租户内最大三位数字编号-----------
} }

View File

@@ -1,25 +1,50 @@
package org.jeecg.modules.xslmes.service; package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod; import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine; import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
public interface IMesXslRubberQuickTestMethodService extends IService<MesXslRubberQuickTestMethod> { public interface IMesXslRubberQuickTestMethodService extends IService<MesXslRubberQuickTestMethod> {
String generateNextMethodCode(MesXslRubberQuickTestMethod context); String generateNextMethodCode(MesXslRubberQuickTestMethod context);
boolean isMethodNameDuplicated(String methodName, String excludeId, MesXslRubberQuickTestMethod context); boolean isMethodNameDuplicated(String methodName, String excludeId, MesXslRubberQuickTestMethod context);
void saveMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList); void saveMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList);
void updateMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList); void updateMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList);
void delMain(String id); void delMain(String id);
void delBatchMain(Collection<? extends Serializable> idList); void delBatchMain(Collection<? extends Serializable> idList);
List<MesXslRubberQuickTestMethodLine> selectLinesByMethodId(String methodId); List<MesXslRubberQuickTestMethodLine> selectLinesByMethodId(String methodId);
} }

View File

@@ -1,166 +1,332 @@
package org.jeecg.modules.xslmes.service.impl; package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import org.jeecg.common.config.TenantContext; import org.jeecg.common.config.TenantContext;
import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.exception.JeecgBootException; import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.SpringContextUtils; import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.TokenUtils; import org.jeecg.common.util.TokenUtils;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod; import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine; import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodLineMapper; import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodLineMapper;
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodMapper; import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodMapper;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService; import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@Service @Service
public class MesXslRubberQuickTestMethodServiceImpl public class MesXslRubberQuickTestMethodServiceImpl
extends ServiceImpl<MesXslRubberQuickTestMethodMapper, MesXslRubberQuickTestMethod> extends ServiceImpl<MesXslRubberQuickTestMethodMapper, MesXslRubberQuickTestMethod>
implements IMesXslRubberQuickTestMethodService { implements IMesXslRubberQuickTestMethodService {
@Autowired @Autowired
private MesXslRubberQuickTestMethodLineMapper mesXslRubberQuickTestMethodLineMapper; private MesXslRubberQuickTestMethodLineMapper mesXslRubberQuickTestMethodLineMapper;
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法编号001递增、名称同租户唯一、主子保存----------- //update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法编号001递增、名称同租户唯一、主子保存-----------
@Override @Override
public String generateNextMethodCode(MesXslRubberQuickTestMethod context) { public String generateNextMethodCode(MesXslRubberQuickTestMethod context) {
Integer tenantId = resolveTenantId(context); Integer tenantId = resolveTenantId(context);
Integer max = baseMapper.selectMaxNumericMethodCode(tenantId); Integer max = baseMapper.selectMaxNumericMethodCode(tenantId);
int next = (max == null ? 0 : max) + 1; int next = (max == null ? 0 : max) + 1;
if (next > 999) { if (next > 999) {
throw new IllegalStateException("实验方法编号已超过999请联系管理员"); throw new IllegalStateException("实验方法编号已超过999请联系管理员");
} }
return String.format("%03d", next); return String.format("%03d", next);
} }
@Override @Override
public boolean isMethodNameDuplicated(String methodName, String excludeId, MesXslRubberQuickTestMethod context) { public boolean isMethodNameDuplicated(String methodName, String excludeId, MesXslRubberQuickTestMethod context) {
if (oConvertUtils.isEmpty(methodName)) { if (oConvertUtils.isEmpty(methodName)) {
return false; return false;
} }
Integer tenantId = resolveTenantId(context); Integer tenantId = resolveTenantId(context);
LambdaQueryWrapper<MesXslRubberQuickTestMethod> w = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MesXslRubberQuickTestMethod> w = new LambdaQueryWrapper<>();
w.eq(MesXslRubberQuickTestMethod::getMethodName, methodName.trim()); w.eq(MesXslRubberQuickTestMethod::getMethodName, methodName.trim());
w.and( w.and(
q -> q ->
q.eq(MesXslRubberQuickTestMethod::getDelFlag, CommonConstant.DEL_FLAG_0) q.eq(MesXslRubberQuickTestMethod::getDelFlag, CommonConstant.DEL_FLAG_0)
.or() .or()
.isNull(MesXslRubberQuickTestMethod::getDelFlag)); .isNull(MesXslRubberQuickTestMethod::getDelFlag));
if (oConvertUtils.isNotEmpty(excludeId)) { if (oConvertUtils.isNotEmpty(excludeId)) {
w.ne(MesXslRubberQuickTestMethod::getId, excludeId); w.ne(MesXslRubberQuickTestMethod::getId, excludeId);
} }
if (tenantId != null) { if (tenantId != null) {
w.eq(MesXslRubberQuickTestMethod::getTenantId, tenantId); w.eq(MesXslRubberQuickTestMethod::getTenantId, tenantId);
} }
return this.count(w) > 0; return this.count(w) > 0;
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void saveMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList) { public void saveMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList) {
assertMethodNameUniqueForSave(main, null); assertMethodNameUniqueForSave(main, null);
if (oConvertUtils.isEmpty(main.getMethodCode())) { if (oConvertUtils.isEmpty(main.getMethodCode())) {
main.setMethodCode(generateNextMethodCode(main)); main.setMethodCode(generateNextMethodCode(main));
int next = (max == null ? 0 : max) + 1;
} }
throw new IllegalStateException("实验方法编号已超过999请联系管理员"); this.save(main);
}
return String.format("%03d", next);
}
@Override
public boolean isMethodNameDuplicated(String methodName, String excludeId, MesXslRubberQuickTestMethod context) {
if (oConvertUtils.isEmpty(methodName)) {
insertLines(main.getId(), lineList); insertLines(main.getId(), lineList);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void updateMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList) {
if (oConvertUtils.isEmpty(main.getId())) {
throw new JeecgBootException("缺少主键");
}
MesXslRubberQuickTestMethod old = this.getById(main.getId());
if (old == null) {
throw new JeecgBootException("实验方法不存在");
}
main.setMethodCode(old.getMethodCode());
assertMethodNameUniqueForSave(main, main.getId());
this.updateById(main);
mesXslRubberQuickTestMethodLineMapper.delete(
new LambdaQueryWrapper<MesXslRubberQuickTestMethodLine>()
.eq(MesXslRubberQuickTestMethodLine::getMethodId, main.getId()));
insertLines(main.getId(), lineList);
}
private void insertLines(String methodId, List<MesXslRubberQuickTestMethodLine> lineList) { private void insertLines(String methodId, List<MesXslRubberQuickTestMethodLine> lineList) {
if (CollectionUtils.isEmpty(lineList)) { if (CollectionUtils.isEmpty(lineList)) {
return; return;
} }
int sort = 0; int sort = 0;
for (MesXslRubberQuickTestMethodLine line : lineList) { for (MesXslRubberQuickTestMethodLine line : lineList) {
line.setId(null); line.setId(null);
line.setMethodId(methodId); line.setMethodId(methodId);
line.setSortNo(sort++); line.setSortNo(sort++);
mesXslRubberQuickTestMethodLineMapper.insert(line); mesXslRubberQuickTestMethodLineMapper.insert(line);
} }
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delMain(String id) { public void delMain(String id) {
mesXslRubberQuickTestMethodLineMapper.delete( mesXslRubberQuickTestMethodLineMapper.delete(
new LambdaQueryWrapper<MesXslRubberQuickTestMethodLine>() new LambdaQueryWrapper<MesXslRubberQuickTestMethodLine>()
.eq(MesXslRubberQuickTestMethodLine::getMethodId, id)); .eq(MesXslRubberQuickTestMethodLine::getMethodId, id));
this.removeById(id); this.removeById(id);
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void delBatchMain(Collection<? extends Serializable> idList) { public void delBatchMain(Collection<? extends Serializable> idList) {
for (Serializable id : idList) { for (Serializable id : idList) {
delMain(id.toString()); delMain(id.toString());
}
} }
}
@Override
} }
@Override
public List<MesXslRubberQuickTestMethodLine> selectLinesByMethodId(String methodId) {
return mesXslRubberQuickTestMethodLineMapper.selectList(
new LambdaQueryWrapper<MesXslRubberQuickTestMethodLine>()
.eq(MesXslRubberQuickTestMethodLine::getMethodId, methodId)
.orderByAsc(MesXslRubberQuickTestMethodLine::getSortNo));
}
private void assertMethodNameUniqueForSave(MesXslRubberQuickTestMethod entity, String excludeId) { private void assertMethodNameUniqueForSave(MesXslRubberQuickTestMethod entity, String excludeId) {
if (entity == null || oConvertUtils.isEmpty(entity.getMethodName())) { if (entity == null || oConvertUtils.isEmpty(entity.getMethodName())) {
throw new JeecgBootException("实验方法名称不能为空"); throw new JeecgBootException("实验方法名称不能为空");
assertMethodNameUniqueForSave(main, null);
if (oConvertUtils.isEmpty(main.getMethodCode())) {
main.setMethodCode(generateNextMethodCode(main));
} }
String name = entity.getMethodName().trim();
entity.setMethodName(name);
if (isMethodNameDuplicated(name, excludeId, entity)) {
throw new JeecgBootException("实验方法名称已存在");
}
}
private static Integer resolveTenantId(MesXslRubberQuickTestMethod context) { private static Integer resolveTenantId(MesXslRubberQuickTestMethod context) {
if (context != null && context.getTenantId() != null) { if (context != null && context.getTenantId() != null) {
return context.getTenantId(); return context.getTenantId();
} }
String ts = TenantContext.getTenant(); String ts = TenantContext.getTenant();
if (oConvertUtils.isEmpty(ts)) { if (oConvertUtils.isEmpty(ts)) {
try { try {
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest()); ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
} catch (Exception ignored) { } catch (Exception ignored) {
} }
} }
if (oConvertUtils.isEmpty(ts)) { if (oConvertUtils.isEmpty(ts)) {
return null; return null;
} }
try { try {
return Integer.parseInt(ts.trim()); return Integer.parseInt(ts.trim());
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
return null; return null;
} }
} }
//update-end---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法编号001递增、名称同租户唯一、主子保存----------- //update-end---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法编号001递增、名称同租户唯一、主子保存-----------
} }

View File

@@ -1,12 +1,24 @@
package org.jeecg.modules.xslmes.vo; package org.jeecg.modules.xslmes.vo;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod; import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
/** /**
* 胶料快检实验方法主子保存页 VO * 胶料快检实验方法主子保存页 VO
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class MesXslRubberQuickTestMethodPage extends MesXslRubberQuickTestMethod {} public class MesXslRubberQuickTestMethodPage extends MesXslRubberQuickTestMethod {}

View File

@@ -1,146 +1,292 @@
-- MES 胶料快检实验方法主子表字典 + 建表 + 菜单质量管理下+ 按钮 + 租户 admin 授权 -- MES 胶料快检实验方法主子表字典 + 建表 + 菜单质量管理下+ 按钮 + 租户 admin 授权
-- 权限前缀mes:mes_xsl_rubber_quick_test_method:* -- 权限前缀mes:mes_xsl_rubber_quick_test_method:*
-- 菜单 ID 1860000000000000177避免与数据点 170 段冲突 -- 菜单 ID 1860000000000000177避免与数据点 170 段冲突
-- 依赖mes_xsl_rubber_quick_test_typemes_xsl_rubber_quick_test_data_point质量管理目录 -- 依赖mes_xsl_rubber_quick_test_typemes_xsl_rubber_quick_test_data_point质量管理目录
SET NAMES utf8mb4; SET NAMES utf8mb4;
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`) 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_quick_test_rotor_type', '1大转子2小转子', 0, 'admin', NOW(), 0, 0 SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检转子类型', 'xslmes_rubber_quick_test_rotor_type', '1大转子2小转子', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND `del_flag` = 0); WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND `del_flag` = 0);
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
SELECT REPLACE(UUID(), '-', ''), d.id, '大转子', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d SELECT REPLACE(UUID(), '-', ''), d.id, '大转子', '1', 1, 1, 'admin', NOW() FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1'); WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '1');
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
SELECT REPLACE(UUID(), '-', ''), d.id, '小转子', '2', 2, 1, 'admin', NOW() FROM `sys_dict` d SELECT REPLACE(UUID(), '-', ''), d.id, '小转子', '2', 2, 1, 'admin', NOW() FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2'); WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = '2');
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`) 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_quick_test_torque_unit', 'Ib.indNmkg.cmNmmdm', 0, 'admin', NOW(), 0, 0 SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检扭矩单位', 'xslmes_rubber_quick_test_torque_unit', 'Ib.indNmkg.cmNmmdm', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_torque_unit' AND `del_flag` = 0); WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_torque_unit' AND `del_flag` = 0);
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW() SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW()
FROM `sys_dict` d FROM `sys_dict` d
CROSS JOIN ( CROSS JOIN (
SELECT 'Ib.in' AS txt, 'Ib.in' AS val, 1 AS ord UNION ALL SELECT 'Ib.in' AS txt, 'Ib.in' AS val, 1 AS ord UNION ALL
SELECT 'dNm', 'dNm', 2 UNION ALL SELECT 'dNm', 'dNm', 2 UNION ALL
SELECT 'kg.cm', 'kg.cm', 3 UNION ALL SELECT 'kg.cm', 'kg.cm', 3 UNION ALL
SELECT 'Nm', 'Nm', 4 UNION ALL SELECT 'Nm', 'Nm', 4 UNION ALL
SELECT 'mdm', 'mdm', 5 SELECT 'mdm', 'mdm', 5
) v ) v
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_torque_unit' WHERE d.`dict_code` = 'xslmes_rubber_quick_test_torque_unit'
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val); AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`) 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_quick_test_time_unit', 'secminm:s', 0, 'admin', NOW(), 0, 0 SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检时间单位', 'xslmes_rubber_quick_test_time_unit', 'secminm:s', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_time_unit' AND `del_flag` = 0); WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_time_unit' AND `del_flag` = 0);
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW() SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW()
FROM `sys_dict` d FROM `sys_dict` d
CROSS JOIN ( CROSS JOIN (
SELECT 'sec' AS txt, 'sec' AS val, 1 AS ord UNION ALL SELECT 'sec' AS txt, 'sec' AS val, 1 AS ord UNION ALL
SELECT 'min', 'min', 2 UNION ALL SELECT 'min', 'min', 2 UNION ALL
SELECT 'm:s', 'm:s', 3 SELECT 'm:s', 'm:s', 3
) v ) v
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_time_unit' WHERE d.`dict_code` = 'xslmes_rubber_quick_test_time_unit'
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val); AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = v.val);
INSERT INTO `sys_dict` (`id`, `dict_name`, `dict_code`, `description`, `del_flag`, `create_by`, `create_time`, `type`, `tenant_id`) 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_quick_test_mooney_unit', 'MU', 0, 'admin', NOW(), 0, 0 SELECT REPLACE(UUID(), '-', ''), 'MES胶料快检门尼单位', 'xslmes_rubber_quick_test_mooney_unit', 'MU', 0, 'admin', NOW(), 0, 0
WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_mooney_unit' AND `del_flag` = 0); WHERE NOT EXISTS (SELECT 1 FROM `sys_dict` WHERE `dict_code` = 'xslmes_rubber_quick_test_mooney_unit' AND `del_flag` = 0);
INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`) INSERT INTO `sys_dict_item` (`id`, `dict_id`, `item_text`, `item_value`, `sort_order`, `status`, `create_by`, `create_time`)
SELECT REPLACE(UUID(), '-', ''), d.id, 'MU', 'MU', 1, 1, 'admin', NOW() FROM `sys_dict` d SELECT REPLACE(UUID(), '-', ''), d.id, 'MU', 'MU', 1, 1, 'admin', NOW() FROM `sys_dict` d
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_mooney_unit' WHERE d.`dict_code` = 'xslmes_rubber_quick_test_mooney_unit'
AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'MU'); AND NOT EXISTS (SELECT 1 FROM `sys_dict_item` i WHERE i.`dict_id` = d.id AND i.`item_value` = 'MU');
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method` ( CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method` (
`id` varchar(32) NOT NULL COMMENT '主键', `id` varchar(32) NOT NULL COMMENT '主键',
`method_code` varchar(16) NOT NULL COMMENT '方法编号租户内从001递增自动生成', `method_code` varchar(16) NOT NULL COMMENT '方法编号租户内从001递增自动生成',
`method_name` varchar(128) NOT NULL COMMENT '实验方法名称同租户未删除唯一', `method_name` varchar(128) NOT NULL COMMENT '实验方法名称同租户未删除唯一',
`quick_test_type_id` varchar(32) NOT NULL COMMENT '实验类型 mes_xsl_rubber_quick_test_type.id', `quick_test_type_id` varchar(32) NOT NULL COMMENT '实验类型 mes_xsl_rubber_quick_test_type.id',
`quick_test_type_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余', `quick_test_type_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
`test_temp_c` decimal(12,2) DEFAULT NULL COMMENT '实验温度°C', `test_temp_c` decimal(12,2) DEFAULT NULL COMMENT '实验温度°C',
`preheat_time_min` decimal(12,2) DEFAULT NULL COMMENT '预热时间min', `preheat_time_min` decimal(12,2) DEFAULT NULL COMMENT '预热时间min',
`test_time_min` decimal(12,2) DEFAULT NULL COMMENT '实验时间min', `test_time_min` decimal(12,2) DEFAULT NULL COMMENT '实验时间min',
`test_angle_deg` decimal(12,2) DEFAULT NULL COMMENT '实验角度Deg', `test_angle_deg` decimal(12,2) DEFAULT NULL COMMENT '实验角度Deg',
`test_freq_hz` decimal(12,2) DEFAULT NULL COMMENT '实验频率Hz', `test_freq_hz` decimal(12,2) DEFAULT NULL COMMENT '实验频率Hz',
`rotor_type` varchar(2) DEFAULT NULL COMMENT '转子类型字典xslmes_rubber_quick_test_rotor_type1大转子2小转子', `rotor_type` varchar(2) DEFAULT NULL COMMENT '转子类型字典xslmes_rubber_quick_test_rotor_type1大转子2小转子',
`rotor_speed_rpm` decimal(12,2) DEFAULT NULL COMMENT '转子速度rpm', `rotor_speed_rpm` decimal(12,2) DEFAULT NULL COMMENT '转子速度rpm',
`method_desc` varchar(500) DEFAULT NULL COMMENT '方法描述', `method_desc` varchar(500) DEFAULT NULL COMMENT '方法描述',
`tenant_id` int DEFAULT NULL COMMENT '租户', `tenant_id` int DEFAULT NULL COMMENT '租户',
`sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门', `sys_org_code` varchar(64) DEFAULT NULL COMMENT '部门',
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人', `create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间', `create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人', `update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间', `update_time` datetime DEFAULT NULL COMMENT '更新时间',
`del_flag` int DEFAULT '0' COMMENT '删除标记0正常1删除', `del_flag` int DEFAULT '0' COMMENT '删除标记0正常1删除',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_mrqtm_tenant_code` (`tenant_id`, `method_code`), KEY `idx_mrqtm_tenant_code` (`tenant_id`, `method_code`),
KEY `idx_mrqtm_type` (`quick_test_type_id`), KEY `idx_mrqtm_type` (`quick_test_type_id`),
UNIQUE KEY `uk_mrqtm_tenant_name_del` (`tenant_id`, `method_name`, `del_flag`) UNIQUE KEY `uk_mrqtm_tenant_name_del` (`tenant_id`, `method_name`, `del_flag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法';
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method_line` ( CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method_line` (
`id` varchar(32) NOT NULL COMMENT '主键', `id` varchar(32) NOT NULL COMMENT '主键',
`method_id` varchar(32) NOT NULL COMMENT '主表 mes_xsl_rubber_quick_test_method.id', `method_id` varchar(32) NOT NULL COMMENT '主表 mes_xsl_rubber_quick_test_method.id',
`data_point_id` varchar(32) NOT NULL COMMENT '数据点 mes_xsl_rubber_quick_test_data_point.id', `data_point_id` varchar(32) NOT NULL COMMENT '数据点 mes_xsl_rubber_quick_test_data_point.id',
`point_name` varchar(128) DEFAULT NULL COMMENT '数据点名称冗余只读带出', `point_name` varchar(128) DEFAULT NULL COMMENT '数据点名称冗余只读带出',
`unit_type` varchar(64) DEFAULT NULL COMMENT '单位类型冗余只读带出', `unit_type` varchar(64) DEFAULT NULL COMMENT '单位类型冗余只读带出',
`torque_unit_type` varchar(32) DEFAULT NULL COMMENT '扭矩单位类型字典xslmes_rubber_quick_test_torque_unit', `torque_unit_type` varchar(32) DEFAULT NULL COMMENT '扭矩单位类型字典xslmes_rubber_quick_test_torque_unit',
`time_unit_type` varchar(32) DEFAULT NULL COMMENT '时间单位类型字典xslmes_rubber_quick_test_time_unit', `time_unit_type` varchar(32) DEFAULT NULL COMMENT '时间单位类型字典xslmes_rubber_quick_test_time_unit',
`mooney_unit_type` varchar(32) DEFAULT NULL COMMENT '门尼单位类型字典xslmes_rubber_quick_test_mooney_unit', `mooney_unit_type` varchar(32) DEFAULT NULL COMMENT '门尼单位类型字典xslmes_rubber_quick_test_mooney_unit',
`sort_no` int DEFAULT NULL COMMENT '排序号', `sort_no` int DEFAULT NULL COMMENT '排序号',
`create_by` varchar(32) DEFAULT NULL COMMENT '创建人', `create_by` varchar(32) DEFAULT NULL COMMENT '创建人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间', `create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(32) DEFAULT NULL COMMENT '更新人', `update_by` varchar(32) DEFAULT NULL COMMENT '更新人',
`update_time` datetime DEFAULT NULL COMMENT '更新时间', `update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_mrqtml_method` (`method_id`), KEY `idx_mrqtml_method` (`method_id`),
UNIQUE KEY `uk_mrqtml_method_point` (`method_id`, `data_point_id`) UNIQUE KEY `uk_mrqtml_method_point` (`method_id`, `data_point_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法明细'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验方法明细';
SET @mes_tenant_id = 1002; SET @mes_tenant_id = 1002;
SET @mes_quality_pid = IFNULL( SET @mes_quality_pid = IFNULL(
(SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1), (SELECT `id` FROM `sys_permission` WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = '质量管理' LIMIT 1),
'1860000000000000162' '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`) 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 ('1860000000000000177', @mes_quality_pid, '胶料快检实验方法', '/xslmes/mesXslRubberQuickTestMethod', 'xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList', 'MesXslRubberQuickTestMethodList', 1, NULL, '1', 3, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW()) VALUES ('1860000000000000177', @mes_quality_pid, '胶料快检实验方法', '/xslmes/mesXslRubberQuickTestMethod', 'xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList', 'MesXslRubberQuickTestMethodList', 1, NULL, '1', 3, 1, 0, 0, '1', 0, 1, 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`), `component_name` = VALUES(`component_name`), `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`), `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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0, `is_route` = VALUES(`is_route`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`); `keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
UPDATE `sys_permission` SET `icon` = 'ant-design:profile-outlined' WHERE `id` = '1860000000000000177' AND `del_flag` = 0; UPDATE `sys_permission` SET `icon` = 'ant-design:profile-outlined' WHERE `id` = '1860000000000000177' 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 INSERT INTO `sys_permission`(`id`, `parent_id`, `name`, `menu_type`, `perms`, `perms_type`, `is_leaf`, `status`, `del_flag`, `create_by`, `create_time`) VALUES
('1860000000000000178', '1860000000000000177', '新增', 2, 'mes:mes_xsl_rubber_quick_test_method:add', '1', 1, '1', 0, 'admin', NOW()), ('1860000000000000178', '1860000000000000177', '新增', 2, 'mes:mes_xsl_rubber_quick_test_method:add', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000179', '1860000000000000177', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_method:edit', '1', 1, '1', 0, 'admin', NOW()), ('1860000000000000179', '1860000000000000177', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_method:edit', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000180', '1860000000000000177', '删除', 2, 'mes:mes_xsl_rubber_quick_test_method:delete', '1', 1, '1', 0, 'admin', NOW()), ('1860000000000000180', '1860000000000000177', '删除', 2, 'mes:mes_xsl_rubber_quick_test_method:delete', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000181', '1860000000000000177', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_method:deleteBatch', '1', 1, '1', 0, 'admin', NOW()), ('1860000000000000181', '1860000000000000177', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_method:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000182', '1860000000000000177', '导出', 2, 'mes:mes_xsl_rubber_quick_test_method:exportXls', '1', 1, '1', 0, 'admin', NOW()), ('1860000000000000182', '1860000000000000177', '导出', 2, 'mes:mes_xsl_rubber_quick_test_method:exportXls', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000183', '1860000000000000177', '导入', 2, 'mes:mes_xsl_rubber_quick_test_method:importExcel', '1', 1, '1', 0, 'admin', NOW()) ('1860000000000000183', '1860000000000000177', '导入', 2, 'mes:mes_xsl_rubber_quick_test_method:importExcel', '1', 1, '1', 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE 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`), `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; `is_leaf` = 1, `status` = '1', `del_flag` = 0;
INSERT INTO `sys_role_permission`(`id`, `role_id`, `permission_id`, `operate_date`, `operate_ip`) 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' SELECT REPLACE(UUID(), '-', ''), r.`id`, p.`id`, NOW(), '127.0.0.1'
FROM `sys_role` r FROM `sys_role` r
CROSS JOIN `sys_permission` p CROSS JOIN `sys_permission` p
WHERE r.`tenant_id` = @mes_tenant_id WHERE r.`tenant_id` = @mes_tenant_id
AND r.`role_code` = 'admin' AND r.`role_code` = 'admin'
AND p.`id` IN ( AND p.`id` IN (
'1860000000000000177', '1860000000000000177',
'1860000000000000178', '1860000000000000179', '1860000000000000180', '1860000000000000181', '1860000000000000178', '1860000000000000179', '1860000000000000180', '1860000000000000181',
'1860000000000000182', '1860000000000000183' '1860000000000000182', '1860000000000000183'
) )
AND NOT EXISTS ( AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id` WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
); );

View File

@@ -1,64 +1,128 @@
import { defHttp } from '/@/utils/http/axios'; import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage(); const { createConfirm } = useMessage();
enum Api { enum Api {
list = '/xslmes/mesXslRubberQuickTestMethod/list', list = '/xslmes/mesXslRubberQuickTestMethod/list',
nextMethodCode = '/xslmes/mesXslRubberQuickTestMethod/nextMethodCode', nextMethodCode = '/xslmes/mesXslRubberQuickTestMethod/nextMethodCode',
checkMethodName = '/xslmes/mesXslRubberQuickTestMethod/checkMethodName', checkMethodName = '/xslmes/mesXslRubberQuickTestMethod/checkMethodName',
save = '/xslmes/mesXslRubberQuickTestMethod/add', save = '/xslmes/mesXslRubberQuickTestMethod/add',
edit = '/xslmes/mesXslRubberQuickTestMethod/edit', edit = '/xslmes/mesXslRubberQuickTestMethod/edit',
deleteOne = '/xslmes/mesXslRubberQuickTestMethod/delete', deleteOne = '/xslmes/mesXslRubberQuickTestMethod/delete',
deleteBatch = '/xslmes/mesXslRubberQuickTestMethod/deleteBatch', deleteBatch = '/xslmes/mesXslRubberQuickTestMethod/deleteBatch',
importExcel = '/xslmes/mesXslRubberQuickTestMethod/importExcel', importExcel = '/xslmes/mesXslRubberQuickTestMethod/importExcel',
exportXls = '/xslmes/mesXslRubberQuickTestMethod/exportXls', exportXls = '/xslmes/mesXslRubberQuickTestMethod/exportXls',
queryById = '/xslmes/mesXslRubberQuickTestMethod/queryById', queryById = '/xslmes/mesXslRubberQuickTestMethod/queryById',
queryLineList = '/xslmes/mesXslRubberQuickTestMethod/queryLineListByMethodId', queryLineList = '/xslmes/mesXslRubberQuickTestMethod/queryLineListByMethodId',
} }
export const getExportUrl = Api.exportXls; export const getExportUrl = Api.exportXls;
export const getImportUrl = Api.importExcel; export const getImportUrl = Api.importExcel;
export const list = (params) => defHttp.get({ url: Api.list, params }); export const list = (params) => defHttp.get({ url: Api.list, params });
export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params }); export const queryById = (params: { id: string }) => defHttp.get({ url: Api.queryById, params });
export const queryLineListByMethodId = (params: { id: string }) => defHttp.get({ url: Api.queryLineList, params }); export const queryLineListByMethodId = (params: { id: string }) => defHttp.get({ url: Api.queryLineList, params });
export const fetchNextMethodCode = () => defHttp.get({ url: Api.nextMethodCode }, { successMessageMode: 'none' }); export const fetchNextMethodCode = () => defHttp.get({ url: Api.nextMethodCode }, { successMessageMode: 'none' });
export const checkMethodName = (params: { methodName: string; dataId?: string }) => export const checkMethodName = (params: { methodName: string; dataId?: string }) =>
defHttp.get( defHttp.get(
{ url: Api.checkMethodName, params }, { url: Api.checkMethodName, params },
{ {
successMessageMode: 'none', successMessageMode: 'none',
errorMessageMode: 'none', errorMessageMode: 'none',
}, },
); );
export const deleteOne = (params, handleSuccess) => { export const deleteOne = (params, handleSuccess) => {
return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => { return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
handleSuccess(); handleSuccess();
}); });
}; };
export const batchDelete = (params, handleSuccess) => { export const batchDelete = (params, handleSuccess) => {
createConfirm({ createConfirm({
iconType: 'warning', iconType: 'warning',
title: '确认删除', title: '确认删除',
content: '是否删除选中数据', content: '是否删除选中数据',
okText: '确认', okText: '确认',
cancelText: '取消', cancelText: '取消',
onOk: () => { onOk: () => {
return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => { return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
handleSuccess(); handleSuccess();
}); });
}, },
}); });
}; };
export const saveOrUpdate = (params, isUpdate) => { export const saveOrUpdate = (params, isUpdate) => {
const url = isUpdate ? Api.edit : Api.save; const url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url, params }); return defHttp.post({ url, params });
}; };

View File

@@ -1,136 +1,272 @@
<template> <template>
<div> <div>
<BasicTable @register="registerTable" :rowSelection="rowSelection"> <BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle> <template #tableTitle>
<a-button <a-button
type="primary" type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_method:add'" v-auth="'mes:mes_xsl_rubber_quick_test_method:add'"
@click="handleAdd" @click="handleAdd"
preIcon="ant-design:plus-outlined" preIcon="ant-design:plus-outlined"
> >
新增 新增
</a-button> </a-button>
<a-button <a-button
type="primary" type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_method:exportXls'" v-auth="'mes:mes_xsl_rubber_quick_test_method:exportXls'"
preIcon="ant-design:export-outlined" preIcon="ant-design:export-outlined"
@click="onExportXls" @click="onExportXls"
> >
导出 导出
</a-button> </a-button>
<j-upload-button <j-upload-button
type="primary" type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_method:importExcel'" v-auth="'mes:mes_xsl_rubber_quick_test_method:importExcel'"
preIcon="ant-design:import-outlined" preIcon="ant-design:import-outlined"
@click="onImportXls" @click="onImportXls"
> >
导入 导入
</j-upload-button> </j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay> <template #overlay>
<a-menu> <a-menu>
<a-menu-item key="1" @click="batchHandleDelete"> <a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined" /> <Icon icon="ant-design:delete-outlined" />
删除 删除
</a-menu-item> </a-menu-item>
</a-menu> </a-menu>
导出
</a-button>
<j-upload-button
type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_method:importExcel'"
preIcon="ant-design:import-outlined"
@click="onImportXls"
>
导入
</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
</template> </template>
<a-button v-auth="'mes:mes_xsl_rubber_quick_test_method: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_quick_test_method:edit',
},
]"
:dropDownActions="getDropDownAction(record)"
/>
</template>
</BasicTable>
<MesXslRubberQuickTestMethodModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslRubberQuickTestMethod" setup> <script lang="ts" name="xslmes-mesXslRubberQuickTestMethod" setup>
import { BasicTable, TableAction } from '/@/components/Table'; import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal'; import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage'; import { useListPage } from '/@/hooks/system/useListPage';
import Icon from '/@/components/Icon'; import Icon from '/@/components/Icon';
import MesXslRubberQuickTestMethodModal from './components/MesXslRubberQuickTestMethodModal.vue'; import MesXslRubberQuickTestMethodModal from './components/MesXslRubberQuickTestMethodModal.vue';
import { columns, searchFormSchema } from './MesXslRubberQuickTestMethod.data'; import { columns, searchFormSchema } from './MesXslRubberQuickTestMethod.data';
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberQuickTestMethod.api'; import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberQuickTestMethod.api';
const [registerModal, { openModal }] = useModal(); const [registerModal, { openModal }] = useModal();
const { tableContext, onExportXls, onImportXls } = useListPage({ const { tableContext, onExportXls, onImportXls } = useListPage({
tableProps: { tableProps: {
title: '胶料快检实验方法', title: '胶料快检实验方法',
api: list, api: list,
columns, columns,
canResize: true, canResize: true,
formConfig: { formConfig: {
schemas: searchFormSchema, schemas: searchFormSchema,
labelWidth: 120, labelWidth: 120,
autoSubmitOnEnter: true, autoSubmitOnEnter: true,
showAdvancedButton: true, showAdvancedButton: true,
}, },
actionColumn: { actionColumn: {
width: 200, width: 200,
fixed: 'right', fixed: 'right',
}, },
}, },
exportConfig: { exportConfig: {
name: '胶料快检实验方法', name: '胶料快检实验方法',
url: getExportUrl, url: getExportUrl,
}, },
importConfig: { importConfig: {
url: getImportUrl, url: getImportUrl,
success: handleSuccess, success: handleSuccess,
}, },
}); });
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext; const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
function handleAdd() { function handleAdd() {
openModal(true, { isUpdate: false, showFooter: true }); openModal(true, { isUpdate: false, showFooter: true });
} }
function handleEdit(record: Recordable) { function handleEdit(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: true }); openModal(true, { record, isUpdate: true, showFooter: true });
} }
function handleDetail(record: Recordable) { function handleDetail(record: Recordable) {
openModal(true, { record, isUpdate: true, showFooter: false }); openModal(true, { record, isUpdate: true, showFooter: false });
} }
async function handleDelete(record) { async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess); await deleteOne({ id: record.id }, handleSuccess);
} }
async function batchHandleDelete() { async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess); await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
} }
function handleSuccess() { function handleSuccess() {
selectedRowKeys.value = []; selectedRowKeys.value = [];
reload(); reload();
} }
function getDropDownAction(record) { function getDropDownAction(record) {
return [ return [
{ label: '详情', onClick: handleDetail.bind(null, record) }, { label: '详情', onClick: handleDetail.bind(null, record) },
{ {
label: '删除', label: '删除',
popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) }, popConfirm: { title: '是否确认删除', confirm: handleDelete.bind(null, record) },
auth: 'mes:mes_xsl_rubber_quick_test_method:delete', auth: 'mes:mes_xsl_rubber_quick_test_method:delete',
}, },
]; ];
} }
</script> </script>

View File

@@ -1,78 +1,156 @@
<template> <template>
<BasicModal v-bind="$attrs" :title="modalTitle" :width="1000" @register="registerModal" @ok="handleOk"> <BasicModal v-bind="$attrs" :title="modalTitle" :width="1000" @register="registerModal" @ok="handleOk">
<BasicTable @register="registerTable" /> <BasicTable @register="registerTable" />
</BasicModal> </BasicModal>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal'; import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicTable, useTable } from '/@/components/Table'; import { BasicTable, useTable } from '/@/components/Table';
import { list } from '/@/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.api'; import { list } from '/@/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.api';
const emit = defineEmits(['register', 'select']); const emit = defineEmits(['register', 'select']);
const filterQuickTestTypeId = ref(''); const filterQuickTestTypeId = ref('');
const selectedRows = ref<Recordable[]>([]); const selectedRows = ref<Recordable[]>([]);
const modalTitle = computed(() => '选择数据点(可多选)'); const modalTitle = computed(() => '选择数据点(可多选)');
function handleSelectionChange(_keys: string[], rows: Recordable[]) { function handleSelectionChange(_keys: string[], rows: Recordable[]) {
selectedRows.value = rows || []; selectedRows.value = rows || [];
} }
function fetchPointPage(params: Recordable) { function fetchPointPage(params: Recordable) {
const p = { ...params }; const p = { ...params };
if (filterQuickTestTypeId.value) { if (filterQuickTestTypeId.value) {
p.quickTestTypeId = filterQuickTestTypeId.value; p.quickTestTypeId = filterQuickTestTypeId.value;
} }
return list(p); return list(p);
} }
const [registerTable, { reload, getSelectRows, clearSelectedRowKeys }] = useTable({ const [registerTable, { reload, getSelectRows, clearSelectedRowKeys }] = useTable({
api: fetchPointPage, api: fetchPointPage,
columns: [ columns: [
{ title: '数据点名称', dataIndex: 'pointName', width: 160 }, { title: '数据点名称', dataIndex: 'pointName', width: 160 },
{ title: '实验类型', dataIndex: 'quickTestTypeName', width: 140 }, { title: '实验类型', dataIndex: 'quickTestTypeName', width: 140 },
{ title: '单位类型', dataIndex: 'unitType', width: 120 }, { title: '单位类型', dataIndex: 'unitType', width: 120 },
{ title: '描述', dataIndex: 'pointDesc', width: 200, ellipsis: true }, { title: '描述', dataIndex: 'pointDesc', width: 200, ellipsis: true },
], ],
rowKey: 'id', rowKey: 'id',
useSearchForm: true, useSearchForm: true,
formConfig: { formConfig: {
labelWidth: 90, labelWidth: 90,
schemas: [ schemas: [
{ label: '数据点名称', field: 'pointName', component: 'Input', colProps: { span: 8 } }, { label: '数据点名称', field: 'pointName', component: 'Input', colProps: { span: 8 } },
], ],
}, },
pagination: { pageSize: 10 }, pagination: { pageSize: 10 },
canResize: false, canResize: false,
showIndexColumn: false, showIndexColumn: false,
immediate: true, immediate: true,
rowSelection: { rowSelection: {
type: 'checkbox', type: 'checkbox',
columnWidth: 48, columnWidth: 48,
onChange: handleSelectionChange, onChange: handleSelectionChange,
}, },
clickToRowSelect: true, clickToRowSelect: true,
}); });
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => { const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
filterQuickTestTypeId.value = data?.quickTestTypeId ? String(data.quickTestTypeId) : ''; filterQuickTestTypeId.value = data?.quickTestTypeId ? String(data.quickTestTypeId) : '';
selectedRows.value = []; selectedRows.value = [];
clearSelectedRowKeys?.(); clearSelectedRowKeys?.();
setModalProps({ confirmLoading: false }); setModalProps({ confirmLoading: false });
reload(); reload();
}); });
async function handleOk() { async function handleOk() {
let rows = selectedRows.value?.length ? [...selectedRows.value] : ((getSelectRows?.() || []) as Recordable[]); let rows = selectedRows.value?.length ? [...selectedRows.value] : ((getSelectRows?.() || []) as Recordable[]);
const valid = rows.filter((r) => r?.id && r.pointName != null); const valid = rows.filter((r) => r?.id && r.pointName != null);
if (!valid.length) { if (!valid.length) {
closeModal(); closeModal();
return; return;
} }
emit('select', valid); emit('select', valid);
closeModal(); closeModal();
} }
</script> </script>