Browse Source

首页底部增加【设置快捷菜单】

liangyan0105 3 years ago
parent
commit
3e7a5031f7

+ 1 - 1
src/assets/less/common.css

@@ -57,5 +57,5 @@
   color: green;
 }
 a {
-  text-decoration: none;
+  text-decoration: none !important;
 }

+ 1 - 1
src/assets/less/common.less

@@ -62,5 +62,5 @@
   color: green;
 }
 a {
-  text-decoration: none;
+  text-decoration: none !important;
 }

+ 97 - 0
src/assets/less/drawer.css

@@ -0,0 +1,97 @@
+ /deep/ .ant-card-body {
+  padding: 10px !important;
+}
+ /deep/ .ant-card-head-title {
+  padding: 0;
+  font-weight: 700;
+  font-size: 14px;
+}
+ /deep/ .ant-card-head {
+  min-height: 30px;
+  border-bottom: none;
+  line-height: 30px;
+}
+.selectTag {
+  height: 124px;
+  background-color: #90caf9;
+}
+.selectTag .selected {
+  display: flex;
+  flex-flow: row wrap;
+  box-sizing: border-box;
+}
+.selectTag .selected .selectedItem {
+  width: calc((100% - 36px) / 4);
+  display: flex;
+  margin: 4px;
+  justify-content: center;
+  align-items: center;
+  border-radius: 0;
+}
+.selectTag /deep/ .ant-card-head-title {
+  color: #003f88;
+  margin-top: 10px;
+}
+.selectTag .ant-tag {
+  border: none;
+}
+.second {
+  background-color: white;
+  margin: 0 20px 0 12px;
+  height: 50px;
+  line-height: 50px;
+  margin-bottom: 100px;
+}
+.second span {
+  font-size: 14px;
+  color: #333;
+  display: inline-block;
+}
+.searchLine {
+  margin-top: 106px;
+}
+.searchLine /deep/ .ant-row {
+  margin: 10px 0;
+}
+.searchLine /deep/ .ant-row /deep/ .ant-card {
+  background-color: gray;
+}
+.searchLine /deep/ .ant-row /deep/ .ant-card /deep/ .ant-card-head {
+  display: none !important;
+}
+.searchLine /deep/ .ant-row /deep/ .ant-card /deep/ .ant-card-body {
+  background-color: pink !important;
+}
+.searchLine .active {
+  background-color: rgba(19, 116, 206, 0.5);
+  border-radius: 10px;
+}
+.searchLine .active a {
+  color: white;
+}
+.oneMenuItem {
+  text-align: center;
+}
+.LevelTwoMenu {
+  display: flex;
+  flex-flow: row wrap;
+  box-sizing: border-box;
+}
+.LevelTwoMenu .twoMenuItem {
+  text-align: center;
+  background-color: #f3f3f3 !important;
+  border: 1px solid #dfdfdf;
+  width: calc((100% - 50px) / 4);
+  display: flex;
+  margin: 0 6px 6px 6px;
+}
+.LevelTwoMenu .twoMenuItem a {
+  color: #333 !important;
+  text-decoration: none;
+  overflow: hidden;
+  white-space: nowrap;
+  text-overflow: ellipsis;
+}
+.LevelTwoMenu .bg {
+  background-color: blue;
+}

+ 111 - 0
src/assets/less/drawer.less

@@ -0,0 +1,111 @@
+/deep/ .ant-card-body {
+  padding: 10px !important;
+}
+// card 标题颜色
+/deep/ .ant-card-head-title {
+  padding: 0;
+  font-weight: 700;
+  font-size: 14px;
+}
+
+/deep/ .ant-card-head {
+  min-height: 30px;
+  border-bottom: none;
+  line-height: 30px;
+}
+
+// 已选功能
+.selectTag {
+  height: 124px; //固定高度
+  background-color: #90caf9;
+  .selected {
+    display: flex;
+    flex-flow: row wrap;
+    box-sizing: border-box;
+    .selectedItem {
+      width: calc((100% - 36px) / 4);
+      display: flex;
+      margin: 4px;
+      justify-content: center;
+      align-items: center;
+      border-radius: 0;
+    }
+  }
+  /deep/ .ant-card-head-title {
+    color: #003f88;
+    margin-top: 10px;
+  }
+  //不要边框
+  .ant-tag {
+    border: none;
+  }
+}
+
+// 额外的定位
+.second {
+  background-color: white;
+  margin: 0 20px 0 12px;
+  height: 50px;
+  line-height: 50px;
+  margin-bottom: 100px;
+  span {
+    font-size: 14px;
+    color: #333;
+    display: inline-block;
+  }
+}
+
+.searchLine {
+  margin-top: 106px;
+  /deep/ .ant-row {
+    margin: 10px 0; //每个菜单的间距
+    /deep/ .ant-card {
+      background-color: gray;
+      /deep/ .ant-card-head {
+        display: none !important;
+      }
+      /deep/ .ant-card-body {
+        background-color: pink !important;
+      }
+    }
+  }
+
+  //选中的样式
+  .active {
+    background-color: rgba(19, 116, 206, 0.5);
+    border-radius: 10px;
+    a {
+      color: white;
+    }
+  }
+}
+// 功能列表----------------
+// 一级
+.oneMenuItem {
+  text-align: center;
+}
+// 二级
+.LevelTwoMenu {
+  display: flex;
+  flex-flow: row wrap;
+  box-sizing: border-box;
+  .twoMenuItem {
+    text-align: center;
+    background-color: #f3f3f3 !important;
+    border: 1px solid #dfdfdf;
+    width: calc((100% - 50px) / 4);
+    display: flex;
+    margin: 0 6px 6px 6px;
+    // padding: 0 4px;
+    a {
+      color: #333 !important;
+      text-decoration: none;
+      overflow: hidden;
+      white-space: nowrap;
+      text-overflow: ellipsis;
+    }
+  }
+  .bg {
+    background-color: blue;
+  }
+}

+ 9 - 2
src/components/layouts/TabLayout.vue

@@ -33,6 +33,11 @@
         </template>
       </transition>
     </div>
+
+    <!-- 底部导航遮罩层 -->
+    <div class="navMask">
+      <global-navFooter />
+    </div>
   </global-layout>
 </template>
 
@@ -41,6 +46,7 @@ import GlobalLayout from '@/components/page/GlobalLayout'
 import Contextmenu from '@/components/menu/Contextmenu'
 import { mixin, mixinDevice } from '@/utils/mixin.js'
 import { triggerWindowResizeEvent } from '@/utils/util'
+import GlobalNavFooter from '@/components/page/GlobalNavFooter'
 
 const indexKey = '/dashboard/analysis'
 
@@ -48,7 +54,8 @@ export default {
     name: 'TabLayout',
     components: {
         GlobalLayout,
-        Contextmenu
+        Contextmenu,
+        GlobalNavFooter // 底部导航
     },
     mixins: [mixin, mixinDevice],
     data () {
@@ -86,7 +93,7 @@ export default {
     created () {
         if (this.$route.path != indexKey) {
             this.addIndexToFirst()
-            console.log('不要回显路径')
+            // console.log('不要回显路径')
         }
         // update-begin-author:sunjianlei date:20191223 for: 修复刷新后菜单Tab名字显示异常
         let storeKey = 'route:title:' + this.$route.fullPath

+ 22 - 22
src/components/page/GlobalFooter.vue

@@ -18,35 +18,35 @@
 </template>
 
 <script>
-  export default {
-    name: "LayoutFooter"
-  }
+export default {
+    name: 'LayoutFooter'
+}
 </script>
 
 <style lang="less" scoped>
-  .footer {
-    padding: 0 16px;
-    margin: 48px 0 24px;
-    text-align: center;
+.footer {
+  padding: 0 16px;
+  margin: 24px 0 60px;
+  text-align: center;
 
-    .links {
-      margin-bottom: 8px;
+  .links {
+    margin-bottom: 8px;
 
-      a {
-        color: rgba(0, 0, 0, .45);
+    a {
+      color: rgba(0, 0, 0, 0.45);
 
-        &:hover {
-          color: rgba(0, 0, 0, .65);
-        }
+      &:hover {
+        color: rgba(0, 0, 0, 0.65);
+      }
 
-        &:not(:last-child) {
-          margin-right: 40px;
-        }
+      &:not(:last-child) {
+        margin-right: 40px;
       }
     }
-    .copyright {
-      color: rgba(0, 0, 0, .45);
-      font-size: 14px;
-    }
   }
-</style>
+  .copyright {
+    color: rgba(0, 0, 0, 0.45);
+    font-size: 14px;
+  }
+}
+</style>

+ 348 - 0
src/components/page/GlobalNavFooter.vue

@@ -0,0 +1,348 @@
+/* eslint-disable camelcase */
+<template>
+  <div id="navFooter">
+    <!-- 底部快捷菜单 -->
+    <a-row style="background:rgba(24, 144, 255,.9);">
+      <!-- 左 小箭头 -->
+      <a-col :span="1" @click="handleChange">
+        <a class="arrowBtn">
+          <a-icon v-if="isShow" type="arrow-left" />
+          <a-divider type="vertical" style="width:3px;height:20px;marginBottom:6px;borderRadius:4px;" />
+          <a-icon v-if="!isShow" type="arrow-right" />
+        </a>
+      </a-col>
+
+      <!-- 右 菜单 -->
+      <a-col :span="23">
+        <transition-group name="animation">
+          <div class="shortcut" v-if="isShow" :key="1">
+            <a-row style="textAlign:center;">
+              <!-- 设置快捷抽屉 -->
+              <a-col :span="1">
+                <a href="#" @click="showDrawer" class="setBtn">设置快捷</a>
+              </a-col>
+              <!-- 菜单 -->
+              <a-col :span="20">
+                <div class="nav" v-for="item in selectList" :key="item.id">
+                  <a href="#">{{ item.name }}</a>
+                </div>
+              </a-col>
+              <!-- 公司名称 -->
+              <a-col :span="3">
+                <span style="color:rgba(224, 224, 224);">上海萃颠信息科技有限公司出品</span>
+              </a-col>
+            </a-row>
+          </div>
+        </transition-group>
+      </a-col>
+    </a-row>
+
+    <!-- 抽屉 设置快捷 -->
+    <a-drawer
+      title="设置快捷菜单"
+      width="520"
+      :placement="placement"
+      :closable="false"
+      :visible="visible"
+      :bodyStyle="{ padding: '12px', marginBottom: '90px', background: '#90caf9' }"
+    >
+      <!-- 固定屏幕 部分-->
+      <div
+        :style="{
+          position: 'absolute',
+          left: 0,
+          top: '0',
+          width: '100%',
+          textAlign: 'left',
+          zIndex: 6,
+          height: '124px'
+        }"
+      >
+        <!-- 已选 -->
+        <a-row>
+          <a-col :span="24">
+            <a-card title="已选功能" :bordered="false" class="selectTag">
+              <div class="selected">
+                <a-tag
+                  :key="item.id"
+                  v-for="item in selectList"
+                  :closable="true"
+                  @close="() => handleClose(item)"
+                  class="selectedItem"
+                >
+                  {{ item.name }}
+                  <!-- <a-empty v-show="this.selectList.length == 0" /> -->
+                </a-tag>
+              </div>
+            </a-card>
+          </a-col>
+        </a-row>
+        <!-- 搜索栏 -->
+        <div class="second">
+          <a-row style="textAlign:right;">
+            <a-col :span="3">
+              <span style="fontSize:14px;fontWeight:700;">功能菜单</span>
+            </a-col>
+
+            <a-col :span="20">
+              <a-input-search placeholder="请输入菜单名称" style="width: 180px" @search="searchMenu" />
+            </a-col>
+          </a-row>
+        </div>
+      </div>
+
+      <!-- 所有菜单-->
+      <a-row>
+        <a-col a-col :span="24">
+          <a-card title="" :bordered="false" class="searchLine">
+            <!-- 所有菜单 -->
+            <a-row v-for="menu in menuALL" :key="menu.name">
+              <a-col :span="4">
+                <span>{{ menu.name }}:</span>
+              </a-col>
+
+              <a-col :span="20" class="LevelTwoMenu">
+                <span v-for="item in menu.childList" :key="item.id" class="twoMenuItem">
+                  <!-- active: 返回的值是布尔值,调用判断布尔值的方法 -->
+                  <a
+                    href="#"
+                    style="width: 6em"
+                    @click.stop="selectItem(item)"
+                    :class="{ active: getActive(item.sysPermissionId) }"
+                  >
+                    {{ item.name }}
+                  </a>
+                </span>
+              </a-col>
+              <a-divider />
+            </a-row>
+          </a-card>
+        </a-col>
+      </a-row>
+
+      <!-- 抽屉底部按钮 -->
+      <div
+        :style="{
+          position: 'absolute',
+          right: 0,
+          bottom: '40px',
+          width: '100%',
+          padding: '10px  16px',
+          background: '#fff',
+          textAlign: 'right',
+          zIndex: 1,
+          background: '#90caf9'
+        }"
+      >
+        <a-popconfirm title="确定取消设置吗?" ok-text="是" cancel-text="否" @confirm="openTips">
+          <a-button :style="{ marginRight: '8px' }">取消</a-button>
+        </a-popconfirm>
+
+        <a-button type="primary" @click="drawerSave">保存</a-button>
+      </div>
+    </a-drawer>
+  </div>
+</template>
+
+<script>
+import Vue from 'vue'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
+import { getUserPermissionByTokenBottom, getListByCreateBy, addBatch } from '@api/api.js'
+
+export default {
+    name: 'GlobalNavFooter',
+    data () {
+        return {
+            isShow: true, // 默认显示快捷导航
+            visible: false, // 抽屉默认关闭
+            placement: 'left', // 抽屉方向布局
+            selectList: [], // 已选功能
+            menuALL: {}, // 所有菜单
+            bottomMenuList: [] // 后台接收快捷菜单
+        }
+    },
+    created () {
+        this.getFooterNav() // 获取快捷导航
+        this.getMenuList() // 所有菜单
+    },
+    methods: {
+    // 判断是否勾选(参数是菜单 ID)
+        getActive (sysPermissionId) {
+            let isActive = false // 默认未点击
+            this.selectList.forEach(element => {
+                if (sysPermissionId === element.sysPermissionId) {
+                    isActive = true // 点击
+                }
+            })
+            // console.log(isActive)
+            return isActive // 返回active状态
+        },
+        // 点击勾选
+        selectItem (item) {
+            // console.log('【点击的菜单】', item.name)
+            let isSelect = false // 默认未勾选
+            this.selectList.forEach((element, index) => {
+                // 判断是否重复
+                if (item.sysPermissionId === element.sysPermissionId) {
+                    isSelect = true // 勾选
+                    this.selectList.splice(index, 1)
+                }
+            })
+
+            // 长度控制
+            if (this.selectList.length >= 8) {
+                this.$message.warning('最多可选8个快捷菜单')
+                return
+            }
+            // 未勾选
+            if (!isSelect) {
+                this.selectList.push(item)
+            }
+        },
+
+        // 获取快捷菜单
+        async getFooterNav () {
+            await getListByCreateBy().then(res => {
+                if (res.success) {
+                    console.log('底部快捷菜单', res)
+                    this.selectList = res.result
+                }
+            })
+        },
+
+        // 保存 快捷菜单
+        async drawerSave () {
+            // console.log('保存')
+            await addBatch({ bottomMenuList: this.selectList }).then(res => {
+                if (res.success) {
+                    // 无需其他操作
+                    // this.getMenuList()
+                    this.$message.success('快捷菜单保存成功')
+                    this.visible = false
+                }
+            })
+        },
+        // 头部叉叉
+        handleClose (item) {
+            console.log('点击的叉叉', item)
+            this.selectList.forEach((e, index) => {
+                if (e.id == item.id) {
+                    this.selectList.splice(index, 1)
+                }
+                console.log(' 删后this.selectList', this.selectList)
+            })
+        },
+
+        // 所有菜单
+        async getMenuList () {
+            let token = Vue.ls.get(ACCESS_TOKEN)
+            let params = { token: token }
+            await getUserPermissionByTokenBottom(params).then(res => {
+                // console.log('所有菜单res---->', res)
+                if (res.success) {
+                    this.menuALL = res.result.menu
+                    // console.log('所有菜单res---->', res)
+                }
+            })
+        },
+        // 抽屉取消
+        openTips () {
+            console.log('点击抽屉取消')
+            this.visible = false
+        },
+
+        // 搜索菜单
+        searchMenu () {
+            console.log('设置搜索条件')
+        },
+        // 设置快捷
+        showDrawer () {
+            this.visible = true
+            this.getFooterNav() // 获取nav
+        },
+
+        // 底部导航 显示隐藏
+        handleChange () {
+            // console.log(this.isShow)
+            if (!this.isShow) {
+                this.visible = false
+                this.isShow = true
+            } else {
+                this.isShow = false
+            }
+        }
+    }
+}
+</script>
+
+<style lang="less" scoped>
+// 单独抽屉样式  如下
+@import '~@assets/less/drawer.less';
+@import '~@assets/less/common.less';
+// 整个底部导航
+#navFooter {
+  width: 100%;
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  height: 40px;
+  line-height: 40px;
+  z-index: 99999;
+
+  // 箭头
+  .arrowBtn {
+    background: transparent;
+    font-size: 26px;
+    padding-left: 32px;
+    color: white;
+  }
+
+  // 可消失行
+  .shortcut {
+    //设置快捷(文字)
+    .setBtn {
+      font-size: 14px;
+      font-weight: 700;
+      color: white;
+    }
+    .setBtn:hover {
+      color: orange;
+      font-weight: 400;
+    }
+    // 快捷菜单
+    .nav {
+      float: left;
+      letter-spacing: 1px;
+      a {
+        margin: 10px;
+        font-size: 14px;
+        color: white;
+        font-weight: 700;
+      }
+      a:hover {
+        color: orange;
+        font-weight: 400;
+      }
+    }
+    // 右侧公司名称
+    span {
+      // border-radius: ;
+    }
+  }
+
+  // 动画效果
+  .animation-enter,
+  .animation-leave-to {
+    opacity: 0;
+    transform: translateX(-40px);
+  }
+  .animation-enter-to,
+  .animation-leave {
+    opacity: 1;
+  }
+  .animation-enter-active,
+  .animation-leave-active {
+    transition: all 0.5s;
+  }
+}
+</style>

+ 29 - 19
src/views/dashboard/MyToDo.vue

@@ -168,6 +168,7 @@
 </template>
 
 <script>
+import Vue from 'vue'
 import MyoaTabs from '@views/dashboard/MyoaTabs.vue'
 import DetAnnModal from '@views/oa/enter-ann/add/detAnnModal.vue'
 import { mapGetters } from 'vuex'
@@ -184,6 +185,8 @@ import { enterpriseEList } from '@api/oa/cd-enterprise-announcement'
 import '@fullcalendar/daygrid/main.css'
 import JEditor from '../../components/jeecg/JEditor.vue'
 import '@/assets/less/dataVTable.less' // 修改首页 DataV 轮播表样式
+import { getUserPermissionByTokenBottom, getListByCreateBy } from '@api/api.js'
+import { ACCESS_TOKEN } from '@/store/mutation-types'
 export default {
   name: 'Mytodo',
   components: {
@@ -194,6 +197,7 @@ export default {
   },
   data() {
     return {
+      menuALL: [],
       timer: '',
       value: 0,
       annDetail: {}, //公告详情 数据
@@ -309,6 +313,8 @@ export default {
     this.getDataList() //待办数据
     this.getActiveKeyAll() //OA按钮
     this.getAnnList() //渲染公告(已发布的)
+    this.getMenuList() // 所有菜单
+    this.getFooterNav() // 获取快捷导航
   },
   computed: {
     // 系统消息计算
@@ -337,26 +343,32 @@ export default {
     this.getAnnList()
   },
   methods: {
-    //获取当前时间
-    // getCurrentTime() {
-    //   var _this = this
-    //   let yy = new Date().getFullYear()
-    //   let mm = new Date().getMonth() + 1
-    //   let dd = new Date().getDate()
-    //   let hh = new Date().getHours()
-    //   let mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
-    //   let ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
-    //   //  yy + '/' + mm + '/' +dd + ' ' +  省掉年月日
-    //   _this.gettime = hh + ':' + mf + ':' + ss
-    //   this.value = _this.gettime
-    //   showTime.innerHTML = _this.gettime
-    //   // console.log(_this.gettime)
-    // },
+    // 获取快捷菜单
+    async getFooterNav() {
+      await getListByCreateBy().then(res => {
+        if (res.success) {
+          console.log('底部快捷菜单', res)
+          this.selectList = res.result
+        }
+      })
+    },
+    // 抽屉所有菜单
+    async getMenuList() {
+      let token = Vue.ls.get(ACCESS_TOKEN)
+      let params = { token: token }
+      await getUserPermissionByTokenBottom(params).then(res => {
+        if (res.success) {
+          this.menuALL = res.result.menu
+          // console.log('所有菜单res---->', res)
+        }
+      })
+    },
+
     // 公告数据 ----|**查询条件:已发布、数据条数**|------
     async getAnnList() {
       await enterpriseEList({ isRelease: '1', pageSize: 1000 }).then(res => {
         if (res.success) {
-          console.log('轮播公告列表-->', res.result.records)
+          // console.log('轮播公告列表-->', res.result.records)
           this.annList = res.result.records
           let scrollData = [] //轮播表数据
           // 拿到返回的数据进行遍历并渲染
@@ -453,6 +465,7 @@ export default {
         }
       })
     },
+
     // 获取 OA 按钮
     getActiveKeyAll() {
       this.postFormAction('/activiti_process/listData', { status: 1, roles: true }).then(res => {
@@ -579,9 +592,6 @@ export default {
   top: 0;
   bottom: 0;
   width: 100%;
-  // height: 300px;
-  // line-height: 50px;
-  // text-align: center;
   background: rgba(255, 255, 255, 0.3);
 }
 </style>