提交 e6133dd5 编写于 作者: KK's avatar KK

树面包屑

上级 decbd3ca
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
<ion-searchbar></ion-searchbar> <ion-searchbar></ion-searchbar>
<div class="treeNav"> <div class="treeNav">
<template v-for="(item,index) in treeNav"> <template v-for="(item,index) in treeNav">
<ion-label :key="index" :class="index+1 < treeNav.length? 'treeNav-active':'' ">{{item}}</ion-label> <ion-label :key="index" class="sc-ion-label-ios-h sc-ion-label-ios-s ios hydrated" :class="index+1 < treeNav.length? 'treeNav-active':'' " @click="nav_click(item)">{{item.text}}</ion-label>
<span class="tree-span" :key="index+'span'" v-if="index+1 < treeNav.length">></span> <span class="tree-span" :key="index+'span'" v-if="index+1 < treeNav.length">></span>
</template> </template>
</div> </div>
<div class="tree-partition"></div> <div class="tree-partition"></div>
<ion-list> <ion-list>
<template v-for="item in nodes"> <template v-for="item in nodes">
<ion-item v-if="isNode(item.id)" :key="item.id" @click="click_node(item)"> <ion-item v-if="item.isNode" :key="item.id" @click="click_node(item)">
<ion-label>{{item.text}}</ion-label> <ion-label>{{item.text}}</ion-label>
<ion-icon class="tree-icon" slot="end" name="chevron-forward-outline"></ion-icon> <ion-icon class="tree-icon" slot="end" name="chevron-forward-outline"></ion-icon>
</ion-item> </ion-item>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<div class="tree-partition tree-partition-bigger"></div> <div class="tree-partition tree-partition-bigger"></div>
<ion-list> <ion-list>
<template v-for="item in nodes"> <template v-for="!item.isNode">
<ion-item v-if="!isNode(item.id)" :key="item.id"> <ion-item v-if="!isNode(item.id)" :key="item.id">
<ion-label>{{item.text}}</ion-label> <ion-label>{{item.text}}</ion-label>
</ion-item> </ion-item>
......
...@@ -23,7 +23,7 @@ import { Util } from '@ibiz-core/utils' ...@@ -23,7 +23,7 @@ import { Util } from '@ibiz-core/utils'
* @type {string[]} * @type {string[]}
* @memberof ${srfclassname('${ctrl.codeName}')}Base * @memberof ${srfclassname('${ctrl.codeName}')}Base
*/ */
public treeNav = []; public treeNav :any= [];
/** /**
* 获取多项数据 * 获取多项数据
...@@ -118,47 +118,6 @@ import { Util } from '@ibiz-core/utils' ...@@ -118,47 +118,6 @@ import { Util } from '@ibiz-core/utils'
this.load({data:data}); this.load({data:data});
} }
/**
* 节点值
*
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public treenodes:any = [
<#assign rootnode = "">
<#if ctrl.getRootPSDETreeNode?? && ctrl.getRootPSDETreeNode()?? && ctrl.getRootPSDETreeNode().getNodeType?? && ctrl.getRootPSDETreeNode().getNodeType()??>
<#assign rootnode = ctrl.getRootPSDETreeNode().getNodeType() >
</#if>
<#if ctrl.getPSDETreeNodeRSs?? && ctrl.getPSDETreeNodeRSs()??>
<#list ctrl.getPSDETreeNodeRSs() as node>
<#if node.getChildPSDETreeNode?? && node.getChildPSDETreeNode()??>
<#assign nodeitemchild = node.getChildPSDETreeNode()>
<#assign hasnoders = false>
<#assign isstatic = false>
<#if nodeitemchild.hasPSDETreeNodeRSs?? && nodeitemchild.hasPSDETreeNodeRSs()??>
<#assign hasnoders = nodeitemchild.hasPSDETreeNodeRSs() >
</#if>
<#if nodeitemchild.getTreeNodeType?? && nodeitemchild.getTreeNodeType()?? && nodeitemchild.getTreeNodeType() != 'STATIC'>
<#assign isstatic = true >
</#if>
<#if hasnoders || isstatic>
'${nodeitemchild.getNodeType()};${rootnode}',
</#if>
</#if>
</#list>
'${rootnode};${rootnode}'
</#if>
]
/**
* 选中值变化
*
* @param {string} key
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public isNode(key:string) {
return this.treenodes.includes(key);
}
/** /**
* 选中值变化 * 选中值变化
* *
...@@ -182,6 +141,19 @@ import { Util } from '@ibiz-core/utils' ...@@ -182,6 +141,19 @@ import { Util } from '@ibiz-core/utils'
} }
} }
/**
* 导航点击行为
*
* @param {*} newVal
* @param {*} oldVal
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public nav_click(item:any) {
const count = this.treeNav.findIndex((i:any) => item.id === i.id) + 1;
this.treeNav.splice(count,this.treeNav.length- count);
this.load({data:item});
}
/** /**
* 回显选中数据集合 * 回显选中数据集合
* *
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册