胶料快检实验类型、胶料快检数据点、胶料快检实验方法新增

This commit is contained in:
2026-05-25 11:01:00 +08:00
parent fa1c5c9b42
commit af8bf14b5e
44 changed files with 4476 additions and 1 deletions

View File

@@ -0,0 +1,66 @@
-- MES 胶料快检数据点建表 + 菜单质量管理下+ 按钮 + 租户 admin 授权可整文件一次执行
-- 权限前缀mes:mes_xsl_rubber_quick_test_data_point:*
-- 依赖mes_xsl_rubber_quick_test_type修改租户改 SET @mes_tenant_id
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_data_point` (
`id` varchar(32) NOT NULL COMMENT '主键',
`point_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_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
`unit_type` varchar(64) DEFAULT NULL COMMENT '单位类型手填',
`point_desc` varchar(500) DEFAULT 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_mrqtdp_tenant_type` (`tenant_id`, `quick_test_type_id`),
UNIQUE KEY `uk_mrqtdp_tenant_name_del` (`tenant_id`, `point_name`, `del_flag`)
) 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 ('1860000000000000170', @mes_quality_pid, '胶料快检数据点', '/xslmes/mesXslRubberQuickTestDataPoint', 'xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPointList', 'MesXslRubberQuickTestDataPointList', 1, NULL, '1', 2, 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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
UPDATE `sys_permission` SET `icon` = 'ant-design:dot-chart-outlined' WHERE `id` = '1860000000000000170' 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
('1860000000000000171', '1860000000000000170', '新增', 2, 'mes:mes_xsl_rubber_quick_test_data_point:add', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000172', '1860000000000000170', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_data_point:edit', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000173', '1860000000000000170', '删除', 2, 'mes:mes_xsl_rubber_quick_test_data_point:delete', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000174', '1860000000000000170', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_data_point:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000175', '1860000000000000170', '导出', 2, 'mes:mes_xsl_rubber_quick_test_data_point:exportXls', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000176', '1860000000000000170', '导入', 2, 'mes:mes_xsl_rubber_quick_test_data_point: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 (
'1860000000000000170',
'1860000000000000171', '1860000000000000172', '1860000000000000173', '1860000000000000174',
'1860000000000000175', '1860000000000000176'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -0,0 +1,27 @@
-- 撤销胶料快检实验方法删除菜单权限字典业务表可整文件一次执行
-- 说明若仅未执行过 V3.9.2_99 / mes-xsl-rubber-quick-test-method-menu-permission.sql执行本脚本即可
-- Flyway 执行过 V3.9.2_99 的环境请同时执行 flyway V3.9.2_100 或本脚本内容一致
SET NAMES utf8mb4;
DELETE FROM `sys_role_permission`
WHERE `permission_id` IN (
'1860000000000000170',
'1860000000000000171', '1860000000000000172', '1860000000000000173',
'1860000000000000174', '1860000000000000175', '1860000000000000176'
);
DELETE FROM `sys_permission`
WHERE `id` IN (
'1860000000000000170',
'1860000000000000171', '1860000000000000172', '1860000000000000173',
'1860000000000000174', '1860000000000000175', '1860000000000000176'
);
DELETE di FROM `sys_dict_item` di
INNER JOIN `sys_dict` d ON di.`dict_id` = d.`id`
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND d.`del_flag` = 0;
DELETE FROM `sys_dict`
WHERE `dict_code` = 'xslmes_rubber_quick_test_rotor_type';
DROP TABLE IF EXISTS `mes_xsl_rubber_quick_test_method`;

View File

@@ -0,0 +1,147 @@
-- 胶料快检实验方法主子表字典 + 建表 + 菜单质量管理下+ 按钮 + 租户 admin 授权
-- 权限前缀mes:mes_xsl_rubber_quick_test_method:*
-- 菜单 ID 1860000000000000177与数据点 170 段区分
-- 可与 Flyway V3.9.2_102 重复执行ON DUPLICATE / IF NOT EXISTS
-- SET @mes_tenant_id多租户 admin 授权目标租户
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_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);
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
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`)
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');
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
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`)
SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW()
FROM `sys_dict` d
CROSS JOIN (
SELECT 'Ib.in' AS txt, 'Ib.in' AS val, 1 AS ord UNION ALL
SELECT 'dNm', 'dNm', 2 UNION ALL
SELECT 'kg.cm', 'kg.cm', 3 UNION ALL
SELECT 'Nm', 'Nm', 4 UNION ALL
SELECT 'mdm', 'mdm', 5
) v
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);
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
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`)
SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW()
FROM `sys_dict` d
CROSS JOIN (
SELECT 'sec' AS txt, 'sec' AS val, 1 AS ord UNION ALL
SELECT 'min', 'min', 2 UNION ALL
SELECT 'm:s', 'm:s', 3
) v
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);
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
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`)
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'
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` (
`id` varchar(32) NOT NULL COMMENT '主键',
`method_code` varchar(16) NOT NULL COMMENT '方法编号租户内从001递增自动生成',
`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_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
`test_temp_c` decimal(12,2) DEFAULT NULL COMMENT '实验温度°C',
`preheat_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_freq_hz` decimal(12,2) DEFAULT NULL COMMENT '实验频率Hz',
`rotor_type` varchar(2) DEFAULT NULL COMMENT '转子类型字典xslmes_rubber_quick_test_rotor_type1大转子2小转子',
`rotor_speed_rpm` decimal(12,2) DEFAULT NULL COMMENT '转子速度rpm',
`method_desc` varchar(500) DEFAULT NULL COMMENT '方法描述',
`tenant_id` int DEFAULT NULL COMMENT '租户',

View File

@@ -0,0 +1,87 @@
-- MES 胶料快检实验类型建表 + 质量管理目录 + 子菜单 + 按钮 + 租户 admin 授权可整文件一次执行
-- 权限前缀与 Controller前端 v-auth 一致mes:mes_xsl_rubber_quick_test_type:*
-- 修改租户 SET @mes_tenant_id
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_type` (
`id` varchar(32) NOT NULL COMMENT '主键',
`type_code` varchar(16) NOT NULL COMMENT '实验类型编号租户内从001递增自动生成',
`type_name` varchar(128) 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_mrqtt_tenant_code` (`tenant_id`, `type_code`),
KEY `idx_mrqtt_tenant_name` (`tenant_id`, `type_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验类型';
SET @mes_tenant_id = 1002;
SET @mes_root_parent = (
SELECT `parent_id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
LIMIT 1
);
SET @mes_root_parent = IFNULL(@mes_root_parent, (
SELECT `parent_id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
LIMIT 1
));
SET @mes_root_parent = IFNULL(@mes_root_parent, '1860000000000000001');
SET @mes_quality_sort = IFNULL((
SELECT `sort_no` + 1 FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料', '设备管理')
ORDER BY `sort_no` DESC
LIMIT 1
), 52);
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 ('1860000000000000162', @mes_root_parent, '质量管理', '/xslmes/quality', 'layouts/RouteView', 'MesQualityLayout', 0, NULL, '1', @mes_quality_sort, 1, 0, 0, '1', 0, 0, 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
`menu_type` = VALUES(`menu_type`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:safety-certificate-outlined' WHERE `id` = '1860000000000000162' AND `del_flag` = 0;
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 ('1860000000000000163', '1860000000000000162', '胶料快检实验类型', '/xslmes/mesXslRubberQuickTestType', 'xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestTypeList', 'MesXslRubberQuickTestTypeList', 1, NULL, '1', 1, 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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
UPDATE `sys_permission` SET `icon` = 'ant-design:experiment-outlined' WHERE `id` = '1860000000000000163' 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
('1860000000000000164', '1860000000000000163', '新增', 2, 'mes:mes_xsl_rubber_quick_test_type:add', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000165', '1860000000000000163', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_type:edit', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000166', '1860000000000000163', '删除', 2, 'mes:mes_xsl_rubber_quick_test_type:delete', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000167', '1860000000000000163', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_type:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000168', '1860000000000000163', '导出', 2, 'mes:mes_xsl_rubber_quick_test_type:exportXls', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000169', '1860000000000000163', '导入', 2, 'mes:mes_xsl_rubber_quick_test_type: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 (
'1860000000000000162',
'1860000000000000163',
'1860000000000000164', '1860000000000000165', '1860000000000000166', '1860000000000000167',
'1860000000000000168', '1860000000000000169'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -103,3 +103,79 @@ jeecgboot-vue3/src/views/xslmes/mesXslFormulaSpec/components/MesXslFormulaSpecMo
-- author:cursor---date:20260521--for: 【配合示方】编辑打开时基本资料闪清修复 ---
jeecgboot-vue3/src/views/xslmes/mesXslFormulaSpec/components/MesXslFormulaSpecModal.vue
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验类型质量管理目录、001自动编号、CRUD与菜单权限 ---
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_97__mes_xsl_rubber_quick_test_type.sql
jeecg-boot/db/mes-xsl-rubber-quick-test-type-menu-permission.sql
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestType.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestTypeMapper.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestTypeService.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestTypeServiceImpl.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestTypeController.java
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestTypeList.vue
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/components/MesXslRubberQuickTestTypeModal.vue
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验方法质量管理菜单、001编号、名称唯一、关联实验类型 ---
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_99__mes_xsl_rubber_quick_test_method.sql
jeecg-boot/db/mes-xsl-rubber-quick-test-method-menu-permission.sql
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestMethod.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestMethodMapper.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestMethodService.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestMethodServiceImpl.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestMethodController.java
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList.vue
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/components/MesXslRubberQuickTestMethodModal.vue
-- author:jiangxh---date:20260522--for: 【MES】撤销胶料快检实验方法功能删代码+库清理脚本)---
jeecg-boot/db/mes-xsl-rubber-quick-test-method-drop.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_100__drop_mes_xsl_rubber_quick_test_method.sql
-- author:jiangxh---date:20260522--for: 【MES】胶料快检数据点质量管理菜单、名称唯一、关联实验类型、单位手填 ---
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_101__mes_xsl_rubber_quick_test_data_point.sql
jeecg-boot/db/mes-xsl-rubber-quick-test-data-point-menu-permission.sql
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestDataPoint.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestDataPointMapper.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestDataPointService.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestDataPointServiceImpl.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestDataPointController.java
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPointList.vue
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/components/MesXslRubberQuickTestDataPointModal.vue
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验类型名称同租户不可重复Service兜底+唯一索引)---
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_98__mes_xsl_rubber_quick_test_type_name_unique.sql
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestTypeServiceImpl.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestTypeController.java
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.data.ts
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验方法主子表质量管理菜单177段、001编号、名称唯一、选择数据点明细 ---
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_102__mes_xsl_rubber_quick_test_method.sql
jeecg-boot/db/mes-xsl-rubber-quick-test-method-menu-permission.sql
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestMethod.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestMethodLine.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/vo/MesXslRubberQuickTestMethodPage.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestMethodMapper.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestMethodLineMapper.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestMethodService.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestMethodServiceImpl.java
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestMethodController.java
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList.vue
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/components/MesXslRubberQuickTestMethodModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/components/MesXslRubberQuickTestDataPointSelectModal.vue
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验方法明细字典单位必选、不可清空 ---
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/components/MesXslRubberQuickTestMethodModal.vue
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验方法明细单位字典默认取首项非空选---
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/components/MesXslRubberQuickTestMethodModal.vue
jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestMethodController.java
jeecgboot-vue3/src/components/jeecg/JVxeTable/src/components/cells/JVxeSelectCell.vue

View File

@@ -0,0 +1,297 @@
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.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
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.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.MesXslRubberQuickTestDataPoint;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestDataPointService;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
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/mesXslRubberQuickTestDataPoint")
@Slf4j
public class MesXslRubberQuickTestDataPointController
extends JeecgController<MesXslRubberQuickTestDataPoint, IMesXslRubberQuickTestDataPointService> {
@Autowired
private IMesXslRubberQuickTestDataPointService mesXslRubberQuickTestDataPointService;
@Autowired
private IMesXslRubberQuickTestTypeService mesXslRubberQuickTestTypeService;
@Operation(summary = "MES胶料快检数据点-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslRubberQuickTestDataPoint>> queryPageList(
MesXslRubberQuickTestDataPoint model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslRubberQuickTestDataPoint> queryWrapper =
QueryGenerator.initQueryWrapper(model, req.getParameterMap());
Page<MesXslRubberQuickTestDataPoint> page = new Page<>(pageNo, pageSize);
IPage<MesXslRubberQuickTestDataPoint> pageList = mesXslRubberQuickTestDataPointService.page(page, queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "MES胶料快检数据点-添加")
@Operation(summary = "MES胶料快检数据点-添加")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody MesXslRubberQuickTestDataPoint model) {
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检数据点保存校验、实验类型回填-----------
String err = validateForSave(model, null);
if (err != null) {
return Result.error(err);
}
try {
mesXslRubberQuickTestDataPointService.save(model);
} catch (JeecgBootException e) {
return Result.error(e.getMessage());
}
//update-end---author:jiangxh ---date:20260522 for【MES】胶料快检数据点保存校验、实验类型回填-----------
return Result.OK("添加成功!");
}
@AutoLog(value = "MES胶料快检数据点-编辑")
@Operation(summary = "MES胶料快检数据点-编辑")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslRubberQuickTestDataPoint model) {
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检数据点编辑校验-----------
if (oConvertUtils.isEmpty(model.getId())) {
return Result.error("缺少主键");
}
MesXslRubberQuickTestDataPoint old = mesXslRubberQuickTestDataPointService.getById(model.getId());
if (old == null) {
return Result.error("未找到对应数据");
}
String err = validateForSave(model, model.getId());
if (err != null) {
return Result.error(err);
}
old.setPointName(model.getPointName());
old.setQuickTestTypeId(model.getQuickTestTypeId());
old.setQuickTestTypeName(model.getQuickTestTypeName());
old.setUnitType(model.getUnitType());
old.setPointDesc(model.getPointDesc());
try {
mesXslRubberQuickTestDataPointService.updateById(old);
} catch (JeecgBootException e) {
return Result.error(e.getMessage());
}
//update-end---author:jiangxh ---date:20260522 for【MES】胶料快检数据点编辑校验-----------
return Result.OK("编辑成功!");
}
@AutoLog(value = "MES胶料快检数据点-删除")
@Operation(summary = "MES胶料快检数据点-通过id删除")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslRubberQuickTestDataPointService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "MES胶料快检数据点-批量删除")
@Operation(summary = "MES胶料快检数据点-批量删除")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslRubberQuickTestDataPointService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "MES胶料快检数据点-通过id查询")
@GetMapping(value = "/queryById")
public Result<MesXslRubberQuickTestDataPoint> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslRubberQuickTestDataPoint entity = mesXslRubberQuickTestDataPointService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@Operation(summary = "校验数据点名称是否重复")
@GetMapping(value = "/checkPointName")
public Result<String> checkPointName(
@RequestParam(name = "pointName", required = true) String pointName,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(pointName) || pointName.trim().isEmpty()) {
return Result.OK("该值可用!");
}
MesXslRubberQuickTestDataPoint ctx = new MesXslRubberQuickTestDataPoint();
if (mesXslRubberQuickTestDataPointService.isPointNameDuplicated(pointName.trim(), dataId, ctx)) {
return Result.error("该数据点名称已存在");
}
return Result.OK("该值可用!");
}
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberQuickTestDataPoint model) {
return super.exportXls(request, model, MesXslRubberQuickTestDataPoint.class, "MES胶料快检数据点");
}
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_data_point:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
//update-begin---author:jiangxh ---date:20260522 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<MesXslRubberQuickTestDataPoint> list =
ExcelImportUtil.importExcel(file.getInputStream(), MesXslRubberQuickTestDataPoint.class, params);
if (list == null) {
list = List.of();
}
Set<String> namesInFile = new HashSet<>();
for (int i = 0; i < list.size(); i++) {
MesXslRubberQuickTestDataPoint row = list.get(i);
int rowNo = i + 1;
if (row == null) {
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
}
String err = validateImportRow(row, rowNo, namesInFile);
if (err != null) {
return Result.error(err);
}
}
for (MesXslRubberQuickTestDataPoint row : list) {
try {
mesXslRubberQuickTestDataPointService.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:20260522 for【MES】胶料快检数据点导入校验-----------
return Result.error("文件导入失败!");
}
private String validateForSave(MesXslRubberQuickTestDataPoint model, String excludeId) {
if (oConvertUtils.isEmpty(model.getPointName()) || model.getPointName().trim().isEmpty()) {
return "数据点名称不能为空";
}
model.setPointName(model.getPointName().trim());
if (mesXslRubberQuickTestDataPointService.isPointNameDuplicated(model.getPointName(), excludeId, model)) {
return "数据点名称已存在";
}
if (oConvertUtils.isNotEmpty(model.getUnitType())) {
model.setUnitType(model.getUnitType().trim());
}
if (oConvertUtils.isNotEmpty(model.getPointDesc())) {
model.setPointDesc(model.getPointDesc().trim());
}
return resolveAndFillQuickTestType(model);
}
private String validateImportRow(MesXslRubberQuickTestDataPoint row, int rowNo, Set<String> namesInFile) {
if (oConvertUtils.isEmpty(row.getPointName()) || row.getPointName().trim().isEmpty()) {
return "文件导入失败:第 " + rowNo + " 条数据点名称不能为空";
}
row.setPointName(row.getPointName().trim());
if (!namesInFile.add(row.getPointName())) {
return "文件导入失败:数据点名称【" + row.getPointName() + "】在导入文件中重复";
}
if (mesXslRubberQuickTestDataPointService.isPointNameDuplicated(row.getPointName(), null, row)) {
return "文件导入失败:第 " + rowNo + " 条数据点名称【" + row.getPointName() + "】已存在";
}
if (oConvertUtils.isEmpty(row.getQuickTestTypeId()) && oConvertUtils.isNotEmpty(row.getImportQuickTestTypeName())) {
row.setQuickTestTypeName(row.getImportQuickTestTypeName().trim());
}
if (oConvertUtils.isEmpty(row.getQuickTestTypeId()) && oConvertUtils.isNotEmpty(row.getQuickTestTypeName())) {
MesXslRubberQuickTestType type = findQuickTestTypeByName(row.getQuickTestTypeName(), row);
if (type == null) {
return "文件导入失败:第 " + rowNo + " 条实验类型【" + row.getQuickTestTypeName() + "】不存在";
}
row.setQuickTestTypeId(type.getId());
}
String typeErr = resolveAndFillQuickTestType(row);
if (typeErr != null) {
return "文件导入失败:第 " + rowNo + "" + typeErr;
}
if (oConvertUtils.isNotEmpty(row.getUnitType())) {
row.setUnitType(row.getUnitType().trim());
}
return null;
}
private String resolveAndFillQuickTestType(MesXslRubberQuickTestDataPoint model) {
if (oConvertUtils.isEmpty(model.getQuickTestTypeId())) {
return "请选择实验类型";
}
MesXslRubberQuickTestType type = mesXslRubberQuickTestTypeService.getById(model.getQuickTestTypeId());
if (type == null) {
return "实验类型不存在或已删除";
}
model.setQuickTestTypeName(type.getTypeName());
return null;
}
private MesXslRubberQuickTestType findQuickTestTypeByName(String typeName, MesXslRubberQuickTestDataPoint context) {
LambdaQueryWrapper<MesXslRubberQuickTestType> w = new LambdaQueryWrapper<>();
w.eq(MesXslRubberQuickTestType::getTypeName, typeName.trim());
w.and(
q ->
q.eq(MesXslRubberQuickTestType::getDelFlag, CommonConstant.DEL_FLAG_0)
.or()
.isNull(MesXslRubberQuickTestType::getDelFlag));
Integer tenantId = context != null ? context.getTenantId() : null;
if (tenantId != null) {
w.eq(MesXslRubberQuickTestType::getTenantId, tenantId);
}
w.last("LIMIT 1");
return mesXslRubberQuickTestTypeService.getOne(w, false);
}
}

View File

@@ -0,0 +1,508 @@
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.HashSet;
import java.util.List;
import java.util.Set;
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.MesXslRubberQuickTestDataPoint;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestDataPointService;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
import org.jeecg.modules.xslmes.vo.MesXslRubberQuickTestMethodPage;
import org.springframework.beans.BeanUtils;
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/mesXslRubberQuickTestMethod")
@Slf4j
public class MesXslRubberQuickTestMethodController
extends JeecgController<MesXslRubberQuickTestMethod, IMesXslRubberQuickTestMethodService> {
@Autowired
private IMesXslRubberQuickTestMethodService mesXslRubberQuickTestMethodService;
@Autowired
private IMesXslRubberQuickTestTypeService mesXslRubberQuickTestTypeService;
@Autowired
private IMesXslRubberQuickTestDataPointService mesXslRubberQuickTestDataPointService;
@Operation(summary = "MES胶料快检实验方法-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslRubberQuickTestMethod>> queryPageList(
MesXslRubberQuickTestMethod model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslRubberQuickTestMethod> queryWrapper =
QueryGenerator.initQueryWrapper(model, req.getParameterMap());
queryWrapper.orderByDesc("create_time");
Page<MesXslRubberQuickTestMethod> page = new Page<>(pageNo, pageSize);
IPage<MesXslRubberQuickTestMethod> pageList = mesXslRubberQuickTestMethodService.page(page, queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "MES胶料快检实验方法-添加")
@Operation(summary = "MES胶料快检实验方法-添加")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody MesXslRubberQuickTestMethodPage page) {
MesXslRubberQuickTestMethod main = new MesXslRubberQuickTestMethod();
BeanUtils.copyProperties(page, main);
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法保存校验与明细从数据点带出-----------
String err = validateForSave(main, page.getLineList(), null);
if (err != null) {
return Result.error(err);
}
//update-end---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法保存校验与明细从数据点带出-----------
try {
mesXslRubberQuickTestMethodService.saveMain(main, page.getLineList());
} catch (Exception e) {
log.error(e.getMessage(), e);
return Result.error(e.getMessage());
}
return Result.OK("添加成功!");
}
@AutoLog(value = "MES胶料快检实验方法-编辑")
@Operation(summary = "MES胶料快检实验方法-编辑")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslRubberQuickTestMethodPage page) {
MesXslRubberQuickTestMethod main = new MesXslRubberQuickTestMethod();
BeanUtils.copyProperties(page, main);
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法保存校验与明细从数据点带出-----------
String err = validateForSave(main, page.getLineList(), main.getId());
if (err != null) {
return Result.error(err);
}
//update-end---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法保存校验与明细从数据点带出-----------
try {
mesXslRubberQuickTestMethodService.updateMain(main, page.getLineList());
} catch (Exception e) {
log.error(e.getMessage(), e);
return Result.error(e.getMessage());
}
return Result.OK("编辑成功!");
}
@AutoLog(value = "MES胶料快检实验方法-删除")
@Operation(summary = "MES胶料快检实验方法-通过id删除")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslRubberQuickTestMethodService.delMain(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "MES胶料快检实验方法-批量删除")
@Operation(summary = "MES胶料快检实验方法-批量删除")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslRubberQuickTestMethodService.delBatchMain(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "MES胶料快检实验方法-通过id查询")
@GetMapping(value = "/queryById")
public Result<MesXslRubberQuickTestMethod> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslRubberQuickTestMethod entity = mesXslRubberQuickTestMethodService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@Operation(summary = "MES胶料快检实验方法-查询明细")
@GetMapping(value = "/queryLineListByMethodId")
public Result<List<MesXslRubberQuickTestMethodLine>> queryLineListByMethodId(
@RequestParam(name = "id", required = true) String id) {
return Result.OK(mesXslRubberQuickTestMethodService.selectLinesByMethodId(id));
}
@Operation(summary = "MES胶料快检实验方法-下一编号")
@GetMapping(value = "/nextMethodCode")
public Result<String> nextMethodCode() {
MesXslRubberQuickTestMethod ctx = new MesXslRubberQuickTestMethod();
return Result.OK(mesXslRubberQuickTestMethodService.generateNextMethodCode(ctx));
}
@Operation(summary = "MES胶料快检实验方法-校验名称唯一")
@GetMapping(value = "/checkMethodName")
public Result<?> checkMethodName(
@RequestParam(name = "methodName") String methodName,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(methodName) || methodName.trim().isEmpty()) {
return Result.OK();
}
MesXslRubberQuickTestMethod ctx = new MesXslRubberQuickTestMethod();
if (mesXslRubberQuickTestMethodService.isMethodNameDuplicated(methodName.trim(), dataId, ctx)) {
return Result.error("实验方法名称已存在");
}
return Result.OK();
}
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberQuickTestMethod model) {
return super.exportXls(request, model, MesXslRubberQuickTestMethod.class, "MES胶料快检实验方法");
}
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_method:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
return super.importExcel(request, response, MesXslRubberQuickTestMethod.class);
}
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法保存校验与明细从数据点带出-----------
private String validateForSave(
MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList, String excludeId) {
if (main == null) {
return "参数不能为空";
}
if (oConvertUtils.isEmpty(main.getMethodName())) {
return "实验方法名称不能为空";
}
main.setMethodName(main.getMethodName().trim());
if (mesXslRubberQuickTestMethodService.isMethodNameDuplicated(main.getMethodName(), excludeId, main)) {
return "实验方法名称已存在";
}
if (oConvertUtils.isEmpty(main.getQuickTestTypeId())) {
return "请选择实验类型";
}
MesXslRubberQuickTestType type = mesXslRubberQuickTestTypeService.getById(main.getQuickTestTypeId());
if (type == null || isDeleted(type.getDelFlag())) {
return "实验类型不存在或已删除";
}
main.setQuickTestTypeName(type.getTypeName());
if (lineList == null || lineList.isEmpty()) {
return "请通过「选择数据点」至少添加一条明细";
}
Set<String> pointIds = new HashSet<>();
int sort = 0;
for (int i = 0; i < lineList.size(); i++) {
MesXslRubberQuickTestMethodLine line = lineList.get(i);
if (line == null) {
continue;
}
int rowNo = i + 1;
if (oConvertUtils.isEmpty(line.getDataPointId())) {
return "" + rowNo + " 行未选择数据点";
}
String pointId = line.getDataPointId().trim();
if (!pointIds.add(pointId)) {
return "" + rowNo + " 行数据点与前面行重复,同一方法中数据点不能重复";
}
MesXslRubberQuickTestDataPoint point = mesXslRubberQuickTestDataPointService.getById(pointId);
if (point == null || isDeleted(point.getDelFlag())) {
return "" + rowNo + " 行数据点不存在或已删除";
}
if (!main.getQuickTestTypeId().equals(point.getQuickTestTypeId())) {
return "" + rowNo + " 行数据点的实验类型与主表实验类型不一致";
}
line.setDataPointId(pointId);
line.setPointName(point.getPointName());
line.setUnitType(point.getUnitType());
if (oConvertUtils.isEmpty(line.getTorqueUnitType())) {
return "" + rowNo + " 行请选择扭矩单位类型";
}
if (oConvertUtils.isEmpty(line.getTimeUnitType())) {
return "" + rowNo + " 行请选择时间单位类型";
}
if (oConvertUtils.isEmpty(line.getMooneyUnitType())) {
return "" + rowNo + " 行请选择门尼单位类型";
}
line.setSortNo(sort++);
}
if (pointIds.isEmpty()) {
return "请通过「选择数据点」至少添加一条明细";
}
return null;
}
private static boolean isDeleted(Integer delFlag) {
return delFlag != null && delFlag.equals(CommonConstant.DEL_FLAG_1);
}
//update-end---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法保存校验与明细从数据点带出-----------
}

View File

@@ -0,0 +1,235 @@
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.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
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.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
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/mesXslRubberQuickTestType")
@Slf4j
public class MesXslRubberQuickTestTypeController
extends JeecgController<MesXslRubberQuickTestType, IMesXslRubberQuickTestTypeService> {
@Autowired
private IMesXslRubberQuickTestTypeService mesXslRubberQuickTestTypeService;
@Operation(summary = "MES胶料快检实验类型-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<MesXslRubberQuickTestType>> queryPageList(
MesXslRubberQuickTestType model,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<MesXslRubberQuickTestType> queryWrapper =
QueryGenerator.initQueryWrapper(model, req.getParameterMap());
Page<MesXslRubberQuickTestType> page = new Page<>(pageNo, pageSize);
IPage<MesXslRubberQuickTestType> pageList = mesXslRubberQuickTestTypeService.page(page, queryWrapper);
return Result.OK(pageList);
}
@AutoLog(value = "MES胶料快检实验类型-添加")
@Operation(summary = "MES胶料快检实验类型-添加")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:add")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody MesXslRubberQuickTestType model) {
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检实验类型新增校验与自动编号-----------
if (oConvertUtils.isEmpty(model.getTypeName()) || model.getTypeName().trim().isEmpty()) {
return Result.error("实验类型名称不能为空");
}
model.setTypeName(model.getTypeName().trim());
if (mesXslRubberQuickTestTypeService.isTypeNameDuplicated(model.getTypeName(), null, model)) {
return Result.error("实验类型名称已存在");
}
model.setTypeCode(null);
try {
mesXslRubberQuickTestTypeService.save(model);
} catch (JeecgBootException e) {
return Result.error(e.getMessage());
}
//update-end---author:jiangxh ---date:20260522 for【MES】胶料快检实验类型新增校验与自动编号-----------
return Result.OK("添加成功!");
}
@AutoLog(value = "MES胶料快检实验类型-编辑")
@Operation(summary = "MES胶料快检实验类型-编辑")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:edit")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody MesXslRubberQuickTestType model) {
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检实验类型编辑仅改名称、编号只读-----------
if (oConvertUtils.isEmpty(model.getId())) {
return Result.error("缺少主键");
}
if (oConvertUtils.isEmpty(model.getTypeName()) || model.getTypeName().trim().isEmpty()) {
return Result.error("实验类型名称不能为空");
}
model.setTypeName(model.getTypeName().trim());
if (mesXslRubberQuickTestTypeService.isTypeNameDuplicated(model.getTypeName(), model.getId(), model)) {
return Result.error("实验类型名称已存在");
}
MesXslRubberQuickTestType old = mesXslRubberQuickTestTypeService.getById(model.getId());
if (old == null) {
return Result.error("未找到对应数据");
}
old.setTypeName(model.getTypeName());
try {
mesXslRubberQuickTestTypeService.updateById(old);
} catch (JeecgBootException e) {
return Result.error(e.getMessage());
}
//update-end---author:jiangxh ---date:20260522 for【MES】胶料快检实验类型编辑仅改名称、编号只读-----------
return Result.OK("编辑成功!");
}
@AutoLog(value = "MES胶料快检实验类型-删除")
@Operation(summary = "MES胶料快检实验类型-通过id删除")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:delete")
@DeleteMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
mesXslRubberQuickTestTypeService.removeById(id);
return Result.OK("删除成功!");
}
@AutoLog(value = "MES胶料快检实验类型-批量删除")
@Operation(summary = "MES胶料快检实验类型-批量删除")
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:deleteBatch")
@DeleteMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
mesXslRubberQuickTestTypeService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
@Operation(summary = "MES胶料快检实验类型-通过id查询")
@GetMapping(value = "/queryById")
public Result<MesXslRubberQuickTestType> queryById(@RequestParam(name = "id", required = true) String id) {
MesXslRubberQuickTestType entity = mesXslRubberQuickTestTypeService.getById(id);
if (entity == null) {
return Result.error("未找到对应数据");
}
return Result.OK(entity);
}
@Operation(summary = "预览下一实验类型编号001起")
@GetMapping(value = "/nextTypeCode")
public Result<String> nextTypeCode() {
MesXslRubberQuickTestType ctx = new MesXslRubberQuickTestType();
return Result.OK(mesXslRubberQuickTestTypeService.generateNextTypeCode(ctx));
}
@Operation(summary = "校验实验类型名称是否重复")
@GetMapping(value = "/checkTypeName")
public Result<String> checkTypeName(
@RequestParam(name = "typeName", required = true) String typeName,
@RequestParam(name = "dataId", required = false) String dataId) {
if (oConvertUtils.isEmpty(typeName) || typeName.trim().isEmpty()) {
return Result.OK("该值可用!");
}
MesXslRubberQuickTestType ctx = new MesXslRubberQuickTestType();
if (mesXslRubberQuickTestTypeService.isTypeNameDuplicated(typeName.trim(), dataId, ctx)) {
return Result.error("该实验类型名称已存在");
}
return Result.OK("该值可用!");
}
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:exportXls")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, MesXslRubberQuickTestType model) {
return super.exportXls(request, model, MesXslRubberQuickTestType.class, "MES胶料快检实验类型");
}
@RequiresPermissions("mes:mes_xsl_rubber_quick_test_type:importExcel")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
//update-begin---author:jiangxh ---date:20260522 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<MesXslRubberQuickTestType> list =
ExcelImportUtil.importExcel(file.getInputStream(), MesXslRubberQuickTestType.class, params);
if (list == null) {
list = List.of();
}
Set<String> namesInFile = new HashSet<>();
for (int i = 0; i < list.size(); i++) {
MesXslRubberQuickTestType row = list.get(i);
int rowNo = i + 1;
if (row == null) {
return Result.error("文件导入失败:第 " + rowNo + " 条数据无效(空行)");
}
if (oConvertUtils.isEmpty(row.getTypeName()) || row.getTypeName().trim().isEmpty()) {
return Result.error("文件导入失败:第 " + rowNo + " 条实验类型名称不能为空");
}
row.setTypeName(row.getTypeName().trim());
if (!namesInFile.add(row.getTypeName())) {
return Result.error("文件导入失败:实验类型名称【" + row.getTypeName() + "】在导入文件中重复");
}
if (mesXslRubberQuickTestTypeService.isTypeNameDuplicated(row.getTypeName(), null, row)) {
return Result.error("文件导入失败:第 " + rowNo + " 条实验类型名称【" + row.getTypeName() + "】已存在");
}
if (oConvertUtils.isNotEmpty(row.getTypeCode())) {
row.setTypeCode(row.getTypeCode().trim());
} else {
row.setTypeCode(null);
}
}
for (MesXslRubberQuickTestType row : list) {
try {
mesXslRubberQuickTestTypeService.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:20260522 for【MES】胶料快检实验类型导入名称必填且不重复编号可空则自动生成-----------
return Result.error("文件导入失败!");
}
}

View File

@@ -0,0 +1,74 @@
package org.jeecg.modules.xslmes.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
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_quick_test_data_point")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES胶料快检数据点")
public class MesXslRubberQuickTestDataPoint implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "数据点名称", width = 24)
@Schema(description = "数据点名称(同租户未删除唯一)")
private String pointName;
@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")
@Schema(description = "实验类型ID")
private String quickTestTypeId;
@Excel(name = "实验类型名称", width = 20)
@Schema(description = "实验类型名称冗余")
private String quickTestTypeName;
@Excel(name = "单位类型", width = 16)
@Schema(description = "单位类型(手填)")
private String unitType;
@Excel(name = "描述", width = 40)
@Schema(description = "描述")
private String pointDesc;
@TableField(exist = false)
@Excel(name = "实验类型名称导入", width = 20)
@Schema(description = "导入用实验类型名称")
private String importQuickTestTypeName;
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;
@TableLogic
@Schema(description = "删除状态0正常 1已删除")
private Integer delFlag;
}

View File

@@ -0,0 +1,104 @@
package org.jeecg.modules.xslmes.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
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.math.BigDecimal;
import java.util.Date;
import java.util.List;
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_quick_test_method")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES胶料快检实验方法")
public class MesXslRubberQuickTestMethod implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "方法编号", width = 14)
@Schema(description = "方法编号租户内从001递增自动生成只读")
private String methodCode;
@Excel(name = "实验方法名称", width = 24)
@Schema(description = "实验方法名称(同租户未删除唯一)")
private String methodName;
@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")
@Schema(description = "实验类型ID")
private String quickTestTypeId;
@Excel(name = "实验类型名称", width = 20)
@Schema(description = "实验类型名称冗余")
private String quickTestTypeName;

View File

@@ -0,0 +1,64 @@
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.springframework.format.annotation.DateTimeFormat;
/**
* MES 胶料快检实验方法明细
*/
@Data
@TableName("mes_xsl_rubber_quick_test_method_line")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES胶料快检实验方法明细")
public class MesXslRubberQuickTestMethodLine implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Schema(description = "主表主键 mes_xsl_rubber_quick_test_method.id")
private String methodId;

View File

@@ -0,0 +1,54 @@
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.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
/**
* MES 胶料快检实验类型
*/
@Data
@TableName("mes_xsl_rubber_quick_test_type")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description = "MES胶料快检实验类型")
public class MesXslRubberQuickTestType implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
@Excel(name = "实验类型编号", width = 16)
@Schema(description = "实验类型编号租户内从001递增自动生成只读")
private String typeCode;
@Excel(name = "实验类型名称", width = 24)
@Schema(description = "实验类型名称")
private String typeName;
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;
@TableLogic
@Schema(description = "删除状态0正常 1已删除")
private Integer delFlag;
}

View File

@@ -0,0 +1,11 @@
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.MesXslRubberQuickTestDataPoint;
/**
* MES 胶料快检数据点 Mapper
*/
@Mapper
public interface MesXslRubberQuickTestDataPointMapper extends BaseMapper<MesXslRubberQuickTestDataPoint> {}

View File

@@ -0,0 +1,8 @@
package org.jeecg.modules.xslmes.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

View File

@@ -0,0 +1,19 @@
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.MesXslRubberQuickTestMethod;
@Mapper
public interface MesXslRubberQuickTestMethodMapper extends BaseMapper<MesXslRubberQuickTestMethod> {

View File

@@ -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.MesXslRubberQuickTestType;
/**
* MES 胶料快检实验类型 Mapper
*/
@Mapper
public interface MesXslRubberQuickTestTypeMapper extends BaseMapper<MesXslRubberQuickTestType> {
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检实验类型租户内最大三位数字编号-----------
@Select(
"SELECT IFNULL(MAX(CAST(type_code AS UNSIGNED)), 0) FROM mes_xsl_rubber_quick_test_type "
+ "WHERE del_flag = 0 AND type_code REGEXP '^[0-9]+$' "
+ "AND (#{tenantId} IS NULL OR tenant_id = #{tenantId})")
Integer selectMaxNumericTypeCode(@Param("tenantId") Integer tenantId);
//update-end---author:jiangxh ---date:20260522 for【MES】胶料快检实验类型租户内最大三位数字编号-----------
}

View File

@@ -0,0 +1,9 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestDataPoint;
public interface IMesXslRubberQuickTestDataPointService extends IService<MesXslRubberQuickTestDataPoint> {
boolean isPointNameDuplicated(String pointName, String excludeId, MesXslRubberQuickTestDataPoint context);
}

View File

@@ -0,0 +1,25 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
public interface IMesXslRubberQuickTestMethodService extends IService<MesXslRubberQuickTestMethod> {
String generateNextMethodCode(MesXslRubberQuickTestMethod context);

View File

@@ -0,0 +1,17 @@
package org.jeecg.modules.xslmes.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
public interface IMesXslRubberQuickTestTypeService extends IService<MesXslRubberQuickTestType> {
/**
* 生成下一实验类型编号001 起,三位数字,租户维度)
*/
String generateNextTypeCode(MesXslRubberQuickTestType context);
/**
* 实验类型名称是否重复(仅未删除数据,同租户)
*/
boolean isTypeNameDuplicated(String typeName, String excludeId, MesXslRubberQuickTestType context);
}

View File

@@ -0,0 +1,94 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.config.TenantContext;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.TokenUtils;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestDataPoint;
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestDataPointMapper;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestDataPointService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class MesXslRubberQuickTestDataPointServiceImpl
extends ServiceImpl<MesXslRubberQuickTestDataPointMapper, MesXslRubberQuickTestDataPoint>
implements IMesXslRubberQuickTestDataPointService {
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检数据点名称同租户唯一-----------
@Override
public boolean isPointNameDuplicated(String pointName, String excludeId, MesXslRubberQuickTestDataPoint context) {
if (oConvertUtils.isEmpty(pointName)) {
return false;
}
Integer tenantId = resolveTenantId(context);
LambdaQueryWrapper<MesXslRubberQuickTestDataPoint> w = new LambdaQueryWrapper<>();
w.eq(MesXslRubberQuickTestDataPoint::getPointName, pointName.trim());
w.and(
q ->
q.eq(MesXslRubberQuickTestDataPoint::getDelFlag, CommonConstant.DEL_FLAG_0)
.or()
.isNull(MesXslRubberQuickTestDataPoint::getDelFlag));
if (oConvertUtils.isNotEmpty(excludeId)) {
w.ne(MesXslRubberQuickTestDataPoint::getId, excludeId);
}
if (tenantId != null) {
w.eq(MesXslRubberQuickTestDataPoint::getTenantId, tenantId);
}
return this.count(w) > 0;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean save(MesXslRubberQuickTestDataPoint entity) {
assertPointNameUniqueForSave(entity, null);
return super.save(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateById(MesXslRubberQuickTestDataPoint entity) {
if (oConvertUtils.isEmpty(entity.getId())) {
throw new JeecgBootException("缺少主键");
}
assertPointNameUniqueForSave(entity, entity.getId());
return super.updateById(entity);
}
private void assertPointNameUniqueForSave(MesXslRubberQuickTestDataPoint entity, String excludeId) {
if (entity == null || oConvertUtils.isEmpty(entity.getPointName())) {
throw new JeecgBootException("数据点名称不能为空");
}
String name = entity.getPointName().trim();
entity.setPointName(name);
if (isPointNameDuplicated(name, excludeId, entity)) {
throw new JeecgBootException("数据点名称已存在");
}
}
private static Integer resolveTenantId(MesXslRubberQuickTestDataPoint context) {
if (context != null && context.getTenantId() != null) {
return context.getTenantId();
}
String ts = TenantContext.getTenant();
if (oConvertUtils.isEmpty(ts)) {
try {
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
} catch (Exception ignored) {
}
}
if (oConvertUtils.isEmpty(ts)) {
return null;
}
try {
return Integer.parseInt(ts.trim());
} catch (NumberFormatException e) {
return null;
}
}
//update-end---author:jiangxh ---date:20260522 for【MES】胶料快检数据点名称同租户唯一-----------
}

View File

@@ -0,0 +1,166 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import org.jeecg.common.config.TenantContext;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.TokenUtils;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethodLine;
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodLineMapper;
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestMethodMapper;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestMethodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
@Service
public class MesXslRubberQuickTestMethodServiceImpl
extends ServiceImpl<MesXslRubberQuickTestMethodMapper, MesXslRubberQuickTestMethod>
implements IMesXslRubberQuickTestMethodService {
@Autowired
private MesXslRubberQuickTestMethodLineMapper mesXslRubberQuickTestMethodLineMapper;
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检实验方法编号001递增、名称同租户唯一、主子保存-----------
@Override
public String generateNextMethodCode(MesXslRubberQuickTestMethod context) {
Integer tenantId = resolveTenantId(context);
Integer max = baseMapper.selectMaxNumericMethodCode(tenantId);
int next = (max == null ? 0 : max) + 1;
if (next > 999) {
throw new IllegalStateException("实验方法编号已超过999请联系管理员");
}
return String.format("%03d", next);
}
@Override
public boolean isMethodNameDuplicated(String methodName, String excludeId, MesXslRubberQuickTestMethod context) {
if (oConvertUtils.isEmpty(methodName)) {
return false;
}
Integer tenantId = resolveTenantId(context);
LambdaQueryWrapper<MesXslRubberQuickTestMethod> w = new LambdaQueryWrapper<>();
w.eq(MesXslRubberQuickTestMethod::getMethodName, methodName.trim());
w.and(
q ->
q.eq(MesXslRubberQuickTestMethod::getDelFlag, CommonConstant.DEL_FLAG_0)
.or()
.isNull(MesXslRubberQuickTestMethod::getDelFlag));
if (oConvertUtils.isNotEmpty(excludeId)) {
w.ne(MesXslRubberQuickTestMethod::getId, excludeId);
}
if (tenantId != null) {
w.eq(MesXslRubberQuickTestMethod::getTenantId, tenantId);
}
return this.count(w) > 0;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveMain(MesXslRubberQuickTestMethod main, List<MesXslRubberQuickTestMethodLine> lineList) {
assertMethodNameUniqueForSave(main, null);
if (oConvertUtils.isEmpty(main.getMethodCode())) {
main.setMethodCode(generateNextMethodCode(main));
}
this.save(main);
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());

View File

@@ -0,0 +1,108 @@
package org.jeecg.modules.xslmes.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.config.TenantContext;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.SpringContextUtils;
import org.jeecg.common.util.TokenUtils;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestType;
import org.jeecg.modules.xslmes.mapper.MesXslRubberQuickTestTypeMapper;
import org.jeecg.modules.xslmes.service.IMesXslRubberQuickTestTypeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class MesXslRubberQuickTestTypeServiceImpl
extends ServiceImpl<MesXslRubberQuickTestTypeMapper, MesXslRubberQuickTestType>
implements IMesXslRubberQuickTestTypeService {
//update-begin---author:jiangxh ---date:20260522 for【MES】胶料快检实验类型编号001递增、名称同租户唯一-----------
@Override
public String generateNextTypeCode(MesXslRubberQuickTestType context) {
Integer tenantId = resolveTenantId(context);
Integer max = baseMapper.selectMaxNumericTypeCode(tenantId);
int next = (max == null ? 0 : max) + 1;
if (next > 999) {
throw new IllegalStateException("实验类型编号已超过999请联系管理员");
}
return String.format("%03d", next);
}
@Override
public boolean isTypeNameDuplicated(String typeName, String excludeId, MesXslRubberQuickTestType context) {
if (oConvertUtils.isEmpty(typeName)) {
return false;
}
Integer tenantId = resolveTenantId(context);
LambdaQueryWrapper<MesXslRubberQuickTestType> w = new LambdaQueryWrapper<>();
w.eq(MesXslRubberQuickTestType::getTypeName, typeName.trim());
w.and(
q ->
q.eq(MesXslRubberQuickTestType::getDelFlag, CommonConstant.DEL_FLAG_0)
.or()
.isNull(MesXslRubberQuickTestType::getDelFlag));
if (oConvertUtils.isNotEmpty(excludeId)) {
w.ne(MesXslRubberQuickTestType::getId, excludeId);
}
if (tenantId != null) {
w.eq(MesXslRubberQuickTestType::getTenantId, tenantId);
}
return this.count(w) > 0;
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean save(MesXslRubberQuickTestType entity) {
assertTypeNameUniqueForSave(entity, null);
if (oConvertUtils.isEmpty(entity.getTypeCode())) {
entity.setTypeCode(generateNextTypeCode(entity));
}
return super.save(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updateById(MesXslRubberQuickTestType entity) {
if (oConvertUtils.isEmpty(entity.getId())) {
throw new JeecgBootException("缺少主键");
}
assertTypeNameUniqueForSave(entity, entity.getId());
return super.updateById(entity);
}
private void assertTypeNameUniqueForSave(MesXslRubberQuickTestType entity, String excludeId) {
if (entity == null || oConvertUtils.isEmpty(entity.getTypeName())) {
throw new JeecgBootException("实验类型名称不能为空");
}
String name = entity.getTypeName().trim();
entity.setTypeName(name);
if (isTypeNameDuplicated(name, excludeId, entity)) {
throw new JeecgBootException("实验类型名称已存在");
}
}
private static Integer resolveTenantId(MesXslRubberQuickTestType context) {
if (context != null && context.getTenantId() != null) {
return context.getTenantId();
}
String ts = TenantContext.getTenant();
if (oConvertUtils.isEmpty(ts)) {
try {
ts = TokenUtils.getTenantIdByRequest(SpringContextUtils.getHttpServletRequest());
} catch (Exception ignored) {
}
}
if (oConvertUtils.isEmpty(ts)) {
return null;
}
try {
return Integer.parseInt(ts.trim());
} catch (NumberFormatException e) {
return null;
}
}
//update-end---author:jiangxh ---date:20260522 for【MES】胶料快检实验类型编号001递增、名称同租户唯一-----------
}

View File

@@ -0,0 +1,12 @@
package org.jeecg.modules.xslmes.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.jeecg.modules.xslmes.entity.MesXslRubberQuickTestMethod;

View File

@@ -418,3 +418,53 @@ jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecor
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/MesXslEquipInspectRecordList.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/components/MesXslEquipInspectRecordModal.vue
jeecgboot-vue3/src/views/xslmes/mesXslEquipInspectRecord/components/MesXslEquipInspectRecordHandleModal.vue
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验类型质量管理目录、001自动编号、CRUD与菜单权限 ---
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_97__mes_xsl_rubber_quick_test_type.sql
jeecg-boot/db/mes-xsl-rubber-quick-test-type-menu-permission.sql
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestType.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestTypeMapper.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestTypeService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestTypeServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestTypeController.java
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestTypeList.vue
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/components/MesXslRubberQuickTestTypeModal.vue
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验方法质量管理菜单、001编号、名称唯一、关联实验类型 ---
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_99__mes_xsl_rubber_quick_test_method.sql
jeecg-boot/db/mes-xsl-rubber-quick-test-method-menu-permission.sql
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestMethod.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestMethodMapper.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestMethodService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestMethodServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestMethodController.java
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList.vue
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethod.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestMethod/components/MesXslRubberQuickTestMethodModal.vue
-- author:jiangxh---date:20260522--for: 【MES】撤销胶料快检实验方法功能删代码+库清理脚本)---
jeecg-boot/db/mes-xsl-rubber-quick-test-method-drop.sql
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_100__drop_mes_xsl_rubber_quick_test_method.sql
(已删除 MesXslRubberQuickTestMethod 后端与前端、mes-xsl-rubber-quick-test-method-menu-permission.sql
-- author:jiangxh---date:20260522--for: 【MES】胶料快检数据点质量管理菜单、名称唯一、关联实验类型、单位手填 ---
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_101__mes_xsl_rubber_quick_test_data_point.sql
jeecg-boot/db/mes-xsl-rubber-quick-test-data-point-menu-permission.sql
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/entity/MesXslRubberQuickTestDataPoint.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/mapper/MesXslRubberQuickTestDataPointMapper.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/IMesXslRubberQuickTestDataPointService.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestDataPointServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestDataPointController.java
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPointList.vue
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.data.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.api.ts
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestDataPoint/components/MesXslRubberQuickTestDataPointModal.vue
-- author:jiangxh---date:20260522--for: 【MES】胶料快检实验类型名称同租户不可重复Service兜底+唯一索引)---
jeecg-boot/jeecg-module-system/jeecg-system-start/src/main/resources/flyway/sql/mysql/V3.9.2_98__mes_xsl_rubber_quick_test_type_name_unique.sql
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/service/impl/MesXslRubberQuickTestTypeServiceImpl.java
jeecg-boot/jeecg-boot-module/jeecg-module-xslmes/src/main/java/org/jeecg/modules/xslmes/controller/MesXslRubberQuickTestTypeController.java
jeecgboot-vue3/src/views/xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestType.data.ts

View File

@@ -0,0 +1,25 @@
-- 撤销胶料快检实验方法 db/mes-xsl-rubber-quick-test-method-drop.sql 一致
SET NAMES utf8mb4;
DELETE FROM `sys_role_permission`
WHERE `permission_id` IN (
'1860000000000000170',
'1860000000000000171', '1860000000000000172', '1860000000000000173',
'1860000000000000174', '1860000000000000175', '1860000000000000176'
);
DELETE FROM `sys_permission`
WHERE `id` IN (
'1860000000000000170',
'1860000000000000171', '1860000000000000172', '1860000000000000173',
'1860000000000000174', '1860000000000000175', '1860000000000000176'
);
DELETE di FROM `sys_dict_item` di
INNER JOIN `sys_dict` d ON di.`dict_id` = d.`id`
WHERE d.`dict_code` = 'xslmes_rubber_quick_test_rotor_type' AND d.`del_flag` = 0;
DELETE FROM `sys_dict`
WHERE `dict_code` = 'xslmes_rubber_quick_test_rotor_type';
DROP TABLE IF EXISTS `mes_xsl_rubber_quick_test_method`;

View File

@@ -0,0 +1,66 @@
-- MES 胶料快检数据点建表 + 菜单质量管理下+ 按钮 + 租户 admin 授权
-- 权限前缀mes:mes_xsl_rubber_quick_test_data_point:*
-- 依赖mes_xsl_rubber_quick_test_type质量管理目录 id 1860000000000000162
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_data_point` (
`id` varchar(32) NOT NULL COMMENT '主键',
`point_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_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
`unit_type` varchar(64) DEFAULT NULL COMMENT '单位类型手填',
`point_desc` varchar(500) DEFAULT 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_mrqtdp_tenant_type` (`tenant_id`, `quick_test_type_id`),
UNIQUE KEY `uk_mrqtdp_tenant_name_del` (`tenant_id`, `point_name`, `del_flag`)
) 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 ('1860000000000000170', @mes_quality_pid, '胶料快检数据点', '/xslmes/mesXslRubberQuickTestDataPoint', 'xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPointList', 'MesXslRubberQuickTestDataPointList', 1, NULL, '1', 2, 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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
UPDATE `sys_permission` SET `icon` = 'ant-design:dot-chart-outlined' WHERE `id` = '1860000000000000170' 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
('1860000000000000171', '1860000000000000170', '新增', 2, 'mes:mes_xsl_rubber_quick_test_data_point:add', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000172', '1860000000000000170', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_data_point:edit', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000173', '1860000000000000170', '删除', 2, 'mes:mes_xsl_rubber_quick_test_data_point:delete', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000174', '1860000000000000170', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_data_point:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000175', '1860000000000000170', '导出', 2, 'mes:mes_xsl_rubber_quick_test_data_point:exportXls', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000176', '1860000000000000170', '导入', 2, 'mes:mes_xsl_rubber_quick_test_data_point: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 (
'1860000000000000170',
'1860000000000000171', '1860000000000000172', '1860000000000000173', '1860000000000000174',
'1860000000000000175', '1860000000000000176'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -0,0 +1,146 @@
-- MES 胶料快检实验方法主子表字典 + 建表 + 菜单质量管理下+ 按钮 + 租户 admin 授权
-- 权限前缀mes:mes_xsl_rubber_quick_test_method:*
-- 菜单 ID 1860000000000000177避免与数据点 170 段冲突
-- 依赖mes_xsl_rubber_quick_test_typemes_xsl_rubber_quick_test_data_point质量管理目录
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_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);
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
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`)
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');
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
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`)
SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW()
FROM `sys_dict` d
CROSS JOIN (
SELECT 'Ib.in' AS txt, 'Ib.in' AS val, 1 AS ord UNION ALL
SELECT 'dNm', 'dNm', 2 UNION ALL
SELECT 'kg.cm', 'kg.cm', 3 UNION ALL
SELECT 'Nm', 'Nm', 4 UNION ALL
SELECT 'mdm', 'mdm', 5
) v
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);
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
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`)
SELECT REPLACE(UUID(), '-', ''), d.id, v.txt, v.val, v.ord, 1, 'admin', NOW()
FROM `sys_dict` d
CROSS JOIN (
SELECT 'sec' AS txt, 'sec' AS val, 1 AS ord UNION ALL
SELECT 'min', 'min', 2 UNION ALL
SELECT 'm:s', 'm:s', 3
) v
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);
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
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`)
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'
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` (
`id` varchar(32) NOT NULL COMMENT '主键',
`method_code` varchar(16) NOT NULL COMMENT '方法编号租户内从001递增自动生成',
`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_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
`test_temp_c` decimal(12,2) DEFAULT NULL COMMENT '实验温度°C',
`preheat_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_freq_hz` decimal(12,2) DEFAULT NULL COMMENT '实验频率Hz',
`rotor_type` varchar(2) DEFAULT NULL COMMENT '转子类型字典xslmes_rubber_quick_test_rotor_type1大转子2小转子',
`rotor_speed_rpm` decimal(12,2) DEFAULT NULL COMMENT '转子速度rpm',
`method_desc` varchar(500) DEFAULT NULL COMMENT '方法描述',
`tenant_id` int DEFAULT NULL COMMENT '租户',

View File

@@ -0,0 +1,86 @@
-- MES 胶料快检实验类型建表 + 质量管理目录 + 子菜单 + 按钮 + 租户 admin 授权
-- 权限前缀mes:mes_xsl_rubber_quick_test_type:*
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_type` (
`id` varchar(32) NOT NULL COMMENT '主键',
`type_code` varchar(16) NOT NULL COMMENT '实验类型编号租户内从001递增自动生成',
`type_name` varchar(128) 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_mrqtt_tenant_code` (`tenant_id`, `type_code`),
KEY `idx_mrqtt_tenant_name` (`tenant_id`, `type_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='MES胶料快检实验类型';
SET @mes_tenant_id = 1002;
SET @mes_root_parent = (
SELECT `parent_id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES基础资料'
LIMIT 1
);
SET @mes_root_parent = IFNULL(@mes_root_parent, (
SELECT `parent_id` FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` = 'MES资料'
LIMIT 1
));
SET @mes_root_parent = IFNULL(@mes_root_parent, '1860000000000000001');
SET @mes_quality_sort = IFNULL((
SELECT `sort_no` + 1 FROM `sys_permission`
WHERE `del_flag` = 0 AND `menu_type` = 0 AND `name` IN ('MES基础资料', 'MES资料', '设备管理')
ORDER BY `sort_no` DESC
LIMIT 1
), 52);
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 ('1860000000000000162', @mes_root_parent, '质量管理', '/xslmes/quality', 'layouts/RouteView', 'MesQualityLayout', 0, NULL, '1', @mes_quality_sort, 1, 0, 0, '1', 0, 0, 0, 'admin', NOW())
ON DUPLICATE KEY UPDATE
`parent_id` = VALUES(`parent_id`), `name` = VALUES(`name`), `url` = VALUES(`url`), `component` = VALUES(`component`),
`menu_type` = VALUES(`menu_type`), `is_leaf` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0;
UPDATE `sys_permission` SET `icon` = 'ant-design:safety-certificate-outlined' WHERE `id` = '1860000000000000162' AND `del_flag` = 0;
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 ('1860000000000000163', '1860000000000000162', '胶料快检实验类型', '/xslmes/mesXslRubberQuickTestType', 'xslmes/mesXslRubberQuickTestType/MesXslRubberQuickTestTypeList', 'MesXslRubberQuickTestTypeList', 1, NULL, '1', 1, 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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
UPDATE `sys_permission` SET `icon` = 'ant-design:experiment-outlined' WHERE `id` = '1860000000000000163' 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
('1860000000000000164', '1860000000000000163', '新增', 2, 'mes:mes_xsl_rubber_quick_test_type:add', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000165', '1860000000000000163', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_type:edit', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000166', '1860000000000000163', '删除', 2, 'mes:mes_xsl_rubber_quick_test_type:delete', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000167', '1860000000000000163', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_type:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000168', '1860000000000000163', '导出', 2, 'mes:mes_xsl_rubber_quick_test_type:exportXls', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000169', '1860000000000000163', '导入', 2, 'mes:mes_xsl_rubber_quick_test_type: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 (
'1860000000000000162',
'1860000000000000163',
'1860000000000000164', '1860000000000000165', '1860000000000000166', '1860000000000000167',
'1860000000000000168', '1860000000000000169'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -0,0 +1,20 @@
-- 胶料快检实验类型同租户未删除数据实验类型名称唯一del_flag 参与唯一键逻辑删除后可复用名称
SET NAMES utf8mb4;
SET @idx_exists = (
SELECT COUNT(1)
FROM information_schema.statistics
WHERE table_schema = DATABASE()
AND table_name = 'mes_xsl_rubber_quick_test_type'
AND index_name = 'uk_mrqtt_tenant_name_del'
);
SET @ddl = IF(
@idx_exists = 0,
'ALTER TABLE `mes_xsl_rubber_quick_test_type` ADD UNIQUE KEY `uk_mrqtt_tenant_name_del` (`tenant_id`, `type_name`, `del_flag`)',
'SELECT 1'
);
PREPARE stmt FROM @ddl;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

View File

@@ -0,0 +1,85 @@
-- MES 胶料快检实验方法字典 + 建表 + 菜单质量管理下+ 按钮 + 租户 admin 授权
-- 权限前缀mes:mes_xsl_rubber_quick_test_method:*
-- 依赖mes_xsl_rubber_quick_test_type质量管理目录 id 1860000000000000162
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_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);
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
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`)
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');
CREATE TABLE IF NOT EXISTS `mes_xsl_rubber_quick_test_method` (
`id` varchar(32) NOT NULL COMMENT '主键',
`method_code` varchar(16) NOT NULL COMMENT '方法编号租户内从001递增自动生成',
`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_name` varchar(128) DEFAULT NULL COMMENT '实验类型名称冗余',
`test_temp_c` decimal(12,2) DEFAULT NULL COMMENT '实验温度°C',
`preheat_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_freq_hz` decimal(12,2) DEFAULT NULL COMMENT '实验频率Hz',
`rotor_type` varchar(2) DEFAULT NULL COMMENT '转子类型字典xslmes_rubber_quick_test_rotor_type1大转子2小转子',
`rotor_speed_rpm` decimal(12,2) DEFAULT NULL COMMENT '转子速度rpm',
`method_desc` varchar(500) DEFAULT 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_mrqtm_tenant_code` (`tenant_id`, `method_code`),
KEY `idx_mrqtm_type` (`quick_test_type_id`),
UNIQUE KEY `uk_mrqtm_tenant_name_del` (`tenant_id`, `method_name`, `del_flag`)
) 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 ('1860000000000000170', @mes_quality_pid, '胶料快检实验方法', '/xslmes/mesXslRubberQuickTestMethod', 'xslmes/mesXslRubberQuickTestMethod/MesXslRubberQuickTestMethodList', 'MesXslRubberQuickTestMethodList', 1, NULL, '1', 2, 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` = 0, `hidden` = 0, `status` = '1', `del_flag` = 0,
`keep_alive` = VALUES(`keep_alive`), `internal_or_external` = VALUES(`internal_or_external`);
UPDATE `sys_permission` SET `icon` = 'ant-design:profile-outlined' WHERE `id` = '1860000000000000170' 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
('1860000000000000171', '1860000000000000170', '新增', 2, 'mes:mes_xsl_rubber_quick_test_method:add', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000172', '1860000000000000170', '编辑', 2, 'mes:mes_xsl_rubber_quick_test_method:edit', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000173', '1860000000000000170', '删除', 2, 'mes:mes_xsl_rubber_quick_test_method:delete', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000174', '1860000000000000170', '批量删除', 2, 'mes:mes_xsl_rubber_quick_test_method:deleteBatch', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000175', '1860000000000000170', '导出', 2, 'mes:mes_xsl_rubber_quick_test_method:exportXls', '1', 1, '1', 0, 'admin', NOW()),
('1860000000000000176', '1860000000000000170', '导入', 2, 'mes:mes_xsl_rubber_quick_test_method: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 (
'1860000000000000170',
'1860000000000000171', '1860000000000000172', '1860000000000000173', '1860000000000000174',
'1860000000000000175', '1860000000000000176'
)
AND NOT EXISTS (
SELECT 1 FROM `sys_role_permission` rp
WHERE rp.`role_id` = r.`id` AND rp.`permission_id` = p.`id`
);

View File

@@ -34,7 +34,7 @@
const selectProps = computed(() => {
let selProps = {
...cellProps.value,
allowClear: true,
allowClear: originColumn.value?.allowClear !== false,
autofocus: true,
defaultOpen: !scrolling.value,
style: { width: '100%' },

View File

@@ -0,0 +1,58 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
list = '/xslmes/mesXslRubberQuickTestDataPoint/list',
checkPointName = '/xslmes/mesXslRubberQuickTestDataPoint/checkPointName',
save = '/xslmes/mesXslRubberQuickTestDataPoint/add',
edit = '/xslmes/mesXslRubberQuickTestDataPoint/edit',
deleteOne = '/xslmes/mesXslRubberQuickTestDataPoint/delete',
deleteBatch = '/xslmes/mesXslRubberQuickTestDataPoint/deleteBatch',
importExcel = '/xslmes/mesXslRubberQuickTestDataPoint/importExcel',
exportXls = '/xslmes/mesXslRubberQuickTestDataPoint/exportXls',
queryById = '/xslmes/mesXslRubberQuickTestDataPoint/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 checkPointName = (params: { pointName: string; dataId?: string }) =>
defHttp.get(
{ url: Api.checkPointName, params },
{
successMessageMode: 'none',
errorMessageMode: '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 });
};

View File

@@ -0,0 +1,85 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { checkPointName } from './MesXslRubberQuickTestDataPoint.api';
export const columns: BasicColumn[] = [
{ title: '数据点名称', align: 'center', dataIndex: 'pointName', width: 160 },
{ title: '实验类型', align: 'center', dataIndex: 'quickTestTypeName', width: 140 },
{ title: '单位类型', align: 'center', dataIndex: 'unitType', width: 120 },
{ title: '描述', align: 'center', dataIndex: 'pointDesc', width: 200, ellipsis: true },
{ title: '创建人', align: 'center', dataIndex: 'createBy', width: 100, defaultHidden: true },
{
title: '创建时间',
align: 'center',
dataIndex: 'createTime',
width: 165,
defaultHidden: true,
customRender: ({ text }) => (!text ? '' : String(text).length > 19 ? String(text).substring(0, 19) : text),
},
];
export const searchFormSchema: FormSchema[] = [
{ label: '数据点名称', field: 'pointName', component: 'Input', colProps: { span: 6 } },
{
label: '实验类型',
field: 'quickTestTypeId',
component: 'JDictSelectTag',
componentProps: {
dictCode: 'mes_xsl_rubber_quick_test_type,type_name,id',
placeholder: '请选择实验类型',
},
colProps: { span: 6 },
},
{ label: '单位类型', field: 'unitType', component: 'Input', colProps: { span: 6 } },
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{
label: '数据点名称',
field: 'pointName',
component: 'Input',
required: true,
componentProps: { placeholder: '同租户内不可重复' },
dynamicRules: ({ model }) => [
{ required: true, message: '请输入数据点名称' },
{
validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim();
if (!v) {
return Promise.resolve();
}
try {
await checkPointName({ pointName: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
const msg = e?.response?.data?.message || e?.message || '数据点名称已存在';
return Promise.reject(msg);
}
},
trigger: ['blur', 'change'],
},
],
},
{
label: '实验类型',
field: 'quickTestTypeId',
component: 'JDictSelectTag',
required: true,
componentProps: {
dictCode: 'mes_xsl_rubber_quick_test_type,type_name,id',
placeholder: '请选择系统维护的实验类型',
},
},
{
label: '单位类型',
field: 'unitType',
component: 'Input',
componentProps: { placeholder: '请手填单位类型,如 mm、MPa、%' },
},
{
label: '描述',
field: 'pointDesc',
component: 'InputTextArea',
componentProps: { rows: 3, placeholder: '请输入描述' },
},
];

View File

@@ -0,0 +1,136 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_data_point:add'"
@click="handleAdd"
preIcon="ant-design:plus-outlined"
>
新增
</a-button>
<a-button
type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_data_point:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<j-upload-button
type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_data_point: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_quick_test_data_point: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_data_point:edit',
},
]"
:dropDownActions="getDropDownAction(record)"
/>
</template>
</BasicTable>
<MesXslRubberQuickTestDataPointModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslRubberQuickTestDataPoint" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import Icon from '/@/components/Icon';
import MesXslRubberQuickTestDataPointModal from './components/MesXslRubberQuickTestDataPointModal.vue';
import { columns, searchFormSchema } from './MesXslRubberQuickTestDataPoint.data';
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberQuickTestDataPoint.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_quick_test_data_point:delete',
},
];
}
</script>

View File

@@ -0,0 +1,50 @@
<template>
<BasicModal @register="registerModal" :title="title" width="640px" 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 '../MesXslRubberQuickTestDataPoint.data';
import { saveOrUpdate } from '../MesXslRubberQuickTestDataPoint.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 });
}
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>

View File

@@ -0,0 +1,64 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
list = '/xslmes/mesXslRubberQuickTestMethod/list',
nextMethodCode = '/xslmes/mesXslRubberQuickTestMethod/nextMethodCode',
checkMethodName = '/xslmes/mesXslRubberQuickTestMethod/checkMethodName',
save = '/xslmes/mesXslRubberQuickTestMethod/add',
edit = '/xslmes/mesXslRubberQuickTestMethod/edit',
deleteOne = '/xslmes/mesXslRubberQuickTestMethod/delete',
deleteBatch = '/xslmes/mesXslRubberQuickTestMethod/deleteBatch',
importExcel = '/xslmes/mesXslRubberQuickTestMethod/importExcel',
exportXls = '/xslmes/mesXslRubberQuickTestMethod/exportXls',
queryById = '/xslmes/mesXslRubberQuickTestMethod/queryById',
queryLineList = '/xslmes/mesXslRubberQuickTestMethod/queryLineListByMethodId',
}
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 queryLineListByMethodId = (params: { id: string }) => defHttp.get({ url: Api.queryLineList, params });
export const fetchNextMethodCode = () => defHttp.get({ url: Api.nextMethodCode }, { successMessageMode: 'none' });
export const checkMethodName = (params: { methodName: string; dataId?: string }) =>
defHttp.get(

View File

@@ -0,0 +1,364 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { JVxeColumn, JVxeTypes } from '/@/components/jeecg/JVxeTable/types';
import { checkMethodName } from './MesXslRubberQuickTestMethod.api';
export const columns: BasicColumn[] = [
{ title: '方法编号', align: 'center', dataIndex: 'methodCode', width: 100 },
{ title: '实验方法名称', align: 'center', dataIndex: 'methodName', width: 180 },
{ title: '实验类型', align: 'center', dataIndex: 'quickTestTypeName', width: 140 },
{ title: '实验温度°C', align: 'center', dataIndex: 'testTempC', width: 110 },
{ title: '预热时间min', align: 'center', dataIndex: 'preheatTimeMin', width: 110 },
{ title: '实验时间min', align: 'center', dataIndex: 'testTimeMin', width: 110 },
{ title: '转子类型', align: 'center', dataIndex: 'rotorType_dictText', width: 90 },
{ 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: 'methodCode', component: 'Input', colProps: { span: 6 } },
{ label: '实验方法名称', field: 'methodName', component: 'Input', colProps: { span: 6 } },
{
label: '实验类型',
field: 'quickTestTypeId',
component: 'JSearchSelect',
componentProps: {
dict: 'mes_xsl_rubber_quick_test_type,type_name,id',
async: true,
},
colProps: { span: 6 },
},
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{
label: '方法编号',
field: 'methodCode',
component: 'Input',
componentProps: { readonly: true, placeholder: '保存时从001起自动生成' },
},
{
label: '实验方法名称',
field: 'methodName',
component: 'Input',
required: true,
componentProps: { placeholder: '同租户内不可重复' },
dynamicRules: ({ model }) => [
{ required: true, message: '请输入实验方法名称' },
{
validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim();
if (!v) {
return Promise.resolve();
}
try {
await checkMethodName({ methodName: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
const msg = e?.response?.data?.message || e?.message || '实验方法名称已存在';
return Promise.reject(msg);
}
},
trigger: ['blur', 'change'],
},
],
},
{
label: '实验类型',
field: 'quickTestTypeId',
component: 'JSearchSelect',
required: true,
componentProps: {
dict: 'mes_xsl_rubber_quick_test_type,type_name,id',
async: true,
placeholder: '请选择实验类型',
},
},
{ label: '', field: 'quickTestTypeName', component: 'Input', show: false },
{
label: '实验温度°C',
field: 'testTempC',
component: 'InputNumber',
componentProps: { style: { width: '100%' }, precision: 2 },
},
{
label: '预热时间min',
field: 'preheatTimeMin',
component: 'InputNumber',
componentProps: { style: { width: '100%' }, precision: 2, min: 0 },
},
{
label: '实验时间min',
field: 'testTimeMin',
component: 'InputNumber',
componentProps: { style: { width: '100%' }, precision: 2, min: 0 },
},
{
label: '实验角度Deg',
field: 'testAngleDeg',
component: 'InputNumber',
componentProps: { style: { width: '100%' }, precision: 2 },
},
{
label: '实验频率Hz',
field: 'testFreqHz',
component: 'InputNumber',
componentProps: { style: { width: '100%' }, precision: 2, min: 0 },
},
{
label: '转子类型',
field: 'rotorType',
component: 'JDictSelectTag',
componentProps: { dictCode: 'xslmes_rubber_quick_test_rotor_type', placeholder: '大转子/小转子' },
},
{
label: '转子速度rpm',
field: 'rotorSpeedRpm',
component: 'InputNumber',
componentProps: { style: { width: '100%' }, precision: 2, min: 0 },
},
{
label: '方法描述',
field: 'methodDesc',
component: 'InputTextArea',
colProps: { span: 24 },
componentProps: { rows: 3, maxlength: 500 },
},
];
/** 明细行单位字典编码(与 Flyway / sys_dict 一致) */
export const LINE_UNIT_DICT_CODES = {
torque: 'xslmes_rubber_quick_test_torque_unit',
time: 'xslmes_rubber_quick_test_time_unit',
mooney: 'xslmes_rubber_quick_test_mooney_unit',
} as const;
/** 字典未加载时的兜底默认值(与字典 sort_order 首项一致) */
export const LINE_UNIT_DICT_FALLBACK = {
torqueUnitType: 'Ib.in',
timeUnitType: 'sec',
mooneyUnitType: 'MU',
};
/** 取字典排序后的第一项 value */
export function pickFirstDictItemValue(items: Recordable[] | null | undefined): string | undefined {
if (!items?.length) {
return undefined;
}
const sorted = [...items].sort(
(a, b) => Number(a.sortOrder ?? a.sort ?? 0) - Number(b.sortOrder ?? b.sort ?? 0),
);
const v = sorted[0]?.value;
return v != null && String(v) !== '' ? String(v) : undefined;
}
export const lineJVxeColumns: JVxeColumn[] = [
{ title: '', key: 'dataPointId', type: JVxeTypes.hidden },
{ title: '数据点', key: 'pointName', type: JVxeTypes.normal, width: 160, disabled: true },
{ title: '单位类型', key: 'unitType', type: JVxeTypes.normal, width: 120, disabled: true },
{
title: '扭矩单位类型',
key: 'torqueUnitType',
type: JVxeTypes.select,
width: 130,
dictCode: 'xslmes_rubber_quick_test_torque_unit',
allowClear: false,
placeholder: '请选择',
validateRules: [{ required: true, message: '${title}不能为空' }],
},
{
title: '时间单位类型',
key: 'timeUnitType',
type: JVxeTypes.select,
width: 120,
dictCode: 'xslmes_rubber_quick_test_time_unit',
allowClear: false,
placeholder: '请选择',
validateRules: [{ required: true, message: '${title}不能为空' }],
},
{
title: '门尼单位类型',
key: 'mooneyUnitType',
type: JVxeTypes.select,
width: 120,
dictCode: 'xslmes_rubber_quick_test_mooney_unit',
allowClear: false,
placeholder: '请选择',
validateRules: [{ required: true, message: '${title}不能为空' }],
},
];

View File

@@ -0,0 +1,136 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_method:add'"
@click="handleAdd"
preIcon="ant-design:plus-outlined"
>
新增
</a-button>
<a-button
type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_method:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</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 #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_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>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import Icon from '/@/components/Icon';
import MesXslRubberQuickTestMethodModal from './components/MesXslRubberQuickTestMethodModal.vue';
import { columns, searchFormSchema } from './MesXslRubberQuickTestMethod.data';
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberQuickTestMethod.api';

View File

@@ -0,0 +1,78 @@
<template>
<BasicModal v-bind="$attrs" :title="modalTitle" :width="1000" @register="registerModal" @ok="handleOk">
<BasicTable @register="registerTable" />
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { BasicTable, useTable } from '/@/components/Table';
import { list } from '/@/views/xslmes/mesXslRubberQuickTestDataPoint/MesXslRubberQuickTestDataPoint.api';
const emit = defineEmits(['register', 'select']);
const filterQuickTestTypeId = ref('');
const selectedRows = ref<Recordable[]>([]);
const modalTitle = computed(() => '选择数据点(可多选)');
function handleSelectionChange(_keys: string[], rows: Recordable[]) {
selectedRows.value = rows || [];
}
function fetchPointPage(params: Recordable) {
const p = { ...params };
if (filterQuickTestTypeId.value) {
p.quickTestTypeId = filterQuickTestTypeId.value;
}
return list(p);
}
const [registerTable, { reload, getSelectRows, clearSelectedRowKeys }] = useTable({
api: fetchPointPage,
columns: [
{ title: '数据点名称', dataIndex: 'pointName', width: 160 },
{ title: '实验类型', dataIndex: 'quickTestTypeName', width: 140 },
{ title: '单位类型', dataIndex: 'unitType', width: 120 },
{ title: '描述', dataIndex: 'pointDesc', width: 200, ellipsis: true },
],

View File

@@ -0,0 +1,478 @@
<template>
<BasicModal
v-bind="$attrs"
destroyOnClose
:title="title"
width="1100px"
@register="registerModal"
@ok="handleSubmit"
>
<BasicForm @register="registerForm" />
<a-divider orientation="left">数据点明细</a-divider>
<JVxeTable
v-if="tableReady"
ref="lineTableRef"
toolbar
row-number
rowSelection
keep-source
:insert-row="false"
:max-height="380"
:loading="lineLoading"
:columns="lineJVxeColumns"
:dataSource="lineDataSource"
:disabled="!showFooterFlag"
:toolbar-config="{ btn: ['remove'], slots: ['suffix'] }"
:add-btn-cfg="{ enabled: false }"
>
<template #toolbarSuffix>
<a-button
v-if="showFooterFlag"
type="primary"
preIcon="ant-design:plus-outlined"
@click="openDataPointSelect"
>
选择数据点
</a-button>
</template>
</JVxeTable>
<MesXslRubberQuickTestDataPointSelectModal @register="registerPointModal" @select="onDataPointsSelect" />
</BasicModal>
</template>
<script lang="ts" setup>
import { computed, ref, unref } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import type { JVxeTableInstance } from '/@/components/jeecg/JVxeTable/types';
import { useMessage } from '/@/hooks/web/useMessage';
import { initDictOptions } from '/@/utils/dict';
import {
formSchema,
lineJVxeColumns,
LINE_UNIT_DICT_CODES,
LINE_UNIT_DICT_FALLBACK,
pickFirstDictItemValue,
} from '../MesXslRubberQuickTestMethod.data';
import {
saveOrUpdate,
queryById,
queryLineListByMethodId,
fetchNextMethodCode,
} from '../MesXslRubberQuickTestMethod.api';
import MesXslRubberQuickTestDataPointSelectModal from './MesXslRubberQuickTestDataPointSelectModal.vue';
const emit = defineEmits(['register', 'success']);
const { createMessage } = useMessage();
const isUpdate = ref(false);
const isDetail = ref(false);
const showFooterFlag = ref(true);
const tableReady = ref(false);
const lineLoading = ref(false);
const lineDataSource = ref<Recordable[]>([]);
const lineTableRef = ref<JVxeTableInstance>();
const defaultLineUnits = ref({ ...LINE_UNIT_DICT_FALLBACK });
async function loadDefaultLineUnits() {
try {
const [torque, time, mooney] = await Promise.all([
initDictOptions(LINE_UNIT_DICT_CODES.torque),
initDictOptions(LINE_UNIT_DICT_CODES.time),
initDictOptions(LINE_UNIT_DICT_CODES.mooney),
]);
defaultLineUnits.value = {
torqueUnitType: pickFirstDictItemValue(torque) ?? LINE_UNIT_DICT_FALLBACK.torqueUnitType,
timeUnitType: pickFirstDictItemValue(time) ?? LINE_UNIT_DICT_FALLBACK.timeUnitType,
mooneyUnitType: pickFirstDictItemValue(mooney) ?? LINE_UNIT_DICT_FALLBACK.mooneyUnitType,
};
} catch {
defaultLineUnits.value = { ...LINE_UNIT_DICT_FALLBACK };
}
}
function applyDefaultLineUnits(row: Recordable): Recordable {
const d = defaultLineUnits.value;
return {
...row,
torqueUnitType: row.torqueUnitType || d.torqueUnitType,
timeUnitType: row.timeUnitType || d.timeUnitType,
mooneyUnitType: row.mooneyUnitType || d.mooneyUnitType,
};
}
const [registerForm, { resetFields, setFieldsValue, validate, setProps, getFieldsValue }] = useForm({
labelWidth: 120,
schemas: formSchema,
showActionButtonGroup: false,
baseColProps: { span: 12 },
});
const [registerPointModal, { openModal: openPointModal }] = useModal();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
tableReady.value = false;
lineDataSource.value = [];
await resetFields();
await loadDefaultLineUnits();
setModalProps({ confirmLoading: false, showCancelBtn: data?.showFooter, showOkBtn: data?.showFooter });
isUpdate.value = !!data?.isUpdate;
isDetail.value = !data?.showFooter;
showFooterFlag.value = !!data?.showFooter;
setProps({ disabled: !data?.showFooter });
if (unref(isUpdate) && data?.record?.id) {
lineLoading.value = true;
try {
const mainRaw = await queryById({ id: data.record.id });
const m = (mainRaw as any)?.id != null ? mainRaw : (mainRaw as any)?.result ?? mainRaw;
const linesRaw = await queryLineListByMethodId({ id: data.record.id });
const list = Array.isArray(linesRaw) ? linesRaw : (linesRaw as any)?.result ?? [];
await setFieldsValue({ ...m });
lineDataSource.value = (list || []).map((row) => applyDefaultLineUnits(row));
} finally {
lineLoading.value = false;
}
} else {
try {
const nextCode = await fetchNextMethodCode();
await setFieldsValue({ methodCode: nextCode });
} catch {
await setFieldsValue({ methodCode: '' });
}
}
tableReady.value = true;
});
const title = computed(() =>
!unref(isUpdate) ? '新增胶料快检实验方法' : unref(isDetail) ? '实验方法详情' : '编辑胶料快检实验方法',
);
function pointToLineRow(point: Recordable) {
const d = defaultLineUnits.value;
return {
dataPointId: point.id,
pointName: point.pointName,
unitType: point.unitType,
torqueUnitType: d.torqueUnitType,
timeUnitType: d.timeUnitType,
mooneyUnitType: d.mooneyUnitType,
};
}
function getExistingPointIds(): Set<string> {
const lineRef = lineTableRef.value as any;
const tableData = (lineRef?.getTableData?.() || lineDataSource.value || []) as Recordable[];
const ids = new Set<string>();
for (const r of tableData) {
if (r?.dataPointId) {
ids.add(String(r.dataPointId));
}
}
return ids;
}
function openDataPointSelect() {
const vals = getFieldsValue();
if (!vals?.quickTestTypeId) {
createMessage.warning('请先选择实验类型');
return;
}
openPointModal(true, { quickTestTypeId: vals.quickTestTypeId });
}
function onDataPointsSelect(payload: Recordable | Recordable[]) {
const points = Array.isArray(payload) ? payload : payload ? [payload] : [];
if (!points.length) {
return;
}
const existing = getExistingPointIds();
const toAdd: Recordable[] = [];
const skipped: string[] = [];
for (const point of points) {
if (!point?.id) {
continue;
}
const id = String(point.id);
if (existing.has(id)) {
skipped.push(point.pointName || id);
continue;
}
existing.add(id);
toAdd.push(pointToLineRow(point));
}
if (!toAdd.length) {
if (skipped.length) {
createMessage.warning('所选数据点均已在明细中,未添加新行');
}
return;
}
const lineRef = lineTableRef.value as any;
if (lineRef?.pushRows) {
lineRef.pushRows(toAdd);
} else {
lineDataSource.value = [...lineDataSource.value, ...toAdd];
}
if (skipped.length) {
createMessage.warning(`已添加 ${toAdd.length} 项,跳过 ${skipped.length} 项重复数据点`);
}
}
async function handleSubmit() {
try {
const values = await validate();
const lineRef = lineTableRef.value as any;
const tableData = (lineRef?.getTableData?.() || []) as Recordable[];
const lineList = tableData
.filter((r) => r && r.dataPointId)
.map((r) => {
const row = applyDefaultLineUnits(r);
return {
dataPointId: row.dataPointId,
pointName: row.pointName,
unitType: row.unitType,
torqueUnitType: row.torqueUnitType,
timeUnitType: row.timeUnitType,
mooneyUnitType: row.mooneyUnitType,
};
});
if (!lineList.length) {
createMessage.warning('请通过「选择数据点」至少添加一条明细');
return;
}
const ids = new Set<string>();
for (const line of lineList) {
if (ids.has(line.dataPointId)) {
createMessage.warning('明细中数据点不能重复');
return;
}
ids.add(line.dataPointId);
}
setModalProps({ confirmLoading: true });
await saveOrUpdate({ ...values, lineList }, unref(isUpdate));
closeModal();
emit('success');
} finally {
setModalProps({ confirmLoading: false });
}
}
</script>

View File

@@ -0,0 +1,61 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage();
enum Api {
list = '/xslmes/mesXslRubberQuickTestType/list',
nextTypeCode = '/xslmes/mesXslRubberQuickTestType/nextTypeCode',
checkTypeName = '/xslmes/mesXslRubberQuickTestType/checkTypeName',
save = '/xslmes/mesXslRubberQuickTestType/add',
edit = '/xslmes/mesXslRubberQuickTestType/edit',
deleteOne = '/xslmes/mesXslRubberQuickTestType/delete',
deleteBatch = '/xslmes/mesXslRubberQuickTestType/deleteBatch',
importExcel = '/xslmes/mesXslRubberQuickTestType/importExcel',
exportXls = '/xslmes/mesXslRubberQuickTestType/exportXls',
queryById = '/xslmes/mesXslRubberQuickTestType/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 fetchNextTypeCode = () => defHttp.get({ url: Api.nextTypeCode }, { successMessageMode: 'none' });
export const checkTypeName = (params: { typeName: string; dataId?: string }) =>
defHttp.get(
{ url: Api.checkTypeName, params },
{
successMessageMode: 'none',
errorMessageMode: '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 });
};

View File

@@ -0,0 +1,64 @@
import { BasicColumn, FormSchema } from '/@/components/Table';
import { checkTypeName } from './MesXslRubberQuickTestType.api';
export const columns: BasicColumn[] = [
{ title: '实验类型编号', align: 'center', dataIndex: 'typeCode', width: 120 },
{ title: '实验类型名称', align: 'center', dataIndex: 'typeName', width: 200 },
{ 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),
},
{ 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: 'typeCode', component: 'Input', colProps: { span: 6 } },
{ label: '实验类型名称', field: 'typeName', component: 'Input', colProps: { span: 6 } },
];
export const formSchema: FormSchema[] = [
{ label: '', field: 'id', component: 'Input', show: false },
{
label: '实验类型编号',
field: 'typeCode',
component: 'Input',
componentProps: { readonly: true, placeholder: '保存时从001起自动生成' },
},
{
label: '实验类型名称',
field: 'typeName',
component: 'Input',
required: true,
componentProps: { placeholder: '同租户内不可重复' },
dynamicRules: ({ model }) => [
{ required: true, message: '请输入实验类型名称' },
{
validator: async (_rule, value) => {
const v = value == null ? '' : String(value).trim();
if (!v) {
return Promise.resolve();
}
try {
await checkTypeName({ typeName: v, dataId: model?.id });
return Promise.resolve();
} catch (e: any) {
const msg = e?.response?.data?.message || e?.message || '实验类型名称已存在';
return Promise.reject(msg);
}
},
trigger: ['blur', 'change'],
},
],
},
];

View File

@@ -0,0 +1,136 @@
<template>
<div>
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<template #tableTitle>
<a-button
type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_type:add'"
@click="handleAdd"
preIcon="ant-design:plus-outlined"
>
新增
</a-button>
<a-button
type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_type:exportXls'"
preIcon="ant-design:export-outlined"
@click="onExportXls"
>
导出
</a-button>
<j-upload-button
type="primary"
v-auth="'mes:mes_xsl_rubber_quick_test_type: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_quick_test_type: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_type:edit',
},
]"
:dropDownActions="getDropDownAction(record)"
/>
</template>
</BasicTable>
<MesXslRubberQuickTestTypeModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" name="xslmes-mesXslRubberQuickTestType" setup>
import { BasicTable, TableAction } from '/@/components/Table';
import { useModal } from '/@/components/Modal';
import { useListPage } from '/@/hooks/system/useListPage';
import Icon from '/@/components/Icon';
import MesXslRubberQuickTestTypeModal from './components/MesXslRubberQuickTestTypeModal.vue';
import { columns, searchFormSchema } from './MesXslRubberQuickTestType.data';
import { list, deleteOne, batchDelete, getExportUrl, getImportUrl } from './MesXslRubberQuickTestType.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_quick_test_type:delete',
},
];
}
</script>

View File

@@ -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 '../MesXslRubberQuickTestType.data';
import { fetchNextTypeCode, saveOrUpdate } from '../MesXslRubberQuickTestType.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 fetchNextTypeCode();
await setFieldsValue({ typeCode: nextCode });
} catch {
await setFieldsValue({ typeCode: '' });
}
}
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>