|
@@ -207,15 +207,9 @@
|
|
|
<el-button type="primary" size="mini" v-if="lineDisable" @click="audits">审核</el-button>
|
|
|
<el-button type="primary" size="mini" v-if="lineDisable" @click="closeLine">行关闭</el-button>
|
|
|
|
|
|
- <el-dropdown size="mini" v-if="lineDisable" @command="handleCommand">
|
|
|
- <el-button size="mini" type="primary" style="margin: 0 10px;">
|
|
|
- 导出<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
- </el-button>
|
|
|
- <el-dropdown-menu slot="dropdown">
|
|
|
- <el-dropdown-item command="Excel导出">Excel导出</el-dropdown-item>
|
|
|
- <el-dropdown-item command="导出明细">导出明细</el-dropdown-item>
|
|
|
- </el-dropdown-menu>
|
|
|
- </el-dropdown>
|
|
|
+ <el-button size="mini" type="primary" style="margin: 0 10px;" v-if="lineDisable" @click="handleCommand">
|
|
|
+ 导出
|
|
|
+ </el-button>
|
|
|
|
|
|
<!-- <el-button type="primary" size="mini">转请购</el-button> -->
|
|
|
</div>
|
|
@@ -587,54 +581,26 @@ export default {
|
|
|
this.ids = selection.map(item => item.demandItemId)
|
|
|
console.log('选中数组', this.ids.join())
|
|
|
},
|
|
|
- handleCommand(command) {
|
|
|
- if(command == 'Excel导出') {
|
|
|
- if(this.allSelection.length == 0) {
|
|
|
- this.$modal.notifyWarning("请选中至少一条数据");
|
|
|
- } else {
|
|
|
- exportList(this.allSelection).then(res => {
|
|
|
- const blob = new Blob([res], {
|
|
|
- type: "application/vnd.ms-excel;charset=UTF-8",
|
|
|
- });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
|
|
|
- const downloadElement = document.createElement("a"); //创建a标签
|
|
|
- const href = window.URL.createObjectURL(blob); // 创建下载的链接
|
|
|
- // var temp = res.headers["content-disposition"];
|
|
|
- // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
|
|
|
- // var name = fileName.split(";")[0]; //切割成文件名
|
|
|
- downloadElement.href = href; //下载地址
|
|
|
- downloadElement.download = '导出Excel'; // 下载后文件名
|
|
|
- document.body.appendChild(downloadElement);
|
|
|
- downloadElement.click(); // 点击下载
|
|
|
- document.body.removeChild(downloadElement); // 下载完成移除元素
|
|
|
- window.URL.revokeObjectURL(href); // 释放blob对象
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (command == '导出明细') {
|
|
|
- if (this.allSelection.length == 0 || this.allSelection.length > 1) {
|
|
|
- this.$modal.notifyWarning("明细只能进行单条导出!");
|
|
|
- } else {
|
|
|
- let param = this.queryParams
|
|
|
- param.sumFlag = this.allSelection[0].sumFlag
|
|
|
- exportItems(param).then(res => {
|
|
|
- const blob = new Blob([res], {
|
|
|
- type: "application/vnd.ms-excel;charset=UTF-8",
|
|
|
- });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
|
|
|
- const downloadElement = document.createElement("a"); //创建a标签
|
|
|
- const href = window.URL.createObjectURL(blob); // 创建下载的链接
|
|
|
- // var temp = res.headers["content-disposition"];
|
|
|
- // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
|
|
|
- // var name = fileName.split(";")[0]; //切割成文件名
|
|
|
- downloadElement.href = href; //下载地址
|
|
|
- downloadElement.download = '导出明细'; // 下载后文件名
|
|
|
- document.body.appendChild(downloadElement);
|
|
|
- downloadElement.click(); // 点击下载
|
|
|
- document.body.removeChild(downloadElement); // 下载完成移除元素
|
|
|
- window.URL.revokeObjectURL(href); // 释放blob对象
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ handleCommand() {
|
|
|
+ this.$modal.loading("正在导出数据,请稍后...");
|
|
|
+ let param = this.queryParams
|
|
|
+ exportItems(param).then(res => {
|
|
|
+ this.$modal.closeLoading();
|
|
|
+ const blob = new Blob([res], {
|
|
|
+ type: "application/vnd.ms-excel;charset=UTF-8",
|
|
|
+ });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
|
|
|
+ const downloadElement = document.createElement("a"); //创建a标签
|
|
|
+ const href = window.URL.createObjectURL(blob); // 创建下载的链接
|
|
|
+ // var temp = res.headers["content-disposition"];
|
|
|
+ // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
|
|
|
+ // var name = fileName.split(";")[0]; //切割成文件名
|
|
|
+ downloadElement.href = href; //下载地址
|
|
|
+ downloadElement.download = '采购需求处理导出明细'+ this.parseTime(new Date().getTime()) + ".xlsx"; // 下载后文件名
|
|
|
+ document.body.appendChild(downloadElement);
|
|
|
+ downloadElement.click(); // 点击下载
|
|
|
+ document.body.removeChild(downloadElement); // 下载完成移除元素
|
|
|
+ window.URL.revokeObjectURL(href); // 释放blob对象
|
|
|
+ })
|
|
|
},
|
|
|
check(row) {
|
|
|
this.isList = false
|