eoss-ui 0.6.18 → 0.6.20

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 (101) hide show
  1. package/lib/eoss-ui.common.js +761 -657
  2. package/lib/flow.js +619 -515
  3. package/lib/index.js +1 -1
  4. package/lib/main.js +132 -132
  5. package/lib/qr-code.js +13 -13
  6. package/lib/theme-chalk/index.css +1 -1
  7. package/lib/theme-chalk/login.css +1 -1
  8. package/package.json +157 -157
  9. package/packages/button/src/main.vue +418 -418
  10. package/packages/button-group/src/main.vue +298 -298
  11. package/packages/checkbox-group/src/main.vue +333 -333
  12. package/packages/clients/src/main.vue +144 -144
  13. package/packages/data-table/src/children.vue +39 -39
  14. package/packages/data-table/src/column.vue +983 -983
  15. package/packages/data-table/src/main.vue +1812 -1812
  16. package/packages/data-table/src/sizer.vue +195 -195
  17. package/packages/date-picker/src/main.vue +236 -236
  18. package/packages/flow/src/component/CustomPreset.vue +1 -1
  19. package/packages/flow/src/component/Preset.vue +1 -1
  20. package/packages/flow/src/component/SendMsg.vue +3 -1
  21. package/packages/flow/src/component/taskUnionExamine.vue +38 -20
  22. package/packages/flow/src/main.vue +2731 -2711
  23. package/packages/flow/src/processForm.vue +13 -2
  24. package/packages/flow/src/processReject.vue +14 -3
  25. package/packages/flow/src/startTaskRead.vue +23 -5
  26. package/packages/flow-group/src/main.vue +684 -684
  27. package/packages/form/src/main.vue +3582 -3582
  28. package/packages/form/src/table.vue +1420 -1420
  29. package/packages/handle-user/src/main.vue +134 -134
  30. package/packages/handler/src/main.vue +374 -374
  31. package/packages/icon/src/main.vue +101 -101
  32. package/packages/input/src/main.vue +356 -356
  33. package/packages/login/src/main.vue +1851 -1851
  34. package/packages/login/src/resetPassword.vue +557 -557
  35. package/packages/main/src/default/message.vue +249 -249
  36. package/packages/main/src/default/notice.vue +157 -157
  37. package/packages/main/src/default/userinfo.vue +494 -494
  38. package/packages/main/src/public/online.vue +89 -89
  39. package/packages/main/src/public/search.vue +454 -454
  40. package/packages/main/src/public/settings.vue +221 -221
  41. package/packages/main/src/simplicity/apps.vue +388 -388
  42. package/packages/main/src/simplicity/avatar.vue +82 -82
  43. package/packages/main/src/simplicity/handler.vue +183 -183
  44. package/packages/main/src/simplicity/index.vue +1930 -1930
  45. package/packages/main/src/simplicity/lists.vue +84 -84
  46. package/packages/main/src/simplicity/menu-list.vue +128 -128
  47. package/packages/main/src/simplicity/message.vue +259 -259
  48. package/packages/main/src/simplicity/notice.vue +190 -190
  49. package/packages/main/src/simplicity/router-page.vue +45 -45
  50. package/packages/main/src/simplicity/sub-menu.vue +241 -241
  51. package/packages/main/src/simplicity/user.vue +248 -248
  52. package/packages/main/src/simplicity/userinfo.vue +304 -304
  53. package/packages/menu/src/main.vue +536 -536
  54. package/packages/pagination/src/main.vue +96 -96
  55. package/packages/qr-code/src/main.vue +170 -170
  56. package/packages/radio-group/src/main.vue +319 -319
  57. package/packages/select/src/main.vue +761 -761
  58. package/packages/selector/src/main.vue +677 -677
  59. package/packages/selector-panel/src/main.vue +1020 -1020
  60. package/packages/selector-panel/src/selection.vue +160 -160
  61. package/packages/tabs/src/main.vue +788 -788
  62. package/packages/theme-chalk/lib/index.css +1 -1
  63. package/packages/theme-chalk/lib/login.css +1 -1
  64. package/packages/theme-chalk/src/base.scss +260 -260
  65. package/packages/theme-chalk/src/button-group.scss +175 -175
  66. package/packages/theme-chalk/src/calendar.scss +113 -113
  67. package/packages/theme-chalk/src/clients.scss +87 -87
  68. package/packages/theme-chalk/src/common/var.scss +1 -4
  69. package/packages/theme-chalk/src/data-table.scss +276 -276
  70. package/packages/theme-chalk/src/dialog.scss +77 -77
  71. package/packages/theme-chalk/src/flow-group.scss +110 -110
  72. package/packages/theme-chalk/src/form.scss +496 -496
  73. package/packages/theme-chalk/src/handler.scss +133 -133
  74. package/packages/theme-chalk/src/icon.scss +1745 -1745
  75. package/packages/theme-chalk/src/icons.scss +99 -99
  76. package/packages/theme-chalk/src/login.scss +917 -926
  77. package/packages/theme-chalk/src/main.scss +632 -632
  78. package/packages/theme-chalk/src/menu.scss +222 -222
  79. package/packages/theme-chalk/src/nav.scss +125 -125
  80. package/packages/theme-chalk/src/pagination.scss +29 -29
  81. package/packages/theme-chalk/src/selector-panel.scss +204 -204
  82. package/packages/theme-chalk/src/simplicity.scss +1246 -1246
  83. package/packages/theme-chalk/src/tabs.scss +87 -87
  84. package/packages/theme-chalk/src/toolbar.scss +179 -179
  85. package/packages/theme-chalk/src/tree-group.scss +72 -72
  86. package/packages/theme-chalk/src/tree.scss +165 -165
  87. package/packages/upload/src/main.vue +1313 -1313
  88. package/packages/wujie/src/main.vue +145 -145
  89. package/src/config/api.js +236 -236
  90. package/src/config/image.js +2 -2
  91. package/src/index.js +157 -157
  92. package/packages/.DS_Store +0 -0
  93. package/packages/checkbox-group/.DS_Store +0 -0
  94. package/packages/data-table/.DS_Store +0 -0
  95. package/packages/dialog/.DS_Store +0 -0
  96. package/packages/handler/.DS_Store +0 -0
  97. package/packages/login/.DS_Store +0 -0
  98. package/packages/main/.DS_Store +0 -0
  99. package/packages/main/src/.DS_Store +0 -0
  100. package/packages/theme-chalk/src/.DS_Store +0 -0
  101. package/src/.DS_Store +0 -0
@@ -1,454 +1,454 @@
1
- <template>
2
- <div class="es-public-search-box">
3
- <el-input
4
- class="es-public-search-input"
5
- placeholder="请输入关键字"
6
- clearable
7
- prefix-icon="el-icon-search"
8
- v-model="keyWords"
9
- round
10
- ></el-input>
11
- <el-tabs class="es-public-search-tabs" v-model="active">
12
- <el-tab-pane label="综合" name="0">
13
- <el-scrollbar class="es-scrollbar">
14
- <template v-for="(item, index) in types">
15
- <div
16
- v-if="item.records && item.records.length"
17
- class="es-public-search-content"
18
- :key="item.id"
19
- >
20
- <div class="es-public-search-title">{{ item.name }}</div>
21
- <ul class="es-public-search-list">
22
- <li
23
- v-for="ele in item.records.slice(0, 3)"
24
- class="es-public-search-list-item"
25
- :key="ele.id || ele.title"
26
- @click="handleClick(ele, item)"
27
- >
28
- <es-icon
29
- class="es-public-search-item-icon"
30
- v-bind="getIcon(ele, item)"
31
- :style="setStyle(ele, index)"
32
- ></es-icon>
33
- <div class="es-public-search-item-name">
34
- {{ ele.name || ele.title || ele.text }}
35
- </div>
36
- <div class="es-public-search-item-texts" v-if="ele.summary">
37
- {{ ele.summary }}
38
- </div>
39
- <div class="es-public-search-item-texts">
40
- <template v-if="Array.isArray(ele.infos || ele.footer)">
41
- <span
42
- v-for="(text, idx) in ele.infos || ele.footer"
43
- class="es-public-search-item-text"
44
- :key="idx"
45
- >{{ text }}</span
46
- >
47
- </template>
48
- <template v-else>{{ ele.infos || ele.footer }}</template>
49
- </div>
50
- </li>
51
- </ul>
52
- <div class="es-public-search-more">
53
- <span
54
- class="es-public-search-more-text"
55
- @click="handleTabs(item, index)"
56
- >在<span class="es-public-search-more-quote">{{
57
- item.name
58
- }}</span
59
- >中搜索全部</span
60
- >
61
- </div>
62
- </div>
63
- </template>
64
- </el-scrollbar>
65
- </el-tab-pane>
66
- <template v-for="(item, index) in types">
67
- <el-tab-pane
68
- :label="item.name"
69
- :name="item.id || String(index + 1)"
70
- :key="item.id"
71
- v-loading="loadings[item.id || String(index)]"
72
- element-loading-background="rgba(0, 0, 0, 0.01)"
73
- element-loading-text="加载中..."
74
- v-if="!hides.includes(item.name)"
75
- >
76
- <el-scrollbar
77
- class="es-scrollbar es-public-search-scrollbar"
78
- :infinite-scroll="
79
- () => {
80
- handleSearchd(item, index);
81
- }
82
- "
83
- :infinite-scroll-disabled="disabled"
84
- :infinite-scroll-immediate="false"
85
- >
86
- <div class="es-public-search-info" v-show="keyWords">
87
- {{ item.totalCount }}条与"<span
88
- class="es-public-search-more-quote"
89
- >{{ keyWords }}</span
90
- >"相关的搜索结果
91
- </div>
92
- <ul class="es-public-search-lists">
93
- <li
94
- v-for="ele in item.records"
95
- class="es-public-search-list-item"
96
- :key="ele.id || ele.title"
97
- @click="handleClick(ele, item)"
98
- >
99
- <es-icon
100
- class="es-public-search-item-icon"
101
- v-bind="getIcon(ele, item)"
102
- :style="setStyle(ele, index)"
103
- ></es-icon>
104
- <div class="es-public-search-item-name">
105
- {{ ele.name || ele.title || ele.text }}
106
- </div>
107
- <div class="es-public-search-item-texts" v-if="ele.summary">
108
- {{ ele.summary }}
109
- </div>
110
- <div class="es-public-search-item-texts">
111
- <template v-if="Array.isArray(ele.infos || ele.footer)">
112
- <span
113
- v-for="(text, idx) in ele.infos || ele.footer"
114
- class="es-public-search-item-text"
115
- :key="idx"
116
- >{{ text }}</span
117
- >
118
- </template>
119
- <template v-else>{{ ele.infos || ele.footer }}</template>
120
- </div>
121
- </li>
122
- </ul>
123
- <p
124
- class="es-public-search-no-more"
125
- v-if="noMore[item.id || String(index)]"
126
- >
127
- 没有更多了
128
- </p>
129
- </el-scrollbar>
130
- </el-tab-pane>
131
- </template>
132
- </el-tabs>
133
- <es-dialog :title="title" :visible.sync="visible" size="lg">
134
- <iframe width="100%" height="100%" frameborder="0" :src="url"></iframe>
135
- </es-dialog>
136
- </div>
137
- </template>
138
-
139
- <script>
140
- import util from 'eoss-ui/src/utils/util';
141
- import { searchType } from 'eoss-ui/src/config/api.js';
142
- import { debounce } from 'throttle-debounce';
143
- export default {
144
- name: 'Search',
145
- components: {},
146
- props: {
147
- menuIcon: {
148
- type: String,
149
- default: 'es-icon-application'
150
- },
151
- menus: {
152
- type: Array,
153
- default() {
154
- return [];
155
- }
156
- },
157
- apps: {
158
- type: Array,
159
- default() {
160
- return [];
161
- }
162
- },
163
- searchType: {
164
- type: String,
165
- default: searchType
166
- },
167
- pageSize: {
168
- type: Number,
169
- default: 10
170
- },
171
- hides: {
172
- type: Array,
173
- default() {
174
- return [];
175
- }
176
- }
177
- },
178
- data() {
179
- return {
180
- icons: {
181
- ppt: 'es-icon-ppt',
182
- png: 'es-icon-picture',
183
- gif: 'es-icon-picture',
184
- jpg: 'es-icon-picture',
185
- xls: 'es-icon-excel',
186
- xlsx: 'es-icon-excel',
187
- docx: 'es-icon-word',
188
- doc: 'es-icon-word',
189
- rar: 'es-icon-zip',
190
- zip: 'es-icon-zip',
191
- txt: 'es-icon-txt',
192
- ipa: 'es-icon-ios',
193
- apk: 'es-icon-android',
194
- mp4: 'es-icon-video',
195
- avi: 'es-icon-video',
196
- mp3: 'es-icon-audioo',
197
- wma: 'es-icon-audioo',
198
- pdf: 'es-icon-pdf'
199
- },
200
- colors: [
201
- '#46D3BA',
202
- '#2591F7',
203
- '#40C274',
204
- '#E34D59',
205
- '#FF9C52',
206
- '#17C27B'
207
- ],
208
- keyWords: '',
209
- active: '0',
210
- types: [],
211
- lists: [],
212
- loadings: {},
213
- noMore: {},
214
- isLoading: false,
215
- title: '',
216
- visible: false,
217
- url: ''
218
- };
219
- },
220
- computed: {
221
- loading() {
222
- return this.active == '0' && this.isLoading;
223
- },
224
- disabled() {
225
- return this.loadings[this.active] || this.noMore[this.active];
226
- }
227
- },
228
- watch: {
229
- keyWords(val) {
230
- this.handleSearchAll(val);
231
- }
232
- },
233
- beforeCreate() {
234
- this.handleSearchAll = debounce(500, (res) => {
235
- this.searchAll(res);
236
- });
237
- this.handleSearchd = debounce(500, (obj, index) => {
238
- this.handleSearch(obj, index, false);
239
- });
240
- },
241
- created() {
242
- this.getTypes();
243
- },
244
- mounted() {},
245
- methods: {
246
- getIcon(res, item) {
247
- let icon;
248
- let cls;
249
- if (res.icon || res.icons) {
250
- icon = this.icons[(res.icon || res.icons).toLowerCase()];
251
- if (!icon) {
252
- if (res.icon == '#last' || res.icons == '#last') {
253
- let title = res.title || res.name || res.text;
254
- icon = title.substr(-1, 1);
255
- cls = 'es-public-search-item-icon-text';
256
- } else {
257
- cls = 'es-public-search-item-icons';
258
- icon = res.icon || res.icons;
259
- }
260
- }
261
- } else {
262
- let title = res.title || res.name || res.text;
263
- let key = title.split('.')[1];
264
- icon = key ? this.icons[key.toLowerCase()] : '';
265
- if (!icon) {
266
- icon =
267
- item.name == '菜单' || item.name == '应用'
268
- ? this.menuIcon
269
- : title.substr(-1, 1);
270
- cls = 'es-public-search-item-icon-text';
271
- }
272
- }
273
- return { class: cls, contents: icon };
274
- },
275
- setStyle(res, index) {
276
- if (res.icon || res.icons) {
277
- let icon = this.icons[(res.icon || res.icons).toLowerCase()];
278
- if (!icon && res.icon != '#last') {
279
- return { backgroundColor: this.colors[index % this.colors.length] };
280
- }
281
- } else {
282
- return { backgroundColor: this.colors[index % this.colors.length] };
283
- }
284
- return {};
285
- },
286
- getTypes() {
287
- util
288
- .ajax({
289
- url: this.searchType,
290
- method: 'post',
291
- format: false,
292
- data: {
293
- terminalType: 'web'
294
- }
295
- })
296
- .then((res) => {
297
- if (res.rCode == 0) {
298
- let { results } = res;
299
- let loadings = {};
300
- let noMore = {};
301
- let types = results.catalog.map((item, index) => {
302
- loadings[item.id || String(index)] = false;
303
- noMore[item.id || String(index)] = false;
304
- return { ...item, pageNum: 0, pageCount: 1, records: [] };
305
- });
306
- this.types = types;
307
- this.loadings = loadings;
308
- this.noMore = noMore;
309
- }
310
- });
311
- },
312
- searchAll(keyWords) {
313
- for (let i = 0; i < this.types.length; i++) {
314
- let item = this.types[i];
315
- if (keyWords) {
316
- if (item.name == '菜单' && this.menus.length) {
317
- this.isLoading = false;
318
- this.types[i].records = this.searchData(this.menus, keyWords);
319
- this.types[i].totalCount = this.types[i].records.length;
320
- this.types[i].pageCount = Math.ceil(
321
- this.types[i].records.length / this.pageSize
322
- );
323
- this.types[i].pageNum = 0;
324
- this.$set(this.loadings, item.id || String(i), false);
325
- this.$set(this.noMore, item.id || String(i), true);
326
- } else if (item.name == '应用' && this.apps.length) {
327
- this.isLoading = false;
328
- this.types[i].records = this.searchData(this.apps, keyWords);
329
- this.types[i].totalCount = this.types[i].records.length;
330
- this.types[i].pageCount = Math.ceil(
331
- this.types[i].records.length / this.pageSize
332
- );
333
- this.types[i].pageNum = 0;
334
- this.$set(this.loadings, item.id || String(i), false);
335
- this.$set(this.noMore, item.id || String(i), true);
336
- } else if (item.dataRequestUrl) {
337
- this.isLoading = true;
338
- this.handleSearch(item, i, true);
339
- } else {
340
- this.types[i].records = [];
341
- this.types[i].totalCount = 0;
342
- this.types[i].pageCount = 1;
343
- this.types[i].pageNum = 0;
344
- this.$set(this.loadings, item.id || String(i), false);
345
- this.$set(this.noMore, item.id || String(i), true);
346
- }
347
- } else {
348
- this.isLoading = false;
349
- this.types[i].records = [];
350
- this.types[i].totalCount = 0;
351
- this.types[i].pageCount = 1;
352
- this.types[i].pageNum = 0;
353
- this.$set(this.loadings, item.id || String(i), false);
354
- this.$set(this.noMore, item.id || String(i), true);
355
- }
356
- }
357
- },
358
- searchData(data, name) {
359
- let records = [];
360
- data.forEach((item) => {
361
- let words = item.name || item.text;
362
- if (words.indexOf(name) > -1 && item.permission !== false) {
363
- records.push(item);
364
- }
365
- if (item.children && item.children.length) {
366
- records = records.concat(this.searchData(item.children, name));
367
- }
368
- if (item.fourthTabs && item.fourthTabs.length) {
369
- records = records.concat(this.searchData(item.fourthTabs, name));
370
- }
371
- });
372
- return records;
373
- },
374
- handleSearch(obj, index, reset) {
375
- if (obj.pageNum < obj.pageCount && this.keyWords) {
376
- this.$set(this.loadings, obj.id || String(index), true);
377
- if (this.active == '0') {
378
- this.isLoading = true;
379
- }
380
- util
381
- .ajax({
382
- url: obj.dataRequestUrl,
383
- method: 'post',
384
- format: false,
385
- data: {
386
- pageNum: obj.pageNum + 1,
387
- pageSize: this.pageSize,
388
- search: this.keyWords,
389
- terminalType: 'web'
390
- }
391
- })
392
- .then((res) => {
393
- this.$set(this.loadings, obj.id || String(index), false);
394
- let flag = false;
395
- for (let i in this.loadings) {
396
- if (this.loadings[i]) {
397
- flag = true;
398
- break;
399
- }
400
- }
401
- if (!flag) {
402
- this.isLoading = false;
403
- }
404
- if (res.rCode == 0) {
405
- let { results } = res;
406
- obj.totalCount = results.totalCount;
407
- obj.pageCount = results.pageCount;
408
- obj.pageNum = results.pageNum;
409
- obj.records = reset
410
- ? results.records
411
- : obj.records.concat(results.records);
412
- this.$set(
413
- this.noMore,
414
- obj.id || String(index),
415
- results.pageNum >= results.pageCount
416
- );
417
- } else {
418
- this.types[index].records = [];
419
- this.types[index].totalCount = 0;
420
- this.types[index].pageCount = 1;
421
- this.types[index].pageNum = 0;
422
- this.$set(this.loadings, obj.id || String(index), false);
423
- this.$set(this.noMore, obj.id || String(index), true);
424
- }
425
- })
426
- .catch((err) => {
427
- this.isLoading = false;
428
- this.types[index].records = [];
429
- this.types[index].totalCount = 0;
430
- this.types[index].pageCount = 1;
431
- this.types[index].pageNum = 0;
432
- this.$set(this.loadings, obj.id || String(index), false);
433
- this.$set(this.noMore, obj.id || String(index), true);
434
- if (err.message && err.message !== 'canceled') {
435
- this.$message.error(err.message);
436
- }
437
- });
438
- }
439
- },
440
- handleTabs(res, index) {
441
- this.active = res.id || String(index + 1);
442
- },
443
- handleClick(res, parent) {
444
- if (res.detailUrl) {
445
- this.title = res.title;
446
- this.url = res.detailUrl;
447
- this.visible = true;
448
- } else {
449
- this.$emit('select', res, parent);
450
- }
451
- }
452
- }
453
- };
454
- </script>
1
+ <template>
2
+ <div class="es-public-search-box">
3
+ <el-input
4
+ class="es-public-search-input"
5
+ placeholder="请输入关键字"
6
+ clearable
7
+ prefix-icon="el-icon-search"
8
+ v-model="keyWords"
9
+ round
10
+ ></el-input>
11
+ <el-tabs class="es-public-search-tabs" v-model="active">
12
+ <el-tab-pane label="综合" name="0">
13
+ <el-scrollbar class="es-scrollbar">
14
+ <template v-for="(item, index) in types">
15
+ <div
16
+ v-if="item.records && item.records.length"
17
+ class="es-public-search-content"
18
+ :key="item.id"
19
+ >
20
+ <div class="es-public-search-title">{{ item.name }}</div>
21
+ <ul class="es-public-search-list">
22
+ <li
23
+ v-for="ele in item.records.slice(0, 3)"
24
+ class="es-public-search-list-item"
25
+ :key="ele.id || ele.title"
26
+ @click="handleClick(ele, item)"
27
+ >
28
+ <es-icon
29
+ class="es-public-search-item-icon"
30
+ v-bind="getIcon(ele, item)"
31
+ :style="setStyle(ele, index)"
32
+ ></es-icon>
33
+ <div class="es-public-search-item-name">
34
+ {{ ele.name || ele.title || ele.text }}
35
+ </div>
36
+ <div class="es-public-search-item-texts" v-if="ele.summary">
37
+ {{ ele.summary }}
38
+ </div>
39
+ <div class="es-public-search-item-texts">
40
+ <template v-if="Array.isArray(ele.infos || ele.footer)">
41
+ <span
42
+ v-for="(text, idx) in ele.infos || ele.footer"
43
+ class="es-public-search-item-text"
44
+ :key="idx"
45
+ >{{ text }}</span
46
+ >
47
+ </template>
48
+ <template v-else>{{ ele.infos || ele.footer }}</template>
49
+ </div>
50
+ </li>
51
+ </ul>
52
+ <div class="es-public-search-more">
53
+ <span
54
+ class="es-public-search-more-text"
55
+ @click="handleTabs(item, index)"
56
+ >在<span class="es-public-search-more-quote">{{
57
+ item.name
58
+ }}</span
59
+ >中搜索全部</span
60
+ >
61
+ </div>
62
+ </div>
63
+ </template>
64
+ </el-scrollbar>
65
+ </el-tab-pane>
66
+ <template v-for="(item, index) in types">
67
+ <el-tab-pane
68
+ :label="item.name"
69
+ :name="item.id || String(index + 1)"
70
+ :key="item.id"
71
+ v-loading="loadings[item.id || String(index)]"
72
+ element-loading-background="rgba(0, 0, 0, 0.01)"
73
+ element-loading-text="加载中..."
74
+ v-if="!hides.includes(item.name)"
75
+ >
76
+ <el-scrollbar
77
+ class="es-scrollbar es-public-search-scrollbar"
78
+ :infinite-scroll="
79
+ () => {
80
+ handleSearchd(item, index);
81
+ }
82
+ "
83
+ :infinite-scroll-disabled="disabled"
84
+ :infinite-scroll-immediate="false"
85
+ >
86
+ <div class="es-public-search-info" v-show="keyWords">
87
+ {{ item.totalCount }}条与"<span
88
+ class="es-public-search-more-quote"
89
+ >{{ keyWords }}</span
90
+ >"相关的搜索结果
91
+ </div>
92
+ <ul class="es-public-search-lists">
93
+ <li
94
+ v-for="ele in item.records"
95
+ class="es-public-search-list-item"
96
+ :key="ele.id || ele.title"
97
+ @click="handleClick(ele, item)"
98
+ >
99
+ <es-icon
100
+ class="es-public-search-item-icon"
101
+ v-bind="getIcon(ele, item)"
102
+ :style="setStyle(ele, index)"
103
+ ></es-icon>
104
+ <div class="es-public-search-item-name">
105
+ {{ ele.name || ele.title || ele.text }}
106
+ </div>
107
+ <div class="es-public-search-item-texts" v-if="ele.summary">
108
+ {{ ele.summary }}
109
+ </div>
110
+ <div class="es-public-search-item-texts">
111
+ <template v-if="Array.isArray(ele.infos || ele.footer)">
112
+ <span
113
+ v-for="(text, idx) in ele.infos || ele.footer"
114
+ class="es-public-search-item-text"
115
+ :key="idx"
116
+ >{{ text }}</span
117
+ >
118
+ </template>
119
+ <template v-else>{{ ele.infos || ele.footer }}</template>
120
+ </div>
121
+ </li>
122
+ </ul>
123
+ <p
124
+ class="es-public-search-no-more"
125
+ v-if="noMore[item.id || String(index)]"
126
+ >
127
+ 没有更多了
128
+ </p>
129
+ </el-scrollbar>
130
+ </el-tab-pane>
131
+ </template>
132
+ </el-tabs>
133
+ <es-dialog :title="title" :visible.sync="visible" size="lg">
134
+ <iframe width="100%" height="100%" frameborder="0" :src="url"></iframe>
135
+ </es-dialog>
136
+ </div>
137
+ </template>
138
+
139
+ <script>
140
+ import util from 'eoss-ui/src/utils/util';
141
+ import { searchType } from 'eoss-ui/src/config/api.js';
142
+ import { debounce } from 'throttle-debounce';
143
+ export default {
144
+ name: 'Search',
145
+ components: {},
146
+ props: {
147
+ menuIcon: {
148
+ type: String,
149
+ default: 'es-icon-application'
150
+ },
151
+ menus: {
152
+ type: Array,
153
+ default() {
154
+ return [];
155
+ }
156
+ },
157
+ apps: {
158
+ type: Array,
159
+ default() {
160
+ return [];
161
+ }
162
+ },
163
+ searchType: {
164
+ type: String,
165
+ default: searchType
166
+ },
167
+ pageSize: {
168
+ type: Number,
169
+ default: 10
170
+ },
171
+ hides: {
172
+ type: Array,
173
+ default() {
174
+ return [];
175
+ }
176
+ }
177
+ },
178
+ data() {
179
+ return {
180
+ icons: {
181
+ ppt: 'es-icon-ppt',
182
+ png: 'es-icon-picture',
183
+ gif: 'es-icon-picture',
184
+ jpg: 'es-icon-picture',
185
+ xls: 'es-icon-excel',
186
+ xlsx: 'es-icon-excel',
187
+ docx: 'es-icon-word',
188
+ doc: 'es-icon-word',
189
+ rar: 'es-icon-zip',
190
+ zip: 'es-icon-zip',
191
+ txt: 'es-icon-txt',
192
+ ipa: 'es-icon-ios',
193
+ apk: 'es-icon-android',
194
+ mp4: 'es-icon-video',
195
+ avi: 'es-icon-video',
196
+ mp3: 'es-icon-audioo',
197
+ wma: 'es-icon-audioo',
198
+ pdf: 'es-icon-pdf'
199
+ },
200
+ colors: [
201
+ '#46D3BA',
202
+ '#2591F7',
203
+ '#40C274',
204
+ '#E34D59',
205
+ '#FF9C52',
206
+ '#17C27B'
207
+ ],
208
+ keyWords: '',
209
+ active: '0',
210
+ types: [],
211
+ lists: [],
212
+ loadings: {},
213
+ noMore: {},
214
+ isLoading: false,
215
+ title: '',
216
+ visible: false,
217
+ url: ''
218
+ };
219
+ },
220
+ computed: {
221
+ loading() {
222
+ return this.active == '0' && this.isLoading;
223
+ },
224
+ disabled() {
225
+ return this.loadings[this.active] || this.noMore[this.active];
226
+ }
227
+ },
228
+ watch: {
229
+ keyWords(val) {
230
+ this.handleSearchAll(val);
231
+ }
232
+ },
233
+ beforeCreate() {
234
+ this.handleSearchAll = debounce(500, (res) => {
235
+ this.searchAll(res);
236
+ });
237
+ this.handleSearchd = debounce(500, (obj, index) => {
238
+ this.handleSearch(obj, index, false);
239
+ });
240
+ },
241
+ created() {
242
+ this.getTypes();
243
+ },
244
+ mounted() {},
245
+ methods: {
246
+ getIcon(res, item) {
247
+ let icon;
248
+ let cls;
249
+ if (res.icon || res.icons) {
250
+ icon = this.icons[(res.icon || res.icons).toLowerCase()];
251
+ if (!icon) {
252
+ if (res.icon == '#last' || res.icons == '#last') {
253
+ let title = res.title || res.name || res.text;
254
+ icon = title.substr(-1, 1);
255
+ cls = 'es-public-search-item-icon-text';
256
+ } else {
257
+ cls = 'es-public-search-item-icons';
258
+ icon = res.icon || res.icons;
259
+ }
260
+ }
261
+ } else {
262
+ let title = res.title || res.name || res.text;
263
+ let key = title.split('.')[1];
264
+ icon = key ? this.icons[key.toLowerCase()] : '';
265
+ if (!icon) {
266
+ icon =
267
+ item.name == '菜单' || item.name == '应用'
268
+ ? this.menuIcon
269
+ : title.substr(-1, 1);
270
+ cls = 'es-public-search-item-icon-text';
271
+ }
272
+ }
273
+ return { class: cls, contents: icon };
274
+ },
275
+ setStyle(res, index) {
276
+ if (res.icon || res.icons) {
277
+ let icon = this.icons[(res.icon || res.icons).toLowerCase()];
278
+ if (!icon && res.icon != '#last') {
279
+ return { backgroundColor: this.colors[index % this.colors.length] };
280
+ }
281
+ } else {
282
+ return { backgroundColor: this.colors[index % this.colors.length] };
283
+ }
284
+ return {};
285
+ },
286
+ getTypes() {
287
+ util
288
+ .ajax({
289
+ url: this.searchType,
290
+ method: 'post',
291
+ format: false,
292
+ data: {
293
+ terminalType: 'web'
294
+ }
295
+ })
296
+ .then((res) => {
297
+ if (res.rCode == 0) {
298
+ let { results } = res;
299
+ let loadings = {};
300
+ let noMore = {};
301
+ let types = results.catalog.map((item, index) => {
302
+ loadings[item.id || String(index)] = false;
303
+ noMore[item.id || String(index)] = false;
304
+ return { ...item, pageNum: 0, pageCount: 1, records: [] };
305
+ });
306
+ this.types = types;
307
+ this.loadings = loadings;
308
+ this.noMore = noMore;
309
+ }
310
+ });
311
+ },
312
+ searchAll(keyWords) {
313
+ for (let i = 0; i < this.types.length; i++) {
314
+ let item = this.types[i];
315
+ if (keyWords) {
316
+ if (item.name == '菜单' && this.menus.length) {
317
+ this.isLoading = false;
318
+ this.types[i].records = this.searchData(this.menus, keyWords);
319
+ this.types[i].totalCount = this.types[i].records.length;
320
+ this.types[i].pageCount = Math.ceil(
321
+ this.types[i].records.length / this.pageSize
322
+ );
323
+ this.types[i].pageNum = 0;
324
+ this.$set(this.loadings, item.id || String(i), false);
325
+ this.$set(this.noMore, item.id || String(i), true);
326
+ } else if (item.name == '应用' && this.apps.length) {
327
+ this.isLoading = false;
328
+ this.types[i].records = this.searchData(this.apps, keyWords);
329
+ this.types[i].totalCount = this.types[i].records.length;
330
+ this.types[i].pageCount = Math.ceil(
331
+ this.types[i].records.length / this.pageSize
332
+ );
333
+ this.types[i].pageNum = 0;
334
+ this.$set(this.loadings, item.id || String(i), false);
335
+ this.$set(this.noMore, item.id || String(i), true);
336
+ } else if (item.dataRequestUrl) {
337
+ this.isLoading = true;
338
+ this.handleSearch(item, i, true);
339
+ } else {
340
+ this.types[i].records = [];
341
+ this.types[i].totalCount = 0;
342
+ this.types[i].pageCount = 1;
343
+ this.types[i].pageNum = 0;
344
+ this.$set(this.loadings, item.id || String(i), false);
345
+ this.$set(this.noMore, item.id || String(i), true);
346
+ }
347
+ } else {
348
+ this.isLoading = false;
349
+ this.types[i].records = [];
350
+ this.types[i].totalCount = 0;
351
+ this.types[i].pageCount = 1;
352
+ this.types[i].pageNum = 0;
353
+ this.$set(this.loadings, item.id || String(i), false);
354
+ this.$set(this.noMore, item.id || String(i), true);
355
+ }
356
+ }
357
+ },
358
+ searchData(data, name) {
359
+ let records = [];
360
+ data.forEach((item) => {
361
+ let words = item.name || item.text;
362
+ if (words.indexOf(name) > -1 && item.permission !== false) {
363
+ records.push(item);
364
+ }
365
+ if (item.children && item.children.length) {
366
+ records = records.concat(this.searchData(item.children, name));
367
+ }
368
+ if (item.fourthTabs && item.fourthTabs.length) {
369
+ records = records.concat(this.searchData(item.fourthTabs, name));
370
+ }
371
+ });
372
+ return records;
373
+ },
374
+ handleSearch(obj, index, reset) {
375
+ if (obj.pageNum < obj.pageCount && this.keyWords) {
376
+ this.$set(this.loadings, obj.id || String(index), true);
377
+ if (this.active == '0') {
378
+ this.isLoading = true;
379
+ }
380
+ util
381
+ .ajax({
382
+ url: obj.dataRequestUrl,
383
+ method: 'post',
384
+ format: false,
385
+ data: {
386
+ pageNum: obj.pageNum + 1,
387
+ pageSize: this.pageSize,
388
+ search: this.keyWords,
389
+ terminalType: 'web'
390
+ }
391
+ })
392
+ .then((res) => {
393
+ this.$set(this.loadings, obj.id || String(index), false);
394
+ let flag = false;
395
+ for (let i in this.loadings) {
396
+ if (this.loadings[i]) {
397
+ flag = true;
398
+ break;
399
+ }
400
+ }
401
+ if (!flag) {
402
+ this.isLoading = false;
403
+ }
404
+ if (res.rCode == 0) {
405
+ let { results } = res;
406
+ obj.totalCount = results.totalCount;
407
+ obj.pageCount = results.pageCount;
408
+ obj.pageNum = results.pageNum;
409
+ obj.records = reset
410
+ ? results.records
411
+ : obj.records.concat(results.records);
412
+ this.$set(
413
+ this.noMore,
414
+ obj.id || String(index),
415
+ results.pageNum >= results.pageCount
416
+ );
417
+ } else {
418
+ this.types[index].records = [];
419
+ this.types[index].totalCount = 0;
420
+ this.types[index].pageCount = 1;
421
+ this.types[index].pageNum = 0;
422
+ this.$set(this.loadings, obj.id || String(index), false);
423
+ this.$set(this.noMore, obj.id || String(index), true);
424
+ }
425
+ })
426
+ .catch((err) => {
427
+ this.isLoading = false;
428
+ this.types[index].records = [];
429
+ this.types[index].totalCount = 0;
430
+ this.types[index].pageCount = 1;
431
+ this.types[index].pageNum = 0;
432
+ this.$set(this.loadings, obj.id || String(index), false);
433
+ this.$set(this.noMore, obj.id || String(index), true);
434
+ if (err.message && err.message !== 'canceled') {
435
+ this.$message.error(err.message);
436
+ }
437
+ });
438
+ }
439
+ },
440
+ handleTabs(res, index) {
441
+ this.active = res.id || String(index + 1);
442
+ },
443
+ handleClick(res, parent) {
444
+ if (res.detailUrl) {
445
+ this.title = res.title;
446
+ this.url = res.detailUrl;
447
+ this.visible = true;
448
+ } else {
449
+ this.$emit('select', res, parent);
450
+ }
451
+ }
452
+ }
453
+ };
454
+ </script>