@cpzxrobot/sdk 1.3.132 → 1.3.134
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/AIFORM_GATEWAY.md +1 -1
- package/aiform_gateway.ts +30 -3
- package/dist/aiform_gateway.js +26 -3
- package/dist/web_platform.js +2 -1
- package/package.json +1 -1
- package/types.d.ts +40 -0
- package/web_platform.ts +2 -1
package/AIFORM_GATEWAY.md
CHANGED
package/aiform_gateway.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
AiformStructTypeResponse,
|
|
21
21
|
AiformStructListResponse,
|
|
22
22
|
AiformStructDetailResponse,
|
|
23
|
+
AiformMetadataResponse,
|
|
23
24
|
} from ".";
|
|
24
25
|
|
|
25
26
|
export class AiformGateway extends Object {
|
|
@@ -560,12 +561,13 @@ export class AiformGateway extends Object {
|
|
|
560
561
|
return {
|
|
561
562
|
/**
|
|
562
563
|
* 按工厂 + structType 查询已落库表头列表
|
|
563
|
-
*
|
|
564
|
+
* POST /api/v2/form/pigfarm/list
|
|
564
565
|
* @param factoryId 工厂ID
|
|
565
566
|
* @param structType 报表结构化类型
|
|
567
|
+
* @param searchParams 搜索条件(可选)
|
|
566
568
|
* @returns Promise 包含表头列表
|
|
567
569
|
*/
|
|
568
|
-
list: async (factoryId: number, structType: string): Promise<AiformStructListResponse> => {
|
|
570
|
+
list: async (factoryId: number, structType: string, searchParams?: object): Promise<AiformStructListResponse> => {
|
|
569
571
|
const axios = await this.context.ready;
|
|
570
572
|
|
|
571
573
|
if (!factoryId) {
|
|
@@ -575,7 +577,7 @@ export class AiformGateway extends Object {
|
|
|
575
577
|
throw new Error('结构化类型不能为空');
|
|
576
578
|
}
|
|
577
579
|
|
|
578
|
-
return axios.
|
|
580
|
+
return axios.post(`/api/v2/form/pigfarm/list`,searchParams, {
|
|
579
581
|
params: {
|
|
580
582
|
factoryId,
|
|
581
583
|
structType
|
|
@@ -656,6 +658,31 @@ export class AiformGateway extends Object {
|
|
|
656
658
|
return res.data;
|
|
657
659
|
});
|
|
658
660
|
},
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* 查询元数据(枚举值、必填字段等)
|
|
664
|
+
* GET /api/v2/form/pigfarm/metadata
|
|
665
|
+
* @param structType 报表结构化类型(如 WEANING)
|
|
666
|
+
* @returns Promise 包含元数据信息
|
|
667
|
+
*/
|
|
668
|
+
metadata: async (structType: string): Promise<AiformMetadataResponse> => {
|
|
669
|
+
const axios = await this.context.ready;
|
|
670
|
+
|
|
671
|
+
if (!structType) {
|
|
672
|
+
throw new Error('结构化类型不能为空');
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
return axios.get(`/api/v2/form/pigfarm/metadata`, {
|
|
676
|
+
params: {
|
|
677
|
+
structType
|
|
678
|
+
}
|
|
679
|
+
}).then((res) => {
|
|
680
|
+
if (res.data.code !== 200) {
|
|
681
|
+
throw new Error(res.data.message || '获取元数据失败');
|
|
682
|
+
}
|
|
683
|
+
return res.data;
|
|
684
|
+
});
|
|
685
|
+
},
|
|
659
686
|
};
|
|
660
687
|
}
|
|
661
688
|
}
|
package/dist/aiform_gateway.js
CHANGED
|
@@ -473,12 +473,13 @@ class AiformGateway extends Object {
|
|
|
473
473
|
return {
|
|
474
474
|
/**
|
|
475
475
|
* 按工厂 + structType 查询已落库表头列表
|
|
476
|
-
*
|
|
476
|
+
* POST /api/v2/form/pigfarm/list
|
|
477
477
|
* @param factoryId 工厂ID
|
|
478
478
|
* @param structType 报表结构化类型
|
|
479
|
+
* @param searchParams 搜索条件(可选)
|
|
479
480
|
* @returns Promise 包含表头列表
|
|
480
481
|
*/
|
|
481
|
-
list: (factoryId, structType) => __awaiter(this, void 0, void 0, function* () {
|
|
482
|
+
list: (factoryId, structType, searchParams) => __awaiter(this, void 0, void 0, function* () {
|
|
482
483
|
const axios = yield this.context.ready;
|
|
483
484
|
if (!factoryId) {
|
|
484
485
|
throw new Error('工厂ID不能为空');
|
|
@@ -486,7 +487,7 @@ class AiformGateway extends Object {
|
|
|
486
487
|
if (!structType) {
|
|
487
488
|
throw new Error('结构化类型不能为空');
|
|
488
489
|
}
|
|
489
|
-
return axios.
|
|
490
|
+
return axios.post(`/api/v2/form/pigfarm/list`, searchParams, {
|
|
490
491
|
params: {
|
|
491
492
|
factoryId,
|
|
492
493
|
structType
|
|
@@ -559,6 +560,28 @@ class AiformGateway extends Object {
|
|
|
559
560
|
return res.data;
|
|
560
561
|
});
|
|
561
562
|
}),
|
|
563
|
+
/**
|
|
564
|
+
* 查询元数据(枚举值、必填字段等)
|
|
565
|
+
* GET /api/v2/form/pigfarm/metadata
|
|
566
|
+
* @param structType 报表结构化类型(如 WEANING)
|
|
567
|
+
* @returns Promise 包含元数据信息
|
|
568
|
+
*/
|
|
569
|
+
metadata: (structType) => __awaiter(this, void 0, void 0, function* () {
|
|
570
|
+
const axios = yield this.context.ready;
|
|
571
|
+
if (!structType) {
|
|
572
|
+
throw new Error('结构化类型不能为空');
|
|
573
|
+
}
|
|
574
|
+
return axios.get(`/api/v2/form/pigfarm/metadata`, {
|
|
575
|
+
params: {
|
|
576
|
+
structType
|
|
577
|
+
}
|
|
578
|
+
}).then((res) => {
|
|
579
|
+
if (res.data.code !== 200) {
|
|
580
|
+
throw new Error(res.data.message || '获取元数据失败');
|
|
581
|
+
}
|
|
582
|
+
return res.data;
|
|
583
|
+
});
|
|
584
|
+
}),
|
|
562
585
|
};
|
|
563
586
|
}
|
|
564
587
|
}
|
package/dist/web_platform.js
CHANGED
|
@@ -194,8 +194,9 @@ class WebPlatform {
|
|
|
194
194
|
return { data: yield response.json() };
|
|
195
195
|
}),
|
|
196
196
|
post: (url, data, config) => __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
url = instance.processQueryParams(url, config);
|
|
197
198
|
const isFormData = data instanceof FormData;
|
|
198
|
-
const response = yield
|
|
199
|
+
const response = yield instance.fetchWithAuth(url, {
|
|
199
200
|
method: 'POST',
|
|
200
201
|
headers: isFormData ? config === null || config === void 0 ? void 0 : config.headers : Object.assign({ 'Content-Type': 'application/json' }, config === null || config === void 0 ? void 0 : config.headers),
|
|
201
202
|
body: isFormData ? data : JSON.stringify(data)
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -1229,6 +1229,44 @@ interface AiformStructDetailResponse {
|
|
|
1229
1229
|
};
|
|
1230
1230
|
}
|
|
1231
1231
|
|
|
1232
|
+
/**
|
|
1233
|
+
* 元数据字段信息接口
|
|
1234
|
+
*/
|
|
1235
|
+
interface AiformMetadataField {
|
|
1236
|
+
/** 字段名 */
|
|
1237
|
+
name: string;
|
|
1238
|
+
/** 字段类型 */
|
|
1239
|
+
type: string;
|
|
1240
|
+
/** 是否必填 */
|
|
1241
|
+
required: boolean;
|
|
1242
|
+
/** 字段描述 */
|
|
1243
|
+
description?: string;
|
|
1244
|
+
/** 枚举值列表(如果有) */
|
|
1245
|
+
enumValues?: {
|
|
1246
|
+
/** 枚举值 */
|
|
1247
|
+
value: string;
|
|
1248
|
+
/** 枚举标签 */
|
|
1249
|
+
label: string;
|
|
1250
|
+
}[];
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* 元数据响应接口
|
|
1255
|
+
*/
|
|
1256
|
+
interface AiformMetadataResponse {
|
|
1257
|
+
/** 响应码 */
|
|
1258
|
+
code: number;
|
|
1259
|
+
/** 提示信息 */
|
|
1260
|
+
message: string;
|
|
1261
|
+
/** 元数据信息 */
|
|
1262
|
+
data: {
|
|
1263
|
+
/** 结构化类型 */
|
|
1264
|
+
structType: string;
|
|
1265
|
+
/** 字段元数据列表 */
|
|
1266
|
+
fields: AiformMetadataField[];
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1232
1270
|
/**
|
|
1233
1271
|
* AI报表模板列表响应接口
|
|
1234
1272
|
*/
|
|
@@ -1501,6 +1539,8 @@ declare module "@cpzxrobot/sdk" {
|
|
|
1501
1539
|
AiformStructTypeResponse,
|
|
1502
1540
|
AiformStructListResponse,
|
|
1503
1541
|
AiformStructDetailResponse,
|
|
1542
|
+
AiformMetadataResponse,
|
|
1543
|
+
AiformMetadataField,
|
|
1504
1544
|
AlarmRuleDetail,
|
|
1505
1545
|
AlarmRuleListResponse,
|
|
1506
1546
|
AlarmRuleDetailResponse,
|
package/web_platform.ts
CHANGED
|
@@ -206,8 +206,9 @@ export class WebPlatform implements PlatformInterface {
|
|
|
206
206
|
return { data: await response.json() };
|
|
207
207
|
},
|
|
208
208
|
post: async (url: string, data?: any, config?: any) => {
|
|
209
|
+
url = instance.processQueryParams(url, config);
|
|
209
210
|
const isFormData = data instanceof FormData;
|
|
210
|
-
const response = await
|
|
211
|
+
const response = await instance.fetchWithAuth(url, {
|
|
211
212
|
method: 'POST',
|
|
212
213
|
headers: isFormData ? config?.headers : {
|
|
213
214
|
'Content-Type': 'application/json',
|