Browse Source

用户管理接口调试完成

zhangjie 3 năm trước cách đây
mục cha
commit
f84d1bc682

+ 72 - 0
src/components/base/TypeOrgSelect.vue

@@ -0,0 +1,72 @@
+<template>
+  <el-select
+    v-model="selected"
+    class="type-org-select"
+    placeholder="请选择"
+    :style="styles"
+    filterable
+    :clearable="clearable"
+    :disabled="disabled"
+    @change="select"
+  >
+    <el-option
+      v-for="item in optionList"
+      :key="item.id"
+      :value="item.id"
+      :label="item.name"
+    >
+    </el-option>
+  </el-select>
+</template>
+
+<script>
+import { organizationFindByTypeList } from "../../modules/base/api";
+import { ORG_TYPE } from "@/constants/enumerate";
+
+export default {
+  name: "type-org-select",
+  props: {
+    disabled: { type: Boolean, default: false },
+    value: { type: [Number, String], default: "" },
+    styles: { type: String, default: "" },
+    clearable: { type: Boolean, default: true },
+    type: {
+      type: String,
+      default: "COLLEG",
+      validator(val) {
+        return Object.keys(ORG_TYPE).indexOf(val) > -1;
+      }
+    }
+  },
+  data() {
+    return {
+      optionList: [],
+      selected: ""
+    };
+  },
+  watch: {
+    value: {
+      immediate: true,
+      handler(val) {
+        this.selected = val;
+      }
+    }
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    async search() {
+      const res = await organizationFindByTypeList(this.type);
+      this.optionList = res;
+    },
+    select() {
+      this.$emit("input", this.selected);
+      this.$emit(
+        "change",
+        this.optionList.find(item => item.id === this.selected)
+      );
+    }
+  }
+};
+</script>

+ 4 - 4
src/constants/adminNavs.js

@@ -11,11 +11,11 @@ const navs = [
       {
         title: "系统角色管理",
         router: "SystemRoleManage"
-      },
-      {
-        title: "权限管理",
-        router: "PrivilegeManage"
       }
+      // {
+      //   title: "权限管理",
+      //   router: "PrivilegeManage"
+      // }
     ]
   }
 ];

+ 3 - 3
src/constants/enumerate.js

@@ -40,9 +40,9 @@ export const URL_PRIVILEGE_TYPE = {
 // 机构
 export const ORG_TYPE = {
   COLLEGE: "学院",
-  SUBJECT: "系",
-  STARFF_ROOM: "教研室",
-  PRINT_ROOM: "印刷室"
+  FACULTY: "院系",
+  TEACHING_ROOM: "教研室",
+  PRINTING_HOUSE: "印刷室"
 };
 // 角色
 export const ROLE_TYPE = {

+ 31 - 96
src/modules/admin/components/ModifySystemRole.vue

@@ -1,13 +1,12 @@
 <template>
   <el-dialog
-    class="modify-role"
+    class="modify-system-role"
     :visible.sync="modalIsShow"
     :title="title"
-    top="10px"
-    width="700px"
     :close-on-click-modal="false"
     :close-on-press-escape="false"
     append-to-body
+    fullscreen
     @opened="visibleChange"
   >
     <div class="part-box part-box-pad part-box-border">
@@ -25,30 +24,13 @@
             clearable
           ></el-input>
         </el-form-item>
-        <el-form-item prop="privilegeIds" label="角色权限:">
-          <div class="part-box part-box-pad part-box-border">
-            <el-tree
-              :data="menus"
-              show-checkbox
-              node-key="id"
-              ref="MenuTree"
-              highlight-current
-              check-on-click-node
-              :expand-on-click-node="false"
-              :default-expanded-keys="defaultExpandedKeys"
-              :props="defaultProps"
-              @check-change="checkChange"
-            >
-              <span class="custom-tree-node" slot-scope="{ node, data }">
-                <span
-                  ><i class="el-icon-link" v-if="data.type === 'URL'"></i>
-                  {{ node.label }}</span
-                >
-              </span>
-            </el-tree>
-          </div>
-        </el-form-item>
+        <el-form-item label="角色权限:" required></el-form-item>
       </el-form>
+      <privilege-set
+        v-if="menus && menus.length"
+        ref="PrivilegeSet"
+        :menus="menus"
+      ></privilege-set>
     </div>
     <div slot="footer">
       <el-button type="primary" :disabled="isSubmit" @click="submit"
@@ -60,17 +42,18 @@
 </template>
 
 <script>
-import { updateRole, menuAuthList, roleBoundPrivileges } from "../../base/api";
+import { updateRole, privilegeList, roleBoundPrivileges } from "../../base/api";
+import PrivilegeSet from "../../base/components/PrivilegeSet";
 
 const initModalForm = {
   id: null,
   name: "",
-  type: "CUSTOM",
   privilegeIds: []
 };
 
 export default {
-  name: "modify-role",
+  name: "modify-system-role",
+  components: { PrivilegeSet },
   props: {
     instance: {
       type: Object,
@@ -92,37 +75,13 @@ export default {
       modalIsShow: false,
       isSubmit: false,
       menus: [],
-      defaultExpandedKeys: [],
       modalForm: {},
-      defaultProps: {
-        label: "name"
-      },
       rules: {
         name: [
           {
             required: true,
-            pattern: /^[0-9a-zA-Z\u4E00-\u9FA5]{1,10}$/,
-            message: "角色名称只能输入汉字、字母和数字,长度不能超过10",
-            trigger: "change"
-          }
-        ],
-        type: [
-          {
-            required: true,
-            message: "请选择角色类型",
-            trigger: "change"
-          }
-        ],
-        privilegeIds: [
-          {
-            required: true,
-            validator: (rule, value, callback) => {
-              if (this.modalForm.type !== "CUSTOM" || value.length) {
-                callback();
-              } else {
-                callback(new Error("请选择扩展字段"));
-              }
-            },
+            pattern: /^[0-9a-zA-Z\u4E00-\u9FA5]{1,20}$/,
+            message: "角色名称只能输入汉字、字母和数字,长度不能超过20",
             trigger: "change"
           }
         ]
@@ -134,37 +93,27 @@ export default {
   },
   methods: {
     async getMenus() {
-      const data = await menuAuthList();
-      if (data) this.menus = data.filter(item => item.url !== "common");
-      this.defaultExpandedKeys = [];
-      this.getDefaultExpandedKeys(this.menus);
+      const data = await privilegeList();
+      if (data) {
+        this.menus = data.map(item => {
+          item.parentId = null;
+          return item;
+        });
+      }
     },
     async visibleChange() {
-      console.log(this.instance);
+      let privilegeIds = [];
       if (this.instance.id) {
         this.modalForm = this.$objAssign(initModalForm, this.instance);
-        let privilegeIds = await roleBoundPrivileges(this.instance.id);
+        privilegeIds = await roleBoundPrivileges(this.instance.id);
         privilegeIds = privilegeIds || [];
-        let checkedIds = [];
-        const getCheckedIds = list => {
-          list.forEach(item => {
-            if (item["children"] && item["children"].length) {
-              getCheckedIds(item.children);
-            } else {
-              const isChecked = privilegeIds.includes(item.id);
-              if (isChecked) checkedIds.push(item.id);
-            }
-          });
-        };
-        getCheckedIds(this.menus);
-        this.$refs.MenuTree.setCheckedKeys(checkedIds);
-        this.modalForm.privilegeIds = checkedIds;
+        this.modalForm.privilegeIds = privilegeIds;
       } else {
         this.modalForm = { ...initModalForm };
-        this.$refs.MenuTree.setCheckedKeys([]);
       }
       this.$nextTick(() => {
         this.$refs.modalFormComp.clearValidate();
+        this.$refs.PrivilegeSet.buildTableData(privilegeIds);
       });
     },
     cancel() {
@@ -173,33 +122,19 @@ export default {
     open() {
       this.modalIsShow = true;
     },
-    getDefaultExpandedKeys(menus) {
-      menus.forEach(item => {
-        if (
-          item.children &&
-          item.children.length &&
-          !item.children.some(elem => elem.type === "URL")
-        ) {
-          this.defaultExpandedKeys.push(item.id);
-          this.getDefaultExpandedKeys(item.children);
-        }
-      });
-    },
-    checkChange(data, checked) {
-      this.modalForm.privilegeIds = this.$refs.MenuTree.getCheckedKeys();
-      this.$refs.modalFormComp.validateField("privilegeIds");
-    },
     async submit() {
       const valid = await this.$refs.modalFormComp.validate().catch(() => {});
       if (!valid) return;
 
+      const privilegeIds = this.$refs.PrivilegeSet.getSelectedPrivilegeIds();
+      if (!privilegeIds.length) {
+        this.$emit("请设置角色权限!");
+        return;
+      }
+
       if (this.isSubmit) return;
       this.isSubmit = true;
       const datas = { ...this.modalForm };
-      const privilegeIds = [
-        ...this.$refs.MenuTree.getCheckedKeys(),
-        ...this.$refs.MenuTree.getHalfCheckedKeys()
-      ];
       datas.privilegeIds = privilegeIds;
       const data = await updateRole(datas).catch(() => {});
       this.isSubmit = false;

+ 9 - 3
src/modules/admin/components/ModifyUser.vue

@@ -46,7 +46,6 @@
             style="width:100%;"
             v-model="modalForm.roleIds"
             placeholder="请选择角色"
-            disabled
             multiple
           >
             <el-option
@@ -158,8 +157,15 @@ export default {
   },
   methods: {
     initData(val) {
-      this.modalForm = this.$objAssign(initModalForm, val);
-      this.modalForm.roleIds = val.roles.map(item => item.id);
+      if (val.id) {
+        this.modalForm = this.$objAssign(initModalForm, val);
+        this.modalForm.roleIds = val.roles.map(item => item.id);
+      } else {
+        this.modalForm = { ...initModalForm };
+        this.$nextTick(() => {
+          this.$refs.modalFormComp.clearValidate();
+        });
+      }
     },
     visibleChange() {
       this.initData(this.instance);

+ 3 - 7
src/modules/admin/views/AdminUserManage.vue

@@ -155,15 +155,13 @@ export default {
       const data = await userRoleListPage();
       this.roles = data || [];
       this.roles = this.roles
-        .filter(item => item.type === "CUSTOMER")
+        .filter(item => item.type !== "ADMIN")
         .map(item => {
           return {
             id: item.id,
-            name: item.name,
-            type: item.type
+            name: item.name
           };
         });
-      console.log(this.roles);
     },
     async getList() {
       const datas = {
@@ -211,9 +209,7 @@ export default {
       this.$refs.ModifyUser.open();
     },
     toAdd() {
-      this.curUser = {
-        roles: this.roles
-      };
+      this.curUser = {};
       this.$refs.ModifyUser.open();
     },
     async toResetPwd(row) {

+ 12 - 0
src/modules/admin/views/SystemRoleManage.vue

@@ -1,5 +1,13 @@
 <template>
   <div class="role-manage">
+    <div class="flex-between mb-2">
+      <el-button
+        type="primary"
+        icon="el-icon-circle-plus-outline"
+        @click="toAdd"
+        >添加角色</el-button
+      >
+    </div>
     <div class="part-box">
       <el-table ref="TableList" :data="roles" border stripe>
         <el-table-column
@@ -71,6 +79,10 @@ export default {
     toEdit(row) {
       this.curRole = row;
       this.$refs.ModifySystemRole.open();
+    },
+    toAdd() {
+      this.curRole = {};
+      this.$refs.ModifySystemRole.open();
     }
   }
 };

+ 4 - 1
src/modules/base/api.js

@@ -38,7 +38,7 @@ export const updateRole = datas => {
   return $post("/api/admin/sys/role/save", datas);
 };
 export const deleteRole = id => {
-  return $post("/api/admin/sys/role/remove", { id });
+  return $postParam("/api/admin/sys/role/remove", { id });
 };
 export const userBoundRoles = userId => {
   return $postParam("/api/admin/sys/role/get_user_roles", { userId });
@@ -57,6 +57,9 @@ export const roleBoundPrivileges = roleId => {
 export const organizationList = datas => {
   return $postParam("/api/admin/sys/org/list", datas);
 };
+export const organizationFindByTypeList = orgType => {
+  return $postParam("/api/admin/sys/org/find_by_type", { orgType });
+};
 export const updateOrganization = datas => {
   return $post("/api/admin/sys/org/save", datas);
 };

+ 22 - 18
src/modules/base/components/ModifyOrganization.vue

@@ -17,14 +17,14 @@
         :rules="rules"
         label-width="100px"
       >
+        <el-form-item label="上级机构:">
+          <el-input
+            style="width:282px;"
+            v-model.trim="modalForm.parentName"
+            disabled
+          ></el-input>
+        </el-form-item>
         <el-form-item prop="name" label="机构名称:">
-          <el-form-item label="上级机构:">
-            <el-input
-              style="width:282px;"
-              v-model.trim="modalForm.parentName"
-              disabled
-            ></el-input>
-          </el-form-item>
           <el-input
             style="width:282px;"
             v-model.trim="modalForm.name"
@@ -32,23 +32,23 @@
             clearable
           ></el-input>
         </el-form-item>
-        <el-form-item prop="orgType" label="机构类型:">
+        <el-form-item prop="type" label="机构类型:">
           <el-select
-            v-model="modalForm.orgType"
+            v-model="modalForm.type"
             style="width: 282px;"
             placeholder="请选择"
             clearable
           >
             <el-option
-              v-for="(val, key) in ORG_TYPE"
-              :key="key"
-              :value="key"
-              :label="val"
+              v-for="item in orgTypes"
+              :key="item.type"
+              :value="item.type"
+              :label="item.name"
             ></el-option>
           </el-select>
         </el-form-item>
         <el-form-item
-          v-if="modalForm.orgType === 'PRINT_ROOM'"
+          v-if="modalForm.type === 'PRINTING_HOUSE'"
           prop="campusId"
           label="所属校区:"
         >
@@ -79,12 +79,11 @@
 
 <script>
 import { updateOrganization } from "../api";
-import { ORG_TYPE } from "@/constants/enumerate";
 
 const initModalForm = {
   id: null,
   name: "",
-  orgType: "",
+  type: "",
   campusId: "",
   parentId: null,
   parentName: "",
@@ -99,6 +98,12 @@ export default {
       default() {
         return {};
       }
+    },
+    orgTypes: {
+      type: Array,
+      default() {
+        return [];
+      }
     }
   },
   computed: {
@@ -113,7 +118,6 @@ export default {
     return {
       modalIsShow: false,
       isSubmit: false,
-      ORG_TYPE,
       modalForm: {},
       rules: {
         name: [
@@ -124,7 +128,7 @@ export default {
             trigger: "change"
           }
         ],
-        orgType: [
+        type: [
           {
             required: true,
             message: "请选择机构类型",

+ 3 - 23
src/modules/base/components/ModifyRole.vue

@@ -81,8 +81,8 @@ export default {
         name: [
           {
             required: true,
-            pattern: /^[0-9a-zA-Z\u4E00-\u9FA5]{1,10}$/,
-            message: "角色名称只能输入汉字、字母和数字,长度不能超过10",
+            pattern: /^[0-9a-zA-Z\u4E00-\u9FA5]{1,20}$/,
+            message: "角色名称只能输入汉字、字母和数字,长度不能超过20",
             trigger: "change"
           }
         ]
@@ -90,8 +90,7 @@ export default {
     };
   },
   created() {
-    // this.getMenus();
-    // this.buildMenuTree(navs);
+    this.getMenus();
   },
   methods: {
     async getMenus() {
@@ -105,25 +104,6 @@ export default {
             return item;
           });
     },
-    buildMenuTree(menus) {
-      const buildTree = list => {
-        list.forEach(item => {
-          const children = menus.filter(m => m.parentId === item.id);
-          if (children.length) {
-            item.children = children;
-            buildTree(children);
-          }
-        });
-        return list;
-      };
-
-      const navs = menus.filter(m => m.parentId === "-1");
-      this.menus = buildTree(navs);
-
-      this.menus.forEach(item => {
-        item.parentId = null;
-      });
-    },
     async visibleChange() {
       let privilegeIds = [];
       if (this.instance.id) {

+ 5 - 33
src/modules/base/components/ModifyUser.vue

@@ -55,10 +55,9 @@
             v-model="modalForm.roleIds"
             placeholder="请选择角色"
             multiple
-            @change="rolesChange"
           >
             <el-option
-              v-for="item in roleList"
+              v-for="item in roles"
               :key="item.id"
               :value="item.id"
               :label="item.name"
@@ -66,7 +65,7 @@
             </el-option>
           </el-select>
         </el-form-item>
-        <el-form-item prop="orgId" label="所属学院:" v-if="!IS_SUPER_ADMIN">
+        <el-form-item prop="orgId" label="所属学院:">
           <select-orgs
             ref="SelectOrgs"
             v-model="modalForm.orgId"
@@ -136,13 +135,6 @@ export default {
         callback();
       }
     };
-    const courseIdsValidator = (rule, value, callback) => {
-      if (!value || !value.length) {
-        callback(new Error("请选择课程"));
-      } else {
-        callback();
-      }
-    };
     const orgIdValidator = (rule, value, callback) => {
       if (!value || !value.length) {
         callback(new Error("请选择所属学院"));
@@ -205,13 +197,6 @@ export default {
             trigger: "change"
           }
         ],
-        courseIds: [
-          {
-            required: true,
-            validator: courseIdsValidator,
-            trigger: "change"
-          }
-        ],
         orgId: [
           {
             required: true,
@@ -223,29 +208,22 @@ export default {
       user: {},
       courses: [],
       roleList: [],
-      roleTypes: [],
       IS_SUPER_ADMIN
     };
   },
   methods: {
     initData(val) {
-      this.roleList = this.getRoleList();
       if (val.id) {
         this.modalForm = this.$objAssign(initModalForm, val);
         this.modalForm.roleIds = val.roles.map(item => item.id);
-        this.modalForm.courseIds = val.courses.map(item => item.id);
         this.modalForm.orgId = [val.orgId];
-        this.roleTypes = val.roles.map(role => role.type);
       } else {
         this.modalForm = { ...initModalForm };
+        this.$nextTick(() => {
+          this.$refs.modalFormComp.clearValidate();
+        });
       }
     },
-    getRoleList() {
-      if (this.IS_SUPER_ADMIN)
-        return this.roles.filter(item => item.type === "SCHOOL_ADMIN");
-
-      return this.roles.filter(item => item.type !== "SCHOOL_ADMIN");
-    },
     visibleChange() {
       this.initData(this.instance);
     },
@@ -255,11 +233,6 @@ export default {
     open() {
       this.modalIsShow = true;
     },
-    rolesChange(roleIds) {
-      this.roleTypes = this.roles
-        .filter(role => roleIds.includes(role.id))
-        .map(role => role.type);
-    },
     orgChange() {
       this.$nextTick(() => {
         this.$refs.modalFormComp.validateField("orgId");
@@ -273,7 +246,6 @@ export default {
       this.isSubmit = true;
 
       const datas = { ...this.modalForm };
-      if (!this.IS_QUESTION_TEACHER) delete datas.courseIds;
       datas.orgId = datas.orgId.join();
       const data = await updateUser(datas).catch(() => {});
       this.isSubmit = false;

+ 1 - 4
src/modules/base/components/PrivilegeSet.vue

@@ -142,10 +142,7 @@ export default {
       this.tableData
         .filter(row => row.enable)
         .forEach(row => {
-          if (!row.isPage) {
-            privilegeIds.push(row.id);
-            return;
-          }
+          privilegeIds.push(row.id);
           row.columns.forEach(column => {
             if (column.type === "page" || column.type === "page-checkbox")
               return;

+ 333 - 78
src/modules/base/components/privilege/navs.json

@@ -77,6 +77,16 @@
                 "schoolId": "2",
                 "sequence": 1,
                 "enable": true
+              },
+              {
+                "id": "389",
+                "name": "课程管理-机构列表",
+                "url": "List",
+                "type": "LIST",
+                "parentId": "4",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
               }
             ],
             "conditions": [
@@ -703,6 +713,36 @@
                 "schoolId": "2",
                 "sequence": 5,
                 "enable": true
+              },
+              {
+                "id": "383",
+                "name": "课程管理-查询",
+                "url": "Select",
+                "type": "BUTTON",
+                "parentId": "13",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              },
+              {
+                "id": "385",
+                "name": "课程管理-新增",
+                "url": "Add",
+                "type": "BUTTON",
+                "parentId": "13",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              },
+              {
+                "id": "388",
+                "name": "课程管理-批量导入",
+                "url": "Import",
+                "type": "BUTTON",
+                "parentId": "13",
+                "schoolId": "2",
+                "sequence": 2,
+                "enable": true
               }
             ],
             "links": [
@@ -725,6 +765,26 @@
                 "schoolId": "2",
                 "sequence": 2,
                 "enable": true
+              },
+              {
+                "id": "386",
+                "name": "课程管理-编辑",
+                "url": "Edit",
+                "type": "LINK",
+                "parentId": "13",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              },
+              {
+                "id": "387",
+                "name": "课程管理-删除",
+                "url": "Delete",
+                "type": "LINK",
+                "parentId": "13",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
               }
             ],
             "lists": [
@@ -737,6 +797,16 @@
                 "schoolId": "2",
                 "sequence": 1,
                 "enable": true
+              },
+              {
+                "id": "384",
+                "name": "课程管理-列表",
+                "url": "List",
+                "type": "LIST",
+                "parentId": "13",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
               }
             ],
             "conditions": [
@@ -753,6 +823,156 @@
             ]
           }
         ]
+      },
+      {
+        "id": "356",
+        "name": "字典管理",
+        "url": "dictionary",
+        "type": "MENU",
+        "parentId": "1",
+        "sequence": 1,
+        "children": [
+          {
+            "id": "357",
+            "name": "校区管理",
+            "url": "CampusManage",
+            "type": "MENU",
+            "parentId": "356",
+            "sequence": 1,
+            "children": [],
+            "buttons": [
+              {
+                "id": "372",
+                "name": "校区管理-查询",
+                "url": "Select",
+                "type": "BUTTON",
+                "parentId": "357",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              },
+              {
+                "id": "374",
+                "name": "校区管理-新增",
+                "url": "Add",
+                "type": "BUTTON",
+                "parentId": "357",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              }
+            ],
+            "links": [
+              {
+                "id": "375",
+                "name": "校区管理-编辑",
+                "url": "Edit",
+                "type": "LINK",
+                "parentId": "357",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              },
+              {
+                "id": "376",
+                "name": "校区管理-删除",
+                "url": "Delete",
+                "type": "LINK",
+                "parentId": "357",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              }
+            ],
+            "lists": [
+              {
+                "id": "373",
+                "name": "校区管理-列表",
+                "url": "List",
+                "type": "LIST",
+                "parentId": "357",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              }
+            ]
+          },
+          {
+            "id": "358",
+            "name": "学生管理",
+            "url": "StudentManage",
+            "type": "MENU",
+            "parentId": "356",
+            "sequence": 2,
+            "children": [],
+            "buttons": [
+              {
+                "id": "377",
+                "name": "学生管理-查询",
+                "url": "Select",
+                "type": "BUTTON",
+                "parentId": "358",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              },
+              {
+                "id": "379",
+                "name": "学生管理-新增",
+                "url": "Add",
+                "type": "BUTTON",
+                "parentId": "358",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              },
+              {
+                "id": "382",
+                "name": "学生管理-批量导入",
+                "url": "Import",
+                "type": "BUTTON",
+                "parentId": "358",
+                "schoolId": "2",
+                "sequence": 2,
+                "enable": true
+              }
+            ],
+            "links": [
+              {
+                "id": "380",
+                "name": "学生管理-编辑",
+                "url": "Edit",
+                "type": "LINK",
+                "parentId": "358",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              },
+              {
+                "id": "381",
+                "name": "学生管理-删除",
+                "url": "Delete",
+                "type": "LINK",
+                "parentId": "358",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              }
+            ],
+            "lists": [
+              {
+                "id": "378",
+                "name": "学生管理-列表",
+                "url": "List",
+                "type": "LIST",
+                "parentId": "358",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              }
+            ]
+          }
+        ]
       }
     ]
   },
@@ -1665,79 +1885,6 @@
       }
     ]
   },
-  {
-    "id": "129",
-    "name": "公共接口",
-    "url": "common",
-    "type": "MENU",
-    "parentId": "-1",
-    "sequence": 31,
-    "children": [
-      {
-        "id": "7",
-        "name": "权限管理",
-        "url": "MenuManage",
-        "type": "MENU",
-        "parentId": "129",
-        "sequence": 6,
-        "children": []
-      },
-      {
-        "id": "130",
-        "name": "用户登录相关",
-        "url": "login",
-        "type": "MENU",
-        "parentId": "129",
-        "sequence": 1,
-        "children": []
-      },
-      {
-        "id": "136",
-        "name": "模糊查询",
-        "url": "query",
-        "type": "MENU",
-        "parentId": "129",
-        "sequence": 2,
-        "children": []
-      },
-      {
-        "id": "144",
-        "name": "文件相关",
-        "url": "file",
-        "type": "MENU",
-        "parentId": "129",
-        "sequence": 3,
-        "children": []
-      },
-      {
-        "id": "149",
-        "name": "系统相关",
-        "url": "sys",
-        "type": "MENU",
-        "parentId": "129",
-        "sequence": 4,
-        "children": []
-      },
-      {
-        "id": "154",
-        "name": "其他",
-        "url": "other",
-        "type": "MENU",
-        "parentId": "129",
-        "sequence": 5,
-        "children": []
-      },
-      {
-        "id": "181",
-        "name": "超管中心",
-        "url": "admin",
-        "type": "MENU",
-        "parentId": "129",
-        "sequence": 7,
-        "children": []
-      }
-    ]
-  },
   {
     "id": "170",
     "name": "客服制卡",
@@ -1761,19 +1908,127 @@
             "type": "MENU",
             "parentId": "171",
             "sequence": 1,
-            "children": []
+            "children": [],
+            "buttons": [
+              {
+                "id": "346",
+                "name": "题卡审核-待审核查询",
+                "url": "Select",
+                "type": "BUTTON",
+                "parentId": "172",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              },
+              {
+                "id": "347",
+                "name": "题卡审核-待审核批量下载试卷文件",
+                "url": "BatchDownload",
+                "type": "BUTTON",
+                "parentId": "172",
+                "schoolId": "2",
+                "sequence": 2,
+                "enable": true
+              },
+              {
+                "id": "352",
+                "name": "题卡审核-已审核查询",
+                "url": "Select",
+                "type": "BUTTON",
+                "parentId": "172",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              }
+            ],
+            "links": [
+              {
+                "id": "350",
+                "name": "题卡审核-待审核预览",
+                "url": "Preview",
+                "type": "LINK",
+                "parentId": "172",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              },
+              {
+                "id": "351",
+                "name": "题卡审核-待审核设计题卡",
+                "url": "Preview",
+                "type": "LINK",
+                "parentId": "172",
+                "schoolId": "2",
+                "sequence": 2,
+                "enable": true
+              },
+              {
+                "id": "355",
+                "name": "题卡审核-已审核预览",
+                "url": "Preview",
+                "type": "LINK",
+                "parentId": "172",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              }
+            ],
+            "lists": [
+              {
+                "id": "349",
+                "name": "题卡审核-待审核列表",
+                "url": "List",
+                "type": "LIST",
+                "parentId": "172",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              },
+              {
+                "id": "354",
+                "name": "题卡审核-已审核列表",
+                "url": "List",
+                "type": "LIST",
+                "parentId": "172",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              }
+            ],
+            "conditions": [
+              {
+                "id": "348",
+                "name": "题卡审核-待审核查询条件",
+                "url": "Condition",
+                "type": "CONDITION",
+                "parentId": "172",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              },
+              {
+                "id": "353",
+                "name": "题卡审核-已审核查询条件",
+                "url": "Condition",
+                "type": "CONDITION",
+                "parentId": "172",
+                "schoolId": "2",
+                "sequence": 1,
+                "enable": true
+              }
+            ]
           }
         ]
       }
     ]
   },
   {
-    "id": "175",
-    "name": "题卡管理",
-    "url": "card",
+    "id": "199",
+    "name": "客户端",
+    "url": "client",
     "type": "MENU",
     "parentId": "-1",
-    "sequence": 5,
+    "sequence": 22,
     "children": []
   }
 ]

+ 58 - 15
src/modules/base/views/OrganizationManage.vue

@@ -20,23 +20,17 @@
             ></el-button>
           </span>
           <span v-else>
-            <el-button type="text">{{
-              data.orgType | orgTypeFilter
-            }}</el-button>
+            <el-button type="text">{{ data.type | orgTypeFilter }}</el-button>
             <el-button
+              v-if="
+                data.type !== 'PRINTING_HOUSE' && data.type !== 'TEACHING_ROOM'
+              "
               class="btn-table-icon"
               type="text"
               icon="icon icon-plus-act"
               @click="() => append(data)"
               title="新增子机构"
             ></el-button>
-            <el-button
-              class="btn-table-icon"
-              type="text"
-              icon="el-icon-s-custom"
-              @click="() => modifyAdmin(data)"
-              title="管理人员"
-            ></el-button>
             <el-button
               class="btn-table-icon"
               type="text"
@@ -60,6 +54,7 @@
     <modify-organization
       ref="ModifyOrganization"
       :instance="curOrg"
+      :org-types="orgTypes"
       @confirm="getList"
     ></modify-organization>
   </div>
@@ -68,6 +63,7 @@
 <script>
 import { organizationList, deleteOrganization } from "../api";
 import ModifyOrganization from "../components/ModifyOrganization";
+import { ORG_TYPE } from "@/constants/enumerate";
 
 export default {
   name: "organization-manage",
@@ -76,6 +72,8 @@ export default {
     return {
       orgs: [],
       curOrg: {},
+      orgTypes: [],
+      orgTypeSerial: ["COLLEGE", "FACULTY", "TEACHING_ROOM"],
       defaultProps: {
         label: "name"
       }
@@ -98,13 +96,50 @@ export default {
       ];
     },
     toAdd() {
-      this.curOrg = {};
+      const data = this.orgs[0];
+      this.curOrg = {
+        parentName: data.name
+      };
+      this.orgTypes = [
+        { type: "COLLEGE", name: "学院" },
+        { type: "PRINTING_HOUSE", name: "印刷室" }
+      ];
       this.$refs.ModifyOrganization.open();
     },
     edit(node, data) {
+      if (data.type === "PRINTING_HOUSE" || data.type === "TEACHING_ROOM") {
+        this.orgTypes = [{ type: data.type, name: ORG_TYPE[data.type] }];
+      }
+
+      if (data.type === "COLLEGE") {
+        this.orgTypes = [{ type: "COLLEGE", name: "学院" }];
+        // if (node.childNodes.length) {
+        //   const childNodeTypes = node.childNodes.map(item => item.data.type);
+        //   if (!childNodeTypes.includes("FACULTY")) {
+        //     orgTypes.push({ type: "FACULTY", name: "院系" });
+        //   }
+        // } else {
+        //   this.orgTypes = this.orgTypeSerial.map(type => {
+        //     return {
+        //       type,
+        //       name: ORG_TYPE[type]
+        //     };
+        //   });
+        // }
+      }
+      if (data.type === "FACULTY") {
+        let orgTypes = [{ type: "FACULTY", name: "院系" }];
+        // if (!node.parent.data.type) {
+        //   orgTypes.unshift({ type: "COLLEGE", name: "学院" });
+        // }
+        if (!node.childNodes.length) {
+          orgTypes.push({ type: "TEACHING_ROOM", name: "教研室" });
+        }
+        this.orgTypes = orgTypes;
+      }
       this.curOrg = {
         ...data,
-        parentName: data.parentId && node.parent.data.name
+        parentName: node.parent.data.name
       };
       this.$refs.ModifyOrganization.open();
     },
@@ -127,11 +162,19 @@ export default {
         .catch(() => {});
     },
     append(data) {
+      if (data.type === "PRINTING_HOUSE" || data.type === "TEACHING_ROOM")
+        return;
+
+      const pos = this.orgTypeSerial.indexOf(data.type);
+      this.orgTypes = this.orgTypeSerial.slice(pos + 1).map(type => {
+        return {
+          type,
+          name: ORG_TYPE[type]
+        };
+      });
+
       this.curOrg = { parentId: data.id, parentName: data.name };
       this.$refs.ModifyOrganization.open();
-    },
-    modifyAdmin(data) {
-      console.log(data);
     }
   }
 };

+ 1 - 19
src/modules/base/views/UserManage.vue

@@ -112,7 +112,6 @@
         >
           <template slot-scope="scope">
             <el-button
-              v-if="checkCanEdit(scope.row)"
               class="btn-table-icon"
               type="text"
               icon="icon icon-edit"
@@ -165,7 +164,7 @@
 
 <script>
 import ModifyUser from "../components/ModifyUser";
-import { ABLE_TYPE, SYS_ADMIN_NAME } from "@/constants/enumerate";
+import { ABLE_TYPE } from "@/constants/enumerate";
 import { userListPage, ableUser, resetPwd, userRoleListPage } from "../api";
 // import { logout } from "@/modules/login/api";
 import UploadButton from "../../../components/UploadButton";
@@ -174,8 +173,6 @@ export default {
   name: "user-manage",
   components: { ModifyUser, UploadButton },
   data() {
-    const IS_SUPER_ADMIN =
-      this.$ls.get("user", { loginName: "" }).loginName === SYS_ADMIN_NAME;
     return {
       filter: {
         loginName: "",
@@ -190,19 +187,12 @@ export default {
       roles: [],
       users: [],
       curUser: {},
-      userRoles: this.$ls.get("user", { roleList: [] }).roleList,
-      IS_SUPER_ADMIN,
       // import
       uploadUrl: "/api/admin/sys/user/import",
       downloadUrl: "/temps/用户导入模板.xlsx",
       dfilename: "用户导入模板.xlsx"
     };
   },
-  computed: {
-    IS_SCHOOL_ADMIN() {
-      return this.userRoles.includes("SCHOOL_ADMIN");
-    }
-  },
   created() {
     this.getRoleList();
     this.getList();
@@ -231,14 +221,6 @@ export default {
       this.current = page;
       this.getList();
     },
-    checkCanEdit(row) {
-      const cannotEdit =
-        (this.IS_SCHOOL_ADMIN &&
-          row.roles.some(role => role.type === "SCHOOL_ADMIN")) ||
-        (this.IS_SUPER_ADMIN &&
-          !row.roles.some(role => role.type === "SCHOOL_ADMIN"));
-      return !cannotEdit;
-    },
     toEnable(row) {
       // 自己不可以启用/禁用自己
       const userId = this.$ls.get("user", { id: "" }).id;

+ 73 - 54
src/modules/exam/views/WaitTask.vue

@@ -1,73 +1,92 @@
 <template>
   <div class="wait-task">
-    <el-row type="flex" :gutter="20">
-      <el-col v-if="IS_QUESTION_TEACHER" :span="colSpan">
-        <wait-task-exam-task
-          class="wait-module"
-          ref="WaitTaskExamTask"
-          @update-list="updateList"
-        ></wait-task-exam-task>
-      </el-col>
-      <el-col v-if="IS_EXAM_TEACHER" :span="colSpan">
-        <wait-task-exam
-          class="wait-module"
-          ref="WaitTaskExam"
-          @update-list="updateList"
-        ></wait-task-exam>
-      </el-col>
-      <el-col v-if="IS_EXAM_TEACHER" :span="colSpan">
-        <wait-task-audit
-          class="wait-module"
-          ref="WaitTaskAudit"
-          @update-list="updateList"
-        ></wait-task-audit>
-      </el-col>
-    </el-row>
+    <div class="part-box">
+      <el-table ref="TableList" :data="dataList" border stripe>
+        <el-table-column
+          type="index"
+          label="序号"
+          width="50"
+          align="center"
+          :index="indexMethod"
+        ></el-table-column>
+        <el-table-column prop="paperNumber" label="试卷编号"></el-table-column>
+        <el-table-column prop="type" label="课程(代码)">
+          <template slot-scope="scope">
+            {{ scope.row.courseName }}({{ scope.row.courseCode }})
+          </template>
+        </el-table-column>
+        <el-table-column prop="cardRuleName" label="题卡规则"></el-table-column>
+        <el-table-column prop="taskName" label="流程节点"> </el-table-column>
+        <el-table-column prop="createTime" label="创建时间" width="180">
+          <span slot-scope="scope">{{
+            scope.row.createTime | timestampFilter
+          }}</span>
+        </el-table-column>
+        <el-table-column
+          class-name="action-column"
+          label="操作"
+          align="center"
+          width="100px"
+        >
+          <template slot-scope="scope">
+            <el-button
+              class="btn-table-icon"
+              type="text"
+              icon="icon icon-download-act"
+              :disabled="loading"
+              @click="toDo(scope.row)"
+              >立即处理</el-button
+            >
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="part-page">
+        <el-pagination
+          background
+          layout="total,prev, pager, next"
+          :current-page="current"
+          :total="total"
+          :page-size="size"
+          @current-change="toPage"
+        >
+        </el-pagination>
+      </div>
+    </div>
   </div>
 </template>
 
 <script>
-import WaitTaskExamTask from "../components/WaitTaskExamTask";
-import WaitTaskExam from "../components/WaitTaskExam";
-import WaitTaskAudit from "../components/WaitTaskAudit";
 import { mapActions } from "vuex";
+import { waitExamTaskListPage } from "../api";
 
 export default {
   name: "wait-task",
-  components: { WaitTaskExam, WaitTaskAudit, WaitTaskExamTask },
   data() {
     return {
-      userRoles: this.$ls.get("user", { roleList: [] }).roleList
+      current: 1,
+      size: this.GLOBAL.pageSize,
+      total: 0,
+      dataList: []
     };
   },
-  computed: {
-    IS_QUESTION_TEACHER() {
-      return this.userRoles.includes("QUESTION_TEACHER");
-    },
-    IS_EXAM_TEACHER() {
-      return this.userRoles.includes("EXAM_TEACHER");
-    },
-    colSpan() {
-      const modules = [
-        this.IS_QUESTION_TEACHER,
-        this.IS_EXAM_TEACHER,
-        this.IS_EXAM_TEACHER
-      ];
-      const moduleCount = modules.filter(item => item).length;
-      return Math.floor(24 / moduleCount);
-    }
-  },
   methods: {
     ...mapActions("exam", ["updateWaitTaskCount"]),
-    updateList() {
-      this.updateWaitTaskCount(this.userRoles);
-      if (this.IS_QUESTION_TEACHER) {
-        this.$refs.WaitTaskExamTask.getList();
-      }
-      if (this.IS_EXAM_TEACHER) {
-        this.$refs.WaitTaskExam.getList();
-        this.$refs.WaitTaskAudit.getList();
-      }
+    async getList() {
+      const datas = {
+        pageNumber: this.current,
+        pageSize: this.size
+      };
+      const data = await waitExamTaskListPage(datas);
+      this.tasks = data.records;
+      this.total = data.total;
+    },
+    toPage(page) {
+      this.current = page;
+      this.getList();
+    },
+    toDo(row) {
+      console.log(row);
+      // TODO:
     }
   },
   beforeRouteLeave(to, from, next) {

+ 3 - 1
src/modules/login/views/Login.vue

@@ -12,6 +12,7 @@
             <el-input
               v-model.trim="loginModel.loginName"
               placeholder="请输入账号"
+              name="username"
               clearable
             >
               <i class="icon icon-phone" slot="prefix"></i>
@@ -32,6 +33,7 @@
                 <el-input
                   v-model.trim="loginModel.code"
                   placeholder="请输入手机验证码"
+                  name="code"
                   clearable
                 >
                   <i class="icon icon-checkcode" slot="prefix"></i>
@@ -145,7 +147,7 @@ export default {
   methods: {
     async getSmsCodeRequired() {
       const data = await getSysConfig("sys.code.enable");
-      this.smsCodeRequired = data.configValue === "true";
+      this.smsCodeRequired = data && data.configValue === "true";
     },
     async getSchool() {
       const data = await getSchoolInfo(ORG_CODE);

+ 4 - 4
src/views/Home.vue

@@ -220,7 +220,7 @@ export default {
     ...mapState("exam", ["waitTaskCount"])
   },
   created() {
-    this.getMenus1();
+    this.getMenus();
   },
   methods: {
     ...mapActions("exam", ["updateWaitTaskCount"]),
@@ -236,8 +236,8 @@ export default {
     },
     async getMenus() {
       const data = await sysMenu();
-      this.initPrivilegeMap(data);
-      const { menus, firstRouter } = this.menusToTree(data);
+      this.initPrivilegeMap(data.privileges);
+      const { menus, firstRouter } = this.menusToTree(data.privileges);
       this.menus = menus;
 
       if (this.$route.name === "Home") {
@@ -258,7 +258,7 @@ export default {
     },
     initPrivilegeMap(data) {
       let privilegeMap = {};
-      const pageSetTypes = ["querys", "buttons", "columns", "links"];
+      const pageSetTypes = ["conditions", "buttons", "lists", "links"];
       data.forEach(item => {
         const isPage = pageSetTypes.some(
           type => item[type] && item[type].length