@bit-sun/business-component 2.4.24 → 2.4.26
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/components/Business/BsLayouts/service.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/index.d.ts +0 -1
- package/dist/components/Business/BsSulaQueryTable/setting.d.ts +1 -1
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +0 -1
- package/dist/components/Business/columnSettingTable/columnSetting.d.ts +0 -1
- package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +1 -1
- package/dist/components/Functional/QueryMutipleInput/index.d.ts +1 -2
- package/dist/components/Solution/RuleComponent/services.d.ts +1 -1
- package/dist/index.esm.js +1181 -1737
- package/dist/index.js +1175 -1733
- package/dist/utils/TableUtils.d.ts +2 -93
- package/dist/utils/index.d.ts +4 -6
- package/dist/utils/utils.d.ts +0 -13
- package/package.json +4 -7
- package/src/assets/32.svg +27 -27
- package/src/assets/addIcon.svg +17 -17
- package/src/assets/allfunc.svg +27 -27
- package/src/assets/arrowRight.svg +24 -24
- package/src/assets/btn-delete.svg +29 -29
- package/src/assets/btn-edit.svg +19 -19
- package/src/assets/btn-more.svg +17 -17
- package/src/assets/btn-submit.svg +19 -19
- package/src/assets/close.svg +26 -26
- package/src/assets/drag.svg +17 -17
- package/src/assets/fixed-left.svg +15 -15
- package/src/assets/fixed-right.svg +15 -15
- package/src/assets/guanbi.svg +15 -15
- package/src/assets/icon-quanping.svg +15 -15
- package/src/assets/icon-shezhi.svg +17 -17
- package/src/assets/label_icon_bottom.svg +25 -25
- package/src/assets/list-no-img.svg +21 -21
- package/src/assets/morentouxiang-32.svg +23 -23
- package/src/assets/scanning.svg +24 -24
- package/src/assets/upExport.svg +22 -22
- package/src/common/ENUM.ts +41 -41
- package/src/components/Business/AddSelectBusiness/index.tsx +22 -40
- package/src/components/Business/BsLayouts/Components/AllFunc/index.less +153 -153
- package/src/components/Business/BsLayouts/Components/AllFunc/index.tsx +70 -70
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.less +90 -90
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.tsx +37 -37
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.tsx +242 -242
- package/src/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.tsx +384 -384
- package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.tsx +74 -74
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.less +64 -64
- package/src/components/Business/BsLayouts/Components/CustomerMenu/index.tsx +153 -153
- package/src/components/Business/BsLayouts/Components/GlobalHeader/index.tsx +157 -163
- package/src/components/Business/BsLayouts/Components/RightContent/LoginModal.tsx +85 -85
- package/src/components/Business/BsLayouts/Components/RightContent/index.tsx +2 -19
- package/src/components/Business/BsLayouts/Components/SearchFunc/index.tsx +75 -75
- package/src/components/Business/BsLayouts/index.less +79 -79
- package/src/components/Business/BsLayouts/index.tsx +1484 -1494
- package/src/components/Business/BsLayouts/service.ts +2 -2
- package/src/components/Business/BsLayouts/utils.tsx +203 -203
- package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +9 -9
- package/src/components/Business/BsSulaQueryTable/index.less +221 -221
- package/src/components/Business/BsSulaQueryTable/index.tsx +175 -346
- package/src/components/Business/BsSulaQueryTable/setting.tsx +87 -125
- package/src/components/Business/BsSulaQueryTable/utils.tsx +34 -57
- package/src/components/Business/CommodityEntry/index.md +70 -70
- package/src/components/Business/CommodityEntry/index.tsx +80 -80
- package/src/components/Business/CommonGuideWrapper/index.less +112 -121
- package/src/components/Business/CommonGuideWrapper/index.md +39 -39
- package/src/components/Business/CommonGuideWrapper/index.tsx +84 -94
- package/src/components/Business/DetailPageWrapper/index.less +1 -9
- package/src/components/Business/DetailPageWrapper/index.tsx +110 -121
- package/src/components/Business/HomePageWrapper/index.md +45 -45
- package/src/components/Business/HomePageWrapper/index.tsx +162 -162
- package/src/components/Business/JsonQueryTable/configButton/index.js +20 -20
- package/src/components/Business/JsonQueryTable/configTree/component/compactArrayView.js +25 -25
- package/src/components/Business/JsonQueryTable/configTree/component/compactObjectView.js +30 -30
- package/src/components/Business/JsonQueryTable/configTree/index.js +82 -82
- package/src/components/Business/JsonQueryTable/configTree/index.less +44 -44
- package/src/components/Business/JsonQueryTable/configTree/parser/highlight.js +57 -57
- package/src/components/Business/JsonQueryTable/configTree/parser/index.js +124 -124
- package/src/components/Business/JsonQueryTable/configTree/render/iconRender.js +29 -29
- package/src/components/Business/JsonQueryTable/configTree/render/nameRender.js +22 -22
- package/src/components/Business/JsonQueryTable/configTree/treeNode.js +116 -116
- package/src/components/Business/JsonQueryTable/drawer/index.tsx +12 -12
- package/src/components/Business/JsonQueryTable/index.less +16 -16
- package/src/components/Business/JsonQueryTable/index.md +328 -328
- package/src/components/Business/JsonQueryTable/index.tsx +537 -535
- package/src/components/Business/JsonQueryTable/jsonEditor/index.js +346 -346
- package/src/components/Business/JsonQueryTable/jsonEditor/index.less +22 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/basicType.js +147 -147
- package/src/components/Business/JsonQueryTable/jsonEditor/lint/index.js +389 -389
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/actions.js +118 -118
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/dependency.js +22 -22
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/index.js +21 -21
- package/src/components/Business/JsonQueryTable/jsonEditor/suggestions/request.js +65 -65
- package/src/components/Business/SearchSelect/utils.ts +3 -3
- package/src/components/Business/StateFlow/index.md +60 -60
- package/src/components/Business/StateFlow/index.tsx +29 -29
- package/src/components/Business/columnSettingTable/columnSetting.tsx +8 -10
- package/src/components/Business/columnSettingTable/index.less +247 -247
- package/src/components/Business/columnSettingTable/index.md +357 -357
- package/src/components/Business/columnSettingTable/utils.tsx +71 -71
- package/src/components/Business/moreTreeTable/FixedScrollBar.tsx +87 -87
- package/src/components/Business/moreTreeTable/hooks/useSticky.ts +21 -21
- package/src/components/Business/moreTreeTable/index.less +99 -99
- package/src/components/Business/moreTreeTable/index.tsx +387 -387
- package/src/components/Business/moreTreeTable/utils.ts +126 -126
- package/src/components/Functional/AddSelect/helps.ts +3 -4
- package/src/components/Functional/AddSelect/index.less +367 -367
- package/src/components/Functional/AddSelect/index.tsx +33 -79
- package/src/components/Functional/BillEntry/index.less +371 -371
- package/src/components/Functional/BillEntry/index.tsx +3 -3
- package/src/components/Functional/BsAntdSula/index.ts +2 -2
- package/src/components/Functional/DataImport/index.less +63 -63
- package/src/components/Functional/DataImport/index.tsx +3 -3
- package/src/components/Functional/DataValidation/index.less +63 -63
- package/src/components/Functional/DataValidation/index.tsx +3 -3
- package/src/components/Functional/EllipsisTooltip/index.d.ts +5 -5
- package/src/components/Functional/EllipsisTooltip/index.js +36 -36
- package/src/components/Functional/ExportFunctions/ExportIcon/index.tsx +5 -10
- package/src/components/Functional/QueryMutipleInput/index.less +37 -37
- package/src/components/Functional/QueryMutipleInput/index.tsx +1 -2
- package/src/components/Functional/SearchSelect/index.less +0 -6
- package/src/components/Functional/SearchSelect/index.tsx +45 -152
- package/src/components/Functional/SearchSelect/utils.ts +3 -3
- package/src/components/Functional/TreeSearchSelect/index.tsx +22 -24
- package/src/components/Solution/RuleComponent/Formula.tsx +335 -335
- package/src/components/Solution/RuleComponent/index.d.ts +29 -29
- package/src/components/Solution/RuleComponent/index.js +652 -7
- package/src/components/Solution/RuleComponent/index.less +230 -230
- package/src/components/Solution/RuleComponent/renderSpecificAction.js +99 -99
- package/src/components/Solution/RuleComponent/services.ts +13 -13
- package/src/plugin/TableColumnSetting/index.less +247 -247
- package/src/plugin/TableColumnSetting/index.md +50 -50
- package/src/plugin/TableColumnSetting/index.tsx +2 -2
- package/src/plugin/TableColumnSetting/utils.ts +19 -19
- package/src/utils/CheckOneUser/index.md +39 -39
- package/src/utils/CheckOneUser/index.ts +51 -51
- package/src/utils/LocalstorageUtils.ts +95 -95
- package/src/utils/TableUtils.tsx +18 -691
- package/src/utils/checkUtils.ts +39 -39
- package/src/utils/enumConfig.ts +11 -11
- package/src/utils/getFormMode.js +12 -12
- package/src/utils/index.ts +4 -6
- package/src/utils/requestUtils.ts +2 -29
- package/src/utils/serialize.js +7 -7
- package/src/utils/utils.ts +21 -64
- package/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +0 -3
- package/dist/components/Business/BsLayouts/Components/ChooseStore/services.d.ts +0 -1
- package/dist/components/Business/BsLayouts/Components/RightContent/i18n.d.ts +0 -9
- package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +0 -2
- package/dist/utils/businessUtils.d.ts +0 -27
- package/dist/utils/constant.d.ts +0 -37
- package/dist/utils/request.d.ts +0 -2
- package/src/assets/arrow_top.svg +0 -18
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.less +0 -0
- package/src/components/Business/BsLayouts/Components/ChooseStore/index.tsx +0 -193
- package/src/components/Business/BsLayouts/Components/ChooseStore/services.ts +0 -10
- package/src/components/Business/BsLayouts/Components/RightContent/i18n.ts +0 -9
- package/src/components/Business/BsSulaQueryTable/bssulaquerytable.less +0 -5
- package/src/components/Solution/RuleComponent/RenderCompItem.tsx +0 -637
- package/src/utils/TableUtils.less +0 -52
- package/src/utils/businessUtils.ts +0 -441
- package/src/utils/constant.ts +0 -39
- package/src/utils/request.ts +0 -53
|
@@ -7,11 +7,10 @@ import {
|
|
|
7
7
|
getItemDefaultWidth,
|
|
8
8
|
authFn,
|
|
9
9
|
queryParams,
|
|
10
|
-
renderToString,
|
|
11
10
|
} from './utils';
|
|
12
|
-
import { Menu, Tooltip, Dropdown
|
|
11
|
+
import { Menu, Tooltip, Dropdown } from 'antd';
|
|
13
12
|
import SortableTable from './setting';
|
|
14
|
-
import SearchItemTable from
|
|
13
|
+
import SearchItemTable from "./SearchItemSetting";
|
|
15
14
|
import { Resizable } from 'react-resizable';
|
|
16
15
|
import quanping from '../../../assets/icon-quanping.svg';
|
|
17
16
|
import scanning from '../../../assets/scanning.svg';
|
|
@@ -20,9 +19,8 @@ import { debounce } from 'lodash';
|
|
|
20
19
|
import ExportIcon from '@/components/Functional/ExportFunctions/ExportIcon';
|
|
21
20
|
import ENUM from '@/utils/enumConfig';
|
|
22
21
|
import { handleBssulaColumnsSpecialParams } from '@/utils/utils';
|
|
23
|
-
|
|
22
|
+
|
|
24
23
|
const MemoQueryTable = React.memo(QueryTable);
|
|
25
|
-
const { Text } = Typography;
|
|
26
24
|
|
|
27
25
|
const ResizeableTitle = (props) => {
|
|
28
26
|
const { onResize, width, ...restProps } = props;
|
|
@@ -43,77 +41,91 @@ const ResizeableTitle = (props) => {
|
|
|
43
41
|
};
|
|
44
42
|
|
|
45
43
|
export default (props: any) => {
|
|
46
|
-
const
|
|
44
|
+
const bsTableCode = props?.tableCode || window.location.hash; //设置列字段的唯一标识
|
|
45
|
+
const getConfigFromlocalstorage = (type: string) => {
|
|
46
|
+
let config = localStorage.getItem(type) || '[]';
|
|
47
|
+
let configArray = JSON.parse(config);
|
|
48
|
+
let configSetting = configArray.filter(
|
|
49
|
+
(item) => item.code === bsTableCode,
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
if (configSetting.length && configSetting[0].detail) {
|
|
53
|
+
return JSON.parse(configSetting[0].detail);
|
|
54
|
+
}
|
|
55
|
+
return [];
|
|
56
|
+
};
|
|
57
|
+
const getInitialSearchFieldsInfo = () =>{
|
|
58
|
+
//获取搜索字段的缓存配置
|
|
59
|
+
const { fields = [] } = props;
|
|
60
|
+
let searchFieldsConfig = getConfigFromlocalstorage(ENUM.BROWSER_CACHE.SEARCH_FIELDS_CONDITION);
|
|
61
|
+
let showSearchFields = searchFieldsConfig.length ? searchFieldsConfig.map((item) => {
|
|
62
|
+
let inner = fields.filter(
|
|
63
|
+
(inneritem) => {
|
|
64
|
+
let innerKey = Array.isArray(inneritem.name) ? JSON.stringify(inneritem.name) : inneritem.name;
|
|
65
|
+
let itemKey = Array.isArray(item.name) ? JSON.stringify(item.name) : item.name;
|
|
66
|
+
return innerKey && innerKey === itemKey;
|
|
67
|
+
}
|
|
68
|
+
)[0];
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
...inner,
|
|
72
|
+
...item,
|
|
73
|
+
};
|
|
74
|
+
}) : fields;
|
|
75
|
+
return [...showSearchFields]
|
|
76
|
+
}
|
|
47
77
|
const refs = useRef(null);
|
|
48
78
|
const [pagePath, setPagePath] = useState('');
|
|
49
79
|
// 获取 table columns中所有的 key 防止有的地方是 dataindex
|
|
50
|
-
const checkedList =
|
|
51
|
-
.filter((col: any) => !col.hidden)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const { pathname, state = {} } = useLocation();
|
|
80
|
+
const [checkedList, setCheckedList] = useState(
|
|
81
|
+
props.columns.filter((col: any) => !col.hidden).map((d: any) => Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : (d.key || d.dataIndex)),
|
|
82
|
+
);
|
|
83
|
+
const { pathname } = useLocation();
|
|
84
|
+
const [id]: any = useState(
|
|
85
|
+
Number(Math.random().toString().substr(2, 0) + Date.now()).toString(36),
|
|
86
|
+
);
|
|
59
87
|
const [isFullScreen, setIsFnllScreen]: any = useState(false);
|
|
60
88
|
// @ts-nocheck
|
|
61
|
-
const value = props;
|
|
89
|
+
const [value, setValue]: any = useState(props);
|
|
62
90
|
const [showColumn, setShowColumns] = useState([]); // 列字段
|
|
63
|
-
const
|
|
64
|
-
const [
|
|
91
|
+
const originSearchFields = getInitialSearchFieldsInfo();
|
|
92
|
+
const [showSearchFields, setShowSearchFields] = useState(originSearchFields); //搜索项字段
|
|
93
|
+
const { isPage = true, pagination, tableCode, appRequestConfig } = props;
|
|
65
94
|
|
|
66
95
|
const [height, setHeight]: any = useState('100vh');
|
|
67
96
|
const sortTableRef = useRef(null);
|
|
68
97
|
const searchTableRef = useRef(null);
|
|
69
|
-
const exportTableRef = useRef<any>(null);
|
|
70
98
|
|
|
71
|
-
const bsTableCode = tableCode || window.location.hash; //设置列字段的唯一标识
|
|
72
|
-
const bsTableCodeExport = `${bsTableCode}___Export`; //设置导出列字段的唯一标识
|
|
73
99
|
// 获取table高度
|
|
74
100
|
const getTableHeight = () => {
|
|
75
101
|
setTimeout(() => {
|
|
76
102
|
const cancelHeight = window.top == window ? 303 : 223;
|
|
77
103
|
const isFullScreen: any =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
104
|
+
window.top.document.fullScreen ||
|
|
105
|
+
window.top.document.webkitIsFullScreen ||
|
|
106
|
+
window.top.document.mozFullScreen;
|
|
81
107
|
|
|
82
108
|
// wujie子应用iframe首次加载获取不到client以及dom元素高度兼容处理
|
|
83
|
-
let realIframeClientHeight = document.body.clientHeight
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
let
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
? document.querySelector(
|
|
90
|
-
`.ant-tabs-tabpane-active .table-bssula-summary`,
|
|
91
|
-
)?.clientHeight || 22
|
|
92
|
-
: 0;
|
|
93
|
-
let listTabHeight = document.querySelector(
|
|
94
|
-
`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`,
|
|
95
|
-
)
|
|
96
|
-
? document.querySelector(
|
|
97
|
-
`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`,
|
|
98
|
-
)?.clientHeight || 48
|
|
99
|
-
: 0;
|
|
109
|
+
let realIframeClientHeight = document.body.clientHeight ? document.body.clientHeight : window.top?.document.body.clientHeight - 76;
|
|
110
|
+
let summaryHeight = document.querySelector(`.ant-tabs-tabpane-active .table-bssula-summary`) ?
|
|
111
|
+
(document.querySelector(`.ant-tabs-tabpane-active .table-bssula-summary`)?.clientHeight || 22) : 0;
|
|
112
|
+
let listTabHeight = document.querySelector(`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`) ?
|
|
113
|
+
(document.querySelector(`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`)?.clientHeight || 48) : 0;
|
|
114
|
+
|
|
100
115
|
|
|
101
116
|
const h =
|
|
102
|
-
realIframeClientHeight -
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
(document.querySelector(
|
|
106
|
-
`.ant-tabs-tabpane-active .ant-form ant-form-horizontal`,
|
|
107
|
-
)?.clientHeight || 0) -
|
|
117
|
+
realIframeClientHeight - summaryHeight - listTabHeight -
|
|
118
|
+
(document.querySelector(`.ant-tabs-tabpane-active .ant-form ant-form-horizontal`)?.clientHeight ||
|
|
119
|
+
0) -
|
|
108
120
|
(isFullScreen
|
|
109
121
|
? 0
|
|
110
|
-
: document.querySelector(
|
|
111
|
-
|
|
112
|
-
)?.clientHeight || 0) -
|
|
122
|
+
: document.querySelector(`.ant-tabs-tabpane-active .ant-pro-page-container-warp`)
|
|
123
|
+
?.clientHeight || 0) -
|
|
113
124
|
cancelHeight +
|
|
114
125
|
'px';
|
|
115
126
|
setHeight(h);
|
|
116
|
-
|
|
127
|
+
setValue({ ...value });
|
|
128
|
+
}, 0)
|
|
117
129
|
};
|
|
118
130
|
|
|
119
131
|
//监测是否按下esc键
|
|
@@ -127,20 +139,6 @@ export default (props: any) => {
|
|
|
127
139
|
return isFull;
|
|
128
140
|
}
|
|
129
141
|
|
|
130
|
-
const getConfigFromlocalstorage = (
|
|
131
|
-
type: string,
|
|
132
|
-
tableCode: string = bsTableCode,
|
|
133
|
-
) => {
|
|
134
|
-
let config = localStorage.getItem(type) || '[]';
|
|
135
|
-
let configArray = JSON.parse(config);
|
|
136
|
-
let configSetting = configArray.filter((item) => item.code === tableCode);
|
|
137
|
-
|
|
138
|
-
if (configSetting.length && configSetting[0].detail) {
|
|
139
|
-
return JSON.parse(configSetting[0].detail);
|
|
140
|
-
}
|
|
141
|
-
return [];
|
|
142
|
-
};
|
|
143
|
-
|
|
144
142
|
const setInitialTableInfo = () => {
|
|
145
143
|
const resourceCodeArray = {};
|
|
146
144
|
if (props.actionsRender && props.actionsRender.length) {
|
|
@@ -170,12 +168,8 @@ export default (props: any) => {
|
|
|
170
168
|
handleBssulaColumnsSpecialParams(d);
|
|
171
169
|
});
|
|
172
170
|
setCommonRenderFn(props.columns);
|
|
173
|
-
const authButton = localStorage.getItem(
|
|
174
|
-
ENUM.BROWSER_CACHE.MAIN_AUTH_CODES
|
|
175
|
-
)
|
|
176
|
-
? JSON.parse(
|
|
177
|
-
localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES) as string,
|
|
178
|
-
)
|
|
171
|
+
const authButton = localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES)
|
|
172
|
+
? JSON.parse(localStorage.getItem(ENUM.BROWSER_CACHE.MAIN_AUTH_CODES) as string)
|
|
179
173
|
: [];
|
|
180
174
|
Object.keys(resourceCodeArray).forEach((item: any) => {
|
|
181
175
|
let Item = item;
|
|
@@ -186,41 +180,33 @@ export default (props: any) => {
|
|
|
186
180
|
resourceCodeArray[item].visible = false;
|
|
187
181
|
}
|
|
188
182
|
});
|
|
183
|
+
|
|
189
184
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
return {
|
|
206
|
-
...inner,
|
|
207
|
-
...item,
|
|
208
|
-
};
|
|
209
|
-
})
|
|
210
|
-
: columns.filter((column) => {
|
|
211
|
-
let columnKey = Array.isArray(column.key || column.dataIndex)
|
|
212
|
-
? JSON.stringify(column.key || column.dataIndex)
|
|
213
|
-
: column.key || column.dataIndex;
|
|
214
|
-
return (
|
|
215
|
-
column.notRegularCheckList || checkedList.indexOf(columnKey) > -1
|
|
216
|
-
);
|
|
217
|
-
});
|
|
218
|
-
};
|
|
185
|
+
setValue({
|
|
186
|
+
...value,
|
|
187
|
+
columns: [...props.columns],
|
|
188
|
+
});
|
|
189
|
+
const { columns } = props;
|
|
190
|
+
let columnConfig = getConfigFromlocalstorage(ENUM.BROWSER_CACHE.COLUMN_CONDITION);
|
|
191
|
+
let showColumns = columnConfig.length ? columnConfig.map((item) => {
|
|
192
|
+
let inner = columns.filter(
|
|
193
|
+
(inneritem) => {
|
|
194
|
+
let innerKey = Array.isArray(inneritem.key || inneritem.dataIndex) ? JSON.stringify(inneritem.key || inneritem.dataIndex) : (inneritem.key || inneritem.dataIndex);
|
|
195
|
+
let itemKey = Array.isArray(item.key || item.dataIndex) ? JSON.stringify(item.key || item.dataIndex) : (item.key || item.dataIndex);
|
|
196
|
+
return innerKey && innerKey === itemKey;
|
|
197
|
+
}
|
|
198
|
+
)[0];
|
|
219
199
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
200
|
+
return {
|
|
201
|
+
...inner,
|
|
202
|
+
...item,
|
|
203
|
+
};
|
|
204
|
+
}) : columns.filter(
|
|
205
|
+
(column) => {
|
|
206
|
+
let columnKey = Array.isArray(column.key || column.dataIndex) ? JSON.stringify(column.key || column.dataIndex) : (column.key || column.dataIndex);
|
|
207
|
+
return column.notRegularCheckList || checkedList.indexOf(columnKey) > -1;
|
|
208
|
+
}
|
|
209
|
+
)
|
|
224
210
|
|
|
225
211
|
showColumns.forEach((item, index) => {
|
|
226
212
|
item.width = item.width || getItemDefaultWidth(item);
|
|
@@ -236,53 +222,28 @@ export default (props: any) => {
|
|
|
236
222
|
});
|
|
237
223
|
setShowColumns([...showColumns]);
|
|
238
224
|
|
|
239
|
-
|
|
240
|
-
ENUM.BROWSER_CACHE.COLUMN_CONDITION,
|
|
241
|
-
bsTableCodeExport,
|
|
242
|
-
);
|
|
243
|
-
let showExportColumns = getShowColumns(exportColumnConfig, columns);
|
|
244
|
-
|
|
245
|
-
showExportColumns.forEach((item, index) => {
|
|
246
|
-
item.width = item.width || getItemDefaultWidth(item);
|
|
247
|
-
handleBssulaColumnsSpecialParams(item);
|
|
248
|
-
item.onHeaderCell = (column) => ({
|
|
249
|
-
...item,
|
|
250
|
-
width:
|
|
251
|
-
typeof column.width === 'number'
|
|
252
|
-
? column.width
|
|
253
|
-
: parseInt(column.width.replace('px', '')),
|
|
254
|
-
onResize: handleResize(index),
|
|
255
|
-
});
|
|
256
|
-
});
|
|
257
|
-
setShowExportColumns([...showExportColumns]);
|
|
258
|
-
};
|
|
225
|
+
}
|
|
259
226
|
|
|
260
|
-
const setInitialSearchFieldsInfo = () =>
|
|
227
|
+
const setInitialSearchFieldsInfo = () =>{
|
|
261
228
|
//获取搜索字段的缓存配置
|
|
262
229
|
const { fields = [] } = props;
|
|
263
|
-
let searchFieldsConfig = getConfigFromlocalstorage(
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
let
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
...item,
|
|
281
|
-
};
|
|
282
|
-
})
|
|
283
|
-
: fields;
|
|
284
|
-
setShowSearchFields([...showSearchFields]);
|
|
285
|
-
};
|
|
230
|
+
let searchFieldsConfig = getConfigFromlocalstorage(ENUM.BROWSER_CACHE.SEARCH_FIELDS_CONDITION);
|
|
231
|
+
let showSearchFields = searchFieldsConfig.length ? searchFieldsConfig.map((item) => {
|
|
232
|
+
let inner = fields.filter(
|
|
233
|
+
(inneritem) => {
|
|
234
|
+
let innerKey = Array.isArray(inneritem.name) ? JSON.stringify(inneritem.name) : inneritem.name;
|
|
235
|
+
let itemKey = Array.isArray(item.name) ? JSON.stringify(item.name) : item.name;
|
|
236
|
+
return innerKey && innerKey === itemKey;
|
|
237
|
+
}
|
|
238
|
+
)[0];
|
|
239
|
+
|
|
240
|
+
return {
|
|
241
|
+
...inner,
|
|
242
|
+
...item,
|
|
243
|
+
};
|
|
244
|
+
}) : fields;
|
|
245
|
+
setShowSearchFields([...showSearchFields])
|
|
246
|
+
}
|
|
286
247
|
|
|
287
248
|
//组件初始挂载
|
|
288
249
|
useEffect(() => {
|
|
@@ -298,38 +259,25 @@ export default (props: any) => {
|
|
|
298
259
|
|
|
299
260
|
useEffect(() => {
|
|
300
261
|
if (props?.columns && value?.columns) {
|
|
301
|
-
let newKeys = props.columns.map((d: any) =>
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
: d.key || d.dataIndex,
|
|
305
|
-
);
|
|
306
|
-
let oldKeys = value.columns.map((d: any) =>
|
|
307
|
-
Array.isArray(d.key || d.dataIndex)
|
|
308
|
-
? JSON.stringify(d.key || d.dataIndex)
|
|
309
|
-
: d.key || d.dataIndex,
|
|
310
|
-
);
|
|
311
|
-
JSON.stringify(newKeys) !== JSON.stringify(oldKeys) &&
|
|
312
|
-
setInitialTableInfo();
|
|
262
|
+
let newKeys = props.columns.map((d: any) => Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : (d.key || d.dataIndex));
|
|
263
|
+
let oldKeys = value.columns.map((d: any) => Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : (d.key || d.dataIndex));
|
|
264
|
+
JSON.stringify(newKeys) !== JSON.stringify(oldKeys) && setInitialTableInfo();
|
|
313
265
|
}
|
|
314
|
-
}, [props?.columns])
|
|
266
|
+
}, [props?.columns])
|
|
315
267
|
|
|
316
268
|
useEffect(() => {
|
|
317
269
|
if (props?.fields && value?.fields) {
|
|
318
|
-
let newKeys = props.fields.map((d: any) =>
|
|
319
|
-
|
|
320
|
-
);
|
|
321
|
-
let oldKeys = value.fields.map((d: any) =>
|
|
322
|
-
Array.isArray(d.name) ? JSON.stringify(d.name) : d.name,
|
|
323
|
-
);
|
|
324
|
-
JSON.stringify(newKeys) !== JSON.stringify(oldKeys) &&
|
|
325
|
-
setInitialSearchFieldsInfo();
|
|
270
|
+
let newKeys = props.fields.map((d: any) => Array.isArray(d.name) ? JSON.stringify(d.name) : (d.name));
|
|
271
|
+
let oldKeys = value.fields.map((d: any) => Array.isArray(d.name) ? JSON.stringify(d.name) : (d.name));
|
|
272
|
+
JSON.stringify(newKeys) !== JSON.stringify(oldKeys) && setInitialSearchFieldsInfo();
|
|
326
273
|
}
|
|
327
|
-
},
|
|
274
|
+
},[props?.fields])
|
|
328
275
|
|
|
329
276
|
useEffect(() => {
|
|
330
277
|
setInitialTableInfo();
|
|
331
278
|
}, [props?.refreshColumns]);
|
|
332
279
|
|
|
280
|
+
|
|
333
281
|
const watchWinResize = debounce(() => {
|
|
334
282
|
getTableHeight();
|
|
335
283
|
if (!checkFull()) {
|
|
@@ -365,15 +313,15 @@ export default (props: any) => {
|
|
|
365
313
|
pagination: pagination
|
|
366
314
|
? false
|
|
367
315
|
: {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
316
|
+
defaultPageSize: 20,
|
|
317
|
+
pageSize: 20,
|
|
318
|
+
showTotal: (total: any) => `共 ${total} 条`,
|
|
319
|
+
showQuickJumper: true,
|
|
320
|
+
hideOnSinglePage: value.hideOnSinglePage || false,
|
|
321
|
+
},
|
|
374
322
|
},
|
|
375
323
|
initialSelectedRowKeys: value.initialSelectedRowKeys || [],
|
|
376
|
-
expandable:
|
|
324
|
+
expandable: value.expandable,
|
|
377
325
|
scroll: { x: props.overScrollX || 'max-content', y: height },
|
|
378
326
|
bordered: value.bordered || false,
|
|
379
327
|
sticky: true,
|
|
@@ -395,6 +343,7 @@ export default (props: any) => {
|
|
|
395
343
|
return tableProps;
|
|
396
344
|
};
|
|
397
345
|
|
|
346
|
+
|
|
398
347
|
const ShowFullScreen = () => {
|
|
399
348
|
const isFullScreen: any =
|
|
400
349
|
window.top.document.fullScreen ||
|
|
@@ -417,10 +366,10 @@ export default (props: any) => {
|
|
|
417
366
|
}
|
|
418
367
|
if (window.top.document && isFullScreen) {
|
|
419
368
|
let exitFullScreen =
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
369
|
+
window.top.document.exitFullscreen ||
|
|
370
|
+
window.top.document.mozCancelFullScreen ||
|
|
371
|
+
window.top.document.webkitCancelFullScreen ||
|
|
372
|
+
window.top.document.msExitFullscreen;
|
|
424
373
|
if (exitFullScreen) {
|
|
425
374
|
exitFullScreen.call(window.top.document);
|
|
426
375
|
setIsFnllScreen(false);
|
|
@@ -439,16 +388,13 @@ export default (props: any) => {
|
|
|
439
388
|
props: {
|
|
440
389
|
children: (
|
|
441
390
|
<span className="ant-dropdown-link">
|
|
442
|
-
|
|
443
|
-
overlay={
|
|
391
|
+
<Dropdown overlay={
|
|
444
392
|
<Menu>
|
|
445
393
|
<Menu.Item>
|
|
446
394
|
<div
|
|
447
395
|
onClick={sortTableRef?.current?.showModal}
|
|
448
|
-
style={{
|
|
449
|
-
>
|
|
450
|
-
列设置
|
|
451
|
-
</div>
|
|
396
|
+
style={{fontSize:14, textAlign: 'center'}}
|
|
397
|
+
>列设置</div>
|
|
452
398
|
</Menu.Item>
|
|
453
399
|
<Menu.Item>
|
|
454
400
|
<SearchItemTable
|
|
@@ -457,27 +403,16 @@ export default (props: any) => {
|
|
|
457
403
|
showSearchFields={showSearchFields}
|
|
458
404
|
datasource={value?.fields || []}
|
|
459
405
|
bsTableCode={bsTableCode}
|
|
406
|
+
appRequestConfig={appRequestConfig}
|
|
460
407
|
/>
|
|
461
408
|
</Menu.Item>
|
|
462
|
-
{value?.exportConfig?.settingColumns && (
|
|
463
|
-
<Menu.Item>
|
|
464
|
-
<div
|
|
465
|
-
onClick={exportTableRef?.current?.showModal}
|
|
466
|
-
style={{ fontSize: 14, textAlign: 'center' }}
|
|
467
|
-
>
|
|
468
|
-
导出字段设置
|
|
469
|
-
</div>
|
|
470
|
-
</Menu.Item>
|
|
471
|
-
)}
|
|
472
409
|
</Menu>
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
</Dropdown>
|
|
480
|
-
</span>
|
|
410
|
+
} placement="bottomRight" >
|
|
411
|
+
<span className="ant-dropdown-link">
|
|
412
|
+
<img width={32} src={shezhi} />
|
|
413
|
+
</span>
|
|
414
|
+
</Dropdown>
|
|
415
|
+
</span>
|
|
481
416
|
),
|
|
482
417
|
},
|
|
483
418
|
},
|
|
@@ -518,14 +453,10 @@ export default (props: any) => {
|
|
|
518
453
|
value?.exportConfig && authFn(value?.exportConfig?.code) ? (
|
|
519
454
|
<ExportIcon
|
|
520
455
|
request={{
|
|
521
|
-
url:
|
|
522
|
-
|
|
523
|
-
`/oms-ops/excel/exportAsync/${value?.exportConfig?.type}`,
|
|
524
|
-
params: value?.exportConfig?.params,
|
|
456
|
+
url: `/oms-ops/excel/exportAsync/${value?.exportConfig?.type}`,
|
|
457
|
+
params: value?.exportConfig?.params || queryParams,
|
|
525
458
|
}}
|
|
526
459
|
tableRef={props.forwardedRef || refs}
|
|
527
|
-
allowSelect={value?.exportConfig?.allowSelect}
|
|
528
|
-
columnsRowKey={value?.rowKey}
|
|
529
460
|
/>
|
|
530
461
|
) : (
|
|
531
462
|
<span />
|
|
@@ -544,44 +475,23 @@ export default (props: any) => {
|
|
|
544
475
|
|
|
545
476
|
const handleResize =
|
|
546
477
|
(index) =>
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
478
|
+
(e, { size }) => {
|
|
479
|
+
setShowColumns((columns: any) => {
|
|
480
|
+
let newColumns = [...columns];
|
|
481
|
+
newColumns[index] = {
|
|
482
|
+
...newColumns[index],
|
|
483
|
+
width: size.width,
|
|
484
|
+
};
|
|
485
|
+
newColumns.forEach((d: any) => {
|
|
486
|
+
handleBssulaColumnsSpecialParams(d);
|
|
487
|
+
})
|
|
488
|
+
return [...newColumns];
|
|
556
489
|
});
|
|
557
|
-
|
|
558
|
-
});
|
|
559
|
-
};
|
|
490
|
+
};
|
|
560
491
|
|
|
561
492
|
const setVisibleColumn = (columnTitle: string) => {
|
|
562
493
|
sortTableRef?.current?.handleTableHeadHidden?.(columnTitle);
|
|
563
494
|
};
|
|
564
|
-
const toMapByKey = (
|
|
565
|
-
arr: any[],
|
|
566
|
-
key: string,
|
|
567
|
-
fn?: (item: any, index: number) => any,
|
|
568
|
-
) => {
|
|
569
|
-
const map = {};
|
|
570
|
-
arr.forEach((i: any) => (map[renderToString(i[key])] = i));
|
|
571
|
-
return map;
|
|
572
|
-
};
|
|
573
|
-
const getColumns = () => {
|
|
574
|
-
// 优化一下 减少复杂度
|
|
575
|
-
const titleMap = toMapByKey(value.columns, 'title');
|
|
576
|
-
// 加上排序
|
|
577
|
-
const cols = showColumn.map((i) => ({
|
|
578
|
-
...i,
|
|
579
|
-
isPermissionColumn: titleMap[renderToString(i.title)]?.isPermissionColumn,
|
|
580
|
-
render: titleMap[renderToString(i.title)]?.render,
|
|
581
|
-
}));
|
|
582
|
-
cols.forEach((i) => handleBssulaColumnsSpecialParams(i));
|
|
583
|
-
return cols;
|
|
584
|
-
};
|
|
585
495
|
|
|
586
496
|
const config = {
|
|
587
497
|
visibleFieldsCount: 3,
|
|
@@ -604,126 +514,45 @@ export default (props: any) => {
|
|
|
604
514
|
rowSelection: false, // 默认无多选
|
|
605
515
|
...handleTimeValue(),
|
|
606
516
|
tableProps: setTableProps(),
|
|
607
|
-
columns:
|
|
517
|
+
columns: [...showColumn],
|
|
608
518
|
fields: [...showSearchFields],
|
|
609
519
|
ref: props.forwardedRef || refs,
|
|
610
520
|
isFullScreen,
|
|
611
521
|
};
|
|
612
522
|
|
|
613
523
|
useEffect(() => {
|
|
614
|
-
if (!localStorage.getItem('isTabChange')
|
|
524
|
+
if (!localStorage.getItem('isTabChange')) {
|
|
615
525
|
if (pagePath === pathname) {
|
|
616
526
|
// @ts-ignore
|
|
617
527
|
config.ref?.current?.tableRef?.current?.refreshTable();
|
|
618
528
|
}
|
|
619
|
-
}
|
|
620
|
-
setTimeout(() => {
|
|
621
|
-
// 处理页面刷新两面
|
|
622
|
-
localStorage.removeItem('isTabChange');
|
|
623
|
-
}, 0);
|
|
624
|
-
}, [pathname]);
|
|
625
|
-
|
|
626
|
-
const expandedRowKeys = props?.expandable?.expandedRowKeys;
|
|
627
|
-
|
|
628
|
-
//todo summary属性已经被使用,为了兼容之前的,现在使用 summaryList
|
|
629
|
-
//结构为了实现多行总结栏 定义如下(lableShow: boolean 是否显示列文本)
|
|
630
|
-
/**
|
|
631
|
-
* [
|
|
632
|
-
* {
|
|
633
|
-
* cont:[{key: 'spuCode',value: 100,labelShow: false}]
|
|
634
|
-
* }
|
|
635
|
-
* ]
|
|
636
|
-
* @returns []
|
|
637
|
-
*/
|
|
638
|
-
const getTableSummaryInfo = () => {
|
|
639
|
-
const { summaryList, rowSelection,expandable }: any = props;
|
|
640
|
-
if (summaryList && Array.isArray(summaryList)) {
|
|
641
|
-
const summaryRow = (rowSelection) ? [{}, ...showColumn] : [...showColumn];
|
|
642
|
-
if(expandable){
|
|
643
|
-
summaryRow.unshift({});
|
|
644
|
-
}
|
|
645
|
-
// let summaryInitial = summary().cont;
|
|
646
|
-
return (
|
|
647
|
-
<Table.Summary fixed>
|
|
648
|
-
{Array.isArray(summaryList) &&
|
|
649
|
-
summaryList.map((summaryItem, summaryIndex) => (
|
|
650
|
-
<Table.Summary.Row key={summaryIndex}>
|
|
651
|
-
{summaryRow.map((item: any, index: number) => {
|
|
652
|
-
const { cout = [] } = summaryItem;
|
|
653
|
-
const target = cout.filter(
|
|
654
|
-
(inner: any) =>
|
|
655
|
-
inner.key &&
|
|
656
|
-
(inner.key === item.dataIndex || inner.key === item.key),
|
|
657
|
-
)[0];
|
|
658
|
-
if (target) {
|
|
659
|
-
const labelText = target.labelShow ? `${item.title}:` :``;
|
|
660
|
-
return (
|
|
661
|
-
<Table.Summary.Cell
|
|
662
|
-
index={index}
|
|
663
|
-
key={`Table.Summary.Cell_${item.index}`}
|
|
664
|
-
>
|
|
665
|
-
<Text type="danger">
|
|
666
|
-
{`${labelText} ${target.value ?? ''}`}
|
|
667
|
-
</Text>
|
|
668
|
-
</Table.Summary.Cell>
|
|
669
|
-
);
|
|
670
|
-
} else {
|
|
671
|
-
return (
|
|
672
|
-
<Table.Summary.Cell
|
|
673
|
-
index={index}
|
|
674
|
-
key={`Table.Summary.Cell_${item.index}`}
|
|
675
|
-
>
|
|
676
|
-
<Text type="danger">{` `}</Text>
|
|
677
|
-
</Table.Summary.Cell>
|
|
678
|
-
);
|
|
679
|
-
}
|
|
680
|
-
})}
|
|
681
|
-
</Table.Summary.Row>
|
|
682
|
-
))}
|
|
683
|
-
</Table.Summary>
|
|
684
|
-
);
|
|
685
529
|
} else {
|
|
686
|
-
|
|
530
|
+
setTimeout(() => {
|
|
531
|
+
// 处理页面刷新两面
|
|
532
|
+
localStorage.removeItem('isTabChange');
|
|
533
|
+
}, 0);
|
|
687
534
|
}
|
|
688
|
-
};
|
|
535
|
+
}, [pathname]);
|
|
689
536
|
|
|
690
537
|
const memoConfig = useMemo(
|
|
691
538
|
() => ({
|
|
692
539
|
...config,
|
|
693
540
|
summary: props.summary,
|
|
694
|
-
summaryList: props.summaryList ? getTableSummaryInfo : undefined,
|
|
695
541
|
statusMapping: props.statusMapping,
|
|
542
|
+
appRequestConfig: props.appRequestConfig
|
|
696
543
|
}),
|
|
697
|
-
[
|
|
698
|
-
// value,
|
|
699
|
-
checkedList,
|
|
700
|
-
showColumn,
|
|
701
|
-
props.statusMapping,
|
|
702
|
-
showSearchFields,
|
|
703
|
-
expandedRowKeys,
|
|
704
|
-
],
|
|
705
|
-
);
|
|
706
|
-
return (
|
|
707
|
-
<div id="bs-sula-query-table">
|
|
708
|
-
<MemoQueryTable {...memoConfig} />
|
|
709
|
-
<SortableTable
|
|
710
|
-
ref={sortTableRef}
|
|
711
|
-
setShowColumns={setShowColumns}
|
|
712
|
-
showColumn={showColumn}
|
|
713
|
-
datasource={value?.columns || []}
|
|
714
|
-
bsTableCode={bsTableCode}
|
|
715
|
-
onlyModal
|
|
716
|
-
/>
|
|
717
|
-
{value?.exportConfig?.settingColumns && (
|
|
718
|
-
<SortableTable
|
|
719
|
-
ref={exportTableRef}
|
|
720
|
-
setShowColumns={setShowExportColumns}
|
|
721
|
-
showColumn={showExportColumn}
|
|
722
|
-
datasource={value?.columns || []}
|
|
723
|
-
bsTableCode={bsTableCodeExport}
|
|
724
|
-
onlyModal
|
|
725
|
-
/>
|
|
726
|
-
)}
|
|
727
|
-
</div>
|
|
544
|
+
[value, checkedList, showColumn, props.statusMapping, showSearchFields],
|
|
728
545
|
);
|
|
546
|
+
return <>
|
|
547
|
+
<MemoQueryTable {...memoConfig} />
|
|
548
|
+
<SortableTable
|
|
549
|
+
ref={sortTableRef}
|
|
550
|
+
setShowColumns={setShowColumns}
|
|
551
|
+
showColumn={showColumn}
|
|
552
|
+
datasource={value?.columns || []}
|
|
553
|
+
bsTableCode={bsTableCode}
|
|
554
|
+
appRequestConfig={appRequestConfig}
|
|
555
|
+
onlyModal
|
|
556
|
+
/>
|
|
557
|
+
</>;
|
|
729
558
|
};
|