Commit b9bd5d01 by liimin

修改用户审核方式

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