From e9ac312fdfdf723dfc5b97dbf56df9c339f635f9 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期五, 26 七月 2024 18:04:26 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 src/views/user/student/list.vue |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/src/views/user/student/list.vue b/src/views/user/student/list.vue
index fc074e0..ae48e71 100644
--- a/src/views/user/student/list.vue
+++ b/src/views/user/student/list.vue
@@ -9,6 +9,18 @@
         <router-link :to="{path:'/user/student/edit'}" class="link-left">
           <el-button type="primary">娣诲姞</el-button>
         </router-link>
+        <el-button class="link-left" type="success" @click="exportExcel">瀵煎叆妯℃澘</el-button>
+        <el-upload
+           class="link-left"
+           style="display: inline;"
+           accept=".xls,.xlsx"
+           :multiple="false"
+           action="/api/admin/user/import"
+           :with-credentials="true"
+           :on-success="importSuccess"
+           :show-file-list="false">
+           <el-button type="success">瀵煎叆</el-button>
+         </el-upload>
       </el-form-item>
     </el-form>
 
@@ -70,6 +82,24 @@
     this.search()
   },
   methods: {
+    importSuccess (response) {
+      this.$message.success(response.message);
+      this.search();
+    },
+    exportExcel () {
+      let url = '/api/admin/user/importTemplate'
+      var x = new XMLHttpRequest()
+      x.open('GET', url, true)
+      x.responseType = 'blob'
+      x.onload = function () {
+        var url = window.URL.createObjectURL(x.response)
+        var a = document.createElement('a')
+        a.href = url
+        a.download = '鐢ㄦ埛瀵煎叆妯℃澘.xlsx'
+        a.click()
+      }
+      x.send()
+    },
     search () {
       this.listLoading = true
       userApi.getUserPageList(this.queryParam).then(data => {

--
Gitblit v1.8.0