|
@@ -103,7 +103,7 @@
|
|
|
</el-header>
|
|
|
<el-main class="nopadding page2">
|
|
|
<div class="jp-table top" style="">
|
|
|
- <vxe-toolbar :refresh="{query: resetSearch}" ref="toolbarRef" export custom>
|
|
|
+ <vxe-toolbar :refresh="{query: resetSearch}" ref="toolbarRef" import export custom>
|
|
|
<template #buttons>
|
|
|
<el-button type="primary" icon="el-icon-plus" @click="start()">新建</el-button>
|
|
|
</template>
|
|
@@ -117,6 +117,14 @@
|
|
|
class="tool-btn"
|
|
|
@click="searchVisible = !searchVisible"
|
|
|
></vxe-button>
|
|
|
+ <vxe-button
|
|
|
+ type="text"
|
|
|
+ title="下载导入模板"
|
|
|
+ icon="vxe-icon-copy"
|
|
|
+ class="tool-btn m-l-0"
|
|
|
+ @click="downloadTpl()"
|
|
|
+ >
|
|
|
+ </vxe-button>
|
|
|
</template>
|
|
|
</vxe-toolbar>
|
|
|
<div style="height: calc(100% - 90px)">
|
|
@@ -131,6 +139,11 @@
|
|
|
show-overflow
|
|
|
highlight-hover-row
|
|
|
:print-config="{}"
|
|
|
+ :import-config="{
|
|
|
+ importMethod: importMethod,
|
|
|
+ types: ['csv', 'xls', 'xlsx'],
|
|
|
+ remote: true,
|
|
|
+ }"
|
|
|
:export-config="{
|
|
|
remote: true,
|
|
|
filename: `入职登记信息${moment(new Date()).format('YYYY-MM-DD')}`,
|
|
@@ -438,6 +451,36 @@
|
|
|
|
|
|
}
|
|
|
},
|
|
|
+ // 下载模板
|
|
|
+ downloadTpl() {
|
|
|
+ // this.$utils.downloadExcel('/sys/user/import/template')
|
|
|
+ enrollmentRegistrationService
|
|
|
+ .exportTemplate()
|
|
|
+ .then((data) => {
|
|
|
+ // 将二进制流文件写入excel表,以下为重要步骤
|
|
|
+ this.$utils.downloadExcel(data, "用户导入模板");
|
|
|
+ })
|
|
|
+ .catch(function (err) {
|
|
|
+ if (err.response) {
|
|
|
+ console.log(err.response);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 自定义服务端导入
|
|
|
+ importMethod({ file }) {
|
|
|
+ // 处理表单
|
|
|
+ const formBody = new FormData();
|
|
|
+ formBody.append("file", file);
|
|
|
+ enrollmentRegistrationService.importExcel(formBody).then((result) => {
|
|
|
+ this.$message.success({
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
+ message: result,
|
|
|
+ });
|
|
|
+ this.refreshList();
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
// 自定义服务端导出
|
|
|
exportMethod ({ options }) {
|
|
|
// 传给服务端的参数
|