Sfoglia il codice sorgente

:ok_hand: 安排多租户模块

smallchill 7 anni fa
parent
commit
05fc4ae74c

File diff suppressed because it is too large
+ 1 - 1
public/cdn/avue/2.0.0/avue.min.js


File diff suppressed because it is too large
+ 0 - 0
public/cdn/avue/2.0.0/index.css


+ 5 - 2
src/api/system/dept.js

@@ -46,10 +46,13 @@ export const getDept = (id) => {
     }
   })
 }
-export const getDeptTree = () => {
+export const getDeptTree = (tenantCode) => {
   return request({
     url: '/api/blade-system/dept/tree',
-    method: 'get'
+    method: 'get',
+    params: {
+      tenantCode,
+    }
   })
 }
 

+ 5 - 2
src/api/system/role.js

@@ -66,9 +66,12 @@ export const getRole = (roleIds) => {
   })
 }
 
-export const getRoleTree = () => {
+export const getRoleTree = (tenantCode) => {
   return request({
     url: '/api/blade-system/role/tree',
-    method: 'get'
+    method: 'get',
+    params: {
+      tenantCode,
+    }
   })
 }

+ 38 - 0
src/api/system/tenant.js

@@ -0,0 +1,38 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/blade-system/tenant/list',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+export const remove = (ids) => {
+  return request({
+    url: '/api/blade-system/tenant/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/blade-system/tenant/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/blade-system/tenant/submit',
+    method: 'post',
+    data: row
+  })
+}

+ 2 - 1
src/api/user.js

@@ -1,10 +1,11 @@
 import request from '@/router/axios';
 import {baseUrl} from '@/config/env';
 
-export const loginByUsername = (account, password, type) => request({
+export const loginByUsername = (tenantCode, account, password, type) => request({
   url: '/api/blade-auth/token',
   method: 'post',
   params: {
+    tenantCode,
     account,
     password,
     type

+ 2 - 1
src/lang/en.js

@@ -66,6 +66,7 @@ export default {
   login: {
     title: 'Login ',
     info: 'Enterprise Development Platform',
+    tenantCode: 'Please input tenantCode',
     username: 'Please input username',
     password: 'Please input a password',
     wechat: 'Wechat',
@@ -98,4 +99,4 @@ export default {
     closeOthers: 'Close Others',
     closeAll: 'Close All'
   }
-}
+}

+ 1 - 0
src/lang/zh.js

@@ -66,6 +66,7 @@ export default {
   login: {
     title: '登录 ',
     info: '企业级开发平台',
+    tenantCode: '请输入租户编号',
     username: '请输入账号',
     password: '请输入密码',
     wechat: '微信',

+ 12 - 0
src/page/index/top/top-theme.vue

@@ -44,6 +44,18 @@ export default {
         {
           name: "炫彩主题",
           value: "theme-star"
+        },
+        {
+          name: "iview主题",
+          value: "theme-iview"
+        },
+        {
+          name: "d2主题",
+          value: "theme-d2"
+        },
+        {
+          name: "hey主题",
+          value: "theme-hey"
         }
       ]
     };

+ 14 - 0
src/page/login/userlogin.vue

@@ -5,6 +5,16 @@
            ref="loginForm"
            :model="loginForm"
            label-width="0">
+    <el-form-item prop="tenantCode">
+      <el-input size="small"
+                @keyup.enter.native="handleLogin"
+                v-model="loginForm.tenantCode"
+                auto-complete="off"
+                :placeholder="$t('login.tenantCode')">
+        <i slot="prefix"
+           class="icon-quanxian"></i>
+      </el-input>
+    </el-form-item>
     <el-form-item prop="username">
       <el-input size="small"
                 @keyup.enter.native="handleLogin"
@@ -45,11 +55,15 @@ export default {
   data() {
     return {
       loginForm: {
+        tenantCode: "000000",
         username: "admin",
         password: "admin",
         type: "account"
       },
       loginRules: {
+        tenantCode: [
+          { required: true, message: "请输入租户编号", trigger: "blur" }
+        ],
         username: [
           { required: true, message: "请输入用户名", trigger: "blur" }
         ],

+ 1 - 1
src/store/modules/user.js

@@ -41,7 +41,7 @@ const user = {
         //根据用户名登录
         LoginByUsername({ commit }, userInfo) {
             return new Promise((resolve) => {
-                loginByUsername(userInfo.username, userInfo.password, userInfo.type).then(res => {
+                loginByUsername(userInfo.tenantCode, userInfo.username, userInfo.password, userInfo.type).then(res => {
                     const data = res.data.data;
                     commit('SET_TOKEN', data.accessToken);
                     commit('SET_USERIFNO', data);

+ 0 - 15
src/styles/avue.scss

@@ -1,15 +0,0 @@
-//修改阿里巴巴图表库样式
-.iconfont{
-  margin-right: 5px;
-  font-size: 20px !important;
-}
-.avue-icon-select__item{
-  margin-bottom: 20px;
-}
-.avue-icon-select__list .iconfont{
-  padding: 20px;
-  font-size: 24px;
-}
-.avue-icon-select__list .iconfont:hover{
- transform: scale(1.4);
-}

+ 1 - 3
src/styles/common.scss

@@ -18,8 +18,6 @@
 @import './media.scss';
 //通用配置
 @import './normalize.scss';
-//通用配置
-@import './avue.scss';
 
 a{
   text-decoration: none;
@@ -27,4 +25,4 @@ a{
 }
 *{
   outline: none;
-}
+}

+ 6 - 8
src/styles/element-ui.scss

@@ -24,13 +24,7 @@
     display: none;
 }
 
-.el-dropdown-menu__item--divided:before,
-.el-menu,
-.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus,
-.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover,
-.el-menu--horizontal>.el-submenu .el-submenu__title:hover {
-    background-color: transparent;
-}
+
 
 .el-message__icon,
 .el-message__content {
@@ -58,7 +52,11 @@
 .el-main {
     padding: 0 !important;
 }
+.el-dropdown-menu__item--divided:before, .el-menu, .el-menu--horizontal>.el-menu-item:not(.is-disabled):focus, .el-menu--horizontal>.el-menu-item:not(.is-disabled):hover, .el-menu--horizontal>.el-submenu .el-submenu__title:hover {
+    background-color:transparent;
+}
+
 
 .el-dropdown-menu__item--divided:before, .el-menu, .el-menu--horizontal>.el-menu-item:not(.is-disabled):focus, .el-menu--horizontal>.el-menu-item:not(.is-disabled):hover, .el-menu--horizontal>.el-submenu .el-submenu__title:hover{
     background-color: transparent !important;
-}
+}

+ 52 - 63
src/styles/sidebar.scss

@@ -1,7 +1,41 @@
+
+
+.el-menu--popup{
+    .el-menu-item{
+        background-color: #20222a;
+        i{
+            margin-right: 5px;
+        }
+        i,span{
+            color:hsla(0,0%,100%,.7);
+        }
+        &:hover{
+            i,span{
+                color:#fff;
+            }
+        }
+        &.is-active {
+            background-color: rgba(0,0,0,.8);
+            &:before {
+                content: '';
+                top: 0;
+                left: 0;
+                bottom: 0;
+                width: 4px;
+                background: #409eff;
+                position: absolute;
+            }
+            i,span{
+                color:#fff;
+            }
+        }
+    }
+    
+}
 .avue-sidebar {
     user-select: none; 
     position: relative;
-    padding-top: 74px;
+    padding-top: 60px;
     height: 100%;
     position: relative;
     background-color: #20222a;
@@ -24,77 +58,32 @@
         font-size: 14px;
         background-color: rgba(0,0,0,.4);
     }
-    .el-menu-item,
-    .el-submenu__title {
-        font-size: 14px;
-        height: 56px;
-        line-height: 56px;
-    }
-    .el-menu-item {
-        span,i{
-            color:rgba(255, 255, 255, 0.7);
+    .el-menu-item,.el-submenu__title{
+        i{
+            margin-right: 5px;
         }
-        &:hover {
-            background-color: transparent;
-            color: #fff;
-            span,
-            i {
-                color: #fff;
+        i,span{
+            color:hsla(0,0%,100%,.7);
+        }
+        &:hover{
+            background: transparent;
+            i,span{
+               color:#fff;
             }
         }
         &.is-active {
-            background-color: rgba(0, 0, 0, .8);
-            span,
-            i {
-                color: #fff;
-            }
-            &:hover {
-                background-color: rgba(0, 0, 0, .8);
-            }
-            &::before {
-                content: " ";
+            &:before {
+                content: '';
                 top: 0;
                 left: 0;
                 bottom: 0;
                 width: 4px;
-                background: $mainBg;
-                position: absolute
-            }
-        }
-    }
-    .el-submenu__title {
-        span,i{
-            color:rgba(255, 255, 255, 0.7);
-        }
-        &:hover {
-            i,
-            span {
-                color: #fff;
+                background: #409eff;
+                position: absolute;
             }
-            background-color:transparent ;
-        }
-    }
-    .el-submenu .el-menu-item {
-        height: 50px;
-        line-height: 50px;
-        span,i{
-            color:rgba(255, 255, 255, 0.7);
-        }
-        &.is-active {
-            background-color: rgba(0, 0, 0, .8);
-            span,
-            i {
-                color: #fff
-            }
-            &:hover {
-                background-color: rgba(0, 0, 0, .8);
-            }
-        }
-        &:hover {
-            background-color: transparent;
-            span,
-            i {
-                color: #fff;
+            background-color: rgba(0,0,0,.8);
+            i,span{
+                color:#fff;
             }
         }
     }

+ 57 - 0
src/styles/theme/d2.scss

@@ -0,0 +1,57 @@
+.theme-d2 {
+  .avue-logo{
+    color: #409EFF;
+    background-color: #ebf1f6;
+    box-shadow: none;
+    .avue-logo_title{
+      font-size: 22px;
+      font-weight: 400;
+    }
+  }
+  .avue-top{
+    background-color: #ebf1f6;
+    box-shadow: none;
+  }
+  .avue-main{
+    padding: 0 5px;
+  }
+  .avue-tags{
+    margin-left: 6px;
+    padding: 0;
+    border: 1px solid #e4e7ed;
+    border-radius: 3px;
+    background-color: #ebf1f6;
+    box-shadow: none;
+    .el-tabs__item{
+      border-left: 1px solid #cfd7e5 !important;
+      margin: 0 !important;
+      background-color: rgba(0,0,0,.03) !important;
+      color: #606266 !important;
+      font-size: 14px !important;
+      font-weight: 500 !important;
+      &:first-child{
+        border-left: none !important;
+      }
+    }
+    .is-active{
+      border-bottom:1px solid #fff !important;
+      background-color: #fff !important;
+      color: #409EFF !important;
+    }
+  }
+  .avue-sidebar{
+    background-color: #ebf1f6;
+    box-shadow: none;
+    .el-menu-item,.el-submenu__title{
+      i,span{
+          color:#606266
+      }
+      &:hover,&.is-active{
+        background: hsla(0,0%,100%,.5);
+          i,span{
+            color: #409EFF;
+          }
+      }
+    }
+  }
+}

+ 45 - 0
src/styles/theme/hey.scss

@@ -0,0 +1,45 @@
+.theme-hey{
+  .avue-sidebar{
+    background-color: #fff;
+    box-shadow: 0 1px 4px rgba(0,21,41,.08);
+    .el-menu-item,.el-submenu__title{
+      i,span{
+        color: rgba(49,58,70,.8);
+      }
+      &:hover{
+          background: transparent;
+          i,span{
+             color:#409eff;
+          }
+      }
+      &.is-active {
+          &:before {
+            left:auto;
+            right: 0 ;
+          }
+          background-color: #f0f6ff;
+          i,span{
+              color:#409eff;
+          }
+      }
+  }
+  }
+  .avue-logo{
+    background-color: #fff;
+    box-shadow: none;
+    .avue-logo_title{
+      color:#409eff;
+      font-size: 24px;
+    }
+  }
+  .avue-tags{
+    background: #f3f6f8;
+    .el-tabs__item{
+      color: rgba(0,0,0,.65) !important;
+    }
+    .is-active{
+      background-color: #fff;
+      border-bottom: none !important;
+    }
+  }
+}

+ 10 - 0
src/styles/theme/index.scss

@@ -3,3 +3,13 @@
 
 // 炫酷主题
 @import './star.scss';
+
+
+// d2主题
+@import './d2.scss';
+
+//iview
+@import './iview.scss';
+
+//heyui
+@import './hey.scss';

+ 79 - 0
src/styles/theme/iview.scss

@@ -0,0 +1,79 @@
+.theme-iview {
+  .avue-logo{
+    background: #001529;
+    box-shadow: none;
+    text-align: center;
+    .avue-logo_title{
+      div{
+        border-top-left-radius: 5px;
+        border-top-right-radius: 5px;
+        border-bottom-left-radius: 3px;
+        border-bottom-right-radius: 3px;
+        font-size: 22px;
+        color:#fff;
+        font-weight: 500;
+        margin:  10px auto;
+        width: 180px;
+        height: 45px;
+        background-color: #409EFF;
+      }
+    }
+  }
+  .avue-tags{
+    padding:  3px 5px 5px 0;
+    background: #f0f0f0;
+    box-shadow: inset 0 0 3px 2px hsla(0,0%,39.2%,.1);
+    .is-active{
+      &:before{
+        background: #409EFF !important;
+      }
+    }
+    .el-tabs__item{
+      padding: 0 15px !important;
+      position: relative;
+      height: 32px !important;
+      line-height:32px !important;
+      border: 1px solid #e8eaec!important;
+      color: #515a6e!important;
+      background: #fff!important;
+      border-radius: 3px;
+      &:before{
+        content:'';
+        display: inline-block;
+        width: 12px;
+        height: 12px;
+        margin-right:10px;
+        border-radius: 50%;
+        background: #e8eaec;
+      }
+    }
+  }
+
+  .avue-sidebar{
+    background: #001529;
+    .el-menu-item{
+      &.is-active {
+          background-color:  #000c17;
+          &:before {
+            display: none;
+          }
+          i,span{
+            color:#409EFF;
+        }
+      }
+    }
+     .el-submenu{
+        .el-menu-item{
+          &.is-active {
+            background-color:  #409EFF;
+            &:before {
+              display: none;
+            }
+            i,span{
+              color:#fff;
+          }
+        }
+      }
+    }
+  }
+}

+ 36 - 82
src/styles/theme/star.scss

@@ -3,112 +3,66 @@
         background-image: url("/img/bg/star-squashed.jpg");
         background-size: 100% 100%;
     }
+    .avue-logo{
+        color: #fff;
+    }
     .avue-header,
     .avue-logo,
     .tags-container {
         background-color: transparent;
     }
-    .el-card {
+    .el-card,.error-page {
         opacity: .9;
     }
-    .top {
-        .el-dropdown {
-            color: #fff;
-            i {
-                color: #fff;
-            }
-        }
-        .top-item {
-            i {
-                color: #fff;
-            }
-        }
-    }
     .avue-tabs {
         padding: 0 20px ;
     }
-    .avue-sidebar,
-    .logo,
-    .el-menu-item,
-    .el-submenu__title,
-    .el-menu {
-        background-color: transparent 
-    }
-    .logo_title,
-    .avue-breadcrumb,
-    {
-        color: #fff ;
-        i {
-            color: #fff;
-        }
-    }
-    .el-menu--horizontal>.el-menu-item.is-active {
-        border-bottom: none;
-    }
-    .top {
-        border-bottom: none;
-    }
-    .avue-tags {
+    .avue-tags{
         background-color: transparent;
-        border: none;
-    }
-    .tag-item {
-        color: #fff ;
-        border: none ;
-        background-color: rgba(255, 255, 255, .5);
-        &.is-active {
-            color: #fff ;
-            border: 1px solid #fff ;
-            background-color: rgba(0, 0, 0, .4);
-            .tag-item-icon {
-                color: #fff ;
-            }
-        }
+        border-top: none;
     }
-    .el-menu-item {
-        i,
-        span {
-            color: #fff ;
+    .avue-top{
+        .avue-breadcrumb{
+            color:#fff;
         }
-        &:hover {
-            i,
-            span {
-                color: #409eff ;
+        .el-menu-item{
+            i,span{
+                color:#fff;
             }
-        }
-        &.is-active {
-            background-color: rgba(0, 0, 0, .4) ;
-            &:hover {
-                background-color: rgba(0, 0, 0, .4) ;
+            &.is-active{
+                background-color: rgba(0,0,0,.4)
             }
         }
+        .el-dropdown{
+            color:#fff;
+        }
     }
-    .el-submenu__title {
-        i,
-        span {
-            color: #fff ;
+    .avue-sidebar{
+        box-shadow: 2px 0 6px rgba(0, 21, 41, 0.15);
+        background-color:transparent;
+        .el-menu-item,.el-submenu__title{
+        i,span{
+            color:#fff
         }
-        &:hover {
-            i,
-            span {
-                color: #409eff ;
+        &:hover{
+            background: transparent;
+            i,span{
+                color:#409EFF;
             }
-            background-color:transparent ;
         }
-    }
-    .el-submenu .el-menu-item {
         &.is-active {
-            background-color: rgba(0, 0, 0, .4) ;
-            span,
-            i {
-                color: $mainBg ;
-            }
-            &:hover {
-                background-color: rgba(0, 0, 0, .4) ;
+            background-color: rgba(0,0,0,.4);
+            i,span{
+                color:#fff;
             }
         }
+        }
     }
-    .top-search {
+
+  .top-search {
+        .el-input__inner{
+        color: #333;
+        }
         input::-webkit-input-placeholder,
         textarea::-webkit-input-placeholder {
             /* WebKit browsers */

+ 42 - 43
src/styles/theme/white.scss

@@ -1,4 +1,32 @@
 .theme-white {
+    .el-menu--popup{
+        .el-menu-item{
+            background-color: #fff;
+            i,span{
+                color:#666;
+            }
+            &:hover{
+                i,span{
+                    color:#333;
+                }
+            }
+            &.is-active {
+                background-color: #409EFF;
+                &:before {
+                    content: '';
+                    top: 0;
+                    left: 0;
+                    bottom: 0;
+                    width: 4px;
+                    background: #409eff;
+                    position: absolute;
+                }
+                i,span{
+                    color:#fff;
+                }
+            }
+        }
+    }
   .avue-header,
   .avue-logo,
   .tags-container {
@@ -16,7 +44,7 @@
     color:#fff;
   }
   .logo_title,
-  .avue-breadcrumb,
+  .avue-breadcrumb
   {
       color: #fff ;
       i {
@@ -37,60 +65,31 @@
       }
     }
   }
-  .el-menu--popup{
-    background-color: #fff ;
-    .el-menu-item{
-      background-color: #fff ;
-      span,i {
-        color:#666 ;
-      }
-      &.is-active{
-        background-color:#409EFF ;
-        span,i {
-          color:#fff ;
-        }
-      }
-    }
-  }
   .avue-sidebar{
     box-shadow: 2px 0 6px rgba(0, 21, 41, 0.15);
-    .el-menu{
-      background-color: #fff ;
-    }
-    background-color:#fff ;
+    background-color: #fff;
+    padding-top: 70px;
     .el-menu-item,.el-submenu__title{
       i,span{
-        color:#666 ;
+          color:#666
       }
-      background-color:#fff ;
-    }
-    .el-menu-item,.el-submenu__title{
       &:hover{
-        background-color: transparent ;
-        i,span{
-          color:#666 ;
-        }
-      }
-    }
-    .el-menu-item.is-active,.el-submenu__title.is-active{
-      background-color:#409EFF ;
-      i,span{
-        color:#fff ;
-      }
-      &::before{
-        display: none;
+          background: transparent;
+          i,span{
+             color:#333;
+          }
       }
-      &:hover{
-        background-color: #409EFF ;
-        i,span{
-          color:#fff ;
-        }
+      &.is-active {
+          background-color: #409EFF;
+          i,span{
+              color:#fff;
+          }
       }
     }
   }
   .top-search {
       .el-input__inner{
-        color: #fff;
+        color: #333;
       }
       input::-webkit-input-placeholder,
       textarea::-webkit-input-placeholder {

+ 1 - 1
src/styles/top.scss

@@ -1,7 +1,7 @@
 .avue-top {
     padding: 0 20px;
     position: relative;
-    box-shadow: 0 1px 4px rgba(0,21,41,.08);
+    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
     color: rgba(0, 0, 0, .65);
     font-size: 28px;
     height: 64px;

+ 12 - 0
src/views/system/dept.vue

@@ -73,6 +73,18 @@
                 trigger: "blur"
               }]
             },
+            {
+              label: "租户编号",
+              prop: "tenantCode",
+              search: true,
+              addDisplay: false,
+              editDisplay: false,
+              rules: [{
+                required: true,
+                message: "请输入租户编号",
+                trigger: "blur"
+              }]
+            },
             {
               label: "部门全称",
               prop: "fullName",

+ 12 - 0
src/views/system/role.vue

@@ -105,6 +105,18 @@ export default {
               }
             ]
           },
+          {
+            label: "租户编号",
+            prop: "tenantCode",
+            search: true,
+            addDisplay: false,
+            editDisplay: false,
+            rules: [{
+              required: true,
+              message: "请输入租户编号",
+              trigger: "blur"
+            }]
+          },
           {
             label: "角色别名",
             prop: "roleAlias",

+ 210 - 0
src/views/system/tenant.vue

@@ -0,0 +1,210 @@
+<template>
+  <basic-container>
+    <avue-crud :option="option"
+               :data="data"
+               ref="crud"
+               v-model="form"
+               :page="page"
+               :permission="permissionList"
+               @row-del="rowDel"
+               @row-update="rowUpdate"
+               @row-save="rowSave"
+               @search-change="searchChange"
+               @search-reset="searchReset"
+               @selection-change="selectionChange"
+               @on-load="onLoad">
+      <template slot="menuLeft">
+        <el-button type="danger"
+                   size="small"
+                   icon="el-icon-delete"
+                   v-if="permission.tenant_delete"
+                   plain
+                   @click="handleDelete">删 除
+        </el-button>
+      </template>
+      <template slot-scope="{row}"
+                slot="roleId">
+        <el-tag>{{row.roleName}}</el-tag>
+      </template>
+      <template slot-scope="{row}"
+                slot="deptId">
+        <el-tag>{{row.deptName}}</el-tag>
+      </template>
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+  import {getList, remove, update, add} from "@/api/system/tenant";
+  import {mapGetters} from "vuex";
+
+  export default {
+    data() {
+      return {
+        form: {},
+        selectionList: [],
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        option: {
+          tip: false,
+          border: true,
+          index: true,
+          selection: true,
+          viewBtn: true,
+          dialogWidth: 300,
+          dialogHeight: 400,
+          column: [
+            {
+              label: "租户编号",
+              prop: "tenantCode",
+              search: true,
+              addDisplay: false,
+              editDisplay: false,
+              span: 24,
+              rules: [{
+                required: true,
+                message: "请输入租户编号",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "租户名称",
+              prop: "tenantName",
+              search: true,
+              span: 24,
+              rules: [{
+                required: true,
+                message: "请输入参数名称",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "联系人",
+              prop: "linkman",
+              search: true,
+              span: 24,
+              rules: [{
+                required: true,
+                message: "请输入联系人",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "联系电话",
+              prop: "contactNumber",
+              span: 24,
+            },
+            {
+              label: "联系地址",
+              prop: "address",
+              span: 24,
+              minRows: 6,
+              type: "textarea",
+            }
+          ]
+        },
+        data: []
+      };
+    },
+    computed: {
+      ...mapGetters(["permission"]),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permission.tenant_add, false),
+          viewBtn: this.vaildData(this.permission.tenant_view, false),
+          delBtn: this.vaildData(this.permission.tenant_delete, false),
+          editBtn: this.vaildData(this.permission.tenant_edit, false)
+        };
+      },
+      ids() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids.join(",");
+      }
+    },
+    methods: {
+      rowSave(row, loading) {
+        add(row).then(() => {
+          loading();
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+        });
+      },
+      rowUpdate(row, index, loading) {
+        update(row).then(() => {
+          loading();
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+        });
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(row.id);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          });
+      },
+      searchReset() {
+        this.onLoad(this.page);
+      },
+      searchChange(params) {
+        this.onLoad(this.page, params);
+      },
+      selectionChange(list) {
+        this.selectionList = list;
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(this.ids);
+          })
+          .then(() => {
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      onLoad(page, params = {}) {
+        getList(page.currentPage, page.pageSize, params).then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+          this.data = data.records;
+        });
+      }
+    }
+  };
+</script>
+
+<style>
+</style>

+ 50 - 4
src/views/system/user.vue

@@ -51,6 +51,8 @@
     add,
     resetPassword
   } from "@/api/system/user";
+  import {getDeptTree} from "@/api/system/dept";
+  import {getRoleTree} from "@/api/system/role";
   import {mapGetters} from "vuex";
 
   export default {
@@ -80,6 +82,10 @@
           currentPage: 1,
           total: 0
         },
+        init: {
+          roleTree: [],
+          deptTree: [],
+        },
         option: {
           tip: false,
           border: true,
@@ -91,7 +97,6 @@
             {
               label: "登录账号",
               prop: "account",
-              span: 24,
               search: true,
               rules: [{
                 required: true,
@@ -99,6 +104,22 @@
                 trigger: "blur"
               }]
             },
+            {
+              label: "所属租户",
+              prop: "tenantCode",
+              type: "tree",
+              dicUrl: "/api/blade-system/tenant/select",
+              props: {
+                label: "tenantName",
+                value: "tenantCode"
+              },
+              search: true,
+              rules: [{
+                required: true,
+                message: "请输入所属租户",
+                trigger: "click"
+              }]
+            },
             {
               label: '密码',
               prop: 'password',
@@ -139,7 +160,7 @@
               prop: "roleId",
               multiple: true,
               type: "tree",
-              dicUrl: "/api/blade-system/role/tree",
+              dicData: [],
               props: {
                 label: "title"
               },
@@ -155,7 +176,7 @@
               prop: "deptId",
               type: "tree",
               multiple: true,
-              dicUrl: "/api/blade-system/dept/tree",
+              dicData: [],
               props: {
                 label: "title"
               },
@@ -174,6 +195,7 @@
             {
               label: "电子邮箱",
               prop: "email",
+              hide: true,
               overHidden: true
             },
             {
@@ -201,11 +223,13 @@
               type: "date",
               prop: "birthday",
               format: "yyyy-MM-dd hh:mm:ss",
-              valueFormat: "yyyy-MM-dd hh:mm:ss"
+              valueFormat: "yyyy-MM-dd hh:mm:ss",
+              hide: true
             },
             {
               label: "账号状态",
               prop: "statusName",
+              hide: true,
               display: false
             }
           ]
@@ -213,6 +237,20 @@
         data: []
       };
     },
+    watch: {
+      'form.tenantCode'() {
+        if (this.form.tenantCode !== '') {
+          getDeptTree(this.form.tenantCode).then(res => {
+            const index = this.$refs.crud.findColumnIndex("deptId");
+            this.option.column[index].dicData = res.data.data;
+          });
+          getRoleTree(this.form.tenantCode).then(res => {
+            const index = this.$refs.crud.findColumnIndex("roleId");
+            this.option.column[index].dicData = res.data.data;
+          });
+        }
+      }
+    },
     computed: {
       ...mapGetters(["permission"]),
       permissionList() {
@@ -347,6 +385,14 @@
           this.page.total = data.total;
           this.data = data.records;
         });
+        getDeptTree(this.form.tenantCode).then(res => {
+          const index = this.$refs.crud.findColumnIndex("deptId");
+          this.option.column[index].dicData = res.data.data;
+        });
+        getRoleTree(this.form.tenantCode).then(res => {
+          const index = this.$refs.crud.findColumnIndex("roleId");
+          this.option.column[index].dicData = res.data.data;
+        });
       }
     }
   };

Some files were not shown because too many files changed in this diff