Ver código fonte

Merge branch 'master' of http://114.55.67.98:8070/Natural_p1/zjugis_OA

ljy121 1 ano atrás
pai
commit
8a5940de02

BIN
client/src/assets/imgs/OA/zdww.png


+ 10 - 3
client/src/utils/routerHelper.ts

@@ -19,7 +19,8 @@ export const registerComponent = (componentPath: string) => {
 }
 /* Layout */
 export const Layout = () => import('@/layout/Layout.vue')
-
+/* oaLayout */
+export const OaLayout = () => import('@/views/OaSystem/oaLayout/index.vue')
 export const getParentLayout = () => {
   return () =>
     new Promise((resolve) => {
@@ -63,6 +64,7 @@ export const getRawRoute = (route: RouteLocationNormalized): RouteLocationNormal
 export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecordRaw[] => {
   const res: AppRouteRecordRaw[] = []
   const modulesRoutesKeys = Object.keys(modules)
+
   for (const route of routes) {
     const meta = {
       title: route.name,
@@ -108,8 +110,13 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord
     } else {
       // 目录
       if (route.children) {
-        data.component = Layout
-        data.redirect = getRedirect(route.path, route.children)
+        if (route.path == '/oaSystem') {
+          data.component = OaLayout
+          data.redirect = getRedirect(route.path, route.children)
+        } else {
+          data.component = Layout
+          data.redirect = getRedirect(route.path, route.children)
+        }
         // 外链
       } else if (isUrl(route.path)) {
         data = {

+ 44 - 0
client/src/views/OaSystem/home/index.vue

@@ -0,0 +1,44 @@
+<template>
+  <div class="_home">
+    <ul>
+      <li v-for="(item, index) in reactiveData.routes" :key="index" @click="routeMenuClick(item)">
+        <p>{{ item.name }}</p>
+      </li>
+    </ul>
+  </div>
+</template>
+<script setup lang="ts">
+import { useRouter } from 'vue-router'
+defineOptions({ name: 'Home' })
+
+//routes除去首页外的路由
+const reactiveData: any = reactive({
+  routes: []
+})
+const router = useRouter()
+const initMenus = async () => {
+  let locals: any = localStorage.getItem('roleRouters')
+  let roleRouters = JSON.parse(JSON.parse(locals).v)[0].children
+  roleRouters = JSON.parse(JSON.stringify(roleRouters))
+  reactiveData.routes = roleRouters.slice(1, roleRouters.length)
+}
+const routeMenuClick = async (item: any) => {
+  //跳转路由
+  let c = {}
+  if (item.children) {
+    c = router.resolve({
+      path: item.path + '/' + item.children[0].path
+    })
+  } else {
+    c = router.resolve({
+      path: item.path
+    })
+  }
+
+  window.open(c.href, '_blank')
+}
+/** 初始化 **/
+onMounted(() => {
+  initMenus()
+})
+</script>

+ 199 - 0
client/src/views/OaSystem/oaLayout/header.vue

@@ -0,0 +1,199 @@
+<template>
+  <div class="header">
+    <div class="header-left">
+      <img src="@/assets/imgs/OA/zdww.png" alt="" />
+      <p>浙江万维空间MIS <span v-if="menuUlShow">|</span> {{ headerTitleName }}</p>
+    </div>
+    <div class="header-right">
+      <ul class="menuUl" v-if="menuUlShow">
+        <li v-for="(item, index) in reactiveData.routes" :key="index">
+          <router-link :to="'/oaSystem/projectCenter/' + item.path">
+            <span>{{ item.name }}</span>
+          </router-link>
+        </li>
+      </ul>
+      <div class="header-user">
+        <ElDropdown class="custom-hover" :class="prefixCls" trigger="click">
+          <div class="flex items-center">
+            <ElAvatar
+              :src="avatar"
+              alt=""
+              class="w-[calc(var(--logo-height)-25px)] rounded-[50%]"
+            />
+            <span class="pl-[5px] c-white ml-5px text-14px <lg:hidden">
+              {{ userName }}
+            </span>
+          </div>
+          <template #dropdown>
+            <ElDropdownMenu>
+              <ElDropdownItem>
+                <Icon icon="ep:tools" />
+                <div @click="toProfile">{{ t('common.profile') }}</div>
+              </ElDropdownItem>
+              <ElDropdownItem divided @click="loginOut">
+                <Icon icon="ep:switch-button" />
+                <div>{{ t('common.loginOut') }}</div>
+              </ElDropdownItem>
+            </ElDropdownMenu>
+          </template>
+        </ElDropdown>
+      </div>
+    </div>
+  </div>
+</template>
+<script setup lang="ts">
+import { useRouter } from 'vue-router'
+import { ElMessageBox } from 'element-plus'
+import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
+import { useDesign } from '@/hooks/web/useDesign'
+import avatarImg from '@/assets/imgs/avatar.gif'
+import { useUserStore } from '@/store/modules/user'
+import { useTagsViewStore } from '@/store/modules/tagsView'
+defineOptions({ name: 'Header' })
+const { t } = useI18n()
+
+const { wsCache } = useCache()
+
+const { push, replace } = useRouter()
+
+const userStore = useUserStore()
+
+const tagsViewStore = useTagsViewStore()
+
+const { getPrefixCls } = useDesign()
+
+const prefixCls = getPrefixCls('user-info')
+
+const user = wsCache.get(CACHE_KEY.USER)
+
+const avatar = user.user.avatar ? user.user.avatar : avatarImg
+
+const userName = user.user.nickname ? user.user.nickname : 'Admin'
+
+const loginOut = () => {
+  ElMessageBox.confirm(t('common.loginOutMessage'), t('common.reminder'), {
+    confirmButtonText: t('common.ok'),
+    cancelButtonText: t('common.cancel'),
+    type: 'warning'
+  })
+    .then(async () => {
+      await userStore.loginOut()
+      tagsViewStore.delAllViews()
+      replace('/login?redirect=/index')
+    })
+    .catch(() => {})
+}
+const toProfile = async () => {
+  push('/user/profile')
+}
+
+const reactiveData: any = reactive({
+  routes: []
+})
+const menuUlShow = ref(false) // 菜单列表是否显示,是首页就不显示
+const headerTitleName: any = ref('') // 标题名称
+const router = useRouter()
+const initMenus = async () => {
+  const uid = router.currentRoute.value
+  let locals: any = localStorage.getItem('roleRouters')
+  let roleRouters = JSON.parse(JSON.parse(locals).v)[0].children
+
+  if (uid.path == '/oaSystem/home') {
+    menuUlShow.value = false
+    reactiveData.routes = roleRouters
+  } else {
+    menuUlShow.value = true
+
+    let childName = uid.name
+    let childArr = roleRouters.slice(1, roleRouters.length)
+    await childFun(childName, childArr)
+  }
+}
+
+const childFun = async (name: any, arr: any) => {
+  for (let i = 0; i < arr.length; i++) {
+    if (arr[i].children != null) {
+      for (let j = 0; j < arr[i].children.length; j++) {
+        if (arr[i].children[j].path == name) {
+          headerTitleName.value = arr[i].name
+          reactiveData.routes = arr[i].children
+        }
+      }
+    } else {
+      if (arr[i].path == name) {
+        headerTitleName.value = arr[i].name
+      }
+    }
+  }
+}
+/** 初始化 **/
+onMounted(() => {
+  initMenus()
+})
+</script>
+<style lang="scss" scoped>
+.header {
+  width: calc(100%);
+  height: 76px;
+  background: #183868;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 0 20px;
+  box-sizing: border-box;
+  .header-left {
+    display: flex;
+    align-items: center;
+    img {
+      width: 48px;
+      height: 48px;
+      margin-right: 15px;
+    }
+    p {
+      font-size: 24px;
+      color: #fff;
+    }
+  }
+  .header-right {
+    display: flex;
+    align-items: center;
+    height: 100%;
+    .menuUl {
+      display: flex;
+      align-items: center;
+      height: 100%;
+      margin: 0;
+      border-right: 1px solid #45638e;
+      li {
+        width: 136px;
+        list-style: none;
+        height: 100%;
+        a {
+          width: 100%;
+          height: 100%;
+          display: block;
+          display: flex;
+          align-items: center;
+          justify-content: center;
+          text-decoration: none;
+          span {
+            color: #fff;
+            font-size: 16px;
+          }
+        }
+        .router-link-active {
+          background-color: #4e6e9e;
+        }
+      }
+    }
+
+    .header-user {
+      margin-left: 25px;
+    }
+  }
+}
+
+.custom-hover {
+  background-color: transparent;
+}
+</style>

+ 28 - 0
client/src/views/OaSystem/oaLayout/index.vue

@@ -0,0 +1,28 @@
+<template>
+  <div class="_layout">
+    <Header />
+    <div class="_content">
+      <router-view />
+    </div>
+  </div>
+</template>
+<script setup lang="ts">
+import Header from './header.vue'
+defineOptions({ name: 'Layout' })
+
+/** 初始化 **/
+onMounted(() => {})
+</script>
+<style lang="scss" scoped>
+._layout {
+  width: 100%;
+  height: 100%;
+  box-sizing: border-box;
+}
+._content {
+  width: 100%;
+  height: calc(100% - 76px);
+  background: #fff;
+  padding: 15px;
+}
+</style>

+ 0 - 2
client/src/views/OaSystem/olanTool/index.vue

@@ -2,8 +2,6 @@
   <div class="_OlanTool"> 规划工具 </div>
 </template>
 <script setup lang="ts">
-import type { Column } from 'element-plus'
-
 defineOptions({ name: 'OlanTool' })
 
 /** 初始化 **/

+ 6 - 0
client/src/views/OaSystem/projectCenter/projectBook/projectBook.vue

@@ -0,0 +1,6 @@
+<template>
+  <div class="_ProjectCenter"> 项目台账 </div>
+</template>
+<script setup lang="ts">
+defineOptions({ name: 'ProjectBook' })
+</script>

+ 6 - 0
client/src/views/OaSystem/projectCenter/projectHome/projectHome.vue

@@ -0,0 +1,6 @@
+<template>
+  <div class="_ProjectCenter"> 项目中心首页 </div>
+</template>
+<script setup lang="ts">
+defineOptions({ name: 'ProjectHome' })
+</script>