|
|
@@ -1,6 +1,35 @@
|
|
|
<template>
|
|
|
<div class="container">
|
|
|
<a-card class="general-card" title="">
|
|
|
+ <a-row>
|
|
|
+ <a-col :flex="1">
|
|
|
+ <a-form
|
|
|
+ :model="formModel"
|
|
|
+ :label-col-props="{ span: 4 }"
|
|
|
+ :wrapper-col-props="{ span: 18 }"
|
|
|
+ label-align="left"
|
|
|
+ >
|
|
|
+ <a-row :gutter="16">
|
|
|
+ <a-col :span="8">
|
|
|
+ <a-form-item
|
|
|
+ :label="$t('searchTable.form.month')"
|
|
|
+ label-col-flex="60px"
|
|
|
+ >
|
|
|
+ <a-month-picker v-model="formModel.time" />
|
|
|
+ </a-form-item>
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="8">
|
|
|
+ <a-button type="primary" @click="downloadExcel">
|
|
|
+ <template #icon>
|
|
|
+ <icon-download />
|
|
|
+ </template>
|
|
|
+ {{ $t('searchTable.form.down') }}
|
|
|
+ </a-button>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-form>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
<a-table
|
|
|
row-key="name"
|
|
|
:loading="loading"
|
|
|
@@ -30,12 +59,15 @@ import type { TableColumnData } from '@arco-design/web-vue/es/table/interface';
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
import useLoading from '@/hooks/loading';
|
|
|
import { Pagination } from '@/types/global';
|
|
|
-import { queryRecordList } from '@/api/record';
|
|
|
+import { queryRecordList, getCheckInList } from '@/api/record';
|
|
|
import type { RecordParams, DataList } from '@/api/record';
|
|
|
import { useIntervalFn } from '@vueuse/core';
|
|
|
+import dayjs from 'dayjs';
|
|
|
+
|
|
|
interface FaceParams {
|
|
|
pageIndex: number;
|
|
|
personNumber: number;
|
|
|
+ time: string;
|
|
|
}
|
|
|
type SizeProps = 'mini' | 'small' | 'medium' | 'large';
|
|
|
type Column = TableColumnData & { checked?: true };
|
|
|
@@ -47,6 +79,7 @@ const generateFormModel = () => {
|
|
|
return {
|
|
|
pageIndex: 1,
|
|
|
personNumber: 20,
|
|
|
+ time: dayjs().format('YYYY-MM'),
|
|
|
} as FaceParams;
|
|
|
};
|
|
|
const formModel = ref<FaceParams>(generateFormModel());
|
|
|
@@ -139,6 +172,32 @@ const onPageChange = (current: number) => {
|
|
|
formModel.value.pageIndex = current;
|
|
|
fetchData();
|
|
|
};
|
|
|
+const downloadExcel = () => {
|
|
|
+ setLoading(true);
|
|
|
+ const params = {
|
|
|
+ time: formModel.value.time,
|
|
|
+ };
|
|
|
+ getCheckInList(params)
|
|
|
+ .then(res => {
|
|
|
+ const contentDisposition = res.headers['content-disposition'];
|
|
|
+ const filenameMatch = contentDisposition.match(/filename="?(.+)"?/);
|
|
|
+ const filename = filenameMatch ? filenameMatch[1] : 'default.xlsx';
|
|
|
+ const blob = new Blob([res.data], {
|
|
|
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
|
+ });
|
|
|
+ const downloadUrl = window.URL.createObjectURL(blob);
|
|
|
+ const link = document.createElement('a');
|
|
|
+ link.href = downloadUrl;
|
|
|
+ link.setAttribute('download', filename);
|
|
|
+ document.body.appendChild(link);
|
|
|
+ link.click();
|
|
|
+ document.body.removeChild(link);
|
|
|
+ window.URL.revokeObjectURL(downloadUrl);
|
|
|
+ })
|
|
|
+ .finally(() => {
|
|
|
+ setLoading(false);
|
|
|
+ });
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|