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

编辑器导航参数处理调整

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