szld-libs 0.2.90 → 0.2.91

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.
@@ -12,7 +12,6 @@ const RadioCard = require("./radioCard");
12
12
  const MySelect = require("./mySelect");
13
13
  const MyUpload = require("./myUpload");
14
14
  const MyRadio = require("./myRadio");
15
- const _ = require("lodash");
16
15
  const icons = require("@ant-design/icons");
17
16
  const antd = require("antd");
18
17
  dayjs.extend(isoWeek);
@@ -152,7 +151,7 @@ function useDynamicForm(props) {
152
151
  ) }) || /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: ((_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["instruction-color"]) ?? "red" }, children: (_e = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _e.instruction })
153
152
  ] });
154
153
  };
155
- const handleRenderFunc = react.useCallback(
154
+ const renderNestedFormList = react.useCallback(
156
155
  ({
157
156
  itemWithJson,
158
157
  colNum = 1,
@@ -163,80 +162,67 @@ function useDynamicForm(props) {
163
162
  relatedid,
164
163
  form,
165
164
  defaultWidth = 358,
166
- isFormListItem = false,
167
- formListField,
165
+ parentFormListField,
168
166
  isShowLabel = true
169
167
  }) => {
170
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
171
- const isFormList = (_a = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a["properties-multiple"];
172
- let formListInitValue = [];
173
- if (isFormList) {
174
- formListInitValue = func.handleSetFormItemInitialValue(itemWithJson);
168
+ const formListInitValue = func.handleSetFormItemInitialValue(itemWithJson);
169
+ let children = itemWithJson.children || [];
170
+ if (Array.isArray(children == null ? void 0 : children[0]) && children.length) {
171
+ children = children[0];
175
172
  }
176
- if (((_b = itemWithJson.json) == null ? void 0 : _b.hide) === true || (hideAttrList == null ? void 0 : hideAttrList.includes(itemWithJson.attrid))) {
177
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
178
- }
179
- if (itemWithJson.attrtype === 1) {
180
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
181
- antd.Collapse,
182
- {
183
- bordered: false,
184
- style: { backgroundColor: "transparent" },
185
- expandIcon: ({ isActive }) => handleCollapseIcon({ isActive }),
186
- onChange: async (key) => {
187
- var _a2, _b2;
188
- try {
189
- const { children = [] } = itemWithJson;
190
- if (key && (key == null ? void 0 : key.length) && formConfigRef.current && interfaceTypeChildren && !(children == null ? void 0 : children.length)) {
191
- const res = await commonRequest(interfaceTypeChildren, {
192
- instanceid: relatedid,
193
- asid: (_a2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a2.propertiesID,
194
- tname: itemWithJson.attrvalue
195
- });
196
- if ((res == null ? void 0 : res.ReturnValue) === 1) {
197
- const list = ((_b2 = res == null ? void 0 : res.data) == null ? void 0 : _b2.list) || [];
198
- const arr = method.handleAttrList(list, { instanceid: relatedid, tname: itemWithJson.tname });
199
- const _formConfig = _.cloneDeep(formConfigRef.current);
200
- const _item = _formConfig.find((item) => item.attrid === itemWithJson.attrid);
201
- if (_item) {
202
- _item.children = [...arr];
203
- }
204
- setFormConfig == null ? void 0 : setFormConfig(_formConfig);
205
- setAttrList == null ? void 0 : setAttrList(_formConfig);
206
- }
173
+ const getFormListName = (field) => {
174
+ const parentPath = (parentFormListField == null ? void 0 : parentFormListField.parentName) || (parentFormListField == null ? void 0 : parentFormListField.name);
175
+ if (parentPath) {
176
+ return Array.isArray(parentPath) ? [...parentPath, itemWithJson.attrid, field.name] : [parentPath, itemWithJson.attrid, field.name];
177
+ }
178
+ return [itemWithJson.attrid, field.name];
179
+ };
180
+ return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
181
+ antd.Collapse,
182
+ {
183
+ bordered: false,
184
+ defaultActiveKey: [itemWithJson.attrid],
185
+ style: { backgroundColor: "transparent" },
186
+ expandIcon: ({ isActive }) => handleCollapseIcon({ isActive }),
187
+ items: [
188
+ {
189
+ key: itemWithJson.attrid,
190
+ label: itemWithJson.attrname,
191
+ styles: {
192
+ header: {
193
+ paddingLeft: 0
207
194
  }
208
- } catch (error) {
209
- }
210
- },
211
- items: [
212
- {
213
- key: itemWithJson.attrid,
214
- label: itemWithJson.attrname,
215
- styles: {
216
- header: {
217
- paddingLeft: 0
218
- }
219
- },
220
- children: isFormList ? /* @__PURE__ */ jsxRuntime.jsx(antd.Form.List, { name: itemWithJson.attrid, initialValue: formListInitValue, children: (fields, { add, remove }) => {
221
- var _a2;
222
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", rowGap: 16, flexDirection: "column" }, children: [
195
+ },
196
+ children: /* @__PURE__ */ jsxRuntime.jsx(
197
+ antd.Form.List,
198
+ {
199
+ name: parentFormListField ? Array.isArray(parentFormListField.name) ? [...parentFormListField.name, itemWithJson.attrid] : [parentFormListField.name, itemWithJson.attrid] : itemWithJson.attrid,
200
+ initialValue: formListInitValue,
201
+ children: (fields, { add, remove }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", rowGap: 16, flexDirection: "column" }, children: [
223
202
  fields.map((field) => {
224
- var _a3;
203
+ const nestedField = {
204
+ ...field,
205
+ parentName: getFormListName(field)
206
+ };
225
207
  return /* @__PURE__ */ jsxRuntime.jsx(
226
208
  antd.Card,
227
209
  {
228
- style: { width: ((_a3 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a3["properties-width"]) || defaultWidth + 100 },
210
+ style: { width: defaultWidth + 100 },
229
211
  size: "small",
230
212
  title: `${itemWithJson.attrname} ${field.name + 1}`,
231
213
  extra: /* @__PURE__ */ jsxRuntime.jsx(
232
214
  icons.CloseOutlined,
233
215
  {
234
216
  onClick: () => {
235
- remove(field.name);
217
+ if (fields.length > 1) {
218
+ remove(field.name);
219
+ } else {
220
+ message.warning("至少需要保留一个!");
221
+ }
236
222
  }
237
223
  }
238
224
  ),
239
- children: (itemWithJson.children || []).map((child, index) => {
225
+ children: (children || []).map((child, index) => {
240
226
  return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: handleRenderItem({
241
227
  item: child,
242
228
  readonly,
@@ -246,8 +232,9 @@ function useDynamicForm(props) {
246
232
  form,
247
233
  defaultWidth,
248
234
  formItemStyle,
235
+ radioAlign,
249
236
  isFormListItem: true,
250
- formListField: field,
237
+ formListField: nestedField,
251
238
  isShowLabel: true
252
239
  }) }, child.attrid || `child-${index}`);
253
240
  })
@@ -255,40 +242,66 @@ function useDynamicForm(props) {
255
242
  field.key
256
243
  );
257
244
  }),
258
- /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { style: { width: ((_a2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _a2["properties-width"]) || defaultWidth + 100 }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "dashed", onClick: () => add(), block: true, children: "+ 新增" }) })
259
- ] });
260
- } }) : /* @__PURE__ */ jsxRuntime.jsx("div", { children: (itemWithJson.children || []).map((child, index) => {
261
- return /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: handleRenderItem({
262
- item: child,
263
- readonly,
264
- colNum,
265
- instructionShowMode,
266
- relatedid,
267
- form,
268
- defaultWidth,
269
- formItemStyle
270
- }) }, child.attrid || `child-${index}`);
271
- }) })
272
- }
273
- ]
274
- },
275
- itemWithJson.attrid
276
- ) });
245
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { style: { width: 200 }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "dashed", onClick: () => add(), block: true, children: "+ 新增" }) })
246
+ ] })
247
+ }
248
+ )
249
+ }
250
+ ]
251
+ },
252
+ itemWithJson.attrid
253
+ ) });
254
+ },
255
+ [handleCollapseIcon, func.handleSetFormItemInitialValue]
256
+ );
257
+ const handleRenderFunc = react.useCallback(
258
+ ({
259
+ itemWithJson,
260
+ colNum = 1,
261
+ readonly = false,
262
+ instructionShowMode = "icon",
263
+ radioAlign = "horizontal",
264
+ formItemStyle,
265
+ relatedid,
266
+ form,
267
+ defaultWidth = 358,
268
+ isFormListItem = false,
269
+ formListField,
270
+ isShowLabel = true
271
+ }) => {
272
+ var _a, _b, _c, _d, _e, _f, _g;
273
+ if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true || (hideAttrList == null ? void 0 : hideAttrList.includes(itemWithJson.attrid))) {
274
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
275
+ }
276
+ if (itemWithJson.attrtype === 1) {
277
+ return renderNestedFormList({
278
+ itemWithJson,
279
+ colNum,
280
+ readonly,
281
+ instructionShowMode,
282
+ radioAlign,
283
+ formItemStyle,
284
+ relatedid,
285
+ form,
286
+ defaultWidth,
287
+ parentFormListField: formListField,
288
+ isShowLabel
289
+ });
277
290
  }
278
291
  if (itemWithJson.attrtype === 2) {
279
292
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: "实例信息" });
280
293
  }
281
294
  if (itemWithJson.attrtype === 0) {
282
- let initialValue = func.handleSetFormItemInitialValue(itemWithJson);
283
- const message2 = (_c = itemWithJson.json) == null ? void 0 : _c["default-prompt"];
295
+ const initialValue = func.handleSetFormItemInitialValue(itemWithJson);
296
+ const message2 = (_b = itemWithJson.json) == null ? void 0 : _b["default-prompt"];
284
297
  const placeholder = func.handleGetPlaceholder(itemWithJson);
285
298
  const { combinations = [] } = itemWithJson.json || {};
286
299
  if (combinations == null ? void 0 : combinations.length) {
287
300
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
288
301
  antd.Form.Item,
289
302
  {
290
- label: (_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["combination-name"],
291
- required: (_e = itemWithJson.json) == null ? void 0 : _e.must,
303
+ label: (_c = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c["combination-name"],
304
+ required: (_d = itemWithJson.json) == null ? void 0 : _d.must,
292
305
  children: /* @__PURE__ */ jsxRuntime.jsx(antd.Space.Compact, { children: combinations.map((item, index) => {
293
306
  var _a2, _b2, _c2, _d2;
294
307
  let initValue = func.handleSetFormItemInitialValue(item);
@@ -303,21 +316,20 @@ function useDynamicForm(props) {
303
316
  }
304
317
  }
305
318
  const widthRatio = (_a2 = item == null ? void 0 : item.json) == null ? void 0 : _a2["combination-width-ratio"];
306
- const placeholder2 = func.handleGetPlaceholder(item);
307
319
  if (widthRatio) {
308
320
  width = defaultWidth * widthRatio;
309
321
  }
310
322
  return /* @__PURE__ */ jsxRuntime.jsx(
311
323
  antd.Form.Item,
312
324
  {
313
- name: item.attrid,
325
+ name: formListField ? Array.isArray(formListField.name) ? [...formListField.name, item.attrid] : [formListField.name, item.attrid] : item.attrid,
314
326
  noStyle: true,
315
327
  initialValue: initValue,
316
328
  rules: [
317
329
  ...((_b2 = item.json) == null ? void 0 : _b2.must) ? [
318
330
  {
319
331
  required: true,
320
- message: message2 || `${placeholder2}${item.attrname}`
332
+ message: message2 || `${placeholder}${item.attrname}`
321
333
  }
322
334
  ] : [],
323
335
  ...((_c2 = itemWithJson.json) == null ? void 0 : _c2.regexp) ? [
@@ -346,58 +358,24 @@ function useDynamicForm(props) {
346
358
  `${itemWithJson.attrid}+1`
347
359
  ) });
348
360
  }
349
- if (isFormListItem && formListField) {
350
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
351
- antd.Form.Item,
352
- {
353
- name: [formListField == null ? void 0 : formListField.name, itemWithJson.attrid],
354
- label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
355
- initialValue,
356
- rules: [
357
- ...((_f = itemWithJson.json) == null ? void 0 : _f.must) ? [
358
- {
359
- required: true,
360
- message: `${placeholder}${itemWithJson.attrname}`
361
- }
362
- ] : [],
363
- ...((_g = itemWithJson.json) == null ? void 0 : _g.regexp) ? [
364
- {
365
- pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
366
- message: ((_h = itemWithJson.json) == null ? void 0 : _h["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
367
- }
368
- ] : []
369
- ],
370
- ...handleSetFormItemProps(itemWithJson),
371
- children: handleRenderItemInputMode({
372
- item: itemWithJson,
373
- readonly,
374
- formItemStyle,
375
- radioAlign,
376
- relatedid,
377
- form,
378
- defaultWidth
379
- })
380
- },
381
- itemWithJson.attrid
382
- ) });
383
- }
361
+ const formItemName = isFormListItem && formListField ? Array.isArray(formListField.name) ? [...formListField.name, itemWithJson.attrid] : [formListField.name, itemWithJson.attrid] : itemWithJson.attrid;
384
362
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Col, { span: 24 / colNum, children: /* @__PURE__ */ jsxRuntime.jsx(
385
363
  antd.Form.Item,
386
364
  {
387
- name: itemWithJson.attrid,
365
+ name: formItemName,
388
366
  label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
389
367
  initialValue,
390
368
  rules: [
391
- ...((_i = itemWithJson.json) == null ? void 0 : _i.must) ? [
369
+ ...((_e = itemWithJson.json) == null ? void 0 : _e.must) ? [
392
370
  {
393
371
  required: true,
394
372
  message: `${placeholder}${itemWithJson.attrname}`
395
373
  }
396
374
  ] : [],
397
- ...((_j = itemWithJson.json) == null ? void 0 : _j.regexp) ? [
375
+ ...((_f = itemWithJson.json) == null ? void 0 : _f.regexp) ? [
398
376
  {
399
377
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
400
- message: ((_k = itemWithJson.json) == null ? void 0 : _k["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
378
+ message: ((_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
401
379
  }
402
380
  ] : []
403
381
  ],
@@ -417,7 +395,7 @@ function useDynamicForm(props) {
417
395
  }
418
396
  return null;
419
397
  },
420
- [handleCollapseIcon]
398
+ [handleDealInstruction, func.handleSetFormItemInitialValue, handleSetFormItemProps, hideAttrList, renderNestedFormList]
421
399
  );
422
400
  const handleOnRemove = async (file) => {
423
401
  var _a;
@@ -69,7 +69,7 @@ export declare const handleOperationFile: (params: any, data: any, commonRequest
69
69
  */
70
70
  export declare function handleKebabToCamel(str: string): string;
71
71
  /**
72
- * 提交实例化时处理属性列表为提交嵌套格式
72
+ * 处理属性列表为接口提交格式(修复children的data_list为空问题)
73
73
  * @param {Array} attrList 原始属性列表
74
74
  * @returns {Object} 目标格式的data对象
75
75
  */
@@ -94,7 +94,7 @@ export declare const handleAttrListToObjDetail: ({ attrList, params, extra, comm
94
94
  [key: string]: any;
95
95
  } | undefined;
96
96
  commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
97
- }) => Promise<any>;
97
+ }) => Promise<any[]>;
98
98
  /**
99
99
  * 处理URL选项 根据远程接口获取下拉、单选、多选数据
100
100
  * 将URL中的指定字段拼接为字符串
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const antd = require("antd");
4
4
  const dayjs = require("dayjs");
5
5
  const _ = require("lodash");
6
+ const szxkFunc = require("./szxkFunc");
6
7
  function getJson(jsonStr) {
7
8
  try {
8
9
  return JSON.parse(jsonStr);
@@ -32,42 +33,32 @@ function isBase64(str) {
32
33
  const handleSubmitForm = (originalData, allValues) => {
33
34
  let updatedData = _.cloneDeep(originalData);
34
35
  let uploadedFiles = [];
35
- const processAttrList = (attrList, item) => {
36
- var _a;
36
+ const processAttrList = (attrList) => {
37
37
  try {
38
- if ((_a = item == null ? void 0 : item.json) == null ? void 0 : _a["properties-multiple"]) {
39
- const attrValue = allValues[item.attrid];
40
- if (Array.isArray(attrValue)) {
41
- const childrenObj = {};
42
- attrValue.forEach((item2, index) => {
43
- var _a2;
44
- childrenObj[index] = _.cloneDeep(attrList);
45
- for (const [fieldName, formValue] of Object.entries(item2)) {
46
- const attrItem = (_a2 = childrenObj[index]) == null ? void 0 : _a2.find((item3) => item3.attrid === fieldName);
47
- handleDealValue(attrItem, formValue);
38
+ const attrMap = new Map(attrList.map((item, index) => [item.attrid, index]));
39
+ for (const [fieldName, formValue] of Object.entries(allValues)) {
40
+ const index = attrMap.get(fieldName);
41
+ if (index === void 0)
42
+ continue;
43
+ const attrItem = attrList[index];
44
+ if (!formValue && formValue !== 0) {
45
+ attrItem.attrvalue = "";
46
+ continue;
47
+ }
48
+ handleDealValue(attrItem, formValue);
49
+ }
50
+ attrList.forEach((item) => {
51
+ if (item.children && Array.isArray(item.children) && item.children.length > 0 && !Array.isArray(item.children[0])) {
52
+ processAttrList(item.children);
53
+ }
54
+ if (item.children && Array.isArray(item.children) && item.children.length > 0 && Array.isArray(item.children[0])) {
55
+ item.children.forEach((v) => {
56
+ if (v.children && Array.isArray(v.children)) {
57
+ processAttrList(v.children);
48
58
  }
49
59
  });
50
- item.children = childrenObj;
51
- }
52
- } else {
53
- const attrMap = new Map(attrList.map((item2, index) => [item2.attrid, index]));
54
- for (const [fieldName, formValue] of Object.entries(allValues)) {
55
- const index = attrMap.get(fieldName);
56
- if (index === void 0)
57
- continue;
58
- const attrItem = attrList[index];
59
- if (!formValue && formValue !== 0) {
60
- attrItem.attrvalue = "";
61
- continue;
62
- }
63
- handleDealValue(attrItem, formValue);
64
60
  }
65
- attrList.forEach((item2) => {
66
- if (item2.children && Array.isArray(item2.children) && item2.children.length > 0) {
67
- processAttrList(item2.children, item2);
68
- }
69
- });
70
- }
61
+ });
71
62
  } catch (error) {
72
63
  }
73
64
  };
@@ -155,9 +146,15 @@ const handleSubmitForm = (originalData, allValues) => {
155
146
  };
156
147
  const processChildren = (items, extraAttrs) => {
157
148
  return items.map((item) => {
149
+ var _a, _b, _c;
158
150
  const processedItem = processItem(item, extraAttrs);
159
- if (processedItem.children && Array.isArray(processedItem.children)) {
160
- processedItem.children = processChildren(processedItem.children);
151
+ const { children } = processedItem;
152
+ if (children && !Array.isArray(children == null ? void 0 : children[0]) && (children == null ? void 0 : children.length)) {
153
+ processedItem.children = [processChildren(children)];
154
+ }
155
+ if ((processedItem == null ? void 0 : processedItem.children) && Array.isArray((_a = processedItem == null ? void 0 : processedItem.children) == null ? void 0 : _a[0]) && ((_b = processedItem == null ? void 0 : processedItem.children) == null ? void 0 : _b.length)) {
156
+ const list = (_c = processedItem == null ? void 0 : processedItem.children) == null ? void 0 : _c.map((child) => child == null ? void 0 : child.map((v) => processItem(v)));
157
+ processedItem.children = list;
161
158
  }
162
159
  return processedItem;
163
160
  });
@@ -210,13 +207,15 @@ const handleAttrList = (attrList, extraAttrs) => {
210
207
  combinations: combinationGroups[combinationId]
211
208
  }
212
209
  };
213
- if (processedItem.children && Array.isArray(processedItem.children)) {
214
- processedItem.children = filterAndCombine(processedItem.children);
210
+ const { children: children2 } = processedItem;
211
+ if (children2 && Array.isArray(children2 == null ? void 0 : children2[0]) && (children2 == null ? void 0 : children2.length)) {
212
+ processedItem.children = children2 == null ? void 0 : children2.map((child) => filterAndCombine(child));
215
213
  }
216
214
  return processedItem;
217
215
  }
218
- if (item.children && Array.isArray(item.children)) {
219
- item.children = filterAndCombine(item.children);
216
+ const { children } = item;
217
+ if (children && Array.isArray(children == null ? void 0 : children[0]) && (children == null ? void 0 : children.length)) {
218
+ item.children = children == null ? void 0 : children.map((child) => filterAndCombine(child));
220
219
  }
221
220
  return item;
222
221
  });
@@ -306,13 +305,26 @@ const handleAttrListToObj = (attrList) => {
306
305
  function processLevel(arr) {
307
306
  const result = {};
308
307
  arr.forEach((item) => {
309
- var _a2, _b;
308
+ var _a2, _b, _c, _d, _e;
310
309
  const key = `${item.attrid}_${item.attrtype}`;
311
- if (item.attrtype === 1 && item.children.length > 0) {
310
+ if (item.attrtype === 1 && item.children.length > 0 && !Array.isArray(item.children)) {
312
311
  result[key] = {
313
312
  asid: ((_b = (_a2 = item.children) == null ? void 0 : _a2[0]) == null ? void 0 : _b.asid) || "",
314
313
  data_list: [processLevel(item.children)]
315
314
  };
315
+ } else if (item.attrtype === 1 && item.children.length > 0 && Array.isArray(item.children)) {
316
+ const { attrvalue = [], children = [] } = item || {};
317
+ if (Array.isArray(attrvalue) && (attrvalue == null ? void 0 : attrvalue.length)) {
318
+ item.children = attrvalue.map((v) => {
319
+ return szxkFunc.handleObjDetailToSignleAttrList((children == null ? void 0 : children[0]) || [], v);
320
+ });
321
+ result[key] = {
322
+ asid: ((_e = (_d = (_c = item.children) == null ? void 0 : _c[0]) == null ? void 0 : _d[0]) == null ? void 0 : _e.asid) || "",
323
+ data_list: item.children.map((child) => {
324
+ return processLevel(child);
325
+ })
326
+ };
327
+ }
316
328
  } else {
317
329
  result[key] = item.attrvalue;
318
330
  }
@@ -361,7 +373,7 @@ const handleAttrListToObjDetail = async ({
361
373
  return processedAttrList;
362
374
  })
363
375
  );
364
- return processedDetailList.length === 1 ? processedDetailList[0] : processedDetailList;
376
+ return processedDetailList || [];
365
377
  };
366
378
  const handleUrlOptions = (val, delimiter, list) => {
367
379
  let arr = [];
@@ -2,6 +2,8 @@ import { AxiosResponse } from 'axios';
2
2
  /**
3
3
  * 获取属性集列表
4
4
  * @param params
5
+ * @param commonRequest 通用请求函数
6
+ * @param interfaceType 接口类型,默认值为'SERATTALLList'
5
7
  * @returns
6
8
  */
7
9
  export declare const handleGetAttrList: (params: {
@@ -14,7 +16,11 @@ export declare const handleGetAttrList: (params: {
14
16
  * @param interfaceType 接口类型,默认值为'YLFWLRDataDetails'
15
17
  * @returns 属性集详情 {attrid_attrtype: attrvalue} 格式的数据
16
18
  */
17
- export declare const handleGetAttrDetail: (params: any, commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>, interfaceType?: string) => Promise<any>;
19
+ export declare const handleGetAttrDetail: (params: {
20
+ instanceid: string;
21
+ asid: string;
22
+ tname?: string;
23
+ }, commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>, interfaceType?: string) => Promise<any>;
18
24
  /**
19
25
  * 单层详情数据对应到单个属性集
20
26
  * @param attrList 属性集列表
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.2.90",
4
+ "version": "0.2.91",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",