提交 25d014e6 编写于 作者: Shine-zwj's avatar Shine-zwj

update:更新

上级 5fcc7d67
...@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor; ...@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import net.ibizsys.model.control.IPSControl; import net.ibizsys.model.control.IPSControl;
import net.ibizsys.model.control.layout.IPSGridLayoutPos;
@Getter @Getter
@Setter @Setter
...@@ -40,4 +41,8 @@ public class CtrlModel extends BaseModel{ ...@@ -40,4 +41,8 @@ public class CtrlModel extends BaseModel{
return (IPSControl)opt; return (IPSControl)opt;
} }
public void getGridOptions(IPSGridLayoutPos layoutPos)
{
System.out.println(layoutPos);
}
} }
{{#eq item.pSLayoutPos 'FLEX'}} {{#eq item.pSLayoutPos 'FLEX'}}
<div style="flex-grow: {{#if item.pSLayoutPos.grow}}{{item.pSLayoutPos.grow}}{{else}}0{{/if}};"> <div style="flex-grow: {{#if item.pSLayoutPos.grow}}{{item.pSLayoutPos.grow}}{{else}}0{{/if}};">
<AppFormGroup name="{{item.codeName}}" title="{{item.caption}}"> <IbizFormGroup name="{{item.codeName}}" title="{{item.caption}}">
{{#each item.psDEFormDetails as | formDetail | }} {{#each item.psDEFormDetails as | formDetail | }}
{{>(lookup . 'formDetail.detailType') item=formDetail}} {{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}} {{/each}}
</AppFormGroup> </IbizFormGroup>
</div> </div>
{{else}} {{else}}
<!-- 栅格样式需要方法计算" --> {{ctrl.getGridOptions(item.getPSLayoutPos)}}
<a-col :span="24"> <a-col :span="24">
<AppFormGroup name="{{item.codeName}}" title="{{item.caption}}"> <IbizFormGroup name="{{item.codeName}}" title="{{item.caption}}">
{{#each item.psDEFormDetails as | formDetail | }} {{#each item.psDEFormDetails as | formDetail | }}
{{>(lookup . 'formDetail.detailType') item=formDetail}} {{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}} {{/each}}
</AppFormGroup> </IbizFormGroup>
</a-col> </a-col>
{{/eq}} {{/eq}}
\ No newline at end of file
{{#eq item.pSLayoutPos 'FLEX'}} {{#eq item.pSLayoutPos 'FLEX'}}
<div style="flex-grow: {{#if item.pSLayoutPos.grow}}{{item.pSLayoutPos.grow}}{{else}}0{{/if}};"> <div style="flex-grow: {{#if item.pSLayoutPos.grow}}{{item.pSLayoutPos.grow}}{{else}}0{{/if}};">
<AppFormItem name="{{item.codeName}}" label="{{item.caption}}"> <IbizFormItem name="{{item.codeName}}" label="{{item.caption}}">
{{#if item.psEditor}} {{#if item.psEditor}}
{{>(lookup . 'item.psEditor.editorType') item=item}} {{>(lookup . 'item.psEditor.editorType') item=item}}
{{/if}} {{/if}}
</AppFormItem> </IbizFormItem>
</div> </div>
{{else}} {{else}}
<!-- 栅格样式需要方法计算" -->
<a-col :span="24"> <a-col :span="24">
<AppFormItem name="{{item.codeName}}" label="{{item.caption}}"> <IbizFormItem name="{{item.codeName}}" label="{{item.caption}}">
{{#if item.psEditor}} {{#if item.psEditor}}
{{>(lookup . 'item.psEditor.editorType') item=item}} {{>(lookup . 'item.psEditor.editorType') item=item}}
{{/if}} {{/if}}
</AppFormItem> </IbizFormItem>
</a-col> </a-col>
{{/eq}} {{/eq}}
\ No newline at end of file
<a-tab-pane key="{{formPage.codeName}}" tab="{{formPage.caption}}"> <a-tab-pane key="{{item.codeName}}" tab="{{item.caption}}">
{{#eq formPage.pSLayout.layout "FLEX"}} {{#eq item.pSLayout.layout "FLEX"}}
<div class="app-form-layout-flex" style="{{#if formPage.pSLayout.dir}}flex-direction: {{formPage.pSLayout.dir}};{{/if}}{{#if formPage.pSLayout.align}}justify-content: {{formPage.pSLayout.align}};{{/if}}{{#if formPage.pSLayout.vAlign}}align-items: {{formPage.pSLayout.vAlign}};{{/if}}"> <div class="app-form-layout-flex" style="{{#if item.pSLayout.dir}}flex-direction: {{item.pSLayout.dir}};{{/if}}{{#if item.pSLayout.align}}justify-content: {{item.pSLayout.align}};{{/if}}{{#if item.pSLayout.vAlign}}align-items: {{item.pSLayout.vAlign}};{{/if}}">
{{#each formPage.psDEFormDetails as | formDetail |}} {{#each item.psDEFormDetails as | formDetail |}}
{{>(lookup . 'formDetail.detailType') item=formDetail}} {{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}} {{/each}}
</div> </div>
{{else}} {{else}}
<a-row> <a-row>
{{#each formPage.psDEFormDetails as | formDetail |}} {{#each item.psDEFormDetails as | formDetail |}}
{{>(lookup . 'formDetail.detailType') item=formDetail}} {{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}} {{/each}}
</a-row> </a-row>
......
...@@ -7,12 +7,15 @@ ...@@ -7,12 +7,15 @@
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@ant-design/icons-vue": "^6.0.1",
"ant-design-vue": "^3.0.0-alpha.14",
"element-plus": "^1.2.0-beta.6", "element-plus": "^1.2.0-beta.6",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"qx-util": "^0.0.10", "qx-util": "^0.0.10",
"ramda": "^0.27.1", "ramda": "^0.27.1",
"rxjs": "^7.4.0", "rxjs": "^7.4.0",
"vue": "^3.2.23", "vue": "^3.2.23",
"vue-router": "^4.0.12",
"vue-global-api": "^0.4.1" "vue-global-api": "^0.4.1"
}, },
"devDependencies": { "devDependencies": {
......
<script setup lang="ts"> <script setup lang="ts">
// This starter template is using Vue 3 <script setup> SFCs // This starter template is using Vue 3 <script setup> SFCs
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup // Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
import { EditView } from './views/EditView' import { JobsInfoEditView } from '@page/jobs-info/jobs-info-edit-view';
</script> </script>
<template> <template>
<EditView :context="{}" /> <JobsInfoEditView :context="{}"/>
</template> </template>
<style> <style>
......
<script setup lang="ts">
interface LayoutProps {
/**
* @description 菜单方向
*/
menuAlign: "LEFT" | "TOP" | "CENTER" | "TABEXP_LEFT" | "TABEXP_TOP" | "TABEXP_RIGHT" | "TABEXP_BOTTOM" | "NONE",
/**
* @description 收缩
*/
collapsed: boolean,
}
const props = withDefaults(defineProps<LayoutProps>(), {
menuAlign: "LEFT",
collapsed: false,
})
</script>
<template>
<a-layout class="app-index-view">
<a-layout-header>
<slot name="header"></slot>
<slot name="menu" v-if="Object.is(menuAlign, 'TOP')"></slot>
<slot name="user"></slot>
</a-layout-header>
<a-layout>
<a-layout-sider
v-if="Object.is(menuAlign, 'LEFT')"
theme="light"
collapsible
:trigger="null"
:collapsed="collapsed">
<slot name="menu"></slot>
</a-layout-sider>
<a-layout-content>
<slot name="content"></slot>
</a-layout-content>
</a-layout>
</a-layout>
</template>
<style lang="scss">
.app-index-view {
width: 100%;
height: 100%;
.ant-layout-header {
display: flex;
background-color: #fff;
justify-content: space-between;
}
}
</style>
\ No newline at end of file
import DefaultIndexViewLayout from './DefaultIndexViewLayout.vue'
export const IbizDefaultIndexViewLayout = DefaultIndexViewLayout;
\ No newline at end of file
export * from './DefaultViewLayout' export * from './DefaultViewLayout';
\ No newline at end of file export * from './DefaultIndexViewLayout';
<script setup lang="ts">
import { IActionParam } from "@ibiz-core";
interface FormGroupProps{
name: string;
title: string;
}
interface FormGroupEmit{
(name: 'componentEvent', value: IActionParam): void
}
const props = withDefaults(defineProps<FormGroupProps>(), {});
const emit = defineEmits<FormGroupEmit>();
</script>
<template>
<a-card
:class="['app-form-group', `app-form-group-${name}`]"
:title="title"
:bordered="false">
<template #extra>
<a href="#">行为</a>
</template>
<slot></slot>
</a-card>
</template>
<style lang="scss">
.app-form-group {
height: 100%;
width: 100%;
.ant-card-head {
text-align: left;
}
}
</style>
\ No newline at end of file
import FormGroup from './FormGroup.vue'
export const IbizFormGroup = FormGroup;
\ No newline at end of file
<script setup lang="ts">
import { IActionParam } from "@ibiz-core";
interface FormGroupProps{
name: string;
error: string;
label: string;
}
interface FormGroupEmit{
(name: 'componentEvent', value: IActionParam): void
}
const props = withDefaults(defineProps<FormGroupProps>(), {});
const emit = defineEmits<FormGroupEmit>();
</script>
<template>
<a-form-item :name="name" :label="label" :help="error" :validateStatus="error ? 'error': 'validating'">
<slot></slot>
</a-form-item>
</template>
<style lang="scss">
</style>
\ No newline at end of file
import FormItem from './FormItem.vue'
export const IbizFormItem = FormItem;
\ No newline at end of file
<script setup lang="ts">
import { IParam } from "@ibiz-core";
import {
UserOutlined,
} from '@ant-design/icons-vue';
interface MenuItemProps{
items: IParam[];
}
const props = withDefaults(defineProps<MenuItemProps>(), {});
</script>
<template>
<template v-for="item in items" :key="item.id">
<template v-if="!item.items">
<a-menu-item v-if="!item.hidden" :key="item.id">
<template #icon>
<UserOutlined />
</template>
{{ item.title }}
</a-menu-item>
</template>
<template v-else>
<a-sub-menu v-if="!item.hidden" :key="item.id">
<template #icon>
<UserOutlined />
</template>
<template #title>{{ item.title }}</template>
<app-menu-item :items="item.items" />
</a-sub-menu>
</template>
</template>
</template>
<style lang="scss">
</style>
\ No newline at end of file
import MenuItem from './MenuItem.vue'
export const IbizMenuItem = MenuItem;
\ No newline at end of file
export * from './IconText' export * from './IconText';
\ No newline at end of file export * from './FormItem';
export * from './FormGroup';
export * from './MenuItem';
\ No newline at end of file
...@@ -23,8 +23,8 @@ export interface IActionParam { ...@@ -23,8 +23,8 @@ export interface IActionParam {
/** /**
* @description 数据 * @description 数据
* @type {IParam} * @type {*}
* @memberof IActionParam * @memberof IActionParam
*/ */
data: IParam; data: any;
} }
\ No newline at end of file
import { Subject } from "rxjs"; import { Subject } from "rxjs";
import { IActionParam, IParam } from "@ibiz-core";
/** /**
* 视图props的基类 * 视图props的基类
...@@ -7,17 +8,17 @@ export interface ViewPropsBase { ...@@ -7,17 +8,17 @@ export interface ViewPropsBase {
/** /**
* 上下文参数(外部传入) * 上下文参数(外部传入)
*/ */
context?: any; context?: IParam;
/** /**
* 视图参数(外部传入) * 视图参数(外部传入)
*/ */
viewParams?: any; viewParams?: IParam;
/** /**
* 视图参数(外部传入) * 视图参数(外部传入)
*/ */
viewSubject?: Subject<any>; viewSubject?: Subject<IActionParam>;
/** /**
* 视图打开方式,路由、模态、内嵌,默认为路由方式 * 视图打开方式,路由、模态、内嵌,默认为路由方式
......
import { Subject } from "rxjs"; import { Subject } from "rxjs";
import { IActionParam, IParam } from '@ibiz-core';
/** /**
* 视图基类状态 * 视图基类状态
*/ */
...@@ -17,17 +17,17 @@ export interface ViewStateBase { ...@@ -17,17 +17,17 @@ export interface ViewStateBase {
/** /**
* 上下文参数 * 上下文参数
*/ */
context: any; context: IParam;
/** /**
* 视图参数 * 视图参数
*/ */
viewParams: any; viewParams: IParam;
/** /**
* 视图参数(外部传入) * 视图参数(外部传入)
*/ */
viewSubject: Subject<any>; viewSubject: Subject<IActionParam>;
// 声明任意属性 // 声明任意属性
[propName: string]: any; [propName: string]: any;
......
import { Subject } from "rxjs"; import { Subject } from "rxjs";
import { IActionParam, IParam } from "@ibiz-core";
/** /**
* 部件props的基类 * 部件props的基类
...@@ -7,15 +8,15 @@ import { Subject } from "rxjs"; ...@@ -7,15 +8,15 @@ import { Subject } from "rxjs";
/** /**
* 上下文参数(外部传入) * 上下文参数(外部传入)
*/ */
context?: any; context?: IParam;
/** /**
* 视图参数(外部传入) * 视图参数(外部传入)
*/ */
viewParams?: any; viewParams?: IParam;
/** /**
* 视图参数(外部传入) * 视图参数(外部传入)
*/ */
viewSubject: Subject<any>; viewSubject: Subject<IActionParam>;
} }
\ No newline at end of file
import { IActionParam, IParam } from "@ibiz-core";
import { Subject } from "rxjs"; import { Subject } from "rxjs";
/** /**
...@@ -17,18 +18,18 @@ import { Subject } from "rxjs"; ...@@ -17,18 +18,18 @@ import { Subject } from "rxjs";
/** /**
* 上下文参数 * 上下文参数
*/ */
context: any; context: IParam;
/** /**
* 视图参数 * 视图参数
*/ */
viewParams: any; viewParams: IParam;
/** /**
* 视图参数(外部传入) * 视图参数(外部传入)
*/ */
viewSubject: Subject<any>; viewSubject: Subject<IActionParam>;
// 声明任意属性 // 声明任意属性
// [propName: string]: any; [propName: string]: any;
} }
\ No newline at end of file
import { MainControlState } from '@ibiz-core'; import { IParam, MainControlState } from '@ibiz-core';
/** /**
* 表单部件状态 * 表单部件状态
*/ */
export interface FormControlState extends MainControlState { export interface FormControlState extends MainControlState {
/** /**
* 表单数据对象 * @description 表单数据对象
* @type {IParam}
* @memberof FormControlState
*/ */
data: any; data: IParam;
/**
* @description 表单成员模型集合
* @type {IParam}
* @memberof FormControlState
*/
detailsModel: IParam;
/**
* @description 表单界面行为模型集合
* @type {IParam}
* @memberof FormControlState
*/
actionModel: IParam;
} }
import { deepCopy, FormControlProps, FormControlState, MainControl } from '@ibiz-core'; import { deepCopy, FormControlProps, FormControlState, IActionParam, MainControl } from '@ibiz-core';
import { SyncSeriesHook } from "qx-util";
/** /**
* 表单部件 * 表单部件
* @export * @export
* @class ControlBase * @class FormControl
*/ */
export class FormControl extends MainControl { export class FormControl extends MainControl {
/** /**
...@@ -57,9 +56,9 @@ export class FormControl extends MainControl { ...@@ -57,9 +56,9 @@ export class FormControl extends MainControl {
// 订阅viewSubject,监听load行为 // 订阅viewSubject,监听load行为
if(viewSubject){ if(viewSubject){
let subscription = viewSubject.subscribe((args: any)=>{ let subscription = viewSubject.subscribe(({ tag, action, data }: IActionParam)=>{
if(args.tag == controlName && args.action == "load"){ if(Object.is(controlName, tag) && Object.is("load", action) ){
load(args.data) load(data)
} }
}) })
// 部件卸载时退订viewSubject // 部件卸载时退订viewSubject
......
import { ControlAction, ControlStateBase } from "@ibiz-core"; import { ControlAction, ControlStateBase, IParam } from "@ibiz-core";
/** /**
* 实体部件状态 * 实体部件状态
...@@ -17,5 +17,5 @@ import { ControlAction, ControlStateBase } from "@ibiz-core"; ...@@ -17,5 +17,5 @@ import { ControlAction, ControlStateBase } from "@ibiz-core";
/** /**
* 部件服务 * 部件服务
*/ */
controlService: any controlService: IParam;
} }
\ No newline at end of file
import 'font-awesome/css/font-awesome.min.css' import 'font-awesome/css/font-awesome.min.css'
import '@/style/index.scss' import '@/style/index.scss'
import { createApp } from 'vue' import Router from '@/router';
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
import App from './App.vue' import App from './App.vue'
createApp(App).mount('#app') createApp(App).use(Router).use(Antd).mount('#app')
export const ViewConfig = {
viewCodeName: '{{page.codeName}}',
viewName: '{{page.name}}',
viewCaption: '{{page.caption}}',
};
\ No newline at end of file
<script setup lang="ts">
import { Subject } from 'rxjs'
import { EditView, IActionParam, IParam } from '@ibiz-core'
import { ViewConfig } from './{{page.codeName.spinalCase}}-config'
import { DefaultIndexViewLayout } from '@components';
{{#page.ctrls}}
{{#eq controlType "APPMENU"}}
import { {{codeName}}Menu } from '@widgets/app/{{codeName.spinalCase}}-menu';
{{/eq}}
{{/page.ctrls}}
// props声明和默认值处理
interface Props {
context: IParam;
viewParams?: IParam;
openType?: "ROUTE" | "MODAL" | "EMBED";
viewSubject?: Subject<IActionParam>;
}
const props = withDefaults(defineProps<Props>(), {
// 设定默认值,可选属性可以在这初始化
viewSubject: () => new Subject<IActionParam>()
})
// emit声明
interface ViewEmit {
(name: "CLOSE", value: IActionParam): void;
(name: "VIEWCHANGE", value: IActionParam): void;
}
const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
//const { state } = new EditView(ViewConfig).moduleInstall(props);
const collapsed: Ref<boolean> = ref(false);
</script>
<template>
<DefaultIndexViewLayout class="ibiz-index-view" menuAlign="LEFT" :collapsed="collapsed">
<template #header>
<div class="index-view-header">
<MenuUnfoldOutlined
v-if="collapsed"
class="trigger"
@click="() => (collapsed = !collapsed)"
/>
<MenuFoldOutlined v-else class="trigger" @click="() => (collapsed = !collapsed)" />
</div>
</template>
<template #user>
</template>
<template #menu>
<{{#page.ctrls}}{{#eq controlType "APPMENU"}}{{codeName}}Menu{{/eq}}{{/page.ctrls}}
ref="menu"
name="menu"
menuAlign="LEFT"
:viewState="viewState"
:contextProp="context"
:viewParamsProp="viewParams">
</{{#page.ctrls}}{{#eq controlType "APPMENU"}}{{codeName}}Menu{{/eq}}{{/page.ctrls}}>
</template>
<template #content>
<router-view />
</template>
</DefaultIndexViewLayout>
</template>
<style lang="scss">
.ibiz-index-view {
.index-view-header {
font-size: 18px;
>.trigger:hover {
color: #1890ff;
}
}
}
</style>
\ No newline at end of file
...@@ -20,7 +20,7 @@ export const ViewConfig = { ...@@ -20,7 +20,7 @@ export const ViewConfig = {
action:{ action:{
'createAction': 'Create' 'createAction': 'Create'
} }
} },
{{/eq}} {{/eq}}
{{/page.ctrls}} {{/page.ctrls}}
}; };
\ No newline at end of file
<script setup lang="ts"> <script setup lang="ts">
import { Subject } from 'rxjs' import { Subject } from 'rxjs';
import { EditView, IActionParam } from '@ibiz-core' import { EditView, IActionParam, IParam } from '@ibiz-core';
import { ViewConfig } from './{{page.codeName.spinalCase}}-config' import { ViewConfig } from './{{page.codeName.spinalCase}}-config';
{{#page.ctrls}} {{#page.ctrls}}
{{#neq controlType "TOOLBAR"}} {{#eq controlType "FORM"}}
import { {{codeName}} } from '@widgets/{{appEntity.codeName.spinalCase}}/{{codeName.spinalCase}}'; import { {{codeName}}Form } from '@widgets/{{appEntity.codeName.spinalCase}}/{{codeName.spinalCase}}-form';
{{/neq}} {{/eq}}
{{/page.ctrls}} {{/page.ctrls}}
import { IbizDefaultViewLayout, IbizIconText } from '@components'; import { IbizDefaultViewLayout, IbizIconText } from '@components';
// props声明和默认值处理 // props声明和默认值处理
interface Props { interface Props {
context: any; context: IParam;
viewParams?: any; viewParams?: IParam;
openType?: "ROUTE" | "MODAL" | "EMBED"; openType?: "ROUTE" | "MODAL" | "EMBED";
viewSubject?: Subject<any>; viewSubject?: Subject<IActionParam>;
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
// 设定默认值,可选属性可以在这初始化 // 设定默认值,可选属性可以在这初始化
viewSubject: () => new Subject<any>() viewSubject: () => new Subject<IActionParam>()
}) })
// emit声明 // emit声明
...@@ -43,18 +43,18 @@ const { state } = new EditView(ViewConfig).moduleInstall(props); ...@@ -43,18 +43,18 @@ const { state } = new EditView(ViewConfig).moduleInstall(props);
<template v-slot:header-right> <template v-slot:header-right>
<span>工具栏部件</span> <span>工具栏部件</span>
</template> </template>
<EditForm <{{#page.ctrls}}{{#eq controlType "FORM"}}{{codeName}}Form{{/eq}}{{/page.ctrls}}
:showBusyIndicator="true" :showBusyIndicator="true"
:context="state.context" :context="state.context"
:viewParams="state.viewParams" :viewParams="state.viewParams"
:controlAction="state.controlsAction" :controlAction="state.controlsAction"
:viewSubject="state.viewSubject" :viewSubject="state.viewSubject"
></EditForm> ></{{#page.ctrls}}{{#eq controlType "FORM"}}{{codeName}}Form{{/eq}}{{/page.ctrls}}>
</IbizDefaultViewLayout> </IbizDefaultViewLayout>
</template> </template>
<style scoped> <style lang="scss">
.ibiz-view-container { .ibiz-edit-view {
height: 100%; height: 100%;
width: 100%; width: 100%;
} }
......
import { createRouter, createWebHashHistory } from 'vue-router';
import { JobsInfoEditView } from '@page/jobs-info/jobs-info-edit-view';
const routes = [
{
path: '/JobsInfoEditView',
component: JobsInfoEditView
},
{
path: '/',
redirect: 'JobsInfoEditView'
},
]
const router = createRouter({
history: createWebHashHistory(),
routes,
})
/**
* 全局路由守卫
*/
router.beforeEach((to, from, next) => {
next();
})
export default router;
\ No newline at end of file
import {{ctrl.codeName}}Menu from "./{{ctrl.codeName.spinalCase}}-menu.vue";
export { {{ctrl.codeName}}Menu };
export const CtrlConfig = {
ctrlCodeName: '{{ctrl.codeName}}',
ctrlName: '{{ctrl.name}}',
ctrlCaption: '{{ctrl.caption}}',
};
\ No newline at end of file
<script setup lang="ts">
import { getCurrentInstance, onBeforeMount, onUnmounted, Ref, ref } from "vue";
import { Subject, Subscription } from "rxjs";
import { CtrlConfig } from './{{ctrl.codeName.spinalCase}}-menu-config';
import { useContextParams, handleMenusResource, menuSelect } from "@core";
import { IParam, IActionParam } from "@ibiz-core";
import { IbizMenuItem } from "@components";
import { useRoute, useRouter } from "vue-router";
interface MenuProps{
/**
* @description 部件名称
*/
name: string;
/**
* @description 传入上下文
*/
contextProp: IParam;
/**
* @description 传入视图参数
*/
viewParamsProp?: IParam;
/**
* @description 视图状态
*/
viewState: Subject<IActionParam>;
/**
* @description 菜单方向
*/
menuAlign: "LEFT" | "TOP" | "CENTER" | "TABEXP_LEFT" | "TABEXP_TOP" | "TABEXP_RIGHT" | "TABEXP_BOTTOM" | "NONE";
/**
* @description 默认视图
*/
defaultView: string;
}
const props = withDefaults(defineProps<MenuProps>(), {
menuAlign: "LEFT",
});
const { context, viewParams } = useContextParams(props);
let viewStateEvent: Subscription | undefined;
const menu = getCurrentInstance()?.vnode;
defineExpose({
menu
})
/**
* @description 菜单项集合
*/
const menus: Ref<IParam[]> = ref([
{
id: "1",
title: "菜单项1",
expanded: true,
items: [
{
id: "3",
title: "菜单项3",
},
{
id: "4",
title: "编辑视图",
openDefault: true,
funcTag: "1",
},
]
},
{
id: "2",
title: "菜单项2",
}
]);
const defaultOpens: Ref<string[]> = ref([]);
const defaultSelect: Ref<string[]>= ref([]);
const router = useRouter();
const route = useRoute();
/**
* @description 应用功能集合
*/
const funcs: IParam[] = [{
funcTag: "1",
}];
const modelParam = {
funcs: funcs,
}
const runtimeParam = {
menus: menus,
context: context,
defaultView: props.defaultView,
authService: {},
defaultOpens: defaultOpens,
defaultSelect: defaultSelect,
viewParams: viewParams,
mode: props.menuAlign,
router: router,
route: route,
}
const onSelect = (item: any, key: any, selectedKeys: any) => {
menuSelect(modelParam, runtimeParam);
}
onBeforeMount(() => {
if (props.viewState) {
viewStateEvent = props.viewState.subscribe(({ tag, action, data }: IActionParam) => {
if (Object.is(tag, props.name)) {
switch (action) {
case 'load':
handleMenusResource(modelParam, runtimeParam);
break;
}
}
});
}
})
onUnmounted(() => {
if (viewStateEvent) {
viewStateEvent.unsubscribe();
}
})
</script>
<template>
<a-menu
v-model:openKeys="defaultOpens"
v-model:selectedKeys="defaultSelect"
:mode="Object.is('LEFT', menuAlign) ? 'inline' : 'horizontal'"
@select="onSelect">
<IbizMenuItem :items="menus" />
</a-menu>
</template>
<style scoped>
</style>
\ No newline at end of file
import {{ctrl.codeName}}Form from "./{{ctrl.codeName.spinalCase}}-form.vue";
export { {{ctrl.codeName}}Form };
export const CtrlConfig = {
ctrlCodeName: '{{ctrl.codeName}}',
ctrlName: '{{ctrl.name}}',
ctrlCaption: '{{ctrl.caption}}',
};
\ No newline at end of file
{{>@macro/components/include-ctrls.hbs}}
<script setup lang="ts">
import { Subject } from 'rxjs';
import { CtrlConfig } from './{{ctrl.codeName.spinalCase}}-form-config';
import { FormControl, IActionParam, IParam, ControlAction } from '@ibiz-core';
import { IbizFormItem, IbizFormGroup } from '@components';
interface Props {
context: IParam;
viewParams?: IParam;
controlAction: ControlAction;
showBusyIndicator?: boolean;
viewSubject?: Subject<IActionParam>;
}
const props = withDefaults(defineProps<Props>(), {
viewSubject: () => new Subject<IActionParam>(),
showBusyIndicator: true,
})
// emit声明
interface CtrlEmit {
(name: "Ctrl", value: IActionParam): void;
}
const emit = defineEmits<CtrlEmit>();
// 安装功能模块,提供状态和能力方法
const { state } = new FormControl(CtrlConfig).moduleInstall(props);
</script>
<template>
<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="data"
:rules="rules">
{{#if ctrl.noTabHeader}}
{{#each ctrl.psDEFormPages as | ctrlPage | }}
{{#each ctrlPage.pSDEFormDetails as | formDetail | }}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each }}
{{/each}}
{{else}}
<a-tabs class="app-form-page">
{{#each ctrl.psDEFormPages as | ctrlPage | }}
{{>(lookup . 'ctrlPage.detailType') item=ctrlPage }}
{{/each}}
</a-tabs>
{{/if}}
</a-form>
</template>
<style lang="scss">
.ibiz-form {
margin: 20px;
}
</style>
\ No newline at end of file
{{!引用子模板注册器 include}}
{{>@macro/components/include-ctrls.hbs}}
<template>
<a-form
name="{{ctrl.codeName}}"
class="app-form{{#if ctrl.pSSysCss}} {{ctrl.pSSysCss.cssName}}{{/if}}{{#if ctrl.infoFormMode}} info-form-mode{{/if}}"
style="{{#if ctrl.formWidth}}width: {{ctrl.formWidth}}px;{{/if}}"
:model="data"
:rules="rules">
{{#if ctrl.noTabHeader}}
{{#each ctrl.psDEFormPages as | ctrlPage | }}
{{#each ctrlPage.pSDEFormDetails as | formDetail | }}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each }}
{{/each}}
{{else}}
<a-tabs class="app-form-page">
{{#each ctrl.psDEFormPages as | ctrlPage | }}
{{>(lookup . 'ctrlPage.detailType') formPage=ctrlPage }}
{{/each}}
</a-tabs>
{{/if}}
</a-form>
</template>
\ No newline at end of file
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
"@components/*":["src/components/*"], "@components/*":["src/components/*"],
"@views":["src/views"], "@views":["src/views"],
"@views/*":["src/views/*"], "@views/*":["src/views/*"],
"@page":["src/page"],
"@page/*":["src/page/*"],
"@widgets":["src/widgets"], "@widgets":["src/widgets"],
"@widgets/*":["src/widgets/*"], "@widgets/*":["src/widgets/*"],
"@static":["public"], "@static":["public"],
......
...@@ -15,6 +15,7 @@ export default defineConfig({ ...@@ -15,6 +15,7 @@ export default defineConfig({
'@service': path.resolve(__dirname, 'src/service'), '@service': path.resolve(__dirname, 'src/service'),
'@components': path.resolve(__dirname, 'src/components'), '@components': path.resolve(__dirname, 'src/components'),
'@views': path.resolve(__dirname, 'src/views'), '@views': path.resolve(__dirname, 'src/views'),
'@page': path.resolve(__dirname, 'src/page'),
'@widgets': path.resolve(__dirname, 'src/widgets'), '@widgets': path.resolve(__dirname, 'src/widgets'),
'@static': path.resolve(__dirname, 'public'), '@static': path.resolve(__dirname, 'public'),
'@': path.resolve(__dirname, 'src'), '@': path.resolve(__dirname, 'src'),
......
...@@ -45,7 +45,7 @@ module.exports = { ...@@ -45,7 +45,7 @@ module.exports = {
config.plugins.delete('prefetch-apiview') config.plugins.delete('prefetch-apiview')
config.resolve.alias config.resolve.alias
.set('@ibizsys', resolve('src/ibizsys')) .set('@ibizsys', resolve('src/ibizsys'))
.set('@pages', resolve('src/pages')) .set('@page', resolve('src/page'))
.set('@components', resolve('src/components')) .set('@components', resolve('src/components'))
.set('@widgets', resolve('src/widgets')) .set('@widgets', resolve('src/widgets'))
.set('@engine', resolve('src/engine')) .set('@engine', resolve('src/engine'))
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册