fix:电石渣mgroup根据名称通过接口获取id
This commit is contained in:
parent
6e7e535cfc
commit
93f058997a
|
@ -319,7 +319,7 @@ const routes = [
|
||||||
"name": "enm_rmbase",
|
"name": "enm_rmbase",
|
||||||
"path": "/enm_rmbase",
|
"path": "/enm_rmbase",
|
||||||
"meta": {
|
"meta": {
|
||||||
"title": "原料磨1",
|
"title": "原料磨",
|
||||||
"icon": "el-icon-list",
|
"icon": "el-icon-list",
|
||||||
"type": "menu",
|
"type": "menu",
|
||||||
"perms": ["enm_rmbase"]
|
"perms": ["enm_rmbase"]
|
||||||
|
@ -445,7 +445,7 @@ const routes = [
|
||||||
"name": "enm_kilnbase",
|
"name": "enm_kilnbase",
|
||||||
"path": "/enm_kilnbase",
|
"path": "/enm_kilnbase",
|
||||||
"meta": {
|
"meta": {
|
||||||
"title": "回转窑1",
|
"title": "回转窑",
|
||||||
"icon": "el-icon-menu",
|
"icon": "el-icon-menu",
|
||||||
"type": "menu",
|
"type": "menu",
|
||||||
"perms": ["enm_kilnbase"]
|
"perms": ["enm_kilnbase"]
|
||||||
|
@ -624,7 +624,7 @@ const routes = [
|
||||||
"name": "enm_coalbase",
|
"name": "enm_coalbase",
|
||||||
"path": "/enm_coalbase",
|
"path": "/enm_coalbase",
|
||||||
"meta": {
|
"meta": {
|
||||||
"title": "煤磨1",
|
"title": "煤磨",
|
||||||
"icon": "el-icon-brush-filled",
|
"icon": "el-icon-brush-filled",
|
||||||
"type": "menu",
|
"type": "menu",
|
||||||
"perms": ["enm_coalbase"]
|
"perms": ["enm_coalbase"]
|
||||||
|
|
|
@ -1,234 +1,360 @@
|
||||||
<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-table-column label="检验时间">
|
<el-select
|
||||||
<template #default="scope">
|
v-model="query.team"
|
||||||
<span v-if="scope.row.last_test_time">{{ scope.row.last_test_time.slice(0, 16) }}</span>
|
placeholder="班组"
|
||||||
</template>
|
clearable
|
||||||
</el-table-column>
|
style="margin-left: 2px; width: 120px"
|
||||||
<el-table-column label="操作" fixed="right" align="center" width="150">
|
>
|
||||||
<template #default="scope">
|
<el-option
|
||||||
<el-button link size="small" @click="sflog_edit(scope.row)" type="primary">编辑</el-button>
|
v-for="item in options"
|
||||||
<el-divider direction="vertical"></el-divider>
|
:key="item.id"
|
||||||
<el-button link size="small" @click="sflog_export(scope.row)" type="success">报表</el-button>
|
:label="item.name"
|
||||||
</template>
|
:value="item.id"
|
||||||
</el-table-column>
|
></el-option>
|
||||||
</scTable>
|
</el-select>
|
||||||
</el-main>
|
<el-button
|
||||||
<el-drawer v-model="limitedExport" size="60%" :show-close="false">
|
type="primary"
|
||||||
<template #header="{ close, titleId, titleClass }">
|
icon="el-icon-search"
|
||||||
<h4 :id="titleId" :class="titleClass">交接班日志</h4>
|
@click="handleQuery"
|
||||||
<el-button type="danger" @click="close">
|
></el-button>
|
||||||
<el-icon class="el-icon--left">
|
</div>
|
||||||
<CircleCloseFilled />
|
</el-header>
|
||||||
</el-icon>
|
<el-main class="nopadding">
|
||||||
关闭
|
<scTable
|
||||||
</el-button>
|
ref="table"
|
||||||
</template>
|
:apiObj="apiObj"
|
||||||
<div class="left-panel">
|
row-key="id"
|
||||||
<el-button type="primary" @click="exportExcel()" :loading="exportLoading">导出xlsx
|
stripe
|
||||||
</el-button>
|
:params="query"
|
||||||
<el-button type="primary" @click="handlePrint">打印
|
highlightCurrentRow
|
||||||
</el-button>
|
@row-click="rowClick"
|
||||||
</div>
|
>
|
||||||
<el-main class="nopadding">
|
<el-table-column type="index" width="50" />
|
||||||
<div ref="print" id="myReport" class="printContainer">
|
<el-table-column label="开始时间" prop="start_time">
|
||||||
<div style="margin-right: 20px;text-align: center;font-size: 16px;font-weight: bold;margin-bottom: 20px;">
|
<template #default="scope">
|
||||||
<span v-if="sflogItem.end_time">{{ sflogItem.end_time.slice(0, 10) }}{{ sflogItem.shift_name }}</span>
|
<span>{{ scope.row.start_time.slice(0, 16) }}</span>
|
||||||
<span v-if="sflogItem.team_name">{{ sflogItem.team_name }}</span>
|
</template>
|
||||||
交接班记录
|
</el-table-column>
|
||||||
</div>
|
<el-table-column label="结束时间" prop="end_time">
|
||||||
<table border="1" width="1000" cellspacing="0" :key="timeStamp" id="myTable">
|
<template #default="scope">
|
||||||
<tbody>
|
<span>{{ scope.row.end_time.slice(0, 16) }}</span>
|
||||||
<tr>
|
</template>
|
||||||
<td class="numCell">日期</td>
|
</el-table-column>
|
||||||
<td class="numCell" v-if="sflogItem.end_time">{{ sflogItem.end_time.slice(0, 10) }}</td>
|
<el-table-column
|
||||||
<td class="numCell">班次</td>
|
label="班组名称"
|
||||||
<td class="numCell">{{ sflogItem.shift_name }}</td>
|
prop="team_name"
|
||||||
<td class="numCell">班组</td>
|
></el-table-column>
|
||||||
<td class="numCell"><span v-if="sflogItem.team_name">{{ sflogItem.team_name }}</span></td>
|
<el-table-column
|
||||||
</tr>
|
label="当前班次"
|
||||||
<tr>
|
prop="shift_name"
|
||||||
<td class="numCell">产量(t)</td>
|
></el-table-column>
|
||||||
<td class="numCell">{{ reportItem.total_production }}</td>
|
<el-table-column
|
||||||
<td class="numCell">单位产品分布电耗(KW·h/t)</td>
|
label="班长"
|
||||||
<td class="numCell">{{ reportItem.elec_consume_unit }}</td>
|
prop="leader_name"
|
||||||
<td class="numCell">单位成本(元/吨)</td>
|
></el-table-column>
|
||||||
<td class="numCell">{{ reportItem.production_cost_unit }}</td>
|
<el-table-column label="检验时间">
|
||||||
</tr>
|
<template #default="scope">
|
||||||
<tr v-if="sflogexpList.length > 0">
|
<span v-if="scope.row.last_test_time">{{
|
||||||
<td class="numCell" :rowspan="sflogexpList.length + 1">生产情况记录</td>
|
scope.row.last_test_time.slice(0, 16)
|
||||||
<td class="numCell">时间</td>
|
}}</span>
|
||||||
<td class="numCell">类别</td>
|
</template>
|
||||||
<td class="numCell">原因</td>
|
</el-table-column>
|
||||||
<td class="numCell">处置措施</td>
|
<el-table-column
|
||||||
<td class="numCell">处置人</td>
|
label="操作"
|
||||||
</tr>
|
fixed="right"
|
||||||
<tr v-for="item in sflogexpList" :key="item.id">
|
align="center"
|
||||||
<td class="numCell">{{ item.happen_time }}</td>
|
width="150"
|
||||||
<td class="numCell">{{ item.cate }}</td>
|
>
|
||||||
<td class="numCell">{{ item.reason }}</td>
|
<template #default="scope">
|
||||||
<td class="numCell">{{ item.measure }}</td>
|
<el-button
|
||||||
<td class="numCell">{{ item.handler }}</td>
|
link
|
||||||
</tr>
|
size="small"
|
||||||
</tbody>
|
@click="sflog_edit(scope.row)"
|
||||||
</table>
|
type="primary"
|
||||||
</div>
|
>编辑</el-button
|
||||||
</el-main>
|
>
|
||||||
</el-drawer>
|
<el-divider direction="vertical"></el-divider>
|
||||||
</el-container>
|
<el-button
|
||||||
|
link
|
||||||
|
size="small"
|
||||||
|
@click="sflog_export(scope.row)"
|
||||||
|
type="success"
|
||||||
|
>报表</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</scTable>
|
||||||
|
</el-main>
|
||||||
|
<el-drawer v-model="limitedExport" size="60%" :show-close="false">
|
||||||
|
<template #header="{ close, titleId, titleClass }">
|
||||||
|
<h4 :id="titleId" :class="titleClass">交接班日志</h4>
|
||||||
|
<el-button type="danger" @click="close">
|
||||||
|
<el-icon class="el-icon--left">
|
||||||
|
<CircleCloseFilled />
|
||||||
|
</el-icon>
|
||||||
|
关闭
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
<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">班次</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>
|
||||||
|
<td class="numCell">单位成本(元/吨)</td>
|
||||||
|
<td class="numCell">
|
||||||
|
{{ reportItem.production_cost_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: "sflog",
|
name: "sflog",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
apiObj: this.$API.wpm.sflog.list,
|
apiObj: null,
|
||||||
apiObj2: null,
|
apiObj2: null,
|
||||||
query: {
|
query: {
|
||||||
mgroup: '3346491835287007232',
|
mgroup: "",
|
||||||
},
|
},
|
||||||
deptId: '3345780809943797760',
|
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>
|
||||||
|
|
|
@ -1,346 +1,425 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="left-panel">
|
<div class="left-panel">
|
||||||
<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="1035"
|
||||||
<div ref="print" id="myReport" class="printContainer">
|
cellspacing="0"
|
||||||
<table border="1" width="1035" cellspacing="0" :key="timeStamp" class="myTable" id="myTable">
|
:key="timeStamp"
|
||||||
<thead class="myTableHead">
|
class="myTable"
|
||||||
<tr>
|
id="myTable"
|
||||||
<th colspan="5">电石渣工段主要设备(100KW以上)单位产品电耗数据表</th>
|
>
|
||||||
</tr>
|
<thead class="myTableHead">
|
||||||
<tr>
|
<tr>
|
||||||
<th>设备名称</th>
|
<th colspan="5">
|
||||||
<th>设备编号</th>
|
电石渣工段主要设备(100KW以上)单位产品电耗数据表
|
||||||
<th>单位</th>
|
</th>
|
||||||
<th>昨日</th>
|
</tr>
|
||||||
<th>本月</th>
|
<tr>
|
||||||
</tr>
|
<th>设备名称</th>
|
||||||
</thead>
|
<th>设备编号</th>
|
||||||
<tbody>
|
<th>单位</th>
|
||||||
<tr v-for="item in tableDatas" :key="item">
|
<th>昨日</th>
|
||||||
<template v-for="(item1,ind) in item" :key="item1">
|
<th>本月</th>
|
||||||
<td v-if="ind==0||ind==1||ind==2" class="numCell">{{item1}}</td>
|
</tr>
|
||||||
<td v-if="ind==3" class="numCell" @click="itemClick('day_s',item)">{{item1}}</td>
|
</thead>
|
||||||
<td v-if="ind==4" class="numCell" @click="itemClick('month_s',item)">{{item1}}</td>
|
<tbody>
|
||||||
</template>
|
<tr v-for="item in tableDatas" :key="item">
|
||||||
</tr>
|
<template
|
||||||
</tbody>
|
v-for="(item1, ind) in item"
|
||||||
</table>
|
:key="item1"
|
||||||
<div class="chartWrap">
|
>
|
||||||
<div class="chartTitle">本月生产参数统计图</div>
|
<td
|
||||||
<scEcharts height="400px" width="1033px" :option="optionDay"></scEcharts>
|
v-if="ind == 0 || ind == 1 || ind == 2"
|
||||||
</div>
|
class="numCell"
|
||||||
<div class="chartWrap">
|
>
|
||||||
<div class="chartTitle">本年生产参数统计图</div>
|
{{ item1 }}
|
||||||
<scEcharts height="400px" width="1033px" :option="optionMonth"></scEcharts>
|
</td>
|
||||||
</div>
|
<td
|
||||||
</div>
|
v-if="ind == 3"
|
||||||
</div>
|
class="numCell"
|
||||||
<charts
|
@click="itemClick('day_s', item)"
|
||||||
v-if="asynDialog"
|
>
|
||||||
:type="type"
|
{{ item1 }}
|
||||||
:title="title"
|
</td>
|
||||||
:cate="cate"
|
<td
|
||||||
:apiObj = "apiObj"
|
v-if="ind == 4"
|
||||||
:mgroup="query.mgroup"
|
class="numCell"
|
||||||
:modelValue="modelValue"
|
@click="itemClick('month_s', item)"
|
||||||
:showClose="showClose"
|
>
|
||||||
:echartType='echartType'
|
{{ item1 }}
|
||||||
@closed="asynDialog = false"
|
</td>
|
||||||
></charts>
|
</template>
|
||||||
</el-card>
|
</tr>
|
||||||
</div>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="chartWrap">
|
||||||
|
<div class="chartTitle">本月生产参数统计图</div>
|
||||||
|
<scEcharts
|
||||||
|
height="400px"
|
||||||
|
width="1033px"
|
||||||
|
:option="optionDay"
|
||||||
|
></scEcharts>
|
||||||
|
</div>
|
||||||
|
<div class="chartWrap">
|
||||||
|
<div class="chartTitle">本年生产参数统计图</div>
|
||||||
|
<scEcharts
|
||||||
|
height="400px"
|
||||||
|
width="1033px"
|
||||||
|
:option="optionMonth"
|
||||||
|
></scEcharts>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<charts
|
||||||
|
v-if="asynDialog"
|
||||||
|
:type="type"
|
||||||
|
:title="title"
|
||||||
|
:cate="cate"
|
||||||
|
:apiObj="apiObj"
|
||||||
|
:mgroup="query.mgroup"
|
||||||
|
:modelValue="modelValue"
|
||||||
|
:showClose="showClose"
|
||||||
|
:echartType="echartType"
|
||||||
|
@closed="asynDialog = false"
|
||||||
|
></charts>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
const colors =['#647bfe'];
|
const colors = ["#647bfe"];
|
||||||
let tooltip= {
|
let tooltip = {
|
||||||
show: true,
|
show: true,
|
||||||
trigger: 'axis',
|
trigger: "axis",
|
||||||
axisPointer: {
|
axisPointer: {
|
||||||
type: 'cross'
|
type: "cross",
|
||||||
},
|
},
|
||||||
confine:false,
|
confine: false,
|
||||||
showContent: true,
|
showContent: true,
|
||||||
triggerOn:"mousemove",
|
timeStamp: null,
|
||||||
};
|
triggerOn: "mousemove",
|
||||||
let grid={
|
};
|
||||||
right: '3%',
|
let grid = {
|
||||||
left:'7%',
|
right: "3%",
|
||||||
top:'15%'
|
left: "7%",
|
||||||
};
|
top: "15%",
|
||||||
let toolbox={
|
};
|
||||||
right:'5%',
|
let toolbox = {
|
||||||
feature: {
|
right: "5%",
|
||||||
dataView: { show: true, readOnly: false },
|
feature: {
|
||||||
saveAsImage: { show: true }
|
dataView: { show: true, readOnly: false },
|
||||||
}
|
saveAsImage: { show: true },
|
||||||
};
|
},
|
||||||
let legend= {
|
};
|
||||||
top:'2%',
|
let legend = {
|
||||||
data:['烘干破主电机']
|
top: "2%",
|
||||||
};
|
data: ["烘干破主电机"],
|
||||||
let yAxis= {
|
};
|
||||||
type: 'value',
|
let yAxis = {
|
||||||
name: '分布电耗(KW.h/t)',
|
type: "value",
|
||||||
alignTicks: true,
|
name: "分布电耗(KW.h/t)",
|
||||||
axisLine: {
|
alignTicks: true,
|
||||||
show: true,
|
axisLine: {
|
||||||
lineStyle: {
|
show: true,
|
||||||
color: '#647bfe'
|
lineStyle: {
|
||||||
}
|
color: "#647bfe",
|
||||||
},
|
},
|
||||||
axisLabel: {
|
},
|
||||||
formatter: '{value}'
|
axisLabel: {
|
||||||
}
|
formatter: "{value}",
|
||||||
};
|
},
|
||||||
import scEcharts from "@/components/scEcharts";
|
};
|
||||||
import { defineAsyncComponent } from 'vue'
|
import scEcharts from "@/components/scEcharts";
|
||||||
export default {
|
import { defineAsyncComponent } from "vue";
|
||||||
components: {
|
export default {
|
||||||
scEcharts,
|
components: {
|
||||||
charts: defineAsyncComponent(() => import("@/components/scEnm/lineChartsdialog.vue")),
|
scEcharts,
|
||||||
},
|
charts: defineAsyncComponent(() =>
|
||||||
data() {
|
import("@/components/scEnm/lineChartsdialog.vue")
|
||||||
return {
|
),
|
||||||
chartShow: false,
|
},
|
||||||
myOption: null,
|
data() {
|
||||||
optionDay:{},
|
return {
|
||||||
optionMonth:{},
|
exportLoading: false,
|
||||||
year:2023,
|
chartShow: false,
|
||||||
month:1,
|
myOption: null,
|
||||||
query: {
|
optionDay: {},
|
||||||
mgroup:'3346491835287007232',
|
optionMonth: {},
|
||||||
},
|
year: 2023,
|
||||||
tableName:'主要设备(100KW以上)单位产品电耗数据表',
|
month: 1,
|
||||||
tableDatas:[
|
query: {
|
||||||
['烘干破主电机','','kw.h/t','','',''],
|
mgroup: "",
|
||||||
],
|
},
|
||||||
modelValue:true,
|
tableName: "主要设备(100KW以上)单位产品电耗数据表",
|
||||||
type:'hour_s',
|
tableDatas: [["烘干破主电机", "", "kw.h/t", "", "", ""]],
|
||||||
title:'电石渣工段',
|
modelValue: true,
|
||||||
cate:'',
|
type: "hour_s",
|
||||||
apiObj:this.$API.enm.mpoint.stat,
|
title: "电石渣工段",
|
||||||
showClose:true,
|
cate: "",
|
||||||
echartType:'line',
|
apiObj: this.$API.enm.mpoint.stat,
|
||||||
asynDialog:false,
|
showClose: true,
|
||||||
allValDays:0,
|
echartType: "line",
|
||||||
allValMonth:0,
|
asynDialog: false,
|
||||||
option1:{
|
allValDays: 0,
|
||||||
color: colors,
|
allValMonth: 0,
|
||||||
tooltip:tooltip,
|
option1: {
|
||||||
grid: grid,
|
color: colors,
|
||||||
toolbox: toolbox,
|
tooltip: tooltip,
|
||||||
legend:legend,
|
grid: grid,
|
||||||
xAxis: {
|
toolbox: toolbox,
|
||||||
axisTick: {
|
legend: legend,
|
||||||
show: true,
|
xAxis: {
|
||||||
length: 5,
|
axisTick: {
|
||||||
inside: true,
|
show: true,
|
||||||
},
|
length: 5,
|
||||||
data: []
|
inside: true,
|
||||||
},
|
},
|
||||||
yAxis:yAxis,
|
data: [],
|
||||||
series:{
|
},
|
||||||
name: '烘干破主电机',
|
yAxis: yAxis,
|
||||||
type: 'bar',
|
series: {
|
||||||
data:[]
|
name: "烘干破主电机",
|
||||||
}
|
type: "bar",
|
||||||
},
|
data: [],
|
||||||
option2:{
|
},
|
||||||
color: colors,
|
},
|
||||||
tooltip:tooltip,
|
option2: {
|
||||||
grid: grid,
|
color: colors,
|
||||||
toolbox: toolbox,
|
tooltip: tooltip,
|
||||||
legend: legend,
|
grid: grid,
|
||||||
xAxis: {
|
toolbox: toolbox,
|
||||||
axisTick: {
|
legend: legend,
|
||||||
show: true,
|
xAxis: {
|
||||||
length: 5,
|
axisTick: {
|
||||||
inside: true,
|
show: true,
|
||||||
},
|
length: 5,
|
||||||
data: []
|
inside: true,
|
||||||
},
|
},
|
||||||
yAxis: yAxis,
|
data: [
|
||||||
series:{
|
"一月",
|
||||||
name: '烘干破主电机',
|
"二月",
|
||||||
type: 'bar',
|
"三月",
|
||||||
data:[]
|
"四月",
|
||||||
}
|
"五月",
|
||||||
},
|
"六月",
|
||||||
};
|
"七月",
|
||||||
},
|
"八月",
|
||||||
mounted() {
|
"九月",
|
||||||
let that = this;
|
"十月",
|
||||||
var myDate = new Date();
|
"十一月",
|
||||||
let year = myDate.getFullYear();
|
"十二月",
|
||||||
let month = myDate.getMonth()+1;
|
],
|
||||||
let days = myDate.getDate();
|
},
|
||||||
let hours = myDate.getHours();
|
yAxis: yAxis,
|
||||||
let timeDate = myDate.getTime();
|
series: {
|
||||||
let dayTime = 24 * 60 * 60 * 1000;
|
name: "烘干破主电机",
|
||||||
//昨天的计算
|
type: "bar",
|
||||||
let year_d = year,month_d = month,days_d = days;
|
data: [],
|
||||||
if(hours<21){//21点前,查找昨日数据为前一天数据
|
},
|
||||||
let newDate = timeDate- dayTime;
|
},
|
||||||
let lastDate = new Date(newDate);
|
};
|
||||||
year_d = lastDate.getFullYear();
|
},
|
||||||
month_d = lastDate.getMonth()+1;
|
mounted() {
|
||||||
days_d = lastDate.getDate();
|
let that = this;
|
||||||
}
|
var myDate = new Date();
|
||||||
//本月
|
let year = myDate.getFullYear();
|
||||||
let params2 = {};
|
let month = myDate.getMonth() + 1;
|
||||||
params2.page = 0;
|
let days = myDate.getDate();
|
||||||
params2.year_s = year;
|
let hours = myDate.getHours();
|
||||||
params2.month_s = month;
|
let timeDate = myDate.getTime();
|
||||||
params2.type = 'month_s';
|
this.timeStamp = timeDate;
|
||||||
params2.mgroup = this.query.mgroup;
|
this.year = year;
|
||||||
this.$API.enm.enstat.req(params2).then((res2) => {
|
this.month = month;
|
||||||
if(res2.length>0){
|
this.days = days;
|
||||||
let allValMonth=that.allValMonth = res2[0].total_production;//当前条件下的总产量
|
|
||||||
params2.mpoint__ep_monitored__power_kw__gte = 100;
|
let dayTime = 24 * 60 * 60 * 1000;
|
||||||
this.$API.enm.mpoint.stat.req(params2).then((res) => {
|
//昨天的计算
|
||||||
let data2 = res;
|
let year_d = year,
|
||||||
for (let i = 0; i < data2.length; i++) {
|
month_d = month,
|
||||||
that.tableDatas[i]=[];
|
days_d = days;
|
||||||
that.tableDatas[i][0]=data2[i].ep_monitored_name;
|
if (hours < 21) {
|
||||||
that.tableDatas[i][1]=data2[i].ep_monitored_number;
|
//21点前,查找昨日数据为前一天数据
|
||||||
that.tableDatas[i][2]='KW·h/t';
|
let newDate = timeDate - dayTime;
|
||||||
let val = allValMonth==0?'/':(data2[i].val/allValMonth).toFixed(2);
|
let lastDate = new Date(newDate);
|
||||||
that.tableDatas[i][4]=val;
|
year_d = lastDate.getFullYear();
|
||||||
}
|
month_d = lastDate.getMonth() + 1;
|
||||||
})
|
days_d = lastDate.getDate();
|
||||||
}
|
}
|
||||||
}).then(res2=>{
|
this.$API.mtm.mgroup.list
|
||||||
//昨日
|
.req({ page: 0, search: "电石渣" })
|
||||||
let params3 = {};
|
.then((res) => {
|
||||||
params3.page = 0;
|
console.log("电石渣", res);
|
||||||
params3.year_s = year_d;
|
that.query.mgroup = res[0].id;
|
||||||
params3.month_s = month_d;
|
//本月
|
||||||
params3.day_s = days_d;
|
let params2 = {};
|
||||||
params3.type = 'day_s';
|
params2.page = 0;
|
||||||
params3.mgroup = this.query.mgroup;
|
params2.year_s = year;
|
||||||
this.$API.enm.enstat.req(params3).then((res3) => {
|
params2.month_s = month;
|
||||||
if(res3.length>0){
|
params2.type = "month_s";
|
||||||
let allValDays=that.allValDays = res3[0].total_production;
|
params2.mgroup = this.query.mgroup;
|
||||||
params3.mpoint__ep_monitored__power_kw__gte = 100;
|
this.$API.enm.enstat
|
||||||
this.$API.enm.mpoint.stat.req(params3).then((res) => {
|
.req(params2)
|
||||||
let data3 = res3;
|
.then((res2) => {
|
||||||
for (let j = 0; j < data3.length; j++) {
|
if (res2.length > 0) {
|
||||||
let val = allValDays==0?'/':(data3[j].val/allValDays).toFixed(2);
|
let allValMonth = (that.allValMonth =
|
||||||
that.tableDatas[j][3]=val;
|
res2[0].total_production); //当前条件下的总产量
|
||||||
}
|
params2.mpoint__ep_monitored__power_kw__gte = 100;
|
||||||
})
|
this.$API.enm.mpoint.stat
|
||||||
}
|
.req(params2)
|
||||||
})
|
.then((res) => {
|
||||||
})
|
let data2 = res;
|
||||||
that.getDayData();
|
for (let i = 0; i < data2.length; i++) {
|
||||||
that.getMonthData();
|
that.tableDatas[i] = [];
|
||||||
},
|
that.tableDatas[i][0] =
|
||||||
methods: {
|
data2[i].ep_monitored_name;
|
||||||
//获取天数据
|
that.tableDatas[i][1] =
|
||||||
getDayData(){
|
data2[i].ep_monitored_number;
|
||||||
let that = this;
|
that.tableDatas[i][2] = "KW·h/t";
|
||||||
let query1 = {};
|
let val =
|
||||||
query1.page = 0;
|
allValMonth == 0
|
||||||
query1.year_s = that.year;
|
? "/"
|
||||||
query1.month_s = that.month;
|
: (
|
||||||
query1.type = 'day_s';
|
data2[i].val /
|
||||||
query1.mgroup = this.query.mgroup;
|
allValMonth
|
||||||
query1.mpoint__ep_monitored__power_kw__gte = 100;
|
).toFixed(2);
|
||||||
this.$API.enm.enstat.req(query1).then((response) => {
|
that.tableDatas[i][4] = val;
|
||||||
let seriesData0 = [];
|
}
|
||||||
let data = response;
|
});
|
||||||
data.forEach(item => {
|
}
|
||||||
let ind = item.day_s;
|
})
|
||||||
let val=0;
|
.then((res2) => {
|
||||||
if(that.allValDays==0){
|
//昨日
|
||||||
val = ''
|
let params3 = {};
|
||||||
}else{
|
params3.page = 0;
|
||||||
val = (item.val/that.allValDays).toFixed(2);
|
params3.year_s = year_d;
|
||||||
}
|
params3.month_s = month_d;
|
||||||
if(item.equip_name=='烘干破主电机'){
|
params3.day_s = days_d;
|
||||||
seriesData0[ind] = val;
|
params3.type = "day_s";
|
||||||
}
|
params3.mgroup = this.query.mgroup;
|
||||||
});
|
this.$API.enm.enstat.req(params3).then((res3) => {
|
||||||
let options = {...that.option1};
|
if (res3.length > 0) {
|
||||||
options.series.data=seriesData0;
|
let allValDays = (that.allValDays =
|
||||||
let dayXAxis = [];
|
res3[0].total_production);
|
||||||
for (let i = 1; i <= that.days; i++) {
|
params3.mpoint__ep_monitored__power_kw__gte = 100;
|
||||||
let item = i+'日'
|
this.$API.enm.mpoint.stat
|
||||||
dayXAxis.push(item)
|
.req(params3)
|
||||||
}
|
.then((res) => {
|
||||||
options.xAxis.data = dayXAxis;
|
let data3 = res3;
|
||||||
that.optionDay = options;
|
for (let j = 0; j < data3.length; j++) {
|
||||||
})
|
let val =
|
||||||
},
|
allValDays == 0
|
||||||
//获取月数据
|
? "/"
|
||||||
getMonthData(){
|
: (
|
||||||
let that = this;
|
data3[j].val /
|
||||||
let query2 = {};
|
allValDays
|
||||||
query2.page = 0;
|
).toFixed(2);
|
||||||
query2.year_s = that.year;
|
that.tableDatas[j][3] = val;
|
||||||
query2.type = 'month_s';
|
}
|
||||||
query2.mgroup = that.query.mgroup;
|
});
|
||||||
query2.mpoint__ep_monitored__power_kw__gte = 100;
|
}
|
||||||
this.$API.enm.enstat.req(query2).then((response) => {
|
});
|
||||||
let seriesData0 = [];
|
});
|
||||||
let data = response;
|
that.getDayData();
|
||||||
data.forEach(item => {
|
that.getMonthData();
|
||||||
let ind = item.month_s;
|
});
|
||||||
let val=0;
|
},
|
||||||
if(that.allValMonth==0){
|
methods: {
|
||||||
val = ''
|
//获取天数据
|
||||||
}else{
|
getDayData() {
|
||||||
val = (item.val/that.allValMonth).toFixed(2);
|
let that = this;
|
||||||
}
|
let query1 = {};
|
||||||
if(item.equip_name=='烘干破主电机'){
|
query1.page = 0;
|
||||||
seriesData0[ind] = val;
|
query1.year_s = that.year;
|
||||||
}
|
query1.month_s = that.month;
|
||||||
});
|
query1.type = "day_s";
|
||||||
let options = {...that.option2};
|
query1.mgroup = this.query.mgroup;
|
||||||
options.series.data=seriesData0;
|
query1.mpoint__ep_monitored__power_kw__gte = 100;
|
||||||
let monthXAxis = [];
|
this.$API.enm.enstat.req(query1).then((response) => {
|
||||||
for (let i = 1; i <= that.month; i++) {
|
let seriesData0 = [];
|
||||||
let item = i+'月'
|
let data = response;
|
||||||
monthXAxis.push(item)
|
data.forEach((item) => {
|
||||||
}
|
let ind = item.day_s;
|
||||||
options.xAxis.data = monthXAxis;
|
let val = 0;
|
||||||
that.optionMonth = options;
|
if (that.allValDays == 0) {
|
||||||
})
|
val = "";
|
||||||
},
|
} else {
|
||||||
itemClick(type,item){
|
val = (item.val / that.allValDays).toFixed(2);
|
||||||
this.type=type;
|
}
|
||||||
this.cate = item[0];
|
if (item.equip_name == "烘干破主电机") {
|
||||||
this.asynDialog = true;
|
seriesData0[ind] = val;
|
||||||
},
|
}
|
||||||
handlePrint() {
|
});
|
||||||
this.$PRINT('#myReport');
|
let options = { ...that.option1 };
|
||||||
},
|
options.series.data = seriesData0;
|
||||||
exportExcel() {
|
let dayXAxis = [];
|
||||||
this.exportLoading = true;
|
for (let i = 1; i <= that.days; i++) {
|
||||||
this.$XLSX('#myTable', this.tableName)
|
let item = i + "日";
|
||||||
this.exportLoading = false;
|
dayXAxis.push(item);
|
||||||
},
|
}
|
||||||
}
|
options.xAxis.data = dayXAxis;
|
||||||
};
|
that.optionDay = options;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//获取月数据
|
||||||
|
getMonthData() {
|
||||||
|
let that = this;
|
||||||
|
let query2 = {};
|
||||||
|
query2.page = 0;
|
||||||
|
query2.year_s = that.year;
|
||||||
|
query2.type = "month_s";
|
||||||
|
query2.mgroup = that.query.mgroup;
|
||||||
|
query2.mpoint__ep_monitored__power_kw__gte = 100;
|
||||||
|
this.$API.enm.enstat.req(query2).then((response) => {
|
||||||
|
let seriesData0 = [];
|
||||||
|
let data = response;
|
||||||
|
data.forEach((item) => {
|
||||||
|
let ind = item.month_s;
|
||||||
|
let val = 0;
|
||||||
|
if (that.allValMonth == 0) {
|
||||||
|
val = "";
|
||||||
|
} else {
|
||||||
|
val = (item.val / that.allValMonth).toFixed(2);
|
||||||
|
}
|
||||||
|
if (item.equip_name == "烘干破主电机") {
|
||||||
|
seriesData0[ind] = val;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
let options = { ...that.option2 };
|
||||||
|
options.series.data = seriesData0;
|
||||||
|
that.optionMonth = options;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
itemClick(type, item) {
|
||||||
|
this.type = type;
|
||||||
|
this.cate = item[0];
|
||||||
|
this.asynDialog = true;
|
||||||
|
},
|
||||||
|
handlePrint() {
|
||||||
|
this.$PRINT("#myReport");
|
||||||
|
},
|
||||||
|
exportExcel() {
|
||||||
|
this.exportLoading = true;
|
||||||
|
this.$XLSX("#myTable", this.tableName);
|
||||||
|
this.exportLoading = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.printContainer{
|
.printContainer {
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,221 +1,250 @@
|
||||||
<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="12">电石渣工段班组月度对比分析</th>
|
>
|
||||||
</tr>
|
<thead class="myTableHead">
|
||||||
<tr>
|
<tr>
|
||||||
<th rowspan="2">月份</th>
|
<th colspan="12">电石渣工段班组月度对比分析</th>
|
||||||
<th rowspan="2">班组</th>
|
</tr>
|
||||||
<th rowspan="2">总产量(t)</th>
|
<tr>
|
||||||
<th rowspan="2">单位产品成本(元/吨)</th>
|
<th rowspan="2">月份</th>
|
||||||
<th colspan="7">产品单位电耗</th>
|
<th rowspan="2">班组</th>
|
||||||
<th rowspan="2">得分</th>
|
<th rowspan="2">总产量(t)</th>
|
||||||
</tr>
|
<th rowspan="2">单位产品成本(元/吨)</th>
|
||||||
<tr>
|
<th colspan="7">产品单位电耗</th>
|
||||||
<th>当期值(kKW·h/t)</th>
|
<th rowspan="2">得分</th>
|
||||||
<th>目标值(kKW·h/t)</th>
|
</tr>
|
||||||
<th>当期与目标值差值(KW·h/t)</th>
|
<tr>
|
||||||
<th>环期值(KW·h/t)</th>
|
<th>当期值(kKW·h/t)</th>
|
||||||
<th>当期与环期值差值(KW·h/t)</th>
|
<th>目标值(kKW·h/t)</th>
|
||||||
<th>环比增长率(%)</th>
|
<th>当期与目标值差值(KW·h/t)</th>
|
||||||
<th>同比增长率(%)</th>
|
<th>环期值(KW·h/t)</th>
|
||||||
</tr>
|
<th>当期与环期值差值(KW·h/t)</th>
|
||||||
</thead>
|
<th>环比增长率(%)</th>
|
||||||
<tr v-for="(item,index) in tableDatas" :key="index">
|
<th>同比增长率(%)</th>
|
||||||
<td v-for="(item0,index0) in item" :key="index0" class="numCell">{{item0}}</td>
|
</tr>
|
||||||
</tr>
|
</thead>
|
||||||
</table>
|
<tr v-for="(item, index) in tableDatas" :key="index">
|
||||||
</div>
|
<td
|
||||||
</div>
|
v-for="(item0, index0) in item"
|
||||||
</el-card>
|
:key="index0"
|
||||||
</div>
|
class="numCell"
|
||||||
</template>
|
>
|
||||||
|
{{ item0 }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
query:{
|
query: {
|
||||||
year_s:'',
|
year_s: "",
|
||||||
page : 0,
|
page: 0,
|
||||||
type : 'month_st',
|
type: "month_st",
|
||||||
mgroup:'3346491835287007232',
|
mgroup: "",
|
||||||
},
|
},
|
||||||
tableDatas:[],
|
timeStamp: null,
|
||||||
};
|
exportLoading: false,
|
||||||
},
|
tableDatas: [],
|
||||||
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 params = {};
|
let year = myDate.getFullYear();
|
||||||
params.page=0;
|
this.timeStamp = myDate.getTime();
|
||||||
params.year=year;
|
that.query.year_s = year;
|
||||||
params.mgroup=that.query.mgroup;
|
this.$API.mtm.mgroup.list
|
||||||
this.$API.mtm.goal.list.req(params).then((res) => {
|
.req({ page: 0, search: "电石渣" })
|
||||||
let data = [];
|
.then((res) => {
|
||||||
if(res.length>0){
|
console.log("电石渣", res);
|
||||||
data = res[0];
|
that.query.mgroup = res[0].id;
|
||||||
}
|
let params = {};
|
||||||
that.getData(data);
|
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(goalData) {
|
||||||
|
let that = this;
|
||||||
|
let query0 = {};
|
||||||
|
query0.page = 0;
|
||||||
|
query0.type = "month_st";
|
||||||
|
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) => {
|
||||||
|
//先按月份排序,再按班组排序
|
||||||
|
let n0 = item0.month_s;
|
||||||
|
let ind0 = 0;
|
||||||
|
if (item0.team_name.indexOf("甲") > -1) {
|
||||||
|
ind0 = (n0 - 1) * 3;
|
||||||
|
} else if (item0.team_name.indexOf("乙") > -1) {
|
||||||
|
ind0 = (n0 - 1) * 3 + 1;
|
||||||
|
} else if (item0.team_name.indexOf("丙") > -1) {
|
||||||
|
ind0 = (n0 - 1) * 3 + 2;
|
||||||
|
}
|
||||||
|
wrapArr0[ind0] = item0;
|
||||||
|
});
|
||||||
|
console.log(wrapArr0);
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
this.$API.enm.enstat.req(that.query).then((res) => {
|
||||||
|
let data = res;
|
||||||
|
if (data.length > 0) {
|
||||||
|
data.forEach((item) => {
|
||||||
|
//先按月份排序,再按班组排序
|
||||||
|
let n = item.month_s;
|
||||||
|
let team_name = item.team_name;
|
||||||
|
let ind = 0;
|
||||||
|
if (team_name.indexOf("甲") > -1) {
|
||||||
|
ind = (n - 1) * 3;
|
||||||
|
} else if (team_name.indexOf("乙") > -1) {
|
||||||
|
ind = (n - 1) * 3 + 1;
|
||||||
|
} else if (team_name.indexOf("丙") > -1) {
|
||||||
|
ind = (n - 1) * 3 + 2;
|
||||||
|
}
|
||||||
|
wrapArrs[ind] = item;
|
||||||
|
let arr = [];
|
||||||
|
let time = "" + item.year_s + "." + item.month_s;
|
||||||
|
arr.push(time);
|
||||||
|
arr.push(item.team_name);
|
||||||
|
arr.push(item.total_production);
|
||||||
|
arr.push(item.production_hour);
|
||||||
|
|
||||||
},
|
arr[4] = item.elec_consume_unit; //当期值(KW·h/t)
|
||||||
methods: {
|
let keyVale = "goal_val_" + n;
|
||||||
getData(goalData){
|
arr[5] = goalData[keyVale]; //目标值(KW·h/t)//需要接口获取
|
||||||
let that = this;
|
arr[6] = arr[4] - item.celec_consume_unit; //当期与目标差值(KW·h/t)
|
||||||
let query0={};
|
let ind_pre = 0,
|
||||||
query0.page = 0;
|
huanqi = 0,
|
||||||
query0.type='month_st';
|
huanqicha = 0,
|
||||||
query0.year_s = that.query.year_s-1;
|
tongqi = 0,
|
||||||
query0.mgroup='3346491835287007232';
|
tongqicha = 0;
|
||||||
let wrapArr = [],wrapArr0 = [] ,wrapArrs = [];
|
if (n == 1) {
|
||||||
this.$API.enm.enstat.req(query0).then((res0) => {
|
ind_pre = 12;
|
||||||
let data0 = res0;
|
huanqi = wrapArr0[ind_pre]
|
||||||
if(data0.length>0){
|
? wrapArr0[ind_pre].elec_consume_unit
|
||||||
data0.forEach(item0 => {
|
: "/";
|
||||||
//先按月份排序,再按班组排序
|
} else {
|
||||||
let n0 = item0.month_s;
|
ind_pre = n - 1;
|
||||||
let ind0 = 0;
|
huanqi = wrapArr[ind_pre]
|
||||||
if(team_name0.indexOf('甲')>-1){
|
? wrapArr[ind_pre].elec_consume_unit
|
||||||
ind0 = (n0-1)*3;
|
? wrapArr[ind_pre].elec_consume_unit
|
||||||
}else if(team_name0.indexOf('乙')>-1){
|
: "/"
|
||||||
ind0 = (n0-1)*3+1;
|
: "/";
|
||||||
}else if(team_name0.indexOf('丙')>-1){
|
}
|
||||||
ind0 = (n0-1)*3+2;
|
arr[7] = huanqi; //环期值(KW·h/t)上个月的值
|
||||||
}
|
if (huanqi !== "/") {
|
||||||
wrapArr0[ind0] = item0;
|
huanqicha = item.celec_consume_unit - huanqi;
|
||||||
});
|
} else {
|
||||||
console.log(wrapArr0)
|
huanqicha = item.celec_consume_unit;
|
||||||
}else{
|
}
|
||||||
}
|
arr[8] = huanqicha; //当期与环期差值(KW·h/t)
|
||||||
this.$API.enm.enstat.req(that.query).then((res) => {
|
arr[9] =
|
||||||
let data = res;
|
huanqi != "/" ? (huanqicha / huanqi) * 100 : 0; //环比增长率(%)
|
||||||
if(data.length>0){
|
if (wrapArr0[n]) {
|
||||||
data.forEach(item => {
|
tongqicha =
|
||||||
//先按月份排序,再按班组排序
|
item.celec_consume_unit -
|
||||||
let n = item.month_s;
|
wrapArr0[n].celec_consume_unit;
|
||||||
let team_name = item.team_name;
|
tongqi = tongqicha / tongqi;
|
||||||
let ind = 0;
|
} else {
|
||||||
if(team_name.indexOf('甲')>-1){
|
tongqicha = item.celec_consume_unit;
|
||||||
ind = (n-1)*3;
|
tongqi = 0;
|
||||||
}else if(team_name.indexOf('乙')>-1){
|
}
|
||||||
ind = (n-1)*3+1;
|
arr[10] = tongqi; //同比增长率(%)
|
||||||
}else if(team_name.indexOf('丙')>-1){
|
arr[11] = 0; //得分
|
||||||
ind = (n-1)*3+2;
|
wrapArr[ind] = arr;
|
||||||
}
|
});
|
||||||
wrapArrs[ind] = item;
|
that.tableDatas = wrapArr;
|
||||||
let arr = [];
|
} else {
|
||||||
let time = ''+item.year_s+'.'+item.month_s;
|
}
|
||||||
arr.push(time);
|
});
|
||||||
arr.push(item.team_name);
|
});
|
||||||
arr.push(item.total_production);
|
},
|
||||||
arr.push(item.production_hour);
|
handleQuery() {
|
||||||
|
this.tableDatas = [];
|
||||||
arr[4]=item.elec_consume_unit//当期值(KW·h/t)
|
this.getData();
|
||||||
let keyVale ='goal_val_'+n;
|
},
|
||||||
arr[5]=goalData[keyVale];//目标值(KW·h/t)//需要接口获取
|
itemClick(type, item) {
|
||||||
arr[6]=arr[4]-item.celec_consume_unit;//当期与目标差值(KW·h/t)
|
this.type = type;
|
||||||
let ind_pre = 0,huanqi = 0,huanqicha=0,tongqi=0,tongqicha=0;
|
this.asynDialog = true;
|
||||||
if(n==1){
|
},
|
||||||
ind_pre = 12;
|
itemClick1(type, item) {
|
||||||
huanqi = wrapArr0[ind_pre]?wrapArr0[ind_pre].elec_consume_unit:'/';
|
this.chartShow = false;
|
||||||
}else{
|
this.$API.bi.dataset.exec.req("3322567213885833216").then((res) => {
|
||||||
ind_pre=n-1;
|
this.myOption = JSON.parse(res.echart_options);
|
||||||
huanqi = wrapArr[ind_pre]?wrapArr[ind_pre].elec_consume_unit?wrapArr[ind_pre].elec_consume_unit:'/':'/'
|
debugger;
|
||||||
}
|
console.log(this.myOption);
|
||||||
arr[7]=huanqi;//环期值(KW·h/t)上个月的值
|
this.chartShow = true;
|
||||||
if(huanqi!=='/'){
|
});
|
||||||
huanqicha = item.celec_consume_unit-huanqi;
|
},
|
||||||
}else{
|
handlePrint() {
|
||||||
huanqicha = item.celec_consume_unit
|
this.$PRINT("#myReport");
|
||||||
}
|
},
|
||||||
arr[8]=huanqicha;//当期与环期差值(KW·h/t)
|
exportExcel() {
|
||||||
arr[9]=huanqi!='/'? huanqicha/huanqi*100:0;//环比增长率(%)
|
this.exportLoading = true;
|
||||||
if(wrapArr0[n]){
|
this.$XLSX("#myTable", this.tableName);
|
||||||
tongqicha = item.celec_consume_unit-wrapArr0[n].celec_consume_unit;
|
this.exportLoading = false;
|
||||||
tongqi = tongqicha/tongqi;
|
},
|
||||||
}else{
|
},
|
||||||
tongqicha = item.celec_consume_unit;
|
};
|
||||||
tongqi = 0;
|
|
||||||
}
|
|
||||||
arr[10]=tongqi;//同比增长率(%)
|
|
||||||
arr[11]=0;//得分
|
|
||||||
wrapArr[ind] = arr;
|
|
||||||
});
|
|
||||||
console.log(wrapArr)
|
|
||||||
that.tableDatas = wrapArr;
|
|
||||||
}else{
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
handleQuery(){
|
|
||||||
this.tableDatas = [];
|
|
||||||
this.getData();
|
|
||||||
},
|
|
||||||
itemClick(type,item){
|
|
||||||
this.type=type;
|
|
||||||
this.asynDialog = true;
|
|
||||||
},
|
|
||||||
itemClick1(type,item){
|
|
||||||
this.chartShow = false;
|
|
||||||
this.$API.bi.dataset.exec
|
|
||||||
.req('3322567213885833216')
|
|
||||||
.then((res) => {
|
|
||||||
this.myOption = JSON.parse(res.echart_options);
|
|
||||||
debugger;
|
|
||||||
console.log(this.myOption)
|
|
||||||
this.chartShow = true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
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>
|
|
@ -1,274 +1,320 @@
|
||||||
<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>
|
||||||
<th>当期值(KW·h/t)</th>
|
</tr>
|
||||||
<th>目标值(KW·h/t)</th>
|
<tr>
|
||||||
<th>当期与目标差值(KW·h/t)</th>
|
<th>月份</th>
|
||||||
<th>环期值(KW·h/t)</th>
|
<th>当期值(KW·h/t)</th>
|
||||||
<th>当期与环期差值(KW·h/t)</th>
|
<th>目标值(KW·h/t)</th>
|
||||||
<th>环比增长率(%)</th>
|
<th>当期与目标差值(KW·h/t)</th>
|
||||||
<th>同比增长率(%)</th>
|
<th>环期值(KW·h/t)</th>
|
||||||
</tr>
|
<th>当期与环期差值(KW·h/t)</th>
|
||||||
</thead>
|
<th>环比增长率(%)</th>
|
||||||
<tbody>
|
<th>同比增长率(%)</th>
|
||||||
<tr v-for="item in tableDatas" :key="item">
|
</tr>
|
||||||
<td v-for="(item1,ind) in item" :key="ind" class="numCell">
|
</thead>
|
||||||
<div :class="bindClass(item1,ind)">
|
<tbody>
|
||||||
<span v-if="item1>0&&ind==3">↑</span>
|
<tr v-for="item in tableDatas" :key="item">
|
||||||
<span v-if="item1<0&&ind==3">↓</span>
|
<td
|
||||||
<span v-if="item1<0&&ind==5">▲</span>
|
v-for="(item1, ind) in item"
|
||||||
<span v-if="item1<0&&ind==5">▼</span>
|
:key="ind"
|
||||||
{{item1}}
|
class="numCell"
|
||||||
</div>
|
>
|
||||||
</td>
|
<div :class="bindClass(item1, ind)">
|
||||||
</tr>
|
<span v-if="item1 > 0 && ind == 3"
|
||||||
</tbody>
|
>↑</span
|
||||||
</table>
|
>
|
||||||
</div>
|
<span v-if="item1 < 0 && ind == 3"
|
||||||
</div>
|
>↓</span
|
||||||
</el-card>
|
>
|
||||||
</div>
|
<span v-if="item1 < 0 && ind == 5"
|
||||||
</template>
|
>▲</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:'3346491835287007232',
|
chartShow: false,
|
||||||
},
|
myOption: null,
|
||||||
monthGoal:[],
|
timeStamp: null,
|
||||||
tableDatas:[],
|
query: {
|
||||||
modelValue:true,
|
mgroup: "3346491835287007232",
|
||||||
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;
|
this.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;
|
//月目标
|
||||||
monthGoal[7]=goal.goal_val_8;
|
getMonthGoal() {
|
||||||
monthGoal[8]=goal.goal_val_9;
|
let that = this;
|
||||||
monthGoal[9]=goal.goal_val_10;
|
let paramsGoal = {};
|
||||||
monthGoal[10]=goal.goal_val_11;
|
paramsGoal.page = 0;
|
||||||
monthGoal[11]=goal.goal_val_12;
|
paramsGoal.mgroup = that.query.mgroup;
|
||||||
monthGoal[12]=goal.goal_val_12;
|
that.$API.mtm.goal.list.req(paramsGoal).then((ress) => {
|
||||||
that.monthGoal = monthGoal;
|
if (ress.length > 0) {
|
||||||
}
|
let monthGoal = [];
|
||||||
})
|
ress.forEach((goal) => {
|
||||||
this.getData();
|
if (
|
||||||
}else{
|
goal.goal_cate_name == "单位产品分布电耗(KW·h/t)"
|
||||||
this.getData();
|
) {
|
||||||
}
|
monthGoal[0] = goal.goal_val;
|
||||||
})
|
monthGoal[1] = goal.goal_val_2;
|
||||||
},
|
monthGoal[2] = goal.goal_val_3;
|
||||||
methods: {
|
monthGoal[3] = goal.goal_val_4;
|
||||||
// 动态绑定Class
|
monthGoal[4] = goal.goal_val_5;
|
||||||
bindClass(item,index){
|
monthGoal[5] = goal.goal_val_6;
|
||||||
let classInfo = { redColor: false, greenColor: false }
|
monthGoal[6] = goal.goal_val_7;
|
||||||
if(index==3||index==5){
|
monthGoal[7] = goal.goal_val_8;
|
||||||
if( typeof(item)=='number'){
|
monthGoal[8] = goal.goal_val_9;
|
||||||
if(item>0){
|
monthGoal[9] = goal.goal_val_10;
|
||||||
classInfo.greenColor = true;
|
monthGoal[10] = goal.goal_val_11;
|
||||||
classInfo.redColor = false;
|
monthGoal[11] = goal.goal_val_12;
|
||||||
}else if(item<0){
|
monthGoal[12] = goal.goal_val_12;
|
||||||
classInfo.redColor = true;
|
that.monthGoal = monthGoal;
|
||||||
classInfo.greenColor = false
|
}
|
||||||
}
|
});
|
||||||
}
|
this.getData();
|
||||||
}
|
} else {
|
||||||
return classInfo
|
this.getData();
|
||||||
},
|
}
|
||||||
getData(){
|
});
|
||||||
let that = this;
|
},
|
||||||
let query0={};
|
// 动态绑定Class
|
||||||
query0.page = 0;
|
bindClass(item, index) {
|
||||||
query0.type='month_s';
|
let classInfo = { redColor: false, greenColor: false };
|
||||||
query0.year_s = that.query.year_s-1;
|
if (index == 3 || index == 5) {
|
||||||
query0.mgroup=that.query.mgroup;
|
if (typeof item == "number") {
|
||||||
let wrapArr = [],wrapArr0 = [] ,wrapArrs = [];
|
if (item > 0) {
|
||||||
this.$API.enm.enstat.req(query0).then((res0) => {
|
classInfo.greenColor = true;
|
||||||
let data0 = res0;
|
classInfo.redColor = false;
|
||||||
if(data0.length>0){
|
} else if (item < 0) {
|
||||||
data0.forEach(item0 => {
|
classInfo.redColor = true;
|
||||||
//先按月份排序,再按班组排序
|
classInfo.greenColor = false;
|
||||||
let ind0 = item0.month_s;
|
}
|
||||||
wrapArr0[ind0] = item0;
|
}
|
||||||
});
|
}
|
||||||
}
|
return classInfo;
|
||||||
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() {
|
handleQuery() {
|
||||||
this.$PRINT('#myReport');
|
this.getMonthGoal();
|
||||||
},
|
},
|
||||||
exportExcel() {
|
handlePrint() {
|
||||||
this.exportLoading = true;
|
this.$PRINT("#myReport");
|
||||||
this.$XLSX('#myTable', this.tableName)
|
},
|
||||||
this.exportLoading = false;
|
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>
|
Loading…
Reference in New Issue