提交 8929b58f 编写于 作者: tony001's avatar tony001

update:更新视图

上级 a2c1e38f
import { EditViewProps, EditViewState, MainView } from '@core';
import { EditViewState, IParam, MainView } from '@core';
/**
* @description 编辑视图
......@@ -13,33 +13,55 @@ export class EditView extends MainView {
* @type {EditViewState}
* @memberof EditView
*/
public declare viewState: EditViewState;
public declare state: EditViewState;
/**
* @description 使用加载功能模块
* @param {EditViewProps} props 传入的props
* 当前视图表单部件
*
* @type {IParam}
* @memberof EditView
*/
public useLoad(props: EditViewProps){
const { viewSubject } = this.viewState;
onMounted(()=>{
viewSubject.next({tag: 'form', action: "load", data: {}})
public declare form: IParam;
/**
* @description 处理视图初始化
*
* @memberof EditView
*/
public useViewInit() {
super.useViewInit();
// 初始化表单引用
this.form = ref(null);
onMounted(() => {
const { viewSubject } = this.state;
viewSubject.next({ tag: this.getForm().name, action: "load", data: {} })
})
}
/**
* 获取表单部件
*
* @return {*} {*}
* @memberof IndexView
*/
public getForm(): any {
if (this.form.value) {
return this.form.value;
} else {
return null;
}
}
/**
* @description 安装视图所有功能模块的方法
* @param {EditViewProps} props 传入的Props
* @param {Function} [emit] [emit] 事件
* @return {*}
* @memberof EditView
*/
public moduleInstall(props: EditViewProps, emit?: Function) {
const superParams = super.moduleInstall(props, emit);
this.useLoad(props);
public moduleInstall() {
const superParams = super.moduleInstall();
return {
...superParams,
state: this.viewState,
form: this.form
};
}
}
import { MainView } from "@core";
import { ExpViewProps } from "./exp-view-prop";
import { ExpViewState } from "./exp-view-state";
/**
......@@ -9,36 +8,24 @@ import { ExpViewState } from "./exp-view-state";
* @extends {MainView}
*/
export class ExpView extends MainView {
/**
* @description 视图状态
* @type {ExpViewState}
* @memberof ExpView
*/
public declare viewState: ExpViewState;
/**
* @description 使用加载功能模块
* @param {ExpViewProps} props 传入的props
* @memberof ExpView
*/
public useLoad(props: ExpViewProps) {
const { viewSubject } = this.viewState;
}
public declare state: ExpViewState;
/**
* @description 安装视图所有功能模块的方法
* @param {ExpViewProps} props 传入的Props
* @param {Function} [emit] [emit] 事件
* @return {*}
* @memberof ExpView
*/
public moduleInstall(props: ExpViewProps, emit?: Function) {
const superParams = super.moduleInstall(props, emit);
this.useLoad(props);
public moduleInstall() {
const superParams = super.moduleInstall();
return {
...superParams,
state: this.viewState
...superParams
};
}
}
\ No newline at end of file
import { GridViewProps, GridViewState, IActionParam, IParam, MDView } from '@core';
import { GridViewState, IActionParam, IParam, MDView } from '@core';
/**
* @description 表格视图
......@@ -8,12 +8,13 @@ import { GridViewProps, GridViewState, IActionParam, IParam, MDView } from '@cor
*/
export class GridView extends MDView {
/**
* @description 视图状态
* @type {EditViewState}
* @memberof GridView
*/
public declare viewState: GridViewState;
/**
* 视图状态数据
*
* @type {GridViewState}
* @memberof GridView
*/
public declare state: GridViewState;
/**
* 当前视图表格部件
......@@ -26,12 +27,10 @@ export class GridView extends MDView {
/**
* @description 处理视图初始化
*
* @param {GridViewProps} props
* @param {Function} emit
* @memberof GridView
*/
public useViewInit(props: GridViewProps, emit: Function) {
super.useViewInit(props, emit);
public useViewInit() {
super.useViewInit();
// 初始化搜索表格引用
this.grid = ref(null);
}
......@@ -66,13 +65,11 @@ export class GridView extends MDView {
/**
* @description 安装视图所有功能模块的方法
* @param {GridViewProps} props 传入的Props
* @param {Function} [emit] [emit] 事件
* @return {*}
* @memberof GridView
*/
public moduleInstall(props: GridViewProps, emit: Function) {
const superParams = super.moduleInstall(props, emit);
public moduleInstall() {
const superParams = super.moduleInstall();
return {
...superParams,
grid: this.grid
......
import { IndexViewProps, IndexViewState, ViewBase } from '@core';
import { onMounted } from 'vue';
import { IndexViewState, IParam, ViewBase } from '@core';
/**
* @description 首页视图
* @export
* @class IndexView
* @extends {ViewBase}
* @extends {IndexView}
*/
export class IndexView extends ViewBase {
/**
* 视图状态
*
* @type {IndexViewState}
* @memberof IndexView
*/
public declare viewState: IndexViewState;
public declare state: IndexViewState;
/**
* 使用加载功能模块
* @param props 传入的props
* 当前视图菜单部件
*
* @type {IParam}
* @memberof IndexView
*/
public useLoad(props: IndexViewProps) {
const { viewSubject } = this.viewState;
public declare menu: IParam;
/**
* @description 处理视图初始化
*
* @memberof IndexView
*/
public useViewInit() {
// 初始化菜单引用
this.menu = ref(null);
const { viewSubject } = this.state;
onMounted(() => {
viewSubject.next({ tag: 'appmenu', action: "load", data: {} })
const { viewParams } = this.state;
viewSubject.next({ tag: this.getMenu().name, action: "load", data: viewParams });
})
}
/**
* 安装视图所有功能模块的方法
* @param props 传入的Props
* @param [emit] 事件
* 获取菜单部件
*
* @return {*} {*}
* @memberof IndexView
*/
public getMenu(): any {
if (this.menu.value) {
return this.menu.value;
} else {
return null;
}
}
/**
* @description 安装视图所有功能模块的方法
*
* @memberof IndexView
*/
public moduleInstall(props: IndexViewProps, emit: Function) {
const superParams = super.moduleInstall(props, emit);
this.useLoad(props);
public moduleInstall() {
const superParams = super.moduleInstall();
return {
...superParams,
state: this.viewState,
menu: this.menu
};
}
}
import { ViewBase, MainViewProps, MainViewState, IActionParam, IParam, AppActionService } from '@core';
import { ViewBase, MainViewState, IActionParam, IParam, AppActionService } from '@core';
/**
* 实体视图
......@@ -6,40 +6,22 @@ import { ViewBase, MainViewProps, MainViewState, IActionParam, IParam, AppAction
* @class ViewBase
*/
export class MainView extends ViewBase {
/**
* 视图状态数据
*/
public declare viewState: MainViewState;
/**
* 当前视图具有数据能力部件
* 视图状态数据
*
* @type {IParam}
* @type {MainViewState}
* @memberof MainView
*/
public declare xDataControl: IParam;
public declare state: MainViewState;
/**
* @description 根据props调整设置视图状态变量
*
* @param {ViewPropsBase} props 传入的Props
* @param {Function} emit 事件
* @memberof MainView
*/
protected handleState(props: MainViewProps, emit: Function) {
super.handleState(props, emit);
}
/**
* @description 处理视图初始化
* 当前视图具有数据能力部件
*
* @param {MainViewProps} props
* @param {Function} emit
* @type {IParam}
* @memberof MainView
*/
public useViewInit(props: MainViewProps, emit: Function) {
super.useViewInit(props, emit);
}
public declare xDataControl: IParam;
/**
* @description 处理工具栏事件
......@@ -60,8 +42,8 @@ export class MainView extends ViewBase {
}
// 准备参数
const inputParam = {
context: this.viewState.context,
viewParams: this.viewState.viewParams,
context: this.state.context,
viewParams: this.state.viewParams,
data: this.xDataControl?.value?.data,
event: data.event,
actionEnvironment: this
......@@ -81,12 +63,10 @@ export class MainView extends ViewBase {
/**
* @description 安装视图所有功能模块的方法
*
* @param {ViewPropsBase} props 传入的Props
* @param {Function} emit 事件
* @memberof MainView
*/
public moduleInstall(props: MainViewProps, emit: Function) {
const superParams = super.moduleInstall(props, emit);
public moduleInstall() {
const superParams = super.moduleInstall();
return {
...superParams,
xDataControl: this.xDataControl,
......
import { IActionParam, IParam, MainView, MDViewProps, MDViewState } from '@core';
import { IActionParam, IParam, MainView, MDViewState } from '@core';
/**
* 多数据视图
......@@ -8,10 +8,14 @@ import { IActionParam, IParam, MainView, MDViewProps, MDViewState } from '@core'
* @extends {MainView}
*/
export class MDView extends MainView {
/**
* 视图状态数据
* 视图状态数据
*
* @type {MDViewState}
* @memberof MDView
*/
public declare viewState: MDViewState;
public declare state: MDViewState;
/**
* 当前视图搜索表单部件
......@@ -32,12 +36,10 @@ export class MDView extends MainView {
/**
* @description 处理视图初始化
*
* @param {MainViewProps} props
* @param {Function} emit
* @memberof MDView
*/
public useViewInit(props: MDViewProps, emit: Function) {
super.useViewInit(props, emit);
public useViewInit() {
super.useViewInit();
// 初始化搜索表单引用
this.searchForm = ref(null);
// 初始化搜索栏引用
......@@ -45,7 +47,7 @@ export class MDView extends MainView {
onMounted(() => {
// 初始化数据能力部件
this.xDataControl = this.getMDCtrl();
const { isLoadDefault } = this.viewState;
const { isLoadDefault } = this.state;
if (this.getSearchForm() && isLoadDefault) {
const tag = this.getSearchForm().name;
this.next({ tag: tag, action: 'loaddraft', data: null });
......@@ -53,7 +55,7 @@ export class MDView extends MainView {
const tag = this.getMDCtrl().name;
this.next({ tag: tag, action: 'load', data: null });
} else {
this.viewState.isLoadDefault = true;
this.state.isLoadDefault = true;
}
})
}
......@@ -94,12 +96,12 @@ export class MDView extends MainView {
* @memberof MDView
*/
public onSearchFormLoad(args: any = {}): void {
const { isLoadDefault, viewParams } = this.viewState;
const { isLoadDefault, viewParams } = this.state;
if (this.getMDCtrl() && isLoadDefault) {
const tag = this.getMDCtrl().name;
this.next({ tag: tag, action: 'load', data: viewParams });
}
this.viewState.isLoadDefault = true;
this.state.isLoadDefault = true;
}
/**
......@@ -109,12 +111,12 @@ export class MDView extends MainView {
* @memberof MDView
*/
public onSearchFormSearch(args: any = {}): void {
const { isLoadDefault, viewParams } = this.viewState;
const { isLoadDefault, viewParams } = this.state;
if (this.getMDCtrl() && isLoadDefault) {
const tag = this.getMDCtrl().name;
this.next({ tag: tag, action: 'load', data: viewParams });
}
this.viewState.isLoadDefault = true;
this.state.isLoadDefault = true;
}
/**
......@@ -205,12 +207,10 @@ export class MDView extends MainView {
/**
* @description 安装视图所有功能模块的方法
*
* @param {ViewPropsBase} props 传入的Props
* @param {Function} emit 事件
* @memberof MDView
*/
public moduleInstall(props: MDViewProps, emit: Function) {
const superParams = super.moduleInstall(props, emit);
public moduleInstall() {
const superParams = super.moduleInstall();
return {
...superParams,
xDataControl: this.xDataControl,
......
......@@ -16,7 +16,7 @@ export class PickupGridView extends PickupView {
* @type {PickupGridViewState}
* @memberof PickupGridView
*/
public declare viewState: PickupGridViewState;
public declare state: PickupGridViewState;
/**
......@@ -25,7 +25,7 @@ export class PickupGridView extends PickupView {
* @memberof PickupGridView
*/
public useLoad(props: PickupGridViewProps) {
const { viewSubject } = this.viewState;
const { viewSubject } = this.state;
onMounted(() => {
viewSubject.next({ tag: 'grid', action: "load", data: {} })
})
......@@ -57,14 +57,10 @@ export class PickupGridView extends PickupView {
* @return {*}
* @memberof PickupGridView
*/
public moduleInstall(props: PickupGridViewProps, emit?: Function) {
this.emit = emit;
const superParams = super.moduleInstall(props, emit);
this.useLoad(props);
public moduleInstall() {
const superParams = super.moduleInstall();
return {
...superParams,
handleCtrlEvent: this.handleCtrlEvent.bind(this),
state: this.viewState,
...superParams
};
}
}
\ No newline at end of file
......@@ -16,7 +16,7 @@ export class PickupView extends MainView {
* @type {PickupViewState}
* @memberof PickupView
*/
public declare viewState: PickupViewState;
public declare state: PickupViewState;
public selectData: any[] = [];
......@@ -27,7 +27,7 @@ export class PickupView extends MainView {
* @memberof PickupView
*/
public useLoad(props: PickupViewProps) {
const { viewSubject } = this.viewState;
const { viewSubject } = this.state;
onMounted(() => {
viewSubject.next({ tag: 'grid', action: "load", data: {} })
})
......@@ -48,12 +48,12 @@ export class PickupView extends MainView {
public confirm() {
this.emit('viewEvent', { data: this.selectData, tag: '', action: 'close' })
}
public handleCtrlEvent(actionParam: IActionParam) {
debugger
const { tag, action, data } = actionParam;
// TODO
if (action === 'selectionChange') {
this.selectData = data;
this.emit('viewEvent', { data: this.selectData, tag: '', action: 'viewDataChange' })
......@@ -67,17 +67,13 @@ export class PickupView extends MainView {
/**
* @description 安装视图所有功能模块的方法
* @param {PickupViewProps} props 传入的Props
* @param {Function} [emit] [emit] 事件
* @return {*}
* @memberof PickupView
*/
public moduleInstall(props: PickupViewProps, emit?: Function) {
const superParams = super.moduleInstall(props, emit);
this.useLoad(props);
public moduleInstall() {
const superParams = super.moduleInstall();
return {
...superParams,
state: this.viewState,
selectData: this.selectData,
cancel: this.cancel.bind(this),
confirm: this.confirm.bind(this)
......
......@@ -15,7 +15,7 @@ export class TreeExpView extends ExpView {
* @type {TreeExpViewState}
* @memberof TreeExpView
*/
public declare viewState: TreeExpViewState;
public declare state: TreeExpViewState;
/**
* @description 使用加载功能模块
......@@ -23,7 +23,7 @@ export class TreeExpView extends ExpView {
* @memberof TreeExpView
*/
public useLoad(props: TreeExpViewProps) {
const { viewSubject, treeExpBarName } = this.viewState;
const { viewSubject, treeExpBarName } = this.state;
onMounted(() => {
viewSubject.next({ tag: treeExpBarName, action: "load", data: {} });
})
......@@ -31,13 +31,11 @@ export class TreeExpView extends ExpView {
/**
* @description 安装视图所有功能模块的方法
* @param {TreeExpViewProps} props 传入的Props
* @param {Function} [emit] [emit] 事件
* @return {*}
* @memberof TreeExpView
*/
public moduleInstall(props: TreeExpViewProps, emit?: Function) {
const superParams = super.moduleInstall(props, emit);
public moduleInstall() {
const superParams = super.moduleInstall();
return {
...superParams
};
......
import { Ref } from 'vue';
import { useRoute } from 'vue-router';
import { ViewPropsBase, ViewStateBase, UIBase, IParam, UIUtil } from '@core';
import { ViewPropsBase, ViewStateBase, UIBase, IParam, UIUtil, deepCopy } from '@core';
/**
* @description 视图基类
......@@ -10,11 +10,28 @@ import { ViewPropsBase, ViewStateBase, UIBase, IParam, UIUtil } from '@core';
export class ViewBase {
/**
* @description 视图状态
* 响应状态
*
* @type {ViewStateBase}
* @memberof ViewBase
*/
public viewState: ViewStateBase;
public declare state: ViewStateBase;
/**
* 输入参数
*
* @type {IParam}
* @memberof ViewBase
*/
public declare props: IParam;
/**
* 输出事件
*
* @type {Function}
* @memberof ViewBase
*/
public declare emit: Function;
/**
* 界面行为服务
......@@ -35,21 +52,22 @@ export class ViewBase {
/**
* Creates an instance of ViewBase.
* @param {*} options 配置参数
* @param {IParam} props 输入参数
* @param {IParam} emit 输出参数
* @memberof ViewBase
*/
constructor(options: any) {
this.viewState = reactive(options);
constructor(options: any, props: IParam, emit: Function) {
this.state = reactive(deepCopy(options) as any);
this.props = props;
this.emit = emit;
}
/**
* @description 根据props调整视图状态变量
* @param {ViewPropsBase} props 传入的Props
* @param {Function} emit 事件
* @description 处理响应式状态(state中的对象属性)
* @memberof ViewBase
*/
protected handleState(props: ViewPropsBase, emit: Function) {
// 只读属性处理:把props的属性的Ref赋给state,以维持响应性
this.viewState.viewSubject = toRef(props, 'viewSubject') as any;
protected handleReactiveState() {
this.state.viewSubject = toRef(this.props, 'viewSubject') as any;
}
/**
......@@ -59,7 +77,7 @@ export class ViewBase {
* @memberof ViewEngine
*/
public next({ tag, action, data }: { tag: string, action: string, data: any }): void {
const { viewSubject } = this.viewState;
const { viewSubject } = this.props;
viewSubject.next({ tag: tag, action: action, data: data })
}
......@@ -73,7 +91,7 @@ export class ViewBase {
private handleViewContextParams(props: ViewPropsBase, context: Ref<IParam | undefined>, viewParams: Ref<IParam | undefined>) {
if (!context.value) context.value = {};
if (!viewParams.value) viewParams.value = {};
const { appViewNavContexts, appViewNavParams } = this.viewState;
const { appViewNavContexts, appViewNavParams } = this.state;
if (Object.is(props.openType, 'ROUTE')) {
// 应用上下文
const appContext = App.getAppData();
......@@ -123,29 +141,26 @@ export class ViewBase {
* @param {Function} emit 事件
* @memberof ViewBase
*/
public useViewContextParams(props: ViewPropsBase, emit: Function) {
const context = UIBase.toOneWayRef(props, 'context');
const viewParams = UIBase.toOneWayRef(props, 'viewParams');
public useViewContextParams() {
const context = UIBase.toOneWayRef(this.props, 'context');
const viewParams = UIBase.toOneWayRef(this.props, 'viewParams');
// 导航视图参数处理
this.handleViewContextParams(props, context, viewParams);
this.handleViewContextParams(this.props, context, viewParams);
watch(context, (newVal: any, oldVal: any) => {
this.handleViewContextParams(props, newVal, viewParams);
this.handleViewContextParams(this.props, newVal, viewParams);
});
// 把Ref赋值到State上进行解包
this.viewState.context = context;
this.viewState.viewParams = viewParams;
return { context, viewParams };
this.state.context = context;
this.state.viewParams = viewParams;
}
/**
*@description 使用UI服务
*
* @param {ViewPropsBase} props
* @param {Function} emit
* @memberof ViewBase
*/
public useUIService(props: ViewPropsBase, emit: Function) {
const { appEntityName, context } = this.viewState;
public useUIService() {
const { appEntityName, context } = this.state;
if (appEntityName) {
App.getUIService(appEntityName.toLowerCase(), context).then((service: IParam) => {
this.appUIService = service;
......@@ -156,12 +171,10 @@ export class ViewBase {
/**
*@description 使用数据服务
*
* @param {ViewPropsBase} props
* @param {Function} emit
* @memberof ViewBase
*/
public useDataService(props: ViewPropsBase, emit: Function) {
const { appEntityName, context } = this.viewState;
public useDataService() {
const { appEntityName, context } = this.state;
if (appEntityName) {
App.getDataService(appEntityName.toLowerCase(), context).then((service: IParam) => {
this.appDataService = service;
......@@ -172,43 +185,37 @@ export class ViewBase {
/**
* @description 使用计数器服务
*
* @param {ViewPropsBase} props 传入的Props
* @param {Function} emit 事件
* @memberof ViewBase
*/
public useCounterService(props: ViewPropsBase, emit: Function) { }
public useCounterService() { }
/**
* @description 处理视图初始化
*
* @param {ViewPropsBase} props
* @param {Function} emit
* @memberof ViewBase
*/
public useViewInit(props: ViewPropsBase, emit: Function) { }
public useViewInit() { }
/**
* @description 安装视图所有功能模块的方法
*
* @param {ViewPropsBase} props 传入的Props
* @param {Function} emit 事件
* @memberof ViewBase
*/
public moduleInstall(props: ViewPropsBase, emit: Function) {
public moduleInstall() {
// 处理视图状态
this.handleState(props, emit);
this.handleReactiveState();
// 处理视图导航参数
this.useViewContextParams(props, emit);
this.useViewContextParams();
// 使用计数器服务
this.useCounterService(props, emit);
this.useCounterService();
// 使用数据服务
this.useDataService(props, emit);
this.useDataService();
// 使用UI服务
this.useUIService(props, emit);
this.useUIService();
// 处理视图初始化
this.useViewInit(props, emit);
this.useViewInit();
return {
state: this.viewState
state: this.state
};
}
}
......@@ -30,7 +30,7 @@ export class TreeControl extends MainControl {
/**
* @description 树节点选中
* @param {string} nodeId
* @param \{{ nativeEvent: MouseEvent, node: any, selected: boolean }} e
* @param { nativeEvent: MouseEvent, node: any, selected: boolean } e
* @memberof TreeControl
*/
public treeNodeSelect(nodeId: string, e: { nativeEvent: MouseEvent, node: any, selected: boolean }) {
......
......@@ -31,7 +31,7 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const { state } = new IndexView(ViewConfig).moduleInstall(props, emit);
const { state, menu } = new IndexView(ViewConfig, props, emit).moduleInstall();
const collapsed: Ref<boolean> = ref(false);
const collapsedChange = () => {
collapsed.value = !collapsed.value;
......@@ -55,7 +55,8 @@ const collapsedChange = () => {
<IbizUser/>
</template>
<template #menu>
<{{#page.ctrls}}{{#eq controlType "APPMENU"}}{{codeName}}Menu{{/eq}}{{/page.ctrls}}
<{{#page.ctrls}}{{#eq controlType "APPMENU"}}{{codeName}}Menu{{/eq}}{{/page.ctrls}}
ref="menu"
:context="state.context"
:collapsed="collapsed"
:menuAlign="state.menuAlign"
......
......@@ -29,7 +29,7 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(props, emit);
const { state, form, handleToolbarEvent } = new EditView(ViewConfig, props, emit).moduleInstall();
</script>
......@@ -56,6 +56,7 @@ const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(pro
{{/eq}}
{{#eq controlType "FORM"}}
<{{codeName}}Form
ref="form"
:showBusyIndicator="true"
:context="state.context"
:viewParams="state.viewParams"
......
......@@ -32,7 +32,7 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const { state, grid, handleCtrlEvent, handleToolbarEvent } = new GridView(ViewConfig).moduleInstall(props, emit);
const { state, grid, handleCtrlEvent, handleToolbarEvent } = new GridView(ViewConfig, props, emit).moduleInstall();
</script>
......
......@@ -32,7 +32,7 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const { state, confirm, handleCtrlEvent } = new PickupGridView(ViewConfig).moduleInstall(props, emit);
const { state, confirm, handleCtrlEvent } = new PickupGridView(ViewConfig, props, emit).moduleInstall();
</script>
<template>
......
......@@ -28,7 +28,7 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const { state, cancel, confirm,handleCtrlEvent } = new PickupView(ViewConfig).moduleInstall(props, emit);
const { state, cancel, confirm,handleCtrlEvent } = new PickupView(ViewConfig, props, emit).moduleInstall();
</script>
<template>
......
......@@ -25,7 +25,7 @@ interface ViewEmit {
const emit = defineEmits<ViewEmit>();
// 安装功能模块
const { state, handleCtrlEvent, handleToolbarEvent } = new TreeExpView(ViewConfig).moduleInstall(props, emit);
const { state, handleCtrlEvent, handleToolbarEvent } = new TreeExpView(ViewConfig, props, emit).moduleInstall();
</script>
<template>
......
......@@ -2,7 +2,7 @@
import { Subject } from "rxjs";
import { CtrlConfig } from "./{{spinalCase ctrl.codeName}}-menu-config";
import { IParam, IActionParam, MenuControl, IContext } from "@core";
interface Props{
interface Props {
context: IContext;
defaultView: string;
collapsed: boolean;
......@@ -10,7 +10,7 @@ interface Props{
viewParams?: IParam;
viewSubject: Subject<IActionParam>;
}
const props = withDefaults(defineProps<Props>(), {
const props = withDefaults(defineProps < Props > (), {
menuAlign: "LEFT",
collapsed: false,
});
......@@ -18,19 +18,18 @@ const props = withDefaults(defineProps<Props>(), {
interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits<CtrlEmit>();
const emit = defineEmits < CtrlEmit > ();
const { state, menuSelect } = new MenuControl(CtrlConfig).moduleInstall(props, emit);
// 暴露内部状态及能力
defineExpose({ state, name: '{{ctrl.name}}' });
</script>
<template>
<a-menu
class="ibiz-menu"
v-model:openKeys="state.defaultOpens"
v-model:selectedKeys="state.defaultSelect"
:mode="Object.is('LEFT', state.menuAlign) ? 'inline' : 'horizontal'"
@select="menuSelect">
<IbizMenuItem :items="state.menus" :collapsed="collapsed"/>
<a-menu class="ibiz-menu" v-model:openKeys="state.defaultOpens" v-model:selectedKeys="state.defaultSelect"
:mode="Object.is('LEFT', state.menuAlign) ? 'inline' : 'horizontal'" @select="menuSelect">
<IbizMenuItem :items="state.menus" :collapsed="collapsed" />
</a-menu>
</template>
......
......@@ -12,8 +12,8 @@ interface Props {
viewSubject: Subject<IActionParam>;
}
const props = withDefaults(defineProps<Props>(), {
viewSubject: () => new Subject<IActionParam>(),
const props = withDefaults(defineProps < Props > (), {
viewSubject: () => new Subject < IActionParam > (),
showBusyIndicator: true,
})
......@@ -22,24 +22,23 @@ interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits<CtrlEmit>();
const emit = defineEmits < CtrlEmit > ();
// 安装功能模块,提供状态和能力方法
const { state, handleEditorEvent, handleComponentEvent } = new FormControl(CtrlConfig).moduleInstall(props, emit);
// 暴露内部状态及能力
defineExpose({ state, name: '{{ctrl.name}}' });
</script>
<template>
<a-form
name="{{ctrl.codeName}}"
<a-form name="{{ctrl.codeName}}"
class="ibiz-form{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}{{#if ctrl.infoFormMode}} ibiz-info-form{{/if}}"
style="{{#if ctrl.formWidth}}width: {{ctrl.formWidth}}px;{{/if}}"
:model="state.data"
:rules="state.rules">
style="{{#if ctrl.formWidth}}width: {{ctrl.formWidth}}px;{{/if}}" :model="state.data" :rules="state.rules">
{{#if ctrl.noTabHeader}}
{{#each ctrl.psDEFormPages as | ctrlPage | }}
{{#each ctrlPage.psDEFormDetails as | formDetail | }}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each }}
{{#each ctrlPage.psDEFormDetails as | formDetail | }}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each }}
{{/each}}
{{else}}
<a-tabs class="ibiz-form-page">
......
{{>@macro/front-end/widgets/grid-detail/include-grid.hbs}}
<script setup lang="ts">
import { Subject } from 'rxjs';
import { CtrlConfig } from './{{spinalCase ctrl.codeName}}-grid-config';
import { GridControl, IActionParam, IParam, IContext, ControlAction, deepCopy } from '@core';
import { Subject } from 'rxjs';
import { CtrlConfig } from './{{spinalCase ctrl.codeName}}-grid-config';
import { GridControl, IActionParam, IParam, IContext, ControlAction, deepCopy } from '@core';
interface Props {
context: IContext;
multiple: boolean;
rowEditState: boolean;
rowActiveMode: 0 | 1 | 2;
selectedData: IParam[];
selectFirstDefault: boolean;
viewParams?: IParam;
controlAction: ControlAction;
showBusyIndicator?: boolean;
viewSubject: Subject<IActionParam>;
}
interface Props {
context: IContext;
multiple: boolean;
rowEditState: boolean;
rowActiveMode: 0 | 1 | 2;
selectedData: IParam[];
selectFirstDefault: boolean;
viewParams?: IParam;
controlAction: ControlAction;
showBusyIndicator?: boolean;
viewSubject: Subject<IActionParam>;
}
const props = withDefaults(defineProps < Props > (), {
viewSubject: () => new Subject < IActionParam > (),
showBusyIndicator: true,
multiple: false,
rowEditState: false,
rowActiveMode: 0,
selectFirstDefault: false,
})
const props = withDefaults(defineProps < Props > (), {
viewSubject: () => new Subject < IActionParam > (),
showBusyIndicator: true,
multiple: false,
rowEditState: false,
rowActiveMode: 0,
selectFirstDefault: false,
})
// emit声明
interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits < CtrlEmit > ();
// 安装功能模块,提供状态和能力
const { state, load, handleEditorEvent, handleToolbarEvent, custom } = new GridControl(CtrlConfig).moduleInstall(props, emit);
const { scrollOption, rowKey, rowClassName, customRow, rowSelectionOption, resizeColumn, handleGridChange } = custom;
// 暴露内部状态及能力
defineExpose({ state, name: '{{ctrl.name}}', load });
// emit声明
interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits < CtrlEmit > ();
// 安装功能模块,提供状态和能力
const { state, load, handleEditorEvent, handleToolbarEvent, custom } = new GridControl(CtrlConfig).moduleInstall(props, emit);
const { scrollOption, rowKey, rowClassName, customRow, rowSelectionOption, resizeColumn, handleGridChange } = custom;
// 暴露内部状态及能力
defineExpose({ state, name: '{{ctrl.name}}', load });
</script>
<template>
<a-table bordered sticky class="ibiz-grid{{#if ctrl.psSysCss}} {{ctrl.psSysCss.cssName}}{{/if}}" :rowKey="rowKey"
......
......@@ -31,17 +31,15 @@ interface CtrlEmit {
const emit = defineEmits < CtrlEmit > ();
// 安装功能模块,提供状态和能力方法
const { state, handleViewEvent} = new PickupViewPanelControl(CtrlConfig).moduleInstall(props, emit);
const { state, handleViewEvent } = new PickupViewPanelControl(CtrlConfig).moduleInstall(props, emit);
// 暴露内部状态及能力
defineExpose({ state, name: '{{ctrl.name}}' });
</script>
<template>
<div class="ibiz-pickupviewpanel">
<ChartDataPickUpGridView
:isSingleSelect="state.isSingleSelect"
:isShowButton="state.isShowButton"
:selectedData="state.selectedData"
@viewEvent="handleViewEvent"
></ChartDataPickUpGridView>
<ChartDataPickUpGridView :isSingleSelect="state.isSingleSelect" :isShowButton="state.isShowButton"
:selectedData="state.selectedData" @viewEvent="handleViewEvent"></ChartDataPickUpGridView>
</div>
</template>
\ No newline at end of file
......@@ -33,19 +33,14 @@ const emit = defineEmits < CtrlEmit > ();
// 安装功能模块,提供状态和能力方法
const { state, inited, viewdata, viewparam } = new PickupViewPanelControl(CtrlConfig).moduleInstall(props, emit);
// 暴露内部状态及能力
defineExpose({ state, name: '{{ctrl.name}}' });
</script>
<template>
<div class="ibiz-pickupviewpanel">
<component
v-if="inited && state.embeddedView && state.embeddedView.viewName"
:if="state.embeddedView.viewName"
:viewdata="viewdata"
:viewparam="viewparam"
:isSingleSelect="state.isSingleSelect"
:isShowButton="state.isShowButton"
:selectedData="state.selectedData"
></component>
<component v-if="inited && state.embeddedView && state.embeddedView.viewName" :if="state.embeddedView.viewName"
:viewdata="viewdata" :viewparam="viewparam" :isSingleSelect="state.isSingleSelect"
:isShowButton="state.isShowButton" :selectedData="state.selectedData"></component>
</div>
</template>
\ No newline at end of file
......@@ -36,6 +36,9 @@ const emit = defineEmits < CtrlEmit > ();
// 安装功能模块,提供状态和能力方法
const { state, handleCtrlEvent } = new TreeExpBarControl(CtrlConfig).moduleInstall(props, emit);
// 暴露内部状态及能力
defineExpose({ state, name: '{{ctrl.name}}' });
</script>
<template>
......
......@@ -27,8 +27,12 @@ interface CtrlEmit {
(name: "ctrlEvent", value: IActionParam): void;
}
const emit = defineEmits<CtrlEmit>();
// 安装功能模块,提供状态和能力方法
const { state, load, treeNodeSelect } = new TreeControl(CtrlConfig).moduleInstall(props, emit);
// 暴露内部状态及能力
defineExpose({ state, name: '{{ctrl.name}}' });
</script>
// TODO 树节点待支持图标和自定义绘制
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册