393 lines
13 KiB
Vue
393 lines
13 KiB
Vue
<template>
|
||
<div class="page-container">
|
||
<!-- 搜索区域 -->
|
||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||
<div ref="searchRef" v-show="showSearch" class="mb-[10px]">
|
||
<el-card shadow="hover">
|
||
<el-form ref="queryFormRef" :model="queryParams" label-width="100px">
|
||
<!-- 第一行:搜索元素 -->
|
||
<el-row :gutter="20">
|
||
<el-col :span="6">
|
||
<el-form-item label="学生姓名" prop="studentName">
|
||
<el-input v-model="queryParams.studentName" placeholder="请输入学生姓名" clearable @keyup.enter="handleQuery" />
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="6">
|
||
<el-form-item label="身份证号" prop="idCard">
|
||
<el-input v-model="queryParams.idCard" placeholder="请输入身份证号" clearable @keyup.enter="handleQuery" />
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<!-- 操作按钮行 -->
|
||
<el-row>
|
||
<el-col :span="24" class="search-btn-container">
|
||
<el-form-item>
|
||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
</el-form>
|
||
</el-card>
|
||
</div>
|
||
</transition>
|
||
|
||
<!-- 表格操作区域 -->
|
||
<el-card shadow="never" class="table-card">
|
||
<template #header>
|
||
<el-row ref="toolbarRef" :gutter="10" class="mb8">
|
||
<el-col :span="1.5">
|
||
<el-button type="success" plain icon="Check" :disabled="single" @click="handleApprove()" v-hasPermi="['zsjy:enrollment:process:audit']">
|
||
通过
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button type="danger" plain icon="Close" :disabled="single" @click="handleReject()" v-hasPermi="['zsjy:enrollment:process:audit']">
|
||
驳回
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button type="primary" plain icon="View" :disabled="single" @click="handleView()" v-hasPermi="['zsjy:enrollment:process:query']">
|
||
查看
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button icon="Download" @click="handleExport" v-hasPermi="['zsjy:enrollment:process:export']">导出</el-button>
|
||
</el-col>
|
||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||
</el-row>
|
||
</template>
|
||
|
||
<!-- 表格区域 -->
|
||
<el-table v-loading="loading" border :data="processList" @selection-change="handleSelectionChange" @row-dblclick="handleRowClick">
|
||
<el-table-column type="selection" width="55" align="center" />
|
||
<el-table-column label="学生姓名" align="center" prop="studentName" />
|
||
<el-table-column label="身份证号" align="center" prop="idCard" :show-overflow-tooltip="true" />
|
||
<el-table-column label="当前状态" align="center" prop="currentStatus">
|
||
<template #default="scope">
|
||
<dict-tag :options="zsjy_enrollment_status" :value="scope.row.currentStatus" />
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="信息审核状态" align="center" prop="infoAuditStatus">
|
||
<template #default="scope">
|
||
<dict-tag :options="zsjy_audit_status" :value="scope.row.infoAuditStatus" />
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="录取处理状态" align="center" prop="admissionStatus">
|
||
<template #default="scope">
|
||
<dict-tag :options="zsjy_process_status" :value="scope.row.admissionStatus" />
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="最终审核状态" align="center" prop="finalAuditStatus">
|
||
<template #default="scope">
|
||
<dict-tag :options="zsjy_audit_status" :value="scope.row.finalAuditStatus" />
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||
<template #default="scope">
|
||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
|
||
<template #default="scope">
|
||
<el-button type="primary" link icon="View" @click="handleView(scope.row)" v-hasPermi="['zsjy:enrollment:process:query']">查看</el-button>
|
||
<el-button
|
||
v-if="canAudit(scope.row)"
|
||
type="success"
|
||
link
|
||
icon="Check"
|
||
@click="handleApprove(scope.row)"
|
||
v-hasPermi="['zsjy:enrollment:process:audit']"
|
||
>通过</el-button
|
||
>
|
||
<el-button
|
||
v-if="canAudit(scope.row)"
|
||
type="danger"
|
||
link
|
||
icon="Close"
|
||
@click="handleReject(scope.row)"
|
||
v-hasPermi="['zsjy:enrollment:process:audit']"
|
||
>驳回</el-button
|
||
>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
|
||
<!-- 分页区域 -->
|
||
<pagination v-if="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||
</el-card>
|
||
|
||
<!-- 审核对话框 -->
|
||
<el-dialog :title="auditDialogTitle" v-model="auditDialogVisible" width="500px" append-to-body>
|
||
<el-form ref="auditFormRef" :model="auditForm" :rules="auditRules" label-width="100px">
|
||
<el-form-item label="审核意见" prop="auditOpinion">
|
||
<el-input v-model="auditForm.auditOpinion" type="textarea" placeholder="请输入审核意见" :rows="4" maxlength="200" show-word-limit />
|
||
</el-form-item>
|
||
</el-form>
|
||
<template #footer>
|
||
<div class="dialog-footer">
|
||
<el-button type="primary" @click="submitAudit">确 定</el-button>
|
||
<el-button @click="auditDialogVisible = false">取 消</el-button>
|
||
</div>
|
||
</template>
|
||
</el-dialog>
|
||
</div>
|
||
</template>
|
||
|
||
<script setup name="PendingAudit" lang="ts">
|
||
import { ref, reactive, onMounted, computed, getCurrentInstance, toRefs } from 'vue';
|
||
import type { ComponentInternalInstance } from 'vue';
|
||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||
import { useRouter } from 'vue-router';
|
||
import { listMyAuditProcess, infoAudit, admissionProcess, finalAudit, exportEnrollmentProcess } from '@/api/zsjy/enrollmentProcess';
|
||
import { parseTime } from '@/utils/ruoyi';
|
||
import { download } from '@/utils/request';
|
||
import type { EnrollmentProcessVO, EnrollmentProcessQuery } from '@/api/zsjy/enrollmentProcess';
|
||
|
||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||
// 字典数据
|
||
const { zsjy_enrollment_status, zsjy_audit_status, zsjy_process_status, sys_yes_no } = toRefs<any>(
|
||
proxy?.useDict('zsjy_enrollment_status', 'zsjy_audit_status', 'zsjy_process_status', 'sys_yes_no')
|
||
);
|
||
|
||
// 遮罩层
|
||
const loading = ref(true);
|
||
// 选中数组
|
||
const ids = ref<Array<string | number>>([]);
|
||
// 非单个禁用
|
||
const single = computed(() => ids.value.length !== 1);
|
||
// 非多个禁用
|
||
const multiple = computed(() => !ids.value.length);
|
||
// 显示搜索条件
|
||
const showSearch = ref(true);
|
||
// 总条数
|
||
const total = ref(0);
|
||
// 录取流程状态表格数据
|
||
const processList = ref<EnrollmentProcessVO[]>([]);
|
||
// 弹出层标题
|
||
const auditDialogTitle = ref('');
|
||
// 是否显示弹出层
|
||
const auditDialogVisible = ref(false);
|
||
// 当前操作类型
|
||
const actionType = ref('');
|
||
// 当前选中的记录
|
||
const currentRow = ref<EnrollmentProcessVO | null>(null);
|
||
|
||
// 审核表单
|
||
const auditForm = reactive({
|
||
processId: 0,
|
||
auditResult: '',
|
||
auditOpinion: ''
|
||
});
|
||
|
||
// 审核表单校验规则
|
||
const auditRules = {
|
||
auditOpinion: [{ required: true, message: '请输入审核意见', trigger: 'blur' }]
|
||
};
|
||
|
||
// 查询参数
|
||
const queryParams = reactive<EnrollmentProcessQuery>({
|
||
pageNum: 1,
|
||
pageSize: 10,
|
||
studentName: '',
|
||
idCard: '',
|
||
params: {}
|
||
});
|
||
|
||
// 表单引用
|
||
const queryFormRef = ref();
|
||
const auditFormRef = ref();
|
||
|
||
/** 查询录取流程状态列表 */
|
||
function getList() {
|
||
loading.value = true;
|
||
listMyAuditProcess(queryParams).then((response) => {
|
||
processList.value = response.rows || [];
|
||
total.value = response.total || 0;
|
||
loading.value = false;
|
||
});
|
||
}
|
||
|
||
/** 搜索按钮操作 */
|
||
function handleQuery() {
|
||
queryParams.pageNum = 1;
|
||
getList();
|
||
}
|
||
|
||
/** 重置按钮操作 */
|
||
function resetQuery() {
|
||
queryFormRef.value?.resetFields();
|
||
handleQuery();
|
||
}
|
||
|
||
/** 多选框选中数据 */
|
||
function handleSelectionChange(selection: EnrollmentProcessVO[]) {
|
||
ids.value = selection.map((item) => item.id);
|
||
if (selection.length === 1) {
|
||
currentRow.value = selection[0];
|
||
} else {
|
||
currentRow.value = null;
|
||
}
|
||
}
|
||
|
||
/** 行点击事件 */
|
||
function handleRowClick(row: EnrollmentProcessVO) {
|
||
handleView(row);
|
||
}
|
||
|
||
/** 查看按钮操作 */
|
||
function handleView(row?: EnrollmentProcessVO) {
|
||
const id = row?.id || (ids.value.length > 0 ? ids.value[0] : null);
|
||
if (id) {
|
||
// 跳转到详情页面
|
||
const router = useRouter();
|
||
router.push({ path: '/zsjy/enrollmentProcess/detail', query: { id: id.toString() } });
|
||
}
|
||
}
|
||
|
||
/** 导出按钮操作 */
|
||
function handleExport() {
|
||
ElMessageBox.confirm('是否确认导出所有待我审核的数据项?', '警告', {
|
||
confirmButtonText: '确定',
|
||
cancelButtonText: '取消',
|
||
type: 'warning'
|
||
})
|
||
.then(() => {
|
||
loading.value = true;
|
||
exportEnrollmentProcess(queryParams)
|
||
.then((response) => {
|
||
download(response.msg, '待我审核列表', 'xlsx');
|
||
loading.value = false;
|
||
})
|
||
.catch(() => {
|
||
loading.value = false;
|
||
});
|
||
})
|
||
.catch(() => {});
|
||
}
|
||
|
||
/** 判断是否可以审核 */
|
||
function canAudit(row: EnrollmentProcessVO) {
|
||
// 根据当前用户角色和流程状态判断是否可以审核
|
||
// 这里简单实现,实际应该根据用户角色和流程状态判断
|
||
return true;
|
||
}
|
||
|
||
/** 通过按钮操作 */
|
||
function handleApprove(row?: EnrollmentProcessVO) {
|
||
const selectedRow = row || currentRow.value;
|
||
if (!selectedRow) {
|
||
ElMessage.warning('请选择要审核的记录');
|
||
return;
|
||
}
|
||
|
||
auditForm.processId = selectedRow.id as number;
|
||
auditForm.auditResult = '1'; // 1-通过
|
||
auditForm.auditOpinion = '';
|
||
auditDialogTitle.value = '审核通过';
|
||
actionType.value = 'approve';
|
||
auditDialogVisible.value = true;
|
||
}
|
||
|
||
/** 驳回按钮操作 */
|
||
function handleReject(row?: EnrollmentProcessVO) {
|
||
const selectedRow = row || currentRow.value;
|
||
if (!selectedRow) {
|
||
ElMessage.warning('请选择要审核的记录');
|
||
return;
|
||
}
|
||
|
||
auditForm.processId = selectedRow.id as number;
|
||
auditForm.auditResult = '9'; // 9-驳回
|
||
auditForm.auditOpinion = '';
|
||
auditDialogTitle.value = '审核驳回';
|
||
actionType.value = 'reject';
|
||
auditDialogVisible.value = true;
|
||
}
|
||
|
||
/** 提交审核 */
|
||
function submitAudit() {
|
||
auditFormRef.value?.validate((valid: boolean) => {
|
||
if (valid) {
|
||
const selectedRow = currentRow.value;
|
||
if (!selectedRow) {
|
||
ElMessage.warning('请选择要审核的记录');
|
||
return;
|
||
}
|
||
|
||
const params = {
|
||
processId: auditForm.processId,
|
||
auditOpinion: auditForm.auditOpinion
|
||
};
|
||
|
||
// 根据当前流程状态和用户角色调用不同的审核API
|
||
// 这里简单实现,实际应该根据用户角色和流程状态调用不同的API
|
||
if (selectedRow.currentStatus === '0' || selectedRow.currentStatus === '1') {
|
||
// 信息审核
|
||
infoAudit({
|
||
processId: auditForm.processId,
|
||
auditResult: auditForm.auditResult,
|
||
auditOpinion: auditForm.auditOpinion
|
||
}).then(() => {
|
||
ElMessage.success('审核操作成功');
|
||
auditDialogVisible.value = false;
|
||
getList();
|
||
});
|
||
} else if (selectedRow.currentStatus === '2') {
|
||
// 录取处理
|
||
admissionProcess({
|
||
processId: auditForm.processId,
|
||
admissionResult: auditForm.auditResult,
|
||
admissionOpinion: auditForm.auditOpinion
|
||
}).then(() => {
|
||
ElMessage.success('审核操作成功');
|
||
auditDialogVisible.value = false;
|
||
getList();
|
||
});
|
||
} else if (selectedRow.currentStatus === '3') {
|
||
// 最终确认
|
||
finalAudit({
|
||
processId: auditForm.processId,
|
||
finalResult: auditForm.auditResult,
|
||
finalOpinion: auditForm.auditOpinion
|
||
}).then(() => {
|
||
ElMessage.success('审核操作成功');
|
||
auditDialogVisible.value = false;
|
||
getList();
|
||
});
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
onMounted(() => {
|
||
getList();
|
||
});
|
||
</script>
|
||
|
||
<style scoped>
|
||
.page-container {
|
||
padding: 16px;
|
||
}
|
||
|
||
.search-card {
|
||
margin-bottom: 16px;
|
||
}
|
||
|
||
.search-btn-container {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
margin-right: 10px;
|
||
}
|
||
|
||
.table-card {
|
||
margin-bottom: 16px;
|
||
}
|
||
|
||
.dialog-footer {
|
||
display: flex;
|
||
justify-content: flex-end;
|
||
}
|
||
</style>
|