Commit ff20ed77 authored by caimeng's avatar caimeng

添加角色管理、重置密码、添加在职、离职状态

parent 15f9f9cb
......@@ -309,4 +309,30 @@ export default {
data
})
},
// 初始化用户角色
GetAllUserRole(params){
return request({
url: '/role/select',
method: 'get',
params
})
},
// 查询用户角色
GetUserRole(params){
return request({
url: '/user/selectUserRole',
method: 'get',
params
})
},
// 设置用户角色
SetUserRole(data){
return request({
url: '/user/userRole',
method: 'post',
data
})
},
}
......@@ -3,14 +3,7 @@
<!--搜索-->
<block-header title='搜索' />
<div class='search'>
<el-form label-suffix=':' :inline='true' ref='form' :model='queryForm' class='form-inline'>
<el-form-item prop='creditNo' label='授信编号'>
<el-input
v-model='queryForm.creditNo'
clearable
placeholder='请输入授信编号'
/>
</el-form-item>
<el-form ref='form' label-suffix=':' :inline='true' :model='queryForm' class='form-inline'>
<el-form-item prop='realName' label='客户姓名'>
<el-input
v-model='queryForm.realName'
......@@ -25,40 +18,6 @@
placeholder='请输入客户手机号码'
/>
</el-form-item>
<template v-if='searchData!==null'>
<el-form-item prop='creditType' label='授信类型'>
<el-select clearable v-model='queryForm.creditType' placeholder='请选择授信类型'>
<el-option
v-for='(item,index) in searchData.creditTypeResponseList'
:label='item.creditTypeStr'
:key='index'
:value='item.creditType'></el-option>
</el-select>
</el-form-item>
<el-form-item prop='creditStatus' label='授信状态'>
<el-select clearable v-model='queryForm.creditStatus' placeholder='请选择授信状态'>
<el-option
v-for='(item,index) in searchData.creditStatusResponseList'
:label='item.creditStatusStr'
:key='index'
:value='item.creditStatus'></el-option>
</el-select>
</el-form-item>
</template>
<el-form-item prop='time' label='申请时间'>
<el-date-picker
v-model='queryForm.time'
type='datetimerange'
:picker-options='pickerConfig'
range-separator='至'
start-placeholder='开始时间'
end-placeholder='结束时间'
>
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button icon='el-icon-search' type='primary' @click='onSearch'>搜 索</el-button>
<el-button icon='el-icon-delete' type='default' @click="onReset('form')">重置</el-button>
......@@ -86,15 +45,13 @@
:show-overflow-tooltip='!!item.overflow'
>
<template #default='{ row }'>
<div v-if="item.label==='营业执照' || item.label==='小贷拍照' || item.label==='金融办批文'">
<el-image
style='width: 100px; height: 75px'
:src='row[item.prop]'
fit='fit'
/>
<div v-if="item.label==='账号状态'">
<el-tag v-if='row.status==="NORMAL"' type='primary'>在职</el-tag>
<el-tag v-else type='danger'>离职</el-tag>
</div>
<div v-else-if="item.label==='机构状态'">
<span>{{ row[item.prop] === '1' ? '启用' : '禁用' }}</span>
<div v-else-if="item.label==='是否在线'">
<el-tag v-if='row.userDutyState==="OFFLINE"' type='info'>离线</el-tag>
<el-tag v-else type='success'>在线</el-tag>
</div>
<span v-else>{{ row[item.prop] }}</span>
</template>
......@@ -106,11 +63,14 @@
label='操作'
>
<template #default='{ row }'>
<el-button type='text' @click='handleDetail(row)'>详情</el-button>
<!--<el-button type='text' @click='handleDetail(row)'>详情</el-button>-->
<el-button type='text' @click='handleRole(row)'>角色</el-button>
<el-button type='text' @click='handleResetPwd(row)'>重置密码</el-button>
</template>
</el-table-column>
</el-table>
<!--分页-->
<el-pagination
:current-page='queryForm.current'
layout='total, prev, pager, next'
......@@ -119,6 +79,39 @@
background
@current-change='handleCurrentChange'
/>
<!-- 设置角色-->
<template v-if='visible'>
<el-dialog
:title='title'
:visible.sync='visible'
:destroy-on-close='true'
:append-to-body='true'
:before-close='handleClose'
:close-on-click-modal='false'
width='740px'>
<div class='page'>
<el-transfer
v-model='defaultChecked'
:titles="['老角色', '新角色']"
:button-texts="['到左边', '到右边']"
:data='data'
:props="{
key: 'code',
label: 'name'
}"
>
<span slot-scope='{option}'>{{ option.name }}</span>
</el-transfer>
</div>
<div slot='footer' class='dialog-footer'>
<el-button type='primary' @click='handleSetRole'>确 定</el-button>
<el-button @click='handleClose'>取 消</el-button>
</div>
</el-dialog>
</template>
</div>
</template>
......@@ -130,9 +123,16 @@
import { mapGetters } from 'vuex'
export default {
name: 'CreditList',
name: 'AdminUser',
data() {
return {
visible: false,
title: '',
data: [],
checkedUser: null,
defaultChecked: [],
checkList: ['用户ID', '登录名', '用户名', '手机号', '账号状态', '是否在线'],
columns: [
{
......@@ -174,17 +174,8 @@
current: 1,
size: 10,
mobile: '',
bdNo: '',
creditNo: '',
creditStatus: '',
creditType: '',
realName: '',
time: '',
startTime: '',
endTime: '',
userId: ''
realName: ''
}
}
},
......@@ -197,23 +188,14 @@
)
})
return _.sortBy(finallyArray, (item) => item.order)
},
...mapGetters(['searchData', 'user'])
}
},
mounted() {
this.fetchData()
},
methods: {
onSearch() {
const { time } = this.queryForm
this.queryForm.current = 1
if (time) {
this.queryForm.startTime = time[0]
this.queryForm.endTime = time[1]
} else {
this.queryForm.startTime = ''
this.queryForm.endTime = ''
}
this.fetchData()
},
// 预授信详情
......@@ -232,14 +214,86 @@
this.listLoading = true
const form = this.queryForm
const params = Object.assign({}, form)
delete params.time
params.userId = this.user.userId
const result = await API.userList({ ...params })
const { data, total } = result.result
console.log(data, 's')
this.list = data
this.total = total
this.listLoading = false
},
// 关闭设置角色弹框
handleClose() {
this.visible = false
this.defaultChecked = []
},
// 设置用户角色弹框
async handleRole(row) {
const { loginName, userName } = row
this.title = `设置角色-${userName}`
this.visible = true
this.checkedUser = row
// 已经选中的
const result = await API.GetUserRole({ loginName })
if (result.success) {
const currentRoles = result.result
if (currentRoles.length) {
this.defaultChecked = currentRoles
}
}
// 初始化默认
const res = await API.GetAllUserRole({})
if (res.success) {
this.data = res.result
console.log(this.data, '那啥')
}
},
// 设置用户角色提交
async handleSetRole() {
const { loginName } = this.checkedUser
const roles = this.defaultChecked
if (roles.length) {
const result = await API.SetUserRole({
loginName,
userRole: roles
})
if (result.success) {
this.$message({
type: 'success',
message: '设置成功'
})
this.handleClose()
await this.fetchData()
}
} else {
this.$message({
type: 'error',
message: '请先选择角色'
})
}
},
// 重置密码
async handleResetPwd(row) {
const { loginName } = row
const result = await API.userResetPwd({
loginName
})
if (result.success) {
this.$message({
type: 'success',
message: '操作成功'
})
}
}
}
}
......
......@@ -23,11 +23,11 @@
<template v-if='searchData!==null && payChannelApiResponses.length'>
<el-form-item prop='payChannelApi' label='放款渠道'>
<el-select style='width: 100%;' v-model='form.payChannelApi' clearable placeholder='请选择放款渠道'>
<el-select v-model='form.payChannelApi' style='width: 100%;' clearable placeholder='请选择放款渠道'>
<el-option
v-for='(item,index) in payChannelApiResponses'
:label='item.payChannelApiStr'
:key='index'
:label='item.payChannelApiStr'
:value='item.payChannelApi'></el-option>
</el-select>
......@@ -67,6 +67,13 @@
data() {
return {
rules: {
payChannelApi: [
{
required: true,
trigger: 'change',
message: '请选择放款渠道'
}
],
memo: [
{
required: 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