eoss-ui 0.5.83 → 0.5.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +929 -0
- package/lib/button-group.js +146 -66
- package/lib/button.js +118 -69
- package/lib/checkbox-group.js +64 -46
- package/lib/config/api.js +5 -1
- package/lib/data-table-form.js +64 -46
- package/lib/data-table.js +468 -295
- package/lib/date-picker.js +64 -46
- package/lib/dialog.js +71 -48
- package/lib/eoss-ui.common.js +9188 -15746
- package/lib/flow-group.js +64 -46
- package/lib/flow-list.js +65 -47
- package/lib/flow.js +113 -77
- package/lib/form.js +5708 -13486
- package/lib/handle-user.js +65 -47
- package/lib/handler.js +70 -48
- package/lib/icon.js +64 -46
- package/lib/index.js +1 -1
- package/lib/input-number.js +64 -46
- package/lib/input.js +64 -46
- package/lib/login.js +86 -57
- package/lib/main.js +1435 -483
- package/lib/nav.js +64 -46
- package/lib/notify.js +51 -46
- package/lib/page.js +64 -46
- package/lib/pagination.js +64 -46
- package/lib/player.js +64 -46
- package/lib/qr-code.js +64 -46
- package/lib/radio-group.js +64 -46
- package/lib/retrial-auth.js +64 -46
- package/lib/select-ganged.js +64 -46
- package/lib/select.js +65 -47
- package/lib/selector-panel.js +64 -46
- package/lib/selector.js +64 -46
- package/lib/sizer.js +64 -46
- package/lib/steps.js +64 -46
- package/lib/switch.js +64 -46
- package/lib/table-form.js +64 -46
- package/lib/tabs.js +64 -46
- package/lib/theme-chalk/calendar.css +1 -1
- package/lib/theme-chalk/data-table.css +1 -1
- package/lib/theme-chalk/dialog.css +1 -1
- package/lib/theme-chalk/form.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/theme-chalk/main.css +1 -1
- package/lib/theme-chalk/simplicity.css +1 -1
- package/lib/tips.js +64 -46
- package/lib/tree-group.js +64 -46
- package/lib/tree.js +64 -46
- package/lib/upload.js +78 -60
- package/lib/utils/util.js +18 -5
- package/lib/wujie.js +64 -46
- package/lib/wxlogin.js +64 -46
- package/package.json +2 -2
- package/packages/button/src/main.vue +88 -55
- package/packages/button-group/src/main.vue +56 -13
- package/packages/data-table/src/children.vue +3 -2
- package/packages/data-table/src/column.vue +6 -4
- package/packages/data-table/src/main.vue +150 -69
- package/packages/data-table/src/sizer.vue +51 -22
- package/packages/dialog/src/main.vue +5 -1
- package/packages/flow/src/main.vue +26 -17
- package/packages/form/src/main.vue +129 -2103
- package/packages/handler/src/main.vue +5 -0
- package/packages/login/src/main.vue +12 -1
- package/packages/login/src/resetPassword.vue +4 -2
- package/packages/main/src/default/index.vue +35 -54
- package/packages/main/src/default/userinfo.vue +2 -1
- package/packages/main/src/public/search.vue +444 -0
- package/packages/main/src/simplicity/apps.vue +20 -2
- package/packages/main/src/simplicity/handler.vue +0 -2
- package/packages/main/src/simplicity/index.vue +97 -32
- package/packages/main/src/simplicity/userinfo.vue +1 -0
- package/packages/select/src/main.vue +1 -1
- package/packages/theme-chalk/lib/calendar.css +1 -1
- package/packages/theme-chalk/lib/data-table.css +1 -1
- package/packages/theme-chalk/lib/dialog.css +1 -1
- package/packages/theme-chalk/lib/form.css +1 -1
- package/packages/theme-chalk/lib/index.css +1 -1
- package/packages/theme-chalk/lib/main.css +1 -1
- package/packages/theme-chalk/lib/simplicity.css +1 -1
- package/packages/theme-chalk/src/calendar.scss +3 -3
- package/packages/theme-chalk/src/data-table.scss +12 -0
- package/packages/theme-chalk/src/dialog.scss +15 -0
- package/packages/theme-chalk/src/form.scss +6 -0
- package/packages/theme-chalk/src/main.scss +2 -1
- package/packages/theme-chalk/src/simplicity.scss +172 -4
- package/packages/upload/src/main.vue +16 -12
- package/src/config/api.js +5 -1
- package/src/index.js +157 -157
- package/src/utils/util.js +18 -5
|
@@ -390,6 +390,7 @@ import {
|
|
|
390
390
|
doCaLogin,
|
|
391
391
|
doAssistanceQrLogin
|
|
392
392
|
} from 'eoss-ui/src/config/api.js';
|
|
393
|
+
const ceshi = util.getParams('ceshi');
|
|
393
394
|
export default {
|
|
394
395
|
name: 'EsLogin',
|
|
395
396
|
inheritAttrs: false,
|
|
@@ -817,6 +818,9 @@ export default {
|
|
|
817
818
|
]);
|
|
818
819
|
},
|
|
819
820
|
created() {
|
|
821
|
+
if (ceshi == 'true' || ceshi == true) {
|
|
822
|
+
this.loginModel = '0';
|
|
823
|
+
}
|
|
820
824
|
if (this.isScale) {
|
|
821
825
|
util.setScale();
|
|
822
826
|
window.addEventListener('resize', this.setScale);
|
|
@@ -1021,6 +1025,7 @@ export default {
|
|
|
1021
1025
|
key: 'initLogin',
|
|
1022
1026
|
value: JSON.stringify(res.results)
|
|
1023
1027
|
});
|
|
1028
|
+
this.$emit('initLogin', res.results);
|
|
1024
1029
|
this.setConfig(res.results);
|
|
1025
1030
|
} else {
|
|
1026
1031
|
this.$message({
|
|
@@ -1069,7 +1074,7 @@ export default {
|
|
|
1069
1074
|
if (res.qrimg || res.qrImg) {
|
|
1070
1075
|
this.qrimg = res.qrimg || res.qrImg;
|
|
1071
1076
|
}
|
|
1072
|
-
if (res.loginModel) {
|
|
1077
|
+
if (res.loginModel && ceshi !== 'true' && ceshi !== true) {
|
|
1073
1078
|
this.loginModel = res.loginModel;
|
|
1074
1079
|
}
|
|
1075
1080
|
if (res.loginBackgroundUrl) {
|
|
@@ -1087,6 +1092,12 @@ export default {
|
|
|
1087
1092
|
if (res.subsystemExtend.login_url) {
|
|
1088
1093
|
this.actionUrl = res.subsystemExtend.login_url;
|
|
1089
1094
|
}
|
|
1095
|
+
if (
|
|
1096
|
+
res.subsystemExtend.loginModel &&
|
|
1097
|
+
(ceshi == 'true' || ceshi == true)
|
|
1098
|
+
) {
|
|
1099
|
+
this.loginModel = res.subsystemExtend.loginModel;
|
|
1100
|
+
}
|
|
1090
1101
|
if (res.subsystemExtend.applicationName) {
|
|
1091
1102
|
localStorage.setItem('appcode', res.subsystemExtend.applicationName);
|
|
1092
1103
|
}
|
|
@@ -26,9 +26,10 @@
|
|
|
26
26
|
element-loading-text="修改中..."
|
|
27
27
|
element-loading-spinner="el-icon-loading"
|
|
28
28
|
element-loading-background="rgba(0, 0, 0, 0.65)"
|
|
29
|
+
class="es-user-info"
|
|
29
30
|
:model="formData"
|
|
30
31
|
:contents="page"
|
|
31
|
-
|
|
32
|
+
:autocomplete="false"
|
|
32
33
|
@submit="handleSubmit"
|
|
33
34
|
>
|
|
34
35
|
</es-form>
|
|
@@ -369,6 +370,8 @@ export default {
|
|
|
369
370
|
if (types.length) {
|
|
370
371
|
this.activeIndex = types[0];
|
|
371
372
|
}
|
|
373
|
+
} else {
|
|
374
|
+
this.activeIndex = '0';
|
|
372
375
|
}
|
|
373
376
|
},
|
|
374
377
|
destroyed() {
|
|
@@ -499,7 +502,6 @@ export default {
|
|
|
499
502
|
} else {
|
|
500
503
|
let msg = res.msg || '系统错误,请联系管理员!';
|
|
501
504
|
this.$message.error(msg);
|
|
502
|
-
this.btnText = '获取验证码';
|
|
503
505
|
this.disabled = false;
|
|
504
506
|
delete this.formData.verificationCode;
|
|
505
507
|
clearInterval(this.timer);
|
|
@@ -297,7 +297,12 @@ export default {
|
|
|
297
297
|
//主题颜色选择颜色集合
|
|
298
298
|
themes: Array,
|
|
299
299
|
//需要隐藏的头部功能
|
|
300
|
-
hides:
|
|
300
|
+
hides: {
|
|
301
|
+
type: Object,
|
|
302
|
+
default() {
|
|
303
|
+
return {};
|
|
304
|
+
}
|
|
305
|
+
},
|
|
301
306
|
//储存数据
|
|
302
307
|
storage: {
|
|
303
308
|
type: String,
|
|
@@ -467,66 +472,29 @@ export default {
|
|
|
467
472
|
},
|
|
468
473
|
//隐藏操作按键
|
|
469
474
|
hide() {
|
|
470
|
-
let
|
|
471
|
-
|
|
472
|
-
let topRightToolHide = '';
|
|
473
|
-
if (
|
|
474
|
-
mainConfig &&
|
|
475
|
-
mainConfig.subsystemExtend &&
|
|
476
|
-
mainConfig.subsystemExtend.topRightToolHide
|
|
477
|
-
) {
|
|
475
|
+
let topRightToolHide = {};
|
|
476
|
+
if (this.topRightToolHide) {
|
|
478
477
|
topRightToolHide = JSON.parse(
|
|
479
|
-
|
|
478
|
+
this.topRightToolHide.replace(
|
|
480
479
|
/(['"])?([a-zA-Z0-9_]+)(['"])?:/g,
|
|
481
480
|
'"$2":'
|
|
482
481
|
)
|
|
483
482
|
);
|
|
484
483
|
}
|
|
484
|
+
let hides = {
|
|
485
|
+
set: !this.set,
|
|
486
|
+
index: this.doorIndex ? false : true,
|
|
487
|
+
system: true,
|
|
488
|
+
home: this.homePage ? false : true
|
|
489
|
+
};
|
|
490
|
+
|
|
485
491
|
if (this.layout === 'subsystem' || this.application) {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
} else {
|
|
491
|
-
return { set: !this.set, system: false };
|
|
492
|
-
}
|
|
493
|
-
} else if (this.layout === 'topside' || this.layout === 'side') {
|
|
494
|
-
if (this.hides && Object.keys(this.hides).length) {
|
|
495
|
-
return {
|
|
496
|
-
...this.hides,
|
|
497
|
-
set: !this.set,
|
|
498
|
-
system: true,
|
|
499
|
-
user: true
|
|
500
|
-
};
|
|
501
|
-
} else if (topRightToolHide && Object.keys(topRightToolHide).length) {
|
|
502
|
-
return {
|
|
503
|
-
...topRightToolHide,
|
|
504
|
-
set: !this.set,
|
|
505
|
-
system: true,
|
|
506
|
-
user: true
|
|
507
|
-
};
|
|
508
|
-
} else {
|
|
509
|
-
return { set: !this.set, system: true, user: true };
|
|
510
|
-
}
|
|
511
|
-
} else {
|
|
512
|
-
if (this.hides && Object.keys(this.hides).length) {
|
|
513
|
-
return {
|
|
514
|
-
...this.hides,
|
|
515
|
-
set: !this.set,
|
|
516
|
-
system: true,
|
|
517
|
-
user: true
|
|
518
|
-
};
|
|
519
|
-
} else if (topRightToolHide && Object.keys(topRightToolHide).length) {
|
|
520
|
-
return {
|
|
521
|
-
...topRightToolHide,
|
|
522
|
-
set: !this.set,
|
|
523
|
-
system: true,
|
|
524
|
-
user: true
|
|
525
|
-
};
|
|
526
|
-
} else {
|
|
527
|
-
return { set: !this.set, system: true };
|
|
528
|
-
}
|
|
492
|
+
hides.system = false;
|
|
493
|
+
}
|
|
494
|
+
if (this.layout === 'topside' || this.layout === 'side') {
|
|
495
|
+
hides.user = true;
|
|
529
496
|
}
|
|
497
|
+
return { ...hides, ...this.hides, ...topRightToolHide };
|
|
530
498
|
},
|
|
531
499
|
logoUrl() {
|
|
532
500
|
if (this.mainLogo) {
|
|
@@ -664,7 +632,9 @@ export default {
|
|
|
664
632
|
showPage: false,
|
|
665
633
|
webSocket: null,
|
|
666
634
|
dialog: {},
|
|
667
|
-
hideSubMenu: false
|
|
635
|
+
hideSubMenu: false,
|
|
636
|
+
doorIndex: '',
|
|
637
|
+
topRightToolHide: ''
|
|
668
638
|
};
|
|
669
639
|
},
|
|
670
640
|
created() {
|
|
@@ -683,6 +653,7 @@ export default {
|
|
|
683
653
|
this.init(results);
|
|
684
654
|
}
|
|
685
655
|
}
|
|
656
|
+
this.doorIndex = sessionStorage.getItem('doorIndex');
|
|
686
657
|
},
|
|
687
658
|
mounted() {
|
|
688
659
|
this.handleListener();
|
|
@@ -878,6 +849,7 @@ export default {
|
|
|
878
849
|
}
|
|
879
850
|
if (i === 'doorIndex' && results[i]) {
|
|
880
851
|
window.open(results[i]);
|
|
852
|
+
this.doorIndex = results[i];
|
|
881
853
|
}
|
|
882
854
|
if (i === 'subsystemName' && results[i]) {
|
|
883
855
|
document.title = results[i];
|
|
@@ -916,6 +888,12 @@ export default {
|
|
|
916
888
|
if (results[i].loginPage) {
|
|
917
889
|
util.setStorage('loginPage', results[i].loginPage);
|
|
918
890
|
}
|
|
891
|
+
if (results[i].portalPage || results[i].portalpage) {
|
|
892
|
+
this.doorIndex = results[i].portalPage || results[i].portalpage;
|
|
893
|
+
}
|
|
894
|
+
if (results[i].topRightToolHide) {
|
|
895
|
+
this.topRightToolHide = results[i].topRightToolHide;
|
|
896
|
+
}
|
|
919
897
|
}
|
|
920
898
|
store.set(i, results[i]);
|
|
921
899
|
}
|
|
@@ -1707,6 +1685,9 @@ export default {
|
|
|
1707
1685
|
this.reset = true;
|
|
1708
1686
|
});
|
|
1709
1687
|
break;
|
|
1688
|
+
case 'index':
|
|
1689
|
+
util.win.open(this.doorIndex, '_self');
|
|
1690
|
+
break;
|
|
1710
1691
|
case 'user':
|
|
1711
1692
|
this.showUserInfo = true;
|
|
1712
1693
|
break;
|
|
@@ -0,0 +1,444 @@
|
|
|
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
|
|
13
|
+
label="综合"
|
|
14
|
+
name="0"
|
|
15
|
+
v-loading="loading"
|
|
16
|
+
element-loading-background="rgba(0, 0, 0, 0.01)"
|
|
17
|
+
element-loading-text="加载中..."
|
|
18
|
+
>
|
|
19
|
+
<el-scrollbar class="es-scrollbar">
|
|
20
|
+
<template v-for="(item, index) in types">
|
|
21
|
+
<div
|
|
22
|
+
v-if="item.records && item.records.length"
|
|
23
|
+
class="es-public-search-content"
|
|
24
|
+
:key="item.id"
|
|
25
|
+
>
|
|
26
|
+
<div class="es-public-search-title">{{ item.name }}</div>
|
|
27
|
+
<ul class="es-public-search-list">
|
|
28
|
+
<li
|
|
29
|
+
v-for="ele in item.records.slice(0, 3)"
|
|
30
|
+
class="es-public-search-list-item"
|
|
31
|
+
:key="ele.id"
|
|
32
|
+
@click="handleClick(ele, item)"
|
|
33
|
+
>
|
|
34
|
+
<es-icon
|
|
35
|
+
class="es-public-search-item-icon"
|
|
36
|
+
v-bind="getIcon(ele, item)"
|
|
37
|
+
:style="setStyle(ele, index)"
|
|
38
|
+
></es-icon>
|
|
39
|
+
<div class="es-public-search-item-name">
|
|
40
|
+
{{ ele.name || ele.title || ele.text }}
|
|
41
|
+
</div>
|
|
42
|
+
<div class="es-public-search-item-texts" v-if="ele.summary">
|
|
43
|
+
{{ ele.summary }}
|
|
44
|
+
</div>
|
|
45
|
+
<div class="es-public-search-item-texts">
|
|
46
|
+
<template v-if="Array.isArray(ele.infos || ele.footer)">
|
|
47
|
+
<span
|
|
48
|
+
v-for="(text, idx) in ele.infos || ele.footer"
|
|
49
|
+
class="es-public-search-item-text"
|
|
50
|
+
:key="idx"
|
|
51
|
+
>{{ text }}</span
|
|
52
|
+
>
|
|
53
|
+
</template>
|
|
54
|
+
<template v-else>{{ ele.infos || ele.footer }}</template>
|
|
55
|
+
</div>
|
|
56
|
+
</li>
|
|
57
|
+
</ul>
|
|
58
|
+
<div class="es-public-search-more">
|
|
59
|
+
<span
|
|
60
|
+
class="es-public-search-more-text"
|
|
61
|
+
@click="handleTabs(item, index)"
|
|
62
|
+
>在<span class="es-public-search-more-quote">{{
|
|
63
|
+
item.name
|
|
64
|
+
}}</span
|
|
65
|
+
>中搜索全部</span
|
|
66
|
+
>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
70
|
+
</el-scrollbar>
|
|
71
|
+
</el-tab-pane>
|
|
72
|
+
<el-tab-pane
|
|
73
|
+
v-for="(item, index) in types"
|
|
74
|
+
lazy
|
|
75
|
+
:label="item.name"
|
|
76
|
+
:name="item.id || String(index + 1)"
|
|
77
|
+
:key="item.id"
|
|
78
|
+
v-loading="loadings[item.id || String(index)]"
|
|
79
|
+
element-loading-background="rgba(0, 0, 0, 0.01)"
|
|
80
|
+
element-loading-text="加载中..."
|
|
81
|
+
v-show="hides.includes(item.name)"
|
|
82
|
+
>
|
|
83
|
+
<el-scrollbar
|
|
84
|
+
class="es-scrollbar es-public-search-scrollbar"
|
|
85
|
+
:infinite-scroll="
|
|
86
|
+
() => {
|
|
87
|
+
handleSearchd(item, index);
|
|
88
|
+
}
|
|
89
|
+
"
|
|
90
|
+
:infinite-scroll-disabled="disabled"
|
|
91
|
+
:infinite-scroll-immediate="false"
|
|
92
|
+
>
|
|
93
|
+
<div class="es-public-search-info">
|
|
94
|
+
{{ item.totalCount }}条与"<span
|
|
95
|
+
class="es-public-search-more-quote"
|
|
96
|
+
>{{ keyWords }}</span
|
|
97
|
+
>"相关的搜索结果
|
|
98
|
+
</div>
|
|
99
|
+
<ul class="es-public-search-lists">
|
|
100
|
+
<li
|
|
101
|
+
v-for="ele in item.records"
|
|
102
|
+
class="es-public-search-list-item"
|
|
103
|
+
:key="ele.id"
|
|
104
|
+
@click="handleClick(ele, item)"
|
|
105
|
+
>
|
|
106
|
+
<es-icon
|
|
107
|
+
class="es-public-search-item-icon"
|
|
108
|
+
v-bind="getIcon(ele, item)"
|
|
109
|
+
:style="setStyle(ele, index)"
|
|
110
|
+
></es-icon>
|
|
111
|
+
<div class="es-public-search-item-name">
|
|
112
|
+
{{ ele.name || ele.title || ele.text }}
|
|
113
|
+
</div>
|
|
114
|
+
<div class="es-public-search-item-texts" v-if="ele.summary">
|
|
115
|
+
{{ ele.summary }}
|
|
116
|
+
</div>
|
|
117
|
+
<div class="es-public-search-item-texts">
|
|
118
|
+
<template v-if="Array.isArray(ele.infos || ele.footer)">
|
|
119
|
+
<span
|
|
120
|
+
v-for="(text, idx) in ele.infos || ele.footer"
|
|
121
|
+
class="es-public-search-item-text"
|
|
122
|
+
:key="idx"
|
|
123
|
+
>{{ text }}</span
|
|
124
|
+
>
|
|
125
|
+
</template>
|
|
126
|
+
<template v-else>{{ ele.infos || ele.footer }}</template>
|
|
127
|
+
</div>
|
|
128
|
+
</li>
|
|
129
|
+
</ul>
|
|
130
|
+
<p
|
|
131
|
+
class="es-public-search-no-more"
|
|
132
|
+
v-if="noMore[item.id || String(index)]"
|
|
133
|
+
>
|
|
134
|
+
没有更多了
|
|
135
|
+
</p>
|
|
136
|
+
</el-scrollbar>
|
|
137
|
+
</el-tab-pane>
|
|
138
|
+
</el-tabs>
|
|
139
|
+
</div>
|
|
140
|
+
</template>
|
|
141
|
+
|
|
142
|
+
<script>
|
|
143
|
+
import util from 'eoss-ui/src/utils/util';
|
|
144
|
+
import { searchType } from 'eoss-ui/src/config/api.js';
|
|
145
|
+
import { debounce } from 'throttle-debounce';
|
|
146
|
+
export default {
|
|
147
|
+
name: 'Search',
|
|
148
|
+
components: {},
|
|
149
|
+
props: {
|
|
150
|
+
menuIcon: {
|
|
151
|
+
type: String,
|
|
152
|
+
default: 'es-icon-application'
|
|
153
|
+
},
|
|
154
|
+
menus: {
|
|
155
|
+
type: Array,
|
|
156
|
+
default() {
|
|
157
|
+
return [];
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
apps: {
|
|
161
|
+
type: Array,
|
|
162
|
+
default() {
|
|
163
|
+
return [];
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
searchType: {
|
|
167
|
+
type: String,
|
|
168
|
+
default: searchType
|
|
169
|
+
},
|
|
170
|
+
pageSize: {
|
|
171
|
+
type: Number,
|
|
172
|
+
default: 10
|
|
173
|
+
},
|
|
174
|
+
hides: {
|
|
175
|
+
type: Array,
|
|
176
|
+
default() {
|
|
177
|
+
return [];
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
data() {
|
|
182
|
+
return {
|
|
183
|
+
icons: {
|
|
184
|
+
ppt: 'es-icon-ppt',
|
|
185
|
+
png: 'es-icon-picture',
|
|
186
|
+
gif: 'es-icon-picture',
|
|
187
|
+
jpg: 'es-icon-picture',
|
|
188
|
+
xls: 'es-icon-excel',
|
|
189
|
+
xlsx: 'es-icon-excel',
|
|
190
|
+
docx: 'es-icon-word',
|
|
191
|
+
doc: 'es-icon-word',
|
|
192
|
+
rar: 'es-icon-zip',
|
|
193
|
+
zip: 'es-icon-zip',
|
|
194
|
+
txt: 'es-icon-txt',
|
|
195
|
+
ipa: 'es-icon-ios',
|
|
196
|
+
apk: 'es-icon-android',
|
|
197
|
+
mp4: 'es-icon-video',
|
|
198
|
+
avi: 'es-icon-video',
|
|
199
|
+
mp3: 'es-icon-audioo',
|
|
200
|
+
wma: 'es-icon-audioo',
|
|
201
|
+
pdf: 'es-icon-pdf'
|
|
202
|
+
},
|
|
203
|
+
colors: [
|
|
204
|
+
'#46D3BA',
|
|
205
|
+
'#2591F7',
|
|
206
|
+
'#40C274',
|
|
207
|
+
'#E34D59',
|
|
208
|
+
'#FF9C52',
|
|
209
|
+
'#17C27B'
|
|
210
|
+
],
|
|
211
|
+
keyWords: '',
|
|
212
|
+
active: '0',
|
|
213
|
+
types: [],
|
|
214
|
+
lists: [],
|
|
215
|
+
loadings: {},
|
|
216
|
+
noMore: {},
|
|
217
|
+
isLoading: false
|
|
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);
|
|
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
|
+
if (keyWords) {
|
|
315
|
+
let item = this.types[i];
|
|
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);
|
|
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) {
|
|
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
|
+
data: {
|
|
385
|
+
pageNum: obj.pageNum + 1,
|
|
386
|
+
pageSize: this.pageSize,
|
|
387
|
+
keyWords: this.keyWords
|
|
388
|
+
}
|
|
389
|
+
})
|
|
390
|
+
.then((res) => {
|
|
391
|
+
this.$set(this.loadings, obj.id || String(index), false);
|
|
392
|
+
let flag = false;
|
|
393
|
+
for (let i in this.loadings) {
|
|
394
|
+
if (this.loadings[i]) {
|
|
395
|
+
flag = true;
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
if (!flag) {
|
|
400
|
+
this.isLoading = false;
|
|
401
|
+
}
|
|
402
|
+
if (res.rCode == 0) {
|
|
403
|
+
let { results } = res;
|
|
404
|
+
obj.totalCount = results.totalCount;
|
|
405
|
+
obj.pageCount = results.pageCount;
|
|
406
|
+
obj.pageNum = results.pageNum;
|
|
407
|
+
obj.records = obj.records.concat(results.records);
|
|
408
|
+
this.$set(
|
|
409
|
+
this.noMore,
|
|
410
|
+
obj.id || String(index),
|
|
411
|
+
results.pageNum >= results.pageCount
|
|
412
|
+
);
|
|
413
|
+
} else {
|
|
414
|
+
this.types[index].records = [];
|
|
415
|
+
this.types[index].totalCount = 0;
|
|
416
|
+
this.types[index].pageCount = 1;
|
|
417
|
+
this.types[index].pageNum = 0;
|
|
418
|
+
this.$set(this.loadings, obj.id || String(index), false);
|
|
419
|
+
this.$set(this.noMore, obj.id || String(index), true);
|
|
420
|
+
}
|
|
421
|
+
})
|
|
422
|
+
.catch((err) => {
|
|
423
|
+
this.isLoading = false;
|
|
424
|
+
this.types[index].records = [];
|
|
425
|
+
this.types[index].totalCount = 0;
|
|
426
|
+
this.types[index].pageCount = 1;
|
|
427
|
+
this.types[index].pageNum = 0;
|
|
428
|
+
this.$set(this.loadings, obj.id || String(index), false);
|
|
429
|
+
this.$set(this.noMore, obj.id || String(index), true);
|
|
430
|
+
if (err.message && err.message !== 'canceled') {
|
|
431
|
+
this.$message.error(err.message);
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
handleTabs(res, index) {
|
|
437
|
+
this.active = res.id || String(index + 1);
|
|
438
|
+
},
|
|
439
|
+
handleClick(res, parent) {
|
|
440
|
+
this.$emit('select', res, parent);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
</script>
|