merge
This commit is contained in:
@@ -55,7 +55,11 @@
|
||||
<div class="right-content">
|
||||
<div class="tree-menu">
|
||||
<el-breadcrumb :separator-icon="ArrowRight">
|
||||
<el-breadcrumb-item v-for="(item) in navList" :key="item[dataKey.id]" @click="openDirFun(item[dataKey.id])">
|
||||
<el-breadcrumb-item
|
||||
v-for="item in navList"
|
||||
:key="item[dataKey.id]"
|
||||
@click="openDirFun(item[dataKey.id])"
|
||||
>
|
||||
{{ item[dataKey.name] }}
|
||||
</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
@@ -76,6 +80,7 @@ interface Props {
|
||||
api: any;
|
||||
hideTree?: boolean;
|
||||
dataKey?: any;
|
||||
param?: any;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
@@ -86,6 +91,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
pId: 'parentDirId',
|
||||
name: 'originalName',
|
||||
},
|
||||
param: {},
|
||||
});
|
||||
|
||||
const emit = defineEmits(['choseNode', 'updateNav']);
|
||||
@@ -96,7 +102,7 @@ const visible = ref(true);
|
||||
const isToggleShow = ref(true);
|
||||
|
||||
// 加载节点
|
||||
const loadMoreFun = async(node: any, resolve: any) => {
|
||||
const loadMoreFun = async (node: any, resolve: any) => {
|
||||
const listData: any = await getDataFun(node.data[props.dataKey.id] || '');
|
||||
if (node.level >= 1) {
|
||||
node.data.children = listData;
|
||||
@@ -106,9 +112,9 @@ const loadMoreFun = async(node: any, resolve: any) => {
|
||||
};
|
||||
|
||||
// 获取节点数据
|
||||
const getDataFun = async(pId: string) => {
|
||||
const getDataFun = async (pId: string) => {
|
||||
if (props.api) {
|
||||
const params: any = {};
|
||||
const params: any = { ...props.param };
|
||||
params[props.dataKey.pId] = pId || '';
|
||||
const res: any = await props.api(params);
|
||||
if (res.code === 200) {
|
||||
@@ -191,10 +197,12 @@ defineExpose({
|
||||
<style lang="scss" scoped>
|
||||
.comp-content {
|
||||
height: 100%;
|
||||
|
||||
.content {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
|
||||
.toggle-btn {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
@@ -212,11 +220,13 @@ defineExpose({
|
||||
color: var(--el-text-color-regular);
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
|
||||
&.hide {
|
||||
left: -14px;
|
||||
transform: rotateZ(180deg);
|
||||
}
|
||||
}
|
||||
|
||||
.left-content {
|
||||
width: 400px;
|
||||
overflow: auto;
|
||||
@@ -226,11 +236,13 @@ defineExpose({
|
||||
padding: var(--padding-normal);
|
||||
border-right: solid 1px var(--el-border-color-darker);
|
||||
transition: all 0.3s;
|
||||
|
||||
&.hide {
|
||||
width: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.tree-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
@@ -238,12 +250,14 @@ defineExpose({
|
||||
justify-content: space-between;
|
||||
min-height: 20px;
|
||||
width: 0;
|
||||
|
||||
.name {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -252,12 +266,14 @@ defineExpose({
|
||||
height: 20px;
|
||||
margin-right: var(--margin-tiny);
|
||||
}
|
||||
|
||||
.label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.actions {
|
||||
padding-left: var(--padding-normal);
|
||||
display: flex;
|
||||
@@ -266,12 +282,14 @@ defineExpose({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right-content {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
background-color: var(--el-bg-color);
|
||||
border-radius: var(--border-radius-normal);
|
||||
padding: var(--padding-normal);
|
||||
|
||||
.tree-menu {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user