This commit is contained in:
Vergil
2020-02-10 17:59:59 +08:00
parent ac32df04d7
commit ad88ce3441
3 changed files with 18 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ import { type } from './tool' // type判断传入值的类型比typeof更详
export default {
install(Vue) {
Vue.prototype.exportExcel_NPOI = function(param) {
console.log(ExcelDownLoad, param, 1111111111)
console.log(param, 1)
download(`${ExcelDownLoad}?param=${param}`)
}
Vue.prototype.CreateData = function(type, name, data, pageSize, pageList) {
@@ -272,6 +272,7 @@ export default {
}
function download(url) {
getBlob(url, function(blob, filename) {
console.log(blob, filename, 2)
saveAs(blob, filename)
})
}
@@ -283,14 +284,14 @@ function getBlob(url, cb) {
xhr.onload = function() {
if (xhr.status === 200) {
const name = xhr.getResponseHeader('content-disposition').split('=')[1]
var filename1 = decodeURIComponent(name)
cb(xhr.response, filename1)
var filename = decodeURIComponent(name)
cb(xhr.response, filename)
}
}
xhr.send()
}
function saveAs(blob, filename = '下载文件.xls') {
function saveAs(blob, filename) {
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, filename)
} else {

View File

@@ -17,7 +17,7 @@ export const download = `http://123.56.95.229:8010/submit/downloadFile.ashx` //
export const uploadPerson = `http://123.56.95.229:8010/submit/uploadPerson.ashx`
export const uploadOP = `http://123.56.95.229:8010/submit/uploadOP.ashx`
export const url = `http://123.56.95.229:8010/submit/MESCommonBase.ashx` // 采购件入库、离线件入库
export const ExcelDownLoad = 'http://123.56.95.229:8010/submit/downloadFile.ashx' // 导出excel
export const ExcelDownLoad = 'http://123.56.95.229:8010/submit/MESDownloadExcel.ashx' // 导出excel
export const ExcelWaiGou = 'http://192.168.0.106:8045/submit/excel.ashx' // 导出excel
// 技术中心程序发布时要更改下面所有的IP到0段
export const ServerIP = `http://123.56.95.229:8010/webpage/file/`

View File

@@ -6,6 +6,7 @@
<span>外协厂家:</span>
<el-input v-model="ManufacturerName" size="small" placeholder="外协厂家" clearable style="width:200px"/>
<el-button type="primary" class="el-icon-search" size="small" plain @click="pageCurrent=1;pageSize=50;getParts()">查询</el-button>
<el-button type="primary" class="el-icon-search" size="small" plain @click="exportExcel()">查询</el-button>
</el-row>
<el-table v-loading="loading" :data="tableData" size="mini" highlight-current-row height="500" style="width: 100%;" border element-loading-text="拼命加载中" @row-click="rowClick">
<el-table-column label="厂家" prop="外协厂家名称" align="center" width="230px">
@@ -180,6 +181,17 @@ export default {
this.getParts()
},
methods: {
exportExcel() {
var param = []
param[0] = ['物料名称_check', 0]
param[1] = ['物料名称', 0]
param[2] = ['物料规格_check', 0]
param[3] = ['物料规格', 0]
param[4] = ['物料型号_check', 0]
param[5] = ['物料型号', 0]
var Data = this.CreateData('00', '报表_采购部仓库_库存_查询', param)
this.exportExcel_NPOI(Data)
},
// 获取表格1数据
getParts() {
this.loading = true