@bit-sun/business-component 4.0.13-alpha.8 → 4.2.0-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 (62) hide show
  1. package/.umirc.ts +21 -10
  2. package/dist/components/Business/BsSulaQueryTable/setting.d.ts +5 -2
  3. package/dist/components/Business/DetailPageWrapper/index.d.ts +6 -0
  4. package/dist/components/Business/ItemPropertySelector/index.d.ts +3 -0
  5. package/dist/components/Business/ModalUtils/index.d.ts +8 -0
  6. package/dist/components/Business/SearchSelect/utils.d.ts +4 -2
  7. package/dist/components/Business/columnSettingTable/columnSetting.d.ts +3 -2
  8. package/dist/components/Business/columnSettingTable/index.d.ts +19 -2
  9. package/dist/components/Business/columnSettingTable/sulaSettingTable.d.ts +20 -3
  10. package/dist/components/Functional/DataValidation/index.d.ts +11 -1
  11. package/dist/components/Functional/SearchSelect/utils.d.ts +2 -1
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.esm.js +1998 -885
  14. package/dist/index.js +1998 -884
  15. package/package.json +9 -7
  16. package/src/assets/btn-cancel.svg +3 -0
  17. package/src/assets/btn-copy.svg +3 -0
  18. package/src/assets/btn-delete.svg +2 -29
  19. package/src/assets/btn-edit.svg +2 -19
  20. package/src/assets/btn-hangUp.svg +3 -0
  21. package/src/assets/btn-print.svg +3 -0
  22. package/src/assets/btn-refresh.svg +3 -0
  23. package/src/assets/btn-unhook.svg +3 -0
  24. package/src/components/Business/BsSulaQueryTable/SearchItemSetting.tsx +4 -3
  25. package/src/components/Business/BsSulaQueryTable/index.less +5 -3
  26. package/src/components/Business/BsSulaQueryTable/index.md +45 -32
  27. package/src/components/Business/BsSulaQueryTable/index.tsx +153 -76
  28. package/src/components/Business/BsSulaQueryTable/setting.tsx +40 -10
  29. package/src/components/Business/BsSulaQueryTable/utils.tsx +15 -12
  30. package/src/components/Business/CommodityEntry/index.md +1 -1
  31. package/src/components/Business/CommodityEntry/index.tsx +11 -9
  32. package/src/components/Business/DetailPageWrapper/index.less +1 -1
  33. package/src/components/Business/DetailPageWrapper/index.tsx +24 -5
  34. package/src/components/Business/DetailPageWrapper/utils.tsx +7 -2
  35. package/src/components/Business/HomePageWrapper/index.less +1 -1
  36. package/src/components/Business/ItemPropertySelector/index.tsx +88 -0
  37. package/src/components/Business/JsonQueryTable/function.ts +1 -1
  38. package/src/components/Business/ModalUtils/index.tsx +45 -0
  39. package/src/components/Business/SearchSelect/BusinessUtils.tsx +284 -57
  40. package/src/components/Business/SearchSelect/index.md +4 -4
  41. package/src/components/Business/SearchSelect/utils.ts +26 -4
  42. package/src/components/Business/columnSettingTable/columnSetting.tsx +27 -11
  43. package/src/components/Business/columnSettingTable/index.less +5 -3
  44. package/src/components/Business/columnSettingTable/index.md +200 -136
  45. package/src/components/Business/columnSettingTable/index.tsx +167 -39
  46. package/src/components/Business/columnSettingTable/sulaSettingTable.tsx +178 -47
  47. package/src/components/Functional/AddSelect/index.tsx +19 -9
  48. package/src/components/Functional/BillEntry/index.less +3 -0
  49. package/src/components/Functional/DataValidation/index.md +1 -0
  50. package/src/components/Functional/DataValidation/index.tsx +138 -23
  51. package/src/components/Functional/QueryMutipleSelect/index.tsx +2 -1
  52. package/src/components/Functional/SearchSelect/index.less +4 -0
  53. package/src/components/Functional/SearchSelect/index.tsx +61 -20
  54. package/src/components/Functional/SearchSelect/utils.tsx +13 -10
  55. package/src/components/Functional/TreeSearchSelect/index.tsx +2 -1
  56. package/src/components/Solution/RuleComponent/index.js +59 -1
  57. package/src/components/Solution/RuleComponent/ruleFiled.js +1 -1
  58. package/src/index.ts +1 -0
  59. package/src/plugin/TableColumnSetting/index.less +5 -3
  60. package/src/plugin/TableColumnSetting/index.tsx +4 -3
  61. package/src/styles/bsDefault.less +9 -3
  62. package/src/utils/request.ts +8 -4
@@ -48,9 +48,10 @@ class SortableTable extends React.Component {
48
48
  bsTableCode: '', //设置table 列的标识
49
49
  };
50
50
 
51
- patchUserColumnConfig = (config) => {
51
+ patchUserColumnConfig = (config: any, tableCode: any) => {
52
52
  const { appRequestConfig } = this.props;
53
53
  let that = this;
54
+ const newTableCode = tableCode || that.state.bsTableCode;
54
55
  let configvalue = config
55
56
  ? config.map((item) => ({
56
57
  key: item.key,
@@ -65,12 +66,12 @@ class SortableTable extends React.Component {
65
66
  url: handleRequestUrl('/user','/appConfig/saveUserOrder', appRequestConfig),
66
67
  method: 'POST',
67
68
  data: {
68
- code: that.state.bsTableCode,
69
+ code: newTableCode,
69
70
  detail: configvalue ? JSON.stringify(configvalue) : '',
70
71
  },
71
72
  }).then((res:any) => {
72
73
  if (judgeIsRequestSuccess(res?.data)) {
73
- this.patchConfigToLocalstorage(configvalue);
74
+ this.patchConfigToLocalstorage(configvalue, newTableCode, config);
74
75
  resolve({ status: '0' });
75
76
  } else {
76
77
  message.error('保存表头列自定义失败,请稍后尝试');
@@ -93,20 +94,22 @@ class SortableTable extends React.Component {
93
94
  return [];
94
95
  };
95
96
 
96
- patchConfigToLocalstorage = (configvalue) => {
97
+ patchConfigToLocalstorage = (configvalue, tableCode: any, newDataSource: any) => {
97
98
  const { setShowColumns, datasource = [] } = this.props;
98
99
  const { sortDataSource, bsTableCode } = this.state;
100
+
101
+ const sourceList = newDataSource || sortDataSource;
99
102
  let config =
100
103
  localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
101
104
  let configArray = JSON.parse(config);
102
105
  let currentSetting = configArray.filter(
103
- (item) => item.code === bsTableCode,
106
+ (item) => item.code === tableCode,
104
107
  );
105
108
  if (currentSetting.length) {
106
109
  currentSetting[0].detail = JSON.stringify(configvalue);
107
110
  } else {
108
111
  configArray.push({
109
- code: bsTableCode,
112
+ code: tableCode,
110
113
  detail: JSON.stringify(configvalue),
111
114
  });
112
115
  }
@@ -119,7 +122,7 @@ class SortableTable extends React.Component {
119
122
  visible: false,
120
123
  });
121
124
  if (configvalue) {
122
- setShowColumns([...sortDataSource]);
125
+ setShowColumns([...sourceList]);
123
126
  } else {
124
127
  this.setState({
125
128
  isDefaultValue: true,
@@ -140,6 +143,30 @@ class SortableTable extends React.Component {
140
143
  }
141
144
  };
142
145
 
146
+ isColumnsChange = (pre=[], next=[]) => {
147
+ const preKeyStr = pre.map(item => item.key || item.dataIndex).join(',');
148
+ const nextKeyStr = next.map(item => item.key || item.dataIndex).join(',');
149
+ return preKeyStr !== nextKeyStr;
150
+ }
151
+
152
+ // 提取逻辑到单独的方法
153
+ validateLocalStorageConfig = (datasource: any, tableCode: string) => {
154
+ let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]';
155
+ let configArray = JSON.parse(config);
156
+ let currentSetting = configArray.filter((item: any) => item.code === tableCode);
157
+ let configvalue = currentSetting?.[0]?.detail ? JSON.parse(currentSetting[0].detail) : [];
158
+ if (currentSetting.length === 0 || configvalue.length === 0) {
159
+ this.patchUserColumnConfig(datasource || [], tableCode);
160
+ }
161
+ }
162
+
163
+ componentWillReceiveProps(nextProps: any) {
164
+ if (this.isColumnsChange(this.props?.datasource, nextProps?.datasource)) {
165
+ //this.setInitValue(nextProps?.datasource || []);
166
+ this.validateLocalStorageConfig(nextProps?.datasource, nextProps?.bsTableCode);
167
+ }
168
+ }
169
+
143
170
  setInitValue = (isClick = false) => {
144
171
  const { datasource, showColumn }: any = this.props;
145
172
  let config = this.getConfigFromlocalstorage();
@@ -188,6 +215,8 @@ class SortableTable extends React.Component {
188
215
  const { datasource, showColumn, bsTableCode }: any = this.props;
189
216
  let config = this.getConfigFromlocalstorage();
190
217
 
218
+ this.validateLocalStorageConfig(datasource, bsTableCode);
219
+
191
220
  this.setState({
192
221
  dataSource: datasource.map((item) => {
193
222
  let innerItem = config.filter((inneritem) => {
@@ -544,7 +573,7 @@ class SortableTable extends React.Component {
544
573
  DraggableContainer = (props) => (
545
574
  <SortableBody
546
575
  useDragHandle
547
- disableAutoscroll
576
+ lockAxis='y'
548
577
  helperClass="row-dragging"
549
578
  onSortEnd={this.onSortEnd}
550
579
  {...props}
@@ -555,9 +584,9 @@ class SortableTable extends React.Component {
555
584
  const { sortDataSource } = this.state;
556
585
  // function findIndex base on Table rowKey props and should always be a right array index
557
586
  const index = sortDataSource.findIndex(
558
- (x) => x.key === restProps['data-row-key'],
587
+ (x) => (x.key||x.dataIndex) == restProps['data-row-key'],
559
588
  );
560
- return <SortableItem index={index} {...restProps} />;
589
+ return <SortableItem key={restProps['data-row-key']} index={index} {...restProps} />;
561
590
  };
562
591
 
563
592
 
@@ -918,6 +947,7 @@ class SortableTable extends React.Component {
918
947
  row: this.DraggableBodyRow,
919
948
  },
920
949
  }}
950
+ scroll={{ y: 364 }}
921
951
  />
922
952
  </div>
923
953
  </div>
@@ -242,24 +242,27 @@ export const tableColumnsImage = (
242
242
  url?: string,
243
243
  paramsObj?: tableColumnsImageType,
244
244
  ) => {
245
- // 测试使用 测试类型缩小 随时可删除 start
246
- const imgHtml = document.querySelector('.ant-image-mask-info')!;
247
- if (imgHtml) {
248
- let str = imgHtml?.innerHTML;
249
- str = str?.replace('预览', '');
250
- imgHtml.innerHTML = str;
251
- }
252
- // 测试使用 测试类型缩小 end
245
+ // 默认预览配置(修复失真问题)
246
+ const defaultPreview = {
247
+ width: "40%", // 基于视窗宽度
248
+ objectFit: 'cover'
249
+ };
253
250
 
254
251
  return (
255
252
  <>
256
253
  {url ? (
257
- <div className={`clomnsImg`}>
258
- <Image src={url} width="16px" height="16px" {...paramsObj}></Image>
254
+ <div className="clomnsImg">
255
+ <Image
256
+ src={url}
257
+ width="16px"
258
+ height="16px"
259
+ preview={defaultPreview} // 直接使用配置,避免展开运算符
260
+ {...paramsObj}
261
+ />
259
262
  </div>
260
263
  ) : (
261
- <div className={`clomnsImg2`}>
262
- <img {...paramsObj} src={noImg}></img>
264
+ <div className="clomnsImg2">
265
+ <img {...paramsObj} src={noImg} alt="无图片" />
263
266
  </div>
264
267
  )}
265
268
  </>
@@ -28,7 +28,7 @@ export default () => {
28
28
  console.log('确定操作,可获取到成功录入的商品,做一系列操作')
29
29
  console.log(resultData)
30
30
  // 一般拿到导入数据是做请求接口操作
31
- // import {request} from "bssula";
31
+ // import {request} from 'bssula';
32
32
  // request({
33
33
  // url: `/bop/api/sku/import/save`,
34
34
  // method: "POST",
@@ -34,16 +34,18 @@ const CommodityEntry = (props: any) => {
34
34
 
35
35
  const handleOk = () => {
36
36
  // 方法获取当前组件内部的数据,然后进行自身的业务操作
37
- const resultData = dataValidationRef.current?.getValidateData();
37
+ let resultData = props?.notValid ? dataValidationRef.current?.getData() : dataValidationRef.current?.getValidateData();
38
38
 
39
- if (!resultData.successData.length) {
40
- message.error("无校验通过数据,请校验数据");
41
- return;
42
- }
43
-
44
- if (resultData.failData.length) {
45
- message.error(`有${resultData.failData.length}条校验失败数据`);
46
- return;
39
+ if(!(!!props?.notValid)) {
40
+ if (!resultData.successData.length) {
41
+ message.error("无校验通过数据,请校验数据");
42
+ return;
43
+ }
44
+
45
+ if (resultData.failData.length) {
46
+ message.error(`有${resultData.failData.length}条校验失败数据`);
47
+ return;
48
+ }
47
49
  }
48
50
 
49
51
  callbackHandleOk(resultData, () => {
@@ -94,7 +94,7 @@
94
94
  align-items: center;
95
95
  gap: 2px;
96
96
  border-radius: 3px;
97
- padding: 0 10px;
97
+ padding: 0 2px;
98
98
  }
99
99
  .ant-btn-dangerous {
100
100
  background-color: #EC5246 !important;
@@ -12,6 +12,12 @@ import editIcon from '../../../assets/btn-edit.svg';
12
12
  import submitIcon from '../../../assets/btn-submit.svg';
13
13
  import deleteIcon from '../../../assets/btn-delete.svg';
14
14
  import moreIcon from '../../../assets/btn-more.svg';
15
+ import hangUpIcon from '../../../assets/btn-hangUp.svg';
16
+ import unhookIcon from '../../../assets/btn-unhook.svg';
17
+ import refreshIcon from '../../../assets/btn-refresh.svg';
18
+ import printIcon from '../../../assets/btn-print.svg';
19
+ import copyIcon from '../../../assets/btn-copy.svg';
20
+ import cancelIcon from '../../../assets/btn-cancel.svg';
15
21
  import { useLocation, formatMessage } from 'umi';
16
22
  import CommonAlert from '../CommonAlert';
17
23
  import ENUM from '@/utils/enumConfig';
@@ -30,11 +36,21 @@ interface actionItem {
30
36
  action: object;
31
37
  }
32
38
 
39
+ const iconStyle = {
40
+ width: 16,
41
+ height: 16,
42
+ };
33
43
  export const iconMap = {
34
- edit: <img src={editIcon} />,
35
- delete: <img src={deleteIcon} />,
36
- submit: <img src={submitIcon} />,
37
- more: <img src={moreIcon} />,
44
+ edit: <img src={editIcon} {...iconStyle} />,
45
+ delete: <img src={deleteIcon} {...iconStyle} />,
46
+ submit: <img src={submitIcon} {...iconStyle} />,
47
+ more: <img src={moreIcon} {...iconStyle} />,
48
+ hangUp: <img src={hangUpIcon} {...iconStyle} />,
49
+ unhook: <img src={unhookIcon} {...iconStyle} />,
50
+ refresh: <img src={refreshIcon} {...iconStyle} />,
51
+ print: <img src={printIcon} {...iconStyle} />,
52
+ copy: <img src={copyIcon} {...iconStyle} />,
53
+ cancel: <img src={cancelIcon} {...iconStyle} />,
38
54
  };
39
55
 
40
56
  export default (props: any) => {
@@ -194,6 +210,7 @@ const DetailWrapper = React.memo(
194
210
  <Button
195
211
  type={type || 'primary'}
196
212
  icon={item.icon ? iconMap[item.icon] : ''}
213
+ style={item.icon ? {} : {}}
197
214
  danger={item.name === '删除' ? true : false}
198
215
  disabled={item.disabled}
199
216
  onClick={() => {
@@ -203,13 +220,15 @@ const DetailWrapper = React.memo(
203
220
  doDetailPageAction(item.action);
204
221
  }
205
222
  }}
223
+ {...item?.buttomProps}
206
224
  >
207
225
  {item.name}
208
226
  </Button>
209
227
  );
210
228
  };
211
229
 
212
- if (visibleActions.length <= 3) {
230
+ // 可在actionList第一项设置visibleActionCount,控制按钮几个开始显示更多,默认为3
231
+ if (visibleActions.length <= (actionLists?.[0]?.visibleActionCount || 3)) {
213
232
  return visibleActions.map((item) => {
214
233
  return renderButton(item);
215
234
  });
@@ -85,7 +85,12 @@ export const getMainCrumbNameMap = (menuData) => {
85
85
 
86
86
  const flattenMenuData = (data, parent) => {
87
87
  let pNameMap = parent.nameMap ? [...parent.nameMap] : [];
88
- data.forEach((menuItem) => {
88
+ data.forEach((menuItem) => {
89
+ // 面包屑路径,增加显示一级导航路径显示
90
+ if(parent.isMenuRoot) {
91
+ const newList = (window.top||window)?.applicationList?.filter?.((app: any) => app.code === menuItem.belongAppCode) || [];
92
+ pNameMap = newList.length > 0 ? [newList[0].name] : [];
93
+ }
89
94
  let newMenuItem = {
90
95
  ...menuItem,
91
96
  nameMap: [...pNameMap, menuItem.name]
@@ -100,7 +105,7 @@ export const getMainCrumbNameMap = (menuData) => {
100
105
  };
101
106
  });
102
107
  };
103
- flattenMenuData(menuData, {});
108
+ flattenMenuData(menuData,{ isMenuRoot: true });
104
109
  return routerMap;
105
110
  }
106
111
 
@@ -1,5 +1,5 @@
1
1
  .bs_home_page_head_wrapper{
2
- height: 32px;
2
+ // 如果设置高度 需要考虑列表页引用有传提示参数alertProps情况,写死固定高度会导致提示遮挡筛选条件
3
3
  position: sticky;
4
4
  background: #fff;
5
5
  width: 100%;
@@ -0,0 +1,88 @@
1
+ // @ts-nocheck
2
+
3
+ import React, { useState, useEffect } from 'react';
4
+ import { Input, Select } from 'antd';
5
+ import { request } from 'bssula';
6
+
7
+ const ItemPropertySelector = ({
8
+ onChange,
9
+ value,
10
+ propertyCode,
11
+ name,
12
+ ...restProps
13
+ }: any) => {
14
+
15
+ const [source, setSource] = useState([]);
16
+
17
+ useEffect(() => {
18
+ // FIXME: 目前只能通过固定属性编码先获取属性id,再通过属性id去查属性值 @林军
19
+ if (propertyCode) {
20
+ request({
21
+ url: `/items/item/propertyValue/getPropertyValueNoPagerByCode?qp-propertyCode-eq=${propertyCode}&pageSize=5000`,
22
+ method: 'GET',
23
+ converter: ({ data }: any) => {
24
+ const source = (data?.items || []).map(item => ({
25
+ text: item.value,
26
+ value: item.value
27
+ }))
28
+ setSource(source);
29
+ }
30
+ })
31
+ return;
32
+ request({
33
+ url: `/items/item/property?qp-propertyCode-eq=${propertyCode}`,
34
+ metod: 'GET',
35
+ converter: ({ data }: any) => {
36
+ let propInfo = data?.items?.[0] || {};
37
+ if (propInfo?.dictIs) {
38
+ request({
39
+ url: `/items/bscDict/detailAndFilter/${propInfo?.dictCode}`,
40
+ method: 'GET',
41
+ converter: ({ data }: any) => {
42
+ const source = (data?.dictItemResVoList || []).map(item => ({
43
+ text: item.dictItemName,
44
+ value: item.dictItemName
45
+ }))
46
+ setSource(source);
47
+ }
48
+ })
49
+ return;
50
+ }
51
+
52
+ if (propInfo?.id) {
53
+ request({
54
+ url: `/items/item/propertyValue?qp-propertyId-eq=${propInfo?.id}`,
55
+ method: 'GET',
56
+ converter: ({ data }: any) => {
57
+ const source = (data?.items || []).map(item => ({
58
+ text: item.value,
59
+ value: item.value
60
+ }))
61
+ setSource(source);
62
+ }
63
+ })
64
+ }
65
+ }
66
+ })
67
+ }
68
+ }, [propertyCode]);
69
+
70
+
71
+ return (
72
+ <Select
73
+ {...restProps}
74
+ value={value}
75
+ allowClear
76
+ style={{width: '100%'}}
77
+ onChange={(v: any) => {
78
+ onChange(v);
79
+ }}
80
+ >
81
+ {source.map((res) => {
82
+ return <Select.Option value={res.value}>{res.text}</Select.Option>;
83
+ })}
84
+ </Select>
85
+ );
86
+ };
87
+
88
+ export default ItemPropertySelector;
@@ -1,4 +1,4 @@
1
- import {request} from "bssula";
1
+ import {request} from 'bssula';
2
2
 
3
3
  export const convertActionList = (obj:any, detail:any) => {
4
4
  return {
@@ -0,0 +1,45 @@
1
+ import { Modal } from 'antd';
2
+
3
+ const ModalUtils = {
4
+ success: (content: any) => {
5
+ Modal.success({
6
+ title: '成功提示',
7
+ content: content,
8
+ width: '30%',
9
+ maskClosable: true,
10
+ okText: "确定",
11
+ });
12
+ },
13
+ error: (content: any) => {
14
+ Modal.error({
15
+ title: '错误提示',
16
+ content: content,
17
+ width: '30%',
18
+ maskClosable: true,
19
+ okText: "确定",
20
+ });
21
+ },
22
+ warning: (content: any) => {
23
+ Modal.warning({
24
+ title: '警告提示',
25
+ content: content,
26
+ width: '30%',
27
+ maskClosable: true,
28
+ okText: "确定",
29
+ });
30
+ },
31
+ confirm: (title: any, content: any, width: any, onOk: any, onCancel: any) => {
32
+ Modal.confirm({
33
+ title: title,
34
+ content: content,
35
+ width: width,
36
+ onOk: onOk,
37
+ onCancel: onCancel
38
+ });
39
+ },
40
+ custom: (config: any) => {
41
+ Modal.info(config);
42
+ }
43
+ };
44
+
45
+ export default ModalUtils;