fix:水泥磨mgroup根据名称获取

This commit is contained in:
shijing 2024-04-29 16:11:57 +08:00
parent 63737587e1
commit 4e8a3d486a
5 changed files with 2763 additions and 2196 deletions

View File

@ -3,21 +3,65 @@
<el-header>
<div class="left-panel">
<div style="margin-right: 20px">交接班日志</div>
<el-date-picker v-model="query.start_time__gte" type="date" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD"
placeholder="开始时间" style=" width: 120px" />
<el-date-picker v-model="query.end_time__lt" type="date" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD"
placeholder="结束时间" style="margin-left: 2px; width: 120px" />
<el-select v-model="query.shift" placeholder="班次" clearable style="margin-left: 2px; width: 120px">
<el-option v-for="item in optionsShift" :key="item.id" :label="item.name" :value="item.id"></el-option>
<el-date-picker
v-model="query.start_time__gte"
type="date"
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD"
placeholder="开始时间"
style="width: 120px"
/>
<el-date-picker
v-model="query.end_time__lt"
type="date"
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD"
placeholder="结束时间"
style="margin-left: 2px; width: 120px"
/>
<el-select
v-model="query.shift"
placeholder="班次"
clearable
style="margin-left: 2px; width: 120px"
>
<el-option
v-for="item in optionsShift"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-select v-model="query.team" placeholder="班组" clearable style="margin-left: 2px; width: 120px">
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
<el-select
v-model="query.team"
placeholder="班组"
clearable
style="margin-left: 2px; width: 120px"
>
<el-option
v-for="item in options"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="query" highlightCurrentRow @row-click="rowClick">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="query"
highlightCurrentRow
@row-click="rowClick"
>
<el-table-column type="index" width="50" />
<!-- <el-table-column label="关联工段" prop="mgroup_name"></el-table-column> -->
<el-table-column label="开始时间" prop="start_time">
@ -30,22 +74,50 @@
<span>{{ scope.row.end_time.slice(0, 16) }}</span>
</template>
</el-table-column>
<el-table-column label="班组名称" prop="team_name"></el-table-column>
<el-table-column label="当前班次" prop="shift_name"></el-table-column>
<el-table-column label="班长" prop="leader_name"></el-table-column>
<el-table-column
label="班组名称"
prop="team_name"
></el-table-column>
<el-table-column
label="当前班次"
prop="shift_name"
></el-table-column>
<el-table-column
label="班长"
prop="leader_name"
></el-table-column>
<el-table-column label="检验时间">
<template #default="scope">
<span v-if="scope.row.last_test_time">{{ scope.row.last_test_time.slice(0, 16) }}</span>
<span v-if="scope.row.last_test_time">{{
scope.row.last_test_time.slice(0, 16)
}}</span>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="140">
<el-table-column
label="操作"
fixed="right"
align="center"
width="140"
>
<template #default="scope">
<el-button link size="small" @click="sflog_edit(scope.row)" type="primary">编辑</el-button>
<el-button
link
size="small"
@click="sflog_edit(scope.row)"
type="primary"
>编辑</el-button
>
<!-- <el-button link size="small" @click="sflog_check(scope.row)" type="primary">质量检验</el-button> -->
<!-- <el-button link size="small" @click="sflog_other(scope.row)" type="primary">其他能源</el-button> -->
<el-divider direction="vertical"></el-divider>
<el-button link size="small" @click="sflog_export(scope.row)" type="success">报表</el-button>
<el-button
link
size="small"
@click="sflog_export(scope.row)"
type="success"
>报表</el-button
>
</template>
</el-table-column>
</scTable>
@ -61,54 +133,111 @@
</el-button>
</template>
<div class="left-panel">
<el-button type="primary" @click="exportExcel()" :loading="exportLoading">导出xlsx
</el-button>
<el-button type="primary" @click="handlePrint">打印
<el-button
type="primary"
@click="exportExcel()"
:loading="exportLoading"
>导出xlsx
</el-button>
<el-button type="primary" @click="handlePrint">打印 </el-button>
</div>
<el-main class="nopadding">
<div ref="print" id="myReport" class="printContainer">
<div style="margin-right: 20px;text-align: center;font-size: 16px;font-weight: bold;margin-bottom: 20px;">
<span v-if="sflogItem.end_time">{{ sflogItem.end_time.slice(0, 10) }}{{ sflogItem.shift_name }}</span>
<span v-if="sflogItem.team_name">{{ sflogItem.team_name }}</span>
<div
style="
margin-right: 20px;
text-align: center;
font-size: 16px;
font-weight: bold;
margin-bottom: 20px;
"
>
<span v-if="sflogItem.end_time"
>{{ sflogItem.end_time.slice(0, 10)
}}{{ sflogItem.shift_name }}</span
>
<span v-if="sflogItem.team_name">{{
sflogItem.team_name
}}</span>
交接班记录
</div>
<table border="1" width="1000" cellspacing="0" :key="timeStamp" id="myTable">
<table
border="1"
width="1000"
cellspacing="0"
:key="timeStamp"
id="myTable"
>
<tbody>
<tr>
<td class="numCell">日期</td>
<td class="numCell" v-if="sflogItem.end_time">{{ sflogItem.end_time.slice(0, 10) }}</td>
<td class="numCell" v-if="sflogItem.end_time">
{{ sflogItem.end_time.slice(0, 10) }}
</td>
<td class="numCell">班次</td>
<td class="numCell">{{ sflogItem.shift_name }}</td>
<td class="numCell">
{{ sflogItem.shift_name }}
</td>
<td class="numCell">班组</td>
<td class="numCell"><span v-if="sflogItem.team_name">{{ sflogItem.team_name }}</span></td>
<td class="numCell">
<span v-if="sflogItem.team_name">{{
sflogItem.team_name
}}</span>
</td>
</tr>
<tr>
<td class="numCell">产量t</td>
<td class="numCell">{{ reportItem.total_production }}</td>
<td class="numCell">
{{ reportItem.total_production }}
</td>
<td class="numCell">台时t/h</td>
<td class="numCell">{{ reportItem.production_hour }}</td>
<td class="numCell">
{{ reportItem.production_hour }}
</td>
<td class="numCell">运转时间h</td>
<td class="numCell">{{ reportItem.run_hour }}</td>
<td class="numCell">
{{ reportItem.run_hour }}
</td>
</tr>
<tr>
<td class="numCell">运转率%</td>
<td class="numCell">{{ reportItem.run_rate * 100 }}</td>
<td class="numCell">
{{ reportItem.run_rate * 100 }}
</td>
<td class="numCell">停机时长h</td>
<td class="numCell">{{ reportItem.shut_hour }}</td>
<td class="numCell">
{{ reportItem.shut_hour }}
</td>
<td class="numCell">煤磨分布电耗KW·h/t</td>
<td class="numCell">{{ reportItem.elec_consume_unit }}</td>
<td class="numCell">
{{ reportItem.elec_consume_unit }}
</td>
</tr>
<tr>
<td class="numCell">煤粉细度合格率%</td>
<td class="numCell" v-if="reportItem.煤粉_细度_rate_pass">{{ reportItem.煤粉_细度_rate_pass * 100 }}</td>
<td
class="numCell"
v-if="reportItem.煤粉_细度_rate_pass"
>
{{ reportItem.煤粉_细度_rate_pass * 100 }}
</td>
<td class="numCell" v-else>0</td>
<td class="numCell">煤粉水分合格率%</td>
<td class="numCell" v-if="reportItem.煤粉_水分_rate_pass">{{ reportItem.煤粉_水分_rate_pass * 100 }}</td>
<td
class="numCell"
v-if="reportItem.煤粉_水分_rate_pass"
>
{{ reportItem.煤粉_水分_rate_pass * 100 }}
</td>
<td class="numCell" v-else>0</td>
</tr>
<tr v-if="sflogexpList.length > 0">
<td class="numCell" :rowspan="sflogexpList.length + 1">生产情况记录</td>
<td
class="numCell"
:rowspan="sflogexpList.length + 1"
>
生产情况记录
</td>
<td class="numCell">时间</td>
<td class="numCell">类别</td>
<td class="numCell">原因</td>
@ -135,16 +264,16 @@ export default {
data() {
return {
apiObj: this.$API.wpm.sflog.list,
apiObj: null,
apiObj2: null,
query: {
shift: '',
team: '',
end_time__lt: '',
start_time__gte: '',
mgroup: '3347217651339837440',
shift: "",
team: "",
end_time__lt: "",
start_time__gte: "",
mgroup: "",
},
deptId: '3347207316583170048',
deptId: "",
sflogItem: {},
options: [],
optionsShift: [],
@ -154,22 +283,30 @@ export default {
};
},
mounted() {
this.$API.mtm.mgroup.list
.req({ page: 0, search: "水泥磨" })
.then((res) => {
console.log("水泥磨", res);
this.query.mgroup = res[0].id;
this.apiObj = this.$API.wpm.sflog.list;
this.deptId = res[0].belong_dept;
this.getTeam();
this.getShfit();
});
},
methods: {
getTeam() {
let form = {};
form.page = 0;
form.belong_dept = this.deptId;
this.$API.mtm.team.list.req(form).then(res => {
this.$API.mtm.team.list.req(form).then((res) => {
this.options = res;
})
});
},
getShfit() {
this.$API.mtm.shift.list.req({ page: 0 }).then(res => {
this.$API.mtm.shift.list.req({ page: 0 }).then((res) => {
this.optionsShift = res;
})
});
},
handleQuery() {
this.$refs.table.queryData(this.query);
@ -185,37 +322,41 @@ export default {
},
getSflogexp(id) {
let that = this;
that.$API.wpm.sflogexp.list.req({ page: 0, sflog: id }).then(res => {
that.$API.wpm.sflogexp.list
.req({ page: 0, sflog: id })
.then((res) => {
that.sflogexpList = res;
})
});
},
getSflogItem(id) {
let that = this;
that.$API.enm.enstat.req({ type: 'sflog', sflog: id, page: 0 }).then(res => {
that.$API.enm.enstat
.req({ type: "sflog", sflog: id, page: 0 })
.then((res) => {
if (res.length > 0) {
that.reportItem = res[0];
}
})
});
},
//
sflog_edit(row) {
let jsonStr = JSON.stringify(row);
this.$TOOL.data.remove("sflogItem")
this.$TOOL.data.set('sflogItem', jsonStr)
this.$TOOL.data.remove("sflogItem");
this.$TOOL.data.set("sflogItem", jsonStr);
this.$router.push({
name: "logDetail",
query: {
mgroupId: row.mgroup,
deptId: this.deptId
deptId: this.deptId,
},
});
},
handlePrint() {
this.$PRINT('#myReport');
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX('#myTable', this.tableName)
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
},
@ -241,7 +382,7 @@ export default {
}
.searchHead {
display: flex
display: flex;
}
.middleText {
@ -255,4 +396,3 @@ export default {
margin-left: 5px;
}
</style>

View File

@ -8,20 +8,25 @@
:loading="exportLoading"
>导出xlsx
</el-button>
<el-button
type="primary"
@click="handlePrint"
>打印
</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">
<table
border="1"
width="1035"
cellspacing="0"
:key="timeStamp"
id="myTable"
class="myTable"
>
<thead class="myTableHead">
<tr>
<th colspan="6">水泥磨工段主要设备100KW以上单位产品电耗数据表</th>
<th colspan="6">
水泥磨工段主要设备100KW以上单位产品电耗数据表
</th>
</tr>
<tr>
<th>设备名称</th>
@ -34,26 +39,64 @@
</thead>
<tbody>
<tr v-for="item in tableDatas" :key="item">
<template v-for="(item1,ind) in item" :key="item1">
<td v-if="ind==0||ind==1||ind==2" class="numCell">{{item1}}</td>
<td v-if="ind==3" class="numCell" @click="itemClick('hour_s',item)">{{item1}}</td>
<td v-if="ind==4" class="numCell" @click="itemClick('day_s',item)">{{item1}}</td>
<td v-if="ind==5" class="numCell" @click="itemClick('month_s',item)">{{item1}}</td>
<template
v-for="(item1, ind) in item"
:key="item1"
>
<td
v-if="ind == 0 || ind == 1 || ind == 2"
class="numCell"
>
{{ item1 }}
</td>
<td
v-if="ind == 3"
class="numCell"
@click="itemClick('hour_s', item)"
>
{{ item1 }}
</td>
<td
v-if="ind == 4"
class="numCell"
@click="itemClick('day_s', item)"
>
{{ item1 }}
</td>
<td
v-if="ind == 5"
class="numCell"
@click="itemClick('month_s', item)"
>
{{ item1 }}
</td>
</template>
</tr>
</tbody>
</table>
<div class="chartWrap">
<div class="chartTitle">小时生产参数统计图</div>
<scEcharts height="400px" width="1033px" :option="optionHour"></scEcharts>
<scEcharts
height="400px"
width="1033px"
:option="optionHour"
></scEcharts>
</div>
<div class="chartWrap">
<div class="chartTitle">本月生产参数统计图</div>
<scEcharts height="400px" width="1033px" :option="optionDay"></scEcharts>
<scEcharts
height="400px"
width="1033px"
:option="optionDay"
></scEcharts>
</div>
<div class="chartWrap">
<div class="chartTitle">本年生产参数统计图</div>
<scEcharts height="400px" width="1033px" :option="optionMonth"></scEcharts>
<scEcharts
height="400px"
width="1033px"
:option="optionMonth"
></scEcharts>
</div>
</div>
</div>
@ -66,97 +109,107 @@
:mgroup="query.mgroup"
:modelValue="modelValue"
:showClose="showClose"
:echartType='echartType'
:echartType="echartType"
@closed="asynDialog = false"
></charts>
</el-card>
</div>
</template>
<script>
const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
const colors = [
"#647bfe",
"#8698fe",
"#a9b6fe",
"#cbd3fe",
"#91CC75",
"#EE6666",
];
let tooltip = {
show: true,
trigger: 'axis',
trigger: "axis",
axisPointer: {
type: 'cross'
type: "cross",
},
confine: false,
showContent: true,
triggerOn: "mousemove",
};
let grid = {
right: '3%',
left:'7%',
top:'15%'
right: "3%",
left: "7%",
top: "15%",
};
let toolbox = {
right:'2%',
right: "2%",
feature: {
dataView: { show: true, readOnly: false },
saveAsImage: { show: true }
}
saveAsImage: { show: true },
},
};
let legend = {
top:'2%',
x:'center',
data:['循环风机1906', '系统风机', '水平涡流选粉机', '水泥磨主电机', '辊压机动辊电机','辊压机定辊电机','新增磨尾风机']
top: "2%",
x: "center",
data: [
"循环风机1906",
"系统风机",
"水平涡流选粉机",
"水泥磨主电机",
"辊压机动辊电机",
"辊压机定辊电机",
"新增磨尾风机",
],
};
let yAxis = {
type: 'value',
name: '分布电耗(KW.h/t)',
type: "value",
name: "分布电耗(KW.h/t)",
alignTicks: true,
axisLine: {
show: true,
lineStyle: {
color: colors[3]
}
color: colors[3],
},
},
axisLabel: {
formatter: '{value}'
}
formatter: "{value}",
},
};
import scEcharts from "@/components/scEcharts";
import { defineAsyncComponent } from 'vue'
import { defineAsyncComponent } from "vue";
export default {
components: {
scEcharts,
charts: defineAsyncComponent(() => import("@/components/scEnm/lineChartsdialog.vue")),
charts: defineAsyncComponent(() =>
import("@/components/scEnm/lineChartsdialog.vue")
),
},
data() {
return {
exportLoading: false,
chartShow: false,
myOption: null,
timeStamp: null,
optionHour: {},
optionDay: {},
optionMonth: {},
year:2023,
year: 2024,
month: 1,
days: 1,
hours: 1,
query: {
mgroup:'3347217651339837440',
mgroup: "",
},
tableName:'主要设备100KW以上单位产品电耗数据表',
tableName: "主要设备100KW以上单位产品电耗数据表",
tableDatas: [
['循环风机1906','','KW·h/t','','',''],
['系统风机','','KW·h/t','','',''],
// {name:'1906',number:'NM001',unit:'KW·h/t',hours:'',days:'',month:''},
// {name:'',number:'NM002',unit:'KW·h/t',hours:'',days:'',month:''},
// {name:'1915',number:'NM002',unit:'KW·h/t',hours:'',days:'',month:''},
// {name:'',number:'NM002',unit:'KW·h/t',hours:'',days:'',month:''},
// {name:'',number:'NM002',unit:'KW·h/t',hours:'',days:'',month:''},
// {name:'',number:'NM002',unit:'KW·h/t',hours:'',days:'',month:''},
// {name:'',number:'NM002',unit:'KW·h/t',hours:'',days:'',month:''},
// {name:'1#',number:'NM002',unit:'KW·h/t',hours:'',days:'',month:''},
// {name:'2#',number:'NM002',unit:'KW·h/t',hours:'',days:'',month:''},
["循环风机1906", "", "KW·h/t", "", "", ""],
["系统风机", "", "KW·h/t", "", "", ""],
],
modelValue: true,
type:'hour_s',
title:'水泥磨工段',
cate:'',
type: "hour_s",
title: "水泥磨工段",
cate: "",
apiObj: this.$API.enm.mpoint.stat,
showClose: true,
echartType:'line',
echartType: "line",
asynDialog: false,
allValHour: 0,
allValDays: 0,
@ -173,46 +226,46 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
length: 5,
inside: true,
},
data: []
data: [],
},
yAxis: yAxis,
series: [
{
name: '循环风机1906',
type: 'bar',
data:[]
name: "循环风机1906",
type: "bar",
data: [],
},
{
name: '系统风机',
type: 'bar',
data: []
name: "系统风机",
type: "bar",
data: [],
},
{
name: '水平涡流选粉机',
type: 'bar',
data: []
name: "水平涡流选粉机",
type: "bar",
data: [],
},
{
name: '水泥磨主电机',
type: 'bar',
data: []
name: "水泥磨主电机",
type: "bar",
data: [],
},
{
name: '辊压机动辊电机',
type: 'bar',
data: []
name: "辊压机动辊电机",
type: "bar",
data: [],
},
{
name: '辊压机定辊电机',
type: 'bar',
data: []
name: "辊压机定辊电机",
type: "bar",
data: [],
},
{
name: '新增磨尾风机',
type: 'bar',
data: []
name: "新增磨尾风机",
type: "bar",
data: [],
},
]
],
},
option2: {
color: colors,
@ -226,46 +279,46 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
length: 5,
inside: true,
},
data: []
data: [],
},
yAxis: yAxis,
series: [
{
name: '循环风机1906',
type: 'bar',
data:[]
name: "循环风机1906",
type: "bar",
data: [],
},
{
name: '系统风机',
type: 'bar',
data: []
name: "系统风机",
type: "bar",
data: [],
},
{
name: '水平涡流选粉机',
type: 'bar',
data: []
name: "水平涡流选粉机",
type: "bar",
data: [],
},
{
name: '水泥磨主电机',
type: 'bar',
data: []
name: "水泥磨主电机",
type: "bar",
data: [],
},
{
name: '辊压机动辊电机',
type: 'bar',
data: []
name: "辊压机动辊电机",
type: "bar",
data: [],
},
{
name: '辊压机定辊电机',
type: 'bar',
data: []
name: "辊压机定辊电机",
type: "bar",
data: [],
},
{
name: '新增磨尾风机',
type: 'bar',
data: []
name: "新增磨尾风机",
type: "bar",
data: [],
},
]
],
},
option3: {
color: colors,
@ -279,47 +332,47 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
length: 5,
inside: true,
},
data: []
data: [],
},
yAxis: yAxis,
series: [
{
name: '循环风机1906',
type: 'bar',
data:[]
name: "循环风机1906",
type: "bar",
data: [],
},
{
name: '系统风机',
type: 'bar',
data: []
name: "系统风机",
type: "bar",
data: [],
},
{
name: '水平涡流选粉机',
type: 'bar',
data: []
name: "水平涡流选粉机",
type: "bar",
data: [],
},
{
name: '水泥磨主电机',
type: 'bar',
data: []
name: "水泥磨主电机",
type: "bar",
data: [],
},
{
name: '辊压机动辊电机',
type: 'bar',
data: []
name: "辊压机动辊电机",
type: "bar",
data: [],
},
{
name: '辊压机定辊电机',
type: 'bar',
data: []
name: "辊压机定辊电机",
type: "bar",
data: [],
},
{
name: '新增磨尾风机',
type: 'bar',
data: []
name: "新增磨尾风机",
type: "bar",
data: [],
},
],
},
]
}
};
},
mounted() {
@ -330,10 +383,14 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
let days = myDate.getDate();
let hours = myDate.getHours();
let timeDate = myDate.getTime();
that.timeStamp = timeDate;
let dayTime = 24 * 60 * 60 * 1000;
//
let year_d = year,month_d = month,days_d = days;
if(hours<21){//21点前查找昨日数据为前一天数据
let year_d = year,
month_d = month,
days_d = days;
if (hours < 21) {
//21
let newDate = timeDate - dayTime;
let lastDate = new Date(newDate);
year_d = lastDate.getFullYear();
@ -347,54 +404,81 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
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 params2 = {};
params2.page = 0;
params2.year_s = year;
params2.month_s = month;
params2.type = 'month_s';
params2.type = "month_s";
params2.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params2).then((res2) => {
this.$API.enm.enstat
.req(params2)
.then((res2) => {
if (res2.length > 0) {
let allValMonth =that.allValMonth = res2[0].total_production;//
let allValMonth = (that.allValMonth =
res2[0].total_production); //
params2.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat.req(params2).then((res) => {
this.$API.enm.mpoint.stat
.req(params2)
.then((res) => {
let data2 = res;
for (let i = 0; i < data2.length; i++) {
that.tableDatas[i] = [];
that.tableDatas[i][0]=data2[i].ep_monitored_name;
that.tableDatas[i][1]=data2[i].ep_monitored_number;
that.tableDatas[i][2]='KW·h/t';
let val = allValMonth==0?'/':(data2[i].val/allValMonth).toFixed(2);
that.tableDatas[i][0] =
data2[i].ep_monitored_name;
that.tableDatas[i][1] =
data2[i].ep_monitored_number;
that.tableDatas[i][2] = "KW·h/t";
let val =
allValMonth == 0
? "/"
: (
data2[i].val /
allValMonth
).toFixed(2);
that.tableDatas[i][5] = val;
}
debugger;
console.log(that.tableDatas)
})
console.log(that.tableDatas);
});
}
}).then(res2=>{
})
.then((res2) => {
//
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.type = "day_s";
params3.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params3).then((res3) => {
if (res3.length > 0) {
let allValDays=that.allValDays = res3[0].total_production;
let allValDays = (that.allValDays =
res3[0].total_production);
params3.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat.req(params3).then((res) => {
this.$API.enm.mpoint.stat
.req(params3)
.then((res) => {
let data3 = res3;
for (let j = 0; j < data3.length; j++) {
let val = allValDays==0?'/':(data3[j].val/allValDays).toFixed(2);
let val =
allValDays == 0
? "/"
: (
data3[j].val /
allValDays
).toFixed(2);
that.tableDatas[j][4] = val;
}
})
});
}
})
});
//
let params4 = {};
params4.page = 0;
@ -402,25 +486,35 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
params4.month = month_h;
params4.day = days_h;
params4.hour = hours_h;
params4.type = 'hour_s';
params4.type = "hour_s";
params4.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let hourProduct = that.allValHour = res4[0].total_production;
let hourProduct = (that.allValHour =
res4[0].total_production);
params4.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat.req(params4).then((res) => {
this.$API.enm.mpoint.stat
.req(params4)
.then((res) => {
let data4 = res4;
for (let k = 0; k < data4.length; k++) {
let val = hourProduct==0?'/':(data4[k].val/hourProduct).toFixed(2);
let val =
hourProduct == 0
? "/"
: (
data4[k].val /
hourProduct
).toFixed(2);
that.tableDatas[k][3] = val;
}
})
});
}
})
})
});
});
that.getHourData();
that.getDayData();
that.getMonthData();
});
},
methods: {
//
@ -431,34 +525,39 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
query.year_s = that.year;
query.month_s = that.month;
query.day_s = that.days;
query.type = 'hour_s';
query.type = "hour_s";
query.mgroup = that.query.mgroup;
query.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat.req(query).then((response) => {
let seriesData0 = [],seriesData1 = [], seriesData2 = [],
seriesData3 = [],seriesData4 = [],seriesData5 = [],seriesData6 = [];
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [],
seriesData5 = [],
seriesData6 = [];
let data = response;
data.forEach(item => {
data.forEach((item) => {
let ind = item.hour;
let val = 0;
if (that.allValHour == 0) {
val = ''
val = "";
} else {
val = (item.val / that.allValHour).toFixed(2);
}
if(item.equip_name=='循环风机1906'){
if (item.equip_name == "循环风机1906") {
seriesData0[ind] = val;
}else if(item.equip_name=='系统风机'){
} else if (item.equip_name == "系统风机") {
seriesData1[ind] = val;
}else if(item.equip_name=='水平涡流选粉机'){
} else if (item.equip_name == "水平涡流选粉机") {
seriesData2[ind] = val;
}else if(item.equip_name=='水泥磨主电机'){
} else if (item.equip_name == "水泥磨主电机") {
seriesData3[ind] = val;
}else if(item.equip_name=='辊压机动辊电机'){
} else if (item.equip_name == "辊压机动辊电机") {
seriesData4[ind] = val;
}else if(item.equip_name=='辊压机定辊电机'){
} else if (item.equip_name == "辊压机定辊电机") {
seriesData5[ind] = val;
}else if(item.equip_name=='新增磨尾风机'){
} else if (item.equip_name == "新增磨尾风机") {
seriesData6[ind] = val;
}
});
@ -472,12 +571,12 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
options.series[6].data = seriesData4;
let hourXAxis = [];
for (let i = 1; i <= that.hours; i++) {
let item = i+'时'
hourXAxis.push(item)
let item = i + "时";
hourXAxis.push(item);
}
options.xAxis.data = hourXAxis;
that.optionHour = options;
})
});
},
//
getDayData() {
@ -486,35 +585,40 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
query1.page = 0;
query1.year_s = that.year;
query1.month_s = that.month;
query1.type = 'day_s';
query1.type = "day_s";
query1.mgroup = this.query.mgroup;
query1.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.enstat.req(query1).then((response) => {
let seriesData0 = [],seriesData1 = [], seriesData2 = [],
seriesData3 = [],seriesData4 = [],seriesData5 = [],seriesData6 = [];
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [],
seriesData5 = [],
seriesData6 = [];
let data = response;
data.forEach(item => {
data.forEach((item) => {
// debugger;
let ind = item.day_s;
let val = 0;
if (that.allValDays == 0) {
val = ''
val = "";
} else {
val = (item.val / that.allValDays).toFixed(2);
}
if(item.equip_name=='循环风机1906'){
if (item.equip_name == "循环风机1906") {
seriesData0[ind] = val;
}else if(item.equip_name=='系统风机'){
} else if (item.equip_name == "系统风机") {
seriesData1[ind] = val;
}else if(item.equip_name=='水平涡流选粉机'){
} else if (item.equip_name == "水平涡流选粉机") {
seriesData2[ind] = val;
}else if(item.equip_name=='水泥磨主电机'){
} else if (item.equip_name == "水泥磨主电机") {
seriesData3[ind] = val;
}else if(item.equip_name=='辊压机动辊电机'){
} else if (item.equip_name == "辊压机动辊电机") {
seriesData4[ind] = val;
}else if(item.equip_name=='辊压机定辊电机'){
} else if (item.equip_name == "辊压机定辊电机") {
seriesData5[ind] = val;
}else if(item.equip_name=='新增磨尾风机'){
} else if (item.equip_name == "新增磨尾风机") {
seriesData6[ind] = val;
}
});
@ -528,12 +632,12 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
options.series[6].data = seriesData4;
let dayXAxis = [];
for (let i = 1; i <= that.days; i++) {
let item = i+'日'
dayXAxis.push(item)
let item = i + "日";
dayXAxis.push(item);
}
options.xAxis.data = dayXAxis;
that.optionDay = options;
})
});
},
//
getMonthData() {
@ -541,34 +645,39 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
let query2 = {};
query2.page = 0;
query2.year_s = that.year;
query2.type = 'month_s';
query2.type = "month_s";
query2.mgroup = that.query.mgroup;
query2.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.enstat.req(query2).then((response) => {
let seriesData0 = [],seriesData1 = [], seriesData2 = [],
seriesData3 = [],seriesData4 = [],seriesData5 = [],seriesData6 = [];
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [],
seriesData5 = [],
seriesData6 = [];
let data = response;
data.forEach(item => {
data.forEach((item) => {
let ind = item.month_s;
let val = 0;
if (that.allValMonth == 0) {
val = ''
val = "";
} else {
val = (item.val / that.allValMonth).toFixed(2);
}
if(item.equip_name=='循环风机1906'){
if (item.equip_name == "循环风机1906") {
seriesData0[ind] = val;
}else if(item.equip_name=='系统风机'){
} else if (item.equip_name == "系统风机") {
seriesData1[ind] = val;
}else if(item.equip_name=='水平涡流选粉机'){
} else if (item.equip_name == "水平涡流选粉机") {
seriesData2[ind] = val;
}else if(item.equip_name=='水泥磨主电机'){
} else if (item.equip_name == "水泥磨主电机") {
seriesData3[ind] = val;
}else if(item.equip_name=='辊压机动辊电机'){
} else if (item.equip_name == "辊压机动辊电机") {
seriesData4[ind] = val;
}else if(item.equip_name=='辊压机定辊电机'){
} else if (item.equip_name == "辊压机定辊电机") {
seriesData5[ind] = val;
}else if(item.equip_name=='新增磨尾风机'){
} else if (item.equip_name == "新增磨尾风机") {
seriesData6[ind] = val;
}
});
@ -582,12 +691,12 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
options.series[6].data = seriesData4;
let monthXAxis = [];
for (let i = 1; i <= that.month; i++) {
let item = i+'月'
monthXAxis.push(item)
let item = i + "月";
monthXAxis.push(item);
}
options.xAxis.data = monthXAxis;
that.optionMonth = options;
})
});
},
itemClick(type, item) {
this.type = type;
@ -595,14 +704,14 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
this.asynDialog = true;
},
handlePrint() {
this.$PRINT('#myReport');
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX('#myTable', this.tableName)
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
}
},
};
</script>
<style scoped>

View File

@ -8,17 +8,20 @@
:loading="exportLoading"
>导出xlsx
</el-button>
<el-button
type="primary"
@click="handlePrint"
>打印
</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">
<table
border="1"
width="1035"
cellspacing="0"
:key="timeStamp"
id="myTable"
class="myTable"
>
<thead class="myTableHead">
<tr>
<th colspan="10">水泥磨工段生产报告</th>
@ -37,13 +40,43 @@
</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"
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('hour_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 hoursItem"
@click="itemClick('hour_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>
@ -53,15 +86,27 @@
</table>
<div class="chartWrap">
<div class="chartTitle">小时生产参数统计图</div>
<scEcharts height="400px" width="1033px" :option="optionHour"></scEcharts>
<scEcharts
height="400px"
width="1033px"
:option="optionHour"
></scEcharts>
</div>
<div class="chartWrap">
<div class="chartTitle">本月生产参数统计图</div>
<scEcharts height="400px" width="1033px" :option="optionDay"></scEcharts>
<scEcharts
height="400px"
width="1033px"
:option="optionDay"
></scEcharts>
</div>
<div class="chartWrap">
<div class="chartTitle">本年生产参数统计图</div>
<scEcharts height="400px" width="1033px" :option="optionMonth"></scEcharts>
<scEcharts
height="400px"
width="1033px"
:option="optionMonth"
></scEcharts>
</div>
</div>
</div>
@ -85,7 +130,12 @@
start-placeholder="结束日期"
:picker-options="pickerOptions"
/>
<el-button type="primary" class="searchBtn" @click="dataSearch">查询</el-button>
<el-button
type="primary"
class="searchBtn"
@click="dataSearch"
>查询</el-button
>
</div>
<div class="searchHead" v-if="type == 'days'">
<el-date-picker
@ -104,7 +154,12 @@
start-placeholder="结束日期"
:picker-options="pickerOptions"
/>
<el-button type="primary" class="searchBtn" @click="dataSearch">查询</el-button>
<el-button
type="primary"
class="searchBtn"
@click="dataSearch"
>查询</el-button
>
</div>
<div class="searchHead" v-if="type == 'month'">
<el-date-picker
@ -123,7 +178,12 @@
start-placeholder="结束月份"
:picker-options="pickerOptions"
/>
<el-button type="primary" class="searchBtn" @click="dataSearch">查询</el-button>
<el-button
type="primary"
class="searchBtn"
@click="dataSearch"
>查询</el-button
>
</div>
<div class="searchHead" v-if="type == 'year'">
<el-date-picker
@ -142,9 +202,18 @@
start-placeholder="结束日期"
:picker-options="pickerOptions"
/>
<el-button type="primary" class="searchBtn" @click="dataSearch">查询</el-button>
<el-button
type="primary"
class="searchBtn"
@click="dataSearch"
>查询</el-button
>
</div>
<scEcharts height="360px" :option="myOption" v-if="chartShow"></scEcharts>
<scEcharts
height="360px"
:option="myOption"
v-if="chartShow"
></scEcharts>
</sc-dialog>
<charts
v-if="asynDialog"
@ -155,114 +224,126 @@
:mgroup="query.mgroup"
:modelValue="modelValue"
:showClose="showClose"
:echartType='echartType'
:echartType="echartType"
@closed="asynDialog = false"
></charts>
</el-card>
</div>
</template>
<script>
const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
const colors = [
"#647bfe",
"#8698fe",
"#a9b6fe",
"#cbd3fe",
"#91CC75",
"#EE6666",
];
let tooltip = {
show: true,
trigger: 'axis',
trigger: "axis",
axisPointer: {
type: 'cross'
type: "cross",
},
confine: false,
showContent: true,
triggerOn: "mousemove",
};
let grid = {
right: '8%',
left:'7%',
top:'15%'
right: "8%",
left: "7%",
top: "15%",
};
let toolbox = {
right:'2%',
right: "2%",
feature: {
dataView: { show: true, readOnly: false },
saveAsImage: { show: true }
}
saveAsImage: { show: true },
},
};
let legend = {
top:'2%',
data:['总产量', '台时产量', '运转率', '分布电耗', '成本']
top: "2%",
data: ["总产量", "台时产量", "运转率", "分布电耗", "成本"],
};
let yAxis= [{
type: 'value',
name: '产量 (t)',
position: 'left',
let yAxis = [
{
type: "value",
name: "产量 (t)",
position: "left",
alignTicks: true,
axisLine: {
show: true,
lineStyle: {
color: colors[0]
}
color: colors[0],
},
},
axisLabel: {
formatter: '{value}'
}
formatter: "{value}",
},
},
{
type: 'value',
name: '运转率 (%)',
position: 'right',
type: "value",
name: "运转率 (%)",
position: "right",
alignTicks: true,
offset: 80,
axisLine: {
show: true,
lineStyle: {
color: colors[2]
}
color: colors[2],
},
},
axisLabel: {
formatter: '{value}'
}
formatter: "{value}",
},
},
{
type: 'value',
name: '分布电耗(KW.h)',
position: 'right',
type: "value",
name: "分布电耗(KW.h)",
position: "right",
alignTicks: true,
axisLine: {
show: true,
lineStyle: {
color: colors[3]
}
color: colors[3],
},
},
axisLabel: {
formatter: '{value}'
}
formatter: "{value}",
},
},
{
type: 'value',
name: '成本(元)',
position: 'left',
type: "value",
name: "成本(元)",
position: "left",
alignTicks: true,
offset: 70,
axisLine: {
show: true,
lineStyle: {
color: colors[4]
}
color: colors[4],
},
},
axisLabel: {
formatter: '{value}'
}
}
formatter: "{value}",
},
},
];
import scEcharts from "@/components/scEcharts";
import { defineAsyncComponent } from 'vue'
import { defineAsyncComponent } from "vue";
export default {
components: {
scEcharts,
charts: defineAsyncComponent(() => import("@/components/scEnm/lineChartsdialog.vue")),
charts: defineAsyncComponent(() =>
import("@/components/scEnm/lineChartsdialog.vue")
),
},
data() {
return {
exportLoading: false,
chartShow: false,
myOption: null,
timeStamp: null,
optionHour: {},
optionDay: {},
optionMonth: {},
@ -271,25 +352,25 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
days: 1,
hours: 1,
query: {
mgroup:'3347217651339837440',
mgroup: "",
},
tableDatas: [
['产量','总产量t',0,0,0,0,0,0,0,0],
['产量','台时产量t/h','/',0,0,0,0,0,0,0],
['运转时间','运转时间h','/',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/t',0,0,0,0,0,0,0,0],
['成本','单位产品成本(元/吨)',0,0,0,0,0,0,0,0],
["产量", "总产量t", 0, 0, 0, 0, 0, 0, 0, 0],
["产量", "台时产量t/h", "/", 0, 0, 0, 0, 0, 0, 0],
["运转时间", "运转时间h", "/", 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/t", 0, 0, 0, 0, 0, 0, 0, 0],
["成本", "单位产品成本(元/吨)", 0, 0, 0, 0, 0, 0, 0, 0],
],
tableName:'生产报告',
tableName: "生产报告",
modelValue: true,
type:'hour_s',
title:'水泥磨工段',
cate:'',
type: "hour_s",
title: "水泥磨工段",
cate: "",
apiObj: this.$API.enm.enstat,
showClose: true,
echartType:'line',
echartType: "line",
asynDialog: false,
option1: {
color: colors,
@ -303,42 +384,41 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
length: 5,
inside: true,
},
data: []
data: [],
},
yAxis: yAxis,
series: [
{
name: '总产量',
type: 'bar',
name: "总产量",
type: "bar",
yAxisIndex: 0,
data:[]
data: [],
},
{
name: '台时产量',
type: 'bar',
name: "台时产量",
type: "bar",
yAxisIndex: 0,
data: []
data: [],
},
{
name: '运转率',
type: 'line',
name: "运转率",
type: "line",
yAxisIndex: 1,
data: []
data: [],
},
{
name: '分布电耗',
type: 'bar',
name: "分布电耗",
type: "bar",
yAxisIndex: 2,
data: []
data: [],
},
{
name: '成本',
type: 'bar',
name: "成本",
type: "bar",
yAxisIndex: 3,
data: []
data: [],
},
]
],
},
option2: {
color: colors,
@ -352,42 +432,41 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
length: 5,
inside: true,
},
data: []
data: [],
},
yAxis: yAxis,
series: [
{
name: '总产量',
type: 'bar',
name: "总产量",
type: "bar",
yAxisIndex: 0,
data:[]
data: [],
},
{
name: '台时产量',
type: 'bar',
name: "台时产量",
type: "bar",
yAxisIndex: 0,
data: []
data: [],
},
{
name: '运转率',
type: 'line',
name: "运转率",
type: "line",
yAxisIndex: 1,
data: []
data: [],
},
{
name: '分布电耗',
type: 'bar',
name: "分布电耗",
type: "bar",
yAxisIndex: 2,
data: []
data: [],
},
{
name: '成本',
type: 'bar',
name: "成本",
type: "bar",
yAxisIndex: 3,
data: []
data: [],
},
]
],
},
option3: {
color: colors,
@ -401,64 +480,81 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
length: 5,
inside: true,
},
data: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
data: [
"一月",
"二月",
"三月",
"四月",
"五月",
"六月",
"七月",
"八月",
"九月",
"十月",
"十一月",
"十二月",
],
},
yAxis: yAxis,
series: [
{
name: '总产量',
type: 'bar',
name: "总产量",
type: "bar",
yAxisIndex: 0,
data: []
data: [],
},
{
name: '台时产量',
type: 'bar',
name: "台时产量",
type: "bar",
yAxisIndex: 0,
data: []
data: [],
},
{
name: '运转率',
type: 'line',
name: "运转率",
type: "line",
yAxisIndex: 1,
data: []
data: [],
},
{
name: '分布电耗',
type: 'bar',
name: "分布电耗",
type: "bar",
yAxisIndex: 2,
data: []
data: [],
},
{
name: '成本',
type: 'bar',
name: "成本",
type: "bar",
yAxisIndex: 3,
data: []
}
]
}
data: [],
},
],
},
};
},
mounted() {
function precen(a, b) {
if (b !== 0 && b !== null && a !== null) {
let precen = (a/b).toFixed(2)
return precen*100+'%'
let precen = (a / b).toFixed(2);
return precen * 100 + "%";
} else {
return '/'
return "/";
}
}
let that = this;
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 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();
that.timeStamp = timeDate;
let dayTime = 24 * 60 * 60 * 1000;
//
let year_d = year,month_d = month,days_d = days;
if(hours<21){//21点前查找昨日数据为前一天数据
let year_d = year,
month_d = month,
days_d = days;
if (hours < 21) {
//21
let newDate = timeDate - dayTime;
let lastDate = new Date(newDate);
year_d = lastDate.getFullYear();
@ -472,15 +568,20 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
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) => {
params3.type = "day_s";
params3.mgroup = that.query.mgroup;
that.$API.enm.enstat.req(params3).then((res3) => {
if (res3.length > 0) {
let data3 = res3[0];
that.tableDatas[0][3] = data3.total_production;
@ -491,7 +592,7 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
that.tableDatas[5][3] = data3.cen_consume_unit;
that.tableDatas[6][3] = data3.production_cost_unit;
}
})
});
//
let params4 = {};
params4.page = 0;
@ -499,9 +600,9 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
params4.month = month_h;
params4.day = days_h;
params4.hour = hours_h;
params4.type = 'hour_st';
params4.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params4).then((res4) => {
params4.type = "hour_st";
params4.mgroup = that.query.mgroup;
that.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let data4 = res4[0];
that.tableDatas[0][2] = data4.total_production;
@ -509,96 +610,160 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
that.tableDatas[5][2] = data4.cen_consume_unit;
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) => {
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;
if(item5.goal_cate_name=='总产量t'){
data5.forEach((item5) => {
let str = "goal_val_" + that.month;
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'){
} 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'){
} 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=='运转率(%'){
} 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'){
} 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=='单位产品综合能耗kgce/t'){
} else if (
item5.goal_cate_name ==
"单位产品综合能耗kgce/t"
) {
that.tableDatas[5][6] = item5[str];
that.tableDatas[5][8] = item5.goal_val;
}else if(item5.goal_cate_name=='单位产品成本(元/吨)'){
} else if (
item5.goal_cate_name ==
"单位产品成本(元/吨)"
) {
that.tableDatas[6][6] = item5[str];
that.tableDatas[6][8] = item5.goal_val;
}
})
});
}
}).then(res=>{
})
.then((res) => {
//
let params1 = {};
params1.page = 0;
params1.year_s = year;
params1.type = 'year_s';
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[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[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[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[3][9] = precen(
that.tableDatas[3][5],
that.tableDatas[3][8]
);
that.tableDatas[4][5] = data1.elec_consume_unit;
that.tableDatas[4][9]=precen(that.tableDatas[4][5],that.tableDatas[4][8])
that.tableDatas[4][9] = precen(
that.tableDatas[4][5],
that.tableDatas[4][8]
);
that.tableDatas[5][5] = data1.cen_consume_unit;
that.tableDatas[5][9]=precen(that.tableDatas[5][5],that.tableDatas[5][8])
that.tableDatas[6][5]=data1.production_cost_unit;
that.tableDatas[6][9]=precen(that.tableDatas[6][5],that.tableDatas[6][8])
}else{}
})
that.tableDatas[5][9] = precen(
that.tableDatas[5][5],
that.tableDatas[5][8]
);
that.tableDatas[6][5] =
data1.production_cost_unit;
that.tableDatas[6][9] = precen(
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.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;
that.tableDatas[0][7]=precen(that.tableDatas[0][4],that.tableDatas[0][6])
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[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[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[3][7] = precen(
that.tableDatas[3][4],
that.tableDatas[3][6]
);
that.tableDatas[4][4] = data2.elec_consume_unit;
that.tableDatas[4][7]=precen(that.tableDatas[4][4],that.tableDatas[4][6])
that.tableDatas[5][4]=data1.cen_consume_unit;
that.tableDatas[5][7]=precen(that.tableDatas[5][4],that.tableDatas[5][6])
that.tableDatas[6][4]=data1.production_cost_unit;
that.tableDatas[6][7]=precen(that.tableDatas[6][4],that.tableDatas[6][6])
that.tableDatas[4][7] = precen(
that.tableDatas[4][4],
that.tableDatas[4][6]
);
that.tableDatas[5][4] = data2.cen_consume_unit;
that.tableDatas[5][7] = precen(
that.tableDatas[5][4],
that.tableDatas[5][6]
);
that.tableDatas[6][4] =
data2.production_cost_unit;
that.tableDatas[6][7] = precen(
that.tableDatas[6][4],
that.tableDatas[6][6]
);
}
})
})
});
});
that.getHourData();
that.getDayData();
that.getMonthData();
});
},
methods: {
//
@ -609,14 +774,18 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
query.year_s = that.year;
query.month_s = that.month;
query.day_s = that.days;
query.type = 'hour_s';
query.type = "hour_s";
query.mgroup = that.query.mgroup;
this.$API.enm.enstat.req(query).then((response) => {
// debugger;
let seriesData0 = [],seriesData1 = [], seriesData2 = [],seriesData3 = [],seriesData4 = [];
console.log(response)
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [];
console.log(response);
let data = response;
data.forEach(item => {
data.forEach((item) => {
let ind = item.hour;
seriesData0[ind] = item.total_production;
seriesData1[ind] = item.production_hour;
@ -632,12 +801,12 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
options.series[4].data = seriesData4;
let hourXAxis = [];
for (let i = 1; i <= that.hours; i++) {
let item = i+'时'
hourXAxis.push(item)
let item = i + "时";
hourXAxis.push(item);
}
options.xAxis.data = hourXAxis;
that.optionHour = options;
})
});
},
//
getDayData() {
@ -646,14 +815,18 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
query1.page = 0;
query1.year_s = that.year;
query1.month_s = that.month;
query1.type = 'day_s';
query1.type = "day_s";
query1.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(query1).then((response) => {
let seriesData0 = [],seriesData1 = [], seriesData2 = [],seriesData3 = [],seriesData4 = [];
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [];
// debugger;
console.log(response)
console.log(response);
let data = response;
data.forEach(item => {
data.forEach((item) => {
// debugger;
let ind = item.day_s;
seriesData0[ind] = item.total_production;
@ -670,12 +843,12 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
options.series[4].data = seriesData4;
let dayXAxis = [];
for (let i = 1; i <= that.days; i++) {
let item = i+'日'
dayXAxis.push(item)
let item = i + "日";
dayXAxis.push(item);
}
options.xAxis.data = dayXAxis;
that.optionDay = options;
})
});
},
//
getMonthData() {
@ -683,14 +856,18 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
let query2 = {};
query2.page = 0;
query2.year_s = that.year;
query2.type = 'month_s';
query2.type = "month_s";
query2.mgroup = that.query.mgroup;
this.$API.enm.enstat.req(query2).then((response) => {
// debugger;
let seriesData0 = [],seriesData1 = [], seriesData2 = [],seriesData3 = [],seriesData4 = [];
console.log(response)
let seriesData0 = [],
seriesData1 = [],
seriesData2 = [],
seriesData3 = [],
seriesData4 = [];
console.log(response);
let data = response;
data.forEach(item => {
data.forEach((item) => {
let ind = item.month_s;
seriesData0[ind] = item.total_production;
seriesData1[ind] = item.production_hour;
@ -706,12 +883,12 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
options.series[4].data = seriesData4;
let monthXAxis = [];
for (let i = 1; i <= that.month; i++) {
let item = i+'月'
monthXAxis.push(item)
let item = i + "月";
monthXAxis.push(item);
}
options.xAxis.data = monthXAxis;
that.optionMonth = options;
})
});
},
itemClick(type, item) {
this.type = type;
@ -720,24 +897,22 @@ const colors =['#647bfe','#8698fe','#a9b6fe','#cbd3fe','#91CC75','#EE6666'];
},
itemClick1(type, item) {
this.chartShow = false;
this.$API.bi.dataset.exec
.req('3322567213885833216')
.then((res) => {
this.$API.bi.dataset.exec.req("3322567213885833216").then((res) => {
this.myOption = JSON.parse(res.echart_options);
debugger;
console.log(this.myOption)
console.log(this.myOption);
this.chartShow = true;
});
},
handlePrint() {
this.$PRINT('#myReport');
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX('#myTable', this.tableName)
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
}
},
};
</script>
<style scoped>

View File

@ -21,17 +21,20 @@
:loading="exportLoading"
>导出xlsx
</el-button>
<el-button
type="primary"
@click="handlePrint"
>打印
</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="1900" cellspacing="0" :key="timeStamp" id="myTable" class="myTable">
<table
border="1"
width="1900"
cellspacing="0"
:key="timeStamp"
id="myTable"
class="myTable"
>
<thead class="myTableHead">
<tr>
<th colspan="19">水泥磨工段班组月度对比分析</th>
@ -66,7 +69,14 @@
</tr>
</thead>
<tr v-for="(item, index) in tableDatas" :key="index">
<td v-for="(item0,index0) in item" :key="index0" class="numCell"> <span v-if="item0">{{item0}}</span> <span v-else>0</span></td>
<td
v-for="(item0, index0) in item"
:key="index0"
class="numCell"
>
<span v-if="item0">{{ item0 }}</span>
<span v-else>0</span>
</td>
</tr>
</table>
</div>
@ -80,19 +90,26 @@
return {
timeStamp: 0,
query: {
year_s:'',
year_s: "",
page: 0,
type : 'month_st',
mgroup:'3347217651339837440',
type: "month_st",
mgroup: "3347217651339837440",
},
tableDatas: [],
exportLoading: false,
};
},
mounted() {
let that = this;
var myDate = new Date();
let year = myDate.getFullYear();
this.timeStamp = myDate.getTime();
that.query.year_s = year;
this.$API.mtm.mgroup.list
.req({ page: 0, search: "水泥磨" })
.then((res) => {
console.log("水泥磨", res);
that.query.mgroup = res[0].id;
let params = {};
params.page = 0;
params.year = year;
@ -103,56 +120,60 @@
data = res[0];
}
that.getData(data);
})
});
});
},
methods: {
getData(goalData) {
let that = this;
let query0 = {};
query0.page = 0;
query0.type='month_st';
query0.type = "month_st";
query0.year_s = that.query.year_s - 1;
query0.mgroup='3346520558031773696';
let wrapArr = [],wrapArr0 = [] ,wrapArrs = [];
query0.mgroup = that.query.mgroup;
let wrapArr = [],
wrapArr0 = [],
wrapArrs = [];
this.$API.enm.enstat.req(query0).then((res0) => {
let data0 = []; //
data0 = res0;
if (data0.length > 0) {
data0.forEach(item0 => {
data0.forEach((item0) => {
//
let n0 = item0.month_s;
let ind0 = 0;
if(team_name0.indexOf('甲')>-1){
let team_name0 = item0.team_name;
if (team_name0.indexOf("甲") > -1) {
ind0 = (n0 - 1) * 3;
}else if(team_name0.indexOf('乙')>-1){
} else if (team_name0.indexOf("乙") > -1) {
ind0 = (n0 - 1) * 3 + 1;
}else if(team_name0.indexOf('丙')>-1){
} else if (team_name0.indexOf("丙") > -1) {
ind0 = (n0 - 1) * 3 + 2;
}
wrapArr0[ind0] = item0;
});
console.log(wrapArr0)
console.log(wrapArr0);
} else {
}
this.$API.enm.enstat.req(that.query).then((res) => {
//
let data = res;
if (data.length > 0) {
data.forEach(item => {
data.forEach((item) => {
//
let n = item.month_s;
let team_name = item.team_name;
let ind = 0;
if(team_name.indexOf('甲')>-1){
if (team_name.indexOf("甲") > -1) {
ind = (n - 1) * 3;
}else if(team_name.indexOf('乙')>-1){
} else if (team_name.indexOf("乙") > -1) {
ind = (n - 1) * 3 + 1;
}else if(team_name.indexOf('丙')>-1){
} else if (team_name.indexOf("丙") > -1) {
ind = (n - 1) * 3 + 2;
}
wrapArrs[ind] = item;
let arr = [];
let time = ''+item.year_s+'.'+item.month_s;
let time = "" + item.year_s + "." + item.month_s;
arr.push(time);
arr.push(item.team_name);
arr.push(item.total_production);
@ -160,37 +181,68 @@
arr.push(item.run_rate);
arr.push(item.production_cost_unit);
//
arr[6]=item.出磨水泥_比表面积_rate_pass!=null?item.出磨水泥_比表面积_rate_pass:'/';
arr[7]=item.出磨水泥_SO3_rate_pass!=null?item.出磨水泥_SO3_rate_pass:'/';
arr[8]=item.出磨水泥_掺量_rate_pass!=null?item.出磨水泥_掺量_rate_pass:'/';
arr[6] =
item.出磨水泥_比表面积_rate_pass != null
? item.出磨水泥_比表面积_rate_pass
: "/";
arr[7] =
item.出磨水泥_SO3_rate_pass != null
? item.出磨水泥_SO3_rate_pass
: "/";
arr[8] =
item.出磨水泥_掺量_rate_pass != null
? item.出磨水泥_掺量_rate_pass
: "/";
//
arr[9]=item.循环风机1906_consume_unit!=null?item.循环风机1906_consume_unit:'/';
arr[10]=item.系统风机_consume_unit!=null?item.系统风机_consume_unit:'/';
arr[11]=item.水平涡流选粉机1915_consume_unit!=null?item.水平涡流选粉机1915_consume_unit:'/';
arr[9] =
item.循环风机1906_consume_unit != null
? item.循环风机1906_consume_unit
: "/";
arr[10] =
item.系统风机_consume_unit != null
? item.系统风机_consume_unit
: "/";
arr[11] =
item.水平涡流选粉机1915_consume_unit != null
? item.水平涡流选粉机1915_consume_unit
: "/";
// arr[12]=item._consume_unit!=null?item._consume_unit:'/';
// arr[13]=item.elec_consume_unit//KW·h/t
let keyVale ='goal_val_'+n;
let keyVale = "goal_val_" + n;
arr[12] = goalData[keyVale]; //KW·h/t//
arr[13] = arr[12] - item.celec_consume_unit; //KW·h/t
let ind_pre = 0,huanqi = 0,huanqicha=0,tongqi=0,tongqicha=0;
let ind_pre = 0,
huanqi = 0,
huanqicha = 0,
tongqi = 0,
tongqicha = 0;
if (n == 1) {
ind_pre = 12;
huanqi = wrapArr0[ind_pre]?wrapArr0[ind_pre].elec_consume_unit:'/';
huanqi = wrapArr0[ind_pre]
? wrapArr0[ind_pre].elec_consume_unit
: "/";
} else {
ind_pre = n - 1;
huanqi = wrapArr[ind_pre]?wrapArr[ind_pre].elec_consume_unit?wrapArr[ind_pre].elec_consume_unit:'/':'/'
huanqi = wrapArr[ind_pre]
? wrapArr[ind_pre].elec_consume_unit
? wrapArr[ind_pre].elec_consume_unit
: "/"
: "/";
}
arr[14] = huanqi; //KW·h/t
if(huanqi!=='/'){
if (huanqi !== "/") {
huanqicha = item.celec_consume_unit - huanqi;
} else {
huanqicha = item.celec_consume_unit
huanqicha = item.celec_consume_unit;
}
arr[15] = huanqicha; //KW·h/t
arr[16]=huanqi!='/'? huanqicha/huanqi*100:0;//%
arr[16] =
huanqi != "/" ? (huanqicha / huanqi) * 100 : 0; //%
if (wrapArr0[n]) {
tongqicha = item.celec_consume_unit-wrapArr0[n].celec_consume_unit;
tongqicha =
item.celec_consume_unit -
wrapArr0[n].celec_consume_unit;
tongqi = tongqicha / tongqi;
} else {
tongqicha = item.celec_consume_unit;
@ -198,22 +250,23 @@
}
arr[17] = tongqi; //%:-/
arr[18]=0.00;//%
arr[18] = 0.0; //%
wrapArr[ind] = arr;
});
let newArr = [];
for (let i = 0; i < wrapArr.length; i++) {
let item = wrapArr[i];
console.log(item);
if (item==undefined) {}else{
newArr.push(wrapArr[i])
if (item == undefined) {
} else {
newArr.push(wrapArr[i]);
}
}
that.tableDatas = newArr;
} else {
}
})
})
});
});
},
handleQuery() {
this.tableDatas = [];
@ -225,24 +278,22 @@
},
itemClick1(type, item) {
this.chartShow = false;
this.$API.bi.dataset.exec
.req('3322567213885833216')
.then((res) => {
this.$API.bi.dataset.exec.req("3322567213885833216").then((res) => {
this.myOption = JSON.parse(res.echart_options);
// debugger;
console.log(this.myOption)
console.log(this.myOption);
this.chartShow = true;
});
},
handlePrint() {
this.$PRINT('#myReport');
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX('#myTable', this.tableName)
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
}
},
};
</script>
<style scoped>

View File

@ -34,20 +34,26 @@
:loading="exportLoading"
>导出xlsx
</el-button>
<el-button
type="primary"
@click="handlePrint"
>打印
</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="1075" cellspacing="0" :key="0" id="myTable" class="myTable" v-if="query.type==1">
<table
border="1"
width="1075"
cellspacing="0"
:key="0"
id="myTable"
class="myTable"
v-if="query.type == 1"
>
<thead class="myTableHead">
<tr>
<th colspan="9">水泥磨工段车间单位产品电耗月度分析表</th>
<th colspan="9">
水泥磨工段车间单位产品电耗月度分析表
</th>
</tr>
<tr>
<th rowspan="2">月份</th>
@ -66,20 +72,38 @@
</thead>
<tbody>
<tr v-for="item in tableDatas" :key="item">
<td v-for="(item1,ind) in item" :key="ind" class="numCell">
<td
v-for="(item1, ind) in item"
:key="ind"
class="numCell"
>
<div :class="bindClass(item1, ind)">
<span v-if="item1<0&&ind==6"></span>
<span v-if="item1<0&&ind==6"></span>
<span v-if="item1 < 0 && ind == 6"
></span
>
<span v-if="item1 < 0 && ind == 6"
></span
>
{{ item1 }}
</div>
</td>
</tr>
</tbody>
</table>
<table border="1" width="1075" cellspacing="0" :key="1" id="myTable1" class="myTable" v-else>
<table
border="1"
width="1075"
cellspacing="0"
:key="1"
id="myTable1"
class="myTable"
v-else
>
<thead class="myTableHead">
<tr>
<th colspan="9">水泥磨工段车间单位产品综合能耗月度分析表</th>
<th colspan="9">
水泥磨工段车间单位产品综合能耗月度分析表
</th>
</tr>
<tr>
<th rowspan="2">月份</th>
@ -98,10 +122,18 @@
</thead>
<tbody>
<tr v-for="item in tableDatas2" :key="item">
<td v-for="(item1,ind) in item" :key="ind" class="numCell">
<td
v-for="(item1, ind) in item"
:key="ind"
class="numCell"
>
<div :class="bindClass(item1, ind)">
<span v-if="item1<0&&ind==6"></span>
<span v-if="item1<0&&ind==6"></span>
<span v-if="item1 < 0 && ind == 6"
></span
>
<span v-if="item1 < 0 && ind == 6"
></span
>
{{ item1 }}
</div>
</td>
@ -115,36 +147,44 @@
</template>
<script>
import scEcharts from "@/components/scEcharts";
import { defineAsyncComponent } from 'vue'
import { defineAsyncComponent } from "vue";
export default {
components: {
scEcharts,
charts: defineAsyncComponent(() => import("@/components/scEnm/lineChartsdialog.vue")),
charts: defineAsyncComponent(() =>
import("@/components/scEnm/lineChartsdialog.vue")
),
},
data() {
return {
exportLoading: false,
chartShow: false,
myOption: null,
query: {
type: 1,
year_s:'',
mgroup:'3347217651339837440',
year_s: "",
mgroup: "",
},
monthGoal: [],
monthGoal2: [],
tableDatas: [],
tableDatas2: [],
options:[{
name:'电耗',id:1,
},{
name:'综合能耗',id:2,
}],
options: [
{
name: "电耗",
id: 1,
},
{
name: "综合能耗",
id: 2,
},
],
modelValue: true,
type:'hours',
title:'title',
apiObj:'',
type: "hours",
title: "title",
apiObj: "",
showClose: true,
echartType:'line',
echartType: "line",
asynDialog: false,
};
},
@ -153,15 +193,46 @@
var myDate = new Date();
let year = myDate.getFullYear();
that.query.year_s = year;
that.timeStamp = myDate.getTime();
this.$API.mtm.mgroup.list
.req({ page: 0, search: "水泥磨" })
.then((res) => {
console.log("水泥磨", res);
that.query.mgroup = res[0].id;
//
this.getMonthGoal();
});
},
methods: {
// Class
bindClass(item, index) {
let classInfo = { redColor: false, greenColor: false };
if (index == 6) {
if (typeof item == "number") {
if (item > 0) {
classInfo.greenColor = true;
classInfo.redColor = false;
} else if (item < 0) {
classInfo.redColor = true;
classInfo.greenColor = false;
}
}
}
return classInfo;
},
//
getMonthGoal() {
let that = this;
let paramsGoal = {};
paramsGoal.page = 0;
paramsGoal.mgroup = that.query.mgroup;
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => {
if (ress.length > 0) {
let monthGoal = [];
ress.forEach(goal=>{
if(goal.goal_cate_name=='单位产品分布电耗KW·h/t'){
ress.forEach((goal) => {
if (
goal.goal_cate_name == "单位产品分布电耗KW·h/t"
) {
monthGoal[0] = goal.goal_val;
monthGoal[1] = goal.goal_val_2;
monthGoal[2] = goal.goal_val_3;
@ -177,7 +248,9 @@
monthGoal[12] = goal.goal_val_12;
that.monthGoal = monthGoal;
}
if(goal.goal_cate_name=='单位产品综合能耗kgce/t'){
if (
goal.goal_cate_name == "单位产品综合能耗kgce/t"
) {
monthGoal2[0] = goal.goal_val;
monthGoal2[1] = goal.goal_val_2;
monthGoal2[2] = goal.goal_val_3;
@ -193,42 +266,28 @@
monthGoal2[12] = goal.goal_val_12;
that.monthGoal2 = monthGoal2;
}
})
});
this.getData();
} else {
this.getData();
}
})
},
methods: {
// Class
bindClass(item,index){
let classInfo = { redColor: false, greenColor: false }
if(index==6){
if( typeof(item)=='number'){
if(item>0){
classInfo.greenColor = true;
classInfo.redColor = false;
}else if(item<0){
classInfo.redColor = true;
classInfo.greenColor = false
}
}
}
return classInfo
});
},
getData() {
let that = this;
let query0 = {};
query0.page = 0;
query0.type='month_s';
query0.type = "month_s";
query0.year_s = that.query.year_s - 1;
query0.mgroup = that.query.mgroup;
let wrapArr = [],wrapArr0 = [] ,wrapArrs = [],wrapArrs2 = [];
let wrapArr = [],
wrapArr0 = [],
wrapArrs = [],
wrapArrs2 = [];
this.$API.enm.enstat.req(query0).then((res0) => {
let data0 = res0;
if (data0.length > 0) {
data0.forEach(item0 => {
data0.forEach((item0) => {
//
let ind0 = item0.month_s;
wrapArr0[ind0] = item0;
@ -236,25 +295,29 @@
}
let query = {};
query.page = 0;
query.type='month_s';
query.type = "month_s";
query.year_s = that.query.year_s;
query.mgroup = that.query.mgroup;
that.$API.enm.enstat.req(query).then((res) => {
let data = res;
if (data.length > 0) {
data.forEach(item => {
data.forEach((item) => {
//
let ind = item.month_s;
let arr = [];
let time = ''+item.year_s+'.'+item.month_s;
let time = "" + item.year_s + "." + item.month_s;
arr.push(time);
arr.push(item.elec_consume_unit); //KW·h/t
arr[2] = that.monthGoal[ind]!==undefined?that.monthGoal[ind]:'/';
arr[2] =
that.monthGoal[ind] !== undefined
? that.monthGoal[ind]
: "/";
wrapArr[ind] = arr;
});
wrapArr.forEach((item, index) => {
let ind = item.month_s;
let arrs = [],arrs2=[];
let arrs = [],
arrs2 = [];
arrs[0] = item[0];
arrs[1] = item[1];
arrs[2] = item[2];
@ -262,115 +325,144 @@
arrs[4] = 29;
arrs[5] = 34;
//KW·h/t
let lastNum = 0,lastDiff = 0;
let lastNum = 0,
lastDiff = 0;
if (index > 1) {
let num = index - 1;
if(wrapArr[num]&&wrapArr[num].elec_consume_unit){
if (
wrapArr[num] &&
wrapArr[num].elec_consume_unit
) {
lastNum = wrapArr[num].elec_consume_unit;
} else {
lastNum='/'
lastNum = "/";
}
} else {
lastNum = wrapArr0[12]?wrapArr0[12].elec_consume_unit:'/';
lastNum = wrapArr0[12]
? wrapArr0[12].elec_consume_unit
: "/";
}
if(arrs[1]!=='/'&&lastNum!=='/'){
if (arrs[1] !== "/" && lastNum !== "/") {
lastDiff = arrs[1] - lastNum;
} else {
lastDiff = '/';
lastDiff = "/";
}
arrs[6] = lastDiff;
//%
let lastRate = 0;
if(lastDiff=='/'&&lastNum!=='/'&&lastNum!==0){
if (
lastDiff == "/" &&
lastNum !== "/" &&
lastNum !== 0
) {
lastRate = (lastDiff / lastNum) * 100;
} else {
lastRate = '/'
lastRate = "/";
}
arrs[7] = lastRate;
//%-wrapArr0[ind].elec_consume_unit
let sameRate = 0;
if(wrapArr0[index]&&wrapArr0[index].elec_consume_unit){
sameRate =((arrs[1]- wrapArr0[index].elec_consume_unit)/wrapArr0[index].elec_consume_unit)*100
if (
wrapArr0[index] &&
wrapArr0[index].elec_consume_unit
) {
sameRate =
((arrs[1] -
wrapArr0[index].elec_consume_unit) /
wrapArr0[index].elec_consume_unit) *
100;
} else {
sameRate='/';
sameRate = "/";
}
arrs[8] = sameRate;
wrapArrs.push(arrs);
arrs2[0] = item[0];
arrs2[1] = item.cen_consume_unit;
arrs2[2]=that.monthGoal2[ind]!==undefined?that.monthGoal2[ind]:'/';
arrs2[2] =
that.monthGoal2[ind] !== undefined
? that.monthGoal2[ind]
: "/";
arrs2[3] = 80;
arrs2[4] = 87;
arrs2[5] = 94;
//KW·h/t
let lastNum2 = 0,lastDiff2 = 0;
let lastNum2 = 0,
lastDiff2 = 0;
if (index > 1) {
let num = index - 1;
if(wrapArr[num]&&wrapArr[num].cen_consume_unit){
if (
wrapArr[num] &&
wrapArr[num].cen_consume_unit
) {
lastNum2 = wrapArr[num].cen_consume_unit;
} else {
lastNum2='/'
lastNum2 = "/";
}
} else {
lastNum2 = wrapArr0[12]?wrapArr0[12].cen_consume_unit:'/';
lastNum2 = wrapArr0[12]
? wrapArr0[12].cen_consume_unit
: "/";
}
if(arrs2[1]!=='/'&&lastNum2!=='/'){
if (arrs2[1] !== "/" && lastNum2 !== "/") {
lastDiff2 = arrs2[1] - lastNum2;
} else {
lastDiff2 = '/';
lastDiff2 = "/";
}
arrs2[6] = lastDiff2;
//%
let lastRate2 = 0;
if(lastDiff2=='/'&&lastNum2!=='/'&&lastNum2!==0){
if (
lastDiff2 == "/" &&
lastNum2 !== "/" &&
lastNum2 !== 0
) {
lastRate2 = (lastDiff2 / lastNum2) * 100;
} else {
lastRate2 = '/'
lastRate2 = "/";
}
arrs2[7] = lastRate2;
//%-wrapArr0[ind].elec_consume_unit
let sameRate2 = 0;
if(wrapArr0[index]&&wrapArr0[index].cen_consume_unit){
sameRate2 =((arrs[1]- wrapArr0[index].cen_consume_unit)/wrapArr0[index].cen_consume_unit)*100
if (
wrapArr0[index] &&
wrapArr0[index].cen_consume_unit
) {
sameRate2 =
((arrs[1] -
wrapArr0[index].cen_consume_unit) /
wrapArr0[index].cen_consume_unit) *
100;
} else {
sameRate2='/';
sameRate2 = "/";
}
arrs2[8] = sameRate2;
wrapArrs2.push(arrs2);
})
});
that.tableDatas = wrapArrs;
that.tableDatas2 = wrapArrs2;
} else {
}
})
})
});
});
},
itemClick(type, item) {
this.type = type;
this.asynDialog = true;
},
itemClick1(type,item){
this.chartShow = false;
this.$API.bi.dataset.exec
.req('3322567213885833216')
.then((res) => {
this.myOption = JSON.parse(res.echart_options);
debugger;
console.log(this.myOption)
this.chartShow = true;
});
handleQuery() {
this.getMonthGoal();
},
typeCange() {},
handlePrint() {
this.$PRINT('#myReport');
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX('#myTable', this.tableName)
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
}
},
};
</script>
<style scoped>
</style>
<style scoped></style>