szld-libs 0.3.76 → 0.3.78
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 +11628 -11572
- package/dist/szld-components.umd.js +55 -55
- package/es/components/DynamicFormMobile/index.d.ts +2 -1
- package/es/components/DynamicFormMobile/index.js +5 -3
- package/es/components/DynamicFormMobile/selectModelBackfillFormItem/index.d.ts +1 -0
- package/es/components/DynamicFormMobile/selectModelBackfillFormItem/index.js +59 -3
- package/es/components/DynamicFormMobile/useDynamicForm.d.ts +1 -0
- package/es/components/DynamicFormMobile/useDynamicForm.js +4 -2
- package/es/index.js +6 -4
- package/es/mock/index.js +98 -11
- package/es/utils/szxkFunc.d.ts +1 -0
- package/es/utils/szxkFunc.js +14 -0
- package/lib/components/DynamicFormMobile/index.d.ts +2 -1
- package/lib/components/DynamicFormMobile/index.js +5 -3
- package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/index.d.ts +1 -0
- package/lib/components/DynamicFormMobile/selectModelBackfillFormItem/index.js +59 -3
- package/lib/components/DynamicFormMobile/useDynamicForm.d.ts +1 -0
- package/lib/components/DynamicFormMobile/useDynamicForm.js +4 -2
- package/lib/index.js +6 -4
- package/lib/mock/index.js +98 -11
- package/lib/utils/szxkFunc.d.ts +1 -0
- package/lib/utils/szxkFunc.js +14 -0
- package/package.json +1 -1
|
@@ -18,6 +18,7 @@ export interface IformConfigItem {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface Ijson {
|
|
21
|
+
'instance-source-number'?: string; // 实例来源编号,配合instance-url使用
|
|
21
22
|
'field-names'?: string; // 级联选择的自定义字段名
|
|
22
23
|
'search-field'?: any; // 是否搜索字段
|
|
23
24
|
'action-url-extra-params'?: { [key: string]: any }; // 弹窗选择对应多个表单字段时,额外的参数
|
|
@@ -45,7 +46,7 @@ export interface Ijson {
|
|
|
45
46
|
'modal-height'?: number;
|
|
46
47
|
//代表弹窗列表表头内容
|
|
47
48
|
'modal-field-list'?: { [key: string]: string }; // 键值对,键为属性名,值为属性显示的列表表头内容
|
|
48
|
-
inputType?: 'local' | 'dictionary' | 'url' | 'system-dictionary';
|
|
49
|
+
inputType?: 'local' | 'dictionary' | 'url' | 'system-dictionary' | 'instance-url';
|
|
49
50
|
data?: string[];
|
|
50
51
|
//代表调用【字典管理系统】的值
|
|
51
52
|
classify?: number | string | undefined;
|
|
@@ -5,7 +5,6 @@ import { Flex, Row } from "antd";
|
|
|
5
5
|
import { Form, Button } from "react-vant";
|
|
6
6
|
import { Plus } from "@react-vant/icons";
|
|
7
7
|
const DynamicForm = forwardRef((props, ref) => {
|
|
8
|
-
const [form] = Form.useForm();
|
|
9
8
|
const {
|
|
10
9
|
formConfig,
|
|
11
10
|
setFormConfig,
|
|
@@ -32,7 +31,9 @@ const DynamicForm = forwardRef((props, ref) => {
|
|
|
32
31
|
formShowType = "form",
|
|
33
32
|
formListItemWidth,
|
|
34
33
|
formListItemName,
|
|
35
|
-
langId = "10001"
|
|
34
|
+
langId = "10001",
|
|
35
|
+
getTitle,
|
|
36
|
+
form
|
|
36
37
|
} = props;
|
|
37
38
|
const delFileListRef = useRef([]);
|
|
38
39
|
const updateDelFileList = (file) => {
|
|
@@ -54,7 +55,8 @@ const DynamicForm = forwardRef((props, ref) => {
|
|
|
54
55
|
actionUrlExtraParams,
|
|
55
56
|
CustomModalComponent,
|
|
56
57
|
hideAttrList,
|
|
57
|
-
langId
|
|
58
|
+
langId,
|
|
59
|
+
getTitle
|
|
58
60
|
});
|
|
59
61
|
useImperativeHandle(ref, () => ({
|
|
60
62
|
getDelFileList: () => {
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Form, App, Select, Table, Modal } from "antd";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
|
+
import useUniversalTable from "../../../hooks/useUniversalTable";
|
|
4
5
|
function SelectModel(props) {
|
|
5
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
item,
|
|
8
|
+
disabled,
|
|
9
|
+
style,
|
|
10
|
+
commonRequestWidthParams,
|
|
11
|
+
commonRequest,
|
|
12
|
+
CustomModalComponent,
|
|
13
|
+
attrid,
|
|
14
|
+
form,
|
|
15
|
+
langId,
|
|
16
|
+
getTitle
|
|
17
|
+
} = props;
|
|
6
18
|
const attrValue = Form.useWatch(attrid, form);
|
|
7
19
|
const { message } = App.useApp();
|
|
8
20
|
const mode = item.input;
|
|
21
|
+
const { handleUniversalHeaderToColumns } = useUniversalTable();
|
|
9
22
|
const [value, setValue] = useState(props.value);
|
|
10
23
|
const [modalVisible, setModalVisible] = useState(false);
|
|
11
24
|
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
|
|
@@ -17,7 +30,7 @@ function SelectModel(props) {
|
|
|
17
30
|
});
|
|
18
31
|
const [dataSource, setDataSource] = useState([]);
|
|
19
32
|
const [total, setTotal] = useState(0);
|
|
20
|
-
const columns = buildColumns();
|
|
33
|
+
const [columns, setColumns] = useState(buildColumns());
|
|
21
34
|
useEffect(() => {
|
|
22
35
|
if (!modalVisible) {
|
|
23
36
|
return;
|
|
@@ -29,7 +42,7 @@ function SelectModel(props) {
|
|
|
29
42
|
setSelectedRecords(selectedRows);
|
|
30
43
|
};
|
|
31
44
|
const getData = async () => {
|
|
32
|
-
var _a;
|
|
45
|
+
var _a, _b, _c, _d, _e;
|
|
33
46
|
if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
34
47
|
setLoading(true);
|
|
35
48
|
try {
|
|
@@ -69,6 +82,49 @@ function SelectModel(props) {
|
|
|
69
82
|
}
|
|
70
83
|
return;
|
|
71
84
|
}
|
|
85
|
+
if (item.inputType === "instance-url" && (item == null ? void 0 : item["instance-source-number"])) {
|
|
86
|
+
const defaultRequestParams = {
|
|
87
|
+
PageName: "PCInstanceData",
|
|
88
|
+
Controlname: "List",
|
|
89
|
+
InterfaceType: "YLFWLRDataList"
|
|
90
|
+
};
|
|
91
|
+
const _params = {
|
|
92
|
+
"source-number": item == null ? void 0 : item["instance-source-number"],
|
|
93
|
+
...params
|
|
94
|
+
};
|
|
95
|
+
try {
|
|
96
|
+
const res = await commonRequestWidthParams(defaultRequestParams, _params);
|
|
97
|
+
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
98
|
+
const list = (_c = ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.list) || []) == null ? void 0 : _c.map((item2, index) => {
|
|
99
|
+
const _rowKey = (params.PageNum - 1) * params.PageSize + index;
|
|
100
|
+
return {
|
|
101
|
+
...item2,
|
|
102
|
+
_rowKey
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
setTotal(((_d = res == null ? void 0 : res.data) == null ? void 0 : _d.number) || 0);
|
|
106
|
+
setDataSource([...list]);
|
|
107
|
+
}
|
|
108
|
+
const config = await commonRequest("YLKHDSelPCParam", {
|
|
109
|
+
"source-number": item == null ? void 0 : item["instance-source-number"]
|
|
110
|
+
});
|
|
111
|
+
if ((config == null ? void 0 : config.ReturnValue) === 1) {
|
|
112
|
+
const configData = (_e = config == null ? void 0 : config.data) == null ? void 0 : _e[item == null ? void 0 : item["instance-source-number"]];
|
|
113
|
+
const universalHeader = (configData == null ? void 0 : configData["universal-header"]) || [];
|
|
114
|
+
const attributeSetId = (configData == null ? void 0 : configData["attribute-set-id"]) || "";
|
|
115
|
+
const list = handleUniversalHeaderToColumns({
|
|
116
|
+
universalHeader,
|
|
117
|
+
attributeSetId,
|
|
118
|
+
getTitle,
|
|
119
|
+
otherLangPageId: "5000000"
|
|
120
|
+
}) || [];
|
|
121
|
+
setColumns([...list]);
|
|
122
|
+
}
|
|
123
|
+
} catch (error) {
|
|
124
|
+
}
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
message.error(langId === "10001" ? "参数配置错误" : "Parameter configuration error");
|
|
72
128
|
message.error(langId === "10001" ? "请配置action-url" : "Please configure action-url");
|
|
73
129
|
};
|
|
74
130
|
const openModal = () => {
|
|
@@ -20,6 +20,7 @@ interface IDynamicFormProps {
|
|
|
20
20
|
setAttrList?: (config: IformConfigItem[]) => void;
|
|
21
21
|
hideAttrList?: string[];
|
|
22
22
|
langId?: string;
|
|
23
|
+
getTitle?: (pageID: string, dataID: string) => string;
|
|
23
24
|
}
|
|
24
25
|
type NestedFormListFieldData = FormListFieldData & {
|
|
25
26
|
parentName?: (string | number)[];
|
|
@@ -30,7 +30,8 @@ function useDynamicForm(props) {
|
|
|
30
30
|
actionUrlExtraParams,
|
|
31
31
|
CustomModalComponent,
|
|
32
32
|
hideAttrList = [],
|
|
33
|
-
langId = "10001"
|
|
33
|
+
langId = "10001",
|
|
34
|
+
getTitle
|
|
34
35
|
} = props;
|
|
35
36
|
const formConfigRef = useRef([]);
|
|
36
37
|
const { message } = App.useApp();
|
|
@@ -530,7 +531,8 @@ function useDynamicForm(props) {
|
|
|
530
531
|
form.setFieldsValue(value);
|
|
531
532
|
},
|
|
532
533
|
disabled: readonly,
|
|
533
|
-
CustomModalComponent
|
|
534
|
+
CustomModalComponent,
|
|
535
|
+
getTitle
|
|
534
536
|
}
|
|
535
537
|
);
|
|
536
538
|
}
|
package/es/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { commonRequestWidthParams, uploadFormAction, commonRequest } from "./services";
|
|
3
3
|
import { handleAttrList } from "./utils/method";
|
|
4
|
-
import { BackHeader,
|
|
4
|
+
import { BackHeader, DynamicFormMobile } from "./main";
|
|
5
5
|
import { BrowserRouter } from "react-router-dom";
|
|
6
|
-
import { ConfigProvider, App
|
|
6
|
+
import { ConfigProvider, App } from "antd";
|
|
7
|
+
import { Form, Button } from "react-vant";
|
|
7
8
|
import { useRef, useState, useEffect } from "react";
|
|
8
9
|
import ReactDOM from "react-dom/client";
|
|
9
10
|
import zhCN from "antd/es/locale/zh_CN";
|
|
10
11
|
import { attrList, langConfig } from "./mock";
|
|
11
12
|
import dayjs from "dayjs";
|
|
13
|
+
import "./utils/szxkFunc";
|
|
12
14
|
const index = "";
|
|
13
15
|
const tableDetail = "";
|
|
14
16
|
dayjs.locale("zh-cn");
|
|
@@ -28,7 +30,7 @@ const Demo = () => {
|
|
|
28
30
|
/* @__PURE__ */ jsx(BackHeader, { title: "页头组件", isBack: true }),
|
|
29
31
|
/* @__PURE__ */ jsx("div", { style: {}, children: /* @__PURE__ */ jsxs(Form, { form, onValuesChange, onFinish, children: [
|
|
30
32
|
/* @__PURE__ */ jsx(
|
|
31
|
-
|
|
33
|
+
DynamicFormMobile,
|
|
32
34
|
{
|
|
33
35
|
formConfig: list,
|
|
34
36
|
readonly: false,
|
|
@@ -44,7 +46,7 @@ const Demo = () => {
|
|
|
44
46
|
langId
|
|
45
47
|
}
|
|
46
48
|
),
|
|
47
|
-
/* @__PURE__ */ jsx(Form.Item, { name: "submit", style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(Button, {
|
|
49
|
+
/* @__PURE__ */ jsx(Form.Item, { name: "submit", style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(Button, { round: true, nativeType: "submit", type: "primary", block: true, children: "提交" }) })
|
|
48
50
|
] }) }),
|
|
49
51
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
50
52
|
"2. 测试循环滚动组件",
|
package/es/mock/index.js
CHANGED
|
@@ -2,25 +2,112 @@ const baseAttrList = [];
|
|
|
2
2
|
const attrList = [
|
|
3
3
|
{
|
|
4
4
|
xh: 1,
|
|
5
|
-
asid: "
|
|
5
|
+
asid: "2FD08E801868439EA44CC593CA27F745",
|
|
6
6
|
astype: 0,
|
|
7
|
-
tname: "
|
|
8
|
-
attrid: "
|
|
9
|
-
attrname: "
|
|
7
|
+
tname: "jy_table2_time",
|
|
8
|
+
attrid: "6A5984BD547449088172BD33F2A965E8",
|
|
9
|
+
attrname: "预定日期",
|
|
10
10
|
attrtype: 0,
|
|
11
|
-
info: '{"input":"range-picker","dataType":"
|
|
11
|
+
info: '{"input":"range-picker","range-picker-save":"range","dataType":"string","length":100,"disable-date-goover":true,"must":true}',
|
|
12
12
|
info_base64: 0,
|
|
13
|
-
createtime: "2026-02-11
|
|
13
|
+
createtime: "2026-02-11 14:27:16",
|
|
14
14
|
attrvalue: "",
|
|
15
15
|
serialnum: 1,
|
|
16
16
|
children: [],
|
|
17
17
|
json: {
|
|
18
18
|
input: "range-picker",
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
"range-picker-save": "range",
|
|
20
|
+
dataType: "string",
|
|
21
|
+
length: 100,
|
|
22
|
+
"disable-date-goover": true,
|
|
23
|
+
must: true
|
|
24
|
+
},
|
|
25
|
+
attrLangConfig: [
|
|
26
|
+
{
|
|
27
|
+
jxqyglbh: "2579",
|
|
28
|
+
lanid: "2708E89E803144B799E775A763583601",
|
|
29
|
+
sysid: "1",
|
|
30
|
+
sysname: "属性集",
|
|
31
|
+
systype: "",
|
|
32
|
+
pageid: "2FD08E801868439EA44CC593CA27F745",
|
|
33
|
+
pageinfo: "DPQ寄养填写信息",
|
|
34
|
+
dataid: "27638FC5E2BA4FB88AFB0A9CF77558F7",
|
|
35
|
+
datainfo: "接走时间",
|
|
36
|
+
dicid: "10001",
|
|
37
|
+
info: "中文",
|
|
38
|
+
content: "接走时间"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
jxqyglbh: "2580",
|
|
42
|
+
lanid: "FD9D30A5508447F7BFAE158A07F97DA1",
|
|
43
|
+
sysid: "1",
|
|
44
|
+
sysname: "属性集",
|
|
45
|
+
systype: "",
|
|
46
|
+
pageid: "2FD08E801868439EA44CC593CA27F745",
|
|
47
|
+
pageinfo: "DPQ寄养填写信息",
|
|
48
|
+
dataid: "4E507938BE7448E5883CFCD9C962707D",
|
|
49
|
+
datainfo: "送到时间",
|
|
50
|
+
dicid: "10001",
|
|
51
|
+
info: "中文",
|
|
52
|
+
content: "送到时间"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
jxqyglbh: "2582",
|
|
56
|
+
lanid: "DBE02B29F07843678E8684D5A509F8EC",
|
|
57
|
+
sysid: "1",
|
|
58
|
+
sysname: "属性集",
|
|
59
|
+
systype: "",
|
|
60
|
+
pageid: "2FD08E801868439EA44CC593CA27F745",
|
|
61
|
+
pageinfo: "DPQ寄养填写信息",
|
|
62
|
+
dataid: "6A5984BD547449088172BD33F2A965E8",
|
|
63
|
+
datainfo: "预定日期",
|
|
64
|
+
dicid: "10001",
|
|
65
|
+
info: "中文",
|
|
66
|
+
content: "预定日期"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
jxqyglbh: "2804",
|
|
70
|
+
lanid: "13455BEAD2054605AF4E7F2808E065F2",
|
|
71
|
+
sysid: "1",
|
|
72
|
+
sysname: "属性集",
|
|
73
|
+
systype: "",
|
|
74
|
+
pageid: "2FD08E801868439EA44CC593CA27F745",
|
|
75
|
+
pageinfo: "DPQ寄养填写信息2",
|
|
76
|
+
dataid: "6A5984BD547449088172BD33F2A965E8",
|
|
77
|
+
datainfo: "表单Dates",
|
|
78
|
+
dicid: "10001",
|
|
79
|
+
info: "中文",
|
|
80
|
+
content: "日期"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
jxqyglbh: "2805",
|
|
84
|
+
lanid: "6D7CCAE35F3F463CBCDC8F6B3416526C",
|
|
85
|
+
sysid: "1",
|
|
86
|
+
sysname: "属性集",
|
|
87
|
+
systype: "",
|
|
88
|
+
pageid: "2FD08E801868439EA44CC593CA27F745",
|
|
89
|
+
pageinfo: "DPQ寄养填写信息2",
|
|
90
|
+
dataid: "4E507938BE7448E5883CFCD9C962707D",
|
|
91
|
+
datainfo: "表单-到店时间",
|
|
92
|
+
dicid: "10001",
|
|
93
|
+
info: "中文",
|
|
94
|
+
content: "到店时间"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
jxqyglbh: "2807",
|
|
98
|
+
lanid: "FAFC582DC6104CF58A8ADEBDCCDA77A7",
|
|
99
|
+
sysid: "1",
|
|
100
|
+
sysname: "属性集",
|
|
101
|
+
systype: "",
|
|
102
|
+
pageid: "2FD08E801868439EA44CC593CA27F745",
|
|
103
|
+
pageinfo: "DPQ寄养填写信息2",
|
|
104
|
+
dataid: "27638FC5E2BA4FB88AFB0A9CF77558F7",
|
|
105
|
+
datainfo: "表单-离店时间",
|
|
106
|
+
dicid: "10001",
|
|
107
|
+
info: "中文",
|
|
108
|
+
content: "离店时间"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
24
111
|
}
|
|
25
112
|
];
|
|
26
113
|
const langConfig = [
|
package/es/utils/szxkFunc.d.ts
CHANGED
package/es/utils/szxkFunc.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
import _ from "lodash";
|
|
1
3
|
const handleGetAttrList = async (params, commonRequest, interfaceType) => {
|
|
2
4
|
var _a;
|
|
3
5
|
try {
|
|
@@ -62,8 +64,20 @@ const handleSetTableRowColor = (record, index, ngColor) => ({
|
|
|
62
64
|
backgroundColor: index !== void 0 && index % 2 === 1 ? (ngColor == null ? void 0 : ngColor[0]) || "var(--bg-color-2)" : (ngColor == null ? void 0 : ngColor[1]) || "var(--bg-color-3)"
|
|
63
65
|
}
|
|
64
66
|
});
|
|
67
|
+
const handleFormatMobileDate = (values, format = "YYYY-MM-DD") => {
|
|
68
|
+
Object.entries(_.cloneDeep(values)).forEach(([key, value]) => {
|
|
69
|
+
if (Array.isArray(value) && value.length > 0 && value[0] instanceof Date) {
|
|
70
|
+
values[key] = value.map((item) => dayjs(item).format(format));
|
|
71
|
+
}
|
|
72
|
+
if (value instanceof Date) {
|
|
73
|
+
values[key] = dayjs(value).format(format);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return values;
|
|
77
|
+
};
|
|
65
78
|
export {
|
|
66
79
|
handleCallSupportCode,
|
|
80
|
+
handleFormatMobileDate,
|
|
67
81
|
handleGetAttrDetail,
|
|
68
82
|
handleGetAttrList,
|
|
69
83
|
handleGetList,
|
|
@@ -18,6 +18,7 @@ export interface IformConfigItem {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface Ijson {
|
|
21
|
+
'instance-source-number'?: string; // 实例来源编号,配合instance-url使用
|
|
21
22
|
'field-names'?: string; // 级联选择的自定义字段名
|
|
22
23
|
'search-field'?: any; // 是否搜索字段
|
|
23
24
|
'action-url-extra-params'?: { [key: string]: any }; // 弹窗选择对应多个表单字段时,额外的参数
|
|
@@ -45,7 +46,7 @@ export interface Ijson {
|
|
|
45
46
|
'modal-height'?: number;
|
|
46
47
|
//代表弹窗列表表头内容
|
|
47
48
|
'modal-field-list'?: { [key: string]: string }; // 键值对,键为属性名,值为属性显示的列表表头内容
|
|
48
|
-
inputType?: 'local' | 'dictionary' | 'url' | 'system-dictionary';
|
|
49
|
+
inputType?: 'local' | 'dictionary' | 'url' | 'system-dictionary' | 'instance-url';
|
|
49
50
|
data?: string[];
|
|
50
51
|
//代表调用【字典管理系统】的值
|
|
51
52
|
classify?: number | string | undefined;
|
|
@@ -6,7 +6,6 @@ const antd = require("antd");
|
|
|
6
6
|
const reactVant = require("react-vant");
|
|
7
7
|
const icons = require("@react-vant/icons");
|
|
8
8
|
const DynamicForm = react.forwardRef((props, ref) => {
|
|
9
|
-
const [form] = reactVant.Form.useForm();
|
|
10
9
|
const {
|
|
11
10
|
formConfig,
|
|
12
11
|
setFormConfig,
|
|
@@ -33,7 +32,9 @@ const DynamicForm = react.forwardRef((props, ref) => {
|
|
|
33
32
|
formShowType = "form",
|
|
34
33
|
formListItemWidth,
|
|
35
34
|
formListItemName,
|
|
36
|
-
langId = "10001"
|
|
35
|
+
langId = "10001",
|
|
36
|
+
getTitle,
|
|
37
|
+
form
|
|
37
38
|
} = props;
|
|
38
39
|
const delFileListRef = react.useRef([]);
|
|
39
40
|
const updateDelFileList = (file) => {
|
|
@@ -55,7 +56,8 @@ const DynamicForm = react.forwardRef((props, ref) => {
|
|
|
55
56
|
actionUrlExtraParams,
|
|
56
57
|
CustomModalComponent,
|
|
57
58
|
hideAttrList,
|
|
58
|
-
langId
|
|
59
|
+
langId,
|
|
60
|
+
getTitle
|
|
59
61
|
});
|
|
60
62
|
react.useImperativeHandle(ref, () => ({
|
|
61
63
|
getDelFileList: () => {
|
|
@@ -3,11 +3,24 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const antd = require("antd");
|
|
5
5
|
const react = require("react");
|
|
6
|
+
const useUniversalTable = require("../../../hooks/useUniversalTable");
|
|
6
7
|
function SelectModel(props) {
|
|
7
|
-
const {
|
|
8
|
+
const {
|
|
9
|
+
item,
|
|
10
|
+
disabled,
|
|
11
|
+
style,
|
|
12
|
+
commonRequestWidthParams,
|
|
13
|
+
commonRequest,
|
|
14
|
+
CustomModalComponent,
|
|
15
|
+
attrid,
|
|
16
|
+
form,
|
|
17
|
+
langId,
|
|
18
|
+
getTitle
|
|
19
|
+
} = props;
|
|
8
20
|
const attrValue = antd.Form.useWatch(attrid, form);
|
|
9
21
|
const { message } = antd.App.useApp();
|
|
10
22
|
const mode = item.input;
|
|
23
|
+
const { handleUniversalHeaderToColumns } = useUniversalTable();
|
|
11
24
|
const [value, setValue] = react.useState(props.value);
|
|
12
25
|
const [modalVisible, setModalVisible] = react.useState(false);
|
|
13
26
|
const [selectedRowKeys, setSelectedRowKeys] = react.useState([]);
|
|
@@ -19,7 +32,7 @@ function SelectModel(props) {
|
|
|
19
32
|
});
|
|
20
33
|
const [dataSource, setDataSource] = react.useState([]);
|
|
21
34
|
const [total, setTotal] = react.useState(0);
|
|
22
|
-
const columns = buildColumns();
|
|
35
|
+
const [columns, setColumns] = react.useState(buildColumns());
|
|
23
36
|
react.useEffect(() => {
|
|
24
37
|
if (!modalVisible) {
|
|
25
38
|
return;
|
|
@@ -31,7 +44,7 @@ function SelectModel(props) {
|
|
|
31
44
|
setSelectedRecords(selectedRows);
|
|
32
45
|
};
|
|
33
46
|
const getData = async () => {
|
|
34
|
-
var _a;
|
|
47
|
+
var _a, _b, _c, _d, _e;
|
|
35
48
|
if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
36
49
|
setLoading(true);
|
|
37
50
|
try {
|
|
@@ -71,6 +84,49 @@ function SelectModel(props) {
|
|
|
71
84
|
}
|
|
72
85
|
return;
|
|
73
86
|
}
|
|
87
|
+
if (item.inputType === "instance-url" && (item == null ? void 0 : item["instance-source-number"])) {
|
|
88
|
+
const defaultRequestParams = {
|
|
89
|
+
PageName: "PCInstanceData",
|
|
90
|
+
Controlname: "List",
|
|
91
|
+
InterfaceType: "YLFWLRDataList"
|
|
92
|
+
};
|
|
93
|
+
const _params = {
|
|
94
|
+
"source-number": item == null ? void 0 : item["instance-source-number"],
|
|
95
|
+
...params
|
|
96
|
+
};
|
|
97
|
+
try {
|
|
98
|
+
const res = await commonRequestWidthParams(defaultRequestParams, _params);
|
|
99
|
+
if ((res == null ? void 0 : res.ReturnValue) === 1) {
|
|
100
|
+
const list = (_c = ((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.list) || []) == null ? void 0 : _c.map((item2, index) => {
|
|
101
|
+
const _rowKey = (params.PageNum - 1) * params.PageSize + index;
|
|
102
|
+
return {
|
|
103
|
+
...item2,
|
|
104
|
+
_rowKey
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
setTotal(((_d = res == null ? void 0 : res.data) == null ? void 0 : _d.number) || 0);
|
|
108
|
+
setDataSource([...list]);
|
|
109
|
+
}
|
|
110
|
+
const config = await commonRequest("YLKHDSelPCParam", {
|
|
111
|
+
"source-number": item == null ? void 0 : item["instance-source-number"]
|
|
112
|
+
});
|
|
113
|
+
if ((config == null ? void 0 : config.ReturnValue) === 1) {
|
|
114
|
+
const configData = (_e = config == null ? void 0 : config.data) == null ? void 0 : _e[item == null ? void 0 : item["instance-source-number"]];
|
|
115
|
+
const universalHeader = (configData == null ? void 0 : configData["universal-header"]) || [];
|
|
116
|
+
const attributeSetId = (configData == null ? void 0 : configData["attribute-set-id"]) || "";
|
|
117
|
+
const list = handleUniversalHeaderToColumns({
|
|
118
|
+
universalHeader,
|
|
119
|
+
attributeSetId,
|
|
120
|
+
getTitle,
|
|
121
|
+
otherLangPageId: "5000000"
|
|
122
|
+
}) || [];
|
|
123
|
+
setColumns([...list]);
|
|
124
|
+
}
|
|
125
|
+
} catch (error) {
|
|
126
|
+
}
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
message.error(langId === "10001" ? "参数配置错误" : "Parameter configuration error");
|
|
74
130
|
message.error(langId === "10001" ? "请配置action-url" : "Please configure action-url");
|
|
75
131
|
};
|
|
76
132
|
const openModal = () => {
|
|
@@ -20,6 +20,7 @@ interface IDynamicFormProps {
|
|
|
20
20
|
setAttrList?: (config: IformConfigItem[]) => void;
|
|
21
21
|
hideAttrList?: string[];
|
|
22
22
|
langId?: string;
|
|
23
|
+
getTitle?: (pageID: string, dataID: string) => string;
|
|
23
24
|
}
|
|
24
25
|
type NestedFormListFieldData = FormListFieldData & {
|
|
25
26
|
parentName?: (string | number)[];
|
|
@@ -31,7 +31,8 @@ function useDynamicForm(props) {
|
|
|
31
31
|
actionUrlExtraParams,
|
|
32
32
|
CustomModalComponent,
|
|
33
33
|
hideAttrList = [],
|
|
34
|
-
langId = "10001"
|
|
34
|
+
langId = "10001",
|
|
35
|
+
getTitle
|
|
35
36
|
} = props;
|
|
36
37
|
const formConfigRef = react.useRef([]);
|
|
37
38
|
const { message } = antd.App.useApp();
|
|
@@ -531,7 +532,8 @@ function useDynamicForm(props) {
|
|
|
531
532
|
form.setFieldsValue(value);
|
|
532
533
|
},
|
|
533
534
|
disabled: readonly,
|
|
534
|
-
CustomModalComponent
|
|
535
|
+
CustomModalComponent,
|
|
536
|
+
getTitle
|
|
535
537
|
}
|
|
536
538
|
);
|
|
537
539
|
}
|
package/lib/index.js
CHANGED
|
@@ -5,17 +5,19 @@ const method = require("./utils/method");
|
|
|
5
5
|
const main = require("./main");
|
|
6
6
|
const reactRouterDom = require("react-router-dom");
|
|
7
7
|
const antd = require("antd");
|
|
8
|
+
const reactVant = require("react-vant");
|
|
8
9
|
const react = require("react");
|
|
9
10
|
const ReactDOM = require("react-dom/client");
|
|
10
11
|
const zhCN = require("antd/es/locale/zh_CN");
|
|
11
12
|
const mock = require("./mock");
|
|
12
13
|
const dayjs = require("dayjs");
|
|
14
|
+
require("./utils/szxkFunc");
|
|
13
15
|
const index = "";
|
|
14
16
|
const tableDetail = "";
|
|
15
17
|
dayjs.locale("zh-cn");
|
|
16
18
|
const Demo = () => {
|
|
17
19
|
const formRef = react.useRef(null);
|
|
18
|
-
const [form] =
|
|
20
|
+
const [form] = reactVant.Form.useForm();
|
|
19
21
|
const [list, setList] = react.useState([]);
|
|
20
22
|
const [langId, setLangId] = react.useState("");
|
|
21
23
|
const onValuesChange = async (values, allValues) => {
|
|
@@ -27,9 +29,9 @@ const Demo = () => {
|
|
|
27
29
|
};
|
|
28
30
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
29
31
|
/* @__PURE__ */ jsxRuntime.jsx(main.BackHeader, { title: "页头组件", isBack: true }),
|
|
30
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: {}, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
32
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: {}, children: /* @__PURE__ */ jsxRuntime.jsxs(reactVant.Form, { form, onValuesChange, onFinish, children: [
|
|
31
33
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
-
main.
|
|
34
|
+
main.DynamicFormMobile,
|
|
33
35
|
{
|
|
34
36
|
formConfig: list,
|
|
35
37
|
readonly: false,
|
|
@@ -45,7 +47,7 @@ const Demo = () => {
|
|
|
45
47
|
langId
|
|
46
48
|
}
|
|
47
49
|
),
|
|
48
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
50
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactVant.Form.Item, { name: "submit", style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(reactVant.Button, { round: true, nativeType: "submit", type: "primary", block: true, children: "提交" }) })
|
|
49
51
|
] }) }),
|
|
50
52
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
51
53
|
"2. 测试循环滚动组件",
|