import { AppServiceBase } from '@ibizstudio/runtime'; import { Vue, Prop } from 'vue-property-decorator'; /** * 视图布局组件基类 * * @export * @class StudioViewBase * @extends {Vue} */ export class StudioViewBase extends Vue { /** * 视图名称 * * @type {string} * @memberof StudioViewBase */ @Prop({ default: '' }) viewName!: string; /** * 视图标题 * * @type {string} * @memberof StudioViewBase */ @Prop({ default: '' }) viewTitle!: string; /** * 是否隐藏视图头部 * * @protected * @type {boolean} * @memberof StudioViewBase */ @Prop({ default: false }) protected hiddenHeader!: boolean; /** * 视图实例 * * @public * @type {any} * @memberof StudioViewBase */ @Prop() declare viewInstance: any; /** * 应用上下文 * * @public * @type {any} * @memberof StudioViewBase */ @Prop() declare context: any; /** * 视图参数 * * @public * @type {any} * @memberof StudioViewBase */ @Prop() declare viewparams: any; /** * 是否显示视图头 * * @protected * @type {boolean} * @memberof StudioViewBase */ protected isShowHeader: boolean = true; /** * 组件创建完毕 * * @memberof StudioViewBase */ created(): void { if (this.hiddenHeader) { this.isShowHeader = false; } else { this.isShowHeader = this.$slots.title || this.$slots.toolbar || this.$slots.quickSearch || this.$slots.quickSearchForm || this.$slots.quickGroupSearch ? true : false; } } /** * 计算容器样式 * * @protected * @param {{ [str: string]: boolean }} [classNames] 样式名称对象 * @returns {{ [str: string]: boolean }} * @memberof StudioViewBase */ protected getContainerClass(classNames?: { [str: string]: boolean }): { [str: string]: boolean } { const data = { 'studio-view': true, 'view-container': true, 'hidden-header': !this.isShowHeader, 'show-footer': this.$slots.footer ? true : false, }; if (classNames) { Object.assign(data, classNames); } return data; } /** * 绘制视图内容 * * @protected * @returns {*} * @memberof StudioViewBase */ protected renderContent(): any { return [ this.$slots.topMessage ? this.$slots.topMessage : null, this.isShowHeader ? (