From 0f133012c63fd9acea83740113bfdaf3541b4a49 Mon Sep 17 00:00:00 2001 From: zhf <1204297681@qq.com> Date: Fri, 8 Dec 2023 18:48:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A1=A5=E5=85=85=E7=94=98=E7=89=B9?= =?UTF-8?q?=E5=9B=BE=E8=A7=86=E5=9B=BE=E5=BC=95=E6=93=8E=E5=92=8C=E7=94=98?= =?UTF-8?q?=E7=89=B9=E5=9B=BE=E9=83=A8=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + src/control/gantt/gantt.provider.ts | 14 +++++++++++++ src/control/gantt/gantt.tsx | 31 ++++++++++++++++++++++++++++ src/control/gantt/index.ts | 12 +++++++++++ src/control/index.ts | 1 + src/index.ts | 2 ++ src/view-engine/gantt-view.engine.ts | 20 ++++++++++++++++++ src/view-engine/index.ts | 5 +++++ 8 files changed, 86 insertions(+) create mode 100644 src/control/gantt/gantt.provider.ts create mode 100644 src/control/gantt/gantt.tsx create mode 100644 src/control/gantt/index.ts create mode 100644 src/view-engine/gantt-view.engine.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 788fd16f2..cf2ec3304 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### Added - 默认登录页识别 orgid 当面板数据中有 orgid 时,username 传递值为 username@orgid +- 补充甘特图视图引擎和甘特图部件 ## [0.4.7] - 2023-12-07 diff --git a/src/control/gantt/gantt.provider.ts b/src/control/gantt/gantt.provider.ts new file mode 100644 index 000000000..d4c086b0e --- /dev/null +++ b/src/control/gantt/gantt.provider.ts @@ -0,0 +1,14 @@ +import { IControlProvider } from '@ibiz-template/runtime'; + +/** + * 甘特图适配器 + * + * @author zhanghengfeng + * @date 2023-12-08 15:12:11 + * @export + * @class GanttProvider + * @implements {IControlProvider} + */ +export class GanttProvider implements IControlProvider { + component: string = 'IBizGanttControl'; +} diff --git a/src/control/gantt/gantt.tsx b/src/control/gantt/gantt.tsx new file mode 100644 index 000000000..b7b98626a --- /dev/null +++ b/src/control/gantt/gantt.tsx @@ -0,0 +1,31 @@ +import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { defineComponent, PropType } from 'vue'; +import { IDEGantt } from '@ibiz/model-core'; +import { IControlProvider, GanttController } from '@ibiz-template/runtime'; + +export const GanttControl = defineComponent({ + name: 'IBizGanttControl', + props: { + modelData: { type: Object as PropType, required: true }, + context: { type: Object as PropType, required: true }, + params: { type: Object as PropType, default: () => ({}) }, + provider: { type: Object as PropType }, + loadDefault: { type: Boolean, default: true }, + }, + setup() { + const c = useControlController((...args) => new GanttController(...args)); + const ns = useNamespace(`control-${c.model.controlType!.toLowerCase()}`); + + return { + c, + ns, + }; + }, + render() { + return ( + + 甘特图 + + ); + }, +}); diff --git a/src/control/gantt/index.ts b/src/control/gantt/index.ts new file mode 100644 index 000000000..957985f92 --- /dev/null +++ b/src/control/gantt/index.ts @@ -0,0 +1,12 @@ +import { registerControlProvider, ControlType } from '@ibiz-template/runtime'; +import { withInstall } from '@ibiz-template/vue3-util'; +import { App } from 'vue'; +import { GanttControl } from './gantt'; +import { GanttProvider } from './gantt.provider'; + +export const IBizGanttControl = withInstall(GanttControl, function (v: App) { + v.component(GanttControl.name, GanttControl); + registerControlProvider(ControlType.GANTT, () => new GanttProvider()); +}); + +export default IBizGanttControl; diff --git a/src/control/index.ts b/src/control/index.ts index 4bb09c1a9..e418589d3 100644 --- a/src/control/index.ts +++ b/src/control/index.ts @@ -23,3 +23,4 @@ export * from './tree-grid'; export * from './medit-view-panel'; export * from './map'; export * from './report-panel'; +export * from './gantt'; diff --git a/src/index.ts b/src/index.ts index 506772a83..5e519589c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -41,6 +41,7 @@ import { IBizChartExpBarControl, IBizMapControl, IBizReportPanelControl, + IBizGanttControl, } from './control'; import IBizEditor from './editor'; import { IBizWFStepTraceView } from './view'; @@ -104,6 +105,7 @@ export default { v.use(IBizChartExpBarControl); v.use(IBizMapControl); v.use(IBizReportPanelControl); + v.use(IBizGanttControl); // 编辑器 v.use(IBizEditor); }, diff --git a/src/view-engine/gantt-view.engine.ts b/src/view-engine/gantt-view.engine.ts new file mode 100644 index 000000000..02f72ce37 --- /dev/null +++ b/src/view-engine/gantt-view.engine.ts @@ -0,0 +1,20 @@ +import { + MDViewEngine, + ViewController, + IGanttViewState, + IGanttViewEvent, + IGanttController, +} from '@ibiz-template/runtime'; +import { IAppDEGanttView } from '@ibiz/model-core'; + +export class GanttViewEngine extends MDViewEngine { + protected declare view: ViewController< + IAppDEGanttView, + IGanttViewState, + IGanttViewEvent + >; + + get gantt(): IGanttController { + return this.view.getController('gantt') as IGanttController; + } +} diff --git a/src/view-engine/index.ts b/src/view-engine/index.ts index b13571e59..d31346ffe 100644 --- a/src/view-engine/index.ts +++ b/src/view-engine/index.ts @@ -41,6 +41,7 @@ import { MEditView9Engine } from './medit-view9.engine'; import { ChartExpViewEngine } from './chart-exp-view.engine'; import { MapViewEngine } from './map-view.engine'; import { ReportViewEngine } from './report-view.engine'; +import { GanttViewEngine } from './gantt-view.engine'; export * from './grid-view.engine'; export * from './index-view.engine'; @@ -223,6 +224,10 @@ export const IBizViewEngine = { 'VIEW_DECHARTEXPVIEW', (c: IViewController) => new ChartExpViewEngine(c), ); + ibiz.engine.register( + 'VIEW_DEGANTTVIEW', + (c: IViewController) => new GanttViewEngine(c), + ); // 注册部件视图 ibiz.engine.register( -- Gitee