測試
This commit is contained in:
@@ -5,6 +5,30 @@ Created by hedekun
|
|||||||
import { type } from './tool' // type判断传入值的类型,比typeof更详细
|
import { type } from './tool' // type判断传入值的类型,比typeof更详细
|
||||||
export default {
|
export default {
|
||||||
install(Vue) {
|
install(Vue) {
|
||||||
|
Vue.prototype.CreateData = function(type, name, data, pageSize, pageList) {
|
||||||
|
var paramStr = ''
|
||||||
|
var paramarray = []
|
||||||
|
if (data !== undefined) {
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
paramarray.push({
|
||||||
|
name: data[i][0],
|
||||||
|
value: data[i][1],
|
||||||
|
type: data[i][2],
|
||||||
|
output: data[i][3]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
paramStr = JSON.stringify(paramarray)
|
||||||
|
}
|
||||||
|
var obj = []
|
||||||
|
obj[0] = {}
|
||||||
|
obj[0].type = type
|
||||||
|
obj[0].name = name
|
||||||
|
obj[0].param = paramStr
|
||||||
|
obj[0].pageSize = pageSize
|
||||||
|
obj[0].pageList = pageList
|
||||||
|
var numn = JSON.stringify(obj[0])
|
||||||
|
return numn
|
||||||
|
}
|
||||||
// 用于打开增加框,方法能重置表单,并使表单内容回到初始化状态。
|
// 用于打开增加框,方法能重置表单,并使表单内容回到初始化状态。
|
||||||
// 传入参数
|
// 传入参数
|
||||||
// 1)表单名称,字符串形式如'form',必须
|
// 1)表单名称,字符串形式如'form',必须
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ export const uploadInvoiceScan1 = `http://192.168.1.231:8411/submit/uploadInvoic
|
|||||||
export const download = `http://192.168.1.231:8411/submit/downloadFile.ashx` // ContractInformationManagement
|
export const download = `http://192.168.1.231:8411/submit/downloadFile.ashx` // ContractInformationManagement
|
||||||
export const uploadPerson = `http://192.168.1.231:8411/submit/uploadPerson.ashx`
|
export const uploadPerson = `http://192.168.1.231:8411/submit/uploadPerson.ashx`
|
||||||
export const uploadOP = `http://192.168.1.231:8411/submit/uploadOP.ashx`
|
export const uploadOP = `http://192.168.1.231:8411/submit/uploadOP.ashx`
|
||||||
export const url = `http://192.168.0.100:8074/submit/MESCommonBase.ashx` // 采购件入库、离线件入库
|
export const url = `http://192.168.1.5:8079/submit/MESCommonBase.ashx` // 采购件入库、离线件入库
|
||||||
export const ExcelDownLoad = 'http://192.168.0.100:8074/submit/downloadFile.ashx' // 导出excel
|
export const ExcelDownLoad = 'http://192.168.1.5:8079/submit/downloadFile.ashx' // 导出excel
|
||||||
// 技术中心程序发布时要更改下面所有的IP到0段
|
// 技术中心程序发布时要更改下面所有的IP到0段
|
||||||
export const ServerIP = `http://192.168.1.231:8411/webpage/file/`
|
export const ServerIP = `http://192.168.1.231:8411/webpage/file/`
|
||||||
export const uploadFileMachine = `http://192.168.1.231:8411/submit/uploadFileMachine.ashx` // 机床总图 发布时改成0.231
|
export const uploadFileMachine = `http://192.168.1.231:8411/submit/uploadFileMachine.ashx` // 机床总图 发布时改成0.231
|
||||||
@@ -26,12 +26,7 @@ export const downloadFileMachine = `http://192.168.1.231:8411/submit/downloadFil
|
|||||||
export const MESUploadFile = `http://192.168.1.231:8411/submit/MESUploadFile.ashx`
|
export const MESUploadFile = `http://192.168.1.231:8411/submit/MESUploadFile.ashx`
|
||||||
export const MESDownloadFile = `http://192.168.1.231:8411/submit/MESDownloadFile.ashx`
|
export const MESDownloadFile = `http://192.168.1.231:8411/submit/MESDownloadFile.ashx`
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
<<<<<<< HEAD
|
baseURL: `http://192.168.1.5:8079/submit/MESCommonBase.ashx`,
|
||||||
|
|
||||||
baseURL: `http://192.168.0.100:8074/submit/MESCommonBase.ashx`,
|
|
||||||
=======
|
|
||||||
baseURL: `http://192.168.1.231:8411/submit/MESCommonBase.ashx`,
|
|
||||||
>>>>>>> 4fb54f4d3ea13e7c327b17bde7ac4ffc21b9b821
|
|
||||||
timeout: 1500000 // 请求超时时间
|
timeout: 1500000 // 请求超时时间
|
||||||
})
|
})
|
||||||
export default service
|
export default service
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card>
|
<el-card>
|
||||||
<span>项目名称</span>
|
<span>项目名称</span>
|
||||||
<el-select v-model="projectValue" filterable clearable size="small" style="margin-top:10px;width: 220px" placeholder="项目名称" @change="typeChange()">
|
<el-select v-model="projectValue" filterable clearable size="small" style="margin-right:10px;width: 180px" placeholder="项目名称" @change="typeChange">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in project"
|
v-for="item in project"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@@ -10,13 +10,107 @@
|
|||||||
:value="item.value"/>
|
:value="item.value"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<span>机床名称</span>
|
<span>机床名称</span>
|
||||||
<el-select v-model="machineValue" clearable filterable size="small" style="margin-bottom:10px;width: 220px" placeholder="机床名称">
|
<el-select v-model="machineValue" clearable filterable size="small" style="margin-right:10px;width: 150px" placeholder="机床名称">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in machine"
|
v-for="item in machine"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"/>
|
:value="item.value"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
<span>分组</span>
|
||||||
|
<el-select v-model="partValue" clearable filterable size="small" style="margin-right:10px;width: 80px" placeholder="分组">
|
||||||
|
<el-option
|
||||||
|
v-for="item in part"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"/>
|
||||||
|
</el-select>
|
||||||
|
<span>规格及型号</span>
|
||||||
|
<el-input v-model="specificationValue" clearable size="small" style="margin-right:10px;width: 150px" placeholder="规格型号"/>
|
||||||
|
<span>加工总工时(小时):</span>
|
||||||
|
<el-input v-model="totalProcessingHours" clearable size="small" style="margin-right:10px;width: 100px"/>
|
||||||
|
<span>计划总工时(小时):</span>
|
||||||
|
<el-input v-model="totalPlannedHours" clearable size="small" style="margin-right:10px;width: 100px"/>
|
||||||
|
<el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="searchTable()">查询</el-button>
|
||||||
|
</el-card>
|
||||||
|
<el-card>
|
||||||
|
<el-table :data="tableData" highlight-current-row border style="width: 100%;" size="mini" height="300">
|
||||||
|
<el-table-column label="跟单号" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.跟单号 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="序号" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.序号 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="工序名" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.工序名 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="计划数量" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.计划数量 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="计划准备工时" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.计划准备工时 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="单件计划工时" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.单件计划工时 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="计划工时(分)" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.计划工时 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="计划加工日期" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.计划加工日期 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="加工数量" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.加工数量 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="加工准备工时" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.加工准备工时 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="单件加工工时" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.单件加工工时 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="加工工时(分)" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.加工工时 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="加工日期" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.加工日期 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="图号及规格" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.图号及规格 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="制品名称" align="center" min-width="200">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.制品名称 }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -29,7 +123,13 @@ export default {
|
|||||||
project: [],
|
project: [],
|
||||||
projectValue: '', // 项目名称
|
projectValue: '', // 项目名称
|
||||||
machineValue: '', // 机床名称
|
machineValue: '', // 机床名称
|
||||||
machine: []
|
machine: [],
|
||||||
|
part: [], // 分組
|
||||||
|
partValue: '',
|
||||||
|
specificationValue: '', // 规格型号
|
||||||
|
totalProcessingHours: '', // 加工总工时
|
||||||
|
totalPlannedHours: '', // 计划总工时
|
||||||
|
tableData: [] // 详情表
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="日期" width="100px">
|
<el-table-column align="center" label="日期" width="100px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.操作时间 }}
|
{{ scope.row.操作时间.substr(0,10) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="计划准结工时" width="100px">
|
<el-table-column align="center" label="计划准结工时" width="100px">
|
||||||
|
|||||||
@@ -427,7 +427,7 @@
|
|||||||
<!--:value="item.value"/>-->
|
<!--:value="item.value"/>-->
|
||||||
<!--</el-select>-->
|
<!--</el-select>-->
|
||||||
<div style="margin-top: 15px;">
|
<div style="margin-top: 15px;">
|
||||||
<el-table :data="tableData4" border stripe style="width: 200px; text-align: center;display: inline-block;vertical-align: top;" size="mini" highlight-current-row @row-click="handleChange1">
|
<el-table :data="tableData4" border style="width: 200px; text-align: center;display: inline-block;vertical-align: top;" size="mini" highlight-current-row @row-click="handleChange1">
|
||||||
<el-table-column label="部门" align="center" >
|
<el-table-column label="部门" align="center" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.部门名称 }}
|
{{ scope.row.部门名称 }}
|
||||||
@@ -517,40 +517,40 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!--客户选择-->
|
<!--客户选择-->
|
||||||
<el-dialog v-el-drag-dialog :visible.sync="dialogCustomerFormVisible" title="客户选择" center width="800px">
|
<el-dialog v-el-drag-dialog :visible.sync="dialogCustomerFormVisible" title="客户选择" center width="400px">
|
||||||
<el-input v-model="Customer" clearable size="small" style="width:200px" placeholder="请输入客户名称"/>
|
<el-input v-model="Customer" clearable size="small" style="width:200px" placeholder="请输入客户名称"/>
|
||||||
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px" @click="PageSize1 = 30;PageCurrent1 = 1;fetchCustomerData()">查询</el-button>
|
<el-button type="success" icon="el-icon-search" size="small" style="margin-left: 10px" @click="PageSize1 = 30;PageCurrent1 = 1;fetchCustomerData()">查询</el-button>
|
||||||
<el-table v-loading="loading1" :data="CustomerData" highlight-current-row height="300" stripe border show-overflow-tooltip style="height: 330px; margin-top: 10px" size="mini" @row-click="handleCustomerChange">
|
<el-table v-loading="loading1" :data="CustomerData" highlight-current-row height="300" stripe border show-overflow-tooltip style="height: 350px; margin-top: 10px" size="mini" @row-click="handleCustomerChange">
|
||||||
<el-table-column label="省份" align="center" width="80">
|
<!-- <el-table-column label="省份" align="center" width="80">-->
|
||||||
<template slot-scope="scope">
|
<!-- <template slot-scope="scope">-->
|
||||||
{{ scope.row.省份 }}
|
<!-- {{ scope.row.省份 }}-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-table-column>
|
<!-- </el-table-column>-->
|
||||||
<el-table-column label="客户名称" align="center" >
|
<el-table-column label="客户名称" align="center" >
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.客户名称 }}
|
{{ scope.row.客户名称 }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="联系人" align="center" width="80">
|
<!-- <el-table-column label="联系人" align="center" width="80">-->
|
||||||
<template slot-scope="scope">
|
<!-- <template slot-scope="scope">-->
|
||||||
{{ scope.row.联系人 }}
|
<!-- {{ scope.row.联系人 }}-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-table-column>
|
<!-- </el-table-column>-->
|
||||||
<el-table-column label="联系电话" align="center">
|
<!-- <el-table-column label="联系电话" align="center">-->
|
||||||
<template slot-scope="scope">
|
<!-- <template slot-scope="scope">-->
|
||||||
{{ scope.row.电话 }}
|
<!-- {{ scope.row.电话 }}-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-table-column>
|
<!-- </el-table-column>-->
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-pagination
|
<!-- <el-pagination-->
|
||||||
:current-page="PageCurrent1"
|
<!-- :current-page="PageCurrent1"-->
|
||||||
:page-sizes="[10, 20, 30, 40]"
|
<!-- :page-sizes="[10, 20, 30, 40]"-->
|
||||||
:page-size="PageSize1"
|
<!-- :page-size="PageSize1"-->
|
||||||
:total="total1"
|
<!-- :total="total1"-->
|
||||||
style="margin-top: 10px"
|
<!-- style="margin-top: 10px"-->
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
<!-- layout="total, sizes, prev, pager, next, jumper"-->
|
||||||
@size-change="handleSizeChange1"
|
<!-- @size-change="handleSizeChange1"-->
|
||||||
@current-change="handleCurrentChange1"/>
|
<!-- @current-change="handleCurrentChange1"/>-->
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button @click="offCustomerChange">取消</el-button>
|
<el-button @click="offCustomerChange">取消</el-button>
|
||||||
<el-button type="primary" @click="getCustomerCode">确 定</el-button>
|
<el-button type="primary" @click="getCustomerCode">确 定</el-button>
|
||||||
@@ -659,7 +659,7 @@ export default {
|
|||||||
PageSize: 30,
|
PageSize: 30,
|
||||||
total: null,
|
total: null,
|
||||||
PageCurrent1: 1,
|
PageCurrent1: 1,
|
||||||
PageSize1: 30,
|
PageSize1: 100000,
|
||||||
total1: null,
|
total1: null,
|
||||||
infoDisable: true,
|
infoDisable: true,
|
||||||
hetongID: '',
|
hetongID: '',
|
||||||
|
|||||||
186
src/views/WorkshopProcurement/ExcelExport/index.vue
Normal file
186
src/views/WorkshopProcurement/ExcelExport/index.vue
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
style="margin-left:10px"
|
||||||
|
@click="downloadExcel()">导出Excel模板1</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
style="margin-left:10px"
|
||||||
|
@click="downloadExce2()">导出Excel模板2</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
style="margin-left:10px"
|
||||||
|
@click="downloadExce3()">导出Excel模板3</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
style="margin-left:10px"
|
||||||
|
@click="downloadExce4()">导出Excel模板4</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
style="margin-left:10px"
|
||||||
|
@click="downloadExce5()">导出Excel模板5</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
style="margin-left:10px"
|
||||||
|
@click="downloadExce6()">导出Excel模板6</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
style="margin-left:10px"
|
||||||
|
@click="downloadExce7()">导出Excel模板7</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
style="margin-left:10px"
|
||||||
|
@click="downloadExcel8()">导出Excel模板8</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ExcelDownLoad } from '@/utils/request'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 模板1
|
||||||
|
downloadExcel() {
|
||||||
|
var param = []
|
||||||
|
param[0] = ['发票流水号', 1]
|
||||||
|
param[1] = ['供应商名称', 2]
|
||||||
|
// var data = this.CreateData(1, name: 2, param)
|
||||||
|
var data = this.CreateData(1, 2, param)
|
||||||
|
console.log(data)
|
||||||
|
const _ExcelDownLoad = ExcelDownLoad
|
||||||
|
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
|
||||||
|
},
|
||||||
|
// 模板2
|
||||||
|
downloadExce2() {
|
||||||
|
var param = []
|
||||||
|
param[0] = ['发票流水号', 1]
|
||||||
|
param[1] = ['供应商名称', 2]
|
||||||
|
var data = this.CreateData(1, 2, param)
|
||||||
|
console.log(data)
|
||||||
|
const _ExcelDownLoad = ExcelDownLoad
|
||||||
|
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
|
||||||
|
},
|
||||||
|
// 模板3
|
||||||
|
downloadExce3() {
|
||||||
|
var param = []
|
||||||
|
param[0] = ['发票流水号', 1]
|
||||||
|
param[1] = ['供应商名称', 2]
|
||||||
|
var data = this.CreateData(1, 2, param)
|
||||||
|
console.log(data)
|
||||||
|
const _ExcelDownLoad = ExcelDownLoad
|
||||||
|
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
|
||||||
|
},
|
||||||
|
// 模板4
|
||||||
|
downloadExce4() {
|
||||||
|
var param = []
|
||||||
|
param[0] = ['发票流水号', 1]
|
||||||
|
param[1] = ['供应商名称', 2]
|
||||||
|
var data = this.CreateData(1, 2, param)
|
||||||
|
console.log(data)
|
||||||
|
const _ExcelDownLoad = ExcelDownLoad
|
||||||
|
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
|
||||||
|
},
|
||||||
|
// 模板5
|
||||||
|
downloadExce5() {
|
||||||
|
var param = []
|
||||||
|
param[0] = ['发票流水号', 1]
|
||||||
|
param[1] = ['供应商名称', 2]
|
||||||
|
var data = this.CreateData(1, 2, param)
|
||||||
|
console.log(data)
|
||||||
|
const _ExcelDownLoad = ExcelDownLoad
|
||||||
|
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
|
||||||
|
},
|
||||||
|
// 模板6
|
||||||
|
downloadExce6() {
|
||||||
|
var param = []
|
||||||
|
param[0] = ['发票流水号', 1]
|
||||||
|
param[1] = ['供应商名称', 2]
|
||||||
|
var data = this.CreateData(1, 2, param)
|
||||||
|
console.log(data)
|
||||||
|
const _ExcelDownLoad = ExcelDownLoad
|
||||||
|
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
|
||||||
|
},
|
||||||
|
// 模板7
|
||||||
|
downloadExce7() {
|
||||||
|
var param = []
|
||||||
|
param[0] = ['发票流水号', 1]
|
||||||
|
param[1] = ['供应商名称', 2]
|
||||||
|
var data = this.CreateData(1, 2, param)
|
||||||
|
console.log(data)
|
||||||
|
const _ExcelDownLoad = ExcelDownLoad
|
||||||
|
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
|
||||||
|
},
|
||||||
|
// 模板8
|
||||||
|
downloadExcel8() {
|
||||||
|
var param = []
|
||||||
|
param[0] = ['发票流水号', 1]
|
||||||
|
param[1] = ['供应商名称', 2]
|
||||||
|
var data = this.CreateData(1, 2, param)
|
||||||
|
console.log(data)
|
||||||
|
const _ExcelDownLoad = ExcelDownLoad
|
||||||
|
this.download(`${_ExcelDownLoad}?Fapiao=${data}`)
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 下载
|
||||||
|
* @param {String} url 目标文件地址
|
||||||
|
* @param {String} filename 想要保存的文件名称
|
||||||
|
*/
|
||||||
|
download(url) {
|
||||||
|
this.getBlob(url, function(blob, filename) {
|
||||||
|
saveAs(blob, filename)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getBlob(url, cb) {
|
||||||
|
var xhr = new XMLHttpRequest()
|
||||||
|
xhr.open('GET', url, true)
|
||||||
|
xhr.responseType = 'blob'
|
||||||
|
xhr.onload = function() {
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
console.log(xhr, 1111)
|
||||||
|
const name = xhr.getResponseHeader('content-disposition').split('=')[1]
|
||||||
|
cb(xhr.response, name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.send()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 保存
|
||||||
|
* @param {Blob} blob
|
||||||
|
* @param {String} filename 想要保存的文件名称
|
||||||
|
*/
|
||||||
|
function saveAs(blob, filename = '下载文件.xls') {
|
||||||
|
if (window.navigator.msSaveOrOpenBlob) {
|
||||||
|
navigator.msSaveBlob(blob, filename)
|
||||||
|
} else {
|
||||||
|
var link = document.createElement('a')
|
||||||
|
var body = document.querySelector('body')
|
||||||
|
link.href = window.URL.createObjectURL(blob)
|
||||||
|
link.download = filename
|
||||||
|
// fix Firefox
|
||||||
|
link.style.display = 'none'
|
||||||
|
body.appendChild(link)
|
||||||
|
link.click()
|
||||||
|
body.removeChild(link)
|
||||||
|
window.URL.revokeObjectURL(link.href)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user