|
|
@@ -4,23 +4,29 @@
|
|
|
<el-input placeholder="输入关键字" v-model="search" clearable class="filter-item"></el-input>
|
|
|
<el-button @click="getData" type="primary" icon="el-icon-search" class="filter-item">搜索 </el-button>
|
|
|
<!-- <el-button @click="addRow" type="primary" icon="el-icon-plus" class="filter-item">添加 </el-button> -->
|
|
|
- <el-button
|
|
|
- @click="download"
|
|
|
- type="primary"
|
|
|
- icon="el-icon-download"
|
|
|
- :loading="downloading"
|
|
|
- class="filter-item"
|
|
|
- >导出EXCEL
|
|
|
+ <el-button @click="download" type="primary" icon="el-icon-download" :loading="downloading"
|
|
|
+ >导出所有
|
|
|
</el-button>
|
|
|
- <el-button
|
|
|
- @click="downloadTel"
|
|
|
- type="primary"
|
|
|
- icon="el-icon-download"
|
|
|
- :loading="downloading"
|
|
|
- class="filter-item"
|
|
|
+ <el-button @click="downloadTel" type="primary" icon="el-icon-download" :loading="downloading"
|
|
|
>导出固定电话
|
|
|
</el-button>
|
|
|
- <el-button @click="sendSms" type="primary" class="filter-item">短信通知 </el-button>
|
|
|
+ <el-upload
|
|
|
+ :action="uploadUrl"
|
|
|
+ :before-upload="beforeUpload"
|
|
|
+ :headers="headers"
|
|
|
+ :show-file-list="false"
|
|
|
+ ref="upload"
|
|
|
+ :on-success="onSuccess"
|
|
|
+ class="uploader"
|
|
|
+ :on-error="onfail"
|
|
|
+ :loading="loading"
|
|
|
+ :disabled="loading"
|
|
|
+ >
|
|
|
+ <el-button slot="trigger" type="primary" icon="el-icon-upload2" :loading="loading" :disabled="loading"
|
|
|
+ >批量上传</el-button
|
|
|
+ >
|
|
|
+ </el-upload>
|
|
|
+ <el-button @click="sendSms" type="primary">短信通知 </el-button>
|
|
|
</div>
|
|
|
<el-table
|
|
|
:data="tableData"
|
|
|
@@ -96,6 +102,7 @@
|
|
|
<script>
|
|
|
import { mapState } from 'vuex';
|
|
|
import pageableTable from '@/mixins/pageableTable';
|
|
|
+import resolveUrl from 'resolve-url';
|
|
|
|
|
|
export default {
|
|
|
name: 'TrainingInstitutionList',
|
|
|
@@ -105,14 +112,24 @@ export default {
|
|
|
multipleMode: false,
|
|
|
search: '',
|
|
|
url: '/trainingInstitution/all',
|
|
|
- downloading: false
|
|
|
+ downloading: false,
|
|
|
+ loading: false,
|
|
|
+ uploadUrl: ''
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
selection() {
|
|
|
return this.$refs.table.selection.map(i => i.id);
|
|
|
+ },
|
|
|
+ headers() {
|
|
|
+ return {
|
|
|
+ Authorization: 'Bearer ' + sessionStorage.getItem('token')
|
|
|
+ };
|
|
|
}
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.uploadUrl = resolveUrl(this.$baseUrl, 'trainingInstitution/upload');
|
|
|
+ },
|
|
|
methods: {
|
|
|
beforeGetData() {
|
|
|
return { search: this.search };
|
|
|
@@ -225,8 +242,34 @@ export default {
|
|
|
this.$message.error(e.error);
|
|
|
}
|
|
|
});
|
|
|
+ },
|
|
|
+ upload() {},
|
|
|
+ onfail(e) {
|
|
|
+ console.log(e);
|
|
|
+ this.$message.error('失败:' + e);
|
|
|
+ this.loading = false;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ onSuccess() {
|
|
|
+ this.$message.success('上传成功');
|
|
|
+ this.loading = false;
|
|
|
+ this.getData();
|
|
|
+ },
|
|
|
+ beforeUpload() {
|
|
|
+ return this.$confirm('确认要上传文件吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.loading = true;
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
-<style lang="less" scoped></style>
|
|
|
+<style lang="less" scoped>
|
|
|
+.uploader {
|
|
|
+ display: inline-block;
|
|
|
+ margin: 0 10px;
|
|
|
+}
|
|
|
+</style>
|