Commit 20387399 authored by hezhen's avatar hezhen

添加导入按钮

parent a466a462
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
<el-button class="filter-item" v-if="btn_add" style="margin-left: 10px;" @click="handleCreate" <el-button class="filter-item" v-if="btn_add" style="margin-left: 10px;" @click="handleCreate"
type="primary" icon="edit">添加 type="primary" icon="edit">添加
</el-button> </el-button>
<form methods="post" enctype="multipart/form-data" style="display:inline-block;margin-left:10px;;">
<el-button class="filter-item" type="primary" v-waves @click="choiceImg">导入</el-button>
<input ref="filElem" type="file" name="file" class="upload-file" @change="getFile($event)" style="display:none;">
</form>
</div> </div>
<el-table :key='tableKey' :data="list" v-loading.body="listLoading" <el-table :key='tableKey' :data="list" v-loading.body="listLoading"
...@@ -136,6 +140,7 @@ ...@@ -136,6 +140,7 @@
getToken getToken
} from 'utils/auth'; } from 'utils/auth';
import {mapGetters} from 'vuex'; import {mapGetters} from 'vuex';
import axios from 'axios';
import rsCode from '../../../utils/rsCode'; import rsCode from '../../../utils/rsCode';
export default { export default {
...@@ -417,6 +422,23 @@ ...@@ -417,6 +422,23 @@
this.listQuery.limit = val; this.listQuery.limit = val;
this.getList(); this.getList();
}, },
choiceImg(){
this.$refs.filElem.dispatchEvent(new MouseEvent('click'))
},
getFile(event){
let formData = new FormData();
formData.append('file',event.target.files[0]);
let config = {
headers: {
'Content-Type': 'multipart/form-data'
}
}
axios.post('/vehicle/branchCompany/stock/importExcel', formData, config).then(function (res) {
if (res.status === 2000) {
/*这里做处理*/
}
})
},
handleCurrentChange(val) { handleCurrentChange(val) {
this.listQuery.page = val; this.listQuery.page = val;
this.getList(); this.getList();
......
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