<template>
	<a-modal v-model:visible="openAddModel" :title="title" ok-text="提交" cancel-text="取消" @ok="sumbitForm" :footer="null"
		@cancel="cancelModal" width="80%">
		<a-space direction="vertical" style="width: 100%;">
			<a-segmented v-model:value="activeKey" @change="resumeModeChange"  :options="['基本资料', '联系信息','个人简介', '专业技能掌握程度','培训经历', '求职意向','工作经历', '证书']" size="large" block>
			</a-segmented>
			<resume-basic v-if="openAddModel && activeKey == '基本资料'" :customer_record="customer_record"></resume-basic>
			<resume-contact v-if="openAddModel && activeKey == '联系信息'" :customer_record="customer_record"></resume-contact>
			<resume-introduction v-if="openAddModel && activeKey == '个人简介'" :customer_record="customer_record"></resume-introduction>
			<resume-skill v-if="openAddModel && activeKey == '专业技能掌握程度'" :customer_record="customer_record"></resume-skill>
			<resume-train v-if="openAddModel && activeKey == '培训经历'" :customer_record="customer_record"></resume-train>
			<resume-intention v-if="openAddModel && activeKey == '求职意向'" :customer_record="customer_record"></resume-intention>
			<resume-experience v-if="openAddModel && activeKey=='工作经历'" :customer_record=" customer_record"></resume-experience>
			<resume-credential v-if="openAddModel && activeKey == '证书'" :customer_record="customer_record"></resume-credential>
		</a-space>
		
		<!-- <a-collapse v-model:activeKey="activeKey" accordion>
			<a-collapse-panel key="1" header="基本资料">
				
			</a-collapse-panel>
			<a-collapse-panel key="2" header="联系信息">
				<resume-contact @toNext="toNext" :customer_record="customer_record"></resume-contact>
			</a-collapse-panel>
			<a-collapse-panel key="3" header="个人简介">
				<resume-introduction @toNext="toNext" :customer_record="customer_record"></resume-introduction>
			</a-collapse-panel>
			<a-collapse-panel key="4" header="专业技能掌握程度">
				<resume-skill @toNext="toNext" :customer_record="customer_record"></resume-skill>
			</a-collapse-panel>
			<a-collapse-panel key="5" header="培训经历">
				<resume-train @toNext="toNext" :customer_record="customer_record"></resume-train>
			</a-collapse-panel>
			<a-collapse-panel key="6" header="求职意向">
				<resume-intention @toNext="toNext" :customer_record="customer_record"></resume-intention>
			</a-collapse-panel>
			<a-collapse-panel key="7" header="工作经历">
				<resume-experience @toNext="toNext" :customer_record="customer_record"></resume-experience>
			</a-collapse-panel>
			<a-collapse-panel key="8" header="证书">
				<resume-credential @toNext="toNext" :customer_record="customer_record"></resume-credential>
			</a-collapse-panel>
		</a-collapse> -->
	</a-modal>
</template>

<script setup lang="ts">
	import { ref, onMounted, computed, defineProps, watch, defineEmits } from 'vue';
	import ResumeBasic from '@/views/jobSeeker/resume/add/basic/basic.vue';
	import ResumeContact from '@/views/jobSeeker/resume/add/contact/contact.vue';
	import ResumeCredential from '@/views/jobSeeker/resume/add/credential/credential.vue';
	import ResumeExperience from '@/views/jobSeeker/resume/add/experience/experience.vue';
	import ResumeIntention from '@/views/jobSeeker/resume/add/intention/intention.vue';
	import ResumeIntroduction from '@/views/jobSeeker/resume/add/introduction/introduction.vue';
	import ResumeSkill from '@/views/jobSeeker/resume/add/skill/skill.vue';
	import ResumeTrain from '@/views/jobSeeker/resume/add/train/train.vue';

	import { useCommon } from '@/hooks/useCommon';
	let { store, openAddModel, hideModal, dayjs, disabledDate, richOption, message, imageprefix } = useCommon();
	const emit = defineEmits();
	let props = defineProps(['edit_record']);
	let title = ref<String>('编辑简历');
	let activeKey = ref<String>("基本资料")
	let customer_record = ref<Object>(props.edit_record)

	openAddModel = computed(() => {
		return store.state.openAddModel;
	})

	watch(() => props.edit_record, async (newVal) => {
		if (newVal) {
			title.value = '编辑简历';
			customer_record.value = props.edit_record
		} else {
			title.value = '编辑简历';
		}
	})

	const resumeModeChange = (data) => {
		activeKey.value = data
	}



	const cancelModal = () => {
		emit('closeAdd');
		hideModal();
	}
</script>

<style>
</style>