研发图纸文件管理系统-前端项目
he wei
2022-07-27 d52461fe7cb4c6edfdefd4f5c5399fa6d9f0f2dc
U 不同角色登录后的菜单不同
4个文件已修改
51 ■■■■ 已修改文件
src/pages/login/Login.vue 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/user/components/userInfo.vue 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/config.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/authority-utils.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/login/Login.vue
@@ -88,6 +88,7 @@
import { userLogin } from './apis'
import { values } from 'lodash';
import {getAllRole} from "@/pages/user/apis";
import { hasAnyRole } from '@/utils/authority-utils';
export default {
  name: 'Login',
  components: {CommonLayout,faceLogin},
@@ -154,7 +155,11 @@
        loadRoutes();
        this.$router.push('/workplace');
        if (hasAnyRole('1004', roles)) {
          this.$router.push('/user/list');
        } else {
          this.$router.push('/workplace');
        }
        this.$message.success(loginRes.msg, 3);
      } else {
        this.error = loginRes.msg
src/pages/user/components/userInfo.vue
@@ -114,6 +114,19 @@
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :span="24">
                <a-form-model-item
                  label="下载权限"
                  :labelCol="{ span: 8 }"
                  :wrapperCol="{ span: 15, offset: 1 }"
                  prop="downloadF"
                >
                  <a-switch :default-checked="!!info.dloadFlag" @change="changeDload">
                    <a-icon slot="checkedChildren" type="check" />
                    <a-icon slot="unCheckedChildren" type="close" />
                  </a-switch>
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-layout-content>
        </a-layout>
@@ -145,6 +158,7 @@
  drole: {
    roleName: "",
  },
  dloadFlag: 0,
  desc: "4165465",
};
function getBase64(file) {
@@ -217,7 +231,7 @@
        url = baseUrl + "/face/" + this.info.dface.url.split("\\face\\")[1];
      }
      return url;
    },
    }
  },
  props: {
    info: {
@@ -252,7 +266,7 @@
      this.previewImage = file.url || file.preview;
      this.previewVisible = true;
    },
    checkForm () {
    checkForm() {
      this.$refs.formRef.validate((valid) => {
        if (!valid) {
          this.$message.error("存在未通过检验的表单项");
@@ -264,15 +278,15 @@
    },
    submit() {
      let formData = new FormData();
      let { id, tel, phone, departId, faceId, roleId, name } = this.info;
      let { id, tel, phone, departId, faceId, roleId, name, dloadFlag } = this.info;
      let params = {};
      let operation;
      if (this.isEdit) {
        operation = editUser;
        params = { id, tel, phone, departId, faceId, roleId };
        params = { id, tel, phone, departId, faceId, roleId, dloadFlag };
      } else {
        operation = addUser;
        params = { name, tel, phone, departId, faceId, roleId };
        params = { name, tel, phone, departId, faceId, roleId, dloadFlag };
      }
      let json = JSON.stringify(params);
      // console.log(json);
@@ -349,6 +363,10 @@
    resetFields() {
      this.$refs.formRef.resetFields();
    },
    changeDload(checked) {
      // console.log(checked, 99)
      this.info.dloadFlag = checked * 1;
    }
  },
  mounted() {
src/router/config.js
@@ -33,6 +33,9 @@
            icon: 'home',
            page: {
              closable: false
            },
            authority: {
              role: ['1001', '1002', '1003'],
            }
          },
          component: () => import('@/pages/workplace'),
@@ -41,7 +44,10 @@
          path: 'draw',
          name: '图纸管理',
          meta: {
            icon: 'dashboard'
            icon: 'dashboard',
            authority: {
              role: ['1001', '1002', '1003'],
            }
          },
          component: BlankView,
          children: [
@@ -73,6 +79,9 @@
            icon: 'user',
            page: {
              cacheAble: false
            },
            authority: {
              role: '1004',
            }
          },
          component: BlankView,
@@ -96,6 +105,9 @@
            icon: 'profile',
            page: {
              cacheAble: false
            },
            authority: {
              role: '1004',
            }
          },
          component: BlankView,
src/utils/authority-utils.js
@@ -82,4 +82,4 @@
  })
}
export {filterMenu, hasAuthority}
export {filterMenu, hasAuthority, hasAnyRole}