调整样式

This commit is contained in:
aixianling
2023-05-25 15:06:40 +08:00
parent 5f8850dc00
commit ad8f554ba2
2 changed files with 16 additions and 9 deletions

View File

@@ -1,9 +1,9 @@
<template>
<section class="AiTreePath">
<AiTreePath v-if="parent" v-bind="$props" :current="parent" v-on="$listeners"/>
<div v-else v-text="`全部`" @click="$emit('click','all')"/>
<AiTreePath v-if="parent" v-bind="$props" :node="parent" v-on="$listeners"/>
<b v-else v-text="`全部`" @click="$emit('click','all')"/>
<u-icon v-if="label" name="arrow-right" size="32" color="#ccc"/>
<div v-text="label" @click="$emit('click',current)"/>
<div :class="{active}" v-text="label" @click="$emit('click',node)"/>
</section>
</template>
<script>
@@ -12,7 +12,8 @@ export default {
props: {
current: {default: null},
prop: {default: () => ({})},
paths: {default: () => []}
paths: {default: () => []},
node: {default: null}
},
computed: {
options: v => ({
@@ -21,8 +22,9 @@ export default {
parent: 'parentId',
...v.prop
}),
label: v => v.current?.[v.options.label] || "",
parent: v => v.paths?.[v.current?.[v.options.parent]]
label: v => v.node?.[v.options.label] || "",
parent: v => v.paths?.[v.node?.[v.options.parent]],
active: v => v.node?.[v.options.id] == v.current
}
}
</script>
@@ -34,5 +36,10 @@ export default {
font-size: 36px;
line-height: 40px;
font-family: PingFang-SC;
.active {
font-weight: bold;
color: #26f
}
}
</style>

View File

@@ -1,7 +1,7 @@
<template>
<div class="selectDept">
<AiTopFixed>
<AiTreePath :current="cursor" :paths="depts.map" :prop="{parent:'parentid'}" @click="changeList"/>
<AiTreePath :current="cursor.id" :node="cursor" :paths="depts.map" :prop="{parent:'parentid'}" @click="changeList"/>
</AiTopFixed>
<div class="user-list">
<template v-if="list.length>0">
@@ -44,7 +44,7 @@ export default {
cirIcon: require('./img/xz.png'),
checkIcon: require('./img/xzh.png'),
selected: [],
cursor: null
cursor: {}
}
},
computed: {
@@ -96,8 +96,8 @@ export default {
},
changeList(item) {
if (item == "all") {
this.cursor = {}
this.list = this.depts.tree
this.cursor = null
} else {
this.cursor = item
this.list = item.children