fmui-base 2.3.68 → 2.3.70

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.70:移动端支持表单的规则设置校验
7
+ - 2.3.69:移动端批示意见字段落款支持表单上的自定义样式
6
8
  - 2.3.68:批示意见字段支持根据节点设置控制显示隐藏
7
9
  - 2.3.67:邮件转发按钮根据流程设置显示隐藏,办理缓急图标颜色支持自定义
8
10
  - 2.3.66:字段名带$报错转义
@@ -352,9 +352,17 @@ var PageHome = function (_React$Component) {
352
352
  // 落款无姓名且无签名图可挂靠时,单独补标识
353
353
  var needTrailingAddlots = addlotsLabel && !showUserName && !(hasSignImg && item.inscriptionShow.indexOf("signImg") >= 0);
354
354
  var replaceHtml = item.replacename && item.replacename != "" ? "(代" + (item.userName || "") + "办理)" : "";
355
+ // 落款字体/颜色与字段内容样式保持一致
356
+ var contentStyle = t.props.contentStyle || {};
357
+ var signStyle = Object.assign({
358
+ marginLeft: "auto",
359
+ textAlign: "right",
360
+ width: '100%',
361
+ position: 'relative'
362
+ }, contentStyle);
355
363
  return _react2.default.createElement(
356
364
  Box,
357
- { className: 'comment-html', style: { marginLeft: "auto", "text-align": "right", width: '100%', 'position': 'relative' } },
365
+ { className: 'comment-html', style: signStyle },
358
366
  _returnHtml,
359
367
  needTrailingAddlots ? addlotsOnlyHtml : null,
360
368
  replaceHtml
@@ -367,6 +375,7 @@ var PageHome = function (_React$Component) {
367
375
  key: 'render',
368
376
  value: function render() {
369
377
  var t = this;
378
+ var contentStyle = t.props.contentStyle || {};
370
379
  return _react2.default.createElement(
371
380
  'div',
372
381
  null,
@@ -374,8 +383,8 @@ var PageHome = function (_React$Component) {
374
383
  var commentType = item && item.type != null ? String(item.type) : '';
375
384
  return _react2.default.createElement(
376
385
  VBox,
377
- { className: 't-PB10 t-LH1_5 t-field t-FS14 t-PL10' },
378
- commentType.indexOf('image') < 0 ? _react2.default.createElement(Box, { className: 't-PR16', dangerouslySetInnerHTML: { __html: item.fullMessage == null ? "" : String(item.fullMessage).replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/ /g, '&nbsp;') } }) : item.fullMessage == '' ? _react2.default.createElement(
386
+ { className: 't-PB10 t-LH1_5 t-field t-FS14 t-PL10', style: contentStyle },
387
+ commentType.indexOf('image') < 0 ? _react2.default.createElement(Box, { className: 't-PR16 comment-content', style: contentStyle, dangerouslySetInnerHTML: { __html: item.fullMessage == null ? "" : String(item.fullMessage).replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/ /g, '&nbsp;') } }) : item.fullMessage == '' ? _react2.default.createElement(
379
388
  Box,
380
389
  null,
381
390
  '\'\''
@@ -398,7 +407,7 @@ var PageHome = function (_React$Component) {
398
407
  ) : null,
399
408
  _react2.default.createElement(
400
409
  Box,
401
- { vAlign: 'start', hAlign: 'end', id: 'commentSign-' + item.id, className: 't-FBH t-PR16' },
410
+ { vAlign: 'start', hAlign: 'end', id: 'commentSign-' + item.id, className: 't-FBH t-PR16', style: contentStyle },
402
411
  ' ',
403
412
  item.inscriptionShow ? t.getCommentSign(item) : "",
404
413
  _react2.default.createElement('i', { id: item.id + "_sucess", className: 'iconfont icon-checked t-PT10 t-PL3', style: { color: 'green', display: 'none' } }),
@@ -0,0 +1,145 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.normalizeComplianceRuleExp = normalizeComplianceRuleExp;
7
+ exports.getComplianceFieldNumber = getComplianceFieldNumber;
8
+ exports.evaluateComplianceRules = evaluateComplianceRules;
9
+ exports.buildComplianceDialogText = buildComplianceDialogText;
10
+ /**
11
+ * 移动端合规规则工具(与 PC form.runtime.util.api.js complianceRuleFunc 对齐)
12
+ */
13
+
14
+ function normalizeComplianceRuleExp(exp) {
15
+ if (exp == null || exp === '') {
16
+ return '';
17
+ }
18
+ exp = String(exp);
19
+ exp = exp.replace(/&nbsp;/gi, ' ').replace(/&lt;/gi, '<').replace(/&gt;/gi, '>').replace(/&quot;/gi, '"').replace(/&#39;/g, "'").replace(/&amp;/gi, '&');
20
+ exp = exp.replace(/>/g, '>').replace(/</g, '<').replace(/=/g, '=').replace(/≥/g, '>=').replace(/≤/g, '<=');
21
+ return exp;
22
+ }
23
+
24
+ function getFieldArray(exp) {
25
+ var fieldArray = [];
26
+ if (!exp) {
27
+ return fieldArray;
28
+ }
29
+ var stepOne = String(exp).split('[');
30
+ for (var i = 1; i < stepOne.length; i++) {
31
+ var stepTwo = stepOne[i].split(']');
32
+ if (stepTwo.length > 0 && stepTwo[0].length > 0) {
33
+ fieldArray.push(stepTwo[0]);
34
+ }
35
+ }
36
+ return fieldArray;
37
+ }
38
+
39
+ function toNumberVal(raw) {
40
+ if (raw === null || typeof raw === 'undefined' || raw === '') {
41
+ return 0;
42
+ }
43
+ var num = Number(raw);
44
+ return isNaN(num) ? 0 : num;
45
+ }
46
+
47
+ /**
48
+ * 从 editFormData 按唯一名(如表名_字段名)取数值
49
+ */
50
+ function getComplianceFieldNumber(fieldUniqueName, editFormData) {
51
+ if (!fieldUniqueName || !editFormData) {
52
+ return 0;
53
+ }
54
+ var name = String(fieldUniqueName).replace(/^\[|\]$/g, '');
55
+ var mainTblName = editFormData.mainTblName || '';
56
+ var mainTblData = editFormData.mainTblData || [];
57
+ for (var i = 0; i < mainTblData.length; i++) {
58
+ var full = mainTblName + '_' + mainTblData[i].key;
59
+ if (full === name || mainTblData[i].key === name) {
60
+ return toNumberVal(mainTblData[i].value);
61
+ }
62
+ }
63
+ var subTbl = editFormData.subTbl || [];
64
+ for (var s = 0; s < subTbl.length; s++) {
65
+ var subTblName = subTbl[s].subTblName || '';
66
+ var rows = subTbl[s].subTblData || [];
67
+ for (var r = 0; r < rows.length; r++) {
68
+ var row = rows[r] || [];
69
+ for (var c = 0; c < row.length; c++) {
70
+ var subFull = subTblName + '_' + row[c].key;
71
+ if (subFull === name || row[c].key === name) {
72
+ return toNumberVal(row[c].value);
73
+ }
74
+ }
75
+ }
76
+ }
77
+ return 0;
78
+ }
79
+
80
+ /**
81
+ * 评估合规规则列表
82
+ * @returns {{pass:boolean, blockDeal:string|null, rows:Array}}
83
+ * blockDeal: 0 仅提醒可继续;1 禁止提交;2/null 不打断
84
+ */
85
+ function evaluateComplianceRules(ruleList, editFormData) {
86
+ var rows = [];
87
+ var checkFlag = true;
88
+ var blockDeal = null;
89
+ if (!ruleList || !ruleList.length) {
90
+ return { pass: true, blockDeal: null, rows: rows };
91
+ }
92
+ for (var i = 0; i < ruleList.length; i++) {
93
+ var rule = ruleList[i] || {};
94
+ var ruleContent = normalizeComplianceRuleExp(rule.ruleContent);
95
+ var rulenoDeal = rule.rulenoDeal;
96
+ var ruletips = rule.ruleTips || '';
97
+ var rulenotips = rule.ruleNoTips || '';
98
+ var fieldArray = getFieldArray(ruleContent);
99
+ for (var k = 0; k < fieldArray.length; k++) {
100
+ var fieldStr = '[' + fieldArray[k] + ']';
101
+ var fieldVal = getComplianceFieldNumber(fieldArray[k], editFormData);
102
+ var replaceVal = fieldVal < 0 ? '(' + fieldVal + ')' : String(fieldVal);
103
+ ruleContent = ruleContent.split(fieldStr).join(replaceVal);
104
+ }
105
+ var pass = false;
106
+ try {
107
+ pass = !!eval(ruleContent);
108
+ } catch (e) {
109
+ console.error('合规规则表达式执行失败:', rule.ruleName, ruleContent, e);
110
+ pass = false;
111
+ }
112
+ if (pass) {
113
+ rows.push({
114
+ ruleName: rule.ruleName || '',
115
+ tip: ruletips,
116
+ pass: true
117
+ });
118
+ } else {
119
+ checkFlag = false;
120
+ rows.push({
121
+ ruleName: rule.ruleName || '',
122
+ tip: rulenotips,
123
+ pass: false
124
+ });
125
+ if (blockDeal == null || rulenoDeal == 1 || rulenoDeal === '1') {
126
+ blockDeal = rulenoDeal;
127
+ }
128
+ }
129
+ }
130
+ return { pass: checkFlag, blockDeal: blockDeal, rows: rows };
131
+ }
132
+
133
+ /** 组装弹窗文案 */
134
+ function buildComplianceDialogText(rows) {
135
+ if (!rows || !rows.length) {
136
+ return '合规检测未通过';
137
+ }
138
+ var lines = [];
139
+ for (var i = 0; i < rows.length; i++) {
140
+ var mark = rows[i].pass ? '通过' : '不通过';
141
+ var tip = rows[i].tip || '';
142
+ lines.push((rows[i].ruleName || '规则') + ':' + tip + '(' + mark + ')');
143
+ }
144
+ return lines.join('\n');
145
+ }
package/lib/db/db.js CHANGED
@@ -1209,6 +1209,15 @@ context.create('FlowModuleAPI', {
1209
1209
  // });
1210
1210
  }
1211
1211
  },
1212
+ getComplianceRule: {
1213
+ mockUrl: 'query/queryCanBack.json',
1214
+ url: _variables2.default.URLS.getComplianceRule,
1215
+ method: 'GET',
1216
+ header: {
1217
+ Authorization: 'Bearer ' + getLoginUserInfo().token
1218
+ },
1219
+ willFetch: function willFetch() {}
1220
+ },
1212
1221
  getUserSetInfo: {
1213
1222
  mockUrl: 'query/getUserSetInfo.json',
1214
1223
  url: _variables2.default.URLS.getUserSetInfo,
@@ -149,6 +149,7 @@ exports.default = {
149
149
  getRelaObjByRelaId: approveUrlPrefix + "getRelaObjByRelaId" + '?', //获取相关对象
150
150
  getUrgencyEnum: approveUrlPrefix + "getUrgencyEnum" + '?', //获取枚举
151
151
  getSysSettingByMark: approveUrlPrefix + "getSysSettingByMark" + '?', //获取系统设置
152
+ getComplianceRule: approveUrlPrefix + "getComplianceRule" + '?', //表单合规规则
152
153
  getUserSetInfo: urlBasicPrefix + 'setting/userinfo/getUserSetInfo' + '?', //获取用户组织信息
153
154
  orgSwitch: urlBasicPrefix + 'front/personal/orgSwitch' + '?', //切换组织
154
155
  updateStartUserOrg: approveUrlPrefix + 'updateStartUserOrg' + '?', //更新发起人组织
package/lib/form/form.js CHANGED
@@ -2182,7 +2182,7 @@ var PageHome = function (_React$Component) {
2182
2182
  // 月日自定义、意见、html 等非 SaltUI 标准内容节点
2183
2183
  scope + ' .t-FL', scope + ' .flex-comment .t-PT10', scope + ' .flex-comment .t-textarea-field-content',
2184
2184
  // 批示意见落款与内容字体颜色一致
2185
- scope + ' .comment-html', scope + ' .comment-html span', scope + ' .ueditor-content', scope + ' .t-FB1.t-FAL', scope + ' .t-FB1.t-omit', scope + ' .t-omit', scope + ' .t-LH1_4', scope + ' .t-FS16', scope + ' .t-field-box.t-FS16', scope + ' .t-field-box.t-FS16 .t-FB1', scope + ' .section-content .t-FB1'].join(',') + '{' + contentCss + '}');
2185
+ scope + ' .comment-html', scope + ' .comment-html span', scope + ' .comment-content', scope + ' .ueditor-content', scope + ' .t-FB1.t-FAL', scope + ' .t-FB1.t-omit', scope + ' .t-omit', scope + ' .t-LH1_4', scope + ' .t-FS16', scope + ' .t-field-box.t-FS16', scope + ' .t-field-box.t-FS16 .t-FB1', scope + ' .section-content .t-FB1'].join(',') + '{' + contentCss + '}');
2186
2186
 
2187
2187
  var placeholderCss = this.buildFormCssDecls(cs, { important: true, skipColor: true, withLineHeight: true });
2188
2188
  cssParts.push([scope + ' .t-text-field-placeholder', scope + ' .t-select-field-placeholder', scope + ' .t-datetime-field-placeholder', scope + ' .t-checkbox-field-placeholder'].join(',') + '{' + placeholderCss + '}');
package/lib/form/table.js CHANGED
@@ -542,7 +542,9 @@ var PageHome = function (_React$Component) {
542
542
  }
543
543
  if (this.hasFormStyleProps(cs)) {
544
544
  var contentCss = this.buildFormCssDecls(cs, { important: true, withLineHeight: true });
545
- cssParts.push([scope + ' .t-text-field-input', scope + ' .t-text-field-content-main', scope + ' .t-text-field-content-main span', scope + ' .t-field-content-box > .t-FB1', scope + ' .t-field-content-box > .t-FB1 span', scope + ' .t-field-multi', scope + ' .t-field-multi span', scope + ' .t-select-field-value', scope + ' .t-select-field-value span', scope + ' .t-radio-field-value', scope + ' .t-radio-field-value span', scope + ' .t-radio-field-value .t-FB1', scope + ' .t-radio-field-value .t-omit', scope + ' .t-datetime-field-value', scope + ' .t-datetime-field-value span', scope + ' .t-textarea-field-content', scope + ' .t-textarea-field-content textarea', scope + ' .t-checkbox-field-content', scope + ' .t-checkbox-field-label', scope + ' .t-checkbox-field-value-list', scope + ' .t-checkbox-field-value-list span', scope + ' .dd-select-input-option-text', scope + ' .t-popuser-value', scope + ' .t-popuser-value span', scope + ' .t-popuser-placeholder', scope + ' .t-poppage-value', scope + ' .t-poppage-value span', scope + ' .t-poppage-placeholder', scope + ' .t-FL', scope + ' .flex-comment .t-textarea-field-content', scope + ' .ueditor-content',
545
+ cssParts.push([scope + ' .t-text-field-input', scope + ' .t-text-field-content-main', scope + ' .t-text-field-content-main span', scope + ' .t-field-content-box > .t-FB1', scope + ' .t-field-content-box > .t-FB1 span', scope + ' .t-field-multi', scope + ' .t-field-multi span', scope + ' .t-select-field-value', scope + ' .t-select-field-value span', scope + ' .t-radio-field-value', scope + ' .t-radio-field-value span', scope + ' .t-radio-field-value .t-FB1', scope + ' .t-radio-field-value .t-omit', scope + ' .t-datetime-field-value', scope + ' .t-datetime-field-value span', scope + ' .t-textarea-field-content', scope + ' .t-textarea-field-content textarea', scope + ' .t-checkbox-field-content', scope + ' .t-checkbox-field-label', scope + ' .t-checkbox-field-value-list', scope + ' .t-checkbox-field-value-list span', scope + ' .dd-select-input-option-text', scope + ' .t-popuser-value', scope + ' .t-popuser-value span', scope + ' .t-popuser-placeholder', scope + ' .t-poppage-value', scope + ' .t-poppage-value span', scope + ' .t-poppage-placeholder', scope + ' .t-FL', scope + ' .flex-comment .t-textarea-field-content', scope + ' .flex-comment .t-PT10',
546
+ // 批示意见落款与内容字体颜色一致
547
+ scope + ' .comment-html', scope + ' .comment-html span', scope + ' .comment-content', scope + ' .ueditor-content',
546
548
  // 弹出选择/只读展示:常带 t-FS16 等工具类,需一并覆盖
547
549
  scope + ' .t-FB1.t-FAL', scope + ' .t-FB1.t-omit', scope + ' .t-omit', scope + ' .t-LH1_4', scope + ' .t-FS16', scope + ' .t-field-box.t-FS16', scope + ' .t-field-box.t-FS16 .t-FB1', scope + ' .section-content .t-FB1'].join(',') + '{' + contentCss + '}');
548
550
  var placeholderCss = this.buildFormCssDecls(cs, { important: true, skipColor: true, withLineHeight: true });
@@ -80,6 +80,8 @@ var _filterEmptySubTblRows = require('../form/filterEmptySubTblRows');
80
80
 
81
81
  var _formValidUtil = require('../common/formValidUtil');
82
82
 
83
+ var _complianceRuleUtil = require('../common/complianceRuleUtil');
84
+
83
85
  var _FlowChart = require('./FlowChart');
84
86
 
85
87
  var _FlowChart2 = _interopRequireDefault(_FlowChart);
@@ -231,6 +233,7 @@ var PageHome = function (_React$Component) {
231
233
  dataId: dataId,
232
234
  formId: props.formId,
233
235
  editFormData: {},
236
+ complianceRuleContent: null,
234
237
  formDataNew: {},
235
238
  data: {
236
239
  dataId: "",
@@ -1229,6 +1232,57 @@ var PageHome = function (_React$Component) {
1229
1232
  return "";
1230
1233
  }
1231
1234
 
1235
+ /**
1236
+ * 合规规则闸门(对齐 PC / processInfo)
1237
+ */
1238
+
1239
+ }, {
1240
+ key: 'runComplianceRuleGate',
1241
+ value: function runComplianceRuleGate(onContinue) {
1242
+ var t = this;
1243
+ var formId = t.state.formId;
1244
+ var editFormData = t.state.editFormData;
1245
+ var applyResult = function applyResult(ruleList) {
1246
+ var result = (0, _complianceRuleUtil.evaluateComplianceRules)(ruleList, editFormData);
1247
+ if (result.pass || result.blockDeal == 2 || result.blockDeal === '2' || result.blockDeal == null) {
1248
+ onContinue();
1249
+ return;
1250
+ }
1251
+ var text = (0, _complianceRuleUtil.buildComplianceDialogText)(result.rows);
1252
+ if (result.blockDeal == 1 || result.blockDeal === '1') {
1253
+ _Dialog2.default.alert({
1254
+ locale: 'zh_CN',
1255
+ title: '合规检测',
1256
+ content: text
1257
+ });
1258
+ return;
1259
+ }
1260
+ _Dialog2.default.confirm({
1261
+ locale: 'zh_CN',
1262
+ title: '合规检测',
1263
+ content: text,
1264
+ onConfirm: function onConfirm() {
1265
+ onContinue();
1266
+ }
1267
+ });
1268
+ };
1269
+ if (t.state.complianceRuleContent != null) {
1270
+ applyResult(t.state.complianceRuleContent);
1271
+ return;
1272
+ }
1273
+ if (!formId) {
1274
+ onContinue();
1275
+ return;
1276
+ }
1277
+ _db2.default.FlowModuleAPI.getComplianceRule({ formId: formId }).then(function (content) {
1278
+ var list = content || [];
1279
+ t.setState({ complianceRuleContent: list });
1280
+ applyResult(list);
1281
+ }).catch(function () {
1282
+ onContinue();
1283
+ });
1284
+ }
1285
+
1232
1286
  /**
1233
1287
  * 提交按钮的点击事件(获得下一个活动节点列表)
1234
1288
  */
@@ -1330,20 +1384,22 @@ var PageHome = function (_React$Component) {
1330
1384
  }
1331
1385
  }
1332
1386
  if (operate == 1) {
1333
- //当提交时校验form表单
1334
- //表单提交前
1335
- if (typeof FlowCommon.saveBefore === "function") {
1336
- FlowCommon.saveBefore(0, t.state, function (param) {
1337
- t.handleSubmitFunc(operate);
1338
- }, function (error) {
1339
- _Toast2.default.show({
1340
- type: 'error',
1341
- content: error
1387
+ //当提交时校验form表单(含合规规则)
1388
+ t.runComplianceRuleGate(function () {
1389
+ //表单提交前
1390
+ if (typeof FlowCommon.saveBefore === "function") {
1391
+ FlowCommon.saveBefore(0, t.state, function (param) {
1392
+ t.handleSubmitFunc(operate);
1393
+ }, function (error) {
1394
+ _Toast2.default.show({
1395
+ type: 'error',
1396
+ content: error
1397
+ });
1342
1398
  });
1343
- });
1344
- } else {
1345
- t.handleSubmitFunc(operate);
1346
- }
1399
+ } else {
1400
+ t.handleSubmitFunc(operate);
1401
+ }
1402
+ });
1347
1403
  } else {
1348
1404
  t.handleSubmitFunc(operate);
1349
1405
  }
@@ -183,6 +183,35 @@ var ListItem = function (_React$Component) {
183
183
  }
184
184
  }
185
185
  }
186
+
187
+ /** 办理缓急:文字/边框用配置色,背景同色透明度 0.1 */
188
+
189
+ }, {
190
+ key: 'buildUrgencyLabelStyle',
191
+ value: function buildUrgencyLabelStyle(fieldColor) {
192
+ if (!fieldColor) {
193
+ return null;
194
+ }
195
+ var color = String(fieldColor).replace(/^\s+|\s+$/g, '');
196
+ var bg = '';
197
+ var m;
198
+ if (/^#([0-9a-fA-F]{3})$/.test(color)) {
199
+ m = color.substring(1);
200
+ bg = 'rgba(' + parseInt(m.charAt(0) + m.charAt(0), 16) + ',' + parseInt(m.charAt(1) + m.charAt(1), 16) + ',' + parseInt(m.charAt(2) + m.charAt(2), 16) + ',0.1)';
201
+ } else if (/^#([0-9a-fA-F]{6})$/.test(color)) {
202
+ m = color.substring(1);
203
+ bg = 'rgba(' + parseInt(m.substring(0, 2), 16) + ',' + parseInt(m.substring(2, 4), 16) + ',' + parseInt(m.substring(4, 6), 16) + ',0.1)';
204
+ } else {
205
+ m = color.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
206
+ if (m) {
207
+ bg = 'rgba(' + m[1] + ',' + m[2] + ',' + m[3] + ',0.1)';
208
+ }
209
+ }
210
+ if (!bg) {
211
+ return null;
212
+ }
213
+ return { backgroundColor: bg, border: '1px solid ' + color, color: color };
214
+ }
186
215
  }, {
187
216
  key: 'render',
188
217
  value: function render() {
@@ -195,12 +224,12 @@ var ListItem = function (_React$Component) {
195
224
  //待办
196
225
  checkIsNotComplete = true;
197
226
  // 枚举禁用时后端不回填 urgencyName,此时不渲染角标(避免空 label 色块)
198
- // 优先 fieldColor;无配置时回退历史 60/70/80/90 样式
227
+ // 有 fieldColor:文字/边框用配置色,背景同色透明;无配置时回退 60/70/80/90 样式
199
228
  if (data.urgencyName) {
200
229
  if (data.fieldColor) {
201
230
  urgencyTag = true;
202
231
  tagClass = 'label';
203
- urgencyStyle = { backgroundColor: data.fieldColor, borderColor: data.fieldColor, color: '#fff' };
232
+ urgencyStyle = this.buildUrgencyLabelStyle(data.fieldColor);
204
233
  } else if (data.urgency == '90' || data.urgency == '80') {
205
234
  urgencyTag = true;
206
235
  tagClass = 'label label-danger';
@@ -92,6 +92,8 @@ var _filterEmptySubTblRows = require('../form/filterEmptySubTblRows');
92
92
 
93
93
  var _formValidUtil = require('../common/formValidUtil');
94
94
 
95
+ var _complianceRuleUtil = require('../common/complianceRuleUtil');
96
+
95
97
  var _FlowChart = require('./FlowChart');
96
98
 
97
99
  var _FlowChart2 = _interopRequireDefault(_FlowChart);
@@ -425,6 +427,7 @@ var PageHome = function (_React$Component) {
425
427
  dataId: dataId,
426
428
  formId: props.formId,
427
429
  editFormData: {},
430
+ complianceRuleContent: null, // 表单合规规则缓存,null=未加载
428
431
  formDataOptlock: '',
429
432
  formDataNew: {},
430
433
  data: {
@@ -2356,6 +2359,58 @@ var PageHome = function (_React$Component) {
2356
2359
  return "";
2357
2360
  }
2358
2361
 
2362
+ /**
2363
+ * 合规规则闸门(对齐 PC complianceRuleFunc):
2364
+ * 不通过且处理方式=1 禁止提交;=0 弹窗可继续;=2 不打断
2365
+ */
2366
+
2367
+ }, {
2368
+ key: 'runComplianceRuleGate',
2369
+ value: function runComplianceRuleGate(onContinue) {
2370
+ var t = this;
2371
+ var formId = t.state.formId;
2372
+ var editFormData = t.state.editFormData;
2373
+ var applyResult = function applyResult(ruleList) {
2374
+ var result = (0, _complianceRuleUtil.evaluateComplianceRules)(ruleList, editFormData);
2375
+ if (result.pass || result.blockDeal == 2 || result.blockDeal === '2' || result.blockDeal == null) {
2376
+ onContinue();
2377
+ return;
2378
+ }
2379
+ var text = (0, _complianceRuleUtil.buildComplianceDialogText)(result.rows);
2380
+ if (result.blockDeal == 1 || result.blockDeal === '1') {
2381
+ _Dialog2.default.alert({
2382
+ locale: 'zh_CN',
2383
+ title: '合规检测',
2384
+ content: text
2385
+ });
2386
+ return;
2387
+ }
2388
+ _Dialog2.default.confirm({
2389
+ locale: 'zh_CN',
2390
+ title: '合规检测',
2391
+ content: text,
2392
+ onConfirm: function onConfirm() {
2393
+ onContinue();
2394
+ }
2395
+ });
2396
+ };
2397
+ if (t.state.complianceRuleContent != null) {
2398
+ applyResult(t.state.complianceRuleContent);
2399
+ return;
2400
+ }
2401
+ if (!formId) {
2402
+ onContinue();
2403
+ return;
2404
+ }
2405
+ _db2.default.FlowModuleAPI.getComplianceRule({ formId: formId }).then(function (content) {
2406
+ var list = content || [];
2407
+ t.setState({ complianceRuleContent: list });
2408
+ applyResult(list);
2409
+ }).catch(function () {
2410
+ onContinue();
2411
+ });
2412
+ }
2413
+
2359
2414
  /**
2360
2415
  * 提交按钮的点击事件(获得下一个活动节点列表)
2361
2416
  */
@@ -2498,10 +2553,80 @@ var PageHome = function (_React$Component) {
2498
2553
  }
2499
2554
  }
2500
2555
  if (operate == 1) {
2501
- //当提交时校验form表单
2502
- //表单提交前
2503
- if (typeof FlowCommon.saveBefore === "function") {
2504
- FlowCommon.saveBefore(0, t.state, function (param) {
2556
+ //当提交时校验form表单(含合规规则,对齐 PC)
2557
+ t.runComplianceRuleGate(function () {
2558
+ //表单提交前
2559
+ if (typeof FlowCommon.saveBefore === "function") {
2560
+ FlowCommon.saveBefore(0, t.state, function (param) {
2561
+ //项目开发模块统一扩展
2562
+ var mobileModuleExt;
2563
+ try {
2564
+ if (t.state.module) {
2565
+ mobileModuleExt = typeof eval(t.state.module + "_mobileExt") !== 'undefined' ? eval(t.state.module + "_mobileExt") : null;
2566
+ }
2567
+ } catch (e) {
2568
+ // alert("exception: "+e.message);
2569
+ }
2570
+
2571
+ if (typeof mobileModuleExt !== 'undefined' && typeof mobileModuleExt["submitBefore"] === "function") {
2572
+ mobileModuleExt["submitBefore"](t.state, function () {
2573
+ //项目开发扩展
2574
+ var mobileExt;
2575
+ try {
2576
+ if (t.state.formKey) {
2577
+ mobileExt = typeof eval(t.state.module + "_" + t.state.formKey + "_mobileExt") !== 'undefined' ? eval(t.state.module + "_" + t.state.formKey + "_mobileExt") : null;
2578
+ }
2579
+ } catch (e) {
2580
+ // alert("exception: "+e.message);
2581
+ }
2582
+ if (typeof mobileExt !== 'undefined' && typeof mobileExt["submitBefore"] === "function") {
2583
+ mobileExt["submitBefore"](t.state, function () {
2584
+ t.handleSubmitFunc(operate);
2585
+ }, function (error) {
2586
+ _Toast2.default.show({
2587
+ type: 'error',
2588
+ content: error
2589
+ });
2590
+ });
2591
+ } else {
2592
+ t.handleSubmitFunc(operate);
2593
+ }
2594
+ }, function (error) {
2595
+ _Toast2.default.show({
2596
+ type: 'error',
2597
+ content: error
2598
+ });
2599
+ });
2600
+ } else {
2601
+ //项目开发扩展
2602
+ var mobileExt;
2603
+ try {
2604
+ if (t.state.formKey) {
2605
+ mobileExt = typeof eval(t.state.module + "_" + t.state.formKey + "_mobileExt") !== 'undefined' ? eval(t.state.module + "_" + t.state.formKey + "_mobileExt") : null;
2606
+ }
2607
+ } catch (e) {
2608
+ // alert("exception: "+e.message);
2609
+ }
2610
+ if (typeof mobileExt !== 'undefined' && typeof mobileExt["submitBefore"] === "function") {
2611
+ mobileExt["submitBefore"](t.state, function () {
2612
+ t.handleSubmitFunc(operate);
2613
+ }, function (error) {
2614
+ _Toast2.default.show({
2615
+ type: 'error',
2616
+ content: error
2617
+ });
2618
+ });
2619
+ } else {
2620
+ t.handleSubmitFunc(operate);
2621
+ }
2622
+ }
2623
+ }, function (error) {
2624
+ _Toast2.default.show({
2625
+ type: 'error',
2626
+ content: error
2627
+ });
2628
+ });
2629
+ } else {
2505
2630
  //项目开发模块统一扩展
2506
2631
  var mobileModuleExt;
2507
2632
  try {
@@ -2564,76 +2689,8 @@ var PageHome = function (_React$Component) {
2564
2689
  t.handleSubmitFunc(operate);
2565
2690
  }
2566
2691
  }
2567
- }, function (error) {
2568
- _Toast2.default.show({
2569
- type: 'error',
2570
- content: error
2571
- });
2572
- });
2573
- } else {
2574
- //项目开发模块统一扩展
2575
- var mobileModuleExt;
2576
- try {
2577
- if (t.state.module) {
2578
- mobileModuleExt = typeof eval(t.state.module + "_mobileExt") !== 'undefined' ? eval(t.state.module + "_mobileExt") : null;
2579
- }
2580
- } catch (e) {
2581
- // alert("exception: "+e.message);
2582
2692
  }
2583
-
2584
- if (typeof mobileModuleExt !== 'undefined' && typeof mobileModuleExt["submitBefore"] === "function") {
2585
- mobileModuleExt["submitBefore"](t.state, function () {
2586
- //项目开发扩展
2587
- var mobileExt;
2588
- try {
2589
- if (t.state.formKey) {
2590
- mobileExt = typeof eval(t.state.module + "_" + t.state.formKey + "_mobileExt") !== 'undefined' ? eval(t.state.module + "_" + t.state.formKey + "_mobileExt") : null;
2591
- }
2592
- } catch (e) {
2593
- // alert("exception: "+e.message);
2594
- }
2595
- if (typeof mobileExt !== 'undefined' && typeof mobileExt["submitBefore"] === "function") {
2596
- mobileExt["submitBefore"](t.state, function () {
2597
- t.handleSubmitFunc(operate);
2598
- }, function (error) {
2599
- _Toast2.default.show({
2600
- type: 'error',
2601
- content: error
2602
- });
2603
- });
2604
- } else {
2605
- t.handleSubmitFunc(operate);
2606
- }
2607
- }, function (error) {
2608
- _Toast2.default.show({
2609
- type: 'error',
2610
- content: error
2611
- });
2612
- });
2613
- } else {
2614
- //项目开发扩展
2615
- var mobileExt;
2616
- try {
2617
- if (t.state.formKey) {
2618
- mobileExt = typeof eval(t.state.module + "_" + t.state.formKey + "_mobileExt") !== 'undefined' ? eval(t.state.module + "_" + t.state.formKey + "_mobileExt") : null;
2619
- }
2620
- } catch (e) {
2621
- // alert("exception: "+e.message);
2622
- }
2623
- if (typeof mobileExt !== 'undefined' && typeof mobileExt["submitBefore"] === "function") {
2624
- mobileExt["submitBefore"](t.state, function () {
2625
- t.handleSubmitFunc(operate);
2626
- }, function (error) {
2627
- _Toast2.default.show({
2628
- type: 'error',
2629
- content: error
2630
- });
2631
- });
2632
- } else {
2633
- t.handleSubmitFunc(operate);
2634
- }
2635
- }
2636
- }
2693
+ });
2637
2694
  } else {
2638
2695
  t.handleSubmitFunc(operate);
2639
2696
  }
@@ -378,6 +378,35 @@ var ListItem = function (_React$Component) {
378
378
  }
379
379
  }
380
380
  }
381
+
382
+ /** 办理缓急:文字/边框用配置色,背景同色透明度 0.1 */
383
+
384
+ }, {
385
+ key: 'buildUrgencyLabelStyle',
386
+ value: function buildUrgencyLabelStyle(fieldColor) {
387
+ if (!fieldColor) {
388
+ return null;
389
+ }
390
+ var color = String(fieldColor).replace(/^\s+|\s+$/g, '');
391
+ var bg = '';
392
+ var m;
393
+ if (/^#([0-9a-fA-F]{3})$/.test(color)) {
394
+ m = color.substring(1);
395
+ bg = 'rgba(' + parseInt(m.charAt(0) + m.charAt(0), 16) + ',' + parseInt(m.charAt(1) + m.charAt(1), 16) + ',' + parseInt(m.charAt(2) + m.charAt(2), 16) + ',0.1)';
396
+ } else if (/^#([0-9a-fA-F]{6})$/.test(color)) {
397
+ m = color.substring(1);
398
+ bg = 'rgba(' + parseInt(m.substring(0, 2), 16) + ',' + parseInt(m.substring(2, 4), 16) + ',' + parseInt(m.substring(4, 6), 16) + ',0.1)';
399
+ } else {
400
+ m = color.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
401
+ if (m) {
402
+ bg = 'rgba(' + m[1] + ',' + m[2] + ',' + m[3] + ',0.1)';
403
+ }
404
+ }
405
+ if (!bg) {
406
+ return null;
407
+ }
408
+ return { backgroundColor: bg, border: '1px solid ' + color, color: color };
409
+ }
381
410
  }, {
382
411
  key: 'render',
383
412
  value: function render() {
@@ -396,12 +425,12 @@ var ListItem = function (_React$Component) {
396
425
  checkIsNotComplete = true;
397
426
  }
398
427
  // 枚举禁用时后端不回填 urgencyName,此时不渲染角标(避免空 label 色块)
399
- // 优先 fieldColor;无配置时回退历史 60/70/80/90 样式
428
+ // 有 fieldColor:文字/边框用配置色,背景同色透明;无配置时回退 60/70/80/90 样式
400
429
  if (data.urgencyName) {
401
430
  if (data.fieldColor) {
402
431
  urgencyTag = true;
403
432
  tagClass = 'label';
404
- urgencyStyle = { backgroundColor: data.fieldColor, borderColor: data.fieldColor, color: '#fff' };
433
+ urgencyStyle = this.buildUrgencyLabelStyle(data.fieldColor);
405
434
  } else if (data.urgency == '90' || data.urgency == '80') {
406
435
  urgencyTag = true;
407
436
  tagClass = 'label label-danger';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fmui-base",
3
- "version": "2.3.68",
3
+ "version": "2.3.70",
4
4
  "title": "fmui-base",
5
5
  "description": "fmui移动端组件",
6
6
  "main": "lib/index.js",