fix:煤磨mgroup通过名称获取

This commit is contained in:
shijing 2024-04-26 10:28:08 +08:00
parent 939129b5df
commit ffc08a38de
6 changed files with 1053 additions and 795 deletions

View File

@ -1,257 +1,397 @@
<template> <template>
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<div style="margin-right: 20px">交接班日志</div> <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" <el-date-picker
placeholder="开始时间" style=" width: 120px" /> v-model="query.start_time__gte"
<el-date-picker v-model="query.end_time__lt" type="date" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD" type="date"
placeholder="结束时间" style="margin-left: 2px; width: 120px" /> value-format="YYYY-MM-DD HH:mm:ss"
<el-select v-model="query.shift" placeholder="班次" clearable style="margin-left: 2px; width: 120px"> format="YYYY-MM-DD"
<el-option v-for="item in optionsShift" :key="item.id" :label="item.name" :value="item.id"></el-option> placeholder="开始时间"
</el-select> style="width: 120px"
<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-date-picker
</el-select> v-model="query.end_time__lt"
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button> type="date"
</div> value-format="YYYY-MM-DD HH:mm:ss"
</el-header> format="YYYY-MM-DD"
<el-main class="nopadding"> placeholder="结束时间"
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="query" highlightCurrentRow @row-click="rowClick"> style="margin-left: 2px; width: 120px"
<el-table-column type="index" width="50" /> />
<el-table-column label="开始时间" prop="start_time"> <el-select
<template #default="scope"> v-model="query.shift"
<span>{{ scope.row.start_time.slice(0, 16) }}</span> placeholder="班次"
</template> clearable
</el-table-column> style="margin-left: 2px; width: 120px"
<el-table-column label="结束时间" prop="end_time"> >
<template #default="scope"> <el-option
<span>{{ scope.row.end_time.slice(0, 16) }}</span> v-for="item in optionsShift"
</template> :key="item.id"
</el-table-column> :label="item.name"
<el-table-column label="班组名称" prop="team_name"></el-table-column> :value="item.id"
<el-table-column label="当前班次" prop="shift_name"></el-table-column> ></el-option>
<el-table-column label="班长" prop="leader_name"></el-table-column> </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>
<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"
>
<el-table-column type="index" width="50" />
<el-table-column label="开始时间" prop="start_time">
<template #default="scope">
<span>{{ scope.row.start_time.slice(0, 16) }}</span>
</template>
</el-table-column>
<el-table-column label="结束时间" prop="end_time">
<template #default="scope">
<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="检验时间"> <el-table-column label="检验时间">
<template #default="scope"> <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">{{
</template> scope.row.last_test_time.slice(0, 16)
</el-table-column> }}</span>
<el-table-column label="操作" fixed="right" align="center" width="140"> </template>
<template #default="scope"> </el-table-column>
<el-button link size="small" @click="sflog_edit(scope.row)" type="primary">编辑</el-button> <el-table-column
<!-- <el-button link size="small" @click="sflog_check(scope.row)" type="primary">质量检验</el-button> --> label="操作"
<!-- <el-button link size="small" @click="sflog_other(scope.row)" type="primary">其他能源</el-button> --> fixed="right"
<el-divider direction="vertical"></el-divider> align="center"
<el-button link size="small" @click="sflog_export(scope.row)" type="success">报表</el-button> width="140"
</template> >
</el-table-column> <template #default="scope">
</scTable> <el-button
</el-main> link
<el-drawer v-model="limitedExport" size="60%" :show-close="false"> size="small"
<template #header="{ close, titleId, titleClass }"> @click="sflog_edit(scope.row)"
<h4 :id="titleId" :class="titleClass">交接班日志</h4> type="primary"
<el-button type="danger" @click="close"> >编辑</el-button
<el-icon class="el-icon--left"> >
<CircleCloseFilled /> <!-- <el-button link size="small" @click="sflog_check(scope.row)" type="primary">质量检验</el-button> -->
</el-icon> <!-- <el-button link size="small" @click="sflog_other(scope.row)" type="primary">其他能源</el-button> -->
关闭 <el-divider direction="vertical"></el-divider>
</el-button> <el-button
</template> link
<div class="left-panel"> size="small"
<el-button type="primary" @click="exportExcel()" :loading="exportLoading">导出xlsx @click="sflog_export(scope.row)"
</el-button> type="success"
<el-button type="primary" @click="handlePrint">打印 >报表</el-button
</el-button> >
</div> </template>
<el-main class="nopadding"> </el-table-column>
<div ref="print" id="myReport" class="printContainer"> </scTable>
<div style="margin-right: 20px;text-align: center;font-size: 16px;font-weight: bold;margin-bottom: 20px;"> </el-main>
<span v-if="sflogItem.end_time">{{ sflogItem.end_time.slice(0, 10) }}{{ sflogItem.shift_name }}</span> <el-drawer v-model="limitedExport" size="60%" :show-close="false">
<span v-if="sflogItem.team_name">{{ sflogItem.team_name }}</span> <template #header="{ close, titleId, titleClass }">
交接班记录 <h4 :id="titleId" :class="titleClass">交接班日志</h4>
</div> <el-button type="danger" @click="close">
<table border="1" width="1000" cellspacing="0" :key="timeStamp" id="myTable"> <el-icon class="el-icon--left">
<tbody> <CircleCloseFilled />
<tr> </el-icon>
<td class="numCell">日期</td> 关闭
<td class="numCell" v-if="sflogItem.end_time">{{ sflogItem.end_time.slice(0, 10) }}</td> </el-button>
<td class="numCell">班次</td> </template>
<td class="numCell">{{ sflogItem.shift_name }}</td> <div class="left-panel">
<td class="numCell">班组</td> <el-button
<td class="numCell"><span v-if="sflogItem.team_name">{{ sflogItem.team_name }}</span></td> type="primary"
</tr> @click="exportExcel()"
<tr> :loading="exportLoading"
<td class="numCell">产量t</td> >导出xlsx
<td class="numCell">{{ reportItem.total_production }}</td> </el-button>
<td class="numCell">台时t/h</td> <el-button type="primary" @click="handlePrint">打印 </el-button>
<td class="numCell">{{ reportItem.production_hour }}</td> </div>
<td class="numCell">运转时间h</td> <el-main class="nopadding">
<td class="numCell">{{ reportItem.run_hour }}</td> <div ref="print" id="myReport" class="printContainer">
</tr> <div
<tr> style="
<td class="numCell">运转率%</td> margin-right: 20px;
<td class="numCell">{{ reportItem.run_rate * 100 }}</td> text-align: center;
<td class="numCell">停机时长h</td> font-size: 16px;
<td class="numCell">{{ reportItem.shut_hour }}</td> font-weight: bold;
<td class="numCell">煤磨分布电耗KW·h/t</td> margin-bottom: 20px;
<td class="numCell">{{ reportItem.elec_consume_unit }}</td> "
</tr> >
<tr> <span v-if="sflogItem.end_time"
<td class="numCell">煤粉细度合格率%</td> >{{ sflogItem.end_time.slice(0, 10)
<td class="numCell" v-if="reportItem.煤粉_细度_rate_pass">{{ reportItem.煤粉_细度_rate_pass * 100 }}</td> }}{{ sflogItem.shift_name }}</span
<td class="numCell" v-else>0</td> >
<td class="numCell">煤粉水分合格率%</td> <span v-if="sflogItem.team_name">{{
<td class="numCell" v-if="reportItem.煤粉_水分_rate_pass">{{ reportItem.煤粉_水分_rate_pass * 100 }}</td> sflogItem.team_name
<td class="numCell" v-else>0</td> }}</span>
</tr> 交接班记录
<tr v-if="sflogexpList.length > 0"> </div>
<td class="numCell" :rowspan="sflogexpList.length + 1">生产情况记录</td> <table
<td class="numCell">时间</td> border="1"
<td class="numCell">类别</td> width="1000"
<td class="numCell">原因</td> cellspacing="0"
<td class="numCell">处置措施</td> :key="timeStamp"
<td class="numCell">处置人</td> id="myTable"
</tr> >
<tr v-for="item in sflogexpList" :key="item.id"> <tbody>
<td class="numCell">{{ item.happen_time }}</td> <tr>
<td class="numCell">{{ item.cate }}</td> <td class="numCell">日期</td>
<td class="numCell">{{ item.reason }}</td> <td class="numCell" v-if="sflogItem.end_time">
<td class="numCell">{{ item.measure }}</td> {{ sflogItem.end_time.slice(0, 10) }}
<td class="numCell">{{ item.handler }}</td> </td>
</tr> <td class="numCell">班次</td>
</tbody> <td class="numCell">
</table> {{ sflogItem.shift_name }}
</div> </td>
</el-main> <td class="numCell">班组</td>
</el-drawer> <td class="numCell">
</el-container> <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">台时t/h</td>
<td class="numCell">
{{ reportItem.production_hour }}
</td>
<td class="numCell">运转时间h</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">停机时长h</td>
<td class="numCell">
{{ reportItem.shut_hour }}
</td>
<td class="numCell">煤磨分布电耗KW·h/t</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-else>0</td>
<td class="numCell">煤粉水分合格率%</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">时间</td>
<td class="numCell">类别</td>
<td class="numCell">原因</td>
<td class="numCell">处置措施</td>
<td class="numCell">处置人</td>
</tr>
<tr v-for="item in sflogexpList" :key="item.id">
<td class="numCell">{{ item.happen_time }}</td>
<td class="numCell">{{ item.cate }}</td>
<td class="numCell">{{ item.reason }}</td>
<td class="numCell">{{ item.measure }}</td>
<td class="numCell">{{ item.handler }}</td>
</tr>
</tbody>
</table>
</div>
</el-main>
</el-drawer>
</el-container>
</template> </template>
<script> <script>
export default { export default {
name: "sflog", name: "sflog",
data() { data() {
return { return {
apiObj: this.$API.wpm.sflog.list, apiObj: null,
apiObj2: null, apiObj2: null,
query: { query: {
shift: '', shift: "",
team: '', team: "",
end_time__lt: '', end_time__lt: "",
start_time__gte: '', start_time__gte: "",
mgroup: '3347217512021835776', mgroup: "",
}, },
deptId: '3347207082608115712', deptId: "",
sflogItem: {}, sflogItem: {},
options: [], options: [],
optionsShift: [], optionsShift: [],
limitedExport: false, limitedExport: false,
reportItem: {}, reportItem: {},
sflogexpList: [], sflogexpList: [],
}; };
}, },
mounted() { mounted() {
this.getTeam(); this.$API.mtm.mgroup.list
this.getShfit(); .req({ page: 0, search: "煤磨" })
}, .then((res) => {
methods: { console.log("煤磨", res);
getTeam() { this.query.mgroup = res[0].id;
let form = {}; this.apiObj = this.$API.wpm.sflog.list;
form.page = 0; this.deptId = res[0].belong_dept;
form.belong_dept = this.deptId; this.getTeam();
this.$API.mtm.team.list.req(form).then(res => { this.getShfit();
this.options = res; });
}) },
}, methods: {
getShfit() { getTeam() {
this.$API.mtm.shift.list.req({ page: 0 }).then(res => { let form = {};
this.optionsShift = res; form.page = 0;
}) form.belong_dept = this.deptId;
}, this.$API.mtm.team.list.req(form).then((res) => {
handleQuery() { this.options = res;
this.$refs.table.queryData(this.query); });
}, },
sflog_export() { getShfit() {
this.limitedExport = true; this.$API.mtm.shift.list.req({ page: 0 }).then((res) => {
}, this.optionsShift = res;
rowClick(row) { });
this.sflogId = row.id; },
this.sflogItem = row; handleQuery() {
this.getSflogItem(row.id); this.$refs.table.queryData(this.query);
this.getSflogexp(row.id); },
}, sflog_export() {
getSflogexp(id) { this.limitedExport = true;
let that = this; },
that.$API.wpm.sflogexp.list.req({ page: 0, sflog: id }).then(res => { rowClick(row) {
that.sflogexpList = res; this.sflogId = row.id;
}) this.sflogItem = row;
}, this.getSflogItem(row.id);
getSflogItem(id) { this.getSflogexp(row.id);
let that = this; },
that.$API.enm.enstat.req({ type: 'sflog', sflog: id, page: 0 }).then(res => { getSflogexp(id) {
if (res.length > 0) { let that = this;
that.reportItem = res[0]; that.$API.wpm.sflogexp.list
} .req({ page: 0, sflog: id })
console.log(res[0]) .then((res) => {
}) that.sflogexpList = res;
}, });
// },
sflog_edit(row) { getSflogItem(id) {
let jsonStr = JSON.stringify(row); let that = this;
this.$TOOL.data.remove("sflogItem") that.$API.enm.enstat
this.$TOOL.data.set('sflogItem', jsonStr) .req({ type: "sflog", sflog: id, page: 0 })
this.$router.push({ .then((res) => {
name: "logDetail", if (res.length > 0) {
query: { that.reportItem = res[0];
mgroupId: row.mgroup, }
deptId: this.deptId console.log(res[0]);
}, });
}); },
}, //
handlePrint() { sflog_edit(row) {
this.$PRINT('#myReport'); let jsonStr = JSON.stringify(row);
}, this.$TOOL.data.remove("sflogItem");
exportExcel() { this.$TOOL.data.set("sflogItem", jsonStr);
this.exportLoading = true; this.$router.push({
this.$XLSX('#myTable', this.tableName) name: "logDetail",
this.exportLoading = false; query: {
}, mgroupId: row.mgroup,
}, deptId: this.deptId,
},
});
},
handlePrint() {
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
},
}; };
</script> </script>
<style scoped> <style scoped>
#numTable { #numTable {
margin-left: 37px; margin-left: 37px;
} }
#numTable td { #numTable td {
height: 32px; height: 32px;
padding-left: 5px; padding-left: 5px;
} }
.numCell { .numCell {
width: 80px; width: 80px;
} }
.numCell.numCell_last { .numCell.numCell_last {
width: 100px; width: 100px;
} }
.searchHead { .searchHead {
display: flex display: flex;
} }
.middleText { .middleText {
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
margin: 0 5px; margin: 0 5px;
display: inline-block; display: inline-block;
} }
.searchBtn { .searchBtn {
margin-left: 5px; margin-left: 5px;
} }
</style> </style>

View File

@ -86,7 +86,7 @@ export default {
year_s: "", year_s: "",
page: 0, page: 0,
type: "month_st", type: "month_st",
mgroup: "3347217512021835776", mgroup: "",
}, },
tableDatas: [], tableDatas: [],
}; };
@ -96,16 +96,35 @@ export default {
var myDate = new Date(); var myDate = new Date();
let year = myDate.getFullYear(); let year = myDate.getFullYear();
that.query.year_s = year; that.query.year_s = year;
let params = {}; //
params.page = 0; let paramsGoal = {};
params.year = year; paramsGoal.page = 0;
params.mgroup = that.query.mgroup; paramsGoal.mgroup = that.query.mgroup;
this.$API.mtm.goal.list.req(params).then((res) => { that.$API.mtm.goal.list.req(paramsGoal).then((ress) => {
let data = []; if (ress.length > 0) {
if (res.length > 0) { let monthGoal = [];
data = res[0]; 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;
monthGoal[3] = goal.goal_val_4;
monthGoal[4] = goal.goal_val_5;
monthGoal[5] = goal.goal_val_6;
monthGoal[6] = goal.goal_val_7;
monthGoal[7] = goal.goal_val_8;
monthGoal[8] = goal.goal_val_9;
monthGoal[9] = goal.goal_val_10;
monthGoal[10] = goal.goal_val_11;
monthGoal[11] = goal.goal_val_12;
monthGoal[12] = goal.goal_val_12;
that.monthGoal = monthGoal;
}
});
this.getData();
} else {
this.getData();
} }
that.getData(data);
}); });
}, },
methods: { methods: {

View File

@ -1,275 +1,313 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-date-picker <el-date-picker
v-model="query.year_s" v-model="query.year_s"
type="year" type="year"
value-format="YYYY" value-format="YYYY"
format="YYYY" format="YYYY"
placeholder="查询年份" placeholder="查询年份"
class="headerSearch" class="headerSearch"
/> />
<el-button <el-button
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
@click="handleQuery" @click="handleQuery"
></el-button> ></el-button>
<el-button <el-button
type="primary" type="primary"
@click="exportExcel()" @click="exportExcel()"
:loading = "exportLoading" :loading="exportLoading"
>导出xlsx >导出xlsx
</el-button> </el-button>
<el-button <el-button type="primary" @click="handlePrint">打印 </el-button>
type="primary" </div>
@click="handlePrint" </el-header>
>打印 <el-card style="margin-top: 5px">
</el-button> <div class="printWrap">
</div> <div ref="print" id="myReport" class="printContainer">
</el-header> <table
<el-card style="margin-top:5px"> border="1"
<div class="printWrap"> width="1075"
<div ref="print" id="myReport" class="printContainer"> cellspacing="0"
<table border="1" width="1075" cellspacing="0" :key="timeStamp" id="myTable" class="myTable"> :key="timeStamp"
<thead class="myTableHead"> id="myTable"
<tr> class="myTable"
<th colspan="8">煤磨工段车间单位产品电耗月度分析表</th> >
</tr> <thead class="myTableHead">
<tr> <tr>
<th>月份</th> <th colspan="8">
<th>当期值KW·h/t</th> 煤磨工段车间单位产品电耗月度分析表
<th>目标值KW·h/t</th> </th>
<th>当期与目标差值KW·h/t</th> </tr>
<th>环期值KW·h/t</th> <tr>
<th>当期与环期差值KW·h/t</th> <th>月份</th>
<th>环比增长率%</th> <th>当期值KW·h/t</th>
<th>同比增长率%</th> <th>目标值KW·h/t</th>
</tr> <th>当期与目标差值KW·h/t</th>
</thead> <th>环期值KW·h/t</th>
<tbody> <th>当期与环期差值KW·h/t</th>
<tr v-for="item in tableDatas" :key="item"> <th>环比增长率%</th>
<td v-for="(item1,ind) in item" :key="ind" class="numCell"> <th>同比增长率%</th>
<div :class="bindClass(item1,ind)"> </tr>
<span v-if="item1>0&&ind==3"></span> </thead>
<span v-if="item1<0&&ind==3"></span> <tbody>
<span v-if="item1<0&&ind==5"></span> <tr v-for="item in tableDatas" :key="item">
<span v-if="item1<0&&ind==5"></span> <td
{{item1}} v-for="(item1, ind) in item"
</div> :key="ind"
</td> class="numCell"
</tr> >
</tbody> <div :class="bindClass(item1, ind)">
</table> <span v-if="item1 > 0 && ind == 3"
</div> ></span
</div> >
</el-card> <span v-if="item1 < 0 && ind == 3"
</div> ></span
</template> >
<span v-if="item1 < 0 && ind == 5"
></span
>
<span v-if="item1 < 0 && ind == 5"
></span
>
{{ item1 }}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</el-card>
</div>
</template>
<script> <script>
import scEcharts from "@/components/scEcharts"; import scEcharts from "@/components/scEcharts";
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from "vue";
export default { export default {
components: { components: {
scEcharts, scEcharts,
charts: defineAsyncComponent(() => import("@/components/scEnm/lineChartsdialog.vue")), charts: defineAsyncComponent(() =>
}, import("@/components/scEnm/lineChartsdialog.vue")
data() { ),
return { },
chartShow: false, data() {
myOption: null, return {
query:{ chartShow: false,
year_s:'', myOption: null,
mgroup:'3347217512021835776', query: {
}, year_s: "",
monthGoal:[], mgroup: "",
tableDatas:[], },
modelValue:true, monthGoal: [],
type:'hours', tableDatas: [],
title:'title', modelValue: true,
apiObj:'', type: "hours",
showClose:true, title: "title",
echartType:'line', apiObj: "",
asynDialog:false, showClose: true,
}; echartType: "line",
}, asynDialog: false,
mounted() { };
let that = this; },
var myDate = new Date(); mounted() {
let year = myDate.getFullYear(); let that = this;
that.query.year_s = year; var myDate = new Date();
// let year = myDate.getFullYear();
let paramsGoal = {}; that.query.year_s = year;
paramsGoal.page=0; //
paramsGoal.mgroup=that.query.mgroup; let paramsGoal = {};
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => { paramsGoal.page = 0;
if(ress.length>0){ paramsGoal.mgroup = that.query.mgroup;
let monthGoal = []; that.$API.mtm.goal.list.req(paramsGoal).then((ress) => {
ress.forEach(goal=>{ if (ress.length > 0) {
if(goal.goal_cate_name=='单位产品分布电耗KW·h/t'){ let monthGoal = [];
monthGoal[0]=goal.goal_val; ress.forEach((goal) => {
monthGoal[1]=goal.goal_val_2; if (goal.goal_cate_name == "单位产品分布电耗KW·h/t") {
monthGoal[2]=goal.goal_val_3; monthGoal[0] = goal.goal_val;
monthGoal[3]=goal.goal_val_4; monthGoal[1] = goal.goal_val_2;
monthGoal[4]=goal.goal_val_5; monthGoal[2] = goal.goal_val_3;
monthGoal[5]=goal.goal_val_6; monthGoal[3] = goal.goal_val_4;
monthGoal[6]=goal.goal_val_7; monthGoal[4] = goal.goal_val_5;
monthGoal[7]=goal.goal_val_8; monthGoal[5] = goal.goal_val_6;
monthGoal[8]=goal.goal_val_9; monthGoal[6] = goal.goal_val_7;
monthGoal[9]=goal.goal_val_10; monthGoal[7] = goal.goal_val_8;
monthGoal[10]=goal.goal_val_11; monthGoal[8] = goal.goal_val_9;
monthGoal[11]=goal.goal_val_12; monthGoal[9] = goal.goal_val_10;
monthGoal[12]=goal.goal_val_12; monthGoal[10] = goal.goal_val_11;
that.monthGoal = monthGoal; monthGoal[11] = goal.goal_val_12;
} monthGoal[12] = goal.goal_val_12;
}) that.monthGoal = monthGoal;
this.getData(); }
}else{ });
this.getData(); this.getData();
} } else {
}) this.getData();
}, }
methods: { });
// Class },
bindClass(item,index){ methods: {
let classInfo = { redColor: false, greenColor: false } // Class
if(index==3||index==5){ bindClass(item, index) {
if( typeof(item)=='number'){ let classInfo = { redColor: false, greenColor: false };
if(item>0){ if (index == 3 || index == 5) {
classInfo.greenColor = true; if (typeof item == "number") {
classInfo.redColor = false; if (item > 0) {
}else if(item<0){ classInfo.greenColor = true;
classInfo.redColor = true; classInfo.redColor = false;
classInfo.greenColor = false } else if (item < 0) {
} classInfo.redColor = true;
} classInfo.greenColor = false;
} }
return classInfo }
}, }
getData(){ return classInfo;
let that = this; },
let query0={}; getData() {
query0.page = 0; let that = this;
query0.type='month_s'; let query0 = {};
query0.year_s = that.query.year_s-1; query0.page = 0;
query0.mgroup=that.query.mgroup; query0.type = "month_s";
let wrapArr = [],wrapArr0 = [] ,wrapArrs = []; query0.year_s = that.query.year_s - 1;
this.$API.enm.enstat.req(query0).then((res0) => { query0.mgroup = that.query.mgroup;
let data0 = res0; let wrapArr = [],
if(data0.length>0){ wrapArr0 = [],
data0.forEach(item0 => { wrapArrs = [];
// this.$API.enm.enstat.req(query0).then((res0) => {
let ind0 = item0.month_s; let data0 = res0;
wrapArr0[ind0] = item0; if (data0.length > 0) {
}); data0.forEach((item0) => {
} //
let query={}; let ind0 = item0.month_s;
query.page = 0; wrapArr0[ind0] = item0;
query.type='month_s'; });
query.year_s = that.query.year_s; }
query.mgroup=that.query.mgroup; let query = {};
that.$API.enm.enstat.req(query).then((res) => { query.page = 0;
let data = res; query.type = "month_s";
if(data.length>0){ query.year_s = that.query.year_s;
data.forEach(item => { query.mgroup = that.query.mgroup;
// that.$API.enm.enstat.req(query).then((res) => {
let ind = item.month_s; let data = res;
let arr = []; if (data.length > 0) {
let time = ''+item.year_s+'.'+item.month_s; data.forEach((item) => {
arr.push(time); //
arr.push(item.elec_consume_unit);//KW·h/t let ind = item.month_s;
arr[2] = that.monthGoal[ind]!==undefined?that.monthGoal[ind]:'/'; let arr = [];
wrapArr[ind] = arr; let time = "" + item.year_s + "." + item.month_s;
}); arr.push(time);
wrapArr.forEach((item,index)=>{ arr.push(item.elec_consume_unit); //KW·h/t
let arrs = []; arr[2] =
arrs[0]=item[0]; that.monthGoal[ind] !== undefined
arrs[1]=item[1]; ? that.monthGoal[ind]
arrs[2]=item[2]; : "/";
//KW·h/t// wrapArr[ind] = arr;
//KW·h/t });
let diff = 0; wrapArr.forEach((item, index) => {
if(item[2]!=='/'){ let arrs = [];
diff = item[1]-item[2]; arrs[0] = item[0];
}else{ arrs[1] = item[1];
diff = '/'; arrs[2] = item[2];
} //KW·h/t//
arrs[3]=diff; //KW·h/t
//KW·h/t let diff = 0;
let lastNum = 0; if (item[2] !== "/") {
if(index>1){ diff = item[1] - item[2];
let num = index-1; } else {
if(wrapArr[num]&&wrapArr[num].elec_consume_unit){ diff = "/";
lastNum = wrapArr[num].elec_consume_unit; }
}else{ arrs[3] = diff;
lastNum='/' //KW·h/t
} let lastNum = 0;
}else{ if (index > 1) {
lastNum = wrapArr0[12]?wrapArr0[12].elec_consume_unit:'/'; let num = index - 1;
} if (
arrs[4]=lastNum; wrapArr[num] &&
//KW·h/t wrapArr[num].elec_consume_unit
let lastDiff = 0; ) {
lastNum = wrapArr[num].elec_consume_unit;
} else {
lastNum = "/";
}
} else {
lastNum = wrapArr0[12]
? wrapArr0[12].elec_consume_unit
: "/";
}
arrs[4] = lastNum;
//KW·h/t
let lastDiff = 0;
if(arrs[1]!=='/'&&arrs[4]!=='/'){ if (arrs[1] !== "/" && arrs[4] !== "/") {
lastDiff =arrs[1]- arrs[4]; lastDiff = arrs[1] - arrs[4];
}else{ } else {
lastDiff = '/'; lastDiff = "/";
} }
arrs[5]=lastDiff; arrs[5] = lastDiff;
//% //%
let lastRate = 0; let lastRate = 0;
if(lastDiff=='/'&&lastNum!=='/'&&lastNum!==0){ if (
lastRate = (lastDiff/lastNum)*100; lastDiff == "/" &&
}else{ lastNum !== "/" &&
lastRate = '/' lastNum !== 0
} ) {
arrs[6]=lastRate; lastRate = (lastDiff / lastNum) * 100;
//%-wrapArr0[ind].elec_consume_unit } else {
let sameRate =0; lastRate = "/";
if(wrapArr0[index]&&wrapArr0[index].elec_consume_unit){ }
sameRate =((arrs[1]- wrapArr0[index].elec_consume_unit)/wrapArr0[index].elec_consume_unit)*100 arrs[6] = lastRate;
}else{ //%-wrapArr0[ind].elec_consume_unit
sameRate='/'; let sameRate = 0;
} if (
arrs[7]=sameRate; wrapArr0[index] &&
wrapArrs.push(arrs); wrapArr0[index].elec_consume_unit
}) ) {
that.tableDatas = wrapArrs; sameRate =
}else{ ((arrs[1] -
} wrapArr0[index].elec_consume_unit) /
}) wrapArr0[index].elec_consume_unit) *
}) 100;
}, } else {
itemClick(type,item){ sameRate = "/";
this.type=type; }
this.asynDialog = true; arrs[7] = sameRate;
}, wrapArrs.push(arrs);
itemClick1(type,item){ });
this.chartShow = false; that.tableDatas = wrapArrs;
this.$API.bi.dataset.exec } else {
.req('3322567213885833216') }
.then((res) => { });
this.myOption = JSON.parse(res.echart_options); });
debugger; },
console.log(this.myOption) itemClick(type, item) {
this.chartShow = true; this.type = type;
}); this.asynDialog = true;
}, },
handlePrint() { itemClick1(type, item) {
this.$PRINT('#myReport'); this.chartShow = false;
}, this.$API.bi.dataset.exec.req("3322567213885833216").then((res) => {
exportExcel() { this.myOption = JSON.parse(res.echart_options);
this.exportLoading = true; debugger;
this.$XLSX('#myTable', this.tableName) console.log(this.myOption);
this.exportLoading = false; this.chartShow = true;
}, });
} },
}; handlePrint() {
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
},
};
</script> </script>
<style scoped> <style scoped>
.printWrap{ .printWrap {
width: 100%; width: 100%;
overflow-x: scroll; overflow-x: scroll;
} }
</style> </style>

View File

@ -232,16 +232,16 @@ export default {
name: "sflog", name: "sflog",
data() { data() {
return { return {
apiObj: this.$API.wpm.sflog.list, apiObj: null,
apiObj2: null, apiObj2: null,
query: { query: {
shift: "", shift: "",
team: "", team: "",
end_time__lt: "", end_time__lt: "",
start_time__gte: "", start_time__gte: "",
mgroup: "3347217512021835776", mgroup: "",
}, },
deptId: "3347207082608115712", deptId: "",
sflogItem: {}, sflogItem: {},
options: [], options: [],
optionsShift: [], optionsShift: [],
@ -251,8 +251,16 @@ export default {
}; };
}, },
mounted() { mounted() {
this.getTeam(); this.$API.mtm.mgroup.list
this.getShfit(); .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: { methods: {
getTeam() { getTeam() {

View File

@ -81,7 +81,7 @@ export default {
year_s: "", year_s: "",
page: 0, page: 0,
type: "month_st", type: "month_st",
mgroup: "3347217512021835776", mgroup: "",
}, },
tableDatas: [], tableDatas: [],
}; };
@ -91,17 +91,23 @@ export default {
var myDate = new Date(); var myDate = new Date();
let year = myDate.getFullYear(); let year = myDate.getFullYear();
that.query.year_s = year; that.query.year_s = year;
let params = {}; that.$API.mtm.mgroup.list
params.page = 0; .req({ page: 0, search: "煤磨" })
params.year = year; .then((res) => {
params.mgroup = that.query.mgroup; console.log("煤磨", res);
this.$API.mtm.goal.list.req(params).then((res) => { that.query.mgroup = res[0].id;
let data = []; let params = {};
if (res.length > 0) { params.page = 0;
data = res[0]; params.year = year;
} params.mgroup = that.query.mgroup;
that.getData(data); that.$API.mtm.goal.list.req(params).then((res) => {
}); let data = [];
if (res.length > 0) {
data = res[0];
}
that.getData(data);
});
});
}, },
methods: { methods: {
getData(goalData) { getData(goalData) {

View File

@ -1,275 +1,322 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-date-picker <el-date-picker
v-model="query.year_s" v-model="query.year_s"
type="year" type="year"
value-format="YYYY" value-format="YYYY"
format="YYYY" format="YYYY"
placeholder="查询年份" placeholder="查询年份"
class="headerSearch" class="headerSearch"
/> />
<el-button <el-button
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
@click="handleQuery" @click="handleQuery"
></el-button> ></el-button>
<el-button <el-button
type="primary" type="primary"
@click="exportExcel()" @click="exportExcel()"
:loading = "exportLoading" :loading="exportLoading"
>导出xlsx >导出xlsx
</el-button> </el-button>
<el-button <el-button type="primary" @click="handlePrint">打印 </el-button>
type="primary" </div>
@click="handlePrint" </el-header>
>打印 <el-card style="margin-top: 5px">
</el-button> <div class="printWrap">
</div> <div ref="print" id="myReport" class="printContainer">
</el-header> <table
<el-card style="margin-top:5px"> border="1"
<div class="printWrap"> width="1075"
<div ref="print" id="myReport" class="printContainer"> cellspacing="0"
<table border="1" width="1075" cellspacing="0" :key="timeStamp" id="myTable" class="myTable"> :key="timeStamp"
<thead class="myTableHead"> id="myTable"
<tr> class="myTable"
<th colspan="8">煤磨工段车间单位产品电耗月度分析表</th> >
</tr> <thead class="myTableHead">
<tr> <tr>
<th>月份</th> <th colspan="8">
<th>当期值KW·h/t</th> 煤磨工段车间单位产品电耗月度分析表
<th>目标值KW·h/t</th> </th>
<th>当期与目标差值KW·h/t</th> </tr>
<th>环期值KW·h/t</th> <tr>
<th>当期与环期差值KW·h/t</th> <th>月份</th>
<th>环比增长率%</th> <th>当期值KW·h/t</th>
<th>同比增长率%</th> <th>目标值KW·h/t</th>
</tr> <th>当期与目标差值KW·h/t</th>
</thead> <th>环期值KW·h/t</th>
<tbody> <th>当期与环期差值KW·h/t</th>
<tr v-for="item in tableDatas" :key="item"> <th>环比增长率%</th>
<td v-for="(item1,ind) in item" :key="ind" class="numCell"> <th>同比增长率%</th>
<div :class="bindClass(item1,ind)"> </tr>
<span v-if="item1>0&&ind==3"></span> </thead>
<span v-if="item1<0&&ind==3"></span> <tbody>
<span v-if="item1<0&&ind==5"></span> <tr v-for="item in tableDatas" :key="item">
<span v-if="item1<0&&ind==5"></span> <td
{{item1}} v-for="(item1, ind) in item"
</div> :key="ind"
</td> class="numCell"
</tr> >
</tbody> <div :class="bindClass(item1, ind)">
</table> <span v-if="item1 > 0 && ind == 3"
</div> ></span
</div> >
</el-card> <span v-if="item1 < 0 && ind == 3"
</div> ></span
</template> >
<span v-if="item1 < 0 && ind == 5"
></span
>
<span v-if="item1 < 0 && ind == 5"
></span
>
{{ item1 }}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</el-card>
</div>
</template>
<script> <script>
import scEcharts from "@/components/scEcharts"; import scEcharts from "@/components/scEcharts";
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from "vue";
export default { export default {
components: { components: {
scEcharts, scEcharts,
charts: defineAsyncComponent(() => import("@/components/scEnm/lineChartsdialog.vue")), charts: defineAsyncComponent(() =>
}, import("@/components/scEnm/lineChartsdialog.vue")
data() { ),
return { },
chartShow: false, data() {
myOption: null, return {
query:{ chartShow: false,
year_s:'', myOption: null,
mgroup:'3347217512021835776', query: {
}, year_s: "",
monthGoal:[], mgroup: "3347217512021835776",
tableDatas:[], },
modelValue:true, monthGoal: [],
type:'hours', tableDatas: [],
title:'title', modelValue: true,
apiObj:'', type: "hours",
showClose:true, title: "title",
echartType:'line', apiObj: "",
asynDialog:false, showClose: true,
}; echartType: "line",
}, asynDialog: false,
mounted() { };
let that = this; },
var myDate = new Date(); mounted() {
let year = myDate.getFullYear(); let that = this;
that.query.year_s = year; var myDate = new Date();
// let year = myDate.getFullYear();
let paramsGoal = {}; that.query.year_s = year;
paramsGoal.page=0; that.$API.mtm.mgroup.list
paramsGoal.mgroup=that.query.mgroup; .req({ page: 0, search: "煤磨" })
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => { .then((res) => {
if(ress.length>0){ console.log("煤磨", res);
let monthGoal = []; that.query.mgroup = res[0].id;
ress.forEach(goal=>{ //
if(goal.goal_cate_name=='单位产品分布电耗KW·h/t'){ let paramsGoal = {};
monthGoal[0]=goal.goal_val; paramsGoal.page = 0;
monthGoal[1]=goal.goal_val_2; paramsGoal.mgroup = that.query.mgroup;
monthGoal[2]=goal.goal_val_3; that.$API.mtm.goal.list.req(paramsGoal).then((ress) => {
monthGoal[3]=goal.goal_val_4; if (ress.length > 0) {
monthGoal[4]=goal.goal_val_5; let monthGoal = [];
monthGoal[5]=goal.goal_val_6; ress.forEach((goal) => {
monthGoal[6]=goal.goal_val_7; if (
monthGoal[7]=goal.goal_val_8; goal.goal_cate_name ==
monthGoal[8]=goal.goal_val_9; "单位产品分布电耗KW·h/t"
monthGoal[9]=goal.goal_val_10; ) {
monthGoal[10]=goal.goal_val_11; monthGoal[0] = goal.goal_val;
monthGoal[11]=goal.goal_val_12; monthGoal[1] = goal.goal_val_2;
monthGoal[12]=goal.goal_val_12; monthGoal[2] = goal.goal_val_3;
that.monthGoal = monthGoal; monthGoal[3] = goal.goal_val_4;
} monthGoal[4] = goal.goal_val_5;
}) monthGoal[5] = goal.goal_val_6;
this.getData(); monthGoal[6] = goal.goal_val_7;
}else{ monthGoal[7] = goal.goal_val_8;
this.getData(); monthGoal[8] = goal.goal_val_9;
} monthGoal[9] = goal.goal_val_10;
}) monthGoal[10] = goal.goal_val_11;
}, monthGoal[11] = goal.goal_val_12;
methods: { monthGoal[12] = goal.goal_val_12;
// Class that.monthGoal = monthGoal;
bindClass(item,index){ }
let classInfo = { redColor: false, greenColor: false } });
if(index==3||index==5){ this.getData();
if( typeof(item)=='number'){ } else {
if(item>0){ this.getData();
classInfo.greenColor = true; }
classInfo.redColor = false; });
}else if(item<0){ });
classInfo.redColor = true; },
classInfo.greenColor = false methods: {
} // Class
} bindClass(item, index) {
} let classInfo = { redColor: false, greenColor: false };
return classInfo if (index == 3 || index == 5) {
}, if (typeof item == "number") {
getData(){ if (item > 0) {
let that = this; classInfo.greenColor = true;
let query0={}; classInfo.redColor = false;
query0.page = 0; } else if (item < 0) {
query0.type='month_s'; classInfo.redColor = true;
query0.year_s = that.query.year_s-1; classInfo.greenColor = false;
query0.mgroup=that.query.mgroup; }
let wrapArr = [],wrapArr0 = [] ,wrapArrs = []; }
this.$API.enm.enstat.req(query0).then((res0) => { }
let data0 = res0; return classInfo;
if(data0.length>0){ },
data0.forEach(item0 => { getData() {
// let that = this;
let ind0 = item0.month_s; let query0 = {};
wrapArr0[ind0] = item0; query0.page = 0;
}); query0.type = "month_s";
} query0.year_s = that.query.year_s - 1;
let query={}; query0.mgroup = that.query.mgroup;
query.page = 0; let wrapArr = [],
query.type='month_s'; wrapArr0 = [],
query.year_s = that.query.year_s; wrapArrs = [];
query.mgroup=that.query.mgroup; this.$API.enm.enstat.req(query0).then((res0) => {
that.$API.enm.enstat.req(query).then((res) => { let data0 = res0;
let data = res; if (data0.length > 0) {
if(data.length>0){ data0.forEach((item0) => {
data.forEach(item => { //
// let ind0 = item0.month_s;
let ind = item.month_s; wrapArr0[ind0] = item0;
let arr = []; });
let time = ''+item.year_s+'.'+item.month_s; }
arr.push(time); let query = {};
arr.push(item.elec_consume_unit);//KW·h/t query.page = 0;
arr[2] = that.monthGoal[ind]!==undefined?that.monthGoal[ind]:'/'; query.type = "month_s";
wrapArr[ind] = arr; query.year_s = that.query.year_s;
}); query.mgroup = that.query.mgroup;
wrapArr.forEach((item,index)=>{ that.$API.enm.enstat.req(query).then((res) => {
let arrs = []; let data = res;
arrs[0]=item[0]; if (data.length > 0) {
arrs[1]=item[1]; data.forEach((item) => {
arrs[2]=item[2]; //
//KW·h/t// let ind = item.month_s;
//KW·h/t let arr = [];
let diff = 0; let time = "" + item.year_s + "." + item.month_s;
if(item[2]!=='/'){ arr.push(time);
diff = item[1]-item[2]; arr.push(item.elec_consume_unit); //KW·h/t
}else{ arr[2] =
diff = '/'; that.monthGoal[ind] !== undefined
} ? that.monthGoal[ind]
arrs[3]=diff; : "/";
//KW·h/t wrapArr[ind] = arr;
let lastNum = 0; });
if(index>1){ wrapArr.forEach((item, index) => {
let num = index-1; let arrs = [];
if(wrapArr[num]&&wrapArr[num].elec_consume_unit){ arrs[0] = item[0];
lastNum = wrapArr[num].elec_consume_unit; arrs[1] = item[1];
}else{ arrs[2] = item[2];
lastNum='/' //KW·h/t//
} //KW·h/t
}else{ let diff = 0;
lastNum = wrapArr0[12]?wrapArr0[12].elec_consume_unit:'/'; if (item[2] !== "/") {
} diff = item[1] - item[2];
arrs[4]=lastNum; } else {
//KW·h/t diff = "/";
let lastDiff = 0; }
arrs[3] = diff;
//KW·h/t
let lastNum = 0;
if (index > 1) {
let num = index - 1;
if (
wrapArr[num] &&
wrapArr[num].elec_consume_unit
) {
lastNum = wrapArr[num].elec_consume_unit;
} else {
lastNum = "/";
}
} else {
lastNum = wrapArr0[12]
? wrapArr0[12].elec_consume_unit
: "/";
}
arrs[4] = lastNum;
//KW·h/t
let lastDiff = 0;
if(arrs[1]!=='/'&&arrs[4]!=='/'){ if (arrs[1] !== "/" && arrs[4] !== "/") {
lastDiff =arrs[1]- arrs[4]; lastDiff = arrs[1] - arrs[4];
}else{ } else {
lastDiff = '/'; lastDiff = "/";
} }
arrs[5]=lastDiff; arrs[5] = lastDiff;
//% //%
let lastRate = 0; let lastRate = 0;
if(lastDiff=='/'&&lastNum!=='/'&&lastNum!==0){ if (
lastRate = (lastDiff/lastNum)*100; lastDiff == "/" &&
}else{ lastNum !== "/" &&
lastRate = '/' lastNum !== 0
} ) {
arrs[6]=lastRate; lastRate = (lastDiff / lastNum) * 100;
//%-wrapArr0[ind].elec_consume_unit } else {
let sameRate =0; lastRate = "/";
if(wrapArr0[index]&&wrapArr0[index].elec_consume_unit){ }
sameRate =((arrs[1]- wrapArr0[index].elec_consume_unit)/wrapArr0[index].elec_consume_unit)*100 arrs[6] = lastRate;
}else{ //%-wrapArr0[ind].elec_consume_unit
sameRate='/'; let sameRate = 0;
} if (
arrs[7]=sameRate; wrapArr0[index] &&
wrapArrs.push(arrs); wrapArr0[index].elec_consume_unit
}) ) {
that.tableDatas = wrapArrs; sameRate =
}else{ ((arrs[1] -
} wrapArr0[index].elec_consume_unit) /
}) wrapArr0[index].elec_consume_unit) *
}) 100;
}, } else {
itemClick(type,item){ sameRate = "/";
this.type=type; }
this.asynDialog = true; arrs[7] = sameRate;
}, wrapArrs.push(arrs);
itemClick1(type,item){ });
this.chartShow = false; that.tableDatas = wrapArrs;
this.$API.bi.dataset.exec } else {
.req('3322567213885833216') }
.then((res) => { });
this.myOption = JSON.parse(res.echart_options); });
debugger; },
console.log(this.myOption) itemClick(type, item) {
this.chartShow = true; this.type = type;
}); this.asynDialog = true;
}, },
handlePrint() { itemClick1(type, item) {
this.$PRINT('#myReport'); this.chartShow = false;
}, this.$API.bi.dataset.exec.req("3322567213885833216").then((res) => {
exportExcel() { this.myOption = JSON.parse(res.echart_options);
this.exportLoading = true; debugger;
this.$XLSX('#myTable', this.tableName) console.log(this.myOption);
this.exportLoading = false; this.chartShow = true;
}, });
} },
}; handlePrint() {
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
},
};
</script> </script>
<style scoped> <style scoped>
.printWrap{ .printWrap {
width: 100%; width: 100%;
overflow-x: scroll; overflow-x: scroll;
} }
</style> </style>