@peninsula-med/beisen-ehr-plugin 2.2.0 → 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/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import { OpenClawPlugin } from 'openclaw/plugin-sdk';
2
2
 
3
3
  /**
4
- * 北森 EHR OpenClaw Plugin v2.0.0
4
+ * 北森 EHR OpenClaw Plugin v3.0.0
5
5
  * 🐉 龙二 开发
6
6
  *
7
- * 完全移除 MCP 依赖,直接注册工具
7
+ * 专注功能:加班申请
8
8
  */
9
9
 
10
10
  declare const pluginId = "beisen-ehr-plugin";
11
- declare const pluginVersion = "2.2.0";
11
+ declare const pluginVersion = "3.0.0";
12
12
  interface BeisenEHRConfig {
13
13
  apiUrl?: string;
14
14
  appKey: string;
package/dist/index.esm.js CHANGED
@@ -3450,13 +3450,13 @@ var TypeBuilder = /*#__PURE__*/Object.freeze({
3450
3450
  const Type = TypeBuilder;
3451
3451
 
3452
3452
  /**
3453
- * 北森 EHR OpenClaw Plugin v2.0.0
3453
+ * 北森 EHR OpenClaw Plugin v3.0.0
3454
3454
  * 🐉 龙二 开发
3455
3455
  *
3456
- * 完全移除 MCP 依赖,直接注册工具
3456
+ * 专注功能:加班申请
3457
3457
  */
3458
3458
  const pluginId = 'beisen-ehr-plugin';
3459
- const pluginVersion = '2.2.0';
3459
+ const pluginVersion = '3.0.0';
3460
3460
  const defaultConfig = {
3461
3461
  apiUrl: 'https://openapi.italent.cn',
3462
3462
  };
@@ -3552,25 +3552,11 @@ class BeisenClient {
3552
3552
  body: { attendance_overTime: overtimeData },
3553
3553
  });
3554
3554
  }
3555
- async getLeaveBalance(staffId, email) {
3556
- return this.request("/AttendanceOpen/api/v1/LeaveBalance/QueryLeaveBalance", {
3557
- method: "POST",
3558
- body: { staffId, email },
3559
- });
3560
- }
3561
- async getAttendanceRecords(startDate, endDate, employeeId) {
3562
- return this.request("/api/v1/attendance/records", {
3563
- method: "POST",
3564
- body: { startDate, endDate, employeeId },
3565
- });
3566
- }
3567
- async getApprovalStatus(applicationId) {
3568
- return this.request(`/api/v1/approval/${applicationId}/status`);
3569
- }
3570
3555
  }
3571
3556
  // ============ 插件注册 ============
3572
3557
  async function register(api) {
3573
3558
  console.error(`[BEISEN] 🏢 北森 EHR 插件 v${pluginVersion} 正在加载...`);
3559
+ console.error(`[BEISEN] 🎯 功能:加班申请`);
3574
3560
  const config = api.config?.plugins?.entries?.['beisen-ehr-plugin']?.config;
3575
3561
  if (!config || !config.appKey || !config.appSecret || !config.staffId || !config.tenantId || !config.email) {
3576
3562
  console.error('[BEISEN] ⚠️ 插件已安装,但未配置凭证');
@@ -3583,7 +3569,7 @@ async function register(api) {
3583
3569
  console.error(`[BEISEN] 🏢 TenantId: ${config.tenantId}`);
3584
3570
  console.error(`[BEISEN] 📧 Email: ${config.email}`);
3585
3571
  const client = new BeisenClient(config);
3586
- // ============ 注册工具 ============
3572
+ // ============ 注册工具:加班申请 ============
3587
3573
  console.error('[BEISEN] 🔧 正在注册工具...');
3588
3574
  api.registerTool({
3589
3575
  name: 'beisen_submit_overtime',
@@ -3606,6 +3592,7 @@ async function register(api) {
3606
3592
  properties: params.properties,
3607
3593
  });
3608
3594
  const compTypeText = params.compensationType === 1 ? "加班费" : "调休假";
3595
+ console.error(`[BEISEN] ✅ 加班申请提交成功:`, result);
3609
3596
  return {
3610
3597
  content: [{
3611
3598
  type: "text",
@@ -3622,86 +3609,9 @@ async function register(api) {
3622
3609
  }
3623
3610
  },
3624
3611
  });
3625
- api.registerTool({
3626
- name: 'beisen_get_leave_balance',
3627
- description: '查询假期余额(年假、调休假等)',
3628
- parameters: Type.Object({}),
3629
- async execute(_id, _params) {
3630
- console.error(`[BEISEN] 🔨 工具调用:beisen_get_leave_balance`);
3631
- try {
3632
- const result = await client.getLeaveBalance(config.staffId, config.email);
3633
- let balanceText = `📊 假期余额\n\n员工:${config.email}\n\n`;
3634
- if (result.data && Array.isArray(result.data)) {
3635
- result.data.forEach((item) => {
3636
- balanceText += `• ${item.leaveTypeName || item.typeName || '未知'}: ${item.balanceDays || item.balance || 0} 天\n`;
3637
- });
3638
- }
3639
- else {
3640
- balanceText += "暂无数据";
3641
- }
3642
- return { content: [{ type: "text", text: balanceText }] };
3643
- }
3644
- catch (error) {
3645
- console.error(`[BEISEN] ❌ 查询失败:`, error.message);
3646
- return {
3647
- content: [{ type: "text", text: `❌ 查询失败:${error.message}` }],
3648
- isError: true,
3649
- };
3650
- }
3651
- },
3652
- });
3653
- api.registerTool({
3654
- name: 'beisen_query_attendance',
3655
- description: '查询员工考勤记录',
3656
- parameters: Type.Object({
3657
- startDate: Type.String({ description: '开始日期 (YYYY-MM-DD)' }),
3658
- endDate: Type.String({ description: '结束日期 (YYYY-MM-DD)' }),
3659
- }),
3660
- async execute(_id, params) {
3661
- console.error(`[BEISEN] 🔨 工具调用:beisen_query_attendance`, JSON.stringify(params));
3662
- try {
3663
- const records = await client.getAttendanceRecords(params.startDate, params.endDate, config.staffId);
3664
- return {
3665
- content: [{ type: "text", text: `📅 考勤记录\n\n${JSON.stringify(records, null, 2)}` }],
3666
- };
3667
- }
3668
- catch (error) {
3669
- console.error(`[BEISEN] ❌ 查询失败:`, error.message);
3670
- return {
3671
- content: [{ type: "text", text: `❌ 查询失败:${error.message}` }],
3672
- isError: true,
3673
- };
3674
- }
3675
- },
3676
- });
3677
- api.registerTool({
3678
- name: 'beisen_get_approval_status',
3679
- description: '查询审批状态',
3680
- parameters: Type.Object({
3681
- applicationId: Type.String({ description: '申请 ID' }),
3682
- }),
3683
- async execute(_id, params) {
3684
- console.error(`[BEISEN] 🔨 工具调用:beisen_get_approval_status`, JSON.stringify(params));
3685
- try {
3686
- const status = await client.getApprovalStatus(params.applicationId);
3687
- return {
3688
- content: [{
3689
- type: "text",
3690
- text: `📋 审批状态\n\nID: ${params.applicationId}\n状态:${status.status || "未知"}\n审批人:${status.approver || "待分配"}`,
3691
- }],
3692
- };
3693
- }
3694
- catch (error) {
3695
- console.error(`[BEISEN] ❌ 查询失败:`, error.message);
3696
- return {
3697
- content: [{ type: "text", text: `❌ 查询失败:${error.message}` }],
3698
- isError: true,
3699
- };
3700
- }
3701
- },
3702
- });
3703
- console.error('[BEISEN] ✅ 已注册 4 个工具');
3612
+ console.error('[BEISEN] ✅ 已注册 1 个工具:beisen_submit_overtime');
3704
3613
  console.error('[BEISEN] 🎉 插件加载完成,准备就绪!');
3614
+ console.error('[BEISEN] 💡 使用示例:申请加班,今天晚上 8 点到 9 点');
3705
3615
  }
3706
3616
  async function unregister() {
3707
3617
  console.error('[BEISEN] 🏢 插件已停用');