@bit-sun/business-component 3.2.4 → 3.6.1-alpha.0
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/.umirc.ts +3 -2
- package/dist/components/Business/AddSelectBusiness/index.d.ts +4 -4
- package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +2 -2
- package/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +2 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +2 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +2 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +2 -2
- package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +1 -1
- package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +2 -2
- package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +2 -2
- package/dist/components/Business/BsLayouts/index.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +5 -5
- package/dist/components/Business/BsSulaQueryTable/index.d.ts +2 -2
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +7 -7
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +15 -15
- package/dist/components/Business/CommodityEntry/index.d.ts +2 -2
- package/dist/components/Business/CommonAlert/index.d.ts +2 -2
- package/dist/components/Business/CommonGuideWrapper/index.d.ts +3 -3
- package/dist/components/Business/DetailPageWrapper/index.d.ts +6 -6
- package/dist/components/Business/HomePageWrapper/index.d.ts +2 -2
- package/dist/components/Business/JsonQueryTable/components/FieldsModifyModal.d.ts +2 -2
- package/dist/components/Business/JsonQueryTable/components/FieldsSettingsTable.d.ts +2 -2
- package/dist/components/Business/JsonQueryTable/components/Formula.d.ts +2 -2
- package/dist/components/Business/JsonQueryTable/components/MaintainOptions.d.ts +2 -2
- package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +2 -2
- package/dist/components/Business/SearchSelect/index.d.ts +1 -1
- package/dist/components/Business/StateFlow/index.d.ts +2 -2
- package/dist/components/Business/TreeSearchSelect/index.d.ts +1 -1
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +7 -7
- package/dist/components/Business/columnSettingTable/index.d.ts +3 -2
- package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +2 -2
- package/dist/components/Business/columnSettingTable/utils.d.ts +2 -2
- package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +1 -1
- package/dist/components/Common/ExtendedCollapse/ExtendedPanel.d.ts +10 -0
- package/dist/components/Common/ExtendedCollapse/index.d.ts +7 -0
- package/dist/components/Common/ParagraphCopier/index.d.ts +8 -0
- package/dist/components/Common/Section/index.d.ts +29 -0
- package/dist/components/Functional/AddSelect/index.d.ts +2 -2
- package/dist/components/Functional/AuthButton/index.d.ts +2 -2
- package/dist/components/Functional/DataImport/index.d.ts +3 -3
- package/dist/components/Functional/DataValidation/index.d.ts +3 -3
- package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +2 -2
- package/dist/components/Functional/QueryMutipleInput/index.d.ts +4 -3
- package/dist/components/Functional/SearchSelect/index.d.ts +1 -1
- package/dist/components/Functional/TreeSearchSelect/index.d.ts +2 -2
- package/dist/components/Solution/RuleComponent/Formula.d.ts +2 -2
- package/dist/components/Solution/RuleComponent/InnerSelect.d.ts +2 -2
- package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +2 -2
- package/dist/components/Solution/RuleSetter/RuleInstance.d.ts +2 -2
- package/dist/components/Solution/RuleSetter/baseRule.d.ts +1 -1
- package/dist/components/Solution/RuleSetter/index.d.ts +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +1158 -1849
- package/dist/index.js +1158 -1850
- package/dist/plugin/TableColumnSetting/index.d.ts +6 -5
- package/dist/utils/TableUtils.d.ts +19 -19
- package/dist/utils/requestUtils.d.ts +0 -1
- package/dist/utils/utils.d.ts +0 -3
- package/lib/assets/exportFail.svg +9 -9
- package/lib/assets/exportProcessing.svg +9 -9
- package/lib/assets/exportSuccess.svg +9 -9
- package/package.json +15 -16
- package/src/assets/caidan.svg +1 -1
- package/src/assets/exportFail.svg +9 -9
- package/src/assets/exportProcessing.svg +9 -9
- package/src/assets/exportSuccess.svg +9 -9
- package/src/assets/fixed-left-active.svg +1 -1
- package/src/assets/fixed-right-active.svg +1 -1
- package/src/components/Business/AddSelectBusiness/index.md +11 -5
- package/src/components/Business/AddSelectBusiness/index.tsx +5 -56
- package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +1 -1
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +1 -1
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +2 -2
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +1 -1
- package/src/components/Business/BsLayouts/Components/RightContent/home.less +1 -1
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +3 -3
- package/src/components/Business/BsLayouts/index.tsx +4 -9
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +2 -1
- package/src/components/Business/BsSulaQueryTable/index.md +113 -0
- package/src/components/Business/BsSulaQueryTable/index.tsx +240 -162
- package/src/components/Business/BsSulaQueryTable/setting.tsx +52 -3
- package/src/components/Business/BsSulaQueryTable/utils.less +1 -1
- package/src/components/Business/BsSulaQueryTable/utils.tsx +8 -8
- package/src/components/Business/CommodityEntry/index.tsx +2 -2
- package/src/components/Business/CommonAlert/index.tsx +1 -1
- package/src/components/Business/CommonGuideWrapper/index.less +50 -15
- package/src/components/Business/CommonGuideWrapper/index.md +36 -14
- package/src/components/Business/CommonGuideWrapper/index.tsx +73 -59
- package/src/components/Business/DetailPageWrapper/index.less +11 -9
- package/src/components/Business/DetailPageWrapper/index.tsx +2 -23
- package/src/components/Business/DetailPageWrapper/utils.tsx +1 -1
- package/src/components/Business/HomePageWrapper/index.less +6 -3
- package/src/components/Business/HomePageWrapper/index.md +2 -2
- package/src/components/Business/HomePageWrapper/index.tsx +5 -37
- package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +2 -2
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +40 -38
- package/src/components/Business/SearchSelect/index.md +0 -58
- package/src/components/Business/SearchSelect/utils.ts +2 -2
- package/src/components/Business/StateFlow/index.less +3 -3
- package/src/components/Business/TreeSearchSelect/index.md +0 -28
- package/src/components/Business/TreeSearchSelect/utils.ts +0 -11
- package/src/components/Business/columnSettingTable/columnSetting.tsx +65 -13
- package/src/components/Business/columnSettingTable/index.md +1 -15
- package/src/components/Business/columnSettingTable/index.tsx +14 -4
- package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +5 -4
- package/src/components/Business/columnSettingTable/utils.tsx +2 -2
- package/src/components/Common/ExtendedCollapse/ExtendedPanel.tsx +51 -0
- package/src/components/Common/ExtendedCollapse/index.less +33 -0
- package/src/components/Common/ExtendedCollapse/index.md +136 -0
- package/src/components/Common/ExtendedCollapse/index.tsx +25 -0
- package/src/components/Common/ParagraphCopier/index.md +81 -0
- package/src/components/Common/ParagraphCopier/index.tsx +56 -0
- package/src/components/Common/Section/index.md +120 -0
- package/src/components/Common/Section/index.module.less +16 -0
- package/src/components/Common/Section/index.tsx +70 -0
- package/src/components/Functional/AddSelect/index.tsx +29 -19
- package/src/components/Functional/BillEntry/index.tsx +11 -10
- package/src/components/Functional/DataImport/index.tsx +2 -1
- package/src/components/Functional/DataValidation/index.tsx +3 -3
- package/src/components/Functional/QueryMutipleInput/index.tsx +13 -4
- package/src/components/Functional/SearchSelect/index.tsx +3 -10
- package/src/components/Solution/RuleComponent/InnerSelect.tsx +1 -0
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +30 -46
- package/src/components/Solution/RuleComponent/index.js +18 -13
- package/src/components/Solution/RuleComponent/ruleFiled.js +41 -123
- package/src/index.ts +5 -0
- package/src/plugin/TableColumnSetting/index.tsx +75 -9
- package/src/styles/bsDefault.less +26 -18
- package/src/utils/TableUtils.less +1 -1
- package/src/utils/businessUtils.ts +2 -2
- package/src/utils/requestUtils.ts +2 -6
- package/src/utils/utils.ts +6 -35
- package/src/utils/xlsxUtil.tsx +2 -2
- package/tsconfig.json +2 -1
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.d.ts +0 -3
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/helps.d.ts +0 -2
- package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.d.ts +0 -3
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.tsx +0 -358
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/function.js +0 -255
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/helps.tsx +0 -58
- package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.tsx +0 -129
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
|
3
3
|
import { useLocation } from 'umi';
|
|
4
4
|
import { QueryTable } from 'bssula';
|
|
5
|
+
import { Menu, Tooltip, Dropdown, Table, Typography } from 'antd';
|
|
6
|
+
import { Resizable } from 'react-resizable';
|
|
7
|
+
import { debounce } from 'lodash';
|
|
8
|
+
import ExportIcon from '@/components/Functional/ExportFunctions/ExportIcon';
|
|
9
|
+
import ENUM from '@/utils/enumConfig';
|
|
10
|
+
import { handleBssulaColumnsSpecialParams, uuid } from '@/utils/utils';
|
|
11
|
+
import { getMenuAuthDataKey } from '@/utils/LocalstorageUtils';
|
|
12
|
+
import { shouldUseAuth } from '@/utils';
|
|
5
13
|
import {
|
|
6
14
|
userColumns,
|
|
7
15
|
getItemDefaultWidth,
|
|
@@ -9,20 +17,12 @@ import {
|
|
|
9
17
|
queryParams,
|
|
10
18
|
renderToString,
|
|
11
19
|
} from './utils';
|
|
12
|
-
import { Menu, Tooltip, Dropdown, Table, Typography } from 'antd';
|
|
13
20
|
import SortableTable from './setting';
|
|
14
21
|
import SearchItemTable from './SearchItemSetting';
|
|
15
|
-
import { Resizable } from 'react-resizable';
|
|
16
22
|
import quanping from '../../../assets/icon-quanping.svg';
|
|
17
23
|
import scanning from '../../../assets/scanning.svg';
|
|
18
24
|
import shezhi from '../../../assets/icon-shezhi.svg';
|
|
19
|
-
import { debounce } from 'lodash';
|
|
20
|
-
import ExportIcon from '@/components/Functional/ExportFunctions/ExportIcon';
|
|
21
|
-
import ENUM from '@/utils/enumConfig';
|
|
22
|
-
import { handleBssulaColumnsSpecialParams, uuid, parseWidth } from '@/utils/utils';
|
|
23
25
|
import './bssulaquerytable.less';
|
|
24
|
-
import { getMenuAuthDataKey } from '@/utils/LocalstorageUtils';
|
|
25
|
-
import { shouldUseAuth } from '@/utils';
|
|
26
26
|
|
|
27
27
|
interface Column {
|
|
28
28
|
key?: string | string[];
|
|
@@ -61,9 +61,13 @@ const ResizeableTitle = (props) => {
|
|
|
61
61
|
|
|
62
62
|
export default (props: any) => {
|
|
63
63
|
const bsTableCode = props?.tableCode || window.location.hash; //设置列字段的唯一标识
|
|
64
|
+
/**
|
|
65
|
+
* 默认展示行数
|
|
66
|
+
*/
|
|
67
|
+
const defaultRow = 2
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
|
|
69
|
+
// 获取 table columns中所有的 key 防止有的地方是 dataindex
|
|
70
|
+
const checkedList = useMemo(
|
|
67
71
|
() =>
|
|
68
72
|
props.columns
|
|
69
73
|
.filter((col: any) => !col.hidden)
|
|
@@ -74,13 +78,14 @@ export default (props: any) => {
|
|
|
74
78
|
),
|
|
75
79
|
[props.columns],
|
|
76
80
|
);
|
|
77
|
-
|
|
78
|
-
const getConfigFromlocalstorage = (
|
|
81
|
+
|
|
82
|
+
const getConfigFromlocalstorage = (
|
|
83
|
+
type: string,
|
|
84
|
+
tableCode: string = bsTableCode,
|
|
85
|
+
) => {
|
|
79
86
|
let config = localStorage.getItem(type) || '[]';
|
|
80
87
|
let configArray = JSON.parse(config);
|
|
81
|
-
let configSetting = configArray.filter(
|
|
82
|
-
(item) => item.code === tableCode,
|
|
83
|
-
);
|
|
88
|
+
let configSetting = configArray.filter((item) => item.code === tableCode);
|
|
84
89
|
|
|
85
90
|
if (configSetting.length && configSetting[0].detail) {
|
|
86
91
|
return JSON.parse(configSetting[0].detail);
|
|
@@ -89,63 +94,71 @@ export default (props: any) => {
|
|
|
89
94
|
};
|
|
90
95
|
|
|
91
96
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
*/
|
|
98
|
-
const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
99
|
-
/**
|
|
100
|
-
* 判断值是否为字符串数组。
|
|
101
|
-
* @param value 待判断的值。
|
|
102
|
-
* @returns 如果值是字符串数组,则返回true,否则返回false。
|
|
97
|
+
* 根据保存的配置和原始配置,获取设置的字段或列。
|
|
98
|
+
* @param savedConfig 保存的配置数组,可能包含字段或列的配置。
|
|
99
|
+
* @param originConfig 原始配置数组,包含完整的字段或列信息。
|
|
100
|
+
* @param type 字段或列的类型,用于确定配置的属性。
|
|
101
|
+
* @returns 返回根据保存的配置处理后的字段或列数组,如果未保存任何配置,则返回原始配置。
|
|
103
102
|
*/
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
104
|
+
/**
|
|
105
|
+
* 判断值是否为字符串数组。
|
|
106
|
+
* @param value 待判断的值。
|
|
107
|
+
* @returns 如果值是字符串数组,则返回true,否则返回false。
|
|
108
|
+
*/
|
|
109
|
+
const isStringArray = (value: any): value is string[] => {
|
|
110
|
+
return Array.isArray(value) && value.every((v) => typeof v === 'string');
|
|
111
|
+
};
|
|
107
112
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
/**
|
|
114
|
+
* 根据配置项和类型,获取配置项的键。
|
|
115
|
+
* @param config 配置项,可以是字段或列。
|
|
116
|
+
* @param type 配置项的类型。
|
|
117
|
+
* @returns 返回配置项的键,如果无法获取,则返回空字符串。
|
|
118
|
+
*/
|
|
119
|
+
const getItemKey = (config: Column | Field, type: string): string => {
|
|
120
|
+
try {
|
|
121
|
+
if (type === 'columns') {
|
|
122
|
+
return isStringArray(config.key)
|
|
123
|
+
? JSON.stringify(config.key)
|
|
124
|
+
: isStringArray(config.dataIndex)
|
|
125
|
+
? JSON.stringify(config.dataIndex)
|
|
126
|
+
: config.key || config.dataIndex || '';
|
|
127
|
+
}
|
|
128
|
+
return isStringArray(config.name)
|
|
129
|
+
? JSON.stringify(config.name)
|
|
130
|
+
: config.name || '';
|
|
131
|
+
} catch (e) {}
|
|
132
|
+
return '';
|
|
133
|
+
};
|
|
123
134
|
|
|
124
|
-
|
|
135
|
+
const newConfig = [];
|
|
125
136
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
137
|
+
if (savedConfig.length) {
|
|
138
|
+
const hash = originConfig.reduce((prev, inneritem) => {
|
|
139
|
+
prev[getItemKey(inneritem, type)] = inneritem;
|
|
140
|
+
return prev;
|
|
141
|
+
}, {} as { [key: string]: Column | Field });
|
|
131
142
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
143
|
+
savedConfig.forEach((config, index) => {
|
|
144
|
+
let inner = hash[getItemKey(config, type)];
|
|
145
|
+
inner && newConfig.push({ ...inner, ...config });
|
|
146
|
+
});
|
|
147
|
+
}
|
|
137
148
|
|
|
138
|
-
|
|
149
|
+
if (newConfig.length) return newConfig;
|
|
139
150
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
151
|
+
if (type === 'columns') {
|
|
152
|
+
return originConfig.filter((column) => {
|
|
153
|
+
const columnKey = getItemKey(column, type);
|
|
154
|
+
return (
|
|
155
|
+
column.notRegularCheckList || checkedList.indexOf(columnKey) > -1
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
146
159
|
|
|
147
|
-
|
|
148
|
-
}
|
|
160
|
+
return [...originConfig];
|
|
161
|
+
};
|
|
149
162
|
const refs = useRef(null);
|
|
150
163
|
const [pagePath, setPagePath] = useState('');
|
|
151
164
|
|
|
@@ -155,14 +168,19 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
155
168
|
const value = props;
|
|
156
169
|
const { fields = [] } = props;
|
|
157
170
|
const [showColumn, setShowColumns] = useState([]); // 列字段
|
|
158
|
-
const originSearchFields = getSettingFieldOrColumn(
|
|
171
|
+
const originSearchFields = getSettingFieldOrColumn(
|
|
172
|
+
getConfigFromlocalstorage(ENUM.BROWSER_CACHE.SEARCH_FIELDS_CONDITION),
|
|
173
|
+
fields,
|
|
174
|
+
'searchFields',
|
|
175
|
+
);
|
|
159
176
|
const [showSearchFields, setShowSearchFields] = useState(originSearchFields); //搜索项字段
|
|
160
177
|
const [showExportColumn, setShowExportColumns] = useState([]); // 导出列字段
|
|
161
178
|
|
|
162
|
-
const [height, setHeight]: any = useState('');
|
|
179
|
+
const [height, setHeight]: any = useState('100vh');
|
|
163
180
|
const sortTableRef = useRef(null);
|
|
164
181
|
const searchTableRef = useRef(null);
|
|
165
182
|
const exportTableRef = useRef<any>(null);
|
|
183
|
+
const queryTableRef = useRef(null);
|
|
166
184
|
|
|
167
185
|
const bsTableCodeExport = `${bsTableCode}___Export`; //设置导出列字段的唯一标识
|
|
168
186
|
|
|
@@ -176,12 +194,23 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
176
194
|
window.top.document.mozFullScreen;
|
|
177
195
|
|
|
178
196
|
// wujie子应用iframe首次加载获取不到client以及dom元素高度兼容处理
|
|
179
|
-
let realIframeClientHeight = document.body.clientHeight
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
let
|
|
183
|
-
|
|
184
|
-
|
|
197
|
+
let realIframeClientHeight = document.body.clientHeight
|
|
198
|
+
? document.body.clientHeight
|
|
199
|
+
: window.top?.document.body.clientHeight - 76;
|
|
200
|
+
let summaryHeight = document.querySelector(
|
|
201
|
+
`.ant-tabs-tabpane-active .table-bssula-summary`,
|
|
202
|
+
)
|
|
203
|
+
? document.querySelector(
|
|
204
|
+
`.ant-tabs-tabpane-active .table-bssula-summary`,
|
|
205
|
+
)?.clientHeight || 22
|
|
206
|
+
: 0;
|
|
207
|
+
let listTabHeight = document.querySelector(
|
|
208
|
+
`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`,
|
|
209
|
+
)
|
|
210
|
+
? document.querySelector(
|
|
211
|
+
`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`,
|
|
212
|
+
)?.clientHeight || 48
|
|
213
|
+
: 0;
|
|
185
214
|
|
|
186
215
|
const h =
|
|
187
216
|
realIframeClientHeight -
|
|
@@ -212,8 +241,7 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
212
241
|
return isFull;
|
|
213
242
|
}
|
|
214
243
|
|
|
215
|
-
|
|
216
|
-
const setInitialTableInfo = () => {
|
|
244
|
+
const setInitialTableInfo = (isReset) => {
|
|
217
245
|
const resourceCodeArray = {};
|
|
218
246
|
const uuIdList = [];
|
|
219
247
|
if (props.actionsRender && props.actionsRender.length) {
|
|
@@ -252,29 +280,40 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
252
280
|
: [];
|
|
253
281
|
Object.keys(resourceCodeArray).forEach((item: any) => {
|
|
254
282
|
let Item = item;
|
|
255
|
-
if (uuIdList?.some(s => item.indexOf(s)
|
|
256
|
-
const uuId = uuIdList.filter(s => item.indexOf(s)
|
|
283
|
+
if (uuIdList?.some((s) => item.indexOf(s) > -1)) {
|
|
284
|
+
const uuId = uuIdList.filter((s) => item.indexOf(s) > -1)[0];
|
|
257
285
|
Item = item.replace(uuId, '');
|
|
258
286
|
}
|
|
259
|
-
if (
|
|
287
|
+
if (
|
|
288
|
+
shouldUseAuth() &&
|
|
289
|
+
!authButton.filter((itemInner: any) => Item === itemInner).length
|
|
290
|
+
) {
|
|
260
291
|
resourceCodeArray[item].visible = false;
|
|
261
292
|
}
|
|
262
293
|
});
|
|
263
294
|
}
|
|
264
|
-
|
|
295
|
+
|
|
265
296
|
const { columns } = props;
|
|
266
|
-
let columnConfig = getConfigFromlocalstorage(
|
|
297
|
+
let columnConfig = getConfigFromlocalstorage(
|
|
298
|
+
ENUM.BROWSER_CACHE.COLUMN_CONDITION,
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
const parseWidth = (widthStr: string): number => {
|
|
302
|
+
const parsedWidth = parseInt(widthStr.replace('px', ''));
|
|
303
|
+
return isNaN(parsedWidth) ? 0 : parsedWidth;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
let showColumns = getSettingFieldOrColumn(isReset ? [] : columnConfig, columns, 'columns');
|
|
267
307
|
|
|
268
|
-
let showColumns = getSettingFieldOrColumn(columnConfig, columns, 'columns');
|
|
269
|
-
|
|
270
308
|
showColumns.forEach((item, index) => {
|
|
271
309
|
item.width = item.width || getItemDefaultWidth(item);
|
|
272
310
|
handleBssulaColumnsSpecialParams(item);
|
|
273
311
|
item.onHeaderCell = (column) => ({
|
|
274
312
|
...item,
|
|
275
|
-
width:
|
|
276
|
-
|
|
277
|
-
|
|
313
|
+
width:
|
|
314
|
+
typeof column.width === 'number'
|
|
315
|
+
? column.width
|
|
316
|
+
: parseWidth(column.width),
|
|
278
317
|
onResize: handleResize(index),
|
|
279
318
|
});
|
|
280
319
|
});
|
|
@@ -284,16 +323,21 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
284
323
|
ENUM.BROWSER_CACHE.COLUMN_CONDITION,
|
|
285
324
|
bsTableCodeExport,
|
|
286
325
|
);
|
|
287
|
-
let showExportColumns = getSettingFieldOrColumn(
|
|
326
|
+
let showExportColumns = getSettingFieldOrColumn(
|
|
327
|
+
exportColumnConfig,
|
|
328
|
+
columns,
|
|
329
|
+
'columns',
|
|
330
|
+
);
|
|
288
331
|
|
|
289
332
|
showExportColumns.forEach((item, index) => {
|
|
290
333
|
item.width = item.width || getItemDefaultWidth(item);
|
|
291
334
|
handleBssulaColumnsSpecialParams(item);
|
|
292
335
|
item.onHeaderCell = (column) => ({
|
|
293
336
|
...item,
|
|
294
|
-
width:
|
|
295
|
-
|
|
296
|
-
|
|
337
|
+
width:
|
|
338
|
+
typeof column.width === 'number'
|
|
339
|
+
? column.width
|
|
340
|
+
: parseInt(column.width.replace('px', '')),
|
|
297
341
|
onResize: handleResize(index),
|
|
298
342
|
});
|
|
299
343
|
});
|
|
@@ -306,13 +350,17 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
306
350
|
let searchFieldsConfig = getConfigFromlocalstorage(
|
|
307
351
|
ENUM.BROWSER_CACHE.SEARCH_FIELDS_CONDITION,
|
|
308
352
|
);
|
|
309
|
-
const showSearchFields = getSettingFieldOrColumn(
|
|
353
|
+
const showSearchFields = getSettingFieldOrColumn(
|
|
354
|
+
searchFieldsConfig,
|
|
355
|
+
fields,
|
|
356
|
+
'searchFields',
|
|
357
|
+
);
|
|
310
358
|
setShowSearchFields([...showSearchFields]);
|
|
311
359
|
};
|
|
312
360
|
|
|
313
361
|
//组件初始挂载
|
|
314
362
|
useEffect(() => {
|
|
315
|
-
|
|
363
|
+
getTableHeight();
|
|
316
364
|
setInitialTableInfo();
|
|
317
365
|
setInitialSearchFieldsInfo();
|
|
318
366
|
window.addEventListener('resize', (e) => {
|
|
@@ -397,12 +445,15 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
397
445
|
showQuickJumper: true,
|
|
398
446
|
hideOnSinglePage: value.hideOnSinglePage || false,
|
|
399
447
|
|
|
400
|
-
...tableProps?.initialPaging?.pagination
|
|
448
|
+
...tableProps?.initialPaging?.pagination,
|
|
401
449
|
},
|
|
402
450
|
},
|
|
403
451
|
initialSelectedRowKeys: value.initialSelectedRowKeys || [],
|
|
404
452
|
expandable: props.expandable,
|
|
405
|
-
scroll: {
|
|
453
|
+
scroll: {
|
|
454
|
+
x: props.overScrollX || 'max-content',
|
|
455
|
+
y: props?.overScrollY || height,
|
|
456
|
+
},
|
|
406
457
|
bordered: value.bordered || false,
|
|
407
458
|
sticky: true,
|
|
408
459
|
rowClassName: (record: object | null | undefined, index: number) =>
|
|
@@ -411,7 +462,6 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
411
462
|
header: {
|
|
412
463
|
cell: ResizeableTitle,
|
|
413
464
|
},
|
|
414
|
-
...tableProps?.components,
|
|
415
465
|
},
|
|
416
466
|
};
|
|
417
467
|
|
|
@@ -459,12 +509,12 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
459
509
|
};
|
|
460
510
|
|
|
461
511
|
const handleTimeValue = () => {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
512
|
+
let actionsRender = (value.actionsRender ?? [])
|
|
513
|
+
.map((x) => ({
|
|
514
|
+
...x,
|
|
515
|
+
position: x.position ?? 'left',
|
|
516
|
+
}))
|
|
517
|
+
.filter((x) => authFn(x?.code));
|
|
468
518
|
|
|
469
519
|
if (value?.exportConfig && authFn(value?.exportConfig?.code)) {
|
|
470
520
|
actionsRender = actionsRender.concat([
|
|
@@ -520,55 +570,55 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
520
570
|
),
|
|
521
571
|
},
|
|
522
572
|
},
|
|
523
|
-
{
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
},
|
|
573
|
+
// {
|
|
574
|
+
// type: 'text',
|
|
575
|
+
// props: {
|
|
576
|
+
// children: (
|
|
577
|
+
// <span className="ant-dropdown-link">
|
|
578
|
+
// <Dropdown
|
|
579
|
+
// overlay={
|
|
580
|
+
// <Menu>
|
|
581
|
+
// <Menu.Item>
|
|
582
|
+
// <div
|
|
583
|
+
// onClick={sortTableRef?.current?.showModal}
|
|
584
|
+
// style={{ fontSize: 14, textAlign: 'center' }}
|
|
585
|
+
// >
|
|
586
|
+
// 列设置
|
|
587
|
+
// </div>
|
|
588
|
+
// </Menu.Item>
|
|
589
|
+
// {!value?.searchConfig?.isHidden && (
|
|
590
|
+
// <Menu.Item>
|
|
591
|
+
// <SearchItemTable
|
|
592
|
+
// ref={searchTableRef}
|
|
593
|
+
// setShowSearchFields={setShowSearchFields}
|
|
594
|
+
// showSearchFields={showSearchFields}
|
|
595
|
+
// datasource={value?.fields || []}
|
|
596
|
+
// bsTableCode={bsTableCode}
|
|
597
|
+
// />
|
|
598
|
+
// </Menu.Item>
|
|
599
|
+
// )}
|
|
600
|
+
// {value?.exportConfig?.settingColumns && (
|
|
601
|
+
// <Menu.Item>
|
|
602
|
+
// <div
|
|
603
|
+
// onClick={exportTableRef?.current?.showModal}
|
|
604
|
+
// style={{ fontSize: 14, textAlign: 'center' }}
|
|
605
|
+
// >
|
|
606
|
+
// 导出字段设置
|
|
607
|
+
// </div>
|
|
608
|
+
// </Menu.Item>
|
|
609
|
+
// )}
|
|
610
|
+
// </Menu>
|
|
611
|
+
// }
|
|
612
|
+
// placement="bottomRight"
|
|
613
|
+
// >
|
|
614
|
+
// <div className="ant-dropdown-link">
|
|
615
|
+
// <img width={32} src={shezhi} />
|
|
616
|
+
// </div>
|
|
617
|
+
// </Dropdown>
|
|
618
|
+
// </span>
|
|
619
|
+
// ),
|
|
620
|
+
// },
|
|
621
|
+
// },
|
|
572
622
|
]);
|
|
573
623
|
if (value.rowSelection) {
|
|
574
624
|
value.rowSelection.columnWidth = 50;
|
|
@@ -621,14 +671,13 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
621
671
|
};
|
|
622
672
|
|
|
623
673
|
const config = {
|
|
624
|
-
visibleFieldsCount: 3,
|
|
625
674
|
tableWrapperStyle: {
|
|
626
675
|
padding: '10px',
|
|
627
676
|
// background: '#f3f3f3',
|
|
628
677
|
},
|
|
629
678
|
setVisibleColumn: setVisibleColumn,
|
|
630
679
|
itemLayout: {
|
|
631
|
-
span:
|
|
680
|
+
span: 6, // 栅格占位格数
|
|
632
681
|
labelCol: {
|
|
633
682
|
// label标签布局;可设置 span、offset
|
|
634
683
|
span: 8,
|
|
@@ -673,10 +722,10 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
673
722
|
* @returns []
|
|
674
723
|
*/
|
|
675
724
|
const getTableSummaryInfo = () => {
|
|
676
|
-
const { summaryList, rowSelection,expandable }: any = props;
|
|
725
|
+
const { summaryList, rowSelection, expandable }: any = props;
|
|
677
726
|
if (summaryList && Array.isArray(summaryList)) {
|
|
678
|
-
const summaryRow =
|
|
679
|
-
if(expandable){
|
|
727
|
+
const summaryRow = rowSelection ? [{}, ...showColumn] : [...showColumn];
|
|
728
|
+
if (expandable) {
|
|
680
729
|
summaryRow.unshift({});
|
|
681
730
|
}
|
|
682
731
|
// let summaryInitial = summary().cont;
|
|
@@ -693,7 +742,7 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
693
742
|
(inner.key === item.dataIndex || inner.key === item.key),
|
|
694
743
|
)[0];
|
|
695
744
|
if (target) {
|
|
696
|
-
const labelText = target.labelShow ? `${item.title}:`
|
|
745
|
+
const labelText = target.labelShow ? `${item.title}:` : ``;
|
|
697
746
|
return (
|
|
698
747
|
<Table.Summary.Cell
|
|
699
748
|
index={index}
|
|
@@ -724,16 +773,41 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
724
773
|
}
|
|
725
774
|
};
|
|
726
775
|
|
|
776
|
+
const columnsDom = <span className="ant-dropdown-link">
|
|
777
|
+
<div onClick={sortTableRef?.current?.showModal} className="ant-dropdown-link">
|
|
778
|
+
<img style={{position: 'relative', cursor: 'pointer'}} width={24} src={shezhi} />
|
|
779
|
+
</div>
|
|
780
|
+
</span>
|
|
781
|
+
|
|
782
|
+
const queryFieldsDom = <SearchItemTable
|
|
783
|
+
ref={searchTableRef}
|
|
784
|
+
setShowSearchFields={setShowSearchFields}
|
|
785
|
+
showSearchFields={showSearchFields}
|
|
786
|
+
datasource={value?.fields || []}
|
|
787
|
+
bsTableCode={bsTableCode}
|
|
788
|
+
/>
|
|
789
|
+
|
|
727
790
|
const memoConfig = useMemo(
|
|
728
|
-
() =>
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
791
|
+
() => {
|
|
792
|
+
/**
|
|
793
|
+
* 默认状态下,可见查询字段的个数,核心逻辑:
|
|
794
|
+
* 1.组件有传入时,优先取
|
|
795
|
+
* 2.没有传入时,通过每个字段栅格数计算,计算公式:
|
|
796
|
+
* 栅格总数(24)/每个字段栅格数*默认行数
|
|
797
|
+
*/
|
|
798
|
+
return {
|
|
799
|
+
...config,
|
|
800
|
+
...(config?.visibleFieldsCount !== undefined
|
|
801
|
+
? { visibleFieldsCount: config.visibleFieldsCount }
|
|
802
|
+
: { visibleFieldsCount: 24 / Number(config?.itemLayout?.span) * defaultRow }),
|
|
803
|
+
summary: props.summary,
|
|
804
|
+
summaryList: props.summaryList ? getTableSummaryInfo : undefined,
|
|
805
|
+
statusMapping: props.statusMapping,
|
|
806
|
+
columnsDom,
|
|
807
|
+
queryFieldsDom,
|
|
808
|
+
}
|
|
809
|
+
},
|
|
735
810
|
[
|
|
736
|
-
// value,
|
|
737
811
|
checkedList,
|
|
738
812
|
showColumn,
|
|
739
813
|
props.statusMapping,
|
|
@@ -741,13 +815,16 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
741
815
|
expandedRowKeys,
|
|
742
816
|
],
|
|
743
817
|
);
|
|
818
|
+
|
|
744
819
|
return (
|
|
745
820
|
<div id="bs-sula-query-table">
|
|
746
821
|
<MemoQueryTable {...memoConfig} />
|
|
822
|
+
{/* 列设置弹出框表格 */}
|
|
747
823
|
<SortableTable
|
|
748
824
|
ref={sortTableRef}
|
|
749
825
|
setShowColumns={setShowColumns}
|
|
750
826
|
showColumn={showColumn}
|
|
827
|
+
setInitialTableInfo={setInitialTableInfo}
|
|
751
828
|
datasource={value?.columns || []}
|
|
752
829
|
bsTableCode={bsTableCode}
|
|
753
830
|
onlyModal
|
|
@@ -756,6 +833,7 @@ const getSettingFieldOrColumn = (savedConfig, originConfig, type: string) => {
|
|
|
756
833
|
<SortableTable
|
|
757
834
|
ref={exportTableRef}
|
|
758
835
|
setShowColumns={setShowExportColumns}
|
|
836
|
+
setInitialTableInfo={setInitialTableInfo}
|
|
759
837
|
showColumn={showExportColumn}
|
|
760
838
|
datasource={value?.columns || []}
|
|
761
839
|
bsTableCode={bsTableCodeExport}
|