From bd56a451250e8b8d7b25526cd36b1949d96d38fa Mon Sep 17 00:00:00 2001 From: Vergil <974548713@qq.com> Date: Sat, 8 Feb 2020 18:30:18 +0800 Subject: [PATCH 1/7] =?UTF-8?q?curd=E5=A4=96=E5=8D=8F=E4=BB=98=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OutsourcingPaymentPlanManagement.js | 2 + src/utils/curd.js | 41 ++++++++++ .../index.vue | 79 ++++++------------- 3 files changed, 68 insertions(+), 54 deletions(-) diff --git a/src/api/Outsourcing/OutsourcingPaymentPlanManagement.js b/src/api/Outsourcing/OutsourcingPaymentPlanManagement.js index b9c2393e..69d7ff29 100644 --- a/src/api/Outsourcing/OutsourcingPaymentPlanManagement.js +++ b/src/api/Outsourcing/OutsourcingPaymentPlanManagement.js @@ -1,7 +1,9 @@ import request from '@/utils/request' +import state from '@/store' // 查询表格数据 export function searchtable(check1, ManufacturerAbbreviation, check2, starttime, endTime, pageCurrent, pageSize) { + console.log(state.state.user.id, 22222) return request({ url: '', method: 'post', diff --git a/src/utils/curd.js b/src/utils/curd.js index 5bbc55eb..0fe3334c 100644 --- a/src/utils/curd.js +++ b/src/utils/curd.js @@ -5,6 +5,10 @@ Created by hedekun import { type } from './tool' // type判断传入值的类型,比typeof更详细 export default { install(Vue) { + Vue.prototype.exportExcel_NPOI = function(url, type, name, data) { + console.log(url, type, name, data, 1111111111) + // this.download(`${url}?param=${data}`) + } Vue.prototype.CreateData = function(type, name, data, pageSize, pageList) { var paramStr = '' var paramarray = [] @@ -268,3 +272,40 @@ export default { } } } + +// function download(url) { +// getBlob(url, function(blob, filename) { +// var filename1 = decodeURIComponent(filename) +// saveAs(blob, filename1) +// }) +// } +// +// function decodeUtf8(bytes) { var encoded = ""; for (var i = 0; i < bytes.length; i++) { encoded += '%' + bytes[i].toString(16); } return decodeURIComponent(encoded); } +// +// function getBlob(url, cb) { +// var xhr = new XMLHttpRequest() +// xhr.open('GET', url, true) +// xhr.responseType = 'blob' +// xhr.onload = function() { +// if (xhr.status === 200) { +// var name = decodeUtf8(xhr.getResponseHeader('content-disposition').split('=')[1]) +// } +// } +// xhr.send() +// } +// +// 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 +// link.style.display = 'none' +// body.appendChild(link) +// link.click() +// body.removeChild(link) +// window.URL.revokeObjectURL(link.href) +// } +// } diff --git a/src/views/Outsourcing/OutsourcingPaymentPlanManagement/index.vue b/src/views/Outsourcing/OutsourcingPaymentPlanManagement/index.vue index dd993dd0..76cddbc7 100644 --- a/src/views/Outsourcing/OutsourcingPaymentPlanManagement/index.vue +++ b/src/views/Outsourcing/OutsourcingPaymentPlanManagement/index.vue @@ -7,7 +7,7 @@ 查询 - +