提交 073b5c19 编写于 作者: zhujiamin's avatar zhujiamin

模型获取 分组数据 --fix4

上级 be6588f6
......@@ -162,7 +162,7 @@
* @type {boolean}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public group_detail:any = <#if ctrl.getGroupPSCodeList?? && ctrl.getGroupPSCodeList()?? && ctrl.getGroupPSCodeList().getAllPSCodeItems?? && ctrl.getGroupPSCodeList().getAllPSCodeItems()??> <#assign codelist = ctrl.getGroupPSCodeList().getAllPSCodeItems()> {<#list codelist as item> <#if item.getValue?? && item.getValue()?? && item.getName?? && item.getName()??>'${item.getValue()}':'${item.getName()}',</#if></#list>}<#else>''</#if>;
public group_detail:any = <#if ctrl.getGroupPSCodeList?? && ctrl.getGroupPSCodeList()?? && ctrl.getGroupPSCodeList().getAllPSCodeItems?? && ctrl.getGroupPSCodeList().getAllPSCodeItems()??> <#assign codelist = ctrl.getGroupPSCodeList().getAllPSCodeItems()> [<#list codelist as item> <#if item.getValue?? && item.getValue()?? && item.getName?? && item.getName()??>{"value":'${item.getValue()}',"text":'${item.getName()}'},</#if></#list>]<#else>[]</#if>;
/**
* 分组数据
......@@ -559,20 +559,26 @@
/**
* 获取分组数据
*
* @memberof ${srfclassname('${ctrl.codeName}')}
* @memberof Mob
*/
public getGroupData(items:any){
let data:any =[];
let obj:any = {};
items.forEach((item:any,index:number,items:Array<number>)=>{
if(!obj[item[this.group_field]]){
obj[item[this.group_field]] = item[this.group_field];
let data:any = [];
let iobj:any = {};
this.group_detail.forEach((obj:any,index:number)=>{
let idata
items.forEach((item:any,i:number)=>{
if (item[this.group_field] === obj.value) {
if(!iobj[ item[this.group_field] ]){
iobj[ item[this.group_field] ] = item[this.group_field];
data.push(this.filterByTag(items,item[this.group_field]));
}
}
})
})
data.forEach((arr:any,index:number)=>{
this.group_data[index] = {};
this.group_data[index].text = this.group_detail[ arr[0][this.group_field] ];
this.group_data[index].text = this.group_detail[ index ].text;
this.group_data[index].items = arr;
})
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册