wupengfei
1 天以前 d32cd83674f9b0db0154e6228807e658539f8cd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<template>
  <ProForm :model="form" ref="dialogForm" label-width="120px" is-read>
    <ProFormCol>
      <ProFormColItem :span="12">
        <ProFormItemV2 label="姓名:" prop="name">
          <ProFormText v-model.trim="form.name"></ProFormText>
        </ProFormItemV2>
      </ProFormColItem>
      <ProFormColItem :span="12">
        <ProFormItemV2 label="实名时间:" prop="userRealTime">
          <div>{{ format(form.userRealTime, 'YYYY-MM-DD HH:mm') }}</div>
        </ProFormItemV2>
      </ProFormColItem>
    </ProFormCol>
    <ProFormCol>
      <ProFormColItem :span="12">
        <ProFormItemV2 label="身份证号:" prop="identity">
          <ProFormText v-model.trim="form.identity"></ProFormText>
        </ProFormItemV2>
      </ProFormColItem>
    </ProFormCol>
    <ProFormCol>
      <ProFormColItem :span="12">
        <ProFormItemV2 label="手机号:" prop="contactPhoneNumber">
          <ProFormText v-model.trim="form.contactPhoneNumber"></ProFormText>
        </ProFormItemV2>
      </ProFormColItem>
    </ProFormCol>
    <ProFormCol>
      <ProFormColItem :span="12">
        <ProFormItemV2 label="性别:" prop="gender">
          <ProFormRadio
            v-model="form.gender"
            :value-enum="EnumUserGenderTextForPerson"
          ></ProFormRadio>
        </ProFormItemV2>
      </ProFormColItem>
    </ProFormCol>
    <ProFormCol>
      <ProFormColItem :span="12">
        <ProFormItemV2 label="年龄:" prop="age">
          <ProFormInputNumber v-model="form.age"> </ProFormInputNumber>
        </ProFormItemV2>
      </ProFormColItem>
    </ProFormCol>
    <ProFormItemV2 label="身份证正面:" prop="identityImg">
      <ProFormImageUpload v-model:file-url="form.identityImg"> </ProFormImageUpload>
    </ProFormItemV2>
    <ProFormItemV2 label="身份证反面:" prop="identityBackImg">
      <ProFormImageUpload v-model:file-url="form.identityBackImg"> </ProFormImageUpload>
    </ProFormItemV2>
  </ProForm>
</template>
 
<script setup lang="ts">
import {
  ProForm,
  ProFormCol,
  ProFormColItem,
  ProFormItemV2,
  ProFormText,
  ProFormInputNumber,
  ProFormImageUpload,
  ProFormRadio,
  UploadUserFile,
} from '@bole-core/components';
import { convertApi2FormUrlOnlyOne, format } from '@/utils';
import { useQuery } from '@tanstack/vue-query';
import { EnumUserGender, EnumUserGenderTextForPerson } from '@/constants';
import * as enterpriseEmployeeServices from '@/services/api/enterpriseEmployee';
 
defineOptions({
  name: 'StaffDetailInfoView',
});
 
type Form = {
  name: string;
  identity: string;
  contactPhoneNumber: string;
  age: number;
  gender: EnumUserGender;
  identityImg: UploadUserFile[];
  identityBackImg: UploadUserFile[];
  userRealTime: string;
};
 
const form = defineModel<Form>('form');
 
// const detail = reactive({
//   name: '',
//   identity: '',
//   contactPhoneNumber: '',
//   gender: EnumUserGender.Male,
//   age: 0,
//   identityImg: [] as UploadUserFile[],
//   identityBackImg: [] as UploadUserFile[],
//   userRealTime: '',
// });
 
// const { isLoading } = useQuery({
//   queryKey: ['enterpriseEmployeeServices/getEnterpriseEmployee', form.value.id],
//   queryFn: async () => {
//     return await enterpriseEmployeeServices.getEnterpriseEmployee({ id: form.value.id });
//   },
//   onSuccess(data) {
//     detail.name = data.name;
//     detail.identity = data.identity;
//     detail.contactPhoneNumber = data.contactPhoneNumber;
//     detail.gender = data.gender;
//     detail.age = data.age ?? 0;
//     detail.identityImg = data.identityImg ? convertApi2FormUrlOnlyOne(data.identityImg) : [];
//     detail.identityBackImg = data.identityBackImg
//       ? convertApi2FormUrlOnlyOne(data.identityBackImg)
//       : [];
//     detail.userRealTime = data.userRealTime ?? '';
//   },
//   enabled: computed(() => !!form.value.id),
// });
</script>