From 73928a0ed0a92251c45c491908d6e6e0dfb95ac7 Mon Sep 17 00:00:00 2001 From: juzi <819872918@qq.com> Date: Fri, 15 Mar 2024 13:33:58 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E5=8E=82=E5=8A=A1=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E9=87=8C=E6=94=B9=E4=B8=AA=E5=B7=A5=E5=8D=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/base/orderManage.js | 9 + .../base/energyQuantityManual/index.vue | 92 ++++----- .../energyType/components/energyTypeAdd.vue | 91 ++++----- .../components/groupTeamViewDetail.vue | 2 +- .../orderManage/components/addWorkOrder.vue | 179 ++++++++---------- 5 files changed, 151 insertions(+), 222 deletions(-) diff --git a/src/api/base/orderManage.js b/src/api/base/orderManage.js index 732e13c7..00174a7d 100644 --- a/src/api/base/orderManage.js +++ b/src/api/base/orderManage.js @@ -34,6 +34,15 @@ export function workOrderList(query) { }) } +// 条件获得工单列表 +export function getFreeWOlist(query) { + return request({ + url: '/base/core-work-order/getFreeWOlist', + method: 'get', + params: query + }) +} + // 获得订单分页 export function getOrderPage(query) { return request({ diff --git a/src/views/energy/base/energyQuantityManual/index.vue b/src/views/energy/base/energyQuantityManual/index.vue index 49f6329b..14dd96e6 100644 --- a/src/views/energy/base/energyQuantityManual/index.vue +++ b/src/views/energy/base/energyQuantityManual/index.vue @@ -2,44 +2,20 @@
- + - - + + - + - - + +
@@ -68,7 +44,7 @@ const tableProps = [ }, { prop: 'tableName', - label: '水/气表名', + label: '能源表名', filter: publicFormatter('table_name'), minWidth: 110 }, @@ -142,25 +118,25 @@ export default { // 班次基础信息列表 list: [], tableBtn: [ - this.$auth.hasPermi('base:energy-quantity-manual:create') + this.$auth.hasPermi('base:energy-quantity-manual:create') ? { - type: 'meterReading', - btnName: '抄表' - } + type: 'meterReading', + btnName: '抄表' + } : undefined, this.$auth.hasPermi('base:energy-quantity-manual:update') ? { - type: 'edit', - btnName: '编辑' - } + type: 'edit', + btnName: '编辑' + } : undefined, this.$auth.hasPermi('base:energy-quantity-manual:delete') ? { - type: 'delete', - btnName: '删除' - } + type: 'delete', + btnName: '删除' + } : undefined - ].filter((v)=>v), + ].filter((v) => v), // 查询参数 queryParams: { pageNo: 1, @@ -209,10 +185,10 @@ export default { break default: this.$modal.confirm('是否确认导出').then(() => { - return energyQuantityManualExport({...this.queryParams}); - }).then(response => { - this.$download.excel(response, '能源报表.xls'); - }).catch(() => {}) + return energyQuantityManualExport({ ...this.queryParams }); + }).then(response => { + this.$download.excel(response, '能源报表.xls'); + }).catch(() => { }) } }, /** 查询列表 */ @@ -281,13 +257,13 @@ export default { /** 删除按钮操作 */ handleDelete(row) { console.log(row.id) - this.$modal.confirm('是否确认删除能源类型为"' + row.energyType + '"的数据项?').then(function() { - return energyQuantityManualDelete({id: row.id}); - }).then(() => { - this.queryParams.pageNo = 1; - this.getList(); - this.$modal.msgSuccess("删除成功"); - }).catch(() => {}); + this.$modal.confirm('是否确认删除能源类型为"' + row.energyType + '"的数据项?').then(function () { + return energyQuantityManualDelete({ id: row.id }); + }).then(() => { + this.queryParams.pageNo = 1; + this.getList(); + this.$modal.msgSuccess("删除成功"); + }).catch(() => { }); } } }; diff --git a/src/views/energy/base/energyType/components/energyTypeAdd.vue b/src/views/energy/base/energyType/components/energyTypeAdd.vue index 1b808543..efe5b35a 100644 --- a/src/views/energy/base/energyType/components/energyTypeAdd.vue +++ b/src/views/energy/base/energyType/components/energyTypeAdd.vue @@ -16,10 +16,7 @@ - @@ -28,9 +25,9 @@ - - - + + + @@ -38,56 +35,33 @@ - + - - + + - + - - + + - - + + @@ -182,15 +156,15 @@ export default { if (id) { this.isEdit = true this.form.id = id - getEnergyType( id ).then((res) => { + getEnergyType(id).then((res) => { if (res.code === 0) { this.form.name = res.data.name this.form.code = res.data.code this.form.unit = res.data.unit this.form.pricingMethod = res.data.pricingMethod this.form.leaderName = res.data.leaderName - this.form.push = res.data.push ? true : false - switch(this.form.pricingMethod) { + this.form.push = res.data.push ? true : false + switch (this.form.pricingMethod) { case 0: this.tableData1 = res.data.segPriceList || [] break; @@ -198,6 +172,7 @@ export default { this.tableData2 = res.data.usedPriceList || [] break; default: + this.form.singlePrice = res.data.singlePrice || 0 } } }) @@ -234,7 +209,7 @@ export default { emitButtonClick1() { let n = this.tableData1.length let obj = {} - obj.startTime = n === 0 ? '' : this.tableData1[n-1].endTime + obj.startTime = n === 0 ? '' : this.tableData1[n - 1].endTime obj.endTime = '' obj.price = 0 this.tableData1.push(obj) @@ -242,7 +217,7 @@ export default { emitButtonClick2() { let n = this.tableData2.length let obj = {} - obj.startUsed = n === 0 ? 0 : this.tableData2[n-1].endUsed + obj.startUsed = n === 0 ? 0 : this.tableData2[n - 1].endUsed obj.endUsed = 0 obj.price = 0 this.tableData2.push(obj) @@ -259,7 +234,7 @@ export default { submitForm() { this.$refs['form'].validate((valid) => { if (valid) { - switch(this.form.pricingMethod) { + switch (this.form.pricingMethod) { case 0:// 时间段 if (this.tableData1.length === 0) { this.$modal.msgError('时间段表格数据不能为空') @@ -289,7 +264,7 @@ export default { default:// 固定单价 if (!this.form.singlePrice) { this.$modal.msgError('单价有误请检查,请检查') - return false + return false } } console.log(this.form) @@ -302,11 +277,11 @@ export default { unit: this.form.unit, pricingMethod: this.form.pricingMethod, description: this.form.description, - dim: this.form.pricingMethod === 1 ? this.form.dim: '', + dim: this.form.pricingMethod === 1 ? this.form.dim : '', singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '', - segPriceList: this.form.pricingMethod === 0 ? this.tableData1: [], - usedPriceList: this.form.pricingMethod === 1 ? this.tableData2: [], - push:this.form.push ? 1 : 0 + segPriceList: this.form.pricingMethod === 0 ? this.tableData1 : [], + usedPriceList: this.form.pricingMethod === 1 ? this.tableData2 : [], + push: this.form.push ? 1 : 0 }).then((res) => { if (res.code === 0) { this.$modal.msgSuccess("操作成功"); @@ -320,11 +295,11 @@ export default { unit: this.form.unit, pricingMethod: this.form.pricingMethod, description: this.form.description, - dim: this.form.pricingMethod === 1 ? this.form.dim: '', + dim: this.form.pricingMethod === 1 ? this.form.dim : '', singlePrice: this.form.pricingMethod === 2 ? this.form.singlePrice : '', - segPriceList: this.form.pricingMethod === 0 ? this.tableData1: [], - usedPriceList: this.form.pricingMethod === 1 ? this.tableData2: [], - push:this.form.push ? 1 : 0 + segPriceList: this.form.pricingMethod === 0 ? this.tableData1 : [], + usedPriceList: this.form.pricingMethod === 1 ? this.tableData2 : [], + push: this.form.push ? 1 : 0 }).then((res) => { if (res.code === 0) { this.$modal.msgSuccess("操作成功"); diff --git a/src/views/group/monitoring/groupTeamView/components/groupTeamViewDetail.vue b/src/views/group/monitoring/groupTeamView/components/groupTeamViewDetail.vue index 3e46b185..de22d382 100644 --- a/src/views/group/monitoring/groupTeamView/components/groupTeamViewDetail.vue +++ b/src/views/group/monitoring/groupTeamView/components/groupTeamViewDetail.vue @@ -1,6 +1,6 @@ diff --git a/src/views/report/glass/inputTable.vue b/src/views/report/glass/inputTable.vue index d5d6614a..6a68c98e 100644 --- a/src/views/report/glass/inputTable.vue +++ b/src/views/report/glass/inputTable.vue @@ -1,7 +1,7 @@ @@ -9,10 +9,10 @@
编辑 - 返回 + 返回 保存 - + - + +
@@ -112,7 +114,7 @@ const cols = [ label: '本周', }, { - prop: 'originalGlassPassHis ', + prop: 'originalGlassPassHis', label: '上周', }, { @@ -130,6 +132,10 @@ const cols = [ type: Array, default: () => [], }, + id: { + type: String, + default:'exportTable' + }, time: { type: Array, default: () => [], @@ -150,6 +156,7 @@ const cols = [ data() { return { cols, + remark:null, edit: false, }; }, @@ -195,16 +202,44 @@ const cols = [ } } }, - methods: { + methods: { + handleReturn() { + // this.disabled = true + this.edit = false + }, + handleChange(e) { + // console.log(q) + console.log(e); + }, updateData() { + let obj = {} this.data.forEach((ele, index) => { + if (ele.det === false) { + this.data[index].lineId = '' + this.data[index].remark = this.remark + obj = ele + delete this.data[index].dailyOutputTrend + delete this.data[index].originalGlassStatisticsTrend + delete this.data[index].actualProductTrend + delete this.data[index].originalGlassPassTrend + this.data.splice(index, 1) + } + }) + let updateArr = this.data + updateArr.forEach((ele, index) => { delete ele.dailyOutputTrend delete ele.originalGlassStatisticsTrend delete ele.actualProductTrend delete ele.originalGlassPassTrend }); - updateGlass(this.data).then(response => { - updateGlassRemark(this.sum).then(res => { + // this.data.forEach((ele, index) => { + // delete ele.dailyOutputTrend + // delete ele.originalGlassStatisticsTrend + // delete ele.actualProductTrend + // delete ele.originalGlassPassTrend + // }); + updateGlass(updateArr).then(response => { + updateGlassRemark(obj).then(res => { this.$modal.msgSuccess("修改成功"); this.edit = false; this.$emit("refreshDataList"); diff --git a/src/views/report/glass/month.vue b/src/views/report/glass/month.vue index 011a2c4b..9b099a73 100644 --- a/src/views/report/glass/month.vue +++ b/src/views/report/glass/month.vue @@ -29,7 +29,8 @@ import { parseTime } from '../../core/mixins/code-filter'; import { getGlassPage, exportGlasscExcel } from '@/api/report/glass'; import inputTable from './inputTable.vue'; import { getCorePLList } from '@/api/base/coreProductionLine'; - +import FileSaver from 'file-saver' +import * as XLSX from 'xlsx' export default { components: { inputTable }, data() { @@ -72,29 +73,61 @@ export default { // console.log(date) this.changeTime(date) // console.log(date.valueOf()); + }, + multipliedByHundred(str) { + if (str) { + let floatVal = parseFloat(str); + if (isNaN(floatVal)) { + return 0; + } + floatVal = Math.round(str * 10000) / 100; + let strVal = floatVal.toString(); + let searchVal = strVal.indexOf('.'); + if (searchVal < 0) { + searchVal = strVal.length; + strVal += '.'; + } + while (strVal.length <= searchVal + 2) { + strVal += '0'; + } + return parseFloat(strVal); + } + }, // 获取数据列表 async getDataList() { this.dataListLoading = true; - await this.urlOptions.getDataListURL(this.listQuery).then(response => { - this.tableData = response.data.filter(item => { - this.proLineList.forEach(it => { - if (item.lineId === it.id) { + if (this.listQuery.reportTime.length == 0) { + this.$message({ + message: '请选择时间', + type: 'warning' + }) + return false + } + await this.urlOptions.getDataListURL(this.listQuery).then(res => { + res.data.forEach((ele, index) => { + if (ele.det === false) { + res.data[index].lineName = '合计' + this.remark = res.data[index].remark + res.data[index].dailyOutputTrend = res.data[index].dailyOutputTrend != 0 ? this.multipliedByHundred(res.data[index].dailyOutputTrend) + '%' : res.data[index].dailyOutputTrend == 0 ? 0 : undefined + res.data[index].originalGlassStatisticsTrend = res.data[index].originalGlassStatisticsTrend != 0 ? this.multipliedByHundred(res.data[index].originalGlassStatisticsTrend) + '%' : res.data[index].originalGlassStatisticsTrend == 0 ? 0 : undefined + res.data[index].actualProductTrend = res.data[index].actualProductTrend != 0 ? this.multipliedByHundred(res.data[index].actualProductTrend) + '%' : res.data[index].actualProductTrend == 0 ? 0 : undefined + res.data[index].originalGlassPassTrend = res.data[index].originalGlassPassTrend != 0 ? this.multipliedByHundred(res.data[index].originalGlassPassTrend) + '%' : res.data[index].originalGlassPassTrend == 0 ? 0 : undefined + } + }) + res.data.forEach(item => { + this.proLineList.forEach(it => { + if (item.lineId === it.id) { + console.log(item) item.lineName = it.name - item.dailyOutputTrend = item.dailyOutputTrend ? parseFloat((item.dailyOutputTrend * 100).toFixed(2)) + '%' : null - item.originalGlassStatisticsTrend = item.originalGlassStatisticsTrend ? parseFloat((item.originalGlassStatisticsTrend * 100).toFixed(2)) + '%' : null - item.actualProductTrend = item.actualProductTrend ? parseFloat((item.originalGlassStatisticsTrend * 100).toFixed(2)) + '%' : null - item.originalGlassPassTrend = item.originalGlassPassTrend ? parseFloat((item.originalGlassStatisticsTrend * 100).toFixed(2)) + '%' : null - } - }) - if (item.det === false) { - this.all = { - id: item.id, - remark: item.remark - } - } - return item.det === true - }); + item.dailyOutputTrend = item.dailyOutputTrend != 0 ? this.multipliedByHundred(item.dailyOutputTrend) + '%' : item.dailyOutputTrend == 0 ? 0 : undefined + item.originalGlassStatisticsTrend = item.originalGlassStatisticsTrend != 0 ? this.multipliedByHundred(item.originalGlassStatisticsTrend) + '%' : item.originalGlassStatisticsTrend == 0 ? 0 : undefined + item.actualProductTrend = item.actualProductTrend != 0 ? this.multipliedByHundred(item.actualProductTrend) + '%' : item.actualProductTrend == 0 ? 0 : undefined + item.originalGlassPassTrend = item.originalGlassPassTrend != 0 ? this.multipliedByHundred(item.originalGlassPassTrend) + '%' : item.originalGlassPassTrend == 0 ? 0 : undefined + } + }) + }) + this.tableData = res.data this.listQuery.total = response.data.length; this.dataListLoading = false; }); @@ -165,16 +198,32 @@ export default { /** 导出按钮操作 */ handleExport() { // 处理查询参数 - let params = { ...this.listQuery }; - params.pageNo = undefined; - params.pageSize = undefined; - this.$modal.confirm('是否确认导出所有数据项?').then(() => { - this.exportLoading = true; - return this.urlOptions.exportURL(params); - }).then(response => { - this.$download.excel(response, '原片生产周报.xls'); - this.exportLoading = false; - }).catch(() => { }); + var xlsxParam = { raw: true }; + /* 从表生成工作簿对象 */ + var wb = XLSX.utils.table_to_book( + document.querySelector("#exportTable"), + xlsxParam + ); + /* 获取二进制字符串作为输出 */ + var wbout = XLSX.write(wb, { + bookType: "xlsx", + bookSST: true, + type: "array", + }); + try { + FileSaver.saveAs( + //Blob 对象表示一个不可变、原始数据的类文件对象。 + //Blob 表示的不一定是JavaScript原生格式的数据。 + //File 接口基于Blob,继承了 blob 的功能并将其扩展使其支持用户系统上的文件。 + //返回一个新创建的 Blob 对象,其内容由参数中给定的数组串联组成。 + new Blob([wbout], { type: "application/octet-stream" }), + //设置导出文件名称 + "许昌安彩月原片生产汇总.xlsx" + ); + } catch (e) { + if (typeof console !== "undefined") console.log(e, wbout); + } + return wbout; } }, }; diff --git a/src/views/report/glass/weekly.vue b/src/views/report/glass/weekly.vue index 8c85adbf..7df919b7 100644 --- a/src/views/report/glass/weekly.vue +++ b/src/views/report/glass/weekly.vue @@ -31,7 +31,8 @@ import { parseTime } from '../../core/mixins/code-filter'; import { getGlassPage, exportGlasscExcel } from '@/api/report/glass'; import inputTable from './inputTable.vue'; import { getCorePLList } from '@/api/base/coreProductionLine'; - +import FileSaver from 'file-saver' +import * as XLSX from 'xlsx' export default { components: { inputTable }, data() { @@ -163,29 +164,61 @@ export default { // this.endTimeStamp = this.timeFun(timeStamp + (24 * 60 * 60 * 1000) * 5); //结束时间 // this.changeTime(reportTime) } + }, + multipliedByHundred(str) { + if (str) { + let floatVal = parseFloat(str); + if (isNaN(floatVal)) { + return 0; + } + floatVal = Math.round(str * 10000) / 100; + let strVal = floatVal.toString(); + let searchVal = strVal.indexOf('.'); + if (searchVal < 0) { + searchVal = strVal.length; + strVal += '.'; + } + while (strVal.length <= searchVal + 2) { + strVal += '0'; + } + return parseFloat(strVal); + } + }, // 获取数据列表 async getDataList() { this.dataListLoading = true; - await this.urlOptions.getDataListURL(this.listQuery).then(response => { - this.tableData = response.data.filter(item => { - this.proLineList.forEach(it => { - if (item.lineId === it.id) { + if (this.listQuery.reportTime.length == 0) { + this.$message({ + message: '请选择时间', + type: 'warning' + }) + return false + } + await this.urlOptions.getDataListURL(this.listQuery).then(res => { + res.data.forEach((ele, index) => { + if (ele.det === false) { + res.data[index].lineName = '合计' + this.remark = res.data[index].remark + res.data[index].dailyOutputTrend = res.data[index].dailyOutputTrend != 0 ? this.multipliedByHundred(res.data[index].dailyOutputTrend) + '%' : res.data[index].dailyOutputTrend == 0 ? 0 : undefined + res.data[index].originalGlassStatisticsTrend = res.data[index].originalGlassStatisticsTrend != 0 ? this.multipliedByHundred(res.data[index].originalGlassStatisticsTrend) + '%' : res.data[index].originalGlassStatisticsTrend == 0 ? 0 : undefined + res.data[index].actualProductTrend = res.data[index].actualProductTrend != 0 ? this.multipliedByHundred(res.data[index].actualProductTrend) + '%' : res.data[index].actualProductTrend == 0 ? 0 : undefined + res.data[index].originalGlassPassTrend = res.data[index].originalGlassPassTrend != 0 ? this.multipliedByHundred(res.data[index].originalGlassPassTrend) + '%' : res.data[index].originalGlassPassTrend == 0 ? 0 : undefined + } + }) + res.data.forEach(item => { + this.proLineList.forEach(it => { + if (item.lineId === it.id) { + console.log(item) item.lineName = it.name - item.dailyOutputTrend = item.dailyOutputTrend ? parseFloat((item.dailyOutputTrend * 100).toFixed(2)) + '%' : null - item.originalGlassStatisticsTrend = item.originalGlassStatisticsTrend ? parseFloat((item.originalGlassStatisticsTrend * 100).toFixed(2)) + '%' : null - item.actualProductTrend = item.actualProductTrend ? parseFloat((item.originalGlassStatisticsTrend * 100).toFixed(2)) + '%' : null - item.originalGlassPassTrend = item.originalGlassPassTrend ? parseFloat((item.originalGlassStatisticsTrend * 100).toFixed(2)) + '%' : null - } - }) - if (item.det === false) { - this.all = { - id: item.id, - remark: item.remark - } - } - return item.det === true - }); + item.dailyOutputTrend = item.dailyOutputTrend != 0 ? this.multipliedByHundred(item.dailyOutputTrend) + '%' : item.dailyOutputTrend == 0 ? 0 : undefined + item.originalGlassStatisticsTrend = item.originalGlassStatisticsTrend != 0 ? this.multipliedByHundred(item.originalGlassStatisticsTrend) + '%' : item.originalGlassStatisticsTrend == 0 ? 0 : undefined + item.actualProductTrend = item.actualProductTrend != 0 ? this.multipliedByHundred(item.actualProductTrend) + '%' : item.actualProductTrend == 0 ? 0 : undefined + item.originalGlassPassTrend = item.originalGlassPassTrend != 0 ? this.multipliedByHundred(item.originalGlassPassTrend) + '%' : item.originalGlassPassTrend == 0 ? 0 : undefined + } + }) + }) + this.tableData = res.data this.listQuery.total = response.data.length; this.dataListLoading = false; }); @@ -230,16 +263,32 @@ export default { /** 导出按钮操作 */ handleExport() { // 处理查询参数 - let params = { ...this.listQuery }; - params.pageNo = undefined; - params.pageSize = undefined; - this.$modal.confirm('是否确认导出所有数据项?').then(() => { - this.exportLoading = true; - return this.urlOptions.exportURL(params); - }).then(response => { - this.$download.excel(response, '原片生产周报.xls'); - this.exportLoading = false; - }).catch(() => { }); + var xlsxParam = { raw: true }; + /* 从表生成工作簿对象 */ + var wb = XLSX.utils.table_to_book( + document.querySelector("#exportTable"), + xlsxParam + ); + /* 获取二进制字符串作为输出 */ + var wbout = XLSX.write(wb, { + bookType: "xlsx", + bookSST: true, + type: "array", + }); + try { + FileSaver.saveAs( + //Blob 对象表示一个不可变、原始数据的类文件对象。 + //Blob 表示的不一定是JavaScript原生格式的数据。 + //File 接口基于Blob,继承了 blob 的功能并将其扩展使其支持用户系统上的文件。 + //返回一个新创建的 Blob 对象,其内容由参数中给定的数组串联组成。 + new Blob([wbout], { type: "application/octet-stream" }), + //设置导出文件名称 + "许昌安彩周原片生产汇总.xlsx" + ); + } catch (e) { + if (typeof console !== "undefined") console.log(e, wbout); + } + return wbout; } }, }; diff --git a/src/views/report/glass/year.vue b/src/views/report/glass/year.vue index c9146476..6bff74f9 100644 --- a/src/views/report/glass/year.vue +++ b/src/views/report/glass/year.vue @@ -26,7 +26,8 @@ import { parseTime } from '../../core/mixins/code-filter'; import { getGlassPage, exportGlasscExcel } from '@/api/report/glass'; import inputTable from './inputTable.vue'; import { getCorePLList } from '@/api/base/coreProductionLine'; - +import FileSaver from 'file-saver' +import * as XLSX from 'xlsx' export default { components: { inputTable }, data() { @@ -74,29 +75,61 @@ export default { // 产线列表 const res = await getCorePLList(); this.proLineList = res.data; - }, + }, + multipliedByHundred(str) { + if (str) { + let floatVal = parseFloat(str); + if (isNaN(floatVal)) { + return 0; + } + floatVal = Math.round(str * 10000) / 100; + let strVal = floatVal.toString(); + let searchVal = strVal.indexOf('.'); + if (searchVal < 0) { + searchVal = strVal.length; + strVal += '.'; + } + while (strVal.length <= searchVal + 2) { + strVal += '0'; + } + return parseFloat(strVal); + } + + }, // 获取数据列表 async getDataList() { this.dataListLoading = true; - await this.urlOptions.getDataListURL(this.listQuery).then(response => { - this.tableData = response.data.filter(item => { - this.proLineList.forEach(it => { + if (this.listQuery.reportTime.length == 0) { + this.$message({ + message: '请选择时间', + type: 'warning' + }) + return false + } + await this.urlOptions.getDataListURL(this.listQuery).then(res => { + res.data.forEach((ele, index) => { + if (ele.det === false) { + res.data[index].lineName = '合计' + this.remark = res.data[index].remark + res.data[index].dailyOutputTrend = res.data[index].dailyOutputTrend != 0 ? this.multipliedByHundred(res.data[index].dailyOutputTrend) + '%' : res.data[index].dailyOutputTrend == 0 ? 0 : undefined + res.data[index].originalGlassStatisticsTrend = res.data[index].originalGlassStatisticsTrend != 0 ? this.multipliedByHundred(res.data[index].originalGlassStatisticsTrend) + '%' : res.data[index].originalGlassStatisticsTrend == 0 ? 0 : undefined + res.data[index].actualProductTrend = res.data[index].actualProductTrend != 0 ? this.multipliedByHundred(res.data[index].actualProductTrend) + '%' : res.data[index].actualProductTrend == 0 ? 0 : undefined + res.data[index].originalGlassPassTrend = res.data[index].originalGlassPassTrend != 0 ? this.multipliedByHundred(res.data[index].originalGlassPassTrend) + '%' : res.data[index].originalGlassPassTrend == 0 ? 0 : undefined + } + }) + res.data.forEach(item => { + this.proLineList.forEach(it => { if (item.lineId === it.id) { - item.dailyOutputTrend = item.dailyOutputTrend ? parseFloat((item.dailyOutputTrend * 100).toFixed(2)) + '%' : null - item.originalGlassStatisticsTrend = item.originalGlassStatisticsTrend ? parseFloat((item.originalGlassStatisticsTrend * 100).toFixed(2)) + '%' : null - item.actualProductTrend = item.actualProductTrend ? parseFloat((item.originalGlassStatisticsTrend * 100).toFixed(2)) + '%' : null - item.originalGlassPassTrend = item.originalGlassPassTrend ? parseFloat((item.originalGlassStatisticsTrend * 100).toFixed(2)) + '%' : null - item.lineName = it.name - } - }) - if (item.det === false) { - this.all = { - id: item.id, - remark: item.remark - } - } - return item.det === true - }); + console.log(item) + item.lineName = it.name + item.dailyOutputTrend = item.dailyOutputTrend != 0 ? this.multipliedByHundred(item.dailyOutputTrend) + '%' : item.dailyOutputTrend == 0 ? 0 : undefined + item.originalGlassStatisticsTrend = item.originalGlassStatisticsTrend != 0 ? this.multipliedByHundred(item.originalGlassStatisticsTrend) + '%' : item.originalGlassStatisticsTrend == 0 ? 0 : undefined + item.actualProductTrend = item.actualProductTrend != 0 ? this.multipliedByHundred(item.actualProductTrend) + '%' : item.actualProductTrend == 0 ? 0 : undefined + item.originalGlassPassTrend = item.originalGlassPassTrend != 0 ? this.multipliedByHundred(item.originalGlassPassTrend) + '%' : item.originalGlassPassTrend == 0 ? 0 : undefined + } + }) + }) + this.tableData = res.data this.listQuery.total = response.data.length; this.dataListLoading = false; }); @@ -139,16 +172,32 @@ export default { /** 导出按钮操作 */ handleExport() { // 处理查询参数 - let params = { ...this.listQuery }; - params.pageNo = undefined; - params.pageSize = undefined; - this.$modal.confirm('是否确认导出所有数据项?').then(() => { - this.exportLoading = true; - return this.urlOptions.exportURL(params); - }).then(response => { - this.$download.excel(response, '原片生产周报.xls'); - this.exportLoading = false; - }).catch(() => { }); + var xlsxParam = { raw: true }; + /* 从表生成工作簿对象 */ + var wb = XLSX.utils.table_to_book( + document.querySelector("#exportTable"), + xlsxParam + ); + /* 获取二进制字符串作为输出 */ + var wbout = XLSX.write(wb, { + bookType: "xlsx", + bookSST: true, + type: "array", + }); + try { + FileSaver.saveAs( + //Blob 对象表示一个不可变、原始数据的类文件对象。 + //Blob 表示的不一定是JavaScript原生格式的数据。 + //File 接口基于Blob,继承了 blob 的功能并将其扩展使其支持用户系统上的文件。 + //返回一个新创建的 Blob 对象,其内容由参数中给定的数组串联组成。 + new Blob([wbout], { type: "application/octet-stream" }), + //设置导出文件名称 + "许昌安彩年原片生产汇总.xlsx" + ); + } catch (e) { + if (typeof console !== "undefined") console.log(e, wbout); + } + return wbout; } }, }; diff --git a/src/views/report/productionDayReport/index.vue b/src/views/report/productionDayReport/index.vue index 0d8e23d0..2dcd82e4 100644 --- a/src/views/report/productionDayReport/index.vue +++ b/src/views/report/productionDayReport/index.vue @@ -1,13 +1,13 @@