Browse Source

chore: 补 3 个 personnel 字典(person_type/certificate_type/insurance_status)

前端 personnel/index.vue 用 getDicts() 加载这 3 个字典,但数据库没有,导致下拉框空。
新增:
- person_type: 员工/管理人员/临时工/实习生/外包人员(5 项)
- certificate_type: 操作证/健康证/职业资格证/特种作业证/其他(5 项)
- insurance_status: 未投保/已投保/已过期(3 项)

🤖 Generated with [Claude Code](https://claude.com/claude-code)
yangjingjing 2 days ago
parent
commit
67d97095ad
1 changed files with 45 additions and 0 deletions
  1. 45 0
      sql/risk_personnel_dict.sql

+ 45 - 0
sql/risk_personnel_dict.sql

@@ -0,0 +1,45 @@
+-- ============================================================
+-- 人员管理相关字典(前端用 getDicts() 加载,但数据库没有)
+-- 1. person_type        人员类型
+-- 2. certificate_type   证书类型
+-- 3. insurance_status   保险状态
+-- ============================================================
+
+USE risk_control_platform;
+
+-- ===== 1. 人员类型 =====
+INSERT IGNORE INTO sys_dict_type (dict_name, dict_type, remark, create_by, create_time, update_by, update_time)
+VALUES ('人员类型', 'person_type', '人员信息-人员类型', 1, NOW(), 1, NOW());
+
+INSERT IGNORE INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, remark, create_by, create_time, update_by, update_time) VALUES
+(1, '员工',       '员工',       'person_type', '', 'primary', 'N', '', 1, NOW(), 1, NOW()),
+(2, '管理人员',   '管理人员',   'person_type', '', 'success', 'N', '', 1, NOW(), 1, NOW()),
+(3, '临时工',     '临时工',     'person_type', '', 'info',    'N', '', 1, NOW(), 1, NOW()),
+(4, '实习生',     '实习生',     'person_type', '', 'warning', 'N', '', 1, NOW(), 1, NOW()),
+(5, '外包人员',   '外包人员',   'person_type', '', 'danger',  'N', '', 1, NOW(), 1, NOW());
+
+-- ===== 2. 证书类型 =====
+INSERT IGNORE INTO sys_dict_type (dict_name, dict_type, remark, create_by, create_time, update_by, update_time)
+VALUES ('证书类型', 'certificate_type', '人员证书-证书类型', 1, NOW(), 1, NOW());
+
+INSERT IGNORE INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, remark, create_by, create_time, update_by, update_time) VALUES
+(1, '操作证',     '操作证',     'certificate_type', '', 'primary', 'N', '', 1, NOW(), 1, NOW()),
+(2, '健康证',     '健康证',     'certificate_type', '', 'success', 'N', '', 1, NOW(), 1, NOW()),
+(3, '职业资格证', '职业资格证', 'certificate_type', '', 'warning', 'N', '', 1, NOW(), 1, NOW()),
+(4, '特种作业证', '特种作业证', 'certificate_type', '', 'danger',  'N', '', 1, NOW(), 1, NOW()),
+(5, '其他',       '其他',       'certificate_type', '', 'info',    'N', '', 1, NOW(), 1, NOW());
+
+-- ===== 3. 保险状态 =====
+INSERT IGNORE INTO sys_dict_type (dict_name, dict_type, remark, create_by, create_time, update_by, update_time)
+VALUES ('保险状态', 'insurance_status', '人员信息-保险状态', 1, NOW(), 1, NOW());
+
+INSERT IGNORE INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, remark, create_by, create_time, update_by, update_time) VALUES
+(1, '未投保', '未投保', 'insurance_status', '', 'danger',  'Y', '默认', 1, NOW(), 1, NOW()),
+(2, '已投保', '已投保', 'insurance_status', '', 'success', 'N', '', 1, NOW(), 1, NOW()),
+(3, '已过期', '已过期', 'insurance_status', '', 'warning', 'N', '', 1, NOW(), 1, NOW());
+
+-- 验证
+SELECT '--- 字典统计 ---' AS info;
+SELECT dict_type, COUNT(*) cnt FROM sys_dict_data
+WHERE dict_type IN ('person_type', 'certificate_type', 'insurance_status')
+GROUP BY dict_type;