wangting
2024-04-02 b38eb035c3782025257d9b582e5a0db45f7881b8
菜单跳转
已修改10个文件
已添加2个文件
462 ■■■■■ 文件已修改
Source/ProjectWeb/src/api/system/menu.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/api/user.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/components/file/list.vue 162 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/page/index/top/top-menu.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/page/login/userlogin.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/permission.js 153 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/router/avue-router.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/store/modules/dict.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/store/modules/user.js 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/views/fileManage/index.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/ProjectWeb/src/api/system/menu.js
@@ -93,12 +93,12 @@
}
export const getTopMenu = () => request({
  url: '/api/blade-system/menu/top-menu',
  url: '/api/smFunctionController/top-menu',
  method: 'get'
});
export const getRoutes = (parentOid) => request({
  url: 'api/smFunctionController/treeMyMenu',
  url: '/api/smFunctionController/treeMyMenu',
  method: 'get',
  params: {
    parentOid,
Source/ProjectWeb/src/api/user.js
@@ -2,7 +2,7 @@
import website from "@/config/website";
export const loginByUsername = (tenantId, deptId, roleId, username, password, type, key) => request({
  url: '/api/blade-auth/oauth/token',
  url: '/api/framework/loginController/login',
  method: 'post',
  headers: {
    'Tenant-Id': tenantId,
Source/ProjectWeb/src/components/dynamic-components/dynamic-custom.vue
@@ -2,15 +2,15 @@
  <div class="UI-dynamic" :id="'UI-dynamic-'+areasName+componentVO.oid">
    <div v-if="isError" style="color: #F56C6C">这个自定义页面的地址格式不正确。推荐使用bs=?type=xxx&context=yyy&pparam=zzz这种形式</div>
    <component v-else :is="currentComponent"
               :btmType="customOptions.btmType"
               :content="customOptions.content"
               :btmType="btmType"
               :content="content"
               :inDialog="true"
               :key="areasName+'customCom-'+componentVO.oid"
               :componentVO="componentVO"
               :sourceData="sourceData"
               :dataStore="dataStore"
               :areasName="areasName"
               :paramVOS="customOptions.paramVOS"></component>
               :paramVOS="urlParams"></component>
  </div>
</template>
@@ -57,6 +57,9 @@
  },
  data() {
    return {
      btmType:'',
      content:'',
      urlParams:{},
      height:'300px',
      customClass:this.componentVO.customClass, //bs=?type=xxx&context=yyy&param=zzz  æˆ–者 bs=组件name?type=xxx&context=yyy&param=zzz
      isError:false, //路径解析失败
@@ -73,46 +76,45 @@
    }
  },
  computed:{
    customOptions() {
      if(this.customClass.indexOf("bs=") <0){
        this.isError=true;
        return ;
      }
      this.customClass=this.componentVO.customClass.split("bs=")[1];
      if(this.customClass.indexOf("?") <0 || this.customClass.indexOf("type=") <0 || this.customClass.indexOf("context=") <0){
        this.isError=true;
        return ;
      }
      if(this.customClass.split('?')[0]!='' && this.customClass.split('?')[0]!='UI' && this.customClass.split('?')[0]!='ui'){
        this.currentComponent=this.customClass.split('?')[0];
      }
      this.customClass=this.componentVO.customClass.split("?")[1].split('&');
      let urlParams={};
      let btmType=''
      let content=''
      this.customClass.forEach(item=>{
        var preParam =item.split("=");
        if(preParam[0]=='type'){
          btmType=preParam[1];
        }else if(preParam[0]=='context'){
          content=preParam[1];
        }else{
          urlParams[preParam[0]] = preParam[1];
        }
      })
      return {
        btmType:btmType,
        content:content,
        paramVOS:Object.assign(this.paramVOS,urlParams)
      }
    }
  },
  created() {
  },
  mounted() {
    if(this.customClass.indexOf("bs=") <0){
      this.isError=true;
      return ;
    }
    this.customClass=this.componentVO.customClass.split("bs=")[1];
    if(this.customClass.indexOf("?") <0 || this.customClass.indexOf("type=") <0 || this.customClass.indexOf("context=") <0){
      this.isError=true;
      return ;
    }
    if(this.customClass.split('?')[0]!='' && this.customClass.split('?')[0]!='UI' && this.customClass.split('?')[0]!='ui'){
      this.currentComponent=this.customClass.split('?')[0];
    }
    this.customClass=this.componentVO.customClass.split("?")[1].split('&');
    let urlParams={};
    let btmType=''
    let content=''
    this.customClass.forEach(item=>{
      var preParam =item.split("=");
      if(preParam[0]=='type'){
        btmType=preParam[1];
      }else if(preParam[0]=='context'){
        content=preParam[1];
      }else{
        urlParams[preParam[0]] = preParam[1];
      }
    })
      this.btmType=btmType,
      this.content=content,
      this.urlParams=Object.assign(this.paramVOS,urlParams)
    //this.getHeight(this.$parent);
  },
 },
  methods:{
    getHeight(el){
      if(el.$el.clientHeight>50){
Source/ProjectWeb/src/components/dynamic-components/dynamic-table.vue
@@ -557,9 +557,6 @@
    selectChange(row) {
      this.selectList = row;
    },
    TreeSelectChange(row) {
      this.TreeSelectList = row;
    },
    searchChange(form,done){
      console.log(form)
      done()
Source/ProjectWeb/src/components/file/list.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,162 @@
<template>
  <!--文件列表-->
  <div style="height: 100%">
    <avue-crud ref="dataTable"
               v-model="form"
               :data="tableList"
               :option="option"
               :page.sync="pageType"
               :table-loading="loading"
               @row-click="rowClickChange"
               @selection-change="selectChange">
      <!--top区域按钮-->
      <template slot="menuLeft" slot-scope="scope">
        <dynamic-button :butttonList="componentVO.buttons" :selectList="selectList" LocationType="top"
                        type="table"></dynamic-button>
      </template>
      <!--menu区域按钮-->
      <template slot="menu" slot-scope="scope">
        <dynamic-button :butttonList="componentVO.buttons" :scope="scope" :selectList="selectList" LocationType="menu"
                        type="table"></dynamic-button>
      </template>
    </avue-crud>
  </div>
</template>
<script>
import {validatenull} from "@/util/validate";
export default {
  name: "list",
  props: {
    componentVO: {
      type: Object,
      default: {}
    },
    inDialog: {
      type: Boolean,
      default: false
    },
    areasName: {
      type: String,
      default: ''//westArea导航区
    },
    sourceData: {
      //菜单源数据或者弹窗时按钮所属区域的上一区域选中数据
      type: Object,
      default: {}
    },
    paramVOS: {
      type: Object,
      default: {}
    },
    isShow: {
      //所在区域是否已显示,针对tab和collapse
      type: Boolean,
      default: true
    },
    dataStore: {
      //弹窗时按钮所属区域选中数据
      type: Array,
      default: []
    }
  },
  data() {
    return {
      parentHeight: '100%',//当前组件根节点元素高度
      form: {},
      loading: false,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 50,
      },
      simplePage: {
        currentPage: 1,
        total: 100,
        pagerCount: 4,
        layout: "prev, pager, next"
      },
      //表格数据
      tableList: [],
      option: {
        index: true,
        addBtn: false,
        editBtn: false,
        delBtn: true,
        selection: true,
        tip: false,
        height: '100%',
        calcHeight: 15,
        indexFixed: false,
        menuFixed: false,
        searchMenuSpan: 12,
        searchShow: false,
        column: [{
          field:'name',
          title:'文件名称',
          width:250
        },{
          field:'fileSize',
          title:'大小',
          width:80,
          templet:function(d){
            if(!d.fileSize || d.fileSize == null || d.fileSize*1 == 0 || isNaN(d.fileSize*1) ){
              return "未知大小";
            }else{
              //原始大小是B
              var filesize = d.fileSize*1;
              if(filesize>1024*1024*1024*1024){
                return parseInt(filesize/(1024*1024*1024*1024)) + "TB";
              }else if(filesize> 1024*1024*1024){
                return parseInt(filesize/(1024*1024*1024)) + "GB";
              }else if(filesize> 1024*1024){
                return parseInt(filesize/(1024*1024)) + "MB";
              }else if(filesize> 1024){
                return parseInt(filesize/1024) + "KB";
              }else {
                return filesize + "B";
              }
            }
          }
        },{
          field:'secretGradeText',
          title:'密级',
          hidden:(!configData.controlSecret),
          width:60
        },{
          field:'fileDocClassifyName',
          title:'文档类型',
          width:160
        },{
          field:'creator',
          title:'上传人/时间',
          width:210,
          templet:function(d){
            return d.creator + "(" + $webUtil.formateDateTimeNoSecond(d.createTime) + ")";
          }
        }],
      },
      selectList: [],
    }
  },
  computed: {
    pageType() {
      return this.areasName === 'westArea' ? this.simplePage : this.page;
    }
  },
  methods: {
    rowClickChange(row) {
      this.$refs.dataTable.toggleRowSelection(row);
    },
    selectChange(row) {
      this.selectList = row;
    }
  }
}
</script>
<style scoped>
</style>
Source/ProjectWeb/src/page/index/top/top-menu.vue
@@ -54,9 +54,9 @@
        this.index.openMenu(item)
      },
      getMenu() {
        this.$store.dispatch("GetTopMenu").then(res => {
        /*this.$store.dispatch("GetTopMenu").then(res => {
          this.items = res;
        });
        });*/
      },
      generateTitle(item) {
        return this.$router.$avueRouter.generateTitle(
Source/ProjectWeb/src/page/login/userlogin.vue
@@ -109,15 +109,15 @@
      };
    },
    created() {
      this.getTenant();
     // this.getTenant();
    },
    mounted() {
      //在mounted获取首页下拉菜单数据
      this.$axios.get('/api/blade-system/tenant/tenant-map').then(res=>{
      /*this.$axios.get('/api/blade-system/tenant/tenant-map').then(res=>{
        if(res.data.code == 200){
          this.loginForm.region=res.data.data
        }
      })
      })*/
    },
    watch: {
      'loginForm.deptId'() {
@@ -175,8 +175,8 @@
            });
            this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
              if (this.website.switchMode) {
                const deptId = this.userInfo.dept_id;
                const roleId = this.userInfo.role_id;
                const deptId = this.userInfo.deptOid;
                const roleId = this.userInfo.userOid;
                if (deptId.includes(",") || roleId.includes(",")) {
                  this.loginForm.deptId = deptId;
                  this.loginForm.roleId = roleId;
Source/ProjectWeb/src/permission.js
@@ -1,76 +1,77 @@
// /**
//  * å…¨ç«™æƒé™é…ç½®
//  *
//  */
// import router from './router/router'
// import store from './store'
// import {validatenull} from '@/util/validate'
// import {getToken} from '@/util/auth'
// import NProgress from 'nprogress' // progress bar
// import 'nprogress/nprogress.css' // progress bar style
// NProgress.configure({showSpinner: false});
// const lockPage = store.getters.website.lockPage; //锁屏页
// router.beforeEach((to, from, next) => {
//   const meta = to.meta || {};
//   const isMenu = meta.menu === undefined ? to.query.menu : meta.menu;
//   store.commit('SET_IS_MENU', isMenu === undefined);
//   if (getToken()) {
//     if (store.getters.isLock && to.path !== lockPage) { //如果系统激活锁屏,全部跳转到锁屏页
//       next({path: lockPage})
//     } else if (to.path === '/login') { //如果登录成功访问登录页跳转到主页
//       next({path: '/'})
//     } else {
//       //如果用户信息为空则获取用户信息,获取用户信息失败,跳转到登录页
//       if (store.getters.token.length === 0) {
//         store.dispatch('FedLogOut').then(() => {
//           next({path: '/login'})
//         })
//       } else {
//         const value = to.query.src || to.fullPath;
//         const label = to.query.name || to.name;
//         const meta = to.meta || router.$avueRouter.meta || {};
//         const i18n = to.query.i18n;
//         if (to.query.target) {
//           window.open(value)
//         } else if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) {
//           store.commit('ADD_TAG', {
//             label: label,
//             value: value,
//             params: to.params,
//             query: to.query,
//             meta: (() => {
//               if (!i18n) {
//                 return meta
//               }
//               return {
//                 i18n: i18n
//               }
//             })(),
//             group: router.$avueRouter.group || []
//           });
//         }
//         next()
//       }
//     }
//   } else {
//     //判断是否需要认证,没有登录访问去登录页
//     if (meta.isAuth === false) {
//       next()
//     } else {
//       next('/login')
//     }
//   }
// })
//
// router.afterEach(() => {
//   NProgress.done();
//   let title = store.getters.tag.label;
//   let i18n = store.getters.tag.meta.i18n;
//   title = router.$avueRouter.generateTitle(title, i18n);
//   //判断登录页的情况
//   if (router.history.current.fullPath === "/login") {
//     title = "登录";
//   }
//   //根据当前的标签也获取label的值动态设置浏览器标题
//   router.$avueRouter.setTitle(title);
// });
 /**
  * å…¨ç«™æƒé™é…ç½®
  *
  */
 import router from './router/router'
 import store from './store'
 import {validatenull} from '@/util/validate'
 import {getToken} from '@/util/auth'
 import NProgress from 'nprogress' // progress bar
 import 'nprogress/nprogress.css' // progress bar style
 NProgress.configure({showSpinner: false});
 const lockPage = store.getters.website.lockPage; //锁屏页
 router.beforeEach((to, from, next) => {
   debugger;
   const meta = to.meta || {};
   const isMenu = meta.menu === undefined ? to.query.menu : meta.menu;
   store.commit('SET_IS_MENU', isMenu === undefined);
   if (getToken()) {
     if (store.getters.isLock && to.path !== lockPage) { //如果系统激活锁屏,全部跳转到锁屏页
       next({path: lockPage})
     } else if (to.path === '/login') { //如果登录成功访问登录页跳转到主页
       next({path: '/'})
     } else {
       //如果用户信息为空则获取用户信息,获取用户信息失败,跳转到登录页
       if (store.getters.token.length === 0) {
         store.dispatch('FedLogOut').then(() => {
           next({path: '/login'})
         })
       } else {
         const value = to.query.src || to.fullPath;
         const label = to.query.name || to.name;
         const meta = to.meta || router.$avueRouter.meta || {};
         const i18n = to.query.i18n;
         if (to.query.target) {
           window.open(value)
         } else if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) {
           store.commit('ADD_TAG', {
             label: label,
             value: value,
             params: to.params,
             query: to.query,
             meta: (() => {
               if (!i18n) {
                 return meta
               }
               return {
                 i18n: i18n
               }
             })(),
             group: router.$avueRouter.group || []
           });
         }
         next()
       }
     }
   } else {
     //判断是否需要认证,没有登录访问去登录页
     if (meta.isAuth === false) {
       next()
     } else {
       next('/login')
     }
   }
 })
 router.afterEach(() => {
   NProgress.done();
   let title = store.getters.tag.label;
   let i18n = store.getters.tag.meta.i18n;
   title = router.$avueRouter.generateTitle(title, i18n);
   //判断登录页的情况
   if (router.history.current.fullPath === "/login") {
     title = "登录";
   }
   //根据当前的标签也获取label的值动态设置浏览器标题
   router.$avueRouter.setTitle(title);
 });
Source/ProjectWeb/src/router/avue-router.js
@@ -90,8 +90,7 @@
       * first: ä¸ºäº†åŒºåˆ†å¤–界 è°ƒç”¨formatRoutes å’Œ å½“前文件调用 formatRoutes
      */
    formatRoutes: function (aMenu = [], first) {
      // window.console.log('aMenu')
      // window.console.log(aMenu)
      debugger;
      const aRouter = []
      // èŽ·å–åˆ°å…¨å±€é…ç½®ä¸­çš„ props
      const propsConfig = this.$website.menu.props;
@@ -119,7 +118,8 @@
            }
          })(),
          //特殊处理组件 æ‰§è¡Œå®Œè¿™ä¸ª component ä¹Ÿå°±æ˜¯ç²¾ç¡®åˆ°å…·ä½“的文件了  views文件夹下面就是具体的页面代码
          component = 'views' + oMenu.path,
          //component = 'views' + oMenu.path,
          component =  oMenu.path,
          name = oMenu[propsDefault.label],
          icon = oMenu[propsDefault.icon],
          children = oMenu[propsDefault.children],
Source/ProjectWeb/src/store/modules/dict.js
@@ -9,12 +9,12 @@
  actions: {
    FlowRoutes({commit}) {
      return new Promise((resolve, reject) => {
        getDictionary({code: 'flow'}).then(res => {
        /*getDictionary({code: 'flow'}).then(res => {
          commit('SET_FLOW_ROUTES', res.data.data);
          resolve();
        }).catch(error => {
          reject(error)
        })
        })*/
      })
    },
  },
Source/ProjectWeb/src/store/modules/user.js
@@ -50,18 +50,19 @@
      return new Promise((resolve, reject) => {
        loginByUsername(userInfo.tenantId, userInfo.deptId, userInfo.roleId, userInfo.username, md5(userInfo.password), userInfo.type, userInfo.key, ).then(res => {
          const data = res.data;
          if (data.error_description) {
            Message({
              message: data.error_description,
              type: 'error'
            })
          } else {
            commit('SET_TOKEN', data.access_token);
            commit('SET_REFRESH_TOKEN', data.refresh_token);
          if(data.success){
            debugger;
            commit('SET_TOKEN', data.obj.sessionInfo.token);
            commit('SET_REFRESH_TOKEN', data.obj.sessionInfo.token);
            commit('SET_TENANT_ID', data.tenant_id);
            commit('SET_USER_INFO', data);
            commit('SET_USER_INFO', data.obj.sessionInfo);
            commit('DEL_ALL_TAG');
            commit('CLEAR_LOCK');
          }else {
            Message({
              message: data.msg,
              type: 'error'
            })
          }
          resolve();
        }).catch(error => {
@@ -210,7 +211,7 @@
          });
          commit('SET_MENU_ALL', menu)
          commit('SET_MENU', menu)
          dispatch('GetButtons');
          //dispatch('GetButtons');
          resolve(menu)
        })
      })
@@ -228,6 +229,7 @@
  },
  mutations: {
    SET_TOKEN: (state, token) => {
      debugger;
      setToken(token);
      state.token = token;
      setStore({name: 'token', content: state.token})
Source/ProjectWeb/src/views/fileManage/index.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
<template>
  <!--文仓管理页面-->
  <basic-container>
  </basic-container>
</template>
<script>
export default {
  name: "index"
}
</script>
<style scoped>
</style>