dlt-for-react 1.0.23 → 1.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 +12 -2
- package/lib/components/Button/index.js +79 -0
- package/lib/components/HqSelector/HqLsrySelector/index.js +3 -5
- package/lib/components/HqSelector/HqRySelector/index.js +3 -5
- package/lib/components/HqSelector/HqWzSelector/index.js +3 -5
- package/lib/components/KyEditableTable/component.js +3 -5
- package/lib/components/KyEditableTable/index.js +7 -13
- package/lib/components/KyExcel/index.js +3 -5
- package/lib/components/KyInputPicker/render.js +13 -43
- package/lib/components/KyInputPicker/setting-checkbox.js +3 -5
- package/lib/components/KyInputPicker/setting-multiSelect.js +3 -5
- package/lib/components/KyInputPicker/setting-nhcascader.js +3 -5
- package/lib/components/KyInputPicker/setting-select.js +3 -5
- package/lib/components/KyInputPicker/setting-stu-selector.js +3 -5
- package/lib/components/KyInputPicker/setting-tea-selector.js +3 -5
- package/lib/components/KyTable/checkButtons.js +4 -7
- package/lib/components/KyTree/index.js +6 -16
- package/lib/components/KyUpload/index.js +13 -21
- package/lib/components/NHAuditPanel/config/Axios.js +263 -0
- package/lib/components/NHAuditPanel/config/api.js +479 -0
- package/lib/components/NHAuditPanel/config/data.js +156 -0
- package/lib/components/NHAuditPanel/config/typeMap.js +1234 -0
- package/lib/components/NHAuditPanel/config/uiValidate.js +92 -0
- package/lib/components/NHAuditPanel/index.js +413 -0
- package/lib/components/NHAuditPanel/node.js +619 -0
- package/lib/components/NHCascader/index.js +355 -0
- package/lib/components/NHCheckboxGroup/index.js +135 -0
- package/lib/components/NHDynamicFormShow/baseInfo/index.js +194 -0
- package/lib/components/NHDynamicFormShow/custom/index.js +553 -0
- package/lib/components/NHDynamicFormShow/customModule/common/CommonMethod.js +43 -0
- package/lib/components/NHDynamicFormShow/customModule/czxy/qgzx/EditForm.js +1113 -0
- package/lib/components/NHDynamicFormShow/customModule/czxy/qgzx/index.js +263 -0
- package/lib/components/NHDynamicFormShow/customModule/czxy/xfjm/EditForm.js +880 -0
- package/lib/components/NHDynamicFormShow/customModule/czxy/xfjm/index.js +171 -0
- package/lib/components/NHDynamicFormShow/customModule/czxy/zxj/EditForm.js +865 -0
- package/lib/components/NHDynamicFormShow/customModule/czxy/zxj/index.js +138 -0
- package/lib/components/NHDynamicFormShow/customModule/eszy/zsxxhd/EditForm.js +571 -0
- package/lib/components/NHDynamicFormShow/customModule/eszy/zsxxhd/index.js +147 -0
- package/lib/components/NHDynamicFormShow/customModule/eszy/zybjtz/EditForm.js +474 -0
- package/lib/components/NHDynamicFormShow/customModule/eszy/zybjtz/index.js +139 -0
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/cqzg/EditForm.js +506 -0
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/cqzg/index.js +143 -0
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/gwsb/EditForm.js +1074 -0
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/gwsb/index.js +172 -0
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/qjgl/EditForm.js +927 -0
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/qjgl/index.js +195 -0
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/sxsqj/EditForm.js +1064 -0
- package/lib/components/NHDynamicFormShow/customModule/gnyxy/sxsqj/index.js +183 -0
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/jxj/EditForm.js +763 -0
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/jxj/index.js +137 -0
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/lzjxj/EditForm.js +819 -0
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/lzjxj/index.js +137 -0
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/qgzx/EditForm.js +700 -0
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/qgzx/index.js +162 -0
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/xsqj/EditForm.js +743 -0
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/xsqj/index.js +177 -0
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/zxj/EditForm.js +848 -0
- package/lib/components/NHDynamicFormShow/customModule/hblgxy/zxj/index.js +138 -0
- package/lib/components/NHDynamicFormShow/customModule/hljwgy/qjgl/EditForm.js +777 -0
- package/lib/components/NHDynamicFormShow/customModule/hljwgy/qjgl/index.js +161 -0
- package/lib/components/NHDynamicFormShow/customModule/hljwgy/xjgl/EditForm.js +706 -0
- package/lib/components/NHDynamicFormShow/customModule/hljwgy/xjgl/index.js +130 -0
- package/lib/components/NHDynamicFormShow/customModule/jhysxy/cfjcsq/cfjcEditForm.js +413 -0
- package/lib/components/NHDynamicFormShow/customModule/jhysxy/cfjcsq/index.js +135 -0
- package/lib/components/NHDynamicFormShow/customModule/jhysxy/xsqj/EditForm.js +1013 -0
- package/lib/components/NHDynamicFormShow/customModule/jhysxy/xsqj/index.js +175 -0
- package/lib/components/NHDynamicFormShow/customModule/jjrlx/EditForm.js +1345 -0
- package/lib/components/NHDynamicFormShow/customModule/jjrlx/index.js +274 -0
- package/lib/components/NHDynamicFormShow/customModule/jxj/EditForm.js +669 -0
- package/lib/components/NHDynamicFormShow/customModule/jxj/index.js +134 -0
- package/lib/components/NHDynamicFormShow/customModule/jxsl/fqkns/EditForm.js +378 -0
- package/lib/components/NHDynamicFormShow/customModule/jxsl/fqkns/index.js +120 -0
- package/lib/components/NHDynamicFormShow/customModule/jxsl/xwryfjjd/EditForm.js +638 -0
- package/lib/components/NHDynamicFormShow/customModule/jxsl/xwryfjjd/index.js +133 -0
- package/lib/components/NHDynamicFormShow/customModule/qgzx/EditForm.js +965 -0
- package/lib/components/NHDynamicFormShow/customModule/qgzx/index.js +237 -0
- package/lib/components/NHDynamicFormShow/customModule/qjgl/EditForm.js +823 -0
- package/lib/components/NHDynamicFormShow/customModule/qjgl/index.js +188 -0
- package/lib/components/NHDynamicFormShow/customModule/rcgl/jqlssq/EditForm.js +401 -0
- package/lib/components/NHDynamicFormShow/customModule/rcgl/jqlssq/index.js +472 -0
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/EditForm.js +304 -0
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHCascader/index.js +375 -0
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/RadioGroup.js +118 -0
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/index.js +62 -0
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/input-const.js +55 -0
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/NHInputPicker/render.js +1238 -0
- package/lib/components/NHDynamicFormShow/customModule/rcgl/tssq/index.js +375 -0
- package/lib/components/NHDynamicFormShow/customModule/rych/collective/EditForm.js +554 -0
- package/lib/components/NHDynamicFormShow/customModule/rych/collective/index.js +130 -0
- package/lib/components/NHDynamicFormShow/customModule/rych/personal/EditForm.js +542 -0
- package/lib/components/NHDynamicFormShow/customModule/rych/personal/index.js +133 -0
- package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/collective/EditForm.js +575 -0
- package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/collective/index.js +130 -0
- package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/personal/EditForm.js +563 -0
- package/lib/components/NHDynamicFormShow/customModule/sxgy/rych/personal/index.js +133 -0
- package/lib/components/NHDynamicFormShow/customModule/whcz/qjgl/EditForm.js +745 -0
- package/lib/components/NHDynamicFormShow/customModule/whcz/qjgl/index.js +164 -0
- package/lib/components/NHDynamicFormShow/customModule/whcz/rccrxy/EditForm.js +587 -0
- package/lib/components/NHDynamicFormShow/customModule/whcz/rccrxy/index.js +143 -0
- package/lib/components/NHDynamicFormShow/customModule/whdlqjgl/EditForm.js +743 -0
- package/lib/components/NHDynamicFormShow/customModule/whdlqjgl/index.js +172 -0
- package/lib/components/NHDynamicFormShow/customModule/whgc/jjrlx/EditForm.js +1410 -0
- package/lib/components/NHDynamicFormShow/customModule/whgc/jjrlx/index.js +274 -0
- package/lib/components/NHDynamicFormShow/customModule/whgc/jxj/EditForm.js +755 -0
- package/lib/components/NHDynamicFormShow/customModule/whgc/jxj/index.js +130 -0
- package/lib/components/NHDynamicFormShow/customModule/whgc/qjgl/EditForm.js +814 -0
- package/lib/components/NHDynamicFormShow/customModule/whgc/qjgl/index.js +188 -0
- package/lib/components/NHDynamicFormShow/customModule/whgc/zxj/EditForm.js +769 -0
- package/lib/components/NHDynamicFormShow/customModule/whgc/zxj/index.js +130 -0
- package/lib/components/NHDynamicFormShow/customModule/whgcrych/EditForm.js +1004 -0
- package/lib/components/NHDynamicFormShow/customModule/whgcrych/index.js +126 -0
- package/lib/components/NHDynamicFormShow/customModule/whtl/jsrzsq/EditForm.js +503 -0
- package/lib/components/NHDynamicFormShow/customModule/whtl/jsrzsq/index.js +149 -0
- package/lib/components/NHDynamicFormShow/customModule/whtlyhk/EditForm.js +379 -0
- package/lib/components/NHDynamicFormShow/customModule/whtlyhk/index.js +148 -0
- package/lib/components/NHDynamicFormShow/customModule/whtlzxj/EditForm.js +748 -0
- package/lib/components/NHDynamicFormShow/customModule/whtlzxj/index.js +135 -0
- package/lib/components/NHDynamicFormShow/customModule/whtlzy/jxj/EditForm.js +762 -0
- package/lib/components/NHDynamicFormShow/customModule/whtlzy/jxj/index.js +134 -0
- package/lib/components/NHDynamicFormShow/customModule/wjcf/cfjc/cfjcEditForm.js +682 -0
- package/lib/components/NHDynamicFormShow/customModule/wjcf/cfjc/index.js +135 -0
- package/lib/components/NHDynamicFormShow/customModule/wjcf/wjsb/index.js +152 -0
- package/lib/components/NHDynamicFormShow/customModule/wjcf/wjsb/wjsbEditForm.js +783 -0
- package/lib/components/NHDynamicFormShow/customModule/zxj/EditForm.js +764 -0
- package/lib/components/NHDynamicFormShow/customModule/zxj/index.js +138 -0
- package/lib/components/NHDynamicFormShow/customModule/zzsd/cfjcsq/cfjcEditForm.js +677 -0
- package/lib/components/NHDynamicFormShow/customModule/zzsd/cfjcsq/index.js +138 -0
- package/lib/components/NHDynamicFormShow/customModule/zzsd/qjgl/EditForm.js +1173 -0
- package/lib/components/NHDynamicFormShow/customModule/zzsd/qjgl/index.js +242 -0
- package/lib/components/NHDynamicFormShow/customModule/zzsd/rcgl/rcxwgrdj/IndividualRegistForm.js +862 -0
- package/lib/components/NHDynamicFormShow/customModule/zzsd/rcgl/rcxwgrdj/IndividualRegistIndex.js +201 -0
- package/lib/components/NHDynamicFormShow/customModule/zzsd/stuinfo/messageInfo.js +196 -0
- package/lib/components/NHDynamicFormShow/customModule/zzsd/wjsb/index.js +167 -0
- package/lib/components/NHDynamicFormShow/customModule/zzsd/wjsb/wjsbEditForm.js +1096 -0
- package/lib/components/NHDynamicFormShow/index.js +647 -0
- package/lib/components/NHDynamicFormShow/oneOnMany/cardForm/cardItem/index.js +279 -0
- package/lib/components/NHDynamicFormShow/oneOnMany/cardForm/index.js +206 -0
- package/lib/components/NHDynamicFormShow/oneOnMany/index.js +419 -0
- package/lib/components/NHDynamicFormShow/oneOnOne/EditForm.js +401 -0
- package/lib/components/NHDynamicFormShow/oneOnOne/index.js +271 -0
- package/lib/components/NHImagePicker/index.js +554 -0
- package/lib/components/NHInputPicker/RadioGroup.js +118 -0
- package/lib/components/NHInputPicker/index.js +62 -0
- package/lib/components/NHInputPicker/input-const.js +55 -0
- package/lib/components/NHInputPicker/render.js +1271 -0
- package/lib/components/NHListView/index.js +374 -0
- package/lib/components/NHMapGeolocation/index.js +537 -0
- package/lib/components/NHMapGeolocation/initMap/initGdMap.js +104 -0
- package/lib/components/NHMapGeolocation/initMap/initTencentMap.js +138 -0
- package/lib/components/NHMapGeolocation/style.js +51 -0
- package/lib/components/NHMultiSelect/index.js +272 -0
- package/lib/components/NHRadioGroup/index.js +118 -0
- package/lib/components/NHSelect/index.js +364 -0
- package/lib/components/NHTreeMenu/index.js +126 -0
- package/lib/components/NHTreeMenu/treeNode.js +164 -0
- package/lib/components/StuSelector/index.js +611 -0
- package/lib/index.js +161 -116
- package/lib/layouts/KyInputPicker/edit-page.js +585 -0
- package/lib/layouts/KyInputPicker/index.js +220 -0
- package/lib/layouts/KyInputPicker/input-const.js +134 -0
- package/lib/layouts/KyInputPicker/render.js +2477 -0
- package/lib/layouts/KyInputPicker/setting-checkbox.js +850 -0
- package/lib/layouts/KyInputPicker/setting-datepicker.js +430 -0
- package/lib/layouts/KyInputPicker/setting-datetimepicker.js +443 -0
- package/lib/layouts/KyInputPicker/setting-input.js +555 -0
- package/lib/layouts/KyInputPicker/setting-inputNumber.js +612 -0
- package/lib/layouts/KyInputPicker/setting-monthpicker.js +434 -0
- package/lib/layouts/KyInputPicker/setting-multiSelect.js +532 -0
- package/lib/layouts/KyInputPicker/setting-nhcascader.js +584 -0
- package/lib/layouts/KyInputPicker/setting-old-upload.js +428 -0
- package/lib/layouts/KyInputPicker/setting-radio.js +468 -0
- package/lib/layouts/KyInputPicker/setting-rangepicker.js +466 -0
- package/lib/layouts/KyInputPicker/setting-select.js +534 -0
- package/lib/layouts/KyInputPicker/setting-stu-selector.js +507 -0
- package/lib/layouts/KyInputPicker/setting-switch.js +274 -0
- package/lib/layouts/KyInputPicker/setting-tea-selector.js +507 -0
- package/lib/layouts/KyInputPicker/setting-textarea.js +619 -0
- package/lib/layouts/KyInputPicker/setting-timepicker.js +437 -0
- package/lib/layouts/KyInputPicker/setting-upload.js +766 -0
- package/lib/layouts/KyModal/buildTitle.js +81 -0
- package/lib/layouts/KyModal/dragM.js +127 -0
- package/lib/layouts/KyModal/index.js +321 -0
- package/lib/layouts/KyPreview/index.js +219 -0
- package/lib/layouts/KyUpload/index.js +1155 -0
- package/lib/layouts/LeftMenu/index.js +5 -11
- package/lib/layouts/NavigationBar/index.js +4 -10
- package/lib/layouts/Top/editPassWord.js +5 -7
- package/lib/layouts/Top/index.js +6 -20
- package/lib/layouts/TopMenu/index.js +11 -14
- package/lib/layouts/layout/index.js +7 -13
- package/lib/layouts/{Login → login}/index-pre.js +3 -5
- package/lib/layouts/{Login → login}/index.js +6 -8
- package/lib/layouts/{Login → login}/login.js +8 -17
- package/lib/layouts/mixTop/index.js +13 -28
- package/lib/layouts/settingDrawer/index.js +3 -5
- package/lib/routes/AuthorizedRoute.js +7 -13
- package/lib/utils/NHCore.js +46 -2
- package/lib/utils/base64.js +238 -0
- package/lib/utils/browserJudge.js +33 -0
- package/lib/utils/common.js +18 -20
- package/lib/utils/createUuid.js +11 -31
- package/lib/utils/device.js +44 -0
- package/lib/utils/dynamicLoadCss.js +14 -0
- package/lib/utils/dynamicLoadJs.js +21 -0
- package/lib/utils/getLoginUser.js +1 -1
- package/lib/utils/getSize.js +2 -11
- package/lib/utils/getStyle.js +26 -0
- package/lib/utils/getSuitHeight.js +49 -0
- package/lib/utils/hasAuth.js +11 -0
- package/lib/utils/index.js +1 -34
- package/lib/utils/loadJS.js +40 -0
- package/package.json +1 -1
- /package/lib/layouts/{Login → login}/lyPassword.js +0 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _picker = require('antd-mobile/lib/picker');
|
|
8
|
+
|
|
9
|
+
var _picker2 = _interopRequireDefault(_picker);
|
|
10
|
+
|
|
11
|
+
var _list = require('antd-mobile/lib/list');
|
|
12
|
+
|
|
13
|
+
var _list2 = _interopRequireDefault(_list);
|
|
14
|
+
|
|
15
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
16
|
+
|
|
17
|
+
require('antd-mobile/lib/picker/style/css');
|
|
18
|
+
|
|
19
|
+
require('antd-mobile/lib/list/style/css');
|
|
20
|
+
|
|
21
|
+
var _NHFetch = require('../../utils/NHFetch');
|
|
22
|
+
|
|
23
|
+
var _NHFetch2 = _interopRequireDefault(_NHFetch);
|
|
24
|
+
|
|
25
|
+
var _propTypes = require('prop-types');
|
|
26
|
+
|
|
27
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
28
|
+
|
|
29
|
+
var _react = require('react');
|
|
30
|
+
|
|
31
|
+
var _react2 = _interopRequireDefault(_react);
|
|
32
|
+
|
|
33
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
|
+
|
|
35
|
+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
|
|
36
|
+
|
|
37
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
38
|
+
|
|
39
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
40
|
+
|
|
41
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /*
|
|
42
|
+
* @Description: 下拉框
|
|
43
|
+
* @Author: zengweijin
|
|
44
|
+
* @Date: 2019-07-11 09:04:46
|
|
45
|
+
* @LastEditors: zengweijin
|
|
46
|
+
* @LastEditTime: 2020-10-22 13:47:11
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
// import NHFetch from '../../utils/NHFetch'
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
var NHSelect = function (_React$Component) {
|
|
53
|
+
_inherits(NHSelect, _React$Component);
|
|
54
|
+
|
|
55
|
+
function NHSelect(props) {
|
|
56
|
+
_classCallCheck(this, NHSelect);
|
|
57
|
+
|
|
58
|
+
var _this = _possibleConstructorReturn(this, (NHSelect.__proto__ || Object.getPrototypeOf(NHSelect)).call(this, props));
|
|
59
|
+
|
|
60
|
+
_this.loadRemoteDataUseUrl = function (flexibleUrl) {
|
|
61
|
+
var _this$props = _this.props,
|
|
62
|
+
params = _this$props.params,
|
|
63
|
+
baseUrl = _this$props.baseUrl;
|
|
64
|
+
|
|
65
|
+
(0, _NHFetch2.default)(baseUrl + flexibleUrl, 'GET', params).then(function (res) {
|
|
66
|
+
if (res) {
|
|
67
|
+
_this.parseData(res.data);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
_this.loadRemoteDataUseSign = function (sign) {
|
|
73
|
+
var baseUrl = _this.props.baseUrl;
|
|
74
|
+
(0, _NHFetch2.default)((baseUrl ? baseUrl : '') + "/proData/selectDataList", 'GET', { sign: sign }).then(function (res) {
|
|
75
|
+
if (res) {
|
|
76
|
+
_this.parseData(res.data);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
_this.loadLocalData = function () {
|
|
82
|
+
if (_this.props.dataSource) {
|
|
83
|
+
var nullOption = [{ value: '', label: '请选择...' }];
|
|
84
|
+
var newData = [].concat(nullOption, _toConsumableArray(_this.props.dataSource));
|
|
85
|
+
var realData = [].concat(nullOption, _toConsumableArray(_this.props.dataSource));
|
|
86
|
+
if ('parentValue' in _this.props) {
|
|
87
|
+
realData = newData.filter(function (item) {
|
|
88
|
+
// 因为nextProps.parentValue 的值可能是undefined
|
|
89
|
+
if ('PARENTVALUE' in item) {
|
|
90
|
+
return item.PARENTVALUE === _this.props.parentValue;
|
|
91
|
+
}
|
|
92
|
+
if ('parentValue' in item) {
|
|
93
|
+
return item.parentValue === _this.props.parentValue;
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
_this.setState({ data: newData, realData: realData });
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
_this.parseData = function (data) {
|
|
103
|
+
if (data) {
|
|
104
|
+
var nullOption = [];
|
|
105
|
+
var newData = [].concat(nullOption, _toConsumableArray(data));
|
|
106
|
+
var realData = [].concat(nullOption, _toConsumableArray(data));
|
|
107
|
+
if ('parentValue' in _this.props) {
|
|
108
|
+
realData = newData.filter(function (item) {
|
|
109
|
+
// 因为nextProps.parentValue 的值可能是undefined
|
|
110
|
+
if ('PARENTVALUE' in item) {
|
|
111
|
+
return item.PARENTVALUE === _this.props.parentValue;
|
|
112
|
+
}
|
|
113
|
+
if ('parentValue' in item) {
|
|
114
|
+
return item.parentValue === _this.props.parentValue;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
_this.setState({ data: newData, realData: realData });
|
|
120
|
+
} else {
|
|
121
|
+
//如果远程数据为空,则尝试加载本地数据源
|
|
122
|
+
_this.loadLocalData();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
_this.getLabel = function (val) {
|
|
127
|
+
var item = _this.state.data.find(function (item) {
|
|
128
|
+
return (item.value || item.VALUE) === val[0];
|
|
129
|
+
});
|
|
130
|
+
var label = item.label || item.LABEL;
|
|
131
|
+
return label;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
_this.handleChange = function (val) {
|
|
135
|
+
if (!('value' in _this.props)) {
|
|
136
|
+
_this.setState({
|
|
137
|
+
value: val
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
var onChange = _this.props.onChange;
|
|
141
|
+
if (onChange) {
|
|
142
|
+
onChange(val[0], _this.getLabel(val));
|
|
143
|
+
}
|
|
144
|
+
var onSelect = _this.props.onSelect;
|
|
145
|
+
if (onSelect) {
|
|
146
|
+
onSelect(val[0], _this.getLabel(val));
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
var value = _this.props.value ? [_this.props.value] : [];
|
|
151
|
+
_this.state = {
|
|
152
|
+
data: [],
|
|
153
|
+
value: value,
|
|
154
|
+
realData: []
|
|
155
|
+
};
|
|
156
|
+
return _this;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
_createClass(NHSelect, [{
|
|
160
|
+
key: 'componentDidMount',
|
|
161
|
+
value: function componentDidMount() {
|
|
162
|
+
var _props = this.props,
|
|
163
|
+
flexibleUrl = _props.flexibleUrl,
|
|
164
|
+
sign = _props.sign;
|
|
165
|
+
//优先支持自定义的url以满足更复杂的请求
|
|
166
|
+
|
|
167
|
+
if (flexibleUrl && flexibleUrl != '') {
|
|
168
|
+
this.loadRemoteDataUseUrl(flexibleUrl);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
//如果是使用数据源标识,则优先加载远程数据
|
|
172
|
+
if (sign && sign !== '') {
|
|
173
|
+
this.loadRemoteDataUseSign(sign);
|
|
174
|
+
} else {
|
|
175
|
+
//如果没有使用远程数据,则加载本地数据
|
|
176
|
+
this.loadLocalData();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
//数据回传格式需要正确格式为[{LABEL:"",VALUE:""},{LABEL:"",VALUE:""}]
|
|
181
|
+
|
|
182
|
+
//加载远程数据
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
//加载本地数据
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
//解析数据
|
|
189
|
+
|
|
190
|
+
}, {
|
|
191
|
+
key: 'render',
|
|
192
|
+
value: function render() {
|
|
193
|
+
var _props2 = this.props,
|
|
194
|
+
style = _props2.style,
|
|
195
|
+
placeholder = _props2.placeholder,
|
|
196
|
+
disabled = _props2.disabled,
|
|
197
|
+
defaultValue = _props2.defaultValue,
|
|
198
|
+
filterData = _props2.filterData,
|
|
199
|
+
error = _props2.error;
|
|
200
|
+
var _state = this.state,
|
|
201
|
+
value = _state.value,
|
|
202
|
+
realData = _state.realData;
|
|
203
|
+
|
|
204
|
+
var options = [];
|
|
205
|
+
var data = realData;
|
|
206
|
+
//如果有过滤条件
|
|
207
|
+
if (filterData) {
|
|
208
|
+
var type = filterData.type,
|
|
209
|
+
_filterData$filterkey = filterData.filterkeys,
|
|
210
|
+
filterkeys = _filterData$filterkey === undefined ? [] : _filterData$filterkey;
|
|
211
|
+
|
|
212
|
+
switch (type) {
|
|
213
|
+
//过滤掉指定key值
|
|
214
|
+
case 'remove':
|
|
215
|
+
{
|
|
216
|
+
options = data.filter(function (item) {
|
|
217
|
+
if (filterkeys.find(function (key) {
|
|
218
|
+
return (item.VALUE || item.value) === key;
|
|
219
|
+
})) {
|
|
220
|
+
return false;
|
|
221
|
+
} else {
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
//保留指定key值
|
|
228
|
+
case 'save':
|
|
229
|
+
{
|
|
230
|
+
options = data.filter(function (item) {
|
|
231
|
+
if (filterkeys.find(function (key) {
|
|
232
|
+
return (item.VALUE || item.value) === key;
|
|
233
|
+
})) {
|
|
234
|
+
return true;
|
|
235
|
+
} else {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
//未找到指定过滤类型,则不做过滤
|
|
242
|
+
default:
|
|
243
|
+
{
|
|
244
|
+
/* options = data;*/
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
} else {
|
|
249
|
+
options = data;
|
|
250
|
+
}
|
|
251
|
+
if (defaultValue && value.length === 0) {
|
|
252
|
+
value = [defaultValue];
|
|
253
|
+
}
|
|
254
|
+
// 将大写转为小写
|
|
255
|
+
options = options.map(function (item) {
|
|
256
|
+
var i = {};
|
|
257
|
+
i.value = item.value || item.VALUE;
|
|
258
|
+
i.label = item.label || item.LABEL;
|
|
259
|
+
return i;
|
|
260
|
+
});
|
|
261
|
+
return _react2.default.createElement(
|
|
262
|
+
'div',
|
|
263
|
+
{ className: disabled ? 'nh-inputrender-disabled' : 'nh-inputrender' },
|
|
264
|
+
_react2.default.createElement(
|
|
265
|
+
_picker2.default,
|
|
266
|
+
{
|
|
267
|
+
style: style,
|
|
268
|
+
data: options,
|
|
269
|
+
value: value,
|
|
270
|
+
title: placeholder,
|
|
271
|
+
disabled: disabled,
|
|
272
|
+
onChange: this.handleChange,
|
|
273
|
+
cols: 1
|
|
274
|
+
},
|
|
275
|
+
_react2.default.createElement(
|
|
276
|
+
_list2.default.Item,
|
|
277
|
+
{ arrow: 'horizontal', wrap: true, error: error },
|
|
278
|
+
this.props.children
|
|
279
|
+
)
|
|
280
|
+
)
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
}], [{
|
|
284
|
+
key: 'getDerivedStateFromProps',
|
|
285
|
+
value: function getDerivedStateFromProps(nextProps, prevState) {
|
|
286
|
+
|
|
287
|
+
var updateState = {};
|
|
288
|
+
|
|
289
|
+
if ('value' in nextProps) {
|
|
290
|
+
var value = nextProps.value;
|
|
291
|
+
Object.assign(updateState, { value: [value] });
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if ('dataSource' in nextProps) {
|
|
295
|
+
var data = nextProps.dataSource;
|
|
296
|
+
Object.assign(updateState, { data: data });
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if ('parentValue' in nextProps) {
|
|
300
|
+
var realData = prevState.data.filter(function (item) {
|
|
301
|
+
// 因为nextProps.parentValue 的值可能是undefined
|
|
302
|
+
if ('PARENTVALUE' in item) {
|
|
303
|
+
return item.PARENTVALUE === nextProps.parentValue;
|
|
304
|
+
}
|
|
305
|
+
if ('parentValue' in item) {
|
|
306
|
+
return item.parentValue === nextProps.parentValue;
|
|
307
|
+
}
|
|
308
|
+
return false;
|
|
309
|
+
});
|
|
310
|
+
var _value = prevState.value;
|
|
311
|
+
if ('value' in nextProps) {
|
|
312
|
+
_value = [nextProps.value];
|
|
313
|
+
}
|
|
314
|
+
if (!(realData.findIndex(function (item) {
|
|
315
|
+
return item.value === _value[0] || item.VALUE === _value[0];
|
|
316
|
+
}) > -1)) {
|
|
317
|
+
_value = undefined;
|
|
318
|
+
if (prevState.data && prevState.data.length > 0 && nextProps.value !== _value && nextProps.onChange) {
|
|
319
|
+
// 此时需要重置值,并且通知也上一级(form)
|
|
320
|
+
nextProps.onChange(_value, '');
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
Object.assign(updateState, { realData: realData, value: _value });
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (Object.keys(updateState).length > 0) {
|
|
327
|
+
return updateState;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
}]);
|
|
333
|
+
|
|
334
|
+
return NHSelect;
|
|
335
|
+
}(_react2.default.Component);
|
|
336
|
+
|
|
337
|
+
//属性默认值
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
exports.default = NHSelect;
|
|
341
|
+
NHSelect.defaultProps = {
|
|
342
|
+
placeholder: '请选择',
|
|
343
|
+
disabled: false
|
|
344
|
+
|
|
345
|
+
//属性检查
|
|
346
|
+
};NHSelect.propTypes = {
|
|
347
|
+
sign: _propTypes2.default.string, //远程数据源标识
|
|
348
|
+
dataSource: _propTypes2.default.arrayOf(_propTypes2.default.shape({
|
|
349
|
+
value: _propTypes2.default.string,
|
|
350
|
+
label: _propTypes2.default.node
|
|
351
|
+
})), //本地数据源
|
|
352
|
+
style: _propTypes2.default.object, //样式
|
|
353
|
+
placeholder: _propTypes2.default.string, //下拉提示
|
|
354
|
+
disabled: _propTypes2.default.bool, //是否禁用
|
|
355
|
+
defaultValue: _propTypes2.default.string, //默认值
|
|
356
|
+
value: _propTypes2.default.string, //初始值
|
|
357
|
+
filterData: _propTypes2.default.shape({
|
|
358
|
+
type: _propTypes2.default.oneOf(['remove', 'save']), //是保留还是过滤掉
|
|
359
|
+
filterkeys: _propTypes2.default.array //保留或过滤的key值
|
|
360
|
+
}), //要过滤掉的Key值
|
|
361
|
+
onSelect: _propTypes2.default.func, //下拉选项选中时回调
|
|
362
|
+
onChange: _propTypes2.default.func, //下拉框值变化时回调
|
|
363
|
+
baseUrl: _propTypes2.default.string //请求路径的前缀,可通过改参数控制访问的后端服务,如果不设置,则会去访问当前前端服务对应的后端服务,例如:api/sm-bpm-expansion
|
|
364
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _button = require("antd-mobile/lib/button");
|
|
8
|
+
|
|
9
|
+
var _button2 = _interopRequireDefault(_button);
|
|
10
|
+
|
|
11
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
12
|
+
|
|
13
|
+
require("antd-mobile/lib/button/style/css");
|
|
14
|
+
|
|
15
|
+
var _react = require("react");
|
|
16
|
+
|
|
17
|
+
var _react2 = _interopRequireDefault(_react);
|
|
18
|
+
|
|
19
|
+
var _propTypes = require("prop-types");
|
|
20
|
+
|
|
21
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
22
|
+
|
|
23
|
+
var _treeNode = require("./treeNode.js");
|
|
24
|
+
|
|
25
|
+
var _treeNode2 = _interopRequireDefault(_treeNode);
|
|
26
|
+
|
|
27
|
+
require("../../../assets/NHTreeMenu/index.less");
|
|
28
|
+
|
|
29
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
+
|
|
31
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
32
|
+
|
|
33
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
34
|
+
|
|
35
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
36
|
+
// import css from './index.less';
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
var treeMenu = function (_Component) {
|
|
40
|
+
_inherits(treeMenu, _Component);
|
|
41
|
+
|
|
42
|
+
// Tree菜单
|
|
43
|
+
function treeMenu(props) {
|
|
44
|
+
_classCallCheck(this, treeMenu);
|
|
45
|
+
|
|
46
|
+
return _possibleConstructorReturn(this, (treeMenu.__proto__ || Object.getPrototypeOf(treeMenu)).call(this, props));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_createClass(treeMenu, [{
|
|
50
|
+
key: "render",
|
|
51
|
+
value: function render() {
|
|
52
|
+
var _props = this.props,
|
|
53
|
+
dataList = _props.dataList,
|
|
54
|
+
selectedData = _props.selectedData,
|
|
55
|
+
onSelected = _props.onSelected;
|
|
56
|
+
|
|
57
|
+
var fullHeight = document.body.clientHeight;
|
|
58
|
+
var ifShowHeader = sessionStorage.getItem("showHeaderConfig");
|
|
59
|
+
return _react2.default.createElement(
|
|
60
|
+
"div",
|
|
61
|
+
null,
|
|
62
|
+
dataList instanceof Array ? _react2.default.createElement(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: "treeMenu",
|
|
66
|
+
style: {
|
|
67
|
+
height: ifShowHeader ? "calc(" + fullHeight + "px - 0.88rem - 0.88rem - 0.7rem)" : "calc(" + fullHeight + "px - 0.88rem - 0.88rem)",
|
|
68
|
+
overflow: "auto"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
dataList.map(function (d, index) {
|
|
72
|
+
return _react2.default.createElement(_treeNode2.default, {
|
|
73
|
+
dataList: d,
|
|
74
|
+
key: "treeNode-" + d.type + "-" + d.id,
|
|
75
|
+
onSelected: onSelected,
|
|
76
|
+
selectedData: selectedData
|
|
77
|
+
});
|
|
78
|
+
})
|
|
79
|
+
) : _react2.default.createElement("div", null),
|
|
80
|
+
_react2.default.createElement(
|
|
81
|
+
"div",
|
|
82
|
+
{ className: "treeMenu-button" },
|
|
83
|
+
_react2.default.createElement(
|
|
84
|
+
_button2.default,
|
|
85
|
+
{
|
|
86
|
+
type: "ghost",
|
|
87
|
+
inline: true,
|
|
88
|
+
size: "small",
|
|
89
|
+
onClick: this.props.onReset
|
|
90
|
+
},
|
|
91
|
+
"\u91CD\u7F6E"
|
|
92
|
+
),
|
|
93
|
+
_react2.default.createElement(
|
|
94
|
+
_button2.default,
|
|
95
|
+
{
|
|
96
|
+
type: "primary",
|
|
97
|
+
inline: true,
|
|
98
|
+
size: "small",
|
|
99
|
+
onClick: this.props.onComfirm
|
|
100
|
+
},
|
|
101
|
+
"\u786E\u5B9A"
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}]);
|
|
107
|
+
|
|
108
|
+
return treeMenu;
|
|
109
|
+
}(_react.Component);
|
|
110
|
+
|
|
111
|
+
// 属性默认值
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
exports.default = treeMenu;
|
|
115
|
+
treeMenu.defaultProps = {
|
|
116
|
+
// dataList: [],
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// 属性检查
|
|
120
|
+
treeMenu.propTypes = {
|
|
121
|
+
// dataList: PropTypes.array, //树级的数据
|
|
122
|
+
onSelected: _propTypes2.default.func, //选中的事件
|
|
123
|
+
selectedData: _propTypes2.default.array, //所选的数据
|
|
124
|
+
onClose: _propTypes2.default.func, //点击确认后执行的事件
|
|
125
|
+
onReset: _propTypes2.default.func //点击重置后执行的事件
|
|
126
|
+
};
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _accordion = require('antd-mobile/lib/accordion');
|
|
8
|
+
|
|
9
|
+
var _accordion2 = _interopRequireDefault(_accordion);
|
|
10
|
+
|
|
11
|
+
var _list = require('antd-mobile/lib/list');
|
|
12
|
+
|
|
13
|
+
var _list2 = _interopRequireDefault(_list);
|
|
14
|
+
|
|
15
|
+
var _radio = require('antd-mobile/lib/radio');
|
|
16
|
+
|
|
17
|
+
var _radio2 = _interopRequireDefault(_radio);
|
|
18
|
+
|
|
19
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
20
|
+
|
|
21
|
+
require('antd-mobile/lib/accordion/style/css');
|
|
22
|
+
|
|
23
|
+
require('antd-mobile/lib/list/style/css');
|
|
24
|
+
|
|
25
|
+
require('antd-mobile/lib/radio/style/css');
|
|
26
|
+
|
|
27
|
+
var _react = require('react');
|
|
28
|
+
|
|
29
|
+
var _react2 = _interopRequireDefault(_react);
|
|
30
|
+
|
|
31
|
+
var _propTypes = require('prop-types');
|
|
32
|
+
|
|
33
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
34
|
+
|
|
35
|
+
var _treeNode = require('./treeNode.js');
|
|
36
|
+
|
|
37
|
+
var _treeNode2 = _interopRequireDefault(_treeNode);
|
|
38
|
+
|
|
39
|
+
require('../../../assets/NHTreeMenu/index.less');
|
|
40
|
+
|
|
41
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
42
|
+
|
|
43
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
44
|
+
|
|
45
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
46
|
+
|
|
47
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /*
|
|
48
|
+
* @Description:
|
|
49
|
+
* @Author: lisenlin
|
|
50
|
+
* @Date: 2021-03-05 09:16:35
|
|
51
|
+
* @LastEditors: lisenlin
|
|
52
|
+
* @LastEditTime: 2021-03-09 10:19:22
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
var treeNode = function (_Component) {
|
|
57
|
+
_inherits(treeNode, _Component);
|
|
58
|
+
|
|
59
|
+
// Tree菜单节点
|
|
60
|
+
function treeNode(props) {
|
|
61
|
+
_classCallCheck(this, treeNode);
|
|
62
|
+
|
|
63
|
+
var _this = _possibleConstructorReturn(this, (treeNode.__proto__ || Object.getPrototypeOf(treeNode)).call(this, props));
|
|
64
|
+
|
|
65
|
+
_this.RadioClick = function (e) {
|
|
66
|
+
e.stopPropagation();
|
|
67
|
+
_this.props.onSelected(_this.props.dataList);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
_this.renderHeader = function (item, value) {
|
|
71
|
+
|
|
72
|
+
var selectedData = _this.props.selectedData;
|
|
73
|
+
return _react2.default.createElement(
|
|
74
|
+
'div',
|
|
75
|
+
{ className: item.type + '-TreeNode' },
|
|
76
|
+
_react2.default.createElement(
|
|
77
|
+
_radio2.default.RadioItem,
|
|
78
|
+
{ onClick: _this.RadioClick
|
|
79
|
+
// checked={item.id == selectedData.id}
|
|
80
|
+
, checked: selectedData.length > 0 && selectedData.findIndex(function (row) {
|
|
81
|
+
return row.id == item.id;
|
|
82
|
+
}) !== -1
|
|
83
|
+
},
|
|
84
|
+
value
|
|
85
|
+
)
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return _this;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 渲染有下一级别(有children)的选项,父级选项
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
_createClass(treeNode, [{
|
|
96
|
+
key: 'render',
|
|
97
|
+
value: function render() {
|
|
98
|
+
var _this2 = this;
|
|
99
|
+
|
|
100
|
+
var data = this.props.dataList;
|
|
101
|
+
var selectedData = this.props.selectedData;
|
|
102
|
+
var Header = this.renderHeader(data, data.value);
|
|
103
|
+
return data && (!data.children || data.children.length === 0) ?
|
|
104
|
+
// 渲染无下一级别(无children)的选项
|
|
105
|
+
_react2.default.createElement(
|
|
106
|
+
'div',
|
|
107
|
+
{ className: data.type + '-TreeNode' },
|
|
108
|
+
_react2.default.createElement(
|
|
109
|
+
_list2.default,
|
|
110
|
+
{
|
|
111
|
+
className: 'under-list'
|
|
112
|
+
},
|
|
113
|
+
_react2.default.createElement(
|
|
114
|
+
_radio2.default.RadioItem,
|
|
115
|
+
{ onClick: this.RadioClick,
|
|
116
|
+
checked: selectedData.length > 0 && selectedData.findIndex(function (row) {
|
|
117
|
+
return row.id == data.id;
|
|
118
|
+
}) !== -1
|
|
119
|
+
// checked={selectedData.id==data.id}
|
|
120
|
+
},
|
|
121
|
+
data.value
|
|
122
|
+
)
|
|
123
|
+
)
|
|
124
|
+
) : _react2.default.createElement(
|
|
125
|
+
'div',
|
|
126
|
+
null,
|
|
127
|
+
_react2.default.createElement(
|
|
128
|
+
_accordion2.default,
|
|
129
|
+
null,
|
|
130
|
+
_react2.default.createElement(
|
|
131
|
+
_accordion2.default.Panel,
|
|
132
|
+
{ header: Header, className: 'tree-accordion-panel' },
|
|
133
|
+
data && data.children && data.children.map(function (item, index) {
|
|
134
|
+
// 若存在子元素,则继续遍历
|
|
135
|
+
return _react2.default.createElement(_treeNode2.default, {
|
|
136
|
+
dataList: item,
|
|
137
|
+
onSelected: _this2.props.onSelected,
|
|
138
|
+
key: 'treeNodeHasChildren-' + item.type + '-' + item.id,
|
|
139
|
+
selectedData: selectedData
|
|
140
|
+
});
|
|
141
|
+
})
|
|
142
|
+
)
|
|
143
|
+
)
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
}]);
|
|
147
|
+
|
|
148
|
+
return treeNode;
|
|
149
|
+
}(_react.Component);
|
|
150
|
+
|
|
151
|
+
// 属性默认值
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
exports.default = treeNode;
|
|
155
|
+
treeNode.defaultProps = {}
|
|
156
|
+
// dataList: [],
|
|
157
|
+
|
|
158
|
+
// 属性检查
|
|
159
|
+
;treeNode.propTypes = {
|
|
160
|
+
// dataList: PropTypes.array, //树级的数据
|
|
161
|
+
onSelected: _propTypes2.default.func, //选中的事件
|
|
162
|
+
selectedData: _propTypes2.default.array //所选的数据
|
|
163
|
+
|
|
164
|
+
};
|