szld-libs 0.3.66 → 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 +12955 -12906
- package/dist/szld-components.umd.js +55 -55
- 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 +10 -4
- package/es/hooks/useUniversalTable.d.ts +3 -2
- package/es/hooks/useUniversalTable.js +180 -164
- 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 +10 -4
- package/lib/hooks/useUniversalTable.d.ts +3 -2
- package/lib/hooks/useUniversalTable.js +180 -164
- 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();
|
|
@@ -115,9 +116,13 @@ function useDynamicForm(props) {
|
|
|
115
116
|
break;
|
|
116
117
|
case "range-picker":
|
|
117
118
|
baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.map((d) => d == null ? void 0 : d.format(format || "YYYY-MM-DD"));
|
|
118
|
-
baseProps.getValueProps = (value) =>
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
baseProps.getValueProps = (value) => {
|
|
120
|
+
if (!(value == null ? void 0 : value.length) && !Array.isArray(value))
|
|
121
|
+
return { value: null };
|
|
122
|
+
return {
|
|
123
|
+
value: (value == null ? void 0 : value.map((v) => dayjs(v))) || null
|
|
124
|
+
};
|
|
125
|
+
};
|
|
121
126
|
break;
|
|
122
127
|
case "multiple-date-picker":
|
|
123
128
|
baseProps.getValueFromEvent = (date) => date == null ? void 0 : date.map((d) => d == null ? void 0 : d.format(format || "YYYY-MM-DD"));
|
|
@@ -552,6 +557,7 @@ function useDynamicForm(props) {
|
|
|
552
557
|
item: item.json,
|
|
553
558
|
form,
|
|
554
559
|
attrid,
|
|
560
|
+
getTitle,
|
|
555
561
|
value: item.attrvalue || item.json.default || "",
|
|
556
562
|
commonRequestWidthParams,
|
|
557
563
|
commonRequest,
|
|
@@ -6,13 +6,13 @@ 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;
|
|
13
13
|
objDefaultLangPageId?: string | undefined;
|
|
14
14
|
}) => any[] | import("antd/es/message/interface").MessageType;
|
|
15
|
-
handleSelListToFormItems: ({ selListData, handleSearch, handleReset, detail, styles, attributeSetId, commonRequest, commonRequestWidthParams, getTitle, searchText, resetText, }: {
|
|
15
|
+
handleSelListToFormItems: ({ selListData, handleSearch, handleReset, detail, styles, attributeSetId, commonRequest, commonRequestWidthParams, getTitle, searchText, resetText, langConfig, }: {
|
|
16
16
|
selListData: any[];
|
|
17
17
|
handleSearch: (values: any, selListData: any[]) => void;
|
|
18
18
|
handleReset: (values: any) => void;
|
|
@@ -24,6 +24,7 @@ declare function useUniversalTable(): {
|
|
|
24
24
|
getTitle?: ((commonId: string, code: string, defaultTitle?: string) => string) | undefined;
|
|
25
25
|
searchText?: string | undefined;
|
|
26
26
|
resetText?: string | undefined;
|
|
27
|
+
langConfig?: any;
|
|
27
28
|
}) => Promise<{
|
|
28
29
|
formItems: import("szld-libs/lib/components/CreateForm").CreateFormItemProps<import("szld-libs/lib/components/CreateForm").ValueType>[];
|
|
29
30
|
selList: any[];
|
|
@@ -5,6 +5,7 @@ import { App, Flex, Space, Button, Tooltip } from "antd";
|
|
|
5
5
|
import { downloadUrl } from "../utils/download";
|
|
6
6
|
function useUniversalTable() {
|
|
7
7
|
const { message, modal } = App.useApp();
|
|
8
|
+
const attrListCache = {};
|
|
8
9
|
const handleSelListToFormItems = async ({
|
|
9
10
|
selListData,
|
|
10
11
|
handleSearch,
|
|
@@ -16,181 +17,196 @@ function useUniversalTable() {
|
|
|
16
17
|
commonRequestWidthParams,
|
|
17
18
|
getTitle,
|
|
18
19
|
searchText = "搜索",
|
|
19
|
-
resetText = "重置"
|
|
20
|
+
resetText = "重置",
|
|
21
|
+
langConfig = []
|
|
20
22
|
}) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var _a;
|
|
32
|
-
return ((_a = item.renderdata) == null ? void 0 : _a.input) !== "tab";
|
|
33
|
-
});
|
|
34
|
-
const selectItems = searchItems.filter(
|
|
35
|
-
(item) => {
|
|
36
|
-
var _a;
|
|
37
|
-
return ["select", "checkbox", "radio", "mult-select", "cascader"].includes((_a = item.renderdata) == null ? void 0 : _a.input);
|
|
23
|
+
var _a;
|
|
24
|
+
try {
|
|
25
|
+
if ((selListData == null ? void 0 : selListData.length) && detail) {
|
|
26
|
+
selListData.forEach((item) => {
|
|
27
|
+
var _a2;
|
|
28
|
+
const key = ((_a2 = item["default-render-data"]) == null ? void 0 : _a2.key) || "";
|
|
29
|
+
if (key) {
|
|
30
|
+
item.attrvalue = (detail == null ? void 0 : detail[key]) || "";
|
|
31
|
+
}
|
|
32
|
+
});
|
|
38
33
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
asid: attributeSetId
|
|
45
|
-
},
|
|
46
|
-
commonRequest
|
|
34
|
+
const searchItems = selListData.filter(
|
|
35
|
+
(item) => {
|
|
36
|
+
var _a2;
|
|
37
|
+
return ((_a2 = item.renderdata) == null ? void 0 : _a2.input) !== "tab" && !(item == null ? void 0 : item["default-render-data"]);
|
|
38
|
+
}
|
|
47
39
|
);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var _a;
|
|
53
|
-
const renderdata = item.renderdata || {};
|
|
54
|
-
const { input, width } = renderdata || {};
|
|
55
|
-
const labelCol = (renderdata == null ? void 0 : renderdata["label-col"]) || 6;
|
|
56
|
-
const renderPlaceholder = () => {
|
|
57
|
-
const value = renderdata["default-prompt"];
|
|
58
|
-
if (getTitle) {
|
|
59
|
-
if (typeof value === "string") {
|
|
60
|
-
return getTitle(attributeSetId, item.attrid, value);
|
|
61
|
-
} else if (Array.isArray(value)) {
|
|
62
|
-
return [
|
|
63
|
-
getTitle(attributeSetId, `${item.attrid}_1`, value[0]),
|
|
64
|
-
getTitle(attributeSetId, `${item.attrid}_2`, value[1])
|
|
65
|
-
];
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
return value || "";
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
let valueType = "input";
|
|
72
|
-
switch (input) {
|
|
73
|
-
case "range-picker":
|
|
74
|
-
valueType = "rangePicker";
|
|
75
|
-
break;
|
|
76
|
-
case "number":
|
|
77
|
-
valueType = "inputNumber";
|
|
78
|
-
break;
|
|
79
|
-
case "select":
|
|
80
|
-
case "checkbox":
|
|
81
|
-
case "radio":
|
|
82
|
-
case "textarea":
|
|
83
|
-
valueType = input;
|
|
84
|
-
break;
|
|
85
|
-
case "mult-select":
|
|
86
|
-
valueType = "select";
|
|
87
|
-
break;
|
|
88
|
-
case "time-picker":
|
|
89
|
-
valueType = "timePicker";
|
|
90
|
-
break;
|
|
91
|
-
case "date-picker":
|
|
92
|
-
valueType = "datePicker";
|
|
93
|
-
break;
|
|
94
|
-
case "cascader":
|
|
95
|
-
valueType = "cascader";
|
|
96
|
-
break;
|
|
97
|
-
default:
|
|
98
|
-
valueType = "input";
|
|
99
|
-
break;
|
|
40
|
+
const selectItems = searchItems.filter(
|
|
41
|
+
(item) => {
|
|
42
|
+
var _a2;
|
|
43
|
+
return ["select", "checkbox", "radio", "mult-select", "cascader"].includes((_a2 = item.renderdata) == null ? void 0 : _a2.input);
|
|
100
44
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
45
|
+
);
|
|
46
|
+
let attrList = [];
|
|
47
|
+
if (selectItems == null ? void 0 : selectItems.length) {
|
|
48
|
+
if ((_a = attrListCache[attributeSetId]) == null ? void 0 : _a.length) {
|
|
49
|
+
attrList = attrListCache[attributeSetId];
|
|
50
|
+
} else {
|
|
51
|
+
const list = await handleGetAttrList(
|
|
52
|
+
{
|
|
53
|
+
asid: attributeSetId
|
|
54
|
+
},
|
|
55
|
+
commonRequest
|
|
56
|
+
);
|
|
57
|
+
attrList = handleBaseAttrList(list) || [];
|
|
58
|
+
attrListCache[attributeSetId] = attrList || [];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const formItems = await Promise.all(
|
|
62
|
+
searchItems.map(async (item) => {
|
|
63
|
+
var _a2;
|
|
64
|
+
const renderdata = item.renderdata || {};
|
|
65
|
+
const { input, width } = renderdata || {};
|
|
66
|
+
const labelCol = (renderdata == null ? void 0 : renderdata["label-col"]) || 6;
|
|
67
|
+
const renderPlaceholder = () => {
|
|
68
|
+
const value = renderdata["default-prompt"];
|
|
69
|
+
if (getTitle) {
|
|
70
|
+
if (typeof value === "string") {
|
|
71
|
+
const getTitleResult = getTitle(attributeSetId || "", value);
|
|
72
|
+
const isGetTitleArrayStr = isArrayString(getTitleResult);
|
|
73
|
+
if (input === "range-picker" && value && isGetTitleArrayStr) {
|
|
74
|
+
return JSON.parse(getTitleResult);
|
|
75
|
+
} else {
|
|
76
|
+
return getTitleResult;
|
|
77
|
+
}
|
|
126
78
|
}
|
|
127
|
-
}
|
|
79
|
+
} else {
|
|
80
|
+
return value || "";
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
let valueType = "input";
|
|
84
|
+
switch (input) {
|
|
85
|
+
case "range-picker":
|
|
86
|
+
valueType = "rangePicker";
|
|
87
|
+
break;
|
|
88
|
+
case "number":
|
|
89
|
+
valueType = "inputNumber";
|
|
90
|
+
break;
|
|
91
|
+
case "select":
|
|
92
|
+
case "checkbox":
|
|
93
|
+
case "radio":
|
|
94
|
+
case "textarea":
|
|
95
|
+
valueType = input;
|
|
96
|
+
break;
|
|
97
|
+
case "mult-select":
|
|
98
|
+
valueType = "select";
|
|
99
|
+
break;
|
|
100
|
+
case "time-picker":
|
|
101
|
+
valueType = "timePicker";
|
|
102
|
+
break;
|
|
103
|
+
case "date-picker":
|
|
104
|
+
valueType = "datePicker";
|
|
105
|
+
break;
|
|
106
|
+
case "cascader":
|
|
107
|
+
valueType = "cascader";
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
valueType = "input";
|
|
111
|
+
break;
|
|
128
112
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
113
|
+
const formItem = {
|
|
114
|
+
dataIndex: item.attrid,
|
|
115
|
+
title: item.attrname || "",
|
|
116
|
+
valueType,
|
|
117
|
+
valueProps: {
|
|
118
|
+
placeholder: renderPlaceholder()
|
|
119
|
+
},
|
|
120
|
+
colProps: {},
|
|
121
|
+
formItemProps: {
|
|
122
|
+
style: { marginBottom: 10, width: typeof width === "string" ? `${width}px` : width || 240 },
|
|
123
|
+
labelCol: { span: labelCol }
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
if (["select", "checkbox", "radio", "mult-select", "cascader"].includes(input)) {
|
|
127
|
+
const attrid = item.attrid || "";
|
|
128
|
+
const attrItem = attrList.find((attrItem2) => attrItem2.attrid === attrid);
|
|
129
|
+
let json = (attrItem == null ? void 0 : attrItem.json) || {};
|
|
130
|
+
if (!(json == null ? void 0 : json.inputType) && (renderdata == null ? void 0 : renderdata["input-type"])) {
|
|
131
|
+
json = {
|
|
132
|
+
...json,
|
|
133
|
+
inputType: renderdata == null ? void 0 : renderdata["input-type"],
|
|
134
|
+
"action-url": renderdata == null ? void 0 : renderdata["action-url"],
|
|
135
|
+
"field-names": renderdata == null ? void 0 : renderdata["field-names"],
|
|
136
|
+
"key-field": {
|
|
137
|
+
...renderdata == null ? void 0 : renderdata["key-field"]
|
|
138
|
+
}
|
|
139
|
+
};
|
|
141
140
|
}
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
let options = await handleSelectOptions({
|
|
142
|
+
item: json || {},
|
|
143
|
+
commonRequest,
|
|
144
|
+
commonRequestWidthParams,
|
|
145
|
+
langConfig: langConfig || []
|
|
146
|
+
});
|
|
147
|
+
if (!(options == null ? void 0 : options.length)) {
|
|
148
|
+
const { data = [] } = renderdata || {};
|
|
149
|
+
if (data == null ? void 0 : data.length) {
|
|
150
|
+
options = data == null ? void 0 : data.map((v) => ({
|
|
151
|
+
label: v || "",
|
|
152
|
+
value: v || ""
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
if ((_a2 = renderdata == null ? void 0 : renderdata.options) == null ? void 0 : _a2.length) {
|
|
156
|
+
options = (renderdata == null ? void 0 : renderdata.options) || [];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (input === "cascader") {
|
|
160
|
+
const _options = handleCascaderOptions(options, renderdata == null ? void 0 : renderdata["field-names"]);
|
|
161
|
+
formItem.valueProps.options = _options || [];
|
|
162
|
+
} else {
|
|
163
|
+
formItem.valueProps.options = options || [];
|
|
144
164
|
}
|
|
145
165
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
166
|
+
return formItem;
|
|
167
|
+
})
|
|
168
|
+
);
|
|
169
|
+
let defaultSearchStyle = {
|
|
170
|
+
color: "#ffffff",
|
|
171
|
+
borderRadius: 4,
|
|
172
|
+
fontSize: 14,
|
|
173
|
+
height: 32
|
|
174
|
+
};
|
|
175
|
+
let defaultResetStyle = {
|
|
176
|
+
color: "#333333",
|
|
177
|
+
borderRadius: 4,
|
|
178
|
+
fontSize: 14,
|
|
179
|
+
height: 32,
|
|
180
|
+
borderColor: "#D9D9D9"
|
|
181
|
+
};
|
|
182
|
+
formItems.push({
|
|
183
|
+
dataIndex: "btns",
|
|
184
|
+
valueType: "btns",
|
|
185
|
+
valueProps: [
|
|
186
|
+
{
|
|
187
|
+
btnType: "submit",
|
|
188
|
+
title: searchText,
|
|
189
|
+
type: "primary",
|
|
190
|
+
shape: "default",
|
|
191
|
+
style: { ...defaultSearchStyle, ...styles == null ? void 0 : styles.searchStyle },
|
|
192
|
+
onClick: (values) => handleSearch(values, selListData)
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
btnType: "reset",
|
|
196
|
+
title: resetText,
|
|
197
|
+
style: { ...defaultResetStyle, ...styles == null ? void 0 : styles.resetStyle },
|
|
198
|
+
onClick: () => handleReset(selListData)
|
|
151
199
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
);
|
|
156
|
-
let defaultSearchStyle = {
|
|
157
|
-
color: "#ffffff",
|
|
158
|
-
borderRadius: 4,
|
|
159
|
-
fontSize: 14,
|
|
160
|
-
height: 32
|
|
161
|
-
};
|
|
162
|
-
let defaultResetStyle = {
|
|
163
|
-
color: "#333333",
|
|
164
|
-
borderRadius: 4,
|
|
165
|
-
fontSize: 14,
|
|
166
|
-
height: 32,
|
|
167
|
-
borderColor: "#D9D9D9"
|
|
168
|
-
};
|
|
169
|
-
formItems.push({
|
|
170
|
-
dataIndex: "btns",
|
|
171
|
-
valueType: "btns",
|
|
172
|
-
valueProps: [
|
|
173
|
-
{
|
|
174
|
-
btnType: "submit",
|
|
175
|
-
title: searchText,
|
|
176
|
-
type: "primary",
|
|
177
|
-
shape: "default",
|
|
178
|
-
style: { ...defaultSearchStyle, ...styles == null ? void 0 : styles.searchStyle },
|
|
179
|
-
onClick: (values) => handleSearch(values, selListData)
|
|
200
|
+
],
|
|
201
|
+
colProps: {
|
|
202
|
+
flex: "none"
|
|
180
203
|
},
|
|
181
|
-
{
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
],
|
|
188
|
-
colProps: {
|
|
189
|
-
flex: "none"
|
|
190
|
-
},
|
|
191
|
-
formItemProps: { style: { marginBottom: 10, minWidth: 127 } }
|
|
192
|
-
});
|
|
193
|
-
return { formItems, selList: selListData };
|
|
204
|
+
formItemProps: { style: { marginBottom: 10, minWidth: 127 } }
|
|
205
|
+
});
|
|
206
|
+
return { formItems, selList: selListData };
|
|
207
|
+
} catch (error) {
|
|
208
|
+
return { formItems: [], selList: [] };
|
|
209
|
+
}
|
|
194
210
|
};
|
|
195
211
|
const handleUniversalHeaderToColumns = ({
|
|
196
212
|
universalHeader,
|
|
@@ -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];
|