feat: add certification approve/reject with enhanced UI (#18)

- Add PUT /approve/{id} and PUT /reject/{id} endpoints
- Add state filter dropdown (pending/approved/rejected)
- Add colored status tags and approve/reject action buttons
- Add reject reason dialog and detail view with image previews

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
renjianbo
2026-05-17 01:13:01 +08:00
parent 2f460dbd4f
commit 8f2d9c337a
3 changed files with 342 additions and 365 deletions

View File

@@ -1,44 +1,61 @@
import request from '@/utils/request'
// 查询renzheng列表
export function listRenzheng(query) {
return request({
url: '/system/renzheng/list',
method: 'get',
params: query
})
}
// 查询renzheng详细
export function getRenzheng(id) {
return request({
url: '/system/renzheng/' + id,
method: 'get'
})
}
// 新增renzheng
export function addRenzheng(data) {
return request({
url: '/system/renzheng',
method: 'post',
data: data
})
}
// 修改renzheng
export function updateRenzheng(data) {
return request({
url: '/system/renzheng',
method: 'put',
data: data
})
}
// 删除renzheng
export function delRenzheng(id) {
return request({
url: '/system/renzheng/' + id,
method: 'delete'
})
}
import request from '@/utils/request'
// 查询renzheng列表
export function listRenzheng(query) {
return request({
url: '/system/renzheng/list',
method: 'get',
params: query
})
}
// 查询renzheng详细
export function getRenzheng(id) {
return request({
url: '/system/renzheng/' + id,
method: 'get'
})
}
// 新增renzheng
export function addRenzheng(data) {
return request({
url: '/system/renzheng',
method: 'post',
data: data
})
}
// 修改renzheng
export function updateRenzheng(data) {
return request({
url: '/system/renzheng',
method: 'put',
data: data
})
}
// 删除renzheng
export function delRenzheng(id) {
return request({
url: '/system/renzheng/' + id,
method: 'delete'
})
}
// 审核通过
export function approveRenzheng(id) {
return request({
url: '/system/renzheng/approve/' + id,
method: 'put'
})
}
// 审核驳回
export function rejectRenzheng(id, juejuereson) {
return request({
url: '/system/renzheng/reject/' + id,
method: 'put',
data: { juejuereson }
})
}

View File

@@ -1,321 +1,247 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="名" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户ID" prop="userId">
<el-input
v-model="queryParams.userId"
placeholder="请输入用户ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="审核不通过原因" prop="juejuereson">
<el-input
v-model="queryParams.juejuereson"
placeholder="请输入审核不通过原因"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="认证状态1是新的1是通过2是驳回" prop="state">
<el-input
v-model="queryParams.state"
placeholder="请输入认证状态1是新的1是通过2是驳回"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:renzheng:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:renzheng:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:renzheng:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:renzheng:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="renzhengList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="名称" align="center" prop="name" />
<el-table-column label="人脸照地址" align="center" prop="facePic" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.facePic" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="用户ID" align="center" prop="userId" />
<el-table-column label="身份证正面" align="center" prop="frontIdentity" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.frontIdentity" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="身份证反面" align="center" prop="backIdentity" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.backIdentity" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="审核不通过原因" align="center" prop="juejuereson" />
<el-table-column label="认证状态1是新的1是通过2是驳回" align="center" prop="state" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:renzheng:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:renzheng:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改renzheng对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
<el-form-item label="人脸照地址">
<image-upload v-model="form.facePic"/>
</el-form-item>
<el-form-item label="用户ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户ID" />
</el-form-item>
<el-form-item label="身份证正面">
<image-upload v-model="form.frontIdentity"/>
</el-form-item>
<el-form-item label="身份证反面">
<image-upload v-model="form.backIdentity"/>
</el-form-item>
<el-form-item label="审核不通过原因" prop="juejuereson">
<el-input v-model="form.juejuereson" placeholder="请输入审核不通过原因" />
</el-form-item>
<el-form-item label="认证状态1是新的1是通过2是驳回" prop="state">
<el-input v-model="form.state" placeholder="请输入认证状态1是新的1是通过2是驳回" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listRenzheng, getRenzheng, delRenzheng, addRenzheng, updateRenzheng } from "@/api/system/renzheng";
export default {
name: "Renzheng",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// renzheng表格数据
renzhengList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
facePic: null,
userId: null,
frontIdentity: null,
backIdentity: null,
juejuereson: null,
state: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询renzheng列表 */
getList() {
this.loading = true;
listRenzheng(this.queryParams).then(response => {
this.renzhengList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
facePic: null,
userId: null,
frontIdentity: null,
backIdentity: null,
juejuereson: null,
state: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加renzheng";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getRenzheng(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改renzheng";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateRenzheng(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addRenzheng(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除renzheng编号为"' + ids + '"的数据项?').then(function() {
return delRenzheng(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/renzheng/export', {
...this.queryParams
}, `renzheng_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="名" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入姓名" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="用户ID" prop="userId">
<el-input v-model="queryParams.userId" placeholder="请输入用户ID" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="认证状态" prop="state">
<el-select v-model="queryParams.state" placeholder="请选择认证状态" clearable>
<el-option label="全部" :value="null" />
<el-option label="待审核" value="0" />
<el-option label="已通过" value="1" />
<el-option label="已驳回" value="2" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:renzheng:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['system:renzheng:remove']">删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="renzhengList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" align="center" prop="id" width="70" />
<el-table-column label="姓名" align="center" prop="name" min-width="80" />
<el-table-column label="身份证号" align="center" prop="identityNo" min-width="170" />
<el-table-column label="用户ID" align="center" prop="userId" width="80" />
<el-table-column label="人脸照" align="center" prop="facePic" width="80">
<template slot-scope="scope">
<image-preview :src="scope.row.facePic" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column label="身份证正面" align="center" prop="frontIdentity" width="80">
<template slot-scope="scope">
<image-preview :src="scope.row.frontIdentity" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column label="身份证反面" align="center" prop="backIdentity" width="80">
<template slot-scope="scope">
<image-preview :src="scope.row.backIdentity" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column label="认证状态" align="center" prop="state" width="90">
<template slot-scope="scope">
<el-tag :type="stateTagType(scope.row.state)">{{ stateMap[scope.row.state] || scope.row.state }}</el-tag>
</template>
</el-table-column>
<el-table-column label="驳回原因" align="center" prop="juejuereson" min-width="120" show-overflow-tooltip />
<el-table-column label="提交时间" align="center" prop="createTime" width="160" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
<template slot-scope="scope">
<el-button size="mini" type="success" icon="el-icon-check" @click="handleApprove(scope.row)"
v-if="scope.row.state == '0' || scope.row.state == null"
v-hasPermi="['system:renzheng:edit']">通过</el-button>
<el-button size="mini" type="danger" icon="el-icon-close" @click="handleReject(scope.row)"
v-if="scope.row.state == '0' || scope.row.state == null"
v-hasPermi="['system:renzheng:edit']">驳回</el-button>
<el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.row)">详情</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:renzheng:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 驳回原因对话框 -->
<el-dialog :title="'审核驳回'" :visible.sync="rejectOpen" width="450px" append-to-body>
<el-form ref="rejectForm" :model="rejectForm" :rules="rejectRules" label-width="80px">
<el-form-item label="驳回原因" prop="juejuereson">
<el-input v-model="rejectForm.juejuereson" type="textarea" :rows="3" placeholder="请输入驳回原因" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitReject"> </el-button>
<el-button @click="rejectOpen = false"> </el-button>
</div>
</el-dialog>
<!-- 认证详情对话框 -->
<el-dialog :title="'认证详情'" :visible.sync="detailOpen" width="650px" append-to-body>
<el-descriptions :column="2" border>
<el-descriptions-item label="ID">{{ detail.id }}</el-descriptions-item>
<el-descriptions-item label="姓名">{{ detail.name }}</el-descriptions-item>
<el-descriptions-item label="身份证号">{{ detail.identityNo }}</el-descriptions-item>
<el-descriptions-item label="用户ID">{{ detail.userId }}</el-descriptions-item>
<el-descriptions-item label="认证状态">
<el-tag :type="stateTagType(detail.state)">{{ stateMap[detail.state] || detail.state }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="驳回原因">{{ detail.juejuereson || '-' }}</el-descriptions-item>
<el-descriptions-item label="人脸照" :span="2">
<image-preview :src="detail.facePic" :width="120" :height="120" v-if="detail.facePic" />
<span v-else></span>
</el-descriptions-item>
<el-descriptions-item label="身份证正面">
<image-preview :src="detail.frontIdentity" :width="200" v-if="detail.frontIdentity" />
<span v-else></span>
</el-descriptions-item>
<el-descriptions-item label="身份证反面">
<image-preview :src="detail.backIdentity" :width="200" v-if="detail.backIdentity" />
<span v-else></span>
</el-descriptions-item>
<el-descriptions-item label="提交时间">{{ detail.createTime }}</el-descriptions-item>
<el-descriptions-item label="更新时间">{{ detail.updateTime }}</el-descriptions-item>
</el-descriptions>
<div slot="footer" class="dialog-footer">
<el-button type="success" @click="detailOpen = false; handleApprove(detail)"
v-if="detail.state == '0' || detail.state == null"
v-hasPermi="['system:renzheng:edit']">审核通过</el-button>
<el-button type="danger" @click="detailOpen = false; handleReject(detail)"
v-if="detail.state == '0' || detail.state == null"
v-hasPermi="['system:renzheng:edit']">审核驳回</el-button>
<el-button @click="detailOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listRenzheng, getRenzheng, delRenzheng, approveRenzheng, rejectRenzheng } from "@/api/system/renzheng";
export default {
name: "Renzheng",
data() {
return {
loading: true,
ids: [],
single: true,
multiple: true,
showSearch: true,
total: 0,
renzhengList: [],
detailOpen: false,
detail: {},
rejectOpen: false,
rejectForm: { id: null, juejuereson: '' },
rejectRules: {
juejuereson: [{ required: true, message: '请输入驳回原因', trigger: 'blur' }]
},
stateMap: { '0': '待审核', '1': '已通过', '2': '已驳回' },
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
userId: null,
state: null,
},
form: {},
rules: {}
};
},
created() {
this.getList();
},
methods: {
stateTagType(state) {
const map = { '0': 'warning', '1': 'success', '2': 'danger' };
return map[state] || 'info';
},
getList() {
this.loading = true;
listRenzheng(this.queryParams).then(response => {
this.renzhengList = response.rows;
this.total = response.total;
this.loading = false;
});
},
cancel() {
this.open = false;
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
handleAdd() {
this.$router.push({ path: '/system/renzheng/edit' });
},
handleDetail(row) {
getRenzheng(row.id).then(response => {
this.detail = response.data;
this.detailOpen = true;
});
},
handleApprove(row) {
this.$modal.confirm('确认通过该认证申请?').then(() => {
approveRenzheng(row.id).then(() => {
this.$modal.msgSuccess("审核通过");
this.getList();
});
}).catch(() => {});
},
handleReject(row) {
this.rejectForm = { id: row.id, juejuereson: '' };
this.rejectOpen = true;
},
submitReject() {
this.$refs["rejectForm"].validate(valid => {
if (valid) {
rejectRenzheng(this.rejectForm.id, this.rejectForm.juejuereson).then(() => {
this.$modal.msgSuccess("已驳回");
this.rejectOpen = false;
this.getList();
});
}
});
},
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除认证编号为"' + ids + '"的数据项?').then(function () {
return delRenzheng(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
handleExport() {
this.download('system/renzheng/export', {
...this.queryParams
}, `renzheng_${new Date().getTime()}.xlsx`)
}
}
};
</script>

View File

@@ -34,6 +34,40 @@ public class SysUserRenzhengController extends BaseController
@Autowired
private ISysUserRenzhengService sysUserRenzhengService;
/**
* 审核通过
*/
@Log(title = "认证审核", businessType = BusinessType.UPDATE)
@PutMapping("/approve/{id}")
public AjaxResult approve(@PathVariable Long id)
{
SysUserRenzheng renzheng = sysUserRenzhengService.selectSysUserRenzhengById(id);
if (renzheng == null)
{
return AjaxResult.error("认证记录不存在");
}
renzheng.setState("1");
renzheng.setJuejuereson(null);
return toAjax(sysUserRenzhengService.updateSysUserRenzheng(renzheng));
}
/**
* 审核驳回
*/
@Log(title = "认证审核", businessType = BusinessType.UPDATE)
@PutMapping("/reject/{id}")
public AjaxResult reject(@PathVariable Long id, @RequestBody SysUserRenzheng req)
{
SysUserRenzheng renzheng = sysUserRenzhengService.selectSysUserRenzhengById(id);
if (renzheng == null)
{
return AjaxResult.error("认证记录不存在");
}
renzheng.setState("2");
renzheng.setJuejuereson(req.getJuejuereson());
return toAjax(sysUserRenzhengService.updateSysUserRenzheng(renzheng));
}
/**
* 查询renzheng列表
*/