<template>
|
<div class="review-dialog">
|
<el-dialog
|
:title="editCommonConfig.title"
|
:visible.sync="editConfig.visible"
|
:width="dialogWidth"
|
:before-close="handleClose"
|
append-to-body
|
custom-class="iframe-dialog"
|
>
|
<div class="drawerContent" style="overflow: auto">
|
<el-form ref="form" :rules="rules" :model="editConfig.infomation" label-position="right" label-width="100px">
|
<el-form-item label="审核结果:" prop="result">
|
<el-select v-model="editConfig.infomation.result" placeholder="请选择审核结果">
|
<el-option label="审核通过" :value="3"></el-option>
|
<el-option label="审核拒绝" :value="4"></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item v-if="editConfig.infomation.result === 4" label="未通过原因:" prop="reason">
|
<el-input v-model="editConfig.infomation.reason" type="textarea"></el-input>
|
</el-form-item>
|
<el-form-item v-if="editConfig.infomation.result === 3" label="用户等级:" prop="roleIDs">
|
<el-checkbox-group
|
v-model="editConfig.infomation.roleIDs"
|
:disabled="editConfig.title == '查看' ? true : false"
|
>
|
<el-checkbox v-for="role in roleList" :label="role.id" :key="role.id">{{ role.name }}</el-checkbox>
|
</el-checkbox-group>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="handleClose">取消</el-button>
|
<el-button v-if="editConfig.title == '查看' ? false : true" type="primary" @click="onSubmit('form')"
|
>确定</el-button
|
>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { getRoleIDs, userExamine } from "@/api/unifiedManage/userManage"
|
export default {
|
name: "ReviewDialog",
|
props: {
|
editCommonConfig: {
|
type: Object,
|
default: () => {
|
return {
|
visible: false,
|
title: "用户审核",
|
infomation: {
|
result: 3,
|
roleIDs: []
|
}
|
}
|
}
|
}
|
},
|
components: {},
|
computed: {},
|
data() {
|
return {
|
dialogWidth: "30%",
|
editConfig: this.editCommonConfig,
|
rules: {
|
result: [{ required: true, message: "请选择审核结果", trigger: "change" }],
|
reason: [{ required: true, message: "请输入拒绝原因", trigger: "blur" }],
|
roleIDs: [{ required: true, message: "请选择用户等级", trigger: "change" }]
|
},
|
roleList: [] // 用户等级
|
}
|
},
|
watch: {
|
"editCommonConfig.visible"(val) {
|
if (val) {
|
this.$refs.form.resetFields()
|
}
|
},
|
"editCommonConfig.infomation"(val) {
|
if (this.isopen) {
|
this.$refs.form.resetFields()
|
if (val.id) {
|
// this.form = val
|
// this.getDataInfo(val)
|
}
|
}
|
}
|
},
|
created() {
|
this.getDataInfo()
|
},
|
methods: {
|
handleClose() {
|
this.editConfig.visible = false
|
},
|
// 获取等级信息
|
async getDataInfo() {
|
const rsp = await getRoleIDs({ useType: 1 })
|
if (rsp.code == 200) {
|
this.roleList = rsp.data ? rsp.data : []
|
}
|
},
|
// 确定
|
onSubmit(formName) {
|
this.$refs[formName].validate((valid) => {
|
console.log(valid)
|
if (valid) {
|
let param = this.saveParams()
|
userExamine(param).then((reply) => {
|
if (reply && reply.code === 200) {
|
this.$message.success("保存成功")
|
this.handleClose()
|
this.$parent.getData()
|
}
|
})
|
}
|
})
|
},
|
saveParams() {
|
let reason = this.editConfig.infomation.result == 3 ? "" : this.editConfig.infomation.reason
|
let roleIds = this.editConfig.infomation.result == 3 ? this.editConfig.infomation.roleIDs : []
|
let params = {
|
reason: reason,
|
roleIds: roleIds,
|
status: this.editConfig.infomation.result,
|
userId: this.editConfig.infomation.id
|
}
|
return params
|
}
|
}
|
}
|
</script>
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
<style lang="scss" scoped>
|
::v-deep {
|
.iframe-dialog .el-dialog__body {
|
.drawerContent {
|
width: 80%;
|
padding: 20px 0;
|
margin: auto;
|
overflow: hidden;
|
margin-top: 15px;
|
// 溢出隐藏滚动条
|
scrollbar-width: none; /* firefox */
|
-ms-overflow-style: none; /* IE 10+ */
|
}
|
}
|
.el-dialog__footer {
|
background-color: #f5f5f5;
|
height: 55px;
|
line-height: 55px;
|
text-align: right;
|
padding-right: 20px;
|
}
|
}
|
</style>
|