fix:水泥包装mgroup根据名称获取

This commit is contained in:
shijing 2024-04-29 16:30:32 +08:00
parent 74e65ba199
commit aee0427138
4 changed files with 1273 additions and 999 deletions

View File

@ -1,237 +1,361 @@
<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="mgroup_name"></el-table-column> --> <el-select
<el-table-column label="开始时间" prop="start_time"> v-model="query.shift"
<template #default="scope"> placeholder="班次"
<span>{{ scope.row.start_time.slice(0, 16) }}</span> clearable
</template> style="margin-left: 2px; width: 120px"
</el-table-column> >
<el-table-column label="结束时间" prop="end_time"> <el-option
<template #default="scope"> v-for="item in optionsShift"
<span>{{ scope.row.end_time.slice(0, 16) }}</span> :key="item.id"
</template> :label="item.name"
</el-table-column> :value="item.id"
<el-table-column label="班组名称" prop="team_name"></el-table-column> ></el-option>
<el-table-column label="当前班次" prop="shift_name"></el-table-column> </el-select>
<el-table-column label="班长" prop="leader_name"></el-table-column> <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="mgroup_name"></el-table-column> -->
<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">单位产品分布电耗KW·h/t</td> <el-button type="primary" @click="handlePrint">打印 </el-button>
<td class="numCell">{{ reportItem.elec_consume_unit }}</td> </div>
</tr> <el-main class="nopadding">
<tr v-if="sflogexpList.length > 0"> <div ref="print" id="myReport" class="printContainer">
<td class="numCell" :rowspan="sflogexpList.length + 1">生产情况记录</td> <div
<td class="numCell">时间</td> style="
<td class="numCell">类别</td> margin-right: 20px;
<td class="numCell">原因</td> text-align: center;
<td class="numCell">处置措施</td> font-size: 16px;
<td class="numCell">处置人</td> font-weight: bold;
</tr> margin-bottom: 20px;
<tr v-for="item in sflogexpList" :key="item.id"> "
<td class="numCell">{{ item.happen_time }}</td> >
<td class="numCell">{{ item.cate }}</td> <span v-if="sflogItem.end_time"
<td class="numCell">{{ item.reason }}</td> >{{ sflogItem.end_time.slice(0, 10)
<td class="numCell">{{ item.measure }}</td> }}{{ sflogItem.shift_name }}</span
<td class="numCell">{{ item.handler }}</td> >
</tr> <span v-if="sflogItem.team_name">{{
</tbody> sflogItem.team_name
</table> }}</span>
</div> 交接班记录
</el-main> </div>
</el-drawer> <table
</el-container> 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">班次</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>
</tr>
<tr>
<td class="numCell">产量t</td>
<td class="numCell">
{{ reportItem.total_production }}
</td>
<td class="numCell">
单位产品分布电耗KW·h/t
</td>
<td class="numCell">
{{ reportItem.elec_consume_unit }}
</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: "packsflog", name: "packsflog",
data() { data() {
return { return {
apiObj: this.$API.wpm.sflog.list, apiObj: null,
apiObj2: null, apiObj2: null,
query: { query: {
mgroup: '3347217757455728640', mgroup: "",
}, },
deptId: '3347207316583170048', 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>

File diff suppressed because it is too large Load Diff

View File

@ -77,11 +77,13 @@
export default { export default {
data() { data() {
return { return {
exportLoading: false,
timeStamp: null,
query: { query: {
year_s: "", year_s: "",
page: 0, page: 0,
type: "month_st", type: "month_st",
mgroup: "3347217757455728640", mgroup: "",
}, },
tableDatas: [], tableDatas: [],
}; };
@ -90,8 +92,25 @@ export default {
let that = this; let that = this;
var myDate = new Date(); var myDate = new Date();
let year = myDate.getFullYear(); let year = myDate.getFullYear();
this.timeStamp = myDate.getTime();
that.query.year_s = year; that.query.year_s = year;
that.getData(); 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;
params.mgroup = that.query.mgroup;
this.$API.mtm.goal.list.req(params).then((res) => {
let data = [];
if (res.length > 0) {
data = res[0];
}
that.getData(data);
});
});
}, },
methods: { methods: {
getData() { getData() {
@ -111,6 +130,7 @@ export default {
// //
let n0 = item0.month_s; let n0 = item0.month_s;
let ind0 = 0; let ind0 = 0;
let team_name0 = item0.team_name;
if (team_name0.indexOf("甲") > -1) { if (team_name0.indexOf("甲") > -1) {
ind0 = (n0 - 1) * 3; ind0 = (n0 - 1) * 3;
} else if (team_name0.indexOf("乙") > -1) { } else if (team_name0.indexOf("乙") > -1) {
@ -144,10 +164,10 @@ export default {
arr.push(time); arr.push(time);
arr.push(item.team_name); arr.push(item.team_name);
arr.push(item.total_production); arr.push(item.total_production);
arr[3] = item.elec_consume_unit; //KW·h/t arr[3] = item.elec_consume_unit; //KW·h/t
arr[4] = item.celec_consume_unit; //KW·h/t// let keyVale = "goal_val_" + n;
arr[5] = item.celec_consume_unit; //KW·h/t arr[4] = goalData[keyVale]; //KW·h/t//
arr[5] = arr[3] - item.celec_consume_unit; //KW·h/t
let ind_pre = 0, let ind_pre = 0,
huanbi = 0; huanbi = 0;
if (item.month_s == 1) { if (item.month_s == 1) {

View File

@ -1,270 +1,326 @@
<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:{ exportLoading: false,
mgroup:'3347217757455728640', timeStamp: null,
}, chartShow: false,
monthGoal:[], myOption: null,
tableDatas:[], query: {
modelValue:true, mgroup: "",
type:'hours', },
title:'title', monthGoal: [],
apiObj:'', tableDatas: [],
showClose:true, modelValue: true,
echartType:'line', type: "hours",
asynDialog:false, title: "title",
}; apiObj: "",
}, showClose: true,
mounted() { echartType: "line",
let that = this; asynDialog: false,
var myDate = new Date(); };
let year = myDate.getFullYear(); },
that.query.year_s = year; mounted() {
// let that = this;
let paramsGoal = {}; var myDate = new Date();
paramsGoal.page=0; let year = myDate.getFullYear();
paramsGoal.mgroup=that.query.mgroup; that.query.year_s = year;
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => { that.timeStamp = myDate.getTime();
if(ress.length>0){ this.$API.mtm.mgroup.list
let monthGoal = []; .req({ page: 0, search: "水泥包装" })
ress.forEach(goal=>{ .then((res) => {
if(goal.goal_cate_name=='单位产品分布电耗KW·h/t'){ console.log("水泥包装", res);
monthGoal[0]=goal.goal_val; that.query.mgroup = res[0].id;
monthGoal[1]=goal.goal_val_2; //
monthGoal[2]=goal.goal_val_3; that.getMonthGoal();
monthGoal[3]=goal.goal_val_4; });
monthGoal[4]=goal.goal_val_5; },
monthGoal[5]=goal.goal_val_6; methods: {
monthGoal[6]=goal.goal_val_7; // Class
monthGoal[7]=goal.goal_val_8; bindClass(item, index) {
monthGoal[8]=goal.goal_val_9; let classInfo = { redColor: false, greenColor: false };
monthGoal[9]=goal.goal_val_10; if (index == 3 || index == 5) {
monthGoal[10]=goal.goal_val_11; if (typeof item == "number") {
monthGoal[11]=goal.goal_val_12; if (item > 0) {
monthGoal[12]=goal.goal_val_12; classInfo.greenColor = true;
that.monthGoal = monthGoal; classInfo.redColor = false;
} } else if (item < 0) {
}) classInfo.redColor = true;
this.getData(); classInfo.greenColor = false;
}else{ }
this.getData(); }
} }
}) return classInfo;
}, },
methods: { //
// Class getMonthGoal() {
bindClass(item,index){ let that = this;
let classInfo = { redColor: false, greenColor: false } let paramsGoal = {};
if(index==3||index==5){ paramsGoal.page = 0;
if( typeof(item)=='number'){ paramsGoal.mgroup = that.query.mgroup;
if(item>0){ that.$API.mtm.goal.list.req(paramsGoal).then((ress) => {
classInfo.greenColor = true; if (ress.length > 0) {
classInfo.redColor = false; let monthGoal = [];
}else if(item<0){ ress.forEach((goal) => {
classInfo.redColor = true; if (
classInfo.greenColor = false goal.goal_cate_name == "单位产品分布电耗KW·h/t"
} ) {
} monthGoal[0] = goal.goal_val;
} monthGoal[1] = goal.goal_val_2;
return classInfo monthGoal[2] = goal.goal_val_3;
}, monthGoal[3] = goal.goal_val_4;
getData(){ monthGoal[4] = goal.goal_val_5;
let that = this; monthGoal[5] = goal.goal_val_6;
let query0={}; monthGoal[6] = goal.goal_val_7;
query0.page = 0; monthGoal[7] = goal.goal_val_8;
query0.type='month_s'; monthGoal[8] = goal.goal_val_9;
query0.year_s = that.query.year_s-1; monthGoal[9] = goal.goal_val_10;
query0.mgroup=that.query.mgroup; monthGoal[10] = goal.goal_val_11;
let wrapArr = [],wrapArr0 = [] ,wrapArrs = []; monthGoal[11] = goal.goal_val_12;
this.$API.enm.enstat.req(query0).then((res0) => { monthGoal[12] = goal.goal_val_12;
let data0 = res0; that.monthGoal = monthGoal;
if(data0.length>0){ }
data0.forEach(item0 => { });
// this.getData();
let ind0 = item0.month_s; } else {
wrapArr0[ind0] = item0; this.getData();
}); }
} });
let query={}; },
query.page = 0; getData() {
query.type='month_s'; let that = this;
query.year_s = that.query.year_s; let query0 = {};
query.mgroup=that.query.mgroup; query0.page = 0;
that.$API.enm.enstat.req(query).then((res) => { query0.type = "month_s";
let data = res; query0.year_s = that.query.year_s - 1;
if(data.length>0){ query0.mgroup = that.query.mgroup;
data.forEach(item => { let wrapArr = [],
// wrapArr0 = [],
let ind = item.month_s; wrapArrs = [];
let arr = []; this.$API.enm.enstat.req(query0).then((res0) => {
let time = ''+item.year_s+'.'+item.month_s; let data0 = res0;
arr.push(time); if (data0.length > 0) {
arr.push(item.elec_consume_unit);//KW·h/t data0.forEach((item0) => {
arr[2] = that.monthGoal[ind]!==undefined?that.monthGoal[ind]:'/'; //
wrapArr[ind] = arr; let ind0 = item0.month_s;
}); wrapArr0[ind0] = item0;
wrapArr.forEach((item,index)=>{ });
let arrs = []; }
arrs[0]=item[0]; let query = {};
arrs[1]=item[1]; query.page = 0;
arrs[2]=item[2]; query.type = "month_s";
//KW·h/t// query.year_s = that.query.year_s;
//KW·h/t query.mgroup = that.query.mgroup;
let diff = 0; that.$API.enm.enstat.req(query).then((res) => {
if(item[2]!=='/'){ let data = res;
diff = item[1]-item[2]; if (data.length > 0) {
}else{ data.forEach((item) => {
diff = '/'; //
} let ind = item.month_s;
arrs[3]=diff; let arr = [];
//KW·h/t let time = "" + item.year_s + "." + item.month_s;
let lastNum = 0; arr.push(time);
if(index>1){ arr.push(item.elec_consume_unit); //KW·h/t
let num = index-1; arr[2] =
if(wrapArr[num]&&wrapArr[num].elec_consume_unit){ that.monthGoal[ind] !== undefined
lastNum = wrapArr[num].elec_consume_unit; ? that.monthGoal[ind]
}else{ : "/";
lastNum='/' wrapArr[ind] = arr;
} });
}else{ wrapArr.forEach((item, index) => {
lastNum = wrapArr0[12]?wrapArr0[12].elec_consume_unit:'/'; let arrs = [];
} arrs[0] = item[0];
arrs[4]=lastNum; arrs[1] = item[1];
//KW·h/t arrs[2] = item[2];
let lastDiff = 0; //KW·h/t//
//KW·h/t
let diff = 0;
if (item[2] !== "/") {
diff = item[1] - item[2];
} else {
diff = "/";
}
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;
}, });
} },
}; handleQuery() {
this.getMonthGoal();
},
handlePrint() {
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
},
};
</script> </script>
<style scoped> <style scoped></style>
</style>