From 8545b7bba6a9f4ff3a977046df9187296c9ab497 Mon Sep 17 00:00:00 2001 From: zhf <1204297681@qq.com> Date: Wed, 13 Aug 2025 21:09:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E5=AE=9E=E4=BD=93?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA=E6=8F=92=E4=BB=B6=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/de-action-plugin.provider.ts | 4 ++ packages/de-action-plugin/src/fetch-plugin.ts | 65 +++++++++++++++++++ packages/de-action-plugin/vite.config.ts | 1 - 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 packages/de-action-plugin/src/fetch-plugin.ts diff --git a/packages/de-action-plugin/src/de-action-plugin.provider.ts b/packages/de-action-plugin/src/de-action-plugin.provider.ts index e84886b..79e012a 100644 --- a/packages/de-action-plugin/src/de-action-plugin.provider.ts +++ b/packages/de-action-plugin/src/de-action-plugin.provider.ts @@ -6,6 +6,7 @@ import { } from '@ibiz-template/runtime'; import { IAppDataEntity, IAppDEMethod } from '@ibiz/model-core'; import { DeActionPlugin } from './de-action-plugin'; +import { FetchPlugin } from './fetch-plugin'; export class DeActionPluginProvider implements IDEMethodProvider { create( @@ -14,6 +15,9 @@ export class DeActionPluginProvider implements IDEMethodProvider { method: IAppDEMethod, opts: IDEMethodCreateOptions, ): Method { + if (method.methodType === 'FETCH') { + return new FetchPlugin(service, entity, method, opts.localMode); + } return new DeActionPlugin(service, entity, method, opts.localMode); } } diff --git a/packages/de-action-plugin/src/fetch-plugin.ts b/packages/de-action-plugin/src/fetch-plugin.ts new file mode 100644 index 0000000..a3221ce --- /dev/null +++ b/packages/de-action-plugin/src/fetch-plugin.ts @@ -0,0 +1,65 @@ +import { HttpResponse } from '@ibiz-template/core'; +import { Method, IDataEntity } from '@ibiz-template/runtime'; +import { IAppDEDataSet } from '@ibiz/model-core'; + +export class FetchPlugin extends Method { + declare method: IAppDEDataSet; + + async exec( + context: IContext, + _params?: IData | IData[], + _params2?: IParams, + _header?: IData, + ): Promise> { + const items: IData[] = [ + { + id: 'item1', + name: '动态代码表项1', + begin: 1, + end: 25, + bgcolor: '#c6e2ff', + color: '#409eff', + imagepath: 'user-avatar.png', + textclass: 'codelist-custom-item', + disableselect: false, + }, + { + id: 'item2', + name: '动态代码表项2', + begin: 26, + end: 50, + bgcolor: '#d1edc4', + color: '#67c23a', + iconclass: 'cafe-outline', + textclass: 'codelist-custom-item', + disableselect: false, + }, + { + id: 'item3', + name: '动态代码表项3', + begin: 51, + end: 75, + bgcolor: '#f8e3c5', + color: '#e6a23c', + iconclass: 'mail-outline', + textclass: 'codelist-custom-item', + disableselect: false, + }, + { + id: 'item4', + name: '动态代码表项4', + begin: 76, + end: 100, + bgcolor: '#fcd3d3', + color: '#f56c6c', + iconclass: 'snow-outline', + textclass: 'codelist-custom-item', + disableselect: true, + }, + ]; + for (let i = 0; i < items.length; i++) { + items[i] = await this.result.format(context, items[i]); + } + return new HttpResponse(items.map(item => this.createEntity(item))); + } +} diff --git a/packages/de-action-plugin/vite.config.ts b/packages/de-action-plugin/vite.config.ts index 12525a1..fc3449a 100644 --- a/packages/de-action-plugin/vite.config.ts +++ b/packages/de-action-plugin/vite.config.ts @@ -34,7 +34,6 @@ export default defineConfig({ 'vuedraggable', ], }, - sourcemap: true }, css: { preprocessorOptions: { -- Gitee