增加删除用户功能 修正一些细节bug

This commit is contained in:
pixel
2020-04-16 20:16:19 +08:00
parent 5698c207a1
commit 569abbeb53
9 changed files with 248 additions and 169 deletions
+1 -1
View File
@@ -259,7 +259,7 @@ export default {
if (res.code == 0) {
this.$message({
type: 'success',
message: '添加成功',
message: '编辑成功',
showClose: true
})
}
+1 -6
View File
@@ -225,14 +225,9 @@ export default {
if (res.code == 0) {
this.$message({
type: 'success',
message: '添加成功!'
message: this.isEdit?'编辑成功':'添加成功!'
})
this.getTableData()
} else {
this.$message({
type: 'error',
message: '添加失败!'
})
}
this.initForm()
this.dialogFormVisible = false
+23 -1
View File
@@ -30,6 +30,21 @@
</el-select>
</template>
</el-table-column>
<el-table-column label="操作" min-width="150">
<template slot-scope="scope">
<el-popover
placement="top"
width="160"
v-model="scope.row.visible">
<p>确定要删除此用户吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="scope.row.visible = false">取消</el-button>
<el-button type="primary" size="mini" @click="deleteUser(scope.row)">确定</el-button>
</div>
<el-button type="text" size="small" slot="reference">删除</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
@@ -89,7 +104,7 @@
<script>
// 获取列表内容封装在mixins内部 getTableData方法 初始化已封装完成
const path = process.env.VUE_APP_BASE_API
import { getUserList, setUserAuthority, register } from '@/api/user'
import { getUserList, setUserAuthority, register, deleteUser } from '@/api/user'
import { getAuthorityList } from '@/api/authority'
import infoList from '@/components/mixins/infoList'
import { mapGetters } from 'vuex'
@@ -127,6 +142,13 @@ export default {
...mapGetters('user', ['token'])
},
methods: {
async deleteUser(row){
const res = await deleteUser({id:row.ID})
if(res.code == 0){
this.getTableData()
row.visible = false
}
},
getAuthorityList(AuthorityData){
AuthorityData.map(item=>{
this.authOptions.push({