@zgfe/business-lib 1.1.55-beta.3 → 1.1.55-beta.6
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/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/quickDatePicker/demo/index.d.ts +3 -0
- package/es/quickDatePicker/demo/index.js +36 -0
- package/es/quickDatePicker/index.d.ts +6 -0
- package/es/quickDatePicker/index.js +152 -0
- package/es/quickDatePicker/styles/index.less +108 -0
- package/es/quickDatePicker/types.d.ts +24 -0
- package/es/quickDatePicker/types.js +1 -0
- package/es/quickDatePicker/utils.d.ts +10 -0
- package/es/quickDatePicker/utils.js +42 -0
- package/es/utils/ajax.js +24 -11
- package/es/utils/demo/interruption.d.ts +2 -0
- package/es/utils/demo/interruption.js +38 -0
- package/package.json +2 -2
package/es/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import BizTargetCondition from './targetConditionGroup';
|
|
|
8
8
|
import BizConditionItem from './attrConditions';
|
|
9
9
|
import BizConditionGroup from './attrConditions/group';
|
|
10
10
|
import BizDatePicker from './datePicker';
|
|
11
|
+
import BizQuickDatePicker from './quickDatePicker';
|
|
11
12
|
import BizSelect from './select';
|
|
12
13
|
import BizDialog from './dialog';
|
|
13
14
|
import BizChart from './chart';
|
|
@@ -34,7 +35,7 @@ import BizAttrCondition from './attrCondition';
|
|
|
34
35
|
import BizAttrConditionGroup from './attrCondition/group';
|
|
35
36
|
import BizTargetFromPanel from './layout/optionTitle';
|
|
36
37
|
import { BizTargetFromPanelContext } from './layout/optionTitle/types';
|
|
37
|
-
export { BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, ColorIcon, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, };
|
|
38
|
+
export { BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, ColorIcon, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, };
|
|
38
39
|
export type { UserGroupTypes } from './userGroup/types';
|
|
39
40
|
export type { BizSelectTypes } from './select/types';
|
|
40
41
|
export type { AttributeSelect } from './attributeSelector/types';
|
package/es/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import BizTargetCondition from './targetConditionGroup';
|
|
|
7
7
|
import BizConditionItem from './attrConditions';
|
|
8
8
|
import BizConditionGroup from './attrConditions/group';
|
|
9
9
|
import BizDatePicker from './datePicker';
|
|
10
|
+
import BizQuickDatePicker from './quickDatePicker';
|
|
10
11
|
import BizSelect from './select';
|
|
11
12
|
import BizDialog from './dialog';
|
|
12
13
|
import BizChart from './chart';
|
|
@@ -33,4 +34,4 @@ import BizAttrCondition from './attrCondition';
|
|
|
33
34
|
import BizAttrConditionGroup from './attrCondition/group';
|
|
34
35
|
import BizTargetFromPanel from './layout/optionTitle';
|
|
35
36
|
import { BizTargetFromPanelContext } from './layout/optionTitle/types';
|
|
36
|
-
export { BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, ColorIcon, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig };
|
|
37
|
+
export { BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, ColorIcon, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { BizQuickDatePicker } from '@zgfe/business-lib';
|
|
8
|
+
import React, { useState } from 'react';
|
|
9
|
+
import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
|
|
10
|
+
export default (function () {
|
|
11
|
+
var _useState = useState({
|
|
12
|
+
unit: 'day',
|
|
13
|
+
begin: '2023-06-23',
|
|
14
|
+
end: '2023-06-30',
|
|
15
|
+
relative: 7
|
|
16
|
+
}),
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
time = _useState2[0],
|
|
19
|
+
setTime = _useState2[1];
|
|
20
|
+
var onChange = function onChange(data) {
|
|
21
|
+
console.log('777', data);
|
|
22
|
+
setTime(data);
|
|
23
|
+
};
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
style: {
|
|
26
|
+
display: 'flex'
|
|
27
|
+
}
|
|
28
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
style: {
|
|
30
|
+
lineHeight: '32px'
|
|
31
|
+
}
|
|
32
|
+
}, "\u9009\u62E9\u65F6\u95F4\uFF1A"), /*#__PURE__*/React.createElement(BizQuickDatePicker, {
|
|
33
|
+
defaultValue: time,
|
|
34
|
+
onChange: onChange
|
|
35
|
+
}));
|
|
36
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './styles/index.less';
|
|
3
|
+
import { QuickDatePickerTypes } from './types';
|
|
4
|
+
export declare const classPrefix = "biz-quick-date-picker-wrap";
|
|
5
|
+
declare const BizQuickDatePicker: React.FC<QuickDatePickerTypes.Props>;
|
|
6
|
+
export default BizQuickDatePicker;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect, useState } from 'react';
|
|
8
|
+
import './styles/index.less';
|
|
9
|
+
import moment from 'moment';
|
|
10
|
+
import { quickModuleOneOptions, quickModuleTwoOptions } from './utils';
|
|
11
|
+
import IconFont from '../icon/iconFont';
|
|
12
|
+
import { DatePicker } from 'antd';
|
|
13
|
+
var RangePicker = DatePicker.RangePicker;
|
|
14
|
+
export var classPrefix = 'biz-quick-date-picker-wrap';
|
|
15
|
+
var changeCount = 0;
|
|
16
|
+
var BizQuickDatePicker = function BizQuickDatePicker(props) {
|
|
17
|
+
var defaultValue = props.defaultValue;
|
|
18
|
+
var _useState = useState(false),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
show = _useState2[0],
|
|
21
|
+
setShow = _useState2[1];
|
|
22
|
+
var _useState3 = useState(-1),
|
|
23
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
24
|
+
relative = _useState4[0],
|
|
25
|
+
setRelative = _useState4[1];
|
|
26
|
+
var _useState5 = useState('day'),
|
|
27
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
28
|
+
unit = _useState6[0],
|
|
29
|
+
setUnit = _useState6[1];
|
|
30
|
+
var _useState7 = useState([moment().subtract(6, 'day'), moment()]),
|
|
31
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
32
|
+
value = _useState8[0],
|
|
33
|
+
setValue = _useState8[1];
|
|
34
|
+
var _useState9 = useState('过去7天'),
|
|
35
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
36
|
+
showText = _useState10[0],
|
|
37
|
+
setShowText = _useState10[1];
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
var _value = defaultValue || props.value;
|
|
40
|
+
if (_value) {
|
|
41
|
+
setValue([moment(_value.begin), moment(_value.end)]);
|
|
42
|
+
_value.relative && setRelative(_value.relative);
|
|
43
|
+
_value.unit && setUnit(_value.unit);
|
|
44
|
+
}
|
|
45
|
+
}, [defaultValue, props.value]);
|
|
46
|
+
var onChange = function onChange(date, dateString) {
|
|
47
|
+
changeCount++;
|
|
48
|
+
setValue(date);
|
|
49
|
+
setShowText('自定义');
|
|
50
|
+
setRelative(-1);
|
|
51
|
+
if (changeCount >= 2) {
|
|
52
|
+
setShow(false);
|
|
53
|
+
var changeValue = {
|
|
54
|
+
unit: 'day',
|
|
55
|
+
begin: dateString[0],
|
|
56
|
+
end: dateString[1],
|
|
57
|
+
relative: -1
|
|
58
|
+
};
|
|
59
|
+
props.onChange && props.onChange(changeValue);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
if (!show) changeCount = 0;
|
|
64
|
+
}, [show]);
|
|
65
|
+
var onBlur = function onBlur() {
|
|
66
|
+
setShow(false);
|
|
67
|
+
};
|
|
68
|
+
var onClick = function onClick() {
|
|
69
|
+
setShow(true);
|
|
70
|
+
};
|
|
71
|
+
var disabledDate = function disabledDate(current) {
|
|
72
|
+
return current && current > moment().endOf('month');
|
|
73
|
+
};
|
|
74
|
+
var quickModuleHandle = function quickModuleHandle(item) {
|
|
75
|
+
var _value;
|
|
76
|
+
if (item.type === 'week' || item.type === 'month') {
|
|
77
|
+
switch (Number(item.value)) {
|
|
78
|
+
case 1:
|
|
79
|
+
_value = [moment().weekday(1), moment().weekday(7)];
|
|
80
|
+
break;
|
|
81
|
+
case 2:
|
|
82
|
+
_value = [moment().weekday(1).subtract(1, 'week'), moment().weekday(7).subtract(1, 'week')];
|
|
83
|
+
break;
|
|
84
|
+
case 3:
|
|
85
|
+
_value = [moment().startOf('month'), moment().endOf('month')];
|
|
86
|
+
break;
|
|
87
|
+
case 4:
|
|
88
|
+
_value = [moment().startOf('month').subtract(1, 'month'), moment().endOf('month').subtract(1, 'month')];
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
_value = [moment().subtract(Number(item.value) - 1, 'day'), moment()];
|
|
93
|
+
}
|
|
94
|
+
setRelative(item.value);
|
|
95
|
+
setUnit(item.type);
|
|
96
|
+
setShowText(item.label);
|
|
97
|
+
setValue(_value);
|
|
98
|
+
setShow(false);
|
|
99
|
+
if (_value) {
|
|
100
|
+
var changeValue = {
|
|
101
|
+
unit: item.type,
|
|
102
|
+
begin: _value[0].format('YYYY-MM-DD'),
|
|
103
|
+
end: _value[1].format('YYYY-MM-DD'),
|
|
104
|
+
relative: item.value
|
|
105
|
+
};
|
|
106
|
+
props.onChange && props.onChange(changeValue);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var renderExtraFooter = function renderExtraFooter() {
|
|
110
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
111
|
+
className: "".concat(classPrefix, "-content-options")
|
|
112
|
+
}, /*#__PURE__*/React.createElement("ol", null, quickModuleOneOptions.map(function (item) {
|
|
113
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
114
|
+
className: "".concat(item.type === unit && item.value === relative ? 'active' : ''),
|
|
115
|
+
key: item.label,
|
|
116
|
+
onClick: function onClick() {
|
|
117
|
+
return quickModuleHandle(item);
|
|
118
|
+
}
|
|
119
|
+
}, item.label);
|
|
120
|
+
})), /*#__PURE__*/React.createElement("ol", null, quickModuleTwoOptions.map(function (item) {
|
|
121
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
122
|
+
className: "".concat(item.type === unit && item.value === relative ? 'active' : ''),
|
|
123
|
+
key: item.label,
|
|
124
|
+
onClick: function onClick() {
|
|
125
|
+
return quickModuleHandle(item);
|
|
126
|
+
}
|
|
127
|
+
}, item.label);
|
|
128
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
className: "".concat(relative === -1 ? 'active' : '')
|
|
130
|
+
}, "\u81EA\u5B9A\u4E49\u65F6\u95F4", /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconFont, {
|
|
131
|
+
type: "fanhuiicon"
|
|
132
|
+
}))));
|
|
133
|
+
};
|
|
134
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
135
|
+
className: "".concat(classPrefix, " clearfix")
|
|
136
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
137
|
+
onClick: function onClick() {
|
|
138
|
+
setShow(true);
|
|
139
|
+
}
|
|
140
|
+
}, showText), /*#__PURE__*/React.createElement(RangePicker, {
|
|
141
|
+
popupClassName: "".concat(classPrefix, "-content"),
|
|
142
|
+
separator: '至',
|
|
143
|
+
value: value,
|
|
144
|
+
onBlur: onBlur,
|
|
145
|
+
open: show,
|
|
146
|
+
onClick: onClick,
|
|
147
|
+
disabledDate: disabledDate,
|
|
148
|
+
onChange: onChange,
|
|
149
|
+
renderExtraFooter: renderExtraFooter
|
|
150
|
+
}));
|
|
151
|
+
};
|
|
152
|
+
export default BizQuickDatePicker;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
@import '../../assets/styles/inner.less';
|
|
2
|
+
|
|
3
|
+
.biz-quick-date-picker-wrap {
|
|
4
|
+
display: inline-block;
|
|
5
|
+
height: 34px;
|
|
6
|
+
padding: 4px 8px;
|
|
7
|
+
background: #fafafb;
|
|
8
|
+
border: 1px solid #165dff;
|
|
9
|
+
border-radius: 4px;
|
|
10
|
+
> :nth-child(1) {
|
|
11
|
+
float: left;
|
|
12
|
+
height: 24px;
|
|
13
|
+
margin-right: 8px;
|
|
14
|
+
padding: 2px 8px;
|
|
15
|
+
color: #165dff;
|
|
16
|
+
vertical-align: middle;
|
|
17
|
+
background: #e8efff;
|
|
18
|
+
}
|
|
19
|
+
.ant-picker {
|
|
20
|
+
padding: 0;
|
|
21
|
+
vertical-align: middle;
|
|
22
|
+
border: none;
|
|
23
|
+
border-radius: 0 !important;
|
|
24
|
+
.ant-picker-clear {
|
|
25
|
+
right: 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
&-content {
|
|
29
|
+
float: left;
|
|
30
|
+
.ant-picker-panel-container {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: row-reverse;
|
|
33
|
+
.ant-picker-footer {
|
|
34
|
+
width: auto;
|
|
35
|
+
min-width: auto;
|
|
36
|
+
border-bottom: 1px solid #e8efff;
|
|
37
|
+
box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
&-options {
|
|
41
|
+
width: 170px;
|
|
42
|
+
padding-bottom: 25px;
|
|
43
|
+
color: #67727f;
|
|
44
|
+
ol,
|
|
45
|
+
li {
|
|
46
|
+
margin: 0;
|
|
47
|
+
padding: 0;
|
|
48
|
+
list-style: none;
|
|
49
|
+
list-style-type: none;
|
|
50
|
+
}
|
|
51
|
+
> :nth-child(1),
|
|
52
|
+
> :nth-child(2) {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-wrap: wrap;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
margin-top: 8px;
|
|
57
|
+
padding-bottom: 4px;
|
|
58
|
+
border-bottom: 1px solid #ecedf0;
|
|
59
|
+
li {
|
|
60
|
+
width: 81px;
|
|
61
|
+
height: 24px;
|
|
62
|
+
margin-bottom: 8px;
|
|
63
|
+
line-height: 24px;
|
|
64
|
+
text-align: center;
|
|
65
|
+
background: #fafafb;
|
|
66
|
+
border-radius: 24px;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
> :nth-child(2) {
|
|
71
|
+
margin-top: 14px;
|
|
72
|
+
li {
|
|
73
|
+
border-radius: 0;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
> :nth-child(3) {
|
|
77
|
+
display: flex;
|
|
78
|
+
justify-content: space-between;
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 32px;
|
|
81
|
+
margin-top: 12px;
|
|
82
|
+
padding: 0 12px;
|
|
83
|
+
line-height: 32px;
|
|
84
|
+
background: #fafafb;
|
|
85
|
+
> :first-child {
|
|
86
|
+
transform: rotate(180deg);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
.active,
|
|
90
|
+
li.active {
|
|
91
|
+
color: #165dff;
|
|
92
|
+
background: #e8efff;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.clearfix:after {
|
|
99
|
+
display: block;
|
|
100
|
+
clear: both;
|
|
101
|
+
height: 0;
|
|
102
|
+
content: '';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.clearfix {
|
|
106
|
+
/* 触发 hasLayout */
|
|
107
|
+
zoom: 1;
|
|
108
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare namespace QuickDatePickerTypes {
|
|
2
|
+
interface Options {
|
|
3
|
+
label: string;
|
|
4
|
+
value: number;
|
|
5
|
+
type: 'week' | 'month' | 'day';
|
|
6
|
+
}
|
|
7
|
+
interface Range {
|
|
8
|
+
begin: string;
|
|
9
|
+
end: string;
|
|
10
|
+
}
|
|
11
|
+
interface Value extends Range {
|
|
12
|
+
unit: 'day' | 'week' | 'month';
|
|
13
|
+
relative?: number;
|
|
14
|
+
}
|
|
15
|
+
interface Props {
|
|
16
|
+
defaultValue?: Value;
|
|
17
|
+
value?: Value;
|
|
18
|
+
onChange?: (data: Value) => void;
|
|
19
|
+
}
|
|
20
|
+
interface ListOption {
|
|
21
|
+
count: number;
|
|
22
|
+
value: string;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export var quickModuleOneOptions = [{
|
|
2
|
+
label: '本周',
|
|
3
|
+
value: 1,
|
|
4
|
+
type: 'week'
|
|
5
|
+
}, {
|
|
6
|
+
label: '上周',
|
|
7
|
+
value: 2,
|
|
8
|
+
type: 'week'
|
|
9
|
+
}, {
|
|
10
|
+
label: '本月',
|
|
11
|
+
value: 3,
|
|
12
|
+
type: 'month'
|
|
13
|
+
}, {
|
|
14
|
+
label: '上月',
|
|
15
|
+
value: 4,
|
|
16
|
+
type: 'month'
|
|
17
|
+
}];
|
|
18
|
+
export var quickModuleTwoOptions = [{
|
|
19
|
+
label: '过去5天',
|
|
20
|
+
value: 5,
|
|
21
|
+
type: 'day'
|
|
22
|
+
}, {
|
|
23
|
+
label: '过去7天',
|
|
24
|
+
value: 7,
|
|
25
|
+
type: 'day'
|
|
26
|
+
}, {
|
|
27
|
+
label: '过去14天',
|
|
28
|
+
value: 14,
|
|
29
|
+
type: 'day'
|
|
30
|
+
}, {
|
|
31
|
+
label: '过去30天',
|
|
32
|
+
value: 30,
|
|
33
|
+
type: 'day'
|
|
34
|
+
}, {
|
|
35
|
+
label: '过去60天',
|
|
36
|
+
value: 60,
|
|
37
|
+
type: 'day'
|
|
38
|
+
}, {
|
|
39
|
+
label: '过去180天',
|
|
40
|
+
value: 180,
|
|
41
|
+
type: 'day'
|
|
42
|
+
}];
|
package/es/utils/ajax.js
CHANGED
|
@@ -77,10 +77,11 @@ export function responseErrorHandler(url, apiResult, errorTitle, notifyType) {
|
|
|
77
77
|
if (new RegExp("".concat(ResponseStatus.success, "$")).test(apiResult.code)) {
|
|
78
78
|
flag = true;
|
|
79
79
|
} else if (new RegExp("".concat(ResponseStatus.notLogin)).test(apiResult.code)) {
|
|
80
|
-
|
|
80
|
+
message.error('账户未登录或登录已失效');
|
|
81
|
+
flag = true;
|
|
81
82
|
} else if (new RegExp("".concat(ResponseStatus.noPermission)).test(apiResult.code)) {
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
message.error('账户没有权限');
|
|
84
|
+
flag = true;
|
|
84
85
|
}
|
|
85
86
|
if (!flag) {
|
|
86
87
|
msg = apiResult.msg || msg;
|
|
@@ -139,28 +140,40 @@ function _request() {
|
|
|
139
140
|
return req(params.url, params.options);
|
|
140
141
|
case 14:
|
|
141
142
|
res = _context.sent;
|
|
143
|
+
if (res) {
|
|
144
|
+
_context.next = 17;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
throw new Error('Request Interruption');
|
|
148
|
+
case 17:
|
|
142
149
|
if (!(((_params$options2 = params.options) === null || _params$options2 === void 0 ? void 0 : _params$options2.responseType) === 'blob')) {
|
|
143
|
-
_context.next =
|
|
150
|
+
_context.next = 23;
|
|
144
151
|
break;
|
|
145
152
|
}
|
|
146
153
|
if (!util.isBlob(res.data)) {
|
|
147
|
-
_context.next =
|
|
154
|
+
_context.next = 22;
|
|
148
155
|
break;
|
|
149
156
|
}
|
|
150
157
|
return _context.abrupt("return", downloadFile(res, params.options.fileName));
|
|
151
|
-
case
|
|
158
|
+
case 22:
|
|
152
159
|
res = res.data;
|
|
153
|
-
case
|
|
160
|
+
case 23:
|
|
154
161
|
return _context.abrupt("return", responseWrapper ? responseWrapper(url, responseErrorHandler(url, res, options === null || options === void 0 ? void 0 : options.errorTitle, options === null || options === void 0 ? void 0 : options.notifyType)) : responseErrorHandler(url, res, options === null || options === void 0 ? void 0 : options.errorTitle, options === null || options === void 0 ? void 0 : options.notifyType));
|
|
155
|
-
case
|
|
156
|
-
_context.prev =
|
|
162
|
+
case 26:
|
|
163
|
+
_context.prev = 26;
|
|
157
164
|
_context.t0 = _context["catch"](0);
|
|
165
|
+
if (!(_context.t0.message === 'Request Interruption')) {
|
|
166
|
+
_context.next = 30;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
throw new Error('Request Interruption');
|
|
170
|
+
case 30:
|
|
158
171
|
return _context.abrupt("return", null);
|
|
159
|
-
case
|
|
172
|
+
case 31:
|
|
160
173
|
case "end":
|
|
161
174
|
return _context.stop();
|
|
162
175
|
}
|
|
163
|
-
}, _callee, null, [[0,
|
|
176
|
+
}, _callee, null, [[0, 26]]);
|
|
164
177
|
}));
|
|
165
178
|
return _request.apply(this, arguments);
|
|
166
179
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Button, message } from 'antd';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ajax } from '@zgfe/business-lib';
|
|
4
|
+
import Request from 'umi-request';
|
|
5
|
+
var CancelToken = Request.CancelToken;
|
|
6
|
+
var cancel;
|
|
7
|
+
export default (function () {
|
|
8
|
+
var getPanels = function getPanels() {
|
|
9
|
+
if (typeof cancel === 'function') {
|
|
10
|
+
cancel();
|
|
11
|
+
}
|
|
12
|
+
ajax('/zg/web/v2/apppanel/panels', {
|
|
13
|
+
method: 'post',
|
|
14
|
+
data: {
|
|
15
|
+
appId: 501648,
|
|
16
|
+
platform: 0
|
|
17
|
+
},
|
|
18
|
+
cancelToken: new CancelToken(function executor(c) {
|
|
19
|
+
cancel = c;
|
|
20
|
+
}),
|
|
21
|
+
responseWrapper: function responseWrapper(_url, res) {
|
|
22
|
+
if (/07$/.test(res.code)) {
|
|
23
|
+
console.log('reLogin-----');
|
|
24
|
+
throw new Error('reLogin');
|
|
25
|
+
}
|
|
26
|
+
return res;
|
|
27
|
+
}
|
|
28
|
+
}).then(function (res) {
|
|
29
|
+
if (!res) return;
|
|
30
|
+
message.success('请求成功');
|
|
31
|
+
}).catch(function (e) {
|
|
32
|
+
console.log(e);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
|
36
|
+
onClick: getPanels
|
|
37
|
+
}, "\u8BF7\u6C42\u63A5\u53E3"));
|
|
38
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.55-beta.
|
|
3
|
+
"version": "1.1.55-beta.6",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.12.0 || ^17.0.0",
|
|
61
61
|
"yorkie": "^2.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "ef3cee53b89f098aca2adfa5196bb8695bdb00e1"
|
|
64
64
|
}
|