提交 7a8758e0 编写于 作者: tony001's avatar tony001

界面行为导航参数调整

上级 da61f905
......@@ -7,24 +7,28 @@ import Vue, { VNode, CreateElement } from "vue";
* @interface UIActionTool
*/
export declare interface UIActionTool {
/**
* 处理应用上下文参数
*
* @param actionTarget 数据目标
* @param args 传入数据对象
* @param parentContext 父上下文
* @param parentParams 父参数
* @param param 传入应用上下数据参数
*/
handleContextParam(actionTarget:any,args:any,context:any):any;
handleContextParam(actionTarget: any, args: any,parentContext:any,parentParams:any, context: any):any;
/**
* 处理界面行为参数
*
* @param actionTarget 数据目标
* @param args 传入数据对象
* @param parentContext 父上下文
* @param parentParams 父参数
* @param param 传入界面行为附加参数
*/
handleActionParam(actionTarget:any,args:any,params:any):any;
handleActionParam(actionTarget: any, args: any,parentContext:any,parentParams:any, params: any):any;
}
declare module "vue/types/vue" {
......
......@@ -8,10 +8,12 @@ export class UIActionTool {
*
* @param actionTarget 数据目标
* @param args 传入数据对象
* @param parentContext 父上下文
* @param parentParams 父参数
* @param param 传入应用上下数据参数
*/
public static handleContextParam(actionTarget: any, args: any, context: any) {
return this.formatData(actionTarget, args, context);
public static handleContextParam(actionTarget: any, args: any,parentContext:any,parentParams:any, context: any) {
return this.formatData(actionTarget, args,parentContext,parentParams,context);
}
/**
......@@ -19,10 +21,12 @@ export class UIActionTool {
*
* @param actionTarget 数据目标
* @param args 传入数据对象
* @param parentContext 父上下文
* @param parentParams 父参数
* @param param 传入界面行为附加参数
*/
public static handleActionParam(actionTarget: any, args: any, params: any) {
return this.formatData(actionTarget, args, params);
public static handleActionParam(actionTarget: any, args: any,parentContext:any,parentParams:any, params: any) {
return this.formatData(actionTarget, args,parentContext,parentParams,params);
}
/**
......@@ -32,11 +36,13 @@ export class UIActionTool {
* @static
* @param {*} actionTarget
* @param {*} args
* @param parentContext
* @param parentParams
* @param {*} _params
* @returns {*}
* @memberof UIActionTool
*/
private static formatData(actionTarget: any, args: any, _params: any): any {
private static formatData(actionTarget: any, args: any,parentContext:any,parentParams:any, _params: any): any {
let _data: any = {};
if (Object.is(actionTarget, 'SINGLEKEY')) {
let [arg] = args;
......@@ -50,12 +56,16 @@ export class UIActionTool {
const key = value.substring(1, value.length - 1);
if (arg && arg.hasOwnProperty(key)) {
value = (arg[key] !== null && arg[key] !== undefined) ? arg[key] : null;
} else {
} else if(parentContext && parentContext.hasOwnProperty(key)){
value = (parentContext[key] !== null && parentContext[key] !== undefined) ? parentContext[key] : null;
}else if(parentParams && parentParams.hasOwnProperty(key)){
value = (parentParams[key] !== null && parentParams[key] !== undefined) ? parentParams[key] : null;
}else {
hasProperty = false;
}
}
if(hasProperty){
Object.assign(_data, { [name]: value });
Object.assign(_data, { [name.toLowerCase()]: value });
}
});
} else if (Object.is(actionTarget, 'MULTIKEY')) {
......@@ -71,7 +81,11 @@ export class UIActionTool {
args.forEach((arg: any) => {
if (arg && arg.hasOwnProperty(key)) {
value = (arg[key] !== null && arg[key] !== undefined) ? arg[key] : null;
} else {
}else if(parentContext && parentContext.hasOwnProperty(key)){
value = (parentContext[key] !== null && parentContext[key] !== undefined) ? parentContext[key] : null;
}else if(parentParams && parentParams.hasOwnProperty(key)){
value = (parentParams[key] !== null && parentParams[key] !== undefined) ? parentParams[key] : null;
}else {
value = null;
noPropertyNum++;
}
......@@ -79,7 +93,7 @@ export class UIActionTool {
});
}
if(values.length !== noPropertyNum){
Object.assign(_data, { [name]: values.length > 0 ? values.join(',') : value });
Object.assign(_data, { [name.toLowerCase()]: values.length > 0 ? values.join(',') : value });
}
});
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册