Commit c090f1e3 by 袁晓帅

修改IE下不能下载和不能的导出问题

parent 0f1567b3
......@@ -12,7 +12,7 @@ module.exports = {
assetsPublicPath: '/',
// proxyTable: {
// '/api': {
// target: 'https://test-witcase.chinajinmao.cn',
// target: 'https://iotservice-test.jinmaodigital.com/service',
// changeOrigin: true,
// pathRewrite: {
// '^/api': ''
......
......@@ -3,19 +3,26 @@
<div>
<div class="mainContent tableCont">
<div class="tabCont">
<el-button class="addBtn" @click="addBtn" v-if="isAddBtn">
<img src="../../../../static/img/add.png" class="addIcon" />
<span>新增</span>
</el-button>
<el-button class="addBtn" @click="upload(1)" v-if="isDownloadBtn"><span>导入模板下载</span></el-button>
<el-button class="addBtn" v-if="isImportBtn">
<el-upload ref="upload" action="string" :before-upload="onBeforeUploadImage" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel " :http-request="UploadImage" :show-file-list="false" style="width: 80px;">
<span>数据导入</span>
</el-upload>
</el-button>
<el-button class="addBtn" @click="upload(3)" v-if="isCarExportBtn">
<span>数据导出</span>
</el-button>
<div style="display: flex;align-items: center;">
<el-button class="addBtn" @click="addBtn" v-if="isAddBtn">
<img src="../../../../static/img/add.png" class="addIcon" />
<span>新增</span>
</el-button>
<el-button class="addBtn" @click="upload(1)" v-if="isDownloadBtn"><span>导入模板下载</span></el-button>
<div class="filebutton" v-if="isImportBtn">
<div>数据导入</div>
<input id="fileinp" type="file" name="fn" @change="UploadImage" ref="inputer"/>
</div>
<!-- <el-button class="addBtn" >
<el-upload ref="upload" action="string" :before-upload="onBeforeUploadImage" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel " :http-request="UploadImage" :show-file-list="false" style="width: 80px;">
<span>数据导入</span>
</el-upload>
</el-button> -->
<el-button class="addBtn" @click="upload(3)" v-if="isCarExportBtn">
<span>数据导出</span>
</el-button>
</div>
<div v-if="adddialogVisible" style="display: flex;align-items: center;padding-bottom: 10px;">
<el-form :model="addForm" label-width="80px" style="display: flex;" :rules="rules">
<el-form-item label="所在楼层" prop="floor">
......@@ -28,7 +35,7 @@
<el-input :rows="5" v-model="addForm.carNumber" placeholder="请输入车位编号" style="width: 150px;"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer text-center" style="margin-left: 10px;">
<div slot="footer" class="dialog-footer text-center" style="margin-left: 10px;height: 40px;">
<el-button type="primary" v-on:click="addsubmit(type)">保存</el-button>
<el-button class="ml10" @click="adddialogVisible = false">取消</el-button>
</div>
......@@ -207,8 +214,12 @@ export default {
},
// 文件提交
UploadImage (param) {
let formData = new FormData()
formData.append('file', param.file) // 要提交给后台的文件
var inputDOM = this.$refs.inputer;
var file = inputDOM.files;
var formData = new FormData();
formData.append('file', file[0]);
console.log(file[0])
this.$axios({
method: 'post',
url: '/carParking/carImport',
......@@ -356,4 +367,24 @@ export default {
.modelBox {
padding-right: 15px;
}
.filebutton{
position: relative;
display: inline-block;
overflow: hidden;
border:1px solid #DF9F01;
padding: 4px 20px !important;
border-radius: 4px;
}
.filebutton input{
position: absolute;
top: 0;
opacity: 0;
font-size: 100px;
}
.filebutton div{
font-size: 12px;
background-color: #FFFFFF!important;
color: #DF9F01!important;
border-color: #DF9F01!important;
}
</style>
......@@ -44,7 +44,7 @@ axios.interceptors.request.use(config => {
})
// 设置拦截器
axios.interceptors.response.use(function (response) {
console.log(response.config.url)
// console.log(response.data)
if (response.data.code === '0') {
return response
} else if (response.data.code === 'BASE_00004') {
......@@ -52,7 +52,7 @@ axios.interceptors.response.use(function (response) {
alert('登录失效,请重新登录', '温馨提示')
router.push('/login')
return false
} else if (response.data.type === 'application/vnd.ms-excel') {
} else if (response.data.type === 'application/vnd.ms-excel' || response.data.type === 'application/vnd.ms-excel;charset=UTF-8') {
return response
} else {
// 在添加其他的错误码判断
......
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 sign in to comment