提交 25fc6088 编写于 作者: sq3536's avatar sq3536

Merge remote-tracking branch 'origin/master'

...@@ -8,6 +8,14 @@ ...@@ -8,6 +8,14 @@
detailStyle: '{{formDetail.detailStyle}}', detailStyle: '{{formDetail.detailStyle}}',
resetItemName: '{{formDetail.resetItemName}}', resetItemName: '{{formDetail.resetItemName}}',
valueItemName: '{{formDetail.valueItemName}}', valueItemName: '{{formDetail.valueItemName}}',
{{#each formDetail.psDEFDGroupLogics as | groupLogic |}}
groupOP: {{groupLogic.groupOP}},
relatedDetailNames: {{groupLogic.relatedDetailNames}},
logicCat: {{groupLogic.logicCat}},
logicType: {{groupLogic.logicType}},
notMode: {{groupLogic.notMode}},
Logics: []
{{/each}}
{{/if}} {{/if}}
}, },
{{#if formDetail.psDEFormDetails}} {{#if formDetail.psDEFormDetails}}
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</IbizFormGroup> </IbizFormGroup>
</div> </div>
{{else}} {{else}}
<a-col :span="24"> {{> @macro/front-end/view/common/layout.hbs item=item}}
<IbizFormGroup name="{{item.codeName}}" title="{{item.caption}}"> <IbizFormGroup name="{{item.codeName}}" title="{{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}}">
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</IbizFormItem> </IbizFormItem>
</div> </div>
{{else}} {{else}}
<a-col :span="24"> {{> @macro/front-end/view/common/layout.hbs item=item.psLayoutPos}}
<IbizFormItem 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 ctrlType="form"}} {{>(lookup . 'item.psEditor.editorType') item=item ctrlType="form"}}
......
controlsAction:{ controlsAction:{
{{#page.ctrls as | ctrl |}}
{{#neq controlType "TOOLBAR"}}
{{codeName}}:{
loadAction: '{{ctrl.getPSControlAction.psAppDEMethod.codeName}}', loadAction: '{{ctrl.getPSControlAction.psAppDEMethod.codeName}}',
removeAction: '{{ctrl.removePSControlAction.psAppDEMethod.codeName}}', removeAction: '{{ctrl.removePSControlAction.psAppDEMethod.codeName}}',
updateAction: '{{ctrl.updatePSControlAction.psAppDEMethod.codeName}}', updateAction: '{{ctrl.updatePSControlAction.psAppDEMethod.codeName}}',
loadDraftAction: '{{ctrl.getDraftPSControlAction.psAppDEMethod.codeName}}', loadDraftAction: '{{ctrl.getDraftPSControlAction.psAppDEMethod.codeName}}',
createAction: '{{ctrl.getDraftPSControlAction.psAppDEMethod.codeName}}', createAction: '{{ctrl.getDraftPSControlAction.psAppDEMethod.codeName}}',
} },
\ No newline at end of file {{/neq}}
{{/page.ctrls}}
}
\ No newline at end of file
<a-col
:span="{{#if item.colMD}}{{item.colMD}}{{else}}24{{/if}}"
{{!-- :offset="{{#if item.colMD}}{{item.colMD}}{{/if}}"
:lg="{{#if item.colLG}}{{item.colLG}}{{/if}}"
:md="{{#if item.colMD}}{{item.colMD}}{{/if}}"
:sm="{{#if item.colSM}}{{item.colSM}}{{/if}}"
:xs="{{#if item.xs}}{{item.xs}}{{/if}}" --}}
>
viewCodeName: '{{page.codeName}}', viewCodeName: '{{page.codeName}}',
viewName: '{{page.name}}', viewName: '{{page.name}}',
viewCaption: '{{page.caption}}', viewCaption: '{{page.caption}}',
height: '{{page.height}}', height: '{{page.height}}',
width: '{{page.width}}', width: '{{page.width}}',
viewMsgGroup: '{{page.psAppViewMsgGroup}}', viewMsgGroup: '{{page.psAppViewMsgGroup}}',
viewUIActions: '{{page.psAppViewUIActions}}', viewUIActions: '{{page.psAppViewUIActions}}',
viewSysCss: '{{page.psSysCss}}', viewSysCss: '{{page.psSysCss}}',
viewSysImage: '{{page.psSysImage}}', viewSysImage: '{{page.psSysImage}}',
subCaption: '{{page.subCaption}}', subCaption: '{{page.subCaption}}',
viewType: '{{page.viewType}}', viewType: '{{page.viewType}}',
viewStyle: '{{page.viewStyle}}', viewStyle: '{{page.viewStyle}}',
showCaptionBar: '{{page.viewStyle}}', showCaptionBar: '{{page.viewStyle}}',
viewToolbarModel: [ viewToolbarModel: [
{{#page.ctrls}} {{#page.ctrls}}
{{#eq controlType "TOOLBAR"}} {{#eq controlType "TOOLBAR"}}
{{#psDEToolbarItems}} {{#psDEToolbarItems}}
{ name:'{{name}}',caption:'{{caption}}',groupExtractMode:'{{groupExtractMode}}',itemType:'{{itemType}}',noPrivDisplayMode:'{{noPrivDisplayMode}}',showIcon:{{showIcon}},showCaption:{{showCaption}},tooltip:'{{tooltip}}' }, { 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}} },
{{/psDEToolbarItems}} {{/psDEToolbarItems}}
{{/eq}} {{/eq}}
{{/page.ctrls}} {{/page.ctrls}}
], ],
{{> @macro/front-end/view/common/controlAction.hbs}}
\ No newline at end of file
\ No newline at end of file
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
{{/if}} {{/if}}
{{#if item.psSysImage}} {{#if item.psSysImage}}
{{#if item.psSysImage.cssClass}} {{#if item.psSysImage.cssClass}}
iconCls: "{{item.psSysImage.cssClass}}", iconClass: "{{item.psSysImage.cssClass}}",
{{/if}} {{/if}}
{{#if item.psSysImage.imagePath}} {{#if item.psSysImage.imagePath}}
imgPath: "{{item.psSysImage.imagePath}}", imgPath: "{{item.psSysImage.imagePath}}",
......
...@@ -23,6 +23,6 @@ ...@@ -23,6 +23,6 @@
{{/if}} {{/if}}
"viewType": "{{appView.viewType}}", "viewType": "{{appView.viewType}}",
"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 (and @last ../@last)}},{{/unless}} }{{#unless @last}},{{/unless}}
{{/each}} {{/each}}
} }
...@@ -18,46 +18,50 @@ const showHeader = computed(()=> props.showHeader && (props.viewCaption || slot ...@@ -18,46 +18,50 @@ const showHeader = computed(()=> props.showHeader && (props.viewCaption || slot
<template> <template>
<div class="ibiz-view-layout ibiz-view-layout--default"> <div class="ibiz-view-layout ibiz-view-layout--default">
<div v-if="showHeader" class="ibiz-view-layout__header"> <div class="ibiz-view-layout__header">
<slot name="header-top" />
<div class="ibiz-view-layout__header-content"> <div class="ibiz-view-layout__header-content">
<slot name="header"> <slot name="header-left" />
<div class="ibiz-view-layout__header-left"> <slot name="header-content" />
<slot name="header-left"/> <slot name="header-right" />
</div>
<div class="ibiz-view-layout__header-right">
<slot name="header-right" />
</div>
</slot>
</div> </div>
<slot name="header-bottom" /> <slot name="header-bottom" />
</div> </div>
<div class="ibiz-view-layout__body"> <div class="ibiz-view-layout__body">
<slot name="body-top" />
<slot /> <slot />
<slot name="body-bottom" />
</div> </div>
<div class="ibiz-view-footer"> <div class="ibiz-view-footer">
<slot name="footer" /> <slot name="footer-left" />
<slot name="footer-content" />
<slot name="footer-right" />
</div> </div>
</div> </div>
</template> </template>
<style lang="scss"> <style lang="scss">
.ibiz-view-layout { .ibiz-view-layout {
display: flex;
flex-direction: column;
padding: 0 24px 24px; padding: 0 24px 24px;
.ibiz-view-layout__header { .ibiz-view-layout__header {
flex: none; flex: none;
display: flex;
flex-direction: column;
padding: 16px 0;
.ibiz-view-layout__header-content { .ibiz-view-layout__header-content {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 16px 0;
} }
} }
.ibiz-view-layout__body { .ibiz-view-layout__body {
flex: auto; flex: auto;
display: flex;
flex-direction: column;
} }
.ibiz-view-layout__footer { .ibiz-view-footer {
flex: none; flex: none;
display: flex;
justify-content: space-between;
} }
} }
......
<script setup lang="ts">
interface Props {
viewCaption?: string
showHeader?: boolean
}
const props = withDefaults(defineProps<Props>(), {
// 设定默认值,可选属性可以在这初始化
showHeader: true,
})
</script>
<template>
<IbizDefaultViewLayout>
<template v-slot:header-left>
<slot name="caption" />
</template>
<template v-slot:header-right>
<slot name="toolbar" />
</template>
<template v-slot:header-bottom>
<slot name="topMessage" />
<slot name="searchForm" />
</template>
<template v-slot:body-top>
<slot name="bodyMessage" />
</template>
<slot />
<template v-slot:footer-content>
<slot name="bottomMessage" />
</template>
</IbizDefaultViewLayout>
</template>
<style lang="scss">
</style>
\ No newline at end of file
<script setup lang="ts"> <script setup lang="ts">
// props声明和默认值处理
interface Props { interface Props {
text?: string text?: string
iconClass?: string, iconClass?: string,
...@@ -15,7 +13,6 @@ const props = withDefaults(defineProps<Props>(), { ...@@ -15,7 +13,6 @@ const props = withDefaults(defineProps<Props>(), {
const hasIcon = computed(() => props.iconClass || props.imgPath) const hasIcon = computed(() => props.iconClass || props.imgPath)
const extraClass = { const extraClass = {
"ibiz-icon-text--no-icon": !hasIcon.value, "ibiz-icon-text--no-icon": !hasIcon.value,
[`ibiz-icon-text--${props.position}`]: hasIcon.value, [`ibiz-icon-text--${props.position}`]: hasIcon.value,
......
<script setup lang="ts"> <script setup lang="ts">
import { IParam } from "@ibiz-core"; import { IParam } from "@ibiz-core";
import {
UserOutlined,
} from '@ant-design/icons-vue';
interface Props{ interface Props{
items: IParam[]; items: IParam[],
collapsed: boolean,
} }
const props = withDefaults(defineProps<Props>(), {}); const props = withDefaults(defineProps<Props>(), {
collapsed: false,
});
</script> </script>
<template> <template>
<template v-for="item in items" :key="item.name"> <template v-for="item in items" :key="item.name">
<template v-if="!item.items"> <template v-if="!item.items">
<a-menu-item v-if="!item.hidden" :key="item.name"> <a-menu-item v-if="!item.hidden" :key="item.name" class="ibiz-menu-item">
<template #icon> <template #icon>
<div class="menu-icon"> <IbizIconText :iconClass="item.iconClass" :imgPath="item.imgPath" :text="collapsed && item.caption[0]"/>
<UserOutlined />
</div>
</template> </template>
\{{item.caption}} \{{item.caption}}
</a-menu-item> </a-menu-item>
</template> </template>
<template v-else> <template v-else>
<a-sub-menu v-if="!item.hidden" :key="item.name"> <a-sub-menu v-if="!item.hidden" :key="item.name" class="ibiz-menu-item">
<template #icon> <template #icon>
<div class="menu-icon"> <IbizIconText :iconClass="item.iconClass" :imgPath="item.imgPath" :text="collapsed && item.caption[0]"/>
<UserOutlined />
</div>
</template> </template>
<template #title>\{{item.caption}}</template> <template #title>\{{item.caption}}</template>
<IbizMenuItem :items="item.items" /> <IbizMenuItem :items="item.items" />
...@@ -36,5 +32,26 @@ const props = withDefaults(defineProps<Props>(), {}); ...@@ -36,5 +32,26 @@ const props = withDefaults(defineProps<Props>(), {});
</template> </template>
<style lang="scss"> <style lang="scss">
.ibiz-icon-text {
display: flex !important;
align-items: center;
}
.ant-menu-submenu-popup {
.ibiz-menu-item {
display: flex !important;
}
.ant-menu-submenu-title {
display: flex !important;
width: 100%;
}
}
.ant-menu-inline-collapsed {
.ibiz-menu-item {
position: relative;
.ibiz-icon-text {
position: absolute;
right: calc(50% - 8px);
}
}
}
</style> </style>
\ No newline at end of file
...@@ -25,15 +25,6 @@ const props = withDefaults(defineProps<ToolbarProps>(), { ...@@ -25,15 +25,6 @@ const props = withDefaults(defineProps<ToolbarProps>(), {
}); });
const emit = defineEmits<toolbarEmit>(); const emit = defineEmits<toolbarEmit>();
const items: Ref<IParam[]> = ref(props.actionModel || []); const items: Ref<IParam[]> = ref(props.actionModel || []);
console.log(items);
const getItemClass = (item: IParam) => {
return item?.class;
};
const getItemIcon = (item: IParam) => {
if (item.getPSSysImage) {
return item.getPSSysImage.cssClass;
}
};
const itemClick = (item: IParam) => { const itemClick = (item: IParam) => {
emit("toolbarEvent", { emit("toolbarEvent", {
tag: props.name, tag: props.name,
...@@ -52,17 +43,19 @@ const itemClick = (item: IParam) => { ...@@ -52,17 +43,19 @@ const itemClick = (item: IParam) => {
> >
<!-- todo 无权限显示模式 --> <!-- todo 无权限显示模式 -->
<a-button <a-button
v-show="true" v-show="item.visible"
:class="['toolbar-item', getItemClass(item)]" :class="['toolbar-item', item.class]"
:disabled="item.disabled" :disabled="item.disabled"
type="primary" type="primary"
@click="itemClick(item)" @click="itemClick(item)"
> >
<!-- <a-icon v-show="item.showIcon" :type="getItemIcon(item)" /> --> <IbizIconText
\{{ item.showCaption ? item.caption : "" }} :text="item.showCaption && item.caption"
:iconClass="item.showIcon && item.iconClass"
:imgPath="item.showIcon && item.imgPath"/>
</a-button> </a-button>
</a-tooltip> </a-tooltip>
<a-dropdown v-else-if="Object.is(item.itemType, 'items')"> <a-dropdown v-else-if="Object.is(item.itemType, 'ITEMS')">
<a-menu slot="overlay" @click="itemClick"> <a-menu slot="overlay" @click="itemClick">
<a-tooltip <a-tooltip
v-for="(childItem, index) in item" v-for="(childItem, index) in item"
...@@ -71,35 +64,39 @@ const itemClick = (item: IParam) => { ...@@ -71,35 +64,39 @@ const itemClick = (item: IParam) => {
> >
<a-menu-item <a-menu-item
v-show="childItem.visible" v-show="childItem.visible"
:class="['toolbar-item', getItemClass(childItem)]" :class="['toolbar-item', item.class]"
:disabled="childItem.disabled" :disabled="childItem.disabled"
type="primary" type="primary"
@click="itemClick(childItem)" @click="itemClick(childItem)"
> >
<!-- <a-icon <IbizIconText
v-show="childItem.showIcon" :text="item.showCaption && item.caption"
:type="getItemIcon(childItem)" :iconClass="item.showIcon && item.iconClass"
/> --> :imgPath="item.showIcon && item.imgPath"/>
\{{ childItem.showCaption ? childItem.caption : "" }}
</a-menu-item> </a-menu-item>
</a-tooltip> </a-tooltip>
</a-menu> </a-menu>
</a-dropdown> </a-dropdown>
<template v-else-if="Object.is(item.itemType, 'SEPERATOR')">
<span class='separator'>|</span>
</template>
</template> </template>
</a-space> </a-space>
<a-space v-else class="toolbar-link"> <a-space v-else class="toolbar-link">
<template v-for="(item, index) in items" :key="index"> <template v-for="(item, index) in items" :key="index">
<div v-if="item.separator" class="separator"></div>
<a-button <a-button
v-show="item.visabled" v-show="item.visible"
:class="['toolbar-item', getItemClass(item)]" :class="['toolbar-item', item.class]"
:disabled="item.disabled" :disabled="item.disabled"
type="link" type="link"
@click="itemClick(item)" @click="itemClick(item)"
> >
<!-- <a-icon v-show="item.showIcon" :type="getItemIcon(item)" /> --> <IbizIconText
\{{ item.showCaption ? item.caption : "" }} :text="item.showCaption && item.caption"
:iconClass="item.showIcon && item.iconClass"
:imgPath="item.showIcon && item.imgPath"/>
</a-button> </a-button>
<div v-if="item.separator" class="separator"></div>
</template> </template>
</a-space> </a-space>
</div> </div>
...@@ -113,9 +110,12 @@ const itemClick = (item: IParam) => { ...@@ -113,9 +110,12 @@ const itemClick = (item: IParam) => {
flex-wrap: wrap; flex-wrap: wrap;
.ant-space-item { .ant-space-item {
position: relative; position: relative;
.ant-btn-link {
padding: 4px 10px;
}
.separator { .separator {
position: absolute; position: absolute;
right: 0; left: 0;
top: 15%; top: 15%;
height: 70%; height: 70%;
width: 1px; width: 1px;
...@@ -123,5 +123,10 @@ const itemClick = (item: IParam) => { ...@@ -123,5 +123,10 @@ const itemClick = (item: IParam) => {
} }
} }
} }
.toolbar-item {
.ibiz-icon-text__icon {
vertical-align: unset;
}
}
} }
</style> </style>
...@@ -74,6 +74,23 @@ export class ControlVOBase { ...@@ -74,6 +74,23 @@ export class ControlVOBase {
} }
} }
/**
* 克隆方法(创建一个新的ControlVO对象)
* 拥有ControlVO的功能,且与原对象的互不影响。
*
*/
public clone(){
}
/**
* 转换成普通js对象,拷贝所有的数据
*
*/
public toObject(){
return {};
}
/** /**
* 用后台数据重置数据对象 * 用后台数据重置数据对象
* @param data 后台数据 * @param data 后台数据
......
export class ControlServiceBase { import { ControlVOBase, EntityService } from "@ibiz-core";
export class ControlServiceBase<T extends ControlVOBase> {
/**
* 构造函数
* @param controlVOType
*/
constructor(private controlVOType: new (data: any)=> T,public entityService: EntityService){}
/**
* 新建部件界面数据对象
* @param $DO 后台数据对象
* @return {*}
*/
public newControlVO($DO: any){
return new this.controlVOType($DO);
}
/** /**
* 请求前处理函数 * 请求前处理函数
* *
......
import { ControlServiceBase, hasFunction } from '@ibiz-core'; import { ControlServiceBase, ControlVOBase, hasFunction } from '@ibiz-core';
import { createUUID } from 'qx-util';
import { {{pascalCase ctrl.psAppDataEntity.codeName}}Service } from '@service/entity/{{spinalCase ctrl.psAppDataEntity.codeName}}/{{spinalCase ctrl.psAppDataEntity.codeName}}-service';
import { ControlVO } from './{{spinalCase ctrl.codeName}}-form-config';
export class ControlService extends ControlServiceBase {
/**
* 实体服务对象
*/
public entityService: {{pascalCase ctrl.psAppDataEntity.codeName}}Service = new {{pascalCase ctrl.psAppDataEntity.codeName}}Service();
/**
* 表单部件服务
*
* @export
* @class EditFormService
* @template T 部件数据对象类型
*/
export class EditFormService<T extends ControlVOBase> extends ControlServiceBase<T> {
/** /**
* 加载草稿数据 * 加载草稿数据
* *
...@@ -19,14 +17,15 @@ export class ControlService extends ControlServiceBase { ...@@ -19,14 +17,15 @@ export class ControlService extends ControlServiceBase {
* @return {*} * @return {*}
*/ */
public async loadDraft(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> { public async loadDraft(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
const { context: Context, data: Data } = this.handleRequestData(context, data, opts); let _entityService: any = this.entityService;
// todo主键 const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const action = hasFunction(this.entityService, opts.action) ? opts.action : 'GetDraft'; // todo主键
const response = await this.entityService[action](Context, Data, opts.isLoading); const action = hasFunction(_entityService, opts.action) ? opts.action : 'GetDraft';
// this.setRemoteCopyData(response); const response = await _entityService[action](Context, Data, opts.isLoading);
response.data = new ControlVO(response.data); // this.setRemoteCopyData(response);
response.data.srfuf = "0"; response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts); response.data.srfuf = '0';
return this.handleResponse(response, opts);
} }
/** /**
...@@ -38,12 +37,13 @@ export class ControlService extends ControlServiceBase { ...@@ -38,12 +37,13 @@ export class ControlService extends ControlServiceBase {
* @return {*} * @return {*}
*/ */
public async get(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> { public async get(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
const { context: Context, data: Data } = this.handleRequestData(context, data, opts); let _entityService: any = this.entityService;
const action = hasFunction(this.entityService, opts.action) ? opts.action : 'GET'; const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const response = await this.entityService[action](Context, Data, opts.isLoading); const action = hasFunction(_entityService, opts.action) ? opts.action : 'GET';
// this.setRemoteCopyData(response); const response = await _entityService[action](Context, Data, opts.isLoading);
response.data = new ControlVO(response.data); // this.setRemoteCopyData(response);
return this.handleResponse(response, opts); response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
} }
/** /**
...@@ -55,11 +55,12 @@ export class ControlService extends ControlServiceBase { ...@@ -55,11 +55,12 @@ export class ControlService extends ControlServiceBase {
* @return {*} * @return {*}
*/ */
public async create(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> { public async create(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
const { context: Context, data: Data } = this.handleRequestData(context, data, opts); let _entityService: any = this.entityService;
const action = hasFunction(this.entityService, opts.action) ? opts.action : 'Create'; const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const response = await this.entityService[action](Context, Data, opts.isLoading); const action = hasFunction(_entityService, opts.action) ? opts.action : 'Create';
response.data = new ControlVO(response.data); const response = await _entityService[action](Context, Data, opts.isLoading);
return this.handleResponse(response, opts); response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
} }
/** /**
...@@ -71,11 +72,12 @@ export class ControlService extends ControlServiceBase { ...@@ -71,11 +72,12 @@ export class ControlService extends ControlServiceBase {
* @return {*} * @return {*}
*/ */
public async remove(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> { public async remove(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
const { context: Context, data: Data } = this.handleRequestData(context, data, opts); let _entityService: any = this.entityService;
const action = hasFunction(this.entityService, opts.action) ? opts.action : 'Remove'; const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const response = await this.entityService[action](Context, Data, opts.isLoading); const action = hasFunction(_entityService, opts.action) ? opts.action : 'Remove';
response.data = new ControlVO(response.data); const response = await _entityService[action](Context, Data, opts.isLoading);
return this.handleResponse(response, opts); response.data = this.newControlVO(response.data);
return this.handleResponse(response, opts);
} }
/** /**
...@@ -87,11 +89,11 @@ export class ControlService extends ControlServiceBase { ...@@ -87,11 +89,11 @@ export class ControlService extends ControlServiceBase {
* @return {*} * @return {*}
*/ */
public async update(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> { public async update(context: any, data: any, opts: { action: string; isLoading?: boolean }): Promise<any> {
const { context: Context, data: Data } = this.handleRequestData(context, data, opts); let _entityService: any = this.entityService;
const action = hasFunction(this.entityService, opts.action) ? opts.action : 'Update'; const { context: Context, data: Data } = this.handleRequestData(context, data, opts);
const response = await this.entityService[action](Context, Data, opts.isLoading); const action = hasFunction(_entityService, opts.action) ? opts.action : 'Update';
response.data = new ControlVO(response.data); const response = await _entityService[action](Context, Data, opts.isLoading);
return this.handleResponse(response, opts); response.data = this.newControlVO(response.data);
} return this.handleResponse(response, opts);
} }
}
export * from './control-service-base' export * from './control-service-base'
\ No newline at end of file export * from './edit-form-service'
\ No newline at end of file
export const ViewConfig = { export const ViewConfig = {
viewCodeName: '{{page.codeName}}', {{> @macro/front-end/view/common/viewBaseConfig.hbs}}
viewName: '{{page.name}}',
viewCaption: '{{page.caption}}',
}; };
\ No newline at end of file
...@@ -32,6 +32,9 @@ const emit = defineEmits<ViewEmit>(); ...@@ -32,6 +32,9 @@ const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法 // 安装功能模块,提供状态和能力方法
const { state } = new IndexView(ViewConfig).moduleInstall(props, emit); const { state } = new IndexView(ViewConfig).moduleInstall(props, emit);
const collapsed: Ref<boolean> = ref(false); const collapsed: Ref<boolean> = ref(false);
const collapsedChange = () => {
collapsed.value = !collapsed.value;
}
</script> </script>
<template> <template>
...@@ -42,9 +45,9 @@ const collapsed: Ref<boolean> = ref(false); ...@@ -42,9 +45,9 @@ const collapsed: Ref<boolean> = ref(false);
<MenuUnfoldOutlined <MenuUnfoldOutlined
v-if="collapsed" v-if="collapsed"
class="trigger" class="trigger"
@click="() => (collapsed = !collapsed)" @click="collapsedChange"
/> />
<MenuFoldOutlined v-else class="trigger" @click="() => (collapsed = !collapsed)" /> <MenuFoldOutlined v-else class="trigger" @click="collapsedChange" />
</div> </div>
</template> </template>
<template #user> <template #user>
......
export const ViewConfig = { export const ViewConfig = {
{{> @macro/front-end/view/common/viewBaseConfig.hbs}} {{> @macro/front-end/view/common/viewBaseConfig.hbs}}
{{#each page.ctrls as | ctrl |}}
{{#if (eq ctrl.controlType "FORM")}}
{{> @macro/front-end/view/common/controlAction.hbs ctrl=ctrl}}
{{/if}}
{{/each}}
}; };
\ No newline at end of file
...@@ -34,8 +34,8 @@ const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(pro ...@@ -34,8 +34,8 @@ const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(pro
</script> </script>
<template> <template>
<IbizDefaultViewLayout :class="['ibiz-edit-view', state.viewSysCss]"> <IbizEditViewLayout :class="['ibiz-edit-view', state.viewSysCss]">
<template v-slot:header-left> <template v-slot:caption>
<IbizIconText <IbizIconText
class="ibiz-view__caption" class="ibiz-view__caption"
size="large" size="large"
...@@ -46,7 +46,7 @@ const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(pro ...@@ -46,7 +46,7 @@ const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(pro
</template> </template>
{{#page.ctrls}} {{#page.ctrls}}
{{#eq controlType "TOOLBAR"}} {{#eq controlType "TOOLBAR"}}
<template v-slot:header-right> <template v-slot:toolbar>
<IbizToolbar <IbizToolbar
mode="button" mode="button"
name="{{lowerCase codeName}}" name="{{lowerCase codeName}}"
...@@ -64,7 +64,7 @@ const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(pro ...@@ -64,7 +64,7 @@ const { state, handleToolbarEvent } = new EditView(ViewConfig).moduleInstall(pro
></{{codeName}}Form> ></{{codeName}}Form>
{{/eq}} {{/eq}}
{{/page.ctrls}} {{/page.ctrls}}
</IbizDefaultViewLayout> </IbizEditViewLayout>
</template> </template>
<style lang="scss"> <style lang="scss">
......
...@@ -2,9 +2,4 @@ export const ViewConfig = { ...@@ -2,9 +2,4 @@ export const ViewConfig = {
gridRowActiveMode: {{page.gridRowActiveMode}}, gridRowActiveMode: {{page.gridRowActiveMode}},
rowEditState: {{#if page.enableRowEdit}}{{page.rowEditDefault}}{{else}}false{{/if}}, rowEditState: {{#if page.enableRowEdit}}{{page.rowEditDefault}}{{else}}false{{/if}},
{{> @macro/front-end/view/common/viewBaseConfig.hbs}} {{> @macro/front-end/view/common/viewBaseConfig.hbs}}
{{#each page.ctrls as | ctrl |}}
{{#if (eq ctrl.controlType "GRID")}}
{{> @macro/front-end/view/common/controlAction.hbs ctrl=ctrl}}
{{/if}}
{{/each}}
}; };
\ No newline at end of file
export const ViewConfig = { export const ViewConfig = {
viewCodeName: '{{page.codeName}}', {{> @macro/front-end/view/common/viewBaseConfig.hbs}}
viewName: '{{page.name}}',
viewCaption: '{{page.caption}}',
{{#page.ctrls}}
{{#eq controlType "GRID"}}
{{lowerCase codeName}}:{
name:'{{name}}',
codeName:'{{codeName}}',
action:{
'createAction': 'Create'
}
},
{{/eq}}
{{/page.ctrls}}
}; };
\ No newline at end of file
export const ViewConfig = { export const ViewConfig = {
viewCodeName: '{{page.codeName}}', {{> @macro/front-end/view/common/viewBaseConfig.hbs}}
viewName: '{{page.name}}',
viewCaption: '{{page.caption}}',
{{#page.ctrls}}
{{#eq controlType "PICKUPVIEWPANEL"}}
{{lowerCase codeName}}:{
name:'{{name}}',
codeName:'{{codeName}}',
action:{
'createAction': 'Create'
}
},
{{/eq}}
{{/page.ctrls}}
}; };
\ No newline at end of file
...@@ -32,7 +32,7 @@ const routes = [ ...@@ -32,7 +32,7 @@ const routes = [
viewType: "{{appView.viewType}}", viewType: "{{appView.viewType}}",
{{#if appView.psSysImage}} {{#if appView.psSysImage}}
imgPath: "{{appView.psSysImage.imagePath}}", imgPath: "{{appView.psSysImage.imagePath}}",
iconCls: "{{appView.psSysImage.cssClass}}", iconClass: "{{appView.psSysImage.cssClass}}",
{{/if}} {{/if}}
parameters: [ parameters: [
{ pathName: "apps", parameterName: "app" }, { pathName: "apps", parameterName: "app" },
......
...@@ -25,11 +25,12 @@ const { state, menuSelect } = new MenuControl(CtrlConfig).moduleInstall(props, e ...@@ -25,11 +25,12 @@ const { state, menuSelect } = new MenuControl(CtrlConfig).moduleInstall(props, e
<template> <template>
<a-menu <a-menu
class="ibiz-menu"
v-model:openKeys="state.defaultOpens" v-model:openKeys="state.defaultOpens"
v-model:selectedKeys="state.defaultSelect" v-model:selectedKeys="state.defaultSelect"
:mode="Object.is('LEFT', state.menuAlign) ? 'inline' : 'horizontal'" :mode="Object.is('LEFT', state.menuAlign) ? 'inline' : 'horizontal'"
@select="menuSelect"> @select="menuSelect">
<IbizMenuItem :items="state.menus" /> <IbizMenuItem :items="state.menus" :collapsed="collapsed"/>
</a-menu> </a-menu>
</template> </template>
......
{{>@macro/form-detail/include-form.hbs}} {{>@macro/form-detail/include-form.hbs}}
import { ControlVOBase, verifyRules } from '@ibiz-core'; import { ControlVOBase, verifyRules, EditFormService } from '@ibiz-core';
import { ControlService } from './{{spinalCase ctrl.codeName}}-form-service'; import { {{pascalCase ctrl.psAppDataEntity.codeName}}Service } from '@service/entity/{{spinalCase ctrl.psAppDataEntity.codeName}}/{{spinalCase ctrl.psAppDataEntity.codeName}}-service';
/**
* 部件展示数据对象
* @export
* @class ControlVO
*/
export class ControlVO extends ControlVOBase {
/**
* 用后台数据对象创建部件数据对象
* @param data 后台数据
*/
constructor(data: any){
super(data);
// 记录没有映射的属性
this.$ownKeys =
{{~#each ctrl.psDEFormItems as | formItem | ~}}
{{#if @first}}[{{/if~}}
'{{lowerCase formItem.id}}'{{#unless @last}},{{/unless}}
{{~#if @last}}];{{/if~}}
{{/each}}
}
// 表单里映射了属性的字段
{{#each ctrl.psDEFormItems as | formItem | }}
{{!-- TODO: 表单formItem的name拿不到 --}}
{{#neq formItem.psAppDEField null }}
get {{lowerCase formItem.id}}() {
return this.$DO.{{lowerCase formItem.psAppDEField.codeName}};
}
set {{lowerCase formItem.id}}(value: any) {
this.$DO.{{lowerCase formItem.psAppDEField.codeName}} = value;
}
{{/neq}}
{{/each}}
// 表单里没有映射实体属性的字段(srfuf除外)
{{#each ctrl.psDEFormItems as | formItem | }}
{{#if (and (eq formItem.psAppDEField null) (neq formItem.id "srfuf" )) }}
{{lowerCase formItem.id}}: any;
{{/if}}
{{/each}}
}
// 部件配置对象
export const CtrlConfig = { export const CtrlConfig = {
controlCodeName: '{{ctrl.codeName}}', controlCodeName: '{{ctrl.codeName}}',
controlName: '{{ctrl.name}}', controlName: '{{ctrl.name}}',
controlService: new ControlService(), controlService: new EditFormService<ControlVO>(ControlVO, new {{pascalCase ctrl.psAppDataEntity.codeName}}Service() ),
data: {}, data: new ControlVO({}),
itemsModel: [ itemsModel: [
{{#each ctrl.psDEFormPages as | FormPage | }} {{#each ctrl.psDEFormPages as | FormPage | }}
{{>(lookup 'FORMDETAILSMODEL') items=FormPage.psDEFormDetails}} {{>(lookup 'FORMDETAILSMODEL') items=FormPage.psDEFormDetails}}
...@@ -34,32 +79,4 @@ export const CtrlConfig = { ...@@ -34,32 +79,4 @@ export const CtrlConfig = {
{{/neq}} {{/neq}}
{{/each}} {{/each}}
}, },
}; };
\ No newline at end of file
/**
* 部件展示数据对象
* @export
* @class ControlVO
*/
export class ControlVO extends ControlVOBase {
// 表单里映射了属性的字段
{{#each ctrl.psDEFormItems as | formItem | }}
{{!-- TODO: 表单formItem的name拿不到 --}}
{{#neq formItem.psAppDEField null }}
get {{lowerCase formItem.id}}() {
return this.$DO.{{lowerCase formItem.psAppDEField.codeName}};
}
set {{lowerCase formItem.id}}(value: any) {
this.$DO.{{lowerCase formItem.psAppDEField.codeName}} = value;
}
{{/neq}}
{{/each}}
// 表单里没有映射实体属性的字段(srfuf除外)
{{#each ctrl.psDEFormItems as | formItem | }}
{{#if (and (eq formItem.psAppDEField null) (neq formItem.id "srfuf" )) }}
{{lowerCase formItem.id}}: any;
{{/if}}
{{/each}}
}
\ No newline at end of file
...@@ -48,7 +48,7 @@ export const CtrlConfig = { ...@@ -48,7 +48,7 @@ export const CtrlConfig = {
{{#if (eq column.columnType 'UAGRIDCOLUMN')}} {{#if (eq column.columnType 'UAGRIDCOLUMN')}}
{{#each column.psDEUIActionGroup.psUIActionGroupDetails as | action |}} {{#each column.psDEUIActionGroup.psUIActionGroupDetails as | action |}}
{{#action}} {{#action}}
{ name: "{{name}}", caption: "{{psUIAction.caption}}", showIcon: {{showIcon}}, showCaption: {{showCaption}}, separator: {{addSeparator}}, uIActionTag: "{{psUIAction.uIActionTag}}", noPrivDisplayMode: {{#if psUIAction.noPrivDisplayMode}}{{psUIAction.noPrivDisplayMode}}{{else}}6{{/if}}, disabled: false, visabled: true,{{#if psUIAction.psSysImage}}{{#if psUIAction.psSysImage.imagePath}} imgPath: "{{psUIAction.psSysImage.imagePath}}",{{/if}}{{#if psUIAction.psSysImage.cssClass}} iconCls: "{{psUIAction.psSysImage.cssClass}}",{{/if}}{{/if}} }, { name: "{{name}}", caption: "{{psUIAction.caption}}", showIcon: {{showIcon}}, showCaption: {{showCaption}}, separator: {{addSeparator}}, uIActionTag: "{{psUIAction.uIActionTag}}", noPrivDisplayMode: {{#if psUIAction.noPrivDisplayMode}}{{psUIAction.noPrivDisplayMode}}{{else}}6{{/if}}, 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}} },
{{/action}} {{/action}}
{{/each}} {{/each}}
{{/if}} {{/if}}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册