@cloudbase/weda-ui 3.4.10 → 3.4.11-alpha.1
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/configs/components/customer-service.js +3 -0
- package/dist/configs/components/form-user-tree-select.js +13 -0
- package/dist/configs/components/wd-button.js +3 -0
- package/dist/configs/components/wd-table.js +8 -3
- package/dist/configs/components/web-view.js +3 -0
- package/dist/docs/common/components/json-schema-view.js +1 -1
- package/dist/web/actions/showMessage/index.js +4 -1
- package/dist/web/components/carousel/index.js +1 -1
- package/dist/web/components/form/input/index.js +11 -5
- package/dist/web/components/form/select/dropdown-select/index.js +7 -1
- package/dist/web/components/form/select/h5.js +10 -1
- package/dist/web/components/form/select/request.js +14 -2
- package/dist/web/components/form/uploader/uploader.h5.js +55 -57
- package/dist/web/components/form/uploader/uploader.pc.js +50 -42
- package/dist/web/components/form/uploaderFile/uploadFile.h5.js +8 -14
- package/dist/web/components/form/uploaderFile/uploadFile.pc.js +6 -14
- package/dist/web/components/form/userOrgSelect/common/fetch-data-service.js +30 -3
- package/dist/web/components/form/userOrgSelect/common/utils.js +3 -8
- package/dist/web/components/form/userOrgSelect/component/org-tree.js +21 -11
- package/dist/web/components/form/userOrgSelect/component/user-select-h5/index.js +13 -1
- package/dist/web/components/form/userOrgSelect/hooks/use-depart-data.js +3 -3
- package/dist/web/components/form-input-hooks/index.js +2 -1
- package/dist/web/components/form-user-tree-select/index.js +2 -2
- package/dist/web/components/table/ImportFileModalByApi/uploadCSVFile.js +1 -1
- package/dist/web/components/wd-form/index.js +3 -2
- package/dist/web/components/wd-table/components/FieldRender/index.js +20 -22
- package/dist/web/components/wd-table/wd-table.js +18 -18
- package/dist/web/utils/datasource.js +23 -17
- package/dist/web/utils/date.js +3 -3
- package/package.json +1 -1
|
@@ -210,12 +210,15 @@ const config = defineConfig({
|
|
|
210
210
|
'x-platforms': ['MP'],
|
|
211
211
|
detail: {
|
|
212
212
|
errMsg: Type.String({
|
|
213
|
+
title: '错误信息',
|
|
213
214
|
description: '错误信息',
|
|
214
215
|
}),
|
|
215
216
|
path: Type.String({
|
|
217
|
+
title: '小程序消息指定的路径',
|
|
216
218
|
description: '小程序消息指定的路径',
|
|
217
219
|
}),
|
|
218
220
|
query: Type.Object({}, {
|
|
221
|
+
title: '小程序消息指定的查询参数',
|
|
219
222
|
description: '小程序消息指定的查询参数',
|
|
220
223
|
}),
|
|
221
224
|
},
|
|
@@ -196,6 +196,19 @@ const data = Type.Object({
|
|
|
196
196
|
selectedDataSourceName: 'sys_user',
|
|
197
197
|
},
|
|
198
198
|
}),
|
|
199
|
+
corpScope: Type.Array(Type.String({
|
|
200
|
+
type: 'string',
|
|
201
|
+
title: '企业id',
|
|
202
|
+
'x-category': '高级属性',
|
|
203
|
+
}), {
|
|
204
|
+
type: 'array',
|
|
205
|
+
title: '展示企业范围',
|
|
206
|
+
default: [],
|
|
207
|
+
'x-index': 88,
|
|
208
|
+
'x-category': '高级属性',
|
|
209
|
+
description: '填写企业id后,只展示这些企业下的部门和用户',
|
|
210
|
+
'x-helper-text': '支持写入企业id,用于限制组件中展示的企业列表',
|
|
211
|
+
}),
|
|
199
212
|
layout: Type.StringEnum({
|
|
200
213
|
enum: Tuple([
|
|
201
214
|
{
|
|
@@ -374,12 +374,15 @@ const config = defineConfig({
|
|
|
374
374
|
'x-platforms': ['MP'],
|
|
375
375
|
detail: {
|
|
376
376
|
errMsg: Type.String({
|
|
377
|
+
title: '错误信息',
|
|
377
378
|
description: '错误信息',
|
|
378
379
|
}),
|
|
379
380
|
path: Type.String({
|
|
381
|
+
title: '小程序消息指定的路径',
|
|
380
382
|
description: '小程序消息指定的路径',
|
|
381
383
|
}),
|
|
382
384
|
query: Type.Object({}, {
|
|
385
|
+
title: '小程序消息指定的查询参数',
|
|
383
386
|
description: '小程序消息指定的查询参数',
|
|
384
387
|
}),
|
|
385
388
|
},
|
|
@@ -20,7 +20,7 @@ const commonProperties = {
|
|
|
20
20
|
'x-linkages': [
|
|
21
21
|
{
|
|
22
22
|
type: 'value:state',
|
|
23
|
-
target: '*( filterFields,bindMetadata,queryCondition,orderBy,orderType,defaultPageSize)',
|
|
23
|
+
target: '*( filterFields,bindMetadata,queryCondition,orderBy,orderType,defaultPageSize,defaultPageIndex)',
|
|
24
24
|
condition: "{{$self.value !='custom-connector'}}",
|
|
25
25
|
state: {
|
|
26
26
|
display: true,
|
|
@@ -1028,14 +1028,17 @@ const config = defineConfig({
|
|
|
1028
1028
|
name: 'tabTableRow',
|
|
1029
1029
|
detail: {
|
|
1030
1030
|
record: Type.BasicTypeUnion({
|
|
1031
|
+
title: '选中行记录',
|
|
1031
1032
|
type: 'array',
|
|
1032
1033
|
description: '选中行记录',
|
|
1033
1034
|
}),
|
|
1034
|
-
rowKey: Type.
|
|
1035
|
+
rowKey: Type.String({
|
|
1036
|
+
title: '选中行记录id',
|
|
1035
1037
|
type: 'string',
|
|
1036
1038
|
description: '选中行记录id',
|
|
1037
1039
|
}),
|
|
1038
|
-
recordIndex: Type.
|
|
1040
|
+
recordIndex: Type.Number({
|
|
1041
|
+
title: '选中行index',
|
|
1039
1042
|
type: 'number',
|
|
1040
1043
|
description: '选中行index',
|
|
1041
1044
|
}),
|
|
@@ -1048,6 +1051,7 @@ const config = defineConfig({
|
|
|
1048
1051
|
name: 'rowsSelect',
|
|
1049
1052
|
detail: {
|
|
1050
1053
|
data: Type.BasicTypeUnion({
|
|
1054
|
+
title: '选中行记录',
|
|
1051
1055
|
type: 'array',
|
|
1052
1056
|
description: '选中行记录',
|
|
1053
1057
|
}),
|
|
@@ -1062,6 +1066,7 @@ const config = defineConfig({
|
|
|
1062
1066
|
'x-platforms': ['MOBILEWEB', 'PCWEB'],
|
|
1063
1067
|
detail: {
|
|
1064
1068
|
data: Type.BasicTypeUnion({
|
|
1069
|
+
title: '查询结果,查询条件',
|
|
1065
1070
|
type: 'object',
|
|
1066
1071
|
description: '查询结果,查询条件',
|
|
1067
1072
|
}),
|
|
@@ -54,6 +54,7 @@ const config = defineConfig({
|
|
|
54
54
|
title: '网页加载成功',
|
|
55
55
|
detail: {
|
|
56
56
|
src: Type.String({
|
|
57
|
+
title: '网页链接地址',
|
|
57
58
|
description: '网页链接地址',
|
|
58
59
|
}),
|
|
59
60
|
},
|
|
@@ -63,6 +64,7 @@ const config = defineConfig({
|
|
|
63
64
|
title: '网页加载失败',
|
|
64
65
|
detail: {
|
|
65
66
|
src: Type.String({
|
|
67
|
+
title: '网页链接地址',
|
|
66
68
|
description: '网页链接地址',
|
|
67
69
|
}),
|
|
68
70
|
},
|
|
@@ -72,6 +74,7 @@ const config = defineConfig({
|
|
|
72
74
|
title: '接收网页消息',
|
|
73
75
|
detail: {
|
|
74
76
|
data: Type.Object({}, {
|
|
77
|
+
title: '接收信息内容',
|
|
75
78
|
description: '接收信息内容',
|
|
76
79
|
}),
|
|
77
80
|
},
|
|
@@ -8,7 +8,7 @@ export default function JsonSchemaView({ schema, }) {
|
|
|
8
8
|
}
|
|
9
9
|
if (properties) {
|
|
10
10
|
return (_jsx("ul", { children: Object.entries(properties).map(([name, config]) => {
|
|
11
|
-
return (_jsxs("li", { children: [_jsx("b", { children: name }), ":", _jsx("code", { children: config.type }), config.description] }, name));
|
|
11
|
+
return (_jsxs("li", { children: [_jsx("b", { children: name }), ":", _jsx("code", { children: config.type }), (config === null || config === void 0 ? void 0 : config.description) || (config === null || config === void 0 ? void 0 : config.title)] }, name));
|
|
12
12
|
}) }));
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isH5Platform } from '../../utils/platform';
|
|
2
|
-
import { message } from 'tea-component';
|
|
2
|
+
import { message, setConfig } from 'tea-component';
|
|
3
3
|
import './index.css';
|
|
4
4
|
const iconType = {
|
|
5
5
|
success: 'success',
|
|
@@ -24,6 +24,9 @@ export default function showMessage(props) {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
+
setConfig({
|
|
28
|
+
classPrefix: 'wedatea2td',
|
|
29
|
+
});
|
|
27
30
|
const realIcon = iconType[icon];
|
|
28
31
|
const isNotShowIcon = realIcon === 'none' || !realIcon;
|
|
29
32
|
message[isNotShowIcon ? 'success' : icon]({
|
|
@@ -28,7 +28,7 @@ export default function Carousel({ className, style, autoplay, circular, vertica
|
|
|
28
28
|
}, interval);
|
|
29
29
|
return () => clearInterval(timer);
|
|
30
30
|
}
|
|
31
|
-
}, [currentIndex, autoplay]);
|
|
31
|
+
}, [currentIndex, autoplay, itemCount]);
|
|
32
32
|
// 触发切换
|
|
33
33
|
const pre = useRef({ index: currentIndex }).current;
|
|
34
34
|
useEffect(() => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import classNames from '../../../utils/classnames';
|
|
4
4
|
import { usePlatform } from '../../../utils/platform';
|
|
@@ -59,14 +59,20 @@ label = '标题', labelVisible = true, name = 'formInput', defaultValue = '', pa
|
|
|
59
59
|
e.preventDefault();
|
|
60
60
|
};
|
|
61
61
|
const onKeyDown = function (e) {
|
|
62
|
-
var _a;
|
|
62
|
+
var _a, _b;
|
|
63
63
|
// 确认逻辑
|
|
64
64
|
if (e.key === 'enter' || e.keyCode === 13) {
|
|
65
65
|
(_a = events === null || events === void 0 ? void 0 : events.confirm) === null || _a === void 0 ? void 0 : _a.call(events, { value: e.target.value }, { originEvent: e });
|
|
66
66
|
}
|
|
67
67
|
// 数字类型的键盘, 不能输入e
|
|
68
|
-
if (inputType === 'number'
|
|
69
|
-
e.
|
|
68
|
+
if (inputType === 'number') {
|
|
69
|
+
if (e.key === 'e') {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
}
|
|
72
|
+
// 不能输入 -
|
|
73
|
+
if (e.key === '-' && ((_b = e.target.value) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
}
|
|
70
76
|
}
|
|
71
77
|
};
|
|
72
78
|
const onFocus = function (e) {
|
|
@@ -79,7 +85,7 @@ label = '标题', labelVisible = true, name = 'formInput', defaultValue = '', pa
|
|
|
79
85
|
(_a = events === null || events === void 0 ? void 0 : events.blur) === null || _a === void 0 ? void 0 : _a.call(events, { value: e.target.value }, { originEvent: e });
|
|
80
86
|
setIsFocus(false);
|
|
81
87
|
};
|
|
82
|
-
const fieldEl = platform === 'h5' ? (_jsx("div", { className: subCls, children: _jsxs("div", { className: "weui-cell__bd weui-flex", children: [_jsx("input", { className: "weui-input", "data-testid": "weui-input-test", type: inputType, placeholder: placeholder, value: value, disabled: disabled, name: name, autoFocus: autoFocus, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, role: "input" }), clearable && (_jsx("button", { "data-testid": "weui-btn_input-clear-test", className: "weui-btn_reset weui-btn_icon weui-btn_input-clear", onMouseDown: onClear, children: _jsx("i", { className: "weui-icon-clear" }) }))] }) })) : (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsxs("div", { className: 'weui-pc-input', children: [_jsx(TeaInput, { "data-testid": "weui-input-test-pc", className: 'pc-input', size: size, type: inputType, placeholder: placeholder, value: value, disabled: disabled, name: name, autoFocus: autoFocus, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown }), showPcClear && (_jsx(Icon, { "data-testid": "weui-input-test-pc-clear", className: 'pc-clear', type: "dismiss", size: "s", onMouseDown: onClear }))] }) }));
|
|
88
|
+
const fieldEl = platform === 'h5' ? (_jsx(_Fragment, { children: _jsx("div", { className: subCls, children: _jsxs("div", { className: "weui-cell__bd weui-flex", children: [_jsx("input", { className: "weui-input", "data-testid": "weui-input-test", type: inputType, placeholder: placeholder, value: value, disabled: disabled, name: name, autoFocus: autoFocus, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, role: "input" }), clearable && (_jsx("button", { "data-testid": "weui-btn_input-clear-test", className: "weui-btn_reset weui-btn_icon weui-btn_input-clear", onMouseDown: onClear, children: _jsx("i", { className: "weui-icon-clear" }) }))] }) }) })) : (_jsx(ConfigProvider, { classPrefix: "wedatea2td", children: _jsxs("div", { className: 'weui-pc-input', children: [_jsx(TeaInput, { "data-testid": "weui-input-test-pc", className: 'pc-input', size: size, type: inputType, placeholder: placeholder, value: value, disabled: disabled, name: name, autoFocus: autoFocus, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown }), showPcClear && (_jsx(Icon, { "data-testid": "weui-input-test-pc-clear", className: 'pc-clear', type: "dismiss", size: "s", onMouseDown: onClear }))] }) }));
|
|
83
89
|
return renderDecorator(fieldEl, decorator)({
|
|
84
90
|
id,
|
|
85
91
|
className: cls,
|
|
@@ -118,7 +118,7 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
|
|
|
118
118
|
const option = isSearch ? searchOptions : options;
|
|
119
119
|
return platform === 'h5' ? option : transFormatTeaSelectKey(option);
|
|
120
120
|
}, [isSearch, searchOptions, options, platform]);
|
|
121
|
-
|
|
121
|
+
const handleSearch = () => {
|
|
122
122
|
// 本地搜索
|
|
123
123
|
if (!isTurnPages || options.length < PAGE_SIZE) {
|
|
124
124
|
const searchOpt = options.filter((item) => {
|
|
@@ -145,6 +145,9 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
|
|
|
145
145
|
}, 1000);
|
|
146
146
|
return () => clearTimeout(timer);
|
|
147
147
|
}
|
|
148
|
+
};
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
handleSearch();
|
|
148
151
|
}, [searchValue]);
|
|
149
152
|
// 加载更多
|
|
150
153
|
const loadMore = () => {
|
|
@@ -184,6 +187,9 @@ export function PureSelect({ params, selectedValue, updateValue, placeholder, si
|
|
|
184
187
|
setSearchStatus(Status.LOADING);
|
|
185
188
|
setSearchOptions([]);
|
|
186
189
|
setSearchValue(value);
|
|
190
|
+
if (value == searchValue) {
|
|
191
|
+
handleSearch();
|
|
192
|
+
}
|
|
187
193
|
};
|
|
188
194
|
/**
|
|
189
195
|
* 精确查找
|
|
@@ -164,7 +164,16 @@ defaultRegion, defaultMutiRegion, separator, regionType, onChange, }) {
|
|
|
164
164
|
}
|
|
165
165
|
else if (dateMode === 'day') {
|
|
166
166
|
// 年月日,3 列
|
|
167
|
-
|
|
167
|
+
let defaultValue = null;
|
|
168
|
+
if (date) {
|
|
169
|
+
const dayDate = new Date(getIOSNotNaNDate(date));
|
|
170
|
+
defaultValue = [
|
|
171
|
+
dayDate.getFullYear(),
|
|
172
|
+
dayDate.getMonth() + 1,
|
|
173
|
+
dayDate.getDate(),
|
|
174
|
+
];
|
|
175
|
+
}
|
|
176
|
+
weui.datePicker({ id: String(Date.now()), ...options, defaultValue });
|
|
168
177
|
}
|
|
169
178
|
else {
|
|
170
179
|
// 年月日时分秒,4列
|
|
@@ -30,10 +30,22 @@ export const requestFatherRelatedOption = async (params, pageNo, type, searchVal
|
|
|
30
30
|
let realWhere = [];
|
|
31
31
|
if (searchValue) {
|
|
32
32
|
if (type === RequestOptionType.SEARCH) {
|
|
33
|
-
realWhere = [
|
|
33
|
+
realWhere = [
|
|
34
|
+
{
|
|
35
|
+
[primaryField]: {
|
|
36
|
+
$search: searchValue,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
];
|
|
34
40
|
}
|
|
35
41
|
else if (type === RequestOptionType.EQUAL) {
|
|
36
|
-
realWhere = [
|
|
42
|
+
realWhere = [
|
|
43
|
+
{
|
|
44
|
+
_id: {
|
|
45
|
+
$eq: searchValue,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
];
|
|
37
49
|
}
|
|
38
50
|
}
|
|
39
51
|
realWhere = [{ $and: [...getWhereList(where), ...realWhere] }];
|
|
@@ -48,23 +48,16 @@ export function ImageUploaderH5({ title: label, maxUploadCount, maxSize = 10, ac
|
|
|
48
48
|
return maxUploadCount;
|
|
49
49
|
}, [single, maxUploadCount]);
|
|
50
50
|
const deleteFile = (url) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
const value = single ? '' : fileIdList.filter((f) => f !== url);
|
|
52
|
+
setInputValue(value);
|
|
53
|
+
handleChange([].concat(value));
|
|
54
|
+
};
|
|
55
|
+
const handleChange = (ids) => {
|
|
56
|
+
const value = single ? ids[0] || '' : ids;
|
|
57
|
+
setInputValue(value);
|
|
58
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
59
|
+
events === null || events === void 0 ? void 0 : events.change({ value });
|
|
56
60
|
};
|
|
57
|
-
React.useEffect(() => {
|
|
58
|
-
if (single) {
|
|
59
|
-
const file = fileIdList[0] || '';
|
|
60
|
-
onChange && onChange(file);
|
|
61
|
-
events.change && events.change({ value: file });
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
onChange && onChange(fileIdList);
|
|
65
|
-
events.change && events.change({ value: fileIdList });
|
|
66
|
-
}
|
|
67
|
-
}, [fileIdList]);
|
|
68
61
|
const onProgress = (progressEvent) => {
|
|
69
62
|
let percentCompleted = 0;
|
|
70
63
|
try {
|
|
@@ -74,28 +67,29 @@ export function ImageUploaderH5({ title: label, maxUploadCount, maxSize = 10, ac
|
|
|
74
67
|
catch (e) { }
|
|
75
68
|
setProgress(percentCompleted);
|
|
76
69
|
};
|
|
77
|
-
const uploadToTcb = (file) => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
70
|
+
const uploadToTcb = async (file) => {
|
|
71
|
+
var _a;
|
|
72
|
+
try {
|
|
73
|
+
setUploading(true);
|
|
74
|
+
const tcb = await getCloudInstance();
|
|
75
|
+
const cloudPath = `${uploadPath}/${randomStr()}-${file === null || file === void 0 ? void 0 : file.name.replace(/[%#]/g, '-')}`;
|
|
76
|
+
const { fileID } = await tcb.uploadFile({
|
|
77
|
+
cloudPath,
|
|
78
|
+
filePath: file,
|
|
79
|
+
onUploadProgress: onProgress,
|
|
80
|
+
});
|
|
81
|
+
(_a = events.success) === null || _a === void 0 ? void 0 : _a.call(events, { value: fileID, file });
|
|
82
|
+
setUploading(false);
|
|
83
|
+
return fileID;
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
weui.alert('上传失败,请检查网络后重试');
|
|
87
|
+
events.error && events.error(err);
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
setUploading(false);
|
|
91
|
+
setProgress(0);
|
|
92
|
+
}
|
|
99
93
|
};
|
|
100
94
|
const accepts = React.useMemo(() => {
|
|
101
95
|
return acceptTypes.includes('image/*') || acceptTypes.length === 0
|
|
@@ -132,25 +126,29 @@ export function ImageUploaderH5({ title: label, maxUploadCount, maxSize = 10, ac
|
|
|
132
126
|
}
|
|
133
127
|
return fileIdList.length < maxUploadCount;
|
|
134
128
|
}, [fileIdList, single, maxUploadCount, uploading]);
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
129
|
+
const uploadChange = async (e) => {
|
|
130
|
+
const files = [...e.target.files];
|
|
131
|
+
if (!islegalType(files, accepts))
|
|
132
|
+
return;
|
|
133
|
+
if (files.some((f) => f.size > maxSize * 1024 * 1024)) {
|
|
134
|
+
weui.alert(`请上传不超过 ${maxSize}M 的图片`);
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
if (files.length > finalMaxImgCount) {
|
|
138
|
+
// 防止一下子选择过多文件
|
|
139
|
+
weui.alert(`最多只能上传${finalMaxImgCount}张图片,请重新选择`);
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
if (fileIdList.length + files.length > finalMaxImgCount) {
|
|
143
|
+
weui.alert(`最多只能上传${finalMaxImgCount}张图片`);
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
const promiseAll = files.map((f) => uploadToTcb(f));
|
|
147
|
+
const result = await Promise.all(promiseAll);
|
|
148
|
+
const ids = [].concat(fileIdList, result);
|
|
149
|
+
handleChange(ids);
|
|
150
|
+
};
|
|
151
|
+
return (_jsx("div", { className: cls, id: id, style: style, children: _jsx("div", { children: _jsxs("div", { className: classNames('weui-uploader', layout), children: [_jsx("div", { className: classNames('weui-uploader__hd', layout), children: _jsx(UploaderLabel, { layout: layout, label: label, labelVisible: labelVisible, currentCount: fileIdList.length, maxCount: finalMaxImgCount, requiredFlag: requiredFlag }) }), _jsxs("div", { className: "weui-uploader__bd", children: [_jsxs("ul", { className: "weui-uploader__files", id: "uploaderFiles", children: [(fileIdList !== null && fileIdList !== void 0 ? fileIdList : []).map((f) => (_jsx(SingleImage, { src: f, deleteBySrc: deleteFile, disabled: disabled, imgTypeCls: imgTypeCls }, f))), fileIdList.length < 1 && formType === 'read' && _jsx(_Fragment, { children: "\u2014" }), uploading && (_jsx("li", { className: `weui-uploader__file weui-uploader__file_status ${imgTypeCls}`, children: _jsxs("div", { className: "weui-uploader__file-content", children: [progress, "%"] }) }))] }), showAdd && formType !== 'read' && (_jsx("div", { className: `weui-uploader__input-box ${imgTypeCls}`, children: !disabled && (_jsx("input", { "data-testid": "uploaderh5_input", id: "uploaderInput", className: "weui-uploader__input", type: "file", accept: accepts.join(','), multiple: !single && !(browserEnv().android && browserEnv().weixin), onChange: uploadChange })) }))] })] }) }) }));
|
|
154
152
|
}
|
|
155
153
|
function SingleImage({ src, deleteBySrc, disabled, imgTypeCls, }) {
|
|
156
154
|
const cls = classNames({
|
|
@@ -36,39 +36,35 @@ export function UploaderPC({ layout, className, id, style, title, tips, ...props
|
|
|
36
36
|
export function UploaderPCInner(props) {
|
|
37
37
|
var _a;
|
|
38
38
|
const { tips = '', btnTitle = '上传图片', maxUploadCount = 9, maxSize = 10, defaultValue, // 需要兼容 cloud:和https: 协议,需要兼容 字符串和字符串数组
|
|
39
|
-
acceptTypes = IMAGE_TYPES, uploadPath = 'weda-uploader', events = emptyObject, single = false, disabled = false, onChange, imgTypeCls, $node,
|
|
39
|
+
acceptTypes = IMAGE_TYPES, uploadPath = 'weda-uploader', events = emptyObject, single = false, disabled = false, onChange, imgTypeCls, $node, value, // 数据管理后台中,formily使用此字段传默认值
|
|
40
|
+
} = props;
|
|
40
41
|
// 上传中
|
|
41
42
|
const [uploading, setUploading] = React.useState(false);
|
|
42
43
|
//上传进度
|
|
43
44
|
const [progress, setProgress] = React.useState(0);
|
|
44
45
|
// 文件列表
|
|
45
46
|
const [fileIDList, setfileIDList] = React.useState([]);
|
|
46
|
-
const fileRef = React.useRef([]);
|
|
47
47
|
const formType = ((_a = getParentForm($node)) === null || _a === void 0 ? void 0 : _a.formType) || 'create';
|
|
48
|
+
const defaultValueRef = React.useRef(null);
|
|
48
49
|
React.useEffect(() => {
|
|
50
|
+
if (isObjectEqual(defaultValueRef.current, defaultValue))
|
|
51
|
+
return;
|
|
49
52
|
let initialValue = []
|
|
50
|
-
.concat(defaultValue)
|
|
53
|
+
.concat(value ? value : defaultValue)
|
|
51
54
|
.filter((d) => typeof d === 'string' && d !== '');
|
|
52
55
|
if (single) {
|
|
53
56
|
initialValue = initialValue[0] ? [initialValue[0]] : [];
|
|
54
57
|
}
|
|
58
|
+
defaultValueRef.current = defaultValue;
|
|
55
59
|
setfileIDList(initialValue);
|
|
56
60
|
}, [defaultValue, single]);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
onChange && onChange(fileIDList);
|
|
67
|
-
events.change && events.change({ value: fileIDList });
|
|
68
|
-
}
|
|
69
|
-
fileRef.current = fileIDList;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
61
|
+
const handleChange = (ids) => {
|
|
62
|
+
var _a;
|
|
63
|
+
setfileIDList(ids);
|
|
64
|
+
const value = single ? ids[0] || '' : ids;
|
|
65
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
66
|
+
(_a = events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
|
|
67
|
+
};
|
|
72
68
|
//验证上传文件类型是否合法
|
|
73
69
|
const islegalType = (files, accepts) => {
|
|
74
70
|
const illegalType = [];
|
|
@@ -113,32 +109,43 @@ export function UploaderPCInner(props) {
|
|
|
113
109
|
catch (e) { }
|
|
114
110
|
return false;
|
|
115
111
|
}
|
|
116
|
-
|
|
112
|
+
const ids = fileList.filter((f) => !!f.id);
|
|
113
|
+
if (ids.length < fileList.length)
|
|
114
|
+
return false;
|
|
115
|
+
uploadTcbMulti(fileList);
|
|
117
116
|
return false;
|
|
118
117
|
};
|
|
118
|
+
// 多张上传
|
|
119
|
+
const uploadTcbMulti = async (files) => {
|
|
120
|
+
const promiseAll = files.map((f) => uploadTcb(f));
|
|
121
|
+
const result = await Promise.all(promiseAll);
|
|
122
|
+
const ids = [].concat(fileIDList, result);
|
|
123
|
+
handleChange(ids);
|
|
124
|
+
};
|
|
119
125
|
// 自定义上传到 Tcb 的 COS
|
|
120
|
-
const uploadTcb = (file) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
126
|
+
const uploadTcb = async (file) => {
|
|
127
|
+
var _a;
|
|
128
|
+
try {
|
|
129
|
+
setUploading(true);
|
|
130
|
+
const tcb = await getCloudInstance();
|
|
131
|
+
const cloudPath = `${uploadPath}/${randomStr()}-${file === null || file === void 0 ? void 0 : file.name.replace(/[%#]/g, '-')}`;
|
|
132
|
+
const { fileID } = await tcb.uploadFile({
|
|
133
|
+
cloudPath,
|
|
134
|
+
filePath: file,
|
|
135
|
+
onUploadProgress: onProgress,
|
|
136
|
+
});
|
|
137
|
+
(_a = events.success) === null || _a === void 0 ? void 0 : _a.call(events, { value: fileID, file });
|
|
138
|
+
setUploading(false);
|
|
139
|
+
return fileID;
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
message.error({ content: '上传失败,请检查网络后重试' });
|
|
143
|
+
events.error && events.error(err);
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
setUploading(false);
|
|
147
|
+
setProgress(0);
|
|
148
|
+
}
|
|
142
149
|
};
|
|
143
150
|
// 计算上传进度
|
|
144
151
|
const onProgress = (progressEvent) => {
|
|
@@ -152,7 +159,8 @@ export function UploaderPCInner(props) {
|
|
|
152
159
|
};
|
|
153
160
|
// 删除图片
|
|
154
161
|
const deleteHandle = (fileID) => {
|
|
155
|
-
|
|
162
|
+
const ids = fileIDList.filter((d) => d !== fileID);
|
|
163
|
+
handleChange(ids);
|
|
156
164
|
};
|
|
157
165
|
// 转换后的属性
|
|
158
166
|
const extraProps = {};
|
|
@@ -56,22 +56,16 @@ events = emptyObject, defaultValue, uploadPath = 'weda-uploader', single = true,
|
|
|
56
56
|
}
|
|
57
57
|
}, [defaultValue]);
|
|
58
58
|
React.useEffect(() => {
|
|
59
|
-
var _a, _b
|
|
59
|
+
var _a, _b;
|
|
60
|
+
if (isObjectEqual(fileRef.current, fileIDList))
|
|
61
|
+
return;
|
|
60
62
|
// 外部 onChange 事件
|
|
61
63
|
const pureFileIDList = fileIDList.filter((d) => isCloudFileID(d) || isHttpFileID(d));
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
else {
|
|
68
|
-
onChange && onChange(pureFileIDList);
|
|
69
|
-
(_b = events === null || events === void 0 ? void 0 : events.change) === null || _b === void 0 ? void 0 : _b.call(events, { value: pureFileIDList });
|
|
70
|
-
}
|
|
71
|
-
if (!isObjectEqual(fileRef.current, fileIDList)) {
|
|
72
|
-
(_c = events === null || events === void 0 ? void 0 : events.success) === null || _c === void 0 ? void 0 : _c.call(events, { value: pureFileIDList });
|
|
73
|
-
fileRef.current = fileIDList;
|
|
74
|
-
}
|
|
64
|
+
const value = single ? pureFileIDList[0] || '' : pureFileIDList;
|
|
65
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
66
|
+
(_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
|
|
67
|
+
(_b = events === null || events === void 0 ? void 0 : events.success) === null || _b === void 0 ? void 0 : _b.call(events, { value: pureFileIDList });
|
|
68
|
+
fileRef.current = fileIDList;
|
|
75
69
|
}, [fileIDList]);
|
|
76
70
|
// 外层组件类
|
|
77
71
|
const cls = classNames({
|
|
@@ -57,22 +57,14 @@ acceptTypes = emptyArray, downloadVisible = true, deleteVisible = true, uploadPa
|
|
|
57
57
|
}
|
|
58
58
|
}, [defaultValue]);
|
|
59
59
|
React.useEffect(() => {
|
|
60
|
-
var _a
|
|
60
|
+
var _a;
|
|
61
|
+
if (isObjectEqual(fileRef.current, fileIDList))
|
|
62
|
+
return;
|
|
61
63
|
// 外部 onChange 事件
|
|
62
64
|
const pureFileIDList = fileIDList.filter((d) => isCloudFileID(d) || isHttpFileID(d));
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value: file });
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(pureFileIDList);
|
|
70
|
-
(_b = events === null || events === void 0 ? void 0 : events.change) === null || _b === void 0 ? void 0 : _b.call(events, { value: pureFileIDList });
|
|
71
|
-
}
|
|
72
|
-
if (!isObjectEqual(fileRef.current, fileIDList)) {
|
|
73
|
-
(_c = events === null || events === void 0 ? void 0 : events.success) === null || _c === void 0 ? void 0 : _c.call(events, { value: pureFileIDList });
|
|
74
|
-
fileRef.current = fileIDList;
|
|
75
|
-
}
|
|
65
|
+
const value = single ? pureFileIDList[0] || '' : pureFileIDList;
|
|
66
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
67
|
+
(_a = events === null || events === void 0 ? void 0 : events.change) === null || _a === void 0 ? void 0 : _a.call(events, { value });
|
|
76
68
|
}, [fileIDList]);
|
|
77
69
|
// 外层组件类
|
|
78
70
|
const cls = classNames({
|
|
@@ -54,6 +54,8 @@ export const fetchUserListByIds = async (selectUserIds = [], request) => {
|
|
|
54
54
|
UserType: 'internalUser',
|
|
55
55
|
NeedPrimaryColumn: true,
|
|
56
56
|
IsNoRelatedOrgFlag: false,
|
|
57
|
+
PageNo: index,
|
|
58
|
+
PageSize: PAGE_SIZE,
|
|
57
59
|
}));
|
|
58
60
|
}
|
|
59
61
|
const results = await Promise.all(promises);
|
|
@@ -177,13 +179,36 @@ async function fetchUsersByOrgId(params, request) {
|
|
|
177
179
|
/**
|
|
178
180
|
*获取全量组织数据
|
|
179
181
|
*/
|
|
180
|
-
export const DescribeOrgs = async (request) => {
|
|
182
|
+
export const DescribeOrgs = async (request, params) => {
|
|
181
183
|
try {
|
|
182
184
|
const PAGE_SIZE = 1000;
|
|
183
|
-
|
|
185
|
+
// 如果传递了 params.corpScopes 参数,则只拉取这些企业下的部门展示
|
|
186
|
+
const corpScopes = params === null || params === void 0 ? void 0 : params.corpScopes;
|
|
187
|
+
const queryList = [];
|
|
188
|
+
if (corpScopes && Array.isArray(corpScopes) && corpScopes.length > 0) {
|
|
189
|
+
if (corpScopes.length === 1) {
|
|
190
|
+
queryList.push({
|
|
191
|
+
Key: '_organizationId',
|
|
192
|
+
Rel: 'eq',
|
|
193
|
+
Val: corpScopes[0],
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
queryList.push({
|
|
198
|
+
Key: '_organizationId',
|
|
199
|
+
Rel: 'in',
|
|
200
|
+
Val: corpScopes,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const QueryWhereList = queryList.length > 0 ? queryList : undefined;
|
|
205
|
+
const result = await request('DescribeOrgs', {
|
|
184
206
|
pageNo: 1,
|
|
185
207
|
pageSize: PAGE_SIZE,
|
|
208
|
+
QueryWhereList,
|
|
186
209
|
});
|
|
210
|
+
const Total = (result === null || result === void 0 ? void 0 : result.Total) || 0;
|
|
211
|
+
const DataList = (result === null || result === void 0 ? void 0 : result.DataList) || [];
|
|
187
212
|
const total = Number(Total);
|
|
188
213
|
// 一页拉取了全部数据,直接返回
|
|
189
214
|
if (total <= PAGE_SIZE) {
|
|
@@ -196,11 +221,13 @@ export const DescribeOrgs = async (request) => {
|
|
|
196
221
|
promises.push(request('DescribeOrgs', {
|
|
197
222
|
pageNo: index,
|
|
198
223
|
pageSize: PAGE_SIZE,
|
|
224
|
+
QueryWhereList,
|
|
199
225
|
}));
|
|
200
226
|
}
|
|
201
227
|
const results = await Promise.all(promises);
|
|
202
228
|
for (const res of results) {
|
|
203
|
-
if (res
|
|
229
|
+
if (res &&
|
|
230
|
+
res.DataList &&
|
|
204
231
|
Array.isArray(res.DataList) &&
|
|
205
232
|
res.DataList.length > 0) {
|
|
206
233
|
records.push(...res.DataList);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { callWedaApi } from '../../../../utils/tcb';
|
|
2
2
|
import destr from 'destr';
|
|
3
3
|
import { node } from 'prop-types';
|
|
4
|
+
import { textToString } from '../../../../utils/platform';
|
|
4
5
|
// 处理用户数据格式
|
|
5
6
|
export const dealUserData = (data = []) => {
|
|
6
7
|
return data.map((user) => {
|
|
@@ -192,14 +193,8 @@ export const displayUserInfo = (item, secondDisplay) => {
|
|
|
192
193
|
return list[0].label;
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
value = item === null || item === void 0 ? void 0 : item[secondDisplay];
|
|
198
|
-
}
|
|
199
|
-
else if ((_b = item === null || item === void 0 ? void 0 : item.userExtend) === null || _b === void 0 ? void 0 : _b[secondDisplay]) {
|
|
200
|
-
value = (_c = item === null || item === void 0 ? void 0 : item.userExtend) === null || _c === void 0 ? void 0 : _c[secondDisplay];
|
|
201
|
-
}
|
|
202
|
-
return value;
|
|
196
|
+
const value = (_b = item === null || item === void 0 ? void 0 : item[secondDisplay]) !== null && _b !== void 0 ? _b : (_c = item === null || item === void 0 ? void 0 : item.userExtend) === null || _c === void 0 ? void 0 : _c[secondDisplay];
|
|
197
|
+
return textToString(value);
|
|
203
198
|
};
|
|
204
199
|
/**
|
|
205
200
|
* 前端实现部门模糊搜索
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Tree } from 'tea-component';
|
|
3
|
-
import { LoadingStatus, ErrorStatus } from './error-tips';
|
|
3
|
+
import { LoadingStatus, ErrorStatus, NullStatus } from './error-tips';
|
|
4
4
|
import './index.css';
|
|
5
5
|
export const OrgTree = (props) => {
|
|
6
6
|
const { selectedOrgId = [], treeData, treeDataError, onActive,
|
|
@@ -28,14 +28,24 @@ export const OrgTree = (props) => {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
//}
|
|
32
31
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
if (treeDataError) {
|
|
33
|
+
return _jsx(ErrorStatus, { description: treeDataError || null });
|
|
34
|
+
}
|
|
35
|
+
if (!treeData) {
|
|
36
|
+
return _jsx(LoadingStatus, {});
|
|
37
|
+
}
|
|
38
|
+
if (treeData.length > 0) {
|
|
39
|
+
return (_jsx(Tree, { className: "depart-tree", data: treeData, fullActivable: true, activable: true, selectable: selectable, selectedIds: selectedOrgId, activeIds: selectedOrgId, defaultExpandedIds: defaultExpandedIds, selectStrictly: true, onActive: (ids, context) => {
|
|
40
|
+
var _a;
|
|
41
|
+
onChange(ids, context === null || context === void 0 ? void 0 : context.active, context === null || context === void 0 ? void 0 : context.nodeId, (_a = context === null || context === void 0 ? void 0 : context.data) === null || _a === void 0 ? void 0 : _a.selectable);
|
|
42
|
+
}, onSelect: (ids, context) => {
|
|
43
|
+
onChange(ids, context === null || context === void 0 ? void 0 : context.selected, context === null || context === void 0 ? void 0 : context.nodeId, true);
|
|
44
|
+
},
|
|
45
|
+
// 开启虚拟滚动,优化大数据量性能!!
|
|
46
|
+
height: 320 }));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return _jsx(NullStatus, { description: "\u6682\u65E0\u6570\u636E", size: 's' });
|
|
50
|
+
}
|
|
41
51
|
};
|
|
@@ -13,6 +13,7 @@ import { useDepartData } from '../../hooks/use-depart-data';
|
|
|
13
13
|
import { parseStrToArr } from '../../common/utils';
|
|
14
14
|
export default function UserTreeSelect(props) {
|
|
15
15
|
const { events = emptyObject, defaultValue = emptyArray, confirmValue = '', defaultValueType = 'noneUser', onChange = null, multiple = false, request = defaultRequest, where, confirmAction, closeAction, secondDisplay, // 辅助信息
|
|
16
|
+
corpScope, // 展示企业范围
|
|
16
17
|
/**
|
|
17
18
|
* 以下两个属性 不用在组件库,企业工作台使用该组件时支持外部定义样式
|
|
18
19
|
* naked: 单纯使用该组件,而不在FormCell中使用(该组件实现默认在在)
|
|
@@ -42,7 +43,18 @@ export default function UserTreeSelect(props) {
|
|
|
42
43
|
//组织下展示用户页大小
|
|
43
44
|
const pageSize = 200;
|
|
44
45
|
const { filterParams } = useViewData(where);
|
|
45
|
-
const
|
|
46
|
+
const [corpScopes, setCorpScopes] = useState([]);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (!corpScope) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const corpScopes = filterStrList(parseStrToArr(corpScope));
|
|
52
|
+
setCorpScopes(corpScopes);
|
|
53
|
+
}, [corpScope]);
|
|
54
|
+
const { treeData, error } = useDepartData({
|
|
55
|
+
request,
|
|
56
|
+
params: { corpScopes },
|
|
57
|
+
});
|
|
46
58
|
// 默认选中第一个部门
|
|
47
59
|
useEffect(() => {
|
|
48
60
|
var _a;
|
|
@@ -64,9 +64,9 @@ const isNoOrgList = {
|
|
|
64
64
|
icon: Icon,
|
|
65
65
|
};
|
|
66
66
|
export const useDepartData = (props) => {
|
|
67
|
-
const { request } = props;
|
|
68
|
-
const { data: treeData, error } = useSWR(
|
|
69
|
-
const tempList = await DescribeOrgs(request);
|
|
67
|
+
const { request, params } = props;
|
|
68
|
+
const { data: treeData, error } = useSWR(`${DescribeOrgs}_${JSON.stringify(params)}`, async () => {
|
|
69
|
+
const tempList = await DescribeOrgs(request, params);
|
|
70
70
|
const orgsData = destr(tempList);
|
|
71
71
|
const { res: tempTreeData, tempOrgList } = buildTreeData(orgsData);
|
|
72
72
|
//是否展示非组织节点
|
|
@@ -35,13 +35,14 @@ export function useParentForm($widget) {
|
|
|
35
35
|
return data;
|
|
36
36
|
}
|
|
37
37
|
export function useFormInputTrait(inputParams) {
|
|
38
|
+
var _a;
|
|
38
39
|
const { value, $widget, inputRef, required, requiredMsg, rules = emptyArray, events, layout: currentLayout, setInnerHandle = noop, onChange: outerOnChange = noop, $node, } = inputParams;
|
|
39
40
|
if (isNil($widget)) {
|
|
40
41
|
throw new Error('$widget 没传入');
|
|
41
42
|
}
|
|
42
43
|
const eventsRef = useSyncedRef(events);
|
|
43
44
|
const [name] = useSyncValue(inputParams.name);
|
|
44
|
-
const [disabled, setDisabled] = useSyncValue(inputParams.disabled);
|
|
45
|
+
const [disabled, setDisabled] = useSyncValue((_a = inputParams.disabled) !== null && _a !== void 0 ? _a : false);
|
|
45
46
|
const [readOnly] = useSyncValue(inputParams.readOnly);
|
|
46
47
|
const [validateState, setValidateState] = useState(inputParams.validateStatus);
|
|
47
48
|
const [validateErrorMsg, setValidateErrorMsg] = useState('');
|
|
@@ -5,7 +5,7 @@ import Tips from '../form/tips';
|
|
|
5
5
|
import { useFormInputTrait } from '../form-input-hooks';
|
|
6
6
|
import { FormItemWrapper } from '../common/form-item-wrapper';
|
|
7
7
|
const FormUserTreeSelect = React.forwardRef(function FormUserTreeSelect(props, inputRef) {
|
|
8
|
-
const { className, id, style, events, required, requiredFlag, label, labelVisible, confirmValue, defaultValueType, multiple, size, where, secondDisplay, ...restProps } = props;
|
|
8
|
+
const { className, id, style, events, required, requiredFlag, label, labelVisible, confirmValue, defaultValueType, multiple, size, where, secondDisplay, corpScope, ...restProps } = props;
|
|
9
9
|
const { value, name,
|
|
10
10
|
// onChange,
|
|
11
11
|
disabled, layout,
|
|
@@ -19,6 +19,6 @@ const FormUserTreeSelect = React.forwardRef(function FormUserTreeSelect(props, i
|
|
|
19
19
|
if (!visible) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
return (_jsxs(FormItemWrapper, { children: [_jsx(UserTreeSelect, { id: id, style: style, className: className, events: events, name: name, checked: value, disabled: disabled, label: label, labelVisible: labelVisible, layout: layout, requiredFlag: required && requiredFlag, confirmValue: confirmValue, defaultValueType: defaultValueType, defaultValue: value, size: size, multiple: multiple, where: where, secondDisplay: secondDisplay }), (validateState === 'error' || validateState === 'warn') && (_jsx(Tips, { tips: validateErrorMsg, type: "warn" }))] }));
|
|
22
|
+
return (_jsxs(FormItemWrapper, { children: [_jsx(UserTreeSelect, { id: id, style: style, className: className, events: events, name: name, checked: value, disabled: disabled, label: label, labelVisible: labelVisible, layout: layout, requiredFlag: required && requiredFlag, confirmValue: confirmValue, defaultValueType: defaultValueType, defaultValue: value, size: size, multiple: multiple, where: where, secondDisplay: secondDisplay, corpScope: corpScope }), (validateState === 'error' || validateState === 'warn') && (_jsx(Tips, { tips: validateErrorMsg, type: "warn" }))] }));
|
|
23
23
|
});
|
|
24
24
|
export default FormUserTreeSelect;
|
|
@@ -87,5 +87,5 @@ export function UploadCSVFile({ parseFile, fields, datasourceTitle, dbName, setD
|
|
|
87
87
|
setDisableNext(true);
|
|
88
88
|
}, children: "\u5220\u9664" })] }) }), children: isDragging ? ('释放鼠标') : (_jsx(Status, { className: "upload-file", icon: 'blank', size: 's', operation: _jsxs(_Fragment, { children: [_jsx("a", { onClick: open, children: "\u70B9\u51FB\u4E0A\u4F20" }), " /", ' ', _jsx(Text, { theme: "weak", children: "\u62D6\u62FD\u5230\u6B64\u533A\u57DF" })] }) })) })) }) }), _jsx("div", { className: "modal-upload-text-wrap", children: _jsxs("ul", { children: [_jsxs("li", { children: ["1\u3001\u8BF7\u4E0B\u8F7D\u4F7F\u7528", _jsx("span", { onClick: () => {
|
|
89
89
|
getCSVTemplate(fields, datasourceTitle);
|
|
90
|
-
}, children: "\u00A0 \u5BFC\u5165\u6A21\u7248" }), "\uFF0C\u5E76\u6309\u7167\u793A\u4F8B\u586B\u5199\u6570\u636E\uFF0C\u4EE5\u4FDD\u8BC1\u6570\u636E\u5BFC\u5165\u987A\u5229"] }), _jsx("li", { children: "2\u3001\u652F\u6301xlsx\u7C7B\u578B\u6587\u4EF6\uFF0C\u8981\u6C42\u6587\u4EF6\u5927\u5C0F2M\u4EE5\u5185\uFF0C\u4E0D\u80FD\u8D85\u8FC710000\u884C" }), _jsxs("li", { children: [_jsx("div", { children: "3\u3001\u5BFC\u5165\u66F4\u65B0\u8BF4\u660E" }), _jsx("div", { children: "\u00A01\uFF09\u652F\u6301\
|
|
90
|
+
}, children: "\u00A0 \u5BFC\u5165\u6A21\u7248" }), "\uFF0C\u5E76\u6309\u7167\u793A\u4F8B\u586B\u5199\u6570\u636E\uFF0C\u4EE5\u4FDD\u8BC1\u6570\u636E\u5BFC\u5165\u987A\u5229"] }), _jsx("li", { children: "2\u3001\u652F\u6301xlsx\u7C7B\u578B\u6587\u4EF6\uFF0C\u8981\u6C42\u6587\u4EF6\u5927\u5C0F2M\u4EE5\u5185\uFF0C\u4E0D\u80FD\u8D85\u8FC710000\u884C" }), _jsxs("li", { children: [_jsx("div", { children: "3\u3001\u5BFC\u5165\u66F4\u65B0\u8BF4\u660E" }), _jsx("div", { children: "\u00A01\uFF09\u652F\u6301\u9009\u62E9\u5F00\u542F\u552F\u4E00\u5C5E\u6027\u7684\u5B57\u6BB5\uFF0C\u7528\u4E8E\u5339\u914D\u5E76\u66F4\u65B0\u5DF2\u6709\u7684\u6570\u636E\u8BB0\u5F55" }), _jsx("div", { children: "\u00A02\uFF09\u5BFC\u5165\u6A21\u5F0F\u4E3A\u300C\u65B0\u589E\u6216\u66F4\u65B0\u300D\u65F6\uFF0C\u5982\u300C\u6570\u636E\u6807\u8BC6\u300D\u5217\u4E3A\u7A7A\uFF0C\u8BE5\u884C\u6570\u636E\u4F1A\u6267\u884C\u65B0\u589E\u64CD\u4F5C" })] }), _jsxs("li", { children: [_jsx("div", { children: "4\u3001\u6570\u636E\u683C\u5F0F\u8BF4\u660E" }), _jsx("div", { children: "\u00A0 1\uFF09\u679A\u4E3E\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301\u9009\u62E9\u9009\u9879\u6807\u8BC6\u6216\u9009\u9879\u503C\u8FDB\u884C\u5BFC\u5165\uFF1A\u9009\u9879\u6807\u8BC6\u4E3A\u8868\u683C\u4E2D\u5C55\u793A\u7684\u4E1A\u52A1\u540D\u79F0\uFF1B\u9009\u9879\u503C\u4E3A\u9009\u9879\u7684\u7CFB\u7EDF\u552F\u4E00\u6807\u8BC6" }), _jsx("div", { children: "\u00A02\uFF09\u5173\u8054\u5173\u7CFB\u3001\u4E3B\u5B50\u660E\u7EC6\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301\u9009\u62E9\u4E3B\u5217\u5B57\u6BB5\u6216\u6570\u636E\u6807\u8BC6\u8FDB\u884C\u5BFC\u5165\uFF1A\u4E3B\u5217\u5B57\u6BB5\u4E3A\u8868\u683C\u4E2D\u5C55\u793A\u7684\u5173\u8054\u6570\u636E\u4E1A\u52A1\u540D\u79F0\uFF1B\u6570\u636E\u6807\u8BC6\u4E3A\u5173\u8054\u6570\u636E\u7684\u7CFB\u7EDF\u552F\u4E00\u6807\u8BC6" }), _jsx("div", { children: "\u00A03\uFF09\u5E03\u5C14\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301\u5BFC\u5165\u300C\u662F/\u5426\u300D\u6216\u300Ctrue/false\u300D" }), _jsx("div", { children: "\u00A04\uFF09\u56FE\u7247\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301\u5BFC\u5165https\u6216cloud\u534F\u8BAE\u7684\u56FE\u7247\u5730\u5740" }), _jsx("div", { children: "\u00A05\uFF09\u6587\u4EF6\u7C7B\u578B\u6570\u636E\uFF1A\u652F\u6301cloud\u534F\u8BAE\u7684\u6587\u4EF6\u5730\u5740" }), _jsx("div", { children: "\u00A06\uFF09\u5730\u7406\u4F4D\u7F6E\u7C7B\u578B\u6570\u636E\uFF1A\u6570\u636E\u683C\u5F0F\u8981\u6C42\u4E3A\u5730\u70B9\u540D\u79F0(\u5750\u6807\u7ECF\u5EA6\uFF0C\u5750\u6807\u7EF4\u5EA6)" })] })] }) })] }));
|
|
91
91
|
}
|
|
@@ -143,7 +143,8 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
143
143
|
}
|
|
144
144
|
else {
|
|
145
145
|
formItemMap.forEach((item) => {
|
|
146
|
-
|
|
146
|
+
var _a;
|
|
147
|
+
item.setReadOnly((_a = item.initialDisabled) !== null && _a !== void 0 ? _a : false);
|
|
147
148
|
});
|
|
148
149
|
}
|
|
149
150
|
});
|
|
@@ -176,7 +177,7 @@ const WdForm = React.forwardRef(function WdForm(props, ref) {
|
|
|
176
177
|
setValue(fetchedInitialValues, true);
|
|
177
178
|
}
|
|
178
179
|
}, [fetchedInitialValues, initValueFetchError, isLoadingInitValues, setValue]);
|
|
179
|
-
const { data: dataSourceProfile } = useDataSource();
|
|
180
|
+
const { data: dataSourceProfile } = useDataSource(dataSourceName);
|
|
180
181
|
const authValue = useAuthValue({
|
|
181
182
|
appCloud,
|
|
182
183
|
isDataModel,
|
|
@@ -16,6 +16,7 @@ import { QuoteModal } from './QuoteModal';
|
|
|
16
16
|
import { TABLE_SLOT_PREFIX } from '../../../../utils/constant';
|
|
17
17
|
import { getPrimaryField } from '../../../../utils/datasource';
|
|
18
18
|
import { useConfig } from '../../../../utils/config-context';
|
|
19
|
+
import { EnumHoc } from '../../../../utils/hooks/EnumHoc';
|
|
19
20
|
import { ImagePreview } from './ImagePreview';
|
|
20
21
|
const MODAL_SIZE = 'auto';
|
|
21
22
|
// 文字提示框包裹组件
|
|
@@ -47,10 +48,7 @@ export function getFieldRender(field = {}, extra = {}) {
|
|
|
47
48
|
}
|
|
48
49
|
// render 方法
|
|
49
50
|
const FieldRender = (val) => {
|
|
50
|
-
|
|
51
|
-
if (isValueEmpty(val) ||
|
|
52
|
-
(type === 'array' && !(val === null || val === void 0 ? void 0 : val.length)) ||
|
|
53
|
-
(type === 'array' && (val === null || val === void 0 ? void 0 : val.length) && !((_a = Object.keys(val[0])) === null || _a === void 0 ? void 0 : _a.length))) {
|
|
51
|
+
if (isValueEmpty(val) || (type === 'array' && !(val === null || val === void 0 ? void 0 : val.length))) {
|
|
54
52
|
return '-';
|
|
55
53
|
}
|
|
56
54
|
// fieldValue 值转换,如布尔/时间/枚举等
|
|
@@ -211,10 +209,10 @@ export const DataItemView = ({ fields, modelType, value }) => {
|
|
|
211
209
|
* object,展示表格组件
|
|
212
210
|
*/
|
|
213
211
|
export const DataTableView = ({ fields, value }) => {
|
|
212
|
+
var _a;
|
|
214
213
|
const { classPrefix } = useConfig();
|
|
214
|
+
const rawFields = (_a = Object === null || Object === void 0 ? void 0 : Object.entries(fields.properties)) === null || _a === void 0 ? void 0 : _a.map(([name, field]) => Object.assign({}, field, { name }));
|
|
215
215
|
const columns = useMemo(() => {
|
|
216
|
-
var _a;
|
|
217
|
-
const rawFields = (_a = Object === null || Object === void 0 ? void 0 : Object.entries(fields.properties)) === null || _a === void 0 ? void 0 : _a.map(([name, field]) => Object.assign({}, field, { name }));
|
|
218
216
|
const rawFieldsSort = rawFields.sort((a, b) => a['x-index'] - b['x-index']);
|
|
219
217
|
const baseColumns = getColumns({
|
|
220
218
|
columnSets: [],
|
|
@@ -222,8 +220,8 @@ export const DataTableView = ({ fields, value }) => {
|
|
|
222
220
|
isH5: false,
|
|
223
221
|
});
|
|
224
222
|
return baseColumns;
|
|
225
|
-
}, [
|
|
226
|
-
return (_jsx(ConfigProvider, { classPrefix: classPrefix, children: _jsx(Table, { className: `${classPrefix}-table-wrap`, bordered: "all", recordKey: "_id", records: [].concat(value), columns: columns }) }));
|
|
223
|
+
}, [rawFields]);
|
|
224
|
+
return (_jsx(ConfigProvider, { classPrefix: classPrefix, children: _jsx(EnumHoc, { fields: rawFields, children: _jsx(Table, { className: `${classPrefix}-table-wrap`, bordered: "all", recordKey: "_id", records: [].concat(value), columns: columns }) }) }));
|
|
227
225
|
};
|
|
228
226
|
/**
|
|
229
227
|
* array类型,展示组件
|
|
@@ -576,6 +574,19 @@ export const getFieldValue = (name, _record) => {
|
|
|
576
574
|
return record[name];
|
|
577
575
|
};
|
|
578
576
|
export const slotRender = (slot, props = {}) => typeof slot === 'function' ? slot(props) : slot;
|
|
577
|
+
const TableSlotCell = ({ record, rowKey, recordIndex, column, columnIndex, slot, }) => {
|
|
578
|
+
const component = React.useMemo(() => {
|
|
579
|
+
// 计算单元格的值
|
|
580
|
+
return slotRender(slot, {
|
|
581
|
+
record,
|
|
582
|
+
rowKey,
|
|
583
|
+
recordIndex,
|
|
584
|
+
column,
|
|
585
|
+
columnIndex,
|
|
586
|
+
});
|
|
587
|
+
}, [record, rowKey, recordIndex, column, columnIndex]);
|
|
588
|
+
return _jsx(_Fragment, { children: component });
|
|
589
|
+
};
|
|
579
590
|
/**
|
|
580
591
|
* 根据列管理,过滤表格列信息
|
|
581
592
|
* columns: { key, header, width, align, render,fixed }[] Tea Table 的列
|
|
@@ -610,20 +621,7 @@ export const filterCustomColumns = ({ columns, columnSets, slots }) => {
|
|
|
610
621
|
if (genre === 'slot') {
|
|
611
622
|
// 拿到列对应的插槽
|
|
612
623
|
const slot = slots[`${TABLE_SLOT_PREFIX}${(item2 === null || item2 === void 0 ? void 0 : item2.slotKey) || key}`];
|
|
613
|
-
|
|
614
|
-
const component = React.useMemo(() => {
|
|
615
|
-
// 计算单元格的值
|
|
616
|
-
return slotRender(slot, {
|
|
617
|
-
record,
|
|
618
|
-
rowKey,
|
|
619
|
-
recordIndex,
|
|
620
|
-
column,
|
|
621
|
-
columnIndex,
|
|
622
|
-
});
|
|
623
|
-
}, [record, rowKey, recordIndex, column, columnIndex]);
|
|
624
|
-
return _jsx(_Fragment, { children: component });
|
|
625
|
-
};
|
|
626
|
-
customColumn.render = (record, rowKey, recordIndex, column, columnIndex) => (_jsx(TableSlotCell, { record: record, rowKey: rowKey, recordIndex: recordIndex, column: column, columnIndex: columnIndex }));
|
|
624
|
+
customColumn.render = (record, rowKey, recordIndex, column, columnIndex) => (_jsx(TableSlotCell, { record: record, rowKey: rowKey, recordIndex: recordIndex, column: column, columnIndex: columnIndex, slot: slot }));
|
|
627
625
|
}
|
|
628
626
|
return customColumn;
|
|
629
627
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable max-lines */
|
|
3
|
-
import { useRef, useEffect, useState, useMemo,
|
|
3
|
+
import { useRef, useEffect, useState, useMemo, useImperativeHandle, forwardRef, } from 'react';
|
|
4
4
|
import { ConfigProvider } from 'tea-component';
|
|
5
5
|
import { Table, ExportFileModal, ImportFileModal, InOrOutRecordModal, deleteRecord, importHandleByApi, exportHandleByApi, exportHandle, FilterFieldsPanel, ToolBar, } from './components';
|
|
6
6
|
import classNames from '../../utils/classnames';
|
|
@@ -24,6 +24,22 @@ import Modal from '../modal';
|
|
|
24
24
|
import { WdButton } from '../wd-button';
|
|
25
25
|
const _defaultPageIndex = 1;
|
|
26
26
|
const _defaultPageSize = 10;
|
|
27
|
+
const TableOption = ({ record, rowKey, recordIndex, column, columnIndex, slots, classPrefix, }) => {
|
|
28
|
+
const component = useMemo(() => {
|
|
29
|
+
// 计算单元格的值
|
|
30
|
+
return slotRender(slots[CELL_CUSTOM_OPTION], {
|
|
31
|
+
record,
|
|
32
|
+
rowKey,
|
|
33
|
+
recordIndex,
|
|
34
|
+
column,
|
|
35
|
+
columnIndex,
|
|
36
|
+
});
|
|
37
|
+
}, [column, columnIndex, record, recordIndex, rowKey, slots]);
|
|
38
|
+
return (_jsx("div", { className: `${classPrefix}-pc-table-option-btn-wrap`, children: component }));
|
|
39
|
+
};
|
|
40
|
+
const GlobalButton = function GlobalButtonDom({ classPrefix, slots, }) {
|
|
41
|
+
return _jsx("div", { className: `${classPrefix}-global-btn`, children: slotRender(slots) });
|
|
42
|
+
};
|
|
27
43
|
// eslint-disable-next-line complexity
|
|
28
44
|
export const WdTable = forwardRef(function TableComp({ className, style, dataSourceType, bindConnectMetadata = {
|
|
29
45
|
datasource: { id: '', name: '', title: '' },
|
|
@@ -202,19 +218,6 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
202
218
|
});
|
|
203
219
|
// 操作列
|
|
204
220
|
if (enableCellCustomOption && !isH5) {
|
|
205
|
-
const TableOption = ({ record, rowKey, recordIndex, column, columnIndex, }) => {
|
|
206
|
-
const component = useMemo(() => {
|
|
207
|
-
// 计算单元格的值
|
|
208
|
-
return slotRender(slots[CELL_CUSTOM_OPTION], {
|
|
209
|
-
record,
|
|
210
|
-
rowKey,
|
|
211
|
-
recordIndex,
|
|
212
|
-
column,
|
|
213
|
-
columnIndex,
|
|
214
|
-
});
|
|
215
|
-
}, [column, columnIndex, record, recordIndex, rowKey]);
|
|
216
|
-
return (_jsx("div", { className: `${classPrefix}-pc-table-option-btn-wrap`, children: component }));
|
|
217
|
-
};
|
|
218
221
|
// 展示插槽操作列
|
|
219
222
|
baseColumns.push({
|
|
220
223
|
key: 'button',
|
|
@@ -222,7 +225,7 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
222
225
|
width: 150,
|
|
223
226
|
align: 'left',
|
|
224
227
|
fixed: 'right',
|
|
225
|
-
render: (record, rowKey, recordIndex, column, columnIndex) => (_jsx(TableOption, { record: record, rowKey: rowKey, recordIndex: recordIndex, column: column, columnIndex: columnIndex })),
|
|
228
|
+
render: (record, rowKey, recordIndex, column, columnIndex) => (_jsx(TableOption, { slots: slots, classPrefix: classPrefix, record: record, rowKey: rowKey, recordIndex: recordIndex, column: column, columnIndex: columnIndex })),
|
|
226
229
|
});
|
|
227
230
|
}
|
|
228
231
|
// 选择列
|
|
@@ -401,9 +404,6 @@ enableRefreshBtn = true, enableTableHeightSizeBtn = true, emptyText, ...props },
|
|
|
401
404
|
// 仅当切换小屏的时候重新请求
|
|
402
405
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
403
406
|
}, [isH5]);
|
|
404
|
-
const GlobalButton = memo(function GlobalButtonDom({ classPrefix, slots, }) {
|
|
405
|
-
return (_jsx("div", { className: `${classPrefix}-global-btn`, children: slotRender(slots) }));
|
|
406
|
-
});
|
|
407
407
|
const hasFilterButton = !!filterFieldsData.length;
|
|
408
408
|
const recordKey = isInIde() ? undefined : '_id';
|
|
409
409
|
return (_jsx(ConfigProvider, { classPrefix: classPrefix, children: _jsx(EnumHoc, { fields: authFields, children: _jsxs("div", { className: classNames(wrapClassList, className), style: style, id: id, children: [_jsx(FilterFieldsPanel, { openMobileFilter: openMobileFilter, setOpenMobileFilter: setOpenMobileFilter, filterFields: filterFieldsData, fetchData: (searchValues = []) => {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isInIde, alertErrorMessage, isSystemField } from './platform';
|
|
2
|
-
import { deepClone } from './tool';
|
|
3
2
|
/* **** 数据源相关方法 **** */
|
|
4
3
|
const callWedaApi = (...args) => { var _a, _b; return (_b = (_a = window === null || window === void 0 ? void 0 : window.app) === null || _a === void 0 ? void 0 : _a.cloud) === null || _b === void 0 ? void 0 : _b.callWedaApi(...args); };
|
|
5
4
|
export class DataSource {
|
|
@@ -350,22 +349,29 @@ export const resolveFieldsFromDatasource = async ({ dbName, enabledFieldNames, d
|
|
|
350
349
|
* 获取主列字段标识并展示主列字段
|
|
351
350
|
*/
|
|
352
351
|
export const getPrimaryField = (_data) => {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
if (
|
|
363
|
-
//
|
|
364
|
-
record[
|
|
365
|
-
|
|
366
|
-
|
|
352
|
+
let data = {};
|
|
353
|
+
try {
|
|
354
|
+
data = JSON.parse(JSON.stringify(_data));
|
|
355
|
+
const keys = Object.keys(data).filter((item) => item.includes('@'));
|
|
356
|
+
keys.forEach((item) => {
|
|
357
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
358
|
+
const field = item.replace('@', '');
|
|
359
|
+
const record = (_b = (_a = data[item]) === null || _a === void 0 ? void 0 : _a.v1) === null || _b === void 0 ? void 0 : _b.record;
|
|
360
|
+
const name = (_d = (_c = data[item]) === null || _c === void 0 ? void 0 : _c.v1) === null || _d === void 0 ? void 0 : _d.primaryColumn;
|
|
361
|
+
if (name) {
|
|
362
|
+
// 系统主列字段当record不存在时,默认展示最外层owner、createBy、updateBy字段,与其他列字段逻辑一致
|
|
363
|
+
if (record && record._id === data[field]) {
|
|
364
|
+
// 当record下主列字段没有值时,默认返回主列id
|
|
365
|
+
record[name]
|
|
366
|
+
? (data[field] = record[name])
|
|
367
|
+
: (data[field] = ((_g = (_f = (_e = data[item]) === null || _e === void 0 ? void 0 : _e.v1) === null || _f === void 0 ? void 0 : _f.record) === null || _g === void 0 ? void 0 : _g._id) || '-');
|
|
368
|
+
}
|
|
367
369
|
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
console.error('主列字段数据转换出错', error);
|
|
374
|
+
return _data;
|
|
375
|
+
}
|
|
370
376
|
return data;
|
|
371
377
|
};
|
package/dist/web/utils/date.js
CHANGED
|
@@ -73,10 +73,10 @@ export const formatDateToNumber = (dateType = 'date', t = '') => {
|
|
|
73
73
|
*/
|
|
74
74
|
export const dateCalculation = ({ key, val, rel }, filterType) => {
|
|
75
75
|
const dateSearchvalue = [];
|
|
76
|
-
// 1.
|
|
77
|
-
// 2.
|
|
76
|
+
// 1.datetime日期时间查询精确到秒,换算成毫秒时间戳存储,区间相隔一秒
|
|
77
|
+
// 2.date日期查询精确到日,日期换算成毫秒时间戳存储,区间相隔一日 86400000(未满1日,86399999)
|
|
78
78
|
// 3.time时间查询精确到毫秒,换算成毫秒存储,区间相隔一秒
|
|
79
|
-
const endTime = filterType === 'date' ?
|
|
79
|
+
const endTime = filterType === 'date' ? 86399999 : 999;
|
|
80
80
|
switch (rel) {
|
|
81
81
|
case 'eq':
|
|
82
82
|
dateSearchvalue.push({
|