Files
tuanwei-admin/src/views/gxmu/YXGQTDGBForm/index.vue
T
weicw 0444846422 feat(declare): 申报记录支持撤回/作废,导入支持跳过与失败清单
- 申报记录详情弹窗新增撤回、作废(强制放行)入口,覆盖 9 个模块
- 申报管理支持配置允许重复提交与最多同时条数
- 批量导入逐行容错,命中重复时跳过并给出失败清单导出
2026-11-02 19:28:56 +08:00

413 lines
10 KiB
Vue

<template>
<div class="page">
<div class="ele-body">
<a-card :bordered="false" :body-style="{ padding: '16px' }">
<ele-pro-table
ref="tableRef"
row-key="id"
:columns="columns"
:datasource="datasource"
:scroll="{ x: 3000 }"
tool-class="ele-toolbar-form"
>
<template #toolbar>
<a-space>
<a-button
class="gxmu-toolbar-btn gxmu-add-btn"
@click="openEdit()"
>
<template #icon>
<plus-outlined />
</template>
<span>{{ props.popup ? '立即申报' : '添加' }}</span>
</a-button>
<a-button
v-if="!props.popup"
class="gxmu-toolbar-btn gxmu-import-btn"
@click="openImport"
>
<template #icon>
<UploadOutlined />
</template>
<span>导入</span>
</a-button>
<a-button
v-if="!props.popup"
class="gxmu-toolbar-btn"
:loading="exporting"
@click="exportData"
>
<template #icon>
<DownloadOutlined />
</template>
<span>导出</span>
</a-button>
<a-input-search
allow-clear
v-model:value="searchText"
placeholder="请输入姓名/所在团组织/联系方式"
@search="reload"
@pressEnter="reload"
/>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'currentReviewStatus'">
<ReviewStatusTag :review-list="record.reviewList" />
</template>
<template v-if="column.key === 'action'">
<a-space>
<a @click="openDetail(record)">详情</a>
<a-divider type="vertical" />
<template v-if="!shouldHideEditByReviewList(record.reviewList)">
<a @click="openEdit(record)">编辑</a>
<a-divider type="vertical" />
</template>
<a @click="openReviewHistory(record)">审核历史</a>
<a-divider type="vertical" />
<a-popconfirm
title="确定要删除此记录吗?"
@confirm="remove(record)"
>
<a class="ele-text-danger">删除</a>
</a-popconfirm>
</a-space>
</template>
</template>
</ele-pro-table>
</a-card>
</div>
<edit-modal
v-model:visible="showEdit"
:data="current"
:fixed-year="props.fixedYear"
@done="reload"
/>
<import-modal v-model:visible="showImport" @done="reload" />
<ModuleDataModal
v-model:visible="showDetail"
:module="REVIEW_MODULE"
module-name="优秀共青团干部"
:pk="detailCurrent?.id"
@done="reload"
/>
<ReviewHistoryModal
v-model:visible="showReviewHistory"
:module="REVIEW_MODULE"
:pk="reviewCurrent?.id"
:review-list="reviewCurrent?.reviewList"
/>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { message } from 'ant-design-vue';
import {
DownloadOutlined,
UploadOutlined,
PlusOutlined
} from '@ant-design/icons-vue';
import EditModal from './components/edit.vue';
import ImportModal from './components/import.vue';
import ReviewHistoryModal from '../components/reviewHistoryModal.vue';
import ModuleDataModal from '../reviewList/components/moduleDataModal.vue';
import ReviewStatusTag from '../components/reviewStatusTag.vue';
import { shouldHideEditByReviewList } from '../utils/review';
import type { EleProTable } from 'ele-admin-pro';
import type {
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import {
exportYxgqtdgbForm,
userPageYxgqtdgbForm,
removeYxgqtdgbForm
} from '@/api/gxmu/yxgqtdgb-form';
import type {
YxgqtdgbForm,
YxgqtdgbFormParam
} from '@/api/gxmu/yxgqtdgb-form/model';
const props = withDefaults(
defineProps<{
popup?: boolean;
fixedYear?: string | number;
}>(),
{
popup: false
}
);
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
const searchText = ref('');
const showEdit = ref(false);
const showImport = ref(false);
const current = ref<YxgqtdgbForm>();
const showDetail = ref(false);
const detailCurrent = ref<YxgqtdgbForm | null>(null);
const REVIEW_MODULE = 'gxmu_yxgqtdgb';
const showReviewHistory = ref(false);
const reviewCurrent = ref<YxgqtdgbForm | null>(null);
const exporting = ref(false);
const columns = ref<ColumnItem[]>([
{
title: '姓名',
dataIndex: 'name',
key: 'name',
align: 'center',
width: 100
},
{
title: '年份',
dataIndex: 'year',
key: 'year',
align: 'center',
width: 100
},
{
title: '性别',
dataIndex: 'gender',
key: 'gender',
align: 'center',
width: 80
},
{
title: '民族',
dataIndex: 'nation',
key: 'nation',
align: 'center',
width: 100
},
{
title: '出生年月',
dataIndex: 'birthMonth',
key: 'birthMonth',
align: 'center',
width: 120
},
{
title: '政治面貌',
dataIndex: 'politics',
key: 'politics',
align: 'center',
width: 120
},
{
title: '职务',
dataIndex: 'position',
key: 'position',
align: 'center',
width: 120
},
{
title: '身份',
dataIndex: 'identity',
key: 'identity',
align: 'center',
width: 120
},
{
title: '所在团组织',
dataIndex: 'organization',
key: 'organization',
align: 'center',
width: 180,
ellipsis: true
},
{
title: '联系方式',
dataIndex: 'contact',
key: 'contact',
align: 'center',
width: 140
},
{
title: '发展团员编号',
dataIndex: 'memberNo',
key: 'memberNo',
align: 'center',
width: 160
},
{
title: '任现团内职务时间',
dataIndex: 'currentDutyTime',
key: 'currentDutyTime',
align: 'center',
width: 160
},
{
title: '担任团干部年限',
dataIndex: 'cadreYears',
key: 'cadreYears',
align: 'center',
width: 140
},
{
title: '上一年度工作考核结果',
dataIndex: 'assessment2024',
key: 'assessment2024',
align: 'center',
width: 180
},
{
title: '成为注册志愿者时间',
dataIndex: 'volunteerRegTime',
key: 'volunteerRegTime',
align: 'center',
width: 180
},
{
title: '从事团干部经历',
dataIndex: 'cadreExperience',
key: 'cadreExperience',
align: 'center',
width: 260,
ellipsis: true
},
{
title: '近五年获得校级及以上荣誉情况',
dataIndex: 'honorsFiveYears',
key: 'honorsFiveYears',
align: 'center',
width: 240,
ellipsis: true
},
{
title: '主要事迹',
dataIndex: 'mainStory',
key: 'mainStory',
align: 'center',
width: 240,
ellipsis: true
},
{
title: '所在单位团组织意见',
dataIndex: 'leagueOpinion',
key: 'leagueOpinion',
align: 'center',
width: 200,
ellipsis: true
},
{
title: '所在单位党组织意见',
dataIndex: 'partyOpinion',
key: 'partyOpinion',
align: 'center',
width: 200,
ellipsis: true
},
{
title: '当前审核状态',
dataIndex: 'reviewList',
key: 'currentReviewStatus',
align: 'center',
width: 140
},
{
title: '操作',
key: 'action',
fixed: 'right',
align: 'center',
width: 220
}
]);
const datasource: DatasourceFunction = ({ page, limit }) => {
return userPageYxgqtdgbForm({
page,
limit,
year: props.fixedYear ? String(props.fixedYear) : undefined,
keywords: searchText.value.trim() || undefined
} as YxgqtdgbFormParam).catch((e) => {
message.error(e.message);
return { list: [], count: 0 };
});
};
const buildQueryParams = (): YxgqtdgbFormParam => {
return {
year: props.fixedYear ? String(props.fixedYear) : undefined,
keywords: searchText.value.trim() || undefined
} as YxgqtdgbFormParam;
};
const reload = () => {
tableRef.value?.reload();
};
const openImport = () => {
showImport.value = true;
};
const resolveExportUrl = (payload: any) => {
return String(
payload?.url || payload?.downloadUrl || payload?.path || ''
);
};
const exportData = async () => {
if (exporting.value) {
return;
}
exporting.value = true;
const hide = message.loading('导出中..', 0);
try {
const result = await exportYxgqtdgbForm(buildQueryParams());
const url = resolveExportUrl(result);
if (!url) {
throw new Error('导出地址缺失');
}
window.open(url, '_blank');
hide();
message.success('导出成功');
} catch (e: any) {
hide();
message.error(e.message || '导出失败');
} finally {
exporting.value = false;
}
};
const openEdit = (record?: YxgqtdgbForm) => {
current.value = record
? (JSON.parse(JSON.stringify(record)) as YxgqtdgbForm)
: undefined;
showEdit.value = true;
};
const openReviewHistory = (record: YxgqtdgbForm) => {
reviewCurrent.value = record;
showReviewHistory.value = true;
};
const openDetail = (record: YxgqtdgbForm) => {
detailCurrent.value = record;
showDetail.value = true;
};
const remove = (record: YxgqtdgbForm) => {
const hide = message.loading('请求中..', 0);
removeYxgqtdgbForm(record.id)
.then((msg) => {
hide();
message.success(msg);
reload();
})
.catch((e) => {
hide();
message.error(e.message);
});
};
</script>
<script lang="ts">
export default {
name: 'YXGQTDGBForm'
};
</script>
<style lang="less" scoped>
@import '../toolbar.less';
</style>