@bit-sun/business-component 4.0.12-alpha.2 → 4.0.12-alpha.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.0.12-alpha.2",
3
+ "version": "4.0.12-alpha.20",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -23,6 +23,28 @@ import { BsSulaQueryTable } from '../../../index.ts';
23
23
  export default () => {
24
24
  const config = {
25
25
  needPageHeader: false,
26
+ remoteDataSource: {
27
+ url: `https://randomuser.me/api`,
28
+ method: 'GET',
29
+ convertParams({ params }) {
30
+ return {
31
+ results: params.pageSize,
32
+ ...params,
33
+ };
34
+ },
35
+ converter({ data }) {
36
+ return {
37
+ list: data.results.map((item, index) => {
38
+ return {
39
+ ...item,
40
+ id: `${index}`,
41
+ name: `${item.name.first} ${item.name.last}`,
42
+ };
43
+ }),
44
+ total: 100,
45
+ };
46
+ },
47
+ },
26
48
  summary: [{
27
49
  label: '总金额',
28
50
  count: 100
@@ -72,26 +94,97 @@ export default () => {
72
94
  ],
73
95
  columns: [
74
96
  {
75
- dataIndex: 'code',
76
- title: '应用编码',
77
- tableHeadFilterKey: 'qp-code-eq',
78
- },
79
- {
80
- dataIndex: 'operator',
81
- title: '操作',
82
- fixed: 'right',
83
- render: [
84
- {
85
- type: 'link',
86
- code: 'User_ApplicationList_edit',
87
- props: {
88
- type: 'primary',
89
- children: '编辑',
90
- },
91
- visible: '#{record.status === 1}',
92
- action: ['refreshTable'],
93
- },
94
- ],
97
+ key: 'id',
98
+ title: 'ID',
99
+ },
100
+ {
101
+ key: 'name',
102
+ title: '姓名',
103
+ width: 30,
104
+ },
105
+ {
106
+ key: 'nat',
107
+ title: '国家',
108
+ },
109
+ {
110
+ key: 'gender',
111
+ title: '性别',
112
+ render: ({ text }) => {
113
+ return text === 'male' ? '男' : '女';
114
+ },
115
+ },
116
+ {
117
+ key: 'email',
118
+ title: '邮箱',
119
+ },
120
+ {
121
+ key: 'id',
122
+ title: 'ID',
123
+ },
124
+ {
125
+ key: 'name',
126
+ title: '姓名',
127
+ },
128
+ {
129
+ key: 'nat',
130
+ title: '国家',
131
+ },
132
+ {
133
+ key: 'gender',
134
+ title: '性别',
135
+ render: ({ text }) => {
136
+ return text === 'male' ? '男' : '女';
137
+ },
138
+ },
139
+ {
140
+ key: 'email',
141
+ title: '邮箱',
142
+ },
143
+ {
144
+ key: 'id',
145
+ title: 'ID',
146
+ },
147
+ {
148
+ key: 'name',
149
+ title: '姓名',
150
+ },
151
+ {
152
+ key: 'nat',
153
+ title: '国家',
154
+ },
155
+ {
156
+ key: 'gender',
157
+ title: '性别',
158
+ render: ({ text }) => {
159
+ return text === 'male' ? '男' : '女';
160
+ },
161
+ },
162
+ {
163
+ key: 'email',
164
+ title: '邮箱',
165
+ },
166
+ {
167
+ key: 'id',
168
+ title: 'ID',
169
+ },
170
+ {
171
+ key: 'name',
172
+ title: '姓名',
173
+ },
174
+ {
175
+ key: 'nat',
176
+ title: '国家',
177
+ },
178
+ {
179
+ key: 'gender',
180
+ title: '性别',
181
+ render: ({ text }) => {
182
+ return text === 'male' ? '男' : '女';
183
+ },
184
+ },
185
+ {
186
+ key: 'email',
187
+ title: '邮箱',
95
188
  },
96
189
  ],
97
190
  rowKey: 'id',
@@ -41,18 +41,120 @@ interface Field {
41
41
  const MemoQueryTable = React.memo(QueryTable);
42
42
  const { Text } = Typography;
43
43
 
44
- const ResizeableTitle = (props) => {
44
+ const ResizeableTitle = (props: any) => {
45
45
  const { onResize, width, ...restProps } = props;
46
+
47
+ const [innerWidth, setInnerWidth] = useState(width);
48
+ const [isResizing, setIsResizing] = useState(false); // 标记是否正在拖拽
49
+ const [isDragging, setIsDragging] = useState(false); // 标记拖拽句柄是否被拖拽
50
+ const [startX, setStartX] = useState(0); // 初始X坐标
51
+ const markerPosition = useRef({ left: 0, top: 0 });
52
+ const currentStart = useRef(0);
53
+ const uuidref = useRef(uuid());
54
+
55
+ const prevWidthRef = useRef(width);
56
+
57
+ const handleMouseDown = (e: any) => {
58
+ currentStart.current = e.clientX;
59
+ markerPosition.current = { left: e.clientX, top: e.clientY }
60
+ setIsResizing(true);
61
+ document.addEventListener('mousemove', handleMouseMove);
62
+ document.addEventListener('mouseup', handleMouseUp);
63
+ };
64
+
65
+ const handleMouseMove = (e: any) => {
66
+ e.stopPropagation();
67
+ e.preventDefault();
68
+ // 更新标记位置
69
+ markerPosition.current = { left: e.clientX, top: e.clientY }
70
+ const dom: HTMLElement | null = document.getElementById('text1');
71
+
72
+ if (dom && dom.style) {
73
+ dom.style.left = `${e.clientX}px`;
74
+ dom.style.top = `${e.clientY - 20}px`;
75
+ }
76
+ };
77
+
78
+ const handleMouseUp = (e: any) => {
79
+ document.removeEventListener('mousemove', handleMouseMove);
80
+ document.removeEventListener('mouseup', handleMouseUp);
81
+ setIsResizing(false);
82
+ };
83
+
84
+ const handleresize = (e: any, data: any, title: string) => {
85
+ const newWidth = data?.size?.width || 0;
86
+ setInnerWidth(newWidth); // 更新内部分宽度
87
+ };
88
+
89
+ const handleResizeStart = () => {
90
+ setIsResizing(true);
91
+ };
92
+
93
+ const handleResizeStop = (e: any, data: any) => {
94
+ setIsResizing(false);
95
+ if (onResize) {
96
+ onResize(e, data);
97
+ }
98
+ };
99
+
100
+ useEffect(() => {
101
+ if (width !== prevWidthRef.current) {
102
+ prevWidthRef.current = width;
103
+ setInnerWidth(width);
104
+ }
105
+ }, [width]);
106
+
107
+ const thStyle = {
108
+ boxShadow: isResizing ? '2px 2px 10px rgba(0, 0, 0, 0.3)' : 'none',
109
+ };
46
110
 
47
- if (!width) {
48
- return <th {...restProps} />;
49
- }
50
111
  return (
51
112
  <Resizable
52
- width={width}
113
+ width={innerWidth}
53
114
  height={0}
54
- onResize={onResize}
55
- draggableOpts={{ enableUserSelectHack: false }}
115
+ handle={
116
+ <div>
117
+ <div
118
+ style={{
119
+ width: '10px',
120
+ height: '30px',
121
+ cursor: 'col-resize', // 拖动时改变鼠标样式
122
+ position: 'absolute',
123
+ zIndex: 10,
124
+ top: 0,
125
+ right: 0,
126
+ }}
127
+ onMouseDown={handleMouseDown}
128
+ // onDrag={handleDrag}
129
+ >
130
+ </div>
131
+ {isResizing && <div
132
+ id="text1"
133
+ style={{
134
+ position: 'fixed',
135
+ left: markerPosition.current.left, // 跟随鼠标偏移一点
136
+ top: markerPosition.current.top - 20,
137
+ backgroundColor: '#1890ff',
138
+ color: 'white',
139
+ borderRadius: '4px',
140
+ zIndex: 9999,
141
+ pointerEvents: 'none',
142
+ height: '40px',
143
+ width: 2
144
+ }}
145
+ >
146
+ </div>}
147
+ </div>
148
+ }
149
+ onResize={(e: any, data: any) => {handleresize(e, data, restProps.title)}}
150
+ onResizeStart={handleResizeStart}
151
+ onResizeStop={handleResizeStop}
152
+ draggableOpts={{
153
+ enableUserSelectHack: true,
154
+ grid: [20, 20],
155
+ axis: 'x',
156
+ bounds: 'parent',
157
+ }}
56
158
  >
57
159
  <th {...restProps} />
58
160
  </Resizable>
@@ -15,6 +15,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
15
15
 
16
16
  // 默认type === 'supplier' 供应商选择器
17
17
  let requestConfig = {
18
+ init: true,
18
19
  url: `${prefixUrl.selectPrefix}/supplier`,
19
20
  filter: 'qp-name,code-orGroup,like', // 过滤参数
20
21
  otherParams: {
@@ -326,7 +327,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
326
327
  tableSearchForm = [
327
328
  { name: 'qp-skuCode-in', label: 'SKU编码',type:'multipleQueryInput' },
328
329
  { name: 'qp-skuName-like', label: 'SKU名称' },
329
- { name: 'qp-spuCode-like', label: '外部SPU编码' },
330
+ { name: 'qp-itemCode-like', label: '外部SPU编码' },
330
331
  { name: 'qp-eancode-in', label: '商品条码', field: {
331
332
  type: 'multipleQueryInput',
332
333
  props: {
@@ -784,6 +785,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
784
785
  ...selectConfigProps,
785
786
  }
786
787
  requestConfig = {
788
+ init: true,
787
789
  url: `${prefixUrl.selectPrefix}/skuPropertyValue/list`,
788
790
  filter: 'qp-value-like', // 过滤参数
789
791
  mappingTextField: 'value',
@@ -1694,6 +1696,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
1694
1696
  ...selectConfigProps,
1695
1697
  }
1696
1698
  requestConfig = {
1699
+ init: true,
1697
1700
  url: `${prefixUrl.selectPrefix}/inventoryOrg`,
1698
1701
  filter: 'qp-name,code-orGroup,like', // 过滤参数
1699
1702
  mappingTextField: 'name',
@@ -1726,6 +1729,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
1726
1729
  ...selectConfigProps,
1727
1730
  }
1728
1731
  requestConfig = {
1732
+ init: true,
1729
1733
  url: `${prefixUrl.selectPrefix}/company`,
1730
1734
  filter: 'qp-name,code-orGroup,like', // 过滤参数
1731
1735
  mappingTextField: 'name',
@@ -1758,6 +1762,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
1758
1762
  ...selectConfigProps,
1759
1763
  }
1760
1764
  requestConfig = {
1765
+ init: true,
1761
1766
  url: `${prefixUrl.selectPrefix}/platCompany`,
1762
1767
  filter: 'qp-name,socialCreditCode-orGroup,like', // 过滤参数
1763
1768
  mappingTextField: 'name',
@@ -1790,6 +1795,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
1790
1795
  ...selectConfigProps,
1791
1796
  }
1792
1797
  requestConfig = {
1798
+ init: true,
1793
1799
  url: `${prefixUrl.selectPrefix}/employee/v2`,
1794
1800
  filter: 'qp-employeeNumber,name-orGroup,like', // 过滤参数
1795
1801
  mappingTextField: 'name',
@@ -1887,6 +1893,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
1887
1893
  ...selectConfigProps,
1888
1894
  }
1889
1895
  requestConfig = {
1896
+ init: true,
1890
1897
  url: `${prefixUrl.selectPrefix}/employee/pageList/v2`,
1891
1898
  filter: 'qp-username,name-orGroup,like', // 过滤参数
1892
1899
  mappingTextField: 'name',
@@ -2008,6 +2015,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
2008
2015
  const isLogisCompanyCodeSingleSearch = requestConfigProp?.fixedparameter?.some((i: any) => i == 'qp-logisCompanyCode-eq');
2009
2016
  const logisCompanyCodeSingleSearchName = isLogisCompanyCodeSingleSearch ? 'qp-logisCompanyCode-eq' : 'qp-logisCompanyCode-in';
2010
2017
  requestConfig = {
2018
+ init: true,
2011
2019
  url: `${prefixUrl.selectPrefix}/deliveryMode`,
2012
2020
  filter: 'qp-name,code-orGroup,like', // 过滤参数
2013
2021
  mappingTextField: 'name',
@@ -2135,6 +2143,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
2135
2143
  ...selectConfigProps,
2136
2144
  }
2137
2145
  requestConfig = {
2146
+ init: true,
2138
2147
  url: `${prefixUrl.selectPrefix}/ruleTemplate`,
2139
2148
  filter: 'qp-name,code-orGroup,like', // 过滤参数
2140
2149
  mappingTextField: 'name',
@@ -2210,6 +2219,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
2210
2219
  ...selectConfigProps,
2211
2220
  }
2212
2221
  requestConfig = {
2222
+ init: true,
2213
2223
  url: `${prefixUrl.selectPrefix}/role`,
2214
2224
  filter: 'qp-name,code-orGroup,like', // 过滤参数
2215
2225
  mappingTextField: 'name',
@@ -2308,6 +2318,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
2308
2318
  ...selectConfigProps,
2309
2319
  }
2310
2320
  requestConfig = {
2321
+ init: true,
2311
2322
  url: `${prefixUrl.selectPrefix}/channelInfo`,
2312
2323
  filter: 'qp-name,code-orGroup,like', // 过滤参数
2313
2324
  mappingTextField: 'name',
@@ -2398,6 +2409,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
2398
2409
  ...selectConfigProps,
2399
2410
  }
2400
2411
  requestConfig = {
2412
+ init: true,
2401
2413
  url: `${prefixUrl.selectPrefix}/orgViewNode/common/pageList`,
2402
2414
  filter: 'qp-name-like', // 过滤参数
2403
2415
  mappingTextField: 'name',
@@ -2531,6 +2543,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
2531
2543
  ...selectConfigProps,
2532
2544
  }
2533
2545
  requestConfig = {
2546
+ init: true,
2534
2547
  url: `${prefixUrl.selectPrefix}/person`,
2535
2548
  filter: 'qp-code,name-orGroup,like', // 过滤参数
2536
2549
  mappingTextField: 'name',
@@ -2687,6 +2700,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
2687
2700
  ...selectConfigProps,
2688
2701
  }
2689
2702
  requestConfig = {
2703
+ init: true,
2690
2704
  url: `${prefixUrl.selectPrefix}/priceType`,
2691
2705
  filter: 'qp-code,name-orGroup,like', // 过滤参数
2692
2706
  mappingTextField: 'name',
@@ -1707,7 +1707,6 @@ export default () => {
1707
1707
  }
1708
1708
  const selectPropsMultiple = {
1709
1709
  mode: 'multiple',
1710
- maxTagCount: 1,
1711
1710
  }
1712
1711
 
1713
1712
  const [ tabKey, setTabKey ] = useState('single')
@@ -26,7 +26,7 @@ const BusinessSearchSelect = forwardRef((props: any, ref: any) => {
26
26
  needModalTable,
27
27
  modalTableProps
28
28
  }
29
- }, [props?.value, props.disabled, props.selectBusinessType]);
29
+ }, [props?.value, props.disabled, props.selectBusinessType,props.requestConfig?.noOperate]);
30
30
 
31
31
  useImperativeHandle(ref, () => ({
32
32
  getRef: () => innerRef,
@@ -52,5 +52,8 @@ export default React.memo(BusinessSearchSelect, (props, nextProps) => {
52
52
  if (props && props.selectBusinessType !== nextProps.selectBusinessType) {
53
53
  return false
54
54
  }
55
+ if (props && props.requestConfig && typeof props.requestConfig.noOperate === 'boolean' && props.requestConfig.noOperate !== nextProps.requestConfig.noOperate) {
56
+ return false
57
+ }
55
58
  return true
56
59
  });
@@ -0,0 +1,25 @@
1
+ import React, { Fragment } from "react";
2
+ import { Typography } from 'antd';
3
+ import './style.less';
4
+
5
+ //表格底部 金额总计
6
+ export default ({
7
+ summary
8
+ }: any) => {
9
+ const { Text } = Typography;
10
+
11
+ return (
12
+ <Fragment>
13
+ <div className="table_sum_wrapper">
14
+ <div className='table-bssula-summary'>
15
+ {summary.map((item: any) => (
16
+ <Text type='danger'>
17
+ {item.label}: <span className='table-bssula-summary-count'>{item.count || 0}</span>
18
+ </Text>
19
+ ))}
20
+ </div>
21
+ </div>
22
+ <div className="sum_right_line"></div>
23
+ </Fragment>
24
+ )
25
+ }
@@ -0,0 +1,25 @@
1
+
2
+ .table_sum_wrapper{
3
+ position: absolute;
4
+ overflow: hidden;
5
+ width: 80%;
6
+ height: 26px;
7
+ bottom: 0;
8
+ .table-bssula-summary{
9
+ height: 40px;
10
+ right: 0;
11
+ bottom: -20px;
12
+ white-space: nowrap;
13
+ overflow-x: auto;
14
+ }
15
+ }
16
+ .sum_right_line {
17
+ position: absolute;
18
+ right: 20%;
19
+ bottom: 0;
20
+ width: 16px;
21
+ height: 26px;
22
+ opacity: 0.32;
23
+ transform: scaleX(-1);
24
+ background-image: linear-gradient(270deg, #ffffff00 0%, #A4A4A4 100%);
25
+ }
@@ -212,4 +212,4 @@
212
212
  .ant-dropdown-link {
213
213
  cursor: pointer;
214
214
  }
215
- }
215
+ }
@@ -111,7 +111,7 @@ export default () => {
111
111
  x: '100%',
112
112
  },
113
113
  rowKey: 'id',
114
- dataSource: [{}, {}],
114
+ dataSource: [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}],
115
115
  pagination: {
116
116
  showTotal: (total: any) => `共 ${total} 条`,
117
117
  showQuickJumper: true,
@@ -291,17 +291,14 @@ export default () => {
291
291
  ]
292
292
  const config = {
293
293
  modeType: 'view',
294
- scroll: {
295
- x: '100%',
296
- },
297
294
  rowKey: 'id',
298
295
  // initialDataSource: [{}, {}],
299
296
  remoteDataSource: {
300
297
  url: 'xxxxxx',
301
298
  converter: ({ data }: any) => {
302
299
  return {
303
- list: [{},{}],
304
- total: 2
300
+ list: [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}],
301
+ total: 40
305
302
  };
306
303
  },
307
304
  },
@@ -310,8 +307,8 @@ export default () => {
310
307
  showQuickJumper: true,
311
308
  hideOnSinglePage: true,
312
309
  current: 1,
313
- pageSize: 10,
314
- total: 10,
310
+ pageSize: 30,
311
+ total: 40,
315
312
  size: 'small'
316
313
  },
317
314
  rowSelection: {
@@ -6,6 +6,7 @@ import { getItemDefaultWidth, getShowColumns, handleTextOverflow } from './utils
6
6
  import { noEmptyArray } from './utils';
7
7
  import ENUM from '@/utils/enumConfig';
8
8
  import { handleAntdColumnsSpecialParams } from '@/utils/utils';
9
+ import TableSumComponent from './components/TableSumComponent';
9
10
  const { Text } = Typography;
10
11
  export default class ColumnSettingTable extends React.Component {
11
12
  state: any;
@@ -159,7 +160,7 @@ export default class ColumnSettingTable extends React.Component {
159
160
  ...restProps,
160
161
  };
161
162
  let showSummary = null;
162
- if (this.state.showColumns.length) {
163
+ if (this.state.showColumns.length && !Array.isArray(summary)) {
163
164
  if (summary && summary().diy) {
164
165
  showSummary = this.getTableSummaryInfo();
165
166
  } else {
@@ -201,7 +202,9 @@ export default class ColumnSettingTable extends React.Component {
201
202
  ...scroll,
202
203
  x: restProps.overScrollX || this.getTableScrollXWidth(showCol)
203
204
  },
204
- summary: showSummary,
205
+ ...(
206
+ showSummary ? { summary: showSummary } : {}
207
+ )
205
208
  }
206
209
  return (
207
210
  <div style={{ position: 'relative' }}>
@@ -227,6 +230,9 @@ export default class ColumnSettingTable extends React.Component {
227
230
  ...otherTableInfo
228
231
  }
229
232
  />
233
+ {Array.isArray(summary) && (
234
+ <TableSumComponent summary={summary} />
235
+ )}
230
236
  </div >
231
237
  )
232
238
  }