提交 dc537899 编写于 作者: WodahsOrez's avatar WodahsOrez

lxm--面板界面行为

上级 d4ea91ea
...@@ -93,6 +93,37 @@ ...@@ -93,6 +93,37 @@
*/ */
@Prop() public fetchAction!: string; @Prop() public fetchAction!: string;
<#if view.getPSAppViewLogics?? && view.getPSAppViewLogics()??>
<#list view.getPSAppViewLogics() as logic>
<#if logic.getPFLogicCodeType() == 'APP_NEWDATA'>
/**
* 打开新建数据视图
*
* @type {any}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
@Prop() public newdata: any;
</#if>
<#if logic.getPFLogicCodeType() == 'APP_OPENDATA'>
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
@Prop() public opendata: any;
</#if>
</#list>
</#if>
/**
* this引用
*
* @type {number}
* @memberof Main
*/
public thisRef: any = this;
/** /**
* 当前页 * 当前页
* *
......
...@@ -8,6 +8,16 @@ ...@@ -8,6 +8,16 @@
<#if view.getViewType() == 'DELISTEXPVIEW'> <#if view.getViewType() == 'DELISTEXPVIEW'>
:isSelectFirstDefault="true" :isSelectFirstDefault="true"
</#if> </#if>
<#if view.getPSAppViewLogics?? && view.getPSAppViewLogics()??>
<#list view.getPSAppViewLogics() as logic>
<#if logic.getPFLogicCodeType() == 'APP_NEWDATA'>
:newdata="newdata"
</#if>
<#if logic.getPFLogicCodeType() == 'APP_OPENDATA'>
:opendata="opendata"
</#if>
</#list>
</#if>
</#assign> </#assign>
<#ibizinclude> <#ibizinclude>
../@MACRO/HTML/DEFAULT.html.ftl ../@MACRO/HTML/DEFAULT.html.ftl
......
...@@ -17,10 +17,10 @@ import CodeListService from "@service/app/codelist-service"; ...@@ -17,10 +17,10 @@ import CodeListService from "@service/app/codelist-service";
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
getDatas(): any[] { getDatas(): any[] {
if (!this.data) { if (!this.panelData) {
return []; return [];
} }
return [this.data]; return [this.panelData];
} }
/** /**
...@@ -33,6 +33,14 @@ import CodeListService from "@service/app/codelist-service"; ...@@ -33,6 +33,14 @@ import CodeListService from "@service/app/codelist-service";
return this.data; return this.data;
} }
/**
* 父级部件引用
*
* @type {*}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
@Prop() public parentRef?: any;
/** /**
* 面板数据对象 * 面板数据对象
* *
...@@ -90,6 +98,14 @@ import CodeListService from "@service/app/codelist-service"; ...@@ -90,6 +98,14 @@ import CodeListService from "@service/app/codelist-service";
*/ */
public data:any = {}; public data:any = {};
/**
* 面板数据对象
*
* @type {*}
* @memberof Mob
*/
public panelData:any = null;
/** /**
* 监听数据对象 * 监听数据对象
* *
...@@ -135,13 +151,46 @@ import CodeListService from "@service/app/codelist-service"; ...@@ -135,13 +151,46 @@ import CodeListService from "@service/app/codelist-service";
} }
} }
/**
* 计算面板数据
*
* @param codelistArray 代码表模型数组
* @memberof Mob
*/
public async computePanelData(){
let codelistArray:Array<any> = [];
let panelData:any = {};
if((this.dataModel.getDataItems instanceof Function) && this.dataModel.getDataItems().length >0){
this.dataModel.getDataItems().forEach((item:any) =>{
if(item.codelist){
codelistArray.push(item.codelist);
}
})
if(codelistArray.length >0){
let res:any = await this.getAllCodeList(codelistArray,true);
this.dataModel.getDataItems().forEach((item:any) =>{
if(item.codelist){
panelData[item.prop] = res.get(item.codelist.tag).get(this.data[item.name]);
}else{
panelData[item.prop] = this.data[item.name];
}
})
}else{
this.dataModel.getDataItems().forEach((item:any) =>{
panelData[item.prop] = this.data[item.name];
})
}
}
this.panelData = Object.assign(JSON.parse(JSON.stringify(this.inputData)),panelData);
}
/** /**
* 获取所有代码表 * 获取所有代码表
* *
* @param codelistArray 代码表模型数组 * @param codelistArray 代码表模型数组
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public getAllCodeList(codelistArray:Array<any>):Promise<any>{ public getAllCodeList(codelistArray:Array<any>,reverse:boolean = false):Promise<any>{
return new Promise((resolve:any,reject:any) =>{ return new Promise((resolve:any,reject:any) =>{
let codeListMap:Map<string,any> = new Map(); let codeListMap:Map<string,any> = new Map();
let promiseArray:Array<any> = []; let promiseArray:Array<any> = [];
...@@ -154,7 +203,11 @@ import CodeListService from "@service/app/codelist-service"; ...@@ -154,7 +203,11 @@ import CodeListService from "@service/app/codelist-service";
let tempCodeListMap:Map<number,any> = new Map(); let tempCodeListMap:Map<number,any> = new Map();
if(codeList.length >0){ if(codeList.length >0){
codeList.forEach((codeListItem:any) =>{ codeList.forEach((codeListItem:any) =>{
tempCodeListMap.set(codeListItem.value,codeListItem.text); if(reverse){
tempCodeListMap.set(codeListItem.text,codeListItem.value);
}else{
tempCodeListMap.set(codeListItem.value,codeListItem.text);
}
}) })
} }
codeListMap.set(item.tag,tempCodeListMap); codeListMap.set(item.tag,tempCodeListMap);
...@@ -194,24 +247,6 @@ import CodeListService from "@service/app/codelist-service"; ...@@ -194,24 +247,6 @@ import CodeListService from "@service/app/codelist-service";
}) })
} }
<#if ctrl.getAllPSPanelItems()??>
<#list ctrl.getAllPSPanelItems() as panelItem>
<#if panelItem.getItemType() == "BUTTON">
/**
* 面板 ${panelItem.getCaption()} 事件
*
* @memberof @memberof ${srfclassname('${ctrl.codeName}')}
*/
public ${panelItem.getName()}_click($event: any): void {
<#if panelItem.getPSUIAction?? && panelItem.getPSUIAction()??>
<#assign uiaction = panelItem.getPSUIAction()>
this.${ctrl.name}_${panelItem.getName()}_click(null, null, $event);
</#if>
}
</#if>
</#list>
</#if>
/** /**
* 界面行为 * 界面行为
* *
...@@ -220,7 +255,8 @@ import CodeListService from "@service/app/codelist-service"; ...@@ -220,7 +255,8 @@ import CodeListService from "@service/app/codelist-service";
* @param {*} $event * @param {*} $event
* @memberof ${srfclassname('${ctrl.codeName}')} * @memberof ${srfclassname('${ctrl.codeName}')}
*/ */
public uiAction(row: any, tag: any, $event: any) { public async uiAction(row: any, tag: any, $event: any) {
await this.computePanelData();
<#if ctrl.getPSAppViewLogics()??> <#if ctrl.getPSAppViewLogics()??>
<#list ctrl.getPSAppViewLogics() as logic> <#list ctrl.getPSAppViewLogics() as logic>
<#if logic.getPSAppViewUIAction().getPSUIAction()??> <#if logic.getPSAppViewUIAction().getPSUIAction()??>
...@@ -233,6 +269,55 @@ import CodeListService from "@service/app/codelist-service"; ...@@ -233,6 +269,55 @@ import CodeListService from "@service/app/codelist-service";
</#if> </#if>
} }
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any){
if (this.parentRef.opendata && this.parentRef.opendata instanceof Function) {
this.parentRef.opendata(args,fullargs,params, $event, xData);
}
}
/**
* 打开新建数据视图
*
* @type {any}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public newdata(args: any[],fullargs?:any[], params?: any, $event?: any, xData?: any) {
if (this.parentRef.newdata && this.parentRef.newdata instanceof Function) {
this.parentRef.newdata(args,fullargs,params, $event, xData);
}
}
/**
* 删除
*
* @param {any[]} datas
* @returns {Promise<any>}
* @memberof ${srfclassname('${ctrl.codeName}')}
*/
public async remove(datas: any[]): Promise<any> {
if (this.parentRef.remove && this.parentRef.remove instanceof Function) {
return this.parentRef.remove(datas);
}
}
/**
* 刷新
*
* @param {*} [opt={}]
* @memberof Main
*/
public refresh(opt: any = {}) {
if (this.parentRef.refresh && this.parentRef.refresh instanceof Function) {
this.parentRef.refresh(opt);
}
}
<#ibizinclude> <#ibizinclude>
../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl ../@MACRO/CONTROL/CONTROL_BOTTOM-BASE.vue.ftl
</#ibizinclude> </#ibizinclude>
......
<#assign content>
:parentRef="thisRef"
</#assign>
<#ibizinclude> <#ibizinclude>
../@MACRO/HTML/DEFAULT.html.ftl ../@MACRO/HTML/DEFAULT.html.ftl
</#ibizinclude> </#ibizinclude>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册