@peninsula-med/beisen-ehr-plugin 2.2.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,41 +1,37 @@
1
- # 北森 EHR OpenClaw 插件 v2.2.0 🐉
1
+ # 北森 EHR 加班申请插件 v3.0.0 🐉
2
2
 
3
- 完全集成的北森 EHR 插件,自动安装 MCP 服务器。
3
+ 专注功能:**加班申请**
4
4
 
5
5
  ## 一键安装
6
6
 
7
7
  ```bash
8
- # 1. 安装插件(自动安装 MCP 服务器 + 配置)
8
+ # 1. 安装插件
9
9
  openclaw plugins install @peninsula-med/beisen-ehr-plugin@latest
10
10
 
11
- # 2. 配置凭证(交互式输入)
11
+ # 2. 配置凭证
12
12
  npx @peninsula-med/beisen-ehr-configure
13
13
 
14
14
  # 3. 重启
15
15
  openclaw gateway restart
16
16
  ```
17
17
 
18
- **自动完成**:
19
- - 安装 MCP 服务器 (`@peninsula-med/beisen-ehr-mcp`)
20
- - 配置 `mcpServers.beisen-ehr`
21
- - 配置 `tools.allow`
22
-
23
- ## 测试
18
+ ## 使用示例
24
19
 
25
20
  ```
26
- 帮我查一下假期余额
21
+ 申请加班,今天晚上 8 点到 9 点
22
+ 帮我提交一个加班申请,明天上午 9 点到下午 6 点
27
23
  ```
28
24
 
29
- ## 调试
30
-
31
- 查看日志:
32
- ```bash
33
- openclaw gateway logs
34
- ```
25
+ ## 配置说明
35
26
 
36
- 应该看到 `[BEISEN]` 开头的日志。
27
+ 需要北森凭证(联系 IT 管理员获取):
28
+ - App Key
29
+ - App Secret
30
+ - Staff ID
31
+ - Tenant ID
32
+ - 企业邮箱
37
33
 
38
34
  ---
39
35
 
40
- **版本**: 2.2.0
36
+ **版本**: 3.0.0
41
37
  **作者**: 龙二 🐉
package/dist/index.cjs.js CHANGED
@@ -3454,13 +3454,13 @@ var TypeBuilder = /*#__PURE__*/Object.freeze({
3454
3454
  const Type = TypeBuilder;
3455
3455
 
3456
3456
  /**
3457
- * 北森 EHR OpenClaw Plugin v2.0.0
3457
+ * 北森 EHR OpenClaw Plugin v3.0.0
3458
3458
  * 🐉 龙二 开发
3459
3459
  *
3460
- * 完全移除 MCP 依赖,直接注册工具
3460
+ * 专注功能:加班申请
3461
3461
  */
3462
3462
  const pluginId = 'beisen-ehr-plugin';
3463
- const pluginVersion = '2.2.1';
3463
+ const pluginVersion = '3.0.0';
3464
3464
  const defaultConfig = {
3465
3465
  apiUrl: 'https://openapi.italent.cn',
3466
3466
  };
@@ -3556,25 +3556,11 @@ class BeisenClient {
3556
3556
  body: { attendance_overTime: overtimeData },
3557
3557
  });
3558
3558
  }
3559
- async getLeaveBalance(staffId, email) {
3560
- return this.request("/AttendanceOpen/api/v1/LeaveBalance/QueryLeaveBalance", {
3561
- method: "POST",
3562
- body: { staffId, email },
3563
- });
3564
- }
3565
- async getAttendanceRecords(startDate, endDate, employeeId) {
3566
- return this.request("/api/v1/attendance/records", {
3567
- method: "POST",
3568
- body: { startDate, endDate, employeeId },
3569
- });
3570
- }
3571
- async getApprovalStatus(applicationId) {
3572
- return this.request(`/api/v1/approval/${applicationId}/status`);
3573
- }
3574
3559
  }
3575
3560
  // ============ 插件注册 ============
3576
3561
  async function register(api) {
3577
3562
  console.error(`[BEISEN] 🏢 北森 EHR 插件 v${pluginVersion} 正在加载...`);
3563
+ console.error(`[BEISEN] 🎯 功能:加班申请`);
3578
3564
  const config = api.config?.plugins?.entries?.['beisen-ehr-plugin']?.config;
3579
3565
  if (!config || !config.appKey || !config.appSecret || !config.staffId || !config.tenantId || !config.email) {
3580
3566
  console.error('[BEISEN] ⚠️ 插件已安装,但未配置凭证');
@@ -3587,7 +3573,7 @@ async function register(api) {
3587
3573
  console.error(`[BEISEN] 🏢 TenantId: ${config.tenantId}`);
3588
3574
  console.error(`[BEISEN] 📧 Email: ${config.email}`);
3589
3575
  const client = new BeisenClient(config);
3590
- // ============ 注册工具 ============
3576
+ // ============ 注册工具:加班申请 ============
3591
3577
  console.error('[BEISEN] 🔧 正在注册工具...');
3592
3578
  api.registerTool({
3593
3579
  name: 'beisen_submit_overtime',
@@ -3610,6 +3596,7 @@ async function register(api) {
3610
3596
  properties: params.properties,
3611
3597
  });
3612
3598
  const compTypeText = params.compensationType === 1 ? "加班费" : "调休假";
3599
+ console.error(`[BEISEN] ✅ 加班申请提交成功:`, result);
3613
3600
  return {
3614
3601
  content: [{
3615
3602
  type: "text",
@@ -3626,86 +3613,9 @@ async function register(api) {
3626
3613
  }
3627
3614
  },
3628
3615
  });
3629
- api.registerTool({
3630
- name: 'beisen_get_leave_balance',
3631
- description: '查询假期余额(年假、调休假等)',
3632
- parameters: Type.Object({}),
3633
- async execute(_id, _params) {
3634
- console.error(`[BEISEN] 🔨 工具调用:beisen_get_leave_balance`);
3635
- try {
3636
- const result = await client.getLeaveBalance(config.staffId, config.email);
3637
- let balanceText = `📊 假期余额\n\n员工:${config.email}\n\n`;
3638
- if (result.data && Array.isArray(result.data)) {
3639
- result.data.forEach((item) => {
3640
- balanceText += `• ${item.leaveTypeName || item.typeName || '未知'}: ${item.balanceDays || item.balance || 0} 天\n`;
3641
- });
3642
- }
3643
- else {
3644
- balanceText += "暂无数据";
3645
- }
3646
- return { content: [{ type: "text", text: balanceText }] };
3647
- }
3648
- catch (error) {
3649
- console.error(`[BEISEN] ❌ 查询失败:`, error.message);
3650
- return {
3651
- content: [{ type: "text", text: `❌ 查询失败:${error.message}` }],
3652
- isError: true,
3653
- };
3654
- }
3655
- },
3656
- });
3657
- api.registerTool({
3658
- name: 'beisen_query_attendance',
3659
- description: '查询员工考勤记录',
3660
- parameters: Type.Object({
3661
- startDate: Type.String({ description: '开始日期 (YYYY-MM-DD)' }),
3662
- endDate: Type.String({ description: '结束日期 (YYYY-MM-DD)' }),
3663
- }),
3664
- async execute(_id, params) {
3665
- console.error(`[BEISEN] 🔨 工具调用:beisen_query_attendance`, JSON.stringify(params));
3666
- try {
3667
- const records = await client.getAttendanceRecords(params.startDate, params.endDate, config.staffId);
3668
- return {
3669
- content: [{ type: "text", text: `📅 考勤记录\n\n${JSON.stringify(records, null, 2)}` }],
3670
- };
3671
- }
3672
- catch (error) {
3673
- console.error(`[BEISEN] ❌ 查询失败:`, error.message);
3674
- return {
3675
- content: [{ type: "text", text: `❌ 查询失败:${error.message}` }],
3676
- isError: true,
3677
- };
3678
- }
3679
- },
3680
- });
3681
- api.registerTool({
3682
- name: 'beisen_get_approval_status',
3683
- description: '查询审批状态',
3684
- parameters: Type.Object({
3685
- applicationId: Type.String({ description: '申请 ID' }),
3686
- }),
3687
- async execute(_id, params) {
3688
- console.error(`[BEISEN] 🔨 工具调用:beisen_get_approval_status`, JSON.stringify(params));
3689
- try {
3690
- const status = await client.getApprovalStatus(params.applicationId);
3691
- return {
3692
- content: [{
3693
- type: "text",
3694
- text: `📋 审批状态\n\nID: ${params.applicationId}\n状态:${status.status || "未知"}\n审批人:${status.approver || "待分配"}`,
3695
- }],
3696
- };
3697
- }
3698
- catch (error) {
3699
- console.error(`[BEISEN] ❌ 查询失败:`, error.message);
3700
- return {
3701
- content: [{ type: "text", text: `❌ 查询失败:${error.message}` }],
3702
- isError: true,
3703
- };
3704
- }
3705
- },
3706
- });
3707
- console.error('[BEISEN] ✅ 已注册 4 个工具');
3616
+ console.error('[BEISEN] ✅ 已注册 1 个工具:beisen_submit_overtime');
3708
3617
  console.error('[BEISEN] 🎉 插件加载完成,准备就绪!');
3618
+ console.error('[BEISEN] 💡 使用示例:申请加班,今天晚上 8 点到 9 点');
3709
3619
  }
3710
3620
  async function unregister() {
3711
3621
  console.error('[BEISEN] 🏢 插件已停用');