|
@@ -5,7 +5,7 @@
|
|
|
<div>
|
|
|
<span style="font-size: 16px;margin-left: 10px;" v-text="lang[langType].signUpZH"></span>
|
|
|
</div>
|
|
|
- <van-form ref="form" @submit="onSubmit" label-width="8em">
|
|
|
+ <van-form ref="form" @submit="onSubmit" @failed="failed" label-width="8em">
|
|
|
<!-- 姓名 -->
|
|
|
<van-field input-align="right"
|
|
|
:rules="[{ required: formData, trigger: 'onBlur', message: lang[langType].nameContent }]" required
|
|
@@ -93,7 +93,7 @@
|
|
|
</van-field>
|
|
|
|
|
|
<!-- 紧急联系人电话 -->
|
|
|
- <van-field input-align="right" v-model="formData.emergencyContactPhone" required
|
|
|
+ <van-field input-align="right" v-model="formData.emergencyContactPhone" required type="number"
|
|
|
:rules="[{ required: true, trigger: 'onBlur', message: lang[langType].emergencyContactPhoneContent }]"
|
|
|
:placeholder="lang[langType].emergencyContactPhoneContent">
|
|
|
<template #label>
|
|
@@ -113,8 +113,7 @@
|
|
|
</van-field>
|
|
|
<van-popup v-model:show="showCardType" destroy-on-close round position="bottom">
|
|
|
<van-picker :confirm-button-text="lang[langType].confirm" :cancel-button-text="lang[langType].cancel"
|
|
|
- :model-value="formData.cardType" :columns="cardTypeList" @cancel="showCardType = false"
|
|
|
- @confirm="onConfirm" />
|
|
|
+ :columns="cardTypeList" @cancel="showCardType = false" @confirm="onConfirm" />
|
|
|
</van-popup>
|
|
|
|
|
|
<!-- 证件 -->
|
|
@@ -157,8 +156,7 @@
|
|
|
</van-field>
|
|
|
<van-popup v-model:show="showUnitType" destroy-on-close round position="bottom">
|
|
|
<van-picker :confirm-button-text="lang[langType].confirm" :cancel-button-text="lang[langType].cancel"
|
|
|
- :model-value="formData.unitType" :columns="unitTypeList" @cancel="showUnitType = false"
|
|
|
- @confirm="onUnitTypeConfirm" />
|
|
|
+ :columns="unitTypeList" @cancel="showUnitType = false" @confirm="onUnitTypeConfirm" />
|
|
|
</van-popup>
|
|
|
|
|
|
<!-- 职务 -->
|
|
@@ -190,7 +188,7 @@
|
|
|
|
|
|
<div style="background-color: #F7F7F7;height: 10px;"></div>
|
|
|
<!-- 接受采访意向 -->
|
|
|
- <van-field input-align="right" v-model="formData.interview" required
|
|
|
+ <van-field v-model="formData.interview" required label-align="top"
|
|
|
:rules="[{ required: true, trigger: 'onBlur', message: lang[langType].interviewContent }]"
|
|
|
:placeholder="lang[langType].interviewContent">
|
|
|
<template #label>
|
|
@@ -199,12 +197,40 @@
|
|
|
<template #input>
|
|
|
<van-radio-group style="justify-content: flex-end;width: 100%;" v-model="formData.interview"
|
|
|
direction="horizontal">
|
|
|
- <van-radio name="是">{{ lang[langType].confirm }}</van-radio>
|
|
|
- <van-radio name="否">{{ lang[langType].cancel }}</van-radio>
|
|
|
+ <van-radio style="flex: 1;" name="是">{{ lang[langType].confirm }}</van-radio>
|
|
|
+ <van-radio style="flex: 1;" name="否">{{ lang[langType].cancel }}</van-radio>
|
|
|
</van-radio-group>
|
|
|
</template>
|
|
|
</van-field>
|
|
|
|
|
|
+
|
|
|
+ <!-- 拟参加的活动 -->
|
|
|
+ <van-field label-align="top" required
|
|
|
+ :rules="[{ required: true, trigger: 'onBlur', message: lang[langType].activitiesAttendedContent }]"
|
|
|
+ :placeholder="lang[langType].activitiesAttendedContent">
|
|
|
+ <template #label>
|
|
|
+ <span :class="langType === 'zh' ? 'label' : ''" v-html="lang[langType].activitiesAttended"></span>
|
|
|
+ </template>
|
|
|
+ <template #input>
|
|
|
+ <van-checkbox-group checked-color="#3F5AC8" v-model="activitiesAttended">
|
|
|
+ <van-cell clickable :title="lang[langType].activity1">
|
|
|
+ <template #icon>
|
|
|
+ <van-checkbox style="margin-right: 5px;" name="active1" @click.stop shape="square" />
|
|
|
+ </template>
|
|
|
+ </van-cell>
|
|
|
+ <van-cell clickable :title="lang[langType].activity2">
|
|
|
+ <template #icon>
|
|
|
+ <van-checkbox style="margin-right: 5px;" name="active2" @click.stop shape="square" />
|
|
|
+ </template>
|
|
|
+ </van-cell>
|
|
|
+ <van-cell clickable :title="lang[langType].activity3">
|
|
|
+ <template #icon>
|
|
|
+ <van-checkbox style="margin-right: 5px;" name="active3" @click.stop shape="square" />
|
|
|
+ </template>
|
|
|
+ </van-cell>
|
|
|
+ </van-checkbox-group>
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
<div style="background-color: #F7F7F7;height: 10px;"></div>
|
|
|
|
|
|
<!-- 抵达西安交通车次 -->
|
|
@@ -280,9 +306,9 @@
|
|
|
<script setup>
|
|
|
import { defineEmits, defineProps, reactive, ref, computed, defineExpose } from 'vue';
|
|
|
import { showToast, showDialog } from 'vant';
|
|
|
-import { saveData, uploadImage } from '@/api/2025.js';
|
|
|
+import { editData, uploadImage } from '@/api/2025.js';
|
|
|
import lang from './lang.js';
|
|
|
-const props = defineProps(['langType','verificationCode', 'subData']);
|
|
|
+const props = defineProps(['langType', 'verificationCode', 'subData']);
|
|
|
|
|
|
const emits = defineEmits(['closeComponent']);
|
|
|
|
|
@@ -298,13 +324,14 @@ const showLeavingTime = ref(false)
|
|
|
const showCardType = ref(false)
|
|
|
const showCheckOutTime = ref(false)
|
|
|
const form = ref(null);
|
|
|
+const activitiesAttended = ref([])
|
|
|
const photo = ref([]);
|
|
|
|
|
|
/**
|
|
|
* 将subData数据转换为formData
|
|
|
*/
|
|
|
const initFormData = () => {
|
|
|
- if(!props.subData) return;
|
|
|
+ if (!props.subData) return;
|
|
|
const relationship = {
|
|
|
name: 'name', // 姓名
|
|
|
provinceCity: 'provinceCity', // 省市区
|
|
@@ -315,11 +342,11 @@ const initFormData = () => {
|
|
|
email: 'email', // 邮箱
|
|
|
emergencyContact: 'emergencyContact', // 紧急联系人
|
|
|
emergencyContactPhone: 'emergencyContactPhone', // 紧急联系人电话
|
|
|
- cardType: 'cardTypeName', // 证件类型
|
|
|
+ cardType: 'cardType', // 证件类型
|
|
|
idCard: 'passport', // 证件号
|
|
|
dietaryRequirements: 'catering', // 饮食要求
|
|
|
workUnit: 'workUnit', // 工作单位
|
|
|
- unitType: 'unitTypeName', // 单位类型
|
|
|
+ unitType: 'unitType', // 单位类型
|
|
|
position: 'career', // 职务
|
|
|
fax: 'fax', // fax
|
|
|
interviewIntention: 'interview', // 接受采访意向
|
|
@@ -331,16 +358,34 @@ const initFormData = () => {
|
|
|
checkOutTime: 'checkOutTime', // 离店时间
|
|
|
remarks: 'message', // 备注
|
|
|
}
|
|
|
- const keys = Object.keys(props.subData || {});
|
|
|
- for(let i = 0 ; i < keys.length; i++) {
|
|
|
+ const subData = JSON.parse(JSON.stringify(props.subData))
|
|
|
+ const keys = Object.keys(subData || {});
|
|
|
+ subData.active1 === '是' && activitiesAttended.value.push('active1');
|
|
|
+ subData.active2 === '是' && activitiesAttended.value.push('active2');
|
|
|
+ subData.active3 === '是' && activitiesAttended.value.push('active3');
|
|
|
+ for (let i = 0; i < keys.length; i++) {
|
|
|
const key = keys[i];
|
|
|
if (key === 'photo') {
|
|
|
photo.value.push({
|
|
|
- url: props.subData[key],
|
|
|
+ url: subData[key],
|
|
|
})
|
|
|
}
|
|
|
- formData[relationship[key]] = props.subData[key];
|
|
|
- }
|
|
|
+ if (key === 'cardType') {
|
|
|
+ try {
|
|
|
+ formData.cardTypeName = lang[props.langType].cardTypeList.filter(item => item.value === subData[key])[0].text;
|
|
|
+ } catch (err) {
|
|
|
+ formData.cardTypeName = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (key === 'unitType') {
|
|
|
+ try {
|
|
|
+ formData.unitTypeName = lang[props.langType].foreignCountryUnitType.filter(item => item.value === subData[key])[0].text;
|
|
|
+ } catch (err) {
|
|
|
+ formData.unitTypeName = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ formData[relationship[key]] = subData[key];
|
|
|
+ }
|
|
|
}
|
|
|
initFormData()
|
|
|
const reset = () => {
|
|
@@ -351,6 +396,10 @@ const onClickLeft = () => {
|
|
|
emits('closeComponent');
|
|
|
};
|
|
|
|
|
|
+const failed = (err) => {
|
|
|
+ console.log(err);
|
|
|
+}
|
|
|
+
|
|
|
const createTextDate = values => values.slice(0, 3).join('-') + ' ' + values.slice(3).join(':');
|
|
|
const packerConfirm = (values) => {
|
|
|
showBirthday.value = false;
|
|
@@ -362,7 +411,7 @@ const leavingTimeConfirm = ({ selectedValues }) => {
|
|
|
}
|
|
|
const onUnitTypeConfirm = (values) => {
|
|
|
showUnitType.value = false;
|
|
|
- formData.unitType = values.selectedValues;
|
|
|
+ formData.unitType = values.selectedOptions[0].value;
|
|
|
formData.unitTypeName = values.selectedOptions[0].text;
|
|
|
}
|
|
|
const reachTimeConfirm = ({ selectedValues }) => {
|
|
@@ -375,7 +424,7 @@ const checkOutTimeConfirm = ({ selectedValues }) => {
|
|
|
}
|
|
|
const onConfirm = (values) => {
|
|
|
showCardType.value = false;
|
|
|
- formData.cardType = values.selectedValues;
|
|
|
+ formData.cardType = values.selectedOptions[0].value;
|
|
|
formData.cardTypeName = values.selectedOptions[0].text;
|
|
|
}
|
|
|
|
|
@@ -459,7 +508,13 @@ let loading = false
|
|
|
const onSubmit = () => {
|
|
|
if (loading) return
|
|
|
loading = true
|
|
|
- saveData({
|
|
|
+ const activity = {}
|
|
|
+ activitiesAttended.value.forEach((item, index) => {
|
|
|
+ activity[`activity${index + 1}`] = '是'
|
|
|
+ })
|
|
|
+ editData({
|
|
|
+ ...activity,
|
|
|
+ id: props.subData.id, // 人员id
|
|
|
code: props.verificationCode, // 邀请码
|
|
|
name: formData.name, // 姓名
|
|
|
provinceCity: formData.provinceCity, // 省市区
|
|
@@ -470,11 +525,11 @@ const onSubmit = () => {
|
|
|
email: formData.email, // 邮箱
|
|
|
emergencyContact: formData.emergencyContact, // 紧急联系人
|
|
|
emergencyContactPhone: formData.emergencyContactPhone, // 紧急联系人电话
|
|
|
- cardType: formData.cardTypeName, // 证件类型
|
|
|
+ cardType: formData.cardType, // 证件类型
|
|
|
idCard: formData.passport, // 证件号
|
|
|
dietaryRequirements: formData.catering, // 饮食要求
|
|
|
workUnit: formData.workUnit, // 工作单位
|
|
|
- unitType: formData.unitTypeName, // 单位类型
|
|
|
+ unitType: formData.unitType, // 单位类型
|
|
|
position: formData.career, // 职务
|
|
|
fax: formData.fax, // fax
|
|
|
interviewIntention: formData.interview, // 接受采访意向
|
|
@@ -497,7 +552,7 @@ const onSubmit = () => {
|
|
|
// });
|
|
|
loading = false
|
|
|
showDialog({
|
|
|
- message: lang[props.langType].registration,
|
|
|
+ message: lang[props.langType].upRegistration,
|
|
|
})
|
|
|
}).catch((res) => {
|
|
|
loading = false
|