szld-libs 0.2.83 → 0.2.85

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?: {
@@ -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,26 +329,29 @@ const handleAttrListToObj = (attrList) => {
333
329
  const handleAttrListToObjDetail = async ({
334
330
  attrList,
335
331
  params,
336
- commonRequest
332
+ commonRequest,
333
+ extra = {}
337
334
  }) => {
338
335
  var _a, _b;
339
336
  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;
337
+ const detail = ((_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b[0]) || {};
338
+ const processedAttrList = await Promise.all(
339
+ (attrList == null ? void 0 : attrList.map(async (v) => {
340
+ const currentItem = { ...v, ...extra };
341
+ currentItem.attrvalue = (detail == null ? void 0 : detail[v.attrid]) || "";
342
+ if (v.attrtype === 1 && Array.isArray(v.children) && v.children.length > 0) {
343
+ const childParams = (detail == null ? void 0 : detail[v.attrid]) || {};
344
+ currentItem.children = await handleAttrListToObjDetail({
345
+ attrList: v.children,
346
+ params: childParams,
347
+ extra,
348
+ commonRequest
349
+ });
350
+ }
351
+ return currentItem;
352
+ })) || []
353
+ );
354
+ return processedAttrList;
356
355
  };
357
356
  const handleUrlOptions = (val, delimiter, list) => {
358
357
  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?: {
@@ -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,26 +331,29 @@ const handleAttrListToObj = (attrList) => {
335
331
  const handleAttrListToObjDetail = async ({
336
332
  attrList,
337
333
  params,
338
- commonRequest
334
+ commonRequest,
335
+ extra = {}
339
336
  }) => {
340
337
  var _a, _b;
341
338
  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;
339
+ const detail = ((_b = (_a = res == null ? void 0 : res.data) == null ? void 0 : _a.list) == null ? void 0 : _b[0]) || {};
340
+ const processedAttrList = await Promise.all(
341
+ (attrList == null ? void 0 : attrList.map(async (v) => {
342
+ const currentItem = { ...v, ...extra };
343
+ currentItem.attrvalue = (detail == null ? void 0 : detail[v.attrid]) || "";
344
+ if (v.attrtype === 1 && Array.isArray(v.children) && v.children.length > 0) {
345
+ const childParams = (detail == null ? void 0 : detail[v.attrid]) || {};
346
+ currentItem.children = await handleAttrListToObjDetail({
347
+ attrList: v.children,
348
+ params: childParams,
349
+ extra,
350
+ commonRequest
351
+ });
352
+ }
353
+ return currentItem;
354
+ })) || []
355
+ );
356
+ return processedAttrList;
358
357
  };
359
358
  const handleUrlOptions = (val, delimiter, list) => {
360
359
  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.85",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",