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.

105 lines
2.6 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>
<div>
<a-button type="primary" icon="search" size="small" class="mr-3" @click="openSearch"> 搜索 </a-button>
<a-button type="primary" size="small" icon="export" @click="clockExport"> 导出 </a-button>
</div>
<div class="timer" v-if="show">
<!-- 时间选择 -->
<TimePicker @changeTime="changeTime" />
<!-- 成员选择 -->
<MemberPicker @changeTime="changeTime" />
<div class="btns mt-3">
<a-button class="btn" size="small"> 取消 </a-button>
<a-button class="btn" type="primary" size="small"> 确认 </a-button>
</div>
</div>
5 years ago
</div>
</template>
<script>
import { mapState } from 'vuex';
import { clockExport } from '@/config/api';
import TimePicker from '@/components/TimePicker/TimePicker.vue';
import MemberPicker from '@/components/MemberPicker/MemberPicker.vue';
5 years ago
export default {
components: { TimePicker, MemberPicker },
5 years ago
data() {
return { show: false };
5 years ago
},
computed: mapState('home', ['projectId', 'startTime', 'endTime', 'memberIdList']),
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 || '导出失败';
}
},
changeTime() {
this.$refs.mychild.setParams();
},
openSearch() {
this.show = !this.show;
},
},
5 years ago
};
</script>
4 years ago
<style lang="less" scoped>
.nav {
position: relative;
// border-bottom: 1px solid #ccc;
5 years ago
}
4 years ago
.back {
position: absolute;
left: 0;
5 years ago
}
.search {
border: none;
}
.timer {
position: absolute;
width: 380px;
height: 150px;
// border: 1px solid black;
top: 50px;
margin-left: 50%;
transform: translate(-50%);
background-color: #fff;
color: black;
box-shadow: 0px 0px 5px #ccc;
z-index: 1;
padding: 26px 24px 24px 24px;
}
.btn {
margin-left: 80px;
}
4 years ago
.export {
position: absolute;
top: 0;
4 years ago
right: 0;
z-index: 2;
5 years ago
}
</style>