| | |
| | | name: 'LockManage', |
| | | meta: { title: '锁具管理', icon: 'lock-hdw', noCache: false } |
| | | }, |
| | | { |
| | | path: 'station', |
| | | component: () => import('@/views/device/station/index.vue'), |
| | | name: 'stationManage', |
| | | meta: { title: '机房管理', icon: 'lock-hdw', noCache: false } |
| | | }, |
| | | // { |
| | | // path: 'station', |
| | | // component: () => import('@/views/device/station/index.vue'), |
| | | // name: 'stationManage', |
| | | // meta: { title: '机房管理', icon: 'lock-hdw', noCache: false } |
| | | // }, |
| | | { |
| | | path: 'task', |
| | | component: () => import('@/views/device/locks/task.vue'), |
| | |
| | | path: 'power', |
| | | component: () => import('@/views/system/user/powerMager.vue'), |
| | | name: 'powerMager', |
| | | meta: { title: '权限管理', icon: 'people-hdw', noCache: false } |
| | | meta: { title: '权限管理', icon: 'people-hdw', noCache: false, roles: ['admin', 'manager'] } |
| | | }, |
| | | { |
| | | path: 'baoji', |
| | | component: () => import('@/views/system/user/baojiMager.vue'), |
| | | name: 'baojiMager', |
| | | meta: { title: '包机组管理', icon: 'people-hdw', noCache: false } |
| | | meta: { title: '包机组管理', icon: 'people-hdw', noCache: false, roles: ['admin', 'manager'] } |
| | | }, |
| | | { |
| | | path: 'user', |
| | | component: () => import('@/views/system/user/index.vue'), |
| | | name: 'UserManage', |
| | | meta: { title: '用户管理', icon: 'people-hdw', noCache: false } |
| | | meta: { title: '用户管理', icon: 'people-hdw', noCache: false, roles: ['admin', 'manager'] } |
| | | }, |
| | | { |
| | | path: 'face', |
| | |
| | | path: 'mapSettings', |
| | | component: () => import('@/views/system/mapSettings.vue'), |
| | | name: 'mapSettings', |
| | | meta: { title: '地图配置', icon: 'log-hdw', noCache: false } |
| | | meta: { title: '地图配置', icon: 'log-hdw', noCache: false, roles: ['admin', 'manager'] } |
| | | } |
| | | ] |
| | | }; |
| | |
| | | function hasPermission(roles, route) { |
| | | console.trace('hasPermission'); |
| | | console.log('hasPermission', roles, route, '============='); |
| | | |
| | | debugger; |
| | | if (route.meta && route.meta.roles) { |
| | | const rolesArr = route.meta.roles; |
| | | return roles.some(role => rolesArr.includes(role)); |
| | |
| | | } |
| | | function generateRoutes(roles) { |
| | | let accessedRoutes; |
| | | debugger; |
| | | if (roles.includes('admin')) { |
| | | console.log('1', '============='); |
| | | |
| | |
| | | let role = response.data2.urole; |
| | | uname.value = name; |
| | | setUname(name); |
| | | token.value = 'admin'; |
| | | setToken('admin'); |
| | | let _token = 'someone'; |
| | | debugger; |
| | | if (response.data2.uid && response.data2.uid <= 10000) { |
| | | _token = 'manager'; |
| | | if (response.data2.uid <= 100) { |
| | | _token = 'admin'; |
| | | } |
| | | } |
| | | token.value = _token; |
| | | setToken(_token); |
| | | urole.value = role; |
| | | setUrole(role); |
| | | resolve(response); |
| | |
| | | function getInfo() { |
| | | return new Promise((resolve) => { |
| | | const data = { |
| | | roles: ['admin'], |
| | | // roles: ['admin'], |
| | | roles: [token.value], |
| | | introduction: 'I am a super administrator', |
| | | avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', |
| | | // name: 'Super Admin' |
| | | name: getUname() |
| | | name: uname.value |
| | | }; |
| | | const { roles: _roles, name, avatar: _avatar, introduction: _introduction } = data; |
| | | roles.value = _roles; |
| | | uname.value = name; |
| | | // uname.value = name; |
| | | avatar.value = _avatar; |
| | | introduction.value = _introduction; |
| | | |
| | |
| | | } |
| | | |
| | | async function changeRoles(role) { |
| | | debugger; |
| | | const _token = role + '-token'; |
| | | |
| | | token.value = _token; |
| | |
| | | color: #fff; |
| | | } |
| | | |
| | | .el-pagination.el-pagination button { |
| | | .el-pagination.el-pagination.el-pagination button { |
| | | background: transparent; |
| | | color: #fff; |
| | | } |
| | | .el-pagination.el-pagination button.is-disabled, |
| | | .el-pagination.el-pagination button:disabled { |
| | | .el-pagination.el-pagination.el-pagination button.is-disabled, |
| | | .el-pagination.el-pagination.el-pagination button:disabled { |
| | | background-color: transparent; |
| | | color: #fff; |
| | | cursor: not-allowed; |
| | |
| | | color: #0ff; |
| | | } |
| | | |
| | | .el-pager.el-pager li { |
| | | .el-pagination .el-pager.el-pager.el-pager li { |
| | | background: transparent; |
| | | color: #fff; |
| | | } |
| | |
| | | import Cookies from 'js-cookie'; |
| | | import formatPassword from '@/utils/formatPassword.js'; |
| | | import const_num from '@/utils/const/const_num.js'; |
| | | import RSA from '@/utils/RSA.js'; |
| | | |
| | | const TokenKey = 'Admin-Token'; |
| | | const TokenKey = 'BAIDU_MAP_SN'; |
| | | |
| | | export function getToken() { |
| | | return Cookies.get(TokenKey); |
| | | const key = const_num.privateKey; |
| | | const str = Cookies.get(TokenKey); |
| | | if (!str) return ''; |
| | | let res = RSA.decrypt(str, key); |
| | | // console.log('res', res, '============='); |
| | | |
| | | return res.split('&&&&&&&&&&')[0]; |
| | | } |
| | | |
| | | export function setToken(token) { |
| | | return Cookies.set(TokenKey, token); |
| | | return Cookies.set(TokenKey, formatPassword(token)); |
| | | } |
| | | |
| | | export function removeToken() { |
| | |
| | | trigger: ["change", "blur"], |
| | | }, |
| | | ], |
| | | lockIp: [ |
| | | { |
| | | required: true, |
| | | message: "不能为空", |
| | | trigger: ["change", "blur"], |
| | | }, |
| | | { |
| | | validator: (rule, value, callback) => { |
| | | let reg = /^((25[0-5]|2[0-4][0-9]|1[0-9]{1,2}|[1-9]|[1-9][0-9]|0)\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{1,2}|[1-9]|[1-9][0-9]|0)$/; |
| | | |
| | | if (value && !reg.test(value)) { |
| | | callback(new Error("请输入正确的IP地址")); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, |
| | | trigger: ["change", "blur"], |
| | | } |
| | | ], |
| | | // 经度 |
| | | longitude: [ |
| | | { |
| | |
| | | stationName1: stationName1.value, |
| | | stationName2: stationName2.value, |
| | | stationName3: stationName3.value, |
| | | stationName4: stationName4.value |
| | | stationName4: stationName4.value, |
| | | lockIp: '127.0.0.1', |
| | | stationId: '', |
| | | }); |
| | | |
| | | const layout = { |
| | |
| | | stationName2: formLock.stationName2, |
| | | stationName3: formLock.stationName3, |
| | | stationName4: formLock.stationName4, |
| | | lockIp: formLock.lockIp, |
| | | longitude: formLock.longitude || 0, |
| | | latitude: formLock.latitude || 0, |
| | | }; |
| | |
| | | stationName2: formLock.stationName2, |
| | | stationName3: formLock.stationName3, |
| | | stationName4: formLock.stationName4, |
| | | lockIp: formLock.lockIp, |
| | | longitude: formLock.longitude || 0, |
| | | latitude: formLock.latitude || 0, |
| | | stationId: formLock.stationId |
| | | }; |
| | | let loading = $loading(); |
| | | updateLock(params) |
| | |
| | | </el-row> |
| | | <el-row :gutter="layout.gutter"> |
| | | <el-col :span="24"> |
| | | <!-- Ip --> |
| | | <el-form-item label="机房Ip" label-position="right" prop="lockIp"> |
| | | <el-input v-model="formLock.lockIp" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="layout.gutter"> |
| | | <el-col :span="24"> |
| | | <!-- 地址 --> |
| | | <el-form-item label="地址" label-position="right" prop="lockAddress"> |
| | | <el-input v-model="formLock.lockAddress" /> |
| | |
| | | <el-col :span="24"> |
| | | <!-- 锁具安装位置 类型 --> |
| | | <el-form-item |
| | | label="锁具安装位置类型" |
| | | label="屏柜类型" |
| | | label-position="right" |
| | | prop="screenBoxType" |
| | | > |
| | |
| | | <el-col :span="24"> |
| | | <!-- 锁具安装位置 品牌 --> |
| | | <el-form-item |
| | | label="锁具安装位置品牌" |
| | | label="屏柜品牌" |
| | | label-position="right" |
| | | prop="screenBoxProduct" |
| | | > |
| | |
| | | // v.type = { 1: '蓝牙锁', 2: 'ID锁', 3: '实体锁' }[v.lockType]; |
| | | v.modelStr = v.model == 1 ? '在线模式' : '离线模式'; |
| | | v.blStateStr = v.blState == 0 ? '蓝牙关闭' : '蓝牙开启'; |
| | | v.ID = v.lockId % 10000000; |
| | | v.ID = v.lockId % 1000; |
| | | return v; |
| | | }); |
| | | _total = total; |
| | |
| | | <el-table-column type="index" fixed="left" width="50" /> |
| | | <el-table-column prop="type" label="类型" width="180" /> |
| | | <el-table-column prop="lockName" label="锁具名称" width="180" /> |
| | | <el-table-column prop="ID" label="锁ID" width="120" /> |
| | | <el-table-column prop="lockId" label="锁ID" width="120" /> |
| | | <el-table-column prop="ID" label="锁具地址" width="120" /> |
| | | <el-table-column prop="stationName" label="机房" min-width="180" /> |
| | | <el-table-column prop="lockIp" label="机房Ip" min-width="180" /> |
| | | <el-table-column prop="modelStr" label="控制模式" width="180" /> |
| | | <el-table-column prop="onlineState" label="在线状态" width="180" /> |
| | | <!-- <el-table-column prop="state" label="安装状态" width="180" /> --> |
| | |
| | | <el-tabs v-model="activeName" type="border-card" class="flex-layout "> |
| | | <el-tab-pane label="包机组用户" name="baoji-group-user"> |
| | | <template #label> |
| | | <span><i class="el-icon-user-solid"></i> 包机组用户</span> |
| | | <span><i class="el-icon-user-solid"></i> 管理的用户</span> |
| | | </template> |
| | | <el-transfer |
| | | v-model="user.value" |
| | |
| | | </el-tab-pane> |
| | | <el-tab-pane label="包机机房" name="baoji-home"> |
| | | <template #label |
| | | ><span><i class="el-icon-s-home"></i> 包机机房</span></template |
| | | ><span><i class="el-icon-s-home"></i> 管理的锁具</span></template |
| | | > |
| | | <el-transfer |
| | | v-model="baoji.value" |
| | |
| | | import useElement from "@/hooks/useElement.js"; |
| | | import { useUserStore } from '@/store/user'; |
| | | const userStore = useUserStore(); |
| | | const { uname } = storeToRefs(userStore); |
| | | const { uid, uname } = storeToRefs(userStore); |
| | | |
| | | import { |
| | | getAllUser, |
| | |
| | | @click="resetSnIdfn(scope.row)">重置密码</el-button> |
| | | <el-button type="danger" size="small" :disabled="scope.row.uname == uname" |
| | | @click="confirmRemove(scope.row)">删除</el-button> |
| | | <!-- <el-button |
| | | type="success" |
| | | v-if="scope.row.uid > 1000" |
| | | size="small" |
| | | @click="improveRolefn(scope.row)" |
| | | >加入管理员组</el-button |
| | | > |
| | | <el-button |
| | | type="danger" |
| | | v-else |
| | | :disabled="scope.row.uid == uid" |
| | | size="small" |
| | | @click="dropRolefn(scope.row)" |
| | | >移出管理员组</el-button |
| | | > --> |
| | | <el-button |
| | | type="success" |
| | | v-if="scope.row.uid > 10000" |
| | | size="small" |
| | | @click="improveRolefn(scope.row)" |
| | | >加入管理员组</el-button |
| | | > |
| | | <el-button |
| | | type="danger" |
| | | v-else |
| | | :disabled="scope.row.uid == uid" |
| | | size="small" |
| | | @click="dropRolefn(scope.row)" |
| | | >移出管理员组</el-button |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |