szld-libs 0.2.80 → 0.2.82
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 +2355 -2353
- package/dist/szld-components.umd.js +28 -28
- package/es/utils/method.d.ts +11 -7
- package/es/utils/method.js +45 -41
- package/lib/utils/method.d.ts +11 -7
- package/lib/utils/method.js +45 -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
|
@@ -32,6 +32,9 @@ 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
|
+
attrList = handleBaseAttrList(attrList);
|
|
37
|
+
}
|
|
35
38
|
try {
|
|
36
39
|
if ((_a = item == null ? void 0 : item.json) == null ? void 0 : _a["properties-multiple"]) {
|
|
37
40
|
const attrValue = allValues[item.attrid];
|
|
@@ -299,55 +302,56 @@ function handleKebabToCamel(str) {
|
|
|
299
302
|
return letter.toUpperCase();
|
|
300
303
|
});
|
|
301
304
|
}
|
|
302
|
-
const handleAttrListToObj = (attrList
|
|
305
|
+
const handleAttrListToObj = (attrList) => {
|
|
303
306
|
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
|
-
}
|
|
307
|
+
function processLevel(arr) {
|
|
308
|
+
const result = {};
|
|
309
|
+
arr.forEach((item) => {
|
|
310
|
+
var _a2, _b;
|
|
311
|
+
const key = `${item.attrid}_${item.attrtype}`;
|
|
312
|
+
if (item.attrtype === 1 && item.children.length > 0) {
|
|
313
|
+
result[key] = {
|
|
314
|
+
asid: ((_b = (_a2 = item.children) == null ? void 0 : _a2[0]) == null ? void 0 : _b.asid) || "",
|
|
315
|
+
data_list: [processLevel(item.children)]
|
|
316
|
+
};
|
|
327
317
|
} else {
|
|
328
|
-
|
|
318
|
+
result[key] = item.attrvalue;
|
|
329
319
|
}
|
|
330
|
-
}
|
|
331
|
-
|
|
320
|
+
});
|
|
321
|
+
return result;
|
|
322
|
+
}
|
|
323
|
+
const asid = ((_a = attrList[0]) == null ? void 0 : _a.asid) || "";
|
|
324
|
+
const dataList = [processLevel(attrList)];
|
|
325
|
+
return {
|
|
326
|
+
data: {
|
|
327
|
+
asid,
|
|
328
|
+
data_list: dataList
|
|
332
329
|
}
|
|
333
|
-
return attrItem;
|
|
334
330
|
};
|
|
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
331
|
};
|
|
341
|
-
const handleAttrListToObjDetail = ({
|
|
332
|
+
const handleAttrListToObjDetail = async ({
|
|
342
333
|
attrList,
|
|
343
|
-
|
|
344
|
-
|
|
334
|
+
params,
|
|
335
|
+
commonRequest
|
|
345
336
|
}) => {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
337
|
+
var _a, _b;
|
|
338
|
+
const res = await commonRequest("YLFWLRDataDetails", params);
|
|
339
|
+
const detail = (_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b[0];
|
|
340
|
+
const attr_list = attrList == null ? void 0 : attrList.map((v) => {
|
|
341
|
+
var _a2;
|
|
342
|
+
if (v.attrtype === 1 && ((_a2 = v == null ? void 0 : v.children) == null ? void 0 : _a2.length) && detail) {
|
|
343
|
+
handleAttrListToObjDetail({
|
|
344
|
+
attrList: (v == null ? void 0 : v.children) || [],
|
|
345
|
+
params: (detail == null ? void 0 : detail[v.attrid]) || {},
|
|
346
|
+
commonRequest
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
return {
|
|
350
|
+
...v,
|
|
351
|
+
attrvalue: (detail == null ? void 0 : detail[v.attrid]) || ""
|
|
352
|
+
};
|
|
353
|
+
});
|
|
354
|
+
return attr_list;
|
|
351
355
|
};
|
|
352
356
|
const handleUrlOptions = (val, delimiter, list) => {
|
|
353
357
|
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
|
@@ -34,6 +34,9 @@ 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
|
+
attrList = handleBaseAttrList(attrList);
|
|
39
|
+
}
|
|
37
40
|
try {
|
|
38
41
|
if ((_a = item == null ? void 0 : item.json) == null ? void 0 : _a["properties-multiple"]) {
|
|
39
42
|
const attrValue = allValues[item.attrid];
|
|
@@ -301,55 +304,56 @@ function handleKebabToCamel(str) {
|
|
|
301
304
|
return letter.toUpperCase();
|
|
302
305
|
});
|
|
303
306
|
}
|
|
304
|
-
const handleAttrListToObj = (attrList
|
|
307
|
+
const handleAttrListToObj = (attrList) => {
|
|
305
308
|
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
|
-
}
|
|
309
|
+
function processLevel(arr) {
|
|
310
|
+
const result = {};
|
|
311
|
+
arr.forEach((item) => {
|
|
312
|
+
var _a2, _b;
|
|
313
|
+
const key = `${item.attrid}_${item.attrtype}`;
|
|
314
|
+
if (item.attrtype === 1 && item.children.length > 0) {
|
|
315
|
+
result[key] = {
|
|
316
|
+
asid: ((_b = (_a2 = item.children) == null ? void 0 : _a2[0]) == null ? void 0 : _b.asid) || "",
|
|
317
|
+
data_list: [processLevel(item.children)]
|
|
318
|
+
};
|
|
329
319
|
} else {
|
|
330
|
-
|
|
320
|
+
result[key] = item.attrvalue;
|
|
331
321
|
}
|
|
332
|
-
}
|
|
333
|
-
|
|
322
|
+
});
|
|
323
|
+
return result;
|
|
324
|
+
}
|
|
325
|
+
const asid = ((_a = attrList[0]) == null ? void 0 : _a.asid) || "";
|
|
326
|
+
const dataList = [processLevel(attrList)];
|
|
327
|
+
return {
|
|
328
|
+
data: {
|
|
329
|
+
asid,
|
|
330
|
+
data_list: dataList
|
|
334
331
|
}
|
|
335
|
-
return attrItem;
|
|
336
332
|
};
|
|
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
333
|
};
|
|
343
|
-
const handleAttrListToObjDetail = ({
|
|
334
|
+
const handleAttrListToObjDetail = async ({
|
|
344
335
|
attrList,
|
|
345
|
-
|
|
346
|
-
|
|
336
|
+
params,
|
|
337
|
+
commonRequest
|
|
347
338
|
}) => {
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
339
|
+
var _a, _b;
|
|
340
|
+
const res = await commonRequest("YLFWLRDataDetails", params);
|
|
341
|
+
const detail = (_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b[0];
|
|
342
|
+
const attr_list = attrList == null ? void 0 : attrList.map((v) => {
|
|
343
|
+
var _a2;
|
|
344
|
+
if (v.attrtype === 1 && ((_a2 = v == null ? void 0 : v.children) == null ? void 0 : _a2.length) && detail) {
|
|
345
|
+
handleAttrListToObjDetail({
|
|
346
|
+
attrList: (v == null ? void 0 : v.children) || [],
|
|
347
|
+
params: (detail == null ? void 0 : detail[v.attrid]) || {},
|
|
348
|
+
commonRequest
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
return {
|
|
352
|
+
...v,
|
|
353
|
+
attrvalue: (detail == null ? void 0 : detail[v.attrid]) || ""
|
|
354
|
+
};
|
|
355
|
+
});
|
|
356
|
+
return attr_list;
|
|
353
357
|
};
|
|
354
358
|
const handleUrlOptions = (val, delimiter, list) => {
|
|
355
359
|
let arr = [];
|