1645 lines
39 KiB
Vue
1645 lines
39 KiB
Vue
<template>
|
||
<div class="app-container">
|
||
<el-header>
|
||
<div class="left-panel">
|
||
<el-select
|
||
v-model="query.type"
|
||
placeholder="查询类型"
|
||
clearable
|
||
class="headerSearch"
|
||
@change="typeCange"
|
||
>
|
||
<el-option
|
||
v-for="item in options"
|
||
:key="item.id"
|
||
:label="item.name"
|
||
:value="item.id"
|
||
></el-option>
|
||
</el-select>
|
||
<el-date-picker
|
||
v-model="query.day"
|
||
type="date"
|
||
value-format="YYYY-MM-DD"
|
||
format="YYYY-MM-DD"
|
||
placeholder="天"
|
||
v-if="query.type==0"
|
||
style="margin-right: 6px"
|
||
/>
|
||
<el-date-picker
|
||
v-model="query.month"
|
||
type="month"
|
||
value-format="YYYY-MM"
|
||
format="YYYY-MM"
|
||
placeholder="查询月份"
|
||
v-if="query.type==1"
|
||
class="headerSearch"
|
||
/>
|
||
<el-date-picker
|
||
v-model="query.year"
|
||
type="year"
|
||
value-format="YYYY"
|
||
format="YYYY"
|
||
placeholder="查询年份"
|
||
v-if="query.type==2"
|
||
class="headerSearch"
|
||
/>
|
||
<el-button
|
||
type="primary"
|
||
icon="el-icon-search"
|
||
@click="dateChange"
|
||
></el-button>
|
||
<el-button
|
||
type="primary"
|
||
@click="exportExcel()"
|
||
:loading="exportLoading"
|
||
v-auth="'export_excel'"
|
||
>导出xlsx
|
||
</el-button>
|
||
<el-button type="primary" @click="handlePrint">打印 </el-button>
|
||
</div>
|
||
</el-header>
|
||
<el-card style="margin-top: 5px">
|
||
<div class="printWrap">
|
||
<div ref="print" id="myReport" class="printContainer">
|
||
<table
|
||
border="1"
|
||
width="1035"
|
||
cellspacing="0"
|
||
:key="timeStamp"
|
||
id="myTable"
|
||
class="myTable"
|
||
>
|
||
<thead class="myTableHead">
|
||
<tr>
|
||
<th colspan="10">生料工序生产报告</th>
|
||
</tr>
|
||
<tr>
|
||
<th colspan="2">参数</th>
|
||
<th>本日</th>
|
||
<th>昨日</th>
|
||
<th>本月</th>
|
||
<th>本年</th>
|
||
<th @click="goToTarget('3744925985427398656')"
|
||
style="font-weight: bold; color: #1CD6DD; font-size: 18px;">月目标值</th>
|
||
<th>月完成度</th>
|
||
<th @click="goToTarget('3744925985427398656')">年目标值</th>
|
||
<th>年完成度</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr v-for="(item, index) in tableDatas" :key="item">
|
||
<td
|
||
class="numCell"
|
||
v-if="index == 0 || index == 2 || index == 4"
|
||
rowspan="2"
|
||
>
|
||
{{ item[0] }}
|
||
</td>
|
||
<td
|
||
class="numCell"
|
||
v-else-if="index == 6"
|
||
>
|
||
{{ item[0] }}
|
||
</td>
|
||
<td class="numCell">{{ item[1] }}</td>
|
||
<td
|
||
class="numCell hoursItem"
|
||
@click="itemClick('day_s', item)"
|
||
>
|
||
{{ item[2] }}
|
||
</td>
|
||
<td
|
||
class="numCell daysItem"
|
||
@click="itemClick('day_s', item)"
|
||
>
|
||
{{ item[3] }}
|
||
</td>
|
||
<td
|
||
class="numCell monthItem"
|
||
@click="itemClick('month_s', item)"
|
||
>
|
||
{{ item[4] }}
|
||
</td>
|
||
<td
|
||
class="numCell yearItem"
|
||
@click="itemClick('year_s', item)"
|
||
>
|
||
{{ item[5] }}
|
||
</td>
|
||
<td class="numCell">{{ item[6]}}</td>
|
||
<td class="numCell">{{ item[7] }}</td>
|
||
<td class="numCell">{{ item[8]}}</td>
|
||
<td class="numCell">{{ item[9] }}</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<!-- <div class="radioWrap">
|
||
<el-radio-group
|
||
v-model="typeRadio"
|
||
@change="typeRadioChange"
|
||
>
|
||
<el-radio-button label="day">按时</el-radio-button>
|
||
<el-radio-button label="month"
|
||
>按日</el-radio-button
|
||
>
|
||
<el-radio-button label="year">按月</el-radio-button>
|
||
</el-radio-group>
|
||
<div style="position: absolute; right: 20px">
|
||
<el-date-picker
|
||
v-model="searchDate"
|
||
type="date"
|
||
value-format="YYYY-MM-DD"
|
||
formatter="YYYY-MM-DD"
|
||
placeholder="选择日期"
|
||
v-if="typeRadio == 'day'"
|
||
@change="dateChange"
|
||
></el-date-picker>
|
||
<el-date-picker
|
||
v-model="searchDate"
|
||
type="month"
|
||
value-format="YYYY-MM"
|
||
formatter="YYYY-MM"
|
||
placeholder="选择月"
|
||
v-if="typeRadio == 'month'"
|
||
@change="dateChange"
|
||
></el-date-picker>
|
||
<el-date-picker
|
||
v-if="typeRadio == 'year'"
|
||
v-model="searchDate"
|
||
type="year"
|
||
value-format="YYYY"
|
||
formatter="YYYY"
|
||
placeholder="选择年"
|
||
@change="dateChange"
|
||
></el-date-picker>
|
||
</div>
|
||
</div> -->
|
||
<!-- <div id="main" style="width:1200px;height:600px;"></div> -->
|
||
<div class="chartWrap" v-show="query.type == 0">
|
||
<div class="chartTitle">本日生产参数统计图</div>
|
||
<scEcharts
|
||
height="400px"
|
||
width="1033px"
|
||
:option="optionHour"
|
||
></scEcharts>
|
||
</div>
|
||
<div class="chartWrap" v-show="query.type == 1">
|
||
<div class="chartTitle">本月生产参数统计图</div>
|
||
<scEcharts
|
||
height="400px"
|
||
width="1033px"
|
||
:option="optionDay"
|
||
></scEcharts>
|
||
</div>
|
||
<div class="chartWrap" v-show="query.type == 2">
|
||
<div class="chartTitle">本年生产参数统计图</div>
|
||
<scEcharts
|
||
height="400px"
|
||
width="1033px"
|
||
:option="optionMonth"
|
||
></scEcharts>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- <sc-dialog v-model="chartShow" draggable title="生料工序">
|
||
<div class="searchHead" v-if="type == 'hours'">
|
||
<el-date-picker
|
||
v-model="query.start_time"
|
||
type="date"
|
||
placeholder="选择时间"
|
||
format="YYYY-MM-DD"
|
||
value-format="YYYY-MM-DD"
|
||
:picker-options="pickerOptions"
|
||
/>
|
||
<span class="middleText">至</span>
|
||
<el-date-picker
|
||
v-model="query.end_time"
|
||
type="date"
|
||
format="YYYY-MM-DD"
|
||
value-format="YYYY-MM-DD"
|
||
start-placeholder="结束日期"
|
||
:picker-options="pickerOptions"
|
||
/>
|
||
<el-button
|
||
type="primary"
|
||
class="searchBtn"
|
||
@click="dataSearch"
|
||
>查询</el-button
|
||
>
|
||
</div>
|
||
<div class="searchHead" v-if="type == 'days'">
|
||
<el-date-picker
|
||
v-model="query.start_time"
|
||
type="date"
|
||
format="YYYY-MM-DD"
|
||
value-format="YYYY-MM-DD"
|
||
start-placeholder="开始日期"
|
||
:picker-options="pickerOptions"
|
||
/>
|
||
<el-date-picker
|
||
v-model="query.end_time"
|
||
type="date"
|
||
format="YYYY-MM-DD"
|
||
value-format="YYYY-MM-DD"
|
||
start-placeholder="结束日期"
|
||
:picker-options="pickerOptions"
|
||
/>
|
||
<el-button
|
||
type="primary"
|
||
class="searchBtn"
|
||
@click="dataSearch"
|
||
>查询</el-button
|
||
>
|
||
</div>
|
||
<div class="searchHead" v-if="type == 'month'">
|
||
<el-date-picker
|
||
v-model="query.start_time"
|
||
type="month"
|
||
format="YYYY-MM"
|
||
value-format="YYYY-MM"
|
||
start-placeholder="开始月份"
|
||
:picker-options="pickerOptions"
|
||
/>
|
||
<el-date-picker
|
||
v-model="query.end_time"
|
||
type="month"
|
||
format="YYYY-MM"
|
||
value-format="YYYY-MM"
|
||
start-placeholder="结束月份"
|
||
:picker-options="pickerOptions"
|
||
/>
|
||
<el-button
|
||
type="primary"
|
||
class="searchBtn"
|
||
@click="dataSearch"
|
||
>查询</el-button
|
||
>
|
||
</div>
|
||
<div class="searchHead" v-if="type == 'year'">
|
||
<el-date-picker
|
||
v-model="query.start_time"
|
||
type="year"
|
||
format="YYYY"
|
||
value-format="YYYY"
|
||
start-placeholder="开始日期"
|
||
:picker-options="pickerOptions"
|
||
/>
|
||
<el-date-picker
|
||
v-model="query.end_time"
|
||
type="year"
|
||
format="YYYY"
|
||
value-format="YYYY"
|
||
start-placeholder="结束日期"
|
||
:picker-options="pickerOptions"
|
||
/>
|
||
<el-button
|
||
type="primary"
|
||
class="searchBtn"
|
||
@click="dataSearch"
|
||
>查询</el-button
|
||
>
|
||
</div>
|
||
<scEcharts
|
||
height="360px"
|
||
:option="myOption"
|
||
v-if="chartShow"
|
||
></scEcharts>
|
||
</sc-dialog> -->
|
||
<charts
|
||
v-if="asynDialog"
|
||
:type="type"
|
||
:title="title"
|
||
:cate="cate"
|
||
:apiObj="apiObj"
|
||
:mgroup="query.mgroup"
|
||
:modelValue="modelValue"
|
||
:showClose="showClose"
|
||
:echartType="echartType"
|
||
@closed="asynDialog = false"
|
||
></charts>
|
||
</el-card>
|
||
</div>
|
||
</template>
|
||
<script>
|
||
const colors = ["#5b9bd5", "#ed7d31", "#70ad47", "#ffc000", "#cb9bff", "#7DDA58"];
|
||
let tooltip = {
|
||
show: true,
|
||
trigger: "axis",
|
||
axisPointer: {
|
||
type: "cross",
|
||
},
|
||
confine: false,
|
||
showContent: true,
|
||
triggerOn: "mousemove",
|
||
// alwaysShowContent:true,
|
||
};
|
||
let grid = {
|
||
right: "10%",
|
||
left: "10%",
|
||
top: "25%",
|
||
};
|
||
let toolbox = {
|
||
right: 0,
|
||
feature: {
|
||
dataView: { show: true, readOnly: false },
|
||
saveAsImage: { show: true },
|
||
},
|
||
orient: "vertical",
|
||
};
|
||
let legend = {
|
||
selector: [
|
||
{
|
||
type: 'all',
|
||
title: '全选'
|
||
},
|
||
{
|
||
type: 'inverse',
|
||
title: '反选'
|
||
}
|
||
],
|
||
top: "2%",
|
||
data: ["生料总产量", "生料台时产量", "生料运转率", "分布电耗", "成本"],
|
||
};
|
||
let yAxis = [
|
||
{
|
||
type: "value",
|
||
name: "产量 (t)",
|
||
position: "left",
|
||
alignTicks: true,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[0],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
nameRotate: 50
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "生料台时产量 (t/h)",
|
||
position: "left",
|
||
alignTicks: true,
|
||
nameRotate: 50,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[1],
|
||
},
|
||
},
|
||
offset: 100,
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "生料运转率 (%)",
|
||
position: "right",
|
||
alignTicks: true,
|
||
offset: 50,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[2],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
nameRotate: 50
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "分布电耗(kW·h)",
|
||
position: "right",
|
||
alignTicks: true,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[3],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
nameRotate: 50
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "成本(元/吨)",
|
||
position: "left",
|
||
alignTicks: true,
|
||
offset: 50,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[4],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
nameRotate: 50
|
||
},
|
||
];
|
||
let yAxis_month = [
|
||
{
|
||
type: "value",
|
||
name: "产量 (t)",
|
||
position: "left",
|
||
alignTicks: true,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[0],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
nameRotate: 50
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "生料台时产量 (t/h)",
|
||
position: "left",
|
||
alignTicks: true,
|
||
nameRotate: 50,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[1],
|
||
},
|
||
},
|
||
offset: 100,
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "生料运转率 (%)",
|
||
position: "right",
|
||
alignTicks: true,
|
||
offset: 50,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[2],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
nameRotate: 50
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "分布电耗(kW·h)",
|
||
position: "right",
|
||
alignTicks: true,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[3],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
nameRotate: 50
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "成本(元/吨)",
|
||
position: "left",
|
||
alignTicks: true,
|
||
offset: 50,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[4],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
nameRotate: 50
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "分布电耗目标值",
|
||
position: "left",
|
||
alignTicks: true,
|
||
offset: 150,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[5],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
nameRotate: 50
|
||
},
|
||
];
|
||
import * as echarts from "echarts";
|
||
import scEcharts from "@/components/scEcharts";
|
||
import { defineAsyncComponent } from "vue";
|
||
export default {
|
||
components: {
|
||
scEcharts,
|
||
charts: defineAsyncComponent(() =>
|
||
import("@/components/scEnm/lineChartsdialog.vue")
|
||
),
|
||
},
|
||
data() {
|
||
return {
|
||
searchDate: "",
|
||
typeRadio: "day",
|
||
chartShow: false,
|
||
exportLoading: false,
|
||
myOption: null,
|
||
timeStamp: null,
|
||
optionHour: {},
|
||
optionDay: {},
|
||
optionMonth: {},
|
||
goal_list: [],
|
||
options: [
|
||
{id:0,name:'日统计'},
|
||
{id:1,name:'月统计'},
|
||
{id:2,name:'年统计'}
|
||
],
|
||
year: 2025,
|
||
month: 1,
|
||
days: 1,
|
||
hours: 1,
|
||
query: {
|
||
mgroup: "",
|
||
type: 0,
|
||
},
|
||
tableDatas: [
|
||
["产量", "生料总产量(t)", 0, 0, 0, 0, 0, 0, 0, 0],
|
||
["产量", "生料台时产量(t/h)", 0, 0, 0, 0, 0, 0, 0, 0],
|
||
["运转时间", "生料运转时间(h)", 0, 0, 0, 0, 0, 0, 0, 0],
|
||
["运转时间", "生料运转率(%)", 0, 0, 0, 0, 0, 0, 0, 0],
|
||
["能耗", "生料分布电耗(kW·h/t)", 0, 0, 0, 0, 0, 0, 0, 0],
|
||
["能耗", "生料总电耗(kW·h)", 0, 0, 0, 0, 0, 0, 0, 0],
|
||
["成本", "生料单位成本(元/吨)", 0, 0, 0, 0, 0, 0, 0, 0],
|
||
],
|
||
tableName: "生产报告",
|
||
modelValue: true,
|
||
type: "hours",
|
||
title: "生料工序",
|
||
cate: "",
|
||
apiObj: this.$API.enm.enstat,
|
||
showClose: true,
|
||
echartType: "line",
|
||
asynDialog: false,
|
||
option1: {
|
||
color: colors,
|
||
tooltip: tooltip,
|
||
grid: grid,
|
||
toolbox: toolbox,
|
||
legend: {
|
||
top: "2%",
|
||
data: ["生料总产量", "分布电耗", "成本"],
|
||
},
|
||
xAxis: {
|
||
axisTick: {
|
||
show: true,
|
||
length: 5,
|
||
inside: true,
|
||
// alignWithLabel: true
|
||
},
|
||
data: [],
|
||
},
|
||
yAxis: yAxis,
|
||
series: [
|
||
{
|
||
name: "生料总产量",
|
||
type: "bar",
|
||
yAxisIndex: 0,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "生料台时产量",
|
||
type: "bar",
|
||
yAxisIndex: 1,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "生料运转率",
|
||
type: "line",
|
||
yAxisIndex: 2,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "分布电耗",
|
||
type: "bar",
|
||
yAxisIndex: 3,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "成本",
|
||
type: "bar",
|
||
yAxisIndex: 4,
|
||
data: [],
|
||
},
|
||
],
|
||
},
|
||
option2: {
|
||
color: colors,
|
||
tooltip: tooltip,
|
||
grid: grid,
|
||
toolbox: toolbox,
|
||
legend: Object.assign(legend, {data: ["生料总产量", "生料台时产量", "生料运转率", "分布电耗", "成本", "分布电耗目标值"]}),
|
||
xAxis: {
|
||
axisTick: {
|
||
show: true,
|
||
length: 5,
|
||
inside: true,
|
||
// alignWithLabel: true
|
||
},
|
||
data: [
|
||
"一月",
|
||
"二月",
|
||
"三月",
|
||
"四月",
|
||
"五月",
|
||
"六月",
|
||
"七月",
|
||
"八月",
|
||
"九月",
|
||
"十月",
|
||
"十一月",
|
||
"十二月",
|
||
],
|
||
},
|
||
yAxis: yAxis,
|
||
series: [
|
||
{
|
||
name: "生料总产量",
|
||
type: "bar",
|
||
yAxisIndex: 0,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "生料台时产量",
|
||
type: "bar",
|
||
yAxisIndex: 1,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "生料运转率",
|
||
type: "line",
|
||
yAxisIndex: 2,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "分布电耗",
|
||
type: "bar",
|
||
yAxisIndex: 3,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "成本",
|
||
type: "bar",
|
||
yAxisIndex: 4,
|
||
data: [],
|
||
},
|
||
],
|
||
},
|
||
option3: {
|
||
color: colors,
|
||
tooltip: tooltip,
|
||
grid: grid,
|
||
toolbox: toolbox,
|
||
legend: legend,
|
||
xAxis: {
|
||
axisTick: {
|
||
show: true,
|
||
length: 5,
|
||
inside: true,
|
||
// alignWithLabel: true
|
||
},
|
||
data: [
|
||
"一月",
|
||
"二月",
|
||
"三月",
|
||
"四月",
|
||
"五月",
|
||
"六月",
|
||
"七月",
|
||
"八月",
|
||
"九月",
|
||
"十月",
|
||
"十一月",
|
||
"十二月",
|
||
],
|
||
},
|
||
yAxis: yAxis_month,
|
||
series: [
|
||
{
|
||
name: "生料总产量",
|
||
type: "bar",
|
||
yAxisIndex: 0,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "生料台时产量",
|
||
type: "bar",
|
||
yAxisIndex: 1,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "生料运转率",
|
||
type: "line",
|
||
yAxisIndex: 1,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "分布电耗",
|
||
type: "bar",
|
||
yAxisIndex: 2,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "成本",
|
||
type: "bar",
|
||
yAxisIndex: 3,
|
||
data: [],
|
||
},
|
||
{
|
||
name: "分布电耗目标值",
|
||
type: "line",
|
||
yAxisIndex: 4,
|
||
data: [],
|
||
},
|
||
],
|
||
},
|
||
dataX: [],
|
||
dataY: [],
|
||
dataY2: [],
|
||
|
||
option: {
|
||
color: [
|
||
"#647bfe",
|
||
"#8698fe",
|
||
"#a9b6fe",
|
||
"#cbd3fe",
|
||
"#91CC75",
|
||
"#EE6666",
|
||
],
|
||
tooltip: {
|
||
trigger: "axis",
|
||
axisPointer: {
|
||
type: "cross",
|
||
},
|
||
},
|
||
grid: {
|
||
right: "20%",
|
||
left: "20%",
|
||
},
|
||
toolbox: {
|
||
feature: {
|
||
dataView: { show: true, readOnly: false },
|
||
restore: { show: true },
|
||
saveAsImage: { show: true },
|
||
},
|
||
},
|
||
legend: {
|
||
data: [
|
||
"生料总产量",
|
||
"生料台时产量",
|
||
"生料运转率",
|
||
"分布电耗",
|
||
"单位产品标煤耗",
|
||
"成本",
|
||
],
|
||
},
|
||
xAxis: [
|
||
{
|
||
type: "category",
|
||
axisTick: {
|
||
alignWithLabel: true,
|
||
},
|
||
// prettier-ignore
|
||
data: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
|
||
},
|
||
],
|
||
yAxis: [
|
||
{
|
||
type: "value",
|
||
name: "产量 (t)",
|
||
position: "right",
|
||
alignTicks: true,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[0],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "生料运转率 (%)",
|
||
position: "right",
|
||
alignTicks: true,
|
||
offset: 80,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[1],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "成本(元/吨)",
|
||
position: "right",
|
||
alignTicks: true,
|
||
offset: 160,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[2],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "分布电耗(kW·h)",
|
||
position: "left",
|
||
alignTicks: true,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[3],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value} ",
|
||
},
|
||
},
|
||
{
|
||
type: "value",
|
||
name: "标煤耗 (t)",
|
||
position: "left",
|
||
alignTicks: true,
|
||
offset: 80,
|
||
min: 0,
|
||
max: 180,
|
||
axisLine: {
|
||
show: true,
|
||
lineStyle: {
|
||
color: colors[4],
|
||
},
|
||
},
|
||
axisLabel: {
|
||
formatter: "{value}",
|
||
},
|
||
},
|
||
],
|
||
series: [
|
||
{
|
||
name: "生料总产量",
|
||
type: "bar",
|
||
yAxisIndex: 0,
|
||
data: [
|
||
100, 120, 110, 130, 140, 120, 110, 120, 100, 150,
|
||
120, 160,
|
||
],
|
||
},
|
||
{
|
||
name: "生料台时产量",
|
||
type: "bar",
|
||
data: [
|
||
2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6,
|
||
20.0, 6.4, 3.3,
|
||
],
|
||
},
|
||
{
|
||
name: "生料运转率",
|
||
type: "bar",
|
||
yAxisIndex: 1,
|
||
data: [
|
||
2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7,
|
||
18.8, 6.0, 2.3,
|
||
],
|
||
},
|
||
{
|
||
name: "分布电耗",
|
||
type: "line",
|
||
yAxisIndex: 2,
|
||
data: [
|
||
2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0,
|
||
16.5, 12.0, 6.2,
|
||
],
|
||
},
|
||
{
|
||
name: "单位产品标煤耗",
|
||
type: "bar",
|
||
yAxisIndex: 2,
|
||
data: [
|
||
2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0,
|
||
16.5, 12.0, 6.2,
|
||
],
|
||
},
|
||
],
|
||
},
|
||
};
|
||
},
|
||
|
||
mounted() {
|
||
function precen(a, b) {
|
||
if (b !== 0 && b !== null && a !== null) {
|
||
let precen = (a / b)* 100;
|
||
return precen.toFixed(2) + "%";
|
||
} else {
|
||
return "/";
|
||
}
|
||
}
|
||
function consume_precen(a, b) {
|
||
if (b !== 0 && b !== null && a !== null) {
|
||
let precen = ((a / b)+1)* 100;
|
||
return precen.toFixed(2) + "%";
|
||
} else {
|
||
return "/";
|
||
}
|
||
}
|
||
let that = this;
|
||
this.$nextTick(() => {
|
||
var myDate = new Date();
|
||
let year = (that.year = myDate.getFullYear());
|
||
let month = (that.month = myDate.getMonth() + 1);
|
||
let days = (that.days = myDate.getDate());
|
||
let hours = (that.hours = myDate.getHours());
|
||
let timeDate = myDate.getTime();
|
||
let dayTime = 24 * 60 * 60 * 1000;
|
||
//昨天的计算
|
||
let year_d = year,
|
||
month_d = month,
|
||
days_d = days;
|
||
|
||
//8点前,查找昨日数据为前一天数据
|
||
let newDate = timeDate - dayTime;
|
||
let lastDate = new Date(newDate);
|
||
year_d = lastDate.getFullYear();
|
||
month_d = lastDate.getMonth() + 1;
|
||
days_d = lastDate.getDate();
|
||
|
||
//上一小时的计算
|
||
let hourTime = timeDate - 3600000;
|
||
let hourDate = new Date(hourTime);
|
||
let year_h = hourDate.getFullYear();
|
||
let month_h = hourDate.getMonth() + 1;
|
||
let days_h = hourDate.getDate();
|
||
let hours_h = hourDate.getHours();
|
||
this.$API.mtm.mgroup.list
|
||
.req({ page: 0, search: "生料工序(二次配料)" })
|
||
.then((res) => {
|
||
console.log("生料工序(二次配料)", res);
|
||
that.query.mgroup = res[0].id;
|
||
//昨日
|
||
let params3 = {};
|
||
params3.page = 0;
|
||
params3.year_s = year_d;
|
||
params3.month_s = month_d;
|
||
params3.day_s = days_d;
|
||
params3.type = "day_s";
|
||
params3.mgroup = this.query.mgroup;
|
||
this.$API.enm.enstat.req(params3).then((res3) => {
|
||
if (res3.length > 0) {
|
||
let data3 = res3[0];
|
||
that.tableDatas[0][3] = data3.total_production;
|
||
if (data3.total_production == 0) {
|
||
that.tableDatas[4][3] = 0;
|
||
that.tableDatas[5][3] = 0;
|
||
that.tableDatas[6][3] = 0;
|
||
}else {
|
||
that.tableDatas[1][3] = data3.production_hour;
|
||
that.tableDatas[2][3] = data3.run_hour;
|
||
that.tableDatas[3][3] = data3.run_rate;
|
||
that.tableDatas[4][3] = data3.elec_consume_unit;
|
||
that.tableDatas[5][3] = data3.elec_consume;
|
||
that.tableDatas[6][3] = data3.production_cost_unit;}
|
||
}
|
||
});
|
||
//本日
|
||
let params4 = {};
|
||
params4.page = 0;
|
||
params4.year_s = year_h;
|
||
params4.month_s = month_h;
|
||
params4.day_s = days_h;
|
||
params4.type = "day_s";
|
||
params4.mgroup = this.query.mgroup;
|
||
this.$API.enm.enstat.req(params4).then((res4) => {
|
||
if (res4.length > 0) {
|
||
let data4 = res4[0];
|
||
that.tableDatas[0][2] = data4.total_production < 1 ? 0 : data4.total_production;
|
||
if (data4.total_production == 0) {
|
||
that.tableDatas[4][2] = 0;
|
||
that.tableDatas[5][2] = 0;
|
||
that.tableDatas[6][2] = 0;
|
||
}else {
|
||
that.tableDatas[1][2] = data4.production_hour;
|
||
that.tableDatas[2][2] = data4.run_hour;
|
||
that.tableDatas[3][2] = data4.run_rate;
|
||
that.tableDatas[4][2] = data4.elec_consume_unit;
|
||
that.tableDatas[5][2] = data4.elec_consume;
|
||
that.tableDatas[6][2] = data4.production_cost_unit;}
|
||
}
|
||
});
|
||
//月目标
|
||
let params5 = {};
|
||
params5.page = 0;
|
||
params5.mgroup = that.query.mgroup;
|
||
this.$API.mtm.goal.list
|
||
.req(params5)
|
||
.then((res5) => {
|
||
if (res5.length > 0) {
|
||
let data5 = res5;
|
||
data5.forEach((item5) => {
|
||
let str = "goal_val_" + that.month;
|
||
debugger;
|
||
console.log(str, item5[str]);
|
||
|
||
if (item5.goal_cate_name == "总产量(t)") {
|
||
that.tableDatas[0][6] = item5[str];
|
||
that.tableDatas[0][8] = item5.goal_val;
|
||
} else if (
|
||
item5.goal_cate_name ==
|
||
"台时产量(t/h)"
|
||
) {
|
||
that.tableDatas[1][6] = item5[str];
|
||
that.tableDatas[1][8] = item5.goal_val;
|
||
} else if (
|
||
item5.goal_cate_name == "运转时间(h)"
|
||
) {
|
||
that.tableDatas[2][6] = item5[str];
|
||
that.tableDatas[2][8] = item5.goal_val;
|
||
} else if (
|
||
item5.goal_cate_name == "运转率(%)"
|
||
) {
|
||
that.tableDatas[3][6] = item5[str];
|
||
that.tableDatas[3][8] = item5.goal_val;
|
||
} else if (
|
||
item5.goal_cate_name ==
|
||
"单位产品分布电耗(kW·h/t)"
|
||
) {
|
||
that.tableDatas[4][6] = item5[str];
|
||
that.tableDatas[4][8] = item5.goal_val;
|
||
} else if (item5.goal_cate_name ==
|
||
"总电量(kW·h)"){
|
||
that.tableDatas[5][6] = item5[str];
|
||
that.tableDatas[5][8] = item5.goal_val;
|
||
}
|
||
else if (
|
||
item5.goal_cate_name ==
|
||
"单位产品成本(元/吨)"
|
||
) {
|
||
that.tableDatas[6][6] = item5[str];
|
||
that.tableDatas[6][8] = item5.goal_val;
|
||
}
|
||
});
|
||
}
|
||
})
|
||
.then((res) => {
|
||
//年
|
||
let params1 = {};
|
||
params1.page = 0;
|
||
params1.year_s = year;
|
||
params1.type = "year_s";
|
||
params1.mgroup = this.query.mgroup;
|
||
this.$API.enm.enstat.req(params1).then((res1) => {
|
||
if (res1.length > 0) {
|
||
let data1 = res1[0];
|
||
that.tableDatas[0][5] =
|
||
data1.total_production;
|
||
that.tableDatas[0][9] = precen(
|
||
that.tableDatas[0][5],
|
||
that.tableDatas[0][8]
|
||
);
|
||
that.tableDatas[1][5] =
|
||
data1.production_hour;
|
||
that.tableDatas[1][9] = precen(
|
||
that.tableDatas[1][5],
|
||
that.tableDatas[1][8]
|
||
);
|
||
that.tableDatas[2][5] = data1.run_hour;
|
||
that.tableDatas[2][9] = precen(
|
||
that.tableDatas[2][5],
|
||
that.tableDatas[2][8]
|
||
);
|
||
that.tableDatas[3][5] = data1.run_rate;
|
||
that.tableDatas[3][9] = precen(
|
||
that.tableDatas[3][5],
|
||
that.tableDatas[3][8]
|
||
);
|
||
that.tableDatas[4][5] =
|
||
data1.elec_consume_unit;
|
||
that.tableDatas[4][9] = consume_precen(
|
||
(that.tableDatas[4][8] - that.tableDatas[4][5]),
|
||
that.tableDatas[4][8]
|
||
);
|
||
that.tableDatas[5][5] = data1.elec_consume;
|
||
that.tableDatas[5][9] = consume_precen(
|
||
(that.tableDatas[5][8] - that.tableDatas[5][5]),
|
||
that.tableDatas[5][8]
|
||
);
|
||
that.tableDatas[6][5] =
|
||
data1.production_cost_unit;
|
||
that.tableDatas[6][9] = consume_precen(
|
||
(that.tableDatas[6][8] - that.tableDatas[6][5]),
|
||
that.tableDatas[6][8]
|
||
);
|
||
} else {
|
||
}
|
||
});
|
||
//月
|
||
let params2 = {};
|
||
params2.page = 0;
|
||
params2.year_s = year;
|
||
params2.month_s = month;
|
||
params2.type = "month_s";
|
||
params2.mgroup = this.query.mgroup;
|
||
this.$API.enm.enstat.req(params2).then((res2) => {
|
||
if (res2.length > 0) {
|
||
let data2 = res2[0];
|
||
that.tableDatas[0][4] =
|
||
data2.total_production;
|
||
if (
|
||
that.tableDatas[0][4] >
|
||
that.tableDatas[0][6]
|
||
) {
|
||
that.wraning = true;
|
||
}
|
||
that.tableDatas[0][7] = precen(
|
||
that.tableDatas[0][4],
|
||
that.tableDatas[0][6]
|
||
);
|
||
that.tableDatas[1][4] =
|
||
data2.production_hour;
|
||
that.tableDatas[1][7] = precen(
|
||
that.tableDatas[1][4],
|
||
that.tableDatas[1][6]
|
||
);
|
||
that.tableDatas[2][4] = data2.run_hour;
|
||
that.tableDatas[2][7] = precen(
|
||
that.tableDatas[2][4],
|
||
that.tableDatas[2][6]
|
||
);
|
||
that.tableDatas[3][4] = data2.run_rate;
|
||
that.tableDatas[3][7] = precen(
|
||
that.tableDatas[3][4],
|
||
that.tableDatas[3][6]
|
||
);
|
||
that.tableDatas[4][4] =
|
||
data2.elec_consume_unit;
|
||
that.tableDatas[4][7] = consume_precen(
|
||
(that.tableDatas[4][6]-that.tableDatas[4][4]),
|
||
that.tableDatas[4][6]
|
||
);
|
||
that.tableDatas[5][4] = data2.elec_consume;
|
||
that.tableDatas[5][7] = consume_precen(
|
||
(that.tableDatas[5][6]-that.tableDatas[5][4]),
|
||
that.tableDatas[5][6]
|
||
);
|
||
that.tableDatas[6][4] =
|
||
data2.production_cost_unit;
|
||
that.tableDatas[6][7] = consume_precen(
|
||
(that.tableDatas[6][6] - that.tableDatas[6][4]),
|
||
that.tableDatas[6][6]
|
||
);
|
||
}
|
||
});
|
||
});
|
||
that.getHourData(year, month, days);
|
||
that.getDayData(year, month);
|
||
that.getMonthData(year);
|
||
});
|
||
});
|
||
},
|
||
methods: {
|
||
typeRadioChange() {
|
||
this.searchDate = "";
|
||
},
|
||
goToTarget(mgroup_id) {
|
||
this.$router.push({
|
||
path: "/enm_monthSet/goalSetting",
|
||
query: {
|
||
mgroup: mgroup_id,
|
||
},
|
||
})
|
||
},
|
||
dateChange() {
|
||
let that = this;
|
||
let arr = [];
|
||
if(that.query.type==0 && that.query.day) {
|
||
arr = that.query.day.split('-');
|
||
that.year = Number(arr[0]);
|
||
that.month = Number(arr[1]);
|
||
that.days = Number(arr[2]);
|
||
this.getHourData(that.year, that.month, that.days);
|
||
this.get_days(that.year, that.month, that.days);
|
||
}
|
||
else if(that.query.type==1 && that.query.month) {
|
||
let year = that.query.month.split("-")[0];
|
||
let month = that.query.month.split("-")[1];
|
||
month = Number(month);
|
||
this.getDayData(year, month);
|
||
this.get_months(year, month);
|
||
this.get_month_year_goal(year, month);
|
||
}else if (that.query.type==2 && that.query.year) {
|
||
let year = that.query.year;
|
||
this.getMonthData(year);
|
||
this.get_years(year);
|
||
this.get_month_year_goal(year , 1);
|
||
}
|
||
},
|
||
get_days(year_d, month_d, days){
|
||
let that = this;
|
||
let params4 = {};
|
||
params4.page = 0;
|
||
params4.year_s = year_d;
|
||
params4.month_s = month_d;
|
||
params4.day_s = days;
|
||
params4.type = "day_s";
|
||
params4.mgroup = this.query.mgroup;
|
||
this.$API.enm.enstat.req(params4).then((res4) => {
|
||
if (res4.length > 0) {
|
||
let data4 = res4[0];
|
||
that.tableDatas[0][2] = data4.total_production < 1 ? 0 : data4.total_production;
|
||
if (data4.total_production == 0) {
|
||
that.tableDatas[4][2] = 0;
|
||
that.tableDatas[5][2] = 0;
|
||
that.tableDatas[6][2] = 0;
|
||
}else {
|
||
that.tableDatas[1][2] = data4.production_hour;
|
||
that.tableDatas[2][2] = data4.run_hour;
|
||
that.tableDatas[3][2] = data4.run_rate;
|
||
that.tableDatas[4][2] = data4.elec_consume_unit;
|
||
that.tableDatas[5][2] = data4.elec_consume;
|
||
that.tableDatas[6][2] = data4.production_cost_unit;}
|
||
}
|
||
});
|
||
},
|
||
get_months(year, month){
|
||
let that = this;
|
||
let params2 = {};
|
||
params2.page = 0;
|
||
params2.year_s = year;
|
||
params2.month_s = month;
|
||
params2.type = "month_s";
|
||
params2.mgroup = this.query.mgroup;
|
||
this.$API.enm.enstat.req(params2).then((res2) => {
|
||
if (res2.length > 0) {
|
||
let data2 = res2[0];
|
||
that.tableDatas[0][4] =
|
||
data2.total_production;
|
||
if (
|
||
that.tableDatas[0][4] >
|
||
that.tableDatas[0][6]
|
||
) {
|
||
that.wraning = true;
|
||
}
|
||
that.tableDatas[0][7] = precen(
|
||
that.tableDatas[0][4],
|
||
that.tableDatas[0][6]
|
||
);
|
||
that.tableDatas[1][4] =
|
||
data2.production_hour;
|
||
that.tableDatas[1][7] = precen(
|
||
that.tableDatas[1][4],
|
||
that.tableDatas[1][6]
|
||
);
|
||
that.tableDatas[2][4] = data2.run_hour;
|
||
that.tableDatas[2][7] = precen(
|
||
that.tableDatas[2][4],
|
||
that.tableDatas[2][6]
|
||
);
|
||
that.tableDatas[3][4] = data2.run_rate;
|
||
that.tableDatas[3][7] = precen(
|
||
that.tableDatas[3][4],
|
||
that.tableDatas[3][6]
|
||
);
|
||
that.tableDatas[4][4] =
|
||
data2.elec_consume_unit;
|
||
that.tableDatas[4][7] = consume_precen(
|
||
(that.tableDatas[4][6]-that.tableDatas[4][4]),
|
||
that.tableDatas[4][6]
|
||
);
|
||
that.tableDatas[5][4] = data2.elec_consume;
|
||
that.tableDatas[5][7] = consume_precen(
|
||
(that.tableDatas[5][6]-that.tableDatas[5][4]),
|
||
that.tableDatas[5][6]
|
||
);
|
||
that.tableDatas[6][4] =
|
||
data2.production_cost_unit;
|
||
that.tableDatas[6][7] = consume_precen(
|
||
(that.tableDatas[6][6] - that.tableDatas[6][4]),
|
||
that.tableDatas[6][6]
|
||
);
|
||
}
|
||
});
|
||
},
|
||
get_month_year_goal(year, month){
|
||
let that = this;
|
||
let params5 = {};
|
||
params5.page = 0;
|
||
params5.year = year;
|
||
params5.mgroup = that.query.mgroup;
|
||
this.$API.mtm.goal.list
|
||
.req(params5)
|
||
.then((res5) => {
|
||
if (res5.length > 0) {
|
||
let data5 = res5;
|
||
data5.forEach((item5) => {
|
||
let str = "goal_val_" + month;
|
||
debugger;
|
||
console.log(str, item5[str]);
|
||
|
||
if (item5.goal_cate_name == "总产量(t)") {
|
||
that.tableDatas[0][6] = item5[str];
|
||
that.tableDatas[0][8] = item5.goal_val;
|
||
} else if (
|
||
item5.goal_cate_name ==
|
||
"台时产量(t/h)"
|
||
) {
|
||
that.tableDatas[1][6] = item5[str];
|
||
that.tableDatas[1][8] = item5.goal_val;
|
||
} else if (
|
||
item5.goal_cate_name == "运转时间(h)"
|
||
) {
|
||
that.tableDatas[2][6] = item5[str];
|
||
that.tableDatas[2][8] = item5.goal_val;
|
||
} else if (
|
||
item5.goal_cate_name == "运转率(%)"
|
||
) {
|
||
that.tableDatas[3][6] = item5[str];
|
||
that.tableDatas[3][8] = item5.goal_val;
|
||
} else if (
|
||
item5.goal_cate_name ==
|
||
"单位产品分布电耗(kW·h/t)"
|
||
) {
|
||
that.tableDatas[4][6] = item5[str];
|
||
that.tableDatas[4][8] = item5.goal_val;
|
||
} else if (item5.goal_cate_name ==
|
||
"总电量(kW·h)"){
|
||
that.tableDatas[5][6] = item5[str];
|
||
that.tableDatas[5][8] = item5.goal_val;
|
||
}
|
||
else if (
|
||
item5.goal_cate_name ==
|
||
"单位产品成本(元/吨)"
|
||
) {
|
||
that.tableDatas[6][6] = item5[str];
|
||
that.tableDatas[6][8] = item5.goal_val;
|
||
}
|
||
});
|
||
}
|
||
})
|
||
},
|
||
get_years(year){
|
||
let params1 = {};
|
||
params1.page = 0;
|
||
params1.year_s = year;
|
||
params1.type = "year_s";
|
||
params1.mgroup = this.query.mgroup;
|
||
this.$API.enm.enstat.req(params1).then((res1) => {
|
||
if (res1.length > 0) {
|
||
let data1 = res1[0];
|
||
that.tableDatas[0][5] =
|
||
data1.total_production;
|
||
that.tableDatas[0][9] = precen(
|
||
that.tableDatas[0][5],
|
||
that.tableDatas[0][8]
|
||
);
|
||
that.tableDatas[1][5] =
|
||
data1.production_hour;
|
||
that.tableDatas[1][9] = precen(
|
||
that.tableDatas[1][5],
|
||
that.tableDatas[1][8]
|
||
);
|
||
that.tableDatas[2][5] = data1.run_hour;
|
||
that.tableDatas[2][9] = precen(
|
||
that.tableDatas[2][5],
|
||
that.tableDatas[2][8]
|
||
);
|
||
that.tableDatas[3][5] = data1.run_rate;
|
||
that.tableDatas[3][9] = precen(
|
||
that.tableDatas[3][5],
|
||
that.tableDatas[3][8]
|
||
);
|
||
that.tableDatas[4][5] =
|
||
data1.elec_consume_unit;
|
||
that.tableDatas[4][9] = consume_precen(
|
||
(that.tableDatas[4][8] - that.tableDatas[4][5]),
|
||
that.tableDatas[4][8]
|
||
);
|
||
that.tableDatas[5][5] = data1.elec_consume;
|
||
that.tableDatas[5][9] = consume_precen(
|
||
(that.tableDatas[5][8] - that.tableDatas[5][5]),
|
||
that.tableDatas[5][8]
|
||
);
|
||
that.tableDatas[6][5] =
|
||
data1.production_cost_unit;
|
||
that.tableDatas[6][9] = precen(
|
||
(that.tableDatas[6][8] - that.tableDatas[6][5]),
|
||
that.tableDatas[6][8]
|
||
);
|
||
} else {
|
||
}
|
||
});
|
||
},
|
||
//获取小时数据
|
||
getHourData(year, month, days) {
|
||
let that = this;
|
||
let query = {};
|
||
query.page = 0;
|
||
query.year = year;
|
||
query.month = month;
|
||
query.day = days;
|
||
query.type = "hour_s";
|
||
query.mgroup = that.query.mgroup;
|
||
this.$API.enm.enstat.req(query).then((response) => {
|
||
let seriesData0 = [],
|
||
seriesData1 = [],
|
||
seriesData2 = [],
|
||
seriesData3 = [],
|
||
seriesData4 = [];
|
||
let data = response;
|
||
data.forEach((item) => {
|
||
let ind = item.hour;
|
||
seriesData0[ind] = item.total_production;
|
||
// seriesData1[ind] = Number(item.production_hour).toFixed(2);
|
||
// seriesData2[ind] = item.run_rate;
|
||
seriesData3[ind] = item.elec_consume_unit;
|
||
seriesData4[ind] = item.production_cost_unit;
|
||
});
|
||
let options = { ...that.option1 };
|
||
options.series[0].data = seriesData0;
|
||
// options.series[1].data = seriesData1;
|
||
// options.series[2].data = seriesData2;
|
||
options.series[3].data = seriesData3;
|
||
options.series[4].data = seriesData4;
|
||
let hourXAxis = [];
|
||
for (let i = 0; i < 24; i++) {
|
||
let item = i + "时";
|
||
hourXAxis.push(item);
|
||
}
|
||
options.xAxis.data = hourXAxis;
|
||
that.optionHour = options;
|
||
});
|
||
},
|
||
//获取天数据
|
||
getDayData(year, month) {
|
||
let that = this;
|
||
let query1 = {};
|
||
query1.page = 0;
|
||
query1.year_s = year;
|
||
query1.month_s = month;
|
||
query1.type = "day_s";
|
||
query1.mgroup = this.query.mgroup;
|
||
this.$API.enm.enstat.req(query1).then((response) => {
|
||
let seriesData0 = [],
|
||
seriesData1 = [],
|
||
seriesData2 = [],
|
||
seriesData3 = [],
|
||
seriesData4 = [];
|
||
let data = response;
|
||
data.forEach((item) => {
|
||
let ind = item.day_s - 1;
|
||
seriesData0[ind] = item.total_production;
|
||
seriesData1[ind] = Number(item.production_hour).toFixed(2);
|
||
seriesData2[ind] = item.run_rate;
|
||
seriesData3[ind] = item.elec_consume_unit;
|
||
seriesData4[ind] = item.production_cost_unit;
|
||
});
|
||
let options = { ...that.option2 };
|
||
options.series[0].data = seriesData0;
|
||
options.series[1].data = seriesData1;
|
||
options.series[2].data = seriesData2;
|
||
options.series[3].data = seriesData3;
|
||
options.series[4].data = seriesData4;
|
||
let dayXAxis = [];
|
||
for (let i = 1; i <= data.length; i++) {
|
||
let item = i + "日";
|
||
dayXAxis.push(item);
|
||
}
|
||
options.xAxis.data = dayXAxis;
|
||
that.optionDay = options;
|
||
});
|
||
},
|
||
//获取月数据
|
||
getMonthData(year) {
|
||
let that = this;
|
||
let params5 = {};
|
||
params5.page = 0;
|
||
params5.year = year;
|
||
params5.mgroup = that.query.mgroup;
|
||
this.$API.mtm.goal.list
|
||
.req(params5)
|
||
.then((res5) => {
|
||
if (res5.length > 0) {
|
||
let data5 = res5;
|
||
data5.forEach((item5) => {
|
||
if (
|
||
item5.goal_cate_name ==
|
||
"单位产品分布电耗(kW·h/t)"
|
||
) {
|
||
that.goal_list.push(item5);
|
||
}
|
||
});
|
||
|
||
}
|
||
}).then(() => {
|
||
let query2 = {};
|
||
query2.page = 0;
|
||
query2.year_s = year;
|
||
query2.type = "month_s";
|
||
query2.mgroup = that.query.mgroup;
|
||
this.$API.enm.enstat.req(query2).then((response) => {
|
||
let seriesData0 = [],
|
||
seriesData1 = [],
|
||
seriesData2 = [],
|
||
seriesData3 = [],
|
||
seriesData5 = [],
|
||
seriesData4 = [];
|
||
let data = response;
|
||
data.forEach((item) => {
|
||
let goal_index = 'goal_val_' + item.month_s;
|
||
let ind = item.month_s - 1;
|
||
seriesData0[ind] = item.total_production;
|
||
seriesData1[ind] = Number(item.production_hour).toFixed(2);
|
||
seriesData2[ind] = item.run_rate;
|
||
seriesData3[ind] = item.elec_consume_unit;
|
||
seriesData4[ind] = item.production_cost_unit;
|
||
seriesData5[ind] = that.goal_list[0][goal_index];
|
||
});
|
||
let options = { ...that.option3 };
|
||
options.series[0].data = seriesData0;
|
||
options.series[1].data = seriesData1;
|
||
options.series[2].data = seriesData2;
|
||
options.series[3].data = seriesData3;
|
||
options.series[4].data = seriesData4;
|
||
options.series[5].data = seriesData5;
|
||
let monthXAxis = [];
|
||
if (year < that.year){
|
||
that.month = 12;
|
||
}
|
||
for (let i = 1; i <= that.month; i++) {
|
||
let item = i + "月";
|
||
monthXAxis.push(item);
|
||
}
|
||
options.xAxis.data = monthXAxis;
|
||
that.optionMonth = options;
|
||
});
|
||
});
|
||
},
|
||
itemClick(type, item) {
|
||
this.type = type;
|
||
this.cate = item[1];
|
||
this.asynDialog = true;
|
||
},
|
||
handlePrint() {
|
||
this.$PRINT("#myReport");
|
||
},
|
||
exportExcel() {
|
||
this.exportLoading = true;
|
||
this.$XLSX("#myTable", this.tableName);
|
||
this.exportLoading = false;
|
||
},
|
||
},
|
||
};
|
||
</script>
|
||
<style scoped>
|
||
.printContainer {
|
||
padding-left: 20px;
|
||
}
|
||
.printWrap {
|
||
overflow-x: auto;
|
||
}
|
||
.radioWrap {
|
||
display: flex;
|
||
justify-content: center;
|
||
padding-top: 10px;
|
||
position: relative;
|
||
}
|
||
</style>
|