This commit is contained in:
zhoutianchi
2026-02-03 18:04:37 +08:00
parent 2046eea38a
commit 741752fa48
2 changed files with 233 additions and 234 deletions

View File

@@ -0,0 +1,10 @@
import request from '/@/utils/request';
export const exportTeacherInfoBySelf = (data?: any) => {
return request({
url: '/professional/file/exportTeacherInfoBySelf',
method: 'post',
data: data,
});
};

View File

@@ -1,59 +1,45 @@
<template>
<el-dialog v-model="dialogEmptyFromVisible" title="教职工信息导出" width="80%">
<el-form :inline="true" label-width="100px" style="margin-bottom: 20px;">
<el-form :inline="true" label-width="100px" style="margin-bottom: 20px">
<el-form-item>
<el-tag type="info">导出依据"职工信息"页面的检索条件</el-tag>
<el-tag type="warning" style="margin-left: 10px;">请在搜索后再打开导出页面</el-tag>
<el-tag type="warning" style="margin-left: 10px">请在搜索后再打开导出页面</el-tag>
</el-form-item>
<el-form-item label="是否退休">
<el-select
v-model="tiedTag"
filterable
reserve-keyword
clearable
style="width: 200px;">
<el-option
v-for="item in YES_OR_NO"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
<el-select v-model="tiedTag" filterable reserve-keyword clearable style="width: 200px">
<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"
:icon="Download">导出</el-button>
<el-button type="primary" @click="exportTeacherInfo" :loading="exportLoading" :icon="Download">导出</el-button>
</el-form-item>
</el-form>
<!-- 基础信息 -->
<el-card shadow="never" style="margin-bottom: 20px;">
<el-card shadow="never" style="margin-bottom: 20px">
<template #header>
<div style="display: flex; justify-content: space-between; align-items: center;">
<div style="display: flex; justify-content: space-between; align-items: center">
<span>基础信息</span>
<el-checkbox v-model="allCheckTeacherBaseInfo">全选</el-checkbox>
</div>
</template>
<el-checkbox-group v-model="checkedTeacherBaseInfo">
<el-checkbox v-for="(item, index) in teacherBasicCheckData" :label="item.value" :key="index" style="margin-right: 20px; margin-bottom: 10px;">
<el-checkbox v-for="(item, index) in teacherBasicCheckData" :label="item.value" :key="index" style="margin-right: 20px; margin-bottom: 10px">
{{ item.label }}
</el-checkbox>
</el-checkbox-group>
</el-card>
<!-- 岗位信息 -->
<el-card shadow="never" style="margin-bottom: 20px;">
<el-card shadow="never" style="margin-bottom: 20px">
<template #header>
<div style="display: flex; justify-content: space-between; align-items: center;">
<div style="display: flex; justify-content: space-between; align-items: center">
<span>岗位信息</span>
<el-checkbox v-model="allCheckStationInfo">全选</el-checkbox>
</div>
</template>
<el-checkbox-group v-model="checkedTeacherStationInfo">
<el-checkbox v-for="(item, index) in teacherStationData" :key="index" :label="item.value" style="margin-right: 20px; margin-bottom: 10px;">
<el-checkbox v-for="(item, index) in teacherStationData" :key="index" :label="item.value" style="margin-right: 20px; margin-bottom: 10px">
{{ item.label }}
</el-checkbox>
</el-checkbox-group>
@@ -62,45 +48,44 @@
<!-- 其他 -->
<el-card shadow="never">
<template #header>
<div style="display: flex; justify-content: space-between; align-items: center;">
<div style="display: flex; justify-content: space-between; align-items: center">
<span>其他</span>
<el-checkbox v-model="allCheckedother">全选</el-checkbox>
</div>
</template>
<el-checkbox-group v-model="checkedTeacherOtherInfo">
<el-checkbox v-for="(item, index) in teacherOtherData" :key="index" :label="item.value" style="margin-right: 20px; margin-bottom: 10px;">
<el-checkbox v-for="(item, index) in teacherOtherData" :key="index" :label="item.value" style="margin-right: 20px; margin-bottom: 10px">
{{ item.label }}
</el-checkbox>
</el-checkbox-group>
</el-card>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { ElNotification } from 'element-plus'
import { Download } from '@element-plus/icons-vue'
import global from '/@/components/tools/commondict.vue'
import request from '/@/utils/request'
import { ref, watch } from 'vue';
import { ElNotification } from 'element-plus';
import { Download } from '@element-plus/icons-vue';
import global from '/@/components/tools/commondict.vue';
import request from '/@/utils/request';
import { exportTeacherInfoBySelf } from '/@/api/professional/professionalfile';
// Props
const props = defineProps<{
search: any
}>()
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 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_姓名' },
@@ -124,7 +109,7 @@
{ label: '授课类型', value: 'teacherCate_授课类型' },
{ label: '允许进出', value: 'inoutFlag_允许进出' },
{ label: '进出情况备注', value: 'inoutRemarks_进出情况备注' },
]
];
const teacherStationData = [
{ label: '教师类型', value: 'teacherTypeName_教师类型' },
@@ -142,7 +127,7 @@
{ label: '任现职务时间', value: 'dutyDate_任现职务时间' },
{ label: '进编时间', value: 'entryDutyDate_进编时间' },
{ label: '进校时间', value: 'entrySchoolDate_进校时间' },
]
];
const teacherOtherData = [
{ label: '职业资格工种', value: 'zyzg_职业资格工种' },
@@ -155,7 +140,7 @@
{ label: '中等教师资格证', value: 'midCer_中等教师资格证' },
{ label: '教师上岗证', value: 'priCer_教师上岗证' },
// {label:'共同居住人',value:'livewith_共同居住人'},
]
];
// 导出文件函数
const exportForModel = async (params: any, fileNameStr: string, url: string) => {
@@ -166,57 +151,57 @@
data: params,
responseType: 'blob',
headers: {
'Content-Type': 'application/json'
}
})
const blob = new Blob([res])
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)
'Content-Type': 'application/json',
},
});
const blob = new Blob([res]);
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)
checkedTeacherBaseInfo.value = teacherBasicCheckData.map((item) => item.value);
} else {
checkedTeacherBaseInfo.value = []
checkedTeacherBaseInfo.value = [];
}
})
});
watch(allCheckStationInfo, (newVal) => {
if (newVal) {
checkedTeacherStationInfo.value = teacherStationData.map(item => item.value)
checkedTeacherStationInfo.value = teacherStationData.map((item) => item.value);
} else {
checkedTeacherStationInfo.value = []
checkedTeacherStationInfo.value = [];
}
})
});
watch(allCheckedother, (newVal) => {
if (newVal) {
checkedTeacherOtherInfo.value = teacherOtherData.map(item => item.value)
checkedTeacherOtherInfo.value = teacherOtherData.map((item) => item.value);
} else {
checkedTeacherOtherInfo.value = []
checkedTeacherOtherInfo.value = [];
}
})
});
// 方法
const init = () => {
tiedTag.value = props.search.tied
dialogEmptyFromVisible.value = true
}
tiedTag.value = props.search.tied;
dialogEmptyFromVisible.value = true;
};
const exportTeacherInfo = async () => {
if (checkedTeacherBaseInfo.value.length == 0 && checkedTeacherStationInfo.value.length == 0 && checkedTeacherOtherInfo.value.length == 0) {
@@ -224,33 +209,37 @@
title: '警告',
message: '请选择要导出的字段',
type: 'warning',
duration: 3000
})
return
duration: 3000,
});
return;
}
exportLoading.value = true
exportLoading.value = true;
const searchData = JSON.parse(JSON.stringify(props.search))
searchData.tied = tiedTag.value
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
}
checkedTeacherBaseInfo: checkedTeacherBaseInfo.value,
checkedTeacherStationInfo: checkedTeacherStationInfo.value,
checkedTeacherOtherInfo: checkedTeacherOtherInfo.value,
teacherBaseDTO: searchData,
};
await exportForModel(params, "教职工信息.xls", "/professional/file/exportTeacherInfoBySelf")
exportTeacherInfoBySelf(params).then((res:any)=>{
ElNotification.success({
title: '下载后台进行中',
message: '操作成功'
})
});
setTimeout(() => {
exportLoading.value = false
}, 3000)
}
exportLoading.value = false;
}, 3000);
};
// 暴露方法给父组件
defineExpose({
init
})
init,
});
</script>
<style scoped>
</style>
<style scoped></style>