YY 2 gadi atpakaļ
vecāks
revīzija
83410d1b31

+ 1 - 4
src/components/admin-frame/home.vue

@@ -5,7 +5,6 @@
       <el-aside width="200px" :style="{ 'background-color': '#242f42' }"><component :is="cAside"></component></el-aside>
       <el-aside width="200px" :style="{ 'background-color': '#242f42' }"><component :is="cAside"></component></el-aside>
       <el-main>
       <el-main>
         <div class="content-box" :class="{ 'content-collapse': collapse }">
         <div class="content-box" :class="{ 'content-collapse': collapse }">
-          <!-- <component :is="cTags"></component> -->
           <el-col :span="24" class="content">
           <el-col :span="24" class="content">
             <transition name="move" mode="out-in">
             <transition name="move" mode="out-in">
               <el-row>
               <el-row>
@@ -26,15 +25,13 @@
 import cHeader from './parts/Header.vue'
 import cHeader from './parts/Header.vue'
 import cAside from './parts/Sidebar.vue'
 import cAside from './parts/Sidebar.vue'
 import cBreadcrumb from './parts/breadcrumb.vue'
 import cBreadcrumb from './parts/breadcrumb.vue'
-import cTags from './parts/Tags.vue'
 import { useRoute } from 'vue-router'
 import { useRoute } from 'vue-router'
 import type { Ref } from 'vue'
 import type { Ref } from 'vue'
-import { ref, toRefs } from 'vue'
+import { ref } from 'vue'
 
 
 // 路由
 // 路由
 const route = useRoute()
 const route = useRoute()
 let collapse: Ref<any> = ref(false)
 let collapse: Ref<any> = ref(false)
-let tagsList: Ref<any> = ref([])
 const testInfo: Ref<any> = ref({
 const testInfo: Ref<any> = ref({
   height: '83.8vh',
   height: '83.8vh',
   background: '#ffffff',
   background: '#ffffff',

+ 1 - 1
src/components/admin-frame/parts/Header.vue

@@ -64,7 +64,7 @@ const logout = () => {
     }
     }
     .right {
     .right {
       text-align: right;
       text-align: right;
-      line-height: 60px;
+      line-height: 50px;
       i {
       i {
         position: relative;
         position: relative;
         top: 5px;
         top: 5px;

+ 22 - 108
src/components/admin-frame/parts/Sidebar.vue

@@ -7,49 +7,43 @@
           <el-menu
           <el-menu
             class="sidebar-el-menu"
             class="sidebar-el-menu"
             :default-active="active"
             :default-active="active"
-            :collapse="collapse"
             unique-opened
             unique-opened
+            default-openeds
             router
             router
+            :collapse="collapse"
             :background-color="styleInfo.backColor"
             :background-color="styleInfo.backColor"
             :text-color="styleInfo.textColor"
             :text-color="styleInfo.textColor"
             :active-text-color="styleInfo.activeColor"
             :active-text-color="styleInfo.activeColor"
           >
           >
             <template v-for="item in items">
             <template v-for="item in items">
-              <!-- 二级菜单 -->
-              <template v-if="item.subs">
-                <el-sub-menu :index="item.index" :key="item.index">
-                  <template v-slot:title>
+              <template v-if="item.type === '0'">
+                <el-sub-menu :index="item._id" :key="item._id">
+                  <template #title>
                     <i :class="['iconfont', item.icon]"></i>
                     <i :class="['iconfont', item.icon]"></i>
-                    <span slot="title">{{ item.title }}</span>
+                    <span>{{ item.name }}</span>
                   </template>
                   </template>
-                  <template v-for="subItem in item.subs">
-                    <!-- 三级菜单 -->
-                    <el-sub-menu v-if="subItem.subs" :index="subItem.index" :key="subItem.index">
-                      <template v-slot:title>
+                  <template v-for="subItem in item.children">
+                    <el-sub-menu v-if="subItem.children && subItem.children.length > 0" :index="subItem._id" :key="subItem._id">
+                      <template #title>
                         <i :class="['iconfont', subItem.icon]"></i>
                         <i :class="['iconfont', subItem.icon]"></i>
-                        <span slot="title">{{ subItem.title }}</span>
+                        <span>{{ subItem.name }}</span>
                       </template>
                       </template>
-                      <el-menu-item v-for="(threeItem, i) in subItem.subs" :key="i" :index="threeItem.index">
-                        <template v-slot:title>
-                          <i :class="['iconfont', threeItem.icon]"></i>
-                          <span slot="title">{{ threeItem.title }}</span>
-                        </template>
+                      <el-menu-item v-for="(threeItem, i) in subItem.children" :key="i" :index="threeItem.path">
+                        <i :class="['iconfont', threeItem.icon]"></i>
+                        <span>{{ threeItem.name }}</span>
                       </el-menu-item>
                       </el-menu-item>
                     </el-sub-menu>
                     </el-sub-menu>
-                    <el-menu-item v-else :index="subItem.index" :key="`index_${subItem.index}`">
-                      <template v-slot:title>
-                        <i :class="['iconfont', subItem.icon]"></i>
-                        <span slot="title">{{ subItem.title }}</span>
-                      </template>
+                    <el-menu-item v-else :index="subItem.path" :key="subItem.path">
+                      <i :class="['iconfont', subItem.icon]"></i>
+                      <span>{{ subItem.name }}</span>
                     </el-menu-item>
                     </el-menu-item>
                   </template>
                   </template>
                 </el-sub-menu>
                 </el-sub-menu>
               </template>
               </template>
-              <!-- 一级菜单 -->
               <template v-else>
               <template v-else>
-                <el-menu-item class="first" :index="item.index" :key="item.index">
+                <el-menu-item :index="item.path" :key="item.path">
                   <i :class="['iconfont', item.icon]"></i>
                   <i :class="['iconfont', item.icon]"></i>
-                  <span slot="title">{{ item.title }}</span>
+                  <span>{{ item.name }}</span>
                 </el-menu-item>
                 </el-menu-item>
               </template>
               </template>
             </template>
             </template>
@@ -61,26 +55,7 @@
 </template>
 </template>
 
 
 <script setup lang="ts">
 <script setup lang="ts">
-import {
-  system,
-  users,
-  achieveUser,
-  channelUser,
-  trainUser,
-  admin,
-  // 成果评价
-  cgsys,
-  cgadmin,
-  cguser,
-  cgexpert,
-  // 专利市场
-  zlsys,
-  zladmin,
-  zlmech,
-  zluser,
-  zlagent,
-  zlcons
-} from '../../../layout/menu'
+import { admin } from '../../../layout/menu'
 import { menuInfo } from '../../../layout/site'
 import { menuInfo } from '../../../layout/site'
 import _ from 'lodash'
 import _ from 'lodash'
 import { ElMessage } from 'element-plus'
 import { ElMessage } from 'element-plus'
@@ -105,61 +80,8 @@ const onRoutes = () => {
   active.value = useRoutes.path
   active.value = useRoutes.path
 }
 }
 
 
-const getMenu = async () => {
-  let list = _.cloneDeep(items.value)
-  // if (!_.get(user.value, 'id')) return;
-  let proType = `${import.meta.env.VUE_APP_ROUTER}`
-  if (proType == 'livecms') {
-    if (user.value && user.value.role == '0') {
-      list.push(...admin)
-    } else {
-      // let res: IQueryResult = await role.fetch(user.value.role_id)
-      // if (res && res.errcode == '0') {
-      //   const { menu } = res.data
-      //   if (menu.length > 0) {
-      //     const nmenu = getMenuOptions(admin, menu)
-      //     list.push(...nmenu)
-      //   }
-      // }
-    }
-  } else if (proType == 'liveuser') {
-    // role:3--平台用户,role:4--企业,role:5--专家,role:6--科技成果,role:7--科技频道,role:7--培训问诊
-    if ((user.value && user.value.role == '3') || user.value.role == '4' || user.value.role == '5') list.push(...users)
-    else if (user.value && user.value.role == '6') list.push(...achieveUser)
-    else if (user.value && user.value.role == '7') list.push(...channelUser)
-    else if (user.value && user.value.role == '8') list.push(...trainUser)
-  } else if (proType == 'liveachieve') {
-    // role:1--管理员,role:3--平台用户,role:9--评审专家用户
-    if (user.value && user.value.role == '1') list.push(...cgadmin, ...cgsys)
-    else if (user.value && user.value.role == '3') list.push(...cguser, ...cgsys)
-    else if (user.value && user.value.role == '9') list.push(...cgexpert, ...cgsys)
-  } else if (proType == 'livepatent') {
-    // role:1--管理员,role:2--机构,role:3--平台用户,role:10--代理机构,role:11--咨询师
-    if (user.value && user.value.role == '1') list.push(...zladmin, ...zlsys)
-    else if (user.value && user.value.role == '2') list.push(...zlmech, ...zlsys)
-    else if (user.value && user.value.role == '3') list.push(...zluser, ...zlsys)
-    else if (user.value && user.value.role == '10') list.push(...zlagent, ...zlsys)
-    else if (user.value && user.value.role == '11') list.push(...zlcons, ...zlsys)
-  }
-  items.value = _.uniqBy(list, 'index')
-}
-// 拍平数据
-const getMenuOptions = (allMenu: any, menus: any) => {
-  menus = _.uniq(_.flattenDeep(menus))
-  return getOptions(allMenu, menus) || []
-}
-// 重组,并找到对应菜单
-const getOptions = (allMenu: any, menus: any) => {
-  let res: any = allMenu.map((l: any) => {
-    const r: any = menus.find((f: any) => f == l.num)
-    if (r) {
-      if (l.subs) l.subs = getOptions(l.subs, menus)
-      return l
-    }
-  })
-  res = _.compact(res)
-  return res
-}
+const getMenu = async () => {}
+
 watch(
 watch(
   user,
   user,
   (newVal) => {
   (newVal) => {
@@ -174,19 +96,11 @@ watch(
 )
 )
 </script>
 </script>
 <style scoped lang="scss">
 <style scoped lang="scss">
-.sidebar {
-  display: block;
-  position: absolute;
-  left: 0;
-  top: 60px;
-  bottom: 0;
-  overflow-y: scroll;
-}
 .sidebar::-webkit-scrollbar {
 .sidebar::-webkit-scrollbar {
   width: 0;
   width: 0;
 }
 }
 .sidebar-el-menu:not(.el-menu--collapse) {
 .sidebar-el-menu:not(.el-menu--collapse) {
-  width: 200px;
+  width: 201px;
 }
 }
 .sidebar > ul {
 .sidebar > ul {
   height: 100%;
   height: 100%;

+ 0 - 175
src/components/admin-frame/parts/Tags.vue

@@ -1,175 +0,0 @@
-<!-- eslint-disable vue/no-deprecated-slot-attribute -->
-<template>
-  <div id="Tags">
-    <el-row>
-      <el-col :span="24" class="main">
-        <el-col :span="24" class="one">
-          <el-col :span="23" class="left">
-            <ul>
-              <li class="tags-li" v-for="(item, index) in tagsList" :class="{ active: isActive(item.path) }" :key="index">
-                <router-link :to="item.path" class="tags-li-title">
-                  {{ item.title }}
-                </router-link>
-                <!-- <span class="tags-li-icon" @click="closeTags(index)"><i class="el-icon-close"></i></span> -->
-              </li>
-            </ul>
-          </el-col>
-          <el-col :span="1" class="right">
-            <el-dropdown @command="handleTags">
-              <el-button size="small" type="primary"> 标签选项<i class="el-icon-arrow-down el-icon--right"></i> </el-button>
-              <el-dropdown-menu size="small" slot="dropdown">
-                <el-dropdown-item command="other">关闭其他</el-dropdown-item>
-                <el-dropdown-item command="all">关闭所有</el-dropdown-item>
-              </el-dropdown-menu>
-            </el-dropdown>
-          </el-col>
-        </el-col>
-      </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script lang="ts" setup>
-// import bus from './parts/bus'
-import type { Ref } from 'vue'
-import { ref, onMounted, watch } from 'vue'
-import { useRouter, useRoute } from 'vue-router'
-const router = useRouter()
-const route = useRoute()
-let tagsList: Ref<any> = ref([])
-const isActive = (path) => {
-  return path === route.fullPath
-}
-// 打开标签
-const handleTags = (command) => {
-  command === 'other' ? closeOther() : closeAll()
-}
-// 关闭单个标签
-const closeTags = (index) => {
-  const delItem = tagsList.value.splice(index, 1)[0]
-  const item = tagsList.value[index] ? tagsList.value[index] : tagsList.value[index - 1]
-  if (item) {
-    delItem.path === route.fullPath && router.push(item.path)
-  } else {
-    router.push('/adminCenter/homeIndex')
-  }
-}
-// 关闭全部标签
-const closeAll = () => {
-  tagsList.value = []
-  router.push('/adminCenter/homeIndex')
-}
-// 关闭其他标签
-const closeOther = () => {
-  const curItem = tagsList.value.filter((item) => {
-    return item.path === route.fullPath
-  })
-  tagsList.value = curItem
-}
-// 设置标签
-const setTags = (route) => {
-  const isExist = tagsList.value.some((item) => {
-    return item.path === route.fullPath
-  })
-  if (!isExist) {
-    if (tagsList.value.length >= 8) {
-      tagsList.value.shift()
-    }
-    tagsList.value.push({
-      title: route.meta.title,
-      path: route.fullPath,
-      name: route.matched[1].components.default.name
-    })
-  }
-  bus.$emit('tags', tagsList.value)
-}
-watch(
-  // route(newValue, oldValue) {
-  //     let index = this.tagsList.findIndex(i => i.path == oldValue.path);
-  //     this.tagsList.splice(index, 1);
-  //     this.setTags(newValue);
-  //   },
-  route,
-  (newValue, oldValue) => {
-    let index = tagsList.value.findIndex((i) => i.path == oldValue.path)
-    tagsList.value.splice(index, 1)
-    setTags(newValue)
-  },
-  {
-    deep: true
-  }
-)
-</script>
-
-<style lang="scss" scoped>
-.main {
-  .one {
-    position: relative;
-    height: 30px;
-    overflow: hidden;
-    background: #fff;
-    padding-right: 120px;
-    box-shadow: 0 5px 10px #ddd;
-    .left {
-      ul {
-        box-sizing: border-box;
-        width: 100%;
-        height: 100%;
-      }
-      .tags-li {
-        float: left;
-        margin: 3px 5px 2px 3px;
-        border-radius: 3px;
-        font-size: 12px;
-        overflow: hidden;
-        cursor: pointer;
-        height: 23px;
-        line-height: 23px;
-        border: 1px solid #e9eaec;
-        background: #fff;
-        padding: 0 5px 0 12px;
-        vertical-align: middle;
-        color: #666;
-        -webkit-transition: all 0.3s ease-in;
-        -moz-transition: all 0.3s ease-in;
-        transition: all 0.3s ease-in;
-      }
-      .tags-li:not(.active):hover {
-        background: #f8f8f8;
-      }
-      .tags-li.active {
-        color: #fff;
-      }
-      .tags-li-title {
-        float: left;
-        // max-width: 80px;
-        // overflow: hidden;
-        // white-space: nowrap;
-        // text-overflow: ellipsis;
-        margin-right: 5px;
-        color: #666;
-      }
-      .tags-li.active .tags-li-title {
-        color: #fff;
-      }
-      .tags-li.active {
-        border: 1px solid #409eff;
-        background-color: #409eff;
-      }
-    }
-    .right {
-      position: absolute;
-      right: 0;
-      top: 0;
-      box-sizing: border-box;
-      padding-top: 1px;
-      text-align: center;
-      width: 110px;
-      height: 30px;
-      background: #fff;
-      box-shadow: -3px 0 15px 3px rgba(0, 0, 0, 0.1);
-      z-index: 10;
-    }
-  }
-}
-</style>

+ 0 - 6
src/components/admin-frame/parts/bus.js

@@ -1,6 +0,0 @@
-import Vue from 'vue';
-
-// 使用 Event Bus
-const bus = new Vue();
-
-export default bus;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 377 - 372
src/layout/menu.ts


+ 2 - 3
src/main.ts

@@ -5,12 +5,11 @@ import router from './router'
 import ElementPlus from 'element-plus'
 import ElementPlus from 'element-plus'
 
 
 // import 'element-plus/theme-chalk/index.css';
 // import 'element-plus/theme-chalk/index.css';
-import '@common/src/assets/css/theme-green/index.css'
-import '@common/src/assets/css/theme-green/color-green.css'
+
 
 
 import locale from 'element-plus/lib/locale/lang/zh-cn'
 import locale from 'element-plus/lib/locale/lang/zh-cn'
 // import moment from 'moment';
 // import moment from 'moment';
-import '@/assets/main.css'
+
 // import 'animate.css';
 // import 'animate.css';
 import * as ElementPlusIconsVue from '@element-plus/icons-vue'
 import * as ElementPlusIconsVue from '@element-plus/icons-vue'
 const app = createApp(App)
 const app = createApp(App)

+ 52 - 0
src/stores/system/dictData.ts

@@ -0,0 +1,52 @@
+import { ref, computed } from 'vue'
+import { defineStore } from 'pinia'
+import { AxiosWrapper } from '@/util/axios-wrapper'
+import _ from 'lodash'
+
+import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util'
+const axios = new AxiosWrapper()
+const api = {
+  url: `/zkzx/v2/v1/api/dictData`
+}
+export const DictDataStore = defineStore('dictData', () => {
+  const count = ref(0)
+  const doubleCount = computed(() => count.value * 2)
+  function increment() {
+    count.value++
+  }
+  const query = async ({ skip = 0, limit = undefined, ...info }: IQueryParams = {}): Promise<IQueryResult> => {
+    let cond: IQueryType = {}
+    if (skip) cond.skip = skip
+    if (limit) cond.limit = limit
+    cond = { ...cond, ...info }
+    const res = await axios.$get(`${api.url}`, cond)
+    return res
+  }
+  const fetch = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$get(`${api.url}/${payload}`)
+    return res
+  }
+  const create = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$post(`${api.url}`, payload)
+    return res
+  }
+  const update = async (payload: any): Promise<IQueryResult> => {
+    const id = _.get(payload, 'id', _.get(payload, '_id'))
+    const res = await axios.$post(`${api.url}/${id}`, payload)
+    return res
+  }
+  const del = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$delete(`${api.url}/${payload}`)
+    return res
+  }
+  return {
+    count,
+    doubleCount,
+    increment,
+    query,
+    fetch,
+    create,
+    update,
+    del
+  }
+})

+ 52 - 0
src/stores/system/dictType.ts

@@ -0,0 +1,52 @@
+import { ref, computed } from 'vue'
+import { defineStore } from 'pinia'
+import { AxiosWrapper } from '@/util/axios-wrapper'
+import _ from 'lodash'
+
+import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util'
+const axios = new AxiosWrapper()
+const api = {
+  url: `/zkzx/v2/v1/api/dictType`
+}
+export const DictTypeStore = defineStore('dictType', () => {
+  const count = ref(0)
+  const doubleCount = computed(() => count.value * 2)
+  function increment() {
+    count.value++
+  }
+  const query = async ({ skip = 0, limit = undefined, ...info }: IQueryParams = {}): Promise<IQueryResult> => {
+    let cond: IQueryType = {}
+    if (skip) cond.skip = skip
+    if (limit) cond.limit = limit
+    cond = { ...cond, ...info }
+    const res = await axios.$get(`${api.url}`, cond)
+    return res
+  }
+  const fetch = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$get(`${api.url}/${payload}`)
+    return res
+  }
+  const create = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$post(`${api.url}`, payload)
+    return res
+  }
+  const update = async (payload: any): Promise<IQueryResult> => {
+    const id = _.get(payload, 'id', _.get(payload, '_id'))
+    const res = await axios.$post(`${api.url}/${id}`, payload)
+    return res
+  }
+  const del = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$delete(`${api.url}/${payload}`)
+    return res
+  }
+  return {
+    count,
+    doubleCount,
+    increment,
+    query,
+    fetch,
+    create,
+    update,
+    del
+  }
+})