提交 4e36ae94 编写于 作者: tony001's avatar tony001

视图消息服务补充context和viewparam

上级 bfd5798d
...@@ -115,10 +115,15 @@ export default class ${srfclassname('${item.getCodeName()}')}MessageServiceBase ...@@ -115,10 +115,15 @@ export default class ${srfclassname('${item.getCodeName()}')}MessageServiceBase
/** /**
* 转化消息模板标题和内容 * 转化消息模板标题和内容
*
* @target {*} target 返回目标数据
* @param {*} context 应用上下文
* @param {*} viewparam 视图参数
* @param {*} item 源数据
* *
* @memberof ${srfclassname('${item.getCodeName()}')}MessageServiceBase * @memberof ${srfclassname('${item.getCodeName()}')}MessageServiceBase
*/ */
public translateMessageTemp(target:any,item?:any){ public translateMessageTemp(target:any,context:any,viewparam:any,item?:any){
if(this.hasMessageTemp && Object.is(this.messageType,"HTML")){ if(this.hasMessageTemp && Object.is(this.messageType,"HTML")){
Object.assign(target,{title:`<#if item.getPSSysMsgTempl()?? && item.getPSSysMsgTempl().getSubject()??>${item.getPSSysMsgTempl().getSubject()}</#if>`}); Object.assign(target,{title:`<#if item.getPSSysMsgTempl()?? && item.getPSSysMsgTempl().getSubject()??>${item.getPSSysMsgTempl().getSubject()}</#if>`});
Object.assign(target,{content:`<#if item.getPSSysMsgTempl()?? && item.getPSSysMsgTempl().getContent()??>${item.getPSSysMsgTempl().getContent()}</#if>`}); Object.assign(target,{content:`<#if item.getPSSysMsgTempl()?? && item.getPSSysMsgTempl().getContent()??>${item.getPSSysMsgTempl().getContent()}</#if>`});
...@@ -134,10 +139,11 @@ export default class ${srfclassname('${item.getCodeName()}')}MessageServiceBase ...@@ -134,10 +139,11 @@ export default class ${srfclassname('${item.getCodeName()}')}MessageServiceBase
/** /**
* 获取远程数据 * 获取远程数据
* *
* @param {*} context * @param {*} context 应用上下文
* @param {*} data * @param {*} data 视图参数
* @param {boolean} [isloading] * @param {boolean} [isloading] 加载状态
* @returns {Promise<any>} * @returns {Promise<any>}
*
* @memberof ${srfclassname('${item.getCodeName()}')}MessageServiceBase * @memberof ${srfclassname('${item.getCodeName()}')}MessageServiceBase
*/ */
public getItems(context: any={}, data: any={}, isloading?: boolean): Promise<any> { public getItems(context: any={}, data: any={}, isloading?: boolean): Promise<any> {
...@@ -150,7 +156,7 @@ export default class ${srfclassname('${item.getCodeName()}')}MessageServiceBase ...@@ -150,7 +156,7 @@ export default class ${srfclassname('${item.getCodeName()}')}MessageServiceBase
promise.then((response: any) => { promise.then((response: any) => {
if (response && response.status === 200) { if (response && response.status === 200) {
const data = response.data; const data = response.data;
resolve(this.doItems(data)); resolve(this.doItems(data,tempContext,tempData));
} else { } else {
resolve([]); resolve([]);
} }
...@@ -166,12 +172,14 @@ export default class ${srfclassname('${item.getCodeName()}')}MessageServiceBase ...@@ -166,12 +172,14 @@ export default class ${srfclassname('${item.getCodeName()}')}MessageServiceBase
/** /**
* 处理数据 * 处理数据
* *
* @public * @param {any[]} items 源数据
* @param {any[]} items * @param {*} context 应用上下文
* @param {*} data 视图参数
* @returns {any[]} * @returns {any[]}
*
* @memberof ${srfclassname('${item.getCodeName()}')}MessageServiceBase * @memberof ${srfclassname('${item.getCodeName()}')}MessageServiceBase
*/ */
public doItems(items: any[]): any[] { public doItems(items: any[],context:any,viewparam:any): any[] {
let _items: any[] = []; let _items: any[] = [];
items.forEach((item: any) => { items.forEach((item: any) => {
let itemdata:any = { let itemdata:any = {
...@@ -188,7 +196,7 @@ export default class ${srfclassname('${item.getCodeName()}')}MessageServiceBase ...@@ -188,7 +196,7 @@ export default class ${srfclassname('${item.getCodeName()}')}MessageServiceBase
dynamicMode:"DYNAMIC", dynamicMode:"DYNAMIC",
messageType:"<#if item.getPSSysMsgTempl()?? && item.getPSSysMsgTempl().getContentType()??>${item.getPSSysMsgTempl().getContentType()}<#else>TEXT</#if>" messageType:"<#if item.getPSSysMsgTempl()?? && item.getPSSysMsgTempl().getContentType()??>${item.getPSSysMsgTempl().getContentType()}<#else>TEXT</#if>"
}; };
this.translateMessageTemp(itemdata,item); this.translateMessageTemp(itemdata,context,viewparam,item);
_items.push(itemdata); _items.push(itemdata);
}); });
return _items; return _items;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册