微盘权限设置
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
|
||||
<script>
|
||||
import List from './components/List'
|
||||
import Add from './components/Add'
|
||||
|
||||
export default {
|
||||
name: 'AppMicrodiskManage',
|
||||
@@ -28,7 +27,6 @@
|
||||
},
|
||||
|
||||
components: {
|
||||
Add,
|
||||
List
|
||||
},
|
||||
|
||||
@@ -37,11 +35,6 @@
|
||||
|
||||
methods: {
|
||||
onChange (data) {
|
||||
if (data.type === 'Add') {
|
||||
this.component = 'Add'
|
||||
this.params = data.params
|
||||
}
|
||||
|
||||
if (data.type === 'list') {
|
||||
this.component = 'List'
|
||||
this.params = data.params
|
||||
|
||||
@@ -1,203 +0,0 @@
|
||||
<template>
|
||||
<ai-detail>
|
||||
<template slot="title">
|
||||
<ai-title :title="id ? '编辑成员' : '添加成员'" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
|
||||
</ai-title>
|
||||
</template>
|
||||
<template slot="content">
|
||||
<el-form ref="form" :model="form" label-width="110px" label-position="right">
|
||||
<ai-card title="个人信息">
|
||||
<template #content>
|
||||
<div class="ai-form">
|
||||
<el-form-item label="姓名" prop="name" :rules="[{ required: true, message: '请输入姓名', trigger: 'blur' }]">
|
||||
<el-input size="small" placeholder="请输入姓名" show-word-limit v-model="form.name" :maxlength="10"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="账号" prop="id" :rules="[{ required: true, message: '请输入账号', trigger: 'blur' }]">
|
||||
<el-input size="small" :disabled="!!id" show-word-limit :maxlength="30" placeholder="成员唯一标识,设定以后不支持修改" v-model="form.id"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="mobile" :rules="[{ required: true, validator: validatorPhone, trigger: 'blur' }]">
|
||||
<el-input size="small" placeholder="请输入手机号" show-word-limit :maxlength="11" v-model="form.mobile"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="性别" prop="gender">
|
||||
<el-radio-group v-model="form.gender">
|
||||
<el-radio label="1">男</el-radio>
|
||||
<el-radio label="2">女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="座机" prop="telephone">
|
||||
<el-input size="small" placeholder="请输入座机" v-model="form.telephone"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input size="small" placeholder="请输入邮箱" v-model="form.email"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="地址" style="width: 100%;" prop="address">
|
||||
<el-input size="small" style="width: 100%;" show-word-limit :maxlength="30" placeholder="请输入地址" v-model="form.address"></el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
</ai-card>
|
||||
<ai-card title="组织信息">
|
||||
<template #content>
|
||||
<el-form-item label="部门" prop="departmentName" style="width: 100%;" :rules="[{ required: true, message: '请选择部门', trigger: 'change' }]">
|
||||
<el-input size="small" placeholder="请选择..." disabled v-model="form.departmentName">
|
||||
<ai-wechat-selecter slot="append" isStrictly :instance="instance" @change="onChange" v-model="department" isChooseUnit>
|
||||
<el-button type="info">选择</el-button>
|
||||
</ai-wechat-selecter>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="标签" style="width: 100%;" prop="tags">
|
||||
<el-select size="small" v-model="form.tagIds" multiple placeholder="请选择标签">
|
||||
<el-option
|
||||
v-for="item in tagsList"
|
||||
:key="item.id"
|
||||
:label="item.tagname"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="职务" prop="position">
|
||||
<el-input size="small" placeholder="请输入职务" v-model="form.position"></el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</ai-card>
|
||||
</el-form>
|
||||
</template>
|
||||
<template #footer>
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
<el-button type="primary" @click="confirm">提交</el-button>
|
||||
</template>
|
||||
</ai-detail>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'Add',
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
params: Object
|
||||
},
|
||||
|
||||
data () {
|
||||
const validatorPhone = function (rule, value, callback) {
|
||||
if (value === '') {
|
||||
callback(new Error('请输入手机号'))
|
||||
} else if (!/^1\d{10}$/.test(value)) {
|
||||
callback(new Error('手机号格式错误'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
info: {},
|
||||
department: [],
|
||||
validatorPhone: validatorPhone,
|
||||
form: {
|
||||
position: '',
|
||||
name: '',
|
||||
email: '',
|
||||
telephone: '',
|
||||
gender: '',
|
||||
mobile: '',
|
||||
departmentName: '',
|
||||
departmentIds: [],
|
||||
tagIds: [],
|
||||
id: ''
|
||||
},
|
||||
id: '',
|
||||
tagsList: []
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.getTags()
|
||||
|
||||
if (this.params && this.params.departmentId && !this.params.id) {
|
||||
this.department = [{
|
||||
id: String(this.params.departmentId),
|
||||
name: this.params.departmentName
|
||||
}]
|
||||
this.form.departmentIds = [this.params.departmentId]
|
||||
this.form.departmentName = this.params.departmentName
|
||||
}
|
||||
|
||||
if (this.params && this.params.id) {
|
||||
this.id = this.params.id
|
||||
this.getInfo(this.params.id)
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
getInfo (id) {
|
||||
this.instance.post(`/app/wxcp/wxuser/queryDetailById?id=${id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
const departmentNames = res.data.departmentNames.split(',')
|
||||
this.department = res.data.departmentIdsStr.split(',').map((item, index) => {
|
||||
return {
|
||||
name: departmentNames[index],
|
||||
id: item
|
||||
}
|
||||
})
|
||||
this.form = {
|
||||
...res.data,
|
||||
departmentName: res.data.departmentNames,
|
||||
tagIds: res.data.tags.map(v => v.id),
|
||||
departmentIds: res.data.departmentIdsStr.split(',')
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onChange (e) {
|
||||
if (e.length) {
|
||||
this.form.departmentIds = e.map(v => v.id)
|
||||
this.form.departmentName = e.map(v => v.name).join(',')
|
||||
} else {
|
||||
this.form.departmentIds = ''
|
||||
this.form.departmentName = ''
|
||||
}
|
||||
},
|
||||
|
||||
getTags () {
|
||||
this.instance.post(`/app/wxcp/wxtag/listAll`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.tagsList = res.data
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onClose () {
|
||||
this.form.explain = ''
|
||||
},
|
||||
|
||||
confirm () {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
const api = this.id ? '/app/wxcp/wxuser/update' : '/app/wxcp/wxuser/add'
|
||||
this.instance.post(api, {
|
||||
...this.form
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('提交成功')
|
||||
setTimeout(() => {
|
||||
this.cancel(true)
|
||||
}, 600)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
cancel (isRefresh) {
|
||||
this.$emit('change', {
|
||||
type: 'list',
|
||||
isRefresh: !!isRefresh
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
@@ -51,18 +51,9 @@
|
||||
<template slot="content">
|
||||
<ai-search-bar class="search-bar">
|
||||
<template #left>
|
||||
<!-- <el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加成员</el-button> -->
|
||||
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="showAuth">权限管理</el-button>
|
||||
</template>
|
||||
<template slot="right">
|
||||
<!-- <el-input
|
||||
v-model="search.name"
|
||||
size="small"
|
||||
v-throttle="() => {search.current = 1, getList()}"
|
||||
placeholder="请输入成员姓名、手机号或标签名称"
|
||||
clearable
|
||||
@clear="search.current = 1, search.name = '', getList()"
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input> -->
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
@@ -93,6 +84,33 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ai-dialog>
|
||||
<ai-dialog
|
||||
:visible.sync="isShowAuth"
|
||||
width="890px"
|
||||
title="权限管理"
|
||||
@close="isShowAuth = false"
|
||||
@onConfirm="isShowAuth = false">
|
||||
<ai-user-selecter ref="aiUserSelecter" v-if="isShowUser" :disabledList="disabledList" :props="{label: 'name', id: 'wxUserId'}" :instance="instance" v-model="authInfos" @change="onUserChange">
|
||||
<el-button size="small" type="primary" icon="iconfont iconAdd">添加成员</el-button>
|
||||
</ai-user-selecter>
|
||||
<ai-table
|
||||
:tableData="authList"
|
||||
:col-configs="authColConfigs"
|
||||
:total="total"
|
||||
tableSize="small"
|
||||
border
|
||||
style="margin-top: 12px;"
|
||||
@getList="getList">
|
||||
<el-table-column slot="options" width="140px" fixed="right" label="操作" align="center">
|
||||
<template slot-scope="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button type="text" v-if="row.auth !== 7" @click="settingAadmin(row.wxUserId)">设置管理员</el-button>
|
||||
<el-button type="text" @click="removeUser(row)">移除</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
</ai-dialog>
|
||||
</template>
|
||||
</ai-list>
|
||||
</template>
|
||||
@@ -108,7 +126,10 @@
|
||||
|
||||
data() {
|
||||
return {
|
||||
isShowAuth: false,
|
||||
isShowMenu: false,
|
||||
authInfos: [],
|
||||
isShowUser: true,
|
||||
menuInfo: {
|
||||
x: '',
|
||||
y: '',
|
||||
@@ -136,12 +157,24 @@
|
||||
{ prop: 'ctime', label: '文件创建时间', formart: v => v ? this.$moment(v * 1000).format('YYYY-MM-DD HH:mm:ss') : '-' },
|
||||
// { prop: 'departmentNames', label: '创建人' }
|
||||
],
|
||||
authColConfigs: [
|
||||
{ prop: 'name', label: '姓名' },
|
||||
{ prop: 'auth', label: '权限', align: 'center', formart: v => v === 7 ? '管理员' : '成员' }
|
||||
],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'fileName'
|
||||
},
|
||||
tableData: [],
|
||||
directoryList: []
|
||||
isShowUser: true,
|
||||
directoryList: [],
|
||||
authList: []
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
disabledList () {
|
||||
return this.authList.map(v => v.wxUserId)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -153,10 +186,51 @@
|
||||
|
||||
mounted () {
|
||||
this.getList()
|
||||
this.getAuthList()
|
||||
document.querySelector('html').addEventListener('click', this.bindEvent)
|
||||
},
|
||||
|
||||
methods: {
|
||||
getAuthList () {
|
||||
this.instance.post(`/app/wxwedrive/spaceUserInfo`, null, {
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.authList = res.data.filter(v => v.type === 1).map(v => {
|
||||
return {
|
||||
...v,
|
||||
id: v.id
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onUserChange (e) {
|
||||
this.instance.post(`/app/wxwedrive/spaceAclAdd`, e.map(v => {
|
||||
return {
|
||||
wxUserId: v.id,
|
||||
type: 1,
|
||||
name: v.name,
|
||||
auth: 1
|
||||
}
|
||||
})).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.authInfos = []
|
||||
this.$message.success('添加成功')
|
||||
this.getAuthList()
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$refs.aiUserSelecter.reset()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
showAuth () {
|
||||
this.authInfos = []
|
||||
this.isShowAuth = true
|
||||
},
|
||||
|
||||
loadNode (node, resolve) {
|
||||
this.instance.post(`/app/wxwedrive/queryWedriveDirectory?spaceid=${node.data.spaceid || ''}&fatherid=${node.data.fileId || ''}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
@@ -282,6 +356,28 @@
|
||||
return data.name.indexOf(value) !== -1
|
||||
},
|
||||
|
||||
settingAadmin (id) {
|
||||
this.$confirm('确定设置该成员为管理员?').then(() => {
|
||||
this.instance.post(`/app/wxwedrive/spaceAclAddAdmin?wxUserId=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.getAuthList()
|
||||
this.$message.success('设置成功')
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
removeUser (e) {
|
||||
this.$confirm('确定移除该成员?').then(() => {
|
||||
this.instance.post(`/app/wxwedrive/spaceAclDel`, [e]).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.getAuthList()
|
||||
this.$message.success('移除成功')
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
remove(id) {
|
||||
this.$confirm('确定删除该数据?').then(() => {
|
||||
this.instance.post(`/app/wxwedrive/fileDelete?fileid=${id}`).then(res => {
|
||||
|
||||
Reference in New Issue
Block a user