“编译修改”

This commit is contained in:
weizhong committed 2025-10-14 16:48:17 +08:00
1 parent e79bf5a26c
commit 2f2e303781
105 files changed
+26461

No files matched your search

@@ -0,0 +1,724 @@
<template>
<div class="app-container">
<el-card class="box-card">
<!-- 选项卡 -->
<el-tabs v-model="activeTab" type="border-card" @tab-change="handleTabChange">
<!-- 登记审批选项卡 -->
<el-tab-pane label="登记审批" name="pending">
<div class="tab-content">
<!-- 搜索区域 -->
<transition :enter-active-class="animate.searchAnimate.enter" :leave-active-class="animate.searchAnimate.leave">
<div 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="5">
<el-form-item label="姓名" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入姓名" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="身份证号" prop="idNumber">
<el-input v-model="queryParams.idNumber" placeholder="请输入身份证号" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="工作部门" prop="department">
<el-input v-model="queryParams.department" 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="button-card table-card">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<!-- 数据表格 -->
<el-table
v-loading="loading"
border
:data="registrationList"
@row-dblclick="handleView"
>
<el-table-column label="序号" type="index" width="60" align="center">
<template #default="scope">
{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="name" width="100" :show-overflow-tooltip="true" />
<el-table-column label="性别" align="center" width="80">
<template #default="scope">{{ scope.row.gender === '0' ? '男' : '女' }}</template>
</el-table-column>
<el-table-column label="身份证号" align="center" prop="idNumber" width="180" :show-overflow-tooltip="true" />
<el-table-column label="工作部门" align="center" prop="department" min-width="150" :show-overflow-tooltip="true" />
<el-table-column label="职务职称" align="center" prop="position" width="120" :show-overflow-tooltip="true" />
<el-table-column label="政治面貌" align="center" prop="politicalStatus" width="120" :show-overflow-tooltip="true" />
<el-table-column label="审批状态" align="center" prop="statusText" width="120">
<template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status)">{{ scope.row.statusText }}</el-tag>
</template>
</el-table-column>
<el-table-column label="提交时间" align="center" prop="createTime" width="160" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="280" fixed="right">
<template #default="scope">
<el-tooltip content="查看详情" placement="top">
<el-button link type="primary" icon="View" @click="handleView(scope.row)" v-hasPermi="['rs:registration:query']"></el-button>
</el-tooltip>
<!-- 待审批状态:显示审批按钮 -->
<el-tooltip content="审批通过" placement="top">
<el-button
link
type="success"
icon="Check"
@click="handleApprove(scope.row)"
v-hasPermi="['rs:registration:approve']"
></el-button>
</el-tooltip>
<el-tooltip content="审批拒绝" placement="top">
<el-button
link
type="danger"
icon="Close"
@click="handleReject(scope.row)"
v-hasPermi="['rs:registration:reject']"
></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
</div>
</el-tab-pane>
<!-- 审批记录选项卡 -->
<el-tab-pane label="审批记录" name="history">
<div class="tab-content">
<!-- 搜索区域 -->
<transition :enter-active-class="animate.searchAnimate.enter" :leave-active-class="animate.searchAnimate.leave">
<div v-show="showHistorySearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="historyQueryFormRef" :model="historyQueryParams" label-width="100px">
<el-row :gutter="20">
<el-col :span="5">
<el-form-item label="姓名" prop="name">
<el-input v-model="historyQueryParams.name" placeholder="请输入姓名" clearable @keyup.enter="handleHistoryQuery" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="身份证号" prop="idNumber">
<el-input v-model="historyQueryParams.idNumber" placeholder="请输入身份证号" clearable @keyup.enter="handleHistoryQuery" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="工作部门" prop="department">
<el-input v-model="historyQueryParams.department" placeholder="请输入工作部门" clearable @keyup.enter="handleHistoryQuery" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="审批状态" prop="status">
<el-select v-model="historyQueryParams.status" placeholder="请选择审批状态" clearable style="width: 100%">
<el-option label="已通过" value="2" />
<el-option label="已拒绝" value="3" />
</el-select>
</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="handleHistoryQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetHistoryQuery">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</div>
</transition>
<!-- 操作按钮和表格 -->
<el-card shadow="never" class="button-card table-card">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar v-model:showSearch="showHistorySearch" @queryTable="getHistoryList"></right-toolbar>
</el-row>
</template>
<!-- 数据表格 -->
<el-table
v-loading="historyLoading"
border
:data="historyList"
@row-dblclick="handleViewHistory"
>
<el-table-column label="序号" type="index" width="60" align="center">
<template #default="scope">
{{ (historyQueryParams.pageNum - 1) * historyQueryParams.pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="name" width="100" :show-overflow-tooltip="true" />
<el-table-column label="性别" align="center" width="80">
<template #default="scope">{{ scope.row.gender === '0' ? '男' : '女' }}</template>
</el-table-column>
<el-table-column label="身份证号" align="center" prop="idNumber" width="180" :show-overflow-tooltip="true" />
<el-table-column label="工作部门" align="center" prop="department" min-width="150" :show-overflow-tooltip="true" />
<el-table-column label="职务职称" align="center" prop="position" width="120" :show-overflow-tooltip="true" />
<el-table-column label="政治面貌" align="center" prop="politicalStatus" width="120" :show-overflow-tooltip="true" />
<el-table-column label="审批状态" align="center" prop="statusText" width="120">
<template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status)">{{ scope.row.statusText }}</el-tag>
</template>
</el-table-column>
<el-table-column label="审批时间" align="center" prop="updateTime" width="160" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="200" fixed="right">
<template #default="scope">
<el-tooltip content="查看详情" placement="top">
<el-button link type="primary" icon="View" @click="handleViewHistory(scope.row)" v-hasPermi="['rs:registration:query']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="historyTotal > 0"
:total="historyTotal"
v-model:page="historyQueryParams.pageNum"
v-model:limit="historyQueryParams.pageSize"
@pagination="getHistoryList"
/>
</el-card>
</div>
</el-tab-pane>
</el-tabs>
</el-card>
<!-- 查看详情弹窗 -->
<el-dialog title="出国登记审批详情" v-model="viewDialog.visible" width="900px" :close-on-click-modal="false" destroy-on-close>
<div class="detail-content" v-loading="viewDialog.loading">
<div class="detail-section">
<h4 class="section-title">基本信息</h4>
<el-descriptions :column="2" border>
<el-descriptions-item label="姓名">{{ viewData.name }}</el-descriptions-item>
<el-descriptions-item label="性别">{{ viewData.gender === '0' ? '男' : '女' }}</el-descriptions-item>
<el-descriptions-item label="出生日期">{{ formatDate(viewData.birthDate) }}</el-descriptions-item>
<el-descriptions-item label="身份证号">{{ viewData.idNumber }}</el-descriptions-item>
<el-descriptions-item label="政治面貌">{{ viewData.politicalStatus }}</el-descriptions-item>
<el-descriptions-item label="户籍所在地" :span="2">{{ viewData.registeredAddress }}</el-descriptions-item>
</el-descriptions>
</div>
<div class="detail-section">
<h4 class="section-title">工作信息</h4>
<el-descriptions :column="2" border>
<el-descriptions-item label="工作部门">{{ viewData.department }}</el-descriptions-item>
<el-descriptions-item label="职务职称">{{ viewData.position }}</el-descriptions-item>
<el-descriptions-item label="行政职级">{{ viewData.administrativeLevel || '无' }}</el-descriptions-item>
<el-descriptions-item label="人员类别代码">{{ viewData.personnelCategory || '无' }}</el-descriptions-item>
<el-descriptions-item label="办公电话">{{ viewData.officePhone || '无' }}</el-descriptions-item>
<el-descriptions-item label="移动电话">{{ viewData.mobilePhone || '无' }}</el-descriptions-item>
</el-descriptions>
</div>
<div class="detail-section">
<h4 class="section-title">审批信息</h4>
<el-descriptions :column="2" border>
<el-descriptions-item label="审批状态">
<el-tag :type="getStatusTagType(viewData.status)">{{ viewData.statusText }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="提交时间">{{ viewData.createTime }}</el-descriptions-item>
<el-descriptions-item label="更新时间">{{ viewData.updateTime }}</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">{{ viewData.remarks || '无' }}</el-descriptions-item>
</el-descriptions>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="viewDialog.visible = false">关 闭</el-button>
<!-- 待审批状态下显示审批按钮 -->
<template v-if="viewData.status === '1'">
<el-button type="success" icon="Check" @click="handleApproveInDialog" v-hasPermi="['rs:registration:approve']">
审批通过
</el-button>
<el-button type="danger" icon="Close" @click="handleRejectInDialog" v-hasPermi="['rs:registration:reject']">
审批拒绝
</el-button>
</template>
</div>
</template>
</el-dialog>
<!-- 审批通过弹窗 -->
<el-dialog title="审批通过" v-model="approveDialog.visible" width="500px" :close-on-click-modal="false" destroy-on-close>
<el-form ref="approveFormRef" :model="approveForm" label-width="100px">
<el-form-item label="审批意见">
<el-input
v-model="approveForm.approveNotes"
type="textarea"
:rows="4"
placeholder="请输入审批意见(非必填)"
maxlength="500"
show-word-limit
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="approveDialog.visible = false">取 消</el-button>
<el-button type="success" @click="submitApprove" :loading="approveDialog.loading">确认通过</el-button>
</div>
</template>
</el-dialog>
<!-- 审批拒绝弹窗 -->
<el-dialog title="审批拒绝" v-model="rejectDialog.visible" width="500px" :close-on-click-modal="false" destroy-on-close>
<el-form ref="rejectFormRef" :model="rejectForm" :rules="rejectRules" label-width="100px">
<el-form-item label="拒绝理由" prop="rejectReason">
<el-input
v-model="rejectForm.rejectReason"
type="textarea"
:rows="4"
placeholder="请输入拒绝理由(必填)"
maxlength="500"
show-word-limit
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="rejectDialog.visible = false">取 消</el-button>
<el-button type="danger" @click="submitReject" :loading="rejectDialog.loading">确认拒绝</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import type { FormInstance } from 'element-plus';
import {
getOverseasRegistrationList,
getOverseasRegistration,
approveOverseasRegistration,
rejectOverseasRegistration,
type OverseasRegistrationQuery,
type OverseasRegistrationVO
} from '@/api/rs/overseas-registration';
// 动画配置
const animate = {
searchAnimate: {
enter: 'animate__animated animate__fadeInDown',
leave: 'animate__animated animate__fadeOutUp'
}
};
// 选项卡
const activeTab = ref('pending');
// 待审批查询相关
const showSearch = ref(true);
const loading = ref(false);
const registrationList = ref<OverseasRegistrationVO[]>([]);
const total = ref(0);
const queryParams = ref<OverseasRegistrationQuery>({
pageNum: 1,
pageSize: 10,
name: '',
idNumber: '',
department: '',
status: '1' // 默认查询待审批状态
});
const queryFormRef = ref<FormInstance>();
// 审批记录查询相关
const showHistorySearch = ref(true);
const historyLoading = ref(false);
const historyList = ref<OverseasRegistrationVO[]>([]);
const historyTotal = ref(0);
const historyQueryParams = ref<OverseasRegistrationQuery>({
pageNum: 1,
pageSize: 10,
name: '',
idNumber: '',
department: '',
status: '' // 不设置默认值,可查询已通过和已拒绝
});
const historyQueryFormRef = ref<FormInstance>();
// 查看详情
const viewDialog = reactive({
visible: false,
loading: false
});
const viewData = ref<any>({});
// 审批通过表单
const approveDialog = reactive({
visible: false,
loading: false
});
const approveFormRef = ref<FormInstance>();
const approveForm = ref({
registrationId: '' as number | string | undefined,
approveNotes: ''
});
// 审批拒绝表单
const rejectDialog = reactive({
visible: false,
loading: false
});
const rejectFormRef = ref<FormInstance>();
const rejectForm = ref({
registrationId: '' as number | string | undefined,
rejectReason: ''
});
const rejectRules = {
rejectReason: [{ required: true, message: '请输入拒绝理由', trigger: 'blur' }]
};
// 工具方法
const formatDate = (date: string) => {
if (!date) return '';
return new Date(date).toLocaleDateString('zh-CN');
};
const getStatusTagType = (status: string): 'success' | 'warning' | 'info' | 'primary' | 'danger' => {
const tagTypes: Record<string, 'success' | 'warning' | 'info' | 'primary' | 'danger'> = {
'0': 'info', // 草稿
'1': 'warning', // 待审批
'2': 'success', // 已通过
'3': 'danger' // 已拒绝
};
return tagTypes[status] || 'info';
};
// 查询列表
const getList = async () => {
loading.value = true;
try {
const response = await getOverseasRegistrationList(queryParams.value);
registrationList.value = response.rows;
total.value = response.total;
} catch (error) {
ElMessage.error('获取审批列表失败');
} finally {
loading.value = false;
}
};
// 搜索
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
// 重置
const resetQuery = () => {
queryParams.value = {
pageNum: 1,
pageSize: 10,
name: '',
idNumber: '',
department: '',
status: '1' // 默认查询待审批状态
};
queryFormRef.value?.resetFields();
getList();
};
// 查看详情
const handleView = async (row: OverseasRegistrationVO) => {
viewDialog.loading = true;
viewDialog.visible = true;
try {
const response = await getOverseasRegistration(row.registrationId);
viewData.value = response.data;
} catch (error) {
ElMessage.error('获取详情失败');
viewDialog.visible = false;
} finally {
viewDialog.loading = false;
}
};
// 审批通过
const handleApprove = (row: OverseasRegistrationVO) => {
approveForm.value = {
registrationId: row.registrationId,
approveNotes: ''
};
approveDialog.visible = true;
};
// 在详情弹窗中审批通过
const handleApproveInDialog = () => {
viewDialog.visible = false;
approveForm.value = {
registrationId: viewData.value.registrationId,
approveNotes: ''
};
approveDialog.visible = true;
};
// 提交审批通过
const submitApprove = async () => {
approveDialog.loading = true;
try {
await approveOverseasRegistration(approveForm.value.registrationId!, {
approveNotes: approveForm.value.approveNotes
});
ElMessage.success('审批通过成功');
approveDialog.visible = false;
// 刷新当前选项卡数据
if (activeTab.value === 'pending') {
getList();
} else if (activeTab.value === 'history') {
getHistoryList();
}
} catch (error) {
ElMessage.error('审批通过失败');
} finally {
approveDialog.loading = false;
}
};
// 审批拒绝
const handleReject = (row: OverseasRegistrationVO) => {
rejectForm.value = {
registrationId: row.registrationId,
rejectReason: ''
};
rejectDialog.visible = true;
};
// 在详情弹窗中审批拒绝
const handleRejectInDialog = () => {
viewDialog.visible = false;
rejectForm.value = {
registrationId: viewData.value.registrationId,
rejectReason: ''
};
rejectDialog.visible = true;
};
// 提交审批拒绝
const submitReject = () => {
rejectFormRef.value?.validate(async valid => {
if (valid) {
rejectDialog.loading = true;
try {
await rejectOverseasRegistration(rejectForm.value.registrationId!, {
rejectReason: rejectForm.value.rejectReason
});
ElMessage.success('审批拒绝成功');
rejectDialog.visible = false;
// 刷新当前选项卡数据
if (activeTab.value === 'pending') {
getList();
} else if (activeTab.value === 'history') {
getHistoryList();
}
} catch (error) {
ElMessage.error('审批拒绝失败');
} finally {
rejectDialog.loading = false;
}
}
});
};
// 选项卡切换
const handleTabChange = (tabName: string) => {
if (tabName === 'pending') {
getList();
} else if (tabName === 'history') {
getHistoryList();
}
};
// 审批记录列表查询
const getHistoryList = async () => {
historyLoading.value = true;
try {
// 构建查询参数,只查询已通过(2)和已拒绝(3)的数据
const params = { ...historyQueryParams.value };
// 如果没有指定状态,默认查询已通过和已拒绝的数据
if (!params.status) {
// 这里需要后端支持多状态查询,暂时不设置,让后端返回所有非待审批状态
// 或者分两次查询然后合并
}
const response = await getOverseasRegistrationList(params);
// 过滤出已通过和已拒绝的数据
historyList.value = response.rows.filter((item: OverseasRegistrationVO) =>
item.status === '2' || item.status === '3'
);
historyTotal.value = historyList.value.length;
} catch (error) {
ElMessage.error('获取审批记录失败');
} finally {
historyLoading.value = false;
}
};
// 审批记录搜索
const handleHistoryQuery = () => {
historyQueryParams.value.pageNum = 1;
getHistoryList();
};
// 审批记录重置
const resetHistoryQuery = () => {
historyQueryParams.value = {
pageNum: 1,
pageSize: 10,
name: '',
idNumber: '',
department: '',
status: ''
};
historyQueryFormRef.value?.resetFields();
getHistoryList();
};
// 查看审批记录详情
const handleViewHistory = async (row: OverseasRegistrationVO) => {
viewDialog.loading = true;
viewDialog.visible = true;
try {
const response = await getOverseasRegistration(row.registrationId);
viewData.value = response.data;
} catch (error) {
ElMessage.error('获取详情失败');
viewDialog.visible = false;
} finally {
viewDialog.loading = false;
}
};
// 生命周期
onMounted(() => {
getList();
});
</script>
<style scoped>
/* 页面容器基础样式 */
.app-container {
padding: 20px;
margin: 0;
width: 100%;
box-sizing: border-box;
}
/* 卡片样式 */
.box-card {
margin-bottom: 20px;
}
/* 选项卡内容区域 */
.tab-content {
padding: 0;
}
/* 搜索按钮容器 */
.search-btn-container {
display: flex;
justify-content: flex-end;
margin-top: 10px;
}
.search-btn-container :deep(.el-form-item) {
margin-bottom: 0 !important;
}
/* 表格卡片样式 */
.table-card {
margin-top: 10px;
}
.button-card {
border: none;
}
/* 详情内容样式 */
.detail-content {
max-height: 600px;
overflow-y: auto;
}
.detail-section {
margin-bottom: 20px;
}
.detail-section:last-child {
margin-bottom: 0;
}
.section-title {
margin: 0 0 15px 0;
padding-bottom: 8px;
border-bottom: 1px solid #e4e7ed;
color: #303133;
font-size: 14px;
font-weight: 500;
}
.dialog-footer {
display: flex;
justify-content: flex-end;
gap: 10px;
}
:deep(.el-descriptions__label) {
font-weight: 500;
}
:deep(.el-table .cell) {
padding: 8px 0;
}
.mt-4 {
margin-top: 1rem;
}
</style>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,521 @@
<template>
<div class="app-container">
<el-card class="box-card">
<!-- 审批管理选项卡 -->
<el-tabs v-model="activeTab" type="border-card" @tab-click="handleTabClick">
<!-- 待审批 -->
<el-tab-pane label="待审批变更" name="pending">
<div class="tab-content">
<!-- 搜索区域 -->
<transition :enter-active-class="animate.searchAnimate.enter" :leave-active-class="animate.searchAnimate.leave">
<div v-show="showPendingSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="pendingQueryFormRef" :model="pendingQueryParams" label-width="100px">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="申请人" prop="applicantName">
<el-input v-model="pendingQueryParams.applicantName" placeholder="请输入申请人姓名" clearable />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="目的地国家" prop="destination">
<el-input v-model="pendingQueryParams.destination" placeholder="请输入目的地国家" clearable />
</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="handlePendingQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetPendingQuery">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</div>
</transition>
<!-- 操作按钮区域 -->
<el-card shadow="never" class="button-card table-card">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar v-model:showSearch="showPendingSearch" @queryTable="getPendingList"></right-toolbar>
</el-row>
</template>
<!-- 待审批列表 -->
<el-table v-loading="pendingLoading" border :data="pendingList" @row-dblclick="handleView">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="申请人" align="center" prop="applicantName" min-width="100" />
<el-table-column label="部门" align="center" prop="department" min-width="120" />
<el-table-column label="原目的地" align="center" prop="originalDestination" min-width="120" />
<el-table-column label="新目的地" align="center" prop="newDestination" min-width="120" />
<el-table-column label="变更类型" align="center" prop="changeType" min-width="150" />
<el-table-column label="原出国时间" align="center" min-width="200">
<template #default="scope">
{{ formatDate(scope.row.originalStartDate) }} 至 {{ formatDate(scope.row.originalEndDate) }}
</template>
</el-table-column>
<el-table-column label="新出国时间" align="center" min-width="200">
<template #default="scope">
{{ formatDate(scope.row.newStartDate) }} 至 {{ formatDate(scope.row.newEndDate) }}
</template>
</el-table-column>
<el-table-column label="申请时间" align="center" prop="createTime" min-width="160" />
<el-table-column label="操作" align="center" width="200" fixed="right">
<template #default="scope">
<el-tooltip content="查看详情" placement="top">
<el-button link type="primary" icon="View" @click="handleView(scope.row)" v-hasPermi="['rs:itineraryChange:query']"></el-button>
</el-tooltip>
<el-tooltip content="通过" placement="top">
<el-button link type="success" icon="Check" @click="handleApprovalPass(scope.row)" v-hasPermi="['rs:itineraryChange:approve']"></el-button>
</el-tooltip>
<el-tooltip content="拒绝" placement="top">
<el-button link type="danger" icon="Close" @click="handleApprovalReject(scope.row)" v-hasPermi="['rs:itineraryChange:approve']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="pendingTotal > 0"
:total="pendingTotal"
v-model:page="pendingQueryParams.pageNum"
v-model:limit="pendingQueryParams.pageSize"
@pagination="getPendingList"
/>
</el-card>
</div>
</el-tab-pane>
<!-- 审批记录 -->
<el-tab-pane label="审批记录" name="record">
<div class="tab-content">
<!-- 搜索区域 -->
<transition :enter-active-class="animate.searchAnimate.enter" :leave-active-class="animate.searchAnimate.leave">
<div v-show="showRecordSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="recordQueryFormRef" :model="recordQueryParams" label-width="100px">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="申请人" prop="applicantName">
<el-input v-model="recordQueryParams.applicantName" placeholder="请输入申请人姓名" clearable />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="目的地国家" prop="destination">
<el-input v-model="recordQueryParams.destination" placeholder="请输入目的地国家" clearable />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="审批状态" prop="status">
<el-select v-model="recordQueryParams.status" placeholder="请选择审批状态" clearable style="width: 100%">
<el-option label="已通过" value="1" />
<el-option label="已拒绝" value="2" />
</el-select>
</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="handleRecordQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetRecordQuery">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</div>
</transition>
<!-- 操作按钮区域 -->
<el-card shadow="never" class="button-card table-card">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar v-model:showSearch="showRecordSearch" @queryTable="getRecordList"></right-toolbar>
</el-row>
</template>
<!-- 审批记录列表 -->
<el-table v-loading="recordLoading" border :data="recordList" @row-dblclick="handleView">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="申请人" align="center" prop="applicantName" min-width="100" />
<el-table-column label="部门" align="center" prop="department" min-width="120" />
<el-table-column label="原目的地" align="center" prop="originalDestination" min-width="120" />
<el-table-column label="新目的地" align="center" prop="newDestination" min-width="120" />
<el-table-column label="变更类型" align="center" prop="changeType" min-width="150" />
<el-table-column label="审批状态" align="center" prop="statusText" min-width="100">
<template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status)">{{ scope.row.statusText }}</el-tag>
</template>
</el-table-column>
<el-table-column label="审批时间" align="center" prop="approvalTime" min-width="160" />
<el-table-column label="审批人" align="center" prop="approvalByName" min-width="100" />
<el-table-column label="操作" align="center" width="80" fixed="right">
<template #default="scope">
<el-tooltip content="查看详情" placement="top">
<el-button link type="primary" icon="View" @click="handleView(scope.row)" v-hasPermi="['rs:itineraryChange:query']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="recordTotal > 0"
:total="recordTotal"
v-model:page="recordQueryParams.pageNum"
v-model:limit="recordQueryParams.pageSize"
@pagination="getRecordList"
/>
</el-card>
</div>
</el-tab-pane>
</el-tabs>
</el-card>
<!-- 查看详情对话框 -->
<el-dialog title="变更行程详情" v-model="viewDialog.visible" width="900px" append-to-body>
<el-descriptions :column="2" border v-if="viewData">
<!-- 基本信息 -->
<el-descriptions-item label="申请人">{{ viewData.applicantName || '-' }}</el-descriptions-item>
<el-descriptions-item label="部门">{{ viewData.department || '-' }}</el-descriptions-item>
<!-- 原申请信息 -->
<el-descriptions-item label="原目的地">{{ viewData.originalDestination || '-' }}</el-descriptions-item>
<el-descriptions-item label="原出境事由">{{ viewData.originalExitReason || '-' }}</el-descriptions-item>
<el-descriptions-item label="原出发日期">{{ formatDate(viewData.originalStartDate) }}</el-descriptions-item>
<el-descriptions-item label="原返回日期">{{ formatDate(viewData.originalEndDate) }}</el-descriptions-item>
<el-descriptions-item label="原出国天数" :span="2">{{ viewData.originalDuration || 0 }}天</el-descriptions-item>
<!-- 变更信息 -->
<el-descriptions-item label="变更类型" :span="2">{{ viewData.changeType || '-' }}</el-descriptions-item>
<el-descriptions-item label="新目的地" v-if="viewData.newDestination">{{ viewData.newDestination }}</el-descriptions-item>
<el-descriptions-item label="新出境事由" v-if="viewData.newExitReason">{{ viewData.newExitReason }}</el-descriptions-item>
<el-descriptions-item label="新出发日期" v-if="viewData.newStartDate">{{ formatDate(viewData.newStartDate) }}</el-descriptions-item>
<el-descriptions-item label="新返回日期" v-if="viewData.newEndDate">{{ formatDate(viewData.newEndDate) }}</el-descriptions-item>
<el-descriptions-item label="新出国天数" v-if="viewData.newDuration" :span="2">{{ viewData.newDuration }}天</el-descriptions-item>
<el-descriptions-item label="新行程安排" :span="2" v-if="viewData.newItinerary">{{ viewData.newItinerary }}</el-descriptions-item>
<el-descriptions-item label="变更原因" :span="2">{{ viewData.changeReason || '-' }}</el-descriptions-item>
<el-descriptions-item label="备注" :span="2" v-if="viewData.remark">{{ viewData.remark }}</el-descriptions-item>
<!-- 审批信息 -->
<el-descriptions-item label="变更状态">
<el-tag :type="getStatusTagType(viewData.status)">{{ viewData.statusText }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="申请时间">{{ viewData.createTime || '-' }}</el-descriptions-item>
<el-descriptions-item label="审批人" v-if="viewData.approvalByName">{{ viewData.approvalByName }}</el-descriptions-item>
<el-descriptions-item label="审批时间" v-if="viewData.approvalTime">{{ viewData.approvalTime }}</el-descriptions-item>
<el-descriptions-item label="审批意见" :span="2" v-if="viewData.approvalOpinion">{{ viewData.approvalOpinion }}</el-descriptions-item>
</el-descriptions>
<template #footer>
<div class="dialog-footer">
<el-button @click="viewDialog.visible = false">关闭</el-button>
</div>
</template>
</el-dialog>
<!-- 审批对话框 -->
<el-dialog :title="approvalDialog.title" v-model="approvalDialog.visible" width="600px" append-to-body :close-on-click-modal="false">
<el-form ref="approvalFormRef" :model="approvalForm" :rules="approvalRules" label-width="100px">
<el-form-item label="审批结果" prop="approved">
<el-radio-group v-model="approvalForm.approved">
<el-radio :label="true">通过</el-radio>
<el-radio :label="false">拒绝</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="审批意见" prop="opinion">
<el-input
v-model="approvalForm.opinion"
type="textarea"
:rows="4"
placeholder="请输入审批意见"
maxlength="500"
show-word-limit
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" :loading="approvalLoading" @click="submitApproval">确 定</el-button>
<el-button @click="approvalDialog.visible = false">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts" name="ItineraryChangeApproval">
import { ref, reactive, toRefs, onMounted } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import animate from '@/animate';
import { parseTime } from '@/utils/ruoyi';
import {
listPendingItineraryChange,
listItineraryChange,
getItineraryChange,
approveItineraryChange,
type ItineraryChangeQuery,
type ItineraryChangeVO,
type ItineraryChangeApprovalRequest
} from '@/api/rs/overseas';
// ==================== 响应式数据 ====================
const pendingQueryFormRef = ref();
const recordQueryFormRef = ref();
const approvalFormRef = ref();
const state = reactive({
// Tab切换
activeTab: 'pending',
// 待审批列表
pendingLoading: false,
showPendingSearch: true,
pendingTotal: 0,
pendingList: [] as ItineraryChangeVO[],
pendingQueryParams: {
pageNum: 1,
pageSize: 10,
applicantName: '',
destination: ''
} as ItineraryChangeQuery,
// 审批记录列表
recordLoading: false,
showRecordSearch: true,
recordTotal: 0,
recordList: [] as ItineraryChangeVO[],
recordQueryParams: {
pageNum: 1,
pageSize: 10,
applicantName: '',
destination: '',
status: ''
} as ItineraryChangeQuery,
// 对话框
viewDialog: {
visible: false
},
approvalDialog: {
visible: false,
title: ''
},
// 表单数据
viewData: null as ItineraryChangeVO | null,
approvalForm: {
changeId: 0,
approved: true, // true=通过,false=拒绝
opinion: ''
} as ItineraryChangeApprovalRequest,
approvalLoading: false,
// 表单验证规则
approvalRules: {
approved: [{ required: true, message: '请选择审批结果', trigger: 'change' }]
}
});
const {
activeTab,
pendingLoading,
showPendingSearch,
pendingTotal,
pendingList,
pendingQueryParams,
recordLoading,
showRecordSearch,
recordTotal,
recordList,
recordQueryParams,
viewDialog,
approvalDialog,
viewData,
approvalForm,
approvalLoading,
approvalRules
} = toRefs(state);
// ==================== 生命周期 ====================
onMounted(() => {
handleTabClick({ props: { name: 'pending' } });
});
// ==================== 方法 ====================
// Tab切换
const handleTabClick = (tab: any) => {
const tabName = tab.props?.name || tab.paneName;
state.activeTab = tabName;
if (tabName === 'pending') {
getPendingList();
} else if (tabName === 'record') {
getRecordList();
}
};
// 查询待审批列表
const getPendingList = async () => {
state.pendingLoading = true;
try {
const response = await listPendingItineraryChange(state.pendingQueryParams);
state.pendingList = response.rows;
state.pendingTotal = response.total;
} catch (error) {
console.error('获取待审批列表失败:', error);
} finally {
state.pendingLoading = false;
}
};
// 查询审批记录列表
const getRecordList = async () => {
state.recordLoading = true;
try {
// 查询已审批的记录(状态为1或2)
const params = { ...state.recordQueryParams };
if (!params.status) {
// 如果没有指定状态,默认查询已通过和已拒绝的
params.status = '1,2';
}
const response = await listItineraryChange(params);
state.recordList = response.rows;
state.recordTotal = response.total;
} catch (error) {
console.error('获取审批记录列表失败:', error);
} finally {
state.recordLoading = false;
}
};
// 搜索查询 - 待审批列表
const handlePendingQuery = () => {
state.pendingQueryParams.pageNum = 1;
getPendingList();
};
// 重置搜索 - 待审批列表
const resetPendingQuery = () => {
pendingQueryFormRef.value?.resetFields();
handlePendingQuery();
};
// 搜索查询 - 审批记录
const handleRecordQuery = () => {
state.recordQueryParams.pageNum = 1;
getRecordList();
};
// 重置搜索 - 审批记录
const resetRecordQuery = () => {
recordQueryFormRef.value?.resetFields();
handleRecordQuery();
};
// 查看详情
const handleView = async (row: ItineraryChangeVO) => {
try {
const response = await getItineraryChange(row.changeId);
state.viewData = response.data;
state.viewDialog.visible = true;
} catch (error) {
console.error('获取详情失败:', error);
ElMessage.error('获取详情失败');
}
};
// 审批通过
const handleApprovalPass = (row: ItineraryChangeVO) => {
state.approvalForm.changeId = row.changeId as number;
state.approvalForm.approved = true;
state.approvalForm.opinion = '';
state.approvalDialog.title = '审批通过';
state.approvalDialog.visible = true;
};
// 审批拒绝
const handleApprovalReject = (row: ItineraryChangeVO) => {
state.approvalForm.changeId = row.changeId as number;
state.approvalForm.approved = false;
state.approvalForm.opinion = '';
state.approvalDialog.title = '审批拒绝';
state.approvalDialog.visible = true;
};
// 提交审批
const submitApproval = () => {
approvalFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
state.approvalLoading = true;
try {
await approveItineraryChange(state.approvalForm);
ElMessage.success('审批成功');
state.approvalDialog.visible = false;
// 刷新两个列表(审批后需要同时更新待审批和审批记录列表)
await getPendingList();
await getRecordList();
} catch (error) {
console.error('审批失败:', error);
ElMessage.error('审批失败');
} finally {
state.approvalLoading = false;
}
}
});
};
// 格式化日期
const formatDate = (date: string | undefined) => {
if (!date) return '-';
return parseTime(date, '{y}-{m}-{d}');
};
// 获取状态标签类型
const getStatusTagType = (status: string): 'primary' | 'success' | 'info' | 'warning' | 'danger' => {
const typeMap: Record<string, 'primary' | 'success' | 'info' | 'warning' | 'danger'> = {
'0': 'warning', // 待审核
'1': 'success', // 已通过
'2': 'danger' // 已拒绝
};
return typeMap[status] || 'info';
};
</script>
<style scoped>
.search-btn-container {
display: flex;
justify-content: flex-end;
margin-top: 10px;
}
.search-btn-container :deep(.el-form-item) {
margin-bottom: 0 !important;
}
.button-card {
margin-top: 10px;
}
.table-card {
margin-bottom: 10px;
}
.tab-content {
min-height: 400px;
}
</style>
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,781 @@
<template>
<div class="app-container">
<el-card class="box-card">
<!-- 选项卡 -->
<el-tabs v-model="activeTab" type="border-card" @tab-change="handleTabChange">
<!-- 党籍保留审批选项卡 -->
<el-tab-pane label="党籍保留审批" name="pending">
<div class="tab-content">
<!-- 搜索区域 -->
<transition :enter-active-class="animate.searchAnimate.enter" :leave-active-class="animate.searchAnimate.leave">
<div 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="5">
<el-form-item label="姓名" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入姓名" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="身份证号" prop="idNumber">
<el-input v-model="queryParams.idNumber" placeholder="请输入身份证号" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="工作部门" prop="department">
<el-input v-model="queryParams.department" placeholder="请输入工作部门" clearable @keyup.enter="handleQuery" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="目的地" prop="destination">
<el-input v-model="queryParams.destination" 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="button-card table-card">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<!-- 数据表格 -->
<el-table v-loading="loading" border :data="retentionList" @row-dblclick="handleView">
<el-table-column label="序号" type="index" width="60" align="center">
<template #default="scope">
{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="name" width="100" :show-overflow-tooltip="true" />
<el-table-column label="身份证号" align="center" prop="idCard" width="180" :show-overflow-tooltip="true" />
<el-table-column label="出国时间" align="center" min-width="220" :show-overflow-tooltip="true">
<template #default="scope">
<span v-if="scope.row.travelStartDate && scope.row.travelEndDate">
{{ scope.row.travelStartDate }} 至 {{ scope.row.travelEndDate }}
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="停留天数" align="center" width="100" :show-overflow-tooltip="true">
<template #default="scope">
<span v-if="scope.row.stayDays">{{ scope.row.stayDays }} 天</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="目的地" align="center" prop="destination" width="120" :show-overflow-tooltip="true" />
<el-table-column label="党支部" align="center" prop="partyBranch" width="150" :show-overflow-tooltip="true" />
<el-table-column label="申请状态" align="center" width="100" :show-overflow-tooltip="true">
<template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status)">{{ scope.row.statusText }}</el-tag>
</template>
</el-table-column>
<el-table-column label="申请时间" align="center" prop="applicationTime" width="160" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="280" fixed="right">
<template #default="scope">
<el-tooltip content="查看详情" placement="top">
<el-button
link
type="primary"
icon="View"
@click="handleView(scope.row)"
v-hasPermi="['rs:partyretention:query']"
></el-button>
</el-tooltip>
<el-tooltip content="审批通过" placement="top">
<el-button
link
type="success"
icon="Check"
@click="handleApprove(scope.row)"
v-hasPermi="['rs:partyretention:approve']"
></el-button>
</el-tooltip>
<el-tooltip content="审批拒绝" placement="top">
<el-button
link
type="danger"
icon="Close"
@click="handleReject(scope.row)"
v-hasPermi="['rs:partyretention:approve']"
></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
</div>
</el-tab-pane>
<!-- 审批记录选项卡 -->
<el-tab-pane label="审批记录" name="history">
<div class="tab-content">
<!-- 搜索区域 -->
<transition :enter-active-class="animate.searchAnimate.enter" :leave-active-class="animate.searchAnimate.leave">
<div v-show="showHistorySearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="historyQueryFormRef" :model="historyQueryParams" label-width="100px">
<el-row :gutter="20">
<el-col :span="5">
<el-form-item label="姓名" prop="name">
<el-input v-model="historyQueryParams.name" placeholder="请输入姓名" clearable @keyup.enter="handleHistoryQuery" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="身份证号" prop="idNumber">
<el-input v-model="historyQueryParams.idNumber" placeholder="请输入身份证号" clearable @keyup.enter="handleHistoryQuery" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="工作部门" prop="department">
<el-input v-model="historyQueryParams.department" placeholder="请输入工作部门" clearable @keyup.enter="handleHistoryQuery" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="审批状态" prop="status">
<el-select v-model="historyQueryParams.status" placeholder="请选择审批状态" clearable style="width: 100%">
<el-option label="已通过" value="2" />
<el-option label="已拒绝" value="3" />
</el-select>
</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="handleHistoryQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetHistoryQuery">重置</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</div>
</transition>
<!-- 操作按钮和表格 -->
<el-card shadow="never" class="button-card table-card">
<template #header>
<el-row :gutter="10" class="mb8">
<right-toolbar v-model:showSearch="showHistorySearch" @queryTable="getHistoryList"></right-toolbar>
</el-row>
</template>
<!-- 数据表格 -->
<el-table v-loading="historyLoading" border :data="historyList" @row-dblclick="handleViewHistory">
<el-table-column label="序号" type="index" width="60" align="center">
<template #default="scope">
{{ (historyQueryParams.pageNum - 1) * historyQueryParams.pageSize + scope.$index + 1 }}
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="name" width="100" :show-overflow-tooltip="true" />
<el-table-column label="身份证号" align="center" prop="idCard" width="180" :show-overflow-tooltip="true" />
<el-table-column label="出国时间" align="center" min-width="220" :show-overflow-tooltip="true">
<template #default="scope">
<span v-if="scope.row.travelStartDate && scope.row.travelEndDate">
{{ scope.row.travelStartDate }} 至 {{ scope.row.travelEndDate }}
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="停留天数" align="center" width="100" :show-overflow-tooltip="true">
<template #default="scope">
<span v-if="scope.row.stayDays">{{ scope.row.stayDays }} 天</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="目的地" align="center" prop="destination" width="120" :show-overflow-tooltip="true" />
<el-table-column label="审批状态" align="center" prop="statusText" width="120">
<template #default="scope">
<el-tag :type="getStatusTagType(scope.row.status)">{{ scope.row.statusText }}</el-tag>
</template>
</el-table-column>
<el-table-column label="审批时间" align="center" prop="updateTime" width="160" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="200" fixed="right">
<template #default="scope">
<el-tooltip content="查看详情" placement="top">
<el-button
link
type="primary"
icon="View"
@click="handleViewHistory(scope.row)"
v-hasPermi="['rs:partyretention:query']"
></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="historyTotal > 0"
:total="historyTotal"
v-model:page="historyQueryParams.pageNum"
v-model:limit="historyQueryParams.pageSize"
@pagination="getHistoryList"
/>
</el-card>
</div>
</el-tab-pane>
</el-tabs>
</el-card>
<!-- 查看详情弹窗 -->
<el-dialog title="党籍保留审批详情" v-model="viewDialog.visible" width="900px" :close-on-click-modal="false" destroy-on-close>
<div class="detail-content" v-loading="viewDialog.loading">
<div class="detail-section">
<h4 class="section-title">申请信息</h4>
<el-descriptions :column="2" border>
<el-descriptions-item label="申请人姓名">{{ viewData.name }}</el-descriptions-item>
<el-descriptions-item label="身份证号">{{ viewData.idCard }}</el-descriptions-item>
<el-descriptions-item label="配偶姓名">{{ viewData.spouse || '无' }}</el-descriptions-item>
<el-descriptions-item label="目的地">{{ viewData.destination }}</el-descriptions-item>
<el-descriptions-item label="出国目的" :span="2">{{ viewData.purpose }}</el-descriptions-item>
<el-descriptions-item label="出国时间" :span="2">
{{ formatDate(viewData.travelStartDate) }} 至 {{ formatDate(viewData.travelEndDate) }}
</el-descriptions-item>
<el-descriptions-item label="停留天数">{{ viewData.stayDays }}天</el-descriptions-item>
<el-descriptions-item label="党支部">{{ viewData.partyBranch }}</el-descriptions-item>
<el-descriptions-item label="职务">{{ viewData.position || '无' }}</el-descriptions-item>
<el-descriptions-item label="亲属姓名">{{ viewData.relativeName || '无' }}</el-descriptions-item>
</el-descriptions>
</div>
<div class="detail-section">
<h4 class="section-title">审批信息</h4>
<el-descriptions :column="2" border>
<el-descriptions-item label="申请状态">
<el-tag :type="getStatusTagType(viewData.status)">{{ viewData.statusText }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="申请时间">{{ viewData.applicationTime }}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ viewData.createTime }}</el-descriptions-item>
<el-descriptions-item label="更新时间">{{ viewData.updateTime }}</el-descriptions-item>
</el-descriptions>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="viewDialog.visible = false">关 闭</el-button>
<!-- 待审批状态下显示审批按钮 -->
<template v-if="viewData.status === '1'">
<el-button type="success" icon="Check" @click="handleApproveInDialog" v-hasPermi="['rs:partyretention:approve']">
审批通过
</el-button>
<el-button type="danger" icon="Close" @click="handleRejectInDialog" v-hasPermi="['rs:partyretention:approve']">
审批拒绝
</el-button>
</template>
</div>
</template>
</el-dialog>
<!-- 审批通过弹窗 -->
<el-dialog title="审批通过" v-model="approveDialog.visible" width="500px" :close-on-click-modal="false" destroy-on-close>
<el-form ref="approveFormRef" :model="approveForm" label-width="100px">
<el-form-item label="审批意见">
<el-input
v-model="approveForm.approvalOpinion"
type="textarea"
:rows="4"
placeholder="请输入审批意见(非必填)"
maxlength="500"
show-word-limit
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="approveDialog.visible = false">取 消</el-button>
<el-button type="success" @click="submitApprove" :loading="approveDialog.loading">确认通过</el-button>
</div>
</template>
</el-dialog>
<!-- 审批拒绝弹窗 -->
<el-dialog title="审批拒绝" v-model="rejectDialog.visible" width="500px" :close-on-click-modal="false" destroy-on-close>
<el-form ref="rejectFormRef" :model="rejectForm" :rules="rejectRules" label-width="100px">
<el-form-item label="拒绝理由" prop="approvalOpinion">
<el-input
v-model="rejectForm.approvalOpinion"
type="textarea"
:rows="4"
placeholder="请输入拒绝理由(必填)"
maxlength="500"
show-word-limit
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="rejectDialog.visible = false">取 消</el-button>
<el-button type="danger" @click="submitReject" :loading="rejectDialog.loading">确认拒绝</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import { ElMessage } from 'element-plus';
import type { FormInstance } from 'element-plus';
import {
getPendingPartyRetentionList,
getPartyRetentionList,
getPartyRetention,
approvePartyRetention,
type PartyRetentionApprovalQuery,
type PartyRetentionVO,
type ApprovalRequest
} from '@/api/rs/party-membership-retention';
// 动画配置
const animate = {
searchAnimate: {
enter: 'animate__animated animate__fadeInDown',
leave: 'animate__animated animate__fadeOutUp'
}
};
// 选项卡
const activeTab = ref('pending');
// 待审批查询相关
const showSearch = ref(true);
const loading = ref(false);
const retentionList = ref<PartyRetentionVO[]>([]);
const total = ref(0);
const queryParams = ref<PartyRetentionApprovalQuery>({
pageNum: 1,
pageSize: 10,
name: '',
idNumber: '',
department: '',
destination: '',
status: '1' // 默认查询待审批状态
});
const queryFormRef = ref<FormInstance>();
// 审批记录查询相关
const showHistorySearch = ref(true);
const historyLoading = ref(false);
const historyList = ref<PartyRetentionVO[]>([]);
const historyTotal = ref(0);
const historyQueryParams = ref<PartyRetentionApprovalQuery>({
pageNum: 1,
pageSize: 10,
name: '',
idNumber: '',
department: '',
destination: '',
status: '' // 不设置默认值,可查询已通过和已拒绝
});
const historyQueryFormRef = ref<FormInstance>();
// 查看详情
const viewDialog = reactive({
visible: false,
loading: false
});
const viewData = ref<any>({});
// 审批通过表单
const approveDialog = reactive({
visible: false,
loading: false
});
const approveFormRef = ref<FormInstance>();
const approveForm = ref<ApprovalRequest>({
retentionId: '',
approvalOpinion: '',
approved: true
});
// 审批拒绝表单
const rejectDialog = reactive({
visible: false,
loading: false
});
const rejectFormRef = ref<FormInstance>();
const rejectForm = ref<ApprovalRequest>({
retentionId: '',
approvalOpinion: '',
approved: false
});
const rejectRules = {
approvalOpinion: [{ required: true, message: '请输入拒绝理由', trigger: 'blur' }]
};
// 工具方法
const formatDate = (date: string) => {
if (!date) return '';
return new Date(date).toLocaleDateString('zh-CN');
};
const getStatusTagType = (status: string): 'success' | 'warning' | 'info' | 'primary' | 'danger' => {
const tagTypes: Record<string, 'success' | 'warning' | 'info' | 'primary' | 'danger'> = {
'0': 'info', // 草稿
'1': 'warning', // 待审批
'2': 'success', // 已通过
'3': 'danger' // 已拒绝
};
return tagTypes[status] || 'info';
};
// 查询列表
const getList = async () => {
loading.value = true;
try {
const response = await getPendingPartyRetentionList(queryParams.value);
retentionList.value = response.rows;
total.value = response.total;
} catch (error) {
ElMessage.error('获取待审批列表失败');
} finally {
loading.value = false;
}
};
// 搜索
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
// 重置
const resetQuery = () => {
queryParams.value = {
pageNum: 1,
pageSize: 10,
name: '',
idNumber: '',
department: '',
destination: '',
status: '1'
};
queryFormRef.value?.resetFields();
getList();
};
// 查看详情
const handleView = async (row: PartyRetentionVO) => {
viewDialog.loading = true;
viewDialog.visible = true;
try {
const response = await getPartyRetention(row.retentionId);
console.log('详情数据:', response.data);
console.log('statusText:', response.data.statusText);
// 如果后端没有返回 statusText,手动计算
if (!response.data.statusText && response.data.status) {
const statusMap: Record<string, string> = {
'0': '草稿',
'1': '待审核',
'2': '已通过',
'3': '已拒绝',
'4': '已撤回'
};
response.data.statusText = statusMap[response.data.status] || '未知状态';
}
viewData.value = response.data;
} catch (error) {
ElMessage.error('获取详情失败');
viewDialog.visible = false;
} finally {
viewDialog.loading = false;
}
};
// 审批通过
const handleApprove = (row: PartyRetentionVO) => {
approveForm.value = {
retentionId: row.retentionId,
approvalOpinion: '',
approved: true
};
approveDialog.visible = true;
};
// 在详情弹窗中审批通过
const handleApproveInDialog = () => {
viewDialog.visible = false;
approveForm.value = {
retentionId: viewData.value.retentionId,
approvalOpinion: '',
approved: true
};
approveDialog.visible = true;
};
// 提交审批通过
const submitApprove = async () => {
approveDialog.loading = true;
try {
console.log('审批请求参数:', approveForm.value);
const response = await approvePartyRetention(approveForm.value);
console.log('审批响应数据:', response);
ElMessage.success('审批通过成功');
approveDialog.visible = false;
// 刷新当前选项卡数据
if (activeTab.value === 'pending') {
getList();
} else if (activeTab.value === 'history') {
getHistoryList();
}
} catch (error) {
console.error('审批通过失败详情:', error);
const errorMsg = (error as any)?.message || (error as any)?.msg || '审批通过失败';
ElMessage.error(errorMsg);
} finally {
approveDialog.loading = false;
}
};
// 审批拒绝
const handleReject = (row: PartyRetentionVO) => {
rejectForm.value = {
retentionId: row.retentionId,
approvalOpinion: '',
approved: false
};
rejectDialog.visible = true;
};
// 在详情弹窗中审批拒绝
const handleRejectInDialog = () => {
viewDialog.visible = false;
rejectForm.value = {
retentionId: viewData.value.retentionId,
approvalOpinion: '',
approved: false
};
rejectDialog.visible = true;
};
// 提交审批拒绝
const submitReject = () => {
rejectFormRef.value?.validate(async valid => {
if (valid) {
rejectDialog.loading = true;
try {
console.log('审批拒绝请求参数:', rejectForm.value);
const response = await approvePartyRetention(rejectForm.value);
console.log('审批拒绝响应数据:', response);
ElMessage.success('审批拒绝成功');
rejectDialog.visible = false;
// 刷新当前选项卡数据
if (activeTab.value === 'pending') {
getList();
} else if (activeTab.value === 'history') {
getHistoryList();
}
} catch (error) {
console.error('审批拒绝失败详情:', error);
const errorMsg = (error as any)?.message || (error as any)?.msg || '审批拒绝失败';
ElMessage.error(errorMsg);
} finally {
rejectDialog.loading = false;
}
}
});
};
// 选项卡切换
const handleTabChange = (tabName: string) => {
if (tabName === 'pending') {
getList();
} else if (tabName === 'history') {
getHistoryList();
}
};
// 审批记录列表查询
const getHistoryList = async () => {
historyLoading.value = true;
try {
// 构建查询参数,查询已通过(2)和已拒绝(3)的数据
const params = { ...historyQueryParams.value };
const response = await getPartyRetentionList(params);
// 过滤出已通过和已拒绝的数据
historyList.value = response.rows.filter((item: PartyRetentionVO) => item.status === '2' || item.status === '3');
historyTotal.value = historyList.value.length;
} catch (error) {
ElMessage.error('获取审批记录失败');
} finally {
historyLoading.value = false;
}
};
// 审批记录搜索
const handleHistoryQuery = () => {
historyQueryParams.value.pageNum = 1;
getHistoryList();
};
// 审批记录重置
const resetHistoryQuery = () => {
historyQueryParams.value = {
pageNum: 1,
pageSize: 10,
name: '',
idNumber: '',
department: '',
destination: '',
status: ''
};
historyQueryFormRef.value?.resetFields();
getHistoryList();
};
// 查看审批记录详情
const handleViewHistory = async (row: PartyRetentionVO) => {
viewDialog.loading = true;
viewDialog.visible = true;
try {
const response = await getPartyRetention(row.retentionId);
console.log('审批记录详情数据:', response.data);
console.log('statusText:', response.data.statusText);
// 如果后端没有返回 statusText,手动计算
if (!response.data.statusText && response.data.status) {
const statusMap: Record<string, string> = {
'0': '草稿',
'1': '待审核',
'2': '已通过',
'3': '已拒绝',
'4': '已撤回'
};
response.data.statusText = statusMap[response.data.status] || '未知状态';
}
viewData.value = response.data;
} catch (error) {
ElMessage.error('获取详情失败');
viewDialog.visible = false;
} finally {
viewDialog.loading = false;
}
};
// 生命周期
onMounted(() => {
getList();
});
</script>
<style scoped>
/* 页面容器基础样式 */
.app-container {
padding: 20px;
margin: 0;
width: 100%;
box-sizing: border-box;
}
/* 卡片样式 */
.box-card {
margin-bottom: 20px;
}
/* 选项卡内容区域 */
.tab-content {
padding: 0;
}
/* 搜索按钮容器 */
.search-btn-container {
display: flex;
justify-content: flex-end;
margin-top: 10px;
}
.search-btn-container :deep(.el-form-item) {
margin-bottom: 0 !important;
}
/* 表格卡片样式 */
.table-card {
margin-top: 10px;
}
.button-card {
border: none;
}
/* 详情内容样式 */
.detail-content {
max-height: 600px;
overflow-y: auto;
}
.detail-section {
margin-bottom: 20px;
}
.detail-section:last-child {
margin-bottom: 0;
}
.section-title {
margin: 0 0 15px 0;
padding-bottom: 8px;
border-bottom: 1px solid #e4e7ed;
color: #303133;
font-size: 14px;
font-weight: 500;
}
.dialog-footer {
display: flex;
justify-content: flex-end;
gap: 10px;
}
:deep(.el-descriptions__label) {
font-weight: 500;
}
:deep(.el-table .cell) {
padding: 8px 0;
}
.mt-4 {
margin-top: 1rem;
}
</style>
File diff suppressed because it is too large. Load diff