You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.4 KiB

5 years ago
<template>
<div class="d-flex justify-space-between align-center justify-center nav mb-4">
4 years ago
<!-- <a-icon type="left" class="back" /> -->
4 years ago
<div>考勤管理</div>
<a-button type="primary" size="small" class="export" @click="clockExport"> 导出 </a-button>
5 years ago
</div>
</template>
<script>
import { mapState } from 'vuex';
import { clockExport } from '@/config/api';
5 years ago
export default {
data() {
4 years ago
return {};
5 years ago
},
5 years ago
computed: mapState('home', ['projectId', 'startTime', 'endTime', 'memberIdList']),
5 years ago
methods: {
/**
* 导出考勤excel
* @param {string} projectId
* @param {array} memberIdList
* @param {string} startTime
* @param {string} endTime
*/
async clockExport() {
try {
const { projectId, memberIdList, startTime, endTime } = this;
const params = { param: { projectId, memberIdList, startTime, endTime } };
const res = await clockExport(params);
const { code, msg, data } = res.data;
if (code === 200) {
this.$message.success('导出成功');
window.location.href = data.url;
} else {
this.$message.error(msg || '导出失败');
throw msg;
}
} catch (error) {
throw error || '导出失败';
}
},
},
5 years ago
};
</script>
4 years ago
<style lang="less" scoped>
.nav {
position: relative;
5 years ago
}
4 years ago
.back {
position: absolute;
left: 0;
5 years ago
}
4 years ago
.export {
position: absolute;
right: 0;
5 years ago
}
</style>