Showing
21 changed files
with
1613 additions
and
119 deletions
| 1 | import request from '@/utils/request' | 1 | import request from '@/utils/request' |
| 2 | import { praseStrEmpty } from "@/utils/FedEx"; | 2 | import { praseStrEmpty } from "@/utils/FedEx"; |
| 3 | 3 | ||
| 4 | +// // 修改用户 | ||
| 5 | +// export function updateUser(data) { | ||
| 6 | +// return request({ | ||
| 7 | +// url: '/system/user', | ||
| 8 | +// method: 'put', | ||
| 9 | +// data: data | ||
| 10 | +// }) | ||
| 11 | +// } | ||
| 12 | + | ||
| 13 | +// // 导出用户 | ||
| 14 | +// export function exportUser(query) { | ||
| 15 | +// return request({ | ||
| 16 | +// url: '/system/user/export', | ||
| 17 | +// method: 'get', | ||
| 18 | +// params: query | ||
| 19 | +// }) | ||
| 20 | +// } | ||
| 21 | + | ||
| 22 | +// // 用户密码重置 | ||
| 23 | +// export function resetUserPwd(userId, password) { | ||
| 24 | +// const data = { | ||
| 25 | +// userId, | ||
| 26 | +// password | ||
| 27 | +// } | ||
| 28 | +// return request({ | ||
| 29 | +// url: '/system/user/resetPwd', | ||
| 30 | +// method: 'put', | ||
| 31 | +// data: data | ||
| 32 | +// }) | ||
| 33 | +// } | ||
| 34 | + | ||
| 35 | +// // 用户状态修改 | ||
| 36 | +// export function changeUserStatus(userId, status) { | ||
| 37 | +// const data = { | ||
| 38 | +// userId, | ||
| 39 | +// status | ||
| 40 | +// } | ||
| 41 | +// return request({ | ||
| 42 | +// url: '/system/user/changeStatus', | ||
| 43 | +// method: 'put', | ||
| 44 | +// data: data | ||
| 45 | +// }) | ||
| 46 | +// } | ||
| 47 | + | ||
| 48 | +// // 查询用户个人信息 | ||
| 49 | +// export function getUserProfile() { | ||
| 50 | +// return request({ | ||
| 51 | +// url: '/system/user/profile', | ||
| 52 | +// method: 'get' | ||
| 53 | +// }) | ||
| 54 | +// } | ||
| 55 | + | ||
| 56 | +// // 修改用户个人信息 | ||
| 57 | +// export function updateUserProfile(data) { | ||
| 58 | +// return request({ | ||
| 59 | +// url: '/system/user/profile', | ||
| 60 | +// method: 'put', | ||
| 61 | +// data: data | ||
| 62 | +// }) | ||
| 63 | +// } | ||
| 64 | + | ||
| 65 | +// // 用户密码重置 | ||
| 66 | +// export function updateUserPwd(oldPassword, newPassword) { | ||
| 67 | +// const data = { | ||
| 68 | +// oldPassword, | ||
| 69 | +// newPassword | ||
| 70 | +// } | ||
| 71 | +// return request({ | ||
| 72 | +// url: '/system/user/profile/updatePwd', | ||
| 73 | +// method: 'put', | ||
| 74 | +// params: data | ||
| 75 | +// }) | ||
| 76 | +// } | ||
| 77 | + | ||
| 78 | +// // 用户头像上传 | ||
| 79 | +// export function uploadAvatar(data) { | ||
| 80 | +// return request({ | ||
| 81 | +// url: '/system/user/profile/avatar', | ||
| 82 | +// method: 'post', | ||
| 83 | +// data: data | ||
| 84 | +// }) | ||
| 85 | +// } | ||
| 86 | + | ||
| 87 | +// // 下载用户导入模板 | ||
| 88 | +// export function importTemplate() { | ||
| 89 | +// return request({ | ||
| 90 | +// url: '/system/user/importTemplate', | ||
| 91 | +// method: 'get' | ||
| 92 | +// }) | ||
| 93 | +// } | ||
| 94 | + | ||
| 4 | // 查询用户列表 | 95 | // 查询用户列表 |
| 5 | -export function listUser(query) { | 96 | +export function listUser(data) { |
| 6 | return request({ | 97 | return request({ |
| 7 | - url: '/system/user/list', | 98 | + url: '/sysUser/getUserList', |
| 8 | - method: 'get', | 99 | + method: 'post', |
| 9 | - params: query | 100 | + data: data |
| 10 | }) | 101 | }) |
| 11 | } | 102 | } |
| 12 | 103 | ||
| 13 | // 查询用户详细 | 104 | // 查询用户详细 |
| 14 | -export function getUser(userId) { | 105 | +export function detailUser(userId) { |
| 15 | return request({ | 106 | return request({ |
| 16 | - url: '/system/user/' + praseStrEmpty(userId), | 107 | + url: '/sysUser/detailUser?id=' + praseStrEmpty(userId), |
| 17 | method: 'get' | 108 | method: 'get' |
| 18 | }) | 109 | }) |
| 19 | } | 110 | } |
| 20 | 111 | ||
| 21 | // 新增用户 | 112 | // 新增用户 |
| 22 | -export function addUser(data) { | 113 | +export function addOrUpdateUser(data) { |
| 23 | return request({ | 114 | return request({ |
| 24 | - url: '/system/user', | 115 | + url: '/sysUser/addOrUpdateUser', |
| 25 | method: 'post', | 116 | method: 'post', |
| 26 | data: data | 117 | data: data |
| 27 | }) | 118 | }) |
| 28 | } | 119 | } |
| 29 | 120 | ||
| 30 | -// 修改用户 | 121 | +// 修改用户状态 |
| 31 | -export function updateUser(data) { | 122 | +export function updateUserStatus(data) { |
| 32 | return request({ | 123 | return request({ |
| 33 | - url: '/system/user', | 124 | + url: '/sysUser/updateUserStatus', |
| 34 | - method: 'put', | 125 | + method: 'post', |
| 35 | data: data | 126 | data: data |
| 36 | }) | 127 | }) |
| 37 | } | 128 | } |
| 38 | 129 | ||
| 39 | -// 删除用户 | 130 | +//菜单信息 |
| 40 | -export function delUser(userId) { | 131 | +export function getAllAuth() { |
| 41 | return request({ | 132 | return request({ |
| 42 | - url: '/system/user/' + userId, | 133 | + url: '/sysMenu/getAllAuth', |
| 43 | - method: 'delete' | 134 | + method: 'get' |
| 44 | }) | 135 | }) |
| 45 | } | 136 | } |
| 46 | 137 | ||
| 47 | -// 导出用户 | 138 | +//菜单开启关闭 |
| 48 | -export function exportUser(query) { | 139 | +export function updateStatus(data) { |
| 49 | return request({ | 140 | return request({ |
| 50 | - url: '/system/user/export', | 141 | + url: '/sysMenu/updateStatus', |
| 51 | - method: 'get', | 142 | + method: 'post', |
| 52 | - params: query | 143 | + data: data |
| 53 | }) | 144 | }) |
| 54 | } | 145 | } |
| 55 | 146 | ||
| 56 | -// 用户密码重置 | 147 | +//角色列表 |
| 57 | -export function resetUserPwd(userId, password) { | 148 | +export function getRoleList(data) { |
| 58 | - const data = { | ||
| 59 | - userId, | ||
| 60 | - password | ||
| 61 | - } | ||
| 62 | return request({ | 149 | return request({ |
| 63 | - url: '/system/user/resetPwd', | 150 | + url: '/role/getRoleList', |
| 64 | - method: 'put', | 151 | + method: 'post', |
| 65 | data: data | 152 | data: data |
| 66 | }) | 153 | }) |
| 67 | } | 154 | } |
| 68 | 155 | ||
| 69 | -// 用户状态修改 | 156 | +//角色详情 |
| 70 | -export function changeUserStatus(userId, status) { | 157 | +export function detailRole(id) { |
| 71 | - const data = { | ||
| 72 | - userId, | ||
| 73 | - status | ||
| 74 | - } | ||
| 75 | return request({ | 158 | return request({ |
| 76 | - url: '/system/user/changeStatus', | 159 | + url: '/role/detailRole?id=' + id, |
| 77 | - method: 'put', | 160 | + method: 'get', |
| 78 | - data: data | ||
| 79 | }) | 161 | }) |
| 80 | } | 162 | } |
| 81 | 163 | ||
| 82 | -// 查询用户个人信息 | 164 | +//新增修改角色 |
| 83 | -export function getUserProfile() { | 165 | +export function addOrUpdateRole(data) { |
| 84 | return request({ | 166 | return request({ |
| 85 | - url: '/system/user/profile', | 167 | + url: '/role/addOrUpdateRole', |
| 86 | - method: 'get' | 168 | + method: 'post', |
| 169 | + data: data | ||
| 87 | }) | 170 | }) |
| 88 | } | 171 | } |
| 89 | 172 | ||
| 90 | -// 修改用户个人信息 | 173 | +//角色状态修改 |
| 91 | -export function updateUserProfile(data) { | 174 | +export function updateRoleStatus(data) { |
| 92 | return request({ | 175 | return request({ |
| 93 | - url: '/system/user/profile', | 176 | + url: '/role/updateRoleStatus', |
| 94 | - method: 'put', | 177 | + method: 'post', |
| 95 | data: data | 178 | data: data |
| 96 | }) | 179 | }) |
| 97 | } | 180 | } |
| 98 | 181 | ||
| 99 | -// 用户密码重置 | 182 | +//口岸列表 |
| 100 | -export function updateUserPwd(oldPassword, newPassword) { | 183 | +export function portNameList() { |
| 101 | - const data = { | ||
| 102 | - oldPassword, | ||
| 103 | - newPassword | ||
| 104 | - } | ||
| 105 | return request({ | 184 | return request({ |
| 106 | - url: '/system/user/profile/updatePwd', | 185 | + url: '/dictionary/port', |
| 107 | - method: 'put', | 186 | + method: 'get', |
| 108 | - params: data | ||
| 109 | }) | 187 | }) |
| 110 | } | 188 | } |
| 111 | 189 | ||
| 112 | -// 用户头像上传 | 190 | +//口岸变更 |
| 113 | -export function uploadAvatar(data) { | 191 | +export function changeCurrentPort(data) { |
| 114 | return request({ | 192 | return request({ |
| 115 | - url: '/system/user/profile/avatar', | 193 | + url: '/sysUser/changeCurrentPort', |
| 116 | method: 'post', | 194 | method: 'post', |
| 117 | data: data | 195 | data: data |
| 118 | }) | 196 | }) |
| 119 | -} | 197 | +} |
| 120 | - | ||
| 121 | -// 下载用户导入模板 | ||
| 122 | -export function importTemplate() { | ||
| 123 | - return request({ | ||
| 124 | - url: '/system/user/importTemplate', | ||
| 125 | - method: 'get' | ||
| 126 | - }) | ||
| 127 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -3,26 +3,44 @@ | ... | @@ -3,26 +3,44 @@ |
| 3 | * Copyright (c) 2019 FedEx | 3 | * Copyright (c) 2019 FedEx |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | -import store from '@/store' | 6 | + import store from '@/store' |
| 7 | 7 | ||
| 8 | -export default { | 8 | + export default { |
| 9 | - inserted(el, binding, vnode) { | 9 | + inserted(el, binding, vnode) { |
| 10 | - const { value } = binding | 10 | + const { value } = binding |
| 11 | - const all_permission = "*:*:*"; | 11 | + const all_permission = "*:*:*"; |
| 12 | - const permissions = store.getters && store.getters.permissions | 12 | + const permissions = store.getters && store.getters.permissions |
| 13 | - | 13 | + |
| 14 | - if (value && value instanceof Array && value.length > 0) { | 14 | + if (value && value instanceof Array && value.length > 0) { |
| 15 | - const permissionFlag = value | 15 | + const permissionFlag = value |
| 16 | - | 16 | + |
| 17 | - const hasPermissions = permissions.some(permission => { | 17 | + const hasPermissions = permissions.some(permission => { |
| 18 | - return all_permission === permission || permissionFlag.includes(permission) | 18 | + return all_permission === permission || permissionFlag.includes(permission) |
| 19 | - }) | 19 | + }) |
| 20 | - | 20 | + |
| 21 | - if (!hasPermissions) { | 21 | + if (!hasPermissions) { |
| 22 | - el.parentNode && el.parentNode.removeChild(el) | 22 | + el.parentNode && el.parentNode.removeChild(el) |
| 23 | + } | ||
| 24 | + } else { | ||
| 25 | + throw new Error(`请设置操作权限标签值`) | ||
| 23 | } | 26 | } |
| 24 | - } else { | 27 | + }, |
| 25 | - throw new Error(`请设置操作权限标签值`) | 28 | + |
| 29 | + //路由权限处理 | ||
| 30 | + routerPer(router){ | ||
| 31 | + const permissions = store.getters && store.getters.permissions | ||
| 32 | + let newRouter = []; | ||
| 33 | + router.forEach(item => { | ||
| 34 | + permissions.forEach(per=>{ | ||
| 35 | + if(item.meta.permissions == per){ | ||
| 36 | + newRouter.push(item) | ||
| 37 | + } | ||
| 38 | + }) | ||
| 39 | + if(item.children && item.children.length){ | ||
| 40 | + item.children = this.routerPer(item.children) | ||
| 41 | + } | ||
| 42 | + }); | ||
| 43 | + return newRouter | ||
| 26 | } | 44 | } |
| 27 | } | 45 | } |
| 28 | -} | 46 | + |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -6,7 +6,6 @@ | ... | @@ -6,7 +6,6 @@ |
| 6 | class="hamburger-container" | 6 | class="hamburger-container" |
| 7 | @toggleClick="toggleSideBar" | 7 | @toggleClick="toggleSideBar" |
| 8 | /> | 8 | /> |
| 9 | - | ||
| 10 | <breadcrumb | 9 | <breadcrumb |
| 11 | id="breadcrumb-container" | 10 | id="breadcrumb-container" |
| 12 | class="breadcrumb-container" | 11 | class="breadcrumb-container" |
| ... | @@ -16,7 +15,20 @@ | ... | @@ -16,7 +15,20 @@ |
| 16 | 15 | ||
| 17 | <div class="right-menu"> | 16 | <div class="right-menu"> |
| 18 | <template v-if="device !== 'mobile'"> </template> | 17 | <template v-if="device !== 'mobile'"> </template> |
| 19 | - | 18 | + <el-select |
| 19 | + v-model="portName" | ||
| 20 | + size="mini" | ||
| 21 | + style="width: 120px; top: -17px; right: 7px" | ||
| 22 | + placeholder="选择口岸" | ||
| 23 | + > | ||
| 24 | + <el-option | ||
| 25 | + v-for="item in portNameList" | ||
| 26 | + :label="item" | ||
| 27 | + :value="item" | ||
| 28 | + :key="item" | ||
| 29 | + > | ||
| 30 | + </el-option> | ||
| 31 | + </el-select> | ||
| 20 | <el-dropdown | 32 | <el-dropdown |
| 21 | class="avatar-container right-menu-item hover-effect" | 33 | class="avatar-container right-menu-item hover-effect" |
| 22 | trigger="click" | 34 | trigger="click" |
| ... | @@ -25,8 +37,7 @@ | ... | @@ -25,8 +37,7 @@ |
| 25 | <img :src="avatar" class="user-avatar" /> | 37 | <img :src="avatar" class="user-avatar" /> |
| 26 | </div> | 38 | </div> |
| 27 | <el-dropdown-menu slot="dropdown"> | 39 | <el-dropdown-menu slot="dropdown"> |
| 28 | - <!-- <el-dropdown-item @click.native.stop="drawer = true">个人中心</el-dropdown-item> --> | 40 | + <el-dropdown-item @click.native="logout"> |
| 29 | - <el-dropdown-item @click.native="logout"> | ||
| 30 | <span>退出登录</span> | 41 | <span>退出登录</span> |
| 31 | </el-dropdown-item> | 42 | </el-dropdown-item> |
| 32 | </el-dropdown-menu> | 43 | </el-dropdown-menu> |
| ... | @@ -35,13 +46,12 @@ | ... | @@ -35,13 +46,12 @@ |
| 35 | v-model="locale" | 46 | v-model="locale" |
| 36 | size="mini" | 47 | size="mini" |
| 37 | @change="local" | 48 | @change="local" |
| 38 | - style="width: 75px;top:-17px;right:7px" | 49 | + style="width: 75px; top: -17px; right: 7px" |
| 39 | > | 50 | > |
| 40 | <el-option label="中文" value="zh"> </el-option> | 51 | <el-option label="中文" value="zh"> </el-option> |
| 41 | <el-option label="英文" value="en"> </el-option> | 52 | <el-option label="英文" value="en"> </el-option> |
| 42 | </el-select> | 53 | </el-select> |
| 43 | </div> | 54 | </div> |
| 44 | - <Profile :drawer="drawer" @drawerHandleClose="drawerHandleClose"></Profile> | ||
| 45 | </div> | 55 | </div> |
| 46 | </template> | 56 | </template> |
| 47 | 57 | ||
| ... | @@ -50,21 +60,22 @@ import { mapGetters } from "vuex"; | ... | @@ -50,21 +60,22 @@ import { mapGetters } from "vuex"; |
| 50 | import Breadcrumb from "@/components/Breadcrumb"; | 60 | import Breadcrumb from "@/components/Breadcrumb"; |
| 51 | import TopNav from "@/components/TopNav"; | 61 | import TopNav from "@/components/TopNav"; |
| 52 | import Hamburger from "@/components/Hamburger"; | 62 | import Hamburger from "@/components/Hamburger"; |
| 53 | -import Profile from "@/views/systemConfig/userConfig/profile/index"; | ||
| 54 | 63 | ||
| 55 | export default { | 64 | export default { |
| 56 | components: { | 65 | components: { |
| 57 | Breadcrumb, | 66 | Breadcrumb, |
| 58 | TopNav, | 67 | TopNav, |
| 59 | Hamburger, | 68 | Hamburger, |
| 60 | - Profile, | ||
| 61 | }, | 69 | }, |
| 62 | data() { | 70 | data() { |
| 63 | return { | 71 | return { |
| 64 | - drawer: false, | 72 | + portNameList: [], |
| 65 | locale: "zh", | 73 | locale: "zh", |
| 66 | }; | 74 | }; |
| 67 | }, | 75 | }, |
| 76 | + created() { | ||
| 77 | + this.portNameList = this.$store.state.user.portNames; | ||
| 78 | + }, | ||
| 68 | computed: { | 79 | computed: { |
| 69 | ...mapGetters(["sidebar", "avatar", "device"]), | 80 | ...mapGetters(["sidebar", "avatar", "device"]), |
| 70 | setting: { | 81 | setting: { |
| ... | @@ -83,6 +94,32 @@ export default { | ... | @@ -83,6 +94,32 @@ export default { |
| 83 | return this.$store.state.settings.topNav; | 94 | return this.$store.state.settings.topNav; |
| 84 | }, | 95 | }, |
| 85 | }, | 96 | }, |
| 97 | + //切换口岸 | ||
| 98 | + portName: { | ||
| 99 | + get() { | ||
| 100 | + return this.$store.state.user.activePortName; | ||
| 101 | + }, | ||
| 102 | + set(val) { | ||
| 103 | + this.$store | ||
| 104 | + .dispatch("changePort", val) | ||
| 105 | + .then((res) => { | ||
| 106 | + if (res.code === 200) { | ||
| 107 | + location.reload(); | ||
| 108 | + } else { | ||
| 109 | + this.$confirm(res.msg, "提示", { | ||
| 110 | + type: "warning", | ||
| 111 | + }).then(()=>{ | ||
| 112 | + location.reload(); | ||
| 113 | + }).catch(()=>{ | ||
| 114 | + location.reload(); | ||
| 115 | + }); | ||
| 116 | + } | ||
| 117 | + }) | ||
| 118 | + .catch((err) => { | ||
| 119 | + console.log(err); | ||
| 120 | + }); | ||
| 121 | + }, | ||
| 122 | + }, | ||
| 86 | }, | 123 | }, |
| 87 | methods: { | 124 | methods: { |
| 88 | toggleSideBar() { | 125 | toggleSideBar() { |
| ... | @@ -100,9 +137,6 @@ export default { | ... | @@ -100,9 +137,6 @@ export default { |
| 100 | }); | 137 | }); |
| 101 | }); | 138 | }); |
| 102 | }, | 139 | }, |
| 103 | - drawerHandleClose(val) { | ||
| 104 | - this.drawer = val; | ||
| 105 | - }, | ||
| 106 | local(val) { | 140 | local(val) { |
| 107 | this.$i18n.locale = val; //此处val为 zh 或者 en | 141 | this.$i18n.locale = val; //此处val为 zh 或者 en |
| 108 | }, | 142 | }, | ... | ... |
| ... | @@ -2,14 +2,15 @@ import { constantRoutes } from '@/router' | ... | @@ -2,14 +2,15 @@ import { constantRoutes } from '@/router' |
| 2 | import { getRouters } from '@/api/menu' | 2 | import { getRouters } from '@/api/menu' |
| 3 | import Layout from '@/layout/index' | 3 | import Layout from '@/layout/index' |
| 4 | import ParentView from '@/components/ParentView'; | 4 | import ParentView from '@/components/ParentView'; |
| 5 | - | 5 | +import hasPermi from '../../directive/permission/hasPermi'; |
| 6 | const permission = { | 6 | const permission = { |
| 7 | state: { | 7 | state: { |
| 8 | routes: [], | 8 | routes: [], |
| 9 | addRoutes: [], | 9 | addRoutes: [], |
| 10 | defaultRoutes: [], | 10 | defaultRoutes: [], |
| 11 | topbarRouters: [], | 11 | topbarRouters: [], |
| 12 | - sidebarRouters: [] | 12 | + sidebarRouters: [], |
| 13 | + filghtAllData: {} | ||
| 13 | }, | 14 | }, |
| 14 | mutations: { | 15 | mutations: { |
| 15 | SET_ROUTES: (state, routes) => { | 16 | SET_ROUTES: (state, routes) => { |
| ... | @@ -23,13 +24,20 @@ const permission = { | ... | @@ -23,13 +24,20 @@ const permission = { |
| 23 | // 顶部导航菜单默认添加统计报表栏指向首页 | 24 | // 顶部导航菜单默认添加统计报表栏指向首页 |
| 24 | const index = [{ | 25 | const index = [{ |
| 25 | path: 'index', | 26 | path: 'index', |
| 26 | - meta: { title: '统计报表', icon: 'dashboard'} | 27 | + meta: { title: '首页', icon: 'home' } |
| 27 | }] | 28 | }] |
| 28 | state.topbarRouters = routes.concat(index); | 29 | state.topbarRouters = routes.concat(index); |
| 29 | }, | 30 | }, |
| 30 | SET_SIDEBAR_ROUTERS: (state, routes) => { | 31 | SET_SIDEBAR_ROUTERS: (state, routes) => { |
| 31 | state.sidebarRouters = routes | 32 | state.sidebarRouters = routes |
| 32 | }, | 33 | }, |
| 34 | + SET_FILGHTALL: (state, data) => { | ||
| 35 | + let name = data.name; | ||
| 36 | + state.filghtAllData[name] = data.data; | ||
| 37 | + }, | ||
| 38 | + REMOVE_FILGHTALL: (state, name) => { | ||
| 39 | + delete state.filghtAllData[name] | ||
| 40 | + } | ||
| 33 | }, | 41 | }, |
| 34 | actions: { | 42 | actions: { |
| 35 | // 生成路由 | 43 | // 生成路由 |
| ... | @@ -37,6 +45,7 @@ const permission = { | ... | @@ -37,6 +45,7 @@ const permission = { |
| 37 | return new Promise(resolve => { | 45 | return new Promise(resolve => { |
| 38 | // 向后端请求路由数据 | 46 | // 向后端请求路由数据 |
| 39 | getRouters().then(res => { | 47 | getRouters().then(res => { |
| 48 | + res.data = hasPermi.routerPer(res.data); | ||
| 40 | const sdata = JSON.parse(JSON.stringify(res.data)) | 49 | const sdata = JSON.parse(JSON.stringify(res.data)) |
| 41 | const rdata = JSON.parse(JSON.stringify(res.data)) | 50 | const rdata = JSON.parse(JSON.stringify(res.data)) |
| 42 | const sidebarRoutes = filterAsyncRouter(sdata) | 51 | const sidebarRoutes = filterAsyncRouter(sdata) | ... | ... |
| 1 | import { login, logout, getInfo } from '@/api/login' | 1 | import { login, logout, getInfo } from '@/api/login' |
| 2 | +import { changeCurrentPort } from "@/api/system/user.js"; | ||
| 2 | import { getToken, setToken, removeToken } from '@/utils/auth' | 3 | import { getToken, setToken, removeToken } from '@/utils/auth' |
| 3 | 4 | ||
| 4 | const user = { | 5 | const user = { |
| ... | @@ -6,6 +7,8 @@ const user = { | ... | @@ -6,6 +7,8 @@ const user = { |
| 6 | token: getToken(), | 7 | token: getToken(), |
| 7 | name: '', | 8 | name: '', |
| 8 | avatar: '', | 9 | avatar: '', |
| 10 | + activePortName: '', | ||
| 11 | + portNames:[], | ||
| 9 | roles: [], | 12 | roles: [], |
| 10 | permissions: [] | 13 | permissions: [] |
| 11 | }, | 14 | }, |
| ... | @@ -20,6 +23,13 @@ const user = { | ... | @@ -20,6 +23,13 @@ const user = { |
| 20 | SET_AVATAR: (state, avatar) => { | 23 | SET_AVATAR: (state, avatar) => { |
| 21 | state.avatar = avatar | 24 | state.avatar = avatar |
| 22 | }, | 25 | }, |
| 26 | + SET_ACTIVEPORTNAME: (state, activePortName) => { | ||
| 27 | + state.activePortName = activePortName | ||
| 28 | + sessionStorage.setItem('portName', activePortName) | ||
| 29 | + }, | ||
| 30 | + SET_PORTNAMES:(state,portNames)=>{ | ||
| 31 | + state.portNames = portNames | ||
| 32 | + }, | ||
| 23 | SET_ROLES: (state, roles) => { | 33 | SET_ROLES: (state, roles) => { |
| 24 | state.roles = roles | 34 | state.roles = roles |
| 25 | }, | 35 | }, |
| ... | @@ -29,6 +39,7 @@ const user = { | ... | @@ -29,6 +39,7 @@ const user = { |
| 29 | }, | 39 | }, |
| 30 | 40 | ||
| 31 | actions: { | 41 | actions: { |
| 42 | + | ||
| 32 | // 登录 | 43 | // 登录 |
| 33 | Login({ commit }, userInfo) { | 44 | Login({ commit }, userInfo) { |
| 34 | const username = userInfo.username.trim() | 45 | const username = userInfo.username.trim() |
| ... | @@ -36,7 +47,7 @@ const user = { | ... | @@ -36,7 +47,7 @@ const user = { |
| 36 | const rememberMe = userInfo.rememberMe | 47 | const rememberMe = userInfo.rememberMe |
| 37 | 48 | ||
| 38 | return new Promise((resolve, reject) => { | 49 | return new Promise((resolve, reject) => { |
| 39 | - login(username, password,rememberMe).then(res => { | 50 | + login(username, password, rememberMe).then(res => { |
| 40 | setToken(res.data) | 51 | setToken(res.data) |
| 41 | commit('SET_TOKEN', res.data) | 52 | commit('SET_TOKEN', res.data) |
| 42 | resolve() | 53 | resolve() |
| ... | @@ -52,6 +63,7 @@ const user = { | ... | @@ -52,6 +63,7 @@ const user = { |
| 52 | getInfo().then(res => { | 63 | getInfo().then(res => { |
| 53 | const user = res.data.user | 64 | const user = res.data.user |
| 54 | const avatar = user.avatar == "" ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar; | 65 | const avatar = user.avatar == "" ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar; |
| 66 | + let ports = user.portName.split(','); | ||
| 55 | if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组 | 67 | if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组 |
| 56 | commit('SET_ROLES', res.data.roles) | 68 | commit('SET_ROLES', res.data.roles) |
| 57 | commit('SET_PERMISSIONS', res.data.permissions) | 69 | commit('SET_PERMISSIONS', res.data.permissions) |
| ... | @@ -60,6 +72,14 @@ const user = { | ... | @@ -60,6 +72,14 @@ const user = { |
| 60 | } | 72 | } |
| 61 | commit('SET_NAME', user.userName) | 73 | commit('SET_NAME', user.userName) |
| 62 | commit('SET_AVATAR', avatar) | 74 | commit('SET_AVATAR', avatar) |
| 75 | + commit('SET_PORTNAMES',ports) | ||
| 76 | + //口岸选择 | ||
| 77 | + if (sessionStorage.getItem('portName')) { | ||
| 78 | + commit('SET_ACTIVEPORTNAME', sessionStorage.getItem('portName')) | ||
| 79 | + } else { | ||
| 80 | + commit('SET_ACTIVEPORTNAME', "PVG") | ||
| 81 | + } | ||
| 82 | + | ||
| 63 | resolve(res) | 83 | resolve(res) |
| 64 | }).catch(error => { | 84 | }).catch(error => { |
| 65 | reject(error) | 85 | reject(error) |
| ... | @@ -67,11 +87,25 @@ const user = { | ... | @@ -67,11 +87,25 @@ const user = { |
| 67 | }) | 87 | }) |
| 68 | }, | 88 | }, |
| 69 | 89 | ||
| 90 | + //切换口岸 | ||
| 91 | + changePort({ commit }, portName) { | ||
| 92 | + return new Promise((resolve, reject) => { | ||
| 93 | + changeCurrentPort({ portName: portName }).then(res=>{ | ||
| 94 | + if(res.code === 200){ | ||
| 95 | + commit('SET_ACTIVEPORTNAME',portName) | ||
| 96 | + } | ||
| 97 | + resolve(res) | ||
| 98 | + }).catch(err=>{ | ||
| 99 | + reject(err) | ||
| 100 | + }) | ||
| 101 | + }) | ||
| 102 | + }, | ||
| 103 | + | ||
| 70 | // 退出系统 | 104 | // 退出系统 |
| 71 | LogOut({ commit, state }) { | 105 | LogOut({ commit, state }) { |
| 72 | return new Promise((resolve, reject) => { | 106 | return new Promise((resolve, reject) => { |
| 73 | logout(state.token).then(() => { | 107 | logout(state.token).then(() => { |
| 74 | - | 108 | + // window.location.href = "https://sso.secure.fedex.com/logout";//wsso系统跳转 |
| 75 | commit('SET_TOKEN', '') | 109 | commit('SET_TOKEN', '') |
| 76 | commit('SET_ROLES', []) | 110 | commit('SET_ROLES', []) |
| 77 | commit('SET_PERMISSIONS', []) | 111 | commit('SET_PERMISSIONS', []) |
| ... | @@ -86,6 +120,7 @@ const user = { | ... | @@ -86,6 +120,7 @@ const user = { |
| 86 | // 前端 登出 | 120 | // 前端 登出 |
| 87 | FedLogOut({ commit }) { | 121 | FedLogOut({ commit }) { |
| 88 | return new Promise(resolve => { | 122 | return new Promise(resolve => { |
| 123 | + // window.location.href = "https://sso.secure.fedex.com/logout";//wsso系统跳转 | ||
| 89 | commit('SET_TOKEN', '') | 124 | commit('SET_TOKEN', '') |
| 90 | removeToken() | 125 | removeToken() |
| 91 | resolve() | 126 | resolve() | ... | ... |
| ... | @@ -17,5 +17,6 @@ export function setToken(token) { | ... | @@ -17,5 +17,6 @@ export function setToken(token) { |
| 17 | export function removeToken() { | 17 | export function removeToken() { |
| 18 | //return Cookies.remove(TokenKey) | 18 | //return Cookies.remove(TokenKey) |
| 19 | // return localStorage.removeItem(TokenKey) | 19 | // return localStorage.removeItem(TokenKey) |
| 20 | + sessionStorage.removeItem('portName') | ||
| 20 | return sessionStorage.removeItem(TokenKey) | 21 | return sessionStorage.removeItem(TokenKey) |
| 21 | } | 22 | } | ... | ... |
| ... | @@ -280,6 +280,7 @@ | ... | @@ -280,6 +280,7 @@ |
| 280 | <el-button | 280 | <el-button |
| 281 | :type="downLoadingTip.downloading ? 'warning' : 'primary'" | 281 | :type="downLoadingTip.downloading ? 'warning' : 'primary'" |
| 282 | size="mini" | 282 | size="mini" |
| 283 | + v-hasPermi="['allocation:cargo:export']" | ||
| 283 | @click="xlsx(0)" | 284 | @click="xlsx(0)" |
| 284 | :loading="downLoadingTip.downloading" | 285 | :loading="downLoadingTip.downloading" |
| 285 | :disabled="tableData.length <= 0" | 286 | :disabled="tableData.length <= 0" |
| ... | @@ -290,6 +291,7 @@ | ... | @@ -290,6 +291,7 @@ |
| 290 | <el-button | 291 | <el-button |
| 291 | :type="downLoadingTip.downloading ? 'warning' : 'primary'" | 292 | :type="downLoadingTip.downloading ? 'warning' : 'primary'" |
| 292 | size="mini" | 293 | size="mini" |
| 294 | + v-hasPermi="['allocation:cargo:export']" | ||
| 293 | @click="xlsx(1)" | 295 | @click="xlsx(1)" |
| 294 | :loading="downLoadingTip.downloading" | 296 | :loading="downLoadingTip.downloading" |
| 295 | :disabled="tableData.length <= 0" | 297 | :disabled="tableData.length <= 0" |
| ... | @@ -300,6 +302,7 @@ | ... | @@ -300,6 +302,7 @@ |
| 300 | <el-button | 302 | <el-button |
| 301 | type="primary" | 303 | type="primary" |
| 302 | size="mini" | 304 | size="mini" |
| 305 | + v-hasPermi="['allocation:cargo:allocation']" | ||
| 303 | @click="addFit" | 306 | @click="addFit" |
| 304 | :disabled="tableSelection.length <= 0" | 307 | :disabled="tableSelection.length <= 0" |
| 305 | >添加到航班</el-button | 308 | >添加到航班</el-button | ... | ... |
| ... | @@ -36,6 +36,7 @@ | ... | @@ -36,6 +36,7 @@ |
| 36 | type="primary" | 36 | type="primary" |
| 37 | icon="el-icon-plus" | 37 | icon="el-icon-plus" |
| 38 | size="mini" | 38 | size="mini" |
| 39 | + v-hasPermi="['allocation:alloc:add']" | ||
| 39 | @click="$router.push({ name: 'FlightAllocConfigAdd', params: { handle: 'add' } })" | 40 | @click="$router.push({ name: 'FlightAllocConfigAdd', params: { handle: 'add' } })" |
| 40 | >添加</el-button | 41 | >添加</el-button |
| 41 | > | 42 | > |
| ... | @@ -76,6 +77,7 @@ | ... | @@ -76,6 +77,7 @@ |
| 76 | type="text" | 77 | type="text" |
| 77 | size="mini" | 78 | size="mini" |
| 78 | icon="el-icon-edit" | 79 | icon="el-icon-edit" |
| 80 | + v-hasPermi="['allocation:alloc:update']" | ||
| 79 | @click="handleClick(scope.row.id, 'update')" | 81 | @click="handleClick(scope.row.id, 'update')" |
| 80 | >修改</el-button | 82 | >修改</el-button |
| 81 | > | 83 | > |
| ... | @@ -83,6 +85,7 @@ | ... | @@ -83,6 +85,7 @@ |
| 83 | type="text" | 85 | type="text" |
| 84 | size="mini" | 86 | size="mini" |
| 85 | icon="el-icon-delete" | 87 | icon="el-icon-delete" |
| 88 | + v-hasPermi="['allocation:alloc:delete']" | ||
| 86 | @click="del(scope.row.id, scope.row.status)" | 89 | @click="del(scope.row.id, scope.row.status)" |
| 87 | >删除</el-button | 90 | >删除</el-button |
| 88 | > | 91 | > |
| ... | @@ -90,6 +93,7 @@ | ... | @@ -90,6 +93,7 @@ |
| 90 | type="text" | 93 | type="text" |
| 91 | size="mini" | 94 | size="mini" |
| 92 | icon="el-icon-video-pause" | 95 | icon="el-icon-video-pause" |
| 96 | + v-hasPermi="['allocation:alloc:openClose']" | ||
| 93 | @click="changeStatus(scope.row.id, 3)" | 97 | @click="changeStatus(scope.row.id, 3)" |
| 94 | v-if="scope.row.status == '1'" | 98 | v-if="scope.row.status == '1'" |
| 95 | >停用</el-button | 99 | >停用</el-button |
| ... | @@ -98,6 +102,7 @@ | ... | @@ -98,6 +102,7 @@ |
| 98 | type="text" | 102 | type="text" |
| 99 | size="mini" | 103 | size="mini" |
| 100 | icon="el-icon-video-play" | 104 | icon="el-icon-video-play" |
| 105 | + v-hasPermi="['allocation:alloc:openClose']" | ||
| 101 | @click="changeStatus(scope.row.id, 1)" | 106 | @click="changeStatus(scope.row.id, 1)" |
| 102 | v-else | 107 | v-else |
| 103 | >启用</el-button | 108 | >启用</el-button | ... | ... |
This diff is collapsed. Click to expand it.
| ... | @@ -102,6 +102,7 @@ | ... | @@ -102,6 +102,7 @@ |
| 102 | :loading="downLoadingTip.downloading" | 102 | :loading="downLoadingTip.downloading" |
| 103 | icon="el-icon-download" | 103 | icon="el-icon-download" |
| 104 | size="mini" | 104 | size="mini" |
| 105 | + v-hasPermi="['base:caExport:export']" | ||
| 105 | >{{ | 106 | >{{ |
| 106 | downLoadingTip.downloading ? downLoadingTip.tip : "导出" | 107 | downLoadingTip.downloading ? downLoadingTip.tip : "导出" |
| 107 | }}</el-button | 108 | }}</el-button | ... | ... |
| ... | @@ -4,12 +4,12 @@ | ... | @@ -4,12 +4,12 @@ |
| 4 | <el-form-item> | 4 | <el-form-item> |
| 5 | <el-upload action="/caPreReviewImport/importFlight" name="file" :http-request="uploadExcel" | 5 | <el-upload action="/caPreReviewImport/importFlight" name="file" :http-request="uploadExcel" |
| 6 | :on-remove="handleRemove" :limit="1" :on-exceed="handleExceed" :file-list="fileList" accept=".xlsx" | 6 | :on-remove="handleRemove" :limit="1" :on-exceed="handleExceed" :file-list="fileList" accept=".xlsx" |
| 7 | - class="upload-demo"> | 7 | + class="upload-demo" v-hasPermi="['base:caImport:import']"> |
| 8 | <el-button type="primary">点击上传</el-button> | 8 | <el-button type="primary">点击上传</el-button> |
| 9 | </el-upload> | 9 | </el-upload> |
| 10 | </el-form-item> | 10 | </el-form-item> |
| 11 | <el-form-item> | 11 | <el-form-item> |
| 12 | - <el-button type="primary" @click="downloadTempleate">下载模板</el-button> | 12 | + <el-button type="primary" @click="downloadTempleate" v-hasPermi="['base:caImport:download']">下载模板</el-button> |
| 13 | </el-form-item> | 13 | </el-form-item> |
| 14 | </el-form> | 14 | </el-form> |
| 15 | <div style="font-size: 12px; font-weight: 700"> | 15 | <div style="font-size: 12px; font-weight: 700"> | ... | ... |
| ... | @@ -23,12 +23,13 @@ | ... | @@ -23,12 +23,13 @@ |
| 23 | :file-list="fileList" | 23 | :file-list="fileList" |
| 24 | accept=".xlsx" | 24 | accept=".xlsx" |
| 25 | class="upload-demo" | 25 | class="upload-demo" |
| 26 | + v-hasPermi="['base:flightImport:importFlight']" | ||
| 26 | > | 27 | > |
| 27 | <el-button type="primary">点击上传</el-button> | 28 | <el-button type="primary">点击上传</el-button> |
| 28 | </el-upload> | 29 | </el-upload> |
| 29 | </el-form-item> | 30 | </el-form-item> |
| 30 | <el-form-item> | 31 | <el-form-item> |
| 31 | - <el-button type="primary" @click="downloadTempleate" | 32 | + <el-button type="primary" @click="downloadTempleate" v-hasPermi="['base:flightImport:exportExcel']" |
| 32 | >下载模板</el-button | 33 | >下载模板</el-button |
| 33 | > | 34 | > |
| 34 | </el-form-item> | 35 | </el-form-item> | ... | ... |
| ... | @@ -50,11 +50,11 @@ | ... | @@ -50,11 +50,11 @@ |
| 50 | 50 | ||
| 51 | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | 51 | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> |
| 52 | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | 52 | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> |
| 53 | - <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button> | 53 | + <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['base:flightInfo:add']">新增</el-button> |
| 54 | - <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除 | 54 | + <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['base:flightInfo:delete']">删除 |
| 55 | </el-button> | 55 | </el-button> |
| 56 | - <el-button type="primary" icon="el-icon-circle-check" size="mini" @click="handleFlightStatus('flightStatus10')">自动配舱开启</el-button> | 56 | + <el-button type="primary" icon="el-icon-circle-check" size="mini" @click="handleFlightStatus('flightStatus10')" v-hasPermi="['base:flightInfo:open']">自动配舱开启</el-button> |
| 57 | - <el-button type="primary" icon="el-icon-circle-close" size="mini" @click="handleFlightStatus('flightStatus80')">自动配舱关闭</el-button> | 57 | + <el-button type="primary" icon="el-icon-circle-close" size="mini" @click="handleFlightStatus('flightStatus80')" v-hasPermi="['base:flightInfo:close']">自动配舱关闭</el-button> |
| 58 | 58 | ||
| 59 | </el-form> | 59 | </el-form> |
| 60 | <!-- <el-row :gutter="10" class="mb8"> | 60 | <!-- <el-row :gutter="10" class="mb8"> |
| ... | @@ -112,9 +112,9 @@ | ... | @@ -112,9 +112,9 @@ |
| 112 | <el-table-column label="最后修改时间" align="center" prop="lastModifyTime" width="120" /> | 112 | <el-table-column label="最后修改时间" align="center" prop="lastModifyTime" width="120" /> |
| 113 | 113 | ||
| 114 | <el-table-column v-if="findAllFltDatList.length>0" label="操作" align="center" | 114 | <el-table-column v-if="findAllFltDatList.length>0" label="操作" align="center" |
| 115 | - class-name="small-padding fixed-width" width="130" fixed="right"> | 115 | + class-name="small-padding fixed-width" width="130" fixed="right" style="top:0!important"> |
| 116 | <template slot-scope="scope"> | 116 | <template slot-scope="scope"> |
| 117 | - <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button> | 117 | + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['base:flightInfo:update']">修改</el-button> |
| 118 | <!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row,'删除')"> | 118 | <!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row,'删除')"> |
| 119 | 删除</el-button> --> | 119 | 删除</el-button> --> |
| 120 | </template> | 120 | </template> | ... | ... |
| ... | @@ -216,10 +216,10 @@ | ... | @@ -216,10 +216,10 @@ |
| 216 | @click="select(0)" | 216 | @click="select(0)" |
| 217 | >查询</el-button | 217 | >查询</el-button |
| 218 | > | 218 | > |
| 219 | - <el-button :type="downLoadingTip.downloading?'warning':'primary'" size="small" @click="xlse(0)" :disabled="tableData.length==0" :loading="downLoadingTip.downloading" | 219 | + <el-button :type="downLoadingTip.downloading?'warning':'primary'" size="small" @click="xlse(0)" :disabled="tableData.length==0" :loading="downLoadingTip.downloading" v-hasPermi="['base:cargo:export']" |
| 220 | >{{downLoadingTip.downloading?downLoadingTip.tip:"导出本页查询结果"}}</el-button | 220 | >{{downLoadingTip.downloading?downLoadingTip.tip:"导出本页查询结果"}}</el-button |
| 221 | > | 221 | > |
| 222 | - <el-button :type="downLoadingTip.downloading?'warning':'primary'" size="small" @click="xlse(1)" :disabled="tableData.length==0" :loading="downLoadingTip.downloading" | 222 | + <el-button :type="downLoadingTip.downloading?'warning':'primary'" size="small" @click="xlse(1)" :disabled="tableData.length==0" :loading="downLoadingTip.downloading" v-hasPermi="['base:cargo:export']" |
| 223 | >{{downLoadingTip.downloading?downLoadingTip.tip:"导出全部查询结果"}}</el-button | 223 | >{{downLoadingTip.downloading?downLoadingTip.tip:"导出全部查询结果"}}</el-button |
| 224 | > | 224 | > |
| 225 | <span style="marginLeft:20px;color:#ffba00">全部导出上限80000条数据</span> | 225 | <span style="marginLeft:20px;color:#ffba00">全部导出上限80000条数据</span> |
| ... | @@ -706,7 +706,7 @@ export default { | ... | @@ -706,7 +706,7 @@ export default { |
| 706 | limitSize: 100, //无限制-1 | 706 | limitSize: 100, //无限制-1 |
| 707 | page:1, | 707 | page:1, |
| 708 | progress:0, | 708 | progress:0, |
| 709 | - formShow:false, | 709 | + formShow:true, |
| 710 | }; | 710 | }; |
| 711 | }, | 711 | }, |
| 712 | created() { | 712 | created() { | ... | ... |
src/views/systemConfig/menuConfig/drawer.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="menuDrawer"> | ||
| 3 | + <el-dialog | ||
| 4 | + :title="drawerTitle" | ||
| 5 | + width="50%" | ||
| 6 | + :visible.sync="dialogVisible" | ||
| 7 | + :close-on-click-modal="false" | ||
| 8 | + :append-to-body="true" | ||
| 9 | + > | ||
| 10 | + <el-form | ||
| 11 | + ref="userForm" | ||
| 12 | + :model="menuForm" | ||
| 13 | + :disabled="menuFormDisabled" | ||
| 14 | + :rules="rules" | ||
| 15 | + label-width="auto" | ||
| 16 | + style="margin: 10px" | ||
| 17 | + > | ||
| 18 | + <el-row> | ||
| 19 | + <el-col :span="12"> | ||
| 20 | + <el-form-item label="菜单名称" prop=""> | ||
| 21 | + <!-- <el-input | ||
| 22 | + placeholder="请输入权限名" | ||
| 23 | + :disabled="menuFormDisabled" | ||
| 24 | + v-model="menuData.userName" | ||
| 25 | + size="mini" | ||
| 26 | + ></el-input> --> | ||
| 27 | + </el-form-item> | ||
| 28 | + </el-col> | ||
| 29 | + <el-col :span="12"> | ||
| 30 | + <el-form-item label="菜单路由" prop=""> | ||
| 31 | + <!-- <el-input | ||
| 32 | + placeholder="请输入权限名" | ||
| 33 | + :disabled="menuFormDisabled" | ||
| 34 | + v-model="menuData.userName" | ||
| 35 | + size="mini" | ||
| 36 | + ></el-input> --> | ||
| 37 | + </el-form-item> | ||
| 38 | + </el-col> | ||
| 39 | + <el-col :span="12"> | ||
| 40 | + <el-form-item label="组件名称" prop=""> | ||
| 41 | + <!-- <el-input | ||
| 42 | + placeholder="请输入权限名" | ||
| 43 | + :disabled="menuFormDisabled" | ||
| 44 | + v-model="menuData.userName" | ||
| 45 | + size="mini" | ||
| 46 | + ></el-input> --> | ||
| 47 | + </el-form-item> | ||
| 48 | + </el-col> | ||
| 49 | + <el-col :span="24"> | ||
| 50 | + <el-form-item label="菜单状态" prop=""> | ||
| 51 | + <el-switch | ||
| 52 | + v-model="menuData.menuStatus" | ||
| 53 | + active-color="#13ce66" | ||
| 54 | + inactive-color="#ff4949" | ||
| 55 | + :disabled="menuFormDisabled" | ||
| 56 | + ></el-switch> | ||
| 57 | + </el-form-item> | ||
| 58 | + </el-col> | ||
| 59 | + <el-col :span="24"> | ||
| 60 | + <el-form-item label="图标选择" prop=""> | ||
| 61 | + <iconSelect @selected="selected"></iconSelect> | ||
| 62 | + </el-form-item> | ||
| 63 | + </el-col> | ||
| 64 | + <el-col :span="24"> | ||
| 65 | + <el-form-item label="权限设置" prop=""> | ||
| 66 | + <el-col :span="6"> | ||
| 67 | + <el-radio label="页面" size="medium"></el-radio> | ||
| 68 | + </el-col> | ||
| 69 | + <el-col :span="6"> | ||
| 70 | + <el-radio label="按钮" size="medium"></el-radio> | ||
| 71 | + </el-col> | ||
| 72 | + <el-col :span="24"> | ||
| 73 | + <el-card shadow="never"> | ||
| 74 | + <el-input placeholder=""></el-input> | ||
| 75 | + </el-card> | ||
| 76 | + </el-col> | ||
| 77 | + </el-form-item> | ||
| 78 | + </el-col> | ||
| 79 | + </el-row> | ||
| 80 | + </el-form> | ||
| 81 | + | ||
| 82 | + <div slot="footer"> | ||
| 83 | + <el-button @click="handleClose">取 消</el-button> | ||
| 84 | + <el-button type="primary" @click="submit">确 定</el-button> | ||
| 85 | + </div> | ||
| 86 | + </el-dialog> | ||
| 87 | + </div> | ||
| 88 | +</template> | ||
| 89 | + | ||
| 90 | +<script> | ||
| 91 | +import iconSelect from "@/components/IconSelect"; | ||
| 92 | +export default { | ||
| 93 | + components: { | ||
| 94 | + iconSelect, | ||
| 95 | + }, | ||
| 96 | + props: { | ||
| 97 | + drawerTitle: { | ||
| 98 | + type: String, | ||
| 99 | + default: "", | ||
| 100 | + }, | ||
| 101 | + menuFormDisabled: { | ||
| 102 | + type: Boolean, | ||
| 103 | + default: false, | ||
| 104 | + }, | ||
| 105 | + dialogVisible: { | ||
| 106 | + type: Boolean, | ||
| 107 | + default: false, | ||
| 108 | + }, | ||
| 109 | + menuData: { | ||
| 110 | + type: Object, | ||
| 111 | + default: null, | ||
| 112 | + }, | ||
| 113 | + }, | ||
| 114 | + data() { | ||
| 115 | + return { | ||
| 116 | + menuForm: {}, | ||
| 117 | + rules:{} | ||
| 118 | + }; | ||
| 119 | + }, | ||
| 120 | + updated() { | ||
| 121 | + this.menuForm = this.menuData; | ||
| 122 | + }, | ||
| 123 | + methods: { | ||
| 124 | + handleClose() { | ||
| 125 | + this.$emit("handleClose", false); | ||
| 126 | + }, | ||
| 127 | + selected(val) { | ||
| 128 | + console.log(val); | ||
| 129 | + }, | ||
| 130 | + submit() {}, | ||
| 131 | + }, | ||
| 132 | +}; | ||
| 133 | +</script> | ||
| 134 | + | ||
| 135 | +<style> | ||
| 136 | +</style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
src/views/systemConfig/menuConfig/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div> | ||
| 3 | + <el-form ref="selectionUserForm" label-width="auto" style="margin: 20px"> | ||
| 4 | + <el-row :gutter="50"> </el-row> | ||
| 5 | + </el-form> | ||
| 6 | + <!-- <div style="margin:20px"> | ||
| 7 | + <el-button type="primary" icon="el-icon-plus" size="mini" @click="addMenu" | ||
| 8 | + >新增菜单</el-button | ||
| 9 | + > | ||
| 10 | + </div> --> | ||
| 11 | + <el-table | ||
| 12 | + :data="data" | ||
| 13 | + row-key="id" | ||
| 14 | + fit | ||
| 15 | + border | ||
| 16 | + stripe | ||
| 17 | + highlightCurrentRow | ||
| 18 | + v-loading="loading" | ||
| 19 | + default-expand-all | ||
| 20 | + :tree-props="{ children: 'children', hasChildren: 'hasChildren' }" | ||
| 21 | + > | ||
| 22 | + <el-table-column | ||
| 23 | + v-for="(item, index) in tableHeader" | ||
| 24 | + :prop="item.value" | ||
| 25 | + :label="item.name" | ||
| 26 | + :key="index" | ||
| 27 | + :align="item.align" | ||
| 28 | + header-align="center" | ||
| 29 | + showOverflowTooltip | ||
| 30 | + :width="item.width" | ||
| 31 | + :formatter="formatter" | ||
| 32 | + > | ||
| 33 | + </el-table-column> | ||
| 34 | + <el-table-column | ||
| 35 | + header-align="center" | ||
| 36 | + align="center" | ||
| 37 | + label="操作" | ||
| 38 | + width="auto" | ||
| 39 | + > | ||
| 40 | + <template slot-scope="scope"> | ||
| 41 | + <!-- <el-button type="success" size="mini" @click="buttonClick(scope)">修改</el-button> | ||
| 42 | + <el-button type="primary" size="mini" @click="buttonClick(scope)" | ||
| 43 | + >查看</el-button | ||
| 44 | + > --> | ||
| 45 | + <el-button | ||
| 46 | + :type="scope.row.status == 1 ? 'warning' : 'primary'" | ||
| 47 | + v-hasPermi="['system:menu:openClose']" | ||
| 48 | + size="mini" | ||
| 49 | + @click="menuStatus(scope)" | ||
| 50 | + v-if="scope.row.menuType == 'C'" | ||
| 51 | + >{{ scope.row.status == 1 ? "停用菜单" : "启用菜单" }}</el-button | ||
| 52 | + > | ||
| 53 | + <el-button | ||
| 54 | + type="danger" | ||
| 55 | + size="mini" | ||
| 56 | + v-hasPermi="['system:menu:delete']" | ||
| 57 | + @click="removeMenu(scope)" | ||
| 58 | + v-if="scope.row.menuType == 'C'" | ||
| 59 | + >删除菜单</el-button | ||
| 60 | + > | ||
| 61 | + </template> | ||
| 62 | + </el-table-column> | ||
| 63 | + </el-table> | ||
| 64 | + | ||
| 65 | + <!-- <Tables | ||
| 66 | + ref="newTable" | ||
| 67 | + :data="data" | ||
| 68 | + :headerData="tableHeader" | ||
| 69 | + size="medium" | ||
| 70 | + rowKey="id" | ||
| 71 | + :defaultExpandAll="true" | ||
| 72 | + height="auto" | ||
| 73 | + @tableSelect="tableSelect" | ||
| 74 | + @tableSelectAll="tableSelectAll" | ||
| 75 | + @SelectChange="SelectChange" | ||
| 76 | + > | ||
| 77 | + <el-table-column | ||
| 78 | + header-align="center" | ||
| 79 | + align="center" | ||
| 80 | + label="操作" | ||
| 81 | + width="auto" | ||
| 82 | + > | ||
| 83 | + <template slot-scope="scope"> | ||
| 84 | + <el-button type="primary" size="mini" @click="menuStatus(scope)">{{ | ||
| 85 | + scope.menuStatus == 0 ? "停用" : "启用" | ||
| 86 | + }}</el-button> | ||
| 87 | + <el-button type="danger" size="mini" @click="removeMenu(scope)" | ||
| 88 | + >删除菜单</el-button | ||
| 89 | + > | ||
| 90 | + </template> | ||
| 91 | + </el-table-column> | ||
| 92 | + </Tables> --> | ||
| 93 | + <!-- <Drawer | ||
| 94 | + :dialogVisible="drawer" | ||
| 95 | + :drawerTitle="drawerTitle" | ||
| 96 | + :menuFormDisabled="menuFormDisabled" | ||
| 97 | + :menuData="menuData" | ||
| 98 | + @handleClose="handleClose" | ||
| 99 | + ></Drawer> --> | ||
| 100 | + </div> | ||
| 101 | +</template> | ||
| 102 | + | ||
| 103 | +<script> | ||
| 104 | +import { getAllAuth, updateStatus } from "@/api/system/user.js"; | ||
| 105 | +import dictLabels from "@/assets/languages/dictLabels.js"; | ||
| 106 | +import Drawer from "./drawer.vue"; | ||
| 107 | +import { MessageBox } from "element-ui"; | ||
| 108 | +export default { | ||
| 109 | + name:"menuConfig", | ||
| 110 | + components: { | ||
| 111 | + Drawer, | ||
| 112 | + }, | ||
| 113 | + data() { | ||
| 114 | + return { | ||
| 115 | + drawer: false, | ||
| 116 | + menuFormDisabled: false, | ||
| 117 | + loading:false, | ||
| 118 | + drawerTitle: "", | ||
| 119 | + menuData: {}, | ||
| 120 | + data: [], | ||
| 121 | + tableHeader: [ | ||
| 122 | + { | ||
| 123 | + type: "", | ||
| 124 | + name: "菜单名", | ||
| 125 | + value: "title", | ||
| 126 | + width: "200", | ||
| 127 | + align: "left", | ||
| 128 | + sorTable: false, | ||
| 129 | + }, | ||
| 130 | + { | ||
| 131 | + type: "", | ||
| 132 | + name: "菜单类型", | ||
| 133 | + value: "menuType", | ||
| 134 | + width: "100", | ||
| 135 | + align: "center", | ||
| 136 | + sortable: false, | ||
| 137 | + }, | ||
| 138 | + { | ||
| 139 | + type: "", | ||
| 140 | + name: "权限标识", | ||
| 141 | + value: "permissionKey", | ||
| 142 | + width: "auto", | ||
| 143 | + align: "left", | ||
| 144 | + sortable: false, | ||
| 145 | + }, | ||
| 146 | + { | ||
| 147 | + type: "", | ||
| 148 | + name: "菜单状态", | ||
| 149 | + value: "status", | ||
| 150 | + width: "100", | ||
| 151 | + align: "center", | ||
| 152 | + sorTable: false, | ||
| 153 | + }, | ||
| 154 | + { | ||
| 155 | + type: "", | ||
| 156 | + name: "菜单路由", | ||
| 157 | + value: "path", | ||
| 158 | + width: "auto", | ||
| 159 | + align: "left", | ||
| 160 | + sorTable: false, | ||
| 161 | + }, | ||
| 162 | + ], | ||
| 163 | + }; | ||
| 164 | + }, | ||
| 165 | + created() { | ||
| 166 | + this.menuAll(); | ||
| 167 | + }, | ||
| 168 | + methods: { | ||
| 169 | + addMenu() { | ||
| 170 | + this.menuData = {}; | ||
| 171 | + this.drawer = true; | ||
| 172 | + this.drawerTitle = "新增菜单"; | ||
| 173 | + this.menuFormDisabled = false; | ||
| 174 | + }, | ||
| 175 | + | ||
| 176 | + //关闭 | ||
| 177 | + handleClose(val) { | ||
| 178 | + this.drawer = val; | ||
| 179 | + }, | ||
| 180 | + | ||
| 181 | + buttonClick(row) { | ||
| 182 | + this.menuData = row.row; | ||
| 183 | + this.drawer = true; | ||
| 184 | + this.drawerTitle = "查看/修改"; | ||
| 185 | + this.menuFormDisabled = true; | ||
| 186 | + }, | ||
| 187 | + | ||
| 188 | + //表格数据 | ||
| 189 | + menuAll() { | ||
| 190 | + this.loading = true; | ||
| 191 | + getAllAuth().then((res) => { | ||
| 192 | + this.loading = false; | ||
| 193 | + if (res.code === 200) { | ||
| 194 | + res.data.length > 0 | ||
| 195 | + ? (this.data = res.data) | ||
| 196 | + : this.$message({ | ||
| 197 | + message: "数据为空", | ||
| 198 | + type: "warning", | ||
| 199 | + }); | ||
| 200 | + } else { | ||
| 201 | + this.$message({ | ||
| 202 | + message: res.msg, | ||
| 203 | + type: "warning", | ||
| 204 | + }); | ||
| 205 | + } | ||
| 206 | + }).catch(()=>{ | ||
| 207 | + this.loading = false; | ||
| 208 | + }); | ||
| 209 | + }, | ||
| 210 | + | ||
| 211 | + //菜单状态改变 | ||
| 212 | + statusUpdate(data) { | ||
| 213 | + updateStatus(data) | ||
| 214 | + .then((res) => { | ||
| 215 | + if (res.code === 200) { | ||
| 216 | + this.menuAll(); | ||
| 217 | + this.$message({ | ||
| 218 | + message: "操作成功", | ||
| 219 | + type: "success", | ||
| 220 | + }); | ||
| 221 | + location.reload() | ||
| 222 | + } else { | ||
| 223 | + this.$message({ | ||
| 224 | + message: res.msg, | ||
| 225 | + type: "warning", | ||
| 226 | + }); | ||
| 227 | + } | ||
| 228 | + }) | ||
| 229 | + .catch((err) => { | ||
| 230 | + console.log(err); | ||
| 231 | + }); | ||
| 232 | + }, | ||
| 233 | + | ||
| 234 | + //菜单开启关闭 | ||
| 235 | + menuStatus(row) { | ||
| 236 | + MessageBox.confirm( | ||
| 237 | + row.row.status == 1 ? "是否要关闭此菜单" : "是否要启用此菜单", | ||
| 238 | + "提示", | ||
| 239 | + { | ||
| 240 | + confirmButtonText: "确定", | ||
| 241 | + cancelButtonText: "取消", | ||
| 242 | + type: "warning", | ||
| 243 | + } | ||
| 244 | + ) | ||
| 245 | + .then(() => { | ||
| 246 | + let data = {}; | ||
| 247 | + data.id = row.row.id; | ||
| 248 | + data.status = row.row.status == 1 ? "2" : "1"; | ||
| 249 | + this.statusUpdate(data); | ||
| 250 | + }) | ||
| 251 | + .catch(() => {}); | ||
| 252 | + }, | ||
| 253 | + | ||
| 254 | + //菜单删除 | ||
| 255 | + removeMenu(row) { | ||
| 256 | + MessageBox.confirm("是否要删除此菜单", "提示", { | ||
| 257 | + confirmButtonText: "确定删除", | ||
| 258 | + cancelButtonText: "取消", | ||
| 259 | + type: "warning", | ||
| 260 | + }) | ||
| 261 | + .then(() => { | ||
| 262 | + let data = {}; | ||
| 263 | + data.id = row.row.id; | ||
| 264 | + data.status = "0"; | ||
| 265 | + this.statusUpdate(data); | ||
| 266 | + }) | ||
| 267 | + .catch(() => {}); | ||
| 268 | + }, | ||
| 269 | + | ||
| 270 | + formatter(row, column, cellValue, index) { | ||
| 271 | + if (dictLabels[column.property]) { | ||
| 272 | + if (dictLabels[column.property][cellValue]) { | ||
| 273 | + return dictLabels[column.property][cellValue]; | ||
| 274 | + } | ||
| 275 | + } | ||
| 276 | + return cellValue; | ||
| 277 | + }, | ||
| 278 | + }, | ||
| 279 | +}; | ||
| 280 | +</script> | ||
| 281 | + | ||
| 282 | +<style> | ||
| 283 | +</style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
src/views/systemConfig/roleConfig/drawer.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="roleDrawer"> | ||
| 3 | + <el-drawer | ||
| 4 | + :title="drawerTitle" | ||
| 5 | + :visible.sync="drawer" | ||
| 6 | + direction="rtl" | ||
| 7 | + size="40%" | ||
| 8 | + destroy-on-close | ||
| 9 | + :close-on-click-modal="false" | ||
| 10 | + :wrapperClosable="false" | ||
| 11 | + :show-close="false" | ||
| 12 | + > | ||
| 13 | + <el-form | ||
| 14 | + ref="roleForm" | ||
| 15 | + :model="roleForm" | ||
| 16 | + label-width="auto" | ||
| 17 | + :rules="rules" | ||
| 18 | + size="mini" | ||
| 19 | + style="margin: 10px" | ||
| 20 | + > | ||
| 21 | + <el-row :gutter="10"> | ||
| 22 | + <el-col :span="12"> | ||
| 23 | + <el-form-item label="角色名:" prop="name"> | ||
| 24 | + <el-input | ||
| 25 | + placeholder="请输入角色名" | ||
| 26 | + v-model.trim="roleForm.name" | ||
| 27 | + :disabled="roleFormDisabled" | ||
| 28 | + v-if="!roleFormDisabled" | ||
| 29 | + ></el-input> | ||
| 30 | + <div v-else>{{ roleData.name }}</div> | ||
| 31 | + </el-form-item> | ||
| 32 | + </el-col> | ||
| 33 | + <el-col :span="24"> | ||
| 34 | + <el-form-item label="角色描述:" prop="remark"> | ||
| 35 | + <el-input | ||
| 36 | + v-model="roleForm.remark" | ||
| 37 | + type="textarea" | ||
| 38 | + placeholder="请输入角色描述" | ||
| 39 | + :disabled="roleFormDisabled" | ||
| 40 | + v-if="!roleFormDisabled" | ||
| 41 | + ></el-input> | ||
| 42 | + <div v-else>{{ roleData.remark }}</div> | ||
| 43 | + </el-form-item> | ||
| 44 | + </el-col> | ||
| 45 | + <!-- <el-col :span="24"> | ||
| 46 | + <el-form-item label="角色状态:" prop="valid"> | ||
| 47 | + <el-switch | ||
| 48 | + v-model="roleForm.valid" | ||
| 49 | + :active-value="1" | ||
| 50 | + :inactive-value="2" | ||
| 51 | + active-color="#13ce66" | ||
| 52 | + inactive-color="#ff4949" | ||
| 53 | + :disabled="roleFormDisabled" | ||
| 54 | + ></el-switch> | ||
| 55 | + </el-form-item> | ||
| 56 | + </el-col> --> | ||
| 57 | + <el-col :span="24"> | ||
| 58 | + <el-form-item label="角色权限:" prop="menuIdList"> | ||
| 59 | + <el-tree | ||
| 60 | + ref="tree" | ||
| 61 | + :data="treeData" | ||
| 62 | + node-key="id" | ||
| 63 | + :props="defaultProps" | ||
| 64 | + :show-checkbox="true" | ||
| 65 | + :default-checked-keys="roleData.menuIds" | ||
| 66 | + check-strictly | ||
| 67 | + accordion | ||
| 68 | + > | ||
| 69 | + </el-tree> | ||
| 70 | + </el-form-item> | ||
| 71 | + </el-col> | ||
| 72 | + </el-row> | ||
| 73 | + <el-form-item> | ||
| 74 | + <el-button | ||
| 75 | + type="primary" | ||
| 76 | + v-if="!roleFormDisabled" | ||
| 77 | + size="mini" | ||
| 78 | + :loading="loading" | ||
| 79 | + @click="submit" | ||
| 80 | + >提交</el-button | ||
| 81 | + > | ||
| 82 | + <el-button type="primary" size="mini" @click="handleClose" | ||
| 83 | + >取消</el-button | ||
| 84 | + > | ||
| 85 | + </el-form-item> | ||
| 86 | + </el-form> | ||
| 87 | + </el-drawer> | ||
| 88 | + </div> | ||
| 89 | +</template> | ||
| 90 | + | ||
| 91 | +<script> | ||
| 92 | +import { getAllAuth, addOrUpdateRole } from "@/api/system/user.js"; | ||
| 93 | +export default { | ||
| 94 | + props: { | ||
| 95 | + drawerTitle: { | ||
| 96 | + type: String, | ||
| 97 | + default: "", | ||
| 98 | + }, | ||
| 99 | + roleFormDisabled: { | ||
| 100 | + type: Boolean, | ||
| 101 | + default: false, | ||
| 102 | + }, | ||
| 103 | + drawer: { | ||
| 104 | + type: Boolean, | ||
| 105 | + default: false, | ||
| 106 | + }, | ||
| 107 | + roleData: { | ||
| 108 | + type: Object, | ||
| 109 | + default: null, | ||
| 110 | + }, | ||
| 111 | + }, | ||
| 112 | + data() { | ||
| 113 | + return { | ||
| 114 | + roleForm: { | ||
| 115 | + name: null, | ||
| 116 | + }, | ||
| 117 | + treeData: [], | ||
| 118 | + loading: false, | ||
| 119 | + defaultProps: { | ||
| 120 | + children: "children", | ||
| 121 | + label: "title", | ||
| 122 | + }, | ||
| 123 | + rules: { | ||
| 124 | + name: [ | ||
| 125 | + { | ||
| 126 | + required: true, | ||
| 127 | + message: "角色名不能为空", | ||
| 128 | + trigger: "blur", | ||
| 129 | + }, | ||
| 130 | + ], | ||
| 131 | + }, | ||
| 132 | + }; | ||
| 133 | + }, | ||
| 134 | + created() { | ||
| 135 | + //权限列表 | ||
| 136 | + getAllAuth() | ||
| 137 | + .then((res) => { | ||
| 138 | + if (res.code === 200) { | ||
| 139 | + this.treeData = res.data; | ||
| 140 | + } else { | ||
| 141 | + this.$message({ | ||
| 142 | + message: res.msg, | ||
| 143 | + type: "warning", | ||
| 144 | + }); | ||
| 145 | + } | ||
| 146 | + }) | ||
| 147 | + .catch((err) => { | ||
| 148 | + console.log(err); | ||
| 149 | + }); | ||
| 150 | + }, | ||
| 151 | + watch:{ | ||
| 152 | + roleFormDisabled(){ | ||
| 153 | + this.treeData = this.treeDisabled(this.treeData) | ||
| 154 | + }, | ||
| 155 | + drawer(){ | ||
| 156 | + this.roleForm = this.roleData; | ||
| 157 | + } | ||
| 158 | + }, | ||
| 159 | + methods: { | ||
| 160 | + //关闭 | ||
| 161 | + handleClose() { | ||
| 162 | + this.$emit("handleClose", false); | ||
| 163 | + }, | ||
| 164 | + | ||
| 165 | + //提交 | ||
| 166 | + submit() { | ||
| 167 | + let formData = {}; | ||
| 168 | + this.loading = true; | ||
| 169 | + formData.menuIdList = this.$refs.tree.getCheckedKeys(); | ||
| 170 | + this.roleData ? (formData.id = this.roleData.id) : ""; | ||
| 171 | + formData.remark = this.roleForm.remark; | ||
| 172 | + formData.valid = this.roleForm.valid; | ||
| 173 | + formData.name = this.roleForm.name; | ||
| 174 | + addOrUpdateRole(formData) | ||
| 175 | + .then((res) => { | ||
| 176 | + if (res.code === 200) { | ||
| 177 | + this.$message({ | ||
| 178 | + message: "操作成功", | ||
| 179 | + type: "success", | ||
| 180 | + }); | ||
| 181 | + this.loading = false; | ||
| 182 | + this.$emit("handleClose", false); | ||
| 183 | + } else { | ||
| 184 | + this.$message({ | ||
| 185 | + message: res.msg, | ||
| 186 | + type: "warning", | ||
| 187 | + }); | ||
| 188 | + } | ||
| 189 | + }) | ||
| 190 | + .catch((err) => { | ||
| 191 | + console.log(err); | ||
| 192 | + }); | ||
| 193 | + }, | ||
| 194 | + | ||
| 195 | + //权限结构禁用 | ||
| 196 | + treeDisabled(val) { | ||
| 197 | + let data = []; | ||
| 198 | + val.forEach((item) => { | ||
| 199 | + item.disabled = this.roleFormDisabled; | ||
| 200 | + data.push(item) | ||
| 201 | + if (item.children && item.children.length) { | ||
| 202 | + item.children = this.treeDisabled(item.children) | ||
| 203 | + } | ||
| 204 | + }); | ||
| 205 | + return data; | ||
| 206 | + }, | ||
| 207 | + }, | ||
| 208 | +}; | ||
| 209 | +</script> | ||
| 210 | + | ||
| 211 | +<style> | ||
| 212 | +</style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <template> | 1 | <template> |
| 2 | - <div></div> | 2 | + <div class="roleConfig"> |
| 3 | + <el-form ref="selectionRoleForm" label-width="auto" style="margin: 20px"> | ||
| 4 | + <el-row :gutter="50"> | ||
| 5 | + <el-col :span="6"> | ||
| 6 | + <el-form-item label="角色名称"> | ||
| 7 | + <el-input | ||
| 8 | + v-model="formData.name" | ||
| 9 | + placeholder="请输入角色名称" | ||
| 10 | + ></el-input> | ||
| 11 | + </el-form-item> | ||
| 12 | + </el-col> | ||
| 13 | + <el-col :span="6"> | ||
| 14 | + <el-form-item label="创建时间"> | ||
| 15 | + <el-date-picker | ||
| 16 | + v-model="createTime" | ||
| 17 | + type="daterange" | ||
| 18 | + range-separator="至" | ||
| 19 | + start-placeholder="开始日期" | ||
| 20 | + end-placeholder="结束日期" | ||
| 21 | + > | ||
| 22 | + </el-date-picker> | ||
| 23 | + </el-form-item> | ||
| 24 | + </el-col> | ||
| 25 | + <el-col :span="6"> | ||
| 26 | + <el-form-item label="状态"> | ||
| 27 | + <el-select v-model="formData.valid" placeholder="角色状态"> | ||
| 28 | + <el-option label="开启" value="1"> </el-option> | ||
| 29 | + <el-option label="关闭" value="1"> </el-option> | ||
| 30 | + </el-select> | ||
| 31 | + </el-form-item> | ||
| 32 | + </el-col> | ||
| 33 | + </el-row> | ||
| 34 | + </el-form> | ||
| 35 | + <div style="margin: 0 20px"> | ||
| 36 | + <el-button | ||
| 37 | + type="primary" | ||
| 38 | + icon="el-icon-search" | ||
| 39 | + size="mini" | ||
| 40 | + :loading="tableLoading" | ||
| 41 | + @click="selectRoleList" | ||
| 42 | + >搜索</el-button | ||
| 43 | + > | ||
| 44 | + <el-button type="primary" icon="el-icon-plus" size="mini" @click="addRole" v-hasPermi="['system:role:add']" | ||
| 45 | + >新增角色</el-button | ||
| 46 | + > | ||
| 47 | + </div> | ||
| 48 | + <Tables | ||
| 49 | + :data="data" | ||
| 50 | + :headerData="tableHeader" | ||
| 51 | + :infoData="tableHeader" | ||
| 52 | + :totalCount="total" | ||
| 53 | + :limitSize="formData.size" | ||
| 54 | + :page="formData.page" | ||
| 55 | + :loading="tableLoading" | ||
| 56 | + height="600" | ||
| 57 | + @currentChange="currentChange" | ||
| 58 | + > | ||
| 59 | + <template> | ||
| 60 | + <el-table-column header-align="center" align="center" label="操作"> | ||
| 61 | + <template slot-scope="scope"> | ||
| 62 | + <el-button type="primary" size="mini" @click="buttonClick(scope, 0)" | ||
| 63 | + >查看</el-button | ||
| 64 | + > | ||
| 65 | + <el-button type="primary" size="mini" @click="buttonClick(scope, 1)" v-hasPermi="['system:role:update']" | ||
| 66 | + >修改</el-button | ||
| 67 | + > | ||
| 68 | + <el-button | ||
| 69 | + :type="scope.row.valid == 1 ? 'warning' : 'primary'" | ||
| 70 | + size="mini" | ||
| 71 | + v-hasPermi="['system:role:openClose']" | ||
| 72 | + @click="roleStatus(scope)" | ||
| 73 | + >{{ scope.row.valid == 1 ? "停用" : "启用" }}</el-button | ||
| 74 | + > | ||
| 75 | + <el-button type="danger" size="mini" @click="removeRole(scope)" v-hasPermi="['system:role:delete']" | ||
| 76 | + >删除角色</el-button | ||
| 77 | + > | ||
| 78 | + </template> | ||
| 79 | + </el-table-column> | ||
| 80 | + </template> | ||
| 81 | + </Tables> | ||
| 82 | + <Drawer | ||
| 83 | + :drawer="drawer" | ||
| 84 | + :drawerTitle="drawerTitle" | ||
| 85 | + :roleFormDisabled="roleFormDisabled" | ||
| 86 | + :roleData="roleData" | ||
| 87 | + @handleClose="handleClose" | ||
| 88 | + ></Drawer> | ||
| 89 | + </div> | ||
| 3 | </template> | 90 | </template> |
| 4 | 91 | ||
| 5 | <script> | 92 | <script> |
| 93 | +import Drawer from "./drawer.vue"; | ||
| 94 | +import { MessageBox } from "element-ui"; | ||
| 95 | +import { | ||
| 96 | + getRoleList, | ||
| 97 | + detailRole, | ||
| 98 | + updateRoleStatus, | ||
| 99 | +} from "@/api/system/user.js"; | ||
| 6 | export default { | 100 | export default { |
| 101 | + name:"RoleConfig", | ||
| 102 | + components: { | ||
| 103 | + Drawer, | ||
| 104 | + }, | ||
| 105 | + data() { | ||
| 106 | + return { | ||
| 107 | + formData: { | ||
| 108 | + page: 1, | ||
| 109 | + size: 20, | ||
| 110 | + valid: null, | ||
| 111 | + createStart: null, | ||
| 112 | + createEnd: null, | ||
| 113 | + name: null, | ||
| 114 | + }, //查询条件 | ||
| 115 | + data: [], //表格数据 | ||
| 116 | + tableHeader: [ | ||
| 117 | + { | ||
| 118 | + type: "index", | ||
| 119 | + name: "", | ||
| 120 | + value: "", | ||
| 121 | + width: "", | ||
| 122 | + align: "center", | ||
| 123 | + sorTable: false, | ||
| 124 | + disabled:true | ||
| 125 | + }, | ||
| 126 | + { | ||
| 127 | + type: "", | ||
| 128 | + name: "角色名称", | ||
| 129 | + value: "name", | ||
| 130 | + width: "150px", | ||
| 131 | + align: "center", | ||
| 132 | + sorTable: false, | ||
| 133 | + disabled:true | ||
| 134 | + }, | ||
| 135 | + { | ||
| 136 | + type: "", | ||
| 137 | + name: "角色状态", | ||
| 138 | + value: "valid", | ||
| 139 | + width: "150px", | ||
| 140 | + align: "center", | ||
| 141 | + sorTable: false, | ||
| 142 | + disabled:true | ||
| 143 | + }, | ||
| 144 | + { | ||
| 145 | + type: "", | ||
| 146 | + name: "创建人", | ||
| 147 | + value: "remark", | ||
| 148 | + width: "150px", | ||
| 149 | + align: "center", | ||
| 150 | + sorTable: false, | ||
| 151 | + disabled:true | ||
| 152 | + }, | ||
| 153 | + { | ||
| 154 | + type: "", | ||
| 155 | + name: "创建时间", | ||
| 156 | + value: "createTime", | ||
| 157 | + width: "150px", | ||
| 158 | + align: "center", | ||
| 159 | + sorTable: false, | ||
| 160 | + disabled:true | ||
| 161 | + }, | ||
| 162 | + { | ||
| 163 | + type: "", | ||
| 164 | + name: "修改时间", | ||
| 165 | + value: "updateTime", | ||
| 166 | + width: "150px", | ||
| 167 | + align: "center", | ||
| 168 | + sorTable: false, | ||
| 169 | + disabled:true | ||
| 170 | + }, | ||
| 171 | + { | ||
| 172 | + type: "", | ||
| 173 | + name: "备注", | ||
| 174 | + value: "remark", | ||
| 175 | + width: "400px", | ||
| 176 | + align: "center", | ||
| 177 | + sorTable: false, | ||
| 178 | + disabled:true | ||
| 179 | + }, | ||
| 180 | + ], //表头数据 | ||
| 181 | + roleData: {}, //角色详情 | ||
| 182 | + createTime: [], | ||
| 183 | + drawer: false, | ||
| 184 | + drawerTitle: "", | ||
| 185 | + roleFormDisabled: false, | ||
| 186 | + tableLoading: false, | ||
| 187 | + total: 0, | ||
| 188 | + }; | ||
| 189 | + }, | ||
| 190 | + created() { | ||
| 191 | + this.selectRoleList(); | ||
| 192 | + }, | ||
| 193 | + methods: { | ||
| 194 | + //角色列表 | ||
| 195 | + selectRoleList() { | ||
| 196 | + this.tableLoading = true; | ||
| 197 | + if (this.createTime.length > 0) { | ||
| 198 | + this.formData.createStart = this.createTime[0]; | ||
| 199 | + this.formData.createEnd = this.createTime[1]; | ||
| 200 | + } | ||
| 7 | 201 | ||
| 8 | -} | 202 | + getRoleList(this.formData) |
| 203 | + .then((res) => { | ||
| 204 | + this.tableLoading = false; | ||
| 205 | + if (res.code === 200) { | ||
| 206 | + this.data = res.data.list; | ||
| 207 | + this.total = res.data.total; | ||
| 208 | + } else { | ||
| 209 | + this.$message({ | ||
| 210 | + message: res.msg, | ||
| 211 | + type: "warning", | ||
| 212 | + }); | ||
| 213 | + } | ||
| 214 | + }) | ||
| 215 | + .catch((err) => { | ||
| 216 | + this.tableLoading = false; | ||
| 217 | + console.log(err); | ||
| 218 | + }); | ||
| 219 | + }, | ||
| 220 | + | ||
| 221 | + //角色详情 | ||
| 222 | + roleDetail(id) { | ||
| 223 | + detailRole(id) | ||
| 224 | + .then((res) => { | ||
| 225 | + if (res.code === 200) { | ||
| 226 | + this.roleData = res.data; | ||
| 227 | + } else { | ||
| 228 | + this.$message({ | ||
| 229 | + message: res.msg, | ||
| 230 | + type: "warning", | ||
| 231 | + }); | ||
| 232 | + } | ||
| 233 | + }) | ||
| 234 | + .catch((err) => { | ||
| 235 | + console.log(err); | ||
| 236 | + }); | ||
| 237 | + }, | ||
| 238 | + | ||
| 239 | + //新增角色 | ||
| 240 | + addRole() { | ||
| 241 | + this.roleData = {}; | ||
| 242 | + this.drawer = true; | ||
| 243 | + this.roleFormDisabled = false; | ||
| 244 | + this.drawerTitle = "新增角色"; | ||
| 245 | + }, | ||
| 246 | + | ||
| 247 | + //修改查看角色 | ||
| 248 | + buttonClick(row, status) { | ||
| 249 | + this.roleDetail(row.row.id); | ||
| 250 | + this.roleData = row.row; | ||
| 251 | + this.drawer = true; | ||
| 252 | + status == 0 | ||
| 253 | + ? (this.roleFormDisabled = true) | ||
| 254 | + : (this.roleFormDisabled = false); | ||
| 255 | + this.drawerTitle = "查看/修改角色"; | ||
| 256 | + }, | ||
| 257 | + | ||
| 258 | + //修改角色状态 | ||
| 259 | + roleStatus(row) { | ||
| 260 | + let msg = ""; | ||
| 261 | + let status = {}; | ||
| 262 | + status.id = row.row.id; | ||
| 263 | + row.row.valid == 1 | ||
| 264 | + ? ((msg = "是否关闭此角色"), (status.valid = 2)) | ||
| 265 | + : ((msg = "是否启用此角色"), (status.valid = 1)); | ||
| 266 | + MessageBox.confirm(msg, "注意", { | ||
| 267 | + confirmButtonText: "确定", | ||
| 268 | + cancelButtonText: "取消", | ||
| 269 | + type: "warning", | ||
| 270 | + }) | ||
| 271 | + .then(() => { | ||
| 272 | + updateRoleStatus(status).then((res) => { | ||
| 273 | + if (res.code === 200) { | ||
| 274 | + this.$message({ | ||
| 275 | + message: "操作成功", | ||
| 276 | + type: "success", | ||
| 277 | + }); | ||
| 278 | + this.selectRoleList(); | ||
| 279 | + } else { | ||
| 280 | + this.$message({ | ||
| 281 | + message: res.msg, | ||
| 282 | + type: "warning", | ||
| 283 | + }); | ||
| 284 | + } | ||
| 285 | + }); | ||
| 286 | + }) | ||
| 287 | + .catch(() => []); | ||
| 288 | + }, | ||
| 289 | + | ||
| 290 | + //删除角色 | ||
| 291 | + removeRole(row) { | ||
| 292 | + MessageBox.confirm( | ||
| 293 | + "如删除此角色,角色下所有用户将从中被剔除,可能会对用户操作造成影响!", | ||
| 294 | + "注意", | ||
| 295 | + { | ||
| 296 | + confirmButtonText: "确定", | ||
| 297 | + cancelButtonText: "取消", | ||
| 298 | + type: "warning", | ||
| 299 | + } | ||
| 300 | + ) | ||
| 301 | + .then(() => { | ||
| 302 | + updateRoleStatus({ | ||
| 303 | + id: row.row.id, | ||
| 304 | + valid: 0, | ||
| 305 | + confirmDel: false, | ||
| 306 | + }).then((res) => { | ||
| 307 | + if (res.code === 200) { | ||
| 308 | + this.$message({ | ||
| 309 | + message: "删除成功", | ||
| 310 | + type: "success", | ||
| 311 | + }); | ||
| 312 | + this.selectRoleList(); | ||
| 313 | + } else if (res.code === 202) { | ||
| 314 | + MessageBox.confirm(res.msg, "注意", { | ||
| 315 | + confirmButtonText: "确定", | ||
| 316 | + cancelButtonText: "取消", | ||
| 317 | + type: "warning", | ||
| 318 | + }) | ||
| 319 | + .then(() => { | ||
| 320 | + updateRoleStatus({ | ||
| 321 | + id: row.row.id, | ||
| 322 | + valid: 0, | ||
| 323 | + confirmDel: true, | ||
| 324 | + }).then((res) => { | ||
| 325 | + if (res.code === 200) { | ||
| 326 | + this.$message({ | ||
| 327 | + message: "操作成功", | ||
| 328 | + type: "success", | ||
| 329 | + }); | ||
| 330 | + this.selectRoleList(); | ||
| 331 | + } | ||
| 332 | + }); | ||
| 333 | + }) | ||
| 334 | + .catch(() => {}); | ||
| 335 | + } else { | ||
| 336 | + this.$message({ | ||
| 337 | + message: res.msg, | ||
| 338 | + type: "warning", | ||
| 339 | + }); | ||
| 340 | + } | ||
| 341 | + }); | ||
| 342 | + }) | ||
| 343 | + .catch(() => []); | ||
| 344 | + }, | ||
| 345 | + | ||
| 346 | + handleClose(val) { | ||
| 347 | + this.drawer = val; | ||
| 348 | + this.selectRoleList(); | ||
| 349 | + }, | ||
| 350 | + currentChange(val) { | ||
| 351 | + this.formData.page = val.page; | ||
| 352 | + this.selectRoleList(); | ||
| 353 | + }, | ||
| 354 | + }, | ||
| 355 | +}; | ||
| 9 | </script> | 356 | </script> |
| 10 | 357 | ||
| 11 | <style> | 358 | <style> |
| 12 | - | ||
| 13 | </style> | 359 | </style> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
src/views/systemConfig/userConfig/drawer.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="userDrawer"> | ||
| 3 | + <el-drawer | ||
| 4 | + :data="userData" | ||
| 5 | + :title="drawerTitle" | ||
| 6 | + :visible.sync="drawer" | ||
| 7 | + direction="rtl" | ||
| 8 | + size="40%" | ||
| 9 | + :close-on-click-modal="false" | ||
| 10 | + :wrapperClosable="false" | ||
| 11 | + :show-close="false" | ||
| 12 | + > | ||
| 13 | + <el-form | ||
| 14 | + ref="userForm" | ||
| 15 | + :model="userForm" | ||
| 16 | + label-width="auto" | ||
| 17 | + :rules="rules" | ||
| 18 | + style="margin: 10px" | ||
| 19 | + > | ||
| 20 | + <el-row :gutter="10"> | ||
| 21 | + <el-col :span="12"> | ||
| 22 | + <el-form-item label="员工号:" prop="loginName"> | ||
| 23 | + <el-input | ||
| 24 | + placeholder="请输入员工号" | ||
| 25 | + v-model.trim="userForm.loginName" | ||
| 26 | + v-if="!userFormDisabled" | ||
| 27 | + :disabled="drawerTitle != '新增用户'" | ||
| 28 | + size="mini" | ||
| 29 | + ></el-input> | ||
| 30 | + <div v-else>{{ userForm.loginName }}</div> | ||
| 31 | + </el-form-item> | ||
| 32 | + </el-col> | ||
| 33 | + <el-col :span="12"> | ||
| 34 | + <el-form-item label="用户姓名:" prop="username"> | ||
| 35 | + <el-input | ||
| 36 | + placeholder="请输入用户姓名" | ||
| 37 | + :disabled="userFormDisabled" | ||
| 38 | + v-model.trim="userForm.username" | ||
| 39 | + v-if="!userFormDisabled" | ||
| 40 | + size="mini" | ||
| 41 | + ></el-input> | ||
| 42 | + <div v-else>{{ userForm.username }}</div> | ||
| 43 | + </el-form-item> | ||
| 44 | + </el-col> | ||
| 45 | + <el-col :span="24"> | ||
| 46 | + <el-alert | ||
| 47 | + title="注意:员工号一但设置就无法更改,请谨慎填写!" | ||
| 48 | + type="warning" | ||
| 49 | + show-icon | ||
| 50 | + size="mini" | ||
| 51 | + :closable="false" | ||
| 52 | + style="width: 400px" | ||
| 53 | + > | ||
| 54 | + </el-alert> | ||
| 55 | + </el-col> | ||
| 56 | + <el-col :span="12"> | ||
| 57 | + <el-form-item label="手机号:" prop="phone"> | ||
| 58 | + <el-input | ||
| 59 | + placeholder="请输入手机号" | ||
| 60 | + type="phone" | ||
| 61 | + v-model.trim="userForm.phone" | ||
| 62 | + :disabled="userFormDisabled" | ||
| 63 | + v-if="!userFormDisabled" | ||
| 64 | + size="mini" | ||
| 65 | + ></el-input> | ||
| 66 | + <div v-else>{{ userForm.phone }}</div> | ||
| 67 | + </el-form-item> | ||
| 68 | + </el-col> | ||
| 69 | + <el-col :span="12"> | ||
| 70 | + <el-form-item label="电子邮箱:" prop="email"> | ||
| 71 | + <el-input | ||
| 72 | + placeholder="请输入电子邮箱" | ||
| 73 | + type="email" | ||
| 74 | + v-model.trim="userForm.email" | ||
| 75 | + :disabled="userFormDisabled" | ||
| 76 | + v-if="!userFormDisabled" | ||
| 77 | + size="mini" | ||
| 78 | + ></el-input> | ||
| 79 | + <div v-else>{{ userForm.email }}</div> | ||
| 80 | + </el-form-item> | ||
| 81 | + </el-col> | ||
| 82 | + <!-- <el-col :span="12" v-if="drawerTitle == '新增用户'"> | ||
| 83 | + <el-form-item label="密码:"> | ||
| 84 | + <el-input | ||
| 85 | + placeholder="请输入密码" | ||
| 86 | + :disabled="userFormDisabled" | ||
| 87 | + type="password" | ||
| 88 | + size="mini" | ||
| 89 | + ></el-input> | ||
| 90 | + </el-form-item> | ||
| 91 | + </el-col> | ||
| 92 | + <el-col :span="12" v-if="drawerTitle == '新增用户'"> | ||
| 93 | + <el-form-item label="确认密码:"> | ||
| 94 | + <el-input | ||
| 95 | + placeholder="请确认密码" | ||
| 96 | + :disabled="userFormDisabled" | ||
| 97 | + type="password" | ||
| 98 | + size="mini" | ||
| 99 | + ></el-input> | ||
| 100 | + </el-form-item> | ||
| 101 | + </el-col> --> | ||
| 102 | + <el-col :span="24"> | ||
| 103 | + <el-form-item | ||
| 104 | + label="所属口岸:" | ||
| 105 | + prop="portName" | ||
| 106 | + > | ||
| 107 | + <!-- <el-checkbox-group v-model="port" :disabled="userFormDisabled"> | ||
| 108 | + <el-checkbox | ||
| 109 | + v-for="item in portNameList" | ||
| 110 | + :label="item.englishName" | ||
| 111 | + :key="item.id" | ||
| 112 | + >{{ item.englishName }}</el-checkbox | ||
| 113 | + > | ||
| 114 | + </el-checkbox-group> --> | ||
| 115 | + <el-select | ||
| 116 | + placeholder="不限" | ||
| 117 | + v-model="port" | ||
| 118 | + :disabled="userFormDisabled" | ||
| 119 | + size="mini" | ||
| 120 | + style="width: 100%" | ||
| 121 | + multiple | ||
| 122 | + clearable | ||
| 123 | + > | ||
| 124 | + <el-option | ||
| 125 | + v-for="item in portNameList" | ||
| 126 | + :label="item.englishName" | ||
| 127 | + :value="item.englishName" | ||
| 128 | + :key="item.id" | ||
| 129 | + > | ||
| 130 | + </el-option> | ||
| 131 | + </el-select> | ||
| 132 | + </el-form-item> | ||
| 133 | + </el-col> | ||
| 134 | + <el-col :span="24"> | ||
| 135 | + <el-form-item label="所属角色:" prop="roleIds"> | ||
| 136 | + <el-checkbox-group | ||
| 137 | + v-model="roleid" | ||
| 138 | + :disabled="userFormDisabled" | ||
| 139 | + @change="change" | ||
| 140 | + > | ||
| 141 | + <el-checkbox | ||
| 142 | + v-for="item in roleList" | ||
| 143 | + :label="item.id" | ||
| 144 | + :key="item.id" | ||
| 145 | + >{{ item.name }}</el-checkbox | ||
| 146 | + > | ||
| 147 | + </el-checkbox-group> | ||
| 148 | + </el-form-item> | ||
| 149 | + </el-col> | ||
| 150 | + <el-col :span="24"> | ||
| 151 | + <el-form-item label="备注:" prop="remark"> | ||
| 152 | + <el-input | ||
| 153 | + type="textarea" | ||
| 154 | + v-model="userForm.remark" | ||
| 155 | + placeholder="备注" | ||
| 156 | + :disabled="userFormDisabled" | ||
| 157 | + v-if="!userFormDisabled" | ||
| 158 | + size="mini" | ||
| 159 | + ></el-input> | ||
| 160 | + <div v-else>{{ userForm.remark }}</div> | ||
| 161 | + </el-form-item> | ||
| 162 | + </el-col> | ||
| 163 | + </el-row> | ||
| 164 | + <el-form-item> | ||
| 165 | + <el-button | ||
| 166 | + type="primary" | ||
| 167 | + size="mini" | ||
| 168 | + v-if="!userFormDisabled" | ||
| 169 | + :loading="loading" | ||
| 170 | + @click="submit" | ||
| 171 | + >提交</el-button | ||
| 172 | + > | ||
| 173 | + <el-button type="primary" size="mini" @click="handleClose" | ||
| 174 | + >取消</el-button | ||
| 175 | + > | ||
| 176 | + </el-form-item> | ||
| 177 | + </el-form> | ||
| 178 | + </el-drawer> | ||
| 179 | + </div> | ||
| 180 | +</template> | ||
| 181 | + | ||
| 182 | +<script> | ||
| 183 | +import { | ||
| 184 | + getRoleList, | ||
| 185 | + addOrUpdateUser, | ||
| 186 | + portNameList, | ||
| 187 | +} from "@/api/system/user.js"; | ||
| 188 | +export default { | ||
| 189 | + props: { | ||
| 190 | + drawerTitle: { | ||
| 191 | + type: String, | ||
| 192 | + default: "", | ||
| 193 | + }, | ||
| 194 | + userFormDisabled: { | ||
| 195 | + type: Boolean, | ||
| 196 | + default: false, | ||
| 197 | + }, | ||
| 198 | + drawer: { | ||
| 199 | + type: Boolean, | ||
| 200 | + default: false, | ||
| 201 | + }, | ||
| 202 | + userData: { | ||
| 203 | + type: Object, | ||
| 204 | + default: null, | ||
| 205 | + }, | ||
| 206 | + }, | ||
| 207 | + data() { | ||
| 208 | + return { | ||
| 209 | + userForm: { | ||
| 210 | + roleIds: [], | ||
| 211 | + }, | ||
| 212 | + roleList: [], | ||
| 213 | + portNameList: [], | ||
| 214 | + port: [], | ||
| 215 | + roleid: [], | ||
| 216 | + ImageUploadUrl: "", | ||
| 217 | + dialogVisible: false, | ||
| 218 | + loading: false, | ||
| 219 | + rules: { | ||
| 220 | + loginName: [ | ||
| 221 | + { | ||
| 222 | + required: true, | ||
| 223 | + message: "角色名不能为空", | ||
| 224 | + trigger: "blur", | ||
| 225 | + }, | ||
| 226 | + ], | ||
| 227 | + username: [ | ||
| 228 | + { | ||
| 229 | + required: true, | ||
| 230 | + message: "角色名不能为空", | ||
| 231 | + trigger: "blur", | ||
| 232 | + }, | ||
| 233 | + ], | ||
| 234 | + portName: [ | ||
| 235 | + { | ||
| 236 | + required: true, | ||
| 237 | + message: "所属口岸不能为空", | ||
| 238 | + trigger: "blur", | ||
| 239 | + }, | ||
| 240 | + ], | ||
| 241 | + }, | ||
| 242 | + }; | ||
| 243 | + }, | ||
| 244 | + created() { | ||
| 245 | + this.selectRoleList(); | ||
| 246 | + }, | ||
| 247 | + watch:{ | ||
| 248 | + drawer(val,oldVal){ | ||
| 249 | + if(val){ | ||
| 250 | + this.userForm = this.userData; | ||
| 251 | + if (this.userData.roleIds) { | ||
| 252 | + this.roleid = this.userData.roleIds; | ||
| 253 | + } | ||
| 254 | + if (this.userData.portName) { | ||
| 255 | + this.port = this.userData.portName; | ||
| 256 | + } | ||
| 257 | + } | ||
| 258 | + } | ||
| 259 | + }, | ||
| 260 | + methods: { | ||
| 261 | + change(val){ | ||
| 262 | + this.roleid = val; | ||
| 263 | + }, | ||
| 264 | + selectRoleList() { | ||
| 265 | + //角色列表 | ||
| 266 | + getRoleList({ size: null, page: null }) | ||
| 267 | + .then((res) => { | ||
| 268 | + if (res.code === 200) { | ||
| 269 | + this.roleList = res.data.list; | ||
| 270 | + } else { | ||
| 271 | + this.$message({ | ||
| 272 | + message: res.msg, | ||
| 273 | + type: "warning", | ||
| 274 | + }); | ||
| 275 | + } | ||
| 276 | + }) | ||
| 277 | + .catch((err) => { | ||
| 278 | + console.log(err); | ||
| 279 | + }); | ||
| 280 | + //获取口岸 | ||
| 281 | + // this.portNameList = this.$store.state.user.portNames; | ||
| 282 | + portNameList() | ||
| 283 | + .then((res) => { | ||
| 284 | + if (res.code === 200) { | ||
| 285 | + this.portNameList = res.data; | ||
| 286 | + } else { | ||
| 287 | + this.$message({ | ||
| 288 | + message: res.msg, | ||
| 289 | + type: "warning", | ||
| 290 | + }); | ||
| 291 | + } | ||
| 292 | + }) | ||
| 293 | + .catch((err) => { | ||
| 294 | + console.log(err); | ||
| 295 | + }); | ||
| 296 | + }, | ||
| 297 | + | ||
| 298 | + //关闭 | ||
| 299 | + handleClose() { | ||
| 300 | + this.roleid = []; | ||
| 301 | + this.port = []; | ||
| 302 | + this.userForm = { | ||
| 303 | + roleIds: [], | ||
| 304 | + }; | ||
| 305 | + this.$emit("handleClose", false); | ||
| 306 | + }, | ||
| 307 | + | ||
| 308 | + //提交 | ||
| 309 | + submit() { | ||
| 310 | + this.loading = true; | ||
| 311 | + this.userData.isValid ? "" : (this.userForm.isValid = 1); | ||
| 312 | + this.userForm.roleIds = this.roleid; | ||
| 313 | + this.userForm.portName = this.port.join(","); | ||
| 314 | + addOrUpdateUser(this.userForm) | ||
| 315 | + .then((res) => { | ||
| 316 | + this.loading = false; | ||
| 317 | + if (res.code === 200) { | ||
| 318 | + this.$message({ | ||
| 319 | + message: "操作成功", | ||
| 320 | + type: "success", | ||
| 321 | + }); | ||
| 322 | + this.$emit("handleClose", false); | ||
| 323 | + } else { | ||
| 324 | + this.$message({ | ||
| 325 | + message: res.msg, | ||
| 326 | + type: "warning", | ||
| 327 | + }); | ||
| 328 | + } | ||
| 329 | + }) | ||
| 330 | + .catch((err) => { | ||
| 331 | + this.loading = false; | ||
| 332 | + console.log(err); | ||
| 333 | + }); | ||
| 334 | + }, | ||
| 335 | + }, | ||
| 336 | +}; | ||
| 337 | +</script> | ||
| 338 | + | ||
| 339 | +<style> | ||
| 340 | +</style> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment