ls-pro-common 3.0.12 → 3.0.14

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.
Files changed (116) hide show
  1. package/README.md +22 -22
  2. package/dist/common.css +121 -21
  3. package/dist/common.js +1 -1
  4. package/dist/common.min.css +121 -21
  5. package/dist/common.min.js +1 -1
  6. package/package.json +48 -48
  7. package/CHANGELOG.md +0 -746
  8. package/es/components/404.d.ts +0 -3
  9. package/es/components/404.jpg +0 -0
  10. package/es/components/404.js +0 -9
  11. package/es/components/AreaCascader.d.ts +0 -4
  12. package/es/components/AreaCascader.js +0 -76
  13. package/es/components/AreaCascaderPanel.d.ts +0 -5
  14. package/es/components/AreaCascaderPanel.js +0 -230
  15. package/es/components/DescritionCard.d.ts +0 -11
  16. package/es/components/DescritionCard.js +0 -79
  17. package/es/components/DtlLayout.d.ts +0 -44
  18. package/es/components/DtlLayout.js +0 -115
  19. package/es/components/GroupTip.d.ts +0 -10
  20. package/es/components/GroupTip.js +0 -31
  21. package/es/components/IconBack.d.ts +0 -3
  22. package/es/components/IconBack.js +0 -20
  23. package/es/components/IconBell.d.ts +0 -3
  24. package/es/components/IconBell.js +0 -22
  25. package/es/components/IconQuestion.d.ts +0 -3
  26. package/es/components/IconQuestion.js +0 -26
  27. package/es/components/IconSearch.d.ts +0 -3
  28. package/es/components/IconSearch.js +0 -22
  29. package/es/components/IconSelector.d.ts +0 -14
  30. package/es/components/IconSelector.js +0 -222
  31. package/es/components/IconText.d.ts +0 -3
  32. package/es/components/IconText.js +0 -30
  33. package/es/components/ImageSelector.d.ts +0 -31
  34. package/es/components/ImageSelector.js +0 -437
  35. package/es/components/InputMultiLine.d.ts +0 -46
  36. package/es/components/InputMultiLine.js +0 -139
  37. package/es/components/InputTable.d.ts +0 -106
  38. package/es/components/InputTable.js +0 -476
  39. package/es/components/Loading.d.ts +0 -8
  40. package/es/components/Loading.js +0 -20
  41. package/es/components/Permission.d.ts +0 -6
  42. package/es/components/Permission.js +0 -13
  43. package/es/components/antd-custom.less +0 -262
  44. package/es/components/common.less +0 -469
  45. package/es/hooks/useDtl/index.d.ts +0 -48
  46. package/es/hooks/useDtl/index.js +0 -949
  47. package/es/hooks/useGetState.d.ts +0 -1
  48. package/es/hooks/useGetState.js +0 -17
  49. package/es/hooks/usePermission/index.d.ts +0 -15
  50. package/es/hooks/usePermission/index.js +0 -58
  51. package/es/hooks/useSingle/index.d.ts +0 -55
  52. package/es/hooks/useSingle/index.js +0 -662
  53. package/es/http/index.d.ts +0 -53
  54. package/es/http/index.js +0 -305
  55. package/es/index.d.ts +0 -32
  56. package/es/index.js +0 -26
  57. package/es/service/BaseService.d.ts +0 -24
  58. package/es/service/BaseService.js +0 -214
  59. package/es/typing.d.ts +0 -53
  60. package/es/typing.js +0 -1
  61. package/es/utils/index.d.ts +0 -258
  62. package/es/utils/index.js +0 -679
  63. package/lib/components/404.d.ts +0 -3
  64. package/lib/components/404.jpg +0 -0
  65. package/lib/components/404.js +0 -17
  66. package/lib/components/AreaCascader.d.ts +0 -4
  67. package/lib/components/AreaCascader.js +0 -85
  68. package/lib/components/AreaCascaderPanel.d.ts +0 -5
  69. package/lib/components/AreaCascaderPanel.js +0 -239
  70. package/lib/components/DescritionCard.d.ts +0 -11
  71. package/lib/components/DescritionCard.js +0 -88
  72. package/lib/components/DtlLayout.d.ts +0 -44
  73. package/lib/components/DtlLayout.js +0 -124
  74. package/lib/components/GroupTip.d.ts +0 -10
  75. package/lib/components/GroupTip.js +0 -39
  76. package/lib/components/IconBack.d.ts +0 -3
  77. package/lib/components/IconBack.js +0 -28
  78. package/lib/components/IconBell.d.ts +0 -3
  79. package/lib/components/IconBell.js +0 -30
  80. package/lib/components/IconQuestion.d.ts +0 -3
  81. package/lib/components/IconQuestion.js +0 -34
  82. package/lib/components/IconSearch.d.ts +0 -3
  83. package/lib/components/IconSearch.js +0 -30
  84. package/lib/components/IconSelector.d.ts +0 -14
  85. package/lib/components/IconSelector.js +0 -230
  86. package/lib/components/IconText.d.ts +0 -3
  87. package/lib/components/IconText.js +0 -38
  88. package/lib/components/ImageSelector.d.ts +0 -31
  89. package/lib/components/ImageSelector.js +0 -445
  90. package/lib/components/InputMultiLine.d.ts +0 -46
  91. package/lib/components/InputMultiLine.js +0 -148
  92. package/lib/components/InputTable.d.ts +0 -106
  93. package/lib/components/InputTable.js +0 -485
  94. package/lib/components/Loading.d.ts +0 -8
  95. package/lib/components/Loading.js +0 -28
  96. package/lib/components/Permission.d.ts +0 -6
  97. package/lib/components/Permission.js +0 -21
  98. package/lib/components/antd-custom.less +0 -262
  99. package/lib/components/common.less +0 -469
  100. package/lib/hooks/useDtl/index.d.ts +0 -48
  101. package/lib/hooks/useDtl/index.js +0 -957
  102. package/lib/hooks/useGetState.d.ts +0 -1
  103. package/lib/hooks/useGetState.js +0 -24
  104. package/lib/hooks/usePermission/index.d.ts +0 -15
  105. package/lib/hooks/usePermission/index.js +0 -65
  106. package/lib/hooks/useSingle/index.d.ts +0 -55
  107. package/lib/hooks/useSingle/index.js +0 -670
  108. package/lib/http/index.d.ts +0 -53
  109. package/lib/http/index.js +0 -319
  110. package/lib/index.d.ts +0 -32
  111. package/lib/service/BaseService.d.ts +0 -24
  112. package/lib/service/BaseService.js +0 -222
  113. package/lib/typing.d.ts +0 -53
  114. package/lib/typing.js +0 -5
  115. package/lib/utils/index.d.ts +0 -258
  116. package/lib/utils/index.js +0 -776
@@ -1,53 +0,0 @@
1
- declare const request: import("umi-request").RequestMethod<false>;
2
- /**
3
- * get请求
4
- * @param url 接口
5
- * @param params 参数{key:value}
6
- * @param needGateWay 是否需要网关 默认为true
7
- * @returns Promise<ApiResponse>
8
- */
9
- export declare function httpGet(url: string, params?: Record<string, any>, needGateWay?: boolean): Promise<any>;
10
- /**
11
- * post请求
12
- * @param url 接口
13
- * @param data 参数{key:value}
14
- * @param isJson json请求还是form请求,默认为json请求
15
- * @param needGateWay 是否需要网关 默认为true
16
- * @returns Promise<ApiResponse>
17
- */
18
- export declare function httpPost(url: string, data?: Record<string, any>, isJson?: boolean, needGateWay?: boolean): Promise<any>;
19
- /**
20
- * put 请求
21
- * @param url 接口
22
- * @param data 参数{key:value}
23
- * @param needGateWay 是否需要网关 默认为true
24
- * @returns Promise<ApiResponse>
25
- */
26
- export declare function httpPut(url: string, data?: Record<string, any>, needGateWay?: boolean): Promise<any>;
27
- /**
28
- * delete 请求
29
- * @param url 接口
30
- * @param data 参数[]
31
- * @param needGateWay 是否需要网关 默认为true
32
- * @returns Promise<ApiResponse>
33
- */
34
- export declare function httpDelete(url: string, data: any, needGateWay?: boolean): Promise<any>;
35
- /**
36
- * 读取数据字典
37
- * @param dictCode 字典编码
38
- * @param needGateWay 是否需要网关 默认为true
39
- * @returns Promise<Record<string,string>>
40
- */
41
- export declare function getDict(dictCode: string, showValue?: boolean, needGateWay?: boolean): Promise<any>;
42
- /**
43
- * 加载下拉框的数据源
44
- * @param url 后端接口
45
- * @param param 请求参数
46
- * @param valueField 值字段
47
- * @param labelField 显示字段
48
- * @param showValue 显示值
49
- * @param needGateWay 是否需要网关 默认为true
50
- * @returns
51
- */
52
- export declare function fetchOptions(url: string, param: any, valueField: string, labelField: string, showValue?: boolean, needGateWay?: boolean): Promise<any>;
53
- export default request;
package/lib/http/index.js DELETED
@@ -1,319 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- exports.fetchOptions = fetchOptions;
9
- exports.getDict = getDict;
10
- exports.httpDelete = httpDelete;
11
- exports.httpGet = httpGet;
12
- exports.httpPost = httpPost;
13
- exports.httpPut = httpPut;
14
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
15
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
16
- var _umiRequest = require("umi-request");
17
- var _utils = require("../utils");
18
- //默认超时时间为1分钟
19
- var request = (0, _umiRequest.extend)({
20
- timeout: 60000
21
- });
22
- var httpStatus = {
23
- 404: '请求的服务不存在',
24
- 429: '请求的服务繁忙',
25
- 502: '请求的服务网关出错',
26
- 503: '请求的服务器异常',
27
- 504: '请求服务超时'
28
- };
29
- /** 请求拦截器,统一添加token */
30
- request.interceptors.request.use(function (url, options) {
31
- var token = (0, _utils.getCookie)("token");
32
- options.headers = options.headers || {};
33
- // 处理 token
34
- if (token && url.indexOf('noToken=1') === -1) {
35
- options.headers['token'] = token;
36
- }
37
- // 处理门店
38
- var shopNo = (0, _utils.getCache)('shopNo', true) || (0, _utils.getCache)('shopNo');
39
- if (shopNo) {
40
- options.headers["shopNo"] = shopNo;
41
- }
42
- // 处理门店
43
- var shopCode = (0, _utils.getCache)('shopCode', true) || (0, _utils.getCache)('shopCode');
44
- if (shopCode) {
45
- options.headers["shopCode"] = shopCode;
46
- }
47
- // 处理仓库
48
- var storeNo = (0, _utils.getCache)('storeNo', true) || (0, _utils.getCache)('storeNo');
49
- if (storeNo) {
50
- options.headers["storeNo"] = storeNo;
51
- }
52
- var tag = (0, _utils.getCookie)('x-asm-prefer-tag');
53
- if (tag) {
54
- options.headers['x-asm-prefer-tag'] = tag;
55
- }
56
- url = url.replace('&noToken=1', '').replace('noToken=1', '');
57
- var param = {
58
- resCode: (0, _utils.getUrlQuery)('resCode') || (0, _utils.getUrlQuery)('resourceId') || (0, _utils.getResourceProps)('resourceId'),
59
- _t1: Date.now()
60
- };
61
- if (!param.resCode) {
62
- delete param.resCode;
63
- }
64
- url = (0, _utils.setUrlQuery)(url, param);
65
- return {
66
- url: url,
67
- options: options
68
- };
69
- });
70
- /** 请求返回拦截器,统一处理业务异常 */
71
- request.interceptors.response.use( /*#__PURE__*/function () {
72
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(response, options) {
73
- var noMsg, _data$flag, _data$flag2, _data$flag3, _data$flag4, data, retCode, retMsg, requestId, faultCode, text, _text, _data$flag5, _data$flag6, _data$flag7, _data$flag8, _data, _retCode, _retMsg, status, _requestId, _faultCode;
74
- return _regenerator.default.wrap(function _callee$(_context) {
75
- while (1) switch (_context.prev = _context.next) {
76
- case 0:
77
- noMsg = (0, _utils.getUrlQuery)('noMsg', options.url); // http 状态码错误
78
- if (!(response.status < 200 || response.status >= 300)) {
79
- _context.next = 20;
80
- break;
81
- }
82
- _context.prev = 2;
83
- _context.next = 5;
84
- return response.clone().json();
85
- case 5:
86
- data = _context.sent;
87
- retCode = (_data$flag = data.flag) === null || _data$flag === void 0 ? void 0 : _data$flag.retCode;
88
- retMsg = (_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retMsg;
89
- requestId = (_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.requestId;
90
- faultCode = (_data$flag4 = data.flag) === null || _data$flag4 === void 0 ? void 0 : _data$flag4.faultCode;
91
- if (retCode === 'timeout' || retCode === '4011') {
92
- (0, _utils.reLogin)();
93
- } else if (noMsg !== '1') {
94
- if (faultCode) {
95
- (0, _utils.httpError)(retMsg, retCode, faultCode, options.url);
96
- } else {
97
- text = httpStatus[response.status];
98
- if (response.status === 503 && response.statusText === 'no healthy upstream') {
99
- text = '请求的服务未启动';
100
- } else if (response.status === 503 && response.statusText === 'reached concurrency limit') {
101
- text = '请求的服务被限流';
102
- }
103
- (0, _utils.showError)(text || retMsg);
104
- }
105
- }
106
- _context.next = 18;
107
- break;
108
- case 13:
109
- _context.prev = 13;
110
- _context.t0 = _context["catch"](2);
111
- _text = httpStatus[response.status];
112
- if (response.status === 503 && response.statusText === 'no healthy upstream') {
113
- _text = '请求的服务未启动';
114
- } else if (response.status === 503 && response.statusText === 'reached concurrency limit') {
115
- _text = '请求的服务被限流';
116
- }
117
- (0, _utils.showError)(_text || _context.t0.message || response.statusText);
118
- case 18:
119
- _context.next = 30;
120
- break;
121
- case 20:
122
- if (!(noMsg !== '1')) {
123
- _context.next = 30;
124
- break;
125
- }
126
- _context.next = 23;
127
- return response.clone().json();
128
- case 23:
129
- _data = _context.sent;
130
- _retCode = (_data === null || _data === void 0 ? void 0 : (_data$flag5 = _data.flag) === null || _data$flag5 === void 0 ? void 0 : _data$flag5.retCode) || '0';
131
- _retMsg = ((_data$flag6 = _data.flag) === null || _data$flag6 === void 0 ? void 0 : _data$flag6.retMsg) || '请求的服务出错';
132
- status = ((0, _utils.getUrlQuery)('apiStatus') || '0').split(',');
133
- _requestId = (_data$flag7 = _data.flag) === null || _data$flag7 === void 0 ? void 0 : _data$flag7.requestId;
134
- _faultCode = (_data$flag8 = _data.flag) === null || _data$flag8 === void 0 ? void 0 : _data$flag8.faultCode;
135
- if (_retCode && !status.includes(_retCode)) {
136
- if (_retCode === 'timeout' || _retCode === '4011') {
137
- if (!(0, _utils.getCookie)("token")) {
138
- (window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
139
- } else {
140
- (0, _utils.reLogin)();
141
- }
142
- } else {
143
- if (_faultCode) {
144
- (0, _utils.httpError)(_retMsg, _retCode, _faultCode, options.url);
145
- } else {
146
- (0, _utils.showError)(_retMsg);
147
- }
148
- }
149
- }
150
- case 30:
151
- return _context.abrupt("return", response);
152
- case 31:
153
- case "end":
154
- return _context.stop();
155
- }
156
- }, _callee, null, [[2, 13]]);
157
- }));
158
- return function (_x, _x2) {
159
- return _ref.apply(this, arguments);
160
- };
161
- }());
162
- function ajax(url) {
163
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
164
- var type = arguments.length > 2 ? arguments[2] : undefined;
165
- var needGateWay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
166
- var isJson = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
167
- if (needGateWay) {
168
- url = (0, _utils.toGatewayUrl)(url);
169
- }
170
- var loadText = (0, _utils.getUrlQuery)('_loading', url);
171
- if (loadText) {
172
- (0, _utils.showLoading)(loadText);
173
- url = (0, _utils.setUrlQuery)(url, {
174
- _loading: ''
175
- }).replace('&_loading=', '').replace('_loading=', '');
176
- }
177
- if (type === 'get') {
178
- return request.get(url, {
179
- params: params
180
- }).finally(function () {
181
- return (0, _utils.exitLoading)();
182
- });
183
- } else if (type === 'delete') {
184
- return request.delete(url, {
185
- data: params
186
- }).finally(function () {
187
- return (0, _utils.exitLoading)();
188
- });
189
- } else if (type === 'put') {
190
- return request.put(url, {
191
- data: params
192
- }).finally(function () {
193
- return (0, _utils.exitLoading)();
194
- });
195
- } else {
196
- return request.post(url, {
197
- data: params,
198
- requestType: isJson ? 'json' : 'form'
199
- }).finally(function () {
200
- return (0, _utils.exitLoading)();
201
- });
202
- }
203
- }
204
- /**
205
- * get请求
206
- * @param url 接口
207
- * @param params 参数{key:value}
208
- * @param needGateWay 是否需要网关 默认为true
209
- * @returns Promise<ApiResponse>
210
- */
211
- function httpGet(url) {
212
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
213
- var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
214
- return ajax(url, params, 'get', needGateWay);
215
- }
216
- /**
217
- * post请求
218
- * @param url 接口
219
- * @param data 参数{key:value}
220
- * @param isJson json请求还是form请求,默认为json请求
221
- * @param needGateWay 是否需要网关 默认为true
222
- * @returns Promise<ApiResponse>
223
- */
224
- function httpPost(url) {
225
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
226
- var isJson = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
227
- var needGateWay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
228
- return ajax(url, data, 'post', needGateWay, isJson);
229
- }
230
- /**
231
- * put 请求
232
- * @param url 接口
233
- * @param data 参数{key:value}
234
- * @param needGateWay 是否需要网关 默认为true
235
- * @returns Promise<ApiResponse>
236
- */
237
- function httpPut(url) {
238
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
239
- var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
240
- return ajax(url, data, 'put', needGateWay);
241
- }
242
- /**
243
- * delete 请求
244
- * @param url 接口
245
- * @param data 参数[]
246
- * @param needGateWay 是否需要网关 默认为true
247
- * @returns Promise<ApiResponse>
248
- */
249
- function httpDelete(url, data) {
250
- var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
251
- return ajax(url, data, 'delete', needGateWay);
252
- }
253
- /**
254
- * 读取数据字典
255
- * @param dictCode 字典编码
256
- * @param needGateWay 是否需要网关 默认为true
257
- * @returns Promise<Record<string,string>>
258
- */
259
- function getDict(dictCode) {
260
- var showValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
261
- var needGateWay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
262
- var api = '/lesoon-integration/sysDictDtl/listByProperties';
263
- var param = {
264
- dictCode: dictCode
265
- };
266
- return fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay);
267
- }
268
- /**
269
- * 加载下拉框的数据源
270
- * @param url 后端接口
271
- * @param param 请求参数
272
- * @param valueField 值字段
273
- * @param labelField 显示字段
274
- * @param showValue 显示值
275
- * @param needGateWay 是否需要网关 默认为true
276
- * @returns
277
- */
278
- function fetchOptions(_x3, _x4, _x5, _x6) {
279
- return _fetchOptions.apply(this, arguments);
280
- }
281
- function _fetchOptions() {
282
- _fetchOptions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(url, param, valueField, labelField) {
283
- var showValue,
284
- needGateWay,
285
- _yield$httpGet,
286
- _yield$httpGet$rows,
287
- rows,
288
- data,
289
- _args2 = arguments;
290
- return _regenerator.default.wrap(function _callee2$(_context2) {
291
- while (1) switch (_context2.prev = _context2.next) {
292
- case 0:
293
- showValue = _args2.length > 4 && _args2[4] !== undefined ? _args2[4] : true;
294
- needGateWay = _args2.length > 5 && _args2[5] !== undefined ? _args2[5] : true;
295
- _context2.next = 4;
296
- return httpGet(url, param, needGateWay);
297
- case 4:
298
- _yield$httpGet = _context2.sent;
299
- _yield$httpGet$rows = _yield$httpGet.rows;
300
- rows = _yield$httpGet$rows === void 0 ? [] : _yield$httpGet$rows;
301
- data = (rows || []).map(function (o) {
302
- return {
303
- value: o[valueField],
304
- text: o[labelField],
305
- label: (showValue ? o[valueField] + '→' : '') + o[labelField],
306
- status: o.status
307
- };
308
- });
309
- return _context2.abrupt("return", data);
310
- case 9:
311
- case "end":
312
- return _context2.stop();
313
- }
314
- }, _callee2);
315
- }));
316
- return _fetchOptions.apply(this, arguments);
317
- }
318
- var _default = request;
319
- exports.default = _default;
package/lib/index.d.ts DELETED
@@ -1,32 +0,0 @@
1
- import DtlLayout from './components/DtlLayout';
2
- import InputTable from './components/InputTable';
3
- import Page404 from './components/404';
4
- import Loading from './components/Loading';
5
- import IconSelector from './components/IconSelector';
6
- import ImageSelector from './components/ImageSelector';
7
- import InputMultiLine from './components/InputMultiLine';
8
- import AreaCascader from './components/AreaCascader';
9
- import AreaCascaderPanel from './components/AreaCascaderPanel';
10
- import DescritionCard from './components/DescritionCard';
11
- import Permission from './components/Permission';
12
- import GroupTip from './components/GroupTip';
13
- import IconBack from './components/IconBack';
14
- import IconText from './components/IconText';
15
- import IconQuestion from './components/IconQuestion';
16
- import IconBell from './components/IconBell';
17
- import IconSearch from './components/IconSearch';
18
- import BaseService from './service/BaseService';
19
- import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
20
- import * as utils from './utils';
21
- /** Hooks */
22
- import useSingle from './hooks/useSingle';
23
- import useDtl from './hooks/useDtl';
24
- import usePermission from './hooks/usePermission';
25
- import useGetState from './hooks/useGetState';
26
- /** Type */
27
- import type { ApiResponse, TableToolbar, BaseApiType, MethodType } from './typing';
28
- import type { DtlLyaoutProps } from './components/DtlLayout';
29
- import type { DescritionCardProps } from './components/DescritionCard';
30
- import type { PermissionProps } from './components/Permission';
31
- export type { ApiResponse, TableToolbar, BaseApiType, MethodType, DtlLyaoutProps, DescritionCardProps, PermissionProps };
32
- export { DtlLayout, InputTable, Page404, Loading, IconSelector, ImageSelector, InputMultiLine, AreaCascader, AreaCascaderPanel, DescritionCard, Permission, GroupTip, IconBack, IconText, IconBell, IconQuestion, IconSearch, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission, useGetState };
@@ -1,24 +0,0 @@
1
- import type { BaseApiType, MethodType } from '../typing';
2
- /** 基本增删改查服务 */
3
- declare class BaseService {
4
- /** 定义每个服务的api */
5
- api: BaseApiType;
6
- /** 定义每个服务接口对应的请求方法,默认为 restful */
7
- method: MethodType;
8
- /** 加载数据方法 @param param 请求参数对象 */
9
- load(param: Record<string, any>): Promise<any>;
10
- /** 保存数据方法 @param data 对象数据,当存在id时即为更改 */
11
- save(data: Record<string, any>): Promise<any>;
12
- saveMstDtl(data: {
13
- opType: 'inserted' | 'updated' | 'deleted';
14
- master: any;
15
- idName: string;
16
- billType?: string;
17
- codeRuleDynamicField?: string;
18
- details?: any;
19
- }): Promise<any>;
20
- /** 批量删除对象方法,@param data id集合 */
21
- remove(data: any[]): Promise<any>;
22
- audit(data: any[]): Promise<any>;
23
- }
24
- export default BaseService;
@@ -1,222 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
- require("antd/es/message/style");
10
- var _message2 = _interopRequireDefault(require("antd/es/message"));
11
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
14
- var _http = require("../http");
15
- /** 基本增删改查服务 */
16
- var BaseService = /*#__PURE__*/function () {
17
- function BaseService() {
18
- (0, _classCallCheck2.default)(this, BaseService);
19
- /** 定义每个服务的api */
20
- this.api = {};
21
- /** 定义每个服务接口对应的请求方法,默认为 restful */
22
- this.method = {
23
- get: 'get',
24
- edit: 'put',
25
- delete: 'delete'
26
- };
27
- }
28
- (0, _createClass2.default)(BaseService, [{
29
- key: "load",
30
- value: /** 加载数据方法 @param param 请求参数对象 */function () {
31
- var _load = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(param) {
32
- var _this$api;
33
- var url;
34
- return _regenerator.default.wrap(function _callee$(_context) {
35
- while (1) switch (_context.prev = _context.next) {
36
- case 0:
37
- url = (_this$api = this.api) === null || _this$api === void 0 ? void 0 : _this$api.load;
38
- if (url) {
39
- _context.next = 4;
40
- break;
41
- }
42
- _message2.default.error("加载方法没有配置api");
43
- return _context.abrupt("return", Promise.reject("加载方法没有配置api"));
44
- case 4:
45
- if (!(this.method.get === 'post')) {
46
- _context.next = 8;
47
- break;
48
- }
49
- _context.next = 7;
50
- return (0, _http.httpPost)(url, param);
51
- case 7:
52
- return _context.abrupt("return", _context.sent);
53
- case 8:
54
- _context.next = 10;
55
- return (0, _http.httpGet)(url, param);
56
- case 10:
57
- return _context.abrupt("return", _context.sent);
58
- case 11:
59
- case "end":
60
- return _context.stop();
61
- }
62
- }, _callee, this);
63
- }));
64
- function load(_x) {
65
- return _load.apply(this, arguments);
66
- }
67
- return load;
68
- }() /** 保存数据方法 @param data 对象数据,当存在id时即为更改 */
69
- }, {
70
- key: "save",
71
- value: function () {
72
- var _save = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(data) {
73
- var _this$api2;
74
- var url;
75
- return _regenerator.default.wrap(function _callee2$(_context2) {
76
- while (1) switch (_context2.prev = _context2.next) {
77
- case 0:
78
- url = (_this$api2 = this.api) === null || _this$api2 === void 0 ? void 0 : _this$api2.add;
79
- if (data.id && this.api.edit) {
80
- url = this.api.edit;
81
- }
82
- if (url) {
83
- _context2.next = 5;
84
- break;
85
- }
86
- _message2.default.error("保存方法没有配置api");
87
- return _context2.abrupt("return", Promise.reject("保存方法没有配置api"));
88
- case 5:
89
- if (!(data.id && this.method.edit === 'put')) {
90
- _context2.next = 9;
91
- break;
92
- }
93
- _context2.next = 8;
94
- return (0, _http.httpPut)(url, data);
95
- case 8:
96
- return _context2.abrupt("return", _context2.sent);
97
- case 9:
98
- _context2.next = 11;
99
- return (0, _http.httpPost)(url, data);
100
- case 11:
101
- return _context2.abrupt("return", _context2.sent);
102
- case 12:
103
- case "end":
104
- return _context2.stop();
105
- }
106
- }, _callee2, this);
107
- }));
108
- function save(_x2) {
109
- return _save.apply(this, arguments);
110
- }
111
- return save;
112
- }()
113
- }, {
114
- key: "saveMstDtl",
115
- value: function () {
116
- var _saveMstDtl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(data) {
117
- var _this$api3;
118
- var url;
119
- return _regenerator.default.wrap(function _callee3$(_context3) {
120
- while (1) switch (_context3.prev = _context3.next) {
121
- case 0:
122
- url = (_this$api3 = this.api) === null || _this$api3 === void 0 ? void 0 : _this$api3.mstDtl;
123
- if (url) {
124
- _context3.next = 4;
125
- break;
126
- }
127
- _message2.default.error("主从一起保存方法没有配置api");
128
- return _context3.abrupt("return", Promise.reject("主从一起保存方法没有配置api"));
129
- case 4:
130
- _context3.next = 6;
131
- return (0, _http.httpPost)(url, data);
132
- case 6:
133
- return _context3.abrupt("return", _context3.sent);
134
- case 7:
135
- case "end":
136
- return _context3.stop();
137
- }
138
- }, _callee3, this);
139
- }));
140
- function saveMstDtl(_x3) {
141
- return _saveMstDtl.apply(this, arguments);
142
- }
143
- return saveMstDtl;
144
- }() /** 批量删除对象方法,@param data id集合 */
145
- }, {
146
- key: "remove",
147
- value: function () {
148
- var _remove = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(data) {
149
- var _this$api4;
150
- var url;
151
- return _regenerator.default.wrap(function _callee4$(_context4) {
152
- while (1) switch (_context4.prev = _context4.next) {
153
- case 0:
154
- url = (_this$api4 = this.api) === null || _this$api4 === void 0 ? void 0 : _this$api4.delete;
155
- if (url) {
156
- _context4.next = 4;
157
- break;
158
- }
159
- _message2.default.error("删除方法没有配置api");
160
- return _context4.abrupt("return", Promise.reject("删除方法没有配置api"));
161
- case 4:
162
- if (!(this.method.delete === 'post')) {
163
- _context4.next = 8;
164
- break;
165
- }
166
- _context4.next = 7;
167
- return (0, _http.httpPost)(url, data);
168
- case 7:
169
- return _context4.abrupt("return", _context4.sent);
170
- case 8:
171
- _context4.next = 10;
172
- return (0, _http.httpDelete)(url, data);
173
- case 10:
174
- return _context4.abrupt("return", _context4.sent);
175
- case 11:
176
- case "end":
177
- return _context4.stop();
178
- }
179
- }, _callee4, this);
180
- }));
181
- function remove(_x4) {
182
- return _remove.apply(this, arguments);
183
- }
184
- return remove;
185
- }()
186
- }, {
187
- key: "audit",
188
- value: function () {
189
- var _audit = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(data) {
190
- var _this$api5;
191
- var url;
192
- return _regenerator.default.wrap(function _callee5$(_context5) {
193
- while (1) switch (_context5.prev = _context5.next) {
194
- case 0:
195
- url = (_this$api5 = this.api) === null || _this$api5 === void 0 ? void 0 : _this$api5.audit;
196
- if (url) {
197
- _context5.next = 4;
198
- break;
199
- }
200
- _message2.default.error("审核方法没有配置api");
201
- return _context5.abrupt("return", Promise.reject("审核方法没有配置api"));
202
- case 4:
203
- _context5.next = 6;
204
- return (0, _http.httpPost)(url, data);
205
- case 6:
206
- return _context5.abrupt("return", _context5.sent);
207
- case 7:
208
- case "end":
209
- return _context5.stop();
210
- }
211
- }, _callee5, this);
212
- }));
213
- function audit(_x5) {
214
- return _audit.apply(this, arguments);
215
- }
216
- return audit;
217
- }()
218
- }]);
219
- return BaseService;
220
- }();
221
- var _default = BaseService;
222
- exports.default = _default;