szld-libs 0.2.84 → 0.2.86
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/szld-components.es.js +735 -734
- package/dist/szld-components.umd.js +1 -1
- package/es/utils/method.d.ts +8 -5
- package/es/utils/method.js +28 -24
- package/es/utils/szxkFunc.d.ts +16 -0
- package/es/utils/szxkFunc.js +21 -0
- package/lib/utils/method.d.ts +8 -5
- package/lib/utils/method.js +28 -24
- package/lib/utils/szxkFunc.d.ts +16 -0
- package/lib/utils/szxkFunc.js +21 -0
- package/package.json +1 -1
package/es/utils/method.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export declare const handleOperationFile: (params: any, data: any, commonRequest
|
|
|
69
69
|
*/
|
|
70
70
|
export declare function handleKebabToCamel(str: string): string;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* 提交实例化时处理属性列表为提交嵌套格式
|
|
73
73
|
* @param {Array} attrList 原始属性列表
|
|
74
74
|
* @returns {Object} 目标格式的data对象
|
|
75
75
|
*/
|
|
@@ -81,24 +81,27 @@ export declare const handleAttrListToObj: (attrList: any[]) => {
|
|
|
81
81
|
};
|
|
82
82
|
/**
|
|
83
83
|
* 详情属性集列表合并详情数据
|
|
84
|
+
* commonRequest,
|
|
85
|
+
* commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
86
|
+
*
|
|
84
87
|
* @param param0
|
|
85
88
|
* @returns
|
|
86
89
|
*/
|
|
87
|
-
export declare const handleAttrListToObjDetail: ({ attrList, params,
|
|
90
|
+
export declare const handleAttrListToObjDetail: ({ attrList, params, extra, commonRequest, }: {
|
|
88
91
|
attrList: any[];
|
|
89
92
|
params: any;
|
|
90
93
|
extra?: {
|
|
91
94
|
[key: string]: any;
|
|
92
95
|
} | undefined;
|
|
93
96
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
94
|
-
}) => Promise<any
|
|
97
|
+
}) => Promise<any>;
|
|
95
98
|
/**
|
|
96
|
-
* 处理URL选项
|
|
99
|
+
* 处理URL选项 根据远程接口获取下拉、单选、多选数据
|
|
97
100
|
* 将URL中的指定字段拼接为字符串
|
|
98
101
|
*/
|
|
99
102
|
export declare const handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
|
|
100
103
|
/**
|
|
101
|
-
*
|
|
104
|
+
* 根据属性项配置处理成下拉数据
|
|
102
105
|
* @param param0
|
|
103
106
|
* @returns
|
|
104
107
|
*/
|
package/es/utils/method.js
CHANGED
|
@@ -32,10 +32,6 @@ const handleSubmitForm = (originalData, allValues) => {
|
|
|
32
32
|
let uploadedFiles = [];
|
|
33
33
|
const processAttrList = (attrList, item) => {
|
|
34
34
|
var _a;
|
|
35
|
-
if (!(item == null ? void 0 : item.json)) {
|
|
36
|
-
message.error("item?.json不能为空,请使用handleAttrList方法处理初始化渲染表单数据");
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
35
|
try {
|
|
40
36
|
if ((_a = item == null ? void 0 : item.json) == null ? void 0 : _a["properties-multiple"]) {
|
|
41
37
|
const attrValue = allValues[item.attrid];
|
|
@@ -333,29 +329,37 @@ const handleAttrListToObj = (attrList) => {
|
|
|
333
329
|
const handleAttrListToObjDetail = async ({
|
|
334
330
|
attrList,
|
|
335
331
|
params,
|
|
336
|
-
|
|
337
|
-
|
|
332
|
+
extra = {},
|
|
333
|
+
commonRequest
|
|
338
334
|
}) => {
|
|
339
|
-
var _a
|
|
335
|
+
var _a;
|
|
340
336
|
const res = await commonRequest("YLFWLRDataDetails", params);
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
337
|
+
const detailList = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
338
|
+
if (!detailList.length) {
|
|
339
|
+
return attrList.map((v) => ({ ...v, ...extra, attrvalue: "", children: [] }));
|
|
340
|
+
}
|
|
341
|
+
const processedDetailList = await Promise.all(
|
|
342
|
+
detailList.map(async (detail) => {
|
|
343
|
+
const processedAttrList = await Promise.all(
|
|
344
|
+
(attrList == null ? void 0 : attrList.map(async (v) => {
|
|
345
|
+
const currentItem = { ...v, ...extra };
|
|
346
|
+
currentItem.attrvalue = (detail == null ? void 0 : detail[v.attrid]) || "";
|
|
347
|
+
if (v.attrtype === 1 && Array.isArray(v.children) && v.children.length > 0) {
|
|
348
|
+
const childParams = (detail == null ? void 0 : detail[v.attrid]) || {};
|
|
349
|
+
currentItem.children = await handleAttrListToObjDetail({
|
|
350
|
+
attrList: v.children,
|
|
351
|
+
params: childParams,
|
|
352
|
+
extra,
|
|
353
|
+
commonRequest
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
return currentItem;
|
|
357
|
+
})) || []
|
|
358
|
+
);
|
|
359
|
+
return processedAttrList;
|
|
360
|
+
})
|
|
357
361
|
);
|
|
358
|
-
return
|
|
362
|
+
return processedDetailList.length === 1 ? processedDetailList[0] : processedDetailList;
|
|
359
363
|
};
|
|
360
364
|
const handleUrlOptions = (val, delimiter, list) => {
|
|
361
365
|
let arr = [];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param params 请求参数
|
|
5
|
+
* @param commonRequest 通用请求函数
|
|
6
|
+
* @param interfaceType 接口类型,默认值为'YLFWLRDataDetails'
|
|
7
|
+
* @returns 属性集详情 {attrid_attrtype: attrvalue} 格式的数据
|
|
8
|
+
*/
|
|
9
|
+
export declare const handleGetArrtDetail: (params: any, commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>, interfaceType?: string) => Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 单层详情数据对应到单个属性集
|
|
12
|
+
* @param attrList 属性集列表
|
|
13
|
+
* @param detail 属性集详情 {attrid_attrtype: attrvalue} 格式的数据
|
|
14
|
+
* @returns 处理后的属性集列表,每个属性项包含attrvalue
|
|
15
|
+
*/
|
|
16
|
+
export declare const handleObjDetailToSignleAttrList: (attrList: any[], detail: any) => any[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const handleGetArrtDetail = async (params, commonRequest, interfaceType) => {
|
|
2
|
+
var _a;
|
|
3
|
+
try {
|
|
4
|
+
const res = await commonRequest(interfaceType || "YLFWLRDataDetails", params);
|
|
5
|
+
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
6
|
+
return ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
7
|
+
}
|
|
8
|
+
return [];
|
|
9
|
+
} catch (error) {
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const handleObjDetailToSignleAttrList = (attrList, detail) => {
|
|
13
|
+
return attrList.map((item) => ({
|
|
14
|
+
...item,
|
|
15
|
+
attrvalue: detail[item.attrid] || ""
|
|
16
|
+
}));
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
handleGetArrtDetail,
|
|
20
|
+
handleObjDetailToSignleAttrList
|
|
21
|
+
};
|
package/lib/utils/method.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export declare const handleOperationFile: (params: any, data: any, commonRequest
|
|
|
69
69
|
*/
|
|
70
70
|
export declare function handleKebabToCamel(str: string): string;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* 提交实例化时处理属性列表为提交嵌套格式
|
|
73
73
|
* @param {Array} attrList 原始属性列表
|
|
74
74
|
* @returns {Object} 目标格式的data对象
|
|
75
75
|
*/
|
|
@@ -81,24 +81,27 @@ export declare const handleAttrListToObj: (attrList: any[]) => {
|
|
|
81
81
|
};
|
|
82
82
|
/**
|
|
83
83
|
* 详情属性集列表合并详情数据
|
|
84
|
+
* commonRequest,
|
|
85
|
+
* commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
86
|
+
*
|
|
84
87
|
* @param param0
|
|
85
88
|
* @returns
|
|
86
89
|
*/
|
|
87
|
-
export declare const handleAttrListToObjDetail: ({ attrList, params,
|
|
90
|
+
export declare const handleAttrListToObjDetail: ({ attrList, params, extra, commonRequest, }: {
|
|
88
91
|
attrList: any[];
|
|
89
92
|
params: any;
|
|
90
93
|
extra?: {
|
|
91
94
|
[key: string]: any;
|
|
92
95
|
} | undefined;
|
|
93
96
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
94
|
-
}) => Promise<any
|
|
97
|
+
}) => Promise<any>;
|
|
95
98
|
/**
|
|
96
|
-
* 处理URL选项
|
|
99
|
+
* 处理URL选项 根据远程接口获取下拉、单选、多选数据
|
|
97
100
|
* 将URL中的指定字段拼接为字符串
|
|
98
101
|
*/
|
|
99
102
|
export declare const handleUrlOptions: (val: any, delimiter: string, list: any[]) => string;
|
|
100
103
|
/**
|
|
101
|
-
*
|
|
104
|
+
* 根据属性项配置处理成下拉数据
|
|
102
105
|
* @param param0
|
|
103
106
|
* @returns
|
|
104
107
|
*/
|
package/lib/utils/method.js
CHANGED
|
@@ -34,10 +34,6 @@ const handleSubmitForm = (originalData, allValues) => {
|
|
|
34
34
|
let uploadedFiles = [];
|
|
35
35
|
const processAttrList = (attrList, item) => {
|
|
36
36
|
var _a;
|
|
37
|
-
if (!(item == null ? void 0 : item.json)) {
|
|
38
|
-
antd.message.error("item?.json不能为空,请使用handleAttrList方法处理初始化渲染表单数据");
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
37
|
try {
|
|
42
38
|
if ((_a = item == null ? void 0 : item.json) == null ? void 0 : _a["properties-multiple"]) {
|
|
43
39
|
const attrValue = allValues[item.attrid];
|
|
@@ -335,29 +331,37 @@ const handleAttrListToObj = (attrList) => {
|
|
|
335
331
|
const handleAttrListToObjDetail = async ({
|
|
336
332
|
attrList,
|
|
337
333
|
params,
|
|
338
|
-
|
|
339
|
-
|
|
334
|
+
extra = {},
|
|
335
|
+
commonRequest
|
|
340
336
|
}) => {
|
|
341
|
-
var _a
|
|
337
|
+
var _a;
|
|
342
338
|
const res = await commonRequest("YLFWLRDataDetails", params);
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
339
|
+
const detailList = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
340
|
+
if (!detailList.length) {
|
|
341
|
+
return attrList.map((v) => ({ ...v, ...extra, attrvalue: "", children: [] }));
|
|
342
|
+
}
|
|
343
|
+
const processedDetailList = await Promise.all(
|
|
344
|
+
detailList.map(async (detail) => {
|
|
345
|
+
const processedAttrList = await Promise.all(
|
|
346
|
+
(attrList == null ? void 0 : attrList.map(async (v) => {
|
|
347
|
+
const currentItem = { ...v, ...extra };
|
|
348
|
+
currentItem.attrvalue = (detail == null ? void 0 : detail[v.attrid]) || "";
|
|
349
|
+
if (v.attrtype === 1 && Array.isArray(v.children) && v.children.length > 0) {
|
|
350
|
+
const childParams = (detail == null ? void 0 : detail[v.attrid]) || {};
|
|
351
|
+
currentItem.children = await handleAttrListToObjDetail({
|
|
352
|
+
attrList: v.children,
|
|
353
|
+
params: childParams,
|
|
354
|
+
extra,
|
|
355
|
+
commonRequest
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
return currentItem;
|
|
359
|
+
})) || []
|
|
360
|
+
);
|
|
361
|
+
return processedAttrList;
|
|
362
|
+
})
|
|
359
363
|
);
|
|
360
|
-
return
|
|
364
|
+
return processedDetailList.length === 1 ? processedDetailList[0] : processedDetailList;
|
|
361
365
|
};
|
|
362
366
|
const handleUrlOptions = (val, delimiter, list) => {
|
|
363
367
|
let arr = [];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param params 请求参数
|
|
5
|
+
* @param commonRequest 通用请求函数
|
|
6
|
+
* @param interfaceType 接口类型,默认值为'YLFWLRDataDetails'
|
|
7
|
+
* @returns 属性集详情 {attrid_attrtype: attrvalue} 格式的数据
|
|
8
|
+
*/
|
|
9
|
+
export declare const handleGetArrtDetail: (params: any, commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>, interfaceType?: string) => Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 单层详情数据对应到单个属性集
|
|
12
|
+
* @param attrList 属性集列表
|
|
13
|
+
* @param detail 属性集详情 {attrid_attrtype: attrvalue} 格式的数据
|
|
14
|
+
* @returns 处理后的属性集列表,每个属性项包含attrvalue
|
|
15
|
+
*/
|
|
16
|
+
export declare const handleObjDetailToSignleAttrList: (attrList: any[], detail: any) => any[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const handleGetArrtDetail = async (params, commonRequest, interfaceType) => {
|
|
4
|
+
var _a;
|
|
5
|
+
try {
|
|
6
|
+
const res = await commonRequest(interfaceType || "YLFWLRDataDetails", params);
|
|
7
|
+
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
8
|
+
return ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) || [];
|
|
9
|
+
}
|
|
10
|
+
return [];
|
|
11
|
+
} catch (error) {
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const handleObjDetailToSignleAttrList = (attrList, detail) => {
|
|
15
|
+
return attrList.map((item) => ({
|
|
16
|
+
...item,
|
|
17
|
+
attrvalue: detail[item.attrid] || ""
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
exports.handleGetArrtDetail = handleGetArrtDetail;
|
|
21
|
+
exports.handleObjDetailToSignleAttrList = handleObjDetailToSignleAttrList;
|