Files
tuanwei-admin/src/views/gxmu/YXGQTDGBForm/components/import.vue
T
2026-07-20 11:50:47 +08:00

94 lines
3.9 KiB
Vue

<template>
<common-import
v-bind="$props"
@done="emit('done')"
@update:visible="emit('update:visible', $event)"
module-name="优秀共青团干部"
file-name="优秀共青团干部导入模板.xlsx"
:template-fields="templateFields"
:sample-row="sampleRow"
:create-payload="createPayload"
:save-item="saveItem"
/>
</template>
<script lang="ts" setup>
import CommonImport from '../../components/common-import.vue';
import { addYxgqtdgbForm } from '@/api/gxmu/yxgqtdgb-form';
import type { YxgqtdgbForm } from '@/api/gxmu/yxgqtdgb-form/model';
defineProps<{ visible: boolean }>();
const emit = defineEmits(['done', 'update:visible']);
const templateFields = [
{ header: '年份', key: 'year', required: true },
{ header: '姓名', key: 'name', required: true },
{ header: '性别', key: 'gender' },
{ header: '民族', key: 'nation' },
{ header: '出生年月', key: 'birthMonth' },
{ header: '政治面貌', key: 'politics' },
{ header: '职务', key: 'position' },
{ header: '身份类别', key: 'identity' },
{ header: '所在团组织', key: 'organization' },
{ header: '联系方式', key: 'contact' },
{ header: '团员编号', key: 'memberNo' },
{ header: '现任职务时间', key: 'currentDutyTime' },
{ header: '从事团的工作年限', key: 'cadreYears' },
{ header: '2024年度考核等次', key: 'assessment2024' },
{ header: '志愿汇注册时间', key: 'volunteerRegTime' },
{ header: '团干部经历', key: 'cadreExperience' },
{ header: '近五年获得校级及以上荣誉情况', key: 'honorsFiveYears' },
{ header: '主要事迹', key: 'mainStory' },
{ header: '二级团组织意见', key: 'leagueOpinion' },
{ header: '二级党组织意见', key: 'partyOpinion' }
] as const;
const sampleRow = {
年份: '2025',
姓名: '王五',
性别: '男',
民族: '汉族',
出生年月: '1999-04',
政治面貌: '中共党员',
职务: '团委副书记',
身份类别: '学生',
所在团组织: '第一临床医学院团委',
联系方式: '13800138000',
团员编号: 'TW2025001',
现任职务时间: '2023-09',
从事团的工作年限: '2',
'2024年度考核等次': '优秀',
志愿汇注册时间: '2021-03',
团干部经历: '连续两年担任学院团学骨干',
近五年获得校级及以上荣誉情况: '校优秀团干部',
主要事迹: '组织多场品牌志愿服务活动',
二级团组织意见: '',
二级党组织意见: ''
};
const createPayload = (row: Record<string, any>): YxgqtdgbForm => ({
year: String(row['年份'] || '').trim(),
name: String(row['姓名'] || '').trim(),
gender: String(row['性别'] || '').trim(),
nation: String(row['民族'] || '').trim(),
birthMonth: String(row['出生年月'] || '').trim(),
politics: String(row['政治面貌'] || '').trim(),
position: String(row['职务'] || '').trim(),
identity: String(row['身份类别'] || '').trim(),
organization: String(row['所在团组织'] || '').trim(),
contact: String(row['联系方式'] || '').trim(),
memberNo: String(row['团员编号'] || '').trim(),
currentDutyTime: String(row['现任职务时间'] || '').trim(),
cadreYears: String(row['从事团的工作年限'] || '').trim(),
assessment2024: String(row['2024年度考核等次'] || '').trim(),
volunteerRegTime: String(row['志愿汇注册时间'] || '').trim(),
cadreExperience: String(row['团干部经历'] || '').trim(),
honorsFiveYears: String(row['近五年获得校级及以上荣誉情况'] || '').trim(),
mainStory: String(row['主要事迹'] || '').trim(),
leagueOpinion: String(row['二级团组织意见'] || '').trim(),
partyOpinion: String(row['二级党组织意见'] || '').trim()
});
const saveItem = (item: YxgqtdgbForm) => addYxgqtdgbForm(item);
</script>