|
|
|
@ -13,22 +13,23 @@
|
|
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
|
type="warning"
|
|
|
|
|
plain
|
|
|
|
|
icon="el-icon-download"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleExport"
|
|
|
|
|
v-hasPermi="['mes:scrap:export']"
|
|
|
|
|
>导出</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
|
<!-- <el-row :gutter="10" class="mb8">-->
|
|
|
|
|
<!-- <el-col :span="1.5">-->
|
|
|
|
|
<!-- <el-button-->
|
|
|
|
|
<!-- type="warning"-->
|
|
|
|
|
<!-- plain-->
|
|
|
|
|
<!-- icon="el-icon-download"-->
|
|
|
|
|
<!-- size="mini"-->
|
|
|
|
|
<!-- @click="handleExport"-->
|
|
|
|
|
<!-- v-hasPermi="['mes:scrap:export']"-->
|
|
|
|
|
<!-- >导出</el-button>-->
|
|
|
|
|
<!-- </el-col>-->
|
|
|
|
|
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
|
|
|
|
|
<!-- </el-row>-->
|
|
|
|
|
<el-tabs type="border-card" @tab-click="handleTabClick">
|
|
|
|
|
<el-tab-pane label="当月产线产量汇总" >
|
|
|
|
|
<el-table :data="tableData" border style="width: 100%" :header-cell-style="getHeaderCellStyle" :summary-method="getSummaries" show-summary>
|
|
|
|
|
<el-button @click="exportExcel1">导出</el-button>
|
|
|
|
|
<el-table :data="tableData" id="exportTable1" border style="width: 100%" :header-cell-style="getHeaderCellStyle" :summary-method="getSummaries" show-summary>
|
|
|
|
|
<el-table-column prop="equipment_name" label="产线" fixed="left" width="150"></el-table-column>
|
|
|
|
|
<el-table-column prop="category" label="类别" fixed="left" width="150"></el-table-column>
|
|
|
|
|
<el-table-column prop="total_monthly_summary" label="当月汇总" fixed="left" width="150"></el-table-column>
|
|
|
|
@ -39,7 +40,8 @@
|
|
|
|
|
</el-tab-pane>
|
|
|
|
|
|
|
|
|
|
<el-tab-pane label="当月产线品类汇总" >
|
|
|
|
|
<el-table :data="tableDatas" border style="width: 100%" :header-cell-style="getHeaderCellStyle" :summary-method="getSummaries" show-summary>
|
|
|
|
|
<el-button @click="exportExcel2">导出</el-button>
|
|
|
|
|
<el-table :data="tableDatas" id="exportTable2" border style="width: 100%" :header-cell-style="getHeaderCellStyle" :summary-method="getSummaries" show-summary>
|
|
|
|
|
<el-table-column prop="category" label="类别" fixed="left" width="150"></el-table-column>
|
|
|
|
|
<el-table-column prop="total_monthly_summarys" label="当月汇总" fixed="left" width="150"></el-table-column>
|
|
|
|
|
<el-table-column v-for="day in days" :key="day" :prop="day" :label="`${day.replace('day', '')}`" :width="150" align="center" :formatter="formatNullToZero">
|
|
|
|
@ -54,6 +56,8 @@
|
|
|
|
|
<script>
|
|
|
|
|
import { getmonthProductionSut } from "@/api/mes/reportWork";
|
|
|
|
|
import * as echarts from 'echarts';
|
|
|
|
|
import FileSaver from 'file-saver'
|
|
|
|
|
import * as XLSX from 'xlsx'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "Index",
|
|
|
|
@ -92,7 +96,28 @@ export default {
|
|
|
|
|
pad(number) {
|
|
|
|
|
return number.toString().padStart(2, '0');
|
|
|
|
|
},
|
|
|
|
|
async exportExcel1() {
|
|
|
|
|
const table = document.querySelector('#exportTable1').cloneNode(true)
|
|
|
|
|
// 删除fixed区域避免重复内容
|
|
|
|
|
if (table.querySelector('.el-table__fixed')) {
|
|
|
|
|
table.removeChild(table.querySelector('.el-table__fixed')) // :ml-citation{ref="3,8" data="citationList"}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const wb = XLSX.utils.table_to_book(table, { raw: true })
|
|
|
|
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' })
|
|
|
|
|
FileSaver.saveAs(new Blob([wbout]), '当月产线产量汇总.xlsx') // :ml-citation{ref="4,7" data="citationList"}
|
|
|
|
|
},
|
|
|
|
|
exportExcel2() {
|
|
|
|
|
const table = document.querySelector('#exportTable2').cloneNode(true)
|
|
|
|
|
// 删除fixed区域避免重复内容
|
|
|
|
|
if (table.querySelector('.el-table__fixed')) {
|
|
|
|
|
table.removeChild(table.querySelector('.el-table__fixed')) // :ml-citation{ref="3,8" data="citationList"}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const wb = XLSX.utils.table_to_book(table, { raw: true })
|
|
|
|
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' })
|
|
|
|
|
FileSaver.saveAs(new Blob([wbout]), '当月产线品类汇总.xlsx') // :ml-citation{ref="4,7" data="citationList"}
|
|
|
|
|
},
|
|
|
|
|
getHeaderCellStyle({rowIndex, columnIndex}) {
|
|
|
|
|
if (rowIndex === 0 && columnIndex === 0) {
|
|
|
|
|
return 'background-color: #afccfd; color: #000000;'; // 蓝色
|
|
|
|
|