From 499c7be95823c4150466ae413d8a76695804002a Mon Sep 17 00:00:00 2001 From: suguangxu <274928232@qq.com> Date: Thu, 22 May 2025 16:42:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=85=E5=8A=9E=E5=88=97=E8=A1=A8=E8=B7=A8?= =?UTF-8?q?=E7=A7=9F=E6=88=B7=E5=AE=A1=E6=89=B9=E5=8A=9F=E8=83=BD=E5=BC=80?= =?UTF-8?q?=E5=8F=91=EF=BC=9A=20=20=20=20=E5=90=8E=E7=AB=AF=E8=BF=94?= =?UTF-8?q?=E5=9B=9Etenant=E4=BF=A1=E6=81=AF=E8=B7=9F=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E7=9A=84tenant=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=AF=94=E8=BE=83=EF=BC=8C=E5=A6=82=E6=9E=9C=E4=B8=8D?= =?UTF-8?q?=E4=B8=80=E8=87=B4=EF=BC=8C=E5=88=99=E5=BC=B9=E5=87=BA=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E6=A1=86=E6=8F=90=E7=A4=BA=E7=94=A8=E6=88=B7=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E7=A7=9F=E6=88=B7=EF=BC=8C=E7=82=B9=E5=87=BB=E7=A1=AE?= =?UTF-8?q?=E8=AE=A4=E5=90=8E=E5=AE=8C=E6=88=90=E7=A7=9F=E6=88=B7=E5=88=87?= =?UTF-8?q?=E6=8D=A2=EF=BC=8C=E5=BC=B9=E5=87=BA=E5=88=87=E6=8D=A2=E7=A7=9F?= =?UTF-8?q?=E6=88=B7=E6=88=90=E5=8A=9F=E7=9A=84=E9=80=9A=E7=9F=A5=EF=BC=8C?= =?UTF-8?q?=E7=84=B6=E5=90=8E=E8=BF=9B=E5=85=A5=E5=AE=A1=E6=89=B9=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/processTasks/ToDoTasksV2.vue | 89 +++++++++++++++++-- 1 file changed, 83 insertions(+), 6 deletions(-) diff --git a/src/views/workflow/task/components/processTasks/ToDoTasksV2.vue b/src/views/workflow/task/components/processTasks/ToDoTasksV2.vue index fa51d09..f54ab21 100644 --- a/src/views/workflow/task/components/processTasks/ToDoTasksV2.vue +++ b/src/views/workflow/task/components/processTasks/ToDoTasksV2.vue @@ -30,11 +30,33 @@ import { getSchemaTask } from '/@/api/workflow/process'; import { TaskTypeUrl } from '/@/enums/workflowEnum'; import { useI18n } from '/@/hooks/web/useI18n'; - import { unref, watch, onMounted, onUnmounted } from 'vue'; + import { unref, watch, onMounted, onUnmounted ,h} from 'vue'; import { useRouter } from 'vue-router'; import useEventBus from '/@/hooks/event/useEventBus'; + import { getAppEnvConfig } from '/@/utils/env'; + 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"; + const router = useRouter(); + const { currentRoute } = router; const { t } = useI18n(); + const appStore = useAppStore(); + const userStore = useUserStore(); + const { userInfo } = storeToRefs(userStore); + const { closeAll } = useTabs(router); + const permissionStore = usePermissionStore(); + const { getShowTopMenu } = useMenuSetting(); + const { getIsMobile } = useAppInject(); + + const configColumns: BasicColumn[] = [ { title: t('流水号'), @@ -112,9 +134,6 @@ setting: false } }); - const router = useRouter(); - const { currentRoute } = router; - onMounted(() => { bus.on(FLOW_PROCESSED, onFlowProcessed); @@ -131,18 +150,76 @@ { deep: true } ); const onRowDblClick = (record, index) => { - const { processId, taskId, schemaId } = record; + const {tenantId,tenantCode,tenantName} = record; + let tenantEnabled=getAppEnvConfig().VITE_TENANT_ENABLED; + if(tenantEnabled =='true'&&tenantId){ + let currentTenantId=userInfo.value.tenantId; + if(tenantId!=currentTenantId){ + const { createConfirm} = useMessage(); + createConfirm({ + iconType: 'warning', + title: () => h('span', t('温馨提醒')), + content: () => h('div', [ + h('span', t(`当前流程的发起租户是"${tenantName}",需要切换到该租户才能对该流程进行审批`)), + h('br'), + h('span', t('是否确认切换租户?未保存的数据可能会丢失!')) + ]), + width:'600px', + onOk: async () => { + toggleLocale(tenantCode).then(()=>{ + openDetailPage(record,true); + }) + + }, + okText: () => t('确认'), + cancelText: () => t('取消'), + }); + + }else{ + openDetailPage(record); + }; + }else{ + openDetailPage(record); + } + }; + + function openDetailPage(record,isTenantSwitch){ + const { processId, taskId, schemaId} = record; router.push({ path: `/flow/${schemaId}/${processId}/approveFlow`, query: { taskId } + }).then(()=> { + if (isTenantSwitch) { + const {notification} = useMessage(); + const {tenantName} = record; + notification.success({ + message: 'Tip', + description: t('已切换到租户“' + tenantName + '"'), + }); + } }); - }; + } function onFlowProcessed() { reload(); } + + async function toggleLocale(tenantCode: string) { + appStore.setPageLoadingAction(true); + await changeTenant(tenantCode); + 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(""); + } + } +