<template>
	<a-modal v-model:visible="openAddModel" title="新增企业" ok-text="提交" cancel-text="取消" @ok="sumbitForm"
		@cancel="cancelModal" width="80%" style="top: 20px">
		<a-form :model="createForm" :label-col="{span: 4}" labelAlign="right">
			<a-divider orientation="left">职位信息</a-divider>
			<a-row gutter="20">
				<a-col span="8">
					<a-form-item required label="选择企业" name="company_id">
						<a-select v-model:value="value" @change="companyChange" placeholder="请选择企业" show-search :filter-option="false"
							label-in-value @search="companySearch">
							<a-select-option v-for="item in company_list" :key="item.id" :value="item.id" :label="item.full_name" label-in-value>{{item.full_name}}</a-select-option>
						</a-select>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="选择部门" name="department_id">
						<a-select v-model:value="value" @change="departmentChange" placeholder="请选择部门" show-search :filter-option="false"
							label-in-value @search="departmentSearch">
							<a-select-option v-for="item in department_list" :key="item.id" :value="item.id" :label="item.name" label-in-value>{{item.name}}</a-select-option>
						</a-select>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="是否紧急" name="urgent">
						<a-radio-group v-model:value="createForm.urgent" button-style="solid">
							<a-radio-button :value="1">是</a-radio-button>
							<a-radio-button :value="2">否</a-radio-button>
						</a-radio-group>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item required label="职位名称" name="name">
						<a-input v-model:value="createForm.name" placeholder="请输入职位名称" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="招聘人数" name="invite_count">
						<a-input v-model:value="createForm.invite_count" placeholder="请输入招聘人数" />
					</a-form-item>
				</a-col>
				<a-col span="24">
					<a-form-item required label="职位类别" :label-col="{span: 0}">
						<a-row gutter="20">
							<a-col span="8">
								<a-c-cascader :dict="2004" @saveCascader="industry1Save" placeholder="请选择职位类别"
									:cascader_content="addOtherForm.company_industry1_cascader"></a-c-cascader>
							</a-col>
							<a-col span="8">
								<a-c-cascader :dict="2004" @saveCascader="industry2Save" placeholder="请选择职位类别二"
									:cascader_content="addOtherForm.company_industry2_cascader"></a-c-cascader>
							</a-col>
							<a-col span="8">
								<a-c-cascader :dict="2004" @saveCascader="industry3Save" placeholder="请选择职位类别三"
									:cascader_content="addOtherForm.company_industry3_cascader"></a-c-cascader>
							</a-col>
						</a-row>
					</a-form-item>
				</a-col>
				<a-col span="24">
					<a-form-item required label="工作区域" :label-col="{span: 0}">
						<a-row gutter="20">
							<a-col span="4">
								<a-c-cascader :dict="2009" @saveCascader="location1Save" placeholder="请选择工作区域"
									:cascader_content="addOtherForm.company_location1_cascader"></a-c-cascader>
							</a-col>
							<a-col span="4">
								<a-c-cascader :dict="2009" @saveCascader="location2Save" placeholder="请选择工作区域"
									:cascader_content="addOtherForm.company_location2_cascader"></a-c-cascader>
							</a-col>
							<a-col span="4">
								<a-c-cascader :dict="2009" @saveCascader="location3Save" placeholder="请选择工作区域"
									:cascader_content="addOtherForm.company_location3_cascader"></a-c-cascader>
							</a-col>
							<a-col span="4">
								<a-c-cascader :dict="2009" @saveCascader="location4Save" placeholder="请选择工作区域"
									:cascader_content="addOtherForm.company_location4_cascader"></a-c-cascader>
							</a-col>
							<a-col span="4">
								<a-c-cascader :dict="2009" @saveCascader="location5Save" placeholder="请选择工作区域"
									:cascader_content="addOtherForm.company_location5_cascader"></a-c-cascader>
							</a-col>
						</a-row>
					</a-form-item>
				</a-col>

				<a-col span="24">
					<a-form-item required label="职位描述" name="describe_text" :label-col="{span: 0}">
						<QuillEditor theme="snow" :options="options" toolbar="full"
							v-model:content="addOtherForm.describe_content"
							@update:content="onEditorDescribeUpdate($event)" contentType="html" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="薪资范围" name="pay_range">
						<a-c-select :dict="2005" placeholder="请选择月薪要求范围" @saveSelect="savePayRange"></a-c-select>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="关键词">
						<a-input v-model:value="createForm.key_word" placeholder="请输入关键词" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item required label="有效天数" name="useful_life">
						<a-input-number :min="0" type="number" v-model:value="createForm.useful_life"
							placeholder="请输入有效天数" style="width: 100%;" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item required label="到期日期">
						<a-date-picker v-model:value="addOtherForm.daoqi_date" @Change="disabledDateChange"
							style="width: 100%;" />
					</a-form-item>
				</a-col>
				<a-col span="24">
					<a-row gutter="20">
						<a-col span="5">
							<a-form-item label="是否全职" name="fulltime" :label-col="{span: 0}">
								<a-radio-group v-model:value="createForm.fulltime" button-style="solid">
									<a-radio-button :value="1">是</a-radio-button>
									<a-radio-button :value="2">否</a-radio-button>
								</a-radio-group>
							</a-form-item>
						</a-col>
						<a-col span="5">
							<a-form-item label="是否兼职" name="parttime" :label-col="{span: 0}">
								<a-radio-group v-model:value="createForm.parttime" button-style="solid">
									<a-radio-button :value="1">是</a-radio-button>
									<a-radio-button :value="2">否</a-radio-button>
								</a-radio-group>
							</a-form-item>
						</a-col>
						<a-col span="5">
							<a-form-item label="是否临时" name="casual" :label-col="{span: 0}">
								<a-radio-group v-model:value="createForm.casual" button-style="solid">
									<a-radio-button :value="1">是</a-radio-button>
									<a-radio-button :value="2">否</a-radio-button>
								</a-radio-group>
							</a-form-item>
						</a-col>
						<a-col span="5">
							<a-form-item label="是否实习" name="practical" :label-col="{span: 0}">
								<a-radio-group v-model:value="createForm.practical" button-style="solid">
									<a-radio-button :value="1">是</a-radio-button>
									<a-radio-button :value="2">否</a-radio-button>
								</a-radio-group>
							</a-form-item>
						</a-col>
						<a-col span="4">
							<a-form-item label="校园招聘" name="campus" :label-col="{span: 0}">
								<a-radio-group v-model:value="createForm.campus" button-style="solid">
									<a-radio-button :value="1">是</a-radio-button>
									<a-radio-button :value="2">否</a-radio-button>
								</a-radio-group>
							</a-form-item>
						</a-col>
					</a-row>
				</a-col>
				<a-col span="8">
					<a-form-item required label="食宿要求">
						<a-c-select :dict="2016" placeholder="请选择食宿要求" @saveSelect="saveShisu"></a-c-select>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item required label="节假日休息情况" :label-col="{span: 0}">
						<a-c-select :dict="2017" placeholder="请选择节假日休息情况" @saveSelect="saveHolidays"></a-c-select>
					</a-form-item>
				</a-col>
				<a-divider orientation="left">应聘要求</a-divider>
				<a-col span="8">
					<a-form-item required label="工作经验">
						<a-c-select :dict="2021" placeholder="请选择工作经验" @saveSelect="saveExperience"></a-c-select>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="学历">
						<a-c-select :dict="2006" placeholder="请选择学历" @saveSelect="saveSchoolDegree"></a-c-select>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="含量高学历" name="degree_better">
						<a-radio-group v-model:value="createForm.degree_better" button-style="solid">
							<a-radio-button :value="1">是</a-radio-button>
							<a-radio-button :value="2">否</a-radio-button>
						</a-radio-group>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item required label="职称要求">
						<a-c-select :dict="2014" placeholder="请选择职称要求" @saveSelect="saveProfelevel"></a-c-select>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item required label="技能认证">
						<a-c-select :dict="2015" placeholder="请选择技能认证" @saveSelect="saveCertification"></a-c-select>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="语言要求">
						<a-c-select :dict="2007" placeholder="请选择语言要求" @saveSelect="saveLanguage"></a-c-select>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="掌握程度">
						<a-c-select :dict="2008" placeholder="请选择掌握程度" @saveSelect="saveLanguageDegree"></a-c-select>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item required label="婚姻状况" name="marital_status">
						<a-radio-group v-model:value="createForm.marital_status" button-style="solid">
							<a-radio-button :value="1">已婚</a-radio-button>
							<a-radio-button :value="2">未婚</a-radio-button>
							<a-radio-button :value="3">不限</a-radio-button>
						</a-radio-group>
						<!-- <a-c-select :dict="2011" placeholder="请选择婚姻状况" @saveSelect="saveMandarinStatus"></a-c-select> -->
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item required label="专业" name="major">
						<a-input v-model:value="createForm.major" placeholder="请输入专业" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="性别要求" name="sex">
						<a-radio-group v-model:value="createForm.sex" button-style="solid">
							<a-radio-button :value="1">男</a-radio-button>
							<a-radio-button :value="2">女</a-radio-button>
							<a-radio-button :value="3">不限</a-radio-button>
						</a-radio-group>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="最小年龄" name="age_min">
						<a-input-number :min="0" type="number" v-model:value="createForm.age_min" placeholder="请输入最小年龄"
							style="width: 100%;" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="最大年龄" name="age_max">
						<a-input-number :min="0" type="number" v-model:value="createForm.age_max" placeholder="请输入最大年龄"
							style="width: 100%;" />
					</a-form-item>
				</a-col>

				<a-col span="24">
					<a-form-item label="证书要求" :label-col="{span: 0}">
						<a-checkbox-group v-model:value="createForm.license" @change="licenseChange">
							<template v-for="(item, index) in licenseOption">
								<a-checkbox :value="item.id">{{item.name}}</a-checkbox>
							</template>
						</a-checkbox-group>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="籍贯要求" name="mandarin">
						<a-c-cascader :dict="2009" @saveCascader="compantJiguanSave" placeholder="请选择籍贯"
							:cascader_content="addOtherForm.company_jiguan_cascader"></a-c-cascader>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="所在地要求" name="mandarin">
						<a-c-cascader :dict="2009" @saveCascader="compantSuozaidiSave" placeholder="请选择所在地"
							:cascader_content="addOtherForm.company_suozaidi_cascader"></a-c-cascader>
					</a-form-item>
				</a-col>
				<a-divider orientation="left">联系方式</a-divider>
				<a-col span="8">
					<a-form-item required label="联系人" name="contact">
						<a-input v-model:value="createForm.contact" placeholder="请输入联系人" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="联系人职位" name="possession">
						<a-input v-model:value="createForm.possession" placeholder="请输入联系人职位" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item required label="联系电话" name="phone">
						<a-input v-model:value="createForm.phone" placeholder="请输入联系电话" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="是否公开联系电话" name="phone_public" :label-col="{span: 0}">
						<a-radio-group v-model:value="createForm.phone_public" button-style="solid">
							<a-radio-button :value="1">是</a-radio-button>
							<a-radio-button :value="2">否</a-radio-button>
						</a-radio-group>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="手机" name="mobile">
						<a-input v-model:value="createForm.mobile" placeholder="请输入手机" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="是否公开手机" name="mobile_public" :label-col="{span: 0}">
						<a-radio-group v-model:value="createForm.mobile_public" button-style="solid">
							<a-radio-button :value="1">是</a-radio-button>
							<a-radio-button :value="2">否</a-radio-button>
						</a-radio-group>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="邮箱" name="email">
						<a-input v-model:value="createForm.email" placeholder="请输入邮箱" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="是否公开邮箱" name="email_public" :label-col="{span: 0}">
						<a-radio-group v-model:value="createForm.email_public" button-style="solid">
							<a-radio-button :value="1">是</a-radio-button>
							<a-radio-button :value="2">否</a-radio-button>
						</a-radio-group>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="传真" name="fax">
						<a-input v-model:value="createForm.fax" placeholder="请输入传真" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="是否公开传真" name="fax_public" :label-col="{span: 0}">
						<a-radio-group v-model:value="createForm.fax_public" button-style="solid">
							<a-radio-button :value="1">是</a-radio-button>
							<a-radio-button :value="2">否</a-radio-button>
						</a-radio-group>
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="其他地址" name="other_address">
						<a-input v-model:value="createForm.other_address" placeholder="请输入其他地址" />
					</a-form-item>
				</a-col>
				<a-col span="8">
					<a-form-item label="面试地址" name="interview_address">
						<a-input v-model:value="createForm.interview_address" placeholder="请输入面试地址" />
					</a-form-item>
				</a-col>
			</a-row>
		</a-form>
	</a-modal>
</template>

<script setup lang="ts">
	import { ref, onMounted, computed, defineProps, watch, defineEmits } from 'vue';
	import { getCompanyList, GetCompanyDepartmentList, GetDictTree, PostCompanyJobAdd, PostCompanyJobEdit } from '@/apis/models';
	import UploadOne from '@/components/upload/one.vue';
	import { UserOutlined, InfoCircleOutlined, LockOutlined, EyeInvisibleOutlined } from '@ant-design/icons-vue';
	import { message } from 'ant-design-vue';
	import { useCommon } from '@/hooks/useCommon';
	import { debounce, throttle } from 'lodash-es';
	import dayjs from 'dayjs';
	import 'dayjs/locale/zh-cn';
	dayjs.locale('zh-cn');
	const dayjsRef = ref(dayjs);
	let { store, openAddModel, hideModal } = useCommon();
	const emit = defineEmits();
	let props = defineProps(['edit_record']);
	const options = ref({
		debug: 'info',
		modules: {
		},
		placeholder: '请输入企业简介'
	})

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

	watch(() => props.edit_record, (newVal1) => {
		if (newVal1) {
			GetCompanyInfo({ id: newVal1.id }).then(res => {
				let newVal = res.data;
				addOtherForm.value = {
					chengli_date: dayjsRef.value(newVal.establishment_date),
					content: newVal.introduction,
					photo_img: "http://114.132.85.7:8894" + newVal.photo,
					license_img: "http://114.132.85.7:8894" + newVal.photo,
					company_address_cascader: newVal.province_name + newVal.city_name + newVal.district_name + newVal.street_name,
					company_industry_cascader: newVal.industry_text,
					company_nature_cascader: newVal.nature_text,
					company_scale_cascader: newVal.scale_text,
				}
				createForm.value = {
					id: newVal.id,
					full_name: newVal.full_name,
					registration_number: newVal.registration_number,
					establishment_date: newVal.establishment_date,
					contact: newVal.contact,
					phone: newVal.phone,
					mobile: newVal.mobile,
					email: newVal.email,
					fax: newVal.fax,
					website: newVal.website,
					province: newVal.province,
					city: newVal.city,
					district: newVal.district,
					street: newVal.street,
					address: newVal.address,
					industry: newVal.industry,
					nature: newVal.nature,
					scale: newVal.scale,
					introduction: newVal.introduction,
					photo: newVal.photo,
					photo_status: newVal.photo_status,
					license_path: newVal.license_path,
					license_status: newVal.license_status,
					login_name: newVal.login_name,
					login_pwd: newVal.login_pwd,
					company_photos: newVal.company_photos,
				}
			})
		}
	})


	const company_list = ref<Object[]>([]);
	const department_list = ref<Object[]>([]);
	const job_type_list = ref<String[]>([]);
	const job_location_list = ref<String[]>([]);
	let createForm : companyListType.addrFormType = ref({
		company_id: 0,
		urgent: 2,
		name: '',
		department_id: 0,
		invite_count: '',
		job_type: [],
		job_location: [],
		describe_text: '',
		pay_range: 0,
		key_word: '',
		useful_life: 0,
		disabled_date: '',
		fulltime: 2,
		parttime: 2,
		casual: 2,
		practical: 2,
		campus: 2,
		shisu: 0,
		holidays: 0,
		experience: 0,
		school_degree: 0,
		degree_better: 0,
		profelevel: 0,
		certification: 0,
		language: 0,
		language_degree: 0,
		sex: 3,
		age_min: 0,
		age_max: 0,
		marital_status: 3,
		major: '',
		license: [],
		household_province: 0,
		household_city: 0,
		location_province: 0,
		location_city: 0,
		location_town: 0,
		contact: '',
		possession: '',
		phone: '',
		phone_public: 2,
		mobile: '',
		mobile_public: 2,
		email: '',
		email_public: 2,
		fax: '',
		fax_public: 2,
		other_address: '',
		interview_address: '',
	})


	let addOtherForm = ref<companyListType.addOtherFormType>({
		company_industry1_cascader: '',
		company_industry2_cascader: '',
		company_industry3_cascader: '',
		company_location1_cascader: '',
		company_location2_cascader: '',
		company_location3_cascader: '',
		company_location4_cascader: '',
		company_location5_cascader: '',
		describe_content: '',
		daoqi_date: '',
		company_jiguan_cascader: '',
		company_suozaidi_cascader: '',
	})

	let licenseOption = ref<Object[]>([])
	onMounted(async () => {
		let res = await getCompanyList({ page: 1, pagesize: 10, sort: 'id', sortby: "asc", keyword: "" });
		res.data.list.map((item : object) => {
			item.name = item.full_name
		})
		company_list.value = res.data.list;
		GetDictTree({
			code: 2018
		}).then(res => {
			licenseOption.value = res.data.dicts
		})


	})

	// 选择企业
	const companySearch = (val) => {
		getCompanyList({ keyword: val }).then(res => {
			company_list.value = res.data.list;
		})
	}
	const companyChange = (val : Object) => {
		createForm.value.company_id = val.key;
		GetCompanyDepartmentList({company_id: val.key}).then(res => {
			department_list.value = res.data.rows;
		})
	}

	// 选择部门
	const departmentSearch = (val) => {
		GetCompanyDepartmentList({ keyword: val }).then(res => {
			department_list.value = res.data.list;
		})
	}
	const departmentChange = (val : Object) => {
		createForm.value.department_id = val.key;
	}

	// 职业类别
	const industry1Save = (data) => {
		if (data.arr1 && data.arr1[1]) {
			job_type_list.value[0] = data.arr1[1]
		} else {
			job_type_list.value[0] = 0
		}
	}

	const industry2Save = (data) => {
		if (data.arr1 && data.arr1[1]) {
			job_type_list.value[1] = data.arr1[1]
		} else {
			job_type_list.value[1] = 0
		}
	}

	const industry3Save = (data) => {
		if (data.arr1 && data.arr1[1]) {
			job_type_list.value[2] = data.arr1[1]
		} else {
			job_type_list.value[2] = 0
		}
	}

	// 工作区域
	const location1Save = (data) => {
		if (data.arr1 && data.arr1[1]) {
			job_location_list.value[0] = data.arr1[1]
		} else {
			job_location_list.value[0] = 0
		}
	}

	const location2Save = (data) => {
		if (data.arr1 && data.arr1[1]) {
			job_location_list.value[1] = data.arr1[1]
		} else {
			job_location_list.value[1] = 0
		}
	}

	const location3Save = (data) => {
		if (data.arr1 && data.arr1[1]) {
			job_location_list.value[2] = data.arr1[1]
		} else {
			job_location_list.value[2] = 0
		}
	}

	const location4Save = (data) => {
		if (data.arr1 && data.arr1[1]) {
			job_location_list.value[3] = data.arr1[1]
		} else {
			job_location_list.value[3] = 0
		}
	}

	const location5Save = (data) => {
		if (data.arr1 && data.arr1[1]) {
			job_location_list.value[4] = data.arr1[1]
		} else {
			job_location_list.value[4] = 0
		}
	}

	// 职位描述
	const onEditorDescribeUpdate = (data) => {
		createForm.value.describe_text = data
	}

	// 薪资范围
	const savePayRange = (data) => {
		createForm.value.pay_range = data.val;
	}

	// 到期日期
	const disabledDateChange = (val) => {
		createForm.value.disabled_date = dayjsRef.value(val).format('YYYY-MM-DD');
	}

	// 食宿要求
	const saveShisu = (data) => {
		createForm.value.shisu = data.val;
	}

	// 节假日要求
	const saveHolidays = (data) => {
		createForm.value.holidays = data.val;
	}

	// 工作经验
	const saveExperience = (data) => {
		createForm.value.experience = data.val;
	}

	// 学历要求
	const saveSchoolDegree = (data) => {
		createForm.value.school_degree = data.val;
	}

	// 职称要求
	const saveProfelevel = (data) => {
		createForm.value.profelevel = data.val;
	}

	// 技能认证
	const saveCertification = (data) => {
		createForm.value.certification = data.val;
	}

	// 语言要求
	const saveLanguage = (data) => {
		createForm.value.language = data.val;
	}

	// 掌握程度
	const saveLanguageDegree = (data) => {
		createForm.value.language_degree = data.val;
	}

	// 婚姻状况
	const saveMandarinStatus = (data) => {
		createForm.value.marital_status = data.val;
	}


	// 选择籍贯
	const compantJiguanSave = (data) => {
		createForm.value.household_province = data.arr1[0] ? data.arr1[0] : 0;
		createForm.value.household_city = data.arr1[1] ? data.arr1[1] : 0;
	}

	// 选择所在地
	const compantSuozaidiSave = (data) => {
		createForm.value.location_province = data.arr1[0] ? data.arr1[0] : 0;
		createForm.value.location_city = data.arr1[1] ? data.arr1[1] : 0;
		createForm.value.location_town = data.arr1[2] ? data.arr1[2] : 0;
	}

	// 证书
	const licenseChange = (val) => {
		console.log(val)
	}



	const sumbitForm = () => {
		job_type_list.value.map(item => {
			console.log(item)
			if (item != 0) {
				console.log(item)
				createForm.value.job_type.push(item)
			}
		})
		job_location_list.value.map(item => {
			console.log(item)
			if (item != 0) {
				console.log(item)
				createForm.value.job_location.push(item)
			}
		})
		console.log(createForm.value)
		if (createForm.value.company_id) {
			if (!createForm.value.id) {
				PostCompanyJobAdd(createForm.value).then(res => {
					message.success('新增职位成功');
					hideModal();
					resetForm();
					emit('successAdd');
				}).catch(err => {
				})
			} else {
				PostCompanyJobEdit(createForm.value).then(res => {
					message.success('修改职位信息成功');
					hideModal();
					resetForm();
					emit('successAdd');
				}).catch(err => {
				})
			}

		} else {
			message.warning('请补充完整信息');
		}
	}

	const resetForm = () => {
		addOtherForm.value = {
			company_industry1_cascader: '',
			company_industry2_cascader: '',
			company_industry3_cascader: '',
			company_location1_cascader: '',
			company_location2_cascader: '',
			company_location3_cascader: '',
			company_location4_cascader: '',
			company_location5_cascader: '',
			describe_content: '',
			daoqi_date: '',
			company_jiguan_cascader: '',
			company_suozaidi_cascader: '',
		}
		createForm.value = {
			company_id: 0,
			urgent: 2,
			name: '',
			department_id: 0,
			invite_count: '',
			job_type: [],
			job_location: [],
			describe_text: '',
			pay_range: 0,
			key_word: '',
			useful_life: 0,
			disabled_date: '',
			fulltime: 2,
			parttime: 2,
			casual: 2,
			practical: 2,
			campus: 2,
			shisu: 0,
			holidays: 0,
			experience: 0,
			school_degree: 0,
			degree_better: 0,
			profelevel: 0,
			certification: 0,
			language: 0,
			language_degree: 0,
			sex: 3,
			age_min: 0,
			age_max: 0,
			marital_status: 0,
			major: '',
			license: [],
			household_province: 0,
			household_city: 0,
			location_province: 0,
			location_city: 0,
			location_town: 0,
			contact: '',
			possession: '',
			phone: '',
			phone_public: 2,
			mobile: '',
			mobile_public: 2,
			email: '',
			email_public: 2,
			fax: '',
			fax_public: 2,
			other_address: '',
			interview_address: '',
		}
	}
	const cancelModal = () => {
		emit('closeAdd');
		resetForm();
		hideModal();
	}


	// const hideModal = () => {
	// 	resetForm();
	// 	emit('closeAdd', { show: false });
	// }
</script>

<style>
</style>