提交 f774df1d 编写于 作者: Mosher's avatar Mosher

update:更新工具栏计数器支持

上级 4f787a99
......@@ -6,6 +6,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import net.ibizsys.model.app.view.IPSAppUIAction;
import net.ibizsys.model.app.view.IPSAppView;
import net.ibizsys.model.control.IPSControl;
import net.ibizsys.model.control.expbar.IPSExpBar;
......@@ -104,6 +105,11 @@ public class PageModel extends BaseModel{
appUIAction.put("uIActionType",UIAction.getUIActionType());
appUIAction.put("actionTarget",UIAction.getActionTarget());
appUIAction.put("dataAccessAction",UIAction.getDataAccessAction());
if (UIAction instanceof IPSAppUIAction) {
if (((IPSAppUIAction)UIAction).getCounterId() != null) {
appUIAction.put("counterId", ((IPSAppUIAction)UIAction).getCounterId());
}
}
toolbarItem.put("uIAction",appUIAction);
}
}
......
......@@ -79,7 +79,7 @@
{{#page.viewToolBarItems}}
toolbar: [
{{#items}}
{ 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}}',actionTarget:'{{uIAction.actionTarget}}',uIActionTag:'{{uIAction.uIActionTag}}',dataAccessAction:'{{uIAction.dataAccessAction}}',uIActionType:'{{uIAction.uIActionType}}'}{{/if}} },
{ 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}}',actionTarget:'{{uIAction.actionTarget}}',uIActionTag:'{{uIAction.uIActionTag}}',dataAccessAction:'{{uIAction.dataAccessAction}}',uIActionType:'{{uIAction.uIActionType}}'}{{#if uIAction.counterId}},counterId: '{{uIAction.counterId}}'{{/if}}{{/if}} },
{{/items}}
],
{{/page.viewToolBarItems}}
......
......@@ -16,6 +16,11 @@ interface ToolbarProps {
* @description 行为模型
*/
actionModel: IParam[];
/**
* @description 计数器数据
*/
counterData: IParam;
}
interface toolbarEmit {
(name: "onToolbarEvent", value: IActionParam): void;
......@@ -32,6 +37,14 @@ const itemClick = (item: IParam) => {
data: item,
});
};
const hasCounter = (item: any) => {
console.log(item.counterId, props.counterData);
if (item.counterId && props.counterData && props.counterData.hasOwnProperty(item.counterId)) {
return true;
}
return false;
}
</script>
<template>
<div class="toolbar">
......@@ -42,6 +55,8 @@ const itemClick = (item: IParam) => {
:title="item.tooltip"
>
<!-- todo 无权限显示模式 -->
<template v-if="hasCounter(item)">
<a-badge :count="counterData[item.counterId]">
<a-button
v-show="item.visible"
:class="['toolbar-item', item.class]"
......@@ -53,6 +68,21 @@ const itemClick = (item: IParam) => {
:iconClass="item.showIcon ? item.iconClass : undefined"
:imgPath="item.showIcon ? item.imgPath : undefined"/>
</a-button>
</a-badge>
</template>
<template v-else>
<a-button
v-show="item.visible"
:class="['toolbar-item', item.class]"
:disabled="item.disabled"
@click="itemClick(item)"
>
<AppIconText
:text="item.showCaption ? item.caption : undefined"
:iconClass="item.showIcon ? item.iconClass : undefined"
:imgPath="item.showIcon ? item.imgPath : undefined"/>
</a-button>
</template>
</a-tooltip>
<!-- todo 模型缺失 -->
<!-- <a-dropdown v-else-if="Object.is(item.itemType, 'ITEMS')" v-show="item.visible">
......
......@@ -5,6 +5,14 @@
*/
export interface IAppCounterService {
/**
* 计数器数据
*
* @type {*}
* @memberof IAppCounterService
*/
data: any;
/**
* 执行计数器
*
......
......@@ -38,9 +38,10 @@ const collapsedChange = () => {
collapsed.value = !collapsed.value;
}
{{#if page.psAppCounterRefs}}
// 计数器数据
const counterData = computed(() => {
const { counterServices } = toRefs(state);
if (counterServices.value && counterServices.value.length) {
if (counterServices && counterServices.value && counterServices.value.length) {
return counterServices.value[0].data;
}
return {};
......
......@@ -31,7 +31,16 @@ const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const editView = new EditView(viewState, props, emit).moduleInstall();
const { state, form, onToolbarEvent, onCtrlEvent } = editView;
{{#if page.psAppCounterRefs}}
// 计数器数据
const counterData = computed(() => {
const { counterServices } = toRefs(state);
if (counterServices && counterServices.value && counterServices.value.length) {
return counterServices.value[0].data;
}
return {};
})
{{/if}}
</script>
<template>
......@@ -51,6 +60,9 @@ const { state, form, onToolbarEvent, onCtrlEvent } = editView;
mode="button"
name="{{lowerCase codeName}}"
:actionModel="state.toolbar"
{{#if page.psAppCounterRefs}}
:counterData="counterData"
{{/if}}
@onToolbarEvent="onToolbarEvent"/>
</template>
{{/eq}}
......
......@@ -41,7 +41,16 @@ const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const gridView = new GridView(viewState, props, emit).moduleInstall();
const { state, grid, searchForm, quickSearchForm, onCtrlEvent, onToolbarEvent, onQuickGroupEvent, onQuickSearchEvent } = gridView;
{{#if page.psAppCounterRefs}}
// 计数器数据
const counterData = computed(() => {
const { counterServices } = toRefs(state);
if (counterServices && counterServices.value && counterServices.value.length) {
return counterServices.value[0].data;
}
return {};
})
{{/if}}
</script>
<template>
......@@ -61,6 +70,9 @@ const { state, grid, searchForm, quickSearchForm, onCtrlEvent, onToolbarEvent, o
mode="button"
name="{{lowerCase codeName}}"
:actionModel="state.toolbar"
{{#if page.psAppCounterRefs}}
:counterData="counterData"
{{/if}}
@onToolbarEvent="onToolbarEvent"/>
</template>
{{/eq}}
......
......@@ -40,7 +40,16 @@ const emit = defineEmits<ViewEmit>();
// 安装功能模块,提供状态和能力方法
const treeView = new TreeView(viewState, props, emit).moduleInstall();
const { state, tree, onCtrlEvent, onToolbarEvent, onQuickGroupEvent, onQuickSearchEvent } = treeView;
{{#if page.psAppCounterRefs}}
// 计数器数据
const counterData = computed(() => {
const { counterServices } = toRefs(state);
if (counterServices && counterServices.value && counterServices.value.length) {
return counterServices.value[0].data;
}
return {};
})
{{/if}}
</script>
<template>
......@@ -60,6 +69,9 @@ const { state, tree, onCtrlEvent, onToolbarEvent, onQuickGroupEvent, onQuickSear
mode="button"
name="{{lowerCase codeName}}"
:actionModel="state.toolbar"
{{#if page.psAppCounterRefs}}
:counterData="counterData"
{{/if}}
@onToolbarEvent="onToolbarEvent"/>
</template>
{{/eq}}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册