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

调整树视图代码 & 修复多选无法打开

上级 c5cebb3c
......@@ -181,33 +181,41 @@ import { Util } from '@ibiz-core/utils'
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public parseNodes(nodes:any) {
let rootNodes :any= [];
let valueNodes :any= [];
this.rootNodes = [];
this.valueNodes = [];
for (let index = 0; index < nodes.length; index++) {
const item = nodes[index];
let ele :any= this.$refs[item.srfkey+'checkbox'];
if(!item.leaf){
rootNodes.push(item);
this.rootNodes.push(item);
}else{
if(this.selectedNodes.findIndex((temp:any)=>{return temp.srfkey == item.srfkey}) > -1){
item.selected = true;
if(ele && ele[0]){
ele[0].ariaChecked = true;
}
}else{
item.selected = false;
if(ele && ele[0]){
ele[0].ariaChecked = false;
}
}
valueNodes.push(item);
this.backfill(item);
this.valueNodes.push(item);
}
}
this.rootNodes = rootNodes;
this.valueNodes = valueNodes;
this.$forceUpdate();
}
/**
* 回填已选择树节点
*
* @param {*} nodes
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public backfill(item:any){
let ele :any= this.$refs[item.srfkey+'checkbox'];
if(this.selectedNodes.findIndex((temp:any)=>{return temp.srfkey == item.srfkey}) > -1){
item.selected = true;
if(ele && ele[0]){
ele[0].ariaChecked = true;
}
}else{
item.selected = false;
if(ele && ele[0]){
ele[0].ariaChecked = false;
}
}
}
/**
* 回显选中数据集合
*
......
......@@ -32,7 +32,7 @@ ${P.getCtrlCode('pickupviewpanel', 'CONTROL.html').code}
</van-action-sheet>
</#if>
</#if>
<div class="selectedCount" @click="select_click">已选择:{{viewSelections.length}}<ion-icon name="chevron-up-outline"></ion-icon></div>
<div class="selectedCount" <#if isTreeView>@click="select_click"</#if>>已选择:{{viewSelections.length}}<ion-icon name="chevron-up-outline"></ion-icon></div>
<ion-button class="pick-btn" @click="onClickOk" :disabled="viewSelections.length === 0">{{$t('app.button.confirm')}}</ion-button>
</div>
</div>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册