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

update:更新

上级 822cb13e
......@@ -85,6 +85,15 @@ export class ControlBase {
counterService.value.destory();
}
});
// 获取计数器数据
const getCounterData = (counterId: string): number => {
if (counterService && counterService.value) {
return counterService.value.data[counterId];
}
return 0;
}
return getCounterData;
}
/**
......@@ -123,12 +132,11 @@ export class ControlBase {
this.setState();
// 处理导航参数
this.useControlContextParams();
// 使用计数器服务
this.useCounterService();
return {
state: this.state,
name: this.state.controlName,
getData: this.getData.bind(this),
getCounterData: this.useCounterService(),
onCtrlEvent: this.onCtrlEvent.bind(this),
};
}
......
......@@ -224,7 +224,7 @@ export class ExpBarControl extends MainControl {
this.useExpCtrlInit();
return {
...superParams,
search: this.search.bind(this),
search: this.useSearch(),
onToolbarEvent: this.onToolbarEvent.bind(this)
};
}
......
......@@ -32,6 +32,8 @@ export class ListControl extends MDControl {
});
})
}
// 清空选中数据,避免多次加载选中效果异常
this.state.selections = [];
// 处理分组
this.handleDataGroup();
// 处理默认选中
......
......@@ -2,4 +2,30 @@ export const ctrlState = {
controlCodeName: '{{ctrl.codeName}}',
controlName: '{{ctrl.name}}',
data: {},
{{#if ctrl.psAppCounterRefs}}
appCounterRefs: [
{{#each ctrl.psAppCounterRefs as | counterRef |}}
{{#if counterRef.psAppCounter}}
{{#with counterRef.psAppCounter as | counter |}}
{
id: '{{counterRef.id}}',
getAction: '{{counter.getPSAppDEAction.codeName}}',
timer: {{#if counter.timer}}{{counter.timer}}{{else}}6000{{/if}},
{{#if counter.psAppDataEntity}}
deCodeName: '{{lowerCase counter.psAppDataEntity.codeName}}'
{{/if}}
}{{#unless @last}},{{/unless}}
{{/with}}
{{/if}}
{{/each}}
],
counterServices: [],
{{#if ctrl.psControls}}
{{#each ctrl.psControls as | viewPanel |}}
{{#and viewPanel.psAppCounterRef viewPanel.psAppCounterRef.psAppCounter viewPanel.counterId}}
{{viewPanel.name}}Counter: { id: '{{viewPanel.psAppCounterRef.id}}', counterId: '{{viewPanel.counterId}}' },
{{/and}}
{{/each}}
{{/if}}
{{/if}}
};
\ No newline at end of file
......@@ -37,7 +37,7 @@ const emit = defineEmits <CtrlEmit> ();
// 安装功能模块,提供状态和能力方法
const tabExpPanelControl = new TabExpPanelControl(ctrlState, props, emit).moduleInstall();
const { name, state, onCtrlEvent } = tabExpPanelControl;
const { name, state, onCtrlEvent, getCounterData } = tabExpPanelControl;
// 暴露内部状态及能力
defineExpose({ name, state });
......@@ -51,7 +51,13 @@ defineExpose({ name, state });
{{#each ctrl.psControls as |viewPanel| }}
<a-tab-pane key="{{viewPanel.name}}">
<template #tab>
{{#and viewPanel.psAppCounterRef viewPanel.counterId}}
<a-badge :count="getCounterData('{{viewPanel.name}}Counter', '{{viewPanel.counterId}}')">
<AppIconText {{#if viewPanel.psSysImage}}{{#if viewPanel.psSysImage.cssClass}}iconClass="{{viewPanel.psSysImage.cssClass}}" {{/if}}{{#if viewPanel.psSysImage.imagePath}}imgPath="{{viewPanel.psSysImage.imagePath}}" {{/if}}{{/if}}text="{{viewPanel.caption}}"/>
</a-badge>
{{else}}
<AppIconText {{#if viewPanel.psSysImage}}{{#if viewPanel.psSysImage.cssClass}}iconClass="{{viewPanel.psSysImage.cssClass}}" {{/if}}{{#if viewPanel.psSysImage.imagePath}}imgPath="{{viewPanel.psSysImage.imagePath}}" {{/if}}{{/if}}text="{{viewPanel.caption}}"/>
{{/and}}
</template>
<{{viewPanel.codeName}}TabViewPanel
name="{{name}}"
......
......@@ -201,7 +201,7 @@ export const ctrlState = {
{{/if}}
{{/with}}
},
counterService: ref(null),
counterService: {},
{{/and}}
contextMenus: {
{{#each ctrl.psDETreeNodes as | treeNode |}}
......
......@@ -49,18 +49,8 @@ const getCustomText = (scriptCode: any) => {
}
// 安装功能模块,提供状态和能力方法
const { name, state, load, refresh, onTreeNodeSelect, onContextMenuClick, onRightClick, onCheck } = new TreeControl(ctrlState, props, emit).moduleInstall();
const { name, state, load, refresh, onTreeNodeSelect, onContextMenuClick, onRightClick, onCheck, getCounterData } = new TreeControl(ctrlState, props, emit).moduleInstall();
{{#and ctrl.psAppCounterRef ctrl.psAppCounterRef.psAppCounter}}
// 获取计数器数据
const counterData = computed(() => {
const { counterService } = state;
if (counterService) {
return counterService.data;
}
return {};
})
{{/and}}
// 暴露内部状态及能力
defineExpose({ name, state, load, refresh });
</script>
......@@ -103,7 +93,7 @@ defineExpose({ name, state, load, refresh });
<span
:class="['app-tree-node__text', node.cssName]"
:title="node.tooltip ? node.tooltip : node.text">
<a-badge v-if="node.counterId && counterData.hasOwnProperty(node.counterId)" class="node__text-badge" :count="counterData[node.counterId]">
<a-badge v-if="node.counterId" class="node__text-badge" :count="getCounterData(node.counterId)">
<template v-if="node.textCustomCode && node.textScriptCode">
<span :domPropsInnerHtml="getCustomText(node.textScriptCode)"></span>
</template>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册