|
@@ -8,6 +8,12 @@
|
|
|
@click="handleCreate"
|
|
|
>新增</a-button
|
|
|
>
|
|
|
+ <a-button
|
|
|
+ v-power="[RoleEnum.COMPANY_ADMIN, RoleEnum.PLAT_ADMIN]"
|
|
|
+ type="error"
|
|
|
+ @click="handleExport"
|
|
|
+ >导出数据</a-button
|
|
|
+ >
|
|
|
</template>
|
|
|
<template #headerTop v-if="getCheckRole([RoleEnum.COMPANY_ADMIN])">
|
|
|
<Alert
|
|
@@ -65,7 +71,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
- import { defineComponent, computed, onMounted, ref } from 'vue';
|
|
|
+ import { defineComponent, computed, onMounted, ref, reactive } from 'vue';
|
|
|
import {
|
|
|
BasicTable,
|
|
|
useTable,
|
|
@@ -82,13 +88,14 @@
|
|
|
import DelListModal from './delListModal.vue';
|
|
|
import { Alert } from 'ant-design-vue';
|
|
|
// import { h } from 'vue';
|
|
|
- import { ListApi, delApi, preDelApi, getNumByStaff } from '/@/api/staff/list';
|
|
|
+ import { ListApi, delApi, preDelApi, getNumByStaff, exportApi } from '/@/api/staff/list';
|
|
|
import { useI18n } from '/@/hooks/web/useI18n';
|
|
|
// import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard';
|
|
|
import { RoleEnum } from '/@/enums/roleEnum';
|
|
|
import { useGo } from '/@/hooks/web/usePage';
|
|
|
import { Time } from '/@/components/Time';
|
|
|
import { useUserStore } from '/@/store/modules/user';
|
|
|
+ import { ExportParams } from '/@/api/staff/model';
|
|
|
export default defineComponent({
|
|
|
components: {
|
|
|
BasicTable,
|
|
@@ -120,6 +127,11 @@
|
|
|
getNumByStaffData();
|
|
|
});
|
|
|
|
|
|
+ let searchInfo: ExportParams = reactive({
|
|
|
+ staffName: '',
|
|
|
+ staffPhone: '',
|
|
|
+ });
|
|
|
+
|
|
|
const columns: BasicColumn[] = [
|
|
|
{
|
|
|
title: 'ID',
|
|
@@ -238,6 +250,10 @@
|
|
|
let order = sortInfo.order && sortInfo.order.replace('end', '');
|
|
|
return { ...sortInfo, sidx: sortInfo.field, order: order };
|
|
|
},
|
|
|
+ searchInfo: searchInfo,
|
|
|
+ handleSearchInfoFn(data) {
|
|
|
+ searchInfo = Object.assign(searchInfo, data);
|
|
|
+ },
|
|
|
});
|
|
|
|
|
|
function renderRoleType(type: number): string {
|
|
@@ -305,6 +321,22 @@
|
|
|
},
|
|
|
});
|
|
|
}
|
|
|
+ async function handleExport() {
|
|
|
+ const data = await exportApi(searchInfo);
|
|
|
+ const downloadBlob = new Blob([data], {
|
|
|
+ type: 'application/msexcel',
|
|
|
+ });
|
|
|
+ const url = URL.createObjectURL(downloadBlob);
|
|
|
+ const a: HTMLAnchorElement = document.createElement('a');
|
|
|
+ document.body.appendChild(a);
|
|
|
+ a.style.display = 'none';
|
|
|
+ a.href = url;
|
|
|
+ const name = new Date().getTime();
|
|
|
+ a.download = `${name}.csv`;
|
|
|
+ a.click();
|
|
|
+ window.URL.revokeObjectURL(url);
|
|
|
+ }
|
|
|
+
|
|
|
return {
|
|
|
registerTable,
|
|
|
registerDetail,
|
|
@@ -327,6 +359,7 @@
|
|
|
surplusSubNum,
|
|
|
getCheckRole,
|
|
|
getNumByStaffData,
|
|
|
+ handleExport,
|
|
|
};
|
|
|
},
|
|
|
});
|