cnhis-design-vue 0.1.79-beta → 0.1.83-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 (51) hide show
  1. package/es/age/index.js +2 -2
  2. package/es/big-table/index.js +21 -21
  3. package/es/button/index.js +2 -2
  4. package/es/captcha/index.js +3 -3
  5. package/es/checkbox/index.js +1 -1
  6. package/es/color-picker/index.js +1 -1
  7. package/es/drag-layout/index.js +3 -3
  8. package/es/editor/index.js +1 -1
  9. package/es/fabric-chart/index.js +9 -9
  10. package/es/img/no-data2.0ca9388b.png +0 -0
  11. package/es/index/index.js +618 -493
  12. package/es/index/style.css +1 -1
  13. package/es/input/index.js +1 -1
  14. package/es/map/index.js +1 -1
  15. package/es/multi-chat/index.js +185 -135
  16. package/es/multi-chat/style.css +1 -1
  17. package/es/multi-chat-client/index.js +97 -66
  18. package/es/multi-chat-client/style.css +1 -1
  19. package/es/multi-chat-history/index.js +4 -4
  20. package/es/multi-chat-record/index.js +4 -4
  21. package/es/multi-chat-setting/index.js +51 -38
  22. package/es/multi-chat-setting/style.css +1 -1
  23. package/es/multi-chat-sip/index.js +1 -1
  24. package/es/radio/index.js +1 -1
  25. package/es/scale-view/index.js +100 -73
  26. package/es/scale-view/style.css +1 -1
  27. package/es/select/index.js +3 -3
  28. package/es/select-label/index.js +2 -2
  29. package/es/select-person/index.js +2 -2
  30. package/es/table-filter/index.js +228 -185
  31. package/es/table-filter/style.css +1 -1
  32. package/es/tag/index.js +1 -1
  33. package/es/utils/vexutils.js +93 -0
  34. package/es/verification-code/index.js +2 -2
  35. package/lib/cui.common.js +940 -726
  36. package/lib/cui.umd.js +940 -726
  37. package/lib/cui.umd.min.js +65 -65
  38. package/lib/img/no-data2.0ca9388b.png +0 -0
  39. package/package.json +2 -2
  40. package/packages/multi-chat/chat/chatFooter.vue +18 -5
  41. package/packages/multi-chat/chat/index.vue +2 -1
  42. package/packages/multi-chat/chat/scrollList.vue +56 -28
  43. package/packages/multi-chat/img/no-data2.png +0 -0
  44. package/packages/multi-chat/setting/baseInfo/index.vue +5 -0
  45. package/packages/scale-view/formitem/r-choice.vue +8 -1
  46. package/packages/scale-view/scaleView.vue +19 -5
  47. package/packages/table-filter/src/components/multi-select/multi-select.vue +52 -33
  48. package/packages/table-filter/src/components/out-quick-search/out-quick-search.vue +6 -39
  49. package/packages/table-filter/src/mixins/wordBookutils.js +99 -0
  50. package/packages/table-filter/src/quick-search/QuickSearch.vue +6 -41
  51. package/src/utils/vexutils.js +70 -0
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "0.1.79-beta",
3
+ "version": "0.1.83-beta",
4
4
  "description": "基于 Ant Desgin Vue 的UI库",
5
5
  "keyword": "cnhis-design-vue vue cnhis",
6
6
  "homepage": "http://dv.cnhis.com/",
@@ -93,4 +93,4 @@
93
93
  "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
94
94
  }
95
95
  }
96
- }
96
+ }
@@ -167,6 +167,7 @@ import QuickReply from './quickReply';
167
167
  import voice from './voice';
168
168
  import ModalUserTransfer from '../components/modal-user-transfer';
169
169
  import ModalRefuseReason from '../components/modal-refuse-reason';
170
+ import vexutils from '@/utils/vexutils';
170
171
  export default {
171
172
  inject: ['store', 'i18nText', 'dispatchEvent', 'registerEvent', 'unregisterEvent'],
172
173
  components: {
@@ -226,7 +227,9 @@ export default {
226
227
  curToolbarItem: {},
227
228
  showVoice: false,
228
229
  transferVisible: false,
229
- refuseVisible: false
230
+ refuseVisible: false,
231
+
232
+ apiResult: {}, // 前置条件的返回值
230
233
  };
231
234
  },
232
235
  computed: {
@@ -307,9 +310,9 @@ export default {
307
310
  },
308
311
  // 拦截url
309
312
  accessInterceptUrl() {
310
- const { accessInterceptObj: obj } = this;
313
+ const { accessInterceptObj: obj, apiResult } = this;
311
314
  if (obj) {
312
- return this.getLinkAddress(obj);
315
+ return this.getLinkAddress(obj,{result:apiResult});
313
316
  }
314
317
  return '';
315
318
  },
@@ -830,18 +833,25 @@ export default {
830
833
  this.modalShow = false;
831
834
  window.removeEventListener('message', this.iframeEvent);
832
835
  },
833
- getLinkAddress(item) {
836
+ getLinkAddress(item,paramsData= {}) {
837
+ let t = {talbe:{},form:{},sys:{}};
838
+ Object.assign(t,paramsData ||{})
834
839
  let { address = '', params = [] } = item;
835
840
  let urlParams = [];
836
841
  params.forEach(({ p_name, p_value }) => {
837
842
  let value;
838
843
  if (p_value.startsWith('form.')) {
839
844
  value = this.clientParams[p_value.slice(5)];
845
+ } else if( /\${result.(.*?)\}/g.test(p_value)) {
846
+ value = vexutils.handleSysParams(p_value,t)
840
847
  } else {
841
848
  value = p_value;
842
849
  }
843
850
  urlParams.push(`${p_name}=${value}`);
844
851
  });
852
+ if(/\${result.(.*?)\}/g.test(address)){
853
+ address = vexutils.handleSysParams(address,t)
854
+ }
845
855
  let { actionType } = this.curToolbarItem;
846
856
  actionType && urlParams.push(`actionType=${actionType}`);
847
857
  if (address.includes('?')) {
@@ -1033,6 +1043,7 @@ export default {
1033
1043
  },
1034
1044
  /* 客服点击接入按钮进入会话 */
1035
1045
  async handleAccess() {
1046
+ this.apiResult = {};
1036
1047
  let accessInterceptValidate = this.handleAccessInterceptValue();
1037
1048
  let data = null; // 接口参数
1038
1049
  if (accessInterceptValidate && this.accessInterceptUrl) {
@@ -1087,12 +1098,14 @@ export default {
1087
1098
  data
1088
1099
  };
1089
1100
  }
1101
+ this.apiResult = {};
1090
1102
  const accessInterceptSetting = this.assemblySetting.accessInterceptSetting || [];
1091
1103
  const setting = accessInterceptSetting.find(item => item.source == 'PC' && item.isChecked == 'Y' && item.precondition);
1092
1104
  if (setting) {
1093
1105
  const precondition = setting.precondition;
1094
1106
  try {
1095
- const res = await this.requestPreCondition(precondition);
1107
+ let res = await this.requestPreCondition(precondition);
1108
+ this.apiResult = res?.data?.map || {};
1096
1109
  if (res.data.result === 'SUCCESS') {
1097
1110
  let value = res.data.map?.result;
1098
1111
  value = value ? JSON.parse(value) : {};
@@ -410,8 +410,9 @@ export default {
410
410
  },
411
411
  async created() {
412
412
  this.init();
413
- this.registerEvent('searchCurrenChatList', keyword => {
413
+ this.registerEvent('searchCurrenChatList', ({type = 'change', keyword}) => {
414
414
  this.handleKeywordsChange({ target: { value: keyword } });
415
+ type == 'pressEnter' && this.handleKeywordsSearch({ target: { value: keyword } });
415
416
  });
416
417
  this.registerEvent('updatePanelTab', this.onlyGroup);
417
418
  },
@@ -84,7 +84,7 @@ export default {
84
84
  const data = {
85
85
  ...item,
86
86
  title,
87
- width: w,
87
+ // width: w,
88
88
  field: `_${key}_`,
89
89
  showHeaderOverflow: true,
90
90
  showOverflow: true
@@ -416,7 +416,11 @@ export default {
416
416
  this.$set(item, 'count', '');
417
417
  });
418
418
  }
419
- let params = { assemblyId: this.assemblyId };
419
+ // let params = { assemblyId: this.assemblyId };
420
+ let params = {
421
+ ...this.getDateParams(),
422
+ assemblyId: this.assemblyId,
423
+ };
420
424
  fetch
421
425
  .get('/chat/service/getQueueUsers', {
422
426
  params
@@ -891,6 +895,7 @@ export default {
891
895
  }
892
896
  const { theme, currentTab, processedScrollList, handleInfiniteOnLoad, busy, infiniteMsgShow, foldTheme, classifyIcon } = this;
893
897
  const isEnd = currentTab === 'end';
898
+ const isNoData = !processedScrollList?.length;
894
899
  const filters = this.$options.filters;
895
900
  const directives = [
896
901
  {
@@ -899,7 +904,7 @@ export default {
899
904
  }
900
905
  ];
901
906
  function getAvatar(item) {
902
- return <Avatar className="avatar" src={item.portrait} name={item.name || item.toName || item.title} len={2} />;
907
+ return <Avatar className="avatar" src={item.portrait} name={item.name || item.toName || item.title || item.titleSetting} len={2} />;
903
908
  }
904
909
  function getContent(item, filters, fold, classifyIcon) {
905
910
  const { formatName, formatCount } = filters;
@@ -951,32 +956,41 @@ export default {
951
956
  }
952
957
  return (
953
958
  <div class={[theme, 'chat-scroll-container']}>
954
- <ul class="chat-scroll-session__list">
955
- {processedScrollList.map((item, index) => {
956
- const msgCount = item.msgCount;
957
- return (
958
- <li class={{ 'scroll-item': true, active: this.isActive(item) }} key={item.id || item.bid || index} onClick={() => this.handleClick(item)} id={'item_id_' + item.id}>
959
- {foldTheme
960
- ? [
961
- <a-popover overlayClassName="chat-list-popover--fold" placement="right" destroyTooltipOnHide={true}>
962
- <template slot="content">{getContent(item, filters, foldTheme, classifyIcon)}</template>
963
- {getAvatar(item)}
964
- </a-popover>,
965
- msgCount ? <div class="chat-scroll-session__num">{msgCount > 99 ? '99+' : msgCount}</div> : null
966
- ]
967
- : [getAvatar(item), getContent(item, filters, foldTheme, classifyIcon)]}
968
- </li>
969
- );
970
- })}
971
- </ul>
972
- {isEnd ? (
973
- <div {...{ directives }} infinite-scroll-immediate-check="immediate" infinite-scroll-disabled={busy} infinite-scroll-distance={10}>
974
- <div class="infinite-wrap" style={infiniteMsgShow ? '' : 'display:none'}>
975
- <a-spin size="small" />
976
- {foldTheme ? '' : '加载中'}
977
- </div>
959
+ {!isNoData ? (
960
+ [
961
+ <ul class="chat-scroll-session__list">
962
+ {processedScrollList.map((item, index) => {
963
+ const msgCount = item.msgCount;
964
+ return (
965
+ <li class={{ 'scroll-item': true, active: this.isActive(item) }} key={item.id || item.bid || index} onClick={() => this.handleClick(item)} id={'item_id_' + item.id}>
966
+ {foldTheme
967
+ ? [
968
+ <a-popover overlayClassName="chat-list-popover--fold" placement="right" destroyTooltipOnHide={true}>
969
+ <template slot="content">{getContent(item, filters, foldTheme, classifyIcon)}</template>
970
+ {getAvatar(item)}
971
+ </a-popover>,
972
+ msgCount ? <div class="chat-scroll-session__num">{msgCount > 99 ? '99+' : msgCount}</div> : null
973
+ ]
974
+ : [getAvatar(item), getContent(item, filters, foldTheme, classifyIcon)]}
975
+ </li>
976
+ );
977
+ })}
978
+ </ul>,
979
+ isEnd ? (
980
+ <div {...{ directives }} infinite-scroll-immediate-check="immediate" infinite-scroll-disabled={busy} infinite-scroll-distance={10}>
981
+ <div class="infinite-wrap" style={infiniteMsgShow ? '' : 'display:none'}>
982
+ <a-spin size="small" />
983
+ {foldTheme ? '' : '加载中'}
984
+ </div>
985
+ </div>
986
+ ) : null
987
+ ]
988
+ ) : (
989
+ <div class="no-data">
990
+ <img src={require('../img/no-data2.png')} />
991
+ <span>{this.i18nText('1.1.6.11')}</span>
978
992
  </div>
979
- ) : null}
993
+ )}
980
994
  </div>
981
995
  );
982
996
  }
@@ -984,6 +998,20 @@ export default {
984
998
  </script>
985
999
 
986
1000
  <style lang="less">
1001
+ .no-data {
1002
+ flex: 1;
1003
+ display: flex;
1004
+ flex-direction: column;
1005
+ justify-content: center;
1006
+ align-items: center;
1007
+ & > img {
1008
+ width: 160px;
1009
+ }
1010
+ span {
1011
+ display: inline-block;
1012
+ font-size: 14px;
1013
+ }
1014
+ }
987
1015
  .chat-scroll-container {
988
1016
  height: 100%;
989
1017
  overflow-y: auto;
@@ -8,6 +8,7 @@
8
8
  <a-form-item>
9
9
  <a-checkbox @change="handleTimeSettingShow" :checked="showTimeSetting">{{ i18nText('1.9.402') }}</a-checkbox>
10
10
  <a-checkbox v-model="readStatus">已读回执</a-checkbox>
11
+ <a-checkbox v-model="lineUpNotice">排队提醒</a-checkbox>
11
12
  </a-form-item>
12
13
  <template v-if="showTimeSetting">
13
14
  <a-row class="time-setting">
@@ -374,6 +375,7 @@ export default {
374
375
  showBotSetting: false,
375
376
  evaluate: false,
376
377
  readStatus: false,
378
+ lineUpNotice: false,
377
379
  evaluateId: '',
378
380
  timeLengths: [5, 10, 20, 30, 40, 50, 60],
379
381
  functionSetting: [], // 服务端功能
@@ -532,9 +534,11 @@ export default {
532
534
  chatPublicCategory,
533
535
  evaluate,
534
536
  readStatus,
537
+ lineUpNotice,
535
538
  broadcast
536
539
  } = setting;
537
540
  this.readStatus = readStatus === 'Y';
541
+ this.lineUpNotice = lineUpNotice === 'Y';
538
542
  this.showTimeSetting = timingSettingSwitch === '1';
539
543
  this.isListClassify = isListClassify;
540
544
  this.rightClickSetting = rightClickSetting;
@@ -837,6 +841,7 @@ export default {
837
841
  }
838
842
  setting.evaluate.isChecked = this.evaluate ? 'Y' : 'N';
839
843
  setting.readStatus = this.readStatus ? 'Y' : 'N';
844
+ setting.lineUpNotice = this.lineUpNotice ? 'Y' : 'N';
840
845
  this.submitData.setting = JSON.stringify(setting);
841
846
  this.submitData.type = 'BASE_INFORMATION';
842
847
  this.submitData.assemblyId = this.assemblyId;
@@ -79,7 +79,7 @@
79
79
  :disabled="isLock"
80
80
  @search="handleSearch"
81
81
  @change="handleSelectChange"
82
- :getPopupContainer="triggerNode => triggerNode.parentNode"
82
+ :getPopupContainer="getPopupContainer"
83
83
  :filterOption="filterOption"
84
84
  :notFoundContent="fetching ? undefined : '暂无数据'"
85
85
  >
@@ -131,6 +131,7 @@ export default {
131
131
  type: Function,
132
132
  default: () => Promise.resolve([])
133
133
  },
134
+ openType: { type: String, default: "" }
134
135
  },
135
136
  components: {
136
137
  // TextOverTooltip,
@@ -428,6 +429,12 @@ export default {
428
429
  },
429
430
  filterOption(input, option) {
430
431
  return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0;
432
+ },
433
+ getPopupContainer(triggerNode) {
434
+ if(this.openType == 'formIframe') {
435
+ return document.body;
436
+ }
437
+ return triggerNode.parentNode;
431
438
  }
432
439
  }
433
440
  };
@@ -153,6 +153,7 @@
153
153
  :item="item"
154
154
  :isLock="componentDisable"
155
155
  :curIndex="index"
156
+ :openType="openType"
156
157
  @change="handleChoice($event, item)"
157
158
  @radioChange="radioChange"
158
159
  @checkboxChange="checkboxChange"
@@ -313,7 +314,8 @@ export default create({
313
314
  small: 1,
314
315
  extrasmall: 0.9
315
316
  })
316
- }
317
+ },
318
+ openType: { type: String, default: "" }
317
319
  },
318
320
  components: {
319
321
  MyChoice,
@@ -1294,19 +1296,31 @@ export default create({
1294
1296
  this.confirmSubmit("确认要提交吗?");
1295
1297
  return;
1296
1298
  }
1299
+
1297
1300
  // 包含测评组件,不包含考试时长,点击提交,弹出二次确认对话框,确认要结束测评吗?
1298
1301
  // 判断有无测评配置 并且在测评时间内
1299
- // 无倒计时
1300
1302
  let { evaluateResultSetting } = this.config;
1301
- let countdownDom = this.$refs.evaluateCountdown;
1302
1303
  if (
1303
1304
  !evaluateResultSetting ||
1304
- (!Object.keys(evaluateResultSetting).length && !this.showEvaluateEntry) ||
1305
- !countdownDom?.showEvaluateCountdown
1305
+ (!Object.keys(evaluateResultSetting).length && !this.showEvaluateEntry)
1306
1306
  ) {
1307
1307
  this.confirmSubmit("确认要结束测评吗?");
1308
1308
  return;
1309
1309
  }
1310
+
1311
+ // 表单内嵌量表, 没有开始答题, 不需要调用保存接口
1312
+ if (this.openType == "formIframe" && this.showEvaluateEntry) {
1313
+ this.$emit("submitNoRequest");
1314
+ return;
1315
+ }
1316
+
1317
+ // 无倒计时
1318
+ let countdownDom = this.$refs.evaluateCountdown;
1319
+ if(!countdownDom?.showEvaluateCountdown) {
1320
+ this.confirmSubmit("确认要结束测评吗?");
1321
+ return;
1322
+ }
1323
+
1310
1324
  // 在倒计时内
1311
1325
  let message = "确认要提前结束测评吗?";
1312
1326
  let setAnswered = this.$refs.evaluateCountdown?.setAnswered;
@@ -4,6 +4,7 @@
4
4
  v-if="item.com == 'SelectMui'"
5
5
  :placeholder="`请选择${item.alias || item.title}`"
6
6
  style="width: 160px"
7
+ :dropdownMatchSelectWidth="false"
7
8
  :maxTagCount="handleMaxTagCount(item)"
8
9
  :maxTagPlaceholder="handleMaxTag(item)"
9
10
  showSearch
@@ -20,40 +21,48 @@
20
21
  <a-spin v-if="fetchingWordbook" slot="notFoundContent" size="small" />
21
22
  <template v-if="item.comType == 'SelectMuiWordBook'">
22
23
  <a-select-option
23
- v-for="sea in item.dataSource"
24
+ v-for="(sea, k) in item.dataSource"
24
25
  :key="item.sid + sea.myName"
25
26
  :value="sea.myName"
26
- :title="sea.showKeys || sea.myName"
27
+ :title="sea._show_title || sea.showKeys || sea.myName"
28
+ :disabled="k === 0 && hasShowKeys && item.hasFieldList"
27
29
  >
28
- {{ sea.showKeys || sea.myName }}
30
+ <div
31
+ v-if="item.hasFieldList && sea.showKeys"
32
+ :class="{
33
+ 'c-s-title-line': k === 0,
34
+ }"
35
+ style="display: flex;"
36
+ >
37
+ <span style="flex: 1;" v-for="(v1, k1) in sea.showKeys.split('<&=&>')" :key="k1" class="c-s-content-item">{{ v1 }}</span>
38
+ </div>
39
+ <span v-else>
40
+ {{sea._show_title || sea.showKeys || sea.myName }}
41
+ </span>
29
42
  </a-select-option>
30
43
  </template>
31
44
  <template v-else>
32
45
  <a-select-option v-for="(i, d) in item.labelList" :key="d">
33
- {{ i.labelName || "" }}
46
+ {{ i.labelName || '' }}
34
47
  </a-select-option>
35
48
  </template>
36
49
 
37
- <div slot="dropdownRender" class="drop-down-container" slot-scope="menu" >
38
- <a-spin :spinning="fetchingWordbook">
50
+ <div slot="dropdownRender" class="drop-down-container" slot-scope="menu">
51
+ <a-spin :spinning="fetchingWordbook">
39
52
  <v-nodes :vnodes="menu" />
40
- <select-pages
41
- v-if="!isnoPages"
42
- :searchPageConfig="item.searchPageConfig"
43
- :handleSearchChangePage="handleSearchChangePage"
44
- />
45
- </a-spin>
53
+ <select-pages v-if="!isnoPages" :searchPageConfig="item.searchPageConfig" :handleSearchChangePage="handleSearchChangePage" />
54
+ </a-spin>
46
55
  </div>
47
56
  </a-select>
48
57
  </template>
49
58
  <script>
50
59
  import { Select, Spin, Icon } from 'ant-design-vue';
51
60
  import utils from '@/utils/utils-map';
52
- import selectPages from './select-pages'
61
+ import selectPages from './select-pages';
53
62
  export default {
54
- name: "multiSelect",
63
+ name: 'multiSelect',
55
64
  components: {
56
- [Select.name]:Select,
65
+ [Select.name]: Select,
57
66
  [Select.Option.name]: Select.Option,
58
67
  [Spin.name]: Spin,
59
68
  [Icon.name]: Icon,
@@ -63,15 +72,7 @@ export default {
63
72
  render: (h, ctx) => ctx.props.vnodes
64
73
  }
65
74
  },
66
- props: [
67
- "item",
68
- "maxTagPlaceholder",
69
- "outFilterChange",
70
- "handleWordBookSearch",
71
- "dropdownVisibleChange",
72
- "source",
73
- "fetchingWordbook"
74
- ],
75
+ props: ['item', 'maxTagPlaceholder', 'outFilterChange', 'handleWordBookSearch', 'dropdownVisibleChange', 'source', 'fetchingWordbook'],
75
76
  data() {
76
77
  return {};
77
78
  },
@@ -87,15 +88,22 @@ export default {
87
88
  handleMaxTag() {
88
89
  return function(item) {
89
90
  let len = this.maxTagPlaceholder(item);
90
- if (len <= 1) return "";
91
+ if (len <= 1) return '';
91
92
  return `已选${this.maxTagPlaceholder(item)}个${item.alias || item.title}`;
92
93
  };
93
94
  },
94
95
 
95
96
  // 有没有分页配置
96
97
  isnoPages(){
97
- const { searchPageConfig } = this.item;
98
+ const { searchPageConfig } = this.item || {};
99
+ if(!searchPageConfig) return;
100
+
98
101
  return searchPageConfig.page <= 1 && !searchPageConfig.hasNextPage;
102
+ },
103
+
104
+ hasShowKeys(){
105
+ let showKeys = this?.item?.setting?.wordbook?.showKeys || [];
106
+ return showKeys.length > 0
99
107
  }
100
108
  },
101
109
  watch: {},
@@ -111,11 +119,13 @@ export default {
111
119
  let refDom = this.$refs.quickInputSelect;
112
120
  if (!refDom) return;
113
121
  let selectDom = refDom.$el;
114
- let pDom = selectDom.querySelector(".ant-select-selection--multiple");
115
- let hasTag = pDom.querySelector(".quick-input-select-span");
122
+ if(!selectDom) return;
123
+
124
+ let pDom = selectDom.querySelector('.ant-select-selection--multiple');
125
+ let hasTag = pDom.querySelector('.quick-input-select-span');
116
126
  if (!hasTag) {
117
- let tag = document.createElement("span");
118
- tag.className = "quick-input-select-span";
127
+ let tag = document.createElement('span');
128
+ tag.className = 'quick-input-select-span';
119
129
  let icon = `<i aria-label="图标: down" class="anticon anticon-down ant-select-arrow-icon"><svg viewBox="64 64 896 896" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></i>`;
120
130
  tag.innerHTML = icon;
121
131
  pDom.appendChild(tag);
@@ -126,10 +136,10 @@ export default {
126
136
  return utils.filterOption(...arg);
127
137
  },
128
138
 
129
- handleSearchChangePage(type){
130
- let cType = type || "next";
139
+ handleSearchChangePage(type) {
140
+ let cType = type || 'next';
131
141
  let { page, keyword = undefined } = this?.item?.searchPageConfig;
132
- page = cType === "next" ? page + 1 : page - 1;
142
+ page = cType === 'next' ? page + 1 : page - 1;
133
143
  this.handleWordBookSearch(keyword, this.item, { page });
134
144
  }
135
145
  }
@@ -168,4 +178,13 @@ export default {
168
178
  margin-right: 8px;
169
179
  height: 32px;
170
180
  }
181
+
182
+ .c-s-title-line {
183
+ font-weight: 700;
184
+ color: #000;
185
+ font-size: 14px;
186
+ }
187
+ .c-s-content-item {
188
+ padding: 0 5px;
189
+ }
171
190
  </style>
@@ -91,6 +91,7 @@
91
91
 
92
92
  import multiSelect from '../multi-select/multi-select';
93
93
  import { filterApiFn } from '../../mixins/mixins';
94
+ import wordBookutils from '../../mixins/wordBookutils';
94
95
 
95
96
  const EVALUATEList = [
96
97
  {
@@ -186,45 +187,11 @@ export default {
186
187
  }
187
188
  },
188
189
  handleWordbookData(item, data, params) {
189
- let { setting = {} } = item;
190
- let { showKeys = [], defaultValue, defaultValueTitle } = setting.wordbook || {};
191
- let defaultItem = null;
192
- if (defaultValue && defaultValueTitle) {
193
- defaultItem = {
194
- myName: defaultValue,
195
- showKeys: defaultValueTitle
196
- };
197
- }
198
- if (data && data.result) {
199
- let { page, hasNextPage } = data.map;
200
- item.searchPageConfig = Object.assign(item.searchPageConfig, {
201
- page,
202
- hasNextPage,
203
- isRequest: true,
204
- keyword: params?.keyword || undefined
205
- });
206
- // 数组赋值并添加唯一name
207
- item.dataSource = data.map.rows.map(row => {
208
- let showKeysStr = [];
209
- showKeys.forEach(ren => {
210
- showKeysStr.push(row[ren]);
211
- });
212
- return Object.assign(row, {
213
- myName: row[item.setting.wordbook.field_key],
214
- showKeys: showKeysStr.join("")
215
- });
216
- });
217
- // 数组对象去重
218
- let obj = {};
219
- let arr = item.dataSource.reduce((cur, next) => {
220
- obj[next.myName] ? "" : (obj[next.myName] = true && cur.push(next));
221
- return cur;
222
- }, []);
223
- if (defaultItem) {
224
- arr.unshift(defaultItem);
225
- }
226
- item.dataSource = arr;
227
- }
190
+ this.$set(item, "hasFieldList", false);
191
+ const {rows,hasFieldList,searchPageConfig} = wordBookutils.handleWordbookData(item,data,params);
192
+ this.$set(item, "hasFieldList", hasFieldList);
193
+ this.$set(item, "dataSource", rows);
194
+ item.searchPageConfig = Object.assign(item.searchPageConfig, searchPageConfig);
228
195
  },
229
196
  getWordbookData(o, obj) {
230
197
  let { id, filterKeys, wordbookType } = o;
@@ -0,0 +1,99 @@
1
+ import vexutils from '@/utils/vexutils';
2
+
3
+ const SYMBOL = "<&=&>"
4
+ /**
5
+ * 处理 getWordbookData 接口返回的数据以及配置
6
+ */
7
+ const formatWordbookDataUtils = {
8
+ hasArray: (arr) => Array.isArray(arr) && arr.length > 0,
9
+ handleWordbookData(item, data, params) {
10
+ // this.$set(item, "hasFieldList", false);
11
+ let { setting = {} } = item;
12
+ let { showKeys = [], defaultValue, defaultValueTitle } = setting.wordbook || {};
13
+ let defaultItem = null;
14
+
15
+ let resArr = [];
16
+ let hasFieldList = false;
17
+ let searchPageConfig = {};
18
+
19
+ if (defaultValue && defaultValueTitle) {
20
+ defaultItem = {
21
+ myName: defaultValue,
22
+ showKeys: defaultValueTitle
23
+ };
24
+ }
25
+ if (data && data.result) {
26
+ let { page, hasNextPage,fieldList } = data.map;
27
+ searchPageConfig = Object.assign(item.searchPageConfig, {
28
+ page,
29
+ hasNextPage,
30
+ isRequest: true,
31
+ keyword: params?.keyword || undefined
32
+ });
33
+ // 数组赋值并添加唯一name
34
+ let rows = data.map.rows.map(row => {
35
+ let showKeysStr = [];
36
+ showKeys.forEach(ren => {
37
+ let str = vexutils.stringToValue(row[ren],'change_text')
38
+ showKeysStr.push(str);
39
+ });
40
+ let name = vexutils.stringToValue(row[item.setting.wordbook.field_key],'value')
41
+ return Object.assign(row, {
42
+ myName: name,
43
+ showKeys: showKeysStr.join(SYMBOL),
44
+ _show_title: showKeysStr.join(" ")
45
+ });
46
+ });
47
+ // 数组对象去重
48
+ let obj = {};
49
+ resArr = rows.reduce((cur, next) => {
50
+ obj[next.myName] ? "" : (obj[next.myName] = true && cur.push(next));
51
+ return cur;
52
+ }, []);
53
+ if (defaultItem) {
54
+ resArr.unshift(defaultItem);
55
+ }
56
+ if(formatWordbookDataUtils.hasArray(fieldList) && formatWordbookDataUtils.hasArray(showKeys) && showKeys.length > 1){
57
+ let t = formatWordbookDataUtils.getTitleHeader(fieldList,showKeys);
58
+ resArr.unshift({
59
+ myName: t,
60
+ showKeys: t,
61
+ sid: Math.random()
62
+ })
63
+ // this.$set(item, "hasFieldList", true);
64
+ hasFieldList = true;
65
+ }
66
+ // this.$set(item, "dataSource", resArr);
67
+ }
68
+
69
+ return {
70
+ rows:resArr,
71
+ hasFieldList,
72
+ searchPageConfig
73
+ }
74
+ },
75
+
76
+ // 下拉搜索框获取字段title
77
+ getTitleHeader(fieldList, renderKey) {
78
+ let titleHeader = [];
79
+ let renderKeyArr = [];
80
+ if (Array.isArray(renderKey)) {
81
+ renderKeyArr = [...renderKey];
82
+ } else {
83
+ renderKeyArr = [renderKey];
84
+ }
85
+ renderKeyArr.forEach(render => {
86
+ for (let i = 0; i < fieldList.length; i++) {
87
+ if (render === fieldList[i].columnName) {
88
+ titleHeader.push(`${fieldList[i].title}`);
89
+ break;
90
+ }
91
+ }
92
+ });
93
+ let res = titleHeader.join(SYMBOL);
94
+ return res;
95
+ },
96
+ }
97
+
98
+
99
+ export default formatWordbookDataUtils;