提交 8336d9a1 编写于 作者: Neuromancer255's avatar Neuromancer255

多数据视图分组代码表 --fix6

上级 f7f0a9d2
......@@ -93,39 +93,7 @@
}
</#if>
<#-- 输出快速搜索:END -->
<#-- 输出快速分组代码表:BEGIN -->
<#if view.getQuickGroupPSCodeList?? && view.getQuickGroupPSCodeList()??>
<#assign quickGroup = view.getQuickGroupPSCodeList()>
/**
* 快速分组代码表
*
* @type {Array<any>}
* @memberof ${srfclassname('${view.name}')}Base
*/
public fastGroupCodeList: Array<any> = [
<#if quickGroup.getAllPSCodeItems?? && quickGroup.getAllPSCodeItems()??>
<#list quickGroup.getAllPSCodeItems() as item>
{
default:${item.isDefault()?c},
codeName:'${item.getCodeName()}',
text:'${item.getText()}',
data:'${item.getData()}',
<#if item.getPSCodeItems?? && item.getPSCodeItems()??>
codeItems: [
<#list item.getPSCodeItems() as son>
default:${item.isDefault()?c},
codeName:'${item.getCodeName()}',
text:'${item.getText()}',
data:'${item.getData()}'},
</#list>
]
</#if>
},
</#list>
</#if>
]
</#if>
<#-- 输出快速分组代码表:END -->
/**
* 是否单选
*
......@@ -304,6 +272,105 @@
}
}
<#if view.isEnableQuickGroup()>
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof ${srfclassname('${view.name}')}Base
*/
public codeListService:CodeListService = new CodeListService();
/**
* 快速分组数据对象
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public quickGroupData:any;
/**
* 快速分组是否有抛值
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public isEmitQuickGroupValue:boolean = false;
/**
* 快速分组模型
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public quickGroupModel:Array<any> = [];
/**
* 加载快速分组模型
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public loadQuickGroupModel () {
<#if view.getQuickGroupPSCodeList()??>
<#assign codelist=view.getQuickGroupPSCodeList() />
let quickGroupCodeList:any = {tag:'${codelist.codeName}',codelistType:'${codelist.getCodeListType()}'};
if (quickGroupCodeList.tag && Object.is(quickGroupCodeList.codelistType,"STATIC")) {
const codelist = this.$store.getters.getCodeList(quickGroupCodeList.tag);
if (codelist) {
this.quickGroupModel = [...this.handleDynamicData(JSON.parse(JSON.stringify(codelist.items)))];
} else {
<#noparse>console.log(`----${quickGroupCodeList.tag}----代码表不存在`);</#noparse>
}
}else if (quickGroupCodeList.tag && Object.is(quickGroupCodeList.codelistType,"DYNAMIC")) {
this.codeListService.getItems(quickGroupCodeList.tag,{},{}).then((res:any) => {
this.quickGroupModel = res;
}).catch((error:any) => {
<#noparse>console.log(`----${quickGroupCodeList.tag}----代码表不存在`);</#noparse>
});
}
</#if>
}
/**
* 处理快速分组模型动态数据部分(%xxx%)
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public handleDynamicData (inputArray:Array<any>) {
if (inputArray.length > 0) {
inputArray.forEach((item:any) =>{
if (item.data && Object.keys(item.data).length > 0) {
Object.keys(item.data).forEach((name:any) => {
let value: any = item.data[name];
if (value && typeof(value)=='string' && value.startsWith('%') && value.endsWith('%')) {
const key = (value.substring(1, value.length - 1)).toLowerCase();
if (this.context[key]) {
value = this.context[key];
} else if (this.viewparams[key]) {
value = this.viewparams[key];
}
}
item.data[name] = value;
})
}
})
}
return inputArray;
}
/**
* 快速分组值变化
*
* @memberof ${srfclassname('${view.name}')}Base
*/
public quickGroupValueChange ($event:any) {
if ($event) {
this.quickGroupData = $event;
if (this.isEmitQuickGroupValue) {
}
}
this.isEmitQuickGroupValue = true;
}
</#if>
<#if view.hasPSControl('mdctrl')>
<#assign mdctrl = view.getPSControl('mdctrl')>
<#if mdctrl.getBatchPSDEToolbar?? && mdctrl.getBatchPSDEToolbar()??>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册