提交 adeaa297 编写于 作者: JunZai's avatar JunZai

update

上级 e3b60ada
......@@ -5,7 +5,7 @@
../../@MACRO/LANG_FUN.ftl
</#ibizinclude>
<template>
<el-table ref="${ctrl.name}" :data="items" row-key="id" border height="100%" lazy :load="loadTreeNode" :tree-props="{ children: 'children', hasChildren: 'leaf' }">
<el-table ref="${ctrl.name}" :data="items" row-key="id" border height="100%" lazy :row-class-name="setRowClass" :load="loadTreeNode" :tree-props="{ children: 'children', hasChildren: 'leaf' }">
<#if ctrl.getPSDETreeColumns()??>
<#list ctrl.getPSDETreeColumns() as column>
<el-table-column show-overflow-tooltip prop="${column.getName()?lower_case}" label="${column.getCaption()}"<#if column.getWidthUnit()!='STAR'> :width="${column.getWidth()?c}" <#else> :min-width="${column.getWidth()?c}" </#if> :align="'${column.getAlign()?lower_case}'">
......@@ -56,10 +56,31 @@
*
* @public
* @type {any[]}
* @memberof ${srfclassname('${ctrl.codeName}')}items
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public items: any[] = [];
/**
* 默认展开节点集合
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public defExpands: any = [];
/**
* 行节点下标
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public itemNum: any = {};
/**
* 计数下标
*
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public num: number = 0;
/**
* 获取列属性值
*
......@@ -133,15 +154,19 @@
this.$Notice.error({ title: "错误", desc: response.info });
return;
}
response.data.forEach((item: any) => {
this.itemNum[item.id] = this.num++;
if(!item.collapsed) {
this.defExpands.push(item);
}
})
if(resolve && resolve instanceof Function) {
resolve(response.data);
} else {
this.items = [...response.data];
}
response.data.forEach((item: any) => {
if(!item.collapsed) {
}
this.$nextTick(() => {
this.expandDefNode();
})
this.$emit("load", this.items);
}).catch((response: any) => {
......@@ -236,6 +261,34 @@
this.load();
}
/**
* 设置行Class
*
* @returns
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public setRowClass({row, rowIndex}: {row: any, rowIndex: number}) {
return 'treegrid' + this.itemNum[row.id];
}
/**
* 展开默认节点
*
* @returns
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public expandDefNode() {
if(this.defExpands.length > 0) {
let item: any = this.defExpands[0];
this.defExpands.splice(0, 1);
let trs: any = this.$el.getElementsByClassName('treegrid' + this.itemNum[item.id]);
if(trs) {
let icons: any = trs[0].getElementsByClassName('el-table__expand-icon');
icons[0].click();
}
}
}
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册