dlt-for-react 2.0.15 → 2.1.0
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 +11 -3
- package/lib/components/KyUpload/index.js +1 -1
- package/lib/components/NHSelector/ListSort/index.js +411 -0
- package/lib/components/NHSelector/index.js +636 -0
- package/lib/components/NHSelector/resultview/index.js +408 -0
- package/lib/components/NHSelector/selectormodal/index.js +303 -0
- package/lib/components/NHSelector/table/index.js +784 -0
- package/lib/components/NHSelector/tree/index.js +554 -0
- package/lib/utils/toFormFillingPage.js +3 -11
- package/package.json +1 -1
- package/lib/utils/createUuid.js +0 -40
- package/lib/utils/getLoginUser.js +0 -10
- package/lib/utils/getSize.js +0 -27
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ResultView = undefined;
|
|
7
|
+
|
|
8
|
+
var _tooltip = require("antd/lib/tooltip");
|
|
9
|
+
|
|
10
|
+
var _tooltip2 = _interopRequireDefault(_tooltip);
|
|
11
|
+
|
|
12
|
+
var _icon = require("antd/lib/icon");
|
|
13
|
+
|
|
14
|
+
var _icon2 = _interopRequireDefault(_icon);
|
|
15
|
+
|
|
16
|
+
var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of");
|
|
17
|
+
|
|
18
|
+
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
|
19
|
+
|
|
20
|
+
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
|
21
|
+
|
|
22
|
+
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
23
|
+
|
|
24
|
+
var _createClass2 = require("babel-runtime/helpers/createClass");
|
|
25
|
+
|
|
26
|
+
var _createClass3 = _interopRequireDefault(_createClass2);
|
|
27
|
+
|
|
28
|
+
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
|
|
29
|
+
|
|
30
|
+
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
|
31
|
+
|
|
32
|
+
var _inherits2 = require("babel-runtime/helpers/inherits");
|
|
33
|
+
|
|
34
|
+
var _inherits3 = _interopRequireDefault(_inherits2);
|
|
35
|
+
|
|
36
|
+
require("antd/lib/tooltip/style");
|
|
37
|
+
|
|
38
|
+
require("antd/lib/icon/style");
|
|
39
|
+
|
|
40
|
+
var _react = require("react");
|
|
41
|
+
|
|
42
|
+
var _react2 = _interopRequireDefault(_react);
|
|
43
|
+
|
|
44
|
+
var _reactCustomScrollbarsPatched = require("react-custom-scrollbars-patched");
|
|
45
|
+
|
|
46
|
+
var _index = require("../ListSort/index");
|
|
47
|
+
|
|
48
|
+
var _index2 = _interopRequireDefault(_index);
|
|
49
|
+
|
|
50
|
+
var _index3 = require("../../../index");
|
|
51
|
+
|
|
52
|
+
require("../../../../assets/selector/resultview/index.less");
|
|
53
|
+
|
|
54
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
55
|
+
|
|
56
|
+
var ResultView = exports.ResultView = function (_React$Component) {
|
|
57
|
+
(0, _inherits3.default)(ResultView, _React$Component);
|
|
58
|
+
|
|
59
|
+
function ResultView(props) {
|
|
60
|
+
(0, _classCallCheck3.default)(this, ResultView);
|
|
61
|
+
|
|
62
|
+
var _this = (0, _possibleConstructorReturn3.default)(this, (ResultView.__proto__ || (0, _getPrototypeOf2.default)(ResultView)).call(this, props));
|
|
63
|
+
|
|
64
|
+
_this.initValues = function (initValues, initParams) {
|
|
65
|
+
if (initValues && initValues.length > 0) {
|
|
66
|
+
var params = {};
|
|
67
|
+
params.initValues = initValues;
|
|
68
|
+
params.params = initParams;
|
|
69
|
+
params.pagination = { page: 1, pageSize: 10000000 };
|
|
70
|
+
params.sign = _this.props.sign;
|
|
71
|
+
params.keyField = _this.props.keyField;
|
|
72
|
+
if (_this.props.mode !== "tree") {
|
|
73
|
+
params.sqlParams = _this.props.sqlParams;
|
|
74
|
+
}
|
|
75
|
+
(0, _index3.NHFetch)(_this.props.url, "POST", params).then(function (res) {
|
|
76
|
+
if (res && res.data) {
|
|
77
|
+
var selectRows = [];
|
|
78
|
+
var selectRowKeys = [];
|
|
79
|
+
var data = [];
|
|
80
|
+
|
|
81
|
+
if (_this.props.mode === "tree") {
|
|
82
|
+
data = res.data;
|
|
83
|
+
} else {
|
|
84
|
+
data = res.data.list;
|
|
85
|
+
}
|
|
86
|
+
if (data && data.length > 0) {
|
|
87
|
+
for (var i = 0; i < data.length; i++) {
|
|
88
|
+
if (data[i].selectFlag !== "0" && data[i].selectFlag !== 0) {
|
|
89
|
+
selectRowKeys.push(data[i][_this.props.keyField]);
|
|
90
|
+
selectRows.push(data[i]);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
_this.props.updateSelectValues(selectRowKeys, selectRows);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
_this.showFooter = function () {
|
|
101
|
+
var unit = _this.props.unit;
|
|
102
|
+
|
|
103
|
+
var count = _this.props.selectRows.length;
|
|
104
|
+
if (_this.props.footerRender) {
|
|
105
|
+
return _react2.default.createElement(
|
|
106
|
+
"div",
|
|
107
|
+
{
|
|
108
|
+
style: {
|
|
109
|
+
height: "40px",
|
|
110
|
+
lineHeight: "40px",
|
|
111
|
+
float: "right",
|
|
112
|
+
paddingRight: "16px",
|
|
113
|
+
fontSize: "15px"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
_this.props.footerRender(count)
|
|
117
|
+
);
|
|
118
|
+
} else {
|
|
119
|
+
return _react2.default.createElement(
|
|
120
|
+
"div",
|
|
121
|
+
{
|
|
122
|
+
style: {
|
|
123
|
+
height: "40px",
|
|
124
|
+
lineHeight: "40px",
|
|
125
|
+
float: "right",
|
|
126
|
+
paddingRight: "16px",
|
|
127
|
+
fontSize: "15px"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"\u603B\u8BA1\uFF1A",
|
|
131
|
+
count,
|
|
132
|
+
unit
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
_this.getTextLength = function () {
|
|
138
|
+
var width = _this.props.width - 50;
|
|
139
|
+
return parseInt(width / 12, 10);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
_this.showRows = function (row, seq) {
|
|
143
|
+
var title = row[_this.props.titleField] ? row[_this.props.titleField] : "";
|
|
144
|
+
var key = row[_this.props.keyField] ? row[_this.props.keyField] : "";
|
|
145
|
+
var len = _this.getTextLength();
|
|
146
|
+
if (_this.props.rowRender) {
|
|
147
|
+
return _react2.default.createElement(
|
|
148
|
+
"li",
|
|
149
|
+
{ key: key },
|
|
150
|
+
_react2.default.createElement(
|
|
151
|
+
"div",
|
|
152
|
+
{ className: "dlt-selector-resultview-showDiv" },
|
|
153
|
+
_this.props.rowRender(key, title, row, len, seq),
|
|
154
|
+
_react2.default.createElement(_icon2.default, {
|
|
155
|
+
type: "info-circle-o",
|
|
156
|
+
className: "dlt-selector-resultview-close",
|
|
157
|
+
onClick: function onClick() {
|
|
158
|
+
return _this.handleClose(row[_this.props.keyField], seq);
|
|
159
|
+
},
|
|
160
|
+
style: { color: "rgba(0, 0, 0, 0.45)" }
|
|
161
|
+
})
|
|
162
|
+
)
|
|
163
|
+
);
|
|
164
|
+
} else {
|
|
165
|
+
return _react2.default.createElement(
|
|
166
|
+
"li",
|
|
167
|
+
{ key: key },
|
|
168
|
+
_react2.default.createElement(
|
|
169
|
+
"div",
|
|
170
|
+
{ className: "dlt-selector-resultview-showDiv" },
|
|
171
|
+
_react2.default.createElement(
|
|
172
|
+
"div",
|
|
173
|
+
{ className: "dlt-selector-resultview-showContentDiv" },
|
|
174
|
+
title.length < len ? title : _react2.default.createElement(
|
|
175
|
+
_tooltip2.default,
|
|
176
|
+
{ title: title },
|
|
177
|
+
title.substring(0, len - 1) + "..."
|
|
178
|
+
)
|
|
179
|
+
),
|
|
180
|
+
_react2.default.createElement(_icon2.default, {
|
|
181
|
+
type: "info-circle-o",
|
|
182
|
+
className: "dlt-selector-resultview-close",
|
|
183
|
+
onClick: function onClick() {
|
|
184
|
+
return _this.handleClose(row[_this.props.keyField], seq);
|
|
185
|
+
},
|
|
186
|
+
style: { color: "rgba(0, 0, 0, 0.45)" }
|
|
187
|
+
})
|
|
188
|
+
)
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
_this.buildRightTig = function (selectRows) {
|
|
194
|
+
return selectRows.map(function (item, index) {
|
|
195
|
+
return _this.showRows(item, index);
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
_this.showBottomCode = function () {
|
|
200
|
+
//如果存在选中数据
|
|
201
|
+
if (_this.props.selectRows && _this.props.selectRows.length > 0) {
|
|
202
|
+
if (_this.props.singerBottomShowRender) {
|
|
203
|
+
return _react2.default.createElement(
|
|
204
|
+
"span",
|
|
205
|
+
{ key: (0, _index3.createUuid)() },
|
|
206
|
+
_react2.default.createElement(
|
|
207
|
+
"font",
|
|
208
|
+
{ className: "dlt-selector-resultview-bottomBt" },
|
|
209
|
+
"\u5F53\u524D\u5DF2\u9009\uFF1A"
|
|
210
|
+
),
|
|
211
|
+
_react2.default.createElement(
|
|
212
|
+
"font",
|
|
213
|
+
null,
|
|
214
|
+
_this.props.singerBottomShowRender(_this.props.selectRows[0])
|
|
215
|
+
)
|
|
216
|
+
);
|
|
217
|
+
} else {
|
|
218
|
+
var title = _this.props.selectRows[0][_this.props.titleField];
|
|
219
|
+
return _react2.default.createElement(
|
|
220
|
+
"span",
|
|
221
|
+
{ key: (0, _index3.createUuid)() },
|
|
222
|
+
_react2.default.createElement(
|
|
223
|
+
"font",
|
|
224
|
+
{ className: "dlt-selector-resultview-bottomBt" },
|
|
225
|
+
"\u5F53\u524D\u5DF2\u9009\uFF1A"
|
|
226
|
+
),
|
|
227
|
+
_react2.default.createElement(
|
|
228
|
+
"font",
|
|
229
|
+
{ className: "dlt-selector-resultview-bottomResult" },
|
|
230
|
+
title
|
|
231
|
+
)
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
} else {
|
|
235
|
+
return _react2.default.createElement(
|
|
236
|
+
"span",
|
|
237
|
+
{ key: (0, _index3.createUuid)() },
|
|
238
|
+
_react2.default.createElement(
|
|
239
|
+
"font",
|
|
240
|
+
{ className: "dlt-selector-resultview-bottomBt" },
|
|
241
|
+
"\u5F53\u524D\u5DF2\u9009\uFF1A"
|
|
242
|
+
),
|
|
243
|
+
_react2.default.createElement(
|
|
244
|
+
"font",
|
|
245
|
+
{ className: "dlt-selector-resultview-bottomNoSelect" },
|
|
246
|
+
"\u60A8\u8FD8\u672A\u9009\u62E9\u6570\u636E"
|
|
247
|
+
)
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
_this.handleClose = function (key) {
|
|
253
|
+
var selectRows = [];
|
|
254
|
+
var selectRowKeys = [];
|
|
255
|
+
for (var i = 0; i < _this.props.selectRows.length; i++) {
|
|
256
|
+
if (_this.props.selectRowKeys[i] !== key) {
|
|
257
|
+
selectRows.push(_this.props.selectRows[i]);
|
|
258
|
+
selectRowKeys.push(_this.props.selectRowKeys[i]);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
if (_this.props.updateSelectValues) {
|
|
262
|
+
_this.props.updateSelectValues(selectRowKeys, selectRows);
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
_this.handleSortChange = function (list) {
|
|
267
|
+
var selectRowsMap = {};
|
|
268
|
+
for (var i = 0; i < _this.props.selectRows.length; i++) {
|
|
269
|
+
selectRowsMap[_this.props.selectRowKeys[i]] = _this.props.selectRows[i];
|
|
270
|
+
}
|
|
271
|
+
var selectRowKeys = [];
|
|
272
|
+
var selectRows = [];
|
|
273
|
+
list.map(function (item, index) {
|
|
274
|
+
selectRowKeys.push(item.key);
|
|
275
|
+
selectRows.push(selectRowsMap[item.key]);
|
|
276
|
+
return item;
|
|
277
|
+
});
|
|
278
|
+
//改变的数据回写给上级组件
|
|
279
|
+
if (_this.props.updateSelectValues) {
|
|
280
|
+
_this.props.updateSelectValues(selectRowKeys, selectRows);
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
_this.state = {};
|
|
285
|
+
return _this;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* 初始化数据
|
|
290
|
+
*/
|
|
291
|
+
|
|
292
|
+
//设置可以传递参数的默认值
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* 显示尾部的信息
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* 显示每一条的数据
|
|
302
|
+
*/
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* 显示在下部分的代码
|
|
307
|
+
*/
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* 删除一个数据
|
|
312
|
+
*/
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* 排序改变
|
|
317
|
+
*/
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
(0, _createClass3.default)(ResultView, [{
|
|
321
|
+
key: "render",
|
|
322
|
+
value: function render() {
|
|
323
|
+
//如果是单选,且结果展示在下方
|
|
324
|
+
if (this.props.isSinger === true && this.props.singerBottomShowFlag === true) {
|
|
325
|
+
return _react2.default.createElement(
|
|
326
|
+
"div",
|
|
327
|
+
{
|
|
328
|
+
key: (0, _index3.createUuid)(),
|
|
329
|
+
className: "dlt-selector-resultview-bottomShowDiv"
|
|
330
|
+
},
|
|
331
|
+
this.showBottomCode()
|
|
332
|
+
);
|
|
333
|
+
} else {
|
|
334
|
+
return _react2.default.createElement(
|
|
335
|
+
"div",
|
|
336
|
+
null,
|
|
337
|
+
_react2.default.createElement(
|
|
338
|
+
"div",
|
|
339
|
+
{
|
|
340
|
+
style: {
|
|
341
|
+
height: this.props.height - 40 + "px",
|
|
342
|
+
width: this.props.width
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
this.props.isSinger === true ? _react2.default.createElement(
|
|
346
|
+
"div",
|
|
347
|
+
{ style: { padding: "10px" } },
|
|
348
|
+
_react2.default.createElement(
|
|
349
|
+
"ul",
|
|
350
|
+
null,
|
|
351
|
+
this.buildRightTig(this.props.selectRows)
|
|
352
|
+
)
|
|
353
|
+
) : "",
|
|
354
|
+
this.props.isSinger !== true ? _react2.default.createElement(
|
|
355
|
+
_reactCustomScrollbarsPatched.Scrollbars,
|
|
356
|
+
{
|
|
357
|
+
autoHide: true,
|
|
358
|
+
style: {
|
|
359
|
+
flex: "0 0 " + this.props.width + "px",
|
|
360
|
+
height: this.props.height - 40
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
_react2.default.createElement(
|
|
364
|
+
"div",
|
|
365
|
+
{ style: { padding: "10px" } },
|
|
366
|
+
_react2.default.createElement(
|
|
367
|
+
_index2.default,
|
|
368
|
+
{
|
|
369
|
+
component: "ul",
|
|
370
|
+
dragClassName: "list-drag-selected",
|
|
371
|
+
appearAnim: { type: ["right", "left"], leaveReverse: true },
|
|
372
|
+
onChange: this.handleSortChange
|
|
373
|
+
},
|
|
374
|
+
this.buildRightTig(this.props.selectRows)
|
|
375
|
+
)
|
|
376
|
+
)
|
|
377
|
+
) : ""
|
|
378
|
+
),
|
|
379
|
+
_react2.default.createElement(
|
|
380
|
+
"div",
|
|
381
|
+
{ style: { height: "40px", width: this.props.width } },
|
|
382
|
+
this.showFooter()
|
|
383
|
+
)
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}]);
|
|
388
|
+
return ResultView;
|
|
389
|
+
}(_react2.default.Component);
|
|
390
|
+
|
|
391
|
+
ResultView.defaultProps = {
|
|
392
|
+
sign: undefined,
|
|
393
|
+
width: undefined, //宽度
|
|
394
|
+
height: undefined, //高度
|
|
395
|
+
footerRender: undefined, //底部渲染方法
|
|
396
|
+
rowRender: undefined, //每行数据渲染的方法,参数:key,title,row,len,seq
|
|
397
|
+
selectRows: undefined, //需要显示的结果数据
|
|
398
|
+
selectRowKeys: undefined, //选中的数据的主键列表
|
|
399
|
+
titleField: "title", //title字段名
|
|
400
|
+
keyField: "key", //title字段名
|
|
401
|
+
url: undefined, //初始化查询数据的url
|
|
402
|
+
mode: undefined,
|
|
403
|
+
updateSelectValues: function updateSelectValues() {}, //删除方法
|
|
404
|
+
isSinger: undefined, //是否单选
|
|
405
|
+
singerBottomShowFlag: undefined, //单选时,结果是否显示在下方
|
|
406
|
+
singerBottomShowRender: undefined //单选时,结果显示在下方的数据展示渲染的回调方法
|
|
407
|
+
};
|
|
408
|
+
exports.default = ResultView;
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SelectorModal = undefined;
|
|
7
|
+
|
|
8
|
+
var _modal = require("antd/lib/modal");
|
|
9
|
+
|
|
10
|
+
var _modal2 = _interopRequireDefault(_modal);
|
|
11
|
+
|
|
12
|
+
var _button = require("antd/lib/button");
|
|
13
|
+
|
|
14
|
+
var _button2 = _interopRequireDefault(_button);
|
|
15
|
+
|
|
16
|
+
var _divider = require("antd/lib/divider");
|
|
17
|
+
|
|
18
|
+
var _divider2 = _interopRequireDefault(_divider);
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of");
|
|
21
|
+
|
|
22
|
+
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
|
23
|
+
|
|
24
|
+
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
|
25
|
+
|
|
26
|
+
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
27
|
+
|
|
28
|
+
var _createClass2 = require("babel-runtime/helpers/createClass");
|
|
29
|
+
|
|
30
|
+
var _createClass3 = _interopRequireDefault(_createClass2);
|
|
31
|
+
|
|
32
|
+
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
|
|
33
|
+
|
|
34
|
+
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
|
35
|
+
|
|
36
|
+
var _inherits2 = require("babel-runtime/helpers/inherits");
|
|
37
|
+
|
|
38
|
+
var _inherits3 = _interopRequireDefault(_inherits2);
|
|
39
|
+
|
|
40
|
+
var _layout = require("antd/lib/layout");
|
|
41
|
+
|
|
42
|
+
var _layout2 = _interopRequireDefault(_layout);
|
|
43
|
+
|
|
44
|
+
require("antd/lib/modal/style");
|
|
45
|
+
|
|
46
|
+
require("antd/lib/button/style");
|
|
47
|
+
|
|
48
|
+
require("antd/lib/divider/style");
|
|
49
|
+
|
|
50
|
+
require("antd/lib/layout/style");
|
|
51
|
+
|
|
52
|
+
var _react = require("react");
|
|
53
|
+
|
|
54
|
+
var _react2 = _interopRequireDefault(_react);
|
|
55
|
+
|
|
56
|
+
var _propTypes = require("prop-types");
|
|
57
|
+
|
|
58
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
59
|
+
|
|
60
|
+
var _index = require("../../../index");
|
|
61
|
+
|
|
62
|
+
require("../../../../assets/selector/selectormodal/index.less");
|
|
63
|
+
|
|
64
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
65
|
+
|
|
66
|
+
var Sider = _layout2.default.Sider;
|
|
67
|
+
|
|
68
|
+
var SelectorModal = exports.SelectorModal = function (_React$Component) {
|
|
69
|
+
(0, _inherits3.default)(SelectorModal, _React$Component);
|
|
70
|
+
|
|
71
|
+
function SelectorModal(props) {
|
|
72
|
+
(0, _classCallCheck3.default)(this, SelectorModal);
|
|
73
|
+
|
|
74
|
+
var _this = (0, _possibleConstructorReturn3.default)(this, (SelectorModal.__proto__ || (0, _getPrototypeOf2.default)(SelectorModal)).call(this, props));
|
|
75
|
+
|
|
76
|
+
_this.show = function () {
|
|
77
|
+
_this.setState({ visible: true });
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
_this.close = function () {
|
|
81
|
+
_this.setState({ visible: false, confirmLoading: false });
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
_this.hideLoading = function () {
|
|
85
|
+
_this.setState({ confirmLoading: false });
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
_this.handleOk = function () {
|
|
89
|
+
_this.props.onOk();
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
_this.handleClear = function () {
|
|
93
|
+
_this.props.onClear && _this.props.onClear();
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
_this.handleCancel = function () {
|
|
97
|
+
_this.close();
|
|
98
|
+
_this.props.onCancel();
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
_this.state = {
|
|
102
|
+
visible: false, //默认不可见
|
|
103
|
+
confirmLoading: false, //确定按钮 loading
|
|
104
|
+
width: "",
|
|
105
|
+
height: _this.props.height ? _this.props.height : "500px"
|
|
106
|
+
};
|
|
107
|
+
return _this;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
(0, _createClass3.default)(SelectorModal, [{
|
|
111
|
+
key: "componentWillMount",
|
|
112
|
+
value: function componentWillMount() {
|
|
113
|
+
if (this.props.isSinger === true && this.props.singerBottomShowFlag === true) {
|
|
114
|
+
this.setState({
|
|
115
|
+
width: parseInt(this.props.treeWidth, 10) + parseInt(this.props.tableWidth, 10)
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
this.setState({
|
|
119
|
+
width: parseInt(this.props.treeWidth, 10) + parseInt(this.props.tableWidth, 10) + parseInt(this.props.resultWidth, 10)
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//显示
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
//关闭
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
//隐藏加载动画
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
//确认
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
//清空
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
//取消
|
|
140
|
+
|
|
141
|
+
}, {
|
|
142
|
+
key: "render",
|
|
143
|
+
value: function render() {
|
|
144
|
+
var _state = this.state,
|
|
145
|
+
visible = _state.visible,
|
|
146
|
+
confirmLoading = _state.confirmLoading;
|
|
147
|
+
var _props = this.props,
|
|
148
|
+
title = _props.title,
|
|
149
|
+
zIndex = _props.zIndex,
|
|
150
|
+
wrapClassName = _props.wrapClassName,
|
|
151
|
+
className = _props.className;
|
|
152
|
+
|
|
153
|
+
var width = this.state.width;
|
|
154
|
+
var height = this.state.height;
|
|
155
|
+
var dividerWidth = this.props.mode === "treeAndTable" ? 2 : 1;
|
|
156
|
+
width = parseInt(width, 10) + dividerWidth;
|
|
157
|
+
|
|
158
|
+
var list = [];
|
|
159
|
+
if (this.props.mode === "tree" || this.props.mode === "treeAndTable") {
|
|
160
|
+
list.push(_react2.default.createElement(
|
|
161
|
+
Sider,
|
|
162
|
+
{
|
|
163
|
+
key: 11010001,
|
|
164
|
+
width: this.props.treeWidth,
|
|
165
|
+
style: {
|
|
166
|
+
height: height,
|
|
167
|
+
overflow: "hidden",
|
|
168
|
+
backgroundColor: "#fff"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
this.props.treeRender()
|
|
172
|
+
));
|
|
173
|
+
list.push(_react2.default.createElement(_divider2.default, {
|
|
174
|
+
key: 11010002,
|
|
175
|
+
type: "vertical",
|
|
176
|
+
style: { height: height, margin: "0px", paddingLeft: "1px" }
|
|
177
|
+
}));
|
|
178
|
+
}
|
|
179
|
+
if (this.props.mode === "table" || this.props.mode === "treeAndTable") {
|
|
180
|
+
list.push(_react2.default.createElement(
|
|
181
|
+
Sider,
|
|
182
|
+
{
|
|
183
|
+
key: 11010003,
|
|
184
|
+
width: this.props.tableWidth,
|
|
185
|
+
style: {
|
|
186
|
+
height: height,
|
|
187
|
+
overflow: "hidden",
|
|
188
|
+
backgroundColor: "#fff"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
this.props.tableRender()
|
|
192
|
+
));
|
|
193
|
+
list.push(_react2.default.createElement(_divider2.default, {
|
|
194
|
+
key: 11010004,
|
|
195
|
+
type: "vertical",
|
|
196
|
+
style: { height: height, margin: "0px", paddingLeft: "1px" }
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
if (this.props.isSinger !== true || this.props.singerBottomShowFlag !== true) {
|
|
200
|
+
list.push(_react2.default.createElement(
|
|
201
|
+
Sider,
|
|
202
|
+
{
|
|
203
|
+
key: 11010005,
|
|
204
|
+
width: this.props.resultWidth,
|
|
205
|
+
style: {
|
|
206
|
+
height: height,
|
|
207
|
+
overflow: "hidden",
|
|
208
|
+
backgroundColor: "#fff"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
this.props.resultRender ? this.props.resultRender() : undefined
|
|
212
|
+
));
|
|
213
|
+
}
|
|
214
|
+
var buttons = [];
|
|
215
|
+
if (this.props.isSinger === true && this.props.singerBottomShowFlag === true && this.props.resultRender) {
|
|
216
|
+
buttons.push(_react2.default.createElement(
|
|
217
|
+
"div",
|
|
218
|
+
{ key: 11010006 },
|
|
219
|
+
this.props.resultRender()
|
|
220
|
+
));
|
|
221
|
+
}
|
|
222
|
+
buttons.push(_react2.default.createElement(
|
|
223
|
+
_button2.default,
|
|
224
|
+
{ key: (0, _index.createUuid)(), type: "primary", onClick: this.handleOk },
|
|
225
|
+
"\u4FDD\u5B58"
|
|
226
|
+
));
|
|
227
|
+
buttons.push(_react2.default.createElement(
|
|
228
|
+
_button2.default,
|
|
229
|
+
{
|
|
230
|
+
key: (0, _index.createUuid)(),
|
|
231
|
+
type: "primary",
|
|
232
|
+
ghost: true,
|
|
233
|
+
onClick: this.handleClear
|
|
234
|
+
},
|
|
235
|
+
"\u6E05\u7A7A"
|
|
236
|
+
));
|
|
237
|
+
buttons.push(_react2.default.createElement(
|
|
238
|
+
_button2.default,
|
|
239
|
+
{
|
|
240
|
+
key: (0, _index.createUuid)(),
|
|
241
|
+
type: "primary",
|
|
242
|
+
ghost: true,
|
|
243
|
+
onClick: this.handleCancel
|
|
244
|
+
},
|
|
245
|
+
"\u53D6\u6D88"
|
|
246
|
+
));
|
|
247
|
+
return _react2.default.createElement(
|
|
248
|
+
"div",
|
|
249
|
+
null,
|
|
250
|
+
_react2.default.createElement(
|
|
251
|
+
_modal2.default,
|
|
252
|
+
{
|
|
253
|
+
title: title,
|
|
254
|
+
visible: visible,
|
|
255
|
+
width: width,
|
|
256
|
+
onCancel: this.handleCancel,
|
|
257
|
+
wrapClassName: "dlt-selector-vertical-center-modal " + wrapClassName,
|
|
258
|
+
confirmLoading: confirmLoading,
|
|
259
|
+
maskClosable: false,
|
|
260
|
+
footer: buttons,
|
|
261
|
+
zIndex: zIndex,
|
|
262
|
+
className: className
|
|
263
|
+
},
|
|
264
|
+
_react2.default.createElement(
|
|
265
|
+
"div",
|
|
266
|
+
{ style: { height: height } },
|
|
267
|
+
_react2.default.createElement(
|
|
268
|
+
_layout2.default,
|
|
269
|
+
null,
|
|
270
|
+
list
|
|
271
|
+
)
|
|
272
|
+
)
|
|
273
|
+
)
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
}]);
|
|
277
|
+
return SelectorModal;
|
|
278
|
+
}(_react2.default.Component);
|
|
279
|
+
|
|
280
|
+
SelectorModal.defaultProps = {
|
|
281
|
+
title: "标题",
|
|
282
|
+
mode: "treeAndTable", //模式:tree:只存在树,table:只存在列表,treeAndTable:存在树和列表
|
|
283
|
+
treeWidth: 0, //树宽度,250
|
|
284
|
+
tableWidth: 0, //列表宽度,600
|
|
285
|
+
resultWidth: 0, //结果区域宽度,150
|
|
286
|
+
treeRender: undefined,
|
|
287
|
+
tableRender: undefined,
|
|
288
|
+
resultRender: undefined,
|
|
289
|
+
onOk: function onOk() {},
|
|
290
|
+
onCancel: function onCancel() {},
|
|
291
|
+
onClear: function onClear() {},
|
|
292
|
+
isSinger: undefined, //是否单选
|
|
293
|
+
singerBottomShowFlag: undefined //单选时,结果是否显示在下方
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
SelectorModal.propTypes = {
|
|
297
|
+
title: _propTypes2.default.string, //对话框标题
|
|
298
|
+
onOk: _propTypes2.default.func, //保存事件回调方法
|
|
299
|
+
onCancel: _propTypes2.default.func, //返回事件回调方法
|
|
300
|
+
onClear: _propTypes2.default.func //清空回调事件
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
exports.default = SelectorModal;
|