提交 190ad6b5 编写于 作者: Neuromancer255's avatar Neuromancer255

多数据部件分组属性逻辑

上级 2bb39fae
...@@ -403,6 +403,33 @@ ...@@ -403,6 +403,33 @@
*/ */
public sort: any = { <#if ctrl.isNoSort?? && ctrl.isNoSort()??><#if ctrl.getMinorSortPSAppDEField?? && ctrl.getMinorSortPSAppDEField()??><#assign sortableField = ctrl.getMinorSortPSAppDEField() /><#if sortableField.getName?? && sortableField.getName()??>sort:'${sortableField.getName()?lower_case},<#if ctrl.getMinorSortDir?? && ctrl.getMinorSortDir()??>${ctrl.getMinorSortDir()?lower_case}</#if>'</#if></#if></#if>}; public sort: any = { <#if ctrl.isNoSort?? && ctrl.isNoSort()??><#if ctrl.getMinorSortPSAppDEField?? && ctrl.getMinorSortPSAppDEField()??><#assign sortableField = ctrl.getMinorSortPSAppDEField() /><#if sortableField.getName?? && sortableField.getName()??>sort:'${sortableField.getName()?lower_case},<#if ctrl.getMinorSortDir?? && ctrl.getMinorSortDir()??>${ctrl.getMinorSortDir()?lower_case}</#if>'</#if></#if></#if>};
<#if ctrl.getGroupPSDEField?? && ctrl.getGroupPSDEField()??>
/**
* 分组属性类别数组
*
* @param {object}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public anchorList:Array<any> = [];
/**
* 监控items变化
*
* @memberof AppQuickGroup
*/
@Watch("items", { immediate: true })
public itemsWatch(newVal:any,oldVal:any): void {
if (newVal) {
newVal.forEach((item:any) => {
this.anchorList.push(item.${ctrl.getGroupPSDEField()?lower_case})
});
this.anchorList = this.anchorList.filter((anchor:any,index:any) => {
return this.anchorList.indexOf(anchor,0) === index;
});
}
}
</#if>
/** /**
* 底部改变状态 * 底部改变状态
* *
...@@ -598,6 +625,18 @@ ...@@ -598,6 +625,18 @@
if (type == 'top') { if (type == 'top') {
this.items = []; this.items = [];
this.items = response.data.records; this.items = response.data.records;
<#if ctrl.getGroupPSDEField?? && ctrl.getGroupPSDEField()??>
this.items.sort((prev:any,next:any) => {
<#if ctrl.getGroupPSDEField()?is_number>
let x = prev.${ctrl.getGroupPSDEField()?lower_case};
let y = next.${ctrl.getGroupPSDEField()?lower_case};
<#else>
let x = prev.${ctrl.getGroupPSDEField()?lower_case}.toLowerCase();
let y = next.${ctrl.getGroupPSDEField()?lower_case}.toLowerCase();
</#if>
return x-y;
})
</#if>
} else if (type == 'bottom') { } else if (type == 'bottom') {
for (let i = 0; i < response.data.records.length; i++) { for (let i = 0; i < response.data.records.length; i++) {
this.items.push(response.data.records[i]); this.items.push(response.data.records[i]);
...@@ -605,6 +644,18 @@ ...@@ -605,6 +644,18 @@
} else { } else {
this.items = []; this.items = [];
this.items = response.data.records; this.items = response.data.records;
<#if ctrl.getGroupPSDEField?? && ctrl.getGroupPSDEField()??>
this.items.sort((prev:any,next:any) => {
<#if ctrl.getGroupPSDEField()?is_number>
let x = prev.${ctrl.getGroupPSDEField()};
let y = next.${ctrl.getGroupPSDEField()};
<#else>
let x = prev.${ctrl.getGroupPSDEField()?lower_case}.toLowerCase();
let y = next.${ctrl.getGroupPSDEField()?lower_case}.toLowerCase();
</#if>
return x-y;
})
</#if>
} }
this.items.forEach((item:any)=>{ this.items.forEach((item:any)=>{
Object.assign(item,this.getActionState(item)); Object.assign(item,this.getActionState(item));
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册