a
This commit is contained in:
254
src/views/professional/teacherbase/export-teacher-info.vue
Normal file
254
src/views/professional/teacherbase/export-teacher-info.vue
Normal file
@@ -0,0 +1,254 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogEmptyFromVisible" title="教职工信息导出" width="80%">
|
||||
<el-form style="margin-left: 7px" :inline="true">
|
||||
<el-form-item>
|
||||
<el-tag>导出教职工人数,依据'职工信息'页面检索条件,如部门,职称等级等条件</el-tag>
|
||||
<el-tag type="warning">*请在'职工信息'页面点击搜索后,再点开当前导出页面</el-tag>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否退休">
|
||||
<el-select
|
||||
v-model="tiedTag"
|
||||
filterable
|
||||
reserve-keyword
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in YES_OR_NO"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="exportTeacherInfo"
|
||||
:loading="exportLoading"
|
||||
size="small">导出</el-button>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
||||
<!-- 基本信息 -->
|
||||
<div class="div_stuData" style="margin-bottom: 5px;margin-top: 5px;">基础信息
|
||||
<el-checkbox v-model="allCheckTeacherBaseInfo" style="margin-left:20px">全选</el-checkbox>
|
||||
</div>
|
||||
<el-tabs type="border-card" tab-position="left">
|
||||
<el-form ref="baseForm" label-width="120px">
|
||||
<el-row>
|
||||
<el-checkbox-group v-model="checkedTeacherBaseInfo">
|
||||
<el-checkbox v-for="(item,index) in teacherBasicCheckData" :label="item.value" :key="index">{{item.label}}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-tabs>
|
||||
|
||||
<!-- 岗位信息 -->
|
||||
<div class="div_stuData" style="margin-bottom: 5px;margin-top: 5px;">岗位信息
|
||||
<el-checkbox v-model="allCheckStationInfo">全选</el-checkbox>
|
||||
</div>
|
||||
<el-tabs type="border-card" tab-position="left">
|
||||
<el-form ref="baseForm" label-width="120px">
|
||||
<el-row>
|
||||
<el-checkbox-group v-model="checkedTeacherStationInfo">
|
||||
<el-checkbox v-for="(item, index) in teacherStationData" :key="index" :label="item.value">{{item.label}}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-tabs>
|
||||
|
||||
<!-- 其他 -->
|
||||
<div class="div_stuData" style="margin-bottom: 5px;margin-top: 5px;">其他
|
||||
<el-checkbox v-model="allCheckedother" style="margin-left: 20px">全选</el-checkbox>
|
||||
</div>
|
||||
<el-tabs type="border-card" tab-position="left">
|
||||
<el-form ref="baseForm" label-width="120px">
|
||||
<el-row>
|
||||
<el-checkbox-group v-model="checkedTeacherOtherInfo">
|
||||
<el-checkbox v-for="(item, index) in teacherOtherData" :key="index" :label="item.value">{{item.label}}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-tabs>
|
||||
|
||||
</el-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
import { ElNotification } from 'element-plus'
|
||||
import global from '/@/components/tools/commondict.vue'
|
||||
import request from '/@/utils/request'
|
||||
|
||||
// Props
|
||||
const props = defineProps<{
|
||||
search: any
|
||||
}>()
|
||||
|
||||
// 响应式数据
|
||||
const tiedTag = ref('')
|
||||
const YES_OR_NO = global.YES_OR_NO
|
||||
const exportLoading = ref(false)
|
||||
const dialogEmptyFromVisible = ref(false)
|
||||
const allCheckTeacherBaseInfo = ref(false)
|
||||
const allCheckStationInfo = ref(false)
|
||||
const allCheckedother = ref(false)
|
||||
const checkedTeacherBaseInfo = ref<string[]>([])
|
||||
const checkedTeacherStationInfo = ref<string[]>([])
|
||||
const checkedTeacherOtherInfo = ref<string[]>([])
|
||||
|
||||
const teacherBasicCheckData = [
|
||||
{label:'姓名',value:'realName_姓名'},
|
||||
{label:'工号',value:'teacherNo_工号'},
|
||||
{label:'部门',value:'deptCode_部门'},
|
||||
{label:'性别',value:'sex_性别'},
|
||||
{label:'身份证',value:'idCard_身份证'},
|
||||
{label:'出生年月',value:'birthday_出生年月'},
|
||||
{label:'年龄',value:'age_年龄'},
|
||||
{label:'手机',value:'telPhone_手机'},
|
||||
{label:'手机2',value:'telPhoneTwo_手机2'},
|
||||
{label:'宅电',value:'homePhone_宅电'},
|
||||
{label:'民族',value:'national_民族'},
|
||||
{label:'籍贯',value:'nativePlace_籍贯'},
|
||||
{label:'出生地',value:'birthPlace_出生地'},
|
||||
{label:'健康状况',value:'health_健康状况'},
|
||||
{label:'特长',value:'speciality_特长'},
|
||||
{label:'银行卡号',value:'bankNo_银行卡号'},
|
||||
{label:'开户行',value:'bankOpen_开户行'},
|
||||
{label:'家庭住址',value:'homeAddress_家庭住址'},
|
||||
{label:'授课类型',value:'teacherCate_授课类型'},
|
||||
{label:'允许进出',value:'inoutFlag_允许进出'},
|
||||
{label:'进出情况备注',value:'inoutRemarks_进出情况备注'},
|
||||
]
|
||||
|
||||
const teacherStationData = [
|
||||
{label:'教师类型',value:'teacherTypeName_教师类型'},
|
||||
{label:'党支部',value:'branchName_党支部'},
|
||||
{label:'用工性质',value:'employmentNatureName_用工性质'},
|
||||
{label:'岗位类别',value:'stationTypeName_岗位类别'},
|
||||
{label:'岗位级别',value:'stationLevelName_岗位级别'},
|
||||
{label:'职务级别',value:'stationDutyLevelName_职务级别'},
|
||||
{label:'任现岗位职级时间',value:'stationDate_任现岗位职级时间'},
|
||||
{label:'在职情况',value:'atStationName_在职情况'},
|
||||
{label:'职务',value:'dutyDesc_职务'},
|
||||
{label:'参加工作时间',value:'workDate_参加工作时间'},
|
||||
{label:'退休时间',value:'retireDate_退休时间'},
|
||||
{label:'职位类别',value:'teacherClassify_职位类别'},
|
||||
{label:'任现职务时间',value:'dutyDate_任现职务时间'},
|
||||
{label:'进编时间',value:'entryDutyDate_进编时间'},
|
||||
{label:'进校时间',value:'entrySchoolDate_进校时间'},
|
||||
]
|
||||
|
||||
const teacherOtherData = [
|
||||
{label:'职业资格工种',value:'zyzg_职业资格工种'},
|
||||
{label:'职业资格等级',value:'zyzgLevel_职业资格等级'},
|
||||
{label:'政治面貌',value:'zzmm_政治面貌'},
|
||||
{label:'学历',value:'xl_学历'},
|
||||
{label:'学位',value:'xw_学位'},
|
||||
{label:'职称',value:'zc_职称'},
|
||||
{label:'高校教师资格证',value:'highCer_高校教师资格证'},
|
||||
{label:'中等教师资格证',value:'midCer_中等教师资格证'},
|
||||
{label:'教师上岗证',value:'priCer_教师上岗证'},
|
||||
{label:'共同居住人',value:'livewith_共同居住人'},
|
||||
]
|
||||
|
||||
// 导出文件函数
|
||||
const exportForModel = async (params: any, fileNameStr: string, url: string) => {
|
||||
try {
|
||||
const res = await request({
|
||||
method: 'post',
|
||||
url: url,
|
||||
data: params,
|
||||
responseType: 'blob',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
const blob = new Blob([res.data])
|
||||
const fileName = fileNameStr
|
||||
const elink = document.createElement('a')
|
||||
elink.download = fileName
|
||||
elink.style.display = 'none'
|
||||
elink.href = URL.createObjectURL(blob)
|
||||
document.body.appendChild(elink)
|
||||
elink.click()
|
||||
URL.revokeObjectURL(elink.href)
|
||||
document.body.removeChild(elink)
|
||||
} catch (err) {
|
||||
ElNotification.error({
|
||||
title: '错误',
|
||||
message: '导出失败',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Watch
|
||||
watch(allCheckTeacherBaseInfo, (newVal) => {
|
||||
if (newVal) {
|
||||
checkedTeacherBaseInfo.value = teacherBasicCheckData.map(item => item.value)
|
||||
} else {
|
||||
checkedTeacherBaseInfo.value = []
|
||||
}
|
||||
})
|
||||
|
||||
watch(allCheckStationInfo, (newVal) => {
|
||||
if (newVal) {
|
||||
checkedTeacherStationInfo.value = teacherStationData.map(item => item.value)
|
||||
} else {
|
||||
checkedTeacherStationInfo.value = []
|
||||
}
|
||||
})
|
||||
|
||||
watch(allCheckedother, (newVal) => {
|
||||
if (newVal) {
|
||||
checkedTeacherOtherInfo.value = teacherOtherData.map(item => item.value)
|
||||
} else {
|
||||
checkedTeacherOtherInfo.value = []
|
||||
}
|
||||
})
|
||||
|
||||
// 方法
|
||||
const init = () => {
|
||||
tiedTag.value = props.search.tied
|
||||
dialogEmptyFromVisible.value = true
|
||||
}
|
||||
|
||||
const exportTeacherInfo = async () => {
|
||||
if (checkedTeacherBaseInfo.value.length == 0 && checkedTeacherStationInfo.value.length == 0 && checkedTeacherOtherInfo.value.length == 0) {
|
||||
ElNotification({
|
||||
title: '警告',
|
||||
message: '请选择要导出的字段',
|
||||
type: 'warning',
|
||||
duration: 3000
|
||||
})
|
||||
return
|
||||
}
|
||||
exportLoading.value = true
|
||||
|
||||
const searchData = JSON.parse(JSON.stringify(props.search))
|
||||
searchData.tied = tiedTag.value
|
||||
const params = {
|
||||
"checkedTeacherBaseInfo": checkedTeacherBaseInfo.value,
|
||||
"checkedTeacherStationInfo": checkedTeacherStationInfo.value,
|
||||
"checkedTeacherOtherInfo": checkedTeacherOtherInfo.value,
|
||||
"teacherBaseDTO": searchData
|
||||
}
|
||||
|
||||
await exportForModel(params, "教职工信息.xls", "/professional/teacherbase/exportTeacherInfoBySelf")
|
||||
|
||||
setTimeout(() => {
|
||||
exportLoading.value = false
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
// 暴露方法给父组件
|
||||
defineExpose({
|
||||
init
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user