| | |
| | | <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> |
| | | |
| | |
| | | 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 => { |