dlt-for-react 1.0.3 → 1.0.5
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/README.md +4 -1
- package/assets/components/KyCheckButton/index.less +23 -0
- package/assets/components/KyCollapse/index.less +15 -0
- package/assets/components/KyContainerFrame/index.less +21 -0
- package/assets/components/KyEditableTable/index.less +116 -0
- package/assets/components/KyEmpty/index.less +8 -0
- package/assets/components/KyIcon/index.less +6 -0
- package/assets/components/KyMore/index.less +9 -0
- package/assets/components/KyTable/checkbuttons.less +23 -0
- package/assets/components/KyTable/highSearchForm.less +16 -0
- package/assets/components/KyTable/index.less +558 -0
- package/assets/components/KyTitle/index.less +39 -0
- package/assets/images/noData.png +0 -0
- package/lib/components/KyBtnBox/index.js +137 -0
- package/lib/components/KyCheckBox/index.js +361 -0
- package/lib/components/KyCheckButton/index.js +256 -0
- package/lib/components/KyCollapse/index.js +144 -0
- package/lib/components/KyContainerFrame/index.js +239 -0
- package/lib/components/KyEditableTable/component.js +216 -0
- package/lib/components/KyEditableTable/index.js +1537 -0
- package/lib/components/KyEmpty/index.js +102 -0
- package/lib/components/KyExcel/ExcelForm.js +111 -0
- package/lib/components/KyExcel/index.js +601 -0
- package/lib/components/KyIcon/index.js +51 -0
- package/lib/components/KyModal/buildTitle.js +1 -0
- package/lib/components/KyModal/dragM.js +1 -0
- package/lib/components/KyMore/index.js +74 -0
- package/lib/components/KyPreview/index.js +1 -0
- package/lib/components/KyTable/AddFieldsModal.js +360 -0
- package/lib/components/KyTable/action.js +222 -0
- package/lib/components/KyTable/checkButtons.js +244 -0
- package/lib/components/KyTable/data.js +726 -0
- package/lib/components/KyTable/expexcel.js +269 -0
- package/lib/components/KyTable/highSearchForm.js +749 -0
- package/lib/components/KyTable/highSelect.js +313 -0
- package/lib/components/KyTable/index.js +2075 -0
- package/lib/components/KyTable/marqueenText.js +142 -0
- package/lib/components/KyTable/overflowColumn.js +113 -0
- package/lib/components/KyTable/text.js +96 -0
- package/lib/components/KyTable/textGroup.js +108 -0
- package/lib/components/KyTitle/index.js +127 -0
- package/lib/components/KyUpload/index.js +1 -0
- package/lib/index.js +240 -59
- package/lib/layouts/Exception/403/index.js +1 -0
- package/lib/layouts/Exception/403.js +1 -0
- package/lib/layouts/Exception/404.js +1 -0
- package/lib/layouts/Exception/500.js +1 -0
- package/lib/layouts/LeftMenu/index.js +1 -0
- package/lib/layouts/Login/lyPassword.js +1 -0
- package/lib/layouts/NavigationBar/index.js +1 -0
- package/lib/layouts/Top/index.js +1 -0
- package/lib/layouts/TopMenu/index.js +1 -0
- package/lib/layouts/layout/index.js +1 -0
- package/lib/layouts/mixTop/index.js +1 -0
- package/lib/layouts/settingDrawer/colorChange.js +1 -0
- package/lib/layouts/settingDrawer/colorPicker.js +1 -0
- package/lib/utils/MD5.js +256 -0
- package/lib/utils/NHCore.js +273 -0
- package/lib/utils/NHFetch.js +451 -0
- package/lib/utils/common.js +516 -0
- package/lib/utils/createUuid.js +37 -0
- package/lib/utils/equalsObj.js +59 -0
- package/lib/utils/getLoginUser.js +10 -0
- package/lib/utils/getSize.js +27 -0
- package/lib/utils/index.js +804 -0
- package/package.json +2 -2
|
@@ -0,0 +1,749 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _row = require('antd/lib/row');
|
|
8
|
+
|
|
9
|
+
var _row2 = _interopRequireDefault(_row);
|
|
10
|
+
|
|
11
|
+
var _button = require('antd/lib/button');
|
|
12
|
+
|
|
13
|
+
var _button2 = _interopRequireDefault(_button);
|
|
14
|
+
|
|
15
|
+
var _col = require('antd/lib/col');
|
|
16
|
+
|
|
17
|
+
var _col2 = _interopRequireDefault(_col);
|
|
18
|
+
|
|
19
|
+
var _inputNumber = require('antd/lib/input-number');
|
|
20
|
+
|
|
21
|
+
var _inputNumber2 = _interopRequireDefault(_inputNumber);
|
|
22
|
+
|
|
23
|
+
var _timePicker = require('antd/lib/time-picker');
|
|
24
|
+
|
|
25
|
+
var _timePicker2 = _interopRequireDefault(_timePicker);
|
|
26
|
+
|
|
27
|
+
var _form = require('antd/lib/form');
|
|
28
|
+
|
|
29
|
+
var _form2 = _interopRequireDefault(_form);
|
|
30
|
+
|
|
31
|
+
var _input = require('antd/lib/input');
|
|
32
|
+
|
|
33
|
+
var _input2 = _interopRequireDefault(_input);
|
|
34
|
+
|
|
35
|
+
var _tooltip = require('antd/lib/tooltip');
|
|
36
|
+
|
|
37
|
+
var _tooltip2 = _interopRequireDefault(_tooltip);
|
|
38
|
+
|
|
39
|
+
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
|
|
40
|
+
|
|
41
|
+
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
|
|
42
|
+
|
|
43
|
+
var _getIterator2 = require('babel-runtime/core-js/get-iterator');
|
|
44
|
+
|
|
45
|
+
var _getIterator3 = _interopRequireDefault(_getIterator2);
|
|
46
|
+
|
|
47
|
+
var _set = require('babel-runtime/core-js/set');
|
|
48
|
+
|
|
49
|
+
var _set2 = _interopRequireDefault(_set);
|
|
50
|
+
|
|
51
|
+
var _extends2 = require('babel-runtime/helpers/extends');
|
|
52
|
+
|
|
53
|
+
var _extends3 = _interopRequireDefault(_extends2);
|
|
54
|
+
|
|
55
|
+
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
|
56
|
+
|
|
57
|
+
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
|
58
|
+
|
|
59
|
+
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
|
60
|
+
|
|
61
|
+
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
62
|
+
|
|
63
|
+
var _createClass2 = require('babel-runtime/helpers/createClass');
|
|
64
|
+
|
|
65
|
+
var _createClass3 = _interopRequireDefault(_createClass2);
|
|
66
|
+
|
|
67
|
+
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
|
68
|
+
|
|
69
|
+
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
|
70
|
+
|
|
71
|
+
var _inherits2 = require('babel-runtime/helpers/inherits');
|
|
72
|
+
|
|
73
|
+
var _inherits3 = _interopRequireDefault(_inherits2);
|
|
74
|
+
|
|
75
|
+
var _datePicker = require('antd/lib/date-picker');
|
|
76
|
+
|
|
77
|
+
var _datePicker2 = _interopRequireDefault(_datePicker);
|
|
78
|
+
|
|
79
|
+
require('antd/lib/row/style');
|
|
80
|
+
|
|
81
|
+
require('antd/lib/button/style');
|
|
82
|
+
|
|
83
|
+
require('antd/lib/col/style');
|
|
84
|
+
|
|
85
|
+
require('antd/lib/input-number/style');
|
|
86
|
+
|
|
87
|
+
require('antd/lib/time-picker/style');
|
|
88
|
+
|
|
89
|
+
require('antd/lib/form/style');
|
|
90
|
+
|
|
91
|
+
require('antd/lib/input/style');
|
|
92
|
+
|
|
93
|
+
require('antd/lib/tooltip/style');
|
|
94
|
+
|
|
95
|
+
require('antd/lib/date-picker/style');
|
|
96
|
+
|
|
97
|
+
var _react = require('react');
|
|
98
|
+
|
|
99
|
+
var _react2 = _interopRequireDefault(_react);
|
|
100
|
+
|
|
101
|
+
var _highSelect = require('./highSelect');
|
|
102
|
+
|
|
103
|
+
var _highSelect2 = _interopRequireDefault(_highSelect);
|
|
104
|
+
|
|
105
|
+
var _AddFieldsModal = require('./AddFieldsModal');
|
|
106
|
+
|
|
107
|
+
var _AddFieldsModal2 = _interopRequireDefault(_AddFieldsModal);
|
|
108
|
+
|
|
109
|
+
var _equalsObj = require('../../utils/equalsObj');
|
|
110
|
+
|
|
111
|
+
var _equalsObj2 = _interopRequireDefault(_equalsObj);
|
|
112
|
+
|
|
113
|
+
var _NHCore = require('../../utils/NHCore');
|
|
114
|
+
|
|
115
|
+
require('../../../assets/components/KyTable/highSearchForm.less');
|
|
116
|
+
|
|
117
|
+
var _moment = require('moment');
|
|
118
|
+
|
|
119
|
+
var _moment2 = _interopRequireDefault(_moment);
|
|
120
|
+
|
|
121
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
122
|
+
|
|
123
|
+
/*
|
|
124
|
+
* @Description:高级搜索
|
|
125
|
+
* @Version: 1.0
|
|
126
|
+
* @Author: 琴时
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
var RangePicker = _datePicker2.default.RangePicker;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* searchType:"input",// 类型,可选值:输入框:input,下拉框:select,日期:date,时间:time,日期时间:datetime,数字:number
|
|
133
|
+
parentField:"xxxx",// 级联下拉框时的上一级字段,值需要跟NHTable配置的一样
|
|
134
|
+
dmbz:"xxx",// 下拉框的数据来源,如果没有传代码库标志或者下拉框配置标志则默认使用列表数据,
|
|
135
|
+
sign:"xxxx",// 下拉框的数据来源,如果没有传代码库标志或者下拉框配置标志则默认使用列表数据,
|
|
136
|
+
defaultSearch:true,// 默认true,如果不需要默认显示为高级搜索时设置为false
|
|
137
|
+
|
|
138
|
+
说明:
|
|
139
|
+
级联下拉框暂时只支持都是列表数据的情况
|
|
140
|
+
字段为date(YYYY-MM-dd),datetime(YYYY-MM-dd HH:mm:ss),time(HH:mm)三种类型时,列表查询的数据必须是字符串且满足特定格式
|
|
141
|
+
*/
|
|
142
|
+
var HighSearchForm = function (_React$Component) {
|
|
143
|
+
(0, _inherits3.default)(HighSearchForm, _React$Component);
|
|
144
|
+
|
|
145
|
+
function HighSearchForm(props) {
|
|
146
|
+
(0, _classCallCheck3.default)(this, HighSearchForm);
|
|
147
|
+
|
|
148
|
+
var _this = (0, _possibleConstructorReturn3.default)(this, (HighSearchForm.__proto__ || (0, _getPrototypeOf2.default)(HighSearchForm)).call(this, props));
|
|
149
|
+
|
|
150
|
+
_this.getCascaderField = function (columns) {
|
|
151
|
+
var cascaderField = {};
|
|
152
|
+
columns && columns.forEach(function (item) {
|
|
153
|
+
// 列表下拉框且存在parentField
|
|
154
|
+
if (item.searchType && item.searchType === 'select' && !item.dmbz && !item.sign && item.parentField) {
|
|
155
|
+
cascaderField[item.parentField] = item.dataIndex;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
return cascaderField;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
_this.onTableSelectChange = function (field, value) {
|
|
162
|
+
var cascaderField = _this.state.cascaderField;
|
|
163
|
+
if (cascaderField[field]) {
|
|
164
|
+
_this.filterTableSelectData(field, value, cascaderField[field]);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
_this.filterTableSelectData = function (curField, curvalue, nextField) {
|
|
169
|
+
var tableData = _this.props.tableData;
|
|
170
|
+
var dataSource = (0, _extends3.default)({}, _this.state.dataSource);
|
|
171
|
+
var data = [];
|
|
172
|
+
if (tableData) {
|
|
173
|
+
var setlist = new _set2.default();
|
|
174
|
+
if (curvalue && curvalue.length === 0) {
|
|
175
|
+
tableData.forEach(function (item) {
|
|
176
|
+
setlist.add(item[nextField]);
|
|
177
|
+
});
|
|
178
|
+
} else {
|
|
179
|
+
tableData.forEach(function (item) {
|
|
180
|
+
var _iteratorNormalCompletion = true;
|
|
181
|
+
var _didIteratorError = false;
|
|
182
|
+
var _iteratorError = undefined;
|
|
183
|
+
|
|
184
|
+
try {
|
|
185
|
+
for (var _iterator = (0, _getIterator3.default)(curvalue), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
186
|
+
var v = _step.value;
|
|
187
|
+
|
|
188
|
+
if (item[curField] === v) {
|
|
189
|
+
setlist.add(item[nextField]);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
} catch (err) {
|
|
193
|
+
_didIteratorError = true;
|
|
194
|
+
_iteratorError = err;
|
|
195
|
+
} finally {
|
|
196
|
+
try {
|
|
197
|
+
if (!_iteratorNormalCompletion && _iterator.return) {
|
|
198
|
+
_iterator.return();
|
|
199
|
+
}
|
|
200
|
+
} finally {
|
|
201
|
+
if (_didIteratorError) {
|
|
202
|
+
throw _iteratorError;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
data = [].concat((0, _toConsumableArray3.default)(setlist)).map(function (item) {
|
|
209
|
+
return { label: item, value: item };
|
|
210
|
+
}).sort(function (a, b) {
|
|
211
|
+
var v = a.label;
|
|
212
|
+
if (typeof v === 'number') {
|
|
213
|
+
return b.label - v;
|
|
214
|
+
} else {
|
|
215
|
+
return (b.label || '').localeCompare(v, 'zh-CN');
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
dataSource[nextField] = data;
|
|
220
|
+
_this.setState({ dataSource: dataSource });
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
_this.getTableSelect = function (columns) {
|
|
224
|
+
var tableSelect = [];
|
|
225
|
+
columns && columns.forEach(function (item) {
|
|
226
|
+
if (item.searchType && item.searchType === 'select' && !item.dmbz && !item.sign) {
|
|
227
|
+
tableSelect.push(item.dataIndex);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
return tableSelect;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
_this.generateSelectData = function (tableData) {
|
|
234
|
+
var dataSource = {};
|
|
235
|
+
var _this$state$tableSele = _this.state.tableSelect,
|
|
236
|
+
tableSelect = _this$state$tableSele === undefined ? [] : _this$state$tableSele;
|
|
237
|
+
// 遍历列表数据
|
|
238
|
+
|
|
239
|
+
tableData && tableData.forEach(function (item, index) {
|
|
240
|
+
var _iteratorNormalCompletion2 = true;
|
|
241
|
+
var _didIteratorError2 = false;
|
|
242
|
+
var _iteratorError2 = undefined;
|
|
243
|
+
|
|
244
|
+
try {
|
|
245
|
+
for (var _iterator2 = (0, _getIterator3.default)(tableSelect), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
246
|
+
var dataIndex = _step2.value;
|
|
247
|
+
|
|
248
|
+
if (!dataSource[dataIndex]) {
|
|
249
|
+
dataSource[dataIndex] = new _set2.default();
|
|
250
|
+
}
|
|
251
|
+
if (item[dataIndex] && item[dataIndex] !== null && item[dataIndex] !== undefined) {
|
|
252
|
+
if (typeof item[dataIndex] === 'string' && item[dataIndex].trim() !== '') {
|
|
253
|
+
dataSource[dataIndex].add(item[dataIndex]);
|
|
254
|
+
} else {
|
|
255
|
+
dataSource[dataIndex].add(item[dataIndex]);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
} catch (err) {
|
|
260
|
+
_didIteratorError2 = true;
|
|
261
|
+
_iteratorError2 = err;
|
|
262
|
+
} finally {
|
|
263
|
+
try {
|
|
264
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
|
265
|
+
_iterator2.return();
|
|
266
|
+
}
|
|
267
|
+
} finally {
|
|
268
|
+
if (_didIteratorError2) {
|
|
269
|
+
throw _iteratorError2;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
var _iteratorNormalCompletion3 = true;
|
|
275
|
+
var _didIteratorError3 = false;
|
|
276
|
+
var _iteratorError3 = undefined;
|
|
277
|
+
|
|
278
|
+
try {
|
|
279
|
+
for (var _iterator3 = (0, _getIterator3.default)(tableSelect), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
280
|
+
var dataIndex = _step3.value;
|
|
281
|
+
|
|
282
|
+
if (dataSource[dataIndex]) {
|
|
283
|
+
dataSource[dataIndex] = [].concat((0, _toConsumableArray3.default)(dataSource[dataIndex])).map(function (item) {
|
|
284
|
+
return { label: item, value: item };
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
} catch (err) {
|
|
289
|
+
_didIteratorError3 = true;
|
|
290
|
+
_iteratorError3 = err;
|
|
291
|
+
} finally {
|
|
292
|
+
try {
|
|
293
|
+
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
|
294
|
+
_iterator3.return();
|
|
295
|
+
}
|
|
296
|
+
} finally {
|
|
297
|
+
if (_didIteratorError3) {
|
|
298
|
+
throw _iteratorError3;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
_this.setState({ dataSource: dataSource });
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
_this.showToolTip = function (e) {
|
|
307
|
+
if (e.target.clientWidth >= e.target.scrollWidth) {
|
|
308
|
+
e.target.style.pointerEvents = 'none'; // 阻止鼠标事件
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
_this.hightSearch = function (fieldpro, index) {
|
|
313
|
+
var parentColumns = _this.props.parentColumns;
|
|
314
|
+
var parentColumnTitle = '';
|
|
315
|
+
if (parentColumns && parentColumns.length) {
|
|
316
|
+
var exactPreant = parentColumns.filter(function (item) {
|
|
317
|
+
return item.children.includes(fieldpro.dataIndex);
|
|
318
|
+
});
|
|
319
|
+
parentColumnTitle = exactPreant.length ? exactPreant[0].title : '';
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// 如果不需要作为高级搜索字段或者没有设置高级搜索字段的类型
|
|
323
|
+
if (fieldpro.defaultSearch === 'false' || fieldpro.defaultSearch === false || !fieldpro.searchType) {
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
var _this$props$form = _this.props.form,
|
|
327
|
+
getFieldDecorator = _this$props$form.getFieldDecorator,
|
|
328
|
+
getFieldValue = _this$props$form.getFieldValue;
|
|
329
|
+
|
|
330
|
+
if (fieldpro.searchType === 'input') {
|
|
331
|
+
// 输入框
|
|
332
|
+
return _react2.default.createElement(
|
|
333
|
+
_form2.default.Item,
|
|
334
|
+
{
|
|
335
|
+
label: _react2.default.createElement(
|
|
336
|
+
_tooltip2.default,
|
|
337
|
+
{ title: parentColumnTitle + fieldpro.title, onMouseEnter: _this.showToolTip },
|
|
338
|
+
parentColumnTitle + fieldpro.title
|
|
339
|
+
),
|
|
340
|
+
key: index
|
|
341
|
+
},
|
|
342
|
+
getFieldDecorator('S_' + fieldpro.dataIndex + '_LK', {
|
|
343
|
+
initialValue: fieldpro.defaultValue ? fieldpro.defaultValue : undefined
|
|
344
|
+
})(_react2.default.createElement(_input2.default, { placeholder: '\u8BF7\u8F93\u5165' + fieldpro.title }))
|
|
345
|
+
);
|
|
346
|
+
} else if (fieldpro.searchType === 'select') {
|
|
347
|
+
index = fieldpro.dataIndex + index;
|
|
348
|
+
// 下拉框
|
|
349
|
+
if (fieldpro.dmbz) {
|
|
350
|
+
// 存在代码标志,根据代码标志获取数据
|
|
351
|
+
return _react2.default.createElement(
|
|
352
|
+
_form2.default.Item,
|
|
353
|
+
{
|
|
354
|
+
label: _react2.default.createElement(
|
|
355
|
+
_tooltip2.default,
|
|
356
|
+
{ title: parentColumnTitle + fieldpro.title, onMouseEnter: _this.showToolTip },
|
|
357
|
+
parentColumnTitle + fieldpro.title,
|
|
358
|
+
' '
|
|
359
|
+
),
|
|
360
|
+
key: index
|
|
361
|
+
},
|
|
362
|
+
getFieldDecorator('S_' + fieldpro.dataIndex + '_IN', {
|
|
363
|
+
initialValue: fieldpro.defaultValue ? fieldpro.defaultValue : undefined
|
|
364
|
+
})(_react2.default.createElement(_highSelect2.default, {
|
|
365
|
+
mode: 'multiple',
|
|
366
|
+
maxTagCount: 3,
|
|
367
|
+
sign: 'DMK_' + fieldpro.dmbz,
|
|
368
|
+
placeholder: '\u8BF7\u9009\u62E9' + fieldpro.title,
|
|
369
|
+
hhzs: fieldpro.hhzs
|
|
370
|
+
}))
|
|
371
|
+
);
|
|
372
|
+
} else if (fieldpro.sign) {
|
|
373
|
+
// 不存在代码标志,存在下拉框标志,根据标志获取数据
|
|
374
|
+
var params = {};
|
|
375
|
+
if (fieldpro.parentField) {
|
|
376
|
+
params.parentLabel = getFieldValue('S_' + fieldpro.parentField + '_IN');
|
|
377
|
+
}
|
|
378
|
+
return _react2.default.createElement(
|
|
379
|
+
_form2.default.Item,
|
|
380
|
+
{
|
|
381
|
+
label: _react2.default.createElement(
|
|
382
|
+
_tooltip2.default,
|
|
383
|
+
{ title: fieldpro.title, onMouseEnter: _this.showToolTip },
|
|
384
|
+
fieldpro.title
|
|
385
|
+
),
|
|
386
|
+
key: index
|
|
387
|
+
},
|
|
388
|
+
getFieldDecorator('S_' + fieldpro.dataIndex + '_IN', {
|
|
389
|
+
initialValue: fieldpro.defaultValue ? fieldpro.defaultValue : undefined
|
|
390
|
+
})(_react2.default.createElement(_highSelect2.default, (0, _extends3.default)({
|
|
391
|
+
mode: 'multiple',
|
|
392
|
+
maxTagCount: 3
|
|
393
|
+
}, params, {
|
|
394
|
+
sign: fieldpro.sign,
|
|
395
|
+
placeholder: '\u8BF7\u9009\u62E9' + fieldpro.title,
|
|
396
|
+
hhzs: fieldpro.hhzs
|
|
397
|
+
})))
|
|
398
|
+
);
|
|
399
|
+
} else {
|
|
400
|
+
// 代码标志和sign都不存在,默认是列表数据
|
|
401
|
+
return _react2.default.createElement(
|
|
402
|
+
_form2.default.Item,
|
|
403
|
+
{
|
|
404
|
+
label: _react2.default.createElement(
|
|
405
|
+
_tooltip2.default,
|
|
406
|
+
{ title: parentColumnTitle + fieldpro.title, onMouseEnter: _this.showToolTip },
|
|
407
|
+
parentColumnTitle + fieldpro.title
|
|
408
|
+
),
|
|
409
|
+
key: index
|
|
410
|
+
},
|
|
411
|
+
getFieldDecorator('S_' + fieldpro.dataIndex + '_IN', {
|
|
412
|
+
initialValue: fieldpro.defaultValue ? fieldpro.defaultValue : undefined
|
|
413
|
+
})(_react2.default.createElement(_highSelect2.default, {
|
|
414
|
+
mode: 'multiple',
|
|
415
|
+
maxTagCount: 3,
|
|
416
|
+
onChange: function onChange(value, label) {
|
|
417
|
+
return _this.onTableSelectChange(fieldpro.dataIndex, value);
|
|
418
|
+
},
|
|
419
|
+
dataSource: _this.state.dataSource[fieldpro.dataIndex] || [],
|
|
420
|
+
onCancel: function onCancel() {
|
|
421
|
+
return _this.setState({ hightSearch: false });
|
|
422
|
+
},
|
|
423
|
+
placeholder: '\u8BF7\u9009\u62E9' + fieldpro.title,
|
|
424
|
+
hhzs: fieldpro.hhzs,
|
|
425
|
+
fetching: _this.props.highSearchFetching
|
|
426
|
+
}))
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
} else if (fieldpro.searchType === 'date') {
|
|
430
|
+
// 日期
|
|
431
|
+
return _react2.default.createElement(
|
|
432
|
+
_form2.default.Item,
|
|
433
|
+
{
|
|
434
|
+
label: _react2.default.createElement(
|
|
435
|
+
_tooltip2.default,
|
|
436
|
+
{ title: parentColumnTitle + fieldpro.title, onMouseEnter: _this.showToolTip },
|
|
437
|
+
parentColumnTitle + fieldpro.title
|
|
438
|
+
),
|
|
439
|
+
key: index
|
|
440
|
+
},
|
|
441
|
+
getFieldDecorator('D_' + fieldpro.dataIndex + '_date', {
|
|
442
|
+
initialValue: fieldpro.defaultValue ? fieldpro.defaultValue : undefined
|
|
443
|
+
})(_react2.default.createElement(RangePicker, null))
|
|
444
|
+
);
|
|
445
|
+
} else if (fieldpro.searchType === 'time') {
|
|
446
|
+
// 时间,没有时间范围组件
|
|
447
|
+
return _react2.default.createElement(
|
|
448
|
+
_form2.default.Item,
|
|
449
|
+
{
|
|
450
|
+
label: _react2.default.createElement(
|
|
451
|
+
_tooltip2.default,
|
|
452
|
+
{ title: parentColumnTitle + fieldpro.title, onMouseEnter: _this.showToolTip },
|
|
453
|
+
parentColumnTitle + fieldpro.title
|
|
454
|
+
),
|
|
455
|
+
key: index
|
|
456
|
+
},
|
|
457
|
+
_react2.default.createElement(
|
|
458
|
+
_form2.default.Item,
|
|
459
|
+
{ style: { display: 'inline-block', width: 'calc(50% - 12px)' } },
|
|
460
|
+
getFieldDecorator('T_' + fieldpro.dataIndex + '_time_start', {})(_react2.default.createElement(_timePicker2.default, { format: 'HH:mm' }))
|
|
461
|
+
),
|
|
462
|
+
_react2.default.createElement(
|
|
463
|
+
'span',
|
|
464
|
+
{ style: { display: 'inline-block', width: '24px', textAlign: 'center' } },
|
|
465
|
+
'~'
|
|
466
|
+
),
|
|
467
|
+
_react2.default.createElement(
|
|
468
|
+
_form2.default.Item,
|
|
469
|
+
{ style: { display: 'inline-block', width: 'calc(50% - 12px)' } },
|
|
470
|
+
getFieldDecorator('T_' + fieldpro.dataIndex + '_time_end', {})(_react2.default.createElement(_timePicker2.default, { format: 'HH:mm' }))
|
|
471
|
+
)
|
|
472
|
+
);
|
|
473
|
+
} else if (fieldpro.searchType === 'datetime') {
|
|
474
|
+
var formItemLayout = {
|
|
475
|
+
labelCol: {
|
|
476
|
+
xs: { span: 24 },
|
|
477
|
+
sm: { span: 4 }
|
|
478
|
+
},
|
|
479
|
+
wrapperCol: {
|
|
480
|
+
xs: { span: 24 },
|
|
481
|
+
sm: { span: 20 }
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
// 日期时间
|
|
485
|
+
return _react2.default.createElement(
|
|
486
|
+
_form2.default.Item,
|
|
487
|
+
(0, _extends3.default)({}, formItemLayout, {
|
|
488
|
+
label: _react2.default.createElement(
|
|
489
|
+
_tooltip2.default,
|
|
490
|
+
{ title: parentColumnTitle + fieldpro.title, onMouseEnter: _this.showToolTip },
|
|
491
|
+
parentColumnTitle + fieldpro.title
|
|
492
|
+
),
|
|
493
|
+
key: index
|
|
494
|
+
}),
|
|
495
|
+
getFieldDecorator('DT_' + fieldpro.dataIndex + '_date', {})(_react2.default.createElement(RangePicker, {
|
|
496
|
+
style: { width: '100%' },
|
|
497
|
+
showTime: {
|
|
498
|
+
defaultValue: [(0, _moment2.default)('00:00:00', 'HH:mm:ss'), (0, _moment2.default)('23:59:59', 'HH:mm:ss')]
|
|
499
|
+
},
|
|
500
|
+
format: 'YYYY-MM-DD HH:mm:ss'
|
|
501
|
+
}))
|
|
502
|
+
);
|
|
503
|
+
} else if (fieldpro.searchType === 'rangeDate') {
|
|
504
|
+
//起止日期
|
|
505
|
+
return _react2.default.createElement(
|
|
506
|
+
_form2.default.Item,
|
|
507
|
+
{
|
|
508
|
+
label: _react2.default.createElement(
|
|
509
|
+
_tooltip2.default,
|
|
510
|
+
{ title: parentColumnTitle + fieldpro.title, onMouseEnter: _this.showToolTip },
|
|
511
|
+
parentColumnTitle + fieldpro.title
|
|
512
|
+
),
|
|
513
|
+
key: index
|
|
514
|
+
},
|
|
515
|
+
getFieldDecorator('RD_' + fieldpro.dataIndex + '_dateRange', {})(_react2.default.createElement(RangePicker, { style: { width: 'auto' } }))
|
|
516
|
+
);
|
|
517
|
+
} else if (fieldpro.searchType === 'rangeDateTime') {
|
|
518
|
+
//起止日期时间
|
|
519
|
+
return _react2.default.createElement(
|
|
520
|
+
_form2.default.Item,
|
|
521
|
+
{
|
|
522
|
+
label: _react2.default.createElement(
|
|
523
|
+
_tooltip2.default,
|
|
524
|
+
{ title: parentColumnTitle + fieldpro.title, onMouseEnter: _this.showToolTip },
|
|
525
|
+
parentColumnTitle + fieldpro.title
|
|
526
|
+
),
|
|
527
|
+
key: index
|
|
528
|
+
},
|
|
529
|
+
getFieldDecorator('RDT_' + fieldpro.dataIndex + '_dateTimeRange', {})(_react2.default.createElement(RangePicker, {
|
|
530
|
+
style: { width: 'auto' },
|
|
531
|
+
showTime: {
|
|
532
|
+
defaultValue: [(0, _moment2.default)('00:00:00', 'HH:mm:ss'), (0, _moment2.default)('23:59:59', 'HH:mm:ss')]
|
|
533
|
+
},
|
|
534
|
+
format: 'YYYY-MM-DD HH:mm:ss'
|
|
535
|
+
}))
|
|
536
|
+
);
|
|
537
|
+
} else if (fieldpro.searchType === 'number') {
|
|
538
|
+
// 数字
|
|
539
|
+
return _react2.default.createElement(
|
|
540
|
+
_form2.default.Item,
|
|
541
|
+
{
|
|
542
|
+
label: _react2.default.createElement(
|
|
543
|
+
_tooltip2.default,
|
|
544
|
+
{ title: parentColumnTitle + fieldpro.title, onMouseEnter: _this.showToolTip },
|
|
545
|
+
parentColumnTitle + fieldpro.title
|
|
546
|
+
),
|
|
547
|
+
key: index
|
|
548
|
+
},
|
|
549
|
+
_react2.default.createElement(
|
|
550
|
+
_form2.default.Item,
|
|
551
|
+
{ style: { display: 'inline-block', width: 'calc(50% - 12px)' } },
|
|
552
|
+
getFieldDecorator('N_' + fieldpro.dataIndex + '_number_start', {
|
|
553
|
+
initialValue: fieldpro.defaultValue ? fieldpro.defaultValue : undefined
|
|
554
|
+
})(_react2.default.createElement(_inputNumber2.default, { style: { width: '100%' }, placeholder: '\u8BF7\u8F93\u5165' + fieldpro.title }))
|
|
555
|
+
),
|
|
556
|
+
_react2.default.createElement(
|
|
557
|
+
'span',
|
|
558
|
+
{ style: { display: 'inline-block', width: '24px', textAlign: 'center' } },
|
|
559
|
+
'~'
|
|
560
|
+
),
|
|
561
|
+
_react2.default.createElement(
|
|
562
|
+
_form2.default.Item,
|
|
563
|
+
{ style: { display: 'inline-block', width: 'calc(50% - 12px)' } },
|
|
564
|
+
getFieldDecorator('N_' + fieldpro.dataIndex + '_number_end', {
|
|
565
|
+
initialValue: fieldpro.defaultValue ? fieldpro.defaultValue : undefined
|
|
566
|
+
})(_react2.default.createElement(_inputNumber2.default, { style: { width: '100%' }, placeholder: '\u8BF7\u8F93\u5165' + fieldpro.title }))
|
|
567
|
+
)
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
_this.showAddModal = function () {
|
|
573
|
+
_this.setState({ visible: true });
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
_this.hideAddModal = function () {
|
|
577
|
+
_this.setState({ visible: false });
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
_this.state = {
|
|
581
|
+
selectData: {},
|
|
582
|
+
tableSelect: [],
|
|
583
|
+
dataSource: {}, // 列表下拉框数据
|
|
584
|
+
cascaderField: {},
|
|
585
|
+
visible: false,
|
|
586
|
+
searchCols: _this.props.columns
|
|
587
|
+
};
|
|
588
|
+
return _this;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
(0, _createClass3.default)(HighSearchForm, [{
|
|
592
|
+
key: 'componentDidMount',
|
|
593
|
+
value: function componentDidMount() {
|
|
594
|
+
var _this2 = this;
|
|
595
|
+
|
|
596
|
+
var _props = this.props,
|
|
597
|
+
_props$columns = _props.columns,
|
|
598
|
+
columns = _props$columns === undefined ? [] : _props$columns,
|
|
599
|
+
_props$tableData = _props.tableData,
|
|
600
|
+
tableData = _props$tableData === undefined ? [] : _props$tableData;
|
|
601
|
+
|
|
602
|
+
var tableSelect = this.getTableSelect(columns);
|
|
603
|
+
var cascaderField = this.getCascaderField(columns);
|
|
604
|
+
this.setState({ tableSelect: tableSelect, cascaderField: cascaderField }, function () {
|
|
605
|
+
return _this2.generateSelectData(tableData);
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
}, {
|
|
609
|
+
key: 'UNSAFE_componentWillReceiveProps',
|
|
610
|
+
value: function UNSAFE_componentWillReceiveProps(nextprops) {
|
|
611
|
+
var _this3 = this;
|
|
612
|
+
|
|
613
|
+
if ('columns' in nextprops && !(0, _equalsObj2.default)(this.props.columns, nextprops.columns) && nextprops.columns) {
|
|
614
|
+
this.props.getHightSearchData && this.props.getHightSearchData(function () {
|
|
615
|
+
var _nextprops$columns = nextprops.columns,
|
|
616
|
+
columns = _nextprops$columns === undefined ? [] : _nextprops$columns,
|
|
617
|
+
_nextprops$tableData = nextprops.tableData,
|
|
618
|
+
tableData = _nextprops$tableData === undefined ? [] : _nextprops$tableData;
|
|
619
|
+
|
|
620
|
+
var tableSelect = _this3.getTableSelect(columns);
|
|
621
|
+
var cascaderField = _this3.getCascaderField(columns);
|
|
622
|
+
_this3.setState({ tableSelect: tableSelect, cascaderField: cascaderField, searchCols: [].concat((0, _toConsumableArray3.default)(columns)) }, function () {
|
|
623
|
+
return _this3.generateSelectData(tableData);
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
} else if ('tableData' in nextprops && nextprops.tableData && this.props.tableData != nextprops.tableData) {
|
|
627
|
+
this.generateSelectData(nextprops.tableData);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
// 获得级联字段的上下级关系
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* 级联下拉框过滤下一级数据
|
|
634
|
+
* @param curField 当前选择下拉框的字段标识
|
|
635
|
+
* @param curvalue 当前下拉框选中的值
|
|
636
|
+
* @param nextField 下一级下拉框的字段标识
|
|
637
|
+
*/
|
|
638
|
+
|
|
639
|
+
// 获取所有从下拉框获取数据的字段标识
|
|
640
|
+
|
|
641
|
+
// 对所有从列表获取数据的下拉框统一获取数据
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
// 当文字超出时才显示tooltip
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
// 高级搜索
|
|
648
|
+
|
|
649
|
+
// 添加搜索字段模态框-关闭
|
|
650
|
+
|
|
651
|
+
}, {
|
|
652
|
+
key: 'render',
|
|
653
|
+
value: function render() {
|
|
654
|
+
var _this4 = this;
|
|
655
|
+
|
|
656
|
+
var columns = this.props.columns;
|
|
657
|
+
var _state = this.state,
|
|
658
|
+
visible = _state.visible,
|
|
659
|
+
_state$searchCols = _state.searchCols,
|
|
660
|
+
searchCols = _state$searchCols === undefined ? [] : _state$searchCols;
|
|
661
|
+
|
|
662
|
+
var checkedCol = searchCols.filter(function (item) {
|
|
663
|
+
return item.defaultSearch !== 'false' && item.defaultSearch !== false && item.searchType;
|
|
664
|
+
});
|
|
665
|
+
checkedCol = checkedCol.map(function (item) {
|
|
666
|
+
return item.dataIndex;
|
|
667
|
+
});
|
|
668
|
+
var ncolumns = columns.filter(function (item) {
|
|
669
|
+
return item.title !== '序号' && item.searchType;
|
|
670
|
+
});
|
|
671
|
+
var formItemLayout = {
|
|
672
|
+
labelCol: {
|
|
673
|
+
xs: { span: 24 },
|
|
674
|
+
sm: { span: 8 }
|
|
675
|
+
},
|
|
676
|
+
wrapperCol: {
|
|
677
|
+
xs: { span: 24 },
|
|
678
|
+
sm: { span: 16 }
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
return _react2.default.createElement(
|
|
682
|
+
'div',
|
|
683
|
+
{ className: 'highSearchForm' },
|
|
684
|
+
_react2.default.createElement(
|
|
685
|
+
_form2.default,
|
|
686
|
+
formItemLayout,
|
|
687
|
+
_react2.default.createElement(
|
|
688
|
+
_row2.default,
|
|
689
|
+
{ gutter: 16, type: 'flex', align: 'middle' },
|
|
690
|
+
searchCols && searchCols.map(function (item, index) {
|
|
691
|
+
var comp = _this4.hightSearch(item, index);
|
|
692
|
+
if (item.searchType === 'datetime' && comp != null) {
|
|
693
|
+
return _react2.default.createElement(
|
|
694
|
+
_col2.default,
|
|
695
|
+
{ key: index, xxl: 12, xl: 16, lg: 24, md: 24, sm: 24 },
|
|
696
|
+
comp
|
|
697
|
+
);
|
|
698
|
+
}
|
|
699
|
+
if (comp != null) {
|
|
700
|
+
return _react2.default.createElement(
|
|
701
|
+
_col2.default,
|
|
702
|
+
{ key: index, xxl: 6, xl: 8, lg: 12, md: 12, sm: 24 },
|
|
703
|
+
comp
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
return null;
|
|
707
|
+
}),
|
|
708
|
+
_react2.default.createElement(
|
|
709
|
+
_col2.default,
|
|
710
|
+
{ span: 24, style: { textAlign: 'right' } },
|
|
711
|
+
_react2.default.createElement(
|
|
712
|
+
_button2.default,
|
|
713
|
+
{ type: 'primary', onClick: this.props.onSearch },
|
|
714
|
+
'\u6267\u884C\u9AD8\u7EA7\u641C\u7D22'
|
|
715
|
+
),
|
|
716
|
+
_react2.default.createElement(
|
|
717
|
+
_button2.default,
|
|
718
|
+
{ onClick: this.showAddModal },
|
|
719
|
+
'\u6DFB\u52A0\u641C\u7D22\u5B57\u6BB5'
|
|
720
|
+
),
|
|
721
|
+
_react2.default.createElement(
|
|
722
|
+
_button2.default,
|
|
723
|
+
{ onClick: this.props.onRest },
|
|
724
|
+
'\u91CD\u7F6E'
|
|
725
|
+
),
|
|
726
|
+
_react2.default.createElement(
|
|
727
|
+
'a',
|
|
728
|
+
{ style: { marginLeft: 10 }, onClick: this.props.onCancel },
|
|
729
|
+
'[\u5173\u95ED\u9AD8\u7EA7\u641C\u7D22]'
|
|
730
|
+
)
|
|
731
|
+
)
|
|
732
|
+
)
|
|
733
|
+
),
|
|
734
|
+
_react2.default.createElement(_AddFieldsModal2.default, {
|
|
735
|
+
visible: visible,
|
|
736
|
+
data: ncolumns,
|
|
737
|
+
checkedList: checkedCol,
|
|
738
|
+
onOk: function onOk(result) {
|
|
739
|
+
return _this4.setState({ searchCols: result, visible: false }, _this4.props.refreshHeight);
|
|
740
|
+
},
|
|
741
|
+
onCancel: this.hideAddModal
|
|
742
|
+
})
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
}]);
|
|
746
|
+
return HighSearchForm;
|
|
747
|
+
}(_react2.default.Component);
|
|
748
|
+
|
|
749
|
+
exports.default = _form2.default.create()(HighSearchForm);
|