fmui-base 2.3.5 → 2.3.7

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 CHANGED
@@ -3,6 +3,8 @@
3
3
  ---npm publish
4
4
 
5
5
  ## 更新日志
6
+ - 2.3.7:选人组件:搜索项改为即时搜索,输入过程中1秒后未输入触发搜索
7
+ - 2.3.6:待办表单支持切换组织
6
8
  - 2.3.5:联动字段保存后被清空
7
9
  - 2.3.4:移动端表单下拉单选和按钮按钮组件样式更换
8
10
  - 2.3.3:移动端表单下拉单选和按钮按钮组件样式更换
package/lib/db/db.js CHANGED
@@ -1111,6 +1111,35 @@ context.create('FlowModuleAPI', {
1111
1111
  // content: <Loading />
1112
1112
  // });
1113
1113
  }
1114
+ },
1115
+ getUserSetInfo: {
1116
+ mockUrl: 'query/getUserSetInfo.json',
1117
+ url: _variables2.default.URLS.getUserSetInfo,
1118
+ method: 'GET',
1119
+ header: {
1120
+ Authorization: 'Bearer ' + getLoginUserInfo().token
1121
+ },
1122
+ willFetch: function willFetch() {}
1123
+ },
1124
+ orgSwitch: {
1125
+ mockUrl: 'query/orgSwitch.json',
1126
+ url: _variables2.default.URLS.orgSwitch,
1127
+ method: 'POST',
1128
+ postDataFomat: 'FORM',
1129
+ header: {
1130
+ Authorization: 'Bearer ' + getLoginUserInfo().token
1131
+ },
1132
+ willFetch: function willFetch() {}
1133
+ },
1134
+ updateStartUserOrg: {
1135
+ mockUrl: 'query/updateStartUserOrg.json',
1136
+ url: _variables2.default.URLS.updateStartUserOrg,
1137
+ method: 'POST',
1138
+ postDataFomat: 'FORM',
1139
+ header: {
1140
+ Authorization: 'Bearer ' + getLoginUserInfo().token
1141
+ },
1142
+ willFetch: function willFetch() {}
1114
1143
  }
1115
1144
 
1116
1145
  });
@@ -140,7 +140,10 @@ exports.default = {
140
140
  getProcessListByCodes: approveUrlPrefix + "getProcessListByCodes" + '?', //获取可发起的子流程
141
141
  getRelaObjByRelaId: approveUrlPrefix + "getRelaObjByRelaId" + '?', //获取相关对象
142
142
  getUrgencyEnum: approveUrlPrefix + "getUrgencyEnum" + '?', //获取枚举
143
- getSysSettingByMark: approveUrlPrefix + "getSysSettingByMark" + '?' //获取系统设置
143
+ getSysSettingByMark: approveUrlPrefix + "getSysSettingByMark" + '?', //获取系统设置
144
+ getUserSetInfo: urlBasicPrefix + 'setting/userinfo/getUserSetInfo' + '?', //获取用户组织信息
145
+ orgSwitch: urlBasicPrefix + 'front/personal/orgSwitch' + '?', //切换组织
146
+ updateStartUserOrg: approveUrlPrefix + 'updateStartUserOrg' + '?' //更新发起人组织
144
147
  },
145
148
  nodataIcon: context + "/mobile/fmui/images/noData.png",
146
149
  loadingIcon: context + "/mobile/fmui/images/loading.gif",
@@ -137,6 +137,33 @@ function isSysTransferCommentRequired() {
137
137
  return getSysSettingByMark('approveTransferComment') == '1';
138
138
  }
139
139
 
140
+ /** 组织切换相关接口不可用(如后台未部署、404) */
141
+ function isApproveOrgApiUnavailableError(err) {
142
+ if (!err) {
143
+ return false;
144
+ }
145
+ var code = err.status || err.statusCode || err.code;
146
+ if (code == 404 || code == '404') {
147
+ return true;
148
+ }
149
+ if (err.error) {
150
+ code = err.error.errorCode || err.error.code || err.error.status;
151
+ if (code == 404 || code == '404') {
152
+ return true;
153
+ }
154
+ }
155
+ var msg = '';
156
+ if (err.error && err.error.errorMsg) {
157
+ msg = err.error.errorMsg;
158
+ } else if (err.message) {
159
+ msg = err.message;
160
+ } else if (typeof err === 'string') {
161
+ msg = err;
162
+ }
163
+ msg = (msg || '').toLowerCase();
164
+ return msg.indexOf('404') >= 0 || msg.indexOf('not found') >= 0;
165
+ }
166
+
140
167
  var isCaReload = false;
141
168
  window.addEventListener('pageshow', function () {
142
169
  console.log("isCaReload===" + isCaReload);
@@ -487,7 +514,7 @@ var PageHome = function (_React$Component) {
487
514
  selectProcessCode: '', //选中的子流程
488
515
  subProcessType: '', //子流程类型 0串行 1并行
489
516
  urgencyList: [], //紧急程度列表
490
- urgency: '' }, _defineProperty(_param, 'urgent', ''), _defineProperty(_param, 'backInitiatorEndFlow', '0'), _defineProperty(_param, 'oauthWindowURL', ''), _defineProperty(_param, 'signDataId', ''), _defineProperty(_param, 'isCaUser', '0'), _defineProperty(_param, 'caFirm', ''), _defineProperty(_param, 'caESignatureName', ''), _defineProperty(_param, 'caFormSign', ''), _defineProperty(_param, 'addlotsReturn', ''), _defineProperty(_param, 'inscriptionShow', ''), _param);
517
+ urgency: '' }, _defineProperty(_param, 'urgent', ''), _defineProperty(_param, 'backInitiatorEndFlow', '0'), _defineProperty(_param, 'oauthWindowURL', ''), _defineProperty(_param, 'signDataId', ''), _defineProperty(_param, 'isCaUser', '0'), _defineProperty(_param, 'caFirm', ''), _defineProperty(_param, 'caESignatureName', ''), _defineProperty(_param, 'caFormSign', ''), _defineProperty(_param, 'addlotsReturn', ''), _defineProperty(_param, 'inscriptionShow', ''), _defineProperty(_param, 'showOrgSwitcher', false), _defineProperty(_param, 'approveOrgOptions', []), _defineProperty(_param, 'approveOrgSelectValue', {}), _defineProperty(_param, 'approveCurOrgId', ''), _defineProperty(_param, 'startUserOrgId', ''), _defineProperty(_param, 'taskAssignOrgId', ''), _defineProperty(_param, 'approveOrgApiUnavailable', false), _param);
491
518
  FlowCommon = require('pages/flow_common/' + module).default ? require('pages/flow_common/' + module).default : require('pages/flow_common/' + module);
492
519
 
493
520
  //处理特有参数
@@ -1517,8 +1544,11 @@ var PageHome = function (_React$Component) {
1517
1544
  caESignatureName: caESignatureName,
1518
1545
  caFormSign: caFormSign,
1519
1546
  addlotsReturn: addlotsReturn,
1520
- inscriptionShow: inscriptionShow
1547
+ inscriptionShow: inscriptionShow,
1548
+ startUserOrgId: content.startUserOrgId || content.startUserGroupId || '',
1549
+ taskAssignOrgId: content.taskAssignOrgId || ''
1521
1550
  }, function () {
1551
+ t.initApproveOrgSwitcher();
1522
1552
  t.refs["selectMember_circulate"].initSelectData();
1523
1553
  t.refs["selectMember_circulate1"].initSelectData();
1524
1554
 
@@ -7538,6 +7568,256 @@ var PageHome = function (_React$Component) {
7538
7568
  sendShortMessage: newremindStyle
7539
7569
  });
7540
7570
  }
7571
+ }, {
7572
+ key: 'hideApproveOrgSwitcherSilently',
7573
+ value: function hideApproveOrgSwitcherSilently() {
7574
+ this.setState({
7575
+ showOrgSwitcher: false,
7576
+ approveOrgOptions: [],
7577
+ approveOrgSelectValue: {},
7578
+ approveCurOrgId: '',
7579
+ approveOrgApiUnavailable: true
7580
+ });
7581
+ }
7582
+ }, {
7583
+ key: 'isApproveOrgSwitcherScene',
7584
+ value: function isApproveOrgSwitcherScene() {
7585
+ var permissionCode = this.state.permissionCode;
7586
+ return permissionCode == 'pending' || permissionCode == 'start' || permissionCode == 'draft';
7587
+ }
7588
+ }, {
7589
+ key: 'isApproveStartOrgUpdateScene',
7590
+ value: function isApproveStartOrgUpdateScene() {
7591
+ var permissionCode = this.state.permissionCode;
7592
+ return permissionCode == 'start' || permissionCode == 'draft' || this.state.isStart == true;
7593
+ }
7594
+ }, {
7595
+ key: 'resolveApproveOrgTargetId',
7596
+ value: function resolveApproveOrgTargetId(orgList, curOrgId, preferredOrgId, fallbackOrgId) {
7597
+ if (preferredOrgId) {
7598
+ for (var i = 0; i < orgList.length; i++) {
7599
+ if (orgList[i].id == preferredOrgId) {
7600
+ return preferredOrgId;
7601
+ }
7602
+ }
7603
+ }
7604
+ if (fallbackOrgId) {
7605
+ for (var i = 0; i < orgList.length; i++) {
7606
+ if (orgList[i].id == fallbackOrgId) {
7607
+ return fallbackOrgId;
7608
+ }
7609
+ }
7610
+ }
7611
+ return curOrgId;
7612
+ }
7613
+ }, {
7614
+ key: 'buildApproveOrgOption',
7615
+ value: function buildApproveOrgOption(org) {
7616
+ var orgName = org.name || org.orgNamePath || org.orgName || '';
7617
+ return {
7618
+ text: orgName,
7619
+ value: org.id
7620
+ };
7621
+ }
7622
+ }, {
7623
+ key: 'renderApproveOrgSwitcher',
7624
+ value: function renderApproveOrgSwitcher(orgList, selectedOrgId) {
7625
+ if (!orgList || orgList.length <= 1) {
7626
+ this.setState({
7627
+ showOrgSwitcher: false,
7628
+ approveOrgOptions: [],
7629
+ approveOrgSelectValue: {},
7630
+ approveCurOrgId: ''
7631
+ });
7632
+ return;
7633
+ }
7634
+ var options = [];
7635
+ var selectValue = {};
7636
+ for (var i = 0; i < orgList.length; i++) {
7637
+ var option = this.buildApproveOrgOption(orgList[i]);
7638
+ options.push(option);
7639
+ if (orgList[i].id == selectedOrgId) {
7640
+ selectValue = option;
7641
+ }
7642
+ }
7643
+ if (!selectValue.value && options.length > 0) {
7644
+ selectValue = options[0];
7645
+ selectedOrgId = selectValue.value;
7646
+ }
7647
+ this.setState({
7648
+ showOrgSwitcher: true,
7649
+ approveOrgOptions: options,
7650
+ approveOrgSelectValue: selectValue,
7651
+ approveCurOrgId: selectedOrgId || ''
7652
+ });
7653
+ }
7654
+ }, {
7655
+ key: 'initApproveOrgSwitcher',
7656
+ value: function initApproveOrgSwitcher() {
7657
+ var t = this;
7658
+ if (!t.isApproveOrgSwitcherScene() || t.state.approveOrgApiUnavailable) {
7659
+ return;
7660
+ }
7661
+ if (!window.approveOrgSwitcherSeq) {
7662
+ window.approveOrgSwitcherSeq = 0;
7663
+ }
7664
+ window.approveOrgSwitcherSeq++;
7665
+ var currentSeq = window.approveOrgSwitcherSeq;
7666
+ var autoSwitchKey = t.state.taskId || t.state.processInstanceId || '';
7667
+ if (!window.approveOrgAutoSwitchedMap) {
7668
+ window.approveOrgAutoSwitchedMap = {};
7669
+ }
7670
+ _db2.default.FlowModuleAPI.getUserSetInfo({}).then(function (userInfo) {
7671
+ if (currentSeq != window.approveOrgSwitcherSeq || t.state.approveOrgApiUnavailable) {
7672
+ return;
7673
+ }
7674
+ if (!userInfo) {
7675
+ t.hideApproveOrgSwitcherSilently();
7676
+ return;
7677
+ }
7678
+ if (userInfo.content && !userInfo.orgList) {
7679
+ userInfo = userInfo.content;
7680
+ }
7681
+ var orgList = userInfo.orgList || [];
7682
+ if (!orgList || orgList.length <= 1) {
7683
+ t.setState({ showOrgSwitcher: false });
7684
+ return;
7685
+ }
7686
+ var curOrgId = userInfo.curOrgId || '';
7687
+ var targetOrgId = t.resolveApproveOrgTargetId(orgList, curOrgId, t.state.taskAssignOrgId, t.state.startUserOrgId);
7688
+ if (targetOrgId && targetOrgId != curOrgId && !window.approveOrgAutoSwitchedMap[autoSwitchKey]) {
7689
+ t.switchApproveOrg(targetOrgId, function () {
7690
+ if (currentSeq != window.approveOrgSwitcherSeq) {
7691
+ return;
7692
+ }
7693
+ window.approveOrgAutoSwitchedMap[autoSwitchKey] = true;
7694
+ t.renderApproveOrgSwitcher(orgList, targetOrgId);
7695
+ }, function () {
7696
+ if (currentSeq != window.approveOrgSwitcherSeq) {
7697
+ return;
7698
+ }
7699
+ t.hideApproveOrgSwitcherSilently();
7700
+ }, { silent: true });
7701
+ return;
7702
+ }
7703
+ t.renderApproveOrgSwitcher(orgList, targetOrgId || curOrgId);
7704
+ }).catch(function (err) {
7705
+ if (currentSeq == window.approveOrgSwitcherSeq) {
7706
+ t.hideApproveOrgSwitcherSilently();
7707
+ }
7708
+ });
7709
+ }
7710
+ }, {
7711
+ key: 'handleApproveOrgSelect',
7712
+ value: function handleApproveOrgSelect(value) {
7713
+ var t = this;
7714
+ if (t.state.approveOrgApiUnavailable) {
7715
+ return;
7716
+ }
7717
+ if (!value || !value.value) {
7718
+ return;
7719
+ }
7720
+ var newOrgId = value.value;
7721
+ if (newOrgId == t.state.approveCurOrgId) {
7722
+ return;
7723
+ }
7724
+ var prevOrgId = t.state.approveCurOrgId;
7725
+ var prevSelectValue = t.state.approveOrgSelectValue;
7726
+ t.switchApproveOrg(newOrgId, function () {
7727
+ t.setState({
7728
+ approveCurOrgId: newOrgId,
7729
+ approveOrgSelectValue: value,
7730
+ startUserOrgId: t.isApproveStartOrgUpdateScene() ? newOrgId : t.state.startUserOrgId
7731
+ });
7732
+ }, function () {
7733
+ t.setState({
7734
+ approveCurOrgId: prevOrgId,
7735
+ approveOrgSelectValue: prevSelectValue
7736
+ });
7737
+ });
7738
+ }
7739
+ }, {
7740
+ key: 'switchApproveOrg',
7741
+ value: function switchApproveOrg(orgId, callback, failCallback, options) {
7742
+ var t = this;
7743
+ options = options || {};
7744
+ var silent = options.silent === true;
7745
+ var handleOrgApiError = function handleOrgApiError(err) {
7746
+ if (silent || isApproveOrgApiUnavailableError(err)) {
7747
+ t.hideApproveOrgSwitcherSilently();
7748
+ if (typeof failCallback === 'function') {
7749
+ failCallback();
7750
+ }
7751
+ return;
7752
+ }
7753
+ var errMsg = '组织切换失败';
7754
+ if (err && err.error && err.error.errorMsg) {
7755
+ errMsg = err.error.errorMsg;
7756
+ } else if (err && err.message) {
7757
+ errMsg = err.message;
7758
+ }
7759
+ _Toast2.default.show({
7760
+ type: 'error',
7761
+ content: errMsg
7762
+ });
7763
+ if (typeof failCallback === 'function') {
7764
+ failCallback();
7765
+ }
7766
+ };
7767
+ var afterOrgSwitchSuccess = function afterOrgSwitchSuccess() {
7768
+ if (t.isApproveStartOrgUpdateScene()) {
7769
+ var processInstanceId = t.state.processInstanceId || '';
7770
+ if (!processInstanceId) {
7771
+ if (typeof callback === 'function') {
7772
+ callback();
7773
+ }
7774
+ return;
7775
+ }
7776
+ _db2.default.FlowModuleAPI.updateStartUserOrg({
7777
+ processInstanceId: processInstanceId,
7778
+ orgId: orgId,
7779
+ userId: getLoginUserInfo().userId
7780
+ }).then(function () {
7781
+ if (typeof callback === 'function') {
7782
+ callback();
7783
+ }
7784
+ }).catch(function (err) {
7785
+ if (silent || isApproveOrgApiUnavailableError(err)) {
7786
+ t.hideApproveOrgSwitcherSilently();
7787
+ if (typeof callback === 'function') {
7788
+ callback();
7789
+ }
7790
+ return;
7791
+ }
7792
+ var errMsg = '更新发起人组织失败';
7793
+ if (err && err.error && err.error.errorMsg) {
7794
+ errMsg = err.error.errorMsg;
7795
+ } else if (err && err.message) {
7796
+ errMsg = err.message;
7797
+ }
7798
+ _Toast2.default.show({
7799
+ type: 'error',
7800
+ content: errMsg
7801
+ });
7802
+ if (typeof failCallback === 'function') {
7803
+ failCallback();
7804
+ }
7805
+ });
7806
+ return;
7807
+ }
7808
+ if (typeof callback === 'function') {
7809
+ callback();
7810
+ }
7811
+ };
7812
+ _db2.default.FlowModuleAPI.orgSwitch({
7813
+ curOrgIdRadios: orgId,
7814
+ curOrgId: orgId
7815
+ }).then(function () {
7816
+ afterOrgSwitchSuccess();
7817
+ }).catch(function (err) {
7818
+ handleOrgApiError(err);
7819
+ });
7820
+ }
7541
7821
  }, {
7542
7822
  key: 'changeUrgencyList',
7543
7823
  value: function changeUrgencyList(value) {
@@ -7842,6 +8122,23 @@ var PageHome = function (_React$Component) {
7842
8122
  )
7843
8123
  )
7844
8124
  ),
8125
+ _react2.default.createElement(
8126
+ 'div',
8127
+ { className: this.state.showOrgSwitcher ? 'approve-org-switch-wrap' : 't-DN' },
8128
+ _react2.default.createElement(
8129
+ _Group2.default.List,
8130
+ null,
8131
+ _react2.default.createElement(_SelectField2.default, {
8132
+ label: '\u5F53\u524D\u7EC4\u7EC7',
8133
+ readOnly: false,
8134
+ options: this.state.approveOrgOptions,
8135
+ placeholder: '\u8BF7\u9009\u62E9',
8136
+ onSelect: this.handleApproveOrgSelect.bind(this),
8137
+ value: this.state.approveOrgSelectValue,
8138
+ multiLine: true
8139
+ })
8140
+ )
8141
+ ),
7845
8142
  _react2.default.createElement(
7846
8143
  _Tab2.default,
7847
8144
  { activeKey: this.state.activeItemIndex == null ? '0' : this.state.activeItemIndex, onChange: this.handleChange.bind(this) },
@@ -1,4 +1,7 @@
1
1
  .approval-details{
2
2
  padding-bottom: calc(62px + constant(safe-area-inset-bottom)) !important; /* 兼容旧版 iOS */
3
3
  padding-bottom: calc(62px + env(safe-area-inset-bottom)) !important; /* 兼容新版 iOS */
4
+ }
5
+ .approve-org-switch-wrap{
6
+ background: #fff;
4
7
  }
@@ -8158,9 +8158,9 @@ var Page = function (_React$Component) {
8158
8158
  var props = {
8159
8159
  placeholder: "请输入",
8160
8160
  locale: 'zh_CN',
8161
- instantSearch: false,
8161
+ instantSearch: true, //即时搜索
8162
8162
  hasHistory: false,
8163
- searchDelay: 450,
8163
+ searchDelay: 1000, //输入过程中1秒后未输入才触发搜索
8164
8164
  onEnter: function onEnter() {
8165
8165
  var $searchbar = $(".select-member-div-class").find(".t-search-bar-input");
8166
8166
  $searchbar.attr('maxlength', 20);
@@ -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.5",
3
+ "version": "2.3.7",
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