提交 5712264d 编写于 作者: sq3536's avatar sq3536

Merge remote-tracking branch 'origin/master'

......@@ -22,7 +22,7 @@
notMode: '{{groupLogic.notMode}}',
Logics: [
{{#each groupLogic.psDEFDLogics as | logic |}}
{condOP: '{{logic.condOP}}',dEFDName: '{{logic.dEFDName}}',logicType: '{{logic.logicType}}',name: '{{logic.name}}',}
{condOP: '{{logic.condOP}}',dEFDName: '{{logic.dEFDName}}',logicType: '{{logic.logicType}}',name: '{{logic.name}}'},
{{/each}}
],
}
......
import { ViewPropsBase, ViewStateBase, toOneWayRef } from '@ibiz-core';
import { Ref } from 'vue';
import { useRoute } from 'vue-router';
import { ViewPropsBase, ViewStateBase, toOneWayRef, IParam } from '@ibiz-core';
/**
* @description 视图基类
......@@ -35,6 +37,36 @@ export class ViewBase {
this.viewState.viewSubject = toRef(props, 'viewSubject') as any;
}
/**
* @description 处理视图导航参数
* @param props 输入属性
* @param context 应用上下文
* @param viewParams 视图参数
*/
public handleViewContextParams(props: ViewPropsBase, context: Ref<IParam | undefined>, viewParams: Ref<IParam | undefined>) {
if (!context.value) context.value = {};
if (!viewParams.value) viewParams.value = {};
if (Object.is(props.openType, 'ROUTE')) {
const appContext = {};
Object.assign(context.value, appContext);
const pageContext = useRoute().params;
Object.assign(context.value, pageContext);
const pageCustomContext = {};
Object.assign(context.value, pageCustomContext);
console.log(context);
const pageViewParams = useRoute().query;
Object.assign(viewParams.value, pageViewParams);
const pageCustomViewParams = {};
Object.assign(viewParams.value, pageCustomViewParams);
console.log(viewParams);
} else {
const customContext = {};
Object.assign(context.value, customContext);
const pageCustomViewParams = {};
Object.assign(viewParams.value, pageCustomViewParams);
}
}
/**
* @description 使用视图上下文参数逻辑块
* @param {ViewPropsBase} props 传入的Props
......@@ -44,15 +76,14 @@ export class ViewBase {
public useViewContextParams(props: ViewPropsBase) {
const context = toOneWayRef(props, 'context');
const viewParams = toOneWayRef(props, 'viewParams');
// 导航视图参数处理
this.handleViewContextParams(props, context, viewParams);
watch(context, (newVal: any, oldVal: any) => {
this.handleViewContextParams(props, newVal,viewParams);
});
// 把Ref赋值到State上进行解包
this.viewState.context = context;
this.viewState.viewParams = viewParams;
// 视图部分额外处理
// todo 导航参数处理,自定义参数处理。
// todo viewparams 视图级隔离,如果没有用导航参数这些指定,则把上一层的都消除。
return { context, viewParams };
}
......
......@@ -20,6 +20,7 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
openType:'ROUTE',
viewSubject: () => new Subject<IActionParam>()
})
......
......@@ -17,7 +17,7 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
// 设定默认值,可选属性可以在这初始化
openType:'ROUTE',
viewSubject: () => new Subject<IActionParam>()
})
......
......@@ -17,7 +17,7 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
// 设定默认值,可选属性可以在这初始化
openType:'ROUTE',
viewSubject: () => new Subject<IActionParam>()
})
......
......@@ -17,7 +17,7 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
// 设定默认值,可选属性可以在这初始化
openType:'ROUTE',
viewSubject: () => new Subject<IActionParam>()
})
......
......@@ -12,7 +12,7 @@ interface Props {
}
const props = withDefaults(defineProps<Props>(), {
// 设定默认值,可选属性可以在这初始化
openType:'ROUTE',
viewSubject: () => new Subject<IActionParam>()
})
......
......@@ -16,7 +16,7 @@ const routes = [
{{/if}}
requireAuth: {{#eq app.defaultPSAppIndexView.accUserMode 0}}false{{else}}{{#eq app.defaultPSAppIndexView.accUserMode 3}}false{{else}}true{{/eq}}{{/eq}},
},
component: () => import("@page/default/{{spinalCase app.defaultPSAppIndexView.codeName}}"),
component: () => import("@page/{{spinalCase app.defaultPSAppIndexView.psAppModule.codeName}}/{{spinalCase app.defaultPSAppIndexView.codeName}}"),
children: [
{{#each app.appEntityResources as |appEntityResource|}}
{{#if appEntityResource.appDataEntity.allPSAppViews}}
......@@ -43,7 +43,7 @@ const routes = [
],
requireAuth: false,
},
component: () => import("@page/{{#if psAppDataEntity}}{{spinalCase psAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}"),
component: () => import("@page/{{spinalCase appView.psAppModule.codeName}}/{{spinalCase appView.codeName}}"),
},
{{/if}}
{{/each}}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册