Kaynağa Gözat

首页后台接口对接

songxy 1 yıl önce
ebeveyn
işleme
c1943ef04f

+ 2 - 4
client/src/App.vue

@@ -3,6 +3,7 @@ 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' })
@@ -19,10 +20,7 @@ const keys: string[] = Object.keys(LinkRouteMap)
 const eKeys: string[] = keys.map((key) => LinkRouteMap[key]['path'])
 eKeys.forEach((eKey) => {
   subscribe.on(eKey, (payload) => {
-    router.push({
-      name: eKey,
-      query: payload
-    })
+    IFrameRoute.push(eKey, payload)(router)
   })
 })
 </script>

+ 5 - 0
client/src/api/oa/staffRecords/index.ts

@@ -23,3 +23,8 @@ export const editRecordsDetail = (params) => {
 export const generateStaffNum = () => {
   return request.post({ url: '/adm/staff-records/generateNum' })
 }
+
+//首页项目工作量统计
+export const reportWorkloadStatistics = (params) => {
+  return request.get({ url: '/adm/reportWorkloadStatistics/index', params })
+}

+ 0 - 1
client/src/main.ts

@@ -43,7 +43,6 @@ import App from './App.vue'
 
 import './permission'
 
-import '@/plugins/tongji' // 百度统计
 import Logger from '@/utils/Logger'
 import subscribe from '@/utils/Subscribe'
 

+ 0 - 23
client/src/plugins/tongji/index.ts

@@ -1,23 +0,0 @@
-import router from '@/router'
-
-// 用于 router push
-window._hmt = window._hmt || []
-// HM_ID
-const HM_ID = import.meta.env.VITE_APP_BAIDU_CODE
-;(function () {
-  // 有值的时候,才开启
-  if (!HM_ID) {
-    return
-  }
-  const hm = document.createElement('script')
-  hm.src = 'https://hm.baidu.com/hm.js?' + HM_ID
-  const s = document.getElementsByTagName('script')[0]
-  s.parentNode.insertBefore(hm, s)
-})()
-
-router.afterEach(function (to) {
-  if (!HM_ID) {
-    return
-  }
-  _hmt.push(['_trackPageview', to.fullPath])
-})

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

@@ -91,7 +91,7 @@ const remainingRouter: AppRouteRecordRaw[] = [
       {
         path: 'mainOfficeCenter',
         component: () => import('@/views/OaSystem/officeCenter/main/index.vue'),
-        name: 'mainOfficeCenter',
+        name: 'MainOfficeCenter',
         meta: {
           title: '办件中心'
         }

+ 4 - 6
client/src/store/modules/tagsView.ts

@@ -1,4 +1,3 @@
-import router from '@/router'
 import type { RouteLocationNormalizedLoaded } from 'vue-router'
 import { getRawRoute } from '@/utils/routerHelper'
 import { defineStore } from 'pinia'
@@ -81,7 +80,7 @@ export const useTagsViewStore = defineStore('tagsView', () => {
   // 删除某个
   const delView = (view: RouteLocationNormalizedLoaded): void => {
     delVisitedView(view)
-    delCachedView()
+    delCachedView(view)
   }
 
   // 删除tag
@@ -95,18 +94,17 @@ export const useTagsViewStore = defineStore('tagsView', () => {
   }
 
   // 删除缓存
-  const delCachedView = (): void => {
-    const route = router.currentRoute.value
+  const delCachedView = (view: RouteLocationNormalizedLoaded): void => {
+    const route = view
     const index = findIndex<string>(unref(getCachedViews), (v) => v === route.name)
     if (index > -1) {
       cachedViews.value.delete(unref(getCachedViews)[index])
     }
   }
-
   // 删除所有缓存和tag
   const delAllViews = (): void => {
     delAllVisitedViews()
-    delCachedView()
+    cachedViews.value.clear()
   }
 
   // 删除所有tag,返回固定tags

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

@@ -251,3 +251,20 @@ 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
+        }
+      })
+    }
+  }
+}

+ 1 - 1
client/src/views/OaSystem/home/common.scss

@@ -92,7 +92,7 @@
     text-align: center;
     border: 1px solid #fff;
     border-radius: 4px;
-
+    cursor: pointer;
     &.checked {
       color: #2e77e6;
       border: 1px solid #2e77e6;

+ 76 - 29
client/src/views/OaSystem/home/components/TimeChart.vue

@@ -1,47 +1,85 @@
 <script setup lang="ts">
+import moment from 'moment'
 import CardTitle from './CardTitle.vue'
 import MyEchart from '@/components/Echart/src/Echart.vue'
 import { EChartsOption } from 'echarts'
+import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
+import { reportWorkloadStatistics } from '@/api/oa/staffRecords'
 
 /**
  * 普通员工-项目时间分布
  */
-const chartData = [
-  { value: 20, name: '浙地智用' },
-  { value: 18, name: '要素一本账' },
-  { value: 32, name: '苏地慧管' },
-  { value: 30, name: '兴化工业云图' }
-]
+const chartData = ref<
+  {
+    name: string
+    value: number
+  }[]
+>([])
 
 const colorPalette = ['#5FA5F8', '#45CCF6', '#F9A527', '#05CE9E']
 
-const options = {
-  series: [
-    {
-      name: '月度',
-      type: 'pie',
-      radius: [15, '80%'],
-      center: ['50%', '50%'],
-      roseType: 'area',
-      color: colorPalette,
-      label: {
-        show: false
-      },
-      itemStyle: {
-        borderRadius: 0
-      },
-      data: chartData
+const options = ref<EChartsOption>({})
+
+const { wsCache } = useCache()
+const user = wsCache.get(CACHE_KEY.USER)
+const currentIndex = ref<number>(0)
+const userId = user.user.id // 当前登录的编号
+const queryReportWorkloadStatistics = async (index: number): Promise<void> => {
+  const params = {
+    userId: userId,
+    startDate: moment()
+      .startOf(index === 0 ? 'months' : index === 1 ? 'quarter' : 'year')
+      .format('YYYY-MM-DD'),
+    endDate: moment()
+      .endOf(index === 0 ? 'months' : index === 1 ? 'quarter' : 'year')
+      .format('YYYY-MM-DD')
+  }
+  const result = await reportWorkloadStatistics(params)
+  chartData.value = result.map((item) => {
+    return {
+      name: item['xmmc'],
+      value: item['workTime']
     }
-  ]
-} as EChartsOption
+  })
+  options.value = {
+    series: [
+      {
+        name: '月度',
+        type: 'pie',
+        radius: [15, '80%'],
+        center: ['50%', '50%'],
+        roseType: 'area',
+        color: colorPalette,
+        label: {
+          show: false
+        },
+        itemStyle: {
+          borderRadius: 0
+        },
+        data: chartData.value
+      }
+    ]
+  }
+}
+queryReportWorkloadStatistics(0)
+const switchReportWorkloadStatistics = (index: number) => {
+  currentIndex.value = index
+  queryReportWorkloadStatistics(index)
+}
 </script>
 <template>
   <CardTitle title="项目工时分布统计">
     <template #rightTitle>
       <span class="title-types">
-        <span class="checked">本月</span>
-        <span>季度</span>
-        <span>年度</span>
+        <span :class="{ checked: currentIndex === 0 }" @click="switchReportWorkloadStatistics(0)">
+          本月
+        </span>
+        <span :class="{ checked: currentIndex === 1 }" @click="switchReportWorkloadStatistics(1)">
+          季度
+        </span>
+        <span :class="{ checked: currentIndex === 2 }" @click="switchReportWorkloadStatistics(2)">
+          年度
+        </span>
       </span>
     </template>
   </CardTitle>
@@ -52,7 +90,9 @@ const options = {
     <div style="display: flex; width: 50%; align-items: center">
       <ul class="time-list">
         <li v-for="(item, index) in chartData" :key="index">
-          <span><i :style="`background: ${colorPalette[index]};`"></i>{{ item.name }}</span>
+          <span class="title" :title="item.name"
+            ><i :style="`background: ${colorPalette[index]};`"></i>{{ item.name }}</span
+          >
           <span>{{ item.value }}小时</span>
         </li>
       </ul>
@@ -75,7 +115,14 @@ const options = {
       font-size: 14px;
       font-weight: 400;
       color: #000000;
-
+      &.title {
+        display: inline-block;
+        width: 160px;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
+        margin-right: 10px;
+      }
       i {
         display: inline-block;
         width: 6px;

+ 1 - 1
client/src/views/OaSystem/home/index.vue

@@ -41,7 +41,7 @@ const roles = userStore.getRoles
 if (roles) {
   if (roles.indexOf('test_leader') != -1 || roles.indexOf('test_dept_manager') != -1) {
     //板块领导||部门经理
-    currentIndex.value = '2'
+    currentIndex.value = '1'
   } else {
     //普通员工
     currentIndex.value = '2'

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

@@ -18,15 +18,15 @@
         />
       </div>
       <div class="form">
-        <span class="formSpan">合同类型:</span>
+        <span class="formSpan">申请类型:</span>
         <el-select
           v-model="queryParams.applyType"
           placeholder="请选择合同类型"
           style="width: 160px"
         >
           <el-option label="全部" :value="-1" />
-          <el-option label="分包合同" :value="1" />
-          <el-option label="外包合同" :value="2" />
+          <el-option label="分包申请" :value="1" />
+          <el-option label="外包申请" :value="2" />
         </el-select>
       </div>
       <div class="from">
@@ -95,7 +95,7 @@
             width="150"
           >
             <template #default="scope">{{
-              scope.row.applyType === 1 ? '分包合同' : scope.row.applyType === 2 ? '外包合同' : ''
+              scope.row.applyType === 1 ? '分包申请' : scope.row.applyType === 2 ? '外包申请' : ''
             }}</template>
           </el-table-column>
           <el-table-column prop="applyDate" label="申请时间" width="160" />

+ 23 - 14
client/src/views/OaSystem/oaLayout/index.vue

@@ -17,13 +17,16 @@
         <TagList />
       </div>
       <div class="layout-content">
-        <router-view>
-          <template #default="{ Component, route }">
-            <keep-alive :include="getCaches">
-              <component :is="Component" :key="route.fullPath" />
-            </keep-alive>
-          </template>
-        </router-view>
+        <template v-if="iframeViews.length > 0 && currentIframe"> </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>
     </div>
   </div>
@@ -34,18 +37,24 @@ import Header from './header.vue'
 import TagList from './tagList.vue'
 import Menus from './menus.vue'
 
+defineOptions({ name: 'Layout' })
+
 const tagsViewStore = useTagsViewStore()
 
+const iframeViews = ref<any[]>([])
+const currentIframe = ref<string>()
+
 const getCaches = computed((): string[] => {
-  console.log('waadsfa--------------')
-  console.log(tagsViewStore.getCachedViews)
+  // iframeViews.value = filterIframe(tagsViewStore.visitedViews)
   return tagsViewStore.getCachedViews
 })
-
-defineOptions({ name: 'Layout' })
-
-/** 初始化 **/
-onMounted(() => {})
+const filterIframe = (arr): any[] => {
+  return arr.filter((item) => {
+    if (item && item.query && item.query.iframe == '1') {
+      return item.query.iframe == '1'
+    }
+  })
+}
 </script>
 <style>
 @import url('./content.scss');

+ 5 - 6
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="toPageHandle('MainOfficeCenter')">
         <img src="@/assets/imgs/OA/bjzx_icon.png" alt="" />
         <p>办件中心</p>
         <div class="tip" v-show="attendCount > 0">{{ attendCount }}</div>
@@ -54,13 +54,14 @@ 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()
 
 const { wsCache } = useCache()
 
-const { push, replace, currentRoute } = useRouter()
+const { push, replace } = useRouter()
 const router = useRouter()
 const userStore = useUserStore()
 const tagsViewStore = useTagsViewStore()
@@ -144,10 +145,8 @@ const handleMouseEnter = (item: any, index: any) => {
     mouseenterIndex.value = -1
   }
 }
-const toPageHandle: (path: string) => void = (path: string) => {
-  push({
-    path
-  })
+const toPageHandle = (name: string) => {
+  IFrameRoute.push(name)(router)
 }
 const handleMouseLeave = (item: any, index: any) => {
   mouseenterIndex.value = -1

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

@@ -233,6 +233,7 @@ const addTags = () => {
   if (name) {
     selectedTag.value = unref(currentRoute)
     tagsViewStore.addView(unref(currentRoute))
+    tagsViewStore.addCachedView()
   }
   nextTick(() => {
     // 当前选择路由滚入视野

+ 1 - 1
client/src/views/OaSystem/officeCenter/gdzccgsqPage/deptPurchase.vue

@@ -120,7 +120,7 @@ import moment from 'moment'
 import { useRouter } from 'vue-router'
 import request from '@/config/axios'
 import * as DeptApi from '@/api/system/dept'
-import { defaultProps, handleTree } from '@/utils/tree'
+import { handleTree } from '@/utils/tree'
 import { arrFlatten } from '../../attendanceCenter/attendAuth'
 import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
 import TableLayout from '../../oaViews/layout/TableLayout.vue'