Commit e3bd6f35 authored by mengzixuan's avatar mengzixuan

feat(车企文件库管理): 下载模板和导入接口对接

parent 6c2d7407
...@@ -49,6 +49,27 @@ ...@@ -49,6 +49,27 @@
@click="resetQuery" @click="resetQuery"
>重置</el-button >重置</el-button
> >
<el-button
type="primary"
icon="el-icon-download"
size="mini"
@click="downTemplate"
>下载模板</el-button
>
<el-upload
style="float: right; margin-left: 10px"
:action="url"
:headers="headers"
:file-list="fileList"
:show-file-list="false"
:on-success="handleUploadSuccess"
:before-upload="handleBeforeUpload"
:data="data"
>
<el-button size="mini" icon="el-icon-upload2" type="primary"
>导入</el-button
>
</el-upload>
</el-form-item> </el-form-item>
</template> </template>
<!-- <el-form-item> <!-- <el-form-item>
...@@ -211,6 +232,7 @@ ...@@ -211,6 +232,7 @@
import page from '@/mixins/page' import page from '@/mixins/page'
import dialog from './components/dialog.vue' import dialog from './components/dialog.vue'
import routerMixins from '@/mixins/router' import routerMixins from '@/mixins/router'
import { getToken } from '@/utils/auth'
export default { export default {
components: { components: {
'yan-dialog': dialog 'yan-dialog': dialog
...@@ -238,7 +260,16 @@ export default { ...@@ -238,7 +260,16 @@ export default {
// 表格loading状态 // 表格loading状态
tableLoading: false, tableLoading: false,
// 表格数据 // 表格数据
tableData: [] tableData: [],
url:
process.env.VUE_APP_BASE_API + '/review/enterprise/archive/importExcel',
data: {
taskId: this.$route.query.id
},
fileList: [],
headers: {
Authorization: 'Bearer ' + getToken()
}
} }
}, },
watch: { watch: {
...@@ -253,6 +284,24 @@ export default { ...@@ -253,6 +284,24 @@ export default {
this.queryParams.taskId = this.$route.query.id this.queryParams.taskId = this.$route.query.id
}, },
methods: { methods: {
handleBeforeUpload(file, fileList) {},
handleUploadSuccess(file, fileList) {
if (file.code === 200) {
this.$message.success(file.msg)
this.loadData()
} else if (file.code === 500) {
this.$message.error(file.msg)
}
},
/** 下载模板操作 */
downTemplate() {
this.download(
'review/enterprise/archive/importDownload',
{},
// `user_template_${new Date().getTime()}.xlsx`
`车企文件库模板.xlsx`
)
},
sort_change(column, prop, order) { sort_change(column, prop, order) {
this.queryParams.pageNum = 1 // 排序后返回第一页 this.queryParams.pageNum = 1 // 排序后返回第一页
if (column.order) { if (column.order) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment