提交 3ee480c0 编写于 作者: KK's avatar KK

编辑器导航参数处理调整

上级 46d29c00
......@@ -83,7 +83,7 @@
* 导航参数
*
* @type {*}
* @memberof AppSelect
* @memberof AppCheckList
*/
@Prop({ default: {} }) protected navigateParam?: any;
......@@ -91,7 +91,7 @@
* 导航上下文
*
* @type {*}
* @memberof AppSelect
* @memberof AppCheckList
*/
@Prop({ default: {} }) protected navigateContext?: any;
......@@ -99,7 +99,7 @@
* 应用上下文
*
* @type {*}
* @memberof AppSelect
* @memberof AppCheckList
*/
@Prop({ default: {} }) protected context?: any;
......@@ -107,11 +107,33 @@
* 是否缓存
*
* @type {*}
* @memberof AppSelect
* @memberof AppCheckList
*/
@Prop({ default: true }) protected isCache?: boolean;
/**
* 传入表单数据
*
* @type {*}
* @memberof AppCheckList
*/
@Prop() public data?: any;
/**
* 视图参数
*
* @type {*}
* @memberof AppCheckList
*/
@Prop() public viewparams!: any;
/**
* 生命周期
*
* @type {*}
* @memberof AppCheckList
*/
public created() {
if (this.tag && this.type) {
if (Object.is(this.type, "dynamic")) {
......@@ -125,11 +147,9 @@
});
} else {
// 处理导航参数、上下文参数
let _context: any = {};
let _queryParam: any = {};
Object.assign(_context,this.context,this.navigateContext);
Object.assign(_queryParam,this.navigateParam);
this.options = this.$store.getters.getCodeListItems(this.tag ,this.isCache, { ..._context }, _queryParam);
let param: any= {};
this.handleOtherParam(param);
this.options = this.$store.getters.getCodeListItems(this.tag ,this.isCache, param.context, param.param);
}
}
}
......@@ -153,6 +173,23 @@
select.value = this.curValue;
}
/**
* 处理额外参数
*/
public handleOtherParam(arg:any) {
if (!this.data) {
return false;
}
// 合并表单参数
arg.param = this.viewparams ? JSON.parse(JSON.stringify(this.viewparams)) : {};
arg.context = this.context ? JSON.parse(JSON.stringify(this.context)) : {};
// 附加参数处理
const param = this.$viewTool.doEditorItemParam({context:this.navigateContext,param:this.navigateParam},this.context,this.viewparams,this.data);
Object.assign(arg.context,param.context);
Object.assign(arg.param,param.param);
return true;
}
/**
* 清空值
* @memberof @memberof AppCheckList
......
......@@ -233,34 +233,17 @@ export default class AppMobMpicker extends Vue {
* @memberof AppMobMpicker
*/
public handlePublicParams(arg: any): boolean {
// if (!this.itemParam) {
// return true;
// }
// if (!this.data) {
// this.$notify({ type: "danger", message: "表单数据异常!" });
// return false;
// }
// 合并表单参数
let _context: any = {};
let _params: any = {};
Object.assign(_context,this.context,this.navigateContext);
Object.assign(_params,this.viewparams,this.navigateParam);
arg.param = _params;
arg.context = _context;
// 附加参数处理
// if (this.itemParam.context) {
// let _context = this.$util.formatData(this.data,this.itemParam.context);
// Object.assign(arg.context, {});
// }
// if (this.itemParam.param) {
// let _param = this.$util.formatData(this.data,this.itemParam.param);
// Object.assign(arg.param, {});
// }
// if (this.itemParam.parentdata) {
// let _parentdata = this.$util.formatData(this.data,this.itemParam.parentdata);
// Object.assign(arg.param, {});
// }
return true;
if (!this.data) {
return false;
}
// 合并表单参数
arg.param = this.viewparams ? JSON.parse(JSON.stringify(this.viewparams)) : {};
arg.context = this.context ? JSON.parse(JSON.stringify(this.context)) : {};
// 附加参数处理
const param = this.$viewTool.doEditorItemParam({context:this.navigateContext,param:this.navigateParam},this.context,this.viewparams,this.data);
Object.assign(arg.context,param.context);
Object.assign(arg.param,param.param);
return true;
}
/**
......
......@@ -694,33 +694,16 @@ export default class AppPicker extends Vue {
* @memberof AppPicker
*/
public handlePublicParams(arg: any): boolean {
if (!this.itemParam) {
return true;
}
if (!this.data) {
this.$notify({ type: 'danger', message: this.$t('formDataIsAbnormal')+"" });
return false;
}
// 合并表单参数
let _context: any = {};
let _params: any = {};
Object.assign(_context,this.context,this.navigateContext);
Object.assign(_params,this.viewparams,this.navigateParam);
arg.param = JSON.parse(JSON.stringify(_params));
arg.context = JSON.parse(JSON.stringify(_context));
arg.param = this.viewparams ? JSON.parse(JSON.stringify(this.viewparams)) : {};
arg.context = this.context ? JSON.parse(JSON.stringify(this.context)) : {};
// 附加参数处理
if (this.itemParam.context) {
// let _context = this.$util.formatData(this.data,this.itemParam.context);
Object.assign(arg.context, {});
}
if (this.itemParam.param) {
// let _param = this.$util.formatData(this.data,this.itemParam.param);
Object.assign(arg.param, {});
}
if (this.itemParam.parentdata) {
// let _parentdata = this.$util.formatData(this.data,this.itemParam.parentdata);
Object.assign(arg.param, {});
}
const param = this.$viewTool.doEditorItemParam({context:this.navigateContext,param:this.navigateParam},this.context,this.viewparams,this.data);
Object.assign(arg.context,param.context);
Object.assign(arg.param,param.param);
return true;
}
......
......@@ -142,6 +142,14 @@ export default class AppSelect extends Vue {
*/
@Prop({ default: true }) protected isCache?: boolean;
/**
* 视图参数
*
* @type {*}
* @memberof AppMobMpicker
*/
@Prop() public viewparams!: any;
/**
* 是否被缓存
*
......@@ -160,7 +168,7 @@ export default class AppSelect extends Vue {
@Watch('data', { deep: true })
onDataChange(newVal: any, val: any) {
if (newVal) {
this.handleOtherParam();
// this.handleOtherParam();
}
}
......@@ -191,11 +199,12 @@ export default class AppSelect extends Vue {
Loading.show(this.$t('app.loadding'));
}
// 处理导航参数、上下文参数
let _context: any = {};
let _queryParam: any = {};
Object.assign(_context,this.context,this.navigateContext);
Object.assign(_queryParam,this.queryParam,this.navigateParam);
let response: any = await this.codeListService.getItems(this.tag, this.isCache, { ..._context }, _queryParam);
let param: any = {};
const bcancel: boolean =this.handleOtherParam(param);
if(!bcancel){
return
}
let response: any = await this.codeListService.getItems(this.tag, this.isCache, param.context, param.param);
if (!this.isCached) {
Loading.hidden();
}
......@@ -220,27 +229,18 @@ export default class AppSelect extends Vue {
/**
* 处理额外参数
*/
public handleOtherParam() {
if (!this.itemParam) {
return;
public handleOtherParam(arg:any) {
if (!this.data) {
return false;
}
this.queryParam = {};
let parentdata: any = this.itemParam.parentdata;
if (!(parentdata && Object.keys(parentdata).length > 0)) {
return;
}
Object.keys(parentdata).forEach((item: any) => {
let value: string | null = parentdata[item];
if (value && value.startsWith("%") && value.endsWith("%")) {
const key = value.substring(1, value.length - 1);
if (this.data && this.data.hasOwnProperty(key)) {
value = (this.data[key] !== null && this.data[key] !== undefined) ? this.data[key] : null;
} else {
value = null;
}
}
Object.assign(this.queryParam, { [item]: value });
});
// 合并表单参数
arg.param = this.viewparams ? JSON.parse(JSON.stringify(this.viewparams)) : {};
arg.context = this.context ? JSON.parse(JSON.stringify(this.context)) : {};
// 附加参数处理
const param = this.$viewTool.doEditorItemParam({context:this.navigateContext,param:this.navigateParam},this.context,this.viewparams,this.data);
Object.assign(arg.context,param.context);
Object.assign(arg.param,param.param);
return true;
}
}
</script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册