he wei
2025-04-24 6580deff14f23b8051edf26db58a3b9425ed5b77
U 权限
11个文件已修改
1个文件已删除
122 ■■■■ 已修改文件
src/assets/images/login-bg.jpg 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/images/login-bg1.png 补丁 | 查看 | 原始文档 | blame | 历史
src/router/modules/devices.js 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/modules/system.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/permission.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/user.js 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/styles/element/blue.scss 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/auth.js 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/device/locks/addEdit.vue 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/device/locks/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/user/baojiMager.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/user/index.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/images/login-bg.jpg

src/assets/images/login-bg1.png
Binary files differ
src/router/modules/devices.js
@@ -28,12 +28,12 @@
      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'),
src/router/modules/system.js
@@ -20,19 +20,19 @@
      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',
@@ -56,7 +56,7 @@
      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'] }
    }
  ]
};
src/store/permission.js
@@ -10,7 +10,7 @@
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));
@@ -51,6 +51,7 @@
  }
  function generateRoutes(roles) {
    let accessedRoutes;
    debugger;
    if (roles.includes('admin')) {
      console.log('1', '=============');
      
src/store/user.js
@@ -52,8 +52,16 @@
          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);
@@ -71,15 +79,16 @@
  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;
      
@@ -115,6 +124,7 @@
  }
  async function changeRoles(role) {
    debugger;
    const _token = role + '-token';
    token.value = _token;
src/styles/element/blue.scss
@@ -181,12 +181,12 @@
  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;
@@ -197,7 +197,7 @@
  color: #0ff;
}
.el-pager.el-pager li {
.el-pagination .el-pager.el-pager.el-pager li {
  background: transparent;
  color: #fff;
}
src/utils/auth.js
@@ -1,13 +1,22 @@
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() {
src/views/device/locks/addEdit.vue
@@ -85,6 +85,25 @@
            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: [
        {
@@ -129,7 +148,9 @@
    stationName1: stationName1.value,
    stationName2: stationName2.value,
    stationName3: stationName3.value,
    stationName4: stationName4.value
    stationName4: stationName4.value,
  lockIp: '127.0.0.1',
  stationId: '',
});
const layout = {
@@ -226,6 +247,7 @@
    stationName2: formLock.stationName2,
    stationName3: formLock.stationName3,
    stationName4: formLock.stationName4,
    lockIp: formLock.lockIp,
        longitude: formLock.longitude || 0,
        latitude: formLock.latitude || 0,
    };
@@ -268,8 +290,10 @@
    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)
@@ -417,6 +441,14 @@
    </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" />
@@ -446,7 +478,7 @@
      <el-col :span="24">
        <!-- 锁具安装位置 类型 -->
        <el-form-item
          label="锁具安装位置类型"
          label="屏柜类型"
          label-position="right"
          prop="screenBoxType"
        >
@@ -471,7 +503,7 @@
      <el-col :span="24">
        <!-- 锁具安装位置 品牌 -->
        <el-form-item
          label="锁具安装位置品牌"
          label="屏柜品牌"
          label-position="right"
          prop="screenBoxProduct"
        >
src/views/device/locks/index.vue
@@ -102,7 +102,7 @@
                    // 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;
@@ -322,8 +322,10 @@
                  <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" /> -->
src/views/system/user/baojiMager.vue
@@ -49,7 +49,7 @@
      <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"
@@ -64,7 +64,7 @@
        </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"
src/views/system/user/index.vue
@@ -8,7 +8,7 @@
    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,
@@ -236,9 +236,9 @@
                        @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
                      <el-button
                                                      type="success"
                                                      v-if="scope.row.uid > 1000"
                        v-if="scope.row.uid > 10000"
                                                      size="small"
                                                      @click="improveRolefn(scope.row)"
                                                      >加入管理员组</el-button
@@ -250,7 +250,7 @@
                                                      size="small"
                                                      @click="dropRolefn(scope.row)"
                                                      >移出管理员组</el-button
                                                  > -->
                      >
                    </template>
                  </el-table-column>
                </el-table>