提交 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,35 +54,40 @@ export const ListExpView = defineComponent({ ...@@ -53,35 +54,40 @@ export const ListExpView = defineComponent({
return { c, defaultSelectKeys, routeViewKey }; return { c, defaultSelectKeys, routeViewKey };
}, },
render() { render() {
const isRouter = this.c.context.isRouter === true;
let listComponent: VNode | null = null;
let expBarModel = null;
if (this.c.complete) { if (this.c.complete) {
const isRouter = this.c.context.isRouter === true;
const { listExpBar } = this.c.model; const { listExpBar } = this.c.model;
const { list } = listExpBar; const { list } = listExpBar;
return ( expBarModel = listExpBar;
<exp-view-base if (this.c.providers[list.name]) {
controller={this.c} listComponent = h(this.c.providers[list.name].component, {
expBarModel={this.c.model.listExpBar} props: {
scopedSlots={{ modelData: list,
default: () => { context: this.c.context,
if (this.c.providers[list.name]) { params: this.c.params,
const listComp = this.c.providers[list.name].component; isExpView: true,
return h(listComp, { isSelectFirstDefault: true,
props: { mdCtrlActiveMode: 1,
modelData: list, defaultSelectKeys: this.defaultSelectKeys,
context: this.c.context, },
params: this.c.params, on: {
isExpView: true, neuronInit: this.c.nerve.onNeuronInit(list.name),
isSelectFirstDefault: true, },
mdCtrlActiveMode: 1, });
defaultSelectKeys: this.defaultSelectKeys, }
}, }
on: { return (
neuronInit: this.c.nerve.onNeuronInit(list.name), <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,58 +54,58 @@ export const TreeExpView = defineComponent({ ...@@ -53,58 +54,58 @@ export const TreeExpView = defineComponent({
}, },
render() { render() {
const { currentNavKey, navViewParams } = this.c; const { currentNavKey, navViewParams } = this.c;
if (this.c.complete) { let treeComponent: VNode | null = null;
return ( let expBarModel = null;
<exp-view-base
controller={this.c}
expBarModel={this.c.model.treeExpBar}
scopedSlots={{
default: () => {
const { tree } = this.c.model;
if (this.c.providers[tree.name]) {
const comp = this.c.providers[tree.name].component;
return h(comp, {
props: {
modelData: tree,
context: this.c.context,
params: this.c.params,
defaultSelectKeys: this.defaultSelectKeys,
isSelectFirstDefault: true,
},
on: {
neuronInit: this.c.nerve.onNeuronInit('tree'),
},
});
}
},
expView: () => {
if (!currentNavKey) {
return;
}
if (!this.c.context.isRouter) {
// 非路由模式下绘制嵌入视图
return h('ViewShell', {
props: {
context: navViewParams[currentNavKey].context,
params: navViewParams[currentNavKey].params,
modal: { mode: ViewMode.EMBED },
modelPath: navViewParams[currentNavKey].modelPath,
key: currentNavKey,
},
});
}
// 路由模式下绘制 if (this.c.complete) {
if (this.routeViewKey) { const { tree } = this.c.model;
return <router-view key={this.routeViewKey}></router-view>; expBarModel = this.c.model.treeExpBar;
} if (this.c.providers[tree.name]) {
return null; treeComponent = h(this.c.providers[tree.name].component, {
}, props: {
}} modelData: tree,
></exp-view-base> context: this.c.context,
); params: this.c.params,
defaultSelectKeys: this.defaultSelectKeys,
isSelectFirstDefault: true,
},
on: {
neuronInit: this.c.nerve.onNeuronInit('tree'),
},
});
}
} }
return null; return (
<exp-view-base
controller={this.c}
expBarModel={expBarModel}
scopedSlots={{
default: () => treeComponent,
expView: () => {
if (!currentNavKey) {
return;
}
if (!this.c.context.isRouter) {
// 非路由模式下绘制嵌入视图
return h('ViewShell', {
props: {
context: navViewParams[currentNavKey].context,
params: navViewParams[currentNavKey].params,
modal: { mode: ViewMode.EMBED },
modelPath: navViewParams[currentNavKey].modelPath,
key: currentNavKey,
},
});
}
// 路由模式下绘制
if (this.routeViewKey) {
return <router-view key={this.routeViewKey}></router-view>;
}
return null;
},
}}
></exp-view-base>
);
}, },
}); });
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册