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

update:更新

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