fmui-base 2.3.69 → 2.3.71

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.71:移动端办理列表缓急标签样式
7
+ - 2.3.70:移动端支持表单的规则设置校验
6
8
  - 2.3.69:移动端批示意见字段落款支持表单上的自定义样式
7
9
  - 2.3.68:批示意见字段支持根据节点设置控制显示隐藏
8
10
  - 2.3.67:邮件转发按钮根据流程设置显示隐藏,办理缓急图标颜色支持自定义
@@ -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' + '?', //更新发起人组织
@@ -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,53 @@ var ListItem = function (_React$Component) {
183
183
  }
184
184
  }
185
185
  }
186
+
187
+ /** 历史枚举未配 fieldColor 时的默认色(对齐原 label-primary/warn/danger) */
188
+
189
+ }, {
190
+ key: 'getDefaultUrgencyColor',
191
+ value: function getDefaultUrgencyColor(urgencyCode) {
192
+ var code = urgencyCode != null ? String(urgencyCode) : '';
193
+ if (code === '60') {
194
+ return '#5688ed';
195
+ }
196
+ if (code === '70') {
197
+ return '#ff802c';
198
+ }
199
+ if (code === '80' || code === '90') {
200
+ return '#ff3a39';
201
+ }
202
+ return '';
203
+ }
204
+
205
+ /** 办理缓急:文字/边框用配置色,背景同色透明度 0.12 */
206
+
207
+ }, {
208
+ key: 'buildUrgencyLabelStyle',
209
+ value: function buildUrgencyLabelStyle(fieldColor) {
210
+ if (!fieldColor) {
211
+ return null;
212
+ }
213
+ var color = String(fieldColor).replace(/^\s+|\s+$/g, '');
214
+ var bg = '';
215
+ var m;
216
+ if (/^#([0-9a-fA-F]{3})$/.test(color)) {
217
+ m = color.substring(1);
218
+ 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.12)';
219
+ } else if (/^#([0-9a-fA-F]{6})$/.test(color)) {
220
+ m = color.substring(1);
221
+ bg = 'rgba(' + parseInt(m.substring(0, 2), 16) + ',' + parseInt(m.substring(2, 4), 16) + ',' + parseInt(m.substring(4, 6), 16) + ',0.12)';
222
+ } else {
223
+ m = color.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
224
+ if (m) {
225
+ bg = 'rgba(' + m[1] + ',' + m[2] + ',' + m[3] + ',0.12)';
226
+ }
227
+ }
228
+ if (!bg) {
229
+ return null;
230
+ }
231
+ return { backgroundColor: bg, border: '1px solid ' + color, color: color };
232
+ }
186
233
  }, {
187
234
  key: 'render',
188
235
  value: function render() {
@@ -195,21 +242,13 @@ var ListItem = function (_React$Component) {
195
242
  //待办
196
243
  checkIsNotComplete = true;
197
244
  // 枚举禁用时后端不回填 urgencyName,此时不渲染角标(避免空 label 色块)
198
- // 优先 fieldColor;无配置时回退历史 60/70/80/90 样式
245
+ // 统一:文字/边框用色,背景同色透明;无 fieldColor 时用 60/70/80/90 默认色
199
246
  if (data.urgencyName) {
200
- if (data.fieldColor) {
247
+ var urgencyColor = data.fieldColor || this.getDefaultUrgencyColor(data.urgency);
248
+ if (urgencyColor) {
201
249
  urgencyTag = true;
202
250
  tagClass = 'label';
203
- urgencyStyle = { backgroundColor: data.fieldColor, borderColor: data.fieldColor, color: '#fff' };
204
- } else if (data.urgency == '90' || data.urgency == '80') {
205
- urgencyTag = true;
206
- tagClass = 'label label-danger';
207
- } else if (data.urgency == '70') {
208
- urgencyTag = true;
209
- tagClass = 'label label-warn';
210
- } else if (data.urgency == '60') {
211
- urgencyTag = true;
212
- tagClass = 'label label-primary';
251
+ urgencyStyle = this.buildUrgencyLabelStyle(urgencyColor);
213
252
  }
214
253
  }
215
254
  } else if (data.type == 1) {
@@ -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,53 @@ var ListItem = function (_React$Component) {
378
378
  }
379
379
  }
380
380
  }
381
+
382
+ /** 历史枚举未配 fieldColor 时的默认色(对齐原 label-primary/warn/danger) */
383
+
384
+ }, {
385
+ key: 'getDefaultUrgencyColor',
386
+ value: function getDefaultUrgencyColor(urgencyCode) {
387
+ var code = urgencyCode != null ? String(urgencyCode) : '';
388
+ if (code === '60') {
389
+ return '#5688ed';
390
+ }
391
+ if (code === '70') {
392
+ return '#ff802c';
393
+ }
394
+ if (code === '80' || code === '90') {
395
+ return '#ff3a39';
396
+ }
397
+ return '';
398
+ }
399
+
400
+ /** 办理缓急:文字/边框用配置色,背景同色透明度 0.12 */
401
+
402
+ }, {
403
+ key: 'buildUrgencyLabelStyle',
404
+ value: function buildUrgencyLabelStyle(fieldColor) {
405
+ if (!fieldColor) {
406
+ return null;
407
+ }
408
+ var color = String(fieldColor).replace(/^\s+|\s+$/g, '');
409
+ var bg = '';
410
+ var m;
411
+ if (/^#([0-9a-fA-F]{3})$/.test(color)) {
412
+ m = color.substring(1);
413
+ 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.12)';
414
+ } else if (/^#([0-9a-fA-F]{6})$/.test(color)) {
415
+ m = color.substring(1);
416
+ bg = 'rgba(' + parseInt(m.substring(0, 2), 16) + ',' + parseInt(m.substring(2, 4), 16) + ',' + parseInt(m.substring(4, 6), 16) + ',0.12)';
417
+ } else {
418
+ m = color.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
419
+ if (m) {
420
+ bg = 'rgba(' + m[1] + ',' + m[2] + ',' + m[3] + ',0.12)';
421
+ }
422
+ }
423
+ if (!bg) {
424
+ return null;
425
+ }
426
+ return { backgroundColor: bg, border: '1px solid ' + color, color: color };
427
+ }
381
428
  }, {
382
429
  key: 'render',
383
430
  value: function render() {
@@ -396,21 +443,13 @@ var ListItem = function (_React$Component) {
396
443
  checkIsNotComplete = true;
397
444
  }
398
445
  // 枚举禁用时后端不回填 urgencyName,此时不渲染角标(避免空 label 色块)
399
- // 优先 fieldColor;无配置时回退历史 60/70/80/90 样式
446
+ // 统一:文字/边框用色,背景同色透明;无 fieldColor 时用 60/70/80/90 默认色(不再用无边框的 label-* 类)
400
447
  if (data.urgencyName) {
401
- if (data.fieldColor) {
448
+ var urgencyColor = data.fieldColor || this.getDefaultUrgencyColor(data.urgency);
449
+ if (urgencyColor) {
402
450
  urgencyTag = true;
403
451
  tagClass = 'label';
404
- urgencyStyle = { backgroundColor: data.fieldColor, borderColor: data.fieldColor, color: '#fff' };
405
- } else if (data.urgency == '90' || data.urgency == '80') {
406
- urgencyTag = true;
407
- tagClass = 'label label-danger';
408
- } else if (data.urgency == '70') {
409
- urgencyTag = true;
410
- tagClass = 'label label-warn';
411
- } else if (data.urgency == '60') {
412
- urgencyTag = true;
413
- tagClass = 'label label-primary';
452
+ urgencyStyle = this.buildUrgencyLabelStyle(urgencyColor);
414
453
  }
415
454
  }
416
455
  } else if (data.listTabType == 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fmui-base",
3
- "version": "2.3.69",
3
+ "version": "2.3.71",
4
4
  "title": "fmui-base",
5
5
  "description": "fmui移动端组件",
6
6
  "main": "lib/index.js",