Commit 7c64a533 authored by 智勇's avatar 智勇

修改密码

parent aed862d5
...@@ -63,3 +63,11 @@ export function modifyRole(data) { ...@@ -63,3 +63,11 @@ export function modifyRole(data) {
data data
}) })
} }
export function changePassword(data) {
return request({
url: '/user/update/password',
method: 'put',
data
})
}
...@@ -40,9 +40,10 @@ ...@@ -40,9 +40,10 @@
<el-table-column label="更新时间" prop="updateTime" align="center"/> <el-table-column label="更新时间" prop="updateTime" align="center"/>
<el-table-column label="登录时间" prop="lastLoginTime" align="center"/> <el-table-column label="登录时间" prop="lastLoginTime" align="center"/>
<el-table-column label="操作" align="center" width="80" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-button type="primary" size="mini" @click="handleUpdate(row)">编辑</el-button> <el-button type="primary" size="mini" @click="handleUpdate(row)">编辑</el-button>
<el-button size="mini" @click="HandleChangePassword(row)">修改密码</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -91,11 +92,28 @@ ...@@ -91,11 +92,28 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogPassword">
<el-form :model="temp" label-position="left" label-width="115px" style="margin-left:10px;">
<el-form-item label="登录账号" prop="username" >
<el-input v-model="temp.username" disabled/>
</el-form-item>
<el-form-item label="新密码" prop="newPassword">
<el-input v-model="temp.newPassword"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogPassword = false">取消</el-button>
<el-button type="primary" @click="changePassword()">确定</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { fetchUser, fetchUserRank, save, modifyUser, getRoles } from '@/api/userManager' import { fetchUser, fetchUserRank, save, modifyUser, getRoles, changePassword } from '@/api/userManager'
import { getChannelInfo } from '@/api/channel' import { getChannelInfo } from '@/api/channel'
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
import permission from '@/directive/permission/index.js' // 权限判断指令 import permission from '@/directive/permission/index.js' // 权限判断指令
...@@ -128,10 +146,12 @@ export default { ...@@ -128,10 +146,12 @@ export default {
temp: {}, temp: {},
dialogFormVisible: false, dialogFormVisible: false,
dialogDeleteVisible: false, dialogDeleteVisible: false,
dialogPassword: false,
dialogStatus: '', dialogStatus: '',
textMap: { textMap: {
update: 'Edit', update: 'Edit',
create: 'Create' create: 'Create',
modify: 'Modify'
}, },
users: [], users: [],
channels: [], channels: [],
...@@ -193,6 +213,7 @@ export default { ...@@ -193,6 +213,7 @@ export default {
handleCreate() { handleCreate() {
this.temp = { this.temp = {
status: 'ENABLED'
} }
this.dialogStatus = 'create' this.dialogStatus = 'create'
this.dialogFormVisible = true this.dialogFormVisible = true
...@@ -223,7 +244,7 @@ export default { ...@@ -223,7 +244,7 @@ export default {
handleUpdate(row) { handleUpdate(row) {
this.temp = Object.assign({}, row) // copy obj this.temp = Object.assign({}, row) // copy obj
this.temp.roleId = row.roles[0].id this.$set(this.temp, 'roleId', row.roles[0].id)
this.dialogStatus = 'update' this.dialogStatus = 'update'
this.dialogFormVisible = true this.dialogFormVisible = true
this.$nextTick(() => { this.$nextTick(() => {
...@@ -253,6 +274,25 @@ export default { ...@@ -253,6 +274,25 @@ export default {
}) })
} }
}) })
},
HandleChangePassword(row) {
this.temp = {}
this.dialogStatus = 'modify'
this.dialogPassword = true
this.$set(this.temp, 'username', row.username)
},
changePassword() {
changePassword(this.temp).then(() => {
this.dialogPassword = false
this.$notify({
title: '成功',
message: '保存成功',
type: 'success',
duration: 2000
})
})
} }
} }
} }
......
...@@ -188,7 +188,9 @@ export default { ...@@ -188,7 +188,9 @@ export default {
handleUpdate(row) { handleUpdate(row) {
this.temp = Object.assign({}, row) // copy obj this.temp = Object.assign({}, row) // copy obj
this.temp.parentId = row.parent.id if (row.parent) {
this.$set(this.temp, 'parentId', row.parent.id)
}
this.temp.permissions = row.permissions.map(i => i.id) this.temp.permissions = row.permissions.map(i => i.id)
this.dialogStatus = 'update' this.dialogStatus = 'update'
this.dialogFormVisible = true this.dialogFormVisible = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment