用户支持分组,wiki空间支持按分组授权,细节优化

This commit is contained in:
暮光:城中城
2021-02-09 22:57:52 +08:00
parent 13d6f3ca8b
commit a153809649
111 changed files with 2760 additions and 338 deletions

View File

@@ -919,6 +919,15 @@
"@hapi/hoek": "^8.3.0"
}
},
"@icon-park/vue": {
"version": "1.2.6",
"resolved": "https://registry.npm.taobao.org/@icon-park/vue/download/@icon-park/vue-1.2.6.tgz",
"integrity": "sha1-bAV9BAa3JVYvIIXmlHvLXKBMHO0=",
"requires": {
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
"csstype": "^3.0.3"
}
},
"@intervolga/optimize-cssnano-plugin": {
"version": "1.0.6",
"resolved": "http://registry.npm.taobao.org/@intervolga/optimize-cssnano-plugin/download/@intervolga/optimize-cssnano-plugin-1.0.6.tgz",
@@ -1049,8 +1058,7 @@
"@vue/babel-helper-vue-jsx-merge-props": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/@vue/babel-helper-vue-jsx-merge-props/download/@vue/babel-helper-vue-jsx-merge-props-1.0.0.tgz",
"integrity": "sha1-BI/leZWNpAj7eosqPsBQtQpmEEA=",
"dev": true
"integrity": "sha1-BI/leZWNpAj7eosqPsBQtQpmEEA="
},
"@vue/babel-plugin-transform-vue-jsx": {
"version": "1.1.2",
@@ -1971,6 +1979,14 @@
"integrity": "sha1-3TeelPDbgxCwgpH51kwyCXZmF/0=",
"dev": true
},
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npm.taobao.org/async-validator/download/async-validator-1.8.5.tgz?cache=0&sync_timestamp=1605749896979&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fasync-validator%2Fdownload%2Fasync-validator-1.8.5.tgz",
"integrity": "sha1-3D4I7B/Q3dtn5ghC8CwM0c7G1/A=",
"requires": {
"babel-runtime": "6.x"
}
},
"asynckit": {
"version": "0.4.0",
"resolved": "http://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz",
@@ -2057,7 +2073,7 @@
},
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "http://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"resolved": "https://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha1-Iq69OzOQIyjlEyk6jkmSs4T58bY="
},
"babel-loader": {
@@ -2096,7 +2112,7 @@
},
"babel-runtime": {
"version": "6.26.0",
"resolved": "http://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz",
"resolved": "https://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"requires": {
"core-js": "^2.4.0",
@@ -2104,9 +2120,9 @@
},
"dependencies": {
"core-js": {
"version": "2.6.10",
"resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.10.tgz?cache=0&sync_timestamp=1573985371469&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-2.6.10.tgz",
"integrity": "sha1-iluDkfjMcBPacDQRzltYVwYwDX8="
"version": "2.6.12",
"resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.12.tgz?cache=0&sync_timestamp=1611038902573&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-2.6.12.tgz",
"integrity": "sha1-2TM9+nsGXjR8xWgiGdb2kIWcwuw="
},
"regenerator-runtime": {
"version": "0.11.1",
@@ -3580,6 +3596,11 @@
"css-tree": "1.0.0-alpha.37"
}
},
"csstype": {
"version": "3.0.6",
"resolved": "https://registry.npm.taobao.org/csstype/download/csstype-3.0.6.tgz?cache=0&sync_timestamp=1610107098407&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcsstype%2Fdownload%2Fcsstype-3.0.6.tgz",
"integrity": "sha1-hl0LWDPX2NQPTluKbXauo95HJe8="
},
"current-script-polyfill": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/current-script-polyfill/download/current-script-polyfill-1.0.0.tgz",
@@ -4110,9 +4131,9 @@
"dev": true
},
"element-ui": {
"version": "2.13.1",
"resolved": "https://registry.npm.taobao.org/element-ui/download/element-ui-2.13.1.tgz?cache=0&sync_timestamp=1586761028754&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felement-ui%2Fdownload%2Felement-ui-2.13.1.tgz",
"integrity": "sha1-DLGkXPJ6phxgHe++GSdArFy533w=",
"version": "2.15.0",
"resolved": "https://registry.npm.taobao.org/element-ui/download/element-ui-2.15.0.tgz?cache=0&sync_timestamp=1610713839122&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felement-ui%2Fdownload%2Felement-ui-2.15.0.tgz",
"integrity": "sha1-3ptzqNHj47UOgrkjpfqVKVI5vUE=",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
@@ -4120,16 +4141,6 @@
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.0",
"throttle-debounce": "^1.0.1"
},
"dependencies": {
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npm.taobao.org/async-validator/download/async-validator-1.8.5.tgz",
"integrity": "sha1-3D4I7B/Q3dtn5ghC8CwM0c7G1/A=",
"requires": {
"babel-runtime": "6.x"
}
}
}
},
"elliptic": {
@@ -7497,7 +7508,7 @@
},
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnormalize-wheel%2Fdownload%2Fnormalize-wheel-1.0.1.tgz",
"resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz",
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
},
"npm-run-path": {

View File

@@ -7,18 +7,19 @@
"build": "vue-cli-service build --mode production"
},
"dependencies": {
"@icon-park/vue": "^1.2.6",
"axios": "^0.19.0",
"core-js": "^3.3.2",
"echarts": "^4.5.0",
"element-ui": "^2.15.0",
"js-cookie": "^2.2.1",
"pouchdb": "^7.1.1",
"sql-formatter": "^2.3.3",
"vue": "^2.6.10",
"vue-axios": "^2.1.5",
"vue-hljs": "^1.1.2",
"vue-router": "^3.1.3",
"vuex": "^3.1.2",
"element-ui": "^2.10.0",
"sql-formatter": "^2.3.3",
"wangeditor": "^3.1.1"
},
"devDependencies": {

View File

@@ -5,7 +5,7 @@
</template>
<el-container v-else>
<el-aside>
<div style="padding: 10px;height: 100%;box-sizing: border-box;background: #fafafa;">
<div class="menu-box">
<el-menu default-active="1-4-1" :router="true" class="el-menu-vertical" @open="handleOpen" @close="handleClose" :collapse="isCollapse">
<el-menu-item index="/"><i class="el-icon-s-home"></i>控制台</el-menu-item>
<el-submenu index="1" v-if="userAuth.userManage">
@@ -13,9 +13,14 @@
<i class="el-icon-s-platform"></i>
<span slot="title">系统管理</span>
</template>
<el-menu-item index="/console/userList"><i class="el-icon-user-solid"></i>用户管理</el-menu-item>
<!-- <el-menu-item index="/console/roleList"><i class="el-icon-s-custom"></i>角色管理</el-menu-item>-->
<!-- <el-menu-item index="/console/authList"><i class="el-icon-s-claim"></i>权限列表</el-menu-item>-->
<el-menu-item index="/console/userList">
<people theme="filled" size="16" fill="#909399"></people>
<span>用户管理</span>
</el-menu-item>
<el-menu-item index="/console/userGroupList">
<peoples theme="filled" size="16" fill="#909399"></peoples>
<span>分组管理</span>
</el-menu-item>
</el-submenu>
</el-menu>
</div>
@@ -65,6 +70,7 @@
<script>
import consoleApi from './common/api/console'
import {Peoples, People} from '@icon-park/vue';
export default {
data() {
@@ -79,6 +85,10 @@
upgradeInfo: {},
}
},
components: {
"peoples": Peoples,
"people": People,
},
computed: {
fullscreen () {
return this.$store.state.global.fullscreen;
@@ -158,4 +168,7 @@
.el-menu-vertical{border-right: 0;background: #fafafa;}
.el-menu-vertical .el-menu{background: #fafafa;}
.el-header {background-color: #409EFF; color: #333; line-height: 40px; text-align: right;height: 40px !important;}
.menu-box{padding: 10px;height: 100%;box-sizing: border-box;background: #fafafa;}
.menu-box .i-icon{line-height: 1;margin-right: 5px;}
</style>

View File

@@ -19,6 +19,9 @@ export default {
},
getUserInfoList: data => {
return request({url: '/user/info/list', method: 'post', data: Qs.stringify(data)});
},
searchUserInfoList: data => {
return request({url: '/user/info/search', method: 'post', data: Qs.stringify(data)});
},
updateUserInfo: data => {
return request({url: '/user/info/update', method: 'post', data: Qs.stringify(data)});
@@ -35,4 +38,22 @@ export default {
resetPassword: data => {
return request({url: '/user/info/resetPassword', method: 'post', data: Qs.stringify(data)});
},
userGroupList: data => {
return request({url: '/user/group/list', method: 'post', data: Qs.stringify(data)});
},
updateUserGroup: data => {
return request({url: '/user/group/update', method: 'post', data: Qs.stringify(data)});
},
deleteUserGroup: data => {
return request({url: '/user/group/delete', method: 'post', data: Qs.stringify(data)});
},
updateUserGroupRelation: data => {
return request({url: '/user/group/relation/update', method: 'post', data: Qs.stringify(data)});
},
removeUserGroupRelation: data => {
return request({url: '/user/group/relation/remove', method: 'post', data: Qs.stringify(data)});
},
userGroupRelationList: data => {
return request({url: '/user/group/relation/list', method: 'post', data: Qs.stringify(data)});
},
};

View File

@@ -29,6 +29,7 @@ let routes = [
{path: 'userList', name: '用户管理', component: () => import('@/views/console/UserList.vue')},
{path: 'roleList', name: '权限管理', component: () => import('@/views/console/AuthList.vue')},
{path: 'authList', name: '角色列表', component: () => import('@/views/console/RoleList.vue')},
{path: 'userGroupList', name: '分组管理', component: () => import('@/views/console/UserGroupList.vue')},
]
}, {
path: '/common',

View File

@@ -0,0 +1,217 @@
<template>
<div class="user-group-vue">
<el-breadcrumb separator-class="el-icon-arrow-right" style="padding: 20px 10px;">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>系统管理</el-breadcrumb-item>
<el-breadcrumb-item>分组管理</el-breadcrumb-item>
</el-breadcrumb>
<el-row>
<el-col :span="6">
<div class="group-box page-scroll-box">
<el-popover placement="bottom" width="300" trigger="click" v-model="createUserGroupVisible">
<el-tag slot="reference" class="group-item" @click="">
<div style="text-align: center;"><i class="el-icon-plus"></i> 创建分组</div>
</el-tag>
<div>
<el-input v-model="editGroupName" placeholder="请输入新的分组名称" style="width: 220px;margin-right: 10px;"></el-input>
<el-button plain type="primary" v-on:click="createUserGroup">创建</el-button>
</div>
</el-popover>
<el-tag :type="item.id==checkedUserGroupId?'warning':'info'" class="group-item" @click="loadUserGroupRelation(item.id)" @dblclick.native="item.edit = true" v-for="item in userGroupList">
<el-input v-if="item.edit" size="mini" v-model="item.editName" @keyup.enter.native="updateUserGroup(item)" @blur="updateUserGroup(item)" class="group-name-input">{{item.name}}</el-input>
<span v-else>{{item.name}}</span>
<el-popconfirm title="确定要删除此分组吗?" @confirm="removeUserGroup(item.id)">
<i slot="reference" class="el-tag__close el-icon-close"></i>
</el-popconfirm>
</el-tag>
</div>
</el-col>
<el-col :span="18">
<div v-if="checkedUserGroupId > 0" class="page-scroll-box" v-loading="searchLoading">
<div style="margin-bottom: 10px;">
<el-button size="mini" plain type="primary" @click="showChoiceUserDialog" icon="el-icon-plus">添加用户</el-button>
</div>
<el-table :data="userGroupRelationList" border style="width: 100%; margin-bottom: 5px;" :max-height="tableHeight">
<el-table-column prop="id" label="编号" width="60"></el-table-column>
<el-table-column prop="userNo" label="账号"></el-table-column>
<el-table-column prop="email" label="邮箱"></el-table-column>
<el-table-column prop="userName" label="用户名"></el-table-column>
<el-table-column prop="phone" label="手机号"></el-table-column>
<el-table-column label="性别">
<template slot-scope="scope">{{scope.row.sex==0?'女':'男'}}</template>
</el-table-column>
<el-table-column label="操作" width="300">
<template slot-scope="scope">
<el-button size="mini" plain type="danger" v-on:click="removeUserRelationFromList(scope.row.id)">移除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-col>
</el-row>
<!--添加用户到分组弹窗-->
<el-dialog title="添加用户到分组" :visible.sync="choiceUserVisible" width="600px" @close="closeChoiceUserDialog">
<el-row>
<el-select v-model="searchAddNewUser" filterable remote reserve-keyword autoComplete="new-password"
placeholder="请输入名字、邮箱、账号搜索用户" :remote-method="getSearchUserList"
:loading="searchUserLoading" style="width: 450px;margin-right: 10px;">
<el-option v-for="item in searchUserList" :key="item.id" :label="item.userName" :value="item.id"></el-option>
</el-select>
<el-button v-on:click="addSearchChoiceUser">添加</el-button>
</el-row>
<div style="margin: 10px 0;">
<el-tag v-for="item in searchAddUserList" :key="item.userId" closable type="info" style="margin-right: 10px;" @close="removeUserRelationFromSearch(item.userId)">
{{item.userName}}
</el-tag>
</div>
</el-dialog>
</div>
</template>
<script>
import consoleApi from '../../common/api/console'
export default {
data() {
return {
searchLoading: false,
editUserDialogVisible: false,
editUserAuthDialogVisible: false,
totalCount: 0,
searchParam: {
type: 1,
keyword: '',
},
searchResultList: [],
roleOptions: [
{value: '管理员'}
],
editUserForm: {},
allUserAuth: [],
editUserAuth: [],
userGroupRelationList: [],
userGroupList: [],
editGroupName: '',
checkedUserGroupId: '',
createUserGroupVisible: false,
choiceUserVisible: false,
// 添加用户
searchAddUserList: [],
searchUserList: [],
searchAddNewUser: "",
searchUserLoading: false,
tableHeight: (document.body.clientHeight - 250),
};
},
mounted() {
this.getUserGroupList();
},
methods: {
getUserGroupList() {
this.userGroupList = [];
consoleApi.userGroupList().then(json => {
let userGroupList = json.data || [];
userGroupList.forEach(item => {
item.edit = false;
item.checked = false;
item.editName = item.name;
});
this.userGroupList = userGroupList;
});
},
loadUserGroupRelation(groupId, force) {
if (!force && groupId == this.checkedUserGroupId) return;
this.checkedUserGroupId = groupId;
this.searchLoading = true;
consoleApi.userGroupRelationList({groupId: groupId}).then(json => {
this.searchLoading = false;
this.userGroupRelationList = json.data || [];
});
},
updateUserGroup(item) {
if (item.name == item.editName) {
item.edit = false;
return;
}
let param = {id: item.id, name: item.editName};
consoleApi.updateUserGroup(param).then(json => {
item.edit = false;
item.name = item.editName;
});
},
createUserGroup() {
let param = {name: this.editGroupName};
consoleApi.updateUserGroup(param).then(json => {
this.editGroupName = '';
this.createUserGroupVisible = false;
this.getUserGroupList();
});
},
removeUserGroup(id) {
consoleApi.deleteUserGroup({id: id}).then(json => {
this.checkedUserGroupId = '';
this.getUserGroupList();
});
},
closeChoiceUserDialog() {
this.loadUserGroupRelation(this.checkedUserGroupId, true);
},
showChoiceUserDialog() {
this.choiceUserVisible = true;
this.searchAddUserList = [];
this.userGroupRelationList.forEach(item => {
this.searchAddUserList.push({userName: item.userName, userId: item.id});
});
},
getSearchUserList(query) {
if (!query) return;
this.searchUserLoading = true;
consoleApi.searchUserInfoList({search: query}).then(json => {
this.searchUserList = json.data || [];
this.searchUserLoading = false;
});
},
removeUserRelationFromSearch(userId) {
let param = {groupId: this.checkedUserGroupId, userId: userId};
consoleApi.removeUserGroupRelation(param).then(json => {
this.searchAddUserList = this.searchAddUserList.filter(item => item.userId != userId);
});
},
removeUserRelationFromList(userId) {
let param = {groupId: this.checkedUserGroupId, userId: userId};
consoleApi.removeUserGroupRelation(param).then(json => {
this.loadUserGroupRelation(this.checkedUserGroupId, true);
});
},
addSearchChoiceUser() {
if (this.searchAddNewUser.length <= 0) {
this.$message.warning("请先选择用户");
return;
}
if (!!this.searchAddUserList.find(item => item.userId == this.searchAddNewUser)) {
this.searchAddNewUser = "";
return;
}
let userName = this.searchUserList.find(item => item.id == this.searchAddNewUser).userName;
let param = {groupId: this.checkedUserGroupId, userId: this.searchAddNewUser};
consoleApi.updateUserGroupRelation(param).then(json => {
this.searchAddUserList.push({userName: userName, userId: this.searchAddNewUser});
});
this.searchAddNewUser = "";
},
}
}
</script>
<style>
.user-group-vue .search-form-box{padding: 10px;}
.user-group-vue .page-info-box{text-align: right;margin: 20px 0 50px 0;}
.user-group-vue .el-button+.el-button{margin-left: 5px;}
.user-group-vue .page-scroll-box{padding: 10px;height: calc(100vh - 200px);overflow: auto;}
.user-group-vue .group-box .group-item{width: 100%;margin-bottom: 10px;cursor: pointer;}
.user-group-vue .group-box .group-item .el-icon-close{float: right; top: 6px;}
.user-group-vue .group-box .group-item .group-name-input{width: calc(100% - 30px);}
.user-group-vue .group-box .group-item .group-name-input input{border: 0;padding-left: 5px;}
</style>

View File

@@ -2,8 +2,8 @@
ENV = 'development'
# base api
VUE_APP_BASE_API = 'http://local.zyplayer.com:8083/zyplayer-doc-manage'
# VUE_APP_BASE_API = 'http://doc.zyplayer.com/zyplayer-doc-manage'
# VUE_APP_BASE_API = 'http://local.zyplayer.com:8083/zyplayer-doc-manage'
VUE_APP_BASE_API = 'http://doc.zyplayer.com/zyplayer-doc-manage'
VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@@ -37,7 +37,7 @@
<el-col :span="24">
<span class="label">表注释</span>
<span v-if="tableInfo.inEdit == 1">
<el-input v-model="tableInfo.newDesc" placeholder="输入表注释" @keyup.enter="saveTableDescription" v-on:blur="saveTableDescription" style="width: 500px;"></el-input>
<el-input v-model="tableInfo.newDesc" placeholder="输入表注释" @keyup.enter.native="saveTableDescription" v-on:blur="saveTableDescription" style="width: 500px;"></el-input>
</span>
<span v-else>{{tableInfo.description || '暂无注释'}} <i class="el-icon-edit edit-table-desc" v-on:click="tableInfo.inEdit = 1"></i></span>
</el-col>
@@ -68,7 +68,7 @@
<el-table-column label="注释">
<template slot-scope="scope">
<div v-if="scope.row.inEdit == 1">
<el-input v-model="scope.row.newDesc" placeholder="输入字段注释" @keyup.enter="saveColumnDescription(scope.row)" v-on:blur="saveColumnDescription(scope.row)"></el-input>
<el-input v-model="scope.row.newDesc" placeholder="输入字段注释" @keyup.enter.native="saveColumnDescription(scope.row)" v-on:blur="saveColumnDescription(scope.row)"></el-input>
</div>
<div v-else class="description" v-on:click="descBoxClick(scope.row)">{{scope.row.description}}</div>
</template>

View File

@@ -2,8 +2,8 @@
ENV = 'development'
# base api
# VUE_APP_BASE_API = 'http://local.zyplayer.com:8083/zyplayer-doc-manage'
VUE_APP_BASE_API = 'http://doc.zyplayer.com/zyplayer-doc-manage'
VUE_APP_BASE_API = 'http://local.zyplayer.com:8083/zyplayer-doc-manage'
# VUE_APP_BASE_API = 'http://doc.zyplayer.com/zyplayer-doc-manage'
VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@@ -1971,6 +1971,14 @@
"integrity": "sha1-3TeelPDbgxCwgpH51kwyCXZmF/0=",
"dev": true
},
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npm.taobao.org/async-validator/download/async-validator-1.8.5.tgz?cache=0&sync_timestamp=1605749896979&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fasync-validator%2Fdownload%2Fasync-validator-1.8.5.tgz",
"integrity": "sha1-3D4I7B/Q3dtn5ghC8CwM0c7G1/A=",
"requires": {
"babel-runtime": "6.x"
}
},
"asynckit": {
"version": "0.4.0",
"resolved": "http://registry.npm.taobao.org/asynckit/download/asynckit-0.4.0.tgz",
@@ -2057,7 +2065,7 @@
},
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "http://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"resolved": "https://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha1-Iq69OzOQIyjlEyk6jkmSs4T58bY="
},
"babel-loader": {
@@ -2096,7 +2104,7 @@
},
"babel-runtime": {
"version": "6.26.0",
"resolved": "http://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz",
"resolved": "https://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"requires": {
"core-js": "^2.4.0",
@@ -2104,9 +2112,9 @@
},
"dependencies": {
"core-js": {
"version": "2.6.10",
"resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.10.tgz?cache=0&sync_timestamp=1573985371469&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-2.6.10.tgz",
"integrity": "sha1-iluDkfjMcBPacDQRzltYVwYwDX8="
"version": "2.6.12",
"resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.12.tgz?cache=0&sync_timestamp=1611038902573&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-2.6.12.tgz",
"integrity": "sha1-2TM9+nsGXjR8xWgiGdb2kIWcwuw="
},
"regenerator-runtime": {
"version": "0.11.1",
@@ -4114,9 +4122,9 @@
"dev": true
},
"element-ui": {
"version": "2.13.1",
"resolved": "https://registry.npm.taobao.org/element-ui/download/element-ui-2.13.1.tgz?cache=0&sync_timestamp=1586761028754&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felement-ui%2Fdownload%2Felement-ui-2.13.1.tgz",
"integrity": "sha1-DLGkXPJ6phxgHe++GSdArFy533w=",
"version": "2.15.0",
"resolved": "https://registry.npm.taobao.org/element-ui/download/element-ui-2.15.0.tgz?cache=0&sync_timestamp=1610713839122&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Felement-ui%2Fdownload%2Felement-ui-2.15.0.tgz",
"integrity": "sha1-3ptzqNHj47UOgrkjpfqVKVI5vUE=",
"requires": {
"async-validator": "~1.8.1",
"babel-helper-vue-jsx-merge-props": "^2.0.0",
@@ -4124,16 +4132,6 @@
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.0",
"throttle-debounce": "^1.0.1"
},
"dependencies": {
"async-validator": {
"version": "1.8.5",
"resolved": "https://registry.npm.taobao.org/async-validator/download/async-validator-1.8.5.tgz",
"integrity": "sha1-3D4I7B/Q3dtn5ghC8CwM0c7G1/A=",
"requires": {
"babel-runtime": "6.x"
}
}
}
},
"elliptic": {
@@ -7521,7 +7519,7 @@
},
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnormalize-wheel%2Fdownload%2Fnormalize-wheel-1.0.1.tgz",
"resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz",
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
},
"npm-run-path": {

View File

@@ -10,7 +10,7 @@
"axios": "^0.19.0",
"core-js": "^3.3.2",
"echarts": "^4.5.0",
"element-ui": "^2.10.0",
"element-ui": "^2.15.0",
"jquery": "^3.5.1",
"js-cookie": "^2.2.1",
"mavon-editor": "^2.9.0",

View File

@@ -37,6 +37,21 @@ export default {
},
pageUnlock: data => {
return request({url: '/zyplayer-doc-wiki/page/unlock', method: 'post', data: Qs.stringify(data)});
},
spaceFavoriteUpdate: data => {
return request({url: '/zyplayer-doc-wiki/space/favorite/update', method: 'post', data: Qs.stringify(data)});
},
spaceAuthAssign: data => {
return request({url: '/zyplayer-doc-wiki/space/auth/assign', method: 'post', data: Qs.stringify(data)});
},
spaceAuthList: data => {
return request({url: '/zyplayer-doc-wiki/space/auth/list', method: 'post', data: Qs.stringify(data)});
},
spaceSettingList: data => {
return request({url: '/zyplayer-doc-wiki/space/setting/list', method: 'post', data: Qs.stringify(data)});
},
spaceSettingUpdate: data => {
return request({url: '/zyplayer-doc-wiki/space/setting/update', method: 'post', data: Qs.stringify(data)});
},
spaceList: data => {
return request({url: '/zyplayer-doc-wiki/space/list', method: 'post', data: Qs.stringify(data)});

View File

@@ -17,6 +17,9 @@ export default {
getUserBaseInfo: data => {
return request({url: '/zyplayer-doc-wiki/common/user/base', method: 'post', data: Qs.stringify(data)});
},
userGroupList: data => {
return request({url: '/user/group/list', method: 'post', data: Qs.stringify(data)});
},
getUserMessageList: data => {
return request({url: '/user/message/list', method: 'post', data: Qs.stringify(data)});
},

View File

@@ -84,72 +84,13 @@
<router-view @loadPageList="loadPageList"
@changeExpandedKeys="changeWikiPageExpandedKeys"
@switchSpace="switchSpacePage"
@loadSpace="loadSpaceList"
:spaceId="choiceSpace"
:spaceInfo="getSpaceInfo(choiceSpace)">
</router-view>
</el-main>
</el-container>
</el-container>
<!--新建空间弹窗-->
<el-dialog title="创建空间" :visible.sync="newSpaceDialogVisible" width="600px" :close-on-click-modal="false">
<el-form label-width="100px" :model="newSpaceForm" :rules="newSpaceFormRules" ref="newSpaceForm">
<el-form-item label="空间名:" prop="name">
<el-input v-model="newSpaceForm.name"></el-input>
</el-form-item>
<el-form-item label="空间描述:" prop="spaceExplain">
<el-input v-model="newSpaceForm.spaceExplain"></el-input>
</el-form-item>
<el-form-item label="空间开放:">
<el-switch v-model="newSpaceForm.openDoc" inactive-text="需要登录" :inactive-value="0" active-text="开放访问" :active-value="1"></el-switch>
</el-form-item>
<el-form-item label="目录加载:">
<el-switch v-model="newSpaceForm.treeLazyLoad" inactive-text="预先加载" :inactive-value="0" active-text="延迟加载" :active-value="1"></el-switch>
</el-form-item>
<el-form-item label="空间类型:">
<el-select v-model="newSpaceForm.type" filterable placeholder="选择类型" style="width: 100%;">
<el-option :key="1" label="公共空间" :value="1">
<span style="float: left">公共空间</span>
<span style="float: right; color: #8492a6; font-size: 13px;">属于公共登录用户可访问编辑</span>
</el-option>
<el-option :key="2" label="个人空间" :value="2">
<span style="float: left">个人空间</span>
<span style="float: right; color: #8492a6; font-size: 13px;">属于个人所有登录用户可访问</span>
</el-option>
<el-option :key="3" label="隐私空间" :value="3">
<span style="float: left">隐私空间</span>
<span style="float: right; color: #8492a6; font-size: 13px;">属于个人仅创建者可访问</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" v-if="newSpaceForm.id > 0" @click="onNewSpaceSubmit('newSpaceForm')">保存修改</el-button>
<el-button type="primary" v-else @click="onNewSpaceSubmit('newSpaceForm')">立即创建</el-button>
<el-button @click="onNewSpaceCancel">取消</el-button>
</el-form-item>
</el-form>
</el-dialog>
<!--管理空间弹窗-->
<el-dialog title="管理空间" :visible.sync="manageSpaceDialogVisible" :close-on-click-modal="false" width="80%">
<el-table :data="spaceList" border style="width: 100%; margin-bottom: 5px;" max-height="500">
<el-table-column prop="id" label="ID" width="60"></el-table-column>
<el-table-column prop="name" label="名字"></el-table-column>
<el-table-column prop="spaceExplain" label="说明"></el-table-column>
<el-table-column label="开放地址">
<template slot-scope="scope">
<el-button type="text" @click="showOpenSpace(scope.row.uuid)" v-if="scope.row.openDoc == 1">{{scope.row.name}}</el-button>
<span v-else>暂未开放</span>
</template>
</el-table-column>
<el-table-column prop="createUserName" label="创建人"></el-table-column>
<el-table-column prop="createTime" label="创建时间"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button size="small" type="primary" v-on:click="editSpaceInfo(scope.row)">编辑</el-button>
<el-button size="small" type="danger" v-on:click="deleteSpaceInfo(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<!--关于弹窗-->
<el-dialog title="关于zyplayer-doc-wiki" :visible.sync="aboutDialogVisible" width="600px">
<el-form>
@@ -168,12 +109,14 @@
</el-form-item>
</el-form>
</el-dialog>
<create-space ref="createSpace" @success="loadSpaceList"></create-space>
</div>
</template>
<script>
import userApi from '../../common/api/user'
import pageApi from '../../common/api/page'
import CreateSpace from '../space/CreateSpace'
export default {
data() {
@@ -191,15 +134,6 @@
spaceList:[],
choiceSpace: "",
nowSpaceShow: {},
newSpaceDialogVisible: false,
manageSpaceDialogVisible: false,
newSpaceForm: {id: '', name: '', spaceExplain: '', treeLazyLoad: 0, openDoc: 0, uuid: '', type: 1},
newSpaceFormRules: {
name: [
{required: true, message: '请输入空间名', trigger: 'blur'},
{min: 2, max: 25, message: '长度在 2 到 25 个字符', trigger: 'blur'}
],
},
nowPageId: '',
// 依据目录树存储的map全局对象
treePathDataMap: new Map(),
@@ -223,6 +157,9 @@
},
}
},
components: {
"create-space": CreateSpace,
},
computed: {
},
mounted: function () {
@@ -323,38 +260,14 @@
// issues:I2CG72 忽略大小写
let name = data.name.toLowerCase();
return name.indexOf(value.toLowerCase()) !== -1;
},
showOpenSpace(space) {
let routeUrl = this.$router.resolve({path: '/page/share/home', query: {space: space}});
window.open(routeUrl.href, '_blank');
},
editSpaceInfo(row) {
this.newSpaceForm = {
id: row.id, name: row.name, spaceExplain: row.spaceExplain,
treeLazyLoad: row.treeLazyLoad, openDoc: row.openDoc, type: row.type
};
this.newSpaceDialogVisible = true;
},
deleteSpaceInfo(row) {
this.$confirm('确定要删除此空间及下面的所有文档吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let param = {id: row.id, delFlag: 1};
pageApi.updateSpace(param).then(() => {
this.loadSpaceList();
});
});
},
spaceChangeEvents(data) {
if (data == 0) {
// 新建空间
this.newSpaceForm = {id: '', name: '', spaceExplain: '', treeLazyLoad: 0, openDoc: 0, uuid: '', type: 1};
this.newSpaceDialogVisible = true;
this.$refs.createSpace.show();
} else if (data == -1) {
// 管理空间
this.manageSpaceDialogVisible = true;
this.$router.push({path: '/space/manage'});
} else {
this.choiceSpace = data;
for (let i = 0; i < this.spaceList.length; i++) {
@@ -368,26 +281,27 @@
this.$router.push({path: '/home', query: {spaceId: data}});
}
},
loadSpaceList() {
loadSpaceList(spaceId) {
pageApi.spaceList({}).then(json => {
this.spaceList = json.data || [];
let spaceOptions = [];
for (let i = 0; i < this.spaceList.length; i++) {
spaceOptions.push({
label: this.spaceList[i].name, value: this.spaceList[i].id
});
}
this.spaceList.forEach(item => spaceOptions.push({label: item.name, value: item.id}));
this.spaceOptions = spaceOptions;
if (this.spaceList.length > 0) {
let spaceId = this.spaceList[0].id;
this.nowSpaceShow = this.spaceList[0];
this.choiceSpace = spaceId;
if (this.spaceList.length > 0) {
let nowSpaceId = spaceId;
let nowSpaceShow = this.spaceList.find(item => item.id == spaceId);
if (!nowSpaceShow) {
nowSpaceShow = this.spaceList[0];
nowSpaceId = nowSpaceShow.id;
}
this.nowSpaceShow = nowSpaceShow;
this.choiceSpace = nowSpaceId;
this.nowPageId = '';
this.doGetPageList(null);
// TODO 在首页时跳转
try {
if (this.$router.app._route.path == "/home") {
this.$router.push({path: '/home', query: {spaceId: spaceId}});
this.$router.push({path: '/home', query: {spaceId: nowSpaceId}});
}
} catch (e) {
console.log(e);
@@ -452,38 +366,6 @@
}
return {};
},
onNewSpaceSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
let param = {
id: this.newSpaceForm.id,
name: this.newSpaceForm.name,
type: this.newSpaceForm.type,
openDoc: this.newSpaceForm.openDoc,
spaceExplain: this.newSpaceForm.spaceExplain,
treeLazyLoad: this.newSpaceForm.treeLazyLoad,
};
pageApi.updateSpace(param).then(json => {
if (param.id > 0) {
this.loadSpaceList();
} else {
this.spaceList.push(json.data);
this.spaceOptions.push({
label: json.data.name, value: json.data.id
});
this.nowSpaceShow = json.data;
this.choiceSpace = json.data.id;
this.doGetPageList(null);
}
this.newSpaceForm = {id: '', name: '', spaceExplain: '', treeLazyLoad: 0, openDoc: 0, uuid: '', type: 1};
this.newSpaceDialogVisible = false;
});
}
});
},
onNewSpaceCancel() {
this.newSpaceDialogVisible = false;
},
checkSystemUpgrade() {
userApi.systemUpgradeInfo({}).then(json => {
if (!!json.data) {

View File

@@ -0,0 +1,121 @@
<template>
<div class="create-space-vue">
<!--新建空间弹窗-->
<el-dialog title="创建空间" :visible.sync="newSpaceDialogVisible" width="600px" :close-on-click-modal="false">
<el-form label-width="100px" :model="newSpaceForm" :rules="newSpaceFormRules" ref="newSpaceForm">
<el-form-item label="空间名:" prop="name">
<el-input v-model="newSpaceForm.name"></el-input>
</el-form-item>
<el-form-item label="空间描述:" prop="spaceExplain">
<el-input v-model="newSpaceForm.spaceExplain"></el-input>
</el-form-item>
<el-form-item label="空间开放:">
<el-switch v-model="newSpaceForm.openDoc" inactive-text="需要登录" :inactive-value="0" active-text="开放访问" :active-value="1"></el-switch>
</el-form-item>
<el-form-item label="目录加载:">
<el-switch v-model="newSpaceForm.treeLazyLoad" inactive-text="预先加载" :inactive-value="0" active-text="延迟加载" :active-value="1"></el-switch>
</el-form-item>
<el-form-item label="空间类型:">
<el-select v-model="newSpaceForm.type" filterable placeholder="选择类型" style="width: 100%;">
<el-option :key="1" label="公共空间" :value="1">
<span style="float: left">公共空间</span>
<span style="float: right; color: #8492a6; font-size: 13px;">属于公共登录用户可访问编辑</span>
</el-option>
<el-option :key="2" label="个人空间" :value="2">
<span style="float: left">个人空间</span>
<span style="float: right; color: #8492a6; font-size: 13px;">属于个人所有登录用户可访问</span>
</el-option>
<el-option :key="3" label="隐私空间" :value="3">
<span style="float: left">隐私空间</span>
<span style="float: right; color: #8492a6; font-size: 13px;">属于个人仅创建者可访问</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" v-if="newSpaceForm.id > 0" @click="onNewSpaceSubmit('newSpaceForm')">保存修改</el-button>
<el-button type="primary" v-else @click="onNewSpaceSubmit('newSpaceForm')">立即创建</el-button>
<el-button @click="onNewSpaceCancel">取消</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import pageApi from '../../common/api/page'
export default {
data() {
return {
newSpaceDialogVisible: false,
manageSpaceDialogVisible: false,
newSpaceForm: {id: '', name: '', spaceExplain: '', treeLazyLoad: 0, openDoc: 0, uuid: '', type: 1},
newSpaceFormRules: {
name: [
{required: true, message: '请输入空间名', trigger: 'blur'},
{min: 2, max: 25, message: '长度在 2 到 25 个字符', trigger: 'blur'}
],
},
editSpaceId: ''
};
},
mounted() {
},
methods: {
show(spaceId) {
this.newSpaceForm = {id: '', name: '', spaceExplain: '', treeLazyLoad: 0, openDoc: 0, uuid: '', type: 1};
this.editSpaceId = spaceId || '';
if (!!this.editSpaceId) {
pageApi.spaceList({id: this.editSpaceId}).then(json => {
let spaceList = json.data || [];
if (spaceList.length > 0) {
this.newSpaceForm = spaceList[0];
}
});
}
this.newSpaceDialogVisible = true;
},
onNewSpaceSubmit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
let param = {
id: this.newSpaceForm.id,
name: this.newSpaceForm.name,
type: this.newSpaceForm.type,
openDoc: this.newSpaceForm.openDoc,
spaceExplain: this.newSpaceForm.spaceExplain,
treeLazyLoad: this.newSpaceForm.treeLazyLoad,
};
pageApi.updateSpace(param).then(json => {
this.$message.success("创建成功");
this.newSpaceDialogVisible = false;
this.$emit("success", json.data.id);
});
}
});
},
onNewSpaceCancel() {
this.newSpaceDialogVisible = false;
},
}
}
</script>
<style>
.create-space-vue .empty-news{text-align: center;padding: 100px;}
.create-space-vue .text-link {
color: #444;
/*cursor: pointer;*/
/*font-weight: bold;*/
}
.create-space-vue .line-box{color: #666;border-bottom: 1px solid #eee;padding: 20px 0;}
.create-space-vue .line-title{font-size: 14px;}
.create-space-vue .page-preview-box{}
.create-space-vue .page-preview-title{font-size: 18px;margin: 10px 0 5px 0;color: #3a8ee6;cursor: pointer;}
.create-space-vue .page-preview-content{font-size: 16px;margin-bottom: 5px;}
.create-space-vue .zan-img{vertical-align: middle;margin-top: -3px;}
.create-space-vue .view-img{font-size: 16px;color: #666;}
.create-space-vue .page-info-box{text-align: right;margin: 20px 0 50px 0;}
</style>

View File

@@ -15,6 +15,7 @@ let routes = [
{path: '/user/myInfo', name: 'WIKI-我的信息', component: () => import('@/views/user/MyInfo')},
{path: '/page/show', name: 'WIKI-内容展示', component: () => import('@/views/page/Show')},
{path: '/page/edit', name: 'WIKI-编辑内容', component: () => import('@/views/page/Edit')},
{path: '/space/manage', name: 'WIKI-空间管理', component: () => import('@/views/space/Manage')},
]
},
{

View File

@@ -46,7 +46,7 @@
</el-table-column>
<el-table-column prop="createTime" label="创建时间" width="180px"></el-table-column>
<el-table-column prop="downloadNum" label="下载次数" width="80px"></el-table-column>
<el-table-column label="操作" width="100px" v-if="wikiPageAuth.canUploadFile==1">
<el-table-column label="操作" width="100px" v-if="wikiPageAuth.canDeleteFile==1">
<template slot-scope="scope">
<el-button size="small" v-on:click="deletePageFile(scope.row)">删除</el-button>
</template>
@@ -168,7 +168,7 @@
<!--人员权限弹窗-->
<el-dialog title="页面权限" :visible.sync="pageAuthDialogVisible" width="900px">
<el-row>
<el-select v-model="pageAuthNewUser" filterable remote reserve-keyword
<el-select v-model="pageAuthNewUser" filterable remote reserve-keyword autoComplete="new-password"
placeholder="请输入名字、邮箱、账号搜索用户" :remote-method="getSearchUserList"
:loading="pageAuthUserLoading" style="width: 750px;margin-right: 10px;">
<el-option v-for="item in searchUserList" :key="item.id" :label="item.userName" :value="item.id"></el-option>
@@ -272,12 +272,9 @@
});
},
getSearchUserList(query) {
if (query == '') {
return;
}
if (query == '') return;
this.pageAuthUserLoading = true;
var param = {search: query};
userApi.getUserBaseInfo(param).then(json => {
userApi.getUserBaseInfo({search: query}).then(json => {
this.searchUserList = json.data || [];
this.pageAuthUserLoading = false;
});
@@ -306,6 +303,10 @@
this.$message.warning("请先选择用户");
return;
}
if (!!this.searchUserList.find(item => item.userId == this.pageAuthNewUser)) {
this.pageAuthNewUser = "";
return;
}
var userName = "";
for (var i = 0; i < this.searchUserList.length; i++) {
if (this.pageAuthNewUser == this.searchUserList[i].id) {
@@ -483,6 +484,7 @@
canEdit: result.canEdit,
canDelete: result.canDelete,
canUploadFile: result.canUploadFile,
canDeleteFile: result.canDeleteFile,
canConfigAuth: result.canConfigAuth,
};
if (this.wikiPage.editorType === 2) {

View File

@@ -0,0 +1,253 @@
<template>
<div style="min-height: 100%;" class="space-manage-vue">
<el-breadcrumb separator-class="el-icon-arrow-right" style="padding: 20px 10px;">
<el-breadcrumb-item>WIKI文档</el-breadcrumb-item>
<el-breadcrumb-item>空间管理</el-breadcrumb-item>
</el-breadcrumb>
<div style="max-width: 1200px;margin: 0 auto;background: #fff;padding: 20px;min-height: 100%;box-sizing: border-box;">
<div style="text-align: right;margin-bottom: 10px;">
<span style="float:left;line-height: 40px;">
仅展示我收藏的空间
<el-switch v-model="userSetting.wiki_only_show_favorite" inactive-value="0" active-value="1" @change="wikiOnlyShowFavoriteChange"></el-switch>
<el-tooltip class="item" effect="dark" content="控制左上角空间下拉列表仅展示我收藏的空间" placement="top-start">
<i class="el-icon-warning-outline" style="vertical-align: middle;margin-left: 10px;color: #999;"></i>
</el-tooltip>
</span>
<el-button @click="loadSpaceList" icon="refresh" :loading="spaceListLoading">刷新</el-button>
<el-button type="primary" @click="showCreateSpace" icon="el-icon-plus">创建空间</el-button>
</div>
<el-table :data="spaceList" border style="width: 100%; margin-bottom: 5px;">
<el-table-column prop="id" label="ID" width="60"></el-table-column>
<el-table-column prop="name" label="名字"></el-table-column>
<el-table-column prop="spaceExplain" label="说明"></el-table-column>
<el-table-column label="开放地址">
<template slot-scope="scope">
<el-button type="text" @click="showOpenSpace(scope.row.uuid)" v-if="scope.row.openDoc == 1">{{scope.row.name}}</el-button>
<span v-else>暂未开放</span>
</template>
</el-table-column>
<el-table-column prop="createUserName" label="创建人"></el-table-column>
<el-table-column prop="createTime" label="创建时间"></el-table-column>
<el-table-column prop="favorite" label="收藏" width="60">
<template slot-scope="scope">
<i class="el-icon-star-on favorite-icon" v-if="scope.row.favorite == 1" @click="updateSpaceFavorite(scope.row)"></i>
<i class="el-icon-star-off favorite-icon" v-else @click="updateSpaceFavorite(scope.row)"></i>
</template>
</el-table-column>
<el-table-column label="操作" width="220">
<template slot-scope="scope" v-if="userSelfInfo.id == scope.row.createUserId">
<el-button size="small" type="primary" v-on:click="editSpaceInfo(scope.row)">编辑</el-button>
<el-button size="small" type="warning" v-on:click="editSpaceAuth(scope.row)">授权</el-button>
<el-button size="small" type="danger" v-on:click="deleteSpaceInfo(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
<!--分组权限弹窗-->
<el-dialog title="权限管理" :visible.sync="spaceAuthDialogVisible" width="900px">
<el-row>
<el-select v-model="spaceAuthNewGroupId" filterable placeholder="请选择分组" style="width: 750px;margin-right: 10px;">
<el-option v-for="item in searchGroupList" :key="item.id" :label="searchGroupMap[item.id]" :value="item.id"></el-option>
</el-select>
<el-button v-on:click="addSpaceAuthUserGroup">添加</el-button>
</el-row>
<el-table :data="spaceAuthGroupList" border style="width: 100%; margin: 10px 0;">
<el-table-column prop="groupId" label="分组名" width="150">
<template slot-scope="scope">{{searchGroupMap[scope.row.groupId]}}</template>
</el-table-column>
<el-table-column label="权限">
<template slot-scope="scope">
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.editPage">编辑</el-checkbox>
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.deletePage">删除</el-checkbox>
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.pageFileUpload">文件上传</el-checkbox>
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.pageFileDelete">文件删除</el-checkbox>
<el-checkbox :true-label="1" :false-label="0" v-model="scope.row.pageAuthManage">权限管理</el-checkbox>
</template>
</el-table-column>
<el-table-column label="操作" width="80">
<template slot-scope="scope">
<el-button size="small" type="danger" plain @click="deleteGroupSpaceAuth(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div style="text-align: right;">
<el-button v-on:click="manageUserGroup">分组管理</el-button>
<el-button type="primary" v-on:click="saveGroupSpaceAuth">保存配置</el-button>
</div>
</el-dialog>
<create-space ref="createSpace" @success="loadSpaceList"></create-space>
</div>
</template>
<script>
import pageApi from '../../common/api/page'
import userApi from '../../common/api/user'
import CreateSpace from '../../components/space/CreateSpace'
export default {
data() {
return {
spaceListLoading: false,
spaceOptions: [],
spaceList:[],
choiceSpace: "",
nowSpaceShow: {},
newSpaceDialogVisible: false,
manageSpaceDialogVisible: false,
newSpaceForm: {id: '', name: '', spaceExplain: '', treeLazyLoad: 0, openDoc: 0, uuid: '', type: 1},
newSpaceFormRules: {
name: [
{required: true, message: '请输入空间名', trigger: 'blur'},
{min: 2, max: 25, message: '长度在 2 到 25 个字符', trigger: 'blur'}
],
},
userSelfInfo: {},
// 空间授权
editSpaceId: '',
spaceAuthDialogVisible: false,
spaceAuthNewGroupId: '',
spaceAuthGroupLoading: false,
searchGroupList: [],
searchGroupMap: {},
spaceAuthGroupList: [],
// 设置
userSetting: {
wiki_only_show_favorite: 0,
},
};
},
components: {
"create-space": CreateSpace,
},
mounted() {
this.loadSpaceList();
this.getSelfUserInfo();
this.getSpaceSettingList();
},
methods: {
showOpenSpace(space) {
let routeUrl = this.$router.resolve({path: '/page/share/home', query: {space: space}});
window.open(routeUrl.href, '_blank');
},
showCreateSpace() {
this.$refs.createSpace.show();
},
editSpaceInfo(row) {
this.$refs.createSpace.show(row.id);
},
addSpaceAuthUserGroup() {
if (!this.spaceAuthNewGroupId) {
this.$message.warning("请先选择分组");
return;
}
if (!!this.spaceAuthGroupList.find(item => item.groupId == this.spaceAuthNewGroupId)) {
this.spaceAuthNewGroupId = "";
return;
}
this.spaceAuthGroupList.push({
groupId: this.spaceAuthNewGroupId,
editPage: 0,
commentPage: 0,
deletePage: 0,
pageFileUpload: 0,
pageFileDelete: 0,
pageAuthManage: 0,
});
this.spaceAuthNewGroupId = '';
},
updateSpaceFavorite(row) {
let delFlag = (row.favorite == 1) ? 1 : 0;
pageApi.spaceFavoriteUpdate({spaceId: row.id, delFlag: delFlag}).then(json => {
row.favorite = (row.favorite == 1) ? 0 : 1;
});
},
saveGroupSpaceAuth() {
let param = {spaceId: this.editSpaceId, authList: JSON.stringify(this.spaceAuthGroupList)};
pageApi.spaceAuthAssign(param).then(json => {
this.$message.success("授权成功!");
});
},
manageUserGroup() {
let manageUrl = location.href.substring(0, location.href.indexOf("/doc-wiki")) + '#/console/userGroupList';
window.open(manageUrl, '_blank');
},
deleteGroupSpaceAuth(row) {
this.spaceAuthGroupList = this.spaceAuthGroupList.filter(item => item.groupId != row.groupId);
},
editSpaceAuth(row) {
this.editSpaceId = row.id;
this.spaceAuthNewGroupId = '';
this.spaceAuthGroupList = [];
userApi.userGroupList().then(json => {
this.searchGroupList = json.data || [];
this.searchGroupList.forEach(item => this.searchGroupMap[item.id] = item.name);
});
pageApi.spaceAuthList({spaceId: row.id}).then(json => {
this.spaceAuthGroupList = json.data || [];
this.spaceAuthDialogVisible = true;
});
},
deleteSpaceInfo(row) {
this.$confirm('确定要删除此空间及下面的所有文档吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let param = {id: row.id, delFlag: 1};
pageApi.updateSpace(param).then(() => {
this.$message.success("删除成功");
this.loadSpaceList();
this.$emit('loadSpace');
});
});
},
loadSpaceList() {
this.spaceListLoading = true;
pageApi.spaceList({ignoreFavorite: 1}).then(json => {
this.spaceList = json.data || [];
setTimeout(() => this.spaceListLoading = false, 500);
});
},
wikiOnlyShowFavoriteChange() {
let param = {name: 'wiki_only_show_favorite', value: this.userSetting.wiki_only_show_favorite};
pageApi.spaceSettingUpdate(param).then(json => {
this.$emit('loadSpace');
});
},
getSpaceSettingList() {
pageApi.spaceSettingList().then(json => {
let result = json.data || {};
this.userSetting = {
wiki_only_show_favorite: result.wiki_only_show_favorite || 0,
};
});
},
getSelfUserInfo() {
userApi.getSelfUserInfo().then(json=>{
this.userSelfInfo = json.data;
});
},
}
}
</script>
<style>
.space-manage-vue .empty-news{text-align: center;padding: 100px;}
.space-manage-vue .text-link {
color: #444;
/*cursor: pointer;*/
/*font-weight: bold;*/
}
.space-manage-vue .line-box{color: #666;border-bottom: 1px solid #eee;padding: 20px 0;}
.space-manage-vue .line-title{font-size: 14px;}
.space-manage-vue .page-preview-box{}
.space-manage-vue .page-preview-title{font-size: 18px;margin: 10px 0 5px 0;color: #3a8ee6;cursor: pointer;}
.space-manage-vue .page-preview-content{font-size: 16px;margin-bottom: 5px;}
.space-manage-vue .zan-img{vertical-align: middle;margin-top: -3px;}
.space-manage-vue .view-img{font-size: 16px;color: #666;}
.space-manage-vue .page-info-box{text-align: right;margin: 20px 0 50px 0;}
.space-manage-vue .favorite-icon{cursor: pointer; font-size: 20px;}
.space-manage-vue .favorite-icon.el-icon-star-on{color: #E6A23C; font-size: 24px;}
</style>