ls-pro-common 1.0.91 → 1.1.1

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.
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { CascaderProps } from 'antd';
3
+ import './common.less';
4
+ declare const AreaPicker: React.ForwardRefExoticComponent<CascaderProps<any> & React.RefAttributes<unknown>>;
5
+ export default AreaPicker;
@@ -0,0 +1,260 @@
1
+ import "antd/es/cascader/style";
2
+ import _Cascader from "antd/es/cascader";
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import "antd/es/button/style";
5
+ import _Button from "antd/es/button";
6
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
7
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
8
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
9
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
10
+ import React, { useRef, useState, useEffect, useImperativeHandle } from 'react';
11
+ import { httpGet } from '../http';
12
+ import { getCache, setCache, treeEach } from '../utils';
13
+ import './common.less';
14
+ var AreaPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
15
+ var propsConfig = _objectSpread({
16
+ getPopupContainer: function getPopupContainer(triggerNode) {
17
+ var _document;
18
+
19
+ return (_document = document) === null || _document === void 0 ? void 0 : _document.body;
20
+ },
21
+ placeholder: "请选择"
22
+ }, props);
23
+
24
+ var _useState = useState(getCache('areaOptionsPanel', true) || []),
25
+ _useState2 = _slicedToArray(_useState, 2),
26
+ options = _useState2[0],
27
+ setOptions = _useState2[1]; //显示数据
28
+
29
+
30
+ var _useState3 = useState(getCache('areaOptionsPanel', true) || []),
31
+ _useState4 = _slicedToArray(_useState3, 2),
32
+ showData = _useState4[0],
33
+ setShowData = _useState4[1]; //暂存值
34
+
35
+
36
+ var _useState5 = useState([]),
37
+ _useState6 = _slicedToArray(_useState5, 2),
38
+ listData = _useState6[0],
39
+ setListData = _useState6[1]; //省市区实际值
40
+
41
+
42
+ var _useState7 = useState(props.value || []),
43
+ _useState8 = _slicedToArray(_useState7, 2),
44
+ actualData = _useState8[0],
45
+ setActualData = _useState8[1]; //标题显示值
46
+
47
+
48
+ var _useState9 = useState('province'),
49
+ _useState10 = _slicedToArray(_useState9, 2),
50
+ areaTitle = _useState10[0],
51
+ setAreaTitle = _useState10[1];
52
+
53
+ var areaRef = useRef();
54
+ useImperativeHandle(ref, function () {
55
+ return areaRef.current;
56
+ });
57
+ useEffect(function () {
58
+ initOptions();
59
+ }, []);
60
+ useEffect(function () {
61
+ if (actualData.length !== 0) {
62
+ var _props$onChange;
63
+
64
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, actualData, listData);
65
+ } else {
66
+ setAreaTitle('province');
67
+ }
68
+ }, [actualData]);
69
+ useEffect(function () {
70
+ var _props$value;
71
+
72
+ if (!options.length || !((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.length)) return;
73
+
74
+ var _props$value2 = _slicedToArray(props.value, 3),
75
+ pKey = _props$value2[0],
76
+ cKey = _props$value2[1],
77
+ dKey = _props$value2[2];
78
+
79
+ var province = pKey ? options.find(function (o) {
80
+ return o.value === pKey;
81
+ }) : false;
82
+ var city = province && cKey ? province.children.find(function (o) {
83
+ return o.value === cKey;
84
+ }) : false;
85
+ var district = city && dKey ? city.children.find(function (o) {
86
+ return o.value === dKey;
87
+ }) : false;
88
+ var area = [province, city, district].filter(Boolean);
89
+ setListData(area);
90
+ setAreaTitle(area.length === 3 ? 'district' : area.length === 2 ? 'city' : 'province');
91
+ setShowData(area.length === 3 ? city.children : area.length === 2 ? province.children : options);
92
+ }, [options]);
93
+
94
+ var initOptions = /*#__PURE__*/function () {
95
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
96
+ var cacheItems, api, result, opts;
97
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
98
+ while (1) {
99
+ switch (_context.prev = _context.next) {
100
+ case 0:
101
+ cacheItems = getCache('areaOptionsPanel', true);
102
+
103
+ if (!(cacheItems && Array.isArray(cacheItems) && cacheItems.length)) {
104
+ _context.next = 3;
105
+ break;
106
+ }
107
+
108
+ return _context.abrupt("return");
109
+
110
+ case 3:
111
+ api = '/petrel/petrel-location-center-api/sysAdministrativeDivision/allByTree';
112
+ _context.next = 6;
113
+ return httpGet(api, {}, false);
114
+
115
+ case 6:
116
+ result = _context.sent;
117
+ opts = result.rows || [];
118
+ treeEach(opts, function (item) {
119
+ item.label = item.name;
120
+ item.value = item.id;
121
+
122
+ if (item.level === 'district') {
123
+ delete item.children;
124
+ }
125
+
126
+ delete item.name;
127
+ delete item.id;
128
+ delete item.parentId;
129
+ });
130
+ setCache('areaOptionsPanel', opts, true);
131
+ setOptions(opts);
132
+ setShowData(opts);
133
+
134
+ case 12:
135
+ case "end":
136
+ return _context.stop();
137
+ }
138
+ }
139
+ }, _callee);
140
+ }));
141
+
142
+ return function initOptions() {
143
+ return _ref.apply(this, arguments);
144
+ };
145
+ }();
146
+
147
+ var dropdownRender = function dropdownRender(menus) {
148
+ var _listData$, _listData$3;
149
+
150
+ var title = /*#__PURE__*/React.createElement("div", {
151
+ className: "ls-area-cascaded-header"
152
+ }, /*#__PURE__*/React.createElement("div", {
153
+ className: "ls-word-box-display"
154
+ }, /*#__PURE__*/React.createElement(_Button, {
155
+ type: "text",
156
+ onClick: function onClick() {
157
+ setAreaTitle('province');
158
+ setShowData(options);
159
+ setListData(function (val) {
160
+ return val.length ? [val[0]] : [];
161
+ });
162
+ }
163
+ }, /*#__PURE__*/React.createElement("span", {
164
+ className: 'ls-myself-select-title-style'
165
+ }, listData[0] ? (_listData$ = listData[0]) === null || _listData$ === void 0 ? void 0 : _listData$.label : '省/直辖市'))), /*#__PURE__*/React.createElement("div", {
166
+ className: "ls-word-box-display"
167
+ }, /*#__PURE__*/React.createElement(_Button, {
168
+ type: "text",
169
+ disabled: listData.length < 2,
170
+ onClick: function onClick() {
171
+ var _listData$2;
172
+
173
+ setAreaTitle('city');
174
+ setShowData((_listData$2 = listData[0]) === null || _listData$2 === void 0 ? void 0 : _listData$2.children);
175
+ setListData(function (val) {
176
+ return val.filter(function (o, i) {
177
+ return i < 2;
178
+ });
179
+ });
180
+ }
181
+ }, /*#__PURE__*/React.createElement("span", {
182
+ className: 'ls-myself-select-title-style'
183
+ }, areaTitle !== 'province' && listData[1] ? (_listData$3 = listData[1]) === null || _listData$3 === void 0 ? void 0 : _listData$3.label : '市'))), /*#__PURE__*/React.createElement("div", {
184
+ className: "ls-word-box-display"
185
+ }, /*#__PURE__*/React.createElement(_Button, {
186
+ type: "text",
187
+ disabled: listData.length < 3
188
+ }, /*#__PURE__*/React.createElement("span", {
189
+ className: 'ls-myself-select-title-style'
190
+ }, listData[2] ? listData[2].label : '区'))));
191
+ return /*#__PURE__*/React.createElement("div", {
192
+ className: "ls-area-cascaded-box"
193
+ }, title, /*#__PURE__*/React.createElement("div", {
194
+ className: "ls-area-cascaded-body"
195
+ }, showData.map(function (item) {
196
+ return /*#__PURE__*/React.createElement("div", {
197
+ className: "ls-area-cascaded-span ".concat(actualData.find(function (o) {
198
+ return o === item.value;
199
+ }) ? ' ls-area-selected' : ''),
200
+ title: item.label,
201
+ onClick: function onClick(e) {
202
+ var _areaRef$current;
203
+
204
+ switch ((item === null || item === void 0 ? void 0 : item.level) || '') {
205
+ case 'province':
206
+ setShowData(item === null || item === void 0 ? void 0 : item.children);
207
+ setActualData([item === null || item === void 0 ? void 0 : item.value]);
208
+ setListData(function (val) {
209
+ return [item];
210
+ }); //面板标题指向市
211
+
212
+ setAreaTitle('city');
213
+ break;
214
+
215
+ case 'city':
216
+ setShowData(item === null || item === void 0 ? void 0 : item.children);
217
+ setActualData(function (val) {
218
+ return [val[0], item === null || item === void 0 ? void 0 : item.value];
219
+ });
220
+ setListData(function (val) {
221
+ return [val[0], item];
222
+ });
223
+ setAreaTitle('district');
224
+ break;
225
+
226
+ case 'district':
227
+ setActualData(function (val) {
228
+ return [val[0], val[1], item === null || item === void 0 ? void 0 : item.value];
229
+ });
230
+ setListData(function (val) {
231
+ return [val[0], val[1], item];
232
+ });
233
+ (_areaRef$current = areaRef.current) === null || _areaRef$current === void 0 ? void 0 : _areaRef$current.blur();
234
+ break;
235
+
236
+ default:
237
+ break;
238
+ }
239
+ }
240
+ }, item.label);
241
+ })));
242
+ };
243
+
244
+ return /*#__PURE__*/React.createElement(_Cascader, _extends({
245
+ options: options,
246
+ style: {
247
+ width: '100%'
248
+ },
249
+ className: 'ls-area-box-position',
250
+ changeOnSelect: true,
251
+ ref: areaRef,
252
+ onClear: function onClear() {
253
+ setActualData([]);
254
+ setListData([]);
255
+ setShowData(options);
256
+ },
257
+ dropdownRender: dropdownRender
258
+ }, propsConfig));
259
+ });
260
+ export default AreaPicker;
@@ -35,6 +35,7 @@ export declare type InputTableProps = ProFormItemProps<InputProps> & {
35
35
  fillMap?: Record<string, string>;
36
36
  /**@name 输入后检查数据的触发方式,默认为entry回车触发 */
37
37
  triggerCheck?: 'entry' | 'blur';
38
+ /**@name 每次展示面板时都加载数据,接合 tableConfig里的 manualRequest 一起使用 */
38
39
  loadOnShow?: boolean;
39
40
  placement?: TooltipPlacement;
40
41
  arrowPointAtCenter?: boolean;
@@ -88,6 +89,7 @@ declare const InputTable: React.ForwardRefExoticComponent<{
88
89
  fillMap?: Record<string, string> | undefined;
89
90
  /**@name 输入后检查数据的触发方式,默认为entry回车触发 */
90
91
  triggerCheck?: "entry" | "blur" | undefined;
92
+ /**@name 每次展示面板时都加载数据,接合 tableConfig里的 manualRequest 一起使用 */
91
93
  loadOnShow?: boolean | undefined;
92
94
  placement?: TooltipPlacement | undefined;
93
95
  arrowPointAtCenter?: boolean | undefined;
@@ -351,4 +351,98 @@ a:hover {
351
351
 
352
352
  .ant-row {
353
353
  width: 100%;
354
- }
354
+ }
355
+
356
+ .ant-popover {
357
+ max-width: min-content !important;
358
+ }
359
+ //-------------------省市区组件样式-----------
360
+ //最外层盒子
361
+ .ls-area-cascaded-box {
362
+ width: 600px;
363
+ display: flex;
364
+ flex-direction: column;
365
+ transition: all 0.3s;
366
+
367
+ .ls-area-cascaded-header {
368
+ width: 100%;
369
+ padding: 2px 0 6px;
370
+ border-bottom: 1px solid #f0f0f0;
371
+ display: flex;
372
+ flex-direction: row;
373
+ justify-content: space-around;
374
+ justify-content: center;
375
+
376
+ .ls-word-box-display {
377
+ margin: 0 10px;
378
+ font-size: 14px;
379
+ font-weight: 100;
380
+
381
+ button {
382
+ border: none;
383
+ background-color: var(--ant-primary-2, #f0f9ff);
384
+
385
+ &[disabled] {
386
+ background-color: #fafafa !important;
387
+
388
+ .ls-myself-select-title-style {
389
+ color: var(--ant-primary-4, #a3d7ff);
390
+ transition: all 0.3s;
391
+ }
392
+ }
393
+ }
394
+
395
+ .ls-myself-select-title-style {
396
+ color: var(--ant-primary-color, rgb(69, 154, 220));
397
+ font-size: 14px;
398
+ font-weight: 600;
399
+ transition: all 0.3s;
400
+ }
401
+ }
402
+
403
+ .ls-icon-box-display {
404
+ display: flex;
405
+ align-items: center;
406
+ }
407
+ }
408
+
409
+ .ls-area-cascaded-body {
410
+ width: 100%;
411
+ min-height: 100px;
412
+ max-height: 350px;
413
+ overflow: auto;
414
+ padding: 8px 12px 4px;
415
+ display: grid;
416
+ grid-template-columns: repeat(4, 1fr);
417
+ gap: 4px;
418
+ justify-content: start;
419
+ align-content: flex-start;
420
+ align-items: center;
421
+
422
+ .ls-area-cascaded-span {
423
+ text-align: center;
424
+ padding: 6px 10px;
425
+
426
+ //文字不换行,超出省略
427
+ overflow: hidden;
428
+ text-overflow: ellipsis;
429
+ white-space: nowrap;
430
+ cursor: pointer;
431
+
432
+ &.ls-area-selected,
433
+ &:hover {
434
+ color: var(--ant-primary-color, rgb(69, 154, 220));
435
+ transition: all 0.3s;
436
+ }
437
+ }
438
+ }
439
+ }
440
+
441
+ //手动指定盒子位置
442
+ .ls-area-box-position {
443
+ .ls-ant-select-dropdown {
444
+ top: 36px !important;
445
+ }
446
+ }
447
+
448
+ //-------------------省市区组件样式-----------
@@ -19,6 +19,8 @@ export declare type DtlParamType = SingleParamType & {
19
19
  billType?: string;
20
20
  /**@name 动态编码规则字段,主从表一起保存传参 */
21
21
  codeRuleDynamicField?: string;
22
+ /**@是否查询历史数据 */
23
+ ifHistoryData?: 0 | 1;
22
24
  };
23
25
  declare function useDtl(dtlParam: DtlParamType): {
24
26
  formRef: import("react").MutableRefObject<ProFormInstance<any> | undefined>;
@@ -33,7 +33,9 @@ function useDtl(dtlParam) {
33
33
  afterRemove = dtlParam.afterRemove,
34
34
  btnStatus = dtlParam.btnStatus,
35
35
  beforeAudit = dtlParam.beforeAudit,
36
- afterAudit = dtlParam.afterAudit;
36
+ afterAudit = dtlParam.afterAudit,
37
+ _dtlParam$ifHistoryDa = dtlParam.ifHistoryData,
38
+ ifHistoryData = _dtlParam$ifHistoryDa === void 0 ? 0 : _dtlParam$ifHistoryDa;
37
39
 
38
40
  var _usePermission = usePermission(),
39
41
  canAdd = _usePermission.canAdd,
@@ -841,23 +843,28 @@ function useDtl(dtlParam) {
841
843
 
842
844
  setSelectedRows([]);
843
845
  (_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : (_tableRef$current3$cl = _tableRef$current3.clearSelected) === null || _tableRef$current3$cl === void 0 ? void 0 : _tableRef$current3$cl.call(_tableRef$current3);
846
+
847
+ if (ifHistoryData === 1) {
848
+ param.history = 1;
849
+ }
850
+
844
851
  _context8.t0 = beforeLoad;
845
852
 
846
853
  if (!_context8.t0) {
847
- _context8.next = 20;
854
+ _context8.next = 21;
848
855
  break;
849
856
  }
850
857
 
851
- _context8.next = 18;
858
+ _context8.next = 19;
852
859
  return beforeLoad(param);
853
860
 
854
- case 18:
861
+ case 19:
855
862
  _context8.t1 = _context8.sent;
856
863
  _context8.t0 = _context8.t1 === false;
857
864
 
858
- case 20:
865
+ case 21:
859
866
  if (!_context8.t0) {
860
- _context8.next = 22;
867
+ _context8.next = 23;
861
868
  break;
862
869
  }
863
870
 
@@ -866,15 +873,15 @@ function useDtl(dtlParam) {
866
873
  success: true
867
874
  });
868
875
 
869
- case 22:
876
+ case 23:
870
877
  if (sumProperties && param.sort) {
871
878
  delete param.sort;
872
879
  }
873
880
 
874
- _context8.next = 25;
881
+ _context8.next = 26;
875
882
  return dtlService.load(param);
876
883
 
877
- case 25:
884
+ case 26:
878
885
  result = _context8.sent;
879
886
  result.data = result.rows;
880
887
  result.success = true;
@@ -885,7 +892,7 @@ function useDtl(dtlParam) {
885
892
 
886
893
  return _context8.abrupt("return", result);
887
894
 
888
- case 30:
895
+ case 31:
889
896
  case "end":
890
897
  return _context8.stop();
891
898
  }
@@ -955,17 +962,16 @@ function useDtl(dtlParam) {
955
962
  return _context9.abrupt("return", false);
956
963
 
957
964
  case 20:
958
- _context9.next = 27;
965
+ _context9.next = 26;
959
966
  break;
960
967
 
961
968
  case 22:
962
969
  _context9.prev = 22;
963
970
  _context9.t0 = _context9["catch"](6);
964
- console.log(_context9.t0);
965
971
  showError(_context9.t0.message);
966
972
  return _context9.abrupt("return", false);
967
973
 
968
- case 27:
974
+ case 26:
969
975
  case "end":
970
976
  return _context9.stop();
971
977
  }
@@ -49,5 +49,7 @@ declare function useSingle(inParam: SingleParamType): {
49
49
  checkRight: (val: number) => boolean;
50
50
  loginName: string | undefined;
51
51
  isAudit: (row?: any) => boolean;
52
+ ifHistoryData: 0 | 1;
53
+ setIfHistoryData: import("react").Dispatch<import("react").SetStateAction<0 | 1>>;
52
54
  };
53
55
  export default useSingle;
@@ -78,6 +78,28 @@ function useSingle(inParam) {
78
78
  /**@name 编辑表单Ref */
79
79
 
80
80
  var editFormRef = useRef();
81
+ /**@name 查看历史数据 */
82
+
83
+ var _useState7 = useState(0),
84
+ _useState8 = _slicedToArray(_useState7, 2),
85
+ ifHistoryData = _useState8[0],
86
+ setIfHistoryData = _useState8[1];
87
+ /** 判断是否已审核,只有传入审核状态和状态字段才进行判断 */
88
+
89
+
90
+ var isAudit = useCallback(function () {
91
+ var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
92
+ if (!auditStatus || !statusField) return false;
93
+ if (!row && !selectedRows.length) return false;
94
+
95
+ if (row) {
96
+ return Number(row[statusField] || 0) >= auditStatus;
97
+ }
98
+
99
+ return selectedRows.findIndex(function (o) {
100
+ return Number(o[statusField] || 0) >= auditStatus;
101
+ }) > -1;
102
+ }, [auditStatus, statusField, selectedRows]);
81
103
  /** 新增按钮事件 */
82
104
 
83
105
  var onAdd = /*#__PURE__*/function () {
@@ -505,7 +527,7 @@ function useSingle(inParam) {
505
527
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(params, sort, filter) {
506
528
  var _tableRef$current, _tableRef$current$cle;
507
529
 
508
- var current, pageSize, sumProperties, rest, param, key, _key, sortArr, _key2, result;
530
+ var current, pageSize, sumProperties, rest, param, key, k, sortArr, _key, result;
509
531
 
510
532
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
511
533
  while (1) {
@@ -540,9 +562,9 @@ function useSingle(inParam) {
540
562
  if (filter && Object.keys(filter).length) {
541
563
  param.where = param.where || {};
542
564
 
543
- for (_key in filter) {
544
- if (filter[_key] && !param.where[_key]) {
545
- param.where[_key] = filter[_key];
565
+ for (k in filter) {
566
+ if (filter[k] && !param.where[k]) {
567
+ param.where[k] = filter[k];
546
568
  }
547
569
  }
548
570
 
@@ -555,32 +577,36 @@ function useSingle(inParam) {
555
577
  if (!sumProperties && sort && Object.keys(sort).length) {
556
578
  sortArr = [];
557
579
 
558
- for (_key2 in sort) {
559
- sortArr.push(_key2 + ' ' + (sort[_key2] === 'ascend' ? 'asc' : 'desc'));
580
+ for (_key in sort) {
581
+ sortArr.push(_key + ' ' + (sort[_key] === 'ascend' ? 'asc' : 'desc'));
560
582
  }
561
583
 
562
584
  param.sort = sortArr.join(',');
563
585
  }
564
586
 
587
+ if (ifHistoryData) {
588
+ param.history = 1;
589
+ }
590
+
565
591
  setSelectedRows([]);
566
592
  (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$cle = _tableRef$current.clearSelected) === null || _tableRef$current$cle === void 0 ? void 0 : _tableRef$current$cle.call(_tableRef$current);
567
593
  _context6.t0 = beforeLoad;
568
594
 
569
595
  if (!_context6.t0) {
570
- _context6.next = 16;
596
+ _context6.next = 17;
571
597
  break;
572
598
  }
573
599
 
574
- _context6.next = 14;
600
+ _context6.next = 15;
575
601
  return beforeLoad(param);
576
602
 
577
- case 14:
603
+ case 15:
578
604
  _context6.t1 = _context6.sent;
579
605
  _context6.t0 = _context6.t1 === false;
580
606
 
581
- case 16:
607
+ case 17:
582
608
  if (!_context6.t0) {
583
- _context6.next = 18;
609
+ _context6.next = 19;
584
610
  break;
585
611
  }
586
612
 
@@ -590,15 +616,15 @@ function useSingle(inParam) {
590
616
  total: 0
591
617
  });
592
618
 
593
- case 18:
619
+ case 19:
594
620
  if (sumProperties && param.sort) {
595
621
  delete param.sort;
596
622
  }
597
623
 
598
- _context6.next = 21;
624
+ _context6.next = 22;
599
625
  return service.load(param);
600
626
 
601
- case 21:
627
+ case 22:
602
628
  result = _context6.sent;
603
629
  result.data = result.rows || [];
604
630
  result.success = true;
@@ -609,7 +635,7 @@ function useSingle(inParam) {
609
635
 
610
636
  return _context6.abrupt("return", result);
611
637
 
612
- case 26:
638
+ case 27:
613
639
  case "end":
614
640
  return _context6.stop();
615
641
  }
@@ -701,6 +727,12 @@ function useSingle(inParam) {
701
727
  return _ref7.apply(this, arguments);
702
728
  };
703
729
  }();
730
+ /**
731
+ * 判断按钮状态
732
+ * @param key
733
+ * @returns
734
+ */
735
+
704
736
 
705
737
  var btnDisabled = function btnDisabled(key) {
706
738
  if (btnStatus && typeof btnStatus(key) === 'boolean') return btnStatus(key);
@@ -716,23 +748,8 @@ function useSingle(inParam) {
716
748
  default:
717
749
  return false;
718
750
  }
719
- };
720
- /** 判断是否已审核,只有传入审核状态和状态字段才进行判断 */
721
-
751
+ }; // 处理内置 table 按钮,新增,编辑,删除,审核,导入,导出
722
752
 
723
- var isAudit = useCallback(function () {
724
- var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
725
- if (!auditStatus || !statusField) return false;
726
- if (!row && !selectedRows.length) return false;
727
-
728
- if (row) {
729
- return Number(row[statusField] || 0) >= auditStatus;
730
- }
731
-
732
- return selectedRows.findIndex(function (o) {
733
- return Number(o[statusField] || 0) >= auditStatus;
734
- }) > -1;
735
- }, [auditStatus, statusField, selectedRows]); // 处理内置 table 按钮,新增,编辑,删除,审核,导入,导出
736
753
 
737
754
  var tableTools = useMemo(function () {
738
755
  return [(toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.add) && canAdd ? /*#__PURE__*/React.createElement(_Button, {
@@ -782,7 +799,7 @@ function useSingle(inParam) {
782
799
  },
783
800
  disabled: btnDisabled('export'),
784
801
  icon: /*#__PURE__*/React.createElement(ExportOutlined, null)
785
- }, "\u5BFC\u51FA") : false].filter(function (o) {
802
+ }, "\u5BFC\u51FA") : false].filter(function () {
786
803
  return Boolean;
787
804
  });
788
805
  }, [selectedRows]);
@@ -807,7 +824,9 @@ function useSingle(inParam) {
807
824
  resourceId: resourceId,
808
825
  checkRight: checkRight,
809
826
  loginName: loginName,
810
- isAudit: isAudit
827
+ isAudit: isAudit,
828
+ ifHistoryData: ifHistoryData,
829
+ setIfHistoryData: setIfHistoryData
811
830
  };
812
831
  }
813
832
 
package/es/http/index.js CHANGED
@@ -6,10 +6,18 @@ import { getCache, getUrlQuery, setUrlQuery, getCookie, getResourceProps, showEr
6
6
  var request = extend({
7
7
  timeout: 60000
8
8
  });
9
+ var httpStatus = {
10
+ 404: '服务不存在',
11
+ 429: '接口限流',
12
+ 502: '网关出错',
13
+ 503: '当前服务器异常',
14
+ 504: '请求超时'
15
+ };
9
16
  /** 请求拦截器,统一添加token */
10
17
 
11
18
  request.interceptors.request.use(function (url, options) {
12
19
  var token = getCookie("token");
20
+ console.log('我的拦截', token);
13
21
  options.headers = options.headers || {}; // 处理 token
14
22
 
15
23
  if (token && url.indexOf('noToken=1') === -1) {