szld-libs 0.2.97 → 0.2.99
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 +6774 -6558
- package/dist/szld-components.umd.js +44 -44
- package/es/components/DynamicForm/index.d.ts +2 -0
- package/es/components/DynamicForm/selectModel/index.js +1 -1
- package/es/components/DynamicForm/selectModelBackfillFormItem/index.d.ts +27 -0
- package/es/components/DynamicForm/selectModelBackfillFormItem/index.js +241 -0
- package/es/components/DynamicForm/selectModelBackfillFormItem/vite.svg +1 -0
- package/es/components/DynamicForm/useDynamicForm.js +22 -1
- package/es/index.js +34 -8
- package/es/mock/index.d.ts +2 -0
- package/es/mock/index.js +82 -1
- package/es/services/index.d.ts +6 -0
- package/es/services/index.js +85 -0
- package/es/services/request.d.ts +6 -0
- package/es/services/request.js +140 -0
- package/es/services/status.d.ts +1 -0
- package/es/services/status.js +44 -0
- package/es/services/vite.svg +1 -0
- package/es/utils/enum.d.ts +4 -0
- package/es/utils/enum.js +10 -0
- package/es/utils/method.js +14 -10
- package/es/vite-env.d.ts +5 -0
- package/lib/components/DynamicForm/index.d.ts +2 -0
- package/lib/components/DynamicForm/selectModel/index.js +1 -1
- package/lib/components/DynamicForm/selectModelBackfillFormItem/index.d.ts +27 -0
- package/lib/components/DynamicForm/selectModelBackfillFormItem/index.js +241 -0
- package/lib/components/DynamicForm/selectModelBackfillFormItem/vite.svg +1 -0
- package/lib/components/DynamicForm/useDynamicForm.js +22 -1
- package/lib/index.js +31 -5
- package/lib/mock/index.d.ts +2 -0
- package/lib/mock/index.js +81 -0
- package/lib/services/index.d.ts +6 -0
- package/lib/services/index.js +85 -0
- package/lib/services/request.d.ts +6 -0
- package/lib/services/request.js +140 -0
- package/lib/services/status.d.ts +1 -0
- package/lib/services/status.js +44 -0
- package/lib/services/vite.svg +1 -0
- package/lib/utils/enum.d.ts +4 -0
- package/lib/utils/enum.js +10 -0
- package/lib/utils/method.js +14 -10
- package/lib/vite-env.d.ts +5 -0
- package/package.json +3 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
var _a, _b;
|
|
2
|
+
import { OEID, TOKEN, encryptParamStrings, USERINFO } from "../utils/enum";
|
|
3
|
+
import { message } from "antd";
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
import _ from "lodash";
|
|
6
|
+
import queryString from "query-string";
|
|
7
|
+
import { HmacSHA512, utils } from "szld-libs";
|
|
8
|
+
import { showStatus } from "./status";
|
|
9
|
+
const { removeSessionStorage, getSessionStorage } = utils;
|
|
10
|
+
const env = {}.VITE_BUILD_ENV;
|
|
11
|
+
const domainSetting = {
|
|
12
|
+
baseUrl: "",
|
|
13
|
+
baseParams: {}
|
|
14
|
+
};
|
|
15
|
+
if (env === "test" || env === "dev") {
|
|
16
|
+
domainSetting.baseUrl = "/ucc";
|
|
17
|
+
domainSetting.baseParams = {
|
|
18
|
+
AppID: "KF_SZLD_YLFWLR",
|
|
19
|
+
Password: "KF_SZLD_YLFWLR2557013"
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
if (env === "dev") {
|
|
23
|
+
domainSetting.baseUrl = "/api";
|
|
24
|
+
}
|
|
25
|
+
if (env === "production") {
|
|
26
|
+
domainSetting.baseUrl = "/ucc";
|
|
27
|
+
domainSetting.baseParams = {
|
|
28
|
+
AppID: (_a = window == null ? void 0 : window.CONFIG) == null ? void 0 : _a.AppID,
|
|
29
|
+
Password: (_b = window == null ? void 0 : window.CONFIG) == null ? void 0 : _b.Password
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const request = axios.create({
|
|
33
|
+
baseURL: domainSetting.baseUrl,
|
|
34
|
+
headers: { "Content-Type": "application/json;charset=utf-8" },
|
|
35
|
+
withCredentials: true,
|
|
36
|
+
timeout: 3e5,
|
|
37
|
+
params: {
|
|
38
|
+
return: true,
|
|
39
|
+
...domainSetting.baseParams
|
|
40
|
+
},
|
|
41
|
+
transformRequest: [
|
|
42
|
+
(data) => {
|
|
43
|
+
data = JSON.stringify(data);
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
request.interceptors.request.use(
|
|
49
|
+
function(config) {
|
|
50
|
+
var _a2;
|
|
51
|
+
const oeid = sessionStorage.getItem(OEID);
|
|
52
|
+
if (oeid) {
|
|
53
|
+
config.data = {
|
|
54
|
+
...(config == null ? void 0 : config.data) || {},
|
|
55
|
+
oeid
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const token = sessionStorage.getItem(TOKEN);
|
|
59
|
+
if (token) {
|
|
60
|
+
const types = ["GetVCode", "FirstLoginUpdateMM", "DPGLSystemName"];
|
|
61
|
+
const names = ["Login"];
|
|
62
|
+
if (!names.includes(config.params["Controlname"]) && !types.includes(config.params["InterfaceType"])) {
|
|
63
|
+
config.params["SessionID"] = token;
|
|
64
|
+
config.params["InterfaceType"] = config.params["InterfaceType"] || "";
|
|
65
|
+
const obj = {};
|
|
66
|
+
encryptParamStrings.forEach((key) => {
|
|
67
|
+
obj[key] = config.params[key] || "";
|
|
68
|
+
});
|
|
69
|
+
const encryptParams = queryString.stringify(obj, { sort: false });
|
|
70
|
+
const sha = new HmacSHA512((_a2 = window == null ? void 0 : window.CONFIG) == null ? void 0 : _a2.Salt);
|
|
71
|
+
config.params["TokenId"] = sha.encrypt(encryptParams);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return config;
|
|
75
|
+
},
|
|
76
|
+
function(error) {
|
|
77
|
+
return Promise.reject(error);
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
request.interceptors.response.use(
|
|
81
|
+
function(response) {
|
|
82
|
+
var _a2;
|
|
83
|
+
const status = response.status;
|
|
84
|
+
if (status < 200 || status >= 300) {
|
|
85
|
+
const msg = showStatus(status);
|
|
86
|
+
if (typeof response.data === "string") {
|
|
87
|
+
response.data = { msg };
|
|
88
|
+
} else {
|
|
89
|
+
response.data = {
|
|
90
|
+
data: response.data,
|
|
91
|
+
msg
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
msgError(response.data.msg);
|
|
95
|
+
Promise.reject(response);
|
|
96
|
+
return {
|
|
97
|
+
ReturnValue: 0,
|
|
98
|
+
...response.data
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
if (typeof response.data === "string" && response.data.includes("Invalid")) {
|
|
102
|
+
msgError("登录已失效,请重新登录");
|
|
103
|
+
removeSessionStorage(USERINFO);
|
|
104
|
+
removeSessionStorage(TOKEN);
|
|
105
|
+
Promise.reject(response);
|
|
106
|
+
return {
|
|
107
|
+
ReturnValue: 0,
|
|
108
|
+
msg: "登录已失效,请重新登录",
|
|
109
|
+
data: response.data
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const result = response.data;
|
|
113
|
+
const noHitControlList = [];
|
|
114
|
+
if (_.isNumber(result == null ? void 0 : result.ReturnValue) && result.ReturnValue !== 1) {
|
|
115
|
+
if (!noHitControlList.includes((_a2 = response.config) == null ? void 0 : _a2.params["Controlname"])) {
|
|
116
|
+
msgError(result.msg);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return result;
|
|
120
|
+
},
|
|
121
|
+
function(error) {
|
|
122
|
+
msgError("请求出错");
|
|
123
|
+
Promise.reject(error);
|
|
124
|
+
return {
|
|
125
|
+
ReturnValue: 0,
|
|
126
|
+
msg: "请求出错",
|
|
127
|
+
data: error
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
const msgError = (content) => {
|
|
132
|
+
message.error({
|
|
133
|
+
content,
|
|
134
|
+
key: "globalError"
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
export {
|
|
138
|
+
request as default,
|
|
139
|
+
domainSetting
|
|
140
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const showStatus: (status: number) => string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const showStatus = (status) => {
|
|
2
|
+
let message = "";
|
|
3
|
+
switch (status) {
|
|
4
|
+
case 400:
|
|
5
|
+
message = "请求错误(400)";
|
|
6
|
+
break;
|
|
7
|
+
case 401:
|
|
8
|
+
message = "未授权,请重新登录(401)";
|
|
9
|
+
break;
|
|
10
|
+
case 403:
|
|
11
|
+
message = "拒绝访问(403)";
|
|
12
|
+
break;
|
|
13
|
+
case 404:
|
|
14
|
+
message = "请求出错(404)";
|
|
15
|
+
break;
|
|
16
|
+
case 408:
|
|
17
|
+
message = "请求超时(408)";
|
|
18
|
+
break;
|
|
19
|
+
case 500:
|
|
20
|
+
message = "服务器错误(500)";
|
|
21
|
+
break;
|
|
22
|
+
case 501:
|
|
23
|
+
message = "服务未实现(501)";
|
|
24
|
+
break;
|
|
25
|
+
case 502:
|
|
26
|
+
message = "网络错误(502)";
|
|
27
|
+
break;
|
|
28
|
+
case 503:
|
|
29
|
+
message = "服务不可用(503)";
|
|
30
|
+
break;
|
|
31
|
+
case 504:
|
|
32
|
+
message = "网络超时(504)";
|
|
33
|
+
break;
|
|
34
|
+
case 505:
|
|
35
|
+
message = "HTTP版本不受支持(505)";
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
message = `连接出错(${status})!`;
|
|
39
|
+
}
|
|
40
|
+
return `${message},请检查网络或联系管理员!`;
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
showStatus
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/es/utils/enum.js
ADDED
package/es/utils/method.js
CHANGED
|
@@ -176,16 +176,19 @@ const handleAttrList = (attrList, extraAttrs) => {
|
|
|
176
176
|
const combinationGroups = parsedAttrList.filter((item) => {
|
|
177
177
|
var _a;
|
|
178
178
|
return (_a = item.json) == null ? void 0 : _a.combination;
|
|
179
|
-
}).reduce(
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
}).reduce(
|
|
180
|
+
(groups, item) => {
|
|
181
|
+
const combinationId = item.json["combination-id"];
|
|
182
|
+
if (!combinationId)
|
|
183
|
+
return groups;
|
|
184
|
+
if (!groups[combinationId]) {
|
|
185
|
+
groups[combinationId] = [];
|
|
186
|
+
}
|
|
187
|
+
groups[combinationId].push(item);
|
|
182
188
|
return groups;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
groups[combinationId].push(item);
|
|
187
|
-
return groups;
|
|
188
|
-
}, {});
|
|
189
|
+
},
|
|
190
|
+
{}
|
|
191
|
+
);
|
|
189
192
|
const excludeAttrIds = /* @__PURE__ */ new Set();
|
|
190
193
|
Object.values(combinationGroups).forEach((group) => {
|
|
191
194
|
if ((group == null ? void 0 : group.length) === 0)
|
|
@@ -310,7 +313,8 @@ const handleAttrListToObj = (attrList) => {
|
|
|
310
313
|
data_list: [processLevel(item.children)]
|
|
311
314
|
};
|
|
312
315
|
} else if (item.attrtype === 1 && item.children.length > 0 && Array.isArray(item.children)) {
|
|
313
|
-
|
|
316
|
+
let { attrvalue = [], children = [] } = item || {};
|
|
317
|
+
attrvalue = Array.isArray(attrvalue) ? attrvalue : [attrvalue];
|
|
314
318
|
if (Array.isArray(attrvalue) && (attrvalue == null ? void 0 : attrvalue.length)) {
|
|
315
319
|
item.children = attrvalue.map((v) => {
|
|
316
320
|
return handleObjDetailToSignleAttrList((children == null ? void 0 : children[0]) || [], v);
|
package/es/vite-env.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export interface IformConfigItem {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export interface Ijson {
|
|
21
|
+
'action-url-extra-params'?: { [key: string]: any }; // 弹窗选择对应多个表单字段时,额外的参数
|
|
21
22
|
'disable-date-goover'?: boolean; // 禁用日期选择器超出当前日期
|
|
22
23
|
'default-prompt'?: string; // 提示信息
|
|
23
24
|
'regexp-message'?: string; // 正则表达式提示信息
|
|
@@ -91,6 +92,7 @@ export type InputType =
|
|
|
91
92
|
| 'radio'
|
|
92
93
|
| 'checkbox'
|
|
93
94
|
| 'cascader'
|
|
95
|
+
| 'mult-field-modal-select' // 弹窗选择对应多个表单字段
|
|
94
96
|
| string;
|
|
95
97
|
|
|
96
98
|
// 定义文件上传值类型
|
|
@@ -139,7 +139,7 @@ function SelectModel(props) {
|
|
|
139
139
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
140
140
|
antd.Select,
|
|
141
141
|
{
|
|
142
|
-
placeholder: (item == null ? void 0 : item["
|
|
142
|
+
placeholder: (item == null ? void 0 : item["default-prompt"]) || "请选择",
|
|
143
143
|
onClick: openModal,
|
|
144
144
|
value,
|
|
145
145
|
open: false,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FormInstance } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AxiosResponse } from 'axios';
|
|
4
|
+
import { Ijson } from '../index.d';
|
|
5
|
+
interface SelectModelProps {
|
|
6
|
+
item: Ijson;
|
|
7
|
+
onSure: (value: {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}) => void;
|
|
10
|
+
value: string;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
style?: React.CSSProperties;
|
|
13
|
+
commonRequestWidthParams: (params: object, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
14
|
+
commonRequest: (InterfaceType: string, data?: any) => Promise<AxiosResponse<any, any>>;
|
|
15
|
+
CustomModalComponent?: React.FC<ICustomModal>;
|
|
16
|
+
attrid: string;
|
|
17
|
+
form: FormInstance;
|
|
18
|
+
}
|
|
19
|
+
declare function SelectModel(props: SelectModelProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @param selectedRows 选中的行数据
|
|
23
|
+
* @param attributeEnrollFormat 配置信息
|
|
24
|
+
* @returns 构建后的字符串
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildValueFromSelectedRows(selectedRows: any[], attributeEnrollFormat: Ijson): Promise<any>;
|
|
27
|
+
export default SelectModel;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const antd = require("antd");
|
|
5
|
+
const react = require("react");
|
|
6
|
+
function SelectModel(props) {
|
|
7
|
+
const { item, disabled, style, commonRequestWidthParams, CustomModalComponent, attrid, form } = props;
|
|
8
|
+
const attrValue = antd.Form.useWatch(attrid, form);
|
|
9
|
+
const { message } = antd.App.useApp();
|
|
10
|
+
const mode = item.input;
|
|
11
|
+
const [value, setValue] = react.useState(props.value);
|
|
12
|
+
const [modalVisible, setModalVisible] = react.useState(false);
|
|
13
|
+
const [selectedRowKeys, setSelectedRowKeys] = react.useState([]);
|
|
14
|
+
const [selectedRecords, setSelectedRecords] = react.useState([]);
|
|
15
|
+
const [loading, setLoading] = react.useState(false);
|
|
16
|
+
const [params, setParams] = react.useState({
|
|
17
|
+
PageNum: 1,
|
|
18
|
+
PageSize: 6
|
|
19
|
+
});
|
|
20
|
+
const [dataSource, setDataSource] = react.useState([]);
|
|
21
|
+
const [total, setTotal] = react.useState(0);
|
|
22
|
+
const columns = buildColumns();
|
|
23
|
+
react.useEffect(() => {
|
|
24
|
+
if (!modalVisible) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
getData();
|
|
28
|
+
}, [modalVisible, params]);
|
|
29
|
+
const onSelectChange = (keys, selectedRows) => {
|
|
30
|
+
setSelectedRowKeys(keys);
|
|
31
|
+
setSelectedRecords(selectedRows);
|
|
32
|
+
};
|
|
33
|
+
const getData = async () => {
|
|
34
|
+
var _a;
|
|
35
|
+
if (item.inputType === "url" && (item == null ? void 0 : item["action-url"])) {
|
|
36
|
+
setLoading(true);
|
|
37
|
+
try {
|
|
38
|
+
const response = await commonRequestWidthParams(
|
|
39
|
+
{
|
|
40
|
+
PageName: "dns_relay",
|
|
41
|
+
Controlname: "CallActionUrl",
|
|
42
|
+
InterfaceType: ""
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"action-url": item == null ? void 0 : item["action-url"],
|
|
46
|
+
...params,
|
|
47
|
+
...(item == null ? void 0 : item["action-url-extra-params"]) || {}
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
if ((response == null ? void 0 : response.ReturnValue) === 0) {
|
|
51
|
+
message.error(response.msg);
|
|
52
|
+
setLoading(false);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const data = response == null ? void 0 : response.data;
|
|
56
|
+
const tempData = (_a = data == null ? void 0 : data.list) == null ? void 0 : _a.map((item2, index) => {
|
|
57
|
+
const _rowKey = (params.PageNum - 1) * params.PageSize + index;
|
|
58
|
+
return {
|
|
59
|
+
...item2,
|
|
60
|
+
_rowKey
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
const tempSelectedRecords = (tempData == null ? void 0 : tempData.filter((item2) => selectedRowKeys.includes(item2._rowKey))) || [];
|
|
64
|
+
setSelectedRecords(tempSelectedRecords);
|
|
65
|
+
setDataSource([...tempData || []]);
|
|
66
|
+
setTotal((data == null ? void 0 : data.number) || 0);
|
|
67
|
+
setLoading(false);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
setLoading(false);
|
|
70
|
+
message.error(error.msg || "参数错误");
|
|
71
|
+
}
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
message.error("请配置action-url");
|
|
75
|
+
};
|
|
76
|
+
const openModal = () => {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
if (disabled) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (value) {
|
|
82
|
+
const keyFieldList = ((_a = item == null ? void 0 : item["key-field"]) == null ? void 0 : _a.list) ?? [];
|
|
83
|
+
const delimiter = ((_b = item == null ? void 0 : item["key-field"]) == null ? void 0 : _b.delimiter) ?? "-";
|
|
84
|
+
if (!keyFieldList.length) {
|
|
85
|
+
message.error("请配置key-field");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
switch (mode) {
|
|
89
|
+
case "modal-select":
|
|
90
|
+
const id = value == null ? void 0 : value.split("-");
|
|
91
|
+
const index = dataSource == null ? void 0 : dataSource.findIndex((item2) => id.includes((item2 == null ? void 0 : item2.typeid) || (item2 == null ? void 0 : item2.instanceid)));
|
|
92
|
+
setSelectedRowKeys([index]);
|
|
93
|
+
break;
|
|
94
|
+
case "modal-mult-select":
|
|
95
|
+
const values = value == null ? void 0 : value.split(",");
|
|
96
|
+
const tempKeys = values == null ? void 0 : values.map((item2) => {
|
|
97
|
+
var _a2;
|
|
98
|
+
const id2 = (_a2 = item2.split(delimiter)) == null ? void 0 : _a2[0];
|
|
99
|
+
return dataSource == null ? void 0 : dataSource.findIndex((item3) => id2.includes((item3 == null ? void 0 : item3.typeid) || (item3 == null ? void 0 : item3.instanceid)));
|
|
100
|
+
});
|
|
101
|
+
setSelectedRowKeys(tempKeys);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
setModalVisible(true);
|
|
106
|
+
};
|
|
107
|
+
const handleOk = async () => {
|
|
108
|
+
try {
|
|
109
|
+
const value2 = await buildValueFromSelectedRows(selectedRecords, item);
|
|
110
|
+
setValue((value2 == null ? void 0 : value2[attrid]) || "");
|
|
111
|
+
props.onSure(value2);
|
|
112
|
+
setModalVisible(false);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
message.error(error.msg || "参数错误");
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const handleCancel = () => {
|
|
118
|
+
setParams({
|
|
119
|
+
...params,
|
|
120
|
+
PageNum: 1
|
|
121
|
+
});
|
|
122
|
+
setModalVisible(false);
|
|
123
|
+
};
|
|
124
|
+
function buildColumns() {
|
|
125
|
+
const modalFieldList = item["modal-field-list"];
|
|
126
|
+
let columns2 = [];
|
|
127
|
+
for (let fieldName in modalFieldList) {
|
|
128
|
+
let title = modalFieldList[fieldName];
|
|
129
|
+
const column = { dataIndex: fieldName, title };
|
|
130
|
+
columns2 = [...columns2, column];
|
|
131
|
+
}
|
|
132
|
+
return columns2;
|
|
133
|
+
}
|
|
134
|
+
const onPageChange = (pageNum) => {
|
|
135
|
+
setParams({
|
|
136
|
+
...params,
|
|
137
|
+
PageNum: pageNum
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
141
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
142
|
+
antd.Select,
|
|
143
|
+
{
|
|
144
|
+
placeholder: (item == null ? void 0 : item["default-prompt"]) || "请选择",
|
|
145
|
+
onClick: openModal,
|
|
146
|
+
open: false,
|
|
147
|
+
value: attrValue,
|
|
148
|
+
disabled,
|
|
149
|
+
style
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
CustomModalComponent && /* @__PURE__ */ jsxRuntime.jsx(
|
|
153
|
+
CustomModalComponent,
|
|
154
|
+
{
|
|
155
|
+
title: item["modal-caption"] || "",
|
|
156
|
+
open: modalVisible,
|
|
157
|
+
onOk: handleOk,
|
|
158
|
+
onCancel: handleCancel,
|
|
159
|
+
modalStyle: { width: item["modal-width"] ?? 600, minHeight: item["modal-height"] ?? 400 },
|
|
160
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
161
|
+
antd.Table,
|
|
162
|
+
{
|
|
163
|
+
columns,
|
|
164
|
+
loading,
|
|
165
|
+
dataSource,
|
|
166
|
+
rowKey: (record) => record._rowKey,
|
|
167
|
+
scroll: { y: "calc(80vh - 300px)" },
|
|
168
|
+
rowSelection: {
|
|
169
|
+
type: mode === "mul-field-modal-select" ? "radio" : "checkbox",
|
|
170
|
+
selectedRowKeys,
|
|
171
|
+
onChange: onSelectChange
|
|
172
|
+
},
|
|
173
|
+
pagination: {
|
|
174
|
+
total,
|
|
175
|
+
current: params.PageNum,
|
|
176
|
+
pageSize: params.PageSize,
|
|
177
|
+
onChange: onPageChange
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
) || /* @__PURE__ */ jsxRuntime.jsx(
|
|
183
|
+
antd.Modal,
|
|
184
|
+
{
|
|
185
|
+
title: item["modal-caption"],
|
|
186
|
+
open: modalVisible,
|
|
187
|
+
onOk: handleOk,
|
|
188
|
+
onCancel: handleCancel,
|
|
189
|
+
width: item["modal-width"] ?? 600,
|
|
190
|
+
okButtonProps: { disabled: selectedRowKeys.length === 0 },
|
|
191
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
192
|
+
antd.Table,
|
|
193
|
+
{
|
|
194
|
+
columns,
|
|
195
|
+
loading,
|
|
196
|
+
dataSource,
|
|
197
|
+
rowKey: (record) => record._rowKey,
|
|
198
|
+
rowSelection: {
|
|
199
|
+
type: mode === "mul-field-modal-select" ? "radio" : "checkbox",
|
|
200
|
+
selectedRowKeys,
|
|
201
|
+
onChange: onSelectChange
|
|
202
|
+
},
|
|
203
|
+
pagination: {
|
|
204
|
+
total,
|
|
205
|
+
current: params.PageNum,
|
|
206
|
+
pageSize: params.PageSize,
|
|
207
|
+
onChange: onPageChange
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
] });
|
|
214
|
+
}
|
|
215
|
+
function buildValueFromSelectedRows(selectedRows, attributeEnrollFormat) {
|
|
216
|
+
return new Promise((resolve, reject) => {
|
|
217
|
+
try {
|
|
218
|
+
var keyfields = attributeEnrollFormat["key-field"];
|
|
219
|
+
if (!keyfields) {
|
|
220
|
+
reject({ msg: "请配置key-field" });
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
let res = {};
|
|
224
|
+
selectedRows.forEach((item) => {
|
|
225
|
+
for (let [key, value] of Object.entries(keyfields)) {
|
|
226
|
+
const list = (value == null ? void 0 : value.list) ?? [];
|
|
227
|
+
const delimiter = (value == null ? void 0 : value.delimiter) ?? "-";
|
|
228
|
+
const arr = list.map((v) => {
|
|
229
|
+
return item == null ? void 0 : item[v];
|
|
230
|
+
});
|
|
231
|
+
res[key] = arr.join(delimiter);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
resolve(res);
|
|
235
|
+
} catch (error) {
|
|
236
|
+
reject({ msg: "key-field参数配置错误" });
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
exports.buildValueFromSelectedRows = buildValueFromSelectedRows;
|
|
241
|
+
exports.default = SelectModel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const icons = require("@ant-design/icons");
|
|
3
4
|
const func = require("./func");
|
|
4
5
|
const method = require("../../utils/method");
|
|
6
|
+
const SelectModelBackfillFormItem = require("./selectModelBackfillFormItem");
|
|
5
7
|
const react = require("react");
|
|
6
8
|
const isoWeek = require("dayjs/plugin/isoWeek");
|
|
7
9
|
const SelectModel = require("./selectModel");
|
|
@@ -12,7 +14,6 @@ const RadioCard = require("./radioCard");
|
|
|
12
14
|
const MySelect = require("./mySelect");
|
|
13
15
|
const MyUpload = require("./myUpload");
|
|
14
16
|
const MyRadio = require("./myRadio");
|
|
15
|
-
const icons = require("@ant-design/icons");
|
|
16
17
|
const antd = require("antd");
|
|
17
18
|
dayjs.extend(isoWeek);
|
|
18
19
|
function useDynamicForm(props) {
|
|
@@ -433,6 +434,7 @@ function useDynamicForm(props) {
|
|
|
433
434
|
}) => {
|
|
434
435
|
var _a, _b, _c, _d;
|
|
435
436
|
const mode = item.json.input || "text";
|
|
437
|
+
const attrid = item.attrid;
|
|
436
438
|
const formatValue = func.handleSetFormItemInitialValue(item);
|
|
437
439
|
const message2 = ((_a = item.json) == null ? void 0 : _a["default-prompt"]) || "";
|
|
438
440
|
const disableDateGoover = ((_b = item.json) == null ? void 0 : _b["disable-date-goover"]) || false;
|
|
@@ -534,6 +536,25 @@ function useDynamicForm(props) {
|
|
|
534
536
|
}
|
|
535
537
|
);
|
|
536
538
|
}
|
|
539
|
+
case "mul-field-modal-select": {
|
|
540
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
541
|
+
SelectModelBackfillFormItem,
|
|
542
|
+
{
|
|
543
|
+
style: { width: defaultWidth, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth },
|
|
544
|
+
item: item.json,
|
|
545
|
+
form,
|
|
546
|
+
attrid,
|
|
547
|
+
value: item.attrvalue || item.json.default || "",
|
|
548
|
+
commonRequestWidthParams,
|
|
549
|
+
commonRequest,
|
|
550
|
+
onSure: async (value) => {
|
|
551
|
+
form.setFieldsValue(value);
|
|
552
|
+
},
|
|
553
|
+
disabled: readonly,
|
|
554
|
+
CustomModalComponent
|
|
555
|
+
}
|
|
556
|
+
);
|
|
557
|
+
}
|
|
537
558
|
case "date-picker":
|
|
538
559
|
case "time-picker":
|
|
539
560
|
case "week-picker":
|
package/lib/index.js
CHANGED
|
@@ -5,15 +5,41 @@ const ReactDOM = require("react-dom/client");
|
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
6
|
const antd = require("antd");
|
|
7
7
|
const main = require("./main");
|
|
8
|
+
const mock = require("./mock");
|
|
9
|
+
const services = require("./services");
|
|
10
|
+
const zhCN = require("antd/es/locale/zh_CN");
|
|
11
|
+
const dayjs = require("dayjs");
|
|
12
|
+
dayjs.locale("zh-cn");
|
|
8
13
|
const Demo = () => {
|
|
9
|
-
antd.Form.useForm();
|
|
10
14
|
react.useEffect(() => {
|
|
11
15
|
}, []);
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
16
|
+
const formRef = react.useRef(null);
|
|
17
|
+
const [form] = antd.Form.useForm();
|
|
18
|
+
const onFinish = (values) => {
|
|
19
|
+
};
|
|
15
20
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column", gap: 20 }, children: [
|
|
16
21
|
/* @__PURE__ */ jsxRuntime.jsx(main.BackHeader, { title: "页头组件", isBack: true }),
|
|
22
|
+
/* @__PURE__ */ jsxRuntime.jsxs(antd.Form, { form, layout: "vertical", onFinish, children: [
|
|
23
|
+
"测试移动端动态组件",
|
|
24
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25
|
+
main.DynamicForm,
|
|
26
|
+
{
|
|
27
|
+
interfaceTypeChildren: "YLFWLRDetailAttrlist",
|
|
28
|
+
formConfig: mock.attrList,
|
|
29
|
+
form,
|
|
30
|
+
readonly: false,
|
|
31
|
+
relatedid: "",
|
|
32
|
+
colNum: 1,
|
|
33
|
+
defaultWidth: 358,
|
|
34
|
+
commonRequestWidthParams: services.commonRequestWidthParams,
|
|
35
|
+
uploadAction: services.uploadFormAction,
|
|
36
|
+
commonRequest: services.commonRequest,
|
|
37
|
+
instructionShowMode: "icon",
|
|
38
|
+
ref: formRef
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "primary", htmlType: "submit", children: "提交" }) })
|
|
42
|
+
] }),
|
|
17
43
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
18
44
|
"2. 测试循环滚动组件",
|
|
19
45
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -30,5 +56,5 @@ const Demo = () => {
|
|
|
30
56
|
] });
|
|
31
57
|
};
|
|
32
58
|
ReactDOM.createRoot(document.getElementById("root")).render(
|
|
33
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.BrowserRouter, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.App, { children: /* @__PURE__ */ jsxRuntime.jsx(Demo, {}) }) })
|
|
59
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.ConfigProvider, { locale: zhCN, children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.BrowserRouter, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.App, { children: /* @__PURE__ */ jsxRuntime.jsx(Demo, {}) }) }) })
|
|
34
60
|
);
|
package/lib/mock/index.d.ts
CHANGED