tuqin
10 天以前 2cb77a3487b8c5da6fe02f3c1018dcf70f73d29a
src/views/hrm/employee/modules/form.vue
@@ -16,7 +16,6 @@
import EducationList from './education-list.vue';
import WorkHistoryList from './work-history-list.vue';
import EmergencyContactList from './emergency-contact-list.vue';
import SocialSecurityList from './social-security-list.vue';
import EmployeeDetail from './detail.vue';
const emit = defineEmits(['success']);
@@ -30,7 +29,6 @@
const educationListRef = ref<InstanceType<typeof EducationList>>();
const workHistoryListRef = ref<InstanceType<typeof WorkHistoryList>>();
const emergencyContactListRef = ref<InstanceType<typeof EmergencyContactList>>();
const socialSecurityListRef = ref<InstanceType<typeof SocialSecurityList>>();
const isDetail = computed(() => formType.value === 'detail');
const getTitle = computed(() => {
@@ -68,6 +66,10 @@
    // 提交表单
    const data = (await formApi.getValues()) as HrmEmployeeApi.Employee;
    data.remark = remark.value;
    // 附件:把 FileUpload 的值转成 blobId 数组
    if (Array.isArray(data.blobIds)) {
      data.blobIds = (data.blobIds as any[]).map((item) => item?.id ?? item);
    }
    // 获取子表数据
    data.educations = educationListRef.value?.getData();
    data.workHistories = workHistoryListRef.value?.getData();
@@ -113,7 +115,14 @@
      employeeData.value = formData;
      remark.value = formData.remark;
      if (data.formType !== 'detail') {
        await formApi.setValues(formData);
        const blobIds = (formData.attachmentList || []).map((item) => ({
          uid: String(item.id),
          name: item.name || '',
          url: item.url || '',
          status: 'done',
          id: item.id,
        }));
        await formApi.setValues({ ...formData, blobIds });
      }
    } finally {
      modalApi.unlock();
@@ -153,14 +162,6 @@
            ref="emergencyContactListRef"
            :form-type="formType"
            :employee-id="employeeId"
          />
        </Tabs.TabPane>
        <Tabs.TabPane key="socialSecurity" tab="社保公积金档案" v-if="employeeId">
          <SocialSecurityList
            ref="socialSecurityListRef"
            :form-type="formType"
            :employee-id="employeeId"
            :user-id="employeeData?.userId"
          />
        </Tabs.TabPane>
      </Tabs>