@peninsula-med/beisen-ehr-plugin 1.1.7 → 1.1.9

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
@@ -6,6 +6,19 @@
6
6
 
7
7
  ### 方式一:一键安装(推荐)
8
8
 
9
+ ```bash
10
+ # 安装插件(自动配置工具 allowlist)
11
+ openclaw plugins install @peninsula-med/beisen-ehr-plugin@latest
12
+
13
+ # 配置凭证(交互式输入)
14
+ npx @peninsula-med/beisen-ehr-configure
15
+
16
+ # 重启 Gateway
17
+ openclaw gateway restart
18
+ ```
19
+
20
+ ✅ 安装时会自动配置工具 allowlist,无需手动编辑配置文件!
21
+
9
22
  ```bash
10
23
  # 1. 安装插件
11
24
  openclaw plugins install @peninsula-med/beisen-ehr-plugin
package/dist/index.cjs.js CHANGED
@@ -3461,7 +3461,7 @@ const Type = TypeBuilder;
3461
3461
  */
3462
3462
  // 插件元数据
3463
3463
  const pluginId = 'beisen-ehr-plugin';
3464
- const pluginVersion = '1.1.7';
3464
+ const pluginVersion = '1.1.9';
3465
3465
  /**
3466
3466
  * 默认配置
3467
3467
  */
@@ -3514,18 +3514,36 @@ class BeisenClient {
3514
3514
  ...(this.config.tenantId && { "tenantId": this.config.tenantId }),
3515
3515
  ...(options.headers || {}),
3516
3516
  };
3517
+ const requestBody = options.body ? JSON.stringify(options.body) : undefined;
3517
3518
  console.error(`📡 请求:${options.method || 'GET'} ${url}`);
3519
+ console.error(`🔑 Token: ${token ? token.substring(0, 20) + '...' : 'none'}`);
3518
3520
  console.error(`🏢 TenantId: ${this.config.tenantId}`);
3519
- const response = await fetch(url, {
3520
- ...options,
3521
- headers,
3522
- body: options.body ? JSON.stringify(options.body) : undefined,
3523
- });
3524
- if (!response.ok) {
3525
- const errorText = await response.text();
3526
- throw new Error(`北森 API 错误:${response.status} - ${errorText}`);
3521
+ if (requestBody) {
3522
+ console.error(`📦 请求体:${requestBody.substring(0, 200)}...`);
3523
+ }
3524
+ const controller = new AbortController();
3525
+ const timeoutId = setTimeout(() => controller.abort(), 30000); // 30 秒超时
3526
+ try {
3527
+ const response = await fetch(url, {
3528
+ ...options,
3529
+ headers,
3530
+ body: requestBody,
3531
+ signal: controller.signal,
3532
+ });
3533
+ clearTimeout(timeoutId);
3534
+ if (!response.ok) {
3535
+ const errorText = await response.text();
3536
+ throw new Error(`北森 API 错误:${response.status} - ${errorText}`);
3537
+ }
3538
+ return response.json();
3539
+ }
3540
+ catch (error) {
3541
+ clearTimeout(timeoutId);
3542
+ if (error.name === 'AbortError') {
3543
+ throw new Error('北森 API 请求超时(30 秒)');
3544
+ }
3545
+ throw error;
3527
3546
  }
3528
- return response.json();
3529
3547
  }
3530
3548
  // 提交加班申请(推送至北森系统并发起审批)
3531
3549
  async submitOvertime(data) {
@@ -3621,7 +3639,9 @@ async function register(api) {
3621
3639
  properties: Type.Optional(Type.String({ description: '自定义字段 JSON 字符串' })),
3622
3640
  }),
3623
3641
  async execute(_id, params) {
3642
+ console.error('🔨 工具调用:beisen_submit_overtime', JSON.stringify(params));
3624
3643
  try {
3644
+ console.error('📡 正在提交加班申请...');
3625
3645
  const result = await client.submitOvertime({
3626
3646
  staffId: config.staffId,
3627
3647
  email: config.email,
@@ -3630,6 +3650,7 @@ async function register(api) {
3630
3650
  compensationType: params.compensationType,
3631
3651
  properties: params.properties,
3632
3652
  });
3653
+ console.error('✅ 加班申请提交成功:', result);
3633
3654
  if (result.code === "200" || result.code === 200) {
3634
3655
  const compTypeText = params.compensationType === 1 ? "加班费" : "调休假";
3635
3656
  return {
@@ -3741,6 +3762,14 @@ async function register(api) {
3741
3762
  },
3742
3763
  });
3743
3764
  console.error('✅ 已注册 4 个工具:beisen_submit_overtime, beisen_get_leave_balance, beisen_query_attendance, beisen_get_approval_status');
3765
+ // 调试:列出所有已注册的工具
3766
+ console.error('🔍 工具注册完成,插件 ID:', pluginId);
3767
+ console.error('🔍 配置:', JSON.stringify({
3768
+ apiUrl: config.apiUrl,
3769
+ staffId: config.staffId,
3770
+ tenantId: config.tenantId,
3771
+ email: config.email,
3772
+ }, null, 2));
3744
3773
  }
3745
3774
  /**
3746
3775
  * 插件停用函数