cnhis-design-vue 0.2.66-beta → 0.2.69-beta

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.
Files changed (116) hide show
  1. package/es/affix/index.js +8 -8
  2. package/es/age/index.js +10 -10
  3. package/es/alert/index.js +8 -8
  4. package/es/anchor/index.js +8 -8
  5. package/es/auto-complete/index.js +8 -8
  6. package/es/avatar/index.js +8 -8
  7. package/es/back-top/index.js +8 -8
  8. package/es/badge/index.js +8 -8
  9. package/es/base/index.js +8 -8
  10. package/es/big-table/index.js +1808 -1302
  11. package/es/big-table/style.css +1 -1
  12. package/es/breadcrumb/index.js +8 -8
  13. package/es/button/index.js +28 -28
  14. package/es/calendar/index.js +8 -8
  15. package/es/captcha/index.js +3 -3
  16. package/es/card/index.js +8 -8
  17. package/es/carousel/index.js +8 -8
  18. package/es/cascader/index.js +8 -8
  19. package/es/checkbox/index.js +9 -9
  20. package/es/col/index.js +8 -8
  21. package/es/collapse/index.js +8 -8
  22. package/es/color-picker/index.js +1 -1
  23. package/es/comment/index.js +8 -8
  24. package/es/config-provider/index.js +8 -8
  25. package/es/date-picker/index.js +8 -8
  26. package/es/descriptions/index.js +8 -8
  27. package/es/divider/index.js +8 -8
  28. package/es/drag-layout/index.js +3 -3
  29. package/es/drawer/index.js +8 -8
  30. package/es/dropdown/index.js +8 -8
  31. package/es/editor/index.js +1 -1
  32. package/es/empty/index.js +8 -8
  33. package/es/fabric-chart/index.js +9 -9
  34. package/es/form/index.js +8 -8
  35. package/es/form-model/index.js +8 -8
  36. package/es/form-table/index.js +62 -62
  37. package/es/index/index.js +2206 -1720
  38. package/es/index/style.css +1 -1
  39. package/es/input/index.js +9 -9
  40. package/es/input-number/index.js +8 -8
  41. package/es/layout/index.js +8 -8
  42. package/es/list/index.js +8 -8
  43. package/es/locale-provider/index.js +8 -8
  44. package/es/map/index.js +9 -9
  45. package/es/mentions/index.js +8 -8
  46. package/es/menu/index.js +8 -8
  47. package/es/message/index.js +8 -8
  48. package/es/multi-chat/index.js +75 -75
  49. package/es/multi-chat-client/index.js +69 -69
  50. package/es/multi-chat-history/index.js +4 -4
  51. package/es/multi-chat-record/index.js +14 -14
  52. package/es/multi-chat-setting/index.js +22 -22
  53. package/es/multi-chat-sip/index.js +1 -1
  54. package/es/notification/index.js +8 -8
  55. package/es/page-header/index.js +8 -8
  56. package/es/pagination/index.js +8 -8
  57. package/es/popconfirm/index.js +8 -8
  58. package/es/popover/index.js +8 -8
  59. package/es/progress/index.js +8 -8
  60. package/es/radio/index.js +9 -9
  61. package/es/rate/index.js +8 -8
  62. package/es/result/index.js +8 -8
  63. package/es/row/index.js +8 -8
  64. package/es/scale-view/index.js +24 -24
  65. package/es/select/index.js +11 -11
  66. package/es/select-label/index.js +11 -11
  67. package/es/select-person/index.js +2 -2
  68. package/es/skeleton/index.js +8 -8
  69. package/es/slider/index.js +8 -8
  70. package/es/space/index.js +8 -8
  71. package/es/spin/index.js +8 -8
  72. package/es/statistic/index.js +8 -8
  73. package/es/steps/index.js +8 -8
  74. package/es/switch/index.js +8 -8
  75. package/es/table-filter/index.js +199 -177
  76. package/es/table-filter/style.css +1 -1
  77. package/es/tabs/index.js +8 -8
  78. package/es/tag/index.js +9 -9
  79. package/es/time-picker/index.js +8 -8
  80. package/es/timeline/index.js +8 -8
  81. package/es/tooltip/index.js +8 -8
  82. package/es/transfer/index.js +8 -8
  83. package/es/tree/index.js +8 -8
  84. package/es/tree-select/index.js +8 -8
  85. package/es/upload/index.js +8 -8
  86. package/es/utils/utils-map.js +33 -0
  87. package/es/utils/vexutils.js +21 -0
  88. package/es/verification-code/index.js +2 -2
  89. package/lib/cui.common.js +4824 -3817
  90. package/lib/cui.umd.js +4824 -3817
  91. package/lib/cui.umd.min.js +67 -67
  92. package/package.json +1 -1
  93. package/packages/big-table/src/BigTable.vue +107 -221
  94. package/packages/big-table/src/assets/style/table-base.less +16 -0
  95. package/packages/big-table/src/components/edit-form/EditForm.vue +27 -9
  96. package/packages/big-table/src/components/edit-form/edit-component/config-data/index.js +2 -1
  97. package/packages/big-table/src/components/edit-form/edit-component/edit-search/edit-search.vue +2 -3
  98. package/packages/big-table/src/components/edit-form/edit-component/edit-search-more/edit-search-more.vue +2 -2
  99. package/packages/big-table/src/components/edit-form/edit-component/edit-select/edit-select.vue +1 -1
  100. package/packages/big-table/src/components/edit-form/edit-component/edit-select-multiple/edit-select-multiple.vue +1 -1
  101. package/packages/big-table/src/components/edit-form/edit-component/edit-switch/edit-switch.vue +43 -0
  102. package/packages/big-table/src/components/edit-form/edit-component/mixins/dateType.js +5 -4
  103. package/packages/big-table/src/components/edit-form/edit-component/mixins/item-default.js +50 -5
  104. package/packages/big-table/src/components/edit-form/edit-component/mixins/search.js +202 -153
  105. package/packages/big-table/src/components/edit-form/edit-item/form-event.js +3 -2
  106. package/packages/big-table/src/components/edit-form/edit-item/validate-rules.js +6 -6
  107. package/packages/big-table/src/components/edit-form/edit-mixins/form-commom.js +25 -20
  108. package/packages/big-table/src/components/player-vod/video-list.vue +3 -2
  109. package/packages/big-table/src/utils/batchEditing.js +144 -75
  110. package/packages/big-table/src/utils/bigTableProps.js +9 -13
  111. package/packages/table-filter/src/base-search-com/BaseSearch.vue +45 -47
  112. package/packages/table-filter/src/components/out-quick-search/out-quick-search.vue +3 -0
  113. package/packages/table-filter/src/components/search-condition/SearchCondition.vue +9 -4
  114. package/packages/table-filter/src/components/search-filter/SearchFilter.vue +11 -3
  115. package/src/utils/utils-map.js +34 -0
  116. package/src/utils/vexutils.js +96 -77
@@ -4,14 +4,16 @@
4
4
  <div class="bease-left" ref="baseLeft" v-resize="onResize">
5
5
  <!-- 行内编辑对应生成的(保存、取消)按钮 -->
6
6
  <template v-if="visibleInlineOperateBtn">
7
- <a-button :style="{ display: isInlineOperating ? 'inline-block' : 'none' }" @click="inlineEditClick" class="btn-custom-class" style="margin: 8px 8px 8px 0" type="primary">
8
- 保存
9
- </a-button>
10
- <a-button :style="{ display: isInlineOperating ? 'inline-block' : 'none' }" @click="inlineEditCancel" class="btn-custom-class" style="margin: 8px 8px 8px 0">
11
- 取消
12
- </a-button>
7
+ <div class="btn-custom-wrap">
8
+ <a-button :style="{ display: isInlineOperating ? 'inline-block' : 'none' }" @click="inlineEditClick" class="btn-custom-class" style="margin: 8px 8px 8px 0" type="primary">
9
+ 保存
10
+ </a-button>
11
+ <a-button :style="{ display: isInlineOperating ? 'inline-block' : 'none' }" @click="inlineEditCancel" class="btn-custom-class" style="margin: 8px 8px 8px 0">
12
+ 取消
13
+ </a-button>
14
+ </div>
13
15
  </template>
14
- <ul v-else>
16
+ <ul v-if="!visibleInlineOperateBtn && !isRowEditing">
15
17
  <div ref="btnRow" class="btn-row" v-if="isShowSettingBtn">
16
18
  <a-button class="btn-setting" v-show="currentTempId != '0' && isShowSetting('hideSettingBtn')" icon="setting" @click="handlerSetting">
17
19
  设置
@@ -324,7 +326,7 @@
324
326
  </ul>
325
327
  </div>
326
328
  </div>
327
- <div class="base-tabs" v-if="conditionType === 'keyword' && tabConditionList.length > 0">
329
+ <div class="base-tabs" v-if="showBaseTabs">
328
330
  <div v-for="(item, index) in tabConditionList" :key="index" :class="tabIndex === index ? 'base-tabs-item base-tabs-item-active' : 'base-tabs-item'" @click="tabClick(index)"
329
331
  >{{ item.name }} {{ countTabCondition == 1 && (item.digital || item.digital === 0) ? '(' + (item.digital || 0) + ')' : '' }}</div
330
332
  >
@@ -557,7 +559,8 @@ export default create({
557
559
  type: Object,
558
560
  default: () => ({})
559
561
  },
560
- useFieldList: Array
562
+ useFieldList: Array,
563
+ editTableUid: [String, Number]
561
564
  },
562
565
  components: {
563
566
  [Button.name]: Button,
@@ -721,6 +724,9 @@ export default create({
721
724
  curBatchBtnData() {
722
725
  return this?.gettersConfig?.curBatchBtnData || {};
723
726
  },
727
+ isRowEditing() {
728
+ return this?.gettersConfig?.isRowEditing || false;
729
+ },
724
730
  // 是否有高级筛选外显
725
731
  showOutSearch() {
726
732
  return this.outSearchFieldList?.length || this.outRelationQuickSearch?.length;
@@ -757,6 +763,9 @@ export default create({
757
763
  // 平铺列表, 左侧不为tree, 而是table
758
764
  if(this.editTableSource == 'relatedComponent' && this.relatedBaseInfo?.showType != "TREE") return showQuick
759
765
  return showQuick && this.isRelatedSearchFold
766
+ },
767
+ showBaseTabs() {
768
+ return this.conditionType === 'keyword' && this.tabConditionList?.length && !this.visibleInlineOperateBtn && !this.isRowEditing
760
769
  }
761
770
  },
762
771
  data() {
@@ -822,7 +831,7 @@ export default create({
822
831
  if (index !== -1) this.$emit('tabClick', this.tabConditionList[index]);
823
832
  },
824
833
  pageResize(obj) {
825
- if (this.resizeFlag || this.visibleInlineOperateBtn) return;
834
+ if (this.resizeFlag || this.visibleInlineOperateBtn || this.isRowEditing) return;
826
835
  let baseLeft = this.$refs['baseLeft'];
827
836
  if (!baseLeft) return;
828
837
  this.resizeFlag = true;
@@ -846,7 +855,7 @@ export default create({
846
855
  }
847
856
  },
848
857
  onResize() {
849
- if (this.isButtonFolding || this.isShowSetting('buttonAdaption') || this.relatedIsTree == 1 || this.visibleInlineOperateBtn) return;
858
+ if (this.isButtonFolding || this.isShowSetting('buttonAdaption') || this.relatedIsTree == 1 || this.visibleInlineOperateBtn || this.isRowEditing) return;
850
859
  utils.debounce(this.pageResize({ type: 'resize' }), 300);
851
860
  },
852
861
  async saveListIsTile() {
@@ -1141,11 +1150,12 @@ export default create({
1141
1150
  paramsData: paramsData,
1142
1151
  btnName: btn.name,
1143
1152
  _params_data: this.paramsData,
1153
+ _type_: btn.type
1144
1154
  }),
1145
1155
  indexList: indexList,
1146
1156
  btnConfig: JSON.parse(JSON.stringify(btn)),
1147
1157
  _params_data: this.paramsData,
1148
-
1158
+ _type_: btn.type
1149
1159
  };
1150
1160
  this.$emit('btnEvent', btnData);
1151
1161
  },
@@ -1915,28 +1925,23 @@ export default create({
1915
1925
  });
1916
1926
  },
1917
1927
  inlineEditClick() {
1918
- // 批量编辑
1919
- if (this.isBatchEditing) {
1920
- let { btnName, tipsMsg, isTips } = this.curBatchBtnData || {};
1921
- let _this = this;
1922
- // 保存是否需要提示
1923
- if (isTips != 1) {
1924
- this.setBatchSaveRowStatus(true);
1925
- return;
1926
- }
1927
- this.$confirm({
1928
- title: tipsMsg || btnName,
1929
- okText: '确定',
1930
- cancelText: '取消',
1931
- onOk: () => {
1932
- _this.setBatchSaveRowStatus(true);
1933
- },
1934
- onCancel() {
1935
- }
1936
- });
1928
+ let { btnName, tipsMsg, isTips } = this.curBatchBtnData || {};
1929
+ let _this = this;
1930
+ // 保存是否需要提示
1931
+ if (isTips != 1) {
1932
+ this.setBatchSaveRowStatus(true);
1937
1933
  return;
1938
1934
  }
1939
- this.setSaveRowStatus(true);
1935
+ this.$confirm({
1936
+ title: tipsMsg || `是否确认${btnName}`,
1937
+ okText: '确定',
1938
+ cancelText: '取消',
1939
+ onOk: () => {
1940
+ _this.setBatchSaveRowStatus(true);
1941
+ },
1942
+ onCancel() {
1943
+ }
1944
+ });
1940
1945
  },
1941
1946
 
1942
1947
  /**
@@ -1964,12 +1969,7 @@ export default create({
1964
1969
 
1965
1970
 
1966
1971
  inlineEditCancel() {
1967
- // 批量编辑
1968
- if (this.isBatchEditing) {
1969
- this.setBatchCancelRowStatus(true);
1970
- return;
1971
- }
1972
- this.setCancelRowStatus(true);
1972
+ this.setBatchCancelRowStatus(true);
1973
1973
  },
1974
1974
 
1975
1975
  setBatchSaveRowStatus(f) {
@@ -1980,14 +1980,6 @@ export default create({
1980
1980
  this.$emit('setBatchCancelRowStatus', f);
1981
1981
  },
1982
1982
 
1983
- setSaveRowStatus(f) {
1984
- this.$emit('setSaveRowStatus', f);
1985
- },
1986
-
1987
- setCancelRowStatus(f) {
1988
- this.$emit('setCancelRowStatus', f);
1989
- },
1990
-
1991
1983
  setPrintNumberCache(obj) {
1992
1984
  this.$emit('setPrintNumberCache', obj);
1993
1985
  }
@@ -2118,7 +2110,7 @@ export default create({
2118
2110
  this.inputSearchW = w > maxW ? maxW : w < 200 ? 200 : w;
2119
2111
  if (w > maxW) {
2120
2112
  this.showPlaceholderPrefix = true;
2121
- }
2113
+ }
2122
2114
  this.onResize();
2123
2115
  });
2124
2116
  }
@@ -2141,6 +2133,12 @@ export default create({
2141
2133
  justify-content: flex-start;
2142
2134
  align-items: flex-start;
2143
2135
  flex: 1;
2136
+ .btn-custom-wrap {
2137
+ width: 100%;
2138
+ display: flex;
2139
+ justify-content: flex-end;
2140
+ align-items: flex-start;
2141
+ }
2144
2142
  }
2145
2143
  .base-tabs {
2146
2144
  display: flex;
@@ -277,6 +277,9 @@ export default {
277
277
  };
278
278
  return this.handleGetConfigApi(params, 'requestGetWordbookData', { fields: o }).then(res => {
279
279
  this.fetchingWordbook = false;
280
+ if(typeof res.data === 'object'){
281
+ res.data.reqParams = params;
282
+ }
280
283
  return res;
281
284
  }).catch(() => {
282
285
  this.fetchingWordbook = false;
@@ -374,7 +374,8 @@ export default create({
374
374
  classify: 'custom',
375
375
  classifyList: [],
376
376
  addVal: '',
377
- showAdd: false
377
+ showAdd: false,
378
+ birthdayFilter: ["BIG", "LESS", "BIGEQ", "LESSEQ", "IN_THE_PAST_DI", "IN_THE_FUTURE_DI"]
378
379
  };
379
380
  },
380
381
  computed: {
@@ -981,12 +982,16 @@ export default create({
981
982
  return true;
982
983
  } else {
983
984
  let matchItem = this.fieldTypeList.find(item => sea.fieldType.toUpperCase() == item.name);
985
+ let conList = this.searchChildList;
984
986
  if (matchItem) {
985
987
  // 关系 选项
986
- action.searchChildList = matchItem.conList;
987
- } else {
988
- action.searchChildList = this.searchChildList;
988
+ conList = matchItem.conList;
989
+ }
990
+ if (action?.settingObj?.attr === "BIRTHDAY") {
991
+ conList = conList.filter(v => !this.birthdayFilter.includes(v.name)) || [];
989
992
  }
993
+
994
+ action.searchChildList = conList;
990
995
  }
991
996
  // 通过 attr 判断类型,searchChildList
992
997
  if (attrType == 'AGE') {
@@ -58,7 +58,8 @@ export default {
58
58
  bodyStyle: {
59
59
  maxHeight: "496px",
60
60
  overflowY: "auto"
61
- }
61
+ },
62
+ filterTimer: null
62
63
  };
63
64
  },
64
65
  computed: {},
@@ -80,9 +81,13 @@ export default {
80
81
  },
81
82
  methods: {
82
83
  init() {
83
- this.$nextTick(() => {
84
+ this.clearTimer()
85
+ this.filterTimer = setTimeout(() => {
84
86
  this.handleInitConditions();
85
- });
87
+ }, 30)
88
+ },
89
+ clearTimer() {
90
+ if(this.filterTimer) clearTimeout(this.filterTimer)
86
91
  },
87
92
  handleInitConditions() {
88
93
  this.$refs.conditionRef.handleInitConditions();
@@ -123,6 +128,9 @@ export default {
123
128
  this.bodyStyle.height = "";
124
129
  }
125
130
  }
131
+ },
132
+ destroyed() {
133
+ this.clearTimer();
126
134
  }
127
135
  };
128
136
  </script>
@@ -447,4 +447,38 @@ export default {
447
447
  });
448
448
  return item;
449
449
  },
450
+ handleCurValue(value) {
451
+ if (!value) return value;
452
+ if (!this.isString(value)) {
453
+ return value;
454
+ }
455
+ if (this.checkHtml(value)) {
456
+ return this.htmlToText(value)
457
+ } else {
458
+ return this.handleUseValue(value)
459
+ }
460
+ },
461
+ /**
462
+ * @description: 将HTML格式转换为纯文本
463
+ */
464
+ htmlToText(HTML) {
465
+ var input = HTML;
466
+ return input
467
+ .replace(/<(style|script|iframe)[^>]*?>[\s\S]+?<\/\1\s*>/gi, "")
468
+ .replace(/<[^>]+?>/g, "")
469
+ .replace(/\s+/g, " ")
470
+ .replace(/ /g, " ")
471
+ .replace(/>/g, " ");
472
+ },
473
+ checkHtml(str) {
474
+ var reg = /<[^>]+>/g;
475
+ return reg.test(str);
476
+ },
477
+ handleUseValue(value) {
478
+ if (value && value.startsWith("###{")) {
479
+ let temp = JSON.parse(value.replace("###", ""));
480
+ return temp.tooltip || temp.value;
481
+ }
482
+ return value;
483
+ }
450
484
  };
@@ -2,7 +2,7 @@ import XEUtils from 'xe-utils';
2
2
  import moment from 'moment';
3
3
  // com内容来源于老项目
4
4
  const com = {
5
- parseCondition: function(conList, data, fieldList) {
5
+ parseCondition: function (conList, data, fieldList) {
6
6
  if (conList && conList.length > 0 && data && data.table) {
7
7
  for (let i = 0; i < conList.length; i++) {
8
8
  let conObj = conList[i];
@@ -19,7 +19,7 @@ const com = {
19
19
  }
20
20
  return true;
21
21
  },
22
- getFieldByKey: function(fieldKey, fieldList) {
22
+ getFieldByKey: function (fieldKey, fieldList) {
23
23
  if (fieldList && fieldList.length > 0) {
24
24
  for (let i = 0; i < fieldList.length; i++) {
25
25
  let fobj = fieldList[i];
@@ -29,7 +29,7 @@ const com = {
29
29
  }
30
30
  }
31
31
  },
32
- getConnection: function(cObj, fVal, field) {
32
+ getConnection: function (cObj, fVal, field) {
33
33
  let con = cObj.con;
34
34
  let value = cObj.value;
35
35
  // 修改 #['NULL','NOT_NULL'] 的判断: value => fval 2020-09-15.
@@ -340,7 +340,7 @@ const com = {
340
340
  }
341
341
  return true;
342
342
  },
343
- getBetween: function(value, type, comVal) {
343
+ getBetween: function (value, type, comVal) {
344
344
  if (value && value.indexOf('~') != -1 && value.split('~').length == 2) {
345
345
  let start = value.split('~')[0];
346
346
  let end = value.split('~')[1];
@@ -351,7 +351,7 @@ const com = {
351
351
  }
352
352
  }
353
353
  },
354
- convertDate: function(str) {
354
+ convertDate: function (str) {
355
355
  if (str) {
356
356
  if (str.indexOf('-') != -1) {
357
357
  str = str = str.replace(/-/g, '/');
@@ -371,7 +371,7 @@ const com = {
371
371
  }
372
372
  }
373
373
  },
374
- addDate: function(tempDate, days, unit) {
374
+ addDate: function (tempDate, days, unit) {
375
375
  let date = tempDate;
376
376
  if (['D', 'H', 'W'].includes(unit)) {
377
377
  if (tempDate && XEUtils.isValidDate(tempDate)) {
@@ -398,7 +398,7 @@ const com = {
398
398
  return new Date(date + days * 3600 * 1000);
399
399
  }
400
400
  },
401
- addDiDate: function(curDate, count, unit = 'day', type) {
401
+ addDiDate: function (curDate, count, unit = 'day', type) {
402
402
  let useTime,
403
403
  res = {};
404
404
  let getUnit = unit.toLowerCase();
@@ -413,7 +413,7 @@ const com = {
413
413
  return res;
414
414
  },
415
415
  // 获取当前季度第一天
416
- getCurSeasonFirstDay: function() {
416
+ getCurSeasonFirstDay: function () {
417
417
  let curDate = new Date();
418
418
  let year = curDate.getFullYear();
419
419
  let month = curDate.getMonth() + 1;
@@ -427,7 +427,7 @@ const com = {
427
427
  return new Date(year + '/10/01');
428
428
  }
429
429
  },
430
- isNumber: function(val) {
430
+ isNumber: function (val) {
431
431
  try {
432
432
  let i = val * 1 + 100;
433
433
  if (i > 0 || i < 0 || i == 0) {
@@ -438,7 +438,7 @@ const com = {
438
438
  }
439
439
  return false;
440
440
  },
441
- isDate: function(data) {
441
+ isDate: function (data) {
442
442
  if (isNaN(data) && !isNaN(Date.parse(data))) {
443
443
  return true;
444
444
  }
@@ -701,13 +701,13 @@ XEUtils.mixin({
701
701
  * @param {*} k key
702
702
  * @returns
703
703
  */
704
- stringToValue(item, k = "value") {
705
- if (XEUtils.isString(item)) {
706
- if (item && item.startsWith("###{")) {
707
- let temp = JSON.parse(item.replace("###", ""));
708
- item = temp[k];
709
- }
704
+ stringToValue(item, k = "value") {
705
+ if (XEUtils.isString(item)) {
706
+ if (item && item.startsWith("###{")) {
707
+ let temp = JSON.parse(item.replace("###", ""));
708
+ item = temp[k];
710
709
  }
710
+ }
711
711
  return item;
712
712
  },
713
713
 
@@ -715,71 +715,89 @@ XEUtils.mixin({
715
715
  return XEUtils.isBoolean(text) || String(text) === "0" || !!text;
716
716
  },
717
717
 
718
- /**
719
- * 变量转换
720
- * @param {string} str
721
- * @param {object} obj
722
- * @param {string | number} noval // 没有值,默认赋值
723
- */
724
- handleSysParams(str, obj = {}, noval = "") {
725
- let p = {
726
- ...obj
727
- };
728
- const that = this;
729
- // 解析变量
730
- const getValList = (plsList = [], obj = {}) => {
731
- var l = [];
732
- var o = obj;
733
- plsList.forEach(v => {
734
- let c = v;
735
- // xx.xx
736
- if (v.includes(".")) {
737
- try {
738
- // 使用 eval 解析 'result.map.map.filed'
739
- eval(`c=o.${v}`);
740
- } catch (error) {
741
- c = "";
742
- }
743
- }
744
- if (XEUtils.notEmpty(c)) {
745
- l.push(c);
718
+ /**
719
+ * 变量转换
720
+ * @param {string} str
721
+ * @param {object} obj
722
+ * @param {string | number} noval // 没有值,默认赋值
723
+ */
724
+ handleSysParams(str, obj = {}, noval = "") {
725
+ let p = {
726
+ ...obj
727
+ };
728
+ const that = this;
729
+ // 解析变量
730
+ const getValList = (plsList = [], obj = {}) => {
731
+ var l = [];
732
+ var o = obj;
733
+ plsList.forEach(v => {
734
+ let c = v;
735
+ // xx.xx
736
+ if (v.includes(".")) {
737
+ try {
738
+ // 使用 eval 解析 'result.map.map.filed'
739
+ eval(`c=o.${v}`);
740
+ } catch (error) {
741
+ c = "";
746
742
  }
747
- });
748
- return l;
749
- };
750
- const getVal = (t, r, k) => {
751
- return t.replace(r, function() {
752
- var pKey = arguments[1];
753
- // 切割
754
- var pls = pKey.split("!");
755
- // 取值
756
- var l = getValList(pls, p);
757
- var f = l.find(v => XEUtils.notEmpty(v));
758
- var res = f;
759
- res = XEUtils.notEmpty(res) ? res : noval;
760
- return res;
761
- });
762
- };
763
- if (typeof str === "string") {
764
- if (str.includes("form")) {
765
- str = getVal(str, /\${(.*?)\}/g, "form");
766
- }
767
- if (str.includes("sys")) {
768
- str = getVal(str, /\${(.*?)\}/g, "sys");
769
743
  }
770
- if (str.includes("db")) {
771
- str = getVal(str, /\${(.*?)\}/g, "db");
772
- }
773
- if (str.includes("table")) {
774
- str = getVal(str, /\${(.*?)\}/g, "table");
775
- }
776
- if (str.includes("result")) {
777
- str = getVal(str, /\${(.*?)\}/g, "result");
744
+ if (XEUtils.notEmpty(c)) {
745
+ l.push(c);
778
746
  }
747
+ });
748
+ return l;
749
+ };
750
+ const getVal = (t, r, k) => {
751
+ return t.replace(r, function () {
752
+ var pKey = arguments[1];
753
+ // 切割
754
+ var pls = pKey.split("!");
755
+ // 取值
756
+ var l = getValList(pls, p);
757
+ var f = l.find(v => XEUtils.notEmpty(v));
758
+ var res = f;
759
+ res = XEUtils.notEmpty(res) ? res : noval;
760
+ return res;
761
+ });
762
+ };
763
+ if (typeof str === "string") {
764
+ if (str.includes("form")) {
765
+ str = getVal(str, /\${(.*?)\}/g, "form");
779
766
  }
780
- return str;
781
- },
782
-
767
+ if (str.includes("sys")) {
768
+ str = getVal(str, /\${(.*?)\}/g, "sys");
769
+ }
770
+ if (str.includes("db")) {
771
+ str = getVal(str, /\${(.*?)\}/g, "db");
772
+ }
773
+ if (str.includes("table")) {
774
+ str = getVal(str, /\${(.*?)\}/g, "table");
775
+ }
776
+ if (str.includes("result")) {
777
+ str = getVal(str, /\${(.*?)\}/g, "result");
778
+ }
779
+ }
780
+ return str;
781
+ },
782
+ /**
783
+ * 去掉字符串两边的空格
784
+ * @param {string} str
785
+ * @return {string}
786
+ */
787
+ handleClearStrBlank(str) {
788
+ if (typeof str === "string") {
789
+ return str.replace(/^\s*|\s*$/g, "");
790
+ }
791
+ return str;
792
+ },
793
+ // 数组对象去重
794
+ uniqArrObj(arr, name) {
795
+ let obj = {};
796
+ return arr.reduce((cur, next) => {
797
+ obj[next[name]] ? "" : (obj[next[name]] = true && cur.push(next));
798
+ return cur;
799
+ }, []);
800
+ },
783
801
  });
784
802
 
785
803
  export default XEUtils;
@@ -809,3 +827,4 @@ export function formatReleaseTime(type, time) {
809
827
  }
810
828
  return XEUtils.toDateString(time, format);
811
829
  }
830
+