Explorar o código

iframe刷新方案解决

songxy hai 1 ano
pai
achega
9e9a94bd08

+ 5 - 1
client/src/service/contract.ts

@@ -243,7 +243,11 @@ export const startContractInvoice = async (contractId?: string) => {
  * 发起用款申请流程
  * @param contractId
  */
-export const startUseMoney = async (payload: { projectId?: string; supplierId?: string }) => {
+export const startUseMoney = async (payload: {
+  projectId?: string
+  contractId?: string
+  supplierId?: string
+}) => {
   return await request.get(
     {
       url: '/UseMoney/contractProcess',

+ 7 - 0
client/src/utils/flow.ts

@@ -26,6 +26,7 @@ export const openProcessFlow = async (
   options?: {
     title: string
     routePath?: string
+    noisy?: string
   },
   query?: string
 ) => {
@@ -40,9 +41,15 @@ export const openProcessFlow = async (
     ElMessage.error('未查询到相关数据')
     return
   }
+  let iFrameId: string = instanceId
+  if (options?.noisy) {
+    iFrameId += '-' + options?.noisy
+  }
   router.push({
     path: options?.routePath ?? '/processContainer',
     query: {
+      iframe: '1',
+      iFrameId: iFrameId,
       url: query ? flowUrl + query : flowUrl,
       title: options?.title ?? '流程查看'
     }

+ 2 - 1
client/src/views/OaSystem/financialManagement/kpglPage/index.vue

@@ -341,7 +341,8 @@ const processHandler = async (row: any, query?: string) => {
     router,
     row.instanceId,
     {
-      title: query ? '回款登记' : '查看流程'
+      title: query ? '回款登记' : '查看流程',
+      noisy: query ? '1' : '2'
     },
     query
   )

+ 8 - 1
client/src/views/OaSystem/mineCenter/components/leftInfo.vue

@@ -41,7 +41,13 @@
               <p v-if="item.type === 'time'">{{
                 dateFormatter2(null, null, data?.[item.value])
               }}</p>
-              <p v-else>{{ data?.[item.value] }}</p>
+              <p v-else>
+                {{
+                  item.value === 'drzw'
+                    ? getDictLabel(DICT_TYPE.POST_TYPE, data?.[item.value])
+                    : data?.[item.value]
+                }}
+              </p>
             </div>
           </li>
         </ul>
@@ -63,6 +69,7 @@ import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
 import { useQuery } from '@tanstack/vue-query'
 import { getRecordsDetail } from '@/api/oa/staffRecords'
 import { dateFormatter2 } from '@/utils/formatTime'
+import { DICT_TYPE, getDictLabel } from '@/utils/dict'
 
 const { wsCache } = useCache()
 const user = wsCache.get(CACHE_KEY.USER)

+ 55 - 30
client/src/views/OaSystem/oaLayout/index.vue

@@ -1,13 +1,5 @@
 <template>
   <div class="_layout">
-    <!-- <Header />
-    <div class="tagBoss">
-      <TagList />
-    </div>
-    <div class="_content">
-      <router-view />
-    </div> -->
-
     <div class="layout-left">
       <Menus />
     </div>
@@ -16,19 +8,22 @@
         <Header />
         <TagList />
       </div>
-      <div class="layout-content">
-        <template v-if="iframeViews.length > 0 && currentIframe">
-          <component v-for="(item, index) in iframeViews" :key="index" :is="item['name']" />
-        </template>
-        <template v-else>
-          <router-view>
-            <template #default="{ Component, route }">
-              <keep-alive :include="getCaches">
-                <component :is="Component" :key="route.fullPath" />
-              </keep-alive>
-            </template>
-          </router-view>
-        </template>
+      <div class="layout-content" v-show="isFrameView">
+        <iframe
+          v-show="currentIframeId === item['query']['iFrameId']"
+          v-for="(item, index) in iframeViews"
+          :key="index"
+          :src="item['query']['url']"
+        ></iframe>
+      </div>
+      <div class="layout-content" v-show="!isFrameView">
+        <router-view>
+          <template #default="{ Component, route }">
+            <keep-alive :include="getCaches">
+              <component :is="Component" :key="route.fullPath" />
+            </keep-alive>
+          </template>
+        </router-view>
       </div>
     </div>
   </div>
@@ -38,23 +33,18 @@ import { useTagsViewStore } from '@/store/modules/tagsView'
 import Header from './header.vue'
 import TagList from './tagList.vue'
 import Menus from './menus.vue'
+import subscribe from '@/utils/Subscribe'
 
 defineOptions({ name: 'Layout' })
 
 const tagsViewStore = useTagsViewStore()
 
+const route = useRoute()
+const isFrameView = ref<boolean>(false)
 const iframeViews = ref<any[]>([])
-const currentIframe = ref<string>()
+const currentIframeId = ref<string>('')
 
-const { name } = useRoute()
 const getCaches = computed((): string[] => {
-  console.log('tagsViewStore------------------')
-  console.log(tagsViewStore.visitedViews, name)
-  iframeViews.value = filterIframe(tagsViewStore.visitedViews)
-  const arr = iframeViews.value.filter((item) => item.name === name)
-  currentIframe.value = arr[0]
-  console.log('currentIframe------------------')
-  console.log(arr)
   return tagsViewStore.getCachedViews
 })
 const filterIframe = (arr): any[] => {
@@ -64,6 +54,35 @@ const filterIframe = (arr): any[] => {
     }
   })
 }
+
+subscribe.on('update:tagsView', () => {
+  isFrameView.value = route.query.iframe === '1' ? true : false
+  nextTick(() => {
+    iframeViews.value = filterIframe(tagsViewStore.visitedViews)
+    if (!route.query.iframe) {
+      currentIframeId.value = ''
+    } else {
+      currentIframeId.value = route.query.iFrameId as string
+    }
+  })
+})
+watch(
+  () => route.query,
+  () => {
+    isFrameView.value = route.query.iframe === '1' ? true : false
+    nextTick(() => {
+      iframeViews.value = filterIframe(tagsViewStore.visitedViews)
+      if (!route.query.iframe) {
+        currentIframeId.value = ''
+      } else {
+        currentIframeId.value = route.query.iFrameId as string
+      }
+    })
+  },
+  {
+    immediate: true
+  }
+)
 </script>
 <style>
 @import url('./content.scss');
@@ -114,4 +133,10 @@ ul,
 li {
   box-sizing: border-box;
 }
+
+iframe {
+  width: 100%;
+  height: 100%;
+  border: 0px;
+}
 </style>

+ 10 - 4
client/src/views/OaSystem/oaLayout/menus.vue

@@ -16,7 +16,7 @@
       </div>
     </div>
     <div class="menus-btns">
-      <div class="btn" @click="toPageHandle('MainOfficeCenter')">
+      <div class="btn" @click="toMainOfficeCenter()">
         <img src="@/assets/imgs/OA/bjzx_icon.png" alt="" />
         <p>办件中心</p>
         <div class="tip" v-show="attendCount > 0">{{ attendCount }}</div>
@@ -54,7 +54,6 @@ import MenusActive from './menusActive.vue'
 import { useQuery } from '@tanstack/vue-query'
 import { getRecordsDetail } from '@/api/oa/staffRecords'
 import { getAttendCount } from '@/api/oa/index'
-import { IFrameRoute } from '@/utils/routerHelper'
 
 defineOptions({ name: 'Header' })
 const { t } = useI18n()
@@ -145,8 +144,15 @@ const handleMouseEnter = (item: any, index: any) => {
     mouseenterIndex.value = -1
   }
 }
-const toPageHandle = (name: string) => {
-  push(name)
+const toMainOfficeCenter = () => {
+  push({
+    path: '/mainOfficeCenter',
+    query: {
+      iframe: '1',
+      url: 'http://10.10.10.7:18080/workflow/HandlerCaseCenter/index',
+      iFrameId: 'mainOfficeCenter_001'
+    }
+  })
 }
 const handleMouseLeave = (item: any, index: any) => {
   mouseenterIndex.value = -1

+ 15 - 10
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(item)
+              //   }
+              // },
               {
                 icon: 'ep:close',
                 label: t('common.closeTab'),
@@ -153,7 +153,7 @@ const { getPrefixCls } = useDesign()
 const prefixCls = getPrefixCls('tags-view')
 const { t } = useI18n()
 const selectedTag = ref<RouteLocationNormalizedLoaded>()
-const { currentRoute, push, replace } = useRouter()
+const { currentRoute, push, replace, go } = useRouter()
 const permissionStore = usePermissionStore()
 const routers = computed(() => permissionStore.getRouters)
 const tagsViewStore = useTagsViewStore()
@@ -203,12 +203,13 @@ const visibleChange = (visible: boolean, tagItem: RouteLocationNormalizedLoaded)
 // 关闭其它
 const closeOthersTags = () => {
   tagsViewStore.delOthersViews(unref(selectedTag) as RouteLocationNormalizedLoaded)
+  subscribe.emit('update:tagsView', null)
 }
 
 // 重新加载
 const refreshSelectedTag = async (view?: RouteLocationNormalizedLoaded) => {
   if (!view) return
-  tagsViewStore.delCachedView()
+  tagsViewStore.delCachedView(view)
   const { path, query } = view
   await nextTick()
   replace({
@@ -220,11 +221,13 @@ const refreshSelectedTag = async (view?: RouteLocationNormalizedLoaded) => {
 // 关闭左侧
 const closeLeftTags = () => {
   tagsViewStore.delLeftViews(unref(selectedTag) as RouteLocationNormalizedLoaded)
+  subscribe.emit('update:tagsView', null)
 }
 
 // 关闭右侧
 const closeRightTags = () => {
   tagsViewStore.delRightViews(unref(selectedTag) as RouteLocationNormalizedLoaded)
+  subscribe.emit('update:tagsView', null)
 }
 
 // 新增tag
@@ -257,6 +260,8 @@ const closeSelectedTag = (view: RouteLocationNormalizedLoaded) => {
   tagsViewStore.delView(view)
   if (isActive(view)) {
     toLastView()
+  } else {
+    subscribe.emit('update:tagsView', null)
   }
 }
 

+ 13 - 6
client/src/views/OaSystem/projectCenter/projectDetail/components/xmht/index.vue

@@ -57,8 +57,9 @@
                   projectId: mContractDetail?.projectId
                 })
               "
-              >用款申请</li
             >
+              用款申请
+            </li>
             <li
               v-if="
                 projectPermis.projectPermisState.all || projectPermis.projectPermisState.xsLeader
@@ -386,17 +387,23 @@
         <div class="tableBox tableBox—first">
           <h4><i class="icon"></i>基本信息</h4>
           <ul>
-            <li v-if="editor === false" @click="handleEditor">编辑合同</li>
-            <li v-else @click="saveContractHandle">保存合同</li>
+            <li v-if="roles.indexOf('contract_edit') !== -1" @click="handleEditor">
+              {{ editor ? '保存' : '编辑' }}合同
+            </li>
             <li
+              v-if="
+                projectPermis.projectPermisState.all || projectPermis.projectPermisState.xsLeader
+              "
               @click="
                 startUseMoneyMuate({
                   projectId: mContractDetail?.projectId,
-                  supplierId: cContractDetail?.clientId
+                  contractId: cContractDetail.contractId,
+                  supplierId: cContractDetail.supplierId
                 })
               "
-              >用款申请</li
             >
+              用款申请
+            </li>
           </ul>
           <table v-if="cContractDetail?.contractType == 2">
             <tr>
@@ -670,7 +677,7 @@ const switchContractInfo = (key: number, type: string): void => {
 }
 
 const saveContractHandle = () => {
-  if (contractInfoIndex.value === 0) {
+  if (contractMainType.value === 'main') {
     //主合同
     saveContract(mContractDetail.value)
   } else {