diff --git a/src/common/rawitem/rawitem.tsx b/src/common/rawitem/rawitem.tsx index 235d05043373fdf98a62cd3aa0bcb9b8bb160525..8acd3bdc648d9e6d0b517a5f27a8e0a69adeee12 100644 --- a/src/common/rawitem/rawitem.tsx +++ b/src/common/rawitem/rawitem.tsx @@ -101,7 +101,7 @@ export const IBizRawItem = defineComponent({ render() { if (this.type === 'IMAGE') { return ( - + ); } if (this.type === 'TEXT') { diff --git a/src/control/form/edit-form/edit-form.service.ts b/src/control/form/edit-form/edit-form.service.ts index c19e3b0d8259d2fb35f639053042011c04e91b99..e7074ca7d51a8516b0f2f7889c4882d94ba5f1f4 100644 --- a/src/control/form/edit-form/edit-form.service.ts +++ b/src/control/form/edit-form/edit-form.service.ts @@ -29,7 +29,7 @@ export class EditFormService< params: IParams = {}, ): Promise> { let res = await this.exec( - this.model.getControlAction!.appDEMethodId!, + this.model.getControlAction?.appDEMethodId! || 'get', context, undefined, params, @@ -52,7 +52,7 @@ export class EditFormService< params: IParams = {}, ): Promise> { let res = await this.exec( - this.model.getDraftControlAction!.appDEMethodId!, + this.model.getDraftControlAction?.appDEMethodId! || 'getdraft', context, undefined, params, @@ -72,7 +72,7 @@ export class EditFormService< */ async remove(context: IParams, params: IParams = {}): Promise { const res = await this.exec( - this.model.removeControlAction!.appDEMethodId!, + this.model.removeControlAction?.appDEMethodId! || 'remove', context, undefined, params, @@ -94,7 +94,7 @@ export class EditFormService< data: IData, ): Promise> { let res = await this.exec( - this.model.createControlAction!.appDEMethodId!, + this.model.createControlAction?.appDEMethodId! || 'create', context, data instanceof ControlVO ? data.getOrigin() : data, ); @@ -116,7 +116,7 @@ export class EditFormService< data: IData, ): Promise> { let res = await this.exec( - this.model.updateControlAction!.appDEMethodId!, + this.model.updateControlAction?.appDEMethodId! || 'update', context, data instanceof ControlVO ? data.getOrigin() : data, ); diff --git a/src/control/form/form-detail/form-rawitem/form-rawitem.controller.ts b/src/control/form/form-detail/form-rawitem/form-rawitem.controller.ts new file mode 100644 index 0000000000000000000000000000000000000000..88356fd7de303bf86514a946686860a62737ecb6 --- /dev/null +++ b/src/control/form/form-detail/form-rawitem/form-rawitem.controller.ts @@ -0,0 +1,20 @@ +import { IDEFormRawItem } from '@ibiz/model-core'; +import { FormDetailController } from '../form-detail'; +import { FormRawItemState } from './form-rawitem.state'; + +/** + * 表单直接内容控制器 + * + * @author lxm + * @date 2022-09-04 15:09:52 + * @export + * @class FormRawItemController + * @extends {FormDetailController} + */ +export class FormRawItemController extends FormDetailController { + declare state: FormRawItemState; + + protected createState(): FormRawItemState { + return new FormRawItemState(this.parent?.state); + } +} diff --git a/src/control/form/form-detail/form-rawitem/form-rawitem.provider.ts b/src/control/form/form-detail/form-rawitem/form-rawitem.provider.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd9c135b590ccd5822e2b6f4085b2614331f5068 --- /dev/null +++ b/src/control/form/form-detail/form-rawitem/form-rawitem.provider.ts @@ -0,0 +1,27 @@ +import { IFormDetailProvider } from '@ibiz-template/runtime'; +import { IDEFormRawItem } from '@ibiz/model-core'; +import { FormController } from '../../form/form.controller'; +import { FormGroupPanelController } from '../form-group-panel'; +import { FormRawItemController } from './form-rawitem.controller'; +/** + * 表单直接内容适配器 + * + * @author lxm + * @date 2022-09-19 22:09:03 + * @export + * @class FormRawItemProvider + * @implements {EditorProvider} + */ +export class FormRawItemProvider implements IFormDetailProvider { + component: string = 'IBizFormRawItem'; + + async createController( + detailModel: IDEFormRawItem, + form: FormController, + parent: FormGroupPanelController | undefined, + ): Promise { + const c = new FormRawItemController(detailModel, form, parent); + await c.init(); + return c; + } +} diff --git a/src/control/form/form-detail/form-rawitem/form-rawitem.scss b/src/control/form/form-detail/form-rawitem/form-rawitem.scss new file mode 100644 index 0000000000000000000000000000000000000000..c9b430c79d39a30a0dc6c7424f047c2a1a39ab4e --- /dev/null +++ b/src/control/form/form-detail/form-rawitem/form-rawitem.scss @@ -0,0 +1,4 @@ +@include b(form-raw-item) { + width: 100%; + height: 100%; +} diff --git a/src/control/form/form-detail/form-rawitem/form-rawitem.state.ts b/src/control/form/form-detail/form-rawitem/form-rawitem.state.ts new file mode 100644 index 0000000000000000000000000000000000000000..85e478395b2c187689b523a43f4f3e96be3b7625 --- /dev/null +++ b/src/control/form/form-detail/form-rawitem/form-rawitem.state.ts @@ -0,0 +1,9 @@ +import { FormDetailState } from '../form-detail'; + +/** + * 表单直接内容状态 + * @return {*} + * @author: zhujiamin + * @Date: 2023-01-04 10:26:34 + */ +export class FormRawItemState extends FormDetailState {} diff --git a/src/control/form/form-detail/form-rawitem/form-rawitem.tsx b/src/control/form/form-detail/form-rawitem/form-rawitem.tsx new file mode 100644 index 0000000000000000000000000000000000000000..2e760d1f0cf31c6c473af16f7b93182ee199bbf0 --- /dev/null +++ b/src/control/form/form-detail/form-rawitem/form-rawitem.tsx @@ -0,0 +1,65 @@ +import { + IDEFormRawItem, + IHtmlItem, + ISysImage, + ITextItem, +} from '@ibiz/model-core'; +import { useNamespace } from '@ibiz-template/vue3-util'; +import { defineComponent, PropType } from 'vue'; +import { FormRawItemController } from './form-rawitem.controller'; +import './form-rawitem.scss'; + +export const FormRawItem = defineComponent({ + name: 'IBizFormRawItem', + props: { + modelData: { + type: Object as PropType, + required: true, + }, + controller: { + type: FormRawItemController, + required: true, + }, + }, + setup() { + const ns = useNamespace('form-raw-item'); + return { ns }; + }, + render() { + if (!this.controller.state.visible) { + return null; + } + + const { rawItem, sysImage } = this.modelData; + const { contentType } = rawItem!; + + // 传入内容 + let content: string | ISysImage | null = null; + // 类型 + let type = contentType; + if (contentType === 'RAW' || contentType === 'HTML') { + if (contentType === 'RAW') { + type = 'TEXT'; + content = (rawItem as ITextItem).caption!; + } else { + content = (rawItem as IHtmlItem).content!; + } + } else if ( + ['VIDEO', 'DIVIDER', 'INFO', 'WARNING', 'ERROR'].includes(contentType!) + ) { + // 暂不支持 + // content = rawContent; + } else if (contentType === 'IMAGE' && sysImage) { + content = sysImage; + } + return ( + + ); + }, +}); + +export default FormRawItem; diff --git a/src/control/form/form-detail/form-rawitem/index.ts b/src/control/form/form-detail/form-rawitem/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..a9a140eb2e02aa704051d25667bcea711ed81505 --- /dev/null +++ b/src/control/form/form-detail/form-rawitem/index.ts @@ -0,0 +1,17 @@ +import { registerFormDetailProvider } from '@ibiz-template/runtime'; +import { withInstall } from '@ibiz-template/vue3-util'; +import { App } from 'vue'; +import FormRawItem from './form-rawitem'; +import { FormRawItemProvider } from './form-rawitem.provider'; + +export * from './form-rawitem.provider'; +export * from './form-rawitem.state'; +export * from './form-rawitem.controller'; + +export const IBizFormRawItem = withInstall(FormRawItem, function (v: App) { + v.component(FormRawItem.name, FormRawItem); + // 表单直接内容 + registerFormDetailProvider('RAWITEM', () => new FormRawItemProvider()); +}); + +export default IBizFormRawItem; diff --git a/src/control/form/form-detail/index.ts b/src/control/form/form-detail/index.ts index 737e972a919f8dfeb1e9975e3122b55814312c5f..6e9e4e390f65e6d5d2a290d8f81af436b2befb32 100644 --- a/src/control/form/form-detail/index.ts +++ b/src/control/form/form-detail/index.ts @@ -5,3 +5,4 @@ export * from './form-page/index'; export * from './form-button/index'; export * from './form-druipart/index'; export * from './form-mdctrl/index'; +export * from './form-rawitem/index'; diff --git a/src/control/form/form/index.ts b/src/control/form/form/index.ts index a0872613504cb99636fbe3f552150312d0f6fc32..c43df9b728a2840f3c521491923ec5d05f2e2a19 100644 --- a/src/control/form/form/index.ts +++ b/src/control/form/form/index.ts @@ -8,6 +8,7 @@ import { IBizFormItem, IBizFormPage, IBizFormMDCtrl, + IBizFormRawItem, } from '../form-detail'; export * from './form.controller'; @@ -20,9 +21,7 @@ export const IBizFormControl = withInstall(FormControl, function (v: App) { v.use(IBizFormButton); v.use(IBizFormDRUIPart); v.use(IBizFormMDCtrl); - - // 表单直接内容 - // registerFormDetailProvider('RAWITEM', new FormRawItemProvider()); + v.use(IBizFormRawItem); }); export default IBizFormControl; diff --git a/src/control/index.ts b/src/control/index.ts index 75aac7b7d15b8f96a1fe859a6bde495765256aae..c6e80ef9baf2b7484df7663577f7cff06089d32f 100644 --- a/src/control/index.ts +++ b/src/control/index.ts @@ -11,3 +11,4 @@ export * from './pickup-view-panel'; export * from './tab-exp-panel'; export * from './exp-bar'; export * from './search-bar'; +export * from './wizard-panel'; diff --git a/src/control/wizard-panel/index.ts b/src/control/wizard-panel/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..bfecf1f42788278370568b5fe639da0cadb56c71 --- /dev/null +++ b/src/control/wizard-panel/index.ts @@ -0,0 +1,21 @@ +import { registerControlProvider, ControlType } from '@ibiz-template/runtime'; +import { withInstall } from '@ibiz-template/vue3-util'; +import { App } from 'vue'; +import { WizardPanelControl } from './wizard-panel'; +import { WizardPanelProvider } from './wizard-panel.provider'; + +export * from './wizard-panel.provider'; +export * from './wizard-panel.controller'; + +export const IBizWizardPanelControl = withInstall( + WizardPanelControl, + function (v: App) { + v.component(WizardPanelControl.name, WizardPanelControl); + registerControlProvider( + ControlType.WIZARD_PANEL, + () => new WizardPanelProvider(), + ); + }, +); + +export default IBizWizardPanelControl; diff --git a/src/control/wizard-panel/wizard-panel.controller.ts b/src/control/wizard-panel/wizard-panel.controller.ts new file mode 100644 index 0000000000000000000000000000000000000000..65798a3bfe060d384ac84800b76e83d5ef357538 --- /dev/null +++ b/src/control/wizard-panel/wizard-panel.controller.ts @@ -0,0 +1,292 @@ +import { Logger, RuntimeError } from '@ibiz-template/core'; +import { + ControlController, + IWizardPanelState, + IWizardPanelEvent, + IWizardPanelController, + IControlProvider, + getControlProvider, + EventBase, + calcDeCodeNameById, +} from '@ibiz-template/runtime'; +import { + IDEWizardEditForm, + IDEWizardForm, + IDEWizardPanel, +} from '@ibiz/model-core'; +import { EditFormController } from '../form'; +import { WizardPanelService } from './wizard-panel.service'; + +/** + * 向导面板控制器 + * + * @author chitanda + * @date 2022-07-24 15:07:07 + * @export + * @class WizardPanelController + * @extends {ControlController} + */ +export class WizardPanelController + extends ControlController< + IDEWizardPanel, + IWizardPanelState, + IWizardPanelEvent + > + implements IWizardPanelController +{ + /** + * 编辑表单服务 + * @author lxm + * @date 2023-05-15 11:03:34 + * @type {WizardPanelService} + */ + service!: WizardPanelService; + + /** + * 表单标识历史 + * + * @author lxm + * @date 2023-02-16 08:41:35 + * @type {string[]} + * @memberof WizardPanelController + */ + tagHistory: string[] = []; + + /** + * 所有部件的适配器 + * + * @author lxm + * @date 2022-08-24 20:08:07 + * @type {{ [key: string]: IControlProvider| undefined }} + */ + providers: { [key: string]: IControlProvider | undefined } = {}; + + /** + * 首表单模型 + * @return {*} + * @author: zhujiamin + * @Date: 2023-06-07 15:03:39 + */ + firstForm: IDEWizardForm | undefined = undefined; + + /** + * 所有表单控制器Map + * @return {*} + * @author: zhujiamin + * @Date: 2023-06-07 15:13:21 + */ + formControllers: Map = new Map(); + + protected initState(): void { + super.initState(); + } + + protected async doCreated(): Promise { + await super.doCreated(); + + // 首表单 + this.firstForm = this.model.dewizard!.dewizardForms!.find( + (wizardForm: IDEWizardForm) => { + return wizardForm.firstForm; + }, + ); + // 实例部件服务 + this.service = new WizardPanelService(this.model); + await this.service.init(this.context); + // 编辑表单适配器 + const { deeditForms } = this.model; + if (deeditForms && deeditForms.length > 0) { + await Promise.all( + deeditForms.map(async editForm => { + const formTag = (editForm as IDEWizardEditForm).dewizardForm!.formTag; + if (formTag) { + this.providers[formTag] = await getControlProvider(editForm); + } + }), + ); + } + } + + /** + * 当前激活的向导表单 + * + * @author lxm + * @date 2023-02-17 10:42:06 + * @readonly + * @memberof WizardPanelController + */ + get activeWizardForm(): IDEWizardForm | undefined { + const { activeFormTag } = this.state; + const form = this.model.dewizard!.dewizardForms!.find( + (wizardForm: IDEWizardForm) => { + return wizardForm.formTag === activeFormTag; + }, + ); + if (!form) { + Logger.debug(`找不到${activeFormTag}的向导表单`); + } + return form; + } + + /** + * 当前激活向导表单的控制器 + * + * @author lxm + * @date 2023-02-17 03:44:46 + * @readonly + * @memberof WizardPanelController + */ + get activeFormController(): EditFormController { + const { activeFormTag } = this.state; + const controller = this.formControllers.get(activeFormTag); + if (!controller) { + throw new RuntimeError(`找不到${activeFormTag}的表单控制器`); + } + return controller; + } + + /** + * 表单挂载后把控制器抛出来 + * @param {string} activeFormTag + * @return {*} + * @author: zhujiamin + * @Date: 2023-06-07 15:14:05 + */ + onFormMounted(activeFormTag: string, event: EventBase) { + const formController = event.controller as EditFormController; + this.formControllers.set(activeFormTag, formController); + // 调用表单的load加载一次数据 + formController.load(); + } + + /** + * 表单保存后,如果上下文里没有主键,赋予主键 + * @param {EventBase} event + * @return {*} + * @author: zhujiamin + * @Date: 2023-06-08 14:06:25 + */ + onFormSaved(event: EventBase) { + const data = event.data[0]; + const deName = calcDeCodeNameById(this.model.appDataEntityId!); + if (!this.context[deName] && data && data.srfkey) { + this.context[deName] = data.srfkey; + } + } + + /** + * 执行初始化操作,存在初始化实体行为的时候加载数据并把主键放入上下文 + * + * @author lxm + * @date 2022-08-19 14:08:50 + */ + async initialize(): Promise { + const initAction = this.model.initControlAction?.appDEMethodId; + if (initAction) { + const res = await this.service.initialize(this.context, this.params); + const deName = calcDeCodeNameById(this.model.appDataEntityId!); + if (res.data && res.data.srfkey) { + this.context[deName] = res.data.srfkey; + } + } + if (this.firstForm) { + this.state.activeFormTag = this.firstForm.formTag!; + this.tagHistory.push(this.firstForm.formTag!); + } + } + + /** + * 执行完成操作 + * + * @author lxm + * @date 2023-02-16 06:20:18 + * @returns {*} {Promise} + * @memberof WizardPanelController + */ + async finish(): Promise { + await this.service.finish(this.context, this.params); + this.evt.emit('onFinishSuccess', undefined); + } + + /** + * 处理上一步按钮点击 + * + * @author lxm + * @date 2023-02-16 09:10:04 + * @memberof WizardPanelController + */ + async onPrevClick(): Promise { + // 先执行表单返回行为 + await this.activeFormController.goBack(); + // 返回上一个表单 + this.tagHistory.pop(); + const prevTag = this.tagHistory[this.tagHistory.length - 1]; + if (!prevTag) { + throw new RuntimeError('没有上一个表单'); + } + this.state.activeFormTag = prevTag; + } + + /** + * 处理下一步按钮点击 + * + * @author lxm + * @date 2023-02-16 09:10:17 + * @memberof WizardPanelController + */ + async onNextClick(): Promise { + // 保存 + const data = await this.activeFormController.save(); + let nextTag; + if (data.srfnextform) { + const wizardForm = this.model.dewizard!.dewizardForms!.find( + (_wizardForm: IDEWizardForm) => { + return _wizardForm.formTag === data.srfnextform; + }, + ); + if (!wizardForm) { + throw new RuntimeError(`找不到标识为${data.srfnextform}的向导表单`); + } + nextTag = data.srfnextform; + } else { + // 通过步骤找,找到下一个步骤对应的第一个向导表单 + const formTag = this.activeWizardForm!.formTag; + const wizardSteps = this.model.dewizard!.dewizardSteps; + if (wizardSteps && formTag) { + const index = wizardSteps.findIndex(_step => { + return _step.stepTag === formTag; + }); + const nextWizardStep = wizardSteps[index + 1]; + if (!nextWizardStep) { + throw new RuntimeError('找不到下一个向导步骤'); + } + const nextWizardForm = this.model.dewizard!.dewizardForms!.find( + (wizardForm: IDEWizardForm) => { + return wizardForm.formTag === nextWizardStep.stepTag; + }, + ); + if (nextWizardForm) { + nextTag = nextWizardForm.formTag; + } + } + } + if (!nextTag) { + throw new RuntimeError('找不到下一个向导表单'); + } + this.state.activeFormTag = nextTag; + this.tagHistory.push(nextTag); + } + + /** + * 处理完成按钮点击 + * + * @author lxm + * @date 2023-02-16 09:09:45 + * @memberof WizardPanelController + */ + async onFinishClick() { + // 保存 + await this.activeFormController.save(); + await this.finish(); + } +} diff --git a/src/control/wizard-panel/wizard-panel.provider.ts b/src/control/wizard-panel/wizard-panel.provider.ts new file mode 100644 index 0000000000000000000000000000000000000000..6861ee24161947f91e5e97ed5207c843fc6a4f3b --- /dev/null +++ b/src/control/wizard-panel/wizard-panel.provider.ts @@ -0,0 +1,14 @@ +import { IControlProvider } from '@ibiz-template/runtime'; + +/** + * 向导面板适配器 + * + * @author lxm + * @date 2022-10-25 18:10:57 + * @export + * @class WizardPanelProvider + * @implements {IControlProvider} + */ +export class WizardPanelProvider implements IControlProvider { + component: string = 'IBizWizardPanelControl'; +} diff --git a/src/control/wizard-panel/wizard-panel.scss b/src/control/wizard-panel/wizard-panel.scss new file mode 100644 index 0000000000000000000000000000000000000000..4725e4f5876b6bfe71f85ce3de2f494a7ef9f66b --- /dev/null +++ b/src/control/wizard-panel/wizard-panel.scss @@ -0,0 +1,16 @@ +// 通用样式 +@include b(control-wizardpanel) { + @include set-component-css-var('control-wizard-panel', $control-wizard-panel); + + height: 100%; + @include e(form) { + height: calc(100% - getCssVar('control-wizard-panel', 'footer-height')); + } +} + +@include b(control-wizardpanel-footer) { + @include flex(row, flex-end, center); + + height: getCssVar('control-wizard-panel', 'footer-height'); + padding-right: getCssVar('padding'); +} diff --git a/src/control/wizard-panel/wizard-panel.service.ts b/src/control/wizard-panel/wizard-panel.service.ts new file mode 100644 index 0000000000000000000000000000000000000000..0d741620b9a83438365beb030af5588799995106 --- /dev/null +++ b/src/control/wizard-panel/wizard-panel.service.ts @@ -0,0 +1,58 @@ +import { IHttpResponse } from '@ibiz-template/core'; +import { ControlService } from '@ibiz-template/runtime'; +import { IDEWizardPanel } from '@ibiz/model-core'; + +/** + * 向导面板服务 + * + * @author lxm + * @date 2023-02-16 04:11:13 + * @export + * @class WizardPanelService + * @extends {ControlService} + * @template T + */ +export class WizardPanelService< + T extends IDEWizardPanel = IDEWizardPanel, +> extends ControlService { + /** + * 执行向导初始化 + * 服务调用之前确认是否有初始化实体行为 + * + * @author lxm + * @date 2022-08-31 17:08:41 + * @param {IParams} context 上下文 + * @param {IParams} [params={}] 视图参数 + * @returns {*} {Promise} + */ + async initialize( + context: IParams, + data: IData = {}, + params: IParams = {}, + ): Promise> { + const initAction = this.model.initControlAction?.appDEMethodId; + let res = await this.exec(initAction!, context, data, params); + res = this.handleResponse(res); + return res as IHttpResponse; + } + + /** + * 执行向导完成 + * + * @author lxm + * @date 2022-08-31 17:08:41 + * @param {IParams} context 上下文 + * @param {IParams} [params={}] 视图参数 + * @returns {*} {Promise} + */ + async finish( + context: IParams, + data: IData = {}, + params: IParams = {}, + ): Promise> { + const finishAction = this.model.finishControlAction?.appDEMethodId; + let res = await this.exec(finishAction!, context, data, params); + res = this.handleResponse(res); + return res as IHttpResponse; + } +} diff --git a/src/control/wizard-panel/wizard-panel.tsx b/src/control/wizard-panel/wizard-panel.tsx new file mode 100644 index 0000000000000000000000000000000000000000..4221a0872584b012883661032a88b533d347b953 --- /dev/null +++ b/src/control/wizard-panel/wizard-panel.tsx @@ -0,0 +1,99 @@ +import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { defineComponent, PropType, resolveComponent, h } from 'vue'; +import { IDEWizardEditForm, IDEWizardPanel } from '@ibiz/model-core'; +import './wizard-panel.scss'; +import { EventBase } from '@ibiz-template/runtime'; +import { WizardPanelController } from './wizard-panel.controller'; + +export const WizardPanelControl = defineComponent({ + name: 'IBizWizardPanelControl', + props: { + modelData: { + type: Object as PropType, + required: true, + }, + context: { type: Object as PropType, required: true }, + params: { type: Object as PropType, default: () => ({}) }, + }, + setup() { + const c = useControlController( + (...args) => new WizardPanelController(...args), + ); + + const ns = useNamespace(`control-${c.model.controlType!.toLowerCase()}`); + + return { c, ns }; + }, + render() { + const { activeFormTag } = this.c.state; + let formComponent = null; + let footer = null; + + // 表单绘制 + if (activeFormTag && this.c.activeWizardForm) { + const wizardForm = this.c.activeWizardForm; + const supportActions = wizardForm.stepActions; + if (this.c.providers[activeFormTag]) { + const component = resolveComponent( + this.c.providers[activeFormTag]!.component, + ); + const editForm = this.c.model.deeditForms?.find(_editForm => { + return ( + activeFormTag === + (_editForm as IDEWizardEditForm).dewizardForm?.formTag + ); + }); + formComponent = h(component, { + class: this.ns.e('form'), + modelData: editForm, + context: this.c.context, + params: this.c.params, + key: activeFormTag, + onMounted: (event: EventBase) => + this.c.onFormMounted(activeFormTag, event), + onSaveSuccess: (event: EventBase) => this.c.onFormSaved(event), + }); + } + + const { dewizard } = this.c.model; + // 底部按钮 + footer = supportActions && ( +
+ {supportActions.includes('PREV') && ( + { + this.c.onPrevClick(); + }} + > + {dewizard!.prevCaption} + + )} + {supportActions.includes('NEXT') && ( + { + await this.c.onNextClick(); + }} + > + {dewizard!.nextCaption} + + )} + {supportActions.includes('FINISH') && ( + { + this.c.onFinishClick(); + }} + > + {dewizard!.finishCaption} + + )} +
+ ); + } + return ( + + {formComponent} + {footer} + + ); + }, +}); diff --git a/src/editor/autocomplete/autocomplete-editor.controller.ts b/src/editor/autocomplete/autocomplete-editor.controller.ts index 7e88cc17dfe17d4701b83f7e506110e25a2786fb..a30d7c65661e6368a07f650844687d6448511db4 100644 --- a/src/editor/autocomplete/autocomplete-editor.controller.ts +++ b/src/editor/autocomplete/autocomplete-editor.controller.ts @@ -111,7 +111,10 @@ export class AutoCompleteEditorController extends EditorController { data: IData, ): Promise> { // 附加编辑器视图参数 - const tempParams = { ...this.params, query, size: 1000 }; + const tempParams = { ...this.params, size: 1000 }; + if (query) { + Object.assign(tempParams, { query }); + } if (this.sort && !Object.is(this.sort, '')) { Object.assign(tempParams, { sort: this.sort }); } diff --git a/src/index.ts b/src/index.ts index c9f610e4c71e435ead1079a9c4691d3c4dd796bd..69f9ab65dcba998845d8d81530a674929c39837a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,6 +20,7 @@ import { IBizDataViewExpBarControl, IBizTreeExpBarControl, IBizSearchBarControl, + IBizWizardPanelControl, } from './control'; import IBizEditor from './editor'; import { IBizView } from './view'; @@ -56,6 +57,7 @@ export default { v.use(IBizTabExpPanelControl); v.use(IBizTreeExpBarControl); v.use(IBizSearchBarControl); + v.use(IBizWizardPanelControl); // 编辑器 v.use(IBizEditor); }, diff --git a/src/view-engine/index.ts b/src/view-engine/index.ts index d0790e0692b5f7311ee9d43673f4171cc2da0ecc..5b6da54608fe58080230a083629f1d84c52534d2 100644 --- a/src/view-engine/index.ts +++ b/src/view-engine/index.ts @@ -15,6 +15,7 @@ import { GridExpViewEngine } from './grid-exp-view.engine'; import { ListExpViewEngine } from './list-exp-view.engine'; import { DataViewExpViewEngine } from './data-view-exp-view.engine'; import { TreeExpViewEngine } from './tree-exp-view.engine'; +import { WizardViewEngine } from './wizard-view-engine'; export * from './grid-view.engine'; export * from './index-view.engine'; @@ -89,5 +90,9 @@ export const IBizViewEngine = { 'VIEW_TreeExpView', (c: IViewController) => new TreeExpViewEngine(c), ); + ibiz.engine.register( + 'VIEW_WizardView', + (c: IViewController) => new WizardViewEngine(c), + ); }, }; diff --git a/src/view-engine/wizard-view-engine.ts b/src/view-engine/wizard-view-engine.ts new file mode 100644 index 0000000000000000000000000000000000000000..1a5531d74ee4fc17674acb35f9e3fb59900f16aa --- /dev/null +++ b/src/view-engine/wizard-view-engine.ts @@ -0,0 +1,51 @@ +import { + ViewEngineBase, + ViewController, + IWizardViewState, + IWizardViewEvent, + IWizardPanelController, +} from '@ibiz-template/runtime'; +import { IAppDEWizardView } from '@ibiz/model-core'; + +export class WizardViewEngine extends ViewEngineBase { + /** + * 视图控制器 + * + * @protected + * @type {ViewController} + * @memberof WizardViewEngine + */ + protected declare view: ViewController< + IAppDEWizardView, + IWizardViewState, + IWizardViewEvent + >; + + /** + * 数据视图(卡片)部件 + * + * @readonly + * @memberof WizardViewEngine + */ + get wizardPanel() { + return this.view.getController('wizardpanel') as IWizardPanelController; + } + + /** + * 视图mounted生命周期执行逻辑 + * + * @memberof WizardViewEngine + */ + async doMounted() { + super.doMounted(); + if (!this.view.slotProps.wizardpanel) { + this.view.slotProps.wizardpanel = {}; + } + + this.wizardPanel.initialize(); + + this.wizardPanel.evt.on('onFinishSuccess', _event => { + this.view.closeView({ ok: true, data: [] }); + }); + } +}