|
@@ -8,20 +8,25 @@
|
|
|
:page-size="page_capacity"
|
|
|
:total="total_count"
|
|
|
:current-page="cur_page"
|
|
|
- @prev-click="changePage"
|
|
|
- @next-click="changePage"
|
|
|
- @current-change="changePage"
|
|
|
- @size-change="changePageSize"
|
|
|
+ @prev-click="changePage($event, queryOrgList)"
|
|
|
+ @next-click="changePage($event, queryOrgList)"
|
|
|
+ @current-change="changePage($event, queryOrgList)"
|
|
|
+ @size-change="changePageSize($event, queryOrgList)"
|
|
|
>
|
|
|
<template #button>
|
|
|
<el-button icon="el-icon-plus" @click="$router.push('/add_org')">创建机构</el-button>
|
|
|
</template>
|
|
|
|
|
|
- <el-table :data="org_list">
|
|
|
+ <el-table :data="list">
|
|
|
<el-table-column prop="name" label="名称" width="240" />
|
|
|
<el-table-column prop="teacher_count" label="注册教师人数" width="110" />
|
|
|
<el-table-column prop="teacher_count_audited" label="审核通过的注册教师人数" width="180" />
|
|
|
<el-table-column prop="admin_user_name" label="机构管理员" />
|
|
|
+ <el-table-column fixed="right" width="100">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <a @click="$router.push({ path: `/free_license/${row.id}` })">教材授权</a>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column fixed="right" width="70">
|
|
|
<template slot-scope="{ row }">
|
|
|
<a @click="showOrg(row.id)">查看</a>
|
|
@@ -58,101 +63,91 @@
|
|
|
</el-table>
|
|
|
</CommonTable>
|
|
|
|
|
|
- <reset-password ref="reset" :user-id="curUserId" />
|
|
|
- <show-org ref="showOrg" :org-id="curOrgId" />
|
|
|
- <update-org ref="updateOrg" :org-id="curOrgId" @refresh="queryOrgList" />
|
|
|
+ <ResetPassword ref="reset" :user-id="curUserId" />
|
|
|
+ <ShowOrg ref="show_org" :org-id="curOrgId" />
|
|
|
+ <UpdateOrg ref="update_org" :org-id="curOrgId" @refresh="queryOrgList" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+export default {
|
|
|
+ name: 'OrgManager'
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { ref } from 'vue';
|
|
|
+import { pageQueryOrgList } from '@/api/list';
|
|
|
+import { GetDistributablePopedomList_OrgManager, SetDistributablePopedom_OrgManager } from '@/api/org';
|
|
|
+import { useList } from '@/utils/list';
|
|
|
+import { Message } from 'element-ui';
|
|
|
+
|
|
|
import ResetPassword from '@/components/ResetPassword.vue';
|
|
|
import ShowOrg from './ShowOrg.vue';
|
|
|
import UpdateOrg from './UpdateOrg.vue';
|
|
|
import CommonTable from '@/components/common/CommonTable.vue';
|
|
|
-import { pageQueryOrgList } from '@/api/list';
|
|
|
-import { GetDistributablePopedomList_OrgManager, SetDistributablePopedom_OrgManager } from '@/api/org';
|
|
|
|
|
|
-export default {
|
|
|
- name: 'OrgManager',
|
|
|
- components: {
|
|
|
- ResetPassword,
|
|
|
- ShowOrg,
|
|
|
- UpdateOrg,
|
|
|
- CommonTable
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- search: '',
|
|
|
- page_capacity: 10,
|
|
|
- cur_page: 1,
|
|
|
- org_list: [],
|
|
|
- total_count: 0,
|
|
|
- curUserId: '',
|
|
|
- curOrgId: '',
|
|
|
- // 权限列表
|
|
|
- popedom_list: []
|
|
|
- };
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.queryOrgList();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- changePage(newPage) {
|
|
|
- this.cur_page = newPage;
|
|
|
- this.queryOrgList();
|
|
|
- },
|
|
|
- changePageSize(pageSize) {
|
|
|
- this.page_capacity = pageSize;
|
|
|
- this.queryOrgList();
|
|
|
- },
|
|
|
- queryOrgList() {
|
|
|
- pageQueryOrgList({
|
|
|
- name: this.search,
|
|
|
- page_capacity: this.page_capacity,
|
|
|
- cur_page: this.cur_page
|
|
|
- }).then(({ cur_page, org_list, total_count }) => {
|
|
|
- this.cur_page = cur_page;
|
|
|
- this.org_list = org_list;
|
|
|
- this.total_count = total_count;
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- showOrg(id) {
|
|
|
- this.curOrgId = id;
|
|
|
- this.$refs.showOrg.show();
|
|
|
- },
|
|
|
-
|
|
|
- updateOrg(id) {
|
|
|
- this.curOrgId = id;
|
|
|
- this.$refs.updateOrg.show();
|
|
|
- },
|
|
|
-
|
|
|
- getDistributablePopedomList_OrgManager(org_id) {
|
|
|
- GetDistributablePopedomList_OrgManager({ org_id }).then(({ popedom_list }) => {
|
|
|
- popedom_list.forEach((el, i, arr) => {
|
|
|
- el.is_selected = el.is_selected === 'true';
|
|
|
- arr[i] = el;
|
|
|
- });
|
|
|
- this.popedom_list = popedom_list;
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- setDistributablePopedom_OrgManager(org_id) {
|
|
|
- let popedom_code_list = [];
|
|
|
- this.popedom_list.forEach(({ popedom_code, is_selected }) => {
|
|
|
- if (is_selected) popedom_code_list.push(popedom_code);
|
|
|
- });
|
|
|
- SetDistributablePopedom_OrgManager({ org_id, popedom_code_list }).then(() => {
|
|
|
- this.$message.success('为机构管理员设置可分配的权限成功');
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- resetOrgAdminPassword(id) {
|
|
|
- this.curUserId = id;
|
|
|
- this.$refs.reset.show();
|
|
|
- }
|
|
|
- }
|
|
|
-};
|
|
|
+let reset = ref();
|
|
|
+let show_org = ref();
|
|
|
+let update_org = ref();
|
|
|
+
|
|
|
+let search = ref(''); // 名称
|
|
|
+let curUserId = ref(''); // 当前用户id
|
|
|
+let curOrgId = ref(''); // 当前机构id
|
|
|
+let popedom_list = ref(''); // 权限列表
|
|
|
+
|
|
|
+const { page_capacity, cur_page, total_count, list, changePage, changePageSize } = useList();
|
|
|
+
|
|
|
+function queryOrgList() {
|
|
|
+ pageQueryOrgList({
|
|
|
+ name: search.value,
|
|
|
+ page_capacity: page_capacity.value,
|
|
|
+ cur_page: cur_page.value
|
|
|
+ }).then(({ cur_page: page, org_list, total_count: total }) => {
|
|
|
+ cur_page.value = page;
|
|
|
+ list.value = org_list;
|
|
|
+ total_count.value = total;
|
|
|
+ });
|
|
|
+}
|
|
|
+queryOrgList();
|
|
|
+
|
|
|
+function showOrg(id) {
|
|
|
+ curOrgId.value = id;
|
|
|
+ show_org.value.show();
|
|
|
+}
|
|
|
+
|
|
|
+function updateOrg(id) {
|
|
|
+ curOrgId = id;
|
|
|
+ update_org.value.show();
|
|
|
+}
|
|
|
+
|
|
|
+// 得到机构管理员可分配的权限列表
|
|
|
+function getDistributablePopedomList_OrgManager(org_id) {
|
|
|
+ GetDistributablePopedomList_OrgManager({ org_id }).then(({ popedom_list: list }) => {
|
|
|
+ list.forEach((el, i, arr) => {
|
|
|
+ el.is_selected = el.is_selected === 'true';
|
|
|
+ arr[i] = el;
|
|
|
+ });
|
|
|
+ popedom_list.value = list;
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 为机构管理员设置可分配的权限
|
|
|
+function setDistributablePopedom_OrgManager(org_id) {
|
|
|
+ let popedom_code_list = [];
|
|
|
+ popedom_list.value.forEach(({ popedom_code, is_selected }) => {
|
|
|
+ if (is_selected) popedom_code_list.push(popedom_code);
|
|
|
+ });
|
|
|
+ SetDistributablePopedom_OrgManager({ org_id, popedom_code_list }).then(() => {
|
|
|
+ Message.success('为机构管理员设置可分配的权限成功');
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 重置管理员机构密码
|
|
|
+function resetOrgAdminPassword(id) {
|
|
|
+ curUserId.value = id;
|
|
|
+ reset.value.show();
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scope>
|