fmui-base 2.3.15 → 2.3.16

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.
@@ -951,7 +951,127 @@ var Page = function (_React$Component) {
951
951
  var t = this;
952
952
  var scopeList = this.state.scopeList;
953
953
  var chooseType = this.getChooseType();
954
- if ("user" == type) {
954
+ if ("common" == type) {
955
+ var commonCheckAll = t.state.commonCheckAll;
956
+ commonCheckAll = !commonCheckAll;
957
+ var commonUsedData = t.state.commonUsedData;
958
+ var total = t.state.total;
959
+ var selectCommonNum = t.state.selectCommonNum;
960
+ var selectedList = t.state.selectedList;
961
+ var selectUsers = selectedList.selectUsers;
962
+ var selectOrgs = selectedList.selectOrgs;
963
+ var selectRoles = selectedList.selectRoles;
964
+ var selectStations = selectedList.selectStations;
965
+ var selectGroups = selectedList.selectGroups;
966
+ if (selectUsers == null || selectUsers == undefined) {
967
+ selectUsers = [];
968
+ }
969
+ if (selectOrgs == null || selectOrgs == undefined) {
970
+ selectOrgs = [];
971
+ }
972
+ if (selectRoles == null || selectRoles == undefined) {
973
+ selectRoles = [];
974
+ }
975
+ if (selectStations == null || selectStations == undefined) {
976
+ selectStations = [];
977
+ }
978
+ if (selectGroups == null || selectGroups == undefined) {
979
+ selectGroups = [];
980
+ }
981
+ if (commonCheckAll) {
982
+ for (var i = 0; i < commonUsedData.length; i++) {
983
+ var common = commonUsedData[i];
984
+ if (!common.checked) {
985
+ commonUsedData[i].checked = true;
986
+ total++;
987
+ selectCommonNum++;
988
+ var selectedData = { id: common.scopeValue };
989
+ var selectData = null;
990
+ if (common.scopeType == "user") {
991
+ selectedData.userName = common.scopeName;
992
+ selectedData.imageId = common.imageId;
993
+ selectData = selectUsers;
994
+ } else if (common.scopeType == "org") {
995
+ selectedData.orgName = common.scopeName;
996
+ selectData = selectOrgs;
997
+ } else if (common.scopeType == "role") {
998
+ selectedData.roleName = common.scopeName;
999
+ selectData = selectRoles;
1000
+ } else if (common.scopeType == "station") {
1001
+ selectedData.stationName = common.scopeName;
1002
+ selectData = selectStations;
1003
+ } else if (common.scopeType == "group") {
1004
+ selectedData.groupName = common.scopeName;
1005
+ selectData = selectGroups;
1006
+ }
1007
+ if (selectData != null) {
1008
+ var flag = true;
1009
+ for (var j = 0; j < selectData.length; j++) {
1010
+ if (selectData[j].id == common.scopeValue) {
1011
+ flag = false;
1012
+ break;
1013
+ }
1014
+ }
1015
+ if (flag) {
1016
+ selectData.push(selectedData);
1017
+ scopeList.push(commonUsedData[i]);
1018
+ }
1019
+ }
1020
+ }
1021
+ }
1022
+ } else {
1023
+ for (var i = 0; i < commonUsedData.length; i++) {
1024
+ var common = commonUsedData[i];
1025
+ if (common.checked) {
1026
+ commonUsedData[i].checked = false;
1027
+ total--;
1028
+ selectCommonNum--;
1029
+ var selectData = null;
1030
+ if (common.scopeType == "user") {
1031
+ selectData = selectUsers;
1032
+ } else if (common.scopeType == "org") {
1033
+ selectData = selectOrgs;
1034
+ } else if (common.scopeType == "role") {
1035
+ selectData = selectRoles;
1036
+ } else if (common.scopeType == "station") {
1037
+ selectData = selectStations;
1038
+ } else if (common.scopeType == "group") {
1039
+ selectData = selectGroups;
1040
+ }
1041
+ if (selectData != null) {
1042
+ for (var j = 0; j < selectData.length; j++) {
1043
+ if (selectData[j].id == common.scopeValue) {
1044
+ selectData.splice(j, 1);
1045
+ break;
1046
+ }
1047
+ }
1048
+ }
1049
+ for (var j = 0; j < scopeList.length; j++) {
1050
+ if (scopeList[j].scopeValue == common.scopeValue) {
1051
+ scopeList.splice(j, 1);
1052
+ break;
1053
+ }
1054
+ }
1055
+ }
1056
+ }
1057
+ }
1058
+ selectedList.selectUsers = selectUsers;
1059
+ selectedList.selectOrgs = selectOrgs;
1060
+ selectedList.selectRoles = selectRoles;
1061
+ selectedList.selectStations = selectStations;
1062
+ selectedList.selectGroups = selectGroups;
1063
+ var commonCheckState = t.syncCommonCheckState(commonUsedData);
1064
+ t.setState({
1065
+ commonUsedData: commonUsedData,
1066
+ total: total,
1067
+ selectCommonNum: commonCheckState.selectCommonNum,
1068
+ commonCheckAll: commonCheckState.commonCheckAll,
1069
+ selectedList: selectedList,
1070
+ scopeList: scopeList
1071
+ }, function () {
1072
+ _this2.instance.update(_this2.getContent());
1073
+ });
1074
+ } else if ("user" == type) {
955
1075
  var navList = t.state.navUserList;
956
1076
  var index = navList.length - 1;
957
1077
  navList[index].checkAll = !navList[index].checkAll;
@@ -2141,10 +2261,13 @@ var Page = function (_React$Component) {
2141
2261
  };
2142
2262
  commonUsedData.push(data);
2143
2263
  }
2264
+ var commonCheckState = t.syncCommonCheckState(commonUsedData);
2144
2265
  t.setState({
2145
2266
  commonTreeData: commonTreeData,
2146
2267
  commonUsedData: commonUsedData,
2147
2268
  selectUserNum: selectUserNum,
2269
+ selectCommonNum: commonCheckState.selectCommonNum,
2270
+ commonCheckAll: commonCheckState.commonCheckAll,
2148
2271
  navCommonList: navList,
2149
2272
  isShowNav: isShowNav,
2150
2273
  isShowCheckAll: isShowCheckAll
@@ -3924,9 +4047,12 @@ var Page = function (_React$Component) {
3924
4047
  };
3925
4048
  commonUsedData.push(data);
3926
4049
  }
4050
+ var commonCheckState = t.syncCommonCheckState(commonUsedData);
3927
4051
  stateParam = {
3928
4052
  commonTreeData: commonTreeData,
3929
4053
  commonUsedData: commonUsedData,
4054
+ selectCommonNum: commonCheckState.selectCommonNum,
4055
+ commonCheckAll: commonCheckState.commonCheckAll,
3930
4056
  navCommonList: navList,
3931
4057
  isShowNav: true,
3932
4058
  isShowCheckAll: isShowCheckAll
@@ -4148,7 +4274,7 @@ var Page = function (_React$Component) {
4148
4274
  }
4149
4275
  var result = t.checkOneCommonItem(commonUsedData[index].checked, selectData, commonUsedData, selectedData, checkType, total, selectCommonNum, index, scopeList);
4150
4276
  total = result.total;
4151
- selectUserNum = result.selectNum;
4277
+ selectCommonNum = result.selectNum;
4152
4278
  if (common.scopeType == "user") {
4153
4279
  selectedList.selectUsers = selectData;
4154
4280
  } else if (common.scopeType == "org") {
@@ -4160,10 +4286,12 @@ var Page = function (_React$Component) {
4160
4286
  } else if (common.scopeType == "group") {
4161
4287
  selectedList.selectGroups = selectData;
4162
4288
  }
4289
+ var commonCheckState = t.syncCommonCheckState(commonUsedData);
4163
4290
  t.setState({
4164
4291
  commonUsedData: commonUsedData,
4165
4292
  total: total,
4166
- selectCommonNum: selectUserNum,
4293
+ selectCommonNum: commonCheckState.selectCommonNum,
4294
+ commonCheckAll: commonCheckState.commonCheckAll,
4167
4295
  selectedList: selectedList,
4168
4296
  scopeList: scopeList
4169
4297
  }, function () {
@@ -5698,6 +5826,23 @@ var Page = function (_React$Component) {
5698
5826
  }
5699
5827
  }
5700
5828
 
5829
+ // 根据 commonUsedData 实际选中状态同步全选(仿照 roleCheckAll 逻辑)
5830
+
5831
+ }, {
5832
+ key: 'syncCommonCheckState',
5833
+ value: function syncCommonCheckState(commonUsedData) {
5834
+ var selectCommonNum = 0;
5835
+ if (commonUsedData != null && commonUsedData != undefined && commonUsedData.length > 0) {
5836
+ for (var i = 0; i < commonUsedData.length; i++) {
5837
+ if (commonUsedData[i].checked) {
5838
+ selectCommonNum++;
5839
+ }
5840
+ }
5841
+ }
5842
+ var commonCheckAll = commonUsedData != null && commonUsedData != undefined && commonUsedData.length > 0 && selectCommonNum == commonUsedData.length;
5843
+ return { selectCommonNum: selectCommonNum, commonCheckAll: commonCheckAll };
5844
+ }
5845
+
5701
5846
  //修改获取的常用数据选中状态
5702
5847
 
5703
5848
  }, {
@@ -5799,10 +5944,10 @@ var Page = function (_React$Component) {
5799
5944
  commonTreeData.push(data);
5800
5945
  }
5801
5946
  }
5802
- selectCommonNum = t.commonDataChecked(commonUsedData);
5803
- if (selectCommonNum == commonUsedData.length) {
5804
- commonCheckAll = true;
5805
- }
5947
+ t.commonDataChecked(commonUsedData);
5948
+ var commonCheckState = t.syncCommonCheckState(commonUsedData);
5949
+ selectCommonNum = commonCheckState.selectCommonNum;
5950
+ commonCheckAll = commonCheckState.commonCheckAll;
5806
5951
  }
5807
5952
 
5808
5953
  if (commonUsedDataSearch != null && commonUsedDataSearch != undefined && commonUsedDataSearch.length > 0) {
@@ -6383,23 +6528,19 @@ var Page = function (_React$Component) {
6383
6528
  var t = this;
6384
6529
  var chooseType = this.getChooseType();
6385
6530
  if (obj.activeKey == "common") {
6386
- var commonUsedData = t.state.commonUsedData;
6387
- var selectCommonNum = 0;
6388
- var commonCheckAll = false;
6389
- if (commonUsedData != null && commonUsedData != undefined && commonUsedData.length > 0) {
6390
- selectCommonNum = t.commonDataChecked(commonUsedData);
6391
- if (selectCommonNum == commonUsedData.length) {
6392
- commonCheckAll = true;
6393
- }
6394
- }
6395
6531
  var isShowCheckAll = true;
6396
6532
  if (checkType == "radio") {
6397
6533
  isShowCheckAll = false;
6398
6534
  }
6535
+ var commonUsedData = t.state.commonUsedData;
6536
+ if (commonUsedData != null && commonUsedData != undefined && commonUsedData.length > 0) {
6537
+ t.commonDataChecked(commonUsedData);
6538
+ }
6539
+ var commonCheckState = t.syncCommonCheckState(commonUsedData);
6399
6540
  t.setState({
6400
- selectCommonNum: selectCommonNum,
6541
+ selectCommonNum: commonCheckState.selectCommonNum,
6401
6542
  isShowCheckAll: isShowCheckAll,
6402
- commonCheckAll: commonCheckAll,
6543
+ commonCheckAll: commonCheckState.commonCheckAll,
6403
6544
  isShowNav: false,
6404
6545
  activeKey: obj.activeKey
6405
6546
  }, function () {
@@ -7413,20 +7554,16 @@ var Page = function (_React$Component) {
7413
7554
 
7414
7555
  }
7415
7556
 
7416
- var selectCommonNum = 0;
7417
7557
  if (commonSearchData.length > 0) {
7418
- selectCommonNum = t.commonDataChecked(commonSearchData);
7419
- }
7420
- var commonCheckAll = false;
7421
- if (commonSearchData != null && commonSearchData != undefined && selectCommonNum == commonSearchData.length) {
7422
- commonCheckAll = true;
7558
+ t.commonDataChecked(commonSearchData);
7423
7559
  }
7560
+ var commonCheckState = t.syncCommonCheckState(commonSearchData);
7424
7561
  t.setState({
7425
7562
  commonUsedData: commonSearchData,
7426
7563
  commonTreeData: commonTreeData,
7427
- selectCommonNum: selectCommonNum,
7564
+ selectCommonNum: commonCheckState.selectCommonNum,
7428
7565
  isShowCheckAll: isShowCheckAll,
7429
- commonCheckAll: commonCheckAll,
7566
+ commonCheckAll: commonCheckState.commonCheckAll,
7430
7567
  commonName: value,
7431
7568
  isShowNav: false,
7432
7569
  activeKey: type
@@ -8577,6 +8714,34 @@ var Page = function (_React$Component) {
8577
8714
  tabContent = _react2.default.createElement(
8578
8715
  'div',
8579
8716
  { id: 'anchor', style: { overflow: "auto", height: '' + t.state.tabHeight }, className: 't-PB68 dd-top-border scrollHeight t-PR' },
8717
+ _react2.default.createElement(
8718
+ 'div',
8719
+ { className: t.state.isShowCheckAll && t.state.commonUsedData.length > 0 ? "" : "t-DN" },
8720
+ _react2.default.createElement(
8721
+ 'div',
8722
+ { className: 't-PL16 t-PR16 t-LH3 dd-bottom-border t-BCf', onClick: function onClick() {
8723
+ t.checkAllMember("common");
8724
+ } },
8725
+ _react2.default.createElement(
8726
+ HBox,
8727
+ { vAlign: 'center' },
8728
+ _react2.default.createElement(
8729
+ HBox,
8730
+ null,
8731
+ _react2.default.createElement(
8732
+ 'div',
8733
+ { className: t.state.commonCheckAll ? 't-checkbox-field-icon-list checked' : 'un-checked t-checkbox-field-icon-list' },
8734
+ _react2.default.createElement('i', { className: 'iconfont icon-checked t-FCf t-FS14' })
8735
+ )
8736
+ ),
8737
+ _react2.default.createElement(
8738
+ Box,
8739
+ { flex: 1, className: 't-ML10' },
8740
+ '\u5168\u9009'
8741
+ )
8742
+ )
8743
+ )
8744
+ ),
8580
8745
  _react2.default.createElement(
8581
8746
  'div',
8582
8747
  { className: t.state.commonName == "" && t.state.isShowNav ? "t-BCf7 t-OFA t-WSN dd-bottom-border" : "t-DN" },
@@ -49,8 +49,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
49
49
 
50
50
  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; }
51
51
 
52
- 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; } /**
53
- * 流程批示意见区块(默认意见、退回意见等),与 TblForm 纯表单分离使用
52
+ 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; } /**
53
+ * 流程批示意见区块(默认意见、退回意见等),与 TblForm 纯表单分离使用
54
54
  */
55
55
 
56
56
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fmui-base",
3
- "version": "2.3.15",
3
+ "version": "2.3.16",
4
4
  "title": "fmui-base",
5
5
  "description": "fmui移动端组件",
6
6
  "main": "lib/index.js",
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _nvoice = require('./nvoice');
8
-
9
- Object.defineProperty(exports, 'default', {
10
- enumerable: true,
11
- get: function get() {
12
- return _interopRequireDefault(_nvoice).default;
13
- }
14
- });
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,177 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = undefined;
7
-
8
- 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; }; }();
9
-
10
- var _react = require('react');
11
-
12
- var _react2 = _interopRequireDefault(_react);
13
-
14
- var _Group = require('saltui/lib/Group');
15
-
16
- var _Group2 = _interopRequireDefault(_Group);
17
-
18
- var _Field = require('saltui/lib/Field');
19
-
20
- var _Field2 = _interopRequireDefault(_Field);
21
-
22
- var _upload = require('../upload/upload');
23
-
24
- var _upload2 = _interopRequireDefault(_upload);
25
-
26
- var _Boxs = require('saltui/lib/Boxs');
27
-
28
- var _Boxs2 = _interopRequireDefault(_Boxs);
29
-
30
- var _db = require('../db/db');
31
-
32
- var _db2 = _interopRequireDefault(_db);
33
-
34
- require('./nvoice.less');
35
-
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
-
38
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
39
-
40
- 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; }
41
-
42
- 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; }
43
-
44
- var HBox = _Boxs2.default.HBox,
45
- Box = _Boxs2.default.Box,
46
- VBox = _Boxs2.default.VBox;
47
-
48
- var Nvoice = function (_React$Component) {
49
- _inherits(Nvoice, _React$Component);
50
-
51
- function Nvoice(props) {
52
- _classCallCheck(this, Nvoice);
53
-
54
- // 传入的props参数
55
- var _this = _possibleConstructorReturn(this, (Nvoice.__proto__ || Object.getPrototypeOf(Nvoice)).call(this, props));
56
-
57
- _this.initFn = function (id) {
58
-
59
- // 初始发票详情数据
60
- _db2.default.form.getNoInvoiceList({
61
- invoicedataid: id
62
- }).then(function (content) {
63
- _this.setState({
64
- invoicedata: content
65
- });
66
- }).catch(function (error) {
67
- console.error('获取详情数据失败', error);
68
- });
69
- };
70
-
71
- var invoicedataid = _this.props.id;
72
- var title = _this.props.label || '发票详情';
73
- var required = _this.props.required || false;
74
-
75
- _this.state = {
76
- invoicedataid: invoicedataid,
77
- invoicedata: [],
78
- title: title,
79
- required: required
80
- };
81
-
82
- return _this;
83
- }
84
-
85
- _createClass(Nvoice, [{
86
- key: 'componentDidMount',
87
- value: function componentDidMount() {
88
- this.initFn(this.state.invoicedataid);
89
- }
90
- }, {
91
- key: 'downloadFile',
92
-
93
-
94
- // 下载函数
95
- value: function (_downloadFile) {
96
- function downloadFile(_x) {
97
- return _downloadFile.apply(this, arguments);
98
- }
99
-
100
- downloadFile.toString = function () {
101
- return _downloadFile.toString();
102
- };
103
-
104
- return downloadFile;
105
- }(function (file) {
106
- downloadFile(file.relaObjId);
107
- })
108
- }, {
109
- key: 'render',
110
- value: function render() {
111
- return _react2.default.createElement(
112
- _Group2.default.List,
113
- { borderTopNone: true },
114
- _react2.default.createElement(
115
- _Field2.default,
116
- { required: this.state.required, label: this.state.title, layout: 'h', multiLine: true },
117
- _react2.default.createElement(
118
- 'div',
119
- null,
120
- this.state.invoicedata.map(function (item, index) {
121
- var fileList = [];
122
- try {
123
- if (item.invoicefileInfo) {
124
- fileList = JSON.parse(item.invoicefileInfo);
125
- }
126
- } catch (e) {
127
- console.error('发票附件解析失败', e);
128
- }
129
-
130
- return _react2.default.createElement(
131
- 'div',
132
- { key: item.id, className: 't-MT2' },
133
- _react2.default.createElement(
134
- VBox,
135
- { className: 'nvoice-filetitle', hAlign: 'start' },
136
- _react2.default.createElement(
137
- Box,
138
- null,
139
- item.invoicename
140
- ),
141
- _react2.default.createElement(
142
- HBox,
143
- { vAlign: 'center' },
144
- _react2.default.createElement(
145
- Box,
146
- { className: 'label label-primary' },
147
- item.invoicetype
148
- ),
149
- _react2.default.createElement(
150
- Box,
151
- null,
152
- '\uFFE5',
153
- item.invoiceamount
154
- )
155
- )
156
- ),
157
- _react2.default.createElement(_upload2.default, {
158
- required: false,
159
- canDel: false,
160
- canPreview: true,
161
- canDownload: true,
162
- initList: fileList,
163
- dir: 'form_invoice',
164
- ref: 'upload_invoice'
165
- })
166
- );
167
- })
168
- )
169
- )
170
- );
171
- }
172
- }]);
173
-
174
- return Nvoice;
175
- }(_react2.default.Component);
176
-
177
- exports.default = Nvoice;
File without changes