szld-libs 0.3.67 → 0.3.68
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 +10258 -10218
- package/dist/szld-components.umd.js +56 -56
- package/es/components/DynamicForm/index.d.ts +2 -1
- package/es/components/DynamicForm/selectModelBackfillFormItem/index.d.ts +1 -0
- package/es/components/DynamicForm/selectModelBackfillFormItem/index.js +51 -3
- package/es/components/DynamicForm/useDynamicForm.d.ts +1 -0
- package/es/components/DynamicForm/useDynamicForm.js +3 -1
- package/es/hooks/useUniversalTable.d.ts +1 -1
- package/lib/components/DynamicForm/index.d.ts +2 -1
- package/lib/components/DynamicForm/selectModelBackfillFormItem/index.d.ts +1 -0
- package/lib/components/DynamicForm/selectModelBackfillFormItem/index.js +51 -3
- package/lib/components/DynamicForm/useDynamicForm.d.ts +1 -0
- package/lib/components/DynamicForm/useDynamicForm.js +3 -1
- package/lib/hooks/useUniversalTable.d.ts +1 -1
- 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
|
'max-tag-count'?: number; // 最大标签数量
|
|
22
23
|
readonly: boolean; // 是否只读属性
|
|
23
24
|
'field-names'?: string; // 级联选择的自定义字段名
|
|
@@ -47,7 +48,7 @@ export interface Ijson {
|
|
|
47
48
|
'modal-height'?: number;
|
|
48
49
|
//代表弹窗列表表头内容
|
|
49
50
|
'modal-field-list'?: { [key: string]: string }; // 键值对,键为属性名,值为属性显示的列表表头内容
|
|
50
|
-
inputType?: 'local' | 'dictionary' | 'url' | 'system-dictionary';
|
|
51
|
+
inputType?: 'local' | 'dictionary' | 'url' | 'system-dictionary' | 'instance-url';
|
|
51
52
|
data?: string[];
|
|
52
53
|
//代表调用【字典管理系统】的值
|
|
53
54
|
classify?: number | string | undefined;
|
|
@@ -13,6 +13,7 @@ interface SelectModelProps {
|
|
|
13
13
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
14
14
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
15
15
|
CustomModalComponent?: React.FC<ICustomModal>;
|
|
16
|
+
getTitle?: (pageID: string, dataID: string) => string;
|
|
16
17
|
attrid: string;
|
|
17
18
|
form: FormInstance;
|
|
18
19
|
langId?: string;
|
|
@@ -2,8 +2,20 @@ 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
4
|
import { handleGetPlaceholder } from "../func";
|
|
5
|
+
import useUniversalTable from "../../../hooks/useUniversalTable";
|
|
5
6
|
function SelectModel(props) {
|
|
6
|
-
const {
|
|
7
|
+
const {
|
|
8
|
+
item,
|
|
9
|
+
disabled,
|
|
10
|
+
style,
|
|
11
|
+
commonRequestWidthParams,
|
|
12
|
+
commonRequest,
|
|
13
|
+
CustomModalComponent,
|
|
14
|
+
attrid,
|
|
15
|
+
form,
|
|
16
|
+
langId,
|
|
17
|
+
getTitle
|
|
18
|
+
} = props;
|
|
7
19
|
const attrValue = Form.useWatch(attrid, form);
|
|
8
20
|
const { message } = App.useApp();
|
|
9
21
|
const mode = item.input;
|
|
@@ -18,7 +30,8 @@ function SelectModel(props) {
|
|
|
18
30
|
});
|
|
19
31
|
const [dataSource, setDataSource] = useState([]);
|
|
20
32
|
const [total, setTotal] = useState(0);
|
|
21
|
-
const columns = buildColumns();
|
|
33
|
+
const [columns, setColumns] = useState(buildColumns());
|
|
34
|
+
const { handleUniversalHeaderToColumns } = useUniversalTable();
|
|
22
35
|
useEffect(() => {
|
|
23
36
|
if (!modalVisible) {
|
|
24
37
|
return;
|
|
@@ -30,7 +43,7 @@ function SelectModel(props) {
|
|
|
30
43
|
setSelectedRecords(selectedRows);
|
|
31
44
|
};
|
|
32
45
|
const getData = async () => {
|
|
33
|
-
var _a;
|
|
46
|
+
var _a, _b;
|
|
34
47
|
if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
35
48
|
setLoading(true);
|
|
36
49
|
try {
|
|
@@ -69,6 +82,38 @@ 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
|
+
setDataSource(((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.list) || []);
|
|
99
|
+
}
|
|
100
|
+
const config = await commonRequest("YLKHDSelPCParam", {
|
|
101
|
+
"source-number": item == null ? void 0 : item["instance-source-number"]
|
|
102
|
+
});
|
|
103
|
+
if ((config == null ? void 0 : config.ReturnValue) === 1) {
|
|
104
|
+
const configData = config == null ? void 0 : config.data;
|
|
105
|
+
const universalHeader = (configData == null ? void 0 : configData["universal-header"]) || [];
|
|
106
|
+
const attributeSetId = (configData == null ? void 0 : configData["attribute-set-id"]) || "";
|
|
107
|
+
const list = handleUniversalHeaderToColumns({
|
|
108
|
+
universalHeader,
|
|
109
|
+
attributeSetId,
|
|
110
|
+
getTitle
|
|
111
|
+
}) || [];
|
|
112
|
+
setColumns(list);
|
|
113
|
+
}
|
|
114
|
+
} catch (error) {
|
|
115
|
+
}
|
|
116
|
+
}
|
|
72
117
|
message.error(langId === "10001" ? "参数配置错误" : "Parameter configuration error");
|
|
73
118
|
};
|
|
74
119
|
const openModal = () => {
|
|
@@ -122,6 +167,9 @@ function SelectModel(props) {
|
|
|
122
167
|
};
|
|
123
168
|
function buildColumns() {
|
|
124
169
|
const modalFieldList = item["modal-field-list"];
|
|
170
|
+
if (!modalFieldList) {
|
|
171
|
+
return [];
|
|
172
|
+
}
|
|
125
173
|
let columns2 = [];
|
|
126
174
|
for (let fieldName in modalFieldList) {
|
|
127
175
|
let title = modalFieldList[fieldName];
|
|
@@ -18,6 +18,7 @@ interface IDynamicFormProps {
|
|
|
18
18
|
isEdit?: boolean;
|
|
19
19
|
formShowType?: 'form' | 'table';
|
|
20
20
|
langId?: string;
|
|
21
|
+
getTitle?: (pageID: string, dataID: string) => string;
|
|
21
22
|
}
|
|
22
23
|
type NestedFormListFieldData = FormListFieldData & {
|
|
23
24
|
parentName?: (string | number)[];
|
|
@@ -30,7 +30,8 @@ function useDynamicForm(props) {
|
|
|
30
30
|
CustomModalComponent,
|
|
31
31
|
isEdit,
|
|
32
32
|
formShowType = "form",
|
|
33
|
-
langId
|
|
33
|
+
langId,
|
|
34
|
+
getTitle
|
|
34
35
|
} = props;
|
|
35
36
|
const formConfigRef = useRef([]);
|
|
36
37
|
const { message } = App.useApp();
|
|
@@ -556,6 +557,7 @@ function useDynamicForm(props) {
|
|
|
556
557
|
item: item.json,
|
|
557
558
|
form,
|
|
558
559
|
attrid,
|
|
560
|
+
getTitle,
|
|
559
561
|
value: item.attrvalue || item.json.default || "",
|
|
560
562
|
commonRequestWidthParams,
|
|
561
563
|
commonRequest,
|
|
@@ -6,7 +6,7 @@ declare function useUniversalTable(): {
|
|
|
6
6
|
extraBtn?: ((record: any, content: string, item: any) => ReactNode) | undefined;
|
|
7
7
|
operationColumnConfig?: any;
|
|
8
8
|
attributeSetId?: string | undefined;
|
|
9
|
-
getTitle?: ((
|
|
9
|
+
getTitle?: ((pageID: string, dataID: string) => string) | undefined;
|
|
10
10
|
downloadText?: string | undefined;
|
|
11
11
|
isDefaultWidth?: boolean | undefined;
|
|
12
12
|
otherLangPageId?: string | undefined;
|
|
@@ -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
|
'max-tag-count'?: number; // 最大标签数量
|
|
22
23
|
readonly: boolean; // 是否只读属性
|
|
23
24
|
'field-names'?: string; // 级联选择的自定义字段名
|
|
@@ -47,7 +48,7 @@ export interface Ijson {
|
|
|
47
48
|
'modal-height'?: number;
|
|
48
49
|
//代表弹窗列表表头内容
|
|
49
50
|
'modal-field-list'?: { [key: string]: string }; // 键值对,键为属性名,值为属性显示的列表表头内容
|
|
50
|
-
inputType?: 'local' | 'dictionary' | 'url' | 'system-dictionary';
|
|
51
|
+
inputType?: 'local' | 'dictionary' | 'url' | 'system-dictionary' | 'instance-url';
|
|
51
52
|
data?: string[];
|
|
52
53
|
//代表调用【字典管理系统】的值
|
|
53
54
|
classify?: number | string | undefined;
|
|
@@ -13,6 +13,7 @@ interface SelectModelProps {
|
|
|
13
13
|
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
14
14
|
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
15
15
|
CustomModalComponent?: React.FC<ICustomModal>;
|
|
16
|
+
getTitle?: (pageID: string, dataID: string) => string;
|
|
16
17
|
attrid: string;
|
|
17
18
|
form: FormInstance;
|
|
18
19
|
langId?: string;
|
|
@@ -4,8 +4,20 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const antd = require("antd");
|
|
5
5
|
const react = require("react");
|
|
6
6
|
const func = require("../func");
|
|
7
|
+
const useUniversalTable = require("../../../hooks/useUniversalTable");
|
|
7
8
|
function SelectModel(props) {
|
|
8
|
-
const {
|
|
9
|
+
const {
|
|
10
|
+
item,
|
|
11
|
+
disabled,
|
|
12
|
+
style,
|
|
13
|
+
commonRequestWidthParams,
|
|
14
|
+
commonRequest,
|
|
15
|
+
CustomModalComponent,
|
|
16
|
+
attrid,
|
|
17
|
+
form,
|
|
18
|
+
langId,
|
|
19
|
+
getTitle
|
|
20
|
+
} = props;
|
|
9
21
|
const attrValue = antd.Form.useWatch(attrid, form);
|
|
10
22
|
const { message } = antd.App.useApp();
|
|
11
23
|
const mode = item.input;
|
|
@@ -20,7 +32,8 @@ function SelectModel(props) {
|
|
|
20
32
|
});
|
|
21
33
|
const [dataSource, setDataSource] = react.useState([]);
|
|
22
34
|
const [total, setTotal] = react.useState(0);
|
|
23
|
-
const columns = buildColumns();
|
|
35
|
+
const [columns, setColumns] = react.useState(buildColumns());
|
|
36
|
+
const { handleUniversalHeaderToColumns } = useUniversalTable();
|
|
24
37
|
react.useEffect(() => {
|
|
25
38
|
if (!modalVisible) {
|
|
26
39
|
return;
|
|
@@ -32,7 +45,7 @@ function SelectModel(props) {
|
|
|
32
45
|
setSelectedRecords(selectedRows);
|
|
33
46
|
};
|
|
34
47
|
const getData = async () => {
|
|
35
|
-
var _a;
|
|
48
|
+
var _a, _b;
|
|
36
49
|
if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
37
50
|
setLoading(true);
|
|
38
51
|
try {
|
|
@@ -71,6 +84,38 @@ 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
|
+
setDataSource(((_b = res == null ? void 0 : res.data) == null ? void 0 : _b.list) || []);
|
|
101
|
+
}
|
|
102
|
+
const config = await commonRequest("YLKHDSelPCParam", {
|
|
103
|
+
"source-number": item == null ? void 0 : item["instance-source-number"]
|
|
104
|
+
});
|
|
105
|
+
if ((config == null ? void 0 : config.ReturnValue) === 1) {
|
|
106
|
+
const configData = config == null ? void 0 : config.data;
|
|
107
|
+
const universalHeader = (configData == null ? void 0 : configData["universal-header"]) || [];
|
|
108
|
+
const attributeSetId = (configData == null ? void 0 : configData["attribute-set-id"]) || "";
|
|
109
|
+
const list = handleUniversalHeaderToColumns({
|
|
110
|
+
universalHeader,
|
|
111
|
+
attributeSetId,
|
|
112
|
+
getTitle
|
|
113
|
+
}) || [];
|
|
114
|
+
setColumns(list);
|
|
115
|
+
}
|
|
116
|
+
} catch (error) {
|
|
117
|
+
}
|
|
118
|
+
}
|
|
74
119
|
message.error(langId === "10001" ? "参数配置错误" : "Parameter configuration error");
|
|
75
120
|
};
|
|
76
121
|
const openModal = () => {
|
|
@@ -124,6 +169,9 @@ function SelectModel(props) {
|
|
|
124
169
|
};
|
|
125
170
|
function buildColumns() {
|
|
126
171
|
const modalFieldList = item["modal-field-list"];
|
|
172
|
+
if (!modalFieldList) {
|
|
173
|
+
return [];
|
|
174
|
+
}
|
|
127
175
|
let columns2 = [];
|
|
128
176
|
for (let fieldName in modalFieldList) {
|
|
129
177
|
let title = modalFieldList[fieldName];
|
|
@@ -18,6 +18,7 @@ interface IDynamicFormProps {
|
|
|
18
18
|
isEdit?: boolean;
|
|
19
19
|
formShowType?: 'form' | 'table';
|
|
20
20
|
langId?: string;
|
|
21
|
+
getTitle?: (pageID: string, dataID: string) => string;
|
|
21
22
|
}
|
|
22
23
|
type NestedFormListFieldData = FormListFieldData & {
|
|
23
24
|
parentName?: (string | number)[];
|
|
@@ -31,7 +31,8 @@ function useDynamicForm(props) {
|
|
|
31
31
|
CustomModalComponent,
|
|
32
32
|
isEdit,
|
|
33
33
|
formShowType = "form",
|
|
34
|
-
langId
|
|
34
|
+
langId,
|
|
35
|
+
getTitle
|
|
35
36
|
} = props;
|
|
36
37
|
const formConfigRef = react.useRef([]);
|
|
37
38
|
const { message } = antd.App.useApp();
|
|
@@ -557,6 +558,7 @@ function useDynamicForm(props) {
|
|
|
557
558
|
item: item.json,
|
|
558
559
|
form,
|
|
559
560
|
attrid,
|
|
561
|
+
getTitle,
|
|
560
562
|
value: item.attrvalue || item.json.default || "",
|
|
561
563
|
commonRequestWidthParams,
|
|
562
564
|
commonRequest,
|
|
@@ -6,7 +6,7 @@ declare function useUniversalTable(): {
|
|
|
6
6
|
extraBtn?: ((record: any, content: string, item: any) => ReactNode) | undefined;
|
|
7
7
|
operationColumnConfig?: any;
|
|
8
8
|
attributeSetId?: string | undefined;
|
|
9
|
-
getTitle?: ((
|
|
9
|
+
getTitle?: ((pageID: string, dataID: string) => string) | undefined;
|
|
10
10
|
downloadText?: string | undefined;
|
|
11
11
|
isDefaultWidth?: boolean | undefined;
|
|
12
12
|
otherLangPageId?: string | undefined;
|