diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a6f20ed967b04838b627ff0b510b3fd87e47819..78987cdafc46594569b3ffcfa8eb6561e283f541 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,12 +14,16 @@ - 应用标题新增strictly参数,为true时不会跟着菜单折叠而改变 - 面板首页搜索新增strictly参数,为true时不会跟着菜单折叠而改变 - 面板首页搜索新增placeholder参数,为输入框添加提示信息 +- 面板全局搜索新增placeholder参数,为输入框添加提示信息 ## Fixed - 修复数据关系分页部件流布局模式下嵌套数据关系分页部件流布局时样式异常以及初始导航栏定位异常问题 - 修复面板分页组件在切换分页时,如果分页里面有气泡飘窗,切换时飘窗会定位到界面左上角的样式异常问题 - 修复首页空白占位存在二级路由时依然绘制空白占位 +- 修复面板全局搜索组件解析子应用全局搜索应用功能报错 +- 修复应用切换器从子应用切换回主应用是,应用标题未与环境参数AppTitle一致 +- 修复应用标题在子应用中绘制异常,未绘制子应用标题而是绘制环境参数AppTitle ## [0.7.41-alpha.18] - 2025-08-14 diff --git a/src/panel-component/app-switch/app-switch.controller.ts b/src/panel-component/app-switch/app-switch.controller.ts index 5e08f08aa7d1bbdea3082debfed62b92209d3a8b..2e227af5647cd7647aaeea7c03323e880754d440 100644 --- a/src/panel-component/app-switch/app-switch.controller.ts +++ b/src/panel-component/app-switch/app-switch.controller.ts @@ -291,9 +291,12 @@ export class AppSwitchController extends PanelItemController { await ibiz.hub.getAppAsync(tempKey); } const targetAppModel = ibiz.hub.getAppSourceModel(tempKey); - - // 设置目标应用应用标题 - if (targetAppModel.getDefaultPSAppIndexView) { + const defaultApp = ibiz.hub.getApp(); + // 切换为主应用时优先获取环境参数中AppTitle + if (defaultApp.model.appId === tempKey && window.Environment.AppTitle) { + ibiz.env.AppTitle = window.Environment.AppTitle; + } else if (targetAppModel.getDefaultPSAppIndexView) { + // 设置目标应用应用标题 const view = targetAppModel.getDefaultPSAppIndexView as IModel; if (targetAppModel.caption) { ibiz.env.AppTitle = targetAppModel.caption; diff --git a/src/panel-component/app-switch/app-switch.tsx b/src/panel-component/app-switch/app-switch.tsx index 9751d0faae1f364f697903a9209c9823af35b985..62bd600bf66d83ce15133f055b02359d2f073ae4 100644 --- a/src/panel-component/app-switch/app-switch.tsx +++ b/src/panel-component/app-switch/app-switch.tsx @@ -10,7 +10,7 @@ import './app-switch.scss'; /** * 应用切换器 * @primary - * @description 应用切换器是前端导航核心组件,通过可视化列表实现多应用快速跳转,使用该能力需在首页视图配置应用选择模式为`默认`。 + * @description 应用切换器是前端导航核心组件,通过可视化列表实现多应用快速跳转,当应用存在子应用时,使用该能力需在首页视图配置应用选择模式为`默认`。 * @panelitemparams {name:sourcetype,parameterType:'UTIL' | 'REFAPP',defaultvalue:REFAPP,description:应用源类型,其中UTIL表示微应用数据来源于功能组件服务、REFAPP表示微应用数据来源于引用子应用集(主应用和引用子应用的所有首页)} * @primary */ diff --git a/src/panel-component/auth-userinfo/auth-userinfo.tsx b/src/panel-component/auth-userinfo/auth-userinfo.tsx index 7d00bdabebe1548cb003ff8d38dffa8df2804f1d..6c021365b0a305b9eb01dde75f62b4d4ca6ac43d 100644 --- a/src/panel-component/auth-userinfo/auth-userinfo.tsx +++ b/src/panel-component/auth-userinfo/auth-userinfo.tsx @@ -9,7 +9,7 @@ import { AuthUserinfoController } from './auth-userinfo.controller'; /** * 用户信息 * @description 展示用户的基本信息,提供登出功能。 - * @panelitemparams {name:strictly,parameterType:boolean,defaultvalue:false,description:是否取消于首页菜单的关联,即菜单收缩时不会跟随改变} + * @panelitemparams {name:strictly,parameterType:boolean,defaultvalue:false,description:是否取消与首页菜单的关联,即菜单收缩时不会跟随改变,当用户信息未配置在首页左侧时应启用} * @panelitemparams {name:readonly,parameterType:boolean,defaultvalue:false,description:是否只读} * @primary */ diff --git a/src/panel-component/global-search/global-search.controller.ts b/src/panel-component/global-search/global-search.controller.ts index c72af3b400669bbe435d352c21eadd4cc050c173..d4c381469ea48b6d4e4081b8a42e27639974e1f0 100644 --- a/src/panel-component/global-search/global-search.controller.ts +++ b/src/panel-component/global-search/global-search.controller.ts @@ -9,8 +9,13 @@ import { PanelItemController, } from '@ibiz-template/runtime'; import { notNilEmpty, createUUID } from 'qx-util'; -import { IPanelRawItem, IAppFunc, IAppMenuItem } from '@ibiz/model-core'; -import { IHttpResponse, recursiveIterate } from '@ibiz-template/core'; +import { + IPanelRawItem, + IAppFunc, + IAppMenuItem, + IAppMenu, +} from '@ibiz/model-core'; +import { IHttpResponse } from '@ibiz-template/core'; import { GlobalSearchState, ISearchItem } from './global-search.state'; /** @@ -42,11 +47,11 @@ export class GlobalSearchController extends PanelItemController { /** * @description 自定义参数 * @exposedoc - * @protected + * @public * @type {IData} * @memberof GlobalSearchController */ - protected rawItemParams: IData = {}; + public rawItemParams: IData = {}; /** * @description 搜索历史缓存标识 @@ -142,34 +147,57 @@ export class GlobalSearchController extends PanelItemController { } /** - * 初始化全局搜索项 - * - * @protected + * @description 获取全局搜索应用功能 + * @param {IAppMenuItem[]} appMenuItems + * @returns {*} {Promise} * @memberof GlobalSearchController */ - protected async initGlobalSearchItem(): Promise { - const appMenu = getControl(this.panel.view.model, 'appmenu'); - if (!appMenu) return; - const appFuncs: IAppFunc[] = []; - recursiveIterate( - appMenu, - (menuItem: IAppMenuItem) => { + async getSearchFunc(appMenuItems: IAppMenuItem[]): Promise { + const result: IAppFunc[] = []; + const promises = appMenuItems.map(async menuItem => { + try { + if (menuItem.appMenuItems) { + const subFuncs = await this.getSearchFunc(menuItem.appMenuItems); + result.push(...subFuncs); + return; + } if (menuItem.appFuncId) { - const app = ibiz.hub.getApp(menuItem.appId); + let app = ibiz.hub.getApp(menuItem.appId); + if (!app) { + app = await ibiz.hub.getAppAsync(menuItem.appId); + } const appFunc = app.getAppFunc(menuItem.appFuncId); if ( appFunc && appFunc.appFuncType === 'SEARCH' && appFunc.appDEACModeId && appFunc.appDataEntityId - ) - appFuncs.push(appFunc); + ) { + result.push(appFunc); + } } - }, - { - childrenFields: ['appMenuItems'], - }, + } catch (err) { + console.error(`计算菜单应用功能异常: ${menuItem.appFuncId}`, err); + } + }); + await Promise.all(promises); + return result; + } + + /** + * 初始化全局搜索项 + * + * @protected + * @memberof GlobalSearchController + */ + protected async initGlobalSearchItem(): Promise { + const appMenu: IAppMenu | undefined = getControl( + this.panel.view.model, + 'appmenu', ); + if (!appMenu) return; + const appMenuItems = appMenu.appMenuItems || []; + const appFuncs: IAppFunc[] = await this.getSearchFunc(appMenuItems); await Promise.all( appFuncs.map(async func => { const deACMode = await getDeACMode( diff --git a/src/panel-component/global-search/global-search.tsx b/src/panel-component/global-search/global-search.tsx index 447dfa3a879c223fcbf568e67c472c51bcaf30b1..25e40f4e28d447d76f769f61b25ba72092a86e1a 100644 --- a/src/panel-component/global-search/global-search.tsx +++ b/src/panel-component/global-search/global-search.tsx @@ -20,10 +20,11 @@ import './global-search.scss'; /** * 全局搜索 * @primary - * @description 全局搜索组件,监听快捷键Ctrl+K弹出搜索框,点击搜索时可查询应用信息。 + * @description 全局搜索组件,监听快捷键Ctrl+K弹出搜索框,需在菜单上绑定应用功能预定义类型为GLOBAL_SEARCH的隐藏菜单项,应用功能类型为全局搜索,同时绑定应用实体与自填模式。输入值时会查询实体自填模式数据,同时点击下拉数据后会打开自填模式中的链接视图。每次查询后还会缓存为搜索历史记录。 * @panelitemparams {name:historyCacheKey,parameterType:string,defaultvalue:global-search-history,description:搜索历史缓存标识} * @panelitemparams {name:maxhistory,parameterType:number,defaultvalue:7,description:最大历史记录,默认7条} * @panelitemparams {name:size,parameterType:number,defaultvalue:100,description:单次查询最大数量,默认100条} + * @panelitemparams {name:placeholder,parameterType:string,description:搜索框提示信息} * @export * @class GlobalSearch */ @@ -66,6 +67,13 @@ export const GlobalSearch = defineComponent({ ); }); + const curPlaceholder = computed(() => { + const { placeholder } = c.rawItemParams; + return ( + placeholder || ibiz.i18n.t('panelComponent.globalSearch.placeholder') + ); + }); + /** * 处理回车事件 * @@ -303,6 +311,7 @@ export const GlobalSearch = defineComponent({ visible, editorRef, searchValue, + curPlaceholder, handleFocus, handleEnter, renderAction, @@ -328,9 +337,7 @@ export const GlobalSearch = defineComponent({ clearable ref='editorRef' v-model={this.searchValue} - placeholder={ibiz.i18n.t( - 'panelComponent.globalSearch.placeholder', - )} + placeholder={this.curPlaceholder} class={[ this.ns.e('search'), this.ns.is('search', this.visible), diff --git a/src/panel-component/panel-app-title/panel-app-title.controller.ts b/src/panel-component/panel-app-title/panel-app-title.controller.ts index 6c9b82a931a9b372d8048cb00510684a86550495..388ff9c13ad2f62a99409b69d2cedd2b06825751 100644 --- a/src/panel-component/panel-app-title/panel-app-title.controller.ts +++ b/src/panel-component/panel-app-title/panel-app-title.controller.ts @@ -100,8 +100,12 @@ export class PanelAppTitleController extends PanelItemController this.state.isSvg = true; } - // 环境变量中的系统标题权重最大 - if (ibiz.env.AppTitle) this.state.caption = ibiz.env.AppTitle; + // 只有主应用才处理环境参数 + const defaultApp = ibiz.hub.getApp(); + if (defaultApp.model.appId === indexViewModel.appId) { + // 环境变量中的系统标题权重最大 + if (ibiz.env.AppTitle) this.state.caption = ibiz.env.AppTitle; + } } /** diff --git a/src/panel-component/panel-app-title/panel-app-title.tsx b/src/panel-component/panel-app-title/panel-app-title.tsx index 6a6ed65302a2f6d3a7f3ab02083b4d7b42b85e44..98c36aa80cdda40f4c53d7b6973446ab7272e7a7 100644 --- a/src/panel-component/panel-app-title/panel-app-title.tsx +++ b/src/panel-component/panel-app-title/panel-app-title.tsx @@ -13,7 +13,7 @@ import './panel-app-title.scss'; /** * 应用标题 * @description 用于绘制应用logo和应用标题,提供点击标题跳转首页的能力。 - * @panelitemparams {name:strictly,parameterType:boolean,defaultvalue:false,description:是否取消于首页菜单的关联,即菜单收缩时不会跟随改变} + * @panelitemparams {name:strictly,parameterType:boolean,defaultvalue:false,description:是否取消与首页菜单的关联,即菜单收缩时不会跟随改变,当应用标题未配置在首页左侧时应启用} * @primary */ export const PanelAppTitle = defineComponent({ diff --git a/src/panel-component/panel-index-view-search/panel-index-view-search.tsx b/src/panel-component/panel-index-view-search/panel-index-view-search.tsx index ef88d0ff43609052cafe3374d1fdc1b1211c4109..710ab0a637310937680c3523e374448ab736fdf7 100644 --- a/src/panel-component/panel-index-view-search/panel-index-view-search.tsx +++ b/src/panel-component/panel-index-view-search/panel-index-view-search.tsx @@ -13,8 +13,8 @@ import './panel-index-view-search.scss'; /** * 首页搜索 * @primary - * @description 输入搜索词点击搜索后,会执行绑定的菜单项应用功能,打开全局搜索界面。 - * @panelitemparams {name:strictly,parameterType:boolean,defaultvalue:false,description:是否取消于首页菜单的关联,即菜单收缩时不会跟随改变} + * @description 用于快速查找应用数据,需在菜单上配置标识与本面板项一样的标识,默认标识为index_view_search,输入搜索词点击搜索后,会执行绑定的菜单项应用功能,打开对应的全局搜索界面。 + * @panelitemparams {name:strictly,parameterType:boolean,defaultvalue:false,description:是否取消与首页菜单的关联,即菜单收缩时不会跟随改变,当首页搜索未配置在首页左侧时应启用} * @panelitemparams {name:placeholder,parameterType:string,description:搜索框提示信息} */ export const PanelIndexViewSearch = defineComponent({ diff --git a/src/panel-component/user-action/user-action.tsx b/src/panel-component/user-action/user-action.tsx index 6f62b9a81f58a72820be9729ba1d20b9f3d940fc..f11215bffc08808592614b0313d1c7966e545e43 100644 --- a/src/panel-component/user-action/user-action.tsx +++ b/src/panel-component/user-action/user-action.tsx @@ -12,7 +12,7 @@ import './user-action.scss'; /** * 用户操作 * @primary - * @description 首页中用户操作行为按钮,点击后执行对应的应用功能。存在三种类型,分别为设置(Setting)、帮助(Helper)、自定义(Custom)。 + * @description 首页中用户操作行为按钮,需在菜单上配置标识为设置(setting)、帮助(helper)、自定义(custom)的三种隐藏菜单项,点击按钮将会执行对应的菜单项应用功能。 * @panelitemparams {name:noprivmode,parameterType:PARENT|SELF,defaultvalue:PARENT,description:无权限模式,为PARENT时会通过父容器进行显示隐藏} * @export * @class UserAction