eoss-ui 0.6.41 → 0.6.42

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 (234) hide show
  1. package/lib/eoss-ui.common.js +1158 -1047
  2. package/lib/flow-list.js +123 -112
  3. package/lib/flow.js +882 -782
  4. package/lib/index.js +1 -1
  5. package/lib/main.js +132 -132
  6. package/lib/qr-code.js +13 -13
  7. package/lib/theme-chalk/flow.css +1 -1
  8. package/lib/theme-chalk/index.css +1 -1
  9. package/package.json +159 -159
  10. package/packages/button/index.js +5 -5
  11. package/packages/button/src/main.vue +418 -418
  12. package/packages/button-group/index.js +5 -5
  13. package/packages/button-group/src/main.vue +298 -298
  14. package/packages/calendar/index.js +5 -5
  15. package/packages/card/index.js +5 -5
  16. package/packages/card/src/main.vue +156 -156
  17. package/packages/cascader/index.js +5 -5
  18. package/packages/cascader/src/main.vue +168 -168
  19. package/packages/checkbox-group/index.js +5 -5
  20. package/packages/checkbox-group/src/main.vue +333 -333
  21. package/packages/clients/index.js +5 -5
  22. package/packages/clients/src/main.vue +144 -144
  23. package/packages/data-table/index.js +5 -5
  24. package/packages/data-table/src/children.vue +39 -39
  25. package/packages/data-table/src/column.vue +989 -989
  26. package/packages/data-table/src/main.vue +1822 -1822
  27. package/packages/data-table/src/sizer.vue +195 -195
  28. package/packages/data-table-form/index.js +5 -5
  29. package/packages/data-table-form/src/checkbox.vue +101 -101
  30. package/packages/data-table-form/src/colgroup.vue +17 -17
  31. package/packages/data-table-form/src/main.vue +181 -181
  32. package/packages/data-table-form/src/radio.vue +65 -65
  33. package/packages/data-table-form/src/table.vue +233 -233
  34. package/packages/data-table-form/src/tbody.vue +336 -336
  35. package/packages/data-table-form/src/thead.vue +68 -68
  36. package/packages/date-picker/index.js +5 -5
  37. package/packages/date-picker/src/main.vue +236 -236
  38. package/packages/dialog/index.js +5 -5
  39. package/packages/enterprise/index.js +5 -5
  40. package/packages/enterprise/src/main.vue +66 -66
  41. package/packages/error-page/index.js +5 -5
  42. package/packages/error-page/src/main.vue +44 -44
  43. package/packages/flow/index.js +5 -5
  44. package/packages/flow/src/component/CommonOpinions.vue +345 -345
  45. package/packages/flow/src/component/CustomPreset.vue +322 -322
  46. package/packages/flow/src/component/FileList.vue +99 -99
  47. package/packages/flow/src/component/Preset.vue +255 -255
  48. package/packages/flow/src/component/SendMsg.vue +229 -229
  49. package/packages/flow/src/component/TimeLimit.vue +190 -190
  50. package/packages/flow/src/component/taskUnionExamine.vue +611 -611
  51. package/packages/flow/src/form.vue +121 -121
  52. package/packages/flow/src/freeStartFlow.vue +2843 -2843
  53. package/packages/flow/src/main.vue +2952 -2862
  54. package/packages/flow/src/processForm.vue +1018 -1018
  55. package/packages/flow/src/processReject.vue +293 -293
  56. package/packages/flow/src/reset.vue +899 -899
  57. package/packages/flow/src/startTaskRead.vue +596 -596
  58. package/packages/flow/src/table.vue +58 -58
  59. package/packages/flow-group/index.js +5 -5
  60. package/packages/flow-group/src/main.vue +688 -688
  61. package/packages/flow-list/index.js +5 -5
  62. package/packages/flow-list/src/main.vue +1183 -1172
  63. package/packages/form/index.js +5 -5
  64. package/packages/form/src/main.vue +3584 -3584
  65. package/packages/form/src/table.vue +1420 -1420
  66. package/packages/handle-user/index.js +5 -5
  67. package/packages/handle-user/src/main.vue +138 -138
  68. package/packages/handler/index.js +5 -5
  69. package/packages/handler/src/main.vue +474 -474
  70. package/packages/icon/index.js +5 -5
  71. package/packages/icon/src/main.vue +101 -101
  72. package/packages/icons/index.js +5 -5
  73. package/packages/icons/src/main.vue +81 -81
  74. package/packages/input/index.js +5 -5
  75. package/packages/input/src/main.vue +356 -356
  76. package/packages/input-number/index.js +5 -5
  77. package/packages/input-number/src/main.vue +106 -106
  78. package/packages/label/index.js +5 -5
  79. package/packages/label/src/main.vue +457 -457
  80. package/packages/layout/index.js +5 -5
  81. package/packages/layout/src/item.vue +152 -152
  82. package/packages/layout/src/main.vue +31 -31
  83. package/packages/login/index.js +5 -5
  84. package/packages/login/src/main.vue +1935 -1935
  85. package/packages/login/src/resetPassword.vue +562 -562
  86. package/packages/main/index.js +5 -5
  87. package/packages/main/src/default/message.vue +249 -249
  88. package/packages/main/src/default/notice.vue +157 -157
  89. package/packages/main/src/default/userinfo.vue +505 -505
  90. package/packages/main/src/public/online.vue +89 -89
  91. package/packages/main/src/public/search.vue +461 -461
  92. package/packages/main/src/public/settings.vue +221 -221
  93. package/packages/main/src/simplicity/apps.vue +388 -388
  94. package/packages/main/src/simplicity/avatar.vue +82 -82
  95. package/packages/main/src/simplicity/handler.vue +259 -259
  96. package/packages/main/src/simplicity/index.vue +2047 -2047
  97. package/packages/main/src/simplicity/lists.vue +84 -84
  98. package/packages/main/src/simplicity/menu-list.vue +128 -128
  99. package/packages/main/src/simplicity/message.vue +259 -259
  100. package/packages/main/src/simplicity/notice.vue +190 -190
  101. package/packages/main/src/simplicity/router-page.vue +45 -45
  102. package/packages/main/src/simplicity/sub-menu.vue +241 -241
  103. package/packages/main/src/simplicity/user.vue +257 -257
  104. package/packages/main/src/simplicity/userinfo.vue +312 -312
  105. package/packages/menu/index.js +5 -5
  106. package/packages/menu/src/main.vue +536 -536
  107. package/packages/nav/index.js +5 -5
  108. package/packages/nav/src/main.vue +402 -402
  109. package/packages/notify/index.js +5 -5
  110. package/packages/notify/src/main.vue +538 -538
  111. package/packages/page/index.js +5 -5
  112. package/packages/page/src/main.vue +167 -167
  113. package/packages/pagination/index.js +5 -5
  114. package/packages/pagination/src/main.vue +96 -96
  115. package/packages/player/index.js +5 -5
  116. package/packages/player/src/main.vue +194 -194
  117. package/packages/qr-code/index.js +5 -5
  118. package/packages/qr-code/src/main.vue +170 -170
  119. package/packages/radio-group/index.js +6 -6
  120. package/packages/radio-group/src/main.vue +319 -319
  121. package/packages/retrial-auth/index.js +5 -5
  122. package/packages/retrial-auth/src/main.vue +280 -280
  123. package/packages/select/index.js +5 -5
  124. package/packages/select/src/main.vue +775 -775
  125. package/packages/select-ganged/index.js +5 -5
  126. package/packages/select-ganged/src/main.vue +724 -724
  127. package/packages/selector/index.js +5 -5
  128. package/packages/selector/src/main.vue +689 -689
  129. package/packages/selector-panel/index.js +5 -5
  130. package/packages/selector-panel/src/main.vue +1027 -1027
  131. package/packages/selector-panel/src/selection.vue +177 -177
  132. package/packages/selector-panel/src/tree.vue +129 -129
  133. package/packages/sizer/index.js +5 -5
  134. package/packages/sizer/src/main.vue +254 -254
  135. package/packages/steps/index.js +5 -5
  136. package/packages/steps/src/main.vue +181 -181
  137. package/packages/switch/index.js +5 -5
  138. package/packages/switch/src/main.vue +154 -154
  139. package/packages/table-form/index.js +5 -5
  140. package/packages/tabs/index.js +5 -5
  141. package/packages/tabs/src/main.vue +788 -788
  142. package/packages/tabs-panel/index.js +5 -5
  143. package/packages/tabs-panel/src/main.vue +29 -29
  144. package/packages/theme-chalk/lib/flow.css +1 -1
  145. package/packages/theme-chalk/lib/index.css +1 -1
  146. package/packages/theme-chalk/src/base.scss +260 -260
  147. package/packages/theme-chalk/src/button-group.scss +175 -175
  148. package/packages/theme-chalk/src/button.scss +24 -24
  149. package/packages/theme-chalk/src/calendar.scss +113 -113
  150. package/packages/theme-chalk/src/card.scss +99 -99
  151. package/packages/theme-chalk/src/checkbox-group.scss +8 -8
  152. package/packages/theme-chalk/src/clients.scss +87 -87
  153. package/packages/theme-chalk/src/data-table-form.scss +67 -67
  154. package/packages/theme-chalk/src/data-table.scss +293 -293
  155. package/packages/theme-chalk/src/date-picker.scss +7 -7
  156. package/packages/theme-chalk/src/dialog.scss +77 -77
  157. package/packages/theme-chalk/src/enterprise.scss +5 -5
  158. package/packages/theme-chalk/src/error-page.scss +18 -18
  159. package/packages/theme-chalk/src/flow-group.scss +110 -110
  160. package/packages/theme-chalk/src/flow-list.scss +36 -36
  161. package/packages/theme-chalk/src/flow.scss +318 -310
  162. package/packages/theme-chalk/src/form.scss +496 -496
  163. package/packages/theme-chalk/src/handle-user.scss +40 -40
  164. package/packages/theme-chalk/src/handler.scss +143 -143
  165. package/packages/theme-chalk/src/icon.scss +1789 -1789
  166. package/packages/theme-chalk/src/icons.scss +99 -99
  167. package/packages/theme-chalk/src/input.scss +9 -9
  168. package/packages/theme-chalk/src/label.scss +24 -24
  169. package/packages/theme-chalk/src/layout.scss +46 -46
  170. package/packages/theme-chalk/src/login.scss +947 -947
  171. package/packages/theme-chalk/src/main.scss +639 -639
  172. package/packages/theme-chalk/src/menu.scss +222 -222
  173. package/packages/theme-chalk/src/mixins/color.scss +117 -117
  174. package/packages/theme-chalk/src/nav.scss +125 -125
  175. package/packages/theme-chalk/src/page.scss +3 -3
  176. package/packages/theme-chalk/src/pagination.scss +29 -29
  177. package/packages/theme-chalk/src/player.scss +9 -9
  178. package/packages/theme-chalk/src/qr-code.scss +17 -17
  179. package/packages/theme-chalk/src/radio-group.scss +9 -9
  180. package/packages/theme-chalk/src/retrial-auth.scss +38 -38
  181. package/packages/theme-chalk/src/select-ganged.scss +8 -8
  182. package/packages/theme-chalk/src/select.scss +8 -8
  183. package/packages/theme-chalk/src/selector-panel.scss +204 -204
  184. package/packages/theme-chalk/src/selector.scss +91 -91
  185. package/packages/theme-chalk/src/simplicity.scss +1262 -1262
  186. package/packages/theme-chalk/src/sizer.scss +36 -36
  187. package/packages/theme-chalk/src/steps.scss +88 -88
  188. package/packages/theme-chalk/src/switch.scss +3 -3
  189. package/packages/theme-chalk/src/table-form.scss +1 -1
  190. package/packages/theme-chalk/src/tabs.scss +87 -87
  191. package/packages/theme-chalk/src/tips.scss +7 -7
  192. package/packages/theme-chalk/src/toolbar.scss +179 -179
  193. package/packages/theme-chalk/src/tree-group.scss +72 -72
  194. package/packages/theme-chalk/src/tree.scss +165 -165
  195. package/packages/theme-chalk/src/upload.scss +167 -167
  196. package/packages/theme-chalk/src/wxlogin.scss +3 -3
  197. package/packages/tips/index.js +5 -5
  198. package/packages/tips/src/main.vue +141 -141
  199. package/packages/toolbar/index.js +5 -5
  200. package/packages/toolbar/src/main.vue +430 -430
  201. package/packages/tree/index.js +5 -5
  202. package/packages/tree-group/index.js +5 -5
  203. package/packages/upload/index.js +5 -5
  204. package/packages/upload/src/main.vue +1334 -1334
  205. package/packages/upload/src/picture.js +15 -15
  206. package/packages/wujie/index.js +5 -5
  207. package/packages/wujie/src/main.vue +145 -145
  208. package/packages/wxlogin/index.js +5 -5
  209. package/packages/wxlogin/src/main.vue +128 -128
  210. package/src/config/api.js +248 -248
  211. package/src/config/image.js +2 -2
  212. package/src/index.js +157 -157
  213. package/src/utils/bus.js +3 -3
  214. package/src/utils/date-util.js +312 -312
  215. package/src/utils/http.js +50 -50
  216. package/src/utils/rules.js +18 -18
  217. package/src/utils/store.js +21 -21
  218. package/src/utils/webSocket.js +107 -107
  219. package/packages/.DS_Store +0 -0
  220. package/packages/data-table/.DS_Store +0 -0
  221. package/packages/data-table-form/.DS_Store +0 -0
  222. package/packages/error-page/.DS_Store +0 -0
  223. package/packages/flow/.DS_Store +0 -0
  224. package/packages/form/.DS_Store +0 -0
  225. package/packages/login/.DS_Store +0 -0
  226. package/packages/main/.DS_Store +0 -0
  227. package/packages/main/src/.DS_Store +0 -0
  228. package/packages/selector/.DS_Store +0 -0
  229. package/packages/selector-panel/.DS_Store +0 -0
  230. package/packages/sizer/.DS_Store +0 -0
  231. package/packages/tabs/.DS_Store +0 -0
  232. package/packages/theme-chalk/src/.DS_Store +0 -0
  233. package/packages/upload/.DS_Store +0 -0
  234. package/src/.DS_Store +0 -0
@@ -1,461 +1,461 @@
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, idx) in item.records.slice(0, 3)"
24
- class="es-public-search-list-item"
25
- :key="ele.id || `${item.id}_${ele.title}_${idx}`"
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) && !item.hide"
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, idx) in item.records"
95
- class="es-public-search-list-item"
96
- :key="ele.id || `${item.id}_${ele.title}_${idx}`"
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 {
305
- ...item,
306
- pageNum: 0,
307
- pageCount: 1,
308
- records: [],
309
- hide:
310
- item.name == '应用' && this.apps.length == 0 ? true : false
311
- };
312
- });
313
- this.types = types;
314
- this.loadings = loadings;
315
- this.noMore = noMore;
316
- }
317
- });
318
- },
319
- searchAll(keyWords) {
320
- for (let i = 0; i < this.types.length; i++) {
321
- let item = this.types[i];
322
- if (keyWords && !this.hides.includes(item.name) && !item.hide) {
323
- if (item.name == '菜单' && this.menus.length) {
324
- this.isLoading = false;
325
- this.types[i].records = this.searchData(this.menus, keyWords);
326
- this.types[i].totalCount = this.types[i].records.length;
327
- this.types[i].pageCount = Math.ceil(
328
- this.types[i].records.length / this.pageSize
329
- );
330
- this.types[i].pageNum = 0;
331
- this.$set(this.loadings, item.id || String(i), false);
332
- this.$set(this.noMore, item.id || String(i), true);
333
- } else if (item.name == '应用' && this.apps.length) {
334
- this.isLoading = false;
335
- this.types[i].records = this.searchData(this.apps, keyWords);
336
- this.types[i].totalCount = this.types[i].records.length;
337
- this.types[i].pageCount = Math.ceil(
338
- this.types[i].records.length / this.pageSize
339
- );
340
- this.types[i].pageNum = 0;
341
- this.$set(this.loadings, item.id || String(i), false);
342
- this.$set(this.noMore, item.id || String(i), true);
343
- } else if (item.dataRequestUrl) {
344
- this.isLoading = true;
345
- this.handleSearch(item, i, true);
346
- } else {
347
- this.types[i].records = [];
348
- this.types[i].totalCount = 0;
349
- this.types[i].pageCount = 1;
350
- this.types[i].pageNum = 0;
351
- this.$set(this.loadings, item.id || String(i), false);
352
- this.$set(this.noMore, item.id || String(i), true);
353
- }
354
- } else {
355
- this.isLoading = false;
356
- this.types[i].records = [];
357
- this.types[i].totalCount = 0;
358
- this.types[i].pageCount = 1;
359
- this.types[i].pageNum = 0;
360
- this.$set(this.loadings, item.id || String(i), false);
361
- this.$set(this.noMore, item.id || String(i), true);
362
- }
363
- }
364
- },
365
- searchData(data, name) {
366
- let records = [];
367
- data.forEach((item) => {
368
- let words = item.name || item.text;
369
- if (words.indexOf(name) > -1 && item.permission !== false) {
370
- records.push(item);
371
- }
372
- if (item.children && item.children.length) {
373
- records = records.concat(this.searchData(item.children, name));
374
- }
375
- if (item.fourthTabs && item.fourthTabs.length) {
376
- records = records.concat(this.searchData(item.fourthTabs, name));
377
- }
378
- });
379
- return records;
380
- },
381
- handleSearch(obj, index, reset) {
382
- if (obj.pageNum < obj.pageCount && this.keyWords) {
383
- this.$set(this.loadings, obj.id || String(index), true);
384
- if (this.active == '0') {
385
- this.isLoading = true;
386
- }
387
- util
388
- .ajax({
389
- url: obj.dataRequestUrl,
390
- method: 'post',
391
- format: false,
392
- data: {
393
- pageNum: obj.pageNum + 1,
394
- pageSize: this.pageSize,
395
- search: this.keyWords,
396
- terminalType: 'web'
397
- }
398
- })
399
- .then((res) => {
400
- this.$set(this.loadings, obj.id || String(index), false);
401
- let flag = false;
402
- for (let i in this.loadings) {
403
- if (this.loadings[i]) {
404
- flag = true;
405
- break;
406
- }
407
- }
408
- if (!flag) {
409
- this.isLoading = false;
410
- }
411
- if (res.rCode == 0) {
412
- let { results } = res;
413
- obj.totalCount = results.totalCount;
414
- obj.pageCount = results.pageCount;
415
- obj.pageNum = results.pageNum;
416
- obj.records = reset
417
- ? results.records
418
- : obj.records.concat(results.records);
419
- this.$set(
420
- this.noMore,
421
- obj.id || String(index),
422
- results.pageNum >= results.pageCount
423
- );
424
- } else {
425
- this.types[index].records = [];
426
- this.types[index].totalCount = 0;
427
- this.types[index].pageCount = 1;
428
- this.types[index].pageNum = 0;
429
- this.$set(this.loadings, obj.id || String(index), false);
430
- this.$set(this.noMore, obj.id || String(index), true);
431
- }
432
- })
433
- .catch((err) => {
434
- this.isLoading = false;
435
- this.types[index].records = [];
436
- this.types[index].totalCount = 0;
437
- this.types[index].pageCount = 1;
438
- this.types[index].pageNum = 0;
439
- this.$set(this.loadings, obj.id || String(index), false);
440
- this.$set(this.noMore, obj.id || String(index), true);
441
- if (err.message && err.message !== 'canceled') {
442
- this.$message.error(err.message);
443
- }
444
- });
445
- }
446
- },
447
- handleTabs(res, index) {
448
- this.active = res.id || String(index + 1);
449
- },
450
- handleClick(res, parent) {
451
- if (res.detailUrl) {
452
- this.title = res.title;
453
- this.url = res.detailUrl;
454
- this.visible = true;
455
- } else {
456
- this.$emit('select', res, parent);
457
- }
458
- }
459
- }
460
- };
461
- </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, idx) in item.records.slice(0, 3)"
24
+ class="es-public-search-list-item"
25
+ :key="ele.id || `${item.id}_${ele.title}_${idx}`"
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) && !item.hide"
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, idx) in item.records"
95
+ class="es-public-search-list-item"
96
+ :key="ele.id || `${item.id}_${ele.title}_${idx}`"
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 {
305
+ ...item,
306
+ pageNum: 0,
307
+ pageCount: 1,
308
+ records: [],
309
+ hide:
310
+ item.name == '应用' && this.apps.length == 0 ? true : false
311
+ };
312
+ });
313
+ this.types = types;
314
+ this.loadings = loadings;
315
+ this.noMore = noMore;
316
+ }
317
+ });
318
+ },
319
+ searchAll(keyWords) {
320
+ for (let i = 0; i < this.types.length; i++) {
321
+ let item = this.types[i];
322
+ if (keyWords && !this.hides.includes(item.name) && !item.hide) {
323
+ if (item.name == '菜单' && this.menus.length) {
324
+ this.isLoading = false;
325
+ this.types[i].records = this.searchData(this.menus, keyWords);
326
+ this.types[i].totalCount = this.types[i].records.length;
327
+ this.types[i].pageCount = Math.ceil(
328
+ this.types[i].records.length / this.pageSize
329
+ );
330
+ this.types[i].pageNum = 0;
331
+ this.$set(this.loadings, item.id || String(i), false);
332
+ this.$set(this.noMore, item.id || String(i), true);
333
+ } else if (item.name == '应用' && this.apps.length) {
334
+ this.isLoading = false;
335
+ this.types[i].records = this.searchData(this.apps, keyWords);
336
+ this.types[i].totalCount = this.types[i].records.length;
337
+ this.types[i].pageCount = Math.ceil(
338
+ this.types[i].records.length / this.pageSize
339
+ );
340
+ this.types[i].pageNum = 0;
341
+ this.$set(this.loadings, item.id || String(i), false);
342
+ this.$set(this.noMore, item.id || String(i), true);
343
+ } else if (item.dataRequestUrl) {
344
+ this.isLoading = true;
345
+ this.handleSearch(item, i, true);
346
+ } else {
347
+ this.types[i].records = [];
348
+ this.types[i].totalCount = 0;
349
+ this.types[i].pageCount = 1;
350
+ this.types[i].pageNum = 0;
351
+ this.$set(this.loadings, item.id || String(i), false);
352
+ this.$set(this.noMore, item.id || String(i), true);
353
+ }
354
+ } else {
355
+ this.isLoading = false;
356
+ this.types[i].records = [];
357
+ this.types[i].totalCount = 0;
358
+ this.types[i].pageCount = 1;
359
+ this.types[i].pageNum = 0;
360
+ this.$set(this.loadings, item.id || String(i), false);
361
+ this.$set(this.noMore, item.id || String(i), true);
362
+ }
363
+ }
364
+ },
365
+ searchData(data, name) {
366
+ let records = [];
367
+ data.forEach((item) => {
368
+ let words = item.name || item.text;
369
+ if (words.indexOf(name) > -1 && item.permission !== false) {
370
+ records.push(item);
371
+ }
372
+ if (item.children && item.children.length) {
373
+ records = records.concat(this.searchData(item.children, name));
374
+ }
375
+ if (item.fourthTabs && item.fourthTabs.length) {
376
+ records = records.concat(this.searchData(item.fourthTabs, name));
377
+ }
378
+ });
379
+ return records;
380
+ },
381
+ handleSearch(obj, index, reset) {
382
+ if (obj.pageNum < obj.pageCount && this.keyWords) {
383
+ this.$set(this.loadings, obj.id || String(index), true);
384
+ if (this.active == '0') {
385
+ this.isLoading = true;
386
+ }
387
+ util
388
+ .ajax({
389
+ url: obj.dataRequestUrl,
390
+ method: 'post',
391
+ format: false,
392
+ data: {
393
+ pageNum: obj.pageNum + 1,
394
+ pageSize: this.pageSize,
395
+ search: this.keyWords,
396
+ terminalType: 'web'
397
+ }
398
+ })
399
+ .then((res) => {
400
+ this.$set(this.loadings, obj.id || String(index), false);
401
+ let flag = false;
402
+ for (let i in this.loadings) {
403
+ if (this.loadings[i]) {
404
+ flag = true;
405
+ break;
406
+ }
407
+ }
408
+ if (!flag) {
409
+ this.isLoading = false;
410
+ }
411
+ if (res.rCode == 0) {
412
+ let { results } = res;
413
+ obj.totalCount = results.totalCount;
414
+ obj.pageCount = results.pageCount;
415
+ obj.pageNum = results.pageNum;
416
+ obj.records = reset
417
+ ? results.records
418
+ : obj.records.concat(results.records);
419
+ this.$set(
420
+ this.noMore,
421
+ obj.id || String(index),
422
+ results.pageNum >= results.pageCount
423
+ );
424
+ } else {
425
+ this.types[index].records = [];
426
+ this.types[index].totalCount = 0;
427
+ this.types[index].pageCount = 1;
428
+ this.types[index].pageNum = 0;
429
+ this.$set(this.loadings, obj.id || String(index), false);
430
+ this.$set(this.noMore, obj.id || String(index), true);
431
+ }
432
+ })
433
+ .catch((err) => {
434
+ this.isLoading = false;
435
+ this.types[index].records = [];
436
+ this.types[index].totalCount = 0;
437
+ this.types[index].pageCount = 1;
438
+ this.types[index].pageNum = 0;
439
+ this.$set(this.loadings, obj.id || String(index), false);
440
+ this.$set(this.noMore, obj.id || String(index), true);
441
+ if (err.message && err.message !== 'canceled') {
442
+ this.$message.error(err.message);
443
+ }
444
+ });
445
+ }
446
+ },
447
+ handleTabs(res, index) {
448
+ this.active = res.id || String(index + 1);
449
+ },
450
+ handleClick(res, parent) {
451
+ if (res.detailUrl) {
452
+ this.title = res.title;
453
+ this.url = res.detailUrl;
454
+ this.visible = true;
455
+ } else {
456
+ this.$emit('select', res, parent);
457
+ }
458
+ }
459
+ }
460
+ };
461
+ </script>