招聘网页
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

2 роки тому
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <div>
  3. <template v-if="state">
  4. <a-form :model="createForm" layout="vertical">
  5. <a-row :gutter="20">
  6. <a-form-item label="上传营业执照" name="photo">
  7. <upload upload_txt="上传营业执照" @uploadSuccess="uploadPhotoSuccess"
  8. :success_image="addOtherForm.license_img" images_length="1" image_type="4"></upload>
  9. </a-form-item>
  10. <a-col span="24">
  11. <a-flex justify="flex-end">
  12. <a-space>
  13. <a-button @click="resetForm" size="large">取消</a-button>
  14. <a-button type="primary" @click="saveForm" size="large">保存</a-button>
  15. </a-space>
  16. </a-flex>
  17. </a-col>
  18. </a-row>
  19. </a-form>
  20. </template>
  21. <template v-else>
  22. <image-container :imgObj="{src: addOtherForm.license_img,width: '200px',height:'280px',mode: 'fill'}"></image-container>
  23. </template>
  24. </div>
  25. </template>
  26. <script setup lang="ts">
  27. import { ref, onMounted, computed, defineProps, watch, defineEmits, createVNode } from 'vue';
  28. import { PostCompanyDetailInfo, PostCompanyLicenseUpload } from '@/apis/models';
  29. import Upload from '@/components/form/upload.vue';
  30. import { warnToast, successToast } from '@/utils/toastHelper';
  31. import { dataForm, otherDataForm, reset } from '@/components/company/information/image/data.ts';
  32. import { useCommon } from '@/hooks/useCommon';
  33. let { imageprefix } = useCommon();
  34. let props = defineProps(['form_state']);
  35. const emit = defineEmits();
  36. let state = ref<Boolean>(false)
  37. let createForm = ref<CompanyLicenceType.LicenceFormType>(dataForm)
  38. let addOtherForm = ref<CompanyLicenceType.OtherFormType>(otherDataForm)
  39. onMounted(async () => {
  40. getBasic()
  41. })
  42. const getBasic = () => {
  43. PostCompanyDetailInfo().then(res => {
  44. createForm.value.license_path = res.data.license_path
  45. addOtherForm.value = {
  46. license_img: imageprefix + res.data.license_path,
  47. }
  48. })
  49. }
  50. // 营业执照
  51. const uploadPhotoSuccess = (data : Object) => {
  52. addOtherForm.value.license_img = imageprefix + data
  53. createForm.value.license_path = data
  54. }
  55. const saveForm = () => {
  56. PostCompanyLicenseUpload(createForm.value).then(res => {
  57. successToast('保存成功')
  58. resetForm();
  59. getBasic();
  60. })
  61. }
  62. const resetForm = () => {
  63. createForm.value = reset().dataForm as CompanyLicenceType.LicenceFormType;
  64. addOtherForm.value = reset().otherDataForm as CompanyLicenceType.OtherFormType;
  65. state.value = false;
  66. emit("quitEdit")
  67. }
  68. watch(() => [props.form_state], (newVal) => {
  69. state.value = newVal[0];
  70. getBasic();
  71. })
  72. </script>
  73. <style>
  74. </style>