You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

contact.vue 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <div style="width: 100%;">
  3. <a-form :model="createForm" layout="vertical" class="resume-form">
  4. <a-row :gutter="20">
  5. <a-col span="8">
  6. <a-form-item label="固话" name="landline">
  7. <a-input v-model:value="createForm.landline" placeholder="请输入固话" />
  8. </a-form-item>
  9. </a-col>
  10. <a-col span="8">
  11. <a-form-item required label="移动电话" name="mobile">
  12. <a-input v-model:value="createForm.mobile" placeholder="请输入移动电话" />
  13. </a-form-item>
  14. </a-col>
  15. <a-col span="8">
  16. <a-form-item label="QQ" name="qq">
  17. <a-input v-model:value="createForm.qq" placeholder="请输入QQ" />
  18. </a-form-item>
  19. </a-col>
  20. <a-col span="8">
  21. <a-form-item label="个人网站" name="personal_website">
  22. <a-input v-model:value="createForm.personal_website" placeholder="请输入个人网站" />
  23. </a-form-item>
  24. </a-col>
  25. <a-col span="8">
  26. <a-form-item label="通信地址" name="mailing_address">
  27. <a-input v-model:value="createForm.mailing_address" placeholder="请输入通信地址" />
  28. </a-form-item>
  29. </a-col>
  30. <a-col span="8">
  31. <a-form-item label="邮编" name="postal_code">
  32. <a-input v-model:value="createForm.postal_code" placeholder="请输入邮编" />
  33. </a-form-item>
  34. </a-col>
  35. <a-col span="24">
  36. <a-flex justify="flex-end">
  37. <a-space>
  38. <a-button @click="resetForm" >取消</a-button>
  39. <a-button type="primary" @click="sumbitForm" >保存</a-button>
  40. </a-space>
  41. </a-flex>
  42. </a-col>
  43. </a-row>
  44. </a-form>
  45. </div>
  46. </template>
  47. <script setup lang="ts">
  48. import { ref, onMounted, computed, defineProps, watch, defineEmits, createVNode } from 'vue';
  49. import { PostJobapplicantAddcontact, PostJobapplicantDelcontact, PostJobapplicantUpdatecontact, GetJobapplicantContactdetail } from '@/apis/models';
  50. import { intersectionAlike } from '@/utils/dataHelper';
  51. import { warnToast, successToast } from '@/utils/toastHelper';
  52. import { dataForm, otherDataForm, reset } from '@/views/jobSeeker/resume/add/contact/data.ts';
  53. import { useCommon } from '@/hooks/useCommon';
  54. let { store, dayjs, richOption, ExclamationCircleOutlined, Modal } = useCommon();
  55. const dayjsRef = ref(dayjs);
  56. let props = defineProps(['customer_record']);
  57. const emit = defineEmits();
  58. let createForm = ref<JobseekerContactType.JobseekerContactFormType>(dataForm)
  59. onMounted(() => {
  60. getBasic()
  61. })
  62. const getBasic = () => {
  63. GetJobapplicantContactdetail({customer_id: props.customer_record.customer_id}).then(res => {
  64. createForm.value = intersectionAlike(createForm.value, res.data)
  65. createForm.value.id = res.data.id;
  66. createForm.value.customer_id = res.data.customer_id;
  67. })
  68. }
  69. const sumbitForm = () => {
  70. if(createForm.value.id) {
  71. PostJobapplicantUpdatecontact(createForm.value).then(res => {
  72. successToast('保存成功');
  73. getBasic();
  74. // resetForm()
  75. }).catch(err => {
  76. })
  77. } else {
  78. PostJobapplicantAddcontact(createForm.value).then(res => {
  79. successToast('保存成功');
  80. getBasic();
  81. // resetForm()
  82. }).catch(err => {
  83. })
  84. }
  85. }
  86. const resetForm = () => {
  87. createForm.value = reset().dataForm as JobseekerContactType.JobseekerContactFormType;
  88. }
  89. // watch(() => [props.form_state], (newVal) => {
  90. // state.value = newVal[0];
  91. // getBasic();
  92. // })
  93. </script>
  94. <style>
  95. </style>