@lambo-design/pro-layout 1.0.0-beta.207 → 1.0.0-beta.209

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design/pro-layout",
3
- "version": "1.0.0-beta.207",
3
+ "version": "1.0.0-beta.209",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -10,8 +10,8 @@
10
10
  "registry": "https://registry.npmjs.org/"
11
11
  },
12
12
  "devDependencies": {
13
- "@lambo-design/shared": "^1.0.0-beta.115",
14
- "@lambo-design/core": "^4.7.1-beta.118"
13
+ "@lambo-design/core": "^4.7.1-beta.118",
14
+ "@lambo-design/shared": "^1.0.0-beta.115"
15
15
  },
16
16
  "scripts": {}
17
17
  }
@@ -4,7 +4,7 @@
4
4
  <LamboProTrigger></LamboProTrigger>
5
5
  </div>
6
6
  <div class="logo-box">
7
- <LamboProLogo @clickLogo="handleClick"></LamboProLogo>
7
+ <LamboProLogo></LamboProLogo>
8
8
  </div>
9
9
  <div class="nav-box">
10
10
  <LamboProNav></LamboProNav>
@@ -66,9 +66,6 @@ export default {
66
66
  FastSearch
67
67
  },
68
68
  methods:{
69
- handleClick(){
70
- this.$emit('clickLogo')
71
- },
72
69
  initListener(){
73
70
  Bus.$on('system-info',(data)=>{
74
71
  this.initSystem(data)
@@ -91,9 +91,8 @@ export default {
91
91
 
92
92
  },
93
93
  methods: {
94
-
95
94
  handleClick(){
96
- this.$emit('clickLogo')
95
+ Bus.$emit('click-logo')
97
96
  },
98
97
  initListener(){
99
98
  Bus.$on('system-info',(data)=>{
@@ -61,9 +61,11 @@ export default {
61
61
  Bus.$off('change-app')
62
62
  },
63
63
  initSystemInfo(data) {
64
- this.topMenuNum = data.topMenu ? data.topMenu : 4;
65
- this.acceptAppId = data.acceptAppId ? data.acceptAppId : '';
66
- this.initNav(this.navList)
64
+ if (data) {
65
+ this.topMenuNum = data.topMenu ? data.topMenu : 4;
66
+ this.acceptAppId = data.acceptAppId ? data.acceptAppId : '';
67
+ this.initNav(this.navList)
68
+ }
67
69
  },
68
70
  initNav(data) {
69
71
  if (data.toString() === this.navList.toString() && this.topMenuNum === this.lastTopMenuNum) {
@@ -113,7 +115,9 @@ export default {
113
115
  })
114
116
  },
115
117
  acceptAppId(val) {
116
- this.selectApp(val)
118
+ if (val) {
119
+ this.selectApp(val)
120
+ }
117
121
  }
118
122
  },
119
123
  created() {
@@ -0,0 +1,271 @@
1
+ <template>
2
+ <div class="search-fast-con">
3
+ <div class="search-fast-con-side" >
4
+ <div class="sideInput" @click="handleSideClick">
5
+ <Input v-if="searchType === 0" v-model="searchText" clearable id="modalInput" placeholder="搜索菜单" font-size="8px"
6
+ @on-change="handleInput" :border="false" @on-blur="searchSideModal= false">
7
+ <template #prefix>
8
+ <Icon type="ios-search" size="17"/>
9
+ </template>
10
+ </Input>
11
+ </div>
12
+ </div>
13
+ <Modal v-model="searchSideModal" class="search-fast-con-side-modal" footer-hide :closable="false" :mask="false"
14
+ scrollable :styles="{width: '255px'}" id="SideModalId" >
15
+ <div v-if="spinShow" style="height: 300px;font-size: 19px;">
16
+ <Spin size="large" :show="spinShow">
17
+ <Icon type="ios-loading" size=18 class="search-spin-icon-load"></Icon>
18
+ <div>加载中</div>
19
+ </Spin>
20
+ </div>
21
+ <div v-else class="search-content">
22
+ <div v-for="(item,index) in menuData" :key="index" >
23
+ <div class="menu-side-style" @click="handleSelect(item)" @mouseenter="handleMouseEnter(index)" @mouseleave="handleMouseLeave(index)">
24
+ <div :style="getScrollingStyle(item.label)" class="text" :class="{ 'scrolling': isHovered[index] && shouldScroll(item.label) }">
25
+ <Icon :type="item.icon" style="margin-left: 10.6px" size="13"></Icon>
26
+ <span style="margin-left: 12.6px">{{ item.label }}</span>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ <div v-if="menuData.length === 0">
31
+ <span style="display: flex;justify-content: center;align-items: center;color: #FFFFFF;font-size: 15px">暂无数据</span>
32
+ </div>
33
+ </div>
34
+ </Modal>
35
+ </div>
36
+ </template>
37
+ <script>
38
+ import Bus from "@lambo-design/shared/utils/bus";
39
+ import {deepCopy} from "@lambo-design/shared/utils/assist";
40
+ export default {
41
+ name: "FastSearch",
42
+ props: {
43
+ searchType: '',
44
+ menuList: {
45
+ type: Array,
46
+ default: () => []
47
+ },
48
+ },
49
+ data () {
50
+ return {
51
+ searchText:'',
52
+ appId:'',
53
+ searchTopText:'',
54
+ option: [],
55
+ menuData:[],
56
+ noticeData:[],
57
+ isHovered: [],
58
+ select:'',
59
+ searchTopModal:false,
60
+ searchSideModal:false,
61
+ showSearchIcon:true,
62
+ maxWidth: 190,
63
+ spinShow:false,
64
+ spinShowTop1:false,
65
+ spinShowTop2:false,
66
+ originMenuList: [],
67
+ searchMenuList: []
68
+ }
69
+ },
70
+ methods:{
71
+ initListener(){
72
+ Bus.$on('menu-list',(data)=>{
73
+ this.initMenu(data)
74
+ });
75
+ },
76
+ destroyListener(){
77
+ Bus.$off('menu-list')
78
+ },
79
+ initMenu(data){
80
+ this.originMenuList = deepCopy(data);
81
+ this.searchMenuList = this.originMenuList.filter(menuItem => menuItem.type === 2)
82
+ .map(menuItem => {
83
+ // 检查menuItem对象的icon属性是否为'icon'或'1'
84
+ if (!menuItem.icon) {
85
+ // 如果是,则修改icon属性为'ios-folder-open-outline'
86
+ menuItem.icon = 'ios-folder-open-outline';
87
+ }
88
+ return menuItem;
89
+ });
90
+ },
91
+ handleSelect(item){
92
+ this.$emit('on-select', item.name,item.uri,item.pid)
93
+ this.searchSideModal = false
94
+ },
95
+ handleInput() {
96
+ // 使用 filter 方法找到所有匹配的菜单项
97
+ const regex = new RegExp(this.searchText, "i");
98
+ this.menuData = this.searchMenuList.filter(menuItem => {
99
+ return menuItem.label.match(regex);
100
+ });
101
+ },
102
+ handleSideClick(){
103
+ this.searchSideModal = true
104
+ this.handleInput()
105
+ },
106
+ handleMouseEnter(index) {
107
+ this.$set(this.isHovered, index, true); // 将当前菜单项设置为被悬停状态
108
+ },
109
+ handleMouseLeave(index) {
110
+ this.$set(this.isHovered, index, false); // 将当前菜单项设置为非悬停状态
111
+ },
112
+ shouldScroll(text) {
113
+ const span = document.createElement("span");
114
+ span.style.fontSize = "15px"; // 根据实际情况设置字体大小
115
+ span.textContent = text;
116
+ document.body.appendChild(span);
117
+ const shouldScroll = span.offsetWidth > this.maxWidth;
118
+ document.body.removeChild(span);
119
+ return shouldScroll;
120
+ },
121
+ getScrollingStyle(text) {
122
+ const span = document.createElement("span");
123
+ span.style.fontSize = "15px"; // 根据实际情况设置字体大小
124
+ span.textContent = text;
125
+ document.body.appendChild(span);
126
+ let scrollDistance = span.offsetWidth - this.maxWidth;
127
+ document.body.removeChild(span);
128
+ if (scrollDistance > 0) {
129
+ scrollDistance += 15
130
+ return {
131
+ "--scroll-distance": `-${scrollDistance}px`,
132
+ };
133
+ }
134
+ else{
135
+ return{
136
+ "--scroll-duration": `0s`,
137
+ }
138
+ }
139
+ }
140
+ },
141
+ created(){
142
+ this.initListener();
143
+ },
144
+ beforeDestroy(){
145
+ this.destroyListener();
146
+ }
147
+ }
148
+ </script>
149
+
150
+ <style lang="less" scoped>
151
+ @import "@lambo-design/core/src/styles/default.less";
152
+ .search-fast-con{
153
+ .search-fast-con-side{
154
+ width: 97%;
155
+ position: absolute;
156
+ top: 0px;
157
+ z-index: 2000;
158
+ .sideInput{
159
+ width: 221px;
160
+ transform: translateX(-13px);
161
+ }
162
+ .ivu-input{
163
+ font-size: 13px;
164
+ margin-top: -4px;
165
+ width: 228.5px;
166
+ height: 40px;
167
+ font-weight: 400;
168
+ border: none;
169
+ background-color: var(--legend-color ,@_legend-color);//修改这里
170
+ text-align:left; /* 确保文本默认左对齐 */
171
+ color: var(--avatar-color ,@_avatar-color );
172
+ padding-right: 99px;
173
+ padding-left: 58px;
174
+ ::placeholder{
175
+ font-size: 13px;
176
+ font-family: Microsoft YaHei;
177
+ font-weight: 400;
178
+ color: var(--avatar-color ,@_avatar-color ) !important;;
179
+ }
180
+ }
181
+ .ivu-icon-ios-search:before {
182
+ margin-right: -54px; /* 向右移动10像素 */
183
+ color: var(--avatar-color ,@_avatar-color );
184
+ line-height: 1.6
185
+ }
186
+ }
187
+ .search-fast-con-side-modal {
188
+ .search-spin-icon-load{
189
+ animation: ani-search-spin 1s linear infinite;
190
+ }
191
+ .ivu-modal{
192
+ padding-top: 1px;
193
+ margin-left: 0px;
194
+ margin-top: 1px;
195
+ .ivu-modal-content{
196
+ background-color: var(--menu-dark-active-bg ,@_menu-dark-active-bg );
197
+ width: 218px;
198
+ margin-top: -18px;
199
+ height: 270px;
200
+ .ivu-modal-body{
201
+ padding: 0px 16px 16px 16px;
202
+ .search-content {
203
+ //padding-top: 6px;
204
+ padding-left: 10px;
205
+ height: 270px;
206
+ width: 211px;
207
+ margin-left: -13px;
208
+ overflow-x: hidden;
209
+ overflow-y: auto;
210
+ background-color: var(--menu-dark-active-bg ,@menu-dark-active-bg );
211
+ -ms-overflow-style: none; /* Internet Explorer 10+ */
212
+ scrollbar-width: none; /* Firefox */
213
+ &::-webkit-scrollbar {
214
+ display: none; /* Chrome, Safari 和 Opera */
215
+ }
216
+ .menu-side-style{
217
+ font-size: 14px;
218
+ font-family: Microsoft YaHei;
219
+ font-weight: 400;
220
+ width: 200px;
221
+ color:#EBEBEB;
222
+ margin-bottom: 8px;
223
+ white-space: nowrap;
224
+ text-overflow: ellipsis;
225
+ .text {
226
+ display: inline-block;
227
+ &.scrolling {
228
+ animation: scrollText linear infinite;
229
+ animation-duration: 2s; /* 调整滚动速度和持续时间 */
230
+ }
231
+ }
232
+ &:hover {
233
+ overflow: visible;
234
+ cursor: pointer;
235
+ color: red;
236
+ .text {
237
+ animation-play-state: running;
238
+ }
239
+ }
240
+ }
241
+ }
242
+ }
243
+ }
244
+ }
245
+ }
246
+ }
247
+ </style>
248
+ <style lang="less">
249
+ .v-transfer-dom ::-webkit-scrollbar {
250
+ display: none; /* Chrome, Safari 和 Opera */
251
+ overflow: hidden !important;
252
+ }
253
+ .v-transfer-dom{
254
+ -ms-overflow-style: none; /* Internet Explorer 10+ */
255
+ scrollbar-width: none; /* Firefox */
256
+ overflow: hidden !important;
257
+ }
258
+ @keyframes scrollText {
259
+ 0% {
260
+ transform: translateX(0);
261
+ }
262
+ 100% {
263
+ transform: translateX(var(--scroll-distance, 0)); /* 调整滚动的距离 */
264
+ }
265
+ }
266
+ @keyframes ani-search-spin {
267
+ from { transform: rotate(0deg);}
268
+ 50% { transform: rotate(180deg);}
269
+ to { transform: rotate(360deg);}
270
+ }
271
+ </style>
@@ -32,13 +32,13 @@
32
32
  </template>
33
33
  </Menu>
34
34
 
35
- <ProLayoutOtherMenu :collapsed="collapsed"></ProLayoutOtherMenu>
36
- <FastSearch
35
+ <ProLayoutOtherMenu :collapsed="collapsed" @menu-click="handleSelect"></ProLayoutOtherMenu>
36
+ <ProLayoutSiderSearch
37
37
  v-show="!collapsed"
38
38
  style="margin-right: 35px; margin-left: 1px; padding-top: 1px"
39
39
  :searchType="0"
40
- @on-select="handleSelect1"
41
- ></FastSearch>
40
+ @on-select="handleSelect"
41
+ ></ProLayoutSiderSearch>
42
42
  <div v-show="collapsed" :list="menuList" class="menu-collapsed" >
43
43
  <template v-for="item in menuList">
44
44
  <ProLayoutSiderCollapsedMenu v-if="item.children && item.children.length > 0" :key="`drop-menu-${item.name}`"
@@ -69,7 +69,7 @@ import {deepCopy} from "@lambo-design/shared/utils/assist";
69
69
  import generatorMenuList from "@lambo-design/shared/utils/menu/index";
70
70
  import sider from '../utils/sider'
71
71
  import ProLayoutOtherMenu from "./pro-layout-other-menu";
72
- import FastSearch from "./search-fast";
72
+ import ProLayoutSiderSearch from "./pro-layout-sider-search";
73
73
  import ProLayoutSiderMenuItem from './pro-layout-sider-menu-item'
74
74
  import ProLayoutSiderCollapsedMenu from './pro-layout-sider-collapsed-menu'
75
75
  import {
@@ -78,7 +78,6 @@ import {
78
78
  tagExists,isOpenBlank
79
79
  } from "@lambo-design/shared/utils/platform";
80
80
  import config from "@lambo-design/shared/config/config";
81
- import ajax from "@lambo-design/shared/utils/ajax";
82
81
 
83
82
  export default {
84
83
  name: "pro-layout-sider",
@@ -86,7 +85,7 @@ export default {
86
85
  ProLayoutSiderMenuItem,
87
86
  ProLayoutSiderCollapsedMenu,
88
87
  ProLayoutOtherMenu,
89
- FastSearch
88
+ ProLayoutSiderSearch
90
89
  },
91
90
  props:{
92
91
  serverContext: {
@@ -232,49 +231,7 @@ export default {
232
231
  this.activeName = menu.name; // 设置当前菜单为激活状态
233
232
  }
234
233
  }
235
- // this.$emit('on-select', name,uri,pid)
236
234
  },
237
-
238
- handleSelect1(name, uri, pid) {
239
- let menu = null;
240
-
241
- if (name.indexOf("isTurnByHref_") > -1) {
242
- name = name.replace("isTurnByHref_","");
243
- menu = filterMenuUri(this.menuList,name);
244
- } else {
245
- menu = filterMenuName(this.menuList,name);
246
- }
247
-
248
- // 处理菜单的展开逻辑,与 uri 是否为空无关
249
- if (menu && menu.meta && Array.isArray(menu.meta.crumbs)) {
250
- let parentMenu = menu.meta.crumbs[0];
251
- this.$set(this, 'selectedTopParent', parentMenu.name);
252
- } else {
253
- this.$set(this, 'selectedTopParent', menu.name);
254
- }
255
-
256
- // 如果 uri 为空,则不进行路由跳转和打开新标签的操作
257
- if (!uri) {
258
- // 根据 pid 判断是展开父菜单还是同时展开父菜单和当前菜单
259
- if (pid === 0) {
260
- // 如果 pid 为 0,表示是最外层菜单
261
- this.openedNames = [this.getNameOrHref(menu)]; // 设置最外层菜单为展开状态
262
- } else {
263
- // 如果 pid 不等于 0,查找并打开对应的最外层父菜单
264
- this.openedNames = [this.getTopParent(menu)]; // 设置最外层父菜单为展开状态
265
- this.activeName = menu.name; // 设置当前菜单为激活状态
266
- }
267
- } else {
268
- // 如果 uri 不为空,则可能需要进行路由跳转和打开新标签的操作
269
- // 这里的逻辑取决于你的路由跳转和标签页打开的实现,需要你根据实际情况进行调整
270
- this.openedNames = [this.getTopParent(menu)]; // 设置最外层父菜单为展开状态
271
- this.activeName = menu.name; // 设置当前菜单为激活状态
272
- this.$router.push(uri);
273
-
274
- }
275
- },
276
-
277
-
278
235
  getTopParent(menu) {
279
236
  return menu.parent ? this.getTopParent(menu.parent) : menu.name;
280
237
  },
@@ -39,6 +39,7 @@ export default {
39
39
  menuList: [],
40
40
  currentName: '',
41
41
  currentItem: {},
42
+ collectMenuList: [],
42
43
  isFullScreen:false,
43
44
  isCollected:false,
44
45
  rightTopOptButtonList: ['collect','fullScreen'],
@@ -104,7 +105,7 @@ export default {
104
105
  }
105
106
  },
106
107
  initCollectMenu(data){
107
- this.collectMenuList = data;
108
+ this.collectMenuList = deepCopy(data);
108
109
  },
109
110
  changeCollectMenu(){
110
111
  this.isCollected = false
@@ -115,13 +116,7 @@ export default {
115
116
  Bus.$emit('user-action', name)
116
117
  },
117
118
  collectEvent(){
118
- let data = {
119
- meta: {
120
- appId: this.currentItem.appId
121
- },
122
- permissionId: this.currentItem.permissionId
123
- }
124
- Bus.$emit('toggle-collect-menu',!this.isCollected,data)
119
+ Bus.$emit('toggle-collect-menu',!this.isCollected,this.currentItem)
125
120
  },
126
121
  handleKeyPress(event){
127
122
  // 按下 F11 键时触发全屏切换
package/src/index.vue CHANGED
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <i-layout class="pro-layout" :class="layoutClass">
3
3
  <i-header class="pro-layout-header">
4
- <LamboProLayoutHeader @clickLogo="handleClick" @on-select="handleSelect"></LamboProLayoutHeader>
4
+ <LamboProLayoutHeader></LamboProLayoutHeader>
5
5
  </i-header>
6
6
  <i-layout>
7
7
  <i-sider
@@ -129,12 +129,6 @@ export default {
129
129
  }
130
130
  },
131
131
  methods: {
132
- handleClick(){
133
- this.$emit('clickLogo')
134
- },
135
- handleSelect(name){
136
- this.$emit('on-select',name)
137
- },
138
132
  initListener(){
139
133
  Bus.$on('trigger-change',(data)=>{
140
134
  this.triggerChange(data)
@@ -160,6 +154,9 @@ export default {
160
154
  Bus.$on('toggle-collect-menu',(actionType,data) => {
161
155
  this.toggleCollectMenu(actionType,data)
162
156
  })
157
+ Bus.$on('click-logo',()=>{
158
+ this.clickLogo();
159
+ })
163
160
  },
164
161
  destroyListener(){
165
162
  Bus.$off('trigger-change')
@@ -170,6 +167,7 @@ export default {
170
167
  Bus.$off('delete-history-menu')
171
168
  Bus.$off('delete-collect-menu')
172
169
  Bus.$off('toggle-collect-menu')
170
+ Bus.$off('click-logo')
173
171
  },
174
172
  initEmit(){
175
173
  //在这里改this.menuList
@@ -264,6 +262,9 @@ export default {
264
262
  },
265
263
  toggleCollectMenu(actionType,data){
266
264
  this.$emit('toggle-collect-menu',actionType,data);
265
+ },
266
+ clickLogo(){
267
+ this.$emit('click-logo')
267
268
  }
268
269
  },
269
270
  mounted(){
@@ -1,590 +0,0 @@
1
- <template>
2
- <div class="search-fast-con">
3
- <!-- <div class="search-fast-con-top" >-->
4
- <!-- <Tooltip v-if="searchType === 1" content="搜索菜单" placement="bottom">-->
5
- <!-- <Icon v-show="showSearchIcon" type="ios-search-outline" :size="23" @click.native="handleIconClick" id="searchIcon"></Icon>-->
6
- <!-- </Tooltip>-->
7
- <!-- <transition name="slide">-->
8
- <!-- <div class="topInput" id="modalTopInput" v-show="showTopInput" @click="handleTopClick">-->
9
- <!-- <Input v-model="searchTopText" clearable placeholder="搜索菜单" ref="topInput"-->
10
- <!-- :border="false" style="width: 200px" @on-change="handleTopInput" @on-blur="handleTopBlur">-->
11
- <!-- <template #prefix>-->
12
- <!-- <Icon type="ios-search" size="23"/>-->
13
- <!-- </template>-->
14
- <!-- </Input>-->
15
- <!-- </div>-->
16
- <!-- </transition>-->
17
- <!-- <Modal-->
18
- <!-- v-model="searchTopModal" class="search-fast-con-modal" footer-hide :closable="false" :mask="false" scrollable id="TopModalId"-->
19
- <!-- :styles="{top: '55px',width: '350px'}">-->
20
- <!-- <div class="sideCloseIcon" @click="handleCloseTopModal" style="text-align: right;margin-right: -6px;margin-top: -2px;padding-bottom: 3px">-->
21
- <!-- <Icon type="ios-close-circle" size="18" />-->
22
- <!-- </div>-->
23
- <!-- <div class="modal-block1">-->
24
- <!-- <div class="modal-title">-->
25
- <!-- <Icon type="ios-apps-outline" size="19" color="red"/>-->
26
- <!-- <span style="margin-left: 3px;font-size: 18px">菜单</span>-->
27
- <!-- </div>-->
28
- <!-- <div v-if="spinShowTop1">-->
29
- <!-- <Spin size="large" v-if="spinShowTop1" :show="spinShowTop1">-->
30
- <!-- <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>-->
31
- <!-- <div>加载中</div>-->
32
- <!-- </Spin>-->
33
- <!-- </div>-->
34
- <!-- <div v-else class="modal-content">-->
35
- <!-- <div v-for="(item,index) in menuData1" :key="index" >-->
36
- <!-- <div class="menu-side-style1" @click="handleSelect1(item)" @mouseenter="handleMouseEnter(index)" @mouseleave="handleMouseLeave(index)">-->
37
- <!-- <div :style="getScrollingStyle(item.label)" class="text" :class="{ 'scrolling': isHovered[index] && shouldScroll(item.label) }">-->
38
- <!-- <Icon :type="item.icon" />-->
39
- <!-- <span style="margin-left: 3px">{{ item.label }}</span>-->
40
- <!-- </div>-->
41
- <!-- </div>-->
42
- <!-- </div>-->
43
- <!-- <div v-if="menuData1.length === 0">-->
44
- <!-- <span style="display: flex;justify-content: center;align-items: center;color: black">暂无数据</span>-->
45
- <!-- </div>-->
46
- <!-- </div>-->
47
- <!-- </div>-->
48
- <!-- </Modal>-->
49
- <!-- </div>-->
50
-
51
-
52
-
53
- <div class="search-fast-con-side" >
54
- <div class="sideInput" @click="handleSideClick">
55
- <Input v-if="searchType === 0" v-model="searchText" clearable id="modalInput" placeholder="搜索菜单" font-size="8px"
56
- @on-change="handleInput" :border="false" @on-blur="searchSideModal= false">
57
- <template #prefix>
58
- <Icon type="ios-search" size="17"/>
59
- </template>
60
- </Input>
61
- </div>
62
- <Modal v-model="searchSideModal" class="search-fast-con-side-modal" footer-hide :closable="false" :mask="false"
63
- scrollable :styles="{width: '255px'}" id="SideModalId" >
64
- <div class="sideCloseIcon" @click="handleCloseModal" style="text-align: right;margin-right: -6px;margin-top: -2px;padding-bottom: 3px">
65
- <Icon type="ios-close-circle" size="18" />
66
- </div>
67
- <div v-if="spinShow" style="height: 300px;font-size: 19px;">
68
- <Spin size="large" :show="spinShow">
69
- <Icon type="ios-loading" size=18 class="demo-spin-icon-load"></Icon>
70
- <div>加载中</div>
71
- </Spin>
72
- </div>
73
- <div v-else class="modal1-content">
74
- <div v-for="(item,index) in menuData" :key="index" >
75
- <div class="menu-side-style" @click="handleSelect(item)" @mouseenter="handleMouseEnter(index)" @mouseleave="handleMouseLeave(index)">
76
- <div :style="getScrollingStyle(item.label)" class="text" :class="{ 'scrolling': isHovered[index] && shouldScroll(item.label) }">
77
- <Icon :type="item.icon" style="margin-left: 10.6px" size="13"></Icon>
78
- <span style="margin-left: 12.6px">{{ item.label }}</span>
79
- </div>
80
- </div>
81
- </div>
82
- <div v-if="menuData.length === 0">
83
- <span style="display: flex;justify-content: center;align-items: center;color: #FFFFFF;font-size: 15px">暂无数据</span>
84
- </div>
85
- </div>
86
- </Modal>
87
- </div>
88
- </div>
89
- </template>
90
- <script>
91
-
92
- import SearchMenu from "./search-list";
93
- import SearchList from "./search-list";
94
- import Bus from "@lambo-design/shared/utils/bus";
95
- import {deepCopy} from "@lambo-design/shared/utils/assist";
96
- import config from "@lambo-design/shared/config/config";
97
- import { mapActions } from 'vuex'
98
- import { debounce } from 'lodash';
99
- //import {getSessionStorage} from '@/libs/platformUtil';
100
- export default {
101
- name: "FastSearch",
102
- components: {SearchList, SearchMenu},
103
- props: {
104
- searchType: '',
105
- menuList: {
106
- type: Array,
107
- default: () => []
108
- },
109
- },
110
- data () {
111
- return {
112
- searchText:'',
113
- appId:'',
114
- searchTopText:'',
115
- showTopInput:false,
116
- option: [],
117
- menuData:[],
118
- menuData1:[],
119
- noticeData:[],
120
- isHovered: [],
121
- select:'',
122
- searchTopModal:false,
123
- searchSideModal:false,
124
- showSearchIcon:true,
125
- maxWidth: 190,
126
- spinShow:false,
127
- spinShowTop1:false,
128
- spinShowTop2:false,
129
- originMenuList: [],
130
- originMenuList1: []
131
- }
132
- },
133
- // mounted() {
134
- // window.addEventListener("click", this.handleOutsideClick);
135
- // },
136
- // beforeDestroy() {
137
- // window.removeEventListener("click", this.handleOutsideClick);
138
- // },
139
- methods:{
140
- initListener(){
141
- Bus.$on('menu-list',(data)=>{
142
- this.initMenu(data)
143
- });
144
- },
145
- destroyListener(){
146
- Bus.$off('menu-list')
147
- },
148
- initMenu(data){
149
- this.originMenuList = deepCopy(data);
150
- this.originMenuList1 = this.originMenuList.filter(menuItem => menuItem.type === 1 || menuItem.type === 2)
151
- .map(menuItem => {
152
- // 检查menuItem对象的icon属性是否为'icon'或'1'
153
- if (menuItem.icon === 'icon' || menuItem.icon === '1' || menuItem.icon === '' || menuItem.icon === '11' || menuItem.icon === '111' || menuItem.icon === '22' ) {
154
- // 如果是,则修改icon属性为'ios-folder-open-outline'
155
- menuItem.icon = 'ios-folder-open-outline';
156
- }
157
- return menuItem;
158
- });
159
- },
160
-
161
- // handleOutsideClick(event) {
162
- // if(!document.getElementById("TopModalId").contains(event.target) && !document.getElementById("modalTopInput").contains(event.target)&&
163
- // !document.getElementById("searchIcon").contains(event.target)){
164
- // let clearButton = event.target.closest(".ivu-icon-ios-close-circle");
165
- // if(clearButton){
166
- // this.searchTopModal =false
167
- // }
168
- // else {
169
- // this.searchTopModal = false;
170
- // this.showTopInput = false;
171
- // setTimeout(() => {
172
- // this.showSearchIcon = true
173
- // }, 525);
174
- // }
175
- // }
176
- // },
177
-
178
- handleSelect(item){
179
- this.$emit('on-select', item.name,item.uri,item.pid)
180
- this.searchSideModal = false
181
- },
182
- // handleSelect1(item){
183
- // this.$emit('on-select', item.name,item.uri,item.pid)
184
- // this.searchTopModal = false
185
- // this.showTopInput = false
186
- // this.showSearchIcon = true
187
- // },
188
- handleNoticeSelect(e,f){
189
- let self = this
190
- self.$router.replace({
191
- name: '消息通知预览',
192
- query: {noticeId: e, confirmed: f,homeFlag:true}
193
- })
194
- self.searchTopModal = false
195
- },
196
-
197
- // handleInput() {
198
- // let self = this;
199
- // // 使用 filter 方法找到所有匹配的菜单项
200
- // const matchedMenuItems = self.originMenuList1.filter(menuItem => {
201
- // return menuItem.label === self.searchText;
202
- // });
203
- // // 选择数组的最后一个元素
204
- // self.menuData = matchedMenuItems.length > 0 ? [matchedMenuItems[matchedMenuItems.length - 1]] : [];
205
- // //console.log('menuData:', self.menuData);
206
- // },
207
- handleInput() {
208
- let self = this;
209
- self.searchSideModal = true
210
- // console.log('originMenuList1',self.originMenuList1)
211
- // 使用 filter 方法找到所有匹配的菜单项
212
- const regex = new RegExp(this.searchText, "i");
213
- self.menuData = self.originMenuList1.filter(menuItem => {
214
- return menuItem.label.match(regex);
215
- });
216
- //console.log('menuData:', self.menuData);
217
- },
218
-
219
- handleTopInput() {
220
- let self = this;
221
- self.searchTopModal = true
222
- // 使用 filter 方法找到所有匹配的菜单项
223
- const regex = new RegExp(this.searchTopText, "i");
224
- self.menuData1 = self.originMenuList1.filter(menuItem => {
225
- return menuItem.label.match(regex);
226
- });
227
- //console.log('menuData:', self.menuData);
228
- },
229
- handleSideClick(){
230
- let self= this
231
- // console.log('searchText:'+self.searchText)
232
- if(self.searchText){
233
- self.searchSideModal = true
234
- }
235
- self.handleInput()
236
- //self.handleSelect(self.menuData[0])
237
- },
238
- handleIconClick(){
239
- let self = this
240
- self.showTopInput = true
241
- self.showSearchIcon = false
242
- self.searchTopModal = false
243
- },
244
- handleTopClick(){
245
- let self= this
246
- if(self.searchTopText){
247
- self.searchTopModal = true
248
- }
249
- self.handleTopInput()
250
- self.showTopInput=true
251
- //self.handleSelect(self.menuData[0])
252
- },
253
- handleTopBlur(){
254
- let self = this
255
- self.searchTopModal = false
256
- self.showTopInput = true;
257
- self.showSearchIcon = true
258
-
259
- },
260
- handleMouseEnter(index) {
261
- this.$set(this.isHovered, index, true); // 将当前菜单项设置为被悬停状态
262
- },
263
- handleMouseLeave(index) {
264
- this.$set(this.isHovered, index, false); // 将当前菜单项设置为非悬停状态
265
- },
266
- shouldScroll(text) {
267
- const span = document.createElement("span");
268
- span.style.fontSize = "15px"; // 根据实际情况设置字体大小
269
- span.textContent = text;
270
- document.body.appendChild(span);
271
- const shouldScroll = span.offsetWidth > this.maxWidth;
272
- document.body.removeChild(span);
273
- return shouldScroll;
274
- },
275
- getScrollingStyle(text) {
276
- const span = document.createElement("span");
277
- span.style.fontSize = "15px"; // 根据实际情况设置字体大小
278
- span.textContent = text;
279
- document.body.appendChild(span);
280
- let scrollDistance = span.offsetWidth - this.maxWidth;
281
- document.body.removeChild(span);
282
- if (scrollDistance > 0) {
283
- scrollDistance += 15
284
- return {
285
- "--scroll-distance": `-${scrollDistance}px`,
286
- };
287
- }
288
- else{
289
- return{
290
- "--scroll-duration": `0s`,
291
- }
292
- }
293
- },
294
- handleCloseModal(){
295
- let self = this
296
- this.searchSideModal = false
297
- },
298
- handleCloseTopModal(){
299
- let self = this
300
- this.searchTopModal = false
301
- }
302
- },
303
- created(){
304
- this.initListener();
305
- },
306
- beforeDestroy(){
307
- this.destroyListener();
308
- }
309
- }
310
- </script>
311
-
312
- <style lang="less" >
313
- @import "@lambo-design/shared/config/themes/blue/blue.less";
314
- @import "@lambo-design/shared/config/themes/default/default.less";
315
- @import "@lambo-design/shared/config/themes/gold/gold.less";
316
- @import "@lambo-design/shared/config/themes/atrovirens/atrovirens.less";
317
- @import "@lambo-design/shared/config/themes/eap/eap.less";
318
- @import "@lambo-design/shared/config/themes/lime/lime.less";
319
- @import "@lambo-design/shared/config/themes/orange/orange.less";
320
- @import "@lambo-design/shared/config/themes/red/red.less";
321
- .search-fast-con-top .ivu-tooltip-rel {
322
- float: left;
323
- height: 64px;
324
- line-height: 56px;
325
- margin-top: 3px;
326
- margin-right: -1000px;
327
- i {
328
- cursor: pointer;
329
- }
330
- }
331
- //.ivu-tooltip-popper[x-placement^="bottom"]{
332
- // margin-top: -1000px;
333
- //}
334
- .search-fast-con-modal .ivu-modal{
335
- width: 350px;
336
- height: 200px;
337
- margin-right: 800px;
338
- margin-left: 500px;
339
- }
340
- .search-fast-con-side-modal .ivu-modal{
341
- padding-top: 1px;
342
- margin-left: 0px;
343
- margin-top: 1px;
344
- }
345
- .search-fast-con-side-modal .ivu-modal-content{
346
- background-color: var(--menu-dark-active-bg ,@menu-dark-active-bg );
347
- width: 218px;
348
- margin-top: -18px;
349
- height: 270px;
350
- }
351
- .search-fast-con-modal .ivu-modal-content{
352
- width: 350px;
353
- height: 200px;
354
- margin-right: 1px;
355
- }
356
-
357
- .modal-title{
358
- font-family: Microsoft YaHei;
359
- font-weight: 400;
360
- color: #333333;
361
- font-size: 17px;
362
- }
363
- //.line{
364
- // border-top: 1px solid lightgray;
365
- // margin:10px
366
- //}
367
- .more-content{
368
- margin-left: 140px;
369
- margin-top: 15px;
370
- a{font-size:14px;color:#999;font-family: Microsoft YaHei-Regular, Microsoft YaHei;}
371
- }
372
- .search-fast-con-side{
373
- width: 97%;
374
- position: absolute;
375
- top: 0px;
376
- z-index: 2000;
377
- //background: #22262f;
378
- }
379
- .search-fast-con-side .ivu-input{
380
- font-size: 13px;
381
- margin-top: -4px;
382
- width: 228.5px;
383
- height: 40px;
384
- font-family: Microsoft YaHei;
385
- font-weight: 400;
386
- border: none;
387
- background-color: var(--legend-color ,@legend-color);//修改这里
388
- text-align:left; /* 确保文本默认左对齐 */
389
- color: var(--avatar-color ,@avatar-color );
390
- padding-right: 99px;
391
- padding-left: 58px;
392
- }
393
- .search-fast-con-side-modal .ivu-modal-body .modal1-content {
394
- padding-top: 6px;
395
- padding-left: 10px;
396
- height: 270px;
397
- width: 211px;
398
- margin-left: -13px;
399
- overflow-x: hidden;
400
- overflow-y: auto;
401
- background-color: var(--menu-dark-active-bg ,@menu-dark-active-bg );
402
- -ms-overflow-style: none; /* Internet Explorer 10+ */
403
- scrollbar-width: none; /* Firefox */
404
- }
405
- .search-fast-con-side-modal .ivu-modal-body .modal1-content::-webkit-scrollbar {
406
- display: none; /* Chrome, Safari 和 Opera */
407
- }
408
-
409
-
410
- .search-fast-con-modal .ivu-modal-body{
411
- height: 280px;
412
- padding: 16px;
413
- font-size: var(--font-size-base, 14px);
414
- line-height: 1.5;
415
- margin-top: 55px;
416
- background-color: white;
417
- overflow: hidden !important;
418
- scrollbar-width: none !important;
419
- }
420
- .search-fast-con-modal .ivu-modal-body .modal-content {
421
- padding-top: 6px;
422
- height: 200px;
423
- width: 350px;
424
- margin-right: 400px;
425
- overflow-x: hidden;
426
- overflow-y: auto;
427
- background-color: white;
428
- -ms-overflow-style: none !important; /* Internet Explorer 10+ */
429
- scrollbar-width: none !important; /* Firefox */
430
- }
431
- .search-fast-con-modal .ivu-modal-body ::-webkit-scrollbar {
432
- display: none !important; /* Chrome, Safari 和 Opera */
433
- }
434
-
435
- .v-transfer-dom ::-webkit-scrollbar {
436
- display: none; /* Chrome, Safari 和 Opera */
437
- overflow: hidden !important;
438
- }
439
- .v-transfer-dom{
440
- -ms-overflow-style: none; /* Internet Explorer 10+ */
441
- scrollbar-width: none; /* Firefox */
442
- overflow: hidden !important;
443
- }
444
-
445
-
446
- search-fast-con-side-modal .ivu-modal-body{
447
- height: 250px;
448
- padding: 16px;
449
- font-size: var(--font-size-base, 14px);
450
- line-height: 1.5;
451
- margin-top: -2px;
452
- //background-color: white;
453
-
454
- }
455
- // .search-fast-con-side .sideCloseIcon{
456
- // text-align: right;
457
- // }
458
- .search-fast-con-side .ivu-icon-ios-search:before {
459
- margin-right: -54px; /* 向右移动10像素 */
460
- //color: rgba(42, 97 ,200);
461
- color: var(--avatar-color ,@avatar-color );
462
- line-height: 1.6
463
- }
464
- .search-fast-con-top .ivu-icon-ios-search-outline:before {
465
- //margin-right: -1000px;
466
- color: rgba(255, 255, 255,0.7);
467
- position: fixed; /* 使用fixed定位 */
468
- right: 180px; /* 设置距离浏览器窗口右侧边缘的距离 */
469
- margin-right: 0;
470
- top:15px;
471
- }
472
- .search-fast-con-top .ivu-icon-ios-search:before {
473
- color: rgba(255, 255, 255,0.7);
474
- }
475
- .search-fast-con-side .ivu-input::placeholder{
476
- font-size: 13px;
477
- font-family: Microsoft YaHei;
478
- font-weight: 400;
479
- // color: rgba(42, 97 ,200)!important;
480
- color: var(--avatar-color ,@avatar-color ) !important;;
481
-
482
- }
483
- .search-fast-con-top .ivu-input {
484
- font-size: 15px;
485
- font-family: Microsoft YaHei;
486
- font-weight: 400;
487
- color: rgba(255, 255, 255,0.7);
488
- border: none;
489
- background-color: transparent;
490
- }
491
- .search-fast-con-top .ivu-input::placeholder{
492
- font-size: 15px;
493
- font-family: Microsoft YaHei;
494
- font-weight: 400;
495
- color: rgba(255, 255, 255,0.7)!important;
496
- }
497
- //.modal1-content {
498
- // overflow-x: hidden;
499
- // overflow-y: auto;
500
- // height: 270px;
501
- //}
502
- .modal-content {
503
- overflow-x: hidden;
504
- overflow-y: auto;
505
- height: 210px;
506
- background-color: white;
507
- width: 273px;
508
- }
509
- .menu-side-style{
510
- font-size: 14px;
511
- font-family: Microsoft YaHei;
512
- font-weight: 400;
513
- width: 200px;
514
- color:#EBEBEB;
515
- margin-top: 8px;
516
- white-space: nowrap;
517
- text-overflow: ellipsis;
518
- }
519
-
520
- .menu-side-style1{
521
- font-size: 16px;
522
- font-family: Microsoft YaHei;
523
- font-weight: 400;
524
- width: 200px;
525
- color:black;
526
- margin-top: 10px;
527
- white-space: nowrap;
528
- text-overflow: ellipsis;
529
- }
530
-
531
- .menu-side-style:hover {
532
- overflow: visible;
533
- cursor: pointer;
534
- color: red;
535
- }
536
- .menu-side-style1:hover {
537
- overflow: visible;
538
- cursor: pointer;
539
- color: red;
540
- }
541
- .sideInput{
542
- width: 221px;
543
- transform: translateX(-13px);
544
- }
545
- .topInput{
546
- float: right;
547
- position: relative;
548
- z-index: 1000;
549
- margin-top: 0px;
550
- margin-left: 10px;
551
- }
552
- .slide-enter-active,
553
- .slide-leave-active{
554
- transition: transform 0.5s;
555
- }
556
- .slide-enter{
557
- transform: translateX(100%);
558
- }
559
- .slide-leave-to{
560
- transform: translateX(175px);
561
- }
562
- .text {
563
- display: inline-block;
564
- }
565
- .text.scrolling {
566
- animation: scrollText linear infinite;
567
- animation-duration: 2s; /* 调整滚动速度和持续时间 */
568
- }
569
-
570
- @keyframes scrollText {
571
- 0% {
572
- transform: translateX(0);
573
- }
574
- 100% {
575
- transform: translateX(var(--scroll-distance, 0)); /* 调整滚动的距离 */
576
- }
577
- }
578
-
579
- .menu-side-style:hover .text {
580
- animation-play-state: running;
581
- }
582
- .demo-spin-icon-load{
583
- animation: ani-demo-spin 1s linear infinite;
584
- }
585
- @keyframes ani-demo-spin {
586
- from { transform: rotate(0deg);}
587
- 50% { transform: rotate(180deg);}
588
- to { transform: rotate(360deg);}
589
- }
590
- </style>
@@ -1,84 +0,0 @@
1
- <template>
2
- <div v-if="listType === 0" >
3
- <div v-for="(item,index) in menuData" v-if='index < 3' :key="index" >
4
- <div class="menu-style" @click="handleMenuClick(item)">
5
- <Icon :type="item.icon" />
6
- <span class="label-style">{{ item.label }}</span>
7
- <br>
8
- <span class="path-style">{{item.pidLabel}}>{{item.label}}</span>
9
- </div>
10
- </div>
11
- <div v-if="menuData.length === 0">
12
- <span style="display: flex;justify-content: center;align-items: center;font-size: 15px">暂无数据</span>
13
- </div>
14
- </div>
15
-
16
-
17
- <div v-else-if="listType === 1">
18
- <div v-for="(item,index) in noticeData" v-if='index < 3' :key="index" >
19
- <div class="menu-style" @click="handleNoticeClick(item.noticeId,item.isConfirmed)">
20
- <Icon type="md-volume-up" />
21
- <span class="label-style">{{item.noticeTitle}}</span>
22
- <br>
23
- <span class="path-style">{{item.releaseTime}}</span>
24
- </div>
25
- </div>
26
- <div v-if="noticeData.length === 0">
27
- <span style="display: flex;justify-content: center;align-items: center;font-size: 15px">暂无数据</span>
28
- </div>
29
- </div>
30
- </template>
31
-
32
- <script>
33
- export default {
34
- name: "SearchList",
35
- props: {
36
- listType:'',
37
- menuData:[],
38
- noticeData:[]
39
- },
40
- data() {
41
- return {
42
- }
43
- },
44
- methods:{
45
- handleMenuClick(item){
46
- this.$emit('modal-select',item)
47
- },
48
- handleNoticeClick(e,f){
49
- this.$emit('modal-select',e,f)
50
- }
51
- }
52
- }
53
- </script>
54
-
55
- <style scoped lang="less">
56
- .menu-style {
57
- margin: 5px;
58
- font-size: 16px;
59
- display: inline-block;
60
- cursor: pointer;
61
- }
62
- .menu-style:hover,
63
- .menu-style:hover .label-style,
64
- .menu-style:hover .path-style{
65
- color:red ;
66
- }
67
- .label-style{
68
- height: 13px;
69
- font-size: 14px;
70
- font-family: Microsoft YaHei;
71
- font-weight: 500;
72
- margin-left: 5px;
73
- color: #333333;
74
- line-height: 18px;
75
- }
76
- .path-style{
77
- height: 13px;
78
- font-size: 14px;
79
- font-family: Microsoft YaHei;
80
- font-weight: 500;
81
- color: #999999;
82
- line-height: 18px;
83
- }
84
- </style>