fix:水泥包装mgroup根据名称获取
This commit is contained in:
parent
74e65ba199
commit
aee0427138
|
@ -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,36 +133,77 @@
|
|||
</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">单位产品分布电耗(KW·h/t)</td>
|
||||
<td class="numCell">{{ reportItem.elec_consume_unit }}</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"
|
||||
:rowspan="sflogexpList.length + 1"
|
||||
>
|
||||
生产情况记录
|
||||
</td>
|
||||
<td class="numCell">时间</td>
|
||||
<td class="numCell">类别</td>
|
||||
<td class="numCell">原因</td>
|
||||
|
@ -116,12 +229,12 @@ export default {
|
|||
name: "packsflog",
|
||||
data() {
|
||||
return {
|
||||
apiObj: this.$API.wpm.sflog.list,
|
||||
apiObj: null,
|
||||
apiObj2: null,
|
||||
query: {
|
||||
mgroup: '3347217757455728640',
|
||||
mgroup: "",
|
||||
},
|
||||
deptId: '3347207316583170048',
|
||||
deptId: "",
|
||||
|
||||
sflogItem: {},
|
||||
options: [],
|
||||
|
@ -132,22 +245,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);
|
||||
|
@ -163,38 +284,42 @@ 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];
|
||||
}
|
||||
console.log(res[0])
|
||||
})
|
||||
console.log(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;
|
||||
},
|
||||
},
|
||||
|
@ -220,7 +345,7 @@ export default {
|
|||
}
|
||||
|
||||
.searchHead {
|
||||
display: flex
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.middleText {
|
||||
|
@ -234,4 +359,3 @@ export default {
|
|||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -5,20 +5,23 @@
|
|||
<el-button
|
||||
type="primary"
|
||||
@click="exportExcel()"
|
||||
:loading = "exportLoading"
|
||||
: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">
|
||||
<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="9">水泥包装工段生产报告</th>
|
||||
|
@ -35,32 +38,55 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item) in tableDatas" :key="item">
|
||||
<td class="numCell">{{item[0]}}</td>
|
||||
<td class="numCell">{{item[1]}}</td>
|
||||
<td class="numCell hoursItem" @click="itemClick('day_s',item)">{{item[2]}}</td>
|
||||
<td class="numCell daysItem" @click="itemClick('month_s',item)">{{item[3]}}</td>
|
||||
<td class="numCell monthItem" @click="itemClick('year_s',item)">{{item[4]}}</td>
|
||||
<td class="numCell">{{item[5]}}</td>
|
||||
<td class="numCell">{{item[6]}}</td>
|
||||
<td class="numCell">{{item[7]}}</td>
|
||||
<td class="numCell">{{item[8]}}</td>
|
||||
<tr v-for="item in tableDatas" :key="item">
|
||||
<td class="numCell">{{ item[0] }}</td>
|
||||
<td class="numCell">{{ item[1] }}</td>
|
||||
<td
|
||||
class="numCell hoursItem"
|
||||
@click="itemClick('day_s', item)"
|
||||
>
|
||||
{{ item[2] }}
|
||||
</td>
|
||||
<td
|
||||
class="numCell daysItem"
|
||||
@click="itemClick('month_s', item)"
|
||||
>
|
||||
{{ item[3] }}
|
||||
</td>
|
||||
<td
|
||||
class="numCell monthItem"
|
||||
@click="itemClick('year_s', item)"
|
||||
>
|
||||
{{ item[4] }}
|
||||
</td>
|
||||
<td class="numCell">{{ item[5] }}</td>
|
||||
<td class="numCell">{{ item[6] }}</td>
|
||||
<td class="numCell">{{ item[7] }}</td>
|
||||
<td class="numCell">{{ item[8] }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<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>
|
||||
|
||||
<sc-dialog v-model="chartShow" draggable title="水泥磨工段">
|
||||
<div class="searchHead" v-if="type=='hours'">
|
||||
<div class="searchHead" v-if="type == 'hours'">
|
||||
<el-date-picker
|
||||
v-model="query.start_time"
|
||||
type="date"
|
||||
|
@ -78,9 +104,14 @@
|
|||
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'">
|
||||
<div class="searchHead" v-if="type == 'days'">
|
||||
<el-date-picker
|
||||
v-model="query.start_time"
|
||||
type="date"
|
||||
|
@ -97,9 +128,14 @@
|
|||
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'">
|
||||
<div class="searchHead" v-if="type == 'month'">
|
||||
<el-date-picker
|
||||
v-model="query.start_time"
|
||||
type="month"
|
||||
|
@ -116,9 +152,14 @@
|
|||
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'">
|
||||
<div class="searchHead" v-if="type == 'year'">
|
||||
<el-date-picker
|
||||
v-model="query.start_time"
|
||||
type="year"
|
||||
|
@ -135,154 +176,138 @@
|
|||
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"
|
||||
:type="type"
|
||||
:title="title"
|
||||
:cate="cate"
|
||||
:apiObj = "apiObj"
|
||||
:apiObj="apiObj"
|
||||
:mgroup="query.mgroup"
|
||||
:modelValue="modelValue"
|
||||
:showClose="showClose"
|
||||
:echartType='echartType'
|
||||
:echartType="echartType"
|
||||
@closed="asynDialog = false"
|
||||
></charts>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
<script>
|
||||
const colors =['#647bfe','#91CC75','#EE6666'];
|
||||
let tooltip= {
|
||||
const colors = ["#647bfe", "#91CC75", "#EE6666"];
|
||||
let tooltip = {
|
||||
show: true,
|
||||
trigger: 'axis',
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: 'cross'
|
||||
type: "cross",
|
||||
},
|
||||
confine:false,
|
||||
confine: false,
|
||||
showContent: true,
|
||||
triggerOn:"mousemove",
|
||||
};
|
||||
let grid={
|
||||
right: '4%',
|
||||
left:'4%',
|
||||
top:'15%'
|
||||
};
|
||||
let toolbox={
|
||||
right:'2%',
|
||||
triggerOn: "mousemove",
|
||||
};
|
||||
let grid = {
|
||||
right: "4%",
|
||||
left: "4%",
|
||||
top: "15%",
|
||||
};
|
||||
let toolbox = {
|
||||
right: "2%",
|
||||
feature: {
|
||||
dataView: { show: true, readOnly: false },
|
||||
saveAsImage: { show: true }
|
||||
}
|
||||
};
|
||||
let legend= {
|
||||
top:'2%',
|
||||
data:['总产量','分布电耗']
|
||||
};
|
||||
let yAxis= [{
|
||||
type: 'value',
|
||||
name: '产量 (t)',
|
||||
position: 'left',
|
||||
saveAsImage: { show: true },
|
||||
},
|
||||
};
|
||||
let legend = {
|
||||
top: "2%",
|
||||
data: ["总产量", "分布电耗"],
|
||||
};
|
||||
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: '分布电耗(KW.h)',
|
||||
position: 'right',
|
||||
type: "value",
|
||||
name: "分布电耗(KW.h)",
|
||||
position: "right",
|
||||
alignTicks: true,
|
||||
axisLine: {
|
||||
show: true,
|
||||
lineStyle: {
|
||||
color: colors[1]
|
||||
}
|
||||
color: colors[1],
|
||||
},
|
||||
},
|
||||
axisLabel: {
|
||||
formatter: '{value}'
|
||||
}
|
||||
}
|
||||
];
|
||||
import scEcharts from "@/components/scEcharts";
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
export default {
|
||||
formatter: "{value}",
|
||||
},
|
||||
},
|
||||
];
|
||||
import scEcharts from "@/components/scEcharts";
|
||||
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,
|
||||
timeStamp: null,
|
||||
myOption: null,
|
||||
optionDay:{},
|
||||
optionMonth:{},
|
||||
year:2023,
|
||||
month:1,
|
||||
days:1,
|
||||
listQuery:{
|
||||
belong_dept:'',
|
||||
task2__year:'',
|
||||
page:0
|
||||
optionDay: {},
|
||||
optionMonth: {},
|
||||
year: 2023,
|
||||
month: 1,
|
||||
days: 1,
|
||||
listQuery: {
|
||||
belong_dept: "",
|
||||
task2__year: "",
|
||||
page: 0,
|
||||
},
|
||||
query: {
|
||||
mgroup:'3347217757455728640',
|
||||
mgroup: "",
|
||||
},
|
||||
tableDatas:[
|
||||
['产量','总产量(t)',0,0,0,0,0,0,0,0],
|
||||
['能耗','单位产品分布电耗(KW·h/t)',0,0,0,0,0,0,0,0],
|
||||
tableDatas: [
|
||||
["产量", "总产量(t)", 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
["能耗", "单位产品分布电耗(KW·h/t)", 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
],
|
||||
tableName:'生产报告',
|
||||
modelValue:true,
|
||||
type:'hour_s',
|
||||
title:'水泥磨工段',
|
||||
cate:'',
|
||||
apiObj:this.$API.enm.enstat,
|
||||
showClose:true,
|
||||
echartType:'line',
|
||||
asynDialog:false,
|
||||
option1:{
|
||||
tableName: "生产报告",
|
||||
modelValue: true,
|
||||
type: "hour_s",
|
||||
title: "水泥磨工段",
|
||||
cate: "",
|
||||
apiObj: this.$API.enm.enstat,
|
||||
showClose: true,
|
||||
echartType: "line",
|
||||
asynDialog: false,
|
||||
option1: {
|
||||
color: colors,
|
||||
tooltip:tooltip,
|
||||
grid: grid,
|
||||
toolbox: toolbox,
|
||||
legend:legend,
|
||||
xAxis: {
|
||||
axisTick: {
|
||||
show: true,
|
||||
length: 5,
|
||||
inside: true,
|
||||
},
|
||||
data: []
|
||||
},
|
||||
yAxis:yAxis,
|
||||
series:[
|
||||
{
|
||||
name: '总产量',
|
||||
type: 'bar',
|
||||
yAxisIndex:0,
|
||||
data:[]
|
||||
},
|
||||
{
|
||||
name: '分布电耗',
|
||||
type: 'bar',
|
||||
yAxisIndex: 1,
|
||||
data: []
|
||||
},
|
||||
]
|
||||
},
|
||||
option2:{
|
||||
color: colors,
|
||||
tooltip:tooltip,
|
||||
tooltip: tooltip,
|
||||
grid: grid,
|
||||
toolbox: toolbox,
|
||||
legend: legend,
|
||||
|
@ -292,235 +317,284 @@
|
|||
length: 5,
|
||||
inside: true,
|
||||
},
|
||||
data: []
|
||||
data: [],
|
||||
},
|
||||
yAxis: yAxis,
|
||||
series:[
|
||||
series: [
|
||||
{
|
||||
name: '总产量',
|
||||
type: 'bar',
|
||||
yAxisIndex:0,
|
||||
data:[]
|
||||
name: "总产量",
|
||||
type: "bar",
|
||||
yAxisIndex: 0,
|
||||
data: [],
|
||||
},
|
||||
{
|
||||
name: '分布电耗',
|
||||
type: 'bar',
|
||||
name: "分布电耗",
|
||||
type: "bar",
|
||||
yAxisIndex: 1,
|
||||
data: []
|
||||
data: [],
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
option2: {
|
||||
color: colors,
|
||||
tooltip: tooltip,
|
||||
grid: grid,
|
||||
toolbox: toolbox,
|
||||
legend: legend,
|
||||
xAxis: {
|
||||
axisTick: {
|
||||
show: true,
|
||||
length: 5,
|
||||
inside: true,
|
||||
},
|
||||
data: [],
|
||||
},
|
||||
yAxis: yAxis,
|
||||
series: [
|
||||
{
|
||||
name: "总产量",
|
||||
type: "bar",
|
||||
yAxisIndex: 0,
|
||||
data: [],
|
||||
},
|
||||
{
|
||||
name: "分布电耗",
|
||||
type: "bar",
|
||||
yAxisIndex: 1,
|
||||
data: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
function precen(a,b){
|
||||
if(b!==0&&b!==null&&a!==null){
|
||||
let precen = (a/b).toFixed(2)
|
||||
return precen*100+'%'
|
||||
}else{
|
||||
return '/'
|
||||
function precen(a, b) {
|
||||
if (b !== 0 && b !== null && a !== null) {
|
||||
let precen = (a / b).toFixed(2);
|
||||
return precen * 100 + "%";
|
||||
} else {
|
||||
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 year = (that.year = myDate.getFullYear());
|
||||
let month = (that.month = myDate.getMonth() + 1);
|
||||
let days = (that.days = myDate.getDate());
|
||||
let hours = myDate.getHours();
|
||||
let timeDate = myDate.getTime();
|
||||
let dayTime = 24 * 60 * 60 * 1000;
|
||||
//昨天的计算
|
||||
let year_d = year,month_d = month,days_d = days;
|
||||
if(hours<21){//21点前,查找昨日数据为前一天数据
|
||||
let newDate = timeDate- dayTime;
|
||||
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();
|
||||
month_d = lastDate.getMonth()+1;
|
||||
month_d = lastDate.getMonth() + 1;
|
||||
days_d = lastDate.getDate();
|
||||
}
|
||||
this.$API.mtm.mgroup.list
|
||||
.req({ page: 0, search: "水泥包装" })
|
||||
.then((res) => {
|
||||
console.log("水泥包装", res);
|
||||
that.query.mgroup = res[0].id;
|
||||
//年
|
||||
let params1 = {};
|
||||
params1.page = 0;
|
||||
params1.year_s = year;
|
||||
params1.type = 'year_s';
|
||||
params1.mgroup = this.query.mgroup;
|
||||
params1.type = "year_s";
|
||||
params1.mgroup = that.query.mgroup;
|
||||
this.$API.enm.enstat.req(params1).then((res1) => {
|
||||
if(res1.length>0){
|
||||
if (res1.length > 0) {
|
||||
let data1 = res1[0];
|
||||
that.tableDatas[0][4]=data1.total_production;
|
||||
that.tableDatas[1][4]=data1.elec_consume_unit;
|
||||
that.tableDatas[0][4] = data1.total_production;
|
||||
that.tableDatas[1][4] = data1.elec_consume_unit;
|
||||
}
|
||||
})
|
||||
});
|
||||
//月
|
||||
let params2 = {};
|
||||
params2.page = 0;
|
||||
params2.year_s = year;
|
||||
params2.month_s = month;
|
||||
params2.type = 'month_s';
|
||||
params2.mgroup = this.query.mgroup;
|
||||
params2.type = "month_s";
|
||||
params2.mgroup = that.query.mgroup;
|
||||
this.$API.enm.enstat.req(params2).then((res2) => {
|
||||
if(res2.length>0){
|
||||
if (res2.length > 0) {
|
||||
let data2 = res2[0];
|
||||
that.tableDatas[0][3]=data2.total_production;
|
||||
that.tableDatas[1][3]=data2.elec_consume_unit;
|
||||
that.tableDatas[0][3] = data2.total_production;
|
||||
that.tableDatas[1][3] = data2.elec_consume_unit;
|
||||
}
|
||||
})
|
||||
});
|
||||
//昨日
|
||||
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;
|
||||
params3.type = "day_s";
|
||||
params3.mgroup = that.query.mgroup;
|
||||
this.$API.enm.enstat.req(params3).then((res3) => {
|
||||
if(res3.length>0){
|
||||
if (res3.length > 0) {
|
||||
let data3 = res3[0];
|
||||
that.tableDatas[0][2]=data3.total_production;
|
||||
that.tableDatas[1][2]=data3.elec_consume_unit;
|
||||
that.tableDatas[0][2] = data3.total_production;
|
||||
that.tableDatas[1][2] = data3.elec_consume_unit;
|
||||
}
|
||||
})
|
||||
});
|
||||
//月目标
|
||||
let params5 = {};
|
||||
params5.page=0;
|
||||
params5.mgroup='3346520558031773696';
|
||||
this.$API.mtm.goal.list.req(params5).then((res5) => {
|
||||
if(res5.length>0){
|
||||
params5.page = 0;
|
||||
params5.mgroup = that.query.mgroup;
|
||||
this.$API.mtm.goal.list
|
||||
.req(params5)
|
||||
.then((res5) => {
|
||||
if (res5.length > 0) {
|
||||
let data5 = res5;
|
||||
data5.forEach(item5=>{
|
||||
let str = 'goal_val_'+that.month;
|
||||
if(item5.goal_cate_name=='总产量(t)'){
|
||||
that.tableDatas[0][5]=item5[str];
|
||||
that.tableDatas[0][7]=item5.goal_val;
|
||||
}else if(item5.goal_cate_name=='单位产品分布电耗(KW·h/t)'){
|
||||
that.tableDatas[1][5]=item5[str];
|
||||
that.tableDatas[1][7]=item5.goal_val;
|
||||
data5.forEach((item5) => {
|
||||
let str = "goal_val_" + that.month;
|
||||
if (item5.goal_cate_name == "总产量(t)") {
|
||||
that.tableDatas[0][5] = item5[str];
|
||||
that.tableDatas[0][7] = item5.goal_val;
|
||||
} else if (
|
||||
item5.goal_cate_name ==
|
||||
"单位产品分布电耗(KW·h/t)"
|
||||
) {
|
||||
that.tableDatas[1][5] = item5[str];
|
||||
that.tableDatas[1][7] = 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){
|
||||
if (res1.length > 0) {
|
||||
let data1 = res1[0];
|
||||
that.tableDatas[0][4]=data1.total_production;
|
||||
that.tableDatas[0][8]=precen(that.tableDatas[0][4],that.tableDatas[0][7])
|
||||
that.tableDatas[1][4]=data1.elec_consume_unit;
|
||||
that.tableDatas[1][8]=precen(that.tableDatas[1][4],that.tableDatas[1][7])
|
||||
|
||||
that.tableDatas[0][4] = data1.total_production;
|
||||
that.tableDatas[0][8] = precen(
|
||||
that.tableDatas[0][4],
|
||||
that.tableDatas[0][7]
|
||||
);
|
||||
that.tableDatas[1][4] = data1.elec_consume_unit;
|
||||
that.tableDatas[1][8] = precen(
|
||||
that.tableDatas[1][4],
|
||||
that.tableDatas[1][7]
|
||||
);
|
||||
}
|
||||
})
|
||||
});
|
||||
//月
|
||||
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){
|
||||
if (res2.length > 0) {
|
||||
let data2 = res2[0];
|
||||
that.tableDatas[0][3]=data2.total_production;
|
||||
that.tableDatas[0][6]=precen(that.tableDatas[0][3],that.tableDatas[0][5])
|
||||
that.tableDatas[1][3]=data2.elec_consume_unit;
|
||||
that.tableDatas[1][6]=precen(that.tableDatas[1][3],that.tableDatas[1][5])
|
||||
that.tableDatas[0][3] = data2.total_production;
|
||||
that.tableDatas[0][6] = precen(
|
||||
that.tableDatas[0][3],
|
||||
that.tableDatas[0][5]
|
||||
);
|
||||
that.tableDatas[1][3] = data2.elec_consume_unit;
|
||||
that.tableDatas[1][6] = precen(
|
||||
that.tableDatas[1][3],
|
||||
that.tableDatas[1][5]
|
||||
);
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
that.getDayData();
|
||||
that.getMonthData();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
//获取天数据
|
||||
getDayData(){
|
||||
getDayData() {
|
||||
let that = this;
|
||||
let query1 = {};
|
||||
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 = [];
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [];
|
||||
|
||||
let data = response;
|
||||
data.forEach(item => {
|
||||
data.forEach((item) => {
|
||||
let ind = item.day_s;
|
||||
seriesData0[ind] = item.total_production;
|
||||
seriesData1[ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = {...that.option1};
|
||||
options.series[0].data=seriesData0;
|
||||
options.series[1].data=seriesData1;
|
||||
let options = { ...that.option1 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
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(){
|
||||
getMonthData() {
|
||||
let that = this;
|
||||
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) => {
|
||||
let seriesData0 = [],seriesData1 = [];
|
||||
let seriesData0 = [],
|
||||
seriesData1 = [];
|
||||
let data = response;
|
||||
data.forEach(item => {
|
||||
data.forEach((item) => {
|
||||
let ind = item.month_s;
|
||||
seriesData0[ind] = item.total_production;
|
||||
seriesData1[ind] = item.elec_consume_unit;
|
||||
});
|
||||
let options = {...that.option2};
|
||||
options.series[0].data=seriesData0;
|
||||
options.series[1].data=seriesData1;
|
||||
let options = { ...that.option2 };
|
||||
options.series[0].data = seriesData0;
|
||||
options.series[1].data = seriesData1;
|
||||
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;
|
||||
this.cate=item[1];
|
||||
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);
|
||||
this.chartShow = true;
|
||||
});
|
||||
},
|
||||
itemClick(type, item) {
|
||||
this.type = type;
|
||||
this.cate = item[1];
|
||||
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>
|
||||
.printContainer{
|
||||
.printContainer {
|
||||
padding-left: 20px;
|
||||
}
|
||||
</style>
|
|
@ -77,11 +77,13 @@
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
exportLoading: false,
|
||||
timeStamp: null,
|
||||
query: {
|
||||
year_s: "",
|
||||
page: 0,
|
||||
type: "month_st",
|
||||
mgroup: "3347217757455728640",
|
||||
mgroup: "",
|
||||
},
|
||||
tableDatas: [],
|
||||
};
|
||||
|
@ -90,8 +92,25 @@ export default {
|
|||
let that = this;
|
||||
var myDate = new Date();
|
||||
let year = myDate.getFullYear();
|
||||
this.timeStamp = myDate.getTime();
|
||||
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: {
|
||||
getData() {
|
||||
|
@ -111,6 +130,7 @@ export default {
|
|||
//先按月份排序,再按班组排序
|
||||
let n0 = item0.month_s;
|
||||
let ind0 = 0;
|
||||
let team_name0 = item0.team_name;
|
||||
if (team_name0.indexOf("甲") > -1) {
|
||||
ind0 = (n0 - 1) * 3;
|
||||
} else if (team_name0.indexOf("乙") > -1) {
|
||||
|
@ -144,10 +164,10 @@ export default {
|
|||
arr.push(time);
|
||||
arr.push(item.team_name);
|
||||
arr.push(item.total_production);
|
||||
|
||||
arr[3] = item.elec_consume_unit; //当期值(KW·h/t)
|
||||
arr[4] = item.celec_consume_unit; //目标值(KW·h/t)//需要接口获取
|
||||
arr[5] = item.celec_consume_unit; //当期与目标差值(KW·h/t)
|
||||
let keyVale = "goal_val_" + n;
|
||||
arr[4] = goalData[keyVale]; //目标值(KW·h/t)//需要接口获取
|
||||
arr[5] = arr[3] - item.celec_consume_unit; //当期与目标差值(KW·h/t)
|
||||
let ind_pre = 0,
|
||||
huanbi = 0;
|
||||
if (item.month_s == 1) {
|
||||
|
|
|
@ -18,23 +18,28 @@
|
|||
<el-button
|
||||
type="primary"
|
||||
@click="exportExcel()"
|
||||
:loading = "exportLoading"
|
||||
: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">
|
||||
<el-card style="margin-top: 5px">
|
||||
<div class="printWrap">
|
||||
<div ref="print" id="myReport" class="printContainer">
|
||||
<table border="1" width="1075" cellspacing="0" :key="timeStamp" id="myTable" class="myTable">
|
||||
<table
|
||||
border="1"
|
||||
width="1075"
|
||||
cellspacing="0"
|
||||
:key="timeStamp"
|
||||
id="myTable"
|
||||
class="myTable"
|
||||
>
|
||||
<thead class="myTableHead">
|
||||
<tr>
|
||||
<th colspan="8">水泥包装工段车间单位产品电耗月度分析表</th>
|
||||
<th colspan="8">
|
||||
水泥包装工段车间单位产品电耗月度分析表
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>月份</th>
|
||||
|
@ -49,13 +54,25 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in tableDatas" :key="item">
|
||||
<td v-for="(item1,ind) in item" :key="ind" class="numCell">
|
||||
<div :class="bindClass(item1,ind)">
|
||||
<span v-if="item1>0&&ind==3">↑</span>
|
||||
<span v-if="item1<0&&ind==3">↓</span>
|
||||
<span v-if="item1<0&&ind==5">▲</span>
|
||||
<span v-if="item1<0&&ind==5">▼</span>
|
||||
{{item1}}
|
||||
<td
|
||||
v-for="(item1, ind) in item"
|
||||
:key="ind"
|
||||
class="numCell"
|
||||
>
|
||||
<div :class="bindClass(item1, ind)">
|
||||
<span v-if="item1 > 0 && ind == 3"
|
||||
>↑</span
|
||||
>
|
||||
<span v-if="item1 < 0 && ind == 3"
|
||||
>↓</span
|
||||
>
|
||||
<span v-if="item1 < 0 && ind == 5"
|
||||
>▲</span
|
||||
>
|
||||
<span v-if="item1 < 0 && ind == 5"
|
||||
>▼</span
|
||||
>
|
||||
{{ item1 }}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -65,31 +82,35 @@
|
|||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
<script>
|
||||
import scEcharts from "@/components/scEcharts";
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
export default {
|
||||
import scEcharts from "@/components/scEcharts";
|
||||
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,
|
||||
timeStamp: null,
|
||||
chartShow: false,
|
||||
myOption: null,
|
||||
query:{
|
||||
mgroup:'3347217757455728640',
|
||||
query: {
|
||||
mgroup: "",
|
||||
},
|
||||
monthGoal:[],
|
||||
tableDatas:[],
|
||||
modelValue:true,
|
||||
type:'hours',
|
||||
title:'title',
|
||||
apiObj:'',
|
||||
showClose:true,
|
||||
echartType:'line',
|
||||
asynDialog:false,
|
||||
monthGoal: [],
|
||||
tableDatas: [],
|
||||
modelValue: true,
|
||||
type: "hours",
|
||||
title: "title",
|
||||
apiObj: "",
|
||||
showClose: true,
|
||||
echartType: "line",
|
||||
asynDialog: false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
@ -97,174 +118,209 @@
|
|||
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;
|
||||
//月目标
|
||||
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)'){
|
||||
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.getMonthGoal();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 动态绑定Class
|
||||
bindClass(item,index){
|
||||
let classInfo = { redColor: false, greenColor: false }
|
||||
if(index==3||index==5){
|
||||
if( typeof(item)=='number'){
|
||||
if(item>0){
|
||||
bindClass(item, index) {
|
||||
let classInfo = { redColor: false, greenColor: false };
|
||||
if (index == 3 || index == 5) {
|
||||
if (typeof item == "number") {
|
||||
if (item > 0) {
|
||||
classInfo.greenColor = true;
|
||||
classInfo.redColor = false;
|
||||
}else if(item<0){
|
||||
} else if (item < 0) {
|
||||
classInfo.redColor = true;
|
||||
classInfo.greenColor = false
|
||||
classInfo.greenColor = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return classInfo
|
||||
return classInfo;
|
||||
},
|
||||
getData(){
|
||||
//月目标
|
||||
getMonthGoal() {
|
||||
let that = this;
|
||||
let query0={};
|
||||
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)"
|
||||
) {
|
||||
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();
|
||||
}
|
||||
});
|
||||
},
|
||||
getData() {
|
||||
let that = this;
|
||||
let query0 = {};
|
||||
query0.page = 0;
|
||||
query0.type='month_s';
|
||||
query0.year_s = that.query.year_s-1;
|
||||
query0.mgroup=that.query.mgroup;
|
||||
let wrapArr = [],wrapArr0 = [] ,wrapArrs = [];
|
||||
query0.type = "month_s";
|
||||
query0.year_s = that.query.year_s - 1;
|
||||
query0.mgroup = that.query.mgroup;
|
||||
let wrapArr = [],
|
||||
wrapArr0 = [],
|
||||
wrapArrs = [];
|
||||
this.$API.enm.enstat.req(query0).then((res0) => {
|
||||
let data0 = res0;
|
||||
if(data0.length>0){
|
||||
data0.forEach(item0 => {
|
||||
if (data0.length > 0) {
|
||||
data0.forEach((item0) => {
|
||||
//先按月份排序,再按班组排序
|
||||
let ind0 = item0.month_s;
|
||||
wrapArr0[ind0] = item0;
|
||||
});
|
||||
}
|
||||
let query={};
|
||||
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;
|
||||
query.mgroup = that.query.mgroup;
|
||||
that.$API.enm.enstat.req(query).then((res) => {
|
||||
let data = res;
|
||||
if(data.length>0){
|
||||
data.forEach(item => {
|
||||
if (data.length > 0) {
|
||||
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.push(item.elec_consume_unit); //当期值(KW·h/t)
|
||||
arr[2] =
|
||||
that.monthGoal[ind] !== undefined
|
||||
? that.monthGoal[ind]
|
||||
: "/";
|
||||
wrapArr[ind] = arr;
|
||||
});
|
||||
wrapArr.forEach((item,index)=>{
|
||||
wrapArr.forEach((item, index) => {
|
||||
let arrs = [];
|
||||
arrs[0]=item[0];
|
||||
arrs[1]=item[1];
|
||||
arrs[2]=item[2];
|
||||
arrs[0] = item[0];
|
||||
arrs[1] = item[1];
|
||||
arrs[2] = item[2];
|
||||
//目标值(KW·h/t)//需要接口获取
|
||||
//当期与目标差值(KW·h/t)
|
||||
let diff = 0;
|
||||
if(item[2]!=='/'){
|
||||
diff = item[1]-item[2];
|
||||
}else{
|
||||
diff = '/';
|
||||
if (item[2] !== "/") {
|
||||
diff = item[1] - item[2];
|
||||
} else {
|
||||
diff = "/";
|
||||
}
|
||||
arrs[3]=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){
|
||||
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 = "/";
|
||||
}
|
||||
}else{
|
||||
lastNum = wrapArr0[12]?wrapArr0[12].elec_consume_unit:'/';
|
||||
} else {
|
||||
lastNum = wrapArr0[12]
|
||||
? wrapArr0[12].elec_consume_unit
|
||||
: "/";
|
||||
}
|
||||
arrs[4]=lastNum;
|
||||
arrs[4] = lastNum;
|
||||
//当期与环期差值(KW·h/t)
|
||||
let lastDiff = 0;
|
||||
|
||||
if(arrs[1]!=='/'&&arrs[4]!=='/'){
|
||||
lastDiff =arrs[1]- arrs[4];
|
||||
}else{
|
||||
lastDiff = '/';
|
||||
if (arrs[1] !== "/" && arrs[4] !== "/") {
|
||||
lastDiff = arrs[1] - arrs[4];
|
||||
} else {
|
||||
lastDiff = "/";
|
||||
}
|
||||
arrs[5]=lastDiff;
|
||||
arrs[5] = lastDiff;
|
||||
//环比增长率(%)
|
||||
let lastRate = 0;
|
||||
if(lastDiff=='/'&&lastNum!=='/'&&lastNum!==0){
|
||||
lastRate = (lastDiff/lastNum)*100;
|
||||
}else{
|
||||
lastRate = '/'
|
||||
if (
|
||||
lastDiff == "/" &&
|
||||
lastNum !== "/" &&
|
||||
lastNum !== 0
|
||||
) {
|
||||
lastRate = (lastDiff / lastNum) * 100;
|
||||
} else {
|
||||
lastRate = "/";
|
||||
}
|
||||
arrs[6]=lastRate;
|
||||
arrs[6] = 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
|
||||
}else{
|
||||
sameRate='/';
|
||||
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;
|
||||
} else {
|
||||
sameRate = "/";
|
||||
}
|
||||
arrs[7]=sameRate;
|
||||
arrs[7] = sameRate;
|
||||
wrapArrs.push(arrs);
|
||||
})
|
||||
});
|
||||
that.tableDatas = wrapArrs;
|
||||
}else{
|
||||
} else {
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
},
|
||||
itemClick(type,item){
|
||||
this.type=type;
|
||||
itemClick(type, item) {
|
||||
this.type = type;
|
||||
this.asynDialog = true;
|
||||
},
|
||||
itemClick1(type,item){
|
||||
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;
|
||||
});
|
||||
},
|
||||
handleQuery() {
|
||||
this.getMonthGoal();
|
||||
},
|
||||
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>
|
||||
|
|
Loading…
Reference in New Issue