当手术计费弹窗中点击"签发"耗材时,因耗材的locationId(发放库房)为空导致后端异常。 在DoctorStationAdviceAppServiceImpl.handDevice方法中,当locationId为null时,使用登录用户的科室ID作为默认值, 与NurseBillingAppService中的处理方式保持一致。
42 lines
1.2 KiB
JavaScript
Executable File
42 lines
1.2 KiB
JavaScript
Executable File
/**
|
|
* 模板组件注册模块
|
|
* 动态引入 template 目录下的所有 .vue 文件,并将它们注册为全局组件
|
|
*/
|
|
|
|
// 动态引入 template 目录下的所有 .vue 文件(包括中文命名的文件)
|
|
// 使用 { eager: true } 表示立即加载所有匹配的文件
|
|
const templates = import.meta.glob('./*.vue', { eager: true });
|
|
|
|
// 存储所有加载的组件
|
|
const components = [];
|
|
|
|
// 遍历所有引入的文件
|
|
for (const path in templates) {
|
|
try {
|
|
// 获取组件的默认导出
|
|
const component = templates[path].default;
|
|
|
|
// 检查组件是否有 name 属性,如果没有则跳过
|
|
if (component && component.name) {
|
|
components.push(component);
|
|
} else {
|
|
console.warn(`组件 ${path} 缺少 name 属性,将不会被注册`);
|
|
}
|
|
} catch (error) {
|
|
console.error(`加载组件 ${path} 时出错:`, error);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 注册所有组件到 Vue 应用实例
|
|
* @param {Object} app - Vue 应用实例
|
|
*/
|
|
const registerComponents = (app) => {
|
|
components.forEach((component) => {
|
|
// 使用组件的 name 属性作为组件名称进行注册
|
|
app.component(component.name, component);
|
|
});
|
|
};
|
|
|
|
// 导出组件数组和注册函数
|
|
export { components, registerComponents }; |