szld-libs 0.2.82 → 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?: {
@@ -33,7 +33,8 @@ const handleSubmitForm = (originalData, allValues) => {
33
33
  const processAttrList = (attrList, item) => {
34
34
  var _a;
35
35
  if (!(item == null ? void 0 : item.json)) {
36
- attrList = handleBaseAttrList(attrList);
36
+ message.error("item?.json不能为空,请使用handleAttrList方法处理初始化渲染表单数据");
37
+ return;
37
38
  }
38
39
  try {
39
40
  if ((_a = item == null ? void 0 : item.json) == null ? void 0 : _a["properties-multiple"]) {
@@ -332,26 +333,29 @@ const handleAttrListToObj = (attrList) => {
332
333
  const handleAttrListToObjDetail = async ({
333
334
  attrList,
334
335
  params,
335
- commonRequest
336
+ commonRequest,
337
+ extra = {}
336
338
  }) => {
337
339
  var _a, _b;
338
340
  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;
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;
355
359
  };
356
360
  const handleUrlOptions = (val, delimiter, list) => {
357
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?: {
@@ -35,7 +35,8 @@ const handleSubmitForm = (originalData, allValues) => {
35
35
  const processAttrList = (attrList, item) => {
36
36
  var _a;
37
37
  if (!(item == null ? void 0 : item.json)) {
38
- attrList = handleBaseAttrList(attrList);
38
+ antd.message.error("item?.json不能为空,请使用handleAttrList方法处理初始化渲染表单数据");
39
+ return;
39
40
  }
40
41
  try {
41
42
  if ((_a = item == null ? void 0 : item.json) == null ? void 0 : _a["properties-multiple"]) {
@@ -334,26 +335,29 @@ const handleAttrListToObj = (attrList) => {
334
335
  const handleAttrListToObjDetail = async ({
335
336
  attrList,
336
337
  params,
337
- commonRequest
338
+ commonRequest,
339
+ extra = {}
338
340
  }) => {
339
341
  var _a, _b;
340
342
  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;
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;
357
361
  };
358
362
  const handleUrlOptions = (val, delimiter, list) => {
359
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.82",
4
+ "version": "0.2.84",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",