szld-libs 0.2.83 → 0.2.84

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.
@@ -84,7 +84,7 @@ export declare const handleAttrListToObj: (attrList: any[]) => {
84
84
  * @param param0
85
85
  * @returns
86
86
  */
87
- export declare const handleAttrListToObjDetail: ({ attrList, params, commonRequest, }: {
87
+ export declare const handleAttrListToObjDetail: ({ attrList, params, commonRequest, extra, }: {
88
88
  attrList: any[];
89
89
  params: any;
90
90
  extra?: {
@@ -333,26 +333,29 @@ const handleAttrListToObj = (attrList) => {
333
333
  const handleAttrListToObjDetail = async ({
334
334
  attrList,
335
335
  params,
336
- commonRequest
336
+ commonRequest,
337
+ extra = {}
337
338
  }) => {
338
339
  var _a, _b;
339
340
  const res = await commonRequest("YLFWLRDataDetails", params);
340
- const detail = (_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b[0];
341
- const attr_list = attrList == null ? void 0 : attrList.map((v) => {
342
- var _a2;
343
- if (v.attrtype === 1 && ((_a2 = v == null ? void 0 : v.children) == null ? void 0 : _a2.length) && detail) {
344
- handleAttrListToObjDetail({
345
- attrList: (v == null ? void 0 : v.children) || [],
346
- params: (detail == null ? void 0 : detail[v.attrid]) || {},
347
- commonRequest
348
- });
349
- }
350
- return {
351
- ...v,
352
- attrvalue: (detail == null ? void 0 : detail[v.attrid]) || ""
353
- };
354
- });
355
- return attr_list;
341
+ const detail = ((_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b[0]) || {};
342
+ const processedAttrList = await Promise.all(
343
+ (attrList == null ? void 0 : attrList.map(async (v) => {
344
+ const currentItem = { ...v, ...extra };
345
+ currentItem.attrvalue = (detail == null ? void 0 : detail[v.attrid]) || "";
346
+ if (v.attrtype === 1 && Array.isArray(v.children) && v.children.length > 0) {
347
+ const childParams = (detail == null ? void 0 : detail[v.attrid]) || {};
348
+ currentItem.children = await handleAttrListToObjDetail({
349
+ attrList: v.children,
350
+ params: childParams,
351
+ extra,
352
+ commonRequest
353
+ });
354
+ }
355
+ return currentItem;
356
+ })) || []
357
+ );
358
+ return processedAttrList;
356
359
  };
357
360
  const handleUrlOptions = (val, delimiter, list) => {
358
361
  let arr = [];
@@ -84,7 +84,7 @@ export declare const handleAttrListToObj: (attrList: any[]) => {
84
84
  * @param param0
85
85
  * @returns
86
86
  */
87
- export declare const handleAttrListToObjDetail: ({ attrList, params, commonRequest, }: {
87
+ export declare const handleAttrListToObjDetail: ({ attrList, params, commonRequest, extra, }: {
88
88
  attrList: any[];
89
89
  params: any;
90
90
  extra?: {
@@ -335,26 +335,29 @@ const handleAttrListToObj = (attrList) => {
335
335
  const handleAttrListToObjDetail = async ({
336
336
  attrList,
337
337
  params,
338
- commonRequest
338
+ commonRequest,
339
+ extra = {}
339
340
  }) => {
340
341
  var _a, _b;
341
342
  const res = await commonRequest("YLFWLRDataDetails", params);
342
- const detail = (_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b[0];
343
- const attr_list = attrList == null ? void 0 : attrList.map((v) => {
344
- var _a2;
345
- if (v.attrtype === 1 && ((_a2 = v == null ? void 0 : v.children) == null ? void 0 : _a2.length) && detail) {
346
- handleAttrListToObjDetail({
347
- attrList: (v == null ? void 0 : v.children) || [],
348
- params: (detail == null ? void 0 : detail[v.attrid]) || {},
349
- commonRequest
350
- });
351
- }
352
- return {
353
- ...v,
354
- attrvalue: (detail == null ? void 0 : detail[v.attrid]) || ""
355
- };
356
- });
357
- return attr_list;
343
+ const detail = ((_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b[0]) || {};
344
+ const processedAttrList = await Promise.all(
345
+ (attrList == null ? void 0 : attrList.map(async (v) => {
346
+ const currentItem = { ...v, ...extra };
347
+ currentItem.attrvalue = (detail == null ? void 0 : detail[v.attrid]) || "";
348
+ if (v.attrtype === 1 && Array.isArray(v.children) && v.children.length > 0) {
349
+ const childParams = (detail == null ? void 0 : detail[v.attrid]) || {};
350
+ currentItem.children = await handleAttrListToObjDetail({
351
+ attrList: v.children,
352
+ params: childParams,
353
+ extra,
354
+ commonRequest
355
+ });
356
+ }
357
+ return currentItem;
358
+ })) || []
359
+ );
360
+ return processedAttrList;
358
361
  };
359
362
  const handleUrlOptions = (val, delimiter, list) => {
360
363
  let arr = [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.2.83",
4
+ "version": "0.2.84",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",