|
@@ -118,6 +118,29 @@ function changeDatePicker(val) {
|
|
|
function userDetails(row) {
|
|
|
showUserDialog.value = true;
|
|
|
}
|
|
|
+
|
|
|
+/* 下载数据 */
|
|
|
+async function downloadExcel() {
|
|
|
+ const res = await apiCustomerUser.getOfficialExport(
|
|
|
+ {
|
|
|
+ Keyword:tableQuery.keyWord,
|
|
|
+ SortParam:tableQuery.sortParam,
|
|
|
+ SortType:tableQuery.sortType,
|
|
|
+ }
|
|
|
+ )
|
|
|
+ const blob = new Blob([res], {
|
|
|
+ type: "application/vnd.ms-excel;charset=utf-8",
|
|
|
+ });
|
|
|
+ let fileName = res.fileName;
|
|
|
+ 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); // 释放URL 对象
|
|
|
+ document.body.removeChild(elink); // 释放标
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -140,7 +163,7 @@ function userDetails(row) {
|
|
|
</el-date-picker>
|
|
|
</div>
|
|
|
<div class="search-box">
|
|
|
- <el-button type="primary" style="margin-right: 20px;">导出表格</el-button>
|
|
|
+ <el-button type="primary" style="margin-right: 20px;" @click="downloadExcel">导出表格</el-button>
|
|
|
<el-input
|
|
|
v-model="tableQuery.keyWord"
|
|
|
:prefix-icon="Search" clearable
|