|
15 | 15 | </div>
|
16 | 16 | <div class="top-r-container">
|
17 | 17 | <template v-for="(work, index) in topTapList">
|
18 |
| - <div |
| 18 | + <we-tab |
19 | 19 | :key="work.id"
|
20 |
| - :class="{ |
21 |
| - active: currentTab.guid === work.guid && !textColor |
22 |
| - }" |
23 |
| - class="tab-item" |
| 20 | + :index="index" |
| 21 | + :work="work" |
| 22 | + :isActive="currentTab.guid === work.guid && !textColor" |
| 23 | + @on-choose="onChooseWork" |
| 24 | + @on-remove="onRemoveWork" |
24 | 25 | ref="work_item"
|
25 |
| - > |
26 |
| - <we-tab |
27 |
| - :index="index" |
28 |
| - :work="work" |
29 |
| - @on-choose="onChooseWork" |
30 |
| - @on-remove="onRemoveWork" |
31 |
| - /> |
32 |
| - </div> |
| 26 | + /> |
33 | 27 | </template>
|
34 | 28 | </div>
|
35 | 29 | </slot>
|
|
44 | 38 | </template>
|
45 | 39 | <script>
|
46 | 40 | //import api from "@/common/service/api";
|
47 |
| -import weTab from "../../../workflows/module/common/tabList/tabs.vue"; |
48 |
| -import { EventBus } from "../common/eventBus/event-bus"; |
| 41 | +import weTab from "@component/lubanTab/index.vue" |
| 42 | +import { EventBus } from "../common/eventBus/event-bus" |
49 | 43 | export default {
|
50 | 44 | components: {
|
51 |
| - weTab |
| 45 | + weTab, |
52 | 46 | },
|
53 | 47 | data() {
|
54 | 48 | return {
|
55 | 49 | textColor: true,
|
56 | 50 | index: 0,
|
57 | 51 | work: {},
|
58 | 52 | currentTab: {},
|
59 |
| - topTapList: [] |
60 |
| - }; |
| 53 | + topTapList: [], |
| 54 | + } |
61 | 55 | },
|
62 | 56 | created() {},
|
63 | 57 | mounted() {
|
64 |
| - EventBus.$on("on-choose-card", model => { |
65 |
| - let that = this; |
66 |
| - that.textColor = false; |
67 |
| - const topTapList = that.topTapList.slice(0); |
68 |
| - const { guid } = model; |
69 |
| - that.currentTab = model; |
70 |
| - if (topTapList.some(model => model.guid === guid)) { |
71 |
| - return false; |
| 58 | + EventBus.$on("on-choose-card", (model) => { |
| 59 | + let that = this |
| 60 | + that.textColor = false |
| 61 | + const topTapList = that.topTapList.slice(0) |
| 62 | + const { guid } = model |
| 63 | + that.currentTab = model |
| 64 | + if (topTapList.some((model) => model.guid === guid)) { |
| 65 | + return false |
72 | 66 | }
|
73 |
| - topTapList.push(model); |
74 |
| - that.topTapList = topTapList; |
75 |
| - }); |
| 67 | + topTapList.push(model) |
| 68 | + that.topTapList = topTapList |
| 69 | + }) |
76 | 70 | },
|
77 | 71 | beforeDestroy() {
|
78 | 72 | // 销毁 eventBus
|
79 |
| - EventBus.$off("on-choose-card"); |
| 73 | + EventBus.$off("on-choose-card") |
80 | 74 | },
|
81 | 75 | methods: {
|
82 | 76 | // 面包屑相关
|
83 | 77 | selectProject() {
|
84 | 78 | // 返回到 目录 即搜索页面
|
85 |
| - const workspaceId = this.$route.query.workspaceId; |
| 79 | + const workspaceId = this.$route.query.workspaceId |
86 | 80 | this.$router.push({
|
87 | 81 | name: "dataGovernance/assets/search",
|
88 |
| - query: { workspaceId } |
89 |
| - }); |
90 |
| - this.textColor = true; |
| 82 | + query: { workspaceId }, |
| 83 | + }) |
| 84 | + this.textColor = true |
91 | 85 | },
|
92 | 86 | onChooseWork(modal) {
|
93 |
| - const workspaceId = this.$route.query.workspaceId; |
94 |
| - const { guid } = modal; |
| 87 | + const workspaceId = this.$route.query.workspaceId |
| 88 | + const { guid } = modal |
95 | 89 | this.$router.push({
|
96 | 90 | name: "dataGovernance/assets/info",
|
97 | 91 | params: { guid },
|
98 |
| - query: { workspaceId } |
99 |
| - }); |
100 |
| - this.currentTab = modal; |
101 |
| - this.textColor = false; |
| 92 | + query: { workspaceId }, |
| 93 | + }) |
| 94 | + this.currentTab = modal |
| 95 | + this.textColor = false |
102 | 96 | },
|
103 | 97 | onRemoveWork(modal) {
|
104 |
| - let that = this; |
105 |
| - let topTapList = that.topTapList.slice(0); |
106 |
| - let len = topTapList.length; |
107 |
| - let idx = 0; |
| 98 | + let that = this |
| 99 | + let topTapList = that.topTapList.slice(0) |
| 100 | + let len = topTapList.length |
| 101 | + let idx = 0 |
108 | 102 |
|
109 | 103 | topTapList.forEach((item, index) => {
|
110 | 104 | if (item.guid === modal.guid) {
|
111 |
| - return (idx = index); |
| 105 | + return (idx = index) |
112 | 106 | }
|
113 |
| - }); |
| 107 | + }) |
114 | 108 |
|
115 | 109 | const removeAction = () => {
|
116 | 110 | if (that.currentTab.guid === modal.guid) {
|
117 |
| - const workspaceId = that.$route.query.workspaceId; |
| 111 | + const workspaceId = that.$route.query.workspaceId |
118 | 112 | if (len > 1 && idx < len - 1) {
|
119 |
| - that.currentTab = topTapList[idx + 1]; |
120 |
| - let guid = that.currentTab.guid; |
| 113 | + that.currentTab = topTapList[idx + 1] |
| 114 | + let guid = that.currentTab.guid |
121 | 115 | that.$router.push({
|
122 | 116 | name: "dataGovernance/assets/info",
|
123 | 117 | params: { guid },
|
124 |
| - query: { workspaceId } |
125 |
| - }); |
| 118 | + query: { workspaceId }, |
| 119 | + }) |
126 | 120 | } else if (len > 1 && idx == len - 1) {
|
127 |
| - that.currentTab = topTapList[idx - 1]; |
128 |
| - let guid = that.currentTab.guid; |
| 121 | + that.currentTab = topTapList[idx - 1] |
| 122 | + let guid = that.currentTab.guid |
129 | 123 | that.$router.push({
|
130 | 124 | name: "dataGovernance/assets/info",
|
131 | 125 | params: { guid },
|
132 |
| - query: { workspaceId } |
133 |
| - }); |
| 126 | + query: { workspaceId }, |
| 127 | + }) |
134 | 128 | } else {
|
135 |
| - that.currentTab = {}; |
136 |
| - that.textColor = true; |
| 129 | + that.currentTab = {} |
| 130 | + that.textColor = true |
137 | 131 | that.$router.push({
|
138 | 132 | name: "dataGovernance/assets/search",
|
139 |
| - query: { workspaceId } |
140 |
| - }); |
| 133 | + query: { workspaceId }, |
| 134 | + }) |
141 | 135 | }
|
142 | 136 | }
|
143 |
| - topTapList.splice(idx, 1); |
144 |
| - that.topTapList = topTapList; |
145 |
| - }; |
| 137 | + topTapList.splice(idx, 1) |
| 138 | + that.topTapList = topTapList |
| 139 | + } |
146 | 140 |
|
147 |
| - removeAction(); |
148 |
| - } |
| 141 | + removeAction() |
| 142 | + }, |
149 | 143 | // 通过 eventBus 获取 面包屑数据
|
150 |
| - } |
151 |
| -}; |
| 144 | + }, |
| 145 | +} |
152 | 146 | </script>
|
153 | 147 | <style lang="scss" scoped>
|
154 | 148 | @import "@/common/style/variables.scss";
|
@@ -190,23 +184,43 @@ export default {
|
190 | 184 | margin: 0 15px;
|
191 | 185 | }
|
192 | 186 | }
|
193 |
| - .active { |
194 |
| - border-bottom: 2px solid $primary-color; |
195 |
| - @include border-color($primary-color, $dark-primary-color); |
196 |
| - } |
197 | 187 | .top-r-container {
|
198 | 188 | flex: 1;
|
199 | 189 | height: 40px;
|
| 190 | + display: flex; |
| 191 | + align-items: center; |
| 192 | + padding: 0 15px; |
200 | 193 | .tab-item {
|
201 | 194 | display: inline-block;
|
202 |
| - height: 40px; |
203 |
| - line-height: 40px; |
204 |
| - @include font-color(rgba(0, 0, 0, 0.85), $dark-text-color); |
| 195 | + height: 24px; |
| 196 | + line-height: 24px; |
| 197 | + // color: $title-color; |
| 198 | + @include font-color( |
| 199 | + $workspace-title-color, |
| 200 | + $dark-workspace-title-color |
| 201 | + ); |
205 | 202 | cursor: pointer;
|
206 |
| - min-width: 100px; |
| 203 | + min-width: 90px; |
207 | 204 | max-width: 200px;
|
| 205 | + padding: 0 10px; |
208 | 206 | overflow: hidden;
|
209 |
| - margin-right: 2px; |
| 207 | + margin-right: 8px; |
| 208 | + @include bg-color(#e1e5ea, $dark-workspace-body-bg-color); |
| 209 | + border-radius: 12px; |
| 210 | + &.active { |
| 211 | + height: 24px; |
| 212 | + @include font-color($primary-color, $dark-primary-color); |
| 213 | + line-height: 24px; |
| 214 | + @include bg-color(#e8eef4, $dark-workspace-body-bg-color); |
| 215 | + border-radius: 12px; |
| 216 | + } |
| 217 | + &:hover { |
| 218 | + height: 24px; |
| 219 | + @include font-color($primary-color, $dark-primary-color); |
| 220 | + line-height: 24px; |
| 221 | + border-radius: 12px; |
| 222 | + @include bg-color(#d1d7dd, $dark-workspace-body-bg-color); |
| 223 | + } |
210 | 224 | }
|
211 | 225 | }
|
212 | 226 | }
|
|
0 commit comments