品规、库存页面新增下载模板功能

merge-requests/1/head
张鑫 5 years ago
parent bbbc322dca
commit dc50c3e97c

@ -157,5 +157,15 @@ export default {
name: '库存列表', name: '库存列表',
method: 'POST' method: 'POST'
}, },
categoryExportModel: {
url: '/category/export/model',
name: '品规模板下载',
method: 'GET'
},
stockExportModel: {
url: '/stock/export/model',
name: '库存模板下载',
method: 'GET'
},
} }

@ -10,7 +10,9 @@ const instance = axios.create({
}); });
window.once = 0 window.once = 0
let blobList = [ let blobList = [
'/stock/export' '/stock/export',
'/category/export/model',
'/stock/export/model'
] ]
instance.interceptors.request.use((config) => { instance.interceptors.request.use((config) => {
const reqObj = config; const reqObj = config;

@ -12,11 +12,15 @@
:showUploadList = 'false' :showUploadList = 'false'
@change="handleChange" @change="handleChange"
ref="table" ref="table"
style="margin-right:15px"
> >
<a-button type="primary" class="plc" > <a-button type="primary" >
导入 导入
</a-button> </a-button>
</a-upload> </a-upload>
<a-button type="" @click="categoryExportModel">
模板下载
</a-button>
</div> </div>
<a-table <a-table
:columns="columns" :columns="columns"
@ -147,6 +151,16 @@ export default {
}); });
}, },
categoryExportModel() {
this.$api.httpApi.categoryExportModel({
params: {}
}).then(res => {
let blob = new Blob([res], {type: "application/vnd.ms-excel"})
this.$utils.downloadFile('品规模板.xls', blob)
}).catch(err => {
});
},
showModel(type,data){ showModel(type,data){
this.visible = true this.visible = true
console.log(type) console.log(type)
@ -190,7 +204,7 @@ export default {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.add{ .add{
margin-right: 20px; margin-right: 15px;
} }
} }
</style> </style>

@ -10,9 +10,12 @@
@change="handleChange" @change="handleChange"
ref="table" ref="table"
> >
<a-button type="primary" class="plc" > <a-button type="primary" style="margin-right:15px">
导入 导入
</a-button> </a-button>
<a-button type="" @click="stockExportModel">
模板下载
</a-button>
</a-upload> </a-upload>
</div> </div>
<a-table <a-table
@ -129,6 +132,16 @@ export default {
}); });
}).catch(err => { }).catch(err => {
});
},
stockExportModel() {
this.$api.httpApi.stockExportModel({
params: {}
}).then(res => {
let blob = new Blob([res], {type: "application/vnd.ms-excel"})
this.$utils.downloadFile('库存模板.xls', blob)
}).catch(err => {
}); });
}, },
}, },

Loading…
Cancel
Save