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

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

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