fix:enm_rm原料磨mgroup 根据名称获取id

This commit is contained in:
shijing 2024-04-29 14:29:25 +08:00
parent 4188ad2a8b
commit d392d7f012
10 changed files with 3494 additions and 3906 deletions

View File

@ -1,155 +1,324 @@
<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="140"> >
<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-button link size="small" @click="sflog_check(scope.row)" type="primary">质量检验</el-button> --> :key="item.id"
<!-- <el-button link size="small" @click="sflog_other(scope.row)" type="primary">其他能源</el-button> --> :label="item.name"
<el-divider direction="vertical"></el-divider> :value="item.id"
<el-button link size="small" @click="sflog_export(scope.row)" type="success">报表</el-button> ></el-option>
</template> </el-select>
</el-table-column> <el-button
</scTable> type="primary"
</el-main> icon="el-icon-search"
<el-drawer v-model="limitedExport" size="60%" :show-close="false"> @click="handleQuery"
<template #header="{ close, titleId, titleClass }"> ></el-button>
<h4 :id="titleId" :class="titleClass">交接班日志</h4> </div>
<el-button type="danger" @click="close"> </el-header>
<el-icon class="el-icon--left"> <el-main class="nopadding">
<CircleCloseFilled /> <scTable
</el-icon> ref="table"
关闭 :apiObj="apiObj"
</el-button> row-key="id"
</template> stripe
<div class="left-panel"> :params="query"
<el-button type="primary" @click="exportExcel()" :loading="exportLoading">导出xlsx highlightCurrentRow
</el-button> @row-click="rowClick"
<el-button type="primary" @click="handlePrint">打印 >
</el-button> <el-table-column type="index" width="50" />
</div> <el-table-column label="开始时间" prop="start_time">
<el-main class="nopadding"> <template #default="scope">
<div ref="print" id="myReport" class="printContainer"> <span>{{ scope.row.start_time.slice(0, 16) }}</span>
<div style="margin-right: 20px;text-align: center;font-size: 16px;font-weight: bold;margin-bottom: 20px;"> </template>
<span v-if="sflogItem.end_time">{{ sflogItem.end_time.slice(0, 10) }}{{ sflogItem.shift_name }}</span> </el-table-column>
<span v-if="sflogItem.team_name">{{ sflogItem.team_name }}</span> <el-table-column label="结束时间" prop="end_time">
交接班记录 <template #default="scope">
</div> <span>{{ scope.row.end_time.slice(0, 16) }}</span>
<table border="1" width="1000" cellspacing="0" :key="timeStamp" id="myTable"> </template>
<tbody> </el-table-column>
<tr> <el-table-column
<td class="numCell">日期</td> label="班组名称"
<td class="numCell" v-if="sflogItem.end_time">{{ sflogItem.end_time.slice(0, 10) }}</td> prop="team_name"
<td class="numCell">班次</td> ></el-table-column>
<td class="numCell">{{ sflogItem.shift_name }}</td> <el-table-column
<td class="numCell">班组</td> label="当前班次"
<td class="numCell"><span v-if="sflogItem.team_name">{{ sflogItem.team_name }}</span></td> prop="shift_name"
</tr> ></el-table-column>
<tr> <el-table-column
<td class="numCell">产量t</td> label="班长"
<td class="numCell">{{ reportItem.total_production }}</td> prop="leader_name"
<td class="numCell">台时t/h</td> ></el-table-column>
<td class="numCell">{{ reportItem.production_hour }}</td> <el-table-column label="检验时间">
<td class="numCell">运转时间h</td> <template #default="scope">
<td class="numCell">{{ reportItem.run_hour }}</td> <span v-if="scope.row.last_test_time">{{
</tr> scope.row.last_test_time.slice(0, 16)
<tr> }}</span>
<td class="numCell">运转率%</td> </template>
<td class="numCell">{{ reportItem.run_rate * 100 }}</td> </el-table-column>
<td class="numCell">停机时长h</td> <el-table-column
<td class="numCell">{{ reportItem.shut_hour }}</td> label="操作"
<td class="numCell">当期单位产品电耗kW·h/t</td> fixed="right"
<td class="numCell">{{ reportItem.elec_consume_unit }}</td> align="center"
</tr> width="140"
<tr> >
<td class="numCell">辅料细度合格率%</td> <template #default="scope">
<td class="numCell" v-if="reportItem.辅料_细度_rate_pass">{{ reportItem.辅料_细度_rate_pass * 100 }}</td> <el-button
<td class="numCell" v-else>0</td> link
<td class="numCell">辅料Fe₂O₃合格率%</td> size="small"
<td class="numCell" v-if="reportItem.辅料_Fe2O3_rate_pass">{{ reportItem.辅料_Fe2O3_rate_pass * 100 }}</td> @click="sflog_edit(scope.row)"
<td class="numCell" v-else>0</td> type="primary"
<td class="numCell">辅料水分合格率%</td> >编辑</el-button
<td class="numCell" v-if="reportItem.辅料_水分_rate_pass">{{ reportItem.辅料_水分_rate_pass * 100 }}</td> >
<td class="numCell" v-else>0</td> <!-- <el-button link size="small" @click="sflog_check(scope.row)" type="primary">质量检验</el-button> -->
</tr> <!-- <el-button link size="small" @click="sflog_other(scope.row)" type="primary">其他能源</el-button> -->
<tr> <el-divider direction="vertical"></el-divider>
<td class="numCell">干混生料CaO合格率%</td> <el-button
<td class="numCell" v-if="reportItem.干混生料_CaO_rate_pass">{{ reportItem.干混生料_CaO_rate_pass * 100 }}</td> link
<td class="numCell" v-else>0</td> size="small"
<td class="numCell">干混生料Fe₂O₃合格率%</td> @click="sflog_export(scope.row)"
<td class="numCell" v-if="reportItem.干混生料_Fe2O3_rate_pass">{{ reportItem.干混生料_Fe2O3_rate_pass * 100 }}</td> type="success"
<td class="numCell" v-else>0</td> >报表</el-button
<td class="numCell">干混生料细度合格率%</td> >
<td class="numCell" v-if="reportItem.干混生料_细度_rate_pass">{{ reportItem.干混生料_细度_rate_pass * 100 }}</td> </template>
<td class="numCell" v-else>0</td> </el-table-column>
</tr> </scTable>
<tr> </el-main>
<td class="numCell">干混生料水分合格率%</td> <el-drawer v-model="limitedExport" size="60%" :show-close="false">
<td class="numCell" v-if="reportItem.干混生料_水分_rate_pass">{{ reportItem.干混生料_水分_rate_pass * 100 }}</td> <template #header="{ close, titleId, titleClass }">
<td class="numCell" v-else>0</td> <h4 :id="titleId" :class="titleClass">交接班日志</h4>
<td class="numCell">单位成本/</td> <el-button type="danger" @click="close">
<td class="numCell">{{ reportItem.production_cost_unit }}</td> <el-icon class="el-icon--left">
<td class="numCell"></td> <CircleCloseFilled />
<td class="numCell"></td> </el-icon>
</tr> 关闭
<tr v-if="sflogexpList.length > 0"> </el-button>
<td class="numCell" :rowspan="sflogexpList.length + 1">生产情况记录</td> </template>
<td class="numCell">时间</td> <div class="left-panel">
<td class="numCell">类别</td> <el-button
<td class="numCell">原因</td> type="primary"
<td class="numCell">处置措施</td> @click="exportExcel()"
<td class="numCell">处置人</td> :loading="exportLoading"
</tr> >导出xlsx
<tr v-for="item in sflogexpList" :key="item.id"> </el-button>
<td class="numCell">{{ item.happen_time }}</td> <el-button type="primary" @click="handlePrint">打印 </el-button>
<td class="numCell">{{ item.cate }}</td> </div>
<td class="numCell">{{ item.reason }}</td> <el-main class="nopadding">
<td class="numCell">{{ item.measure }}</td> <div ref="print" id="myReport" class="printContainer">
<td class="numCell">{{ item.handler }}</td> <div
</tr> style="
</tbody> margin-right: 20px;
</table> text-align: center;
</div> font-size: 16px;
</el-main> font-weight: bold;
</el-drawer> margin-bottom: 20px;
</el-container> "
<!-- <save-dialog >
<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">台时t/h</td>
<td class="numCell">
{{ reportItem.production_hour }}
</td>
<td class="numCell">运转时间h</td>
<td class="numCell">
{{ reportItem.run_hour }}
</td>
</tr>
<tr>
<td class="numCell">运转率%</td>
<td class="numCell">
{{ reportItem.run_rate * 100 }}
</td>
<td class="numCell">停机时长h</td>
<td class="numCell">
{{ reportItem.shut_hour }}
</td>
<td class="numCell">
当期单位产品电耗kW·h/t
</td>
<td class="numCell">
{{ reportItem.elec_consume_unit }}
</td>
</tr>
<tr>
<td class="numCell">辅料细度合格率%</td>
<td
class="numCell"
v-if="reportItem.辅料_细度_rate_pass"
>
{{ reportItem.辅料_细度_rate_pass * 100 }}
</td>
<td class="numCell" v-else>0</td>
<td class="numCell">辅料Fe₂O₃合格率%</td>
<td
class="numCell"
v-if="reportItem.辅料_Fe2O3_rate_pass"
>
{{ reportItem.辅料_Fe2O3_rate_pass * 100 }}
</td>
<td class="numCell" v-else>0</td>
<td class="numCell">辅料水分合格率%</td>
<td
class="numCell"
v-if="reportItem.辅料_水分_rate_pass"
>
{{ reportItem.辅料_水分_rate_pass * 100 }}
</td>
<td class="numCell" v-else>0</td>
</tr>
<tr>
<td class="numCell">干混生料CaO合格率%</td>
<td
class="numCell"
v-if="reportItem.干混生料_CaO_rate_pass"
>
{{
reportItem.干混生料_CaO_rate_pass * 100
}}
</td>
<td class="numCell" v-else>0</td>
<td class="numCell">
干混生料Fe₂O₃合格率%
</td>
<td
class="numCell"
v-if="reportItem.干混生料_Fe2O3_rate_pass"
>
{{
reportItem.干混生料_Fe2O3_rate_pass *
100
}}
</td>
<td class="numCell" v-else>0</td>
<td class="numCell">干混生料细度合格率%</td>
<td
class="numCell"
v-if="reportItem.干混生料_细度_rate_pass"
>
{{
reportItem.干混生料_细度_rate_pass * 100
}}
</td>
<td class="numCell" v-else>0</td>
</tr>
<tr>
<td class="numCell">干混生料水分合格率%</td>
<td
class="numCell"
v-if="reportItem.干混生料_水分_rate_pass"
>
{{
reportItem.干混生料_水分_rate_pass * 100
}}
</td>
<td class="numCell" v-else>0</td>
<td class="numCell">单位成本/</td>
<td class="numCell">
{{ reportItem.production_cost_unit }}
</td>
<td class="numCell"></td>
<td class="numCell"></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>
<!-- <save-dialog
v-if="dialog.save" v-if="dialog.save"
ref="saveDialog" ref="saveDialog"
:deptId ="deptId" :deptId ="deptId"
@ -174,205 +343,218 @@ import saveDialog from "./handover_form.vue";
import quastatDialog from "./quastat_form.vue"; import quastatDialog from "./quastat_form.vue";
import otherDialog from "./other_form.vue"; import otherDialog from "./other_form.vue";
export default { export default {
name: "sflog", name: "sflog",
components: { components: {
saveDialog, saveDialog,
otherDialog, otherDialog,
quastatDialog quastatDialog,
}, },
data() { data() {
return { return {
apiObj: this.$API.wpm.sflog.list, apiObj: null,
apiObj2: null, apiObj2: null,
query: { query: {
mgroup: '3346520558031773696', mgroup: "",
}, },
deptId: "3345780809943797760", deptId: "",
sflogItem: {},
selection: [],
modelValue: true,
showClose: true,
echartType: "line",
asynDialog: false,
options: [],
optionsShift: [],
teamOptions: [],
limitedExport: false,
reportItem: {},
sflogexpList: [],
};
},
mounted() {
this.$API.mtm.mgroup.list
.req({ page: 0, search: "原料磨" })
.then((res) => {
console.log("原料磨", res);
this.mgroupItem = res[0];
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.options = res;
});
},
getShfit() {
this.$API.mtm.shift.list.req({ page: 0 }).then((res) => {
this.optionsShift = res;
});
},
handleQuery() {
this.$refs.table.queryData(this.query);
},
sflog_export() {
this.limitedExport = true;
},
rowClick(row) {
this.sflogId = row.id;
this.sflogItem = row;
this.getSflogItem(row.id);
this.getSflogexp(row.id);
},
getSflogexp(id) {
let that = this;
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) => {
if (res.length > 0) {
that.reportItem = 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.$router.push({
name: "logDetail",
query: {
mgroupId: row.mgroup,
deptId: this.deptId,
},
});
// this.dialog.save = true;
// this.$nextTick(() => {
// this.$refs.saveDialog.open("edit").setData(row);
// });
},
sflogItem: {}, //
selection: [], sflog_check(row) {
modelValue: true, this.dialog.check = true;
showClose: true, this.$nextTick(() => {
echartType: 'line', this.$refs.checkDialog.open("edit").setData(row);
asynDialog: false, });
options: [], },
optionsShift: [], //
teamOptions: [], sflog_other(row) {
limitedExport: false, this.dialog.other = true;
reportItem: {}, this.$nextTick(() => {
sflogexpList: [], this.$refs.otherDialog.open("edit").setData(row);
}; });
}, },
mounted() { // //
this.getTeam(); // table_show(row) {
this.getShfit(); // this.dialog.save = true;
}, // this.$nextTick(() => {
methods: { // this.$refs.checkDialog.open("edit").setData(row);
getTeam() { // });
let form = {}; // },
form.page = 0; //
form.belong_dept = this.deptId; async table_del(row) {
this.$API.mtm.team.list.req(form).then(res => { this.$API.wpm.sflog.delete
this.options = res; .req(row.id)
}) .then((res) => {
}, this.$message.success("删除成功");
getShfit() { return res;
this.$API.mtm.shift.list.req({ page: 0 }).then(res => { })
this.optionsShift = res; .catch((err) => {
}) return err;
}, });
handleQuery() { },
this.$refs.table.queryData(this.query); //
}, handleSaveSuccess(data, mode) {
sflog_export() { this.$refs.table.refresh();
this.limitedExport = true; this.dialog.save = false;
}, },
rowClick(row) { handleOtherSuccess() {
this.sflogId = row.id; this.dialog.other = false;
this.sflogItem = row; },
this.getSflogItem(row.id); handleCheckSuccess() {
this.getSflogexp(row.id); this.dialog.check = false;
}, },
getSflogexp(id) { closed() {
let that = this; this.dialog.save = false;
that.$API.wpm.sflogexp.list.req({ page: 0, sflog: id }).then(res => { this.$refs.table2.refresh();
that.sflogexpList = res; },
}) handleDel(row) {
}, this.$confirm(`确定删除选中的记录吗?`, "提示", {
getSflogItem(id) { type: "warning",
let that = this; })
that.$API.enm.enstat.req({ type: 'sflog', sflog: id, page: 0 }).then(res => { .then(() => {
if (res.length > 0) { this.$API.wpm.shift.delete.req(row.id).then((res) => {
that.reportItem = res[0]; if (res.err_msg) {
} this.$message.error(res.err_msg);
console.log(res[0]) } else {
}) // const loading = this.$loading();
}, // this.$refs.table2.refresh();
// // loading.close();
sflog_edit(row) { // this.$message.success("");
let jsonStr = JSON.stringify(row); }
this.$TOOL.data.remove("sflogItem") });
this.$TOOL.data.set('sflogItem', jsonStr) })
this.$router.push({ .catch(() => {});
name: "logDetail", },
query: { handlePrint() {
mgroupId: row.mgroup, this.$PRINT("#myReport");
deptId: this.deptId },
}, exportExcel() {
}); this.exportLoading = true;
// this.dialog.save = true; this.$XLSX("#myTable", this.tableName);
// this.$nextTick(() => { this.exportLoading = false;
// this.$refs.saveDialog.open("edit").setData(row); },
// }); },
},
//
sflog_check(row) {
this.dialog.check = true;
this.$nextTick(() => {
this.$refs.checkDialog.open("edit").setData(row);
});
},
//
sflog_other(row) {
this.dialog.other = true;
this.$nextTick(() => {
this.$refs.otherDialog.open("edit").setData(row);
});
},
// //
// table_show(row) {
// this.dialog.save = true;
// this.$nextTick(() => {
// this.$refs.checkDialog.open("edit").setData(row);
// });
// },
//
async table_del(row) {
this.$API.wpm.sflog.delete.req(row.id)
.then((res) => {
this.$message.success("删除成功");
return res;
})
.catch((err) => {
return err;
});
},
//
handleSaveSuccess(data, mode) {
this.$refs.table.refresh()
this.dialog.save = false;
},
handleOtherSuccess() {
this.dialog.other = false;
},
handleCheckSuccess() {
this.dialog.check = false;
},
closed() {
this.dialog.save = false;
this.$refs.table2.refresh();
},
handleDel(row) {
this.$confirm(`确定删除选中的记录吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.wpm.shift.delete.req(row.id).then((res) => {
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
// const loading = this.$loading();
// this.$refs.table2.refresh();
// loading.close();
// this.$message.success("");
}
});
})
.catch(() => { });
},
handlePrint() {
this.$PRINT('#myReport');
},
exportExcel() {
this.exportLoading = true;
this.$XLSX('#myTable', this.tableName)
this.exportLoading = false;
},
},
}; };
</script> </script>
<style scoped> <style scoped>
#numTable { #numTable {
margin-left: 37px; margin-left: 37px;
} }
#numTable td { #numTable td {
height: 32px; height: 32px;
padding-left: 5px; padding-left: 5px;
} }
.numCell { .numCell {
width: 80px; width: 80px;
} }
.numCell.numCell_last { .numCell.numCell_last {
width: 100px; width: 100px;
} }
.searchHead { .searchHead {
display: flex display: flex;
} }
.middleText { .middleText {
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
margin: 0 5px; margin: 0 5px;
display: inline-block; display: inline-block;
} }
.searchBtn { .searchBtn {
margin-left: 5px; margin-left: 5px;
} }
</style> </style>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,242 +1,285 @@
<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="2400"
<div ref="print" id="myReport" class="printContainer"> cellspacing="0"
<table border="1" width="2400" cellspacing="0" :key="timeStamp" id="myTable" class="myTable"> :key="timeStamp"
<thead class="myTableHead"> id="myTable"
<tr> class="myTable"
<th colspan="24">原料磨工段班组月度对比分析</th> >
</tr> <thead class="myTableHead">
<tr> <tr>
<th rowspan="2">月份</th> <th colspan="24">原料磨工段班组月度对比分析</th>
<th rowspan="2">班组</th> </tr>
<th colspan="2">产量</th> <tr>
<th>运转率</th> <th rowspan="2">月份</th>
<th>成本</th> <th rowspan="2">班组</th>
<th colspan="7">质量</th> <th colspan="2">产量</th>
<th colspan="10">单位产品电耗</th> <th>运转率</th>
<th rowspan="2">得分</th> <th>成本</th>
</tr> <th colspan="7">质量</th>
<tr> <th colspan="10">单位产品电耗</th>
<th>总产量t</th> <th rowspan="2">得分</th>
<th>台时产量t/h</th> </tr>
<th>运转率%</th> <tr>
<th>单位产品成本/</th> <th>总产量t</th>
<th>细度%</th> <th>台时产量t/h</th>
<th>Fe₂O₃%</th> <th>运转率%</th>
<th>水分%</th> <th>单位产品成本/</th>
<th>细度%</th> <th>细度%</th>
<th>Fe₂O₃%</th> <th>Fe₂O₃%</th>
<th>水分%</th> <th>水分%</th>
<th>CaO%</th> <th>细度%</th>
<th>循环风机KW·h/t</th> <th>Fe₂O₃%</th>
<th>尾排风机KW·h/t</th> <th>水分%</th>
<th>废气风机KW·h/t</th> <th>CaO%</th>
<th>循环风机KW·h/t</th>
<th>尾排风机KW·h/t</th>
<th>废气风机KW·h/t</th>
<th>当期值KW·h/t</th> <th>当期值KW·h/t</th>
<th>目标值KW·h/t</th> <th>目标值KW·h/t</th>
<th>当期与目标差值KW·h/t</th> <th>当期与目标差值KW·h/t</th>
<th>环期值KW·h/t</th> <th>环期值KW·h/t</th>
<th>当期与环期差值KW·h/t</th> <th>当期与环期差值KW·h/t</th>
<th>环比增长率%</th> <th>环比增长率%</th>
<th>同比增长率%</th> <th>同比增长率%</th>
</tr> </tr>
</thead> </thead>
<tr v-for="(item,index) in tableDatas" :key="index"> <tr v-for="(item, index) in tableDatas" :key="index">
<td v-for="(item0,index0) in item" :key="index0" class="numCell">{{item0}}</td> <td
</tr> v-for="(item0, index0) in item"
</table> :key="index0"
</div> class="numCell"
</div> >
</el-card> {{ item0 }}
</div> </td>
</template> </tr>
</table>
</div>
</div>
</el-card>
</div>
</template>
<script> <script>
export default { export default {
data() { data() {
return { return {
timeStamp:0, timeStamp: 0,
query:{ query: {
year_s:'', year_s: "",
page : 0, page: 0,
type : 'month_st', type: "month_st",
mgroup:'3346520558031773696', mgroup: "",
}, },
tableDatas:[], tableDatas: [],
}; exportLoading: false,
}, };
mounted() { },
let that = this; mounted() {
var myDate = new Date(); let that = this;
let year = myDate.getFullYear(); var myDate = new Date();
that.query.year_s = year; let year = myDate.getFullYear();
let params = {}; that.query.year_s = year;
params.page=0; this.$API.mtm.mgroup.list
params.year=year; .req({ page: 0, search: "原料磨" })
params.mgroup=that.query.mgroup; .then((res) => {
this.$API.mtm.goal.list.req(params).then((res) => { console.log("原料磨", res);
let data = []; that.query.mgroup = res[0].id;
if(res.length>0){ let params = {};
data = res[0]; params.page = 0;
} params.year = year;
that.getData(data); params.mgroup = that.query.mgroup;
}) this.$API.mtm.goal.list.req(params).then((res) => {
}, let data = [];
methods: { if (res.length > 0) {
getData(goalData){ data = res[0];
let that = this; }
let query0={}; that.getData(data);
query0.page = 0; });
query0.type='month_st'; });
query0.year_s = that.query.year_s-1; },
query0.mgroup='3346520558031773696'; methods: {
let wrapArr = [],wrapArr0 = [] ,wrapArrs = []; getData(goalData) {
this.$API.enm.enstat.req(query0).then((res0) => { let that = this;
let data0 = res0; let query0 = {};
debugger; query0.page = 0;
if(data0.length>0){ query0.type = "month_st";
data0.forEach(item0 => { query0.year_s = that.query.year_s - 1;
// query0.mgroup = that.query.mgroup;
let n0 = item0.month_s; let wrapArr = [],
let ind0 = 0; wrapArr0 = [],
if(team_name0.indexOf('甲')>-1){ wrapArrs = [];
ind0 = (n0-1)*3; this.$API.enm.enstat.req(query0).then((res0) => {
}else if(team_name0.indexOf('乙')>-1){ let data0 = res0;
ind0 = (n0-1)*3+1; debugger;
}else if(team_name0.indexOf('丙')>-1){ if (data0.length > 0) {
ind0 = (n0-1)*3+2; data0.forEach((item0) => {
} //
wrapArr0[ind0] = item0; let n0 = item0.month_s;
}); let ind0 = 0;
debugger; let team_name0 = item0.team_name;
console.log(wrapArr0) if (team_name0.indexOf("甲") > -1) {
}else{ ind0 = (n0 - 1) * 3;
} } else if (team_name0.indexOf("乙") > -1) {
this.$API.enm.enstat.req(that.query).then((res) => { ind0 = (n0 - 1) * 3 + 1;
let data = res; } else if (team_name0.indexOf("丙") > -1) {
if(data.length>0){ ind0 = (n0 - 1) * 3 + 2;
data.forEach(item => { }
// wrapArr0[ind0] = item0;
let n = item.month_s; });
let team_name = item.team_name; } else {
let ind = 0; }
if(team_name.indexOf('甲')>-1){ this.$API.enm.enstat.req(that.query).then((res) => {
ind = (n-1)*3; let data = res;
}else if(team_name.indexOf('乙')>-1){ if (data.length > 0) {
ind = (n-1)*3+1; data.forEach((item) => {
}else if(team_name.indexOf('丙')>-1){ //
ind = (n-1)*3+2; let n = item.month_s;
} let team_name = item.team_name;
wrapArrs[ind] = item; let ind = 0;
let arr = []; if (team_name.indexOf("甲") > -1) {
let time = ''+item.year_s+'.'+item.month_s; ind = (n - 1) * 3;
arr.push(time); } else if (team_name.indexOf("乙") > -1) {
arr.push(item.team_name); ind = (n - 1) * 3 + 1;
arr.push(item.total_production); } else if (team_name.indexOf("丙") > -1) {
arr.push(item.production_hour); ind = (n - 1) * 3 + 2;
arr.push(item.run_rate); }
arr.push(item.production_cost_unit); wrapArrs[ind] = item;
// let arr = [];
arr[6]=item.辅料_细度_rate_pass!=null?item.辅料_细度_rate_pass:'/'; let time = "" + item.year_s + "." + item.month_s;
arr[7]=item.辅料_Fe2O3_rate_pass!=null?item.辅料_Fe2O3_rate_pass:'/'; arr.push(time);
arr[8]=item.辅料_水分_rate_pass!=null?item.辅料_水分_rate_pass:'/'; arr.push(item.team_name);
arr[9]=item.干混生料_细度_rate_pass!=null?item.干混生料_细度_rate_pass:'/'; arr.push(item.total_production);
arr[10]=item.干混生料_Fe2O3_rate_pass!=null?item.干混生料_Fe2O3_rate_pass:'/'; arr.push(item.production_hour);
arr[11]=item.干混生料_水分_rate_pass!=null?item.干混生料_水分_rate_pass:'/'; arr.push(item.run_rate);
arr[12]=item.干混生料_CaO_rate_pass!=null?item.干混生料_CaO_rate_pass:'/'; arr.push(item.production_cost_unit);
// //
arr[13]=item.循环风机_consume_unit!=null?item.循环风机_consume_unit:'/'; arr[6] =
arr[13]=item.尾排风机_consume_unit!=null?item.尾排风机_consume_unit:'/'; item.辅料_细度_rate_pass != null
arr[13]=item.废气风机_consume_unit!=null?item.废气风机_consume_unit:'/'; ? item.辅料_细度_rate_pass
// : "/";
arr[16]=item.elec_consume_unit//KW·h/t arr[7] =
let keyVale ='goal_val_'+n; item.辅料_Fe2O3_rate_pass != null
arr[17] = goalData[keyVale];//KW·h/t// ? item.辅料_Fe2O3_rate_pass
arr[18]=item.celec_consume_unit-arr[16];//KW·h/t : "/";
let ind_pre = 0,huanbi = 0; arr[8] =
if(item.month_s==1){ item.辅料_水分_rate_pass != null
ind_pre = 12; ? item.辅料_水分_rate_pass
huanbi = wrapArr0[ind_pre]?wrapArr0[ind_pre].elec_consume_unit:'/'; : "/";
}else{ arr[9] =
ind_pre=ind-1; item.干混生料_细度_rate_pass != null
huanbi = wrapArr[ind_pre]?wrapArr[ind_pre].elec_consume_unit?wrapArr[ind_pre].elec_consume_unit:'/':'/' ? item.干混生料_细度_rate_pass
} : "/";
arr[19]=huanbi;//KW·h/t arr[10] =
arr[20]=item.celec_consume_unit;//KW·h/t item.干混生料_Fe2O3_rate_pass != null
arr[21]=item.celec_consume_unit;//% ? item.干混生料_Fe2O3_rate_pass
arr[22]=item.celec_consume_unit;//% : "/";
arr[23]=item.celec_consume_unit;//% arr[11] =
wrapArr[ind] = arr; item.干混生料_水分_rate_pass != null
}); ? item.干混生料_水分_rate_pass
console.log(wrapArr) : "/";
that.tableDatas = wrapArr; arr[12] =
}else{ item.干混生料_CaO_rate_pass != null
} ? item.干混生料_CaO_rate_pass
}) : "/";
}) //
}, arr[13] =
handleQuery(){ item.循环风机_consume_unit != null
this.tableDatas = []; ? item.循环风机_consume_unit
this.getData(); : "/";
}, arr[13] =
itemClick(type,item){ item.尾排风机_consume_unit != null
this.type=type; ? item.尾排风机_consume_unit
this.asynDialog = true; : "/";
}, arr[13] =
itemClick1(type,item){ item.废气风机_consume_unit != null
this.chartShow = false; ? item.废气风机_consume_unit
this.$API.bi.dataset.exec : "/";
.req('3322567213885833216') //
.then((res) => { arr[16] = item.elec_consume_unit; //KW·h/t
this.myOption = JSON.parse(res.echart_options); let keyVale = "goal_val_" + n;
debugger; arr[17] = goalData[keyVale]; //KW·h/t//
console.log(this.myOption) arr[18] = item.celec_consume_unit - arr[16]; //KW·h/t
this.chartShow = true; let ind_pre = 0,
}); huanbi = 0;
}, if (item.month_s == 1) {
handlePrint() { ind_pre = 12;
this.$PRINT('#myReport'); huanbi = wrapArr0[ind_pre]
}, ? wrapArr0[ind_pre].elec_consume_unit
exportExcel() { : "/";
this.exportLoading = true; } else {
this.$XLSX('#myTable', this.tableName) ind_pre = ind - 1;
this.exportLoading = false; huanbi = wrapArr[ind_pre]
}, ? wrapArr[ind_pre].elec_consume_unit
} ? wrapArr[ind_pre].elec_consume_unit
}; : "/"
: "/";
}
arr[19] = huanbi; //KW·h/t
arr[20] = item.celec_consume_unit; //KW·h/t
arr[21] = item.celec_consume_unit; //%
arr[22] = item.celec_consume_unit; //%
arr[23] = item.celec_consume_unit; //%
wrapArr[ind] = arr;
});
console.log(wrapArr);
that.tableDatas = wrapArr;
} else {
}
});
});
},
handleQuery() {
this.tableDatas = [];
this.getData();
},
itemClick(type, item) {
this.type = type;
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>
.printWrap{ .printWrap {
width: 100%; width: 100%;
overflow-x: scroll; overflow-x: scroll;
} }
</style> </style>

View File

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

View File

@ -1,937 +0,0 @@
<template>
<el-container>
<el-main class="nopadding">
<el-card style="margin: 6px; position: relative">
<el-descriptions title="日志信息" :column="3">
<el-descriptions-item label="所属工段:">
<span>{{ form.mgroup_name }}</span>
</el-descriptions-item>
<el-descriptions-item label="工作班次:" :span="3">
{{ form.shift_name }}
</el-descriptions-item>
<el-descriptions-item label="开始时间:">
<span>{{ form.start_time }}</span>
</el-descriptions-item>
<el-descriptions-item label="结束时间:" :span="3">
{{ form.end_time }}
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card style="margin: 6px; position: relative">
<el-button
type="primary"
icon="el-icon-plus"
@click.stop="addExp"
v-if="activeName == 'fourth'"
style="
position: absolute;
top: 6px;
right: 10px;
z-index: 100;
"
></el-button>
<el-tabs
v-model="activeName"
class="demo-tabs"
@tab-click="handleClick"
height="600px"
>
<el-tab-pane label="班组" name="first">
<el-form
ref="teamForm"
:model="form"
label-width="100px"
label-position="right"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="当班班组" prop="team">
<el-select
v-model="form.team"
placeholder="当班班组"
clearable
style="width: 100%"
@change="teamChange"
>
<el-option
v-for="item in teamOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="班组班长"
prop="leader_name"
>
<el-input
v-model="form.leader_name"
placeholder="班组班长"
disabled
/>
</el-form-item>
</el-col>
<el-col
:md="12"
:sm="24"
v-if="
form.shift_name == '白班' &&
mgroupId == '3347217246321065984'
"
>
<el-form-item label="煤粉热值">
<el-input-number
v-model="form.pcoal_heat"
controls-position="right"
placeholder="煤粉热值"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer style="text-align: center">
<el-button
type="primary"
:loading="isSaveing"
@click="submit"
>保存</el-button
>
</el-footer>
</el-tab-pane>
<el-tab-pane label="检验" name="second">
<el-form
ref="dialogForm"
:model="form"
label-width="85px"
label-position="right"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="当前班组">
{{ form.team_name }}
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="班组组长">
{{ form.leader_name }}
</el-form-item>
</el-col>
<el-divider />
</el-row>
</el-form>
<sc-form-table
v-model="checkList"
:hideAdd="hideAdd"
:hideDelete="hideDelete"
placeholder="暂无数据"
>
<el-table-column
prop="material"
label="关联产物"
min-width="150"
>
<template #default="scope">
<span v-if="scope.row.id">{{
scope.row.material_name
}}</span>
</template>
</el-table-column>
<el-table-column
prop="testitem"
label="质检项目"
min-width="150"
>
<template #default="scope">
<span v-if="scope.row.id">{{
scope.row.testitem_name
}}</span>
</template>
</el-table-column>
<el-table-column
prop="val_avg"
label="平均值"
min-width="150"
>
<template #default="scope">
<el-input
v-model="scope.row.val_avg"
placeholder="请输入内容"
></el-input>
</template>
</el-table-column>
<el-table-column
prop="num_test"
label="检验次数"
min-width="150"
>
<template #default="scope">
<el-input
v-model="scope.row.num_test"
placeholder="请输入内容"
></el-input>
</template>
</el-table-column>
<el-table-column
prop="num_ok"
label="合格次数"
min-width="150"
>
<template #default="scope">
<el-input
v-model="scope.row.num_ok"
placeholder="请输入内容"
></el-input>
</template>
</el-table-column>
</sc-form-table>
<el-footer style="text-align: center">
<el-button
type="primary"
:loading="isSaveing"
@click="submit2"
>保存</el-button
>
</el-footer>
</el-tab-pane>
<el-tab-pane label="其他成本" name="third">
<div
v-if="
mgroupId == '3346491835287007232' ||
mgroupId == '3347217651339837440' ||
mgroupId == '3347217246321065984'
"
>
<el-form
ref="thirdForms"
:model="thirdForm"
label-width="100px"
label-position="right"
>
<!-- 电石渣 -->
<el-row
v-if="mgroupId == '3346491835287007232'"
>
<el-col :md="12" :sm="24">
<el-form-item label="湿电石渣">
<el-input-number
v-model="thirdForm.num"
controls-position="right"
placeholder="湿电石渣"
/>
</el-form-item>
</el-col>
</el-row>
<!-- 回转窑 -->
<el-row
v-if="mgroupId == '3347217246321065984'"
>
<el-col :md="12" :sm="24">
<el-form-item label="柴油">
<el-input-number
v-model="thirdForm.num"
controls-position="right"
placeholder="柴油"
/>
</el-form-item>
</el-col>
</el-row>
<!-- 水泥磨 -->
<el-row
v-if="mgroupId == '3347217651339837440'"
>
<el-col :md="12" :sm="24">
<el-form-item label="助剂">
<el-input-number
v-model="thirdForm.num"
controls-position="right"
placeholder="助剂"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item label="包装">
<el-input-number
v-model="thirdForm.num"
controls-position="right"
placeholder="包装"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer style="text-align: center">
<el-button
type="primary"
:loading="isSaveing"
@click="submit"
>保存</el-button
>
</el-footer>
</div>
<div
v-else
style="
width: 100%;
height: 200px;
line-height: 200px;
text-align: center;
"
>
无其他成本
</div>
</el-tab-pane>
<el-tab-pane label="异常" name="fourth">
<el-table
ref="expTable"
:data="stlogList"
row-key="id"
stripe
highlightCurrentRow
>
<el-table-column type="index" width="50" />
<el-table-column label="异常类别" prop="duration">
<template #default="scope">
<span v-if="scope.row.duration > 0"
>停机</span
>
<span v-else>其他</span>
</template>
</el-table-column>
<el-table-column
label="发生时间"
prop="happen_time"
></el-table-column>
<el-table-column
label="原因类别"
prop="cate"
></el-table-column>
<el-table-column
label="异常名称"
prop="title"
></el-table-column>
<el-table-column
label="事件原因"
prop="reason"
></el-table-column>
<el-table-column
label="处置措施"
prop="measure"
></el-table-column>
<el-table-column
label="停机时长"
prop="duration"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="120"
>
<template #default="scope">
<el-button
link
size="small"
@click="sflogexp_edit(scope.row)"
type="primary"
>编辑</el-button
>
<el-divider
direction="vertical"
></el-divider>
<el-button
link
size="small"
@click="sflogexp_delete(scope.row)"
type="danger"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<el-row :gutter="20">
<el-col :span="12">
<p>异常详情</p>
<el-form
ref="expForms"
:rules="rules"
label-width="100px"
:model="expForm"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="异常类别">
<el-select
style="width: 100%"
v-model="sflogexpType"
placeholder="异常类别"
:disabled="1"
>
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.name"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="异常名称"
prop="title"
>
<el-input
v-model="expForm.title"
placeholder="异常名称"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="发生时间"
prop="happen_time"
>
<el-date-picker
v-model="
expForm.happen_time
"
type="datetime"
placeholder="发生时间"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
:disabled="
expTitle !==
'新增异常' &&
expForm.duration > 0
"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="原因类别"
prop="cate"
>
<el-select
style="width: 100%"
v-model="expForm.cate"
placeholder="原因类别"
>
<el-option
v-for="item in options"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:md="12"
:sm="24"
v-if="sflogexpType == 0"
>
<el-form-item label="停机时长">
<el-input-number
v-model="expForm.duration"
:precision="2"
:min="0"
controls-position="right"
placeholder="停机时长"
:disabled="
expTitle !==
'新增异常' &&
expForm.duration > 0
"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item
label="异常原因"
prop="reason"
>
<el-input
type="textarea"
:rows="2"
v-model="expForm.reason"
placeholder="异常原因"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="处置措施"
prop="measure"
>
<el-input
type="textarea"
:rows="2"
v-model="expForm.measure"
placeholder="处置措施"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-col>
<el-col :span="12">
<el-table
ref="expTable"
:data="sflogexpList"
row-key="id"
stripe
highlightCurrentRow
>
<el-table-column type="index" width="50" />
<el-table-column
label="操作人"
prop="measure"
></el-table-column>
<el-table-column
label="操作时间"
prop="happen_time"
></el-table-column>
<el-table-column
label="原因类别"
prop="cate"
></el-table-column>
<el-table-column
label="事件原因"
prop="reason"
></el-table-column>
<el-table-column
label="处置措施"
prop="measure"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="60"
>
<template #default="scope">
<el-button
link
size="small"
@click="
sflogexp_edit(scope.row)
"
type="primary"
>编辑</el-button
>
</template>
</el-table-column>
</el-table>
</el-col>
</el-row>
<el-dialog :title="expTitle" v-model="visible">
<el-form
ref="expForms"
:rules="rules"
label-width="100px"
:model="expForm"
>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item label="异常类别">
<el-select
style="width: 100%"
v-model="sflogexpType"
placeholder="异常类别"
:disabled="1"
>
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.name"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="异常名称"
prop="title"
>
<el-input
v-model="expForm.title"
placeholder="异常名称"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="发生时间"
prop="happen_time"
>
<el-date-picker
v-model="expForm.happen_time"
type="datetime"
placeholder="发生时间"
value-format="YYYY-MM-DD HH:mm:ss"
style="width: 100%"
:disabled="
expTitle !== '新增异常' &&
expForm.duration > 0
"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="原因类别"
prop="cate"
>
<el-select
style="width: 100%"
v-model="expForm.cate"
placeholder="原因类别"
>
<el-option
v-for="item in options"
:key="item"
:label="item"
:value="item"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:md="12"
:sm="24"
v-if="sflogexpType == 0"
>
<el-form-item label="停机时长">
<el-input-number
v-model="expForm.duration"
:precision="2"
:min="0"
controls-position="right"
placeholder="停机时长"
:disabled="
expTitle !== '新增异常' &&
expForm.duration > 0
"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :md="12" :sm="24">
<el-form-item
label="异常原因"
prop="reason"
>
<el-input
type="textarea"
:rows="2"
v-model="expForm.reason"
placeholder="异常原因"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24">
<el-form-item
label="处置措施"
prop="measure"
>
<el-input
type="textarea"
:rows="2"
v-model="expForm.measure"
placeholder="处置措施"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-footer>
<el-button
type="primary"
:loading="isSaveing"
@click="submit4"
>保存</el-button
>
<el-button @click="visible = false"
>取消</el-button
>
</el-footer>
</el-dialog>
</el-tab-pane>
</el-tabs>
</el-card>
</el-main>
</el-container>
</template>
<script>
export default {
name: "listSon",
data() {
return {
deptId: "",
mgroupId: "",
hideAdd: true,
visible: false,
hideDelete: true,
isSaveing: false,
activeName: "fourth",
expTitle: "新增异常",
sflogItem: {},
form: {},
thirdForm: {
num: "",
},
expForm: {
happen_time: "",
cate: "",
title: "",
reason: "",
measure: "",
duration: 0,
sflog: "",
},
query: {
page: 0,
},
rules: {
happen_time: [{ required: true, message: "请选择发生时间" }],
title: [{ required: true, message: "请填写异常名称" }],
cate: [{ required: true, message: "请选择原因类别" }],
reason: [{ required: true, message: "请填写异常原因" }],
measure: [{ required: true, message: "请填写处置措施" }],
},
sflogexpType: "1",
typeOptions: [
{ value: "0", name: "停机" },
{ value: "1", name: "其他" },
],
options: ["工艺", "电器", "机械", "其他"],
checkList: [],
stlogList: [],
teamOptions: [],
sflogexpList: [],
apiObj: this.$API.wpm.sflogexp.list,
};
},
mounted() {
this.deptId = this.$route.query.deptId;
this.mgroupId = this.$route.query.mgroupId;
let form = this.$TOOL.data.get("sflogItem");
this.form = JSON.parse(form);
this.getTeam();
this.getSflogexp();
},
methods: {
handleClick(e) {
this.activeName = e.paneName;
if (e.paneName == "second") {
this.getsflogItem();
}
},
//******first ******* */
getTeam() {
let that = this;
let form = {};
form.page = 0;
form.belong_dept = that.deptId;
that.$API.mtm.team.list.req(form).then((res) => {
that.teamOptions = res;
});
},
teamChange(data) {
let that = this;
that.teamOptions.forEach((item) => {
if (item.id == data) {
that.form.leader_name = item.leader_name;
that.form.leader = item.leader;
}
});
},
//
submit() {
let that = this;
that.$refs.teamForm.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
let obj = {};
obj.team = that.form.team;
obj.shift = that.form.shift;
obj.leader = that.form.leader;
obj.pcoal_heat = that.form.pcoal_heat;
that.$API.wpm.sflog.update
.req(that.form.id, obj)
.then((res) => {
that.isSaveing = false;
that.$message.success("操作成功");
})
.catch((res) => {
that.isSaveing = false;
});
}
});
},
//****** seconed ******* */
//
getsflogItem() {
this.$API.wpm.sflog.init_test.req(this.form.id).then((res) => {
this.checkList = res;
});
},
submit2() {
this.isSaveing = true;
this.$API.qm.updateQuastat
.req("bulk", this.checkList)
.then((res) => {
this.isSaveing = false;
this.$message.success("操作成功");
})
.catch((res) => {
this.isSaveing = false;
});
},
//
sflog_check(row) {
this.dialog.check = true;
this.$nextTick(() => {
this.$refs.checkDialog.open("edit").setData(row);
});
},
//***** fourth ****** */
//
getSflogexp() {
let obj = {};
obj.page = 0;
obj.sflog = this.form.id;
this.$API.wpm.sflogexp.list.req(obj).then((res) => {
this.sflogexpList = res;
});
},
//
addExp() {
this.expForm = {};
this.expForm.happen_time = "";
this.expForm.cate = "";
this.expForm.title = "";
this.expForm.reason = "";
this.expForm.measure = "";
this.expForm.duration = 0;
this.expForm.sflog = this.form.id;
this.expTitle = "新增异常";
this.visible = true;
},
//
sflogexp_edit(row) {
Object.assign(this.expForm, row);
this.expTitle = "编辑异常";
this.expForm.handler = this.$TOOL.data.get("USER_INFO").id;
if (this.expForm.duration > 0) {
this.sflogexpType = "0";
} else {
this.sflogexpType = "1";
}
this.visible = true;
},
//
async sflogexp_delete(row) {
this.$confirm(`确定删除选中的记录吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.wpm.sflogexp.delete
.req(row.id)
.then((res) => {
this.$message.success("删除成功");
this.$refs.expTable.refresh();
})
.catch((err) => {
this.$message.success(err);
});
});
},
submit4() {
let that = this;
that.$refs.expForms.validate(async (valid) => {
if (valid) {
that.isSaveing = true;
if (that.expTitle == "新增异常") {
that.$API.wpm.stlog.create
.req(that.expForm)
.then((res) => {
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
this.$refs.expTable.refresh();
})
.catch((res) => {
that.isSaveing = false;
});
} else {
that.$API.wpm.sflogexp.update
.req(that.expForm.id, that.expForm)
.then((res) => {
that.isSaveing = false;
that.visible = false;
that.$message.success("操作成功");
this.$refs.expTable.refresh();
})
.catch((res) => {
that.isSaveing = false;
});
}
}
});
},
handlePrint() {
this.$PRINT("#myReport");
},
exportExcel() {
this.exportLoading = true;
this.$XLSX("#myTable", this.tableName);
this.exportLoading = false;
},
},
};
</script>
<style scoped>
#numTable {
margin-left: 37px;
}
#numTable td {
height: 32px;
padding-left: 5px;
}
.numCell {
width: 80px;
}
.numCell.numCell_last {
width: 100px;
}
.searchHead {
display: flex;
}
.middleText {
height: 32px;
line-height: 32px;
margin: 0 5px;
display: inline-block;
}
.searchBtn {
margin-left: 5px;
}
</style>

View File

@ -168,8 +168,10 @@ export default {
}, },
data() { data() {
return { return {
exportLoading: false,
chartShow: false, chartShow: false,
myOption: null, myOption: null,
timeStamp: null,
optionHour: {}, optionHour: {},
optionDay: {}, optionDay: {},
optionMonth: {}, optionMonth: {},
@ -178,17 +180,13 @@ export default {
days: 1, days: 1,
hours: 1, hours: 1,
query: { query: {
mgroup: "3346520558031773696", mgroup: "",
}, },
tableName: "主要设备100KW以上单位产品电耗数据表", tableName: "主要设备100KW以上单位产品电耗数据表",
tableDatas: [ tableDatas: [
["辊压机", "", "KW·h/t", "", "", ""], ["辊压机", "", "KW·h/t", "", "", ""],
["循环风机", "", "KW·h/t", "", "", ""], ["循环风机", "", "KW·h/t", "", "", ""],
// ['','','KW·h/t','','',''],
// ['','','KW·h/t','','',''],
// ['','','KW·h/t','','',''],
], ],
modelValue: true, modelValue: true,
type: "hour_s", type: "hour_s",
title: "原料磨工段", title: "原料磨工段",
@ -337,6 +335,7 @@ export default {
let days = (that.days = myDate.getDate()); let days = (that.days = myDate.getDate());
let hours = (that.hours = myDate.getHours()); let hours = (that.hours = myDate.getHours());
let timeDate = myDate.getTime(); let timeDate = myDate.getTime();
that.timeStamp = timeDate;
let dayTime = 24 * 60 * 60 * 1000; let dayTime = 24 * 60 * 60 * 1000;
// //
let year_d = year, let year_d = year,
@ -357,97 +356,115 @@ export default {
let month_h = hourDate.getMonth() + 1; let month_h = hourDate.getMonth() + 1;
let days_h = hourDate.getDate(); let days_h = hourDate.getDate();
let hours_h = hourDate.getHours(); let hours_h = hourDate.getHours();
// this.$API.mtm.mgroup.list
let params2 = {}; .req({ page: 0, search: "原料磨" })
params2.page = 0; .then((res) => {
params2.year_s = year; console.log("原料磨", res);
params2.month_s = month; that.query.mgroup = res[0].id;
params2.type = "month_s"; //
params2.mgroup = this.query.mgroup; let params2 = {};
this.$API.enm.enstat params2.page = 0;
.req(params2) params2.year_s = year;
.then((res2) => { params2.month_s = month;
if (res2.length > 0) { params2.type = "month_s";
let hourProduct = (that.allValMonth = params2.mgroup = this.query.mgroup;
res2[0].total_production); // this.$API.enm.enstat
params2.mpoint__ep_monitored__power_kw__gte = 100; .req(params2)
this.$API.enm.mpoint.stat.req(params2).then((res) => { .then((res2) => {
let data2 = res; if (res2.length > 0) {
for (let i = 0; i < data2.length; i++) { let hourProduct = (that.allValMonth =
that.tableDatas[i] = []; res2[0].total_production); //
that.tableDatas[i][0] = data2[i].ep_monitored_name; params2.mpoint__ep_monitored__power_kw__gte = 100;
that.tableDatas[i][1] = this.$API.enm.mpoint.stat
data2[i].ep_monitored_number; .req(params2)
that.tableDatas[i][2] = "KW·h/t"; .then((res) => {
let val = let data2 = res;
hourProduct == 0 for (let i = 0; i < data2.length; i++) {
? "/" that.tableDatas[i] = [];
: (data2[i].val / hourProduct).toFixed(2); that.tableDatas[i][0] =
that.tableDatas[i][5] = val; data2[i].ep_monitored_name;
that.tableDatas[i][1] =
data2[i].ep_monitored_number;
that.tableDatas[i][2] = "KW·h/t";
let val =
hourProduct == 0
? "/"
: (
data2[i].val /
hourProduct
).toFixed(2);
that.tableDatas[i][5] = val;
}
});
} }
})
.then((res2) => {
//
let params3 = {};
params3.page = 0;
params3.year_s = year_d;
params3.month_s = month_d;
params3.day_s = days_d;
params3.type = "day_s";
params3.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params3).then((res3) => {
if (res3.length > 0) {
let hourProduct = (that.allValDays =
res3[0].total_production);
params3.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params3)
.then((res) => {
let data3 = res3;
for (let j = 0; j < data3.length; j++) {
let val =
hourProduct == 0
? "/"
: (
data3[j].val /
hourProduct
).toFixed(2);
that.tableDatas[j][4] = val;
}
});
}
});
//
let params4 = {};
params4.page = 0;
params4.year = year_h;
params4.month = month_h;
params4.day = days_h;
params4.hour = hours_h;
params4.type = "hour_s";
params4.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let hourProduct = (that.allValHour =
res4[0].total_production);
params4.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(params4)
.then((res) => {
let data4 = res4;
for (let k = 0; k < data4.length; k++) {
let val =
hourProduct == 0
? "/"
: (
data4[k].val /
hourProduct
).toFixed(2);
that.tableDatas[k][3] = val;
}
});
}
});
}); });
} that.getHourData();
}) that.getDayData();
.then((res2) => { that.getMonthData();
//
let params3 = {};
params3.page = 0;
params3.year_s = year_d;
params3.month_s = month_d;
params3.day_s = days_d;
params3.type = "day_s";
params3.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params3).then((res3) => {
if (res3.length > 0) {
let hourProduct = (that.allValDays =
res3[0].total_production);
params3.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat.req(params3).then((res) => {
let data3 = res3;
for (let j = 0; j < data3.length; j++) {
let val =
hourProduct == 0
? "/"
: (data3[j].val / hourProduct).toFixed(
2
);
that.tableDatas[j][4] = val;
}
});
}
});
//
let params4 = {};
params4.page = 0;
params4.year = year_h;
params4.month = month_h;
params4.day = days_h;
params4.hour = hours_h;
params4.type = "hour_s";
params4.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let hourProduct = (that.allValHour =
res4[0].total_production);
params4.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat.req(params4).then((res) => {
let data4 = res4;
for (let k = 0; k < data4.length; k++) {
let val =
hourProduct == 0
? "/"
: (data4[k].val / hourProduct).toFixed(
2
);
that.tableDatas[k][3] = val;
}
});
}
});
}); });
that.getHourData();
that.getDayData();
that.getMonthData();
}, },
methods: { methods: {
// //

View File

@ -85,7 +85,6 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<!-- <div id="main" style="width:1200px;height:600px;"></div> -->
<div class="chartWrap"> <div class="chartWrap">
<div class="chartTitle">小时生产参数统计图</div> <div class="chartTitle">小时生产参数统计图</div>
<scEcharts <scEcharts
@ -338,7 +337,9 @@ export default {
}, },
data() { data() {
return { return {
exportLoading: false,
chartShow: false, chartShow: false,
timeStamp: null,
myOption: null, myOption: null,
optionHour: {}, optionHour: {},
optionDay: {}, optionDay: {},
@ -348,7 +349,7 @@ export default {
days: 1, days: 1,
hours: 1, hours: 1,
query: { query: {
mgroup: "3346520558031773696", mgroup: "",
}, },
tableDatas: [ tableDatas: [
["产量", "总产量t", 0, 0, 0, 0, 0, 0, 0, 0], ["产量", "总产量t", 0, 0, 0, 0, 0, 0, 0, 0],
@ -508,50 +509,6 @@ export default {
}, },
], ],
}, },
list: [
{
x: 1,
y: 1,
z: 99,
k: 11,
},
{
x: 2,
y: 2,
z: 70,
k: 11,
},
{
x: 3,
y: 3,
z: 1,
k: 11,
},
{
x: 4,
y: 4,
z: 30,
k: 11,
},
{
x: 5,
y: 1,
z: 20,
k: 11,
},
{
x: 6,
y: 0,
z: 18,
k: 11,
},
{
x: 7,
y: 10,
z: 12,
k: 11,
},
],
dataX: [], dataX: [],
dataY: [], dataY: [],
dataY2: [], dataY2: [],
@ -743,34 +700,6 @@ export default {
} }
} }
let that = this; let that = this;
this.$nextTick(() => {
this.dataX = this.list.map((item) => item.x);
// 1Y
this.dataY.push({
name: "AA",
type: "line", // 线
yAxisIndex: 0, // Y
symbolSize: "10",
// lineStyle: { color: '#4485f4' },
data: this.list.map((item) => item.y),
});
// 2Y
this.dataY.push({
name: "BB",
type: "line",
yAxisIndex: 1, // Y
data: this.list.map((item) => item.z),
});
// 3Y
this.dataY.push({
name: "CC",
type: "line",
yAxisIndex: 2, // Y
data: this.list.map((item) => item.k),
});
this.init(this.dataX, this.dataY);
});
this.$nextTick(() => { this.$nextTick(() => {
var myDate = new Date(); var myDate = new Date();
let year = (that.year = myDate.getFullYear()); let year = (that.year = myDate.getFullYear());
@ -778,6 +707,7 @@ export default {
let days = (that.days = myDate.getDate()); let days = (that.days = myDate.getDate());
let hours = (that.hours = myDate.getHours()); let hours = (that.hours = myDate.getHours());
let timeDate = myDate.getTime(); let timeDate = myDate.getTime();
that.timeStamp = timeDate;
let dayTime = 24 * 60 * 60 * 1000; let dayTime = 24 * 60 * 60 * 1000;
// //
let year_d = year, let year_d = year,
@ -798,171 +728,183 @@ export default {
let month_h = hourDate.getMonth() + 1; let month_h = hourDate.getMonth() + 1;
let days_h = hourDate.getDate(); let days_h = hourDate.getDate();
let hours_h = hourDate.getHours(); let hours_h = hourDate.getHours();
this.$API.mtm.mgroup.list
// .req({ page: 0, search: "原料磨" })
let params3 = {};
params3.page = 0;
params3.year_s = year_d;
params3.month_s = month_d;
params3.day_s = days_d;
params3.type = "day_s";
params3.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params3).then((res3) => {
if (res3.length > 0) {
let data3 = res3[0];
that.tableDatas[0][3] = data3.total_production;
that.tableDatas[1][3] = data3.production_hour;
that.tableDatas[2][3] = data3.run_hour;
that.tableDatas[3][3] = data3.run_rate;
that.tableDatas[4][3] = data3.elec_consume_unit;
}
});
//
let params4 = {};
params4.page = 0;
params4.year = year_h;
params4.month = month_h;
params4.day = days_h;
params4.hour = hours_h;
params4.type = "hour_st";
params4.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params4).then((res4) => {
if (res4.length > 0) {
let data4 = res4[0];
that.tableDatas[0][2] = data4.total_production;
that.tableDatas[4][2] = data4.elec_consume_unit;
}
});
//
let params5 = {};
params5.page = 0;
params5.mgroup = "3346520558031773696";
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;
debugger;
console.log(str, item5[str]);
if (item5.goal_cate_name == "总产量t") {
that.tableDatas[0][6] = item5[str];
that.tableDatas[0][8] = item5.goal_val;
} else if (
item5.goal_cate_name == "台时产量t/h"
) {
that.tableDatas[1][6] = item5[str];
that.tableDatas[1][8] = item5.goal_val;
} else if (
item5.goal_cate_name == "运转时间h"
) {
that.tableDatas[2][6] = item5[str];
that.tableDatas[2][8] = item5.goal_val;
} else if (item5.goal_cate_name == "运转率(%") {
that.tableDatas[3][6] = item5[str];
that.tableDatas[3][8] = item5.goal_val;
} else if (
item5.goal_cate_name ==
"单位产品分布电耗KW·h/t"
) {
that.tableDatas[4][6] = item5[str];
that.tableDatas[4][8] = item5.goal_val;
}
});
}
})
.then((res) => { .then((res) => {
// console.log("原料磨", res);
let params1 = {}; that.query.mgroup = res[0].id;
params1.page = 0; //
params1.year_s = year; let params3 = {};
params1.type = "year_s"; params3.page = 0;
params1.mgroup = this.query.mgroup; params3.year_s = year_d;
this.$API.enm.enstat.req(params1).then((res1) => { params3.month_s = month_d;
if (res1.length > 0) { params3.day_s = days_d;
let data1 = res1[0]; params3.type = "day_s";
that.tableDatas[0][5] = data1.total_production; params3.mgroup = this.query.mgroup;
that.tableDatas[0][9] = precen( this.$API.enm.enstat.req(params3).then((res3) => {
that.tableDatas[0][5], if (res3.length > 0) {
that.tableDatas[0][8] let data3 = res3[0];
); that.tableDatas[0][3] = data3.total_production;
that.tableDatas[1][5] = data1.production_hour; that.tableDatas[1][3] = data3.production_hour;
that.tableDatas[1][9] = precen( that.tableDatas[2][3] = data3.run_hour;
that.tableDatas[1][5], that.tableDatas[3][3] = data3.run_rate;
that.tableDatas[1][8] that.tableDatas[4][3] = data3.elec_consume_unit;
);
that.tableDatas[2][5] = data1.run_hour;
that.tableDatas[2][9] = precen(
that.tableDatas[2][5],
that.tableDatas[2][8]
);
that.tableDatas[3][5] = data1.run_rate;
that.tableDatas[3][9] = precen(
that.tableDatas[3][5],
that.tableDatas[3][8]
);
that.tableDatas[4][5] = data1.elec_consume_unit;
that.tableDatas[4][9] = precen(
that.tableDatas[4][5],
that.tableDatas[4][8]
);
} else {
} }
}); });
// //
let params2 = {}; let params4 = {};
params2.page = 0; params4.page = 0;
params2.year_s = year; params4.year = year_h;
params2.month_s = month; params4.month = month_h;
params2.type = "month_s"; params4.day = days_h;
params2.mgroup = this.query.mgroup; params4.hour = hours_h;
this.$API.enm.enstat.req(params2).then((res2) => { params4.type = "hour_st";
if (res2.length > 0) { params4.mgroup = this.query.mgroup;
let data2 = res2[0]; this.$API.enm.enstat.req(params4).then((res4) => {
that.tableDatas[0][4] = data2.total_production; if (res4.length > 0) {
if (that.tableDatas[0][4] > that.tableDatas[0][6]) { let data4 = res4[0];
that.wraning = true; that.tableDatas[0][2] = data4.total_production;
that.tableDatas[4][2] = data4.elec_consume_unit;
}
});
//
let params5 = {};
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;
debugger;
console.log(str, item5[str]);
if (item5.goal_cate_name == "总产量t") {
that.tableDatas[0][6] = item5[str];
that.tableDatas[0][8] = item5.goal_val;
} else if (
item5.goal_cate_name ==
"台时产量t/h"
) {
that.tableDatas[1][6] = item5[str];
that.tableDatas[1][8] = item5.goal_val;
} else if (
item5.goal_cate_name == "运转时间h"
) {
that.tableDatas[2][6] = item5[str];
that.tableDatas[2][8] = item5.goal_val;
} else if (
item5.goal_cate_name == "运转率(%"
) {
that.tableDatas[3][6] = item5[str];
that.tableDatas[3][8] = item5.goal_val;
} else if (
item5.goal_cate_name ==
"单位产品分布电耗KW·h/t"
) {
that.tableDatas[4][6] = item5[str];
that.tableDatas[4][8] = item5.goal_val;
}
});
} }
that.tableDatas[0][7] = precen( })
that.tableDatas[0][4], .then((res) => {
that.tableDatas[0][6] //
); let params1 = {};
that.tableDatas[1][4] = data2.production_hour; params1.page = 0;
that.tableDatas[1][7] = precen( params1.year_s = year;
that.tableDatas[1][4], params1.type = "year_s";
that.tableDatas[1][6] params1.mgroup = this.query.mgroup;
); this.$API.enm.enstat.req(params1).then((res1) => {
that.tableDatas[2][4] = data2.run_hour; if (res1.length > 0) {
that.tableDatas[2][7] = precen( let data1 = res1[0];
that.tableDatas[2][4], that.tableDatas[0][5] =
that.tableDatas[2][6] data1.total_production;
); that.tableDatas[0][9] = precen(
that.tableDatas[3][4] = data2.run_rate; that.tableDatas[0][5],
that.tableDatas[3][7] = precen( that.tableDatas[0][8]
that.tableDatas[3][4], );
that.tableDatas[3][6] that.tableDatas[1][5] =
); data1.production_hour;
that.tableDatas[4][4] = data2.elec_consume_unit; that.tableDatas[1][9] = precen(
that.tableDatas[4][7] = precen( that.tableDatas[1][5],
that.tableDatas[4][4], that.tableDatas[1][8]
that.tableDatas[4][6] );
); that.tableDatas[2][5] = data1.run_hour;
} that.tableDatas[2][9] = precen(
}); that.tableDatas[2][5],
that.tableDatas[2][8]
);
that.tableDatas[3][5] = data1.run_rate;
that.tableDatas[3][9] = precen(
that.tableDatas[3][5],
that.tableDatas[3][8]
);
that.tableDatas[4][5] =
data1.elec_consume_unit;
that.tableDatas[4][9] = precen(
that.tableDatas[4][5],
that.tableDatas[4][8]
);
} else {
}
});
//
let params2 = {};
params2.page = 0;
params2.year_s = year;
params2.month_s = month;
params2.type = "month_s";
params2.mgroup = this.query.mgroup;
this.$API.enm.enstat.req(params2).then((res2) => {
if (res2.length > 0) {
let data2 = res2[0];
that.tableDatas[0][4] =
data2.total_production;
if (
that.tableDatas[0][4] >
that.tableDatas[0][6]
) {
that.wraning = true;
}
that.tableDatas[0][7] = precen(
that.tableDatas[0][4],
that.tableDatas[0][6]
);
that.tableDatas[1][4] =
data2.production_hour;
that.tableDatas[1][7] = precen(
that.tableDatas[1][4],
that.tableDatas[1][6]
);
that.tableDatas[2][4] = data2.run_hour;
that.tableDatas[2][7] = precen(
that.tableDatas[2][4],
that.tableDatas[2][6]
);
that.tableDatas[3][4] = data2.run_rate;
that.tableDatas[3][7] = precen(
that.tableDatas[3][4],
that.tableDatas[3][6]
);
that.tableDatas[4][4] =
data2.elec_consume_unit;
that.tableDatas[4][7] = precen(
that.tableDatas[4][4],
that.tableDatas[4][6]
);
}
});
});
that.getHourData();
that.getDayData();
that.getMonthData();
}); });
that.getHourData();
that.getDayData();
that.getMonthData();
}); });
}, },
methods: { methods: {
init(dataX, dataY) {
this.myChart = echarts.init(document.getElementById("main"));
// 使
this.myChart.setOption(this.option);
},
// //
getHourData() { getHourData() {
let that = this; let that = this;

View File

@ -83,9 +83,10 @@ export default {
year_s: "", year_s: "",
page: 0, page: 0,
type: "month_st", type: "month_st",
mgroup: "3346520558031773696", mgroup: "",
}, },
tableDatas: [], tableDatas: [],
exportLoading: false,
}; };
}, },
mounted() { mounted() {
@ -93,17 +94,23 @@ export default {
var myDate = new Date(); var myDate = new Date();
let year = myDate.getFullYear(); let year = myDate.getFullYear();
that.query.year_s = year; that.query.year_s = year;
let params = {}; this.$API.mtm.mgroup.list
params.page = 0; .req({ page: 0, search: "原料磨" })
params.year = year; .then((res) => {
params.mgroup = that.query.mgroup; console.log("原料磨", res);
this.$API.mtm.goal.list.req(params).then((res) => { that.query.mgroup = res[0].id;
let data = []; let params = {};
if (res.length > 0) { params.page = 0;
data = res[0]; params.year = year;
} params.mgroup = that.query.mgroup;
that.getData(data); this.$API.mtm.goal.list.req(params).then((res) => {
}); let data = [];
if (res.length > 0) {
data = res[0];
}
that.getData(data);
});
});
}, },
methods: { methods: {
getData(goalData) { getData(goalData) {
@ -112,7 +119,7 @@ export default {
query0.page = 0; query0.page = 0;
query0.type = "month_st"; query0.type = "month_st";
query0.year_s = that.query.year_s - 1; query0.year_s = that.query.year_s - 1;
query0.mgroup = "3346520558031773696"; query0.mgroup = that.query.mgroup;
let wrapArr = [], let wrapArr = [],
wrapArr0 = [], wrapArr0 = [],
wrapArrs = []; wrapArrs = [];
@ -124,6 +131,7 @@ export default {
// //
let n0 = item0.month_s; let n0 = item0.month_s;
let ind0 = 0; let ind0 = 0;
let team_name0 = item0.team_name;
if (team_name0.indexOf("甲") > -1) { if (team_name0.indexOf("甲") > -1) {
ind0 = (n0 - 1) * 3; ind0 = (n0 - 1) * 3;
} else if (team_name0.indexOf("乙") > -1) { } else if (team_name0.indexOf("乙") > -1) {
@ -133,8 +141,6 @@ export default {
} }
wrapArr0[ind0] = item0; wrapArr0[ind0] = item0;
}); });
debugger;
console.log(wrapArr0);
} else { } else {
} }
this.$API.enm.enstat.req(that.query).then((res) => { this.$API.enm.enstat.req(that.query).then((res) => {

View File

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