diff --git a/.env.development b/.env.development index 1f34454..e118379 100644 --- a/.env.development +++ b/.env.development @@ -41,7 +41,7 @@ VITE_GLOB_API_URL_PREFIX = #租户开关 # VITE_GLOB_TENANT_ENABLED = true -#是否需要输入租户 +#登录时是否需要输入租户码 # VITE_GLOB_TENANT_INPUT_REQUIRED = true # 屏蔽通知消息的轮询 diff --git a/.env.development.example b/.env.development.example index 40cc05c..5f1c007 100644 --- a/.env.development.example +++ b/.env.development.example @@ -36,3 +36,9 @@ VITE_GLOB_API_URL_PREFIX = # 屏蔽通知消息的轮询 VITE_GLOB_DISABLE_NEWS = true + +#租户开关 +# VITE_GLOB_TENANT_ENABLED = true +#登录时是否需要输入租户码 +# VITE_GLOB_TENANT_INPUT_REQUIRED = true + diff --git a/.env.production b/.env.production index f2a7f1f..5b4625c 100644 --- a/.env.production +++ b/.env.production @@ -38,7 +38,7 @@ VITE_GLOB_API_URL_PREFIX = VITE_USE_PWA = false #租户开关 VITE_GLOB_TENANT_ENABLED = true -#是否需要输入租户 +#登录时是否需要输入租户码 # VITE_GLOB_TENANT_INPUT_REQUIRED = true # 屏蔽通知消息的轮询 diff --git a/.env.production.example b/.env.production.example index 9f5ddda..3a6f021 100644 --- a/.env.production.example +++ b/.env.production.example @@ -36,3 +36,9 @@ VITE_GLOB_API_URL_PREFIX = # 打包是否开启pwa功能 VITE_USE_PWA = false + +#租户开关 +# VITE_GLOB_TENANT_ENABLED = true +#登录时是否需要输入租户码 +# VITE_GLOB_TENANT_INPUT_REQUIRED = true + diff --git a/src/components/Application/src/UserTenantChange.vue b/src/components/Application/src/UserTenantChange.vue index d61a481..c6f9748 100644 --- a/src/components/Application/src/UserTenantChange.vue +++ b/src/components/Application/src/UserTenantChange.vue @@ -27,31 +27,20 @@ import { storeToRefs } from 'pinia'; import { Tooltip } from 'ant-design-vue'; import { useUserStore } from '/@/store/modules/user'; - import { changeTenant } from '/@/api/system/tenant'; import { useI18n } from '/@/hooks/web/useI18n'; import {useMessage} from "/@/hooks/web/useMessage"; - import {useTabs} from "/@/hooks/web/useTabs"; - import {router} from "/@/router"; - import {setupRouterGuard} from "/@/router/guard"; - import {usePermissionStore} from "/@/store/modules/permission"; - import {useMenuSetting} from "/@/hooks/setting/useMenuSetting"; - import {useAppInject} from "/@/hooks/web/useAppInject"; - import {useAppStore} from "/@/store/modules/app"; + import {useTenantManager} from "/@/utils/tenantManager"; const userStore = useUserStore(); const { t } = useI18n(); const { userInfo } = storeToRefs(userStore); - const { closeAll } = useTabs(router); - const permissionStore = usePermissionStore(); - const { getShowTopMenu } = useMenuSetting(); - const { getIsMobile } = useAppInject(); - const appStore = useAppStore(); const formInfo: any = ref({ tenants: [], tenantId: '', tenantCode: '', tenantName: '', }); + const {toggleLocal}=useTenantManager(); getDropMenuList(); watch( () => userInfo.value, @@ -73,21 +62,9 @@ }); } } - async function toggleLocale(lang: string) { - appStore.setPageLoadingAction(true); - let res = await changeTenant(lang); - permissionStore.setDynamicAddedRoute(false); - await userStore.afterLoginAction(true); - closeAll(); - await setupRouterGuard(router); - await permissionStore.changeSubsystem(getShowTopMenu.value, getIsMobile.value); - if(permissionStore.getSubSysList.length>0){ - permissionStore.setSubSystem(permissionStore.getSubSysList[0].id); - }else{ - permissionStore.setSubSystem(""); - } - //appStore.setPageLoadingAction(false); - //location.reload(); + + async function switchTenant(tenantCode: string) { + await toggleLocal({tenantCode:tenantCode, goHome:true,tabCloseAction:"closeAll"}); } function handleMenuEvent(menu: DropMenu) { @@ -100,7 +77,7 @@ title: () => h('span', t('温馨提醒')), content: () => h('span', t('是否确认切换租户?未保存的数据可能会丢失!')), onOk: async () => { - toggleLocale(menu.event as string); + switchTenant(menu.event as string); }, okText: () => t('确认'), cancelText: () => t('取消'), diff --git a/src/components/CreateCodeStep/src/EntireConfigStep.vue b/src/components/CreateCodeStep/src/EntireConfigStep.vue index c7febf7..08a001c 100644 --- a/src/components/CreateCodeStep/src/EntireConfigStep.vue +++ b/src/components/CreateCodeStep/src/EntireConfigStep.vue @@ -20,6 +20,7 @@ import { debounce} from 'lodash-es'; import {CustomFormConfig, GeneratorConfig} from '/@/model/generator/generatorConfig'; import { CodeEditor,MODE } from '/@/components/CodeEditor'; + import {ListConfig} from "/@/model/generator/listConfig"; const { t } = useI18n(); const { notification } = useMessage(); @@ -35,7 +36,6 @@ }); - const handleListConfigChange=debounce((v)=>{ try{ let jsonObject = JSON.parse(v); @@ -43,6 +43,7 @@ generatorConfig.listConfig.columnConfigs= jsonObject.columnConfigs; generatorConfig.listConfig.buttonConfigs= jsonObject.buttonConfigs; }catch(e){ + console.log(e); notification.error({ message: t('提示'), description: t('列表配置json格式有误'), @@ -54,6 +55,7 @@ try{ generatorConfig.formJson= JSON.parse(v); }catch(e){ + console.error(e); notification.error({ message: t('提示'), description: t('表单配置json格式有误'), @@ -62,33 +64,18 @@ },1000); const handleRenderConfigChange=debounce((v)=>{ - /* try{ - let jsonObject = JSON.parse(v); - generatorConfig.renderConfig.formProps= jsonObject.formProps; - }catch(e){ - notification.error({ - message: t('提示'), - description: t('渲染覆盖配置json格式有误'), - }); - }*/ customFormConfig.renderConfig=v; },1000); const initStep =()=> { listConfigObject.value=JSON.stringify({ - queryConfigs:generatorConfig.listConfig.queryConfigs, - columnConfigs:generatorConfig.listConfig.columnConfigs, - buttonConfigs:generatorConfig.listConfig.buttonConfigs + queryConfigs:generatorConfig.listConfig.queryConfigs||[], + columnConfigs:generatorConfig.listConfig.columnConfigs||[], + buttonConfigs:generatorConfig.listConfig.buttonConfigs||[] }, null, 2); formConfigObject.value=JSON.stringify(generatorConfig.formJson, null, 2); - - /* renderConfigObject.value=JSON.stringify({ - searchFormSchema:generatorConfig.renderConfig.searchFormSchema||{}, - columns:generatorConfig.renderConfig.columns||{}, - formProps:generatorConfig.renderConfig.formProps||{} - }, null, 2);*/ - renderConfigObject.value= customFormConfig.renderConfig||''; + renderConfigObject.value= customFormConfig.renderConfig||''; } const validateStep = async (): Promise => { @@ -98,15 +85,17 @@ generatorConfig.listConfig.columnConfigs= jsonObject.columnConfigs; generatorConfig.listConfig.buttonConfigs= jsonObject.buttonConfigs; }catch(e){ + console.error(e); notification.error({ message: t('提示'), - description: t('表单配置json格式有误'), + description: t('列表配置json格式有误'), }); return false; } try{ generatorConfig.formJson= JSON.parse(formConfigObject.value); }catch(e){ + console.error(e); notification.error({ message: t('提示'), description: t('表单配置json格式有误'), @@ -114,18 +103,6 @@ return false; } - /* try{ - let jsonObject = JSON.parse(renderConfigObject.value); - generatorConfig.renderConfig.formProps=jsonObject.formProps ; - }catch(e){ - console.log(e); - notification.error({ - message: t('提示'), - description: t('渲染覆盖配置json格式有误'), - }); - return false; - }*/ - customFormConfig.renderConfig=renderConfigObject.value; return true; diff --git a/src/utils/tenantManager.ts b/src/utils/tenantManager.ts new file mode 100644 index 0000000..41ac524 --- /dev/null +++ b/src/utils/tenantManager.ts @@ -0,0 +1,50 @@ +import { useUserStore } from '/@/store/modules/user'; +import {useAppStore} from "/@/store/modules/app"; +import {usePermissionStore} from "/@/store/modules/permission"; +import {setupRouterGuard} from "/@/router/guard"; +import { changeTenant } from '/@/api/system/tenant'; +import {useMenuSetting} from "/@/hooks/setting/useMenuSetting"; +import {useAppInject} from "/@/hooks/web/useAppInject"; +import {useTabs} from "/@/hooks/web/useTabs"; +import { useRouter } from 'vue-router'; + + +export interface SwitchTenantPatams { + tenantCode: string; + goHome: boolean; + tabCloseAction:String; +} + + + export function useTenantManager() { + const { getShowTopMenu } = useMenuSetting(); + const router = useRouter(); + const {closeAll, closeOther} = useTabs(router); + const userStore = useUserStore(); + const appStore = useAppStore(); + const permissionStore = usePermissionStore(); + const { getIsMobile } = useAppInject(); + + const toggleLocal= async (param:SwitchTenantPatams)=>{ + appStore.setPageLoadingAction(true); + await changeTenant(param.tenantCode); + permissionStore.setDynamicAddedRoute(false); + await userStore.afterLoginAction(param.goHome); + let tabCloseAction = param.tabCloseAction; + + if (tabCloseAction == 'closeAll') { + closeAll(); + } else if (tabCloseAction == 'closeOther') { + closeOther(); + } + await setupRouterGuard(router); + await permissionStore.changeSubsystem(getShowTopMenu.value, getIsMobile.value); + if (permissionStore.getSubSysList.length > 0) { + permissionStore.setSubSystem(permissionStore.getSubSysList[0].id); + } else { + permissionStore.setSubSystem(""); + } + } + return {toggleLocal } +} + diff --git a/src/views/form/design/components/BasicConfigStep.vue b/src/views/form/design/components/BasicConfigStep.vue index 1893dc5..687a73e 100644 --- a/src/views/form/design/components/BasicConfigStep.vue +++ b/src/views/form/design/components/BasicConfigStep.vue @@ -397,7 +397,6 @@ rtSchema.push(item); } } - // alert("xx"+customFormConfig.formType); return rtSchema; }; diff --git a/src/views/form/design/components/components/CodeFirstModal.vue b/src/views/form/design/components/components/CodeFirstModal.vue index 2c51ab2..be94543 100644 --- a/src/views/form/design/components/components/CodeFirstModal.vue +++ b/src/views/form/design/components/components/CodeFirstModal.vue @@ -67,6 +67,7 @@ import { FormJson } from '/@/model/generator/codeGenerator'; import { FormEventColumnConfig } from '/@/model/generator/formEventConfig'; import { changeCompsApiConfig, changeEventApiConfig, getMainTable } from '/@/utils/event/design'; + import {ListConfig} from "/@/model/generator/listConfig"; const { t } = useI18n(); const current = ref(0); @@ -149,7 +150,7 @@ customFormConfig.category = data.category; customFormConfig.formDesignType = data.formDesignType; customFormConfig.formJson = JSON.parse(data.formJson); - customFormConfig.listConfig = JSON.parse(data.listConfig); + customFormConfig.listConfig = JSON.parse(data.listConfig)||{} as ListConfig; customFormConfig.renderConfig =data.renderConfig; customFormConfig.remark = data.remark; diff --git a/src/views/form/design/components/components/DataFirstModal.vue b/src/views/form/design/components/components/DataFirstModal.vue index 76cf3d1..7129676 100644 --- a/src/views/form/design/components/components/DataFirstModal.vue +++ b/src/views/form/design/components/components/DataFirstModal.vue @@ -54,6 +54,7 @@ import { useI18n } from '/@/hooks/web/useI18n'; import DesignLogo from '/@/components/ModalPanel/src/DesignLogo.vue'; import useGlobalFlag from '/@/hooks/core/useGlobalFlag'; + import {ListConfig} from "/@/model/generator/listConfig"; const { t } = useI18n(); const current = ref(0); @@ -137,7 +138,7 @@ customFormConfig.category = data.category; customFormConfig.formDesignType = data.formDesignType; customFormConfig.formJson = JSON.parse(data.formJson); - customFormConfig.listConfig = JSON.parse(data.listConfig); + customFormConfig.listConfig = JSON.parse(data.listConfig)||{} as ListConfig; customFormConfig.renderConfig =data.renderConfig; customFormConfig.remark = data.remark; diff --git a/src/views/form/design/components/components/SimpleTemplateModal.vue b/src/views/form/design/components/components/SimpleTemplateModal.vue index 23e5013..21de87a 100644 --- a/src/views/form/design/components/components/SimpleTemplateModal.vue +++ b/src/views/form/design/components/components/SimpleTemplateModal.vue @@ -54,6 +54,7 @@ import { useI18n } from '/@/hooks/web/useI18n'; import { useModal } from '/@/components/Modal'; import DesignLogo from '/@/components/ModalPanel/src/DesignLogo.vue'; + import {ListConfig} from "/@/model/generator/listConfig"; const { t } = useI18n(); const current = ref(0); @@ -148,7 +149,7 @@ customFormConfig.category = data.category; customFormConfig.formDesignType = data.formDesignType; customFormConfig.formJson = JSON.parse(data.formJson); - customFormConfig.listConfig = JSON.parse(data.listConfig); + customFormConfig.listConfig = JSON.parse(data.listConfig)||{} as ListConfig; customFormConfig.renderConfig =data.renderConfig; customFormConfig.remark = data.remark; diff --git a/src/views/form/design/index.vue b/src/views/form/design/index.vue index ad10d2a..1c0260b 100644 --- a/src/views/form/design/index.vue +++ b/src/views/form/design/index.vue @@ -2,97 +2,10 @@ -
-
- -
- - - - -
+
-
-
- -
- - - - -
+
@@ -126,13 +39,7 @@
diff --git a/src/views/form/design/tabpanes/ZeroCodeTypeTabPane.vue b/src/views/form/design/tabpanes/ZeroCodeTypeTabPane.vue new file mode 100644 index 0000000..85543b0 --- /dev/null +++ b/src/views/form/design/tabpanes/ZeroCodeTypeTabPane.vue @@ -0,0 +1,356 @@ + + + + + diff --git a/src/views/secondDev/LoginForm.vue b/src/views/secondDev/LoginForm.vue index 4713cf4..67ecfc7 100644 --- a/src/views/secondDev/LoginForm.vue +++ b/src/views/secondDev/LoginForm.vue @@ -34,7 +34,7 @@ - +
查看导入日志
- + 租户模式导入 @@ -51,6 +51,7 @@ import { useI18n } from '/@/hooks/web/useI18n'; import ImportSystemConfig from './ImportSystemConfig.vue'; import { getLogList,getLogDetails} from '/@/api/system/dataMigration'; + import {getAppEnvConfig} from "/@/utils/env"; const { t } = useI18n(); diff --git a/src/views/workflow/task/components/processTasks/ToDoTasksV2.vue b/src/views/workflow/task/components/processTasks/ToDoTasksV2.vue index baf259c..95b90ed 100644 --- a/src/views/workflow/task/components/processTasks/ToDoTasksV2.vue +++ b/src/views/workflow/task/components/processTasks/ToDoTasksV2.vue @@ -37,24 +37,13 @@ import { storeToRefs } from 'pinia'; import { useUserStore } from '/@/store/modules/user'; import {useMessage} from "/@/hooks/web/useMessage"; - import { changeTenant } from '/@/api/system/tenant'; - import {useAppStore} from "/@/store/modules/app"; - import {setupRouterGuard} from "/@/router/guard"; - import {usePermissionStore} from "/@/store/modules/permission"; - import {useTabs} from "/@/hooks/web/useTabs"; - import {useMenuSetting} from "/@/hooks/setting/useMenuSetting"; - import {useAppInject} from "/@/hooks/web/useAppInject"; + import {useTenantManager} from "/@/utils/tenantManager"; const router = useRouter(); const { currentRoute } = router; const { t } = useI18n(); - const appStore = useAppStore(); const userStore = useUserStore(); const { userInfo } = storeToRefs(userStore); - const { closeOther } = useTabs(router); - const permissionStore = usePermissionStore(); - const { getShowTopMenu } = useMenuSetting(); - const { getIsMobile } = useAppInject(); const configColumns: BasicColumn[] = [ @@ -135,6 +124,8 @@ } }); + const {toggleLocal}=useTenantManager(); + onMounted(() => { bus.on(FLOW_PROCESSED, onFlowProcessed); }); @@ -151,7 +142,7 @@ ); const onRowDblClick = (record, index) => { const {tenantId,tenantCode,tenantName} = record; - let tenantEnabled=getAppEnvConfig().VITE_TENANT_ENABLED; + let tenantEnabled=getAppEnvConfig().VITE_GLOB_TENANT_ENABLED; if(tenantEnabled =='true'&&tenantId){ let currentTenantId=userInfo.value.tenantId; if(tenantId!=currentTenantId){ @@ -166,7 +157,7 @@ ]), width:'600px', onOk: async () => { - toggleLocale(tenantCode).then(()=>{ + switchTenant(tenantCode).then(()=>{ openDetailPage(record,true); }) @@ -206,19 +197,8 @@ reload(); } - async function toggleLocale(tenantCode: string) { - appStore.setPageLoadingAction(true); - await changeTenant(tenantCode); - permissionStore.setDynamicAddedRoute(false); - await userStore.afterLoginAction(false); - closeOther(); - await setupRouterGuard(router); - await permissionStore.changeSubsystem(getShowTopMenu.value, getIsMobile.value); - if(permissionStore.getSubSysList.length>0){ - permissionStore.setSubSystem(permissionStore.getSubSysList[0].id); - }else{ - permissionStore.setSubSystem(""); - } + async function switchTenant(tenantCode: string) { + await toggleLocal({tenantCode:tenantCode, goHome:false,tabCloseAction:"closeOther"}); }