diff --git a/src/commercial-module/README.md b/src/commercial-module/README.md index fb2281b637738d0241a263417cf8a7d287af04c0..31e8dc17f4b18322dc4a30cf9684aa71ffacfb7b 100644 --- a/src/commercial-module/README.md +++ b/src/commercial-module/README.md @@ -1,2 +1,3 @@ -# 商业模块放置地址 -> 该文件夹勿删 \ No newline at end of file +# 商业模块文件夹 + +> 该文件夹勿删,该文件夹下项目以模块命名,切记直接使用neatlogic-web-xxx,否则文件路径会找不到 diff --git a/src/resources/api/api.js b/src/resources/api/api.js index b8752f6c4051171029ebe6831cd47f8c97d8870d..004eb97e25f98bfad1268d693124148b33edf8b4 100644 --- a/src/resources/api/api.js +++ b/src/resources/api/api.js @@ -13,19 +13,39 @@ import report from './report'; import rdm from './rdm'; import documentonline from './documentonline'; let moduleApiConfig = {}; +let moduleList = ['autoexec', 'cmdb', 'common', 'dashboard', 'deploy', 'framework', 'globalsearch', 'inspect', 'knowledge', 'pbc', 'process', 'report', 'rdm', 'documentonline']; // 用于自定义页面接口导入做浅拷贝 +let moduleConfig = { + autoexec: autoexec, + cmdb: cmdb, + common: common, + dashboard: dashboard, + deploy: deploy, + framework: framework, + globalsearch: globalsearch, + inspect: inspect, + knowledge: knowledge, + pbc: pbc, + process: process, + report: report, + rdm: rdm, + documentonline: documentonline +}; try { // 导入自定义模块,获取导出接口地址 const apiConfig = require.context('@/commercial-module', true, /api.js$/); - const moduleApiPathList = apiConfig.keys(); - moduleApiPathList.forEach(routerPath => { - const moduleId = routerPath.split('/')[1]; - const exportValue = apiConfig(routerPath).default || {}; - const lastModuleName = moduleId.split('-'); - const moduleName = lastModuleName?.pop() || moduleId; - moduleApiConfig[moduleName] = exportValue; + apiConfig.keys().forEach(apiPath => { + if (apiPath) { + const moduleName = apiPath.split('/')[1]?.split('-')?.pop() || apiPath.split('/')[1]; + const exportValue = apiConfig(apiPath).default || {}; + if (moduleList.includes(moduleName)) { + moduleApiConfig[moduleName] = Object.assign(moduleConfig[moduleName], exportValue); //自定义页面接口导入,在现有模块基础上添加 + } else { + moduleApiConfig[moduleName] = exportValue; + } + } }); } catch (error) { - // + console.error('api.js抛出异常', error); } export default { diff --git a/src/resources/plugins/TsSheet/form-item-config.vue b/src/resources/plugins/TsSheet/form-item-config.vue index a55690fed71f927bcff62af56e7249c7a553c528..14154ccf2c8746ea3275bdfe800557ef9ee04369 100644 --- a/src/resources/plugins/TsSheet/form-item-config.vue +++ b/src/resources/plugins/TsSheet/form-item-config.vue @@ -80,7 +80,7 @@