diff --git a/src/api/resource/register.ts b/src/api/resource/register.ts index 0dffcfb..d5d7e3c 100644 --- a/src/api/resource/register.ts +++ b/src/api/resource/register.ts @@ -337,3 +337,13 @@ data, }) } + +// 导出人员登记文件流 +export function exportStaffDetail(data: any) { + return request({ + url: `${prefix}/base/exportFile`, + method: 'post', + data, + responseType: 'blob', + }) +} diff --git a/src/api/resource/register.ts b/src/api/resource/register.ts index 0dffcfb..d5d7e3c 100644 --- a/src/api/resource/register.ts +++ b/src/api/resource/register.ts @@ -337,3 +337,13 @@ data, }) } + +// 导出人员登记文件流 +export function exportStaffDetail(data: any) { + return request({ + url: `${prefix}/base/exportFile`, + method: 'post', + data, + responseType: 'blob', + }) +} diff --git a/src/views/resource/person/register/component/basic.vue b/src/views/resource/person/register/component/basic.vue index e9c2108..08f7dce 100644 --- a/src/views/resource/person/register/component/basic.vue +++ b/src/views/resource/person/register/component/basic.vue @@ -3,8 +3,7 @@ import type { UploadProps } from 'element-plus' import { ElLoading, ElMessage, ElMessageBox, dayjs } from 'element-plus' import type { IStaffBasicInfo } from '../person-regitster' -// import FilterSysUser from '@/views/resource/common/filterSysUser.vue' -import FilterSysUser from '../../../common/filterSysUser.vue' +import FilterSysUser from '@/views/resource/common/filterSysUser.vue' import type { IDictType } from '@/commonInterface/resource-interface' import nationList from '@/assets/json/nation-code.json' import { UploadFile } from '@/api/file' @@ -85,11 +84,17 @@ // 获取性别 第17位 奇数为男 偶数为女 if (Number(idCardStr.substring(16, 17)) % 2) { const tarList = genderDict.value.filter(item => item.name === '男') - if (tarList.length > 0) { staffBasicInfo.value.gender = tarList[0].value } + if (tarList.length > 0) { + staffBasicInfo.value.gender = tarList[0].value + staffBasicInfo.value.genderName = tarList[0].name + } } else { const tarList = genderDict.value.filter(item => item.name === '女') - if (tarList.length > 0) { staffBasicInfo.value.gender = tarList[0].value } + if (tarList.length > 0) { + staffBasicInfo.value.gender = tarList[0].value + staffBasicInfo.value.genderName = tarList[0].name + } } callback() @@ -344,13 +349,13 @@ // 监听性别 显示中文 立即监听 watch(() => staffBasicInfo.value.gender, (newVal) => { getGenderDict() - const targetList = genderDict.value.filter(item => item.value === newVal) + /* const targetList = genderDict.value.filter(item => item.value === newVal) if (targetList.length > 0) { staffBasicInfo.value.genderName = targetList[0].name } else { staffBasicInfo.value.genderName = '' - } + } */ }, { immediate: true }) // 监听学历 显示中文 立即监听 @@ -461,7 +466,7 @@ @@ -478,7 +483,7 @@ @@ -509,7 +514,7 @@ @@ -517,7 +522,7 @@ @@ -546,21 +551,21 @@ @@ -575,14 +580,14 @@ @@ -599,7 +604,7 @@ @@ -611,7 +616,7 @@ diff --git a/src/api/resource/register.ts b/src/api/resource/register.ts index 0dffcfb..d5d7e3c 100644 --- a/src/api/resource/register.ts +++ b/src/api/resource/register.ts @@ -337,3 +337,13 @@ data, }) } + +// 导出人员登记文件流 +export function exportStaffDetail(data: any) { + return request({ + url: `${prefix}/base/exportFile`, + method: 'post', + data, + responseType: 'blob', + }) +} diff --git a/src/views/resource/person/register/component/basic.vue b/src/views/resource/person/register/component/basic.vue index e9c2108..08f7dce 100644 --- a/src/views/resource/person/register/component/basic.vue +++ b/src/views/resource/person/register/component/basic.vue @@ -3,8 +3,7 @@ import type { UploadProps } from 'element-plus' import { ElLoading, ElMessage, ElMessageBox, dayjs } from 'element-plus' import type { IStaffBasicInfo } from '../person-regitster' -// import FilterSysUser from '@/views/resource/common/filterSysUser.vue' -import FilterSysUser from '../../../common/filterSysUser.vue' +import FilterSysUser from '@/views/resource/common/filterSysUser.vue' import type { IDictType } from '@/commonInterface/resource-interface' import nationList from '@/assets/json/nation-code.json' import { UploadFile } from '@/api/file' @@ -85,11 +84,17 @@ // 获取性别 第17位 奇数为男 偶数为女 if (Number(idCardStr.substring(16, 17)) % 2) { const tarList = genderDict.value.filter(item => item.name === '男') - if (tarList.length > 0) { staffBasicInfo.value.gender = tarList[0].value } + if (tarList.length > 0) { + staffBasicInfo.value.gender = tarList[0].value + staffBasicInfo.value.genderName = tarList[0].name + } } else { const tarList = genderDict.value.filter(item => item.name === '女') - if (tarList.length > 0) { staffBasicInfo.value.gender = tarList[0].value } + if (tarList.length > 0) { + staffBasicInfo.value.gender = tarList[0].value + staffBasicInfo.value.genderName = tarList[0].name + } } callback() @@ -344,13 +349,13 @@ // 监听性别 显示中文 立即监听 watch(() => staffBasicInfo.value.gender, (newVal) => { getGenderDict() - const targetList = genderDict.value.filter(item => item.value === newVal) + /* const targetList = genderDict.value.filter(item => item.value === newVal) if (targetList.length > 0) { staffBasicInfo.value.genderName = targetList[0].name } else { staffBasicInfo.value.genderName = '' - } + } */ }, { immediate: true }) // 监听学历 显示中文 立即监听 @@ -461,7 +466,7 @@ @@ -478,7 +483,7 @@ @@ -509,7 +514,7 @@ @@ -517,7 +522,7 @@ @@ -546,21 +551,21 @@ @@ -575,14 +580,14 @@ @@ -599,7 +604,7 @@ @@ -611,7 +616,7 @@ diff --git a/src/views/resource/person/register/detail.vue b/src/views/resource/person/register/detail.vue index 7180def..32af9be 100644 --- a/src/views/resource/person/register/detail.vue +++ b/src/views/resource/person/register/detail.vue @@ -6,6 +6,9 @@ import RegisterResume from './component/resume.vue' import RegisterVerifier from './component/verifier.vue' import RegisterTrainning from './component/trainning.vue' +import type { IStaffBasicInfo } from './person-regitster' +import { exportFile, printContent } from '@/utils/exportUtils' +import { exportStaffDetail } from '@/api/resource/register' // 定义变量 const route = useRoute() @@ -25,6 +28,7 @@ const currentLabel = ref('') const staffId = ref('') +const staffDetail = ref() // 子组件的引用 const refRegisterBasic = ref() @@ -35,11 +39,15 @@ // 逻辑 const printToWord = () => { - + exportStaffDetail({ id: staffId.value, pdf: false }).then((res) => { + exportFile(res.data, `人员基本信息-${staffDetail.value?.staffName}-${staffDetail.value?.staffNo}.doc`) + }) } const printToPDF = () => { - + exportStaffDetail({ id: staffId.value, pdf: true }).then((res) => { + exportFile(res.data, `人员基本信息-${staffDetail.value?.staffName}-${staffDetail.value?.staffNo}.pdf`) + }) } // 关闭 @@ -82,6 +90,8 @@ title.value = '人员登记(详情)' staffId.value = params.id + staffDetail.value = JSON.parse(sessionStorage.getItem('staffBasicInfo')!) + // 调用子组件的方法 refRegisterBasic.value.getStaffBasicById(staffId.value)