szld-libs 0.3.2 → 0.3.4
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 +10689 -10676
- package/dist/szld-components.umd.js +52 -52
- package/es/components/DynamicForm/index.js +3 -3
- package/es/components/DynamicForm/useDynamicForm.d.ts +1 -2
- package/es/components/DynamicForm/useDynamicForm.js +5 -9
- package/es/components/DynamicFormMobile/index.js +2 -3
- package/es/index.js +2 -1
- package/es/mock/index.js +12 -3
- package/es/utils/method.d.ts +8 -0
- package/es/utils/method.js +54 -21
- package/lib/components/DynamicForm/index.js +3 -3
- package/lib/components/DynamicForm/useDynamicForm.d.ts +1 -2
- package/lib/components/DynamicForm/useDynamicForm.js +5 -9
- package/lib/components/DynamicFormMobile/index.js +2 -3
- package/lib/index.js +1 -0
- package/lib/mock/index.js +12 -3
- package/lib/utils/method.d.ts +8 -0
- package/lib/utils/method.js +54 -21
- package/package.json +1 -1
|
@@ -30,7 +30,8 @@ const DynamicForm = forwardRef((props, ref) => {
|
|
|
30
30
|
formShowType = "form",
|
|
31
31
|
headerWidth,
|
|
32
32
|
formListItemWidth,
|
|
33
|
-
formListItemName
|
|
33
|
+
formListItemName,
|
|
34
|
+
isEdit = false
|
|
34
35
|
} = props;
|
|
35
36
|
const delFileListRef = useRef([]);
|
|
36
37
|
const updateDelFileList = (file) => {
|
|
@@ -41,7 +42,6 @@ const DynamicForm = forwardRef((props, ref) => {
|
|
|
41
42
|
uploadAction,
|
|
42
43
|
commonRequest,
|
|
43
44
|
setFormConfig,
|
|
44
|
-
setAttrList,
|
|
45
45
|
updateDelFileList,
|
|
46
46
|
formConfig,
|
|
47
47
|
interfaceTypeChildren,
|
|
@@ -51,7 +51,7 @@ const DynamicForm = forwardRef((props, ref) => {
|
|
|
51
51
|
actionUrlKey,
|
|
52
52
|
actionUrlExtraParams,
|
|
53
53
|
CustomModalComponent,
|
|
54
|
-
|
|
54
|
+
isEdit
|
|
55
55
|
});
|
|
56
56
|
useImperativeHandle(ref, () => ({
|
|
57
57
|
getDelFileList: () => {
|
|
@@ -16,8 +16,7 @@ interface IDynamicFormProps {
|
|
|
16
16
|
actionUrlKey: string;
|
|
17
17
|
actionUrlExtraParams: object;
|
|
18
18
|
CustomModalComponent?: React.FC<ICustomModal>;
|
|
19
|
-
|
|
20
|
-
hideAttrList?: string[];
|
|
19
|
+
isEdit?: boolean;
|
|
21
20
|
}
|
|
22
21
|
type NestedFormListFieldData = FormListFieldData & {
|
|
23
22
|
parentName?: (string | number)[];
|
|
@@ -21,17 +21,14 @@ function useDynamicForm(props) {
|
|
|
21
21
|
uploadAction,
|
|
22
22
|
commonRequest,
|
|
23
23
|
formConfig,
|
|
24
|
-
setFormConfig,
|
|
25
24
|
updateDelFileList,
|
|
26
|
-
interfaceTypeChildren,
|
|
27
25
|
interfaceTypeDict,
|
|
28
26
|
interfaceTypeSysDict,
|
|
29
27
|
relatedidKey,
|
|
30
28
|
actionUrlKey,
|
|
31
29
|
actionUrlExtraParams,
|
|
32
30
|
CustomModalComponent,
|
|
33
|
-
|
|
34
|
-
hideAttrList = []
|
|
31
|
+
isEdit
|
|
35
32
|
} = props;
|
|
36
33
|
const formConfigRef = useRef([]);
|
|
37
34
|
const { message } = App.useApp();
|
|
@@ -181,7 +178,6 @@ function useDynamicForm(props) {
|
|
|
181
178
|
Collapse,
|
|
182
179
|
{
|
|
183
180
|
bordered: false,
|
|
184
|
-
defaultActiveKey: [itemWithJson.attrid],
|
|
185
181
|
style: { backgroundColor: "transparent" },
|
|
186
182
|
expandIcon: ({ isActive }) => handleCollapseIcon({ isActive }),
|
|
187
183
|
items: [
|
|
@@ -210,7 +206,7 @@ function useDynamicForm(props) {
|
|
|
210
206
|
style: { width: defaultWidth + 100 },
|
|
211
207
|
size: "small",
|
|
212
208
|
title: `${itemWithJson.attrname} ${field.name + 1}`,
|
|
213
|
-
extra: /* @__PURE__ */ jsx(
|
|
209
|
+
extra: !isEdit && /* @__PURE__ */ jsx(
|
|
214
210
|
CloseOutlined,
|
|
215
211
|
{
|
|
216
212
|
onClick: () => {
|
|
@@ -242,7 +238,7 @@ function useDynamicForm(props) {
|
|
|
242
238
|
field.key
|
|
243
239
|
);
|
|
244
240
|
}),
|
|
245
|
-
/* @__PURE__ */ jsx(Flex, { style: { width: 200 }, children: /* @__PURE__ */ jsx(Button, { type: "dashed", onClick: () => add(), block: true, children: "+ 新增" }) })
|
|
241
|
+
!isEdit && /* @__PURE__ */ jsx(Flex, { style: { width: 200 }, children: /* @__PURE__ */ jsx(Button, { type: "dashed", onClick: () => add(), block: true, children: "+ 新增" }) })
|
|
246
242
|
] })
|
|
247
243
|
}
|
|
248
244
|
)
|
|
@@ -270,7 +266,7 @@ function useDynamicForm(props) {
|
|
|
270
266
|
isShowLabel = true
|
|
271
267
|
}) => {
|
|
272
268
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
273
|
-
if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true
|
|
269
|
+
if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true) {
|
|
274
270
|
return /* @__PURE__ */ jsx(Fragment$1, {});
|
|
275
271
|
}
|
|
276
272
|
if (itemWithJson.attrtype === 1) {
|
|
@@ -395,7 +391,7 @@ function useDynamicForm(props) {
|
|
|
395
391
|
}
|
|
396
392
|
return null;
|
|
397
393
|
},
|
|
398
|
-
[handleDealInstruction, handleSetFormItemInitialValue, handleSetFormItemProps,
|
|
394
|
+
[handleDealInstruction, handleSetFormItemInitialValue, handleSetFormItemProps, renderNestedFormList]
|
|
399
395
|
);
|
|
400
396
|
const handleOnRemove = async (file) => {
|
|
401
397
|
var _a;
|
|
@@ -82,8 +82,8 @@ const DynamicForm = forwardRef((props, ref) => {
|
|
|
82
82
|
justify: "space-between",
|
|
83
83
|
style: {
|
|
84
84
|
height: 44,
|
|
85
|
-
width: "calc(100vw - 32px)",
|
|
86
85
|
marginLeft: 16,
|
|
86
|
+
marginRight: 16,
|
|
87
87
|
borderBottom: "1px solid #E3E3E3"
|
|
88
88
|
},
|
|
89
89
|
align: "center",
|
|
@@ -108,8 +108,7 @@ const DynamicForm = forwardRef((props, ref) => {
|
|
|
108
108
|
defaultWidth: (formListItemWidth == null ? void 0 : formListItemWidth[index]) || defaultWidth,
|
|
109
109
|
formItemStyle,
|
|
110
110
|
isFormListItem: true,
|
|
111
|
-
formListField: field
|
|
112
|
-
isShowLabel: false
|
|
111
|
+
formListField: field
|
|
113
112
|
}) }, index);
|
|
114
113
|
}) })
|
|
115
114
|
]
|
package/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { commonRequestWidthParams, uploadFormAction, commonRequest } from "./services";
|
|
3
|
-
import { handleAttrList } from "./utils/method";
|
|
3
|
+
import { handleAttrListToObj, handleAttrList } from "./utils/method";
|
|
4
4
|
import { BackHeader, DynamicFormMobile } from "./main";
|
|
5
5
|
import { BrowserRouter } from "react-router-dom";
|
|
6
6
|
import { ConfigProvider, App } from "antd";
|
|
@@ -14,6 +14,7 @@ const index = "";
|
|
|
14
14
|
dayjs.locale("zh-cn");
|
|
15
15
|
const Demo = () => {
|
|
16
16
|
useEffect(() => {
|
|
17
|
+
handleAttrListToObj(attrList);
|
|
17
18
|
}, []);
|
|
18
19
|
const formRef = useRef(null);
|
|
19
20
|
Form.useForm();
|
package/es/mock/index.js
CHANGED
|
@@ -3,38 +3,47 @@ const attrList = [
|
|
|
3
3
|
{
|
|
4
4
|
xh: 1,
|
|
5
5
|
asid: "904A28FACAF346DFA63CBEEB3437BDA8",
|
|
6
|
+
astype: 0,
|
|
7
|
+
tname: "tsyy_table",
|
|
6
8
|
attrid: "6970C54A08E54463888CD8F9E7FD851B",
|
|
7
9
|
attrname: "喂药日期",
|
|
8
10
|
attrtype: 0,
|
|
9
11
|
info: '{"input":"multiple-date-picker","range-picker-save":"single","dataType":"string","length":1000}',
|
|
10
12
|
info_base64: 0,
|
|
11
13
|
createtime: "2026-01-05 15:33:36",
|
|
14
|
+
attrvalue: "",
|
|
12
15
|
serialnum: 1,
|
|
13
|
-
|
|
16
|
+
children: []
|
|
14
17
|
},
|
|
15
18
|
{
|
|
16
19
|
xh: 2,
|
|
17
20
|
asid: "904A28FACAF346DFA63CBEEB3437BDA8",
|
|
21
|
+
astype: 0,
|
|
22
|
+
tname: "tsyy_table",
|
|
18
23
|
attrid: "98FD46568CAC4F248B5FD66D52DF5086",
|
|
19
24
|
attrname: "当日次数",
|
|
20
25
|
attrtype: 0,
|
|
21
26
|
info: '{"input":"text","dataType":"string","length":1}',
|
|
22
27
|
info_base64: 0,
|
|
23
28
|
createtime: "2026-01-05 15:33:45",
|
|
29
|
+
attrvalue: "",
|
|
24
30
|
serialnum: 2,
|
|
25
|
-
|
|
31
|
+
children: []
|
|
26
32
|
},
|
|
27
33
|
{
|
|
28
34
|
xh: 3,
|
|
29
35
|
asid: "904A28FACAF346DFA63CBEEB3437BDA8",
|
|
36
|
+
astype: 0,
|
|
37
|
+
tname: "tsyy_table",
|
|
30
38
|
attrid: "E7C4B706E65E4F81B51AAA9D313B5482",
|
|
31
39
|
attrname: "当日时间",
|
|
32
40
|
attrtype: 0,
|
|
33
41
|
info: '{"input":"mult-select","inputType":"local","data":["09:00","10:00","11:00","12:00","13:00","14:00"],"dataType":"string","length":100}',
|
|
34
42
|
info_base64: 0,
|
|
35
43
|
createtime: "2026-01-05 15:34:22",
|
|
44
|
+
attrvalue: "",
|
|
36
45
|
serialnum: 3,
|
|
37
|
-
|
|
46
|
+
children: []
|
|
38
47
|
}
|
|
39
48
|
];
|
|
40
49
|
export {
|
package/es/utils/method.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare const handleSubmitForm: (originalData: {
|
|
|
15
15
|
isMobile?: boolean;
|
|
16
16
|
guid?: string;
|
|
17
17
|
isListToObj?: boolean;
|
|
18
|
+
isAutoFill?: boolean;
|
|
18
19
|
}, allValues: any) => {
|
|
19
20
|
updatedData: any;
|
|
20
21
|
uploadedFiles: any[];
|
|
@@ -120,3 +121,10 @@ export declare const handleSelectOptions: ({ commonRequestWidthParams, commonReq
|
|
|
120
121
|
actionUrlExtraParams?: object | undefined;
|
|
121
122
|
item: Ijson;
|
|
122
123
|
}) => Promise<any[]>;
|
|
124
|
+
/**
|
|
125
|
+
* 单层详情数据对应到单个属性集
|
|
126
|
+
* @param attrList 属性集列表
|
|
127
|
+
* @param detail 属性集详情 {attrid_attrtype: attrvalue} 格式的数据
|
|
128
|
+
* @returns 处理后的属性集列表,每个属性项包含attrvalue
|
|
129
|
+
*/
|
|
130
|
+
export declare const handleObjDetailToSignleAttrList: (attrList: any[], detail: any) => any[];
|
package/es/utils/method.js
CHANGED
|
@@ -31,7 +31,7 @@ const handleSubmitForm = (originalData, allValues) => {
|
|
|
31
31
|
var _a;
|
|
32
32
|
let updatedData = _.cloneDeep(originalData);
|
|
33
33
|
const { attr_list = [] } = updatedData;
|
|
34
|
-
const { isMobile = false, guid, isListToObj = false } = originalData;
|
|
34
|
+
const { isMobile = false, guid, isListToObj = false, isAutoFill = true } = originalData;
|
|
35
35
|
let uploadedFiles = [];
|
|
36
36
|
const processAttrList = (attrList, values) => {
|
|
37
37
|
try {
|
|
@@ -49,14 +49,14 @@ const handleSubmitForm = (originalData, allValues) => {
|
|
|
49
49
|
attrItem = handleDealValue(attrItem, formValue, isMobile);
|
|
50
50
|
}
|
|
51
51
|
attrList.forEach((item) => {
|
|
52
|
-
if (item.children && Array.isArray(item.children) && item.children.length > 0 && !Array.isArray(item.children[0])) {
|
|
52
|
+
if (item.children && Array.isArray(item.children) && item.children.length > 0 && !Array.isArray(item.children[0]) && values[item.attrid]) {
|
|
53
53
|
processAttrList(item.children, values[item.attrid]);
|
|
54
54
|
}
|
|
55
55
|
if (item.children && Array.isArray(item.children) && item.children.length > 0 && Array.isArray(item.children[0])) {
|
|
56
56
|
item.children.forEach((v, i) => {
|
|
57
|
-
var _a2;
|
|
58
|
-
if (v && Array.isArray(v)) {
|
|
59
|
-
processAttrList(v, (
|
|
57
|
+
var _a2, _b;
|
|
58
|
+
if (v && Array.isArray(v) && ((_a2 = values == null ? void 0 : values[item.attrid]) == null ? void 0 : _a2[i])) {
|
|
59
|
+
processAttrList(v, (_b = values == null ? void 0 : values[item.attrid]) == null ? void 0 : _b[i]);
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
}
|
|
@@ -158,20 +158,22 @@ const handleSubmitForm = (originalData, allValues) => {
|
|
|
158
158
|
if (updatedData.attr_list && Array.isArray(updatedData.attr_list)) {
|
|
159
159
|
processAttrList(attr_list, allValues);
|
|
160
160
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (((
|
|
165
|
-
v.
|
|
161
|
+
if (isAutoFill) {
|
|
162
|
+
(_a = updatedData == null ? void 0 : updatedData.attr_list) == null ? void 0 : _a.forEach((v) => {
|
|
163
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
164
|
+
if (((_a2 = v == null ? void 0 : v.json) == null ? void 0 : _a2["auto-generate"]) && ((_b = v == null ? void 0 : v.json) == null ? void 0 : _b["auto-generate-type"])) {
|
|
165
|
+
if (((_c = v == null ? void 0 : v.json) == null ? void 0 : _c["auto-generate-type"]) === "currenttime") {
|
|
166
|
+
v.attrvalue = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
|
167
|
+
}
|
|
168
|
+
if (((_d = v == null ? void 0 : v.json) == null ? void 0 : _d["auto-generate-type"]) === "guid") {
|
|
169
|
+
v.attrvalue = guid || "";
|
|
170
|
+
}
|
|
166
171
|
}
|
|
167
|
-
if ((
|
|
168
|
-
v.attrvalue =
|
|
172
|
+
if ((_e = v == null ? void 0 : v.json) == null ? void 0 : _e["default"]) {
|
|
173
|
+
v.attrvalue = (_f = v == null ? void 0 : v.json) == null ? void 0 : _f["default"];
|
|
169
174
|
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
v.attrvalue = (_f = v == null ? void 0 : v.json) == null ? void 0 : _f["default"];
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
+
});
|
|
176
|
+
}
|
|
175
177
|
return {
|
|
176
178
|
updatedData: isListToObj ? handleAttrListToObj(updatedData.attr_list || []) : updatedData,
|
|
177
179
|
uploadedFiles
|
|
@@ -341,7 +343,7 @@ const handleAttrListToObj = (attrList) => {
|
|
|
341
343
|
function processLevel(arr) {
|
|
342
344
|
const result = {};
|
|
343
345
|
arr.forEach((item) => {
|
|
344
|
-
var _a2, _b, _c, _d
|
|
346
|
+
var _a2, _b, _c, _d;
|
|
345
347
|
const key = `${item.attrid}_${item.attrtype}`;
|
|
346
348
|
if (item.attrtype === 1 && item.children.length > 0 && !Array.isArray(item.children)) {
|
|
347
349
|
result[key] = {
|
|
@@ -349,11 +351,35 @@ const handleAttrListToObj = (attrList) => {
|
|
|
349
351
|
data_list: [processLevel(item.children)]
|
|
350
352
|
};
|
|
351
353
|
} else if (item.attrtype === 1 && item.children.length > 0 && Array.isArray(item.children)) {
|
|
352
|
-
|
|
354
|
+
let { children = [], attrvalue } = item || {};
|
|
355
|
+
if (attrvalue && (attrvalue == null ? void 0 : attrvalue.length) && Array.isArray(attrvalue)) {
|
|
356
|
+
children = attrvalue.map((v) => {
|
|
357
|
+
var _a3, _b2, _c2, _d2;
|
|
358
|
+
const index = (_a3 = Object.values(v)) == null ? void 0 : _a3.findIndex((y) => Array.isArray(y));
|
|
359
|
+
const uploadAttrId = ((_b2 = Object.keys(v)) == null ? void 0 : _b2[index]) || "";
|
|
360
|
+
if (uploadAttrId) {
|
|
361
|
+
const uploadAttrItem = ((_c2 = children == null ? void 0 : children[0]) == null ? void 0 : _c2.find((z) => z.attrid === uploadAttrId)) || {};
|
|
362
|
+
const { input } = (uploadAttrItem == null ? void 0 : uploadAttrItem.json) || {};
|
|
363
|
+
if (["file", "image", "video", "audio"].includes(input)) {
|
|
364
|
+
const parsedValue = ((_d2 = Object.values(v)) == null ? void 0 : _d2[index]) || [];
|
|
365
|
+
const existingFiles = parsedValue.filter((file) => file.FileId);
|
|
366
|
+
const uploadedFileList = parsedValue.filter((file) => {
|
|
367
|
+
var _a4;
|
|
368
|
+
return file.status === "done" && ((_a4 = file.response) == null ? void 0 : _a4.data);
|
|
369
|
+
}).map((file) => file.response.data);
|
|
370
|
+
const allFiles = [...existingFiles, ...uploadedFileList];
|
|
371
|
+
v[uploadAttrId] = allFiles;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return handleObjDetailToSignleAttrList((children == null ? void 0 : children[0]) || [], v);
|
|
375
|
+
});
|
|
376
|
+
} else {
|
|
377
|
+
children = [];
|
|
378
|
+
}
|
|
353
379
|
if ((children == null ? void 0 : children.length) && Array.isArray(children == null ? void 0 : children[0])) {
|
|
354
380
|
result[key] = {
|
|
355
|
-
asid: ((
|
|
356
|
-
data_list:
|
|
381
|
+
asid: ((_d = (_c = children == null ? void 0 : children[0]) == null ? void 0 : _c[0]) == null ? void 0 : _d.asid) || "",
|
|
382
|
+
data_list: children.map((child) => {
|
|
357
383
|
return processLevel(child);
|
|
358
384
|
})
|
|
359
385
|
};
|
|
@@ -503,6 +529,12 @@ const handleSelectOptions = async ({
|
|
|
503
529
|
}
|
|
504
530
|
return options;
|
|
505
531
|
};
|
|
532
|
+
const handleObjDetailToSignleAttrList = (attrList, detail) => {
|
|
533
|
+
return attrList.map((item) => ({
|
|
534
|
+
...item,
|
|
535
|
+
attrvalue: detail[item.attrid] || ""
|
|
536
|
+
}));
|
|
537
|
+
};
|
|
506
538
|
export {
|
|
507
539
|
base64ToString,
|
|
508
540
|
getJson,
|
|
@@ -512,6 +544,7 @@ export {
|
|
|
512
544
|
handleBaseAttrList,
|
|
513
545
|
handleFormConfig,
|
|
514
546
|
handleKebabToCamel,
|
|
547
|
+
handleObjDetailToSignleAttrList,
|
|
515
548
|
handleOperationFile,
|
|
516
549
|
handleSelectOptions,
|
|
517
550
|
handleSubmitForm,
|
|
@@ -31,7 +31,8 @@ const DynamicForm = react.forwardRef((props, ref) => {
|
|
|
31
31
|
formShowType = "form",
|
|
32
32
|
headerWidth,
|
|
33
33
|
formListItemWidth,
|
|
34
|
-
formListItemName
|
|
34
|
+
formListItemName,
|
|
35
|
+
isEdit = false
|
|
35
36
|
} = props;
|
|
36
37
|
const delFileListRef = react.useRef([]);
|
|
37
38
|
const updateDelFileList = (file) => {
|
|
@@ -42,7 +43,6 @@ const DynamicForm = react.forwardRef((props, ref) => {
|
|
|
42
43
|
uploadAction,
|
|
43
44
|
commonRequest,
|
|
44
45
|
setFormConfig,
|
|
45
|
-
setAttrList,
|
|
46
46
|
updateDelFileList,
|
|
47
47
|
formConfig,
|
|
48
48
|
interfaceTypeChildren,
|
|
@@ -52,7 +52,7 @@ const DynamicForm = react.forwardRef((props, ref) => {
|
|
|
52
52
|
actionUrlKey,
|
|
53
53
|
actionUrlExtraParams,
|
|
54
54
|
CustomModalComponent,
|
|
55
|
-
|
|
55
|
+
isEdit
|
|
56
56
|
});
|
|
57
57
|
react.useImperativeHandle(ref, () => ({
|
|
58
58
|
getDelFileList: () => {
|
|
@@ -16,8 +16,7 @@ interface IDynamicFormProps {
|
|
|
16
16
|
actionUrlKey: string;
|
|
17
17
|
actionUrlExtraParams: object;
|
|
18
18
|
CustomModalComponent?: React.FC<ICustomModal>;
|
|
19
|
-
|
|
20
|
-
hideAttrList?: string[];
|
|
19
|
+
isEdit?: boolean;
|
|
21
20
|
}
|
|
22
21
|
type NestedFormListFieldData = FormListFieldData & {
|
|
23
22
|
parentName?: (string | number)[];
|
|
@@ -22,17 +22,14 @@ function useDynamicForm(props) {
|
|
|
22
22
|
uploadAction,
|
|
23
23
|
commonRequest,
|
|
24
24
|
formConfig,
|
|
25
|
-
setFormConfig,
|
|
26
25
|
updateDelFileList,
|
|
27
|
-
interfaceTypeChildren,
|
|
28
26
|
interfaceTypeDict,
|
|
29
27
|
interfaceTypeSysDict,
|
|
30
28
|
relatedidKey,
|
|
31
29
|
actionUrlKey,
|
|
32
30
|
actionUrlExtraParams,
|
|
33
31
|
CustomModalComponent,
|
|
34
|
-
|
|
35
|
-
hideAttrList = []
|
|
32
|
+
isEdit
|
|
36
33
|
} = props;
|
|
37
34
|
const formConfigRef = react.useRef([]);
|
|
38
35
|
const { message } = antd.App.useApp();
|
|
@@ -182,7 +179,6 @@ function useDynamicForm(props) {
|
|
|
182
179
|
antd.Collapse,
|
|
183
180
|
{
|
|
184
181
|
bordered: false,
|
|
185
|
-
defaultActiveKey: [itemWithJson.attrid],
|
|
186
182
|
style: { backgroundColor: "transparent" },
|
|
187
183
|
expandIcon: ({ isActive }) => handleCollapseIcon({ isActive }),
|
|
188
184
|
items: [
|
|
@@ -211,7 +207,7 @@ function useDynamicForm(props) {
|
|
|
211
207
|
style: { width: defaultWidth + 100 },
|
|
212
208
|
size: "small",
|
|
213
209
|
title: `${itemWithJson.attrname} ${field.name + 1}`,
|
|
214
|
-
extra: /* @__PURE__ */ jsxRuntime.jsx(
|
|
210
|
+
extra: !isEdit && /* @__PURE__ */ jsxRuntime.jsx(
|
|
215
211
|
icons.CloseOutlined,
|
|
216
212
|
{
|
|
217
213
|
onClick: () => {
|
|
@@ -243,7 +239,7 @@ function useDynamicForm(props) {
|
|
|
243
239
|
field.key
|
|
244
240
|
);
|
|
245
241
|
}),
|
|
246
|
-
/* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { style: { width: 200 }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "dashed", onClick: () => add(), block: true, children: "+ 新增" }) })
|
|
242
|
+
!isEdit && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { style: { width: 200 }, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "dashed", onClick: () => add(), block: true, children: "+ 新增" }) })
|
|
247
243
|
] })
|
|
248
244
|
}
|
|
249
245
|
)
|
|
@@ -271,7 +267,7 @@ function useDynamicForm(props) {
|
|
|
271
267
|
isShowLabel = true
|
|
272
268
|
}) => {
|
|
273
269
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
274
|
-
if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true
|
|
270
|
+
if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true) {
|
|
275
271
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
276
272
|
}
|
|
277
273
|
if (itemWithJson.attrtype === 1) {
|
|
@@ -396,7 +392,7 @@ function useDynamicForm(props) {
|
|
|
396
392
|
}
|
|
397
393
|
return null;
|
|
398
394
|
},
|
|
399
|
-
[handleDealInstruction, func.handleSetFormItemInitialValue, handleSetFormItemProps,
|
|
395
|
+
[handleDealInstruction, func.handleSetFormItemInitialValue, handleSetFormItemProps, renderNestedFormList]
|
|
400
396
|
);
|
|
401
397
|
const handleOnRemove = async (file) => {
|
|
402
398
|
var _a;
|
|
@@ -83,8 +83,8 @@ const DynamicForm = react.forwardRef((props, ref) => {
|
|
|
83
83
|
justify: "space-between",
|
|
84
84
|
style: {
|
|
85
85
|
height: 44,
|
|
86
|
-
width: "calc(100vw - 32px)",
|
|
87
86
|
marginLeft: 16,
|
|
87
|
+
marginRight: 16,
|
|
88
88
|
borderBottom: "1px solid #E3E3E3"
|
|
89
89
|
},
|
|
90
90
|
align: "center",
|
|
@@ -109,8 +109,7 @@ const DynamicForm = react.forwardRef((props, ref) => {
|
|
|
109
109
|
defaultWidth: (formListItemWidth == null ? void 0 : formListItemWidth[index]) || defaultWidth,
|
|
110
110
|
formItemStyle,
|
|
111
111
|
isFormListItem: true,
|
|
112
|
-
formListField: field
|
|
113
|
-
isShowLabel: false
|
|
112
|
+
formListField: field
|
|
114
113
|
}) }, index);
|
|
115
114
|
}) })
|
|
116
115
|
]
|
package/lib/index.js
CHANGED
package/lib/mock/index.js
CHANGED
|
@@ -5,38 +5,47 @@ const attrList = [
|
|
|
5
5
|
{
|
|
6
6
|
xh: 1,
|
|
7
7
|
asid: "904A28FACAF346DFA63CBEEB3437BDA8",
|
|
8
|
+
astype: 0,
|
|
9
|
+
tname: "tsyy_table",
|
|
8
10
|
attrid: "6970C54A08E54463888CD8F9E7FD851B",
|
|
9
11
|
attrname: "喂药日期",
|
|
10
12
|
attrtype: 0,
|
|
11
13
|
info: '{"input":"multiple-date-picker","range-picker-save":"single","dataType":"string","length":1000}',
|
|
12
14
|
info_base64: 0,
|
|
13
15
|
createtime: "2026-01-05 15:33:36",
|
|
16
|
+
attrvalue: "",
|
|
14
17
|
serialnum: 1,
|
|
15
|
-
|
|
18
|
+
children: []
|
|
16
19
|
},
|
|
17
20
|
{
|
|
18
21
|
xh: 2,
|
|
19
22
|
asid: "904A28FACAF346DFA63CBEEB3437BDA8",
|
|
23
|
+
astype: 0,
|
|
24
|
+
tname: "tsyy_table",
|
|
20
25
|
attrid: "98FD46568CAC4F248B5FD66D52DF5086",
|
|
21
26
|
attrname: "当日次数",
|
|
22
27
|
attrtype: 0,
|
|
23
28
|
info: '{"input":"text","dataType":"string","length":1}',
|
|
24
29
|
info_base64: 0,
|
|
25
30
|
createtime: "2026-01-05 15:33:45",
|
|
31
|
+
attrvalue: "",
|
|
26
32
|
serialnum: 2,
|
|
27
|
-
|
|
33
|
+
children: []
|
|
28
34
|
},
|
|
29
35
|
{
|
|
30
36
|
xh: 3,
|
|
31
37
|
asid: "904A28FACAF346DFA63CBEEB3437BDA8",
|
|
38
|
+
astype: 0,
|
|
39
|
+
tname: "tsyy_table",
|
|
32
40
|
attrid: "E7C4B706E65E4F81B51AAA9D313B5482",
|
|
33
41
|
attrname: "当日时间",
|
|
34
42
|
attrtype: 0,
|
|
35
43
|
info: '{"input":"mult-select","inputType":"local","data":["09:00","10:00","11:00","12:00","13:00","14:00"],"dataType":"string","length":100}',
|
|
36
44
|
info_base64: 0,
|
|
37
45
|
createtime: "2026-01-05 15:34:22",
|
|
46
|
+
attrvalue: "",
|
|
38
47
|
serialnum: 3,
|
|
39
|
-
|
|
48
|
+
children: []
|
|
40
49
|
}
|
|
41
50
|
];
|
|
42
51
|
exports.attrList = attrList;
|
package/lib/utils/method.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare const handleSubmitForm: (originalData: {
|
|
|
15
15
|
isMobile?: boolean;
|
|
16
16
|
guid?: string;
|
|
17
17
|
isListToObj?: boolean;
|
|
18
|
+
isAutoFill?: boolean;
|
|
18
19
|
}, allValues: any) => {
|
|
19
20
|
updatedData: any;
|
|
20
21
|
uploadedFiles: any[];
|
|
@@ -120,3 +121,10 @@ export declare const handleSelectOptions: ({ commonRequestWidthParams, commonReq
|
|
|
120
121
|
actionUrlExtraParams?: object | undefined;
|
|
121
122
|
item: Ijson;
|
|
122
123
|
}) => Promise<any[]>;
|
|
124
|
+
/**
|
|
125
|
+
* 单层详情数据对应到单个属性集
|
|
126
|
+
* @param attrList 属性集列表
|
|
127
|
+
* @param detail 属性集详情 {attrid_attrtype: attrvalue} 格式的数据
|
|
128
|
+
* @returns 处理后的属性集列表,每个属性项包含attrvalue
|
|
129
|
+
*/
|
|
130
|
+
export declare const handleObjDetailToSignleAttrList: (attrList: any[], detail: any) => any[];
|