fmui-base 2.2.86 → 2.2.87

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,7 @@
3
3
  ---npm publish
4
4
 
5
5
  ## 更新日志
6
+ - 2.2.87:选人组件添加隐藏页签,增加业务建模表单组件
6
7
  - 2.2.86: 流程表单按钮超过三个按钮显示更多,修改更多按钮样式,待办保存按钮强制放到更多里面
7
8
  - 2.2.85: 北京ca开启电子签章获取ca签名,不受表单加签控制
8
9
  - 2.2.84: 选人组件baseCorpId取值问题修复
package/lib/db/db.js CHANGED
@@ -1116,6 +1116,37 @@ context.create('FlowModuleAPI', {
1116
1116
  });
1117
1117
 
1118
1118
  context.create('form', {
1119
+ getPureMobileForm: {
1120
+ mockUrl: 'query/getPureMobileForm.json',
1121
+ url: _variables2.default.URLS.getPureMobileForm,
1122
+ method: 'GET',
1123
+ header: {
1124
+ Authorization: 'Bearer ' + getLoginUserInfo().token
1125
+ },
1126
+ willFetch: function willFetch() {
1127
+ _Toast2.default.show({
1128
+ content: _react2.default.createElement(_loading2.default, null),
1129
+ hasMask: true,
1130
+ duration: 800
1131
+ });
1132
+ }
1133
+ },
1134
+ runtimeDataSave: {
1135
+ mockUrl: 'query/runtimeDataSave.json',
1136
+ url: _variables2.default.URLS.runtimeDataSave,
1137
+ method: 'POST',
1138
+ postDataFomat: 'FORM',
1139
+ header: {
1140
+ Authorization: 'Bearer ' + getLoginUserInfo().token
1141
+ },
1142
+ willFetch: function willFetch() {
1143
+ _Toast2.default.show({
1144
+ content: _react2.default.createElement(_loading2.default, null),
1145
+ hasMask: true,
1146
+ duration: 800
1147
+ });
1148
+ }
1149
+ },
1119
1150
  getFormContent: {
1120
1151
  mockUrl: 'query/getFormContent.json',
1121
1152
  url: _variables2.default.URLS.getFormContent,
@@ -65,7 +65,9 @@ exports.default = {
65
65
  batchFavoriteProcess: urlPrefix + 'batchFavoriteProcess' + '?', //批量添加常用流程的接口
66
66
  getRemindBadgeCount: urlPrefix + 'getRemindBadgeCount' + '?', //分类统计小红点
67
67
  queryProcessForm: urlPrefix + 'getMobileForm' + '?', //获取流程表单
68
+ getPureMobileForm: urlPrefix + 'getPureMobileForm' + '?', //获取纯表单(无流程)
68
69
  getRelaFieldsMap: formUrlPrefix + 'relafield/getRelaFieldsMap' + '?', //获取关联表单字段
70
+ runtimeDataSave: formUrlPrefix + 'runtime/runtimeDataSave' + '?', //纯表单运行时保存
69
71
  getNoInvoiceList: formUrlPrefix + 'form/invoice/getNoInvoiceList' + '?', //获取未开票列表
70
72
  getComponentInfoList: urlBasicPrefix + 'mobilehall/mobileoffice/getComponentInfoList' + '?', //获取关联表单字段
71
73
 
package/lib/form/form.js CHANGED
@@ -115,6 +115,8 @@ var _db = require('../db/db');
115
115
 
116
116
  var _db2 = _interopRequireDefault(_db);
117
117
 
118
+ var _formExtHelper = require('./formExtHelper');
119
+
118
120
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
119
121
 
120
122
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -169,11 +171,13 @@ var PageHome = function (_React$Component) {
169
171
  /* alert(commentField);*/
170
172
  var context = document.getElementById("context").value;
171
173
  //alert(props.defaultValue);
172
- var module = props.module && props.module != "undefined" ? props.module : "approve";
174
+ var extLoaded = (0, _formExtHelper.loadFlowOrFormCommon)(props);
175
+ var module = extLoaded.module;
176
+ FlowCommon = extLoaded.FlowCommon;
173
177
  var isRemoveCommentFormHtml = props.isRemoveCommentFormHtml && props.isRemoveCommentFormHtml != "undefined" ? props.isRemoveCommentFormHtml : "0";
174
- FlowCommon = require('pages/flow_common/' + module).default ? require('pages/flow_common/' + module).default : require('pages/flow_common/' + module);
175
178
  _this.state = {
176
179
  module: module,
180
+ formCode: extLoaded.formCode,
177
181
  fold: true,
178
182
  atfold: true,
179
183
  status: status,
@@ -1342,12 +1346,12 @@ var PageHome = function (_React$Component) {
1342
1346
  //在线编辑
1343
1347
  var formDataAttr = form.dataAttr;
1344
1348
  itemParam.webofficeDownload = formDataAttr && formDataAttr.webofficeDownload == '0' ? false : true;
1345
- if (typeof FlowCommon.dealwithWeboffice === "function" && value != null && value != "") {
1349
+ if (FlowCommon && typeof FlowCommon.dealwithWeboffice === "function" && value != null && value != "") {
1346
1350
  FlowCommon.dealwithWeboffice(value, function (content) {
1347
1351
  itemParam.initIds = content;
1348
1352
  itemParam.value = value;
1349
1353
  //处理特有按钮事件
1350
- if (typeof FlowCommon.dealwithCommonFormParam === "function") {
1354
+ if (FlowCommon && typeof FlowCommon.dealwithCommonFormParam === "function") {
1351
1355
  itemParam = FlowCommon.dealwithCommonFormParam(itemParam, this);
1352
1356
  itemType = itemParam.itemType;
1353
1357
  }
@@ -1355,12 +1359,12 @@ var PageHome = function (_React$Component) {
1355
1359
  var mobileExt;
1356
1360
  try {
1357
1361
  if (formKey) {
1358
- mobileExt = typeof eval(module + "_" + formKey + "_mobileExt") !== 'undefined' ? eval(module + "_" + formKey + "_mobileExt") : null;
1362
+ mobileExt = (0, _formExtHelper.resolveMobileFormExt)(this.props.formCode, module, formKey);
1359
1363
  }
1360
1364
  } catch (e) {
1361
1365
  // alert("exception: "+e.message);
1362
1366
  }
1363
- if (typeof mobileExt !== 'undefined' && typeof mobileExt["dealwithFormParamExt"] === "function") {
1367
+ if (mobileExt && typeof mobileExt["dealwithFormParamExt"] === "function") {
1364
1368
  itemParam = mobileExt["dealwithFormParamExt"](itemParam, this);
1365
1369
  itemType = itemParam.itemType;
1366
1370
  }
@@ -1400,7 +1404,7 @@ var PageHome = function (_React$Component) {
1400
1404
  itemParam.value = value;
1401
1405
 
1402
1406
  //处理特有按钮事件
1403
- if (typeof FlowCommon.dealwithCommonFormParam === "function") {
1407
+ if (FlowCommon && typeof FlowCommon.dealwithCommonFormParam === "function") {
1404
1408
  itemParam = FlowCommon.dealwithCommonFormParam(itemParam, this);
1405
1409
  itemType = itemParam.itemType;
1406
1410
  }
@@ -1408,12 +1412,12 @@ var PageHome = function (_React$Component) {
1408
1412
  var mobileExt;
1409
1413
  try {
1410
1414
  if (formKey) {
1411
- mobileExt = typeof eval(module + "_" + formKey + "_mobileExt") !== 'undefined' ? eval(module + "_" + formKey + "_mobileExt") : null;
1415
+ mobileExt = (0, _formExtHelper.resolveMobileFormExt)(this.props.formCode, module, formKey);
1412
1416
  }
1413
1417
  } catch (e) {
1414
1418
  // alert("exception: "+e.message);
1415
1419
  }
1416
- if (typeof mobileExt !== 'undefined' && typeof mobileExt[module + "_dealwithFormParamExt"] === "function") {
1420
+ if (mobileExt && typeof mobileExt[module + "_dealwithFormParamExt"] === "function") {
1417
1421
  itemParam = mobileExt[module + "_dealwithFormParamExt"](itemParam, this);
1418
1422
  itemType = itemParam.itemType;
1419
1423
  }
@@ -1495,7 +1499,7 @@ var PageHome = function (_React$Component) {
1495
1499
  itemParam.value = value;
1496
1500
 
1497
1501
  //处理特有按钮事件
1498
- if (typeof FlowCommon.dealwithCommonFormParam === "function") {
1502
+ if (FlowCommon && typeof FlowCommon.dealwithCommonFormParam === "function") {
1499
1503
  itemParam = FlowCommon.dealwithCommonFormParam(itemParam, this);
1500
1504
  itemType = itemParam.itemType;
1501
1505
  }
@@ -1511,12 +1515,12 @@ var PageHome = function (_React$Component) {
1511
1515
  var mobileExt;
1512
1516
  try {
1513
1517
  if (formKey) {
1514
- mobileExt = typeof eval(module + "_" + formKey + "_mobileExt") !== 'undefined' ? eval(module + "_" + formKey + "_mobileExt") : null;
1518
+ mobileExt = (0, _formExtHelper.resolveMobileFormExt)(this.props.formCode, module, formKey);
1515
1519
  }
1516
1520
  } catch (e) {
1517
1521
  // alert("exception: "+e.message);
1518
1522
  }
1519
- if (typeof mobileExt !== 'undefined' && typeof mobileExt["dealwithFormParamExt"] === "function") {
1523
+ if (mobileExt && typeof mobileExt["dealwithFormParamExt"] === "function") {
1520
1524
  itemParam = mobileExt["dealwithFormParamExt"](itemParam, this);
1521
1525
  itemType = itemParam.itemType;
1522
1526
  }
@@ -1600,12 +1604,12 @@ var PageHome = function (_React$Component) {
1600
1604
  var mobileExt;
1601
1605
  try {
1602
1606
  if (formKey) {
1603
- mobileExt = typeof eval(module + "_" + formKey + "_mobileExt") !== 'undefined' ? eval(module + "_" + formKey + "_mobileExt") : null;
1607
+ mobileExt = (0, _formExtHelper.resolveMobileFormExt)(this.props.formCode, module, formKey);
1604
1608
  }
1605
1609
  } catch (e) {
1606
1610
  // alert("exception: "+e.message);
1607
1611
  }
1608
- if (typeof mobileExt !== 'undefined' && typeof mobileExt["casigin"] === "function") {
1612
+ if (mobileExt && typeof mobileExt["casigin"] === "function") {
1609
1613
  var isVerifySing = mobileExt["casigin"](itemParam, data, uniqueName, isVerifySingValue);
1610
1614
  itemParam.isVerifySing = isVerifySing;
1611
1615
  this.setState(itemParam);
@@ -2166,7 +2170,7 @@ var PageHome = function (_React$Component) {
2166
2170
  var fieldTblId = itemParam.tblId;
2167
2171
  var fieldTblName = itemParam.tblName;
2168
2172
  //处理操作返回数据
2169
- if (typeof FlowCommon.dealwithReturnData === "function") {
2173
+ if (FlowCommon && typeof FlowCommon.dealwithReturnData === "function") {
2170
2174
  FlowCommon.dealwithReturnData(itemCode, value, function (itemCode1, value1) {
2171
2175
  itemCode = itemCode1;
2172
2176
  value = value1;
@@ -0,0 +1,152 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.loadFlowOrFormCommon = loadFlowOrFormCommon;
7
+ exports.resolveMobileFormExt = resolveMobileFormExt;
8
+ /**
9
+ * 表单扩展加载:流程 flow_common / 纯表单 form_common
10
+ *
11
+ * form_common 使用包内 require.context('./form_common'),避免宿主无 pages/form_common 时 webpack 告警。
12
+ * 宿主扩展目录请通过 webpack alias 映射到 fmui-base/lib/form/form_common(见 tblform/README)。
13
+ */
14
+
15
+ var formCommonContext = require.context('./form_common', false, /\.js$/);
16
+
17
+ function loadFormCommonModule(formCode) {
18
+
19
+ if (!formCode) {
20
+
21
+ return null;
22
+ }
23
+
24
+ var keys = ['./' + formCode + '.js', './' + formCode];
25
+
26
+ for (var i = 0; i < keys.length; i++) {
27
+
28
+ if (!formCommonContext.keys().includes(keys[i])) {
29
+
30
+ continue;
31
+ }
32
+
33
+ try {
34
+
35
+ var mod = formCommonContext(keys[i]);
36
+
37
+ return mod.default ? mod.default : mod;
38
+ } catch (e) {
39
+
40
+ // try next key
41
+
42
+ }
43
+ }
44
+
45
+ return loadFormCommonFromGlobal(formCode);
46
+ }
47
+
48
+ /** 宿主可在 window 挂载 {formCode}_formCommon,无需改 node_modules */
49
+
50
+ function loadFormCommonFromGlobal(formCode) {
51
+
52
+ if (!formCode) {
53
+
54
+ return null;
55
+ }
56
+
57
+ try {
58
+
59
+ var globalName = formCode + '_formCommon';
60
+
61
+ if (typeof window !== 'undefined' && window[globalName]) {
62
+
63
+ return window[globalName];
64
+ }
65
+
66
+ if (typeof global !== 'undefined' && global[globalName]) {
67
+
68
+ return global[globalName];
69
+ }
70
+ } catch (e) {
71
+
72
+ // ignore
73
+
74
+ }
75
+
76
+ return null;
77
+ }
78
+
79
+ function loadFlowOrFormCommon(props) {
80
+
81
+ var formCode = props && props.formCode || '';
82
+
83
+ var module = props && props.module;
84
+
85
+ if (module === undefined || module === null || module === 'undefined') {
86
+
87
+ module = formCode ? '' : 'approve';
88
+ }
89
+
90
+ var FlowCommon = null;
91
+
92
+ try {
93
+
94
+ if (formCode) {
95
+
96
+ FlowCommon = loadFormCommonModule(formCode);
97
+ } else if (module) {
98
+
99
+ var mod = require('pages/flow_common/' + module);
100
+
101
+ FlowCommon = mod.default ? mod.default : mod;
102
+ }
103
+ } catch (e) {
104
+
105
+ FlowCommon = null;
106
+ }
107
+
108
+ return { FlowCommon: FlowCommon, module: module, formCode: formCode };
109
+ }
110
+
111
+ /** form_common: {formCode}_mobileExt;流程: {module}_{formKey}_mobileExt */
112
+
113
+ function resolveMobileFormExt(formCode, module, formKey) {
114
+
115
+ if (formCode) {
116
+
117
+ try {
118
+
119
+ var extName = formCode + '_mobileExt';
120
+
121
+ if (typeof eval(extName) !== 'undefined') {
122
+
123
+ return eval(extName);
124
+ }
125
+ } catch (e) {
126
+
127
+ // ignore
128
+
129
+ }
130
+
131
+ return null;
132
+ }
133
+
134
+ if (module && formKey) {
135
+
136
+ try {
137
+
138
+ var _extName = module + '_' + formKey + '_mobileExt';
139
+
140
+ if (typeof eval(_extName) !== 'undefined') {
141
+
142
+ return eval(_extName);
143
+ }
144
+ } catch (e) {
145
+
146
+ // ignore
147
+
148
+ }
149
+ }
150
+
151
+ return null;
152
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 占位模块:无 form_common 扩展时不报错。
3
+ * 业务扩展请放在宿主工程 pages/form_common/,并通过 webpack alias 指向本目录(见 tblform/README)。
4
+ */
5
+ export default {};
@@ -23,6 +23,8 @@ var _form = require('./form');
23
23
 
24
24
  var _form2 = _interopRequireDefault(_form);
25
25
 
26
+ var _formExtHelper = require('./formExtHelper');
27
+
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
29
 
28
30
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -34,6 +36,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
34
36
  var HBox = _Boxs2.default.HBox,
35
37
  Box = _Boxs2.default.Box;
36
38
 
39
+
37
40
  var FlowCommon = void 0;
38
41
 
39
42
  var PageHome = function (_React$Component) {
@@ -49,14 +52,16 @@ var PageHome = function (_React$Component) {
49
52
  var status = props.status;
50
53
  var context = document.getElementById("context").value;
51
54
 
52
- var module = props.module && props.module != "undefined" ? props.module : "approve";
53
- FlowCommon = require('pages/flow_common/' + module).default ? require('pages/flow_common/' + module).default : require('pages/flow_common/' + module);
55
+ var extLoaded = (0, _formExtHelper.loadFlowOrFormCommon)(props);
56
+ var module = extLoaded.module;
57
+ FlowCommon = extLoaded.FlowCommon;
54
58
  //需要隐藏表头的子表表名
55
59
  var isHideSubTblHeadTblList = ['dj_org_mb_duty_now'];
56
60
 
57
61
  // var itemParam =
58
62
  _this.state = {
59
63
  module: module,
64
+ formCode: extLoaded.formCode,
60
65
  status: status,
61
66
  fieldControll: props.fieldControll,
62
67
  urlPrev: context + '/dingisv/api/common/viewImage?fid=',
@@ -189,7 +194,7 @@ var PageHome = function (_React$Component) {
189
194
  itemParam.value = value;
190
195
  itemParam.detailAction = form.detailAction; //添加事件名字
191
196
  //处理特有按钮事件
192
- if (typeof FlowCommon.dealwithCommonFormParam === "function") {
197
+ if (FlowCommon && typeof FlowCommon.dealwithCommonFormParam === "function") {
193
198
  itemParam = FlowCommon.dealwithCommonFormParam(itemParam, this);
194
199
  }
195
200
 
@@ -197,12 +202,12 @@ var PageHome = function (_React$Component) {
197
202
  var mobileExt;
198
203
  try {
199
204
  if (formKey) {
200
- mobileExt = typeof eval(module + "_" + formKey + "_mobileExt") !== 'undefined' ? eval(module + "_" + formKey + "_mobileExt") : null;
205
+ mobileExt = (0, _formExtHelper.resolveMobileFormExt)(this.props.formCode, module, formKey);
201
206
  }
202
207
  } catch (e) {
203
208
  // alert("exception: "+e.message);
204
209
  }
205
- if (typeof mobileExt !== 'undefined' && typeof mobileExt["dealwithFormParamExt"] === "function") {
210
+ if (mobileExt && typeof mobileExt["dealwithFormParamExt"] === "function") {
206
211
  itemParam = mobileExt["dealwithFormParamExt"](itemParam, this);
207
212
  itemType = itemParam.itemType;
208
213
  }
@@ -777,7 +782,7 @@ var PageHome = function (_React$Component) {
777
782
  }, {
778
783
  key: 'extOperate',
779
784
  value: function extOperate(i, itemParam, buttonFun, extParam) {
780
- if (typeof FlowCommon.subFormItemExtOperate === "function") {
785
+ if (FlowCommon && typeof FlowCommon.subFormItemExtOperate === "function") {
781
786
  FlowCommon.subFormItemExtOperate(this.state, i, itemParam, buttonFun, extParam, this);
782
787
  }
783
788
  }
package/lib/form/table.js CHANGED
@@ -61,6 +61,8 @@ var _db = require('../db/db');
61
61
 
62
62
  var _db2 = _interopRequireDefault(_db);
63
63
 
64
+ var _formExtHelper = require('./formExtHelper');
65
+
64
66
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
65
67
 
66
68
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -247,10 +249,16 @@ var PageHome = function (_React$Component) {
247
249
  chooseSignature: []
248
250
  };
249
251
 
250
- var module = props.module && props.module != "undefined" ? props.module : "approve";
251
- try {
252
- FlowCommon = require('pages/flow_common/' + module).default ? require('pages/flow_common/' + module).default : require('pages/flow_common/' + module);
253
- } catch (error) {}
252
+ var module = props.module;
253
+ if (module === undefined || module === null || module === 'undefined') {
254
+ module = 'approve';
255
+ }
256
+ // module 为空时不加载 flow_common(纯表单 TblForm 使用 form_common)
257
+ if (module) {
258
+ try {
259
+ FlowCommon = require('pages/flow_common/' + module).default ? require('pages/flow_common/' + module).default : require('pages/flow_common/' + module);
260
+ } catch (error) {}
261
+ }
254
262
 
255
263
  // DB.form.getRelaFieldsMap({
256
264
  // formId: formId,
@@ -353,23 +361,17 @@ var PageHome = function (_React$Component) {
353
361
  }
354
362
  // var subTblNo = data.subTblNo;
355
363
  //处理特有参数
356
- if (typeof FlowCommon.dealwithFormItemChange === "function") {
364
+ if (FlowCommon && typeof FlowCommon.dealwithFormItemChange === "function") {
357
365
  try {
358
366
  FlowCommon.dealwithFormItemChange(itemParam, this);
359
367
  } catch (error) {
360
368
  console.log("Error occurred while dealing with form item change:", error);
361
369
  }
362
370
  }
363
- var mobileExt;
364
- try {
365
- if (formKey) {
366
- mobileExt = typeof eval(module + "_" + formKey + "_mobileExt") !== 'undefined' ? eval(module + "_" + formKey + "_mobileExt") : null;
367
- }
368
- } catch (e) {}
369
- // alert("exception: "+e.message);
370
-
371
+ var formCode = t.props.formCode || t.state && t.state.formCode || '';
372
+ var mobileExt = (0, _formExtHelper.resolveMobileFormExt)(formCode, module, formKey);
371
373
  //项目开发扩展
372
- if (typeof mobileExt !== 'undefined' && typeof mobileExt["dealwithFormItemChangeExt"] === "function") {
374
+ if (mobileExt && typeof mobileExt["dealwithFormItemChangeExt"] === "function") {
373
375
  mobileExt["dealwithFormItemChangeExt"](itemParam, this, function (paramsExt) {
374
376
  if (paramsExt.length > 0) {
375
377
  paramsExt.map(function (itemExt) {