Commit c090f1e3 by 袁晓帅

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

parent 0f1567b3
...@@ -12,7 +12,7 @@ module.exports = { ...@@ -12,7 +12,7 @@ module.exports = {
assetsPublicPath: '/', assetsPublicPath: '/',
// proxyTable: { // proxyTable: {
// '/api': { // '/api': {
// target: 'https://test-witcase.chinajinmao.cn', // target: 'https://iotservice-test.jinmaodigital.com/service',
// changeOrigin: true, // changeOrigin: true,
// pathRewrite: { // pathRewrite: {
// '^/api': '' // '^/api': ''
......
...@@ -3,19 +3,26 @@ ...@@ -3,19 +3,26 @@
<div> <div>
<div class="mainContent tableCont"> <div class="mainContent tableCont">
<div class="tabCont"> <div class="tabCont">
<el-button class="addBtn" @click="addBtn" v-if="isAddBtn"> <div style="display: flex;align-items: center;">
<img src="../../../../static/img/add.png" class="addIcon" /> <el-button class="addBtn" @click="addBtn" v-if="isAddBtn">
<span>新增</span> <img src="../../../../static/img/add.png" class="addIcon" />
</el-button> <span>新增</span>
<el-button class="addBtn" @click="upload(1)" v-if="isDownloadBtn"><span>导入模板下载</span></el-button> </el-button>
<el-button class="addBtn" v-if="isImportBtn"> <el-button class="addBtn" @click="upload(1)" v-if="isDownloadBtn"><span>导入模板下载</span></el-button>
<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;"> <div class="filebutton" v-if="isImportBtn">
<span>数据导入</span> <div>数据导入</div>
</el-upload> <input id="fileinp" type="file" name="fn" @change="UploadImage" ref="inputer"/>
</el-button> </div>
<el-button class="addBtn" @click="upload(3)" v-if="isCarExportBtn"> <!-- <el-button class="addBtn" >
<span>数据导出</span> <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;">
</el-button> <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;"> <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 :model="addForm" label-width="80px" style="display: flex;" :rules="rules">
<el-form-item label="所在楼层" prop="floor"> <el-form-item label="所在楼层" prop="floor">
...@@ -28,7 +35,7 @@ ...@@ -28,7 +35,7 @@
<el-input :rows="5" v-model="addForm.carNumber" placeholder="请输入车位编号" style="width: 150px;"></el-input> <el-input :rows="5" v-model="addForm.carNumber" placeholder="请输入车位编号" style="width: 150px;"></el-input>
</el-form-item> </el-form-item>
</el-form> </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 type="primary" v-on:click="addsubmit(type)">保存</el-button>
<el-button class="ml10" @click="adddialogVisible = false">取消</el-button> <el-button class="ml10" @click="adddialogVisible = false">取消</el-button>
</div> </div>
...@@ -207,8 +214,12 @@ export default { ...@@ -207,8 +214,12 @@ export default {
}, },
// 文件提交 // 文件提交
UploadImage (param) { UploadImage (param) {
let formData = new FormData() var inputDOM = this.$refs.inputer;
formData.append('file', param.file) // 要提交给后台的文件 var file = inputDOM.files;
var formData = new FormData();
formData.append('file', file[0]);
console.log(file[0])
this.$axios({ this.$axios({
method: 'post', method: 'post',
url: '/carParking/carImport', url: '/carParking/carImport',
...@@ -356,4 +367,24 @@ export default { ...@@ -356,4 +367,24 @@ export default {
.modelBox { .modelBox {
padding-right: 15px; 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> </style>
...@@ -44,7 +44,7 @@ axios.interceptors.request.use(config => { ...@@ -44,7 +44,7 @@ axios.interceptors.request.use(config => {
}) })
// 设置拦截器 // 设置拦截器
axios.interceptors.response.use(function (response) { axios.interceptors.response.use(function (response) {
console.log(response.config.url) // console.log(response.data)
if (response.data.code === '0') { if (response.data.code === '0') {
return response return response
} else if (response.data.code === 'BASE_00004') { } else if (response.data.code === 'BASE_00004') {
...@@ -52,7 +52,7 @@ axios.interceptors.response.use(function (response) { ...@@ -52,7 +52,7 @@ axios.interceptors.response.use(function (response) {
alert('登录失效,请重新登录', '温馨提示') alert('登录失效,请重新登录', '温馨提示')
router.push('/login') router.push('/login')
return false 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 return response
} else { } 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