Ver Fonte

用户管理

natasha há 1 mês atrás
pai
commit
7f988bc240

+ 7 - 0
src/api/list.js

@@ -25,4 +25,11 @@ export function queryOrgList(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=page_query-PageQueryOrgList`, data, {
     baseURL: process.env.VUE_APP_EEP,
   });
+}
+
+// 分页查询内置管理员用户列表
+export function queryUserList(data) {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=page_query-PageQueryUserList`, data, {
+    baseURL: process.env.VUE_APP_EEP,
+  });
 }

+ 7 - 0
src/api/org.js

@@ -6,4 +6,11 @@ export function createOrg(data) {
   return http.post(`${process.env.VUE_APP_EepServer}?MethodName=org_manager-CreateOrg`, data, {
     baseURL: process.env.VUE_APP_EEP,
   });
+}
+
+// 设置机构管理员
+export function setUserToOrgManager(data) {
+  return http.post(`${process.env.VUE_APP_EepServer}?MethodName=user_manager-SetUserToOrgManager`, data, {
+    baseURL: process.env.VUE_APP_EEP,
+  });
 }

+ 16 - 0
src/icons/svg/org.svg

@@ -0,0 +1,16 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747294167845"
+  class="icon" viewBox="0 0 1228 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7797"
+  xmlns:xlink="http://www.w3.org/1999/xlink" width="239.84375" height="200">
+  <path d="M102.4 996.693333h1026.730667a40.96 40.96 0 0 0 0-81.92H102.4a40.96 40.96 0 0 0 0 81.92z" fill="#5C7792"
+    p-id="7798"></path>
+  <path
+    d="M273.066667 27.306667h341.333333A109.226667 109.226667 0 0 1 723.626667 136.533333v860.16H163.84V136.533333A109.226667 109.226667 0 0 1 273.066667 27.306667z m368.64 887.466666V136.533333a27.306667 27.306667 0 0 0-27.306667-27.306666H273.066667a27.306667 27.306667 0 0 0-27.306667 27.306666v778.24h395.946667z"
+    fill="#5C7792" p-id="7799"></path>
+  <path
+    d="M641.706667 300.373333H955.733333A109.226667 109.226667 0 0 1 1064.96 409.6v587.093333H641.706667V300.373333z m81.92 614.4h259.413333V409.6a27.306667 27.306667 0 0 0-27.306667-27.306667h-232.106666v532.48z"
+    fill="#5C7792" p-id="7800"></path>
+  <path
+    d="M913.885867 526.813867h-109.431467a31.9488 31.9488 0 0 0-31.675733 31.675733c0 17.271467 14.404267 31.675733 31.675733 31.675733h109.431467c17.339733 0 31.744-14.336 31.744-31.675733a31.607467 31.607467 0 0 0-31.744-31.675733z m2.935466 167.048533h-115.234133a28.535467 28.535467 0 0 0-28.808533 28.808533v5.7344c0 16.1792 12.6976 28.808533 28.808533 28.808534h115.234133a28.535467 28.535467 0 0 0 28.808534-28.808534v-5.7344a28.8768 28.8768 0 0 0-28.808534-28.808533zM504.968533 567.159467a28.535467 28.535467 0 0 0-28.808533 28.808533v5.7344c0 16.110933 12.6976 28.808533 28.808533 28.808533h86.357334a28.535467 28.535467 0 0 0 28.808533-28.808533V595.968a28.535467 28.535467 0 0 0-28.740267-28.808533H504.900267z m-100.829866 0H317.781333a28.535467 28.535467 0 0 0-28.808533 28.808533v5.7344c0 16.110933 12.629333 28.808533 28.808533 28.808533H404.138667a28.535467 28.535467 0 0 0 28.808533-28.808533V595.968a28.8768 28.8768 0 0 0-28.808533-28.808533z m188.962133-175.7184H506.6752A28.535467 28.535467 0 0 0 477.866667 420.2496v5.802667c0 16.110933 12.6976 28.740267 28.808533 28.740266h86.4256a28.535467 28.535467 0 0 0 28.808533-28.740266v-5.802667a28.535467 28.535467 0 0 0-28.808533-28.808533z m-187.1872 0H319.488a28.535467 28.535467 0 0 0-28.808533 28.808533v5.802667c0 16.110933 12.6976 28.740267 28.808533 28.740266h86.4256a28.535467 28.535467 0 0 0 28.740267-28.740266v-5.802667a28.8768 28.8768 0 0 0-28.740267-28.808533z m187.1872-175.650134H506.6752A28.535467 28.535467 0 0 0 477.866667 244.599467v5.7344c0 16.110933 12.6976 28.808533 28.808533 28.808533h86.4256a28.535467 28.535467 0 0 0 28.808533-28.808533v-5.7344a28.535467 28.535467 0 0 0-28.808533-28.808534z m-187.1872 0H319.488a28.535467 28.535467 0 0 0-28.808533 28.808534v5.7344c0 16.110933 12.6976 28.808533 28.808533 28.808533h86.4256a28.535467 28.535467 0 0 0 28.740267-28.808533v-5.7344a28.8768 28.8768 0 0 0-28.740267-28.808534z"
+    fill="currentColor" p-id="7801"></path>
+</svg>

Diff do ficheiro suprimidas por serem muito extensas
+ 5 - 0
src/icons/svg/setting.svg


+ 1 - 0
src/icons/svg/user.svg

@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747294285308" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8809" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M536.064 550.912c51.2-37.888 84.48-98.816 84.48-167.424 0-114.688-93.184-207.872-207.872-207.872C297.984 175.616 204.8 268.8 204.8 383.488c0 68.608 33.28 129.536 84.48 167.424-130.048 49.664-222.72 175.616-222.72 323.584h69.12c0-153.088 123.904-276.992 276.992-276.992 153.088 0 276.992 123.904 276.992 276.992h69.12c0.512-147.968-92.16-273.92-222.72-323.584z m-111.616-22.528h-23.552C326.144 522.24 267.264 459.776 267.264 383.488c0-80.384 65.024-145.408 145.408-145.408S558.08 303.104 558.08 383.488c0 76.288-58.88 138.752-133.632 144.896z" p-id="8810"></path><path d="M734.208 524.8c51.2-37.888 84.48-98.816 84.48-167.424 0-114.688-93.184-207.872-207.872-207.872v62.464c80.384 0 145.408 65.024 145.408 145.408 0 76.288-58.88 139.264-133.632 144.896h-11.776v69.12c153.088 0 276.992 123.904 276.992 276.992H957.44c0-147.968-92.672-273.92-223.232-323.584z" p-id="8811"></path></svg>

+ 3 - 3
src/layouts/default/header/index.vue

@@ -78,14 +78,14 @@ export default {
     if (userType === 'ORG_MANAGER') {
       this.projectList = [
         { key: 'project_manage', name: '项目管理' },
-        { key: 'user_project', name: '用户管理' },
+        { key: 'user_manage_org', name: '用户管理' },
         { key: 'personal_center', name: '个人中心' },
       ];
     } else if (userType === 'ADMIN') {
       this.projectList = [
         { key: 'org_manage', name: '机构管理' },
-        { key: 'user_project', name: '用户管理' },
-        { key: 'personal_center', name: '系统配置' },
+        { key: 'user_manage', name: '用户管理' },
+        { key: 'system_config', name: '系统配置' },
       ];
     }
   },

+ 56 - 1
src/router/modules/basic.js

@@ -48,7 +48,7 @@ export const OrgManagePage = {
   redirect: '/org_manage',
   meta: {
     title: '机构管理',
-    icon: 'practice',
+    icon: 'org',
   },
   children: [
     {
@@ -58,3 +58,58 @@ export const OrgManagePage = {
     },
   ],
 }
+
+// 内置管理员用户管理
+export const UserManagePage = {
+  path: '/user_manage',
+  component: DEFAULT,
+  redirect: '/user_manage',
+  meta: {
+    title: '用户管理',
+    icon: 'user',
+  },
+  children: [
+    {
+      path: '/user_manage',
+      name: 'UserManage',
+      component: () => import('@/views/user_manage'),
+    },
+  ],
+}
+
+
+// 内置管理员系统管理
+export const SystemConfigPage = {
+  path: '/system_config',
+  component: DEFAULT,
+  redirect: '/system_config',
+  meta: {
+    title: '系统管理',
+    icon: 'setting',
+  },
+  children: [
+    {
+      path: '/system_config',
+      name: 'SystemConfig',
+      component: () => import('@/views/system_config'),
+    },
+  ],
+}
+
+// 机构管理员用户管理
+export const UserManageOrgPage = {
+  path: '/user_manage_org',
+  component: DEFAULT,
+  redirect: '/user_manage_org',
+  meta: {
+    title: '用户管理',
+    icon: 'user',
+  },
+  children: [
+    {
+      path: '/user_manage_org',
+      name: 'UserManageOrg',
+      component: () => import('@/views/user_manage_org'),
+    },
+  ],
+}

+ 3 - 1
src/router/modules/index.js

@@ -1,4 +1,4 @@
-import { homePage, loginPage, NotFoundPage, ImageChangePage, RegisterPage, OrgManagePage } from './basic';
+import { homePage, loginPage, NotFoundPage, ImageChangePage, RegisterPage, OrgManagePage, UserManagePage, SystemConfigPage } from './basic';
 import ProjectRouters from './project';
 import { createBookRouters } from './book';
 import CoursewareRouters from './courseware';
@@ -13,4 +13,6 @@ export const routes = [
   NotFoundPage,
   RegisterPage,
   OrgManagePage,
+  UserManagePage,
+  SystemConfigPage,
 ];

+ 4 - 4
src/views/org_manage/index.vue

@@ -1,6 +1,6 @@
 <template>
-  <div class="project">
-    <div class="project-list">
+  <div class="org-manage">
+    <div class="org-manage-list">
       <el-button class="add-btn" type="primary" size="small" icon="el-icon-plus" @click="updateOrg('')"
         >创建机构</el-button
       >
@@ -61,7 +61,7 @@ import { queryOrgList } from '@/api/list.js';
 import { createOrg } from '@/api/org.js';
 
 export default {
-  name: 'ProjectPage',
+  name: 'OrgManage',
   components: {
     PaginationPage,
   },
@@ -160,7 +160,7 @@ export default {
 <style lang="scss" scoped>
 @use '@/styles/mixin.scss' as *;
 
-.project {
+.org-manage {
   @include page-base;
 
   .add-btn {

+ 21 - 0
src/views/system_config/index.vue

@@ -0,0 +1,21 @@
+<template>
+  <div class="system_config"></div>
+</template>
+
+<script>
+export default {
+  name: 'SystemConfig',
+  data() {
+    return {};
+  },
+  methods: {},
+};
+</script>
+
+<style lang="scss" scoped>
+@use '@/styles/mixin.scss' as *;
+
+.system_config {
+  @include page-base;
+}
+</style>

+ 143 - 0
src/views/user_manage/index.vue

@@ -0,0 +1,143 @@
+<template>
+  <div class="user-manage">
+    <div class="user-manage-list">
+      <el-form ref="registerForm" :model="form" :rules="rules" inline>
+        <el-form-item prop="org_id" label="机构">
+          <el-select v-model="org_id_list" filterable multiple collapse-tags>
+            <el-option v-for="item in institutionList" :key="item.id" :value="item.id" :label="item.name"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item>
+          <el-button type="primary" @click="queryList">搜索</el-button>
+        </el-form-item>
+      </el-form>
+      <el-table :data="list">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="60"
+          align="center"
+          :index="(cur_page - 1) * page_capacity + 1"
+        />
+        <el-table-column prop="user_name" label="真实姓名" align="center" />
+        <el-table-column prop="real_name" label="用户名" align="center" />
+        <el-table-column prop="email" label="邮箱" align="center" width="170" />
+        <el-table-column prop="org_name" label="所属机构" align="center" />
+        <el-table-column prop="is_org_manager" label="机构管理员" align="center">
+          <template slot-scope="{ row }">
+            <i class="el-icon-check" v-if="row.is_org_manager === 'true'"></i>
+          </template>
+        </el-table-column>
+        <el-table-column prop="register_time" label="注册时间" align="center" width="170" />
+        <el-table-column prop="is_audited" label="已审核" align="center"
+          ><template slot-scope="{ row }">
+            <i class="el-icon-check" v-if="row.is_audited === 'true'"></i>
+          </template>
+        </el-table-column>
+        <el-table-column prop="audit_time" label="审核时间" align="center" width="170" />
+
+        <el-table-column prop="operation" label="操作" fixed="right" width="200" align="center">
+          <template slot-scope="{ row }">
+            <span class="link" @click="setOrgManager(row)">{{
+              row.is_org_manager === 'true' ? '取消机构管理员' : '设置机构管理员'
+            }}</span>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <PaginationPage ref="pagination" :total="total" @getList="queryUserList" />
+    </div>
+  </div>
+</template>
+
+<script>
+import PaginationPage from '@/components/PaginationPage.vue';
+
+import { queryUserList } from '@/api/list.js';
+import { setUserToOrgManager } from '@/api/org.js';
+import { orgIndexList } from '@/api/user';
+
+export default {
+  name: 'UserManage',
+  components: {
+    PaginationPage,
+  },
+  data() {
+    return {
+      list: [],
+      total: 0,
+      page_capacity: 10,
+      cur_page: 1,
+      org_id_list: [],
+      institutionList: [],
+    };
+  },
+  methods: {
+    queryUserList(data) {
+      let datas = {
+        page_capacity: data.page_capacity,
+        cur_page: data.cur_page,
+        org_id_list: this.org_id_list,
+      };
+      queryUserList(datas).then(({ total_count, user_list }) => {
+        this.total = total_count;
+        this.list = user_list;
+        this.page_capacity = data.page_capacity;
+        this.cur_page = data.cur_page;
+      });
+    },
+    // 设置机构管理员
+    setOrgManager(row) {
+      let data = {
+        user_id: row.id,
+        is_org_manager: row.is_org_manager === 'true' ? 'false' : 'true',
+      };
+      setUserToOrgManager(data).then((res) => {
+        if (res.status === 1) {
+          this.queryUserList({ cur_page: this.cur_page, page_capacity: this.page_capacity });
+          this.$message({
+            type: 'success',
+            message: '操作成功!',
+          });
+        }
+      });
+    },
+    // 获取机构列表
+    getinstitutionList() {
+      let data = {
+        page_capacity: 10000,
+        cur_page: 1,
+      };
+      orgIndexList(data).then((res) => {
+        if (res.status === 1) {
+          this.institutionList = res.org_list;
+        }
+      });
+    },
+    queryList() {
+      this.queryUserList({ cur_page: 1, page_capacity: this.page_capacity });
+    },
+  },
+  created() {
+    this.getinstitutionList();
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+@use '@/styles/mixin.scss' as *;
+
+.user-manage {
+  @include page-base;
+
+  &-list {
+    display: flex;
+    flex: 1;
+    flex-direction: column;
+
+    .el-table {
+      flex: 1;
+    }
+  }
+}
+</style>

+ 181 - 0
src/views/user_manage_org/index.vue

@@ -0,0 +1,181 @@
+<template>
+  <div class="project">
+    <div class="project-list">
+      <el-button class="add-btn" type="primary" size="small" icon="el-icon-plus" @click="updateOrg('')"
+        >创建机构</el-button
+      >
+      <el-table :data="list">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="60"
+          align="center"
+          :index="(cur_page - 1) * page_capacity + 1"
+        />
+        <el-table-column prop="name" label="名称" align="center" />
+        <el-table-column prop="user_count" label="注册用户数" align="center" />
+        <el-table-column prop="user_count_audited" label="已审核用户数" align="center" />
+        <el-table-column prop="member_name_desc" label="机构管理员" align="center" />
+        <el-table-column prop="create_time" label="创建时间" align="center" />
+
+        <el-table-column prop="operation" label="操作" fixed="right" width="200" align="center">
+          <template slot-scope="{ row }">
+            <span class="link" @click="updateOrg(row)">修改</span>
+            <span class="link" @click="setOrgManager(row.id)">设置机构管理员</span>
+            <span class="link danger" @click="deleteOrg(row.id)">删除</span>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <PaginationPage ref="pagination" :total="total" @getList="queryOrgList" />
+    </div>
+    <el-dialog
+      :visible.sync="orgAddFlag"
+      width="300px"
+      append-to-body
+      :show-close="true"
+      :title="org_Info.name ? '编辑机构' : '创建机构'"
+    >
+      <el-form ref="formDialog" :model="org_Info" :rules="rules" inline>
+        <el-form-item class="label-input" label="名称" prop="name">
+          <el-input
+            v-model="org_Info.name"
+            autocomplete="off"
+            name="name"
+            @blur="org_Info.name = org_Info.name.trim()"
+          />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="orgAddFlag = false">取 消</el-button>
+        <el-button :loading="loading" type="primary" @click="submitOrg">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import PaginationPage from '@/components/PaginationPage.vue';
+
+import { queryOrgList } from '@/api/list.js';
+import { createOrg } from '@/api/org.js';
+
+export default {
+  name: 'UserManageOrg',
+  components: {
+    PaginationPage,
+  },
+  data() {
+    return {
+      list: [],
+      total: 0,
+      page_capacity: 10,
+      cur_page: 1,
+      org_Info: {
+        name: '',
+      },
+      orgAddFlag: false,
+      rules: {
+        name: [{ required: true, trigger: 'blur', message: '请输入名称' }],
+      },
+      loading: false,
+    };
+  },
+  methods: {
+    queryOrgList(data) {
+      queryOrgList(data).then(({ total_count, org_list }) => {
+        this.total = total_count;
+        this.list = org_list;
+        this.page_capacity = data.page_capacity;
+        this.cur_page = data.cur_page;
+      });
+    },
+    /**
+     * 修改机构
+     * @param {string} id - 项目ID
+     */
+    updateOrg(row) {
+      if (row) {
+        this.org_Info = {
+          name: row.name,
+        };
+      } else {
+        this.org_Info = {
+          name: '',
+        };
+      }
+      this.orgAddFlag = true;
+    },
+    // 设置机构管理员
+    setOrgManager(id) {},
+    // 删除机构
+    deleteOrg(id) {
+      let _this = this;
+      _this
+        .$confirm('确定要删除此机构吗?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning',
+        })
+        .then(function () {
+          // transferFilesDelete({ id: id }).then((res) => {
+          //   if (res.status === 1) {
+          _this.queryOrgList({ cur_page: _this.cur_page, page_capacity: _this.page_capacity });
+          _this.$message({
+            type: 'success',
+            message: '删除成功!',
+          });
+          // }
+          // });
+        })
+        .catch(() => {});
+    },
+    // 新增、编辑机构
+    submitOrg() {
+      const _this = this;
+      _this.$refs.formDialog.validate((valid) => {
+        if (valid) {
+          this.loading = true;
+          createOrg(_this.org_Info)
+            .then((res) => {
+              if (res.status === 1) {
+                this.loading = false;
+                _this.queryOrgList({ cur_page: _this.cur_page, page_capacity: _this.page_capacity });
+                _this.$message({
+                  type: 'success',
+                  message: '创建成功!',
+                });
+              }
+            })
+            .catch(() => {
+              this.loading = false;
+            });
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+@use '@/styles/mixin.scss' as *;
+
+.project {
+  @include page-base;
+
+  .add-btn {
+    width: 120px;
+    margin-bottom: 20px;
+  }
+
+  &-list {
+    display: flex;
+    flex: 1;
+    flex-direction: column;
+
+    .el-table {
+      flex: 1;
+    }
+  }
+}
+</style>

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff