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.
- package/dist/common.css +73 -0
- package/dist/common.js +1 -1
- package/dist/common.min.css +73 -0
- package/dist/common.min.js +1 -1
- package/es/components/AreaCascaderPanel.d.ts +5 -0
- package/es/components/AreaCascaderPanel.js +260 -0
- package/es/components/InputTable.d.ts +2 -0
- package/es/components/common.less +95 -1
- package/es/hooks/useDtl/index.d.ts +2 -0
- package/es/hooks/useDtl/index.js +19 -13
- package/es/hooks/useSingle/index.d.ts +2 -0
- package/es/hooks/useSingle/index.js +52 -33
- package/es/http/index.js +8 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/lib/components/AreaCascaderPanel.d.ts +5 -0
- package/lib/components/AreaCascaderPanel.js +287 -0
- package/lib/components/InputTable.d.ts +2 -0
- package/lib/components/common.less +95 -1
- package/lib/hooks/useDtl/index.d.ts +2 -0
- package/lib/hooks/useDtl/index.js +19 -13
- package/lib/hooks/useSingle/index.d.ts +2 -0
- package/lib/hooks/useSingle/index.js +52 -33
- package/lib/http/index.js +8 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +8 -0
- package/package.json +2 -2
|
@@ -100,6 +100,28 @@ function useSingle(inParam) {
|
|
|
100
100
|
/**@name 编辑表单Ref */
|
|
101
101
|
|
|
102
102
|
var editFormRef = (0, _react.useRef)();
|
|
103
|
+
/**@name 查看历史数据 */
|
|
104
|
+
|
|
105
|
+
var _useState7 = (0, _react.useState)(0),
|
|
106
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
107
|
+
ifHistoryData = _useState8[0],
|
|
108
|
+
setIfHistoryData = _useState8[1];
|
|
109
|
+
/** 判断是否已审核,只有传入审核状态和状态字段才进行判断 */
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
var isAudit = (0, _react.useCallback)(function () {
|
|
113
|
+
var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
114
|
+
if (!auditStatus || !statusField) return false;
|
|
115
|
+
if (!row && !selectedRows.length) return false;
|
|
116
|
+
|
|
117
|
+
if (row) {
|
|
118
|
+
return Number(row[statusField] || 0) >= auditStatus;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return selectedRows.findIndex(function (o) {
|
|
122
|
+
return Number(o[statusField] || 0) >= auditStatus;
|
|
123
|
+
}) > -1;
|
|
124
|
+
}, [auditStatus, statusField, selectedRows]);
|
|
103
125
|
/** 新增按钮事件 */
|
|
104
126
|
|
|
105
127
|
var onAdd = /*#__PURE__*/function () {
|
|
@@ -526,7 +548,7 @@ function useSingle(inParam) {
|
|
|
526
548
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(params, sort, filter) {
|
|
527
549
|
var _tableRef$current, _tableRef$current$cle;
|
|
528
550
|
|
|
529
|
-
var current, pageSize, sumProperties, rest, param, key,
|
|
551
|
+
var current, pageSize, sumProperties, rest, param, key, k, sortArr, _key, result;
|
|
530
552
|
|
|
531
553
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
532
554
|
while (1) {
|
|
@@ -561,9 +583,9 @@ function useSingle(inParam) {
|
|
|
561
583
|
if (filter && Object.keys(filter).length) {
|
|
562
584
|
param.where = param.where || {};
|
|
563
585
|
|
|
564
|
-
for (
|
|
565
|
-
if (filter[
|
|
566
|
-
param.where[
|
|
586
|
+
for (k in filter) {
|
|
587
|
+
if (filter[k] && !param.where[k]) {
|
|
588
|
+
param.where[k] = filter[k];
|
|
567
589
|
}
|
|
568
590
|
}
|
|
569
591
|
|
|
@@ -576,32 +598,36 @@ function useSingle(inParam) {
|
|
|
576
598
|
if (!sumProperties && sort && Object.keys(sort).length) {
|
|
577
599
|
sortArr = [];
|
|
578
600
|
|
|
579
|
-
for (
|
|
580
|
-
sortArr.push(
|
|
601
|
+
for (_key in sort) {
|
|
602
|
+
sortArr.push(_key + ' ' + (sort[_key] === 'ascend' ? 'asc' : 'desc'));
|
|
581
603
|
}
|
|
582
604
|
|
|
583
605
|
param.sort = sortArr.join(',');
|
|
584
606
|
}
|
|
585
607
|
|
|
608
|
+
if (ifHistoryData) {
|
|
609
|
+
param.history = 1;
|
|
610
|
+
}
|
|
611
|
+
|
|
586
612
|
setSelectedRows([]);
|
|
587
613
|
(_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);
|
|
588
614
|
_context6.t0 = beforeLoad;
|
|
589
615
|
|
|
590
616
|
if (!_context6.t0) {
|
|
591
|
-
_context6.next =
|
|
617
|
+
_context6.next = 17;
|
|
592
618
|
break;
|
|
593
619
|
}
|
|
594
620
|
|
|
595
|
-
_context6.next =
|
|
621
|
+
_context6.next = 15;
|
|
596
622
|
return beforeLoad(param);
|
|
597
623
|
|
|
598
|
-
case
|
|
624
|
+
case 15:
|
|
599
625
|
_context6.t1 = _context6.sent;
|
|
600
626
|
_context6.t0 = _context6.t1 === false;
|
|
601
627
|
|
|
602
|
-
case
|
|
628
|
+
case 17:
|
|
603
629
|
if (!_context6.t0) {
|
|
604
|
-
_context6.next =
|
|
630
|
+
_context6.next = 19;
|
|
605
631
|
break;
|
|
606
632
|
}
|
|
607
633
|
|
|
@@ -611,15 +637,15 @@ function useSingle(inParam) {
|
|
|
611
637
|
total: 0
|
|
612
638
|
});
|
|
613
639
|
|
|
614
|
-
case
|
|
640
|
+
case 19:
|
|
615
641
|
if (sumProperties && param.sort) {
|
|
616
642
|
delete param.sort;
|
|
617
643
|
}
|
|
618
644
|
|
|
619
|
-
_context6.next =
|
|
645
|
+
_context6.next = 22;
|
|
620
646
|
return service.load(param);
|
|
621
647
|
|
|
622
|
-
case
|
|
648
|
+
case 22:
|
|
623
649
|
result = _context6.sent;
|
|
624
650
|
result.data = result.rows || [];
|
|
625
651
|
result.success = true;
|
|
@@ -630,7 +656,7 @@ function useSingle(inParam) {
|
|
|
630
656
|
|
|
631
657
|
return _context6.abrupt("return", result);
|
|
632
658
|
|
|
633
|
-
case
|
|
659
|
+
case 27:
|
|
634
660
|
case "end":
|
|
635
661
|
return _context6.stop();
|
|
636
662
|
}
|
|
@@ -722,6 +748,12 @@ function useSingle(inParam) {
|
|
|
722
748
|
return _ref7.apply(this, arguments);
|
|
723
749
|
};
|
|
724
750
|
}();
|
|
751
|
+
/**
|
|
752
|
+
* 判断按钮状态
|
|
753
|
+
* @param key
|
|
754
|
+
* @returns
|
|
755
|
+
*/
|
|
756
|
+
|
|
725
757
|
|
|
726
758
|
var btnDisabled = function btnDisabled(key) {
|
|
727
759
|
if (btnStatus && typeof btnStatus(key) === 'boolean') return btnStatus(key);
|
|
@@ -737,23 +769,8 @@ function useSingle(inParam) {
|
|
|
737
769
|
default:
|
|
738
770
|
return false;
|
|
739
771
|
}
|
|
740
|
-
};
|
|
741
|
-
/** 判断是否已审核,只有传入审核状态和状态字段才进行判断 */
|
|
742
|
-
|
|
772
|
+
}; // 处理内置 table 按钮,新增,编辑,删除,审核,导入,导出
|
|
743
773
|
|
|
744
|
-
var isAudit = (0, _react.useCallback)(function () {
|
|
745
|
-
var row = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
746
|
-
if (!auditStatus || !statusField) return false;
|
|
747
|
-
if (!row && !selectedRows.length) return false;
|
|
748
|
-
|
|
749
|
-
if (row) {
|
|
750
|
-
return Number(row[statusField] || 0) >= auditStatus;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
return selectedRows.findIndex(function (o) {
|
|
754
|
-
return Number(o[statusField] || 0) >= auditStatus;
|
|
755
|
-
}) > -1;
|
|
756
|
-
}, [auditStatus, statusField, selectedRows]); // 处理内置 table 按钮,新增,编辑,删除,审核,导入,导出
|
|
757
774
|
|
|
758
775
|
var tableTools = (0, _react.useMemo)(function () {
|
|
759
776
|
return [(toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.add) && canAdd ? /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
@@ -803,7 +820,7 @@ function useSingle(inParam) {
|
|
|
803
820
|
},
|
|
804
821
|
disabled: btnDisabled('export'),
|
|
805
822
|
icon: /*#__PURE__*/_react.default.createElement(_icons.ExportOutlined, null)
|
|
806
|
-
}, "\u5BFC\u51FA") : false].filter(function (
|
|
823
|
+
}, "\u5BFC\u51FA") : false].filter(function () {
|
|
807
824
|
return Boolean;
|
|
808
825
|
});
|
|
809
826
|
}, [selectedRows]);
|
|
@@ -828,7 +845,9 @@ function useSingle(inParam) {
|
|
|
828
845
|
resourceId: resourceId,
|
|
829
846
|
checkRight: checkRight,
|
|
830
847
|
loginName: loginName,
|
|
831
|
-
isAudit: isAudit
|
|
848
|
+
isAudit: isAudit,
|
|
849
|
+
ifHistoryData: ifHistoryData,
|
|
850
|
+
setIfHistoryData: setIfHistoryData
|
|
832
851
|
};
|
|
833
852
|
}
|
|
834
853
|
|
package/lib/http/index.js
CHANGED
|
@@ -25,10 +25,18 @@ var _utils = require("../utils");
|
|
|
25
25
|
var request = (0, _umiRequest.extend)({
|
|
26
26
|
timeout: 60000
|
|
27
27
|
});
|
|
28
|
+
var httpStatus = {
|
|
29
|
+
404: '服务不存在',
|
|
30
|
+
429: '接口限流',
|
|
31
|
+
502: '网关出错',
|
|
32
|
+
503: '当前服务器异常',
|
|
33
|
+
504: '请求超时'
|
|
34
|
+
};
|
|
28
35
|
/** 请求拦截器,统一添加token */
|
|
29
36
|
|
|
30
37
|
request.interceptors.request.use(function (url, options) {
|
|
31
38
|
var token = (0, _utils.getCookie)("token");
|
|
39
|
+
console.log('我的拦截', token);
|
|
32
40
|
options.headers = options.headers || {}; // 处理 token
|
|
33
41
|
|
|
34
42
|
if (token && url.indexOf('noToken=1') === -1) {
|
package/lib/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import IconSelector from './components/IconSelector';
|
|
|
6
6
|
import ImageSelector from './components/ImageSelector';
|
|
7
7
|
import InputMultiLine from './components/InputMultiLine';
|
|
8
8
|
import AreaCascader from './components/AreaCascader';
|
|
9
|
+
import AreaCascaderPanel from './components/AreaCascaderPanel';
|
|
9
10
|
import DescritionCard from './components/DescritionCard';
|
|
10
11
|
import BaseService from './service/BaseService';
|
|
11
12
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
@@ -19,4 +20,4 @@ import type { ApiResponse, TableToolbar, BaseApiType, MethodType } from './typin
|
|
|
19
20
|
import type { DtlLyaoutProps } from './components/DtlLayout';
|
|
20
21
|
import type { DescritionCardProps } from './components/DescritionCard';
|
|
21
22
|
export type { ApiResponse, TableToolbar, BaseApiType, MethodType, DtlLyaoutProps, DescritionCardProps };
|
|
22
|
-
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, DescritionCard, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission };
|
|
23
|
+
export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission };
|
package/lib/index.js
CHANGED
|
@@ -13,6 +13,12 @@ Object.defineProperty(exports, "AreaCascader", {
|
|
|
13
13
|
return _AreaCascader.default;
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
+
Object.defineProperty(exports, "AreaCascaderPanel", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function get() {
|
|
19
|
+
return _AreaCascaderPanel.default;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
16
22
|
Object.defineProperty(exports, "BaseService", {
|
|
17
23
|
enumerable: true,
|
|
18
24
|
get: function get() {
|
|
@@ -145,6 +151,8 @@ var _InputMultiLine = _interopRequireDefault(require("./components/InputMultiLin
|
|
|
145
151
|
|
|
146
152
|
var _AreaCascader = _interopRequireDefault(require("./components/AreaCascader"));
|
|
147
153
|
|
|
154
|
+
var _AreaCascaderPanel = _interopRequireDefault(require("./components/AreaCascaderPanel"));
|
|
155
|
+
|
|
148
156
|
var _DescritionCard = _interopRequireDefault(require("./components/DescritionCard"));
|
|
149
157
|
|
|
150
158
|
var _BaseService = _interopRequireDefault(require("./service/BaseService"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ls-pro-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "ls-pro-common",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antd",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@ant-design/icons": "^4.3.0",
|
|
30
|
-
"ls-pro-table": "2.62.
|
|
30
|
+
"ls-pro-table": "2.62.68",
|
|
31
31
|
"ls-pro-form": "1.52.34",
|
|
32
32
|
"ls-pro-descriptions":"^1.10.33",
|
|
33
33
|
"@babel/runtime": "^7.16.3",
|