Browse Source

重新加载功能优化

songxy 1 year ago
parent
commit
a6fd1ad4a0

+ 9 - 2
client/src/App.vue

@@ -3,7 +3,6 @@ import { useAppStore } from '@/store/modules/app'
 import { useDesign } from '@/hooks/web/useDesign'
 import routerSearch from '@/components/RouterSearch/index.vue'
 import subscribe from '@/utils/Subscribe'
-import { IFrameRoute } from '@/utils/routerHelper'
 import LinkRouteMap from './LinkRouteMap'
 
 defineOptions({ name: 'APP' })
@@ -20,7 +19,15 @@ const keys: string[] = Object.keys(LinkRouteMap)
 const eKeys: string[] = keys.map((key) => LinkRouteMap[key]['path'])
 eKeys.forEach((eKey) => {
   subscribe.on(eKey, (payload) => {
-    IFrameRoute.push(eKey, payload)(router)
+    router.push({
+      name: eKey,
+      query: {
+        iframe: '1',
+        iFrameId: payload?.id,
+        url: payload?.url,
+        title: payload?.title
+      }
+    })
   })
 })
 </script>

+ 0 - 1
client/src/AppNews.vue

@@ -55,7 +55,6 @@ const getUrlParams = (url: string) => {
 const query = getUrlParams(location.href) as {
   id: string
 }
-console.log(query)
 if (query.id) {
   queryDetailById(query.id)
   addReadNum(query.id)

+ 1 - 1
client/src/layout/components/TagsView/src/TagsView.vue

@@ -82,7 +82,7 @@ const closeOthersTags = () => {
 // 重新加载
 const refreshSelectedTag = async (view?: RouteLocationNormalizedLoaded) => {
   if (!view) return
-  tagsViewStore.delCachedView()
+  tagsViewStore.delCachedView(view)
   const { path, query } = view
   await nextTick()
   replace({

+ 17 - 1
client/src/router/modules/remaining.ts

@@ -70,6 +70,23 @@ const remainingRouter: AppRouteRecordRaw[] = [
   //     }
   //   ]
   // },
+  {
+    path: '/redirect2',
+    component: OaLayout,
+    name: 'Redirect2',
+    children: [
+      {
+        path: '/redirect2/:path(.*)',
+        name: 'Redirect2',
+        component: () => import('@/views/Redirect/Redirect.vue'),
+        meta: {}
+      }
+    ],
+    meta: {
+      hidden: true,
+      noTagsView: true
+    }
+  },
   {
     path: '/',
     component: OaLayout,
@@ -90,7 +107,6 @@ const remainingRouter: AppRouteRecordRaw[] = [
       },
       {
         path: 'mainOfficeCenter',
-        component: () => import('@/views/OaSystem/officeCenter/main/index.vue'),
         name: 'MainOfficeCenter',
         meta: {
           title: '办件中心'

+ 0 - 17
client/src/utils/routerHelper.ts

@@ -251,20 +251,3 @@ const toCamelCase = (str: string, upperCaseFirst: boolean) => {
 
   return str
 }
-
-/**
- * 封装跳转到iframe路由组件方法
- */
-export const IFrameRoute = {
-  push(name: string, payload?: any): (router: Router) => void {
-    return (router: Router) => {
-      router.push({
-        name,
-        query: {
-          iframe: 1,
-          ...payload
-        }
-      })
-    }
-  }
-}

+ 6 - 4
client/src/views/OaSystem/home/components/TimeChart.vue

@@ -48,10 +48,12 @@ const queryReportWorkloadStatistics = async (index: number): Promise<void> => {
       otherWorkTime += item['workTime']
     }
   })
-  chartData.value.push({
-    name: '其他',
-    value: otherWorkTime
-  })
+  if (otherWorkTime > 0) {
+    chartData.value.push({
+      name: '其他',
+      value: otherWorkTime
+    })
+  }
   options.value = {
     series: [
       {

+ 6 - 1
client/src/views/OaSystem/marketCenter/contractSubOut/applyIndex.vue

@@ -99,7 +99,12 @@
             }}</template>
           </el-table-column>
           <el-table-column prop="applyDate" label="申请时间" width="160" />
-          <el-table-column prop="client" label="供应商" width="160" />
+          <el-table-column
+            prop="supplier"
+            label="供应商"
+            width="200"
+            :show-overflow-tooltip="true"
+          />
           <el-table-column prop="contractAmount" label="申请金额" width="160" />
           <el-table-column prop="payAmount" label="已支付" width="160">
             <template #default="scope">

+ 17 - 5
client/src/views/OaSystem/oaLayout/index.vue

@@ -12,6 +12,7 @@
         <iframe
           v-show="currentIframeId === item['query']['iFrameId']"
           v-for="(item, index) in iframeViews"
+          :id="item['name']"
           :key="index"
           :src="item['query']['url']"
         ></iframe>
@@ -45,7 +46,7 @@ const iframeViews = ref<any[]>([])
 const currentIframeId = ref<string>('')
 
 const getCaches = computed((): string[] => {
-  return tagsViewStore.getCachedViews
+  return Array.from(tagsViewStore.cachedViews)
 })
 const filterIframe = (arr): any[] => {
   return arr.filter((item) => {
@@ -54,7 +55,15 @@ const filterIframe = (arr): any[] => {
     }
   })
 }
-
+subscribe.on('iframe:reload', (view) => {
+  setTimeout(() => {
+    const iframe = document.getElementById(view.name)
+    if (iframe) {
+      //@ts-ignore
+      iframe.src = iframe.src
+    }
+  }, 100)
+})
 subscribe.on('update:tagsView', () => {
   isFrameView.value = route.query.iframe === '1' ? true : false
   nextTick(() => {
@@ -68,16 +77,19 @@ subscribe.on('update:tagsView', () => {
 })
 watch(
   () => route.query,
-  () => {
+  async () => {
     isFrameView.value = route.query.iframe === '1' ? true : false
-    nextTick(() => {
+    await nextTick()
+    //处理办件中心页面坍塌的问题
+    const timeout = setTimeout(() => {
       iframeViews.value = filterIframe(tagsViewStore.visitedViews)
       if (!route.query.iframe) {
         currentIframeId.value = ''
       } else {
         currentIframeId.value = route.query.iFrameId as string
       }
-    })
+      clearTimeout(timeout)
+    }, 200)
   },
   {
     immediate: true

+ 0 - 1
client/src/views/OaSystem/oaLayout/menus.vue

@@ -66,7 +66,6 @@ const userStore = useUserStore()
 const tagsViewStore = useTagsViewStore()
 
 const user = wsCache.get(CACHE_KEY.USER)
-console.log('user: ', user)
 const avatar = user.user.avatar ? user.user.avatar : avatarImg
 
 const userName = user.user.nickname ? user.user.nickname : 'Admin'

+ 14 - 9
client/src/views/OaSystem/oaLayout/tagList.vue

@@ -24,14 +24,14 @@
             :ref="itemRefs.set"
             :id="`router-tag-${item.fullPath}`"
             :schema="[
-              // {
-              //   icon: 'ep:refresh',
-              //   label: t('common.reload'),
-              //   disabled: selectedTag?.fullPath !== item.fullPath,
-              //   command: () => {
-              //     refreshSelectedTag(item)
-              //   }
-              // },
+              {
+                icon: 'ep:refresh',
+                label: t('common.reload'),
+                disabled: selectedTag?.fullPath !== item.fullPath,
+                command: () => {
+                  refreshSelectedTag(selectedTag)
+                }
+              },
               {
                 icon: 'ep:close',
                 label: t('common.closeTab'),
@@ -211,9 +211,14 @@ const refreshSelectedTag = async (view?: RouteLocationNormalizedLoaded) => {
   if (!view) return
   tagsViewStore.delCachedView(view)
   const { path, query } = view
+  const { iframe } = query
   await nextTick()
+  if (iframe === '1') {
+    subscribe.emit('iframe:reload', view)
+    return
+  }
   replace({
-    path: '/redirect' + path,
+    path: '/redirect2' + path,
     query: query
   })
 }

+ 0 - 33
client/src/views/OaSystem/officeCenter/main/index.vue

@@ -1,33 +0,0 @@
-<template>
-  <div class="officeCenterBox">
-    <iframe :src="iframeUrl" loading="lazy"></iframe>
-  </div>
-</template>
-
-<script setup lang="ts">
-defineOptions({
-  name: 'OfficeCenter'
-})
-
-// const iframeUrl: string = 'http://localhost:6090/HandlerCaseCenter/index'
-const iframeUrl: string = 'http://10.10.10.7:18080/workflow/HandlerCaseCenter/index'
-// const iframeUrl: string =
-// 'http://localhost:6010/WorkFlow/index?flowInstanceId=018bbd46bf18087013178bbd3ebd000e&activityInstanceId=018bbd46bf34087013178bbd3ebd0012&_fm=018bb7307083087087e58bb722830009&participant=018bbd46bf4f087013178bbd3ebd0014&first=1&status=1&child=0&sourcewindowid=handlerCaseCenter&userId=dc794fe0-66fe-4b1d-9273-f747950b27c3'
-</script>
-
-<style lang="scss" scoped>
-.officeCenterBox {
-  margin-top: 20px;
-  height: calc(100% - 20px);
-  background-color: #fff;
-  border-radius: 20px;
-  position: relative;
-  text-align: center;
-  overflow: hidden;
-  > iframe {
-    width: 100%;
-    height: 100%;
-    border: 0px;
-  }
-}
-</style>

+ 0 - 1
client/src/views/Redirect/Redirect.vue

@@ -12,7 +12,6 @@ Reflect.deleteProperty(params, '_redirect_type')
 Reflect.deleteProperty(params, 'path')
 
 const _path = Array.isArray(path) ? path.join('/') : path
-
 if (_redirect_type === 'name') {
   replace({
     name: _path,

+ 2 - 2
zjugis-module-infra/zjugis-module-infra-biz/src/main/resources/application-local.yaml

@@ -68,14 +68,14 @@ spring:
 
   # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
   redis:
-    host: 10.10.10.7 # 地址
+    host: 10.10.10.8 # 地址
     password: zdww1402
 #    password: 123456 # 密码,建议生产环境开启
 
 --- #################### MQ 消息队列相关配置 ####################
 spring:
   rabbitmq:
-    host: 10.10.10.7
+    host: 10.10.10.8
     port: 5672
     username: zjww
     password: zjww1402!

+ 2 - 2
zjugis-module-infra/zjugis-module-infra-biz/src/main/resources/bootstrap-local.yaml

@@ -7,7 +7,7 @@ spring:
     nacos:
       server-addr: 10.10.10.7:8848
       discovery:
-        namespace: d62c66f5-9ddc-40e9-9716-65f65557a557 # 命名空间。这里使用 dev 开发环境
+        namespace: b8c5fc93-8b01-491f-b75a-3b99d1e21f42 # 命名空间。这里使用 dev 开发环境
         metadata:
           version: 1.0.0 # 服务实例的版本号,可用于灰度发布
 
@@ -19,7 +19,7 @@ spring:
       # Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
       config:
         server-addr: 10.10.10.7:8848 # Nacos 服务器地址
-        namespace: d62c66f5-9ddc-40e9-9716-65f65557a557 # 命名空间 dev 的ID,不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev,这里使用 dev 开发环境
+        namespace: b8c5fc93-8b01-491f-b75a-3b99d1e21f42 # 命名空间 dev 的ID,不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev,这里使用 dev 开发环境
         group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
         name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId,默认为 spring.application.name
         file-extension: yaml # 使用的 Nacos 配置集的 dataId 的文件拓展名,同时也是 Nacos 配置集的配置格式,默认为 properties