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 e84886b38f205c57430ee3bdfb641aaf4a01926e..79e012afeb104f021f35fb22bffb0a609caeb2ce 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 0000000000000000000000000000000000000000..a3221cec38823408254bca0dfd3cf54d6fe007f1 --- /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 12525a15abc9d9376f392d67e5f2633e52863640..fc3449a5a42babd06efbe73c42acd8989ffb91fc 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: {