ls-pro-common 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/dist/common.css +2222 -0
- package/dist/common.js +1 -1
- package/dist/common.js.LICENSE.txt +24 -0
- package/dist/common.min.css +2222 -0
- package/dist/common.min.js +1 -1
- package/dist/common.min.js.LICENSE.txt +24 -0
- package/es/components/InputTable.d.ts +18 -0
- package/es/components/InputTable.js +225 -0
- package/es/hooks/useDtl/index.d.ts +2 -0
- package/es/hooks/useDtl/index.js +85 -2
- package/es/hooks/useSingle/index.d.ts +2 -0
- package/es/hooks/useSingle/index.js +122 -22
- package/es/http/index.js +2 -2
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/utils/index.d.ts +7 -0
- package/es/utils/index.js +15 -2
- package/lib/components/InputTable.d.ts +18 -0
- package/lib/components/InputTable.js +254 -0
- package/lib/hooks/useDtl/index.d.ts +2 -0
- package/lib/hooks/useDtl/index.js +85 -1
- package/lib/hooks/useSingle/index.d.ts +2 -0
- package/lib/hooks/useSingle/index.js +122 -21
- package/lib/http/index.js +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +8 -0
- package/lib/utils/index.d.ts +7 -0
- package/lib/utils/index.js +20 -4
- package/package.json +3 -3
package/es/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import DtlLayout from './components/DtlLayout';
|
|
2
|
+
import InputTable from './components/InputTable';
|
|
2
3
|
import BaseService from './service/BaseService';
|
|
3
4
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
4
5
|
import * as utils from './utils';
|
|
@@ -9,4 +10,4 @@ import useDtl from './hooks/useDtl';
|
|
|
9
10
|
import type { ApiResponse, TableToolbar, BaseApiType, MethodType } from './typing';
|
|
10
11
|
import type { DtlLyaoutProps } from './components/DtlLayout';
|
|
11
12
|
export type { ApiResponse, TableToolbar, BaseApiType, MethodType, DtlLyaoutProps };
|
|
12
|
-
export { DtlLayout, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl };
|
|
13
|
+
export { DtlLayout, InputTable, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl };
|
package/es/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import DtlLayout from './components/DtlLayout';
|
|
2
|
+
import InputTable from './components/InputTable';
|
|
2
3
|
import BaseService from './service/BaseService';
|
|
3
4
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
4
5
|
import * as utils from './utils';
|
|
@@ -6,4 +7,4 @@ import * as utils from './utils';
|
|
|
6
7
|
|
|
7
8
|
import useSingle from './hooks/useSingle';
|
|
8
9
|
import useDtl from './hooks/useDtl';
|
|
9
|
-
export { DtlLayout, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl };
|
|
10
|
+
export { DtlLayout, InputTable, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl };
|
package/es/utils/index.d.ts
CHANGED
|
@@ -6,6 +6,13 @@ export declare const getUrlQuery: (name: string, url?: string) => string;
|
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
8
|
export declare const setUrlQuery: (url: string, keyvals?: Record<string, any>) => string;
|
|
9
|
+
/**
|
|
10
|
+
* 给 url 添加网关
|
|
11
|
+
* @param url 原url,以 / 打头
|
|
12
|
+
* @param defGateway 默认网关 /petrel
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare const toGatewayUrl: (url: string, defGateway?: string) => string;
|
|
9
16
|
/**
|
|
10
17
|
* 设置文档title
|
|
11
18
|
* @param {*} title
|
package/es/utils/index.js
CHANGED
|
@@ -38,6 +38,19 @@ export var setUrlQuery = function setUrlQuery(url) {
|
|
|
38
38
|
|
|
39
39
|
return newUrl;
|
|
40
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* 给 url 添加网关
|
|
43
|
+
* @param url 原url,以 / 打头
|
|
44
|
+
* @param defGateway 默认网关 /petrel
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
export var toGatewayUrl = function toGatewayUrl(url) {
|
|
49
|
+
var defGateway = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '/petrel';
|
|
50
|
+
if (url.startsWith('http://') || url.startsWith('https://') || url.startsWith('//')) return url;
|
|
51
|
+
var gateway = getUrlQuery('gateway') || location.origin + defGateway;
|
|
52
|
+
return gateway + url;
|
|
53
|
+
};
|
|
41
54
|
/**
|
|
42
55
|
* 设置文档title
|
|
43
56
|
* @param {*} title
|
|
@@ -216,9 +229,9 @@ export var treeEach = function treeEach(list, fn) {
|
|
|
216
229
|
list.forEach(function (item, index) {
|
|
217
230
|
fn(item, index, list); // @ts-ignore
|
|
218
231
|
|
|
219
|
-
if (Array.isArray(
|
|
232
|
+
if (Array.isArray(item[children]) && item[children].length) {
|
|
220
233
|
// @ts-ignore
|
|
221
|
-
treeEach(
|
|
234
|
+
treeEach(item[children], fn, children);
|
|
222
235
|
}
|
|
223
236
|
});
|
|
224
237
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { InputProps } from 'antd';
|
|
3
|
+
import type { ProFormItemProps } from 'ls-pro-form';
|
|
4
|
+
export declare type InputTableProps = ProFormItemProps<InputProps> & {
|
|
5
|
+
columns: any[];
|
|
6
|
+
url: string;
|
|
7
|
+
tableHeight?: number;
|
|
8
|
+
tableWidth?: number;
|
|
9
|
+
multiple?: boolean;
|
|
10
|
+
name: string;
|
|
11
|
+
valueField: string;
|
|
12
|
+
textField?: string;
|
|
13
|
+
textName?: string;
|
|
14
|
+
tableConfig?: any;
|
|
15
|
+
onSelectChange?: (item: any) => void;
|
|
16
|
+
};
|
|
17
|
+
declare function InputTable(prop: InputTableProps): JSX.Element;
|
|
18
|
+
export default InputTable;
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
require("antd/es/input/style");
|
|
13
|
+
|
|
14
|
+
var _input = _interopRequireDefault(require("antd/es/input"));
|
|
15
|
+
|
|
16
|
+
require("antd/es/popover/style");
|
|
17
|
+
|
|
18
|
+
var _popover = _interopRequireDefault(require("antd/es/popover"));
|
|
19
|
+
|
|
20
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
21
|
+
|
|
22
|
+
require("antd/es/button/style");
|
|
23
|
+
|
|
24
|
+
var _button = _interopRequireDefault(require("antd/es/button"));
|
|
25
|
+
|
|
26
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
27
|
+
|
|
28
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
29
|
+
|
|
30
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
31
|
+
|
|
32
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
33
|
+
|
|
34
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
35
|
+
|
|
36
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
37
|
+
|
|
38
|
+
var _lsProTable = _interopRequireDefault(require("ls-pro-table"));
|
|
39
|
+
|
|
40
|
+
var _lsProForm = require("ls-pro-form");
|
|
41
|
+
|
|
42
|
+
var _icons = require("@ant-design/icons");
|
|
43
|
+
|
|
44
|
+
var _http = require("../http");
|
|
45
|
+
|
|
46
|
+
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "textField", "onSelectChange"],
|
|
47
|
+
_excluded2 = ["current", "pageSize"];
|
|
48
|
+
|
|
49
|
+
function InputTable(prop) {
|
|
50
|
+
//@ts-ignore
|
|
51
|
+
var _useContext = (0, _react.useContext)(_lsProForm.ProFormContext),
|
|
52
|
+
formRef = _useContext.formRef;
|
|
53
|
+
|
|
54
|
+
var tableRef = (0, _react.useRef)();
|
|
55
|
+
|
|
56
|
+
var _useState = (0, _react.useState)(false),
|
|
57
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
58
|
+
visible = _useState2[0],
|
|
59
|
+
setVisible = _useState2[1];
|
|
60
|
+
|
|
61
|
+
var _useState3 = (0, _react.useState)([]),
|
|
62
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
63
|
+
selectedRows = _useState4[0],
|
|
64
|
+
setSelectedRows = _useState4[1];
|
|
65
|
+
|
|
66
|
+
var _useState5 = (0, _react.useState)(''),
|
|
67
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
68
|
+
text = _useState6[0],
|
|
69
|
+
setText = _useState6[1];
|
|
70
|
+
|
|
71
|
+
var columns = prop.columns,
|
|
72
|
+
url = prop.url,
|
|
73
|
+
textName = prop.textName,
|
|
74
|
+
name = prop.name,
|
|
75
|
+
tableConfig = prop.tableConfig,
|
|
76
|
+
_prop$tableHeight = prop.tableHeight,
|
|
77
|
+
tableHeight = _prop$tableHeight === void 0 ? 400 : _prop$tableHeight,
|
|
78
|
+
_prop$tableWidth = prop.tableWidth,
|
|
79
|
+
tableWidth = _prop$tableWidth === void 0 ? 650 : _prop$tableWidth,
|
|
80
|
+
_prop$readonly = prop.readonly,
|
|
81
|
+
readonly = _prop$readonly === void 0 ? true : _prop$readonly,
|
|
82
|
+
multiple = prop.multiple,
|
|
83
|
+
valueField = prop.valueField,
|
|
84
|
+
textField = prop.textField,
|
|
85
|
+
onSelectChange = prop.onSelectChange,
|
|
86
|
+
rest = (0, _objectWithoutProperties2.default)(prop, _excluded);
|
|
87
|
+
var textNameProp = textName || name + '__text';
|
|
88
|
+
|
|
89
|
+
var loadData = /*#__PURE__*/function () {
|
|
90
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(param) {
|
|
91
|
+
var current, pageSize, rest, data, result;
|
|
92
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
93
|
+
while (1) {
|
|
94
|
+
switch (_context.prev = _context.next) {
|
|
95
|
+
case 0:
|
|
96
|
+
current = param.current, pageSize = param.pageSize, rest = (0, _objectWithoutProperties2.default)(param, _excluded2);
|
|
97
|
+
data = {
|
|
98
|
+
page: current,
|
|
99
|
+
pageSize: pageSize
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
if (Object.keys(rest).length) {
|
|
103
|
+
data.where = rest;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
_context.next = 5;
|
|
107
|
+
return (0, _http.httpGet)(url, data);
|
|
108
|
+
|
|
109
|
+
case 5:
|
|
110
|
+
result = _context.sent;
|
|
111
|
+
return _context.abrupt("return", {
|
|
112
|
+
data: result.rows || [],
|
|
113
|
+
total: result.total || 0,
|
|
114
|
+
success: true
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
case 7:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context.stop();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}, _callee);
|
|
123
|
+
}));
|
|
124
|
+
|
|
125
|
+
return function loadData(_x) {
|
|
126
|
+
return _ref.apply(this, arguments);
|
|
127
|
+
};
|
|
128
|
+
}();
|
|
129
|
+
|
|
130
|
+
(0, _react.useEffect)(function () {
|
|
131
|
+
var _formRef$current;
|
|
132
|
+
|
|
133
|
+
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.getFieldsValue();
|
|
134
|
+
var txt = formValue[textField || valueField];
|
|
135
|
+
|
|
136
|
+
if (txt) {
|
|
137
|
+
setText(txt);
|
|
138
|
+
}
|
|
139
|
+
}, []);
|
|
140
|
+
|
|
141
|
+
var tableDom = /*#__PURE__*/_react.default.createElement(_lsProTable.default, (0, _extends2.default)({
|
|
142
|
+
columns: columns,
|
|
143
|
+
request: loadData,
|
|
144
|
+
rowKey: valueField,
|
|
145
|
+
manualRequest: false,
|
|
146
|
+
actionRef: tableRef,
|
|
147
|
+
search: {
|
|
148
|
+
labelWidth: 70
|
|
149
|
+
},
|
|
150
|
+
options: {
|
|
151
|
+
density: false,
|
|
152
|
+
reload: false,
|
|
153
|
+
setting: false
|
|
154
|
+
},
|
|
155
|
+
form: {
|
|
156
|
+
submitter: {
|
|
157
|
+
resetButtonProps: false
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
height: 'full',
|
|
161
|
+
rowSelection: {
|
|
162
|
+
type: multiple ? 'checkbox' : 'radio',
|
|
163
|
+
onChange: function onChange(keys, rows) {
|
|
164
|
+
setSelectedRows(rows);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
tableAlertRender: false,
|
|
168
|
+
onRow: function onRow(record) {
|
|
169
|
+
return {
|
|
170
|
+
onDoubleClick: function onDoubleClick() {
|
|
171
|
+
var _formRef$current2, _formRef$current3;
|
|
172
|
+
|
|
173
|
+
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.getFieldsValue();
|
|
174
|
+
formValue[name] = record[valueField];
|
|
175
|
+
setText(record[textField || valueField]); // 如果需要接收名称(指定了名称属性名),则反回名称
|
|
176
|
+
|
|
177
|
+
if (textName) {
|
|
178
|
+
formValue[textNameProp] = record[textField || valueField];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
(_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
182
|
+
setVisible(false);
|
|
183
|
+
onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(record);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
toolBarRender: function toolBarRender() {
|
|
188
|
+
return [/*#__PURE__*/_react.default.createElement(_button.default, {
|
|
189
|
+
onClick: function onClick() {
|
|
190
|
+
if (selectedRows.length) {
|
|
191
|
+
var _formRef$current4, _formRef$current5;
|
|
192
|
+
|
|
193
|
+
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : _formRef$current4.getFieldsValue();
|
|
194
|
+
formValue[name] = selectedRows.map(function (o) {
|
|
195
|
+
return o[valueField];
|
|
196
|
+
}).join(',');
|
|
197
|
+
var txt = selectedRows.map(function (o) {
|
|
198
|
+
return o[textField || valueField];
|
|
199
|
+
}).join(',');
|
|
200
|
+
setText(txt); // 如果需要接收名称,则反回名称
|
|
201
|
+
|
|
202
|
+
if (textName) {
|
|
203
|
+
formValue[textNameProp] = txt;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
(_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : _formRef$current5.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
setVisible(false);
|
|
210
|
+
}
|
|
211
|
+
}, "\u786E\u8BA4")];
|
|
212
|
+
},
|
|
213
|
+
headerTitle: "\u53CC\u51FB\u8FD4\u56DE\u5F53\u524D\u884C\u6570\u636E"
|
|
214
|
+
}, tableConfig));
|
|
215
|
+
|
|
216
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
217
|
+
style: {
|
|
218
|
+
display: 'none'
|
|
219
|
+
}
|
|
220
|
+
}, /*#__PURE__*/_react.default.createElement(_lsProForm.ProFormText, {
|
|
221
|
+
name: name
|
|
222
|
+
})), /*#__PURE__*/_react.default.createElement(_lsProForm.ProFormText, (0, _extends2.default)({
|
|
223
|
+
name: textNameProp
|
|
224
|
+
}, rest), /*#__PURE__*/_react.default.createElement(_input.default, {
|
|
225
|
+
suffix: /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
226
|
+
content: /*#__PURE__*/_react.default.createElement("div", {
|
|
227
|
+
style: {
|
|
228
|
+
width: tableWidth + 'px',
|
|
229
|
+
height: tableHeight + 'px',
|
|
230
|
+
maxHeight: '95vh',
|
|
231
|
+
overflow: 'auto'
|
|
232
|
+
}
|
|
233
|
+
}, tableDom),
|
|
234
|
+
trigger: "click",
|
|
235
|
+
visible: visible,
|
|
236
|
+
onVisibleChange: setVisible
|
|
237
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.MoreOutlined, null)),
|
|
238
|
+
onClick: function onClick() {
|
|
239
|
+
return setVisible(true);
|
|
240
|
+
},
|
|
241
|
+
onInput: function onInput(e) {
|
|
242
|
+
var _formRef$current6;
|
|
243
|
+
|
|
244
|
+
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : _formRef$current6.getFieldsValue();
|
|
245
|
+
formValue[name] = e.target.value;
|
|
246
|
+
formRef.current.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
247
|
+
},
|
|
248
|
+
readOnly: readonly,
|
|
249
|
+
value: text
|
|
250
|
+
})));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
var _default = InputTable;
|
|
254
|
+
exports.default = _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ActionType } from 'ls-pro-table';
|
|
2
|
+
import type { exportParam } from 'ls-pro-table/lib/components/Export';
|
|
2
3
|
import type { ProFormInstance } from 'ls-pro-form';
|
|
3
4
|
import type { SingleParamType } from '../useSingle';
|
|
4
5
|
export declare type DtlParamType = SingleParamType & {
|
|
@@ -25,5 +26,6 @@ declare function useDtl(dtlParam: DtlParamType): {
|
|
|
25
26
|
onEditDtl: () => Promise<boolean>;
|
|
26
27
|
onSaveMst: (values: any) => Promise<void>;
|
|
27
28
|
onRemoveMst: () => Promise<boolean | undefined>;
|
|
29
|
+
onExportDtl: (url: string, param: exportParam) => Promise<boolean>;
|
|
28
30
|
};
|
|
29
31
|
export default useDtl;
|
|
@@ -29,6 +29,8 @@ var _icons = require("@ant-design/icons");
|
|
|
29
29
|
|
|
30
30
|
var _utils = require("../../utils");
|
|
31
31
|
|
|
32
|
+
var _http = require("../../http");
|
|
33
|
+
|
|
32
34
|
var _excluded = ["current", "pageSize"];
|
|
33
35
|
|
|
34
36
|
function useDtl(dtlParam) {
|
|
@@ -596,6 +598,77 @@ function useDtl(dtlParam) {
|
|
|
596
598
|
};
|
|
597
599
|
}();
|
|
598
600
|
|
|
601
|
+
var onExportDtl = /*#__PURE__*/function () {
|
|
602
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(url, param) {
|
|
603
|
+
var _param$exportColumns;
|
|
604
|
+
|
|
605
|
+
var _result$flag5, result, _result$flag6, _result$flag7;
|
|
606
|
+
|
|
607
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
608
|
+
while (1) {
|
|
609
|
+
switch (_context8.prev = _context8.next) {
|
|
610
|
+
case 0:
|
|
611
|
+
if ((_param$exportColumns = param.exportColumns) === null || _param$exportColumns === void 0 ? void 0 : _param$exportColumns.length) {
|
|
612
|
+
_context8.next = 3;
|
|
613
|
+
break;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
(0, _utils.showWarn)('请选择要导出的列');
|
|
617
|
+
return _context8.abrupt("return", false);
|
|
618
|
+
|
|
619
|
+
case 3:
|
|
620
|
+
if (param.findUrl) {
|
|
621
|
+
_context8.next = 6;
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
(0, _utils.showWarn)('请配置业务接口 bizApi 属性');
|
|
626
|
+
return _context8.abrupt("return", false);
|
|
627
|
+
|
|
628
|
+
case 6:
|
|
629
|
+
_context8.prev = 6;
|
|
630
|
+
_context8.next = 9;
|
|
631
|
+
return (0, _http.httpPost)(url, param);
|
|
632
|
+
|
|
633
|
+
case 9:
|
|
634
|
+
result = _context8.sent;
|
|
635
|
+
|
|
636
|
+
if (!(((_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retCode) === '0')) {
|
|
637
|
+
_context8.next = 15;
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
(0, _utils.showSuccess)(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retMsg) || '导出成功');
|
|
642
|
+
return _context8.abrupt("return", true);
|
|
643
|
+
|
|
644
|
+
case 15:
|
|
645
|
+
(0, _utils.showError)(((_result$flag7 = result.flag) === null || _result$flag7 === void 0 ? void 0 : _result$flag7.retMsg) || '导出失败,请联系系统管理员');
|
|
646
|
+
return _context8.abrupt("return", false);
|
|
647
|
+
|
|
648
|
+
case 17:
|
|
649
|
+
_context8.next = 24;
|
|
650
|
+
break;
|
|
651
|
+
|
|
652
|
+
case 19:
|
|
653
|
+
_context8.prev = 19;
|
|
654
|
+
_context8.t0 = _context8["catch"](6);
|
|
655
|
+
console.log(_context8.t0);
|
|
656
|
+
(0, _utils.showError)(_context8.t0.message);
|
|
657
|
+
return _context8.abrupt("return", false);
|
|
658
|
+
|
|
659
|
+
case 24:
|
|
660
|
+
case "end":
|
|
661
|
+
return _context8.stop();
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}, _callee8, null, [[6, 19]]);
|
|
665
|
+
}));
|
|
666
|
+
|
|
667
|
+
return function onExportDtl(_x6, _x7) {
|
|
668
|
+
return _ref8.apply(this, arguments);
|
|
669
|
+
};
|
|
670
|
+
}();
|
|
671
|
+
|
|
599
672
|
var tableTools = [];
|
|
600
673
|
|
|
601
674
|
if (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.add) {
|
|
@@ -628,6 +701,11 @@ function useDtl(dtlParam) {
|
|
|
628
701
|
if (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.import) {
|
|
629
702
|
tableTools.push( /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
630
703
|
key: "import",
|
|
704
|
+
onClick: function onClick() {
|
|
705
|
+
var _tableRef$current, _tableRef$current$sho;
|
|
706
|
+
|
|
707
|
+
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : (_tableRef$current$sho = _tableRef$current.showImport) === null || _tableRef$current$sho === void 0 ? void 0 : _tableRef$current$sho.call(_tableRef$current);
|
|
708
|
+
},
|
|
631
709
|
icon: /*#__PURE__*/_react.default.createElement(_icons.ImportOutlined, null)
|
|
632
710
|
}, "\u5BFC\u5165"));
|
|
633
711
|
}
|
|
@@ -635,6 +713,11 @@ function useDtl(dtlParam) {
|
|
|
635
713
|
if (toolConfig === null || toolConfig === void 0 ? void 0 : toolConfig.export) {
|
|
636
714
|
tableTools.push( /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
637
715
|
key: "export",
|
|
716
|
+
onClick: function onClick() {
|
|
717
|
+
var _tableRef$current2, _tableRef$current2$sh;
|
|
718
|
+
|
|
719
|
+
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$sh = _tableRef$current2.showExport) === null || _tableRef$current2$sh === void 0 ? void 0 : _tableRef$current2$sh.call(_tableRef$current2);
|
|
720
|
+
},
|
|
638
721
|
icon: /*#__PURE__*/_react.default.createElement(_icons.ExportOutlined, null)
|
|
639
722
|
}, "\u5BFC\u51FA"));
|
|
640
723
|
}
|
|
@@ -656,7 +739,8 @@ function useDtl(dtlParam) {
|
|
|
656
739
|
onAddDtl: onAddDtl,
|
|
657
740
|
onEditDtl: onEditDtl,
|
|
658
741
|
onSaveMst: onSaveMst,
|
|
659
|
-
onRemoveMst: onRemoveMst
|
|
742
|
+
onRemoveMst: onRemoveMst,
|
|
743
|
+
onExportDtl: onExportDtl
|
|
660
744
|
};
|
|
661
745
|
}
|
|
662
746
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ActionType } from 'ls-pro-table';
|
|
2
|
+
import type { exportParam } from 'ls-pro-table/lib/components/Export';
|
|
2
3
|
import type { ProFormInstance } from 'ls-pro-form';
|
|
3
4
|
import type { ApiResponse, TableToolbar } from '../../typing';
|
|
4
5
|
export declare type SingleParamType = {
|
|
@@ -36,5 +37,6 @@ declare function useSingle(inParam: SingleParamType): {
|
|
|
36
37
|
onLoad: (params: Record<string, any>, sort: Record<string, any>, filter: Record<string, any>) => Promise<any>;
|
|
37
38
|
onAdd: () => Promise<void>;
|
|
38
39
|
onEdit: () => Promise<void>;
|
|
40
|
+
onExport: (url: string, param: exportParam) => Promise<boolean>;
|
|
39
41
|
};
|
|
40
42
|
export default useSingle;
|