diff --git a/packages/panel-design/src/components/panel-item-widgets/hooks/use-ctrl-pos/use-ctrl-pos.ts b/packages/panel-design/src/components/panel-item-widgets/hooks/use-ctrl-pos/use-ctrl-pos.ts index 6895f069191485d394beb1fb2f2b64491efd8a41..effedcd527d7b67bb7699e2f85708ae750072c2c 100644 --- a/packages/panel-design/src/components/panel-item-widgets/hooks/use-ctrl-pos/use-ctrl-pos.ts +++ b/packages/panel-design/src/components/panel-item-widgets/hooks/use-ctrl-pos/use-ctrl-pos.ts @@ -135,6 +135,9 @@ export function useCtrlPos(props, ctx) { * @return {*} {Promise} */ const loadCtrlsByType = async (): Promise => { + if (props.context.srfpreview === true) { + return; + } if (ctrlType !== 'APPMENU') { const app = ibiz.hub.getApp(props.context.srfappid); const viewCtrlService = await app.deService.getService( diff --git a/packages/portal-design/src/portal-items/appmenu/appmenu.provider.ts b/packages/portal-design/src/portal-items/appmenu/appmenu.provider.ts new file mode 100644 index 0000000000000000000000000000000000000000..6f5bdcb30c7710257c2d4aac9cbb9804d87e1ab9 --- /dev/null +++ b/packages/portal-design/src/portal-items/appmenu/appmenu.provider.ts @@ -0,0 +1,23 @@ +import { IDataEntity, PanelItemController } from '@ibiz-template/runtime'; +import { IDEForm } from '@ibiz/model-core'; +import { IPortalItemController, IPortalItemProvider } from '../../interface'; +import { PortalItemController } from '../../controller'; +import { PortalDesignContentController } from '../../panel-items/portal-design-content/portal-design-content.controller'; + +export class AppMenuProvider implements IPortalItemProvider { + type: string = 'APPMENU'; + + component: string = 'IBizPortalDesignAppMenu'; + + createController( + c: PanelItemController, + model: IDEForm, + item: IDataEntity, + ): IPortalItemController { + return new PortalItemController( + c as PortalDesignContentController, + model, + item, + ); + } +} diff --git a/packages/portal-design/src/portal-items/appmenu/appmenu.scss b/packages/portal-design/src/portal-items/appmenu/appmenu.scss new file mode 100644 index 0000000000000000000000000000000000000000..8827491ba776be1a7eba8e512a0c9e1be6b267ec --- /dev/null +++ b/packages/portal-design/src/portal-items/appmenu/appmenu.scss @@ -0,0 +1,48 @@ +/* stylelint-disable selector-class-pattern */ +@include b(portal-design-app-menu) { + position: relative; + display: flex; + align-items: center; + width: 100%; + height: 100%; + min-height: 40px; + padding: 0 10px; + + &:hover { + @include b(portal-design-app-menu-mask) { + background-color: rgb(0 0 0 / 40%); + } + } + + @include when(active) { + @include b(portal-design-app-menu-mask) { + background-color: rgb(0 0 0 / 40%); + } + } +} + +@include b(portal-design-app-menu-text) { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +@include b(portal-design-app-menu-mask) { + position: absolute; + inset: 0; + display: flex; + align-items: center; + justify-content: center; +} + +@include b(portal-design-app-menu-action) { + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + + svg { + width: 30px; + height: 30px; + } +} diff --git a/packages/portal-design/src/portal-items/appmenu/appmenu.tsx b/packages/portal-design/src/portal-items/appmenu/appmenu.tsx new file mode 100644 index 0000000000000000000000000000000000000000..fc5c53bef190def57c06f3dd1bcc29e6ed7293ed --- /dev/null +++ b/packages/portal-design/src/portal-items/appmenu/appmenu.tsx @@ -0,0 +1,79 @@ +import { defineComponent } from 'vue'; +import { useNamespace } from '@ibiz-template/vue3-util'; +import { PortalItemController } from '../../controller'; +import './appmenu.scss'; + +export default defineComponent({ + name: 'IBizPortalDesignAppMenu', + props: { + controller: { + type: PortalItemController, + required: true, + }, + isActive: { + type: Boolean, + }, + }, + setup() { + const ns = useNamespace('portal-design-app-menu'); + + // 部件设计 + const ctrlDesign = (e: MouseEvent) => { + e.stopPropagation(); + }; + + return { ns, ctrlDesign }; + }, + render() { + const data = this.controller.data; + if (!data) { + return; + } + return ( +
+
{`${data.text}-[快速菜单栏]`}
+
+
{ + this.ctrlDesign(e); + }} + > + + + + + + + + + + + + + + +
+
+
+ ); + }, +}); diff --git a/packages/portal-design/src/portal-items/appmenu/index.ts b/packages/portal-design/src/portal-items/appmenu/index.ts index 637696ebd18277f32a2e50f6da9f4231a449c451..b332e1b318d8bb0272040babce43f292ff84365f 100644 --- a/packages/portal-design/src/portal-items/appmenu/index.ts +++ b/packages/portal-design/src/portal-items/appmenu/index.ts @@ -1,8 +1,14 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import { App } from 'vue'; +import Component from './appmenu'; +import { AppMenuProvider } from './appmenu.provider'; +import { portalItemProviderRegister } from '../../utils'; export default { install(app: App) { // 注册组件 + app.component(Component.name!, Component); + const provider = new AppMenuProvider(); + portalItemProviderRegister.registerItemProvider(provider.type, provider); }, }; diff --git a/packages/portal-design/src/portal-items/appview/appview.provider.ts b/packages/portal-design/src/portal-items/appview/appview.provider.ts new file mode 100644 index 0000000000000000000000000000000000000000..8a9d4ae4ef5625328d65159e128c26412ec8a2be --- /dev/null +++ b/packages/portal-design/src/portal-items/appview/appview.provider.ts @@ -0,0 +1,23 @@ +import { IDataEntity, PanelItemController } from '@ibiz-template/runtime'; +import { IDEForm } from '@ibiz/model-core'; +import { IPortalItemController, IPortalItemProvider } from '../../interface'; +import { PortalItemController } from '../../controller'; +import { PortalDesignContentController } from '../../panel-items/portal-design-content/portal-design-content.controller'; + +export class AppViewProvider implements IPortalItemProvider { + type: string = 'APPVIEW'; + + component: string = 'IBizPortalDesignAppView'; + + createController( + c: PanelItemController, + model: IDEForm, + item: IDataEntity, + ): IPortalItemController { + return new PortalItemController( + c as PortalDesignContentController, + model, + item, + ); + } +} diff --git a/packages/portal-design/src/portal-items/appview/appview.scss b/packages/portal-design/src/portal-items/appview/appview.scss new file mode 100644 index 0000000000000000000000000000000000000000..8b27f5debd5ff48205a94fd2284ebbd4c7f0e9ee --- /dev/null +++ b/packages/portal-design/src/portal-items/appview/appview.scss @@ -0,0 +1,48 @@ +/* stylelint-disable selector-class-pattern */ +@include b(portal-design-app-view) { + position: relative; + display: flex; + align-items: center; + width: 100%; + height: 100%; + min-height: 40px; + padding: 0 10px; + + &:hover { + @include b(portal-design-app-view-mask) { + background-color: rgb(0 0 0 / 40%); + } + } + + @include when(active) { + @include b(portal-design-app-view-mask) { + background-color: rgb(0 0 0 / 40%); + } + } +} + +@include b(portal-design-app-view-text) { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +@include b(portal-design-app-view-mask) { + position: absolute; + inset: 0; + display: flex; + align-items: center; + justify-content: center; +} + +@include b(portal-design-app-view-action) { + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + + svg { + width: 30px; + height: 30px; + } +} diff --git a/packages/portal-design/src/portal-items/appview/appview.tsx b/packages/portal-design/src/portal-items/appview/appview.tsx new file mode 100644 index 0000000000000000000000000000000000000000..fbd20a88ac2630a5bb7e25025e919a4aed0a54a9 --- /dev/null +++ b/packages/portal-design/src/portal-items/appview/appview.tsx @@ -0,0 +1,79 @@ +import { defineComponent } from 'vue'; +import { useNamespace } from '@ibiz-template/vue3-util'; +import { PortalItemController } from '../../controller'; +import './appview.scss'; + +export default defineComponent({ + name: 'IBizPortalDesignAppView', + props: { + controller: { + type: PortalItemController, + required: true, + }, + isActive: { + type: Boolean, + }, + }, + setup() { + const ns = useNamespace('portal-design-app-view'); + + // 部件设计 + const ctrlDesign = (e: MouseEvent) => { + e.stopPropagation(); + }; + + return { ns, ctrlDesign }; + }, + render() { + const data = this.controller.data; + if (!data) { + return; + } + return ( +
+
{`${data.text}-[嵌入视图]`}
+
+
{ + this.ctrlDesign(e); + }} + > + + + + + + + + + + + + + + +
+
+
+ ); + }, +}); diff --git a/packages/portal-design/src/portal-items/appview/index.ts b/packages/portal-design/src/portal-items/appview/index.ts index 637696ebd18277f32a2e50f6da9f4231a449c451..3996eca403a93c7947f23db53ab83dcfd0ba4967 100644 --- a/packages/portal-design/src/portal-items/appview/index.ts +++ b/packages/portal-design/src/portal-items/appview/index.ts @@ -1,8 +1,14 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import { App } from 'vue'; +import Component from './appview'; +import { AppViewProvider } from './appview.provider'; +import { portalItemProviderRegister } from '../../utils'; export default { install(app: App) { // 注册组件 + app.component(Component.name!, Component); + const provider = new AppViewProvider(); + portalItemProviderRegister.registerItemProvider(provider.type, provider); }, }; diff --git a/packages/portal-design/src/portal-items/index.ts b/packages/portal-design/src/portal-items/index.ts index 1c27e9e70f6804e2780934f481f8a8844cf48d32..b6263423ce3232940ab045560f1f245a16a38140 100644 --- a/packages/portal-design/src/portal-items/index.ts +++ b/packages/portal-design/src/portal-items/index.ts @@ -2,11 +2,17 @@ import { App } from 'vue'; import Container from './container'; import SysPortlet from './sysportlet'; import RawItem from './raw-item'; +import AppMenu from './appmenu'; +import AppView from './appview'; +import Other from './other'; export default { install(app: App) { app.use(Container); app.use(SysPortlet); app.use(RawItem); + app.use(AppMenu); + app.use(AppView); + app.use(Other); }, }; diff --git a/packages/portal-design/src/portal-items/other/index.ts b/packages/portal-design/src/portal-items/other/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..b71d1fe6889cee2f9cc421601bce326817e0671a --- /dev/null +++ b/packages/portal-design/src/portal-items/other/index.ts @@ -0,0 +1,14 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import { App } from 'vue'; +import Component from './other'; +import { OtherProvider } from './other.provider'; +import { portalItemProviderRegister } from '../../utils'; + +export default { + install(app: App) { + // 注册组件 + app.component(Component.name!, Component); + const provider = new OtherProvider(); + portalItemProviderRegister.registerItemProvider(provider.type, provider); + }, +}; diff --git a/packages/portal-design/src/portal-items/other/other.provider.ts b/packages/portal-design/src/portal-items/other/other.provider.ts new file mode 100644 index 0000000000000000000000000000000000000000..909d12b899920b7b82b773c73469400bc9ff3c73 --- /dev/null +++ b/packages/portal-design/src/portal-items/other/other.provider.ts @@ -0,0 +1,23 @@ +import { IDataEntity, PanelItemController } from '@ibiz-template/runtime'; +import { IDEForm } from '@ibiz/model-core'; +import { IPortalItemController, IPortalItemProvider } from '../../interface'; +import { PortalItemController } from '../../controller'; +import { PortalDesignContentController } from '../../panel-items/portal-design-content/portal-design-content.controller'; + +export class OtherProvider implements IPortalItemProvider { + type: string = 'OTHER'; + + component: string = 'IBizPortalDesignOther'; + + createController( + c: PanelItemController, + model: IDEForm, + item: IDataEntity, + ): IPortalItemController { + return new PortalItemController( + c as PortalDesignContentController, + model, + item, + ); + } +} diff --git a/packages/portal-design/src/portal-items/other/other.scss b/packages/portal-design/src/portal-items/other/other.scss new file mode 100644 index 0000000000000000000000000000000000000000..69e04ad5ca4b0b6a3183c32bb07441ef0ff33fbb --- /dev/null +++ b/packages/portal-design/src/portal-items/other/other.scss @@ -0,0 +1,8 @@ +@include b(portal-design-other) { + display: flex; + align-items: center; + width: 100%; + height: 100%; + min-height: 40px; + padding: 0 10px; +} \ No newline at end of file diff --git a/packages/portal-design/src/portal-items/other/other.tsx b/packages/portal-design/src/portal-items/other/other.tsx new file mode 100644 index 0000000000000000000000000000000000000000..849f2bae1d747ef13e38b254e3e66a9a6bd7f3d7 --- /dev/null +++ b/packages/portal-design/src/portal-items/other/other.tsx @@ -0,0 +1,31 @@ +import { defineComponent } from 'vue'; +import { useNamespace } from '@ibiz-template/vue3-util'; +import { PortalItemController } from '../../controller'; +import './other.scss'; + +export default defineComponent({ + name: 'IBizPortalDesignOther', + props: { + controller: { + type: PortalItemController, + required: true, + }, + isActive: { + type: Boolean, + }, + }, + setup() { + const ns = useNamespace('portal-design-other'); + + return { ns }; + }, + render() { + const data = this.controller.data; + if (!data) { + return; + } + return ( +
+ ); + }, +}); diff --git a/packages/portal-design/src/services/psapp-pvpart/psapp-pvpart.service.ts b/packages/portal-design/src/services/psapp-pvpart/psapp-pvpart.service.ts index 3ff0cfa631f994f1a6876d3685ce54edfc22bd84..e1eaee8ca303f2577a8b04b531cbdfde8232bd38 100644 --- a/packages/portal-design/src/services/psapp-pvpart/psapp-pvpart.service.ts +++ b/packages/portal-design/src/services/psapp-pvpart/psapp-pvpart.service.ts @@ -1,6 +1,6 @@ /* eslint-disable no-constant-condition */ /* eslint-disable no-plusplus */ -import { notNilEmpty } from 'qx-util'; +import { notNilEmpty, createUUID } from 'qx-util'; import { isEmpty, isNil } from 'ramda'; import { DEService, IDataEntity } from '@ibiz-template/runtime'; import { IHttpResponse } from '@ibiz-template/core'; @@ -36,6 +36,7 @@ export class PSAppPVPartService extends DEService { * @return {*} {Promise} */ async fillDefault(context: IContext, entity: PSAppPVPart): Promise { + entity.psapppvpartid = createUUID(); let nStartIndex = 1; const strDetailType = entity.itemtype; let strRootName: string = strDetailType; @@ -64,7 +65,6 @@ export class PSAppPVPartService extends DEService { strRootName + (nStartIndex === 0 ? '' : nStartIndex); if (!detailMap.has(strDefaultName) && !detailMap2.has(strDefaultName)) { entity.psapppvpartname = strDefaultName; - entity.psapppvpartid = strDefaultName; break; } nStartIndex++; diff --git a/packages/portal-design/src/services/pssys-dbpart/pssys-dbpart.service.ts b/packages/portal-design/src/services/pssys-dbpart/pssys-dbpart.service.ts index 2d32d42bb84d9025e91e78336f2b72459dd10d46..f5bd39987d54ccc1b3cebc64952d3deb0136188c 100644 --- a/packages/portal-design/src/services/pssys-dbpart/pssys-dbpart.service.ts +++ b/packages/portal-design/src/services/pssys-dbpart/pssys-dbpart.service.ts @@ -3,7 +3,7 @@ /* eslint-disable eqeqeq */ import { DEService, IDataEntity } from '@ibiz-template/runtime'; import { IHttpResponse } from '@ibiz-template/core'; -import { notNilEmpty } from 'qx-util'; +import { createUUID, notNilEmpty } from 'qx-util'; import { isEmpty, isNil } from 'ramda'; import { PSSysDBPart } from '../../entity'; @@ -37,6 +37,7 @@ export class PSSysDBPartService extends DEService { * @return {*} {Promise} */ async fillDefault(context: IContext, entity: PSSysDBPart): Promise { + entity.pssysdbpartid = createUUID(); let nStartIndex = 1; const strDetailType = entity.itemtype; let strRootName: string = strDetailType; @@ -65,7 +66,6 @@ export class PSSysDBPartService extends DEService { strRootName + (nStartIndex == 0 ? '' : nStartIndex); if (!detailMap.has(strDefaultName) && !detailMap2.has(strDefaultName)) { entity.pssysdbpartname = strDefaultName; - entity.pssysdbpartid = strDefaultName; break; } nStartIndex++; diff --git a/packages/portal-design/src/utils/portal-item-provider-register.tsx b/packages/portal-design/src/utils/portal-item-provider-register.tsx index cd2f9dc41436df50d19fcfc82e6586f7f8474f7a..4b96cb106c3bb183f86d86473a1ec8797e7b729e 100644 --- a/packages/portal-design/src/utils/portal-item-provider-register.tsx +++ b/packages/portal-design/src/utils/portal-item-provider-register.tsx @@ -37,7 +37,7 @@ export class PortalItemProviderRegister { * @param {string} type * @return {*} {IPortalItemProvider} */ - getItemProvider(type: string): IPortalItemProvider { + getItemProvider(type: string = 'OTHER'): IPortalItemProvider { const upperType = type.toUpperCase(); if (this.portalItemProviderMap.has(upperType)) { return this.portalItemProviderMap.get(upperType)!; diff --git a/packages/portal-design/src/views/portal-design-view/portal-design-view.engine.ts b/packages/portal-design/src/views/portal-design-view/portal-design-view.engine.ts index 3244a04d1a202d33d8f8e7dd87a08020737da4c7..41f09101eeb1428e7d1f9533314e0fbb9fae48a0 100644 --- a/packages/portal-design/src/views/portal-design-view/portal-design-view.engine.ts +++ b/packages/portal-design/src/views/portal-design-view/portal-design-view.engine.ts @@ -1,4 +1,5 @@ import { DesignViewEngineBase } from '@ibiz-template-plugin/design-base'; +import { SysUIActionTag } from '@ibiz-template/runtime'; import { PortalDesignViewController } from './portal-design-view.controller'; /** @@ -47,4 +48,26 @@ export class PortalDesignViewEngine extends DesignViewEngineBase { this.view.evt.emit('onSaveSuccess', undefined); return result; } + + /** + * 视图能力调用 + * + * @author zhanghengfeng + * @date 2024-11-22 20:11:55 + * @param {string} key + * @param {IData} [args] + * @return {*} {(Promise)} + */ + async call(key: string, args?: IData): Promise { + if (key === SysUIActionTag.REFRESH) { + await this.load(); + this.view.evt.emit('onUpdateSuccess', undefined); + this.navPos.openView({ key: '' }); + requestAnimationFrame(() => { + this.activeRoot(); + }); + return; + } + return super.call(key, args); + } }