调整样式

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

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="selectDept"> <div class="selectDept">
<AiTopFixed> <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> </AiTopFixed>
<div class="user-list"> <div class="user-list">
<template v-if="list.length>0"> <template v-if="list.length>0">
@@ -44,7 +44,7 @@ export default {
cirIcon: require('./img/xz.png'), cirIcon: require('./img/xz.png'),
checkIcon: require('./img/xzh.png'), checkIcon: require('./img/xzh.png'),
selected: [], selected: [],
cursor: null cursor: {}
} }
}, },
computed: { computed: {
@@ -96,8 +96,8 @@ export default {
}, },
changeList(item) { changeList(item) {
if (item == "all") { if (item == "all") {
this.cursor = {}
this.list = this.depts.tree this.list = this.depts.tree
this.cursor = null
} else { } else {
this.cursor = item this.cursor = item
this.list = item.children this.list = item.children