提交 33a208df 编写于 作者: xignzi006's avatar xignzi006

Merge remote-tracking branch 'origin/master'

package cn.ibizlab.codegen.model; package cn.ibizlab.codegen.model;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import net.ibizsys.model.app.view.IPSAppView; import net.ibizsys.model.app.view.IPSAppView;
import org.springframework.util.StringUtils; import net.ibizsys.model.control.toolbar.IPSDETBUIActionItem;
import net.ibizsys.model.control.toolbar.IPSDEToolbar;
import net.ibizsys.model.view.IPSUIAction;
import java.util.*; import java.util.*;
...@@ -42,6 +46,67 @@ public class PageModel extends BaseModel{ ...@@ -42,6 +46,67 @@ public class PageModel extends BaseModel{
} }
}); });
} }
// 初始化工具栏数据
if(appView.getPSControls() != null)
{
appView.getPSControls().forEach(item->{
if("TOOLBAR".equals(item.getControlType())){
JSONObject viewToolBar = new JSONObject();
viewToolBar.put("codeName",item.getCodeName());
viewToolBar.put("controlType",item.getControlType());
viewToolBar.put("logicName",item.getLogicName());
if(((IPSDEToolbar)item).getPSDEToolbarItems() != null){
JSONArray items = new JSONArray();
((IPSDEToolbar)item).getPSDEToolbarItems().forEach(singleItam ->{
JSONObject toolbarItem = new JSONObject();
toolbarItem.put("caption",singleItam.getCaption());
if(singleItam.getCapPSLanguageRes() != null && singleItam.getCapPSLanguageRes().getLanResTag() != null){
toolbarItem.put("capPSLanguageRes",singleItam.getCapPSLanguageRes().getLanResTag());
}
toolbarItem.put("tooltip",singleItam.getTooltip());
if(singleItam.getTooltipPSLanguageRes() != null && singleItam.getTooltipPSLanguageRes().getLanResTag() != null){
toolbarItem.put("tooltipPSLanguageRes",singleItam.getTooltipPSLanguageRes().getLanResTag());
}
toolbarItem.put("itemType",singleItam.getItemType());
toolbarItem.put("name",singleItam.getName());
toolbarItem.put("showCaption",singleItam.isShowCaption());
toolbarItem.put("showIcon",singleItam.isShowIcon());
if(singleItam.getPSSysImage() != null && singleItam.getPSSysImage().getCssClass() != null){
toolbarItem.put("iconClass",singleItam.getPSSysImage().getCssClass());
}
if(singleItam.getPSSysImage() != null && singleItam.getPSSysImage().getImagePath() != null){
toolbarItem.put("imgPath",singleItam.getPSSysImage().getImagePath());
}
if("DEUIACTION".equals(singleItam.getItemType())){
IPSDETBUIActionItem actionItem = (IPSDETBUIActionItem)singleItam;
toolbarItem.put("groupExtractMode",actionItem.getNoPrivDisplayMode());
toolbarItem.put("noPrivDisplayMode",actionItem.getNoPrivDisplayMode());
toolbarItem.put("id",actionItem.getPSAppViewUIAction().getId());
toolbarItem.put("xDataControlName",actionItem.getPSAppViewUIAction().getXDataControlName());
if(actionItem.getPSAppViewUIAction().getPSUIAction() != null){
IPSUIAction UIAction = actionItem.getPSAppViewUIAction().getPSUIAction();
JSONObject appUIAction = new JSONObject();
appUIAction.put("caption",UIAction.getCaption());
if(UIAction.getCapPSLanguageRes() != null && UIAction.getCapPSLanguageRes().getLanResTag() != null){
appUIAction.put("capPSLanguageRes",UIAction.getCapPSLanguageRes().getLanResTag());
}
appUIAction.put("codeName",UIAction.getCodeName());
appUIAction.put("fullCodeName",UIAction.getFullCodeName());
appUIAction.put("name",UIAction.getName());
appUIAction.put("uIActionMode",UIAction.getUIActionMode());
appUIAction.put("uIActionTag",UIAction.getUIActionTag());
appUIAction.put("uIActionType",UIAction.getUIActionType());
toolbarItem.put("uIAction",appUIAction);
}
}
items.add(toolbarItem);
});
viewToolBar.put("items",items);
}
toolBarItems.add(viewToolBar);
}
});
}
} }
...@@ -69,5 +134,10 @@ public class PageModel extends BaseModel{ ...@@ -69,5 +134,10 @@ public class PageModel extends BaseModel{
return ctrlsMap.values(); return ctrlsMap.values();
} }
private Collection<JSONObject> toolBarItems = new ArrayList<>();
public Collection<JSONObject> getViewToolBarItems(){
return toolBarItems;
}
} }
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
{{#if item.psEditor.placeHolder}} {{#if item.psEditor.placeHolder}}
placeholder="{{item.psEditor.placeHolder}}" placeholder="{{item.psEditor.placeHolder}}"
{{/if}} {{/if}}
:contextProp="state.context" :context="state.context"
:viewParamsProp="state.viewParams" :viewParams="state.viewParams"
{{#if item.psEditor.psNavigateContexts}} {{#if item.psEditor.psNavigateContexts}}
localContext="{{item.psEditor.psNavigateContexts}}" localContext="{{item.psEditor.psNavigateContexts}}"
{{/if}} {{/if}}
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
{{#if item.psEditor.psNavigateParams}} {{#if item.psEditor.psNavigateParams}}
localParam="{{item.psEditor.psNavigateParams}}" localParam="{{item.psEditor.psNavigateParams}}"
{{/if}} {{/if}}
:contextProp="state.context" :context="state.context"
:viewParamsProp="state.viewParams" :viewParams="state.viewParams"
{{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}} {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}" :value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent" @editorEvent="handleEditorEvent"
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
{{#if item.psEditor.psNavigateParams}} {{#if item.psEditor.psNavigateParams}}
localParam="{{item.psEditor.psNavigateParams}}" localParam="{{item.psEditor.psNavigateParams}}"
{{/if}} {{/if}}
:contextProp="state.context" :context="state.context"
:viewParamsProp="state.viewParams" :viewParams="state.viewParams"
{{#if item.psEditor.psAppDEACMode.minorSortDir}} {{#if item.psEditor.psAppDEACMode.minorSortDir}}
sort="{{item.psEditor.psAppDEACMode.minorSortDir}}" sort="{{item.psEditor.psAppDEACMode.minorSortDir}}"
{{/if}} {{/if}}
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
{{#if item.psEditor.psNavigateParams}} {{#if item.psEditor.psNavigateParams}}
localParam="{{item.psEditor.psNavigateParams}}" localParam="{{item.psEditor.psNavigateParams}}"
{{/if}} {{/if}}
:contextProp="state.context" :context="state.context"
:viewParamsProp="state.viewParams" :viewParams="state.viewParams"
{{#if item.psEditor.psAppDataEntity}} {{#if item.psEditor.psAppDataEntity}}
{{!-- {{#each item.psEditor.psAppDataEntity as | filed |}} --}} {{!-- {{#each item.psEditor.psAppDataEntity as | filed |}} --}}
{{!-- {{#if filed.majorField}} --}} {{!-- {{#if filed.majorField}} --}}
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
{{#eq item.psEditor.editorType "MDROPDOWNLIST"}} {{#eq item.psEditor.editorType "MDROPDOWNLIST"}}
:multiple="true" :multiple="true"
{{/eq}} {{/eq}}
:contextProp="state.context" :context="state.context"
:viewParamsProp="state.viewParams" :viewParams="state.viewParams"
{{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}} {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}" :value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent" @editorEvent="handleEditorEvent"
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
{{#if item.psEditor.psNavigateParams}} {{#if item.psEditor.psNavigateParams}}
localParam="{{item.psEditor.psNavigateParams}}" localParam="{{item.psEditor.psNavigateParams}}"
{{/if}} {{/if}}
:contextProp="state.context" :context="state.context"
:viewParamsProp="state.viewParams" :viewParams="state.viewParams"
{{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}} {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}" :value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent" @editorEvent="handleEditorEvent"
......
...@@ -5,13 +5,11 @@ ...@@ -5,13 +5,11 @@
:contentType="{{item.psEditor.editorParams.contentType}}" :contentType="{{item.psEditor.editorParams.contentType}}"
{{/if}} {{/if}}
{{#if item.psEditor.editorParams.icon}} {{#if item.psEditor.editorParams.icon}}
icon="{{item.psEditor.editorParams.icon}}" iconClass="{{item.psEditor.editorParams.icon}}"
{{/if}} {{/if}}
{{#if item.psEditor.editorParams.caption}} {{#if item.psEditor.editorParams.caption}}
caption="{{item.psEditor.editorParams.caption}}" caption="{{item.psEditor.editorParams.caption}}"
{{/if}} {{/if}}
:contextProp="state.context"
:viewParamsProp="state.viewParams"
{{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}} {{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}" :value="state.data.{{item.psEditor.name}}"
@editorEvent="handleEditorEvent" @editorEvent="handleEditorEvent"
......
...@@ -28,5 +28,5 @@ ...@@ -28,5 +28,5 @@
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
{{/eq}} {{/eq}}
:contextProp="state.context" :context="state.context"
:viewParamsProp="state.viewParams"/> :viewParams="state.viewParams"/>
{{#eq item.psLayoutPos 'FLEX'}}
<div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};">
<div class="ibiz-form-iframe" style="{{#if item.contentHeight}}height: {{item.contentHeight}}px;{{/if}}{{#if item.contentWidth}}width: {{item.contentWidth}}px{{/if}}">
<iframe src="{{item.iFrameUrl}}" style="height: 100%;width: 100%;border: 0"></iframe>
</div>
</div>
{{else}}
<a-col
{{> @macro/front-end/ctrl/common/layoutPos.hbs item=item.psLayoutPos}} >
<div class="ibiz-form-iframe" style="{{#if item.contentHeight}}height: {{item.contentHeight}}px;{{/if}}{{#if item.contentWidth}}width: {{item.contentWidth}}px{{/if}}">
<iframe src="{{item.iFrameUrl}}" style="height: 100%;width: 100%;border: 0"></iframe>
</div>
</a-col>
{{/eq}}
\ No newline at end of file
<a-tab-pane key="{{item.codeName}}" tab="{{item.caption}}"> <a-tab-pane key="{{item.codeName}}" tab="{{item.caption}}">
{{#eq item.psLayout.layout "FLEX"}} {{#eq item.psLayout.layout "FLEX"}}
<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}}"> <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}}">
...@@ -13,4 +12,4 @@ ...@@ -13,4 +12,4 @@
{{/each}} {{/each}}
</a-row> </a-row>
{{/eq}} {{/eq}}
</a-tab-pane> </a-tab-pane>
\ No newline at end of file
{{#eq item.psLayoutPos 'FLEX'}}
<div style="flex-grow: {{#if item.psLayoutPos.grow}}{{item.psLayoutPos.grow}}{{else}}0{{/if}};">
<IbizRaw
{{#if item.psSysCss}}class="{{item.psSysCss.cssName}}"{{/if}}
{{#if item.psSysImage}}{{#if item.psSysImage.cssClass}}iconClass="{{item.psSysImage.cssClass}}"{{/if}}{{#if item.psSysImage.imagePath}}imgPath="{{item.psSysImage.imagePath}}"{{/if}}{{/if}}
contentType="{{item.contentType}}"
style="{{#if item.rawItemHeight}}height: {{item.rawItemHeight}}px;{{/if}}{{#if item.rawItemWidth}}width: {{item.rawItemWidth}}px{{/if}}"
{{#if (eq item.contentType 'RAW')}}value="{{item.rawContent}}"{{else if (eq item.contentType 'HTML')}}:value="`{{item.htmlContent}}`"{{/if}}/>
</div>
{{else}}
<a-col
{{> @macro/front-end/ctrl/common/layoutPos.hbs item=item.psLayoutPos}} >
<IbizRaw
{{#if item.psSysCss}}class="{{item.psSysCss.cssName}}"{{/if}}
{{#if item.psSysImage}}{{#if item.psSysImage.cssClass}}iconClass="{{item.psSysImage.cssClass}}"{{/if}}{{#if item.psSysImage.imagePath}}imgPath="{{item.psSysImage.imagePath}}"{{/if}}{{/if}}
contentType="{{item.contentType}}"
style="{{#if item.rawItemHeight}}height: {{item.rawItemHeight}}px;{{/if}}{{#if item.rawItemWidth}}width: {{item.rawItemWidth}}px{{/if}}"
{{#if (eq item.contentType 'RAW')}}value="{{item.rawContent}}"{{else if (eq item.contentType 'HTML')}}:value="`{{item.htmlContent}}`"{{/if}}/>
</a-col>
{{/eq}}
<a-tab-pane key="{{item.codeName}}" tab="{{item.caption}}">
{{#eq item.psLayout.layout "FLEX"}}
<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 item.psDEFormDetails as | formDetail |}}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}}
</div>
{{else}}
<a-row>
{{#each item.psDEFormDetails as | formDetail |}}
{{>(lookup . 'formDetail.detailType') item=formDetail}}
{{/each}}
</a-row>
{{/eq}}
</a-tab-pane>
{{#*inline "FORMPAGE"}}{{>@macro/form-detail/form-page.hbs}}{{/inline}} {{#*inline "FORMPAGE"}}{{>@macro/form-detail/form-page.hbs}}{{/inline}}
{{#*inline "GROUPPANEL"}}{{>@macro/form-detail/form-group.hbs}}{{/inline}} {{#*inline "GROUPPANEL"}}{{>@macro/form-detail/form-group-panel.hbs}}{{/inline}}
{{#*inline "FORMITEM"}}{{>@macro/form-detail/form-item.hbs}}{{/inline}} {{#*inline "FORMITEM"}}{{>@macro/form-detail/form-item.hbs}}{{/inline}}
{{#*inline "TABPANEL"}}{{>@macro/form-detail/form-tabpanel.hbs}}{{/inline}} {{#*inline "TABPANEL"}}{{>@macro/form-detail/form-tabpanel.hbs}}{{/inline}}
{{#*inline "BUTTON"}}{{>@macro/form-detail/form-button.hbs}}{{/inline}} {{#*inline "BUTTON"}}{{>@macro/form-detail/form-button.hbs}}{{/inline}}
{{#*inline "RAWITEM"}}{{>@macro/form-detail/form-rawitem.hbs}}{{/inline}}
{{#*inline "IFRAME"}}{{>@macro/form-detail/form-iframe.hbs}}{{/inline}}
{{#*inline "FORMPART"}}{{>@macro/form-detail/form-formpart.hbs}}{{/inline}}
{{#*inline "TABPAGE"}}{{>@macro/form-detail/form-tabpage.hbs}}{{/inline}}
{{#*inline "DRUIPART"}}{{>@macro/form-detail/form-druipart.hbs}}{{/inline}}
{{#*inline "FORMDETAILSMODEL"}}{{>@macro/form-detail/form-details-model.hbs}}{{/inline}} {{#*inline "FORMDETAILSMODEL"}}{{>@macro/form-detail/form-details-model.hbs}}{{/inline}}
\ No newline at end of file
...@@ -11,13 +11,12 @@ ...@@ -11,13 +11,12 @@
viewType: '{{page.viewType}}', viewType: '{{page.viewType}}',
viewStyle: '{{page.viewStyle}}', viewStyle: '{{page.viewStyle}}',
showCaptionBar: '{{page.viewStyle}}', showCaptionBar: '{{page.viewStyle}}',
xDataControlName:'{{page.xDataControlName}}',
viewToolbarModel: [ viewToolbarModel: [
{{#page.ctrls}} {{#page.viewToolBarItems}}
{{#eq controlType "TOOLBAR"}} {{#items}}
{{#psDEToolbarItems}} { id:'{{id}}',name:'{{name}}',caption:'{{caption}}',groupExtractMode:'{{groupExtractMode}}',itemType:'{{itemType}}',noPrivDisplayMode:'{{noPrivDisplayMode}}',showIcon:{{showIcon}},showCaption:{{showCaption}},tooltip:'{{tooltip}}',disabled: false, visible: true, imgPath: '{{imgPath}}',iconClass: '{{iconClass}}',xDataControlName:'{{xDataControlName}}',{{#if uIAction}}uIAction:{codeName:'{{uIAction.codeName}}',fullCodeName:'{{uIAction.fullCodeName}}',uIActionMode:'{{uIAction.uIActionMode}}',uIActionTag:'{{uIAction.uIActionTag}}',uIActionType:'{{uIAction.uIActionType}}'}{{/if}} },
{ name:'{{name}}',caption:'{{caption}}',groupExtractMode:'{{groupExtractMode}}',itemType:'{{itemType}}',noPrivDisplayMode:'{{noPrivDisplayMode}}',showIcon:{{showIcon}},showCaption:{{showCaption}},tooltip:'{{tooltip}}',disabled: false, visible: true,{{#if psUIAction.psSysImage}}{{#if psUIAction.psSysImage.imagePath}} imgPath: "{{psUIAction.psSysImage.imagePath}}",{{/if}}{{#if psUIAction.psSysImage.cssClass}} iconClass: "{{psUIAction.psSysImage.cssClass}}",{{/if}}{{/if}} }, {{/items}}
{{/psDEToolbarItems}} {{/page.viewToolBarItems}}
{{/eq}}
{{/page.ctrls}}
], ],
{{> @macro/front-end/view/common/controlAction.hbs}} {{> @macro/front-end/view/common/controlAction.hbs}}
\ No newline at end of file
<script setup lang="ts"> <script setup lang="ts">
// This starter template is using Vue 3 <script setup> SFCs import { App } from './app';
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup onMounted(()=>{
import {App} from '@service' (window as any).App = App.getInstance();
onMounted(async ()=>{
await App.init();
// App.openViewService.openView({codeName: 'ExampleEditorEditView'},{context: {},viewParams:{}})
}) })
</script> </script>
<template> <template>
<router-view /> <router-view />
</template> </template>
......
export const AppFuncConfig = [
{{#each app.allPSAppFuncs as | func |}}
{
name: "{{func.name}}",
funcTag: "{{func.codeName}}",
appFuncType: "{{func.appFuncType}}",
{{#if (eq func.appFuncType 'OPENHTMLPAGE')}}
htmlPageUrl: "{{func.htmlPageUrl}}",
{{/if}}
{{#if (eq func.appFuncType 'APPVIEW')}}
openMode: "{{func.openMode}}",
viewName: "{{func.psAppView.name}}",
viewCodeName: "{{func.psAppView.codeName}}",
{{/if}}
navParam: {
{{#if func.psNavigateParams}}
{{#each func.psNavigateParams as | param |}}
{{lowerCase param.key}}: "{{#if param.rawValue}}{{param.value}}{{else}}%{{lowerCase param.value}}%{{/if}}",
{{/each}}
{{/if}}
},
navContext: {
{{#if func.psNavigateContexts}}
{{#each func.psNavigateContexts as | context |}}
{{lowerCase context.key}}: "{{#if context.rawValue}}{{context.value}}{{else}}%{{lowerCase context.value}}%{{/if}}",
{{/each}}
{{/if}}
},
},
{{/each}}
]
\ No newline at end of file
{ import { IParam } from "@core";
{{#each app.pages as |appView|}}
export const AppViewConfig:IParam = {
{{#each app.pages as |appView|}}
"{{appView.codeName}}":{ "{{appView.codeName}}":{
"name": "{{appView.name}}", "name": "{{appView.name}}",
"codeName": "{{appView.codeName}}", "codeName": "{{appView.codeName}}",
...@@ -25,4 +27,4 @@ ...@@ -25,4 +27,4 @@
"fileDir": "@page/{{#if psAppDataEntity}}{{spinalCase psAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}" "fileDir": "@page/{{#if psAppDataEntity}}{{spinalCase psAppDataEntity.codeName}}{{else}}default{{/if}}/{{spinalCase appView.codeName}}"
}{{#unless @last}},{{/unless}} }{{#unless @last}},{{/unless}}
{{/each}} {{/each}}
} }
\ No newline at end of file
import { OpenViewService } from "@/utils";
import { AppBase, IParam, ViewDetail, IApp, IOpenViewService, deepCopy } from "@core";
import { AppFuncConfig } from './app-func-config';
import { AppViewConfig } from './app-view-config';
export class App extends AppBase implements IApp {
/**
* 唯一实例
*
* @private
* @static
* @memberof App
*/
private static readonly instance = new App();
/**
* 获取唯一实例
*
* @static
* @return {*} {App}
* @memberof App
*/
public static getInstance(): App {
return App.instance;
}
/**
* 获取所有应用功能
*
* @return {*} {IParam[]}
* @memberof App
*/
public getAllFuncs(): IParam[] {
return AppFuncConfig;
}
/**
* 获取打开视图服务
*
* @return {*} {IOpenViewService}
* @memberof App
*/
public getOpenViewService(): IOpenViewService {
return OpenViewService.getInstance();
}
/**
* 获取视图信息
*
* @static
* @param codeName 视图codeName
* @return {*}
*/
public getViewInfo(codeName: string): ViewDetail | undefined {
return AppViewConfig[codeName] ? (deepCopy(AppViewConfig[codeName]) as ViewDetail) : undefined;;
}
}
\ No newline at end of file
<script setup lang="ts"> <script setup lang="ts">
import { onBeforeMount, Ref, ref } from "vue"; import { onBeforeMount, Ref, ref } from "vue";
import { SearchOutlined } from '@ant-design/icons-vue'; import { SearchOutlined } from '@ant-design/icons-vue';
import { deepCopy, IParam, IActionParam, EditorBase } from "@ibiz-core"; import { deepCopy, IParam, IActionParam, EditorBase, IContext } from "@core";
interface AutoCompleteProps { interface AutoCompleteProps {
/** /**
* @description 表单数据或表格行数据 * @description 表单数据或表格行数据
...@@ -25,12 +25,12 @@ interface AutoCompleteProps { ...@@ -25,12 +25,12 @@ interface AutoCompleteProps {
/** /**
* @description 上下文 * @description 上下文
*/ */
contextProp?: IParam; context?: IContext;
/** /**
* @description 视图参数 * @description 视图参数
*/ */
viewParamsProp?: IParam; viewParams?: IParam;
/** /**
* @description 局部上下文 * @description 局部上下文
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam } from "@ibiz-core"; import { IActionParam } from "@core";
import { computed, Ref } from "vue"; import { computed, Ref } from "vue";
interface CheckboxProps { interface CheckboxProps {
/** /**
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
import { import {
EditorBase, EditorBase,
IActionParam, IActionParam,
IParam IParam,
} from "@ibiz-core"; IContext
} from "@core";
import { computed, onBeforeMount, ref, Ref } from "vue"; import { computed, onBeforeMount, ref, Ref } from "vue";
interface CheckboxListProps { interface CheckboxListProps {
/** /**
...@@ -76,7 +77,7 @@ interface CheckboxListProps { ...@@ -76,7 +77,7 @@ interface CheckboxListProps {
* @type {*} * @type {*}
* @memberof AppCheckBox * @memberof AppCheckBox
*/ */
contextProp: IParam; context: IContext;
/** /**
* 视图参数 * 视图参数
...@@ -84,7 +85,7 @@ interface CheckboxListProps { ...@@ -84,7 +85,7 @@ interface CheckboxListProps {
* @type {*} * @type {*}
* @memberof AppCheckBox * @memberof AppCheckBox
*/ */
viewParamsProp: IParam; viewParams: IParam;
/** /**
* 局部上下文导航参数 * 局部上下文导航参数
......
<script setup lang="ts"> <script setup lang="ts">
import { onBeforeMount, Ref, ref } from 'vue'; import { onBeforeMount, Ref, ref } from 'vue';
import { SearchOutlined, ExportOutlined } from '@ant-design/icons-vue'; import { SearchOutlined, ExportOutlined } from '@ant-design/icons-vue';
import { deepCopy, IParam, IActionParam, EditorBase } from '@ibiz-core'; import { deepCopy, IParam, IActionParam, EditorBase, IContext } from '@core';
interface DataPickerProps { interface DataPickerProps {
/** /**
* @description 编辑器名称 * @description 编辑器名称
...@@ -31,27 +31,27 @@ interface DataPickerProps { ...@@ -31,27 +31,27 @@ interface DataPickerProps {
/** /**
* @description 表单数据或表格行数据 * @description 表单数据或表格行数据
*/ */
data?: any; data?: IParam;
/** /**
* @description 上下文 * @description 上下文
*/ */
contextProp?: any; context?: IContext;
/** /**
* @description 视图参数 * @description 视图参数
*/ */
viewParamsProp?: any; viewParams?: IParam;
/** /**
* @description 局部上下文 * @description 局部上下文
*/ */
localContext?: any; localContext?: IParam;
/** /**
* @description 局部视图参数 * @description 局部视图参数
*/ */
localParam?: any; localParam?: IParam;
/** /**
* @description 主信息属性 * @description 主信息属性
...@@ -66,17 +66,17 @@ interface DataPickerProps { ...@@ -66,17 +66,17 @@ interface DataPickerProps {
/** /**
* @description 选择视图 * @description 选择视图
*/ */
pickUpView?: any; pickUpView?: IParam;
/** /**
* @description 链接视图 * @description 链接视图
*/ */
linkView?: any; linkView?: IParam;
/** /**
* @description ac参数 * @description ac参数
*/ */
acParams?: any; acParams?: IParam;
/** /**
* @description 排序 * @description 排序
......
<script setup lang="ts"> <script setup lang="ts">
import { onBeforeMount, Ref, ref } from 'vue'; import { onBeforeMount, Ref, ref } from 'vue';
import { SearchOutlined, ExportOutlined } from '@ant-design/icons-vue'; import { SearchOutlined, ExportOutlined } from '@ant-design/icons-vue';
import { deepCopy, IParam, IActionParam, EditorBase } from '@ibiz-core'; import { deepCopy, IParam, IActionParam, EditorBase, IContext } from '@core';
interface DataPickerViewProps { interface DataPickerViewProps {
/** /**
* @description 编辑器名称 * @description 编辑器名称
...@@ -31,27 +31,27 @@ interface DataPickerViewProps { ...@@ -31,27 +31,27 @@ interface DataPickerViewProps {
/** /**
* @description 表单数据或表格行数据 * @description 表单数据或表格行数据
*/ */
data?: any; data?: IParam;
/** /**
* @description 上下文 * @description 上下文
*/ */
contextProp?: any; context?: IContext;
/** /**
* @description 视图参数 * @description 视图参数
*/ */
viewParamsProp?: any; viewParams?: IParam;
/** /**
* @description 局部上下文 * @description 局部上下文
*/ */
localContext?: any; localContext?: IParam;
/** /**
* @description 局部视图参数 * @description 局部视图参数
*/ */
localParam?: any; localParam?: IParam;
/** /**
* @description 主信息属性 * @description 主信息属性
...@@ -66,17 +66,17 @@ interface DataPickerViewProps { ...@@ -66,17 +66,17 @@ interface DataPickerViewProps {
/** /**
* @description 选择视图 * @description 选择视图
*/ */
pickUpView?: any; pickUpView?: IParam;
/** /**
* @description 链接视图 * @description 链接视图
*/ */
linkView?: any; linkView?: IParam;
/** /**
* @description ac参数 * @description ac参数
*/ */
acParams?: any; acParams?: IParam;
/** /**
* @description 排序 * @description 排序
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam } from '@ibiz-core'; import { IActionParam } from '@core';
// import dayjs from 'ant-design-vue/lib/time-picker/dayjs'; // import dayjs from 'ant-design-vue/lib/time-picker/dayjs';
import { computed, Ref } from 'vue'; import { computed, Ref } from 'vue';
import dayjs, { Dayjs } from 'dayjs'; import dayjs, { Dayjs } from 'dayjs';
......
<script setup lang="ts"> <script setup lang="ts">
import { onBeforeMount, Ref, ref } from "vue"; import { onBeforeMount, Ref, ref } from "vue";
import { IActionParam, IParam, typeOf, EditorBase } from "@ibiz-core"; import { IActionParam, IParam, typeOf, EditorBase, IContext } from "@core";
interface DropdownListProps { interface DropdownListProps {
/** /**
...@@ -31,12 +31,12 @@ interface DropdownListProps { ...@@ -31,12 +31,12 @@ interface DropdownListProps {
/** /**
* @description 上下文 * @description 上下文
*/ */
contextProp?: IParam; context?: IContext;
/** /**
* @description 视图参数 * @description 视图参数
*/ */
viewParamsProp?: IParam; viewParams?: IParam;
/** /**
* @description 局部上下文 * @description 局部上下文
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam } from "@ibiz-core"; import { IActionParam } from "@core";
interface InputProps{ interface InputProps{
/** /**
* @description 编辑器名称 * @description 编辑器名称
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam } from "@ibiz-core"; import { IActionParam } from "@core";
import { onBeforeMount, ref, Ref } from "vue"; import { onBeforeMount, ref, Ref } from "vue";
interface InputIpProps{ interface InputIpProps{
/** /**
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
import { import {
IActionParam, IActionParam,
IParam, IParam,
EditorBase EditorBase,
} from "@ibiz-core"; IContext
} from "@core";
import { onBeforeMount, ref, Ref } from "vue"; import { onBeforeMount, ref, Ref } from "vue";
interface RadioGroupProps { interface RadioGroupProps {
/** /**
...@@ -52,7 +53,7 @@ interface RadioGroupProps { ...@@ -52,7 +53,7 @@ interface RadioGroupProps {
* @type {*} * @type {*}
* @memberof AppCheckBox * @memberof AppCheckBox
*/ */
contextProp: IParam; context: IContext;
/** /**
* 视图参数 * 视图参数
...@@ -60,7 +61,7 @@ interface RadioGroupProps { ...@@ -60,7 +61,7 @@ interface RadioGroupProps {
* @type {*} * @type {*}
* @memberof AppCheckBox * @memberof AppCheckBox
*/ */
viewParamsProp: IParam; viewParams: IParam;
/** /**
* 局部上下文导航参数 * 局部上下文导航参数
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam, IParam } from "@ibiz-core"; import { IActionParam, IParam } from "@core";
interface RatingProps { interface RatingProps {
/** /**
* 传入值 * 传入值
......
<script setup lang="ts"> <script setup lang="ts">
import { EditorBase, IActionParam } from "@ibiz-core"; import { IActionParam } from "@core";
import { onBeforeMount, ref, Ref } from "vue";
interface RawProps { interface RawProps {
/** /**
* @description 编辑器名称 * @description 编辑器名称
...@@ -18,28 +17,17 @@ interface RawProps { ...@@ -18,28 +17,17 @@ interface RawProps {
contentType: "RAW" | "HTML" | "IMAGE" | "MARKDOWN"; contentType: "RAW" | "HTML" | "IMAGE" | "MARKDOWN";
/** /**
* @description 上下文 * @description 输入框类型
*/
contextProp?: any;
/**
* @description 视图参数
*/ */
viewParamsProp?: any; iconClass?: string;
/** /**
* 图标 * @description 输入框类型
*
* @type {string}
* @memberof AppRawItem
*/ */
icon?: string; imgPath?: string;
/** /**
* 标题 * @description 标题
*
* @type {string}
* @memberof AppRawItem
*/ */
caption?: string; caption?: string;
} }
...@@ -52,51 +40,22 @@ const props = withDefaults(defineProps<RawProps>(), { ...@@ -52,51 +40,22 @@ const props = withDefaults(defineProps<RawProps>(), {
contentType: "RAW", contentType: "RAW",
}); });
const emit = defineEmits<EditorEmit>(); const emit = defineEmits<EditorEmit>();
const { handleEditorNavParams } = new EditorBase();
const content: Ref<string> = ref("");
const { navContext, navViewParam } = handleEditorNavParams(props);
const initContent = () => {
const data = navContext;
if (props.value) {
const items = props.value.match(/\{{(.+?)\}}/g);
if (items) {
items.forEach((item: string) => {
content.value = props.value.replace(
/\{{(.+?)\}}/,
eval(item.substring(2, item.length - 2))
);
});
}
content.value = props.value.replaceAll("&lt;", "<");
content.value = props.value.replaceAll("&gt;", ">");
content.value = props.value.replaceAll("&amp;nbsp;", " ");
content.value = props.value.replaceAll("&nbsp;", " ");
}
return content;
};
onBeforeMount(() => {
initContent();
});
</script> </script>
<template> <template>
<div :class="['app-editor-container', `app-raw-${name}`]"> <div :class="['ibiz-raw-item', `ibiz-raw-item--${contentType.toLowerCase()}`]">
<div class="raw-caption" v-if="caption">\{{ caption }}</div> <div class="raw-caption" v-if="caption">\{{ caption }}</div>
<div v-if="Object.is(contentType, 'RAW')"> <div v-if="Object.is(contentType, 'RAW')">
\{{ content }} \{{ value }}
</div> </div>
<div v-else-if="Object.is(contentType, 'HTML')" v-html="content" /> <div v-else-if="Object.is(contentType, 'HTML')" v-html="value" />
<div v-else-if="Object.is(contentType, 'IMAGE')"> <div v-else-if="Object.is(contentType, 'IMAGE')">
<img v-if="value" :src="value" /> <IbizIconText :iconClass="iconClass" :imgPath="imgPath"/>
<a-icon v-else :type="icon || ''" />
</div> </div>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.app-editor-container {
text-align: left;
}
</style> </style>
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam } from "@ibiz-core"; import { IActionParam } from "@core";
interface sliderProps { interface sliderProps {
/** /**
* 传入值 * 传入值
......
<script setup lang="ts"> <script setup lang="ts">
import { IParam, EditorBase } from "@ibiz-core"; import { IParam, EditorBase, IContext } from "@core";
import { onBeforeMount, ref, Ref } from "vue"; import { onBeforeMount, ref, Ref } from "vue";
interface SpanProps { interface SpanProps {
/** /**
...@@ -71,12 +71,12 @@ interface SpanProps { ...@@ -71,12 +71,12 @@ interface SpanProps {
/** /**
* @description 上下文 * @description 上下文
*/ */
contextProp?: IParam; context?: IContext;
/** /**
* @description 视图参数 * @description 视图参数
*/ */
viewParamsProp?: IParam; viewParams?: IParam;
/** /**
* @description 局部上下文 * @description 局部上下文
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam } from "@ibiz-core"; import { IActionParam } from "@core";
interface StepperProps { interface StepperProps {
/** /**
* 传入值 * 传入值
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam } from "@ibiz-core"; import { IActionParam } from "@core";
import { computed, Ref } from "vue"; import { computed, Ref } from "vue";
interface SwitchProps { interface SwitchProps {
/** /**
......
<script setup lang="ts"> <script setup lang="ts">
import { EditorBase, IActionParam, IParam } from "@ibiz-core"; import { EditorBase, IActionParam, IParam } from "@core";
import { UploadOutlined, PlusOutlined } from '@ant-design/icons-vue'; import { UploadOutlined, PlusOutlined } from '@ant-design/icons-vue';
import { ref, Ref } from "vue"; import { ref, Ref } from "vue";
interface UploadProps { interface UploadProps {
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam } from "@ibiz-core"; import { IActionParam } from "@core";
interface FormGroupProps{ interface FormGroupProps{
name: string; name: string;
......
<script setup lang="ts"> <script setup lang="ts">
import { IActionParam } from "@ibiz-core"; import { IActionParam } from "@core";
interface FormGroupProps{ interface FormGroupProps{
name: string; name: string;
......
<script setup lang="ts"> <script setup lang="ts">
import { IParam } from "@ibiz-core"; import { IParam } from "@core";
interface Props{ interface Props{
width: number; width: number;
......
<script setup lang="ts"> <script setup lang="ts">
import { IParam } from "@ibiz-core"; import { IParam } from "@core";
interface Props{ interface Props{
items: IParam[], items: IParam[],
collapsed: boolean, collapsed: boolean,
......
<script setup lang="ts"> <script setup lang="ts">
import { IParam, IActionParam } from "@ibiz-core"; import { IParam, IActionParam } from "@core";
import { onBeforeMount, ref, Ref } from "vue"; import { onBeforeMount, ref, Ref } from "vue";
interface ToolbarProps { interface ToolbarProps {
......
export * from './interface'; export * from './interface';
export * from './logic';
export * from './modules'; export * from './modules';
export * from './runtime'; export * from './runtime';
export * from './service'; export * from './service';
export * from './utils'; export * from './utils';
export * from './helper'; \ No newline at end of file
\ No newline at end of file
import { IParam, ViewDetail } from "../common";
import { IAppFuncService, IOpenViewService } from "../logic";
/**
* 应用接口
*
* @export
* @interface IApp
*/
export interface IApp {
/**
* 获取应用所有功能
*
* @return {*} {IParam[]}
* @memberof IApp
*/
getAllFuncs(): IParam[];
/**
* 获取应用功能服务
*
* @return {*} {AppFuncService}
* @memberof IApp
*/
getAppFuncService(): IAppFuncService;
/**
* 获取打开视图服务
*
* @return {*} {IParam}
* @memberof IApp
*/
getOpenViewService(): IOpenViewService;
/**
* 获取指定视图信息
*
* @param {string} codeName
* @return {*} {(ViewDetail | undefined)}
* @memberof IApp
*/
getViewInfo(codeName: string): ViewDetail | undefined
}
\ No newline at end of file
...@@ -7,20 +7,20 @@ ...@@ -7,20 +7,20 @@
export interface ViewDetail { export interface ViewDetail {
/** /**
* 视图名称 * 代码名称
* *
* @type {string} * @type {string}
* @memberof ViewDetail * @memberof ViewDetail
*/ */
name: string; codeName: string;
/** /**
* 代码名称 * 视图名称
* *
* @type {string} * @type {string}
* @memberof ViewDetail * @memberof ViewDetail
*/ */
codeName: string; name?: string;
/** /**
* 视图宽度 * 视图宽度
...@@ -60,7 +60,7 @@ export interface ViewDetail { ...@@ -60,7 +60,7 @@ export interface ViewDetail {
* @type {boolean} * @type {boolean}
* @memberof ViewDetail * @memberof ViewDetail
*/ */
redirectView?: boolean; redirectView?: boolean;
/** /**
* 关系路径 * 关系路径
......
export * from './app';
export * from './common';
export * from './logic';
\ No newline at end of file
import { IContext, IParam } from "@core";
/**
* @description 应用功能服务
* @export
* @interface IAppFuncService
*/
export interface IAppFuncService {
/**
* @description 执行应用功能
* @param {IParam} menu 菜单项
* @param {IParam} context 上下文
* @param {IParam} viewParams 视图参数
* @return {*} {*}
* @memberof IAppFuncService
*/
executeAppFunc(menu: IParam, context: IContext, viewParams: IParam): any;
}
\ No newline at end of file
import { IParam, ViewDetail } from "@core";
/**
* @description 打开视图服务接口
* @export
* @interface IOpenViewService
*/
export interface IOpenViewService {
/**
* @description 打开视图
* @param {ViewDetail} view 视图对象参数
* @param {IParam} params 打开视图参数
* @return {*} {*}
* @memberof IOpenViewService
*/
openView(view: ViewDetail, params: IParam): any;
}
\ No newline at end of file
export * from './i-app-func-service';
export * from './i-open-view-service';
\ No newline at end of file
import { IParam, FuncConfig, IContext } from "@ibiz-core"; import { IAppFuncService, IParam } from "@core";
import { App } from "@service";
export class AppFuncService { export class AppFuncService implements IAppFuncService{
/** /**
* @description 唯一实例 * @description 唯一实例
...@@ -28,8 +27,8 @@ export class AppFuncService { ...@@ -28,8 +27,8 @@ export class AppFuncService {
* @param {IParam} viewParams 视图参数 * @param {IParam} viewParams 视图参数
* @memberof AppFuncService * @memberof AppFuncService
*/ */
executeAppFunc(menu: IParam, context: IContext, viewParams: IParam) { executeAppFunc(menu: IParam, context: IParam, viewParams: IParam) {
const appFunc = FuncConfig.find((func: IParam)=> Object.is(func.funcTag, menu.funcTag)); const appFunc = App.getAllFuncs().find((func: IParam)=> Object.is(func.funcTag, menu.funcTag));
if (appFunc) { if (appFunc) {
switch (appFunc.appFuncType) { switch (appFunc.appFuncType) {
case 'APPVIEW': case 'APPVIEW':
...@@ -57,7 +56,7 @@ export class AppFuncService { ...@@ -57,7 +56,7 @@ export class AppFuncService {
* @param {IParam} viewParams 视图参数 * @param {IParam} viewParams 视图参数
* @memberof AppFuncService * @memberof AppFuncService
*/ */
private executeCustomFunc(appFunc: IParam, context: IContext, viewParams: IParam) { executeCustomFunc(appFunc: IParam, context: IParam, viewParams: IParam) {
console.warn(`${appFunc.appFuncType} 类型应用功能暂未支持`); console.warn(`${appFunc.appFuncType} 类型应用功能暂未支持`);
} }
...@@ -68,7 +67,7 @@ export class AppFuncService { ...@@ -68,7 +67,7 @@ export class AppFuncService {
* @param {IParam} viewParams 视图参数 * @param {IParam} viewParams 视图参数
* @memberof AppFuncService * @memberof AppFuncService
*/ */
private executeJavaScript(appFunc: IParam, context: IContext, viewParams: IParam) { executeJavaScript(appFunc: IParam, context: IParam, viewParams: IParam) {
console.warn(`${appFunc.appFuncType} 类型应用功能暂未支持`); console.warn(`${appFunc.appFuncType} 类型应用功能暂未支持`);
} }
...@@ -80,7 +79,7 @@ export class AppFuncService { ...@@ -80,7 +79,7 @@ export class AppFuncService {
* @param {IParam} viewParams 视图参数 * @param {IParam} viewParams 视图参数
* @memberof AppFuncService * @memberof AppFuncService
*/ */
private executePresetFunc(appFunc: IParam, context: IContext, viewParams: IParam) { executePresetFunc(appFunc: IParam, context: IParam, viewParams: IParam) {
console.warn(`${appFunc.appFuncType} 类型应用功能暂未支持`); console.warn(`${appFunc.appFuncType} 类型应用功能暂未支持`);
} }
...@@ -91,7 +90,7 @@ export class AppFuncService { ...@@ -91,7 +90,7 @@ export class AppFuncService {
* @param {IParam} viewParams 视图参数 * @param {IParam} viewParams 视图参数
* @memberof AppFuncService * @memberof AppFuncService
*/ */
private openHtmlPage(appFunc: IParam, context: IContext, viewParams: IParam) { openHtmlPage(appFunc: IParam, context: IParam, viewParams: IParam) {
window.open(appFunc.htmlPageUrl, '_blank'); window.open(appFunc.htmlPageUrl, '_blank');
} }
...@@ -102,9 +101,8 @@ export class AppFuncService { ...@@ -102,9 +101,8 @@ export class AppFuncService {
* @param {IParam} viewParams 视图参数 * @param {IParam} viewParams 视图参数
* @memberof AppFuncService * @memberof AppFuncService
*/ */
private openAppView(appFunc: IParam, context: IContext, viewParams: IParam) { openAppView(appFunc: IParam, context: IParam, viewParams: IParam) {
const view = { const view = {
name: appFunc.viewName,
codeName: appFunc.viewCodeName, codeName: appFunc.viewCodeName,
openMode: appFunc.openMode, openMode: appFunc.openMode,
} }
...@@ -112,6 +110,6 @@ export class AppFuncService { ...@@ -112,6 +110,6 @@ export class AppFuncService {
context: context, context: context,
viewParams: viewParams, viewParams: viewParams,
} }
App.openViewService.openView(view, params); App.getOpenViewService().openView(view, params);
} }
} }
\ No newline at end of file
import { IContext, IParam } from "@core";
/**
* 后台界面行为
*
* @export
* @class AppBackendAction
*/
export class AppBackendAction {
/**
* 执行后台界面行为
*
* @static
* @param {IParam} uiAction 界面行为对象
* @param {context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment:IParam} params { context: 上下文对象, viewParams: 视图参数, data: 当前激活数据, event: 事件源对象, actionEnvironment:操作环境}
* @memberof AppBackendAction
*/
public static async execute(uiAction: IParam, params: { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment:IParam}) {
// TODO 执行后台界面行为
console.log(uiAction,params);
}
}
import { IContext, IParam } from "@core";
/**
* 前台界面行为
*
* @export
* @class AppFrontAction
*/
export class AppFrontAction {
/**
* 执行前台界面行为
*
* @static
* @param {IParam} uiAction 界面行为对象
* @param { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment:IParam} params { context: 上下文对象, viewParams: 视图参数, data: 当前激活数据, event: 事件源对象, actionEnvironment:操作环境}
* @memberof AppBackendAction
*/
public static async execute(uiAction: IParam, params: { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment: IParam }) {
// TODO 前台界面行为
console.log(uiAction,params);
}
}
import { IContext, IParam } from "@core";
/**
* 系统预置界面行为
*
* @export
* @class AppSysAction
*/
export class AppSysAction {
/**
* 执行预置界面行为
*
* @static
* @param {IParam} uiAction 界面行为对象
* @param { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment:IParam} params { context: 上下文对象, viewParams: 视图参数, data: 当前激活数据, event: 事件源对象, actionEnvironment:操作环境}
* @memberof AppBackendAction
*/
public static async execute(uiAction: IParam, params: { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment: IParam }) {
// TODO 预置界面行为
console.log(uiAction,params);
}
}
import { IContext, IParam } from '@core';
import { AppBackendAction } from './app-backend-action'; import { AppBackendAction } from './app-backend-action';
import { AppFrontAction } from './app-front-action'; import { AppFrontAction } from './app-front-action';
import { IUIAction } from "@ibiz-core";
import { AppSysAction } from './app-sys-action'; import { AppSysAction } from './app-sys-action';
/** /**
...@@ -14,9 +14,9 @@ export class AppUIAction { ...@@ -14,9 +14,9 @@ export class AppUIAction {
* 执行界面行为 * 执行界面行为
* *
* @param uiAction 界面行为信息 * @param uiAction 界面行为信息
* @param params 运行参数 * @param params 运行参数 { context: 上下文对象, viewParams: 视图参数, data: 当前激活数据, event: 事件源对象, actionEnvironment:操作环境}
*/ */
public static executeUIAction(uiAction: IUIAction, params: any){ public static execute(uiAction: IParam, params: { context: IContext, viewParams: IParam, data: IParam, event: MouseEvent, actionEnvironment: IParam }){
if(uiAction.uIActionMode == 'FRONT'){ if(uiAction.uIActionMode == 'FRONT'){
AppFrontAction.execute(uiAction, params); AppFrontAction.execute(uiAction, params);
}else if(uiAction.uIActionMode == 'BACKEND'){ }else if(uiAction.uIActionMode == 'BACKEND'){
...@@ -24,7 +24,7 @@ export class AppUIAction { ...@@ -24,7 +24,7 @@ export class AppUIAction {
}else if(uiAction.uIActionMode == 'SYS'){ }else if(uiAction.uIActionMode == 'SYS'){
AppSysAction.execute(uiAction, params); AppSysAction.execute(uiAction, params);
}else{ }else{
// TODO 工作流界面行为 console.warn("非(前台界面行为、后台界面行为、系统预置界面行为)暂未支持");
} }
} }
} }
export * from './app-logic';
export * from './app-ui-action';
\ No newline at end of file
import { AppFuncService, IApp, IAppFuncService, IOpenViewService, ViewDetail } from "@core";
import { IParam } from "@core/interface";
/**
* 应用基类
*
* @export
* @class AppBase
*/
export abstract class AppBase implements IApp {
/**
* 应用功能服务
*
* @private
* @type {AppFuncService}
* @memberof AppBase
*/
private appFuncService: AppFuncService = AppFuncService.getInstance();
/**
* 获取应用功能服务
*
* @return {IAppFuncService}
* @memberof AppBase
*/
public getAppFuncService(): IAppFuncService {
return this.appFuncService;
}
/**
* 获取打开视图服务
*
* @return {*} {IOpenViewService}
* @memberof AppBase
*/
public getOpenViewService(): IOpenViewService {
throw new Error("Method not implemented.");
}
/**
* 获取所有应用功能
*
* @return {*} {IParam[]}
* @memberof AppBase
*/
public getAllFuncs(): IParam[] {
return [];
}
/**
* 获取视图信息
*
* @param codeName 视图codeName
*/
public getViewInfo(codeName: string): ViewDetail | undefined {
return undefined;
}
}
\ No newline at end of file
import { Ref } from 'vue';
import { IContext, IParam } from '@core';
import { deepCopy } from '../../utils';
/**
* @description 界面基类
* @export
* @class UIBase
*/
export class UIBase {
/**
* 为源响应式对象上的某个属性新创建一个单向的Ref,类似于vue的toRef但区别在于,修改返回的Ref,不会影响源响应对象的该属性。而源响应对象上的属性值变化会响应式影响到返回的Ref
*
* @param object 源响应对象,可以是ref对象,也可以是reactive对象
* @param key 响应对象上的属性的key值
*
* ```ts
* const object = ref({foo: 1});
* // 或者 const object = reactive({foo: 1})
* const foo = toOneWayRef(object, 'foo');
* foo.value = 2;
* console.log(object.foo) // 1
* console.log(foo.value) // 2
* object.foo = 3
* console.log(object.foo) // 3
* console.log(foo.value) // 3
* ```
* ps:如果要维持props的父对于props修改的响应性,props必须是Ref
* ```ts
* const father = reactive({ props: { foo: 1 }})
* const props = toRef(father,'props');
* const foo = toOneWayRef(props, 'foo');
* const foo1 = toOneWayRef(props.value,'foo')
* father.props = {foo: 3}
* console.log(father.props.foo) // 3
* console.log(foo.value) // 3
* console.log(foo1.value) // 1
* ```
*
*/
public static toOneWayRef<T extends object, K extends keyof T>(object: Ref<T> | T, key: K): Ref<T[K]> {
// 创建空的Ref
const propertyRef: Ref<T[K]> = ref({}) as any;
// 用watch来监听源响应对象的key属性,并建立单向响应
watch(
() => isRef(object) ? (object.value as T)[key] : object[key],
(newVal: any, oldVal: any) => {
// 用immediate来初始化最初的值,用deepCopy来切断与源值的关联
propertyRef.value = deepCopy(newVal) as T[K];
},
{
immediate: true,
deep: true,
},
);
return propertyRef;
}
/**
* @description 使用上下文参数逻辑块
* @export
* @param {Record<any, any>} props
*/
public static useContextParams(props: Record<any, any>) {
const { contextProp, viewParamsProp } = toRefs(props);
// 维护上下文并监控其变化
const context: Ref<IContext> = ref({});
watch(
contextProp,
(newVal: any, oldVal: any) => {
context.value = deepCopy(newVal || {});
},
{
immediate: true,
deep: true,
}
);
// 维护视图参数并监控其变化
const viewParams: Ref<IParam> = ref({});
watch(
viewParamsProp,
(newVal: any, oldVal: any) => {
viewParams.value = deepCopy(newVal || {});
},
{
immediate: true,
deep: true,
}
);
return { context, viewParams };
}
}
\ No newline at end of file
import { computedNavData, ControlPropsBase, ControlStateBase, IParam, toOneWayRef, useContextParams } from '@ibiz-core'; import { toRefs } from 'vue';
import { RouteLocationNormalizedLoaded, Router, useRoute, useRouter } from 'vue-router'; import { UIUtil, IParam, UIBase } from '@core';
/** /**
* @description 部件基类 * @description 部件基类
* @export * @export
...@@ -16,17 +15,17 @@ export class EditorBase { ...@@ -16,17 +15,17 @@ export class EditorBase {
*/ */
public handleEditorNavParams(props: Record<string, any>) { public handleEditorNavParams(props: Record<string, any>) {
const { localContext, localParam, data } = toRefs(props); const { localContext, localParam, data } = toRefs(props);
const { context, viewParams } = useContextParams(props); const { context, viewParams } = UIBase.useContextParams(props);
const navParams = { const navParams = {
navContext: context.value, navContext: context.value,
navViewParam: viewParams.value, navViewParam: viewParams.value,
} }
if (localContext && Object.keys(localContext).length > 0) { if (localContext && Object.keys(localContext).length > 0) {
const _context = computedNavData(data, navParams.navContext, navParams.navViewParam, localContext); const _context = UIUtil.computedNavData(data, navParams.navContext, navParams.navViewParam, localContext);
Object.assign(navParams.navContext, _context); Object.assign(navParams.navContext, _context);
} }
if (localParam && Object.keys(localParam).length > 0) { if (localParam && Object.keys(localParam).length > 0) {
const _param = computedNavData(data, navParams.navContext, navParams.navViewParam, localParam); const _param = UIUtil.computedNavData(data, navParams.navContext, navParams.navViewParam, localParam);
Object.assign(navParams.navViewParam, _param); Object.assign(navParams.navViewParam, _param);
} }
return navParams; return navParams;
......
export * from './common' export * from './common'
export * from './app'
export * from './views' export * from './views'
export * from './widgets' export * from './widgets'
export * from './editor' export * from './editor'
export * from './app-logic'
\ No newline at end of file
import { EditViewProps, EditViewState, MainView } from '@ibiz-core'; import { EditViewProps, EditViewState, MainView } from '@core';
/** /**
* @description 编辑视图 * @description 编辑视图
......
import { GridViewProps, GridViewState, MainView } from '@ibiz-core'; import { GridViewProps, GridViewState, MainView } from '@core';
/** /**
* @description 表格视图 * @description 表格视图
......
import { IndexViewProps, IndexViewState, ViewBase } from '@ibiz-core'; import { IndexViewProps, IndexViewState, ViewBase } from '@core';
/** /**
* @description 首页视图 * @description 首页视图
......
import { ControlAction, ViewStateBase } from '@ibiz-core'; import { ControlAction, ViewStateBase } from '@core';
/** /**
* @description 实体部件状态 * @description 实体部件状态
......
import { ViewBase, MainViewProps, MainViewState, IActionParam } from '@ibiz-core'; import { ViewBase, MainViewProps, MainViewState, IActionParam, IParam, AppUIAction } from '@core';
/** /**
* 实体部件 * 实体部件
...@@ -7,17 +7,25 @@ import { ViewBase, MainViewProps, MainViewState, IActionParam } from '@ibiz-core ...@@ -7,17 +7,25 @@ import { ViewBase, MainViewProps, MainViewState, IActionParam } from '@ibiz-core
*/ */
export class MainView extends ViewBase { export class MainView extends ViewBase {
/** /**
* 部件状态 * 视图状态数据
*/ */
public declare viewState: MainViewState; public declare viewState: MainViewState;
/**
* 当前视图具有数据能力部件
*
* @type {IParam}
* @memberof MainView
*/
public declare xDataControl: IParam;
/** /**
* 根据props调整设置部件state * 根据props调整设置部件state
* @param props 传入的Props * @param props 传入的Props
*/ */
public setState(props: MainViewProps) { public setState(props: MainViewProps) {
super.setState(props); super.setState(props);
// 只读属性处理:把props的属性的Ref赋给state,以维持响应性。 this.xDataControl = ref(null);
} }
/** /**
...@@ -25,23 +33,41 @@ export class MainView extends ViewBase { ...@@ -25,23 +33,41 @@ export class MainView extends ViewBase {
* @todo * @todo
* @param props * @param props
*/ */
public useOpenData(props: MainViewProps) {} public useOpenData(props: MainViewProps) { }
/** /**
* 打开新建视图功能模块 * 打开新建视图功能模块
* @todo * @todo
* @param props * @param props
*/ */
public useNewData(props: MainViewProps) {} public useNewData(props: MainViewProps) { }
/** /**
* @description 处理工具栏事件 * @description 处理工具栏事件
* @param {IActionParam} actionParam * @param {IActionParam} actionParam
* @memberof MainView * @memberof MainView
*/ */
public handleToolbarEvent(actionParam: IActionParam) { public handleToolbarEvent(actionParam: IActionParam) {
const { tag, action, data } = actionParam; const { tag, action, data } = actionParam;
//todo if (!tag || !action || !data) {
console.warn("工具栏执行参数不足");
return;
}
const { xDataControlName, uIAction } = data;
if (!xDataControlName || !uIAction) {
console.warn("工具栏执行参数不足");
return;
}
// 准备参数
const inputParam = {
context: this.viewState.context,
viewParams: this.viewState.viewParams,
data: this.xDataControl?.value?.data,
event: data.event,
actionEnvironment: this
};
// 执行行为
AppUIAction.execute(uIAction, inputParam);
} }
public handleCtrlEvent(actionParam: IActionParam) { public handleCtrlEvent(actionParam: IActionParam) {
...@@ -64,6 +90,7 @@ export class MainView extends ViewBase { ...@@ -64,6 +90,7 @@ export class MainView extends ViewBase {
return { return {
...superParams, ...superParams,
state: this.viewState, state: this.viewState,
xDataControl: this.xDataControl,
handleToolbarEvent: this.handleToolbarEvent.bind(this), handleToolbarEvent: this.handleToolbarEvent.bind(this),
handleCtrlEvent: this.handleCtrlEvent.bind(this), handleCtrlEvent: this.handleCtrlEvent.bind(this),
}; };
......
import { ControlAction, MainViewState } from '@ibiz-core'; import { ControlAction, MainViewState } from '@core';
/** /**
* @description 选择视图状态 * @description 选择视图状态
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册