提交 8a977105 编写于 作者: Shine-zwj's avatar Shine-zwj

列表和数据视图分组

上级 bb2a2af6
......@@ -18,7 +18,10 @@
</div>
<#elseif ctrl.isEnableGroup?? && ctrl.isEnableGroup()>
<el-collapse>
<el-collapse-item v-for="(group,index) in items" :key="index" :title="group.group" >
<el-collapse-item v-for="(group,index) in groupData" :key="index">
<template slot="title">
<div style="margin: 0 0 0 12px;"><b>{{group.group}}</b></div>
</template>
<div v-if="group.children.length > 0">
<div v-for="item in group.children" :key="item.srfkey" :class="['app-list-item', {'isSelect': item.isselected === true ? true : false}]" @click="handleClick(item)" @dblclick="handleDblClick(item)">
<#if ctrl.getItemPSLayoutPanel()??>
......@@ -50,11 +53,9 @@
<el-backtop target=".content-container .app-list"></el-backtop>
</div>
</template>
<#if ctrl.getGroupMode?? && ctrl.getGroupMode() == 'CODELIST'>
<#assign import_block>
import CodeListService from "@service/app/codelist-service";
</#assign>
</#if>
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_HEADER-BASE.vue.ftl
</#ibizinclude>
......@@ -165,7 +166,15 @@ import CodeListService from "@service/app/codelist-service";
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public groupProperty: string = "<#if ctrl.getGroupPSDEField?? && ctrl.getGroupPSDEField()??>${ctrl.getGroupPSDEField().getCodeName()?lower_case}</#if>";
public groupField: string = "<#if ctrl.getGroupPSDEField?? && ctrl.getGroupPSDEField()??>${ctrl.getGroupPSDEField().getCodeName()?lower_case}</#if>";
/**
* 分组数据
*
* @type {Array<any>}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public groupData: Array<any> = [];
</#if>
<#if ctrl.getGroupMode?? && ctrl.getGroupMode() == 'CODELIST'>
......@@ -212,7 +221,7 @@ import CodeListService from "@service/app/codelist-service";
groups.forEach((group: any,i: number)=>{
let children:Array<any> = [];
data.forEach((item: any,j: number)=>{
if(Object.is(group.label,item[this.groupProperty])){
if(Object.is(group.label,item[this.groupField])){
children.push(item);
}
});
......@@ -224,7 +233,7 @@ import CodeListService from "@service/app/codelist-service";
});
let child:Array<any> = [];
data.forEach((item: any)=>{
let i = groups.findIndex((group: any)=>Object.is(group,item[this.groupProperty]));
let i = groups.findIndex((group: any)=>Object.is(group,item[this.groupField]));
if(i < 0){
child.push(item);
}
......@@ -234,7 +243,7 @@ import CodeListService from "@service/app/codelist-service";
children: child
}
groupTree.push(Tree);
this.items = [...groupTree];
this.groupData = [...groupTree];
}
</#if>
......@@ -248,8 +257,8 @@ import CodeListService from "@service/app/codelist-service";
let data:Array<any> = [...this.items];
let groups:Array<any> = [];
data.forEach((item: any)=>{
if(item.hasOwnProperty(this.groupProperty)){
groups.push(item[this.groupProperty]);
if(item.hasOwnProperty(this.groupField)){
groups.push(item[this.groupField]);
}
});
groups = [...new Set(groups)];
......@@ -258,7 +267,7 @@ import CodeListService from "@service/app/codelist-service";
groups.forEach((group: any,i: number)=>{
let children:Array<any> = [];
data.forEach((item: any,j: number)=>{
if(Object.is(group,item[this.groupProperty])){
if(Object.is(group,item[this.groupField])){
children.push(item);
}
});
......@@ -268,7 +277,7 @@ import CodeListService from "@service/app/codelist-service";
}
groupTree.push(tree);
});
this.items = [...groupTree];
this.groupData = [...groupTree];
}
</#if>
......
......@@ -56,7 +56,10 @@
</a>
<#elseif ctrl.isEnableGroup?? && ctrl.isEnableGroup()>
<el-collapse>
<el-collapse-item v-for="(group,index) in items" :key="index" :title="group.group">
<el-collapse-item v-for="(group,index) in groupData" :key="index">
<template slot="title">
<div style="margin: 0 0 0 12px;"><b>{{group.group}}</b></div>
</template>
<div v-if="group.children.length > 0">
<a v-for="(item,i) in group.children" :key="i" :href="item.starturl">
<i-col style="min-height: 170px;margin-bottom: 10px;max-width: 194px;">
......@@ -93,11 +96,9 @@
</div>
</#if>
</template>
<#if ctrl.getGroupMode?? && ctrl.getGroupMode() == 'CODELIST'>
<#assign import_block>
import CodeListService from "@service/app/codelist-service";
</#assign>
</#if>
<#ibizinclude>
../@MACRO/CONTROL/CONTROL_HEADER-BASE.vue.ftl
</#ibizinclude>
......@@ -207,7 +208,15 @@ import CodeListService from "@service/app/codelist-service";
* @type {string}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public groupProperty: string = "<#if ctrl.getGroupPSDEField?? && ctrl.getGroupPSDEField()??>${ctrl.getGroupPSDEField().getCodeName()?lower_case}</#if>";
public groupField: string = "<#if ctrl.getGroupPSDEField?? && ctrl.getGroupPSDEField()??>${ctrl.getGroupPSDEField().getCodeName()?lower_case}</#if>";
/**
* 分组数据
*
* @type {Array<any>}
* @memberof ${srfclassname('${ctrl.codeName}')}Base
*/
public groupData: Array<any> = [];
</#if>
<#if ctrl.getGroupMode?? && ctrl.getGroupMode() == 'CODELIST'>
......@@ -254,7 +263,7 @@ import CodeListService from "@service/app/codelist-service";
groups.forEach((group: any,i: number)=>{
let children:Array<any> = [];
data.forEach((item: any,j: number)=>{
if(Object.is(group.label,item[this.groupProperty])){
if(Object.is(group.label,item[this.groupField])){
children.push(item);
}
});
......@@ -266,7 +275,7 @@ import CodeListService from "@service/app/codelist-service";
});
let child:Array<any> = [];
data.forEach((item: any)=>{
let i = groups.findIndex((group: any)=>Object.is(group,item[this.groupProperty]));
let i = groups.findIndex((group: any)=>Object.is(group,item[this.groupField]));
if(i < 0){
child.push(item);
}
......@@ -276,7 +285,7 @@ import CodeListService from "@service/app/codelist-service";
children: child
}
groupTree.push(Tree);
this.items = [...groupTree];
this.groupData = [...groupTree];
}
</#if>
......@@ -290,8 +299,8 @@ import CodeListService from "@service/app/codelist-service";
let data:Array<any> = [...this.items];
let groups:Array<any> = [];
data.forEach((item: any)=>{
if(item.hasOwnProperty(this.groupProperty)){
groups.push(item[this.groupProperty]);
if(item.hasOwnProperty(this.groupField)){
groups.push(item[this.groupField]);
}
});
groups = [...new Set(groups)];
......@@ -300,7 +309,7 @@ import CodeListService from "@service/app/codelist-service";
groups.forEach((group: any,i: number)=>{
let children:Array<any> = [];
data.forEach((item: any,j: number)=>{
if(Object.is(group,item[this.groupProperty])){
if(Object.is(group,item[this.groupField])){
children.push(item);
}
});
......@@ -310,10 +319,9 @@ import CodeListService from "@service/app/codelist-service";
}
groupTree.push(tree);
});
this.items = [...groupTree];
this.groupData = [...groupTree];
}
</#if>
/**
* 是否单选
*
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册