topbar.vue
1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<script lang="ts" setup name="topbar">
import { ref, watch } from 'vue';
const props = defineProps({
isFieldLineage: {
type:Boolean,
default: false
},
/** 显示字段级血缘关系开关,还是表级血缘关系开关 */
type: {
type: String,
default: 'field'
}
});
/** 是否展开字段级别的血缘关系。 */
const showFieldLineage = ref(false);
/** 是否展开表级别的血缘关系 */
const showTableLineage = ref(false);
watch(() => props.isFieldLineage, (val) => {
showFieldLineage.value = val;
showTableLineage.value = val;
}, {
immediate: true
})
const emits = defineEmits(["lineageSwitchChange", "handleClick"]);
const switchChange = (val) => {
emits('lineageSwitchChange', val, props.type);
}
const handleClick = (e) => {
emits('handleClick', e);
}
</script>
<template>
<div className='g6-component-topbar-content'>
<div className='g6-component-topbar-item' @click="handleClick">
<span>字段级血缘关系</span>
<el-switch v-if="props.type != 'table'" v-model="showFieldLineage" @change="switchChange" @click="handleClick" />
<el-switch v-else v-model="showTableLineage" @change="switchChange" @click="handleClick" />
</div>
</div>
</template>
<style scoped lang="scss">
.g6-component-topbar-content {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
height: 40px;
background: #fff;
border: 1px solid #e2e2e2;
border-radius: 4px;
padding: 0px 12px;
}
.g6-component-topbar-item {
display: flex;
align-items: center;
padding: 0px 10px;
line-height: 30px;
}
.g6-component-topbar-item>span {
font-size: 14px;
margin-right: 10px;
}
</style>