调整样式

This commit is contained in:
aixianling
2023-05-25 16:42:32 +08:00
parent 8dc189c163
commit ebf5c78721
2 changed files with 20 additions and 7 deletions

View File

@@ -1,18 +1,20 @@
<template> <template>
<section class="AiTreePath"> <section class="AiTreePath">
<AiTreePath v-if="parent" v-bind="$props" :node="parent" v-on="$listeners"/> <b v-text="`全部`" @click="$emit('click','all')"/>
<b v-else v-text="`全部`" @click="$emit('click','all')"/> <div flex v-for="p in parents" :key="p.id">
<u-icon name="arrow-right" size="32" color="#ccc"/>
<div class="mar-l8" v-text="p[options.label]" @click="$emit('click',p)"/>
</div>
<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 :class="{active}" v-text="label" @click="$emit('click',node)"/> <div class="active" v-text="label" @click="$emit('click',node)"/>
</section> </section>
</template> </template>
<script> <script>
export default { export default {
name: "AiTreePath", name: "AiTreePath",
props: { props: {
current: {default: null},
prop: {default: () => ({})}, prop: {default: () => ({})},
paths: {default: () => []}, paths: {default: () => ({})},
node: {default: null} node: {default: null}
}, },
computed: { computed: {
@@ -24,7 +26,18 @@ export default {
}), }),
label: v => v.node?.[v.options.label] || "", label: v => v.node?.[v.options.label] || "",
parent: v => v.paths?.[v.node?.[v.options.parent]], parent: v => v.paths?.[v.node?.[v.options.parent]],
active: v => v.node?.[v.options.id] == v.current parents() {
const arr = []
const {id: KEY, parent: PARENT} = this.options
const find = n => {
if (!!n?.[KEY]) {
arr.unshift(n)
find(this.paths[n?.[PARENT]])
}
}
find(this.parent)
return arr
}
} }
} }
</script> </script>

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="selectDept"> <div class="selectDept">
<AiTopFixed> <AiTopFixed>
<AiTreePath :current="cursor.id" :node="cursor" :paths="depts.map" :prop="{parent:'parentid'}" @click="changeList"/> <AiTreePath :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">