szld-libs 0.2.80 → 0.2.81
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 +2353 -2352
- package/dist/szld-components.umd.js +28 -28
- package/es/utils/method.d.ts +11 -7
- package/es/utils/method.js +42 -41
- package/lib/utils/method.d.ts +11 -7
- package/lib/utils/method.js +42 -41
- package/package.json +1 -1
package/es/utils/method.d.ts
CHANGED
|
@@ -69,25 +69,29 @@ 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
|
*/
|
|
76
|
-
export declare const handleAttrListToObj: (attrList: any[]
|
|
76
|
+
export declare const handleAttrListToObj: (attrList: any[]) => {
|
|
77
|
+
data: {
|
|
78
|
+
asid: any;
|
|
79
|
+
data_list: any[];
|
|
80
|
+
};
|
|
81
|
+
};
|
|
77
82
|
/**
|
|
78
83
|
* 详情属性集列表合并详情数据
|
|
79
84
|
* @param param0
|
|
80
85
|
* @returns
|
|
81
86
|
*/
|
|
82
|
-
export declare const handleAttrListToObjDetail: ({ attrList,
|
|
87
|
+
export declare const handleAttrListToObjDetail: ({ attrList, params, commonRequest, }: {
|
|
83
88
|
attrList: any[];
|
|
84
|
-
|
|
85
|
-
[key: string]: any;
|
|
86
|
-
};
|
|
89
|
+
params: any;
|
|
87
90
|
extra?: {
|
|
88
91
|
[key: string]: any;
|
|
89
92
|
} | undefined;
|
|
90
|
-
|
|
93
|
+
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
94
|
+
}) => Promise<any[]>;
|
|
91
95
|
/**
|
|
92
96
|
* 处理URL选项
|
|
93
97
|
* 将URL中的指定字段拼接为字符串
|
package/es/utils/method.js
CHANGED
|
@@ -299,55 +299,56 @@ function handleKebabToCamel(str) {
|
|
|
299
299
|
return letter.toUpperCase();
|
|
300
300
|
});
|
|
301
301
|
}
|
|
302
|
-
const handleAttrListToObj = (attrList
|
|
302
|
+
const handleAttrListToObj = (attrList) => {
|
|
303
303
|
var _a;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if (item.children && item.children.length > 0 && item.attrtype == 1) {
|
|
315
|
-
attrItem[key] = {
|
|
316
|
-
asid: ((_a2 = item.children[0]) == null ? void 0 : _a2.asid) || "",
|
|
317
|
-
data_list: [],
|
|
318
|
-
data_list_obj: {}
|
|
319
|
-
};
|
|
320
|
-
item.children.forEach((child) => {
|
|
321
|
-
attrItem[key].data_list_obj[child.attrid] = child.attrvalue || "";
|
|
322
|
-
});
|
|
323
|
-
if (num && num > 1) {
|
|
324
|
-
for (let i = 0; i < num; i++) {
|
|
325
|
-
attrItem[key].data_list.push(attrItem[key].data_list_obj);
|
|
326
|
-
}
|
|
304
|
+
function processLevel(arr) {
|
|
305
|
+
const result = {};
|
|
306
|
+
arr.forEach((item) => {
|
|
307
|
+
var _a2, _b;
|
|
308
|
+
const key = `${item.attrid}_${item.attrtype}`;
|
|
309
|
+
if (item.attrtype === 1 && item.children.length > 0) {
|
|
310
|
+
result[key] = {
|
|
311
|
+
asid: ((_b = (_a2 = item.children) == null ? void 0 : _a2[0]) == null ? void 0 : _b.asid) || "",
|
|
312
|
+
data_list: [processLevel(item.children)]
|
|
313
|
+
};
|
|
327
314
|
} else {
|
|
328
|
-
|
|
315
|
+
result[key] = item.attrvalue;
|
|
329
316
|
}
|
|
330
|
-
}
|
|
331
|
-
|
|
317
|
+
});
|
|
318
|
+
return result;
|
|
319
|
+
}
|
|
320
|
+
const asid = ((_a = attrList[0]) == null ? void 0 : _a.asid) || "";
|
|
321
|
+
const dataList = [processLevel(attrList)];
|
|
322
|
+
return {
|
|
323
|
+
data: {
|
|
324
|
+
asid,
|
|
325
|
+
data_list: dataList
|
|
332
326
|
}
|
|
333
|
-
return attrItem;
|
|
334
327
|
};
|
|
335
|
-
attrList.forEach((item) => {
|
|
336
|
-
result.data.data_list.push(processItem2(item));
|
|
337
|
-
});
|
|
338
|
-
result.data.data_list = [Object.assign({}, ...result.data.data_list)];
|
|
339
|
-
return result;
|
|
340
328
|
};
|
|
341
|
-
const handleAttrListToObjDetail = ({
|
|
329
|
+
const handleAttrListToObjDetail = async ({
|
|
342
330
|
attrList,
|
|
343
|
-
|
|
344
|
-
|
|
331
|
+
params,
|
|
332
|
+
commonRequest
|
|
345
333
|
}) => {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
334
|
+
var _a, _b;
|
|
335
|
+
const res = await commonRequest("YLFWLRDataDetails", params);
|
|
336
|
+
const detail = (_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b[0];
|
|
337
|
+
const attr_list = attrList == null ? void 0 : attrList.map((v) => {
|
|
338
|
+
var _a2;
|
|
339
|
+
if (v.attrtype === 1 && ((_a2 = v == null ? void 0 : v.children) == null ? void 0 : _a2.length) && detail) {
|
|
340
|
+
handleAttrListToObjDetail({
|
|
341
|
+
attrList: (v == null ? void 0 : v.children) || [],
|
|
342
|
+
params: (detail == null ? void 0 : detail[v.attrid]) || {},
|
|
343
|
+
commonRequest
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
return {
|
|
347
|
+
...v,
|
|
348
|
+
attrvalue: (detail == null ? void 0 : detail[v.attrid]) || ""
|
|
349
|
+
};
|
|
350
|
+
});
|
|
351
|
+
return attr_list;
|
|
351
352
|
};
|
|
352
353
|
const handleUrlOptions = (val, delimiter, list) => {
|
|
353
354
|
let arr = [];
|
package/lib/utils/method.d.ts
CHANGED
|
@@ -69,25 +69,29 @@ 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
|
*/
|
|
76
|
-
export declare const handleAttrListToObj: (attrList: any[]
|
|
76
|
+
export declare const handleAttrListToObj: (attrList: any[]) => {
|
|
77
|
+
data: {
|
|
78
|
+
asid: any;
|
|
79
|
+
data_list: any[];
|
|
80
|
+
};
|
|
81
|
+
};
|
|
77
82
|
/**
|
|
78
83
|
* 详情属性集列表合并详情数据
|
|
79
84
|
* @param param0
|
|
80
85
|
* @returns
|
|
81
86
|
*/
|
|
82
|
-
export declare const handleAttrListToObjDetail: ({ attrList,
|
|
87
|
+
export declare const handleAttrListToObjDetail: ({ attrList, params, commonRequest, }: {
|
|
83
88
|
attrList: any[];
|
|
84
|
-
|
|
85
|
-
[key: string]: any;
|
|
86
|
-
};
|
|
89
|
+
params: any;
|
|
87
90
|
extra?: {
|
|
88
91
|
[key: string]: any;
|
|
89
92
|
} | undefined;
|
|
90
|
-
|
|
93
|
+
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
94
|
+
}) => Promise<any[]>;
|
|
91
95
|
/**
|
|
92
96
|
* 处理URL选项
|
|
93
97
|
* 将URL中的指定字段拼接为字符串
|
package/lib/utils/method.js
CHANGED
|
@@ -301,55 +301,56 @@ function handleKebabToCamel(str) {
|
|
|
301
301
|
return letter.toUpperCase();
|
|
302
302
|
});
|
|
303
303
|
}
|
|
304
|
-
const handleAttrListToObj = (attrList
|
|
304
|
+
const handleAttrListToObj = (attrList) => {
|
|
305
305
|
var _a;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
if (item.children && item.children.length > 0 && item.attrtype == 1) {
|
|
317
|
-
attrItem[key] = {
|
|
318
|
-
asid: ((_a2 = item.children[0]) == null ? void 0 : _a2.asid) || "",
|
|
319
|
-
data_list: [],
|
|
320
|
-
data_list_obj: {}
|
|
321
|
-
};
|
|
322
|
-
item.children.forEach((child) => {
|
|
323
|
-
attrItem[key].data_list_obj[child.attrid] = child.attrvalue || "";
|
|
324
|
-
});
|
|
325
|
-
if (num && num > 1) {
|
|
326
|
-
for (let i = 0; i < num; i++) {
|
|
327
|
-
attrItem[key].data_list.push(attrItem[key].data_list_obj);
|
|
328
|
-
}
|
|
306
|
+
function processLevel(arr) {
|
|
307
|
+
const result = {};
|
|
308
|
+
arr.forEach((item) => {
|
|
309
|
+
var _a2, _b;
|
|
310
|
+
const key = `${item.attrid}_${item.attrtype}`;
|
|
311
|
+
if (item.attrtype === 1 && item.children.length > 0) {
|
|
312
|
+
result[key] = {
|
|
313
|
+
asid: ((_b = (_a2 = item.children) == null ? void 0 : _a2[0]) == null ? void 0 : _b.asid) || "",
|
|
314
|
+
data_list: [processLevel(item.children)]
|
|
315
|
+
};
|
|
329
316
|
} else {
|
|
330
|
-
|
|
317
|
+
result[key] = item.attrvalue;
|
|
331
318
|
}
|
|
332
|
-
}
|
|
333
|
-
|
|
319
|
+
});
|
|
320
|
+
return result;
|
|
321
|
+
}
|
|
322
|
+
const asid = ((_a = attrList[0]) == null ? void 0 : _a.asid) || "";
|
|
323
|
+
const dataList = [processLevel(attrList)];
|
|
324
|
+
return {
|
|
325
|
+
data: {
|
|
326
|
+
asid,
|
|
327
|
+
data_list: dataList
|
|
334
328
|
}
|
|
335
|
-
return attrItem;
|
|
336
329
|
};
|
|
337
|
-
attrList.forEach((item) => {
|
|
338
|
-
result.data.data_list.push(processItem2(item));
|
|
339
|
-
});
|
|
340
|
-
result.data.data_list = [Object.assign({}, ...result.data.data_list)];
|
|
341
|
-
return result;
|
|
342
330
|
};
|
|
343
|
-
const handleAttrListToObjDetail = ({
|
|
331
|
+
const handleAttrListToObjDetail = async ({
|
|
344
332
|
attrList,
|
|
345
|
-
|
|
346
|
-
|
|
333
|
+
params,
|
|
334
|
+
commonRequest
|
|
347
335
|
}) => {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
336
|
+
var _a, _b;
|
|
337
|
+
const res = await commonRequest("YLFWLRDataDetails", params);
|
|
338
|
+
const detail = (_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b[0];
|
|
339
|
+
const attr_list = attrList == null ? void 0 : attrList.map((v) => {
|
|
340
|
+
var _a2;
|
|
341
|
+
if (v.attrtype === 1 && ((_a2 = v == null ? void 0 : v.children) == null ? void 0 : _a2.length) && detail) {
|
|
342
|
+
handleAttrListToObjDetail({
|
|
343
|
+
attrList: (v == null ? void 0 : v.children) || [],
|
|
344
|
+
params: (detail == null ? void 0 : detail[v.attrid]) || {},
|
|
345
|
+
commonRequest
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
return {
|
|
349
|
+
...v,
|
|
350
|
+
attrvalue: (detail == null ? void 0 : detail[v.attrid]) || ""
|
|
351
|
+
};
|
|
352
|
+
});
|
|
353
|
+
return attr_list;
|
|
353
354
|
};
|
|
354
355
|
const handleUrlOptions = (val, delimiter, list) => {
|
|
355
356
|
let arr = [];
|