@zgfe/business-lib 1.0.7 → 1.0.10
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/addToPanel/components/addPanel.d.ts +7 -0
- package/es/addToPanel/components/addPanel.js +101 -0
- package/es/addToPanel/components/radioGroup.d.ts +7 -0
- package/es/addToPanel/components/radioGroup.js +29 -0
- package/es/addToPanel/components/styleList.d.ts +5 -0
- package/es/{dialog/components/tab.js → addToPanel/components/styleList.js} +10 -6
- package/es/{dialog/demo/index2.d.ts → addToPanel/demo/edit.d.ts} +0 -0
- package/es/{dialog/components/list.js → addToPanel/demo/edit.js} +63 -44
- package/es/{dialog/demo/index3.d.ts → addToPanel/demo/index.d.ts} +0 -0
- package/es/addToPanel/demo/index.js +78 -0
- package/es/addToPanel/index.d.ts +6 -0
- package/es/addToPanel/index.js +233 -0
- package/es/addToPanel/styles/addPanel.less +25 -0
- package/es/addToPanel/styles/index.less +6 -0
- package/es/{dialog/components/styles/tab.less → addToPanel/styles/style.less} +7 -2
- package/es/addToPanel/types.d.ts +56 -0
- package/es/addToPanel/types.js +1 -0
- package/es/addToScene/addGroup.d.ts +11 -0
- package/es/addToScene/addGroup.js +34 -0
- package/es/addToScene/demo/index.d.ts +2 -0
- package/es/addToScene/demo/index.js +34 -0
- package/es/addToScene/index.d.ts +6 -0
- package/es/addToScene/index.js +187 -0
- package/es/addToScene/styles/index.less +23 -0
- package/es/addToScene/types.d.ts +29 -0
- package/es/addToScene/types.js +1 -0
- package/es/analysisLayout/demo/index.js +6 -1
- package/es/analysisLayout/index.d.ts +1 -0
- package/es/analysisLayout/index.js +1 -0
- package/es/assets/styles/chunks.less +14 -2
- package/es/attrConditions/components/stringList.js +3 -3
- package/es/attrConditions/demo/group.js +2 -2
- package/es/attrConditions/demo/index.js +1 -1
- package/es/attrConditions/index.js +2 -2
- package/es/attrConditions/types.d.ts +1 -1
- package/es/attributeSelector/demo/index.js +1 -1
- package/es/attributeSelector/index.js +12 -2
- package/es/attributeSelector/styles/index.less +0 -1
- package/es/chart/demo/index.js +36 -4
- package/es/chart/index.d.ts +1 -1
- package/es/chart/index.js +16 -5
- package/es/constants/apis.d.ts +8 -0
- package/es/constants/apis.js +8 -0
- package/es/dialog/demo/index.d.ts +0 -23
- package/es/dialog/demo/index.js +6 -129
- package/es/dialog/index.d.ts +1 -2
- package/es/dialog/index.js +14 -183
- package/es/dialog/types.d.ts +2 -74
- package/es/index.d.ts +3 -1
- package/es/index.js +3 -1
- package/es/select/index.js +4 -2
- package/es/select/overlay.js +3 -1
- package/es/select/styles/handle.less +1 -0
- package/es/select/types.d.ts +2 -0
- package/es/targetConditionGroup/demo/index.js +1 -1
- package/es/userCondition/conditions/propCondition.js +3 -3
- package/es/userGroup/demo/index.js +4 -1
- package/es/userGroup/index.js +1 -1
- package/es/utils/ajax.d.ts +21 -7
- package/es/utils/ajax.js +205 -111
- package/package.json +3 -2
- package/es/dialog/components/itemNode.d.ts +0 -10
- package/es/dialog/components/itemNode.js +0 -109
- package/es/dialog/components/list.d.ts +0 -5
- package/es/dialog/components/selectToInput.d.ts +0 -6
- package/es/dialog/components/selectToInput.js +0 -175
- package/es/dialog/components/styles/handle.less +0 -39
- package/es/dialog/components/styles/list.less +0 -60
- package/es/dialog/components/tab.d.ts +0 -5
- package/es/dialog/data/data.d.ts +0 -20
- package/es/dialog/data/data.js +0 -73
- package/es/dialog/demo/index2.js +0 -109
- package/es/dialog/demo/index3.js +0 -61
package/es/select/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["overlayWidth", "labelField", "keyField"];
|
|
1
|
+
var _excluded = ["overlayWidth", "minDropdownWidth", "labelField", "keyField"];
|
|
2
2
|
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
4
|
|
|
@@ -32,6 +32,7 @@ export var classPrefix = 'biz-select';
|
|
|
32
32
|
|
|
33
33
|
var BizSelect = function BizSelect(props) {
|
|
34
34
|
var overlayWidth = props.overlayWidth,
|
|
35
|
+
minDropdownWidth = props.minDropdownWidth,
|
|
35
36
|
labelField = props.labelField,
|
|
36
37
|
keyField = props.keyField,
|
|
37
38
|
res = _objectWithoutProperties(props, _excluded);
|
|
@@ -175,7 +176,7 @@ var BizSelect = function BizSelect(props) {
|
|
|
175
176
|
disabled: props.disable,
|
|
176
177
|
destroyPopupOnHide: true,
|
|
177
178
|
overlayStyle: {
|
|
178
|
-
minWidth: 0,
|
|
179
|
+
minWidth: minDropdownWidth || 0,
|
|
179
180
|
width: overlayWidth || width
|
|
180
181
|
},
|
|
181
182
|
trigger: ['click'],
|
|
@@ -192,6 +193,7 @@ var BizSelect = function BizSelect(props) {
|
|
|
192
193
|
ref: boxRef,
|
|
193
194
|
value: current,
|
|
194
195
|
labelField: labelField,
|
|
196
|
+
placeholder: props.placeholder,
|
|
195
197
|
keyField: keyField,
|
|
196
198
|
disable: props.disable,
|
|
197
199
|
multiple: props.multiple,
|
package/es/select/overlay.js
CHANGED
|
@@ -164,7 +164,9 @@ var SelectOverlay = function SelectOverlay(props) {
|
|
|
164
164
|
if (showList && showList.length) {
|
|
165
165
|
return showList;
|
|
166
166
|
} else {
|
|
167
|
-
return /*#__PURE__*/React.createElement("span",
|
|
167
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
168
|
+
className: "".concat(classPrefix, "-nodata")
|
|
169
|
+
}, "\u6682\u65E0\u6570\u636E");
|
|
168
170
|
}
|
|
169
171
|
}
|
|
170
172
|
|
package/es/select/types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare namespace BizSelectTypes {
|
|
|
10
10
|
}
|
|
11
11
|
interface Props {
|
|
12
12
|
disable?: boolean;
|
|
13
|
+
placeholder?: string;
|
|
13
14
|
defaultValue?: Option | Option[];
|
|
14
15
|
value?: Option | Option[];
|
|
15
16
|
className?: string;
|
|
@@ -18,6 +19,7 @@ export declare namespace BizSelectTypes {
|
|
|
18
19
|
size?: 'lg' | 'base' | 'sm';
|
|
19
20
|
border?: boolean;
|
|
20
21
|
multiple?: boolean;
|
|
22
|
+
minDropdownWidth?: number;
|
|
21
23
|
options: Group[] | Option[];
|
|
22
24
|
extra?: (option: Option) => ReactNode;
|
|
23
25
|
dropdownExtra?: ReactNode;
|
|
@@ -89,7 +89,7 @@ var PropCondition = function PropCondition(props) {
|
|
|
89
89
|
attrId = data.attrId,
|
|
90
90
|
category = data.category,
|
|
91
91
|
type = data.type,
|
|
92
|
-
|
|
92
|
+
operator = data.operator,
|
|
93
93
|
values = data.values;
|
|
94
94
|
|
|
95
95
|
var newAttrs = _toConsumableArray(attrs);
|
|
@@ -98,7 +98,7 @@ var PropCondition = function PropCondition(props) {
|
|
|
98
98
|
attrName: attrName,
|
|
99
99
|
attrId: attrId,
|
|
100
100
|
category: category,
|
|
101
|
-
operator: transformNumberOperate(
|
|
101
|
+
operator: transformNumberOperate(operator),
|
|
102
102
|
params: values,
|
|
103
103
|
attrType: numAttrTypeMap[type]
|
|
104
104
|
};
|
|
@@ -148,7 +148,7 @@ var PropCondition = function PropCondition(props) {
|
|
|
148
148
|
props.defaultValue = {
|
|
149
149
|
attrName: attrName,
|
|
150
150
|
category: category || 'custom',
|
|
151
|
-
|
|
151
|
+
operator: operator,
|
|
152
152
|
values: params || [],
|
|
153
153
|
propCategory: getPropCategory(attrName),
|
|
154
154
|
type: attrNumTypeMap[attrType]
|
|
@@ -44,7 +44,10 @@ var UserGroupDemo = function UserGroupDemo() {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
-
className: "biz-user-group-demo"
|
|
47
|
+
className: "biz-user-group-demo",
|
|
48
|
+
style: {
|
|
49
|
+
width: '200px'
|
|
50
|
+
}
|
|
48
51
|
}, /*#__PURE__*/React.createElement(BizUserGroup, {
|
|
49
52
|
options: groupOptions,
|
|
50
53
|
onChange: handleChange,
|
package/es/userGroup/index.js
CHANGED
|
@@ -68,7 +68,7 @@ var BizUserGroup = function BizUserGroup(props) {
|
|
|
68
68
|
border: false,
|
|
69
69
|
disableItemList: props.disableItemList,
|
|
70
70
|
onChange: onChange,
|
|
71
|
-
|
|
71
|
+
minDropdownWidth: 284
|
|
72
72
|
}), /*#__PURE__*/React.createElement(BizTargetOptionIcon, {
|
|
73
73
|
name: "delete",
|
|
74
74
|
icon: "qingchu",
|
package/es/utils/ajax.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { RequestOptionsInit } from 'umi-request';
|
|
2
|
+
declare enum ResponseStatus {
|
|
3
|
+
success = 200,
|
|
4
|
+
exists = 201,
|
|
5
|
+
fail = 500,
|
|
6
|
+
sysNotInit = 501,
|
|
7
|
+
sysInited = 502,
|
|
8
|
+
notLoggin = 503,
|
|
9
|
+
paramError = 504,
|
|
10
|
+
success2 = 106000,
|
|
11
|
+
fail2 = 106001,
|
|
12
|
+
paramError2 = 106002,
|
|
13
|
+
paramError3 = 106003
|
|
14
|
+
}
|
|
15
|
+
export interface InterfaceApiResult<T> {
|
|
16
|
+
code: ResponseStatus;
|
|
17
|
+
data?: T;
|
|
18
|
+
msg?: string;
|
|
19
|
+
}
|
|
20
|
+
declare function request<T>(url: string, options?: RequestOptionsInit): Promise<InterfaceApiResult<T> | null>;
|
|
21
|
+
export default request;
|
package/es/utils/ajax.js
CHANGED
|
@@ -1,124 +1,218 @@
|
|
|
1
|
-
function
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
2
|
|
|
3
|
-
function
|
|
3
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
+
|
|
9
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
+
|
|
11
|
+
import { extend } from 'umi-request';
|
|
12
|
+
import { notification } from 'antd';
|
|
13
|
+
var ResponseStatus;
|
|
14
|
+
|
|
15
|
+
(function (ResponseStatus) {
|
|
16
|
+
ResponseStatus[ResponseStatus["success"] = 200] = "success";
|
|
17
|
+
ResponseStatus[ResponseStatus["exists"] = 201] = "exists";
|
|
18
|
+
ResponseStatus[ResponseStatus["fail"] = 500] = "fail";
|
|
19
|
+
ResponseStatus[ResponseStatus["sysNotInit"] = 501] = "sysNotInit";
|
|
20
|
+
ResponseStatus[ResponseStatus["sysInited"] = 502] = "sysInited";
|
|
21
|
+
ResponseStatus[ResponseStatus["notLoggin"] = 503] = "notLoggin";
|
|
22
|
+
ResponseStatus[ResponseStatus["paramError"] = 504] = "paramError";
|
|
23
|
+
ResponseStatus[ResponseStatus["success2"] = 106000] = "success2";
|
|
24
|
+
ResponseStatus[ResponseStatus["fail2"] = 106001] = "fail2";
|
|
25
|
+
ResponseStatus[ResponseStatus["paramError2"] = 106002] = "paramError2";
|
|
26
|
+
ResponseStatus[ResponseStatus["paramError3"] = 106003] = "paramError3";
|
|
27
|
+
})(ResponseStatus || (ResponseStatus = {}));
|
|
28
|
+
|
|
29
|
+
var ApiResult = /*#__PURE__*/_createClass(function ApiResult(code, data, message) {
|
|
30
|
+
_classCallCheck(this, ApiResult);
|
|
31
|
+
|
|
32
|
+
this.code = void 0;
|
|
33
|
+
this.data = void 0;
|
|
34
|
+
this.msg = void 0;
|
|
35
|
+
this.code = code;
|
|
36
|
+
this.data = data;
|
|
37
|
+
this.msg = message;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
var codeMessage = {
|
|
41
|
+
200: '服务器成功返回请求的数据。',
|
|
42
|
+
201: '新建或修改数据成功。',
|
|
43
|
+
202: '一个请求已经进入后台排队(异步任务)。',
|
|
44
|
+
204: '删除数据成功。',
|
|
45
|
+
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
|
|
46
|
+
401: '用户没有权限(令牌、用户名、密码错误)。',
|
|
47
|
+
403: '用户得到授权,但是访问是被禁止的。',
|
|
48
|
+
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
|
|
49
|
+
406: '请求的格式不可得。',
|
|
50
|
+
410: '请求的资源被永久删除,且不会再得到的。',
|
|
51
|
+
422: '当创建一个对象时,发生一个验证错误。',
|
|
52
|
+
500: '服务器发生错误,请检查服务器。',
|
|
53
|
+
502: '网关错误。',
|
|
54
|
+
503: '服务不可用,服务器暂时过载或维护。',
|
|
55
|
+
504: '网关超时。'
|
|
13
56
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
57
|
+
|
|
58
|
+
var errorHandler = function errorHandler(error) {
|
|
59
|
+
var response = error.response;
|
|
60
|
+
|
|
61
|
+
if (response && response.status) {
|
|
62
|
+
var errorText = codeMessage[response.status] || response.statusText;
|
|
63
|
+
var status = response.status,
|
|
64
|
+
url = response.url;
|
|
65
|
+
notification.error({
|
|
66
|
+
message: "\u8BF7\u6C42\u9519\u8BEF ".concat(status, ": ").concat(url),
|
|
67
|
+
description: errorText
|
|
68
|
+
});
|
|
69
|
+
} else if (!response) {
|
|
70
|
+
notification.error({
|
|
71
|
+
description: '您的网络发生异常,无法连接服务器',
|
|
72
|
+
message: '网络异常'
|
|
73
|
+
});
|
|
19
74
|
}
|
|
20
|
-
};
|
|
21
|
-
var CancelToken = axios.CancelToken;
|
|
22
|
-
|
|
23
|
-
var _request = function _request(ajax) {
|
|
24
|
-
return function () {
|
|
25
|
-
var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
26
|
-
url: '',
|
|
27
|
-
responseOnce: false,
|
|
28
|
-
unique: false,
|
|
29
|
-
delay: 0
|
|
30
|
-
};
|
|
31
|
-
return new Promise(function (resolve, reject) {
|
|
32
|
-
var key = JSON.stringify(option);
|
|
33
|
-
var timerKey = option.url + '_' + (Object.prototype.toString.call(option.unique) === '[object String]' ? option.unique : '');
|
|
34
|
-
|
|
35
|
-
if (option.unique && timer[timerKey]) {
|
|
36
|
-
clearTimeout(timer[timerKey].id);
|
|
37
|
-
|
|
38
|
-
if (timer[timerKey].cancel) {
|
|
39
|
-
timer[timerKey].cancel();
|
|
40
|
-
} else {
|
|
41
|
-
var cancel = new Error('cancel: before request');
|
|
42
|
-
cancel.__CANCEL__ = true;
|
|
43
|
-
timer[timerKey].reject(cancel);
|
|
44
|
-
}
|
|
45
75
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
76
|
+
return response;
|
|
77
|
+
};
|
|
49
78
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}];
|
|
79
|
+
function responseErrorHandler(url, apiResult) {
|
|
80
|
+
if (/\.jsp/.test(url)) {
|
|
81
|
+
return apiResult;
|
|
82
|
+
}
|
|
55
83
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
item.resolve(res);
|
|
60
|
-
});
|
|
61
|
-
}).catch(function (err) {
|
|
62
|
-
history[key].forEach(function (item) {
|
|
63
|
-
item.reject(err);
|
|
64
|
-
});
|
|
65
|
-
}).finally(function () {
|
|
66
|
-
delete timer[timerKey];
|
|
67
|
-
delete history[key];
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
if (option.unique) {
|
|
72
|
-
timer[timerKey] = {
|
|
73
|
-
id: 0,
|
|
74
|
-
option: option,
|
|
75
|
-
cancel: null,
|
|
76
|
-
reject: reject
|
|
77
|
-
};
|
|
78
|
-
timer[timerKey].id = setTimeout(function () {
|
|
79
|
-
option.cancelToken = new CancelToken(function (c) {
|
|
80
|
-
if (timer[timerKey]) {
|
|
81
|
-
timer[timerKey].cancel = c;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
request();
|
|
85
|
-
}, option.delay || 0);
|
|
86
|
-
} else {
|
|
87
|
-
request();
|
|
88
|
-
}
|
|
89
|
-
} else if (option.responseOnce) {
|
|
90
|
-
var _cancel = new Error('cancel: before request');
|
|
91
|
-
|
|
92
|
-
_cancel.__CANCEL__ = true;
|
|
93
|
-
reject(_cancel);
|
|
94
|
-
} else {
|
|
95
|
-
history[key].push({
|
|
96
|
-
resolve: resolve,
|
|
97
|
-
reject: reject
|
|
98
|
-
});
|
|
99
|
-
}
|
|
84
|
+
if (!apiResult.code) {
|
|
85
|
+
notification.error({
|
|
86
|
+
message: "\u63A5\u53E3\u54CD\u5E94\u7ED3\u6784\u5F02\u5E38"
|
|
100
87
|
});
|
|
101
|
-
|
|
102
|
-
}
|
|
88
|
+
throw new Error('接口响应结构异常,缺少status');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var flag = false;
|
|
92
|
+
var message = '接口请求失败';
|
|
93
|
+
|
|
94
|
+
switch (apiResult.code) {
|
|
95
|
+
case ResponseStatus.sysNotInit:
|
|
96
|
+
message = '系统未初始化';
|
|
97
|
+
break;
|
|
98
|
+
|
|
99
|
+
case ResponseStatus.sysInited:
|
|
100
|
+
message = '系统已初始化';
|
|
101
|
+
break;
|
|
102
|
+
|
|
103
|
+
case ResponseStatus.notLoggin:
|
|
104
|
+
message = '账户未登录或登录已失效';
|
|
105
|
+
break;
|
|
103
106
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
107
|
+
case ResponseStatus.paramError:
|
|
108
|
+
message = '请求参数错误';
|
|
109
|
+
break;
|
|
110
|
+
|
|
111
|
+
case ResponseStatus.paramError2:
|
|
112
|
+
message = '请求参数缺失';
|
|
113
|
+
break;
|
|
114
|
+
|
|
115
|
+
case ResponseStatus.paramError3:
|
|
116
|
+
message = '请求参数校验异常';
|
|
117
|
+
break;
|
|
118
|
+
|
|
119
|
+
case ResponseStatus.exists:
|
|
120
|
+
message = '数据已存在';
|
|
121
|
+
break;
|
|
122
|
+
|
|
123
|
+
case ResponseStatus.success:
|
|
124
|
+
flag = true;
|
|
125
|
+
break;
|
|
126
|
+
|
|
127
|
+
case ResponseStatus.success2:
|
|
128
|
+
flag = true;
|
|
129
|
+
break;
|
|
130
|
+
|
|
131
|
+
case ResponseStatus.fail:
|
|
132
|
+
message = apiResult.msg || '接口发生未知错误';
|
|
133
|
+
break;
|
|
134
|
+
|
|
135
|
+
case ResponseStatus.fail2:
|
|
136
|
+
message = apiResult.msg || '接口发生未知错误';
|
|
137
|
+
break;
|
|
138
|
+
|
|
139
|
+
default:
|
|
140
|
+
throw new Error("\u65E0\u6CD5\u8BC6\u522B\u7684\u8BF7\u6C42\u54CD\u5E94\u7801: ".concat(apiResult.code));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (!flag) {
|
|
144
|
+
message = apiResult.msg || message;
|
|
145
|
+
notification.error({
|
|
146
|
+
message: "\u8BF7\u6C42\u9519\u8BEF",
|
|
147
|
+
description: message
|
|
118
148
|
});
|
|
119
|
-
|
|
120
|
-
}
|
|
149
|
+
throw new Error(message);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return apiResult;
|
|
153
|
+
}
|
|
121
154
|
|
|
122
|
-
var
|
|
155
|
+
var req = extend({
|
|
156
|
+
errorHandler: errorHandler,
|
|
157
|
+
credentials: 'include'
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
function request(_x, _x2) {
|
|
161
|
+
return _request.apply(this, arguments);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function _request() {
|
|
165
|
+
_request = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, options) {
|
|
166
|
+
var err, option, list, res;
|
|
167
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
168
|
+
while (1) {
|
|
169
|
+
switch (_context.prev = _context.next) {
|
|
170
|
+
case 0:
|
|
171
|
+
_context.prev = 0;
|
|
172
|
+
|
|
173
|
+
if (!/{{\S*}}/.test(url)) {
|
|
174
|
+
_context.next = 8;
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (!(!options || !options.params)) {
|
|
179
|
+
_context.next = 5;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
err = new Error("\u5E26\u53C2URL(".concat(url, ")\u8BF7\u6C42\u4E2D\uFF0C\u7F3A\u5C11params\u53C2\u6570"));
|
|
184
|
+
throw err;
|
|
185
|
+
|
|
186
|
+
case 5:
|
|
187
|
+
option = options;
|
|
188
|
+
list = url.match(/{{\S*?}}/g) || [];
|
|
189
|
+
list.forEach(function (param) {
|
|
190
|
+
var key = param.replace(/[{|}]/g, '');
|
|
191
|
+
url = url.replace(param, option.params[key]);
|
|
192
|
+
delete option.params[key];
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
case 8:
|
|
196
|
+
_context.next = 10;
|
|
197
|
+
return req(url, options);
|
|
198
|
+
|
|
199
|
+
case 10:
|
|
200
|
+
res = _context.sent;
|
|
201
|
+
return _context.abrupt("return", responseErrorHandler(url, res));
|
|
202
|
+
|
|
203
|
+
case 14:
|
|
204
|
+
_context.prev = 14;
|
|
205
|
+
_context.t0 = _context["catch"](0);
|
|
206
|
+
return _context.abrupt("return", null);
|
|
207
|
+
|
|
208
|
+
case 17:
|
|
209
|
+
case "end":
|
|
210
|
+
return _context.stop();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}, _callee, null, [[0, 14]]);
|
|
214
|
+
}));
|
|
215
|
+
return _request.apply(this, arguments);
|
|
216
|
+
}
|
|
123
217
|
|
|
124
|
-
export default
|
|
218
|
+
export default request;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
"gh-pages": "^3.0.0",
|
|
57
57
|
"lint-staged": "^10.0.7",
|
|
58
58
|
"prettier": "^2.2.1",
|
|
59
|
+
"umi-request": "^1.4.0",
|
|
59
60
|
"yorkie": "^2.0.0"
|
|
60
61
|
},
|
|
61
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "31f61ad6ee6757193c95445304205616b143193b"
|
|
62
63
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { FormItemProps } from 'antd';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { DialogTypes } from '../types';
|
|
4
|
-
declare const ItemNode: React.FC<{
|
|
5
|
-
value?: any;
|
|
6
|
-
field: DialogTypes.FieldProps & FormItemProps;
|
|
7
|
-
fieldNames?: DialogTypes.FieldOption;
|
|
8
|
-
onChange?: (value: any) => void;
|
|
9
|
-
}>;
|
|
10
|
-
export default ItemNode;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { Input, Radio, Space } from 'antd';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { classPrefix } from '..';
|
|
4
|
-
import IconFont from '../../icon/iconFont';
|
|
5
|
-
import BizSelect from '../../select';
|
|
6
|
-
import BizList from './list';
|
|
7
|
-
import BizSelectToInput from './selectToInput';
|
|
8
|
-
import BizTab from './tab';
|
|
9
|
-
|
|
10
|
-
var ItemNode = function ItemNode(props) {
|
|
11
|
-
var _props$field = props.field,
|
|
12
|
-
type = _props$field.type,
|
|
13
|
-
label = _props$field.label,
|
|
14
|
-
options = _props$field.options,
|
|
15
|
-
placeholder = _props$field.placeholder,
|
|
16
|
-
extendName = _props$field.extendName,
|
|
17
|
-
direction = _props$field.direction,
|
|
18
|
-
multiple = _props$field.multiple,
|
|
19
|
-
enableSearch = _props$field.enableSearch,
|
|
20
|
-
selectType = _props$field.selectType,
|
|
21
|
-
overlayWidth = _props$field.overlayWidth,
|
|
22
|
-
extra = _props$field.extra,
|
|
23
|
-
fieldNames = props.fieldNames;
|
|
24
|
-
|
|
25
|
-
var onChange = function onChange(data) {
|
|
26
|
-
if (props.onChange) props.onChange(data);
|
|
27
|
-
if (props.field.onChange) props.field.onChange(data);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
if (type === 'input') {
|
|
31
|
-
return /*#__PURE__*/React.createElement(Input, {
|
|
32
|
-
defaultValue: props.value,
|
|
33
|
-
className: "".concat(classPrefix, "-input"),
|
|
34
|
-
placeholder: placeholder || "\u8BF7\u8F93\u5165".concat(label),
|
|
35
|
-
autoComplete: "off",
|
|
36
|
-
allowClear: {
|
|
37
|
-
clearIcon: /*#__PURE__*/React.createElement(IconFont, {
|
|
38
|
-
className: "biz-icon",
|
|
39
|
-
type: 'qingchu'
|
|
40
|
-
})
|
|
41
|
-
},
|
|
42
|
-
onChange: onChange
|
|
43
|
-
});
|
|
44
|
-
} else if (type === 'password') {
|
|
45
|
-
return /*#__PURE__*/React.createElement(Input.Password, {
|
|
46
|
-
className: "".concat(classPrefix, "-input"),
|
|
47
|
-
defaultValue: props.value,
|
|
48
|
-
placeholder: placeholder || "\u8BF7\u8F93\u5165".concat(label),
|
|
49
|
-
onChange: onChange
|
|
50
|
-
});
|
|
51
|
-
} else if (type === 'select') {
|
|
52
|
-
return /*#__PURE__*/React.createElement(BizSelect, {
|
|
53
|
-
className: "".concat(classPrefix, "-select"),
|
|
54
|
-
options: options || [],
|
|
55
|
-
defaultValue: props.value,
|
|
56
|
-
keyField: fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value,
|
|
57
|
-
labelField: fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label,
|
|
58
|
-
multiple: multiple,
|
|
59
|
-
enableSearch: enableSearch,
|
|
60
|
-
type: selectType,
|
|
61
|
-
overlayWidth: overlayWidth,
|
|
62
|
-
extra: extra,
|
|
63
|
-
onChange: onChange
|
|
64
|
-
});
|
|
65
|
-
} else if (type === 'selectToInput') {
|
|
66
|
-
return /*#__PURE__*/React.createElement(BizSelectToInput, {
|
|
67
|
-
value: props.value,
|
|
68
|
-
options: options || [],
|
|
69
|
-
keyField: fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value,
|
|
70
|
-
labelField: fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label,
|
|
71
|
-
onChange: onChange,
|
|
72
|
-
extendName: extendName
|
|
73
|
-
});
|
|
74
|
-
} else if (type === 'tab') {
|
|
75
|
-
return /*#__PURE__*/React.createElement(BizTab, {
|
|
76
|
-
value: props.value,
|
|
77
|
-
options: options,
|
|
78
|
-
onChange: onChange
|
|
79
|
-
});
|
|
80
|
-
} else if (type === 'radio') {
|
|
81
|
-
return /*#__PURE__*/React.createElement(Radio.Group, {
|
|
82
|
-
onChange: onChange,
|
|
83
|
-
defaultValue: props.value
|
|
84
|
-
}, /*#__PURE__*/React.createElement(Space, {
|
|
85
|
-
direction: direction || 'horizontal'
|
|
86
|
-
}, options && options.map(function (item) {
|
|
87
|
-
return /*#__PURE__*/React.createElement(Radio, {
|
|
88
|
-
key: item[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value],
|
|
89
|
-
value: item[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value]
|
|
90
|
-
}, item[fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label]);
|
|
91
|
-
})));
|
|
92
|
-
} else if (type === 'list') {
|
|
93
|
-
return /*#__PURE__*/React.createElement(BizList, {
|
|
94
|
-
value: props.value,
|
|
95
|
-
options: options && options.length > 0 ? options : undefined,
|
|
96
|
-
onChange: onChange
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u76F8\u5173\u7EC4\u4EF6");
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
ItemNode.defaultProps = {
|
|
104
|
-
fieldNames: {
|
|
105
|
-
label: 'label',
|
|
106
|
-
value: 'value'
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
export default ItemNode;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { BizSelectTypes } from '../../select/types';
|
|
3
|
-
import './styles/handle.less';
|
|
4
|
-
import { SelectInputProps } from '../types';
|
|
5
|
-
declare const BizSelectToInput: React.FC<BizSelectTypes.Props & SelectInputProps>;
|
|
6
|
-
export default BizSelectToInput;
|