@bit-sun/business-component 2.2.39 → 2.2.41-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.
@@ -79,7 +79,7 @@ class SearchItemTable extends React.Component {
79
79
  };
80
80
 
81
81
  patchConfigToLocalstorage = (configvalue) => {
82
- const { setShowSearchFields } = this.props;
82
+ const { setShowSearchFields, datasource = [] } = this.props;
83
83
  const { sortDataSource, bsTableCode } = this.state;
84
84
  let config = localStorage.getItem(ENUM.BROWSER_CACHE.SEARCH_FIELDS_CONDITION) || '[]'
85
85
  let configArray = JSON.parse(config)
@@ -97,7 +97,22 @@ class SearchItemTable extends React.Component {
97
97
  this.setState({
98
98
  visible: false,
99
99
  });
100
- setShowSearchFields([...sortDataSource]);
100
+ if(configvalue){
101
+ setShowSearchFields([...sortDataSource]);
102
+ }else{
103
+ this.setState({
104
+ isDefaultValue: true,
105
+ dataSource: [...datasource.map((item)=>({
106
+ ...item,
107
+ hidden: false
108
+ }))],
109
+ sortDataSource: [...datasource.map((item)=>({
110
+ ...item,
111
+ hidden: false
112
+ }))]
113
+ });
114
+ setShowSearchFields([...datasource]);
115
+ }
101
116
  };
102
117
 
103
118
  setInitValue = (isClick = false) => {
@@ -362,6 +377,10 @@ class SearchItemTable extends React.Component {
362
377
  this.setInitValue(true);
363
378
  };
364
379
 
380
+ handleResetSetting = () =>{
381
+ this.patchUserSearchFieldsConfig('');
382
+ }
383
+
365
384
  onSearch = (e: any) => {
366
385
  this.setState({
367
386
  searchDataSource: e.target.value,
@@ -396,15 +415,22 @@ class SearchItemTable extends React.Component {
396
415
  onOk={this.handleOk}
397
416
  onCancel={this.handleCancel}
398
417
  footer={[
399
- <Button key="back" onClick={this.handleReset}>
400
- 恢复默认
401
- </Button>,
402
- <Button key="submit" onClick={this.handleCancel}>
403
- 取消
404
- </Button>,
405
- <Button key="submit" type="primary" onClick={this.handleOk}>
406
- 确认
407
- </Button>,
418
+ <div>
419
+ <Button key="back" onClick={this.handleReset} style={{marginRight: 0}}>
420
+ 恢复默认
421
+ </Button>,
422
+ <Button key="back" onClick={this.handleResetSetting}>
423
+ 重置设置
424
+ </Button>
425
+ </div>,
426
+ <div>
427
+ <Button key="submit" onClick={this.handleCancel} style={{marginRight: 0}}>
428
+ 取消
429
+ </Button>,
430
+ <Button key="submit" type="primary" onClick={this.handleOk}>
431
+ 确认
432
+ </Button>
433
+ </div>,
408
434
  ]}
409
435
  >
410
436
  <div className={'sort_table'}>
@@ -145,7 +145,9 @@
145
145
  height: 70px;
146
146
  border: 0;
147
147
  padding: 20px;
148
-
148
+ display: flex;
149
+ justify-content: space-between;
150
+
149
151
  .ant-btn {
150
152
  width: 80px;
151
153
  height: 34px;
@@ -160,9 +162,9 @@
160
162
  line-height: 20px;
161
163
  }
162
164
 
163
- &:first-child {
164
- margin-right: 524px;
165
- }
165
+ // &:first-child {
166
+ // margin-right: 524px;
167
+ // }
166
168
  }
167
169
  }
168
170
 
@@ -86,7 +86,7 @@ class SortableTable extends React.Component {
86
86
  };
87
87
 
88
88
  patchConfigToLocalstorage = (configvalue) => {
89
- const { setShowColumns } = this.props;
89
+ const { setShowColumns, datasource = [] } = this.props;
90
90
  const { sortDataSource, bsTableCode } = this.state;
91
91
  let config = localStorage.getItem(ENUM.BROWSER_CACHE.COLUMN_CONDITION) || '[]'
92
92
  let configArray = JSON.parse(config)
@@ -104,7 +104,22 @@ class SortableTable extends React.Component {
104
104
  this.setState({
105
105
  visible: false,
106
106
  });
107
- setShowColumns([...sortDataSource]);
107
+ if(configvalue){
108
+ setShowColumns([...sortDataSource]);
109
+ }else{
110
+ this.setState({
111
+ isDefaultValue: true,
112
+ dataSource: [...datasource.map((item)=>({
113
+ ...item,
114
+ hidden: false
115
+ }))],
116
+ sortDataSource: [...datasource.map((item)=>({
117
+ ...item,
118
+ hidden: false
119
+ }))]
120
+ });
121
+ setShowColumns([...datasource]);
122
+ }
108
123
  };
109
124
 
110
125
  setInitValue = (isClick = false) => {
@@ -570,6 +585,10 @@ class SortableTable extends React.Component {
570
585
  this.setInitValue(true);
571
586
  };
572
587
 
588
+ handleResetSetting = () =>{
589
+ this.patchUserColumnConfig('');
590
+ }
591
+
573
592
  onSearch = (e: any) => {
574
593
  this.setState({
575
594
  searchDataSource: e.target.value,
@@ -606,15 +625,22 @@ class SortableTable extends React.Component {
606
625
  onOk={this.handleOk}
607
626
  onCancel={this.handleCancel}
608
627
  footer={[
609
- <Button key="back" onClick={this.handleReset}>
610
- 恢复默认
611
- </Button>,
612
- <Button key="submit" onClick={this.handleCancel}>
613
- 取消
614
- </Button>,
615
- <Button key="submit" type="primary" onClick={this.handleOk}>
616
- 确认
617
- </Button>,
628
+ <div>
629
+ <Button key="back" onClick={this.handleReset} style={{marginRight: 0}}>
630
+ 恢复默认
631
+ </Button>,
632
+ <Button key="back" onClick={this.handleResetSetting}>
633
+ 重置设置
634
+ </Button>
635
+ </div>,
636
+ <div>
637
+ <Button key="submit" onClick={this.handleCancel} style={{marginRight: 0}}>
638
+ 取消
639
+ </Button>,
640
+ <Button key="submit" type="primary" onClick={this.handleOk}>
641
+ 确认
642
+ </Button>
643
+ </div>
618
644
  ]}
619
645
  >
620
646
  <div className={'sort_table'}>
@@ -614,13 +614,13 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
614
614
  },
615
615
  getCheckboxProps: () => {
616
616
  return ({
617
- disabled: selectProps?.disabled || props?.disabled || !items.length,
617
+ disabled: selectProps?.disabled || props?.disabled || (!items.length && !tableData.length),
618
618
  })
619
619
  },
620
620
  };
621
621
 
622
622
  const onDoubleClickSelect = (e, record) => {
623
- if (!selectMode && !(selectProps?.disabled || props?.disabled || !items.length)) {
623
+ if (!selectMode && !(selectProps?.disabled || props?.disabled || (!items.length && !tableData.length))) {
624
624
  const srs = [JSON.parse(JSON.stringify(record))]
625
625
  const sks = srs.map((i: any) => i.value)
626
626
  onChangeSelectedKeys(sks, srs)