提交 4c4face0 编写于 作者: ibizdev's avatar ibizdev

zhujiamin 发布系统代码 [TrainSys,网页端]

上级 c765c1f1
...@@ -13,14 +13,13 @@ export const ExpViewBase = defineComponent({ ...@@ -13,14 +13,13 @@ export const ExpViewBase = defineComponent({
}, },
expBarModel: { expBarModel: {
type: Object as PropType<IExpBarModel>, type: Object as PropType<IExpBarModel>,
required: true,
}, },
}, },
setup(props) { setup(props) {
const ns = useNamespace('exp-view'); const ns = useNamespace('exp-view');
const cssVars = computed(() => { const cssVars = computed(() => {
if (props.controller.model.expBarWidth) { if (props.controller.model?.expBarWidth) {
return ns.cssVarBlock({ return ns.cssVarBlock({
'left-width': `${props.controller.model.expBarWidth}px`, 'left-width': `${props.controller.model.expBarWidth}px`,
}); });
...@@ -31,8 +30,8 @@ export const ExpViewBase = defineComponent({ ...@@ -31,8 +30,8 @@ export const ExpViewBase = defineComponent({
// 是否显示头部 // 是否显示头部
const isShowHeader = computed(() => { const isShowHeader = computed(() => {
return ( return (
props.expBarModel.showTitleBar || props.expBarModel?.showTitleBar ||
props.expBarModel.enableSearch || props.expBarModel?.enableSearch ||
props.controller.model.toolbar props.controller.model.toolbar
); );
}); });
...@@ -101,33 +100,33 @@ export const ExpViewBase = defineComponent({ ...@@ -101,33 +100,33 @@ export const ExpViewBase = defineComponent({
<div <div
class={this.ns.be('exp-bar-header-left', 'caption')} class={this.ns.be('exp-bar-header-left', 'caption')}
> >
{this.expBarModel.showTitleBar && {this.expBarModel?.showTitleBar &&
(this.expBarModel.getPSSysImage ? ( (this.expBarModel?.getPSSysImage ? (
[ [
<app-icon <app-icon
class={this.ns.be('caption', 'icon')} class={this.ns.be('caption', 'icon')}
icon={this.expBarModel.getPSSysImage} icon={this.expBarModel?.getPSSysImage}
></app-icon>, ></app-icon>,
<span <span
class={this.ns.be('caption', 'text')} class={this.ns.be('caption', 'text')}
title={this.expBarModel.title} title={this.expBarModel?.title}
> >
{this.expBarModel.title} {this.expBarModel?.title}
</span>, </span>,
] ]
) : ( ) : (
<span <span
class={this.ns.be('caption', 'text')} class={this.ns.be('caption', 'text')}
title={this.expBarModel.title} title={this.expBarModel?.title}
> >
{this.expBarModel.title} {this.expBarModel?.title}
</span> </span>
))} ))}
</div> </div>
</div> </div>
<div class={this.ns.b('exp-bar-header-right')}> <div class={this.ns.b('exp-bar-header-right')}>
<div class={this.ns.e('quick-search')}> <div class={this.ns.e('quick-search')}>
{c.complete && this.expBarModel.enableSearch && ( {c.complete && this.expBarModel?.enableSearch && (
<quick-search <quick-search
value={c.query} value={c.query}
viewMode={c.modal.mode} viewMode={c.modal.mode}
......
...@@ -7,6 +7,7 @@ import { ...@@ -7,6 +7,7 @@ import {
Ref, Ref,
toRef, toRef,
getCurrentInstance, getCurrentInstance,
VNode,
} from 'vue'; } from 'vue';
import qs from 'qs'; import qs from 'qs';
import { import {
...@@ -53,19 +54,15 @@ export const ListExpView = defineComponent({ ...@@ -53,19 +54,15 @@ export const ListExpView = defineComponent({
return { c, defaultSelectKeys, routeViewKey }; return { c, defaultSelectKeys, routeViewKey };
}, },
render() { render() {
if (this.c.complete) {
const isRouter = this.c.context.isRouter === true; const isRouter = this.c.context.isRouter === true;
let listComponent: VNode | null = null;
let expBarModel = null;
if (this.c.complete) {
const { listExpBar } = this.c.model; const { listExpBar } = this.c.model;
const { list } = listExpBar; const { list } = listExpBar;
return ( expBarModel = listExpBar;
<exp-view-base
controller={this.c}
expBarModel={this.c.model.listExpBar}
scopedSlots={{
default: () => {
if (this.c.providers[list.name]) { if (this.c.providers[list.name]) {
const listComp = this.c.providers[list.name].component; listComponent = h(this.c.providers[list.name].component, {
return h(listComp, {
props: { props: {
modelData: list, modelData: list,
context: this.c.context, context: this.c.context,
...@@ -80,8 +77,17 @@ export const ListExpView = defineComponent({ ...@@ -80,8 +77,17 @@ export const ListExpView = defineComponent({
}, },
}); });
} }
}, }
return (
<exp-view-base
controller={this.c}
expBarModel={expBarModel}
scopedSlots={{
default: () => listComponent,
expView: () => { expView: () => {
if (this.c.complete) {
const { listExpBar } = this.c.model;
const { list } = listExpBar;
if (!list.navView) { if (!list.navView) {
return null; return null;
} }
...@@ -101,11 +107,10 @@ export const ListExpView = defineComponent({ ...@@ -101,11 +107,10 @@ export const ListExpView = defineComponent({
}, },
key: this.c.navItem.key, key: this.c.navItem.key,
}); });
}
}, },
}} }}
></exp-view-base> ></exp-view-base>
); );
}
return null;
}, },
}); });
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
ref, ref,
Ref, Ref,
toRef, toRef,
VNode,
watch, watch,
} from 'vue'; } from 'vue';
...@@ -53,17 +54,14 @@ export const TreeExpView = defineComponent({ ...@@ -53,17 +54,14 @@ export const TreeExpView = defineComponent({
}, },
render() { render() {
const { currentNavKey, navViewParams } = this.c; const { currentNavKey, navViewParams } = this.c;
let treeComponent: VNode | null = null;
let expBarModel = null;
if (this.c.complete) { if (this.c.complete) {
return (
<exp-view-base
controller={this.c}
expBarModel={this.c.model.treeExpBar}
scopedSlots={{
default: () => {
const { tree } = this.c.model; const { tree } = this.c.model;
expBarModel = this.c.model.treeExpBar;
if (this.c.providers[tree.name]) { if (this.c.providers[tree.name]) {
const comp = this.c.providers[tree.name].component; treeComponent = h(this.c.providers[tree.name].component, {
return h(comp, {
props: { props: {
modelData: tree, modelData: tree,
context: this.c.context, context: this.c.context,
...@@ -76,12 +74,17 @@ export const TreeExpView = defineComponent({ ...@@ -76,12 +74,17 @@ export const TreeExpView = defineComponent({
}, },
}); });
} }
}, }
return (
<exp-view-base
controller={this.c}
expBarModel={expBarModel}
scopedSlots={{
default: () => treeComponent,
expView: () => { expView: () => {
if (!currentNavKey) { if (!currentNavKey) {
return; return;
} }
if (!this.c.context.isRouter) { if (!this.c.context.isRouter) {
// 非路由模式下绘制嵌入视图 // 非路由模式下绘制嵌入视图
return h('ViewShell', { return h('ViewShell', {
...@@ -104,7 +107,5 @@ export const TreeExpView = defineComponent({ ...@@ -104,7 +107,5 @@ export const TreeExpView = defineComponent({
}} }}
></exp-view-base> ></exp-view-base>
); );
}
return null;
}, },
}); });
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册