@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.
Files changed (143) hide show
  1. package/.umirc.ts +3 -2
  2. package/dist/components/Business/AddSelectBusiness/index.d.ts +4 -4
  3. package/dist/components/Business/BsLayouts/Components/AllFunc/drawContent.d.ts +2 -2
  4. package/dist/components/Business/BsLayouts/Components/ChooseStore/index.d.ts +2 -2
  5. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/index.d.ts +1 -1
  6. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/leftTree.d.ts +1 -1
  7. package/dist/components/Business/BsLayouts/Components/CustomerMenu/MenuSetting/rightTree.d.ts +2 -2
  8. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.d.ts +2 -2
  9. package/dist/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/customMenuHeader.d.ts +2 -2
  10. package/dist/components/Business/BsLayouts/Components/CustomerMenu/index.d.ts +1 -1
  11. package/dist/components/Business/BsLayouts/Components/GlobalHeader/index.d.ts +2 -2
  12. package/dist/components/Business/BsLayouts/Components/RightContent/LoginModal.d.ts +2 -2
  13. package/dist/components/Business/BsLayouts/index.d.ts +1 -1
  14. package/dist/components/Business/BsSulaQueryTable/SearchItemSetting.d.ts +5 -5
  15. package/dist/components/Business/BsSulaQueryTable/index.d.ts +2 -2
  16. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +7 -7
  17. package/dist/components/Business/BsSulaQueryTable/utils.d.ts +15 -15
  18. package/dist/components/Business/CommodityEntry/index.d.ts +2 -2
  19. package/dist/components/Business/CommonAlert/index.d.ts +2 -2
  20. package/dist/components/Business/CommonGuideWrapper/index.d.ts +3 -3
  21. package/dist/components/Business/DetailPageWrapper/index.d.ts +6 -6
  22. package/dist/components/Business/HomePageWrapper/index.d.ts +2 -2
  23. package/dist/components/Business/JsonQueryTable/components/FieldsModifyModal.d.ts +2 -2
  24. package/dist/components/Business/JsonQueryTable/components/FieldsSettingsTable.d.ts +2 -2
  25. package/dist/components/Business/JsonQueryTable/components/Formula.d.ts +2 -2
  26. package/dist/components/Business/JsonQueryTable/components/MaintainOptions.d.ts +2 -2
  27. package/dist/components/Business/JsonQueryTable/drawer/index.d.ts +2 -2
  28. package/dist/components/Business/SearchSelect/index.d.ts +1 -1
  29. package/dist/components/Business/StateFlow/index.d.ts +2 -2
  30. package/dist/components/Business/TreeSearchSelect/index.d.ts +1 -1
  31. package/dist/components/Business/columnSettingTable/columnSetting.d.ts +7 -7
  32. package/dist/components/Business/columnSettingTable/index.d.ts +3 -2
  33. package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +2 -2
  34. package/dist/components/Business/columnSettingTable/utils.d.ts +2 -2
  35. package/dist/components/Business/moreTreeTable/FixedScrollBar.d.ts +1 -1
  36. package/dist/components/Common/ExtendedCollapse/ExtendedPanel.d.ts +10 -0
  37. package/dist/components/Common/ExtendedCollapse/index.d.ts +7 -0
  38. package/dist/components/Common/ParagraphCopier/index.d.ts +8 -0
  39. package/dist/components/Common/Section/index.d.ts +29 -0
  40. package/dist/components/Functional/AddSelect/index.d.ts +2 -2
  41. package/dist/components/Functional/AuthButton/index.d.ts +2 -2
  42. package/dist/components/Functional/DataImport/index.d.ts +3 -3
  43. package/dist/components/Functional/DataValidation/index.d.ts +3 -3
  44. package/dist/components/Functional/ExportFunctions/ExportIcon/index.d.ts +2 -2
  45. package/dist/components/Functional/QueryMutipleInput/index.d.ts +4 -3
  46. package/dist/components/Functional/SearchSelect/index.d.ts +1 -1
  47. package/dist/components/Functional/TreeSearchSelect/index.d.ts +2 -2
  48. package/dist/components/Solution/RuleComponent/Formula.d.ts +2 -2
  49. package/dist/components/Solution/RuleComponent/InnerSelect.d.ts +2 -2
  50. package/dist/components/Solution/RuleComponent/RenderCompItem.d.ts +2 -2
  51. package/dist/components/Solution/RuleSetter/RuleInstance.d.ts +2 -2
  52. package/dist/components/Solution/RuleSetter/baseRule.d.ts +1 -1
  53. package/dist/components/Solution/RuleSetter/index.d.ts +1 -1
  54. package/dist/index.d.ts +3 -0
  55. package/dist/index.esm.js +1158 -1849
  56. package/dist/index.js +1158 -1850
  57. package/dist/plugin/TableColumnSetting/index.d.ts +6 -5
  58. package/dist/utils/TableUtils.d.ts +19 -19
  59. package/dist/utils/requestUtils.d.ts +0 -1
  60. package/dist/utils/utils.d.ts +0 -3
  61. package/lib/assets/exportFail.svg +9 -9
  62. package/lib/assets/exportProcessing.svg +9 -9
  63. package/lib/assets/exportSuccess.svg +9 -9
  64. package/package.json +15 -16
  65. package/src/assets/caidan.svg +1 -1
  66. package/src/assets/exportFail.svg +9 -9
  67. package/src/assets/exportProcessing.svg +9 -9
  68. package/src/assets/exportSuccess.svg +9 -9
  69. package/src/assets/fixed-left-active.svg +1 -1
  70. package/src/assets/fixed-right-active.svg +1 -1
  71. package/src/components/Business/AddSelectBusiness/index.md +11 -5
  72. package/src/components/Business/AddSelectBusiness/index.tsx +5 -56
  73. package/src/components/Business/BsLayouts/Components/AllFunc/drawContent.tsx +1 -1
  74. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/DrawContent.tsx +1 -1
  75. package/src/components/Business/BsLayouts/Components/CustomerMenu/globalMenu/drawContent.less +2 -2
  76. package/src/components/Business/BsLayouts/Components/GlobalHeader/index.less +1 -1
  77. package/src/components/Business/BsLayouts/Components/RightContent/home.less +1 -1
  78. package/src/components/Business/BsLayouts/Components/SearchFunc/index.less +3 -3
  79. package/src/components/Business/BsLayouts/index.tsx +4 -9
  80. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +2 -1
  81. package/src/components/Business/BsSulaQueryTable/index.md +113 -0
  82. package/src/components/Business/BsSulaQueryTable/index.tsx +240 -162
  83. package/src/components/Business/BsSulaQueryTable/setting.tsx +52 -3
  84. package/src/components/Business/BsSulaQueryTable/utils.less +1 -1
  85. package/src/components/Business/BsSulaQueryTable/utils.tsx +8 -8
  86. package/src/components/Business/CommodityEntry/index.tsx +2 -2
  87. package/src/components/Business/CommonAlert/index.tsx +1 -1
  88. package/src/components/Business/CommonGuideWrapper/index.less +50 -15
  89. package/src/components/Business/CommonGuideWrapper/index.md +36 -14
  90. package/src/components/Business/CommonGuideWrapper/index.tsx +73 -59
  91. package/src/components/Business/DetailPageWrapper/index.less +11 -9
  92. package/src/components/Business/DetailPageWrapper/index.tsx +2 -23
  93. package/src/components/Business/DetailPageWrapper/utils.tsx +1 -1
  94. package/src/components/Business/HomePageWrapper/index.less +6 -3
  95. package/src/components/Business/HomePageWrapper/index.md +2 -2
  96. package/src/components/Business/HomePageWrapper/index.tsx +5 -37
  97. package/src/components/Business/JsonQueryTable/components/FieldsSettingsTable.tsx +2 -2
  98. package/src/components/Business/SearchSelect/BusinessUtils.tsx +40 -38
  99. package/src/components/Business/SearchSelect/index.md +0 -58
  100. package/src/components/Business/SearchSelect/utils.ts +2 -2
  101. package/src/components/Business/StateFlow/index.less +3 -3
  102. package/src/components/Business/TreeSearchSelect/index.md +0 -28
  103. package/src/components/Business/TreeSearchSelect/utils.ts +0 -11
  104. package/src/components/Business/columnSettingTable/columnSetting.tsx +65 -13
  105. package/src/components/Business/columnSettingTable/index.md +1 -15
  106. package/src/components/Business/columnSettingTable/index.tsx +14 -4
  107. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +5 -4
  108. package/src/components/Business/columnSettingTable/utils.tsx +2 -2
  109. package/src/components/Common/ExtendedCollapse/ExtendedPanel.tsx +51 -0
  110. package/src/components/Common/ExtendedCollapse/index.less +33 -0
  111. package/src/components/Common/ExtendedCollapse/index.md +136 -0
  112. package/src/components/Common/ExtendedCollapse/index.tsx +25 -0
  113. package/src/components/Common/ParagraphCopier/index.md +81 -0
  114. package/src/components/Common/ParagraphCopier/index.tsx +56 -0
  115. package/src/components/Common/Section/index.md +120 -0
  116. package/src/components/Common/Section/index.module.less +16 -0
  117. package/src/components/Common/Section/index.tsx +70 -0
  118. package/src/components/Functional/AddSelect/index.tsx +29 -19
  119. package/src/components/Functional/BillEntry/index.tsx +11 -10
  120. package/src/components/Functional/DataImport/index.tsx +2 -1
  121. package/src/components/Functional/DataValidation/index.tsx +3 -3
  122. package/src/components/Functional/QueryMutipleInput/index.tsx +13 -4
  123. package/src/components/Functional/SearchSelect/index.tsx +3 -10
  124. package/src/components/Solution/RuleComponent/InnerSelect.tsx +1 -0
  125. package/src/components/Solution/RuleComponent/RenderCompItem.tsx +30 -46
  126. package/src/components/Solution/RuleComponent/index.js +18 -13
  127. package/src/components/Solution/RuleComponent/ruleFiled.js +41 -123
  128. package/src/index.ts +5 -0
  129. package/src/plugin/TableColumnSetting/index.tsx +75 -9
  130. package/src/styles/bsDefault.less +26 -18
  131. package/src/utils/TableUtils.less +1 -1
  132. package/src/utils/businessUtils.ts +2 -2
  133. package/src/utils/requestUtils.ts +2 -6
  134. package/src/utils/utils.ts +6 -35
  135. package/src/utils/xlsxUtil.tsx +2 -2
  136. package/tsconfig.json +2 -1
  137. package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.d.ts +0 -3
  138. package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/helps.d.ts +0 -2
  139. package/dist/components/Solution/RuleComponent/CustomPlugin/CustomSelector/index.d.ts +0 -3
  140. package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/CustomSelectorModal.tsx +0 -358
  141. package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/function.js +0 -255
  142. package/src/components/Solution/RuleComponent/CustomPlugin/CustomSelector/helps.tsx +0 -58
  143. 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
- // 获取 table columns中所有的 key 防止有的地方是 dataindex
66
- const checkedList = useMemo(
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 = (type: string, tableCode:string = bsTableCode) => {
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
- * @param savedConfig 保存的配置数组,可能包含字段或列的配置。
94
- * @param originConfig 原始配置数组,包含完整的字段或列信息。
95
- * @param type 字段或列的类型,用于确定配置的属性。
96
- * @returns 返回根据保存的配置处理后的字段或列数组,如果未保存任何配置,则返回原始配置。
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 isStringArray = (value: any): value is string[] => {
105
- return Array.isArray(value) && value.every(v => typeof v === 'string');
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
- * @param config 配置项,可以是字段或列。
111
- * @param type 配置项的类型。
112
- * @returns 返回配置项的键,如果无法获取,则返回空字符串。
113
- */
114
- const getItemKey = (config: Column | Field, type: string): string => {
115
- try {
116
- if (type === 'columns') {
117
- return isStringArray(config.key) ? JSON.stringify(config.key) : isStringArray(config.dataIndex) ? JSON.stringify(config.dataIndex) : config.key || config.dataIndex || '';
118
- }
119
- return isStringArray(config.name) ? JSON.stringify(config.name) : config.name || '';
120
- } catch(e) {}
121
- return '';
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
- const newConfig = [];
135
+ const newConfig = [];
125
136
 
126
- if (savedConfig.length) {
127
- const hash = originConfig.reduce((prev, inneritem) => {
128
- prev[getItemKey(inneritem, type)] = inneritem;
129
- return prev;
130
- }, {} as { [key: string]: Column | Field });
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
- savedConfig.forEach((config, index) => {
133
- let inner = hash[getItemKey(config, type)];
134
- inner && newConfig.push({ ...inner, ...config });
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
- if (newConfig.length) return newConfig;
149
+ if (newConfig.length) return newConfig;
139
150
 
140
- if (type === 'columns') {
141
- return originConfig.filter(column => {
142
- const columnKey = getItemKey(column, type);
143
- return column.notRegularCheckList || checkedList.indexOf(columnKey) > -1;
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
- return [...originConfig];
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(getConfigFromlocalstorage(ENUM.BROWSER_CACHE.SEARCH_FIELDS_CONDITION), fields, 'searchFields');
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 ? document.body.clientHeight : window.top?.document.body.clientHeight - 76;
180
- let summaryHeight = document.querySelector(`.ant-tabs-tabpane-active .table-bssula-summary`) ?
181
- (document.querySelector(`.ant-tabs-tabpane-active .table-bssula-summary`)?.clientHeight || 22) : 0;
182
- let listTabHeight = document.querySelector(`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`) ?
183
- (document.querySelector(`.ant-tabs-tabpane-active .list_top_tab .ant-tabs-nav`)?.clientHeight || 48) : 0;
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) >-1)) {
256
- const uuId = uuIdList.filter(s => item.indexOf(s) >-1)[0];
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 (shouldUseAuth() && !authButton.filter((itemInner: any) => Item === itemInner).length) {
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(ENUM.BROWSER_CACHE.COLUMN_CONDITION);
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: typeof column.width === 'number'
276
- ? column.width
277
- : parseWidth(column.width),
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(exportColumnConfig, columns, 'columns');
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: typeof column.width === 'number'
295
- ? column.width
296
- : parseWidth(column.width),
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(searchFieldsConfig, fields, 'searchFields');
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
- // getTableHeight();
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: { x: props.overScrollX || 'max-content', y: props?.overScrollY || height },
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
- let actionsRender = (value.actionsRender ?? []).map((x) => ({
465
- ...x,
466
- position: x.position ?? 'left',
467
- })).filter((x) => authFn(x?.code));
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
- type: 'text',
525
- props: {
526
- children: (
527
- <span className="ant-dropdown-link">
528
- <Dropdown
529
- overlay={
530
- <Menu>
531
- <Menu.Item>
532
- <div
533
- onClick={sortTableRef?.current?.showModal}
534
- style={{ fontSize: 14, textAlign: 'center' }}
535
- >
536
- 列设置
537
- </div>
538
- </Menu.Item>
539
- {!value?.searchConfig?.isHidden && (
540
- <Menu.Item>
541
- <SearchItemTable
542
- ref={searchTableRef}
543
- setShowSearchFields={setShowSearchFields}
544
- showSearchFields={showSearchFields}
545
- datasource={value?.fields || []}
546
- bsTableCode={bsTableCode}
547
- />
548
- </Menu.Item>
549
- )}
550
- {value?.exportConfig?.settingColumns && (
551
- <Menu.Item>
552
- <div
553
- onClick={exportTableRef?.current?.showModal}
554
- style={{ fontSize: 14, textAlign: 'center' }}
555
- >
556
- 导出字段设置
557
- </div>
558
- </Menu.Item>
559
- )}
560
- </Menu>
561
- }
562
- placement="bottomRight"
563
- >
564
- <div className="ant-dropdown-link">
565
- <img width={32} src={shezhi} />
566
- </div>
567
- </Dropdown>
568
- </span>
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: 8, // 栅格占位格数
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 = (rowSelection) ? [{}, ...showColumn] : [...showColumn];
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
- ...config,
730
- summary: props.summary,
731
- summaryList: props.summaryList ? getTableSummaryInfo : undefined,
732
- statusMapping: props.statusMapping,
733
- isBsSulaQueryTable: true,
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}