Commit b9bd5d01 by liimin

修改用户审核方式

1 parent 812e3936
......@@ -275,7 +275,7 @@ export const resources = {
authId: '1070101',
parentId: '10701',
label: '审核',
handle: 'handleOperation'
handle: 'handleVerify'
}, { //
authId: '1070102',
parentId: '10701',
......
......@@ -110,10 +110,6 @@ export default {
this.$refs.roleForm.validate(vaild => {
if (vaild) {
const authIds = this.$refs.roleTree.getCheckedNodes()
if (authIds.length === 0) {
this.$message.error('请选择权限!')
return
}
var __p = { ...this.roleForm, authIds }
const fMethod = __p.roleId ? RoleModify : RoleReg
fMethod(__p).then(res => {
......
<template>
<el-dialog
:title="regForm.id?'编辑用户':'创建用户'"
:title="title"
:visible.sync="dialogVisible"
:before-close="handleClose"
width="720px"
......@@ -88,7 +88,6 @@
</el-dialog>
</template>
<script>
import { Reg, AccountModify } from '@/api/sys.account'
import { mapActions } from 'vuex'
import notice from '@/common/notice'
import { RegistType } from '@/common/constants'
......@@ -103,12 +102,21 @@ export default {
editData: {
type: Object,
default: {}
},
verify: {
type: Function,
default: null
}
},
watch: {
editData: {
handler: function (value) {
this.title = value && value.userId ? '编辑用户信息' : '创建用户'
if(!value || !value.data) return
const { data } = value
const {title,submit} = data
this.title = title
this.submitFunction = submit
delete value.data
Object.assign(this.regForm, value)
},
immediate: true
......@@ -136,6 +144,7 @@ export default {
roleId: ''
},
title: '',
submitFunction:null,
rules: Object.freeze({
loginName: [
{ required: true, message: '用户名不能为空', trigger: ['blur'] }
......@@ -174,21 +183,20 @@ export default {
methods: {
...mapActions('d2admin/base', ['load']),
handleClose (done) {
this.$event.$emit('e-reg-dialog', false)
this.$event.$emit('e-reg-dialog-close')
},
// 提交注册数据
// 提交注册或审核数据
submit () {
this.$refs.regForm.validate(vaild => {
if (vaild) {
var __p = this.regForm
__p.createType = RegistType.BY_ADMIN
const fMethod = __p.userId ? AccountModify : Reg
fMethod(__p).then(res => {
this.submitFunction(__p).then(res => {
const { operateStatus } = res
if (operateStatus) {
notice.okTips(`${this.title}成功!`)
this.$refs.regForm.resetFields()
this.$event.$emit('e-reg-dialog', false)
this.$event.$emit('e-reg-dialog-close')
} else {
notice.errorTips(`${this.title}失败!`)
}
......
......@@ -97,7 +97,7 @@
:total="page.totalCount"
layout="sizes,total,->,prev,pager,next,jumper"
></el-pagination>
<dialog-reg :isVisible="registerDialogVisible" :editData="editData" />
<dialog-reg :isVisible="registerDialogVisible" :editData="editData"/>
</d2-container>
</template>
......@@ -109,7 +109,8 @@ import {
AccountIncrease,
AccountForbidden,
AccountValidate,
AccountActived
AccountActived,
Reg
} from '@/api/sys.account'
import notice from '@/common/notice'
import { mapActions } from 'vuex'
......@@ -137,8 +138,6 @@ export default {
'重置密码': PassWordReset,
'延期': AccountIncrease,
'禁用': AccountForbidden,
'审核': AccountValidate,
'编辑': AccountModify,
'激活': AccountActived
}),
// 新增/编辑弹窗
......@@ -176,7 +175,7 @@ export default {
mounted () {
this.fetchData()
this.$event.$on('e-reg-dialog', res => (this.registerDialogVisible = res))
this.$event.$on('e-reg-dialog-close', res =>(this.registerDialogVisible = false))
},
methods: {
......@@ -229,7 +228,13 @@ export default {
return row.status === value
},
handleRegister () {
this.registerDialogVisible = true
const row ={
data: {
title:'用户创建',
submit:Reg
}
}
this.openDialog(row)
},
handleSearch () {
this.loadUserList()
......@@ -244,10 +249,25 @@ export default {
this.loadUserList()
},
handleEdit (row) {
row=util.deepClone(row)
row.data = {
title:'用户编辑',
submit:AccountModify
}
this.openDialog (row)
},
openDialog(row) {
this.registerDialogVisible = true
this.editData = util.deepClone(row)
this.editData = row
},
handleVerify(row){
row=util.deepClone(row)
row.data = {
title:'用户审核',
submit:AccountValidate
}
this.openDialog (row)
},
// ------------
// 列表各种操作
async handleOperation (row, e) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!