This commit is contained in:
caoqianming 2024-05-09 17:36:41 +08:00
commit e508d879e1
12 changed files with 2052 additions and 1320 deletions

View File

@ -111,6 +111,15 @@ export default {
); );
} }
}, },
mplogx: {
name: "测点采集数据",
req: async function(data){
return await http.get(
`${config.API_URL}/enm/mplogx/`,
data
);
}
},
enstat2: { enstat2: {
name: "全厂统计记录", name: "全厂统计记录",
req: async function(data){ req: async function(data){

View File

@ -2372,7 +2372,7 @@ const routes = [
"name": "formula", "name": "formula",
"path": "/enm_base/formula", "path": "/enm_base/formula",
"meta": { "meta": {
"title": "计算公式", "title": "计算系数",
"icon": "el-icon-grid", "icon": "el-icon-grid",
"perms": ["enm_base"] "perms": ["enm_base"]
}, },

View File

@ -6,11 +6,16 @@
<div class="logo-bar"> <div class="logo-bar">
<!-- <img class="logo" src="img/bbmg.png"> --> <!-- <img class="logo" src="img/bbmg.png"> -->
<!-- <span>{{ $CONFIG.APP_NAME }}</span> --> <!-- <span>{{ $CONFIG.APP_NAME }}</span> -->
<img class="logo" :src="baseLogo"> <img class="logo" :src="baseLogo" />
<span>{{ baseName }}</span> <span>{{ baseName }}</span>
</div> </div>
<ul v-if="!ismobile" class="nav"> <ul v-if="!ismobile" class="nav">
<li v-for="item in menu" :key="item" :class="pmenu.path == item.path ? 'active' : ''" @click="showMenu(item)"> <li
v-for="item in menu"
:key="item"
:class="pmenu.path == item.path ? 'active' : ''"
@click="showMenu(item)"
>
<el-icon> <el-icon>
<component :is="item.meta.icon || 'el-icon-menu'" /> <component :is="item.meta.icon || 'el-icon-menu'" />
</el-icon> </el-icon>
@ -23,21 +28,35 @@
</div> </div>
</header> </header>
<section class="aminui-wrapper"> <section class="aminui-wrapper">
<div v-if="!ismobile && nextMenu.length > 0 || !pmenu.component" <div
:class="menuIsCollapse ? 'aminui-side isCollapse' : 'aminui-side'"> v-if="(!ismobile && nextMenu.length > 0) || !pmenu.component"
:class="
menuIsCollapse ? 'aminui-side isCollapse' : 'aminui-side'
"
>
<div v-if="!menuIsCollapse" class="adminui-side-top"> <div v-if="!menuIsCollapse" class="adminui-side-top">
<h2>{{ pmenu.meta.title }}</h2> <h2>{{ pmenu.meta.title }}</h2>
</div> </div>
<div class="adminui-side-scroll"> <div class="adminui-side-scroll">
<el-scrollbar> <el-scrollbar>
<el-menu :default-active="active" router :collapse="menuIsCollapse" <el-menu
:unique-opened="$CONFIG.MENU_UNIQUE_OPENED"> :default-active="active"
router
:collapse="menuIsCollapse"
:unique-opened="$CONFIG.MENU_UNIQUE_OPENED"
>
<NavMenu :navMenus="nextMenu"></NavMenu> <NavMenu :navMenus="nextMenu"></NavMenu>
</el-menu> </el-menu>
</el-scrollbar> </el-scrollbar>
</div> </div>
<div class="adminui-side-bottom" @click="$store.commit('TOGGLE_menuIsCollapse')"> <div
<el-icon><el-icon-expand v-if="menuIsCollapse" /><el-icon-fold v-else /></el-icon> class="adminui-side-bottom"
@click="$store.commit('TOGGLE_menuIsCollapse')"
>
<el-icon
><el-icon-expand v-if="menuIsCollapse" /><el-icon-fold
v-else
/></el-icon>
</div> </div>
</div> </div>
<Side-m v-if="ismobile"></Side-m> <Side-m v-if="ismobile"></Side-m>
@ -46,8 +65,14 @@
<Tags v-if="!ismobile && layoutTags"></Tags> <Tags v-if="!ismobile && layoutTags"></Tags>
<div class="adminui-main" id="adminui-main"> <div class="adminui-main" id="adminui-main">
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<keep-alive :include="this.$store.state.keepAlive.keepLiveRoute"> <keep-alive
<component :is="Component" :key="$route.fullPath" v-if="$store.state.keepAlive.routeShow" /> :include="this.$store.state.keepAlive.keepLiveRoute"
>
<component
:is="Component"
:key="$route.fullPath"
v-if="$store.state.keepAlive.routeShow"
/>
</keep-alive> </keep-alive>
</router-view> </router-view>
<iframe-view></iframe-view> <iframe-view></iframe-view>
@ -60,8 +85,16 @@
<template v-else-if="layout == 'menu'"> <template v-else-if="layout == 'menu'">
<header class="adminui-header"> <header class="adminui-header">
<div class="adminui-header-left"> <div class="adminui-header-left">
<div class="logo-bar" style="width: 202px;background: #ffffff;margin-right: 10px;border-radius: 5px;"> <div
<img class="logo" :src="baseLogo"> class="logo-bar"
style="
width: 202px;
background: #ffffff;
margin-right: 10px;
border-radius: 5px;
"
>
<img class="logo" :src="baseLogo" />
<!-- <img class="logo" src="/img/bbmg.jpg"> --> <!-- <img class="logo" src="/img/bbmg.jpg"> -->
</div> </div>
<div class="logo-bar"> <div class="logo-bar">
@ -73,17 +106,32 @@
</div> </div>
</header> </header>
<section class="aminui-wrapper"> <section class="aminui-wrapper">
<div v-if="!ismobile" :class="menuIsCollapse ? 'aminui-side isCollapse' : 'aminui-side'"> <div
v-if="!ismobile"
:class="
menuIsCollapse ? 'aminui-side isCollapse' : 'aminui-side'
"
>
<div class="adminui-side-scroll"> <div class="adminui-side-scroll">
<el-scrollbar> <el-scrollbar>
<el-menu :default-active="active" router :collapse="menuIsCollapse" <el-menu
:unique-opened="$CONFIG.MENU_UNIQUE_OPENED"> :default-active="active"
router
:collapse="menuIsCollapse"
:unique-opened="$CONFIG.MENU_UNIQUE_OPENED"
>
<NavMenu :navMenus="menu"></NavMenu> <NavMenu :navMenus="menu"></NavMenu>
</el-menu> </el-menu>
</el-scrollbar> </el-scrollbar>
</div> </div>
<div class="adminui-side-bottom" @click="$store.commit('TOGGLE_menuIsCollapse')"> <div
<el-icon><el-icon-expand v-if="menuIsCollapse" /><el-icon-fold v-else /></el-icon> class="adminui-side-bottom"
@click="$store.commit('TOGGLE_menuIsCollapse')"
>
<el-icon
><el-icon-expand v-if="menuIsCollapse" /><el-icon-fold
v-else
/></el-icon>
</div> </div>
</div> </div>
<Side-m v-if="ismobile"></Side-m> <Side-m v-if="ismobile"></Side-m>
@ -92,8 +140,14 @@
<!-- <Tags v-if="!ismobile && layoutTags"></Tags> --> <!-- <Tags v-if="!ismobile && layoutTags"></Tags> -->
<div class="adminui-main" id="adminui-main"> <div class="adminui-main" id="adminui-main">
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<keep-alive :include="this.$store.state.keepAlive.keepLiveRoute"> <keep-alive
<component :is="Component" :key="$route.fullPath" v-if="$store.state.keepAlive.routeShow" /> :include="this.$store.state.keepAlive.keepLiveRoute"
>
<component
:is="Component"
:key="$route.fullPath"
v-if="$store.state.keepAlive.routeShow"
/>
</keep-alive> </keep-alive>
</router-view> </router-view>
<iframe-view></iframe-view> <iframe-view></iframe-view>
@ -107,14 +161,20 @@
<header class="adminui-header"> <header class="adminui-header">
<div class="adminui-header-left"> <div class="adminui-header-left">
<div class="logo-bar"> <div class="logo-bar">
<img class="logo" src="img/bbmg.jpg"> <img class="logo" src="img/bbmg.jpg" />
<span>{{ $CONFIG.APP_NAME }}</span> <span>{{ $CONFIG.APP_NAME }}</span>
</div> </div>
</div> </div>
<div class="adminui-header-right"> <div class="adminui-header-right">
<div v-if="!ismobile" class="adminui-header-menu"> <div v-if="!ismobile" class="adminui-header-menu">
<el-menu mode="horizontal" :default-active="active" router background-color="#222b45" text-color="#fff" <el-menu
active-text-color="var(--el-color-primary)"> mode="horizontal"
:default-active="active"
router
background-color="#222b45"
text-color="#fff"
active-text-color="var(--el-color-primary)"
>
<NavMenu :navMenus="menu"></NavMenu> <NavMenu :navMenus="menu"></NavMenu>
</el-menu> </el-menu>
</div> </div>
@ -127,8 +187,14 @@
<Tags v-if="!ismobile && layoutTags"></Tags> <Tags v-if="!ismobile && layoutTags"></Tags>
<div class="adminui-main" id="adminui-main"> <div class="adminui-main" id="adminui-main">
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<keep-alive :include="this.$store.state.keepAlive.keepLiveRoute"> <keep-alive
<component :is="Component" :key="$route.fullPath" v-if="$store.state.keepAlive.routeShow" /> :include="this.$store.state.keepAlive.keepLiveRoute"
>
<component
:is="Component"
:key="$route.fullPath"
v-if="$store.state.keepAlive.routeShow"
/>
</keep-alive> </keep-alive>
</router-view> </router-view>
<iframe-view></iframe-view> <iframe-view></iframe-view>
@ -143,16 +209,26 @@
<div v-if="!ismobile" class="aminui-side-split"> <div v-if="!ismobile" class="aminui-side-split">
<div class="aminui-side-split-top"> <div class="aminui-side-split-top">
<router-link :to="$CONFIG.DASHBOARD_URL"> <router-link :to="$CONFIG.DASHBOARD_URL">
<img class="logo" :title="$CONFIG.APP_NAME" src="img/logo-r.png"> <img
class="logo"
:title="$CONFIG.APP_NAME"
src="img/logo-r.png"
/>
</router-link> </router-link>
</div> </div>
<div class="adminui-side-split-scroll"> <div class="adminui-side-split-scroll">
<el-scrollbar> <el-scrollbar>
<ul> <ul>
<li v-for="item in menu" :key="item" :class="pmenu.path == item.path ? 'active' : ''" <li
@click="showMenu(item)"> v-for="item in menu"
:key="item"
:class="pmenu.path == item.path ? 'active' : ''"
@click="showMenu(item)"
>
<el-icon> <el-icon>
<component :is="item.meta.icon || el-icon-menu" /> <component
:is="item.meta.icon || el - icon - menu"
/>
</el-icon> </el-icon>
<p>{{ item.meta.title }}</p> <p>{{ item.meta.title }}</p>
</li> </li>
@ -160,21 +236,35 @@
</el-scrollbar> </el-scrollbar>
</div> </div>
</div> </div>
<div v-if="!ismobile && nextMenu.length > 0 || !pmenu.component" <div
:class="menuIsCollapse ? 'aminui-side isCollapse' : 'aminui-side'"> v-if="(!ismobile && nextMenu.length > 0) || !pmenu.component"
:class="
menuIsCollapse ? 'aminui-side isCollapse' : 'aminui-side'
"
>
<div v-if="!menuIsCollapse" class="adminui-side-top"> <div v-if="!menuIsCollapse" class="adminui-side-top">
<h2>{{ pmenu.meta.title }}</h2> <h2>{{ pmenu.meta.title }}</h2>
</div> </div>
<div class="adminui-side-scroll"> <div class="adminui-side-scroll">
<el-scrollbar> <el-scrollbar>
<el-menu :default-active="active" router :collapse="menuIsCollapse" <el-menu
:unique-opened="$CONFIG.MENU_UNIQUE_OPENED"> :default-active="active"
router
:collapse="menuIsCollapse"
:unique-opened="$CONFIG.MENU_UNIQUE_OPENED"
>
<NavMenu :navMenus="nextMenu"></NavMenu> <NavMenu :navMenus="nextMenu"></NavMenu>
</el-menu> </el-menu>
</el-scrollbar> </el-scrollbar>
</div> </div>
<div class="adminui-side-bottom" @click="$store.commit('TOGGLE_menuIsCollapse')"> <div
<el-icon><el-icon-expand v-if="menuIsCollapse" /><el-icon-fold v-else /></el-icon> class="adminui-side-bottom"
@click="$store.commit('TOGGLE_menuIsCollapse')"
>
<el-icon
><el-icon-expand v-if="menuIsCollapse" /><el-icon-fold
v-else
/></el-icon>
</div> </div>
</div> </div>
<Side-m v-if="ismobile"></Side-m> <Side-m v-if="ismobile"></Side-m>
@ -185,8 +275,14 @@
<Tags v-if="!ismobile && layoutTags"></Tags> <Tags v-if="!ismobile && layoutTags"></Tags>
<div class="adminui-main" id="adminui-main"> <div class="adminui-main" id="adminui-main">
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<keep-alive :include="this.$store.state.keepAlive.keepLiveRoute"> <keep-alive
<component :is="Component" :key="$route.fullPath" v-if="$store.state.keepAlive.routeShow" /> :include="this.$store.state.keepAlive.keepLiveRoute"
>
<component
:is="Component"
:key="$route.fullPath"
v-if="$store.state.keepAlive.routeShow"
/>
</keep-alive> </keep-alive>
</router-view> </router-view>
<iframe-view></iframe-view> <iframe-view></iframe-view>
@ -195,11 +291,19 @@
</section> </section>
</template> </template>
<div class="main-maximize-exit" @click="exitMaximize"><el-icon><el-icon-close /></el-icon></div> <div class="main-maximize-exit" @click="exitMaximize">
<el-icon><el-icon-close /></el-icon>
</div>
<!-- <div class="layout-setting" @click="openSetting"><el-icon><el-icon-brush-filled /></el-icon></div> --> <!-- <div class="layout-setting" @click="openSetting"><el-icon><el-icon-brush-filled /></el-icon></div> -->
<el-drawer title="布局实时演示" v-model="settingDialog" :size="400" append-to-body destroy-on-close> <el-drawer
title="布局实时演示"
v-model="settingDialog"
:size="400"
append-to-body
destroy-on-close
>
<setting></setting> <setting></setting>
</el-drawer> </el-drawer>
@ -207,17 +311,17 @@
</template> </template>
<script> <script>
import SideM from './components/sideM.vue'; import SideM from "./components/sideM.vue";
import Topbar from './components/topbar.vue'; import Topbar from "./components/topbar.vue";
import Tags from './components/tags.vue'; import Tags from "./components/tags.vue";
import NavMenu from './components/NavMenu.vue'; import NavMenu from "./components/NavMenu.vue";
import userbar from './components/userbar.vue'; import userbar from "./components/userbar.vue";
import setting from './components/setting.vue'; import setting from "./components/setting.vue";
import iframeView from './components/iframeView.vue'; import iframeView from "./components/iframeView.vue";
import autoExit from './other/autoExit.js'; import autoExit from "./other/autoExit.js";
import data from './../utils/baseJson'; import data from "./../utils/baseJson";
export default { export default {
name: 'index', name: "index",
components: { components: {
SideM, SideM,
Topbar, Topbar,
@ -226,7 +330,7 @@ export default {
userbar, userbar,
setting, setting,
iframeView, iframeView,
autoExit autoExit,
}, },
data() { data() {
return { return {
@ -234,102 +338,136 @@ export default {
menu: [], menu: [],
nextMenu: [], nextMenu: [],
pmenu: {}, pmenu: {},
active: '' active: "",
} };
}, },
computed: { computed: {
baseName() { baseName() {
// let baseInFo = data[data.current]; // let baseInFo = data[data.current];
let baseName = this.$TOOL.data.get("BASE_INFO") !== null ? this.$TOOL.data.get("BASE_INFO").base.base_name : '智能管理平台'; let baseName =
this.$TOOL.data.get("BASE_INFO") !== null
? this.$TOOL.data.get("BASE_INFO").base.base_name
: "智能管理平台";
// let baseName = baseInFo!==null?baseInFo.base.base_name:''; // let baseName = baseInFo!==null?baseInFo.base.base_name:'';
return baseName; return baseName;
}, },
baseLogo() { baseLogo() {
// let baseInFo = data[data.current]; // let baseInFo = data[data.current];
let base_logo = this.$TOOL.data.get("BASE_INFO") !== null ? this.$TOOL.data.get("BASE_INFO").base.base_logo : 'img/logo.png'; let base_logo =
this.$TOOL.data.get("BASE_INFO") !== null
? this.$TOOL.data.get("BASE_INFO").base.base_logo
: "img/logo.png";
// let base_logo = baseInFo!==null?baseInFo.base.base_logo:'img/logo.png'; // let base_logo = baseInFo!==null?baseInFo.base.base_logo:'img/logo.png';
return base_logo return base_logo;
}, },
ismobile() { ismobile() {
return this.$store.state.global.ismobile return this.$store.state.global.ismobile;
}, },
layout() { layout() {
return this.$store.state.global.layout return this.$store.state.global.layout;
}, },
layoutTags() { layoutTags() {
return this.$store.state.global.layoutTags return this.$store.state.global.layoutTags;
}, },
menuIsCollapse() { menuIsCollapse() {
return this.$store.state.global.menuIsCollapse return this.$store.state.global.menuIsCollapse;
} },
}, },
created() { created() {
document.title = this.$store.state.global.baseName document.title = this.$store.state.global.baseName;
this.onLayoutResize(); this.onLayoutResize();
window.addEventListener('resize', this.onLayoutResize); window.addEventListener("resize", this.onLayoutResize);
var menu = this.$router.sc_getMenu(); var menu = this.$router.sc_getMenu();
// console.log("menu", menu);
this.menu = this.filterUrl(menu); this.menu = this.filterUrl(menu);
this.showThis() // console.log("this.menu", this.menu);
this.showThis();
}, },
watch: { watch: {
$route() { $route() {
this.showThis() this.showThis();
}, },
layout: { layout: {
handler(val) { handler(val) {
document.body.setAttribute('data-layout', val) document.body.setAttribute("data-layout", val);
}, },
immediate: true, immediate: true,
} },
}, },
methods: { methods: {
openSetting() { openSetting() {
this.settingDialog = true; this.settingDialog = true;
}, },
onLayoutResize() { onLayoutResize() {
this.$store.commit("SET_ismobile", document.body.clientWidth < 992) this.$store.commit("SET_ismobile", document.body.clientWidth < 992);
}, },
// //
showThis() { showThis() {
this.pmenu = this.$route.meta.breadcrumb ? this.$route.meta.breadcrumb[0] : {} function hasPerm(perms_need, perms_have) {
let has = false;
for (var m = 0; m < perms_need.length; m++) {
if (perms_have.indexOf(perms_need[m]) > -1) {
has = true;
}
}
return has;
}
this.pmenu = this.$route.meta.breadcrumb
? this.$route.meta.breadcrumb[0]
: {};
let lists = this.pmenu.children;
let perms = this.$TOOL.data.get("PERMISSIONS") || [];
for (var i = 0; i < lists.length; i++) {
if (lists[i].meta && lists[i].meta.perms) {
let has = hasPerm(lists[i].meta.perms, perms);
if (!has) {
lists.splice(i, 1);
}
}
}
// console.log("this.pmenu.children", this.pmenu.children);
this.nextMenu = this.filterUrl(this.pmenu.children); this.nextMenu = this.filterUrl(this.pmenu.children);
this.$nextTick(() => { this.$nextTick(() => {
this.active = this.$route.meta.active || this.$route.fullPath; this.active = this.$route.meta.active || this.$route.fullPath;
}) });
}, },
// //
showMenu(route) { showMenu(route) {
this.pmenu = route; this.pmenu = route;
this.nextMenu = this.filterUrl(route.children); this.nextMenu = this.filterUrl(route.children);
if ((!route.children || route.children.length == 0) && route.component) { if (
this.$router.push({ path: route.path }) (!route.children || route.children.length == 0) &&
route.component
) {
this.$router.push({ path: route.path });
} }
}, },
// //
filterUrl(map) { filterUrl(map) {
var newMap = [] var newMap = [];
map && map.forEach(item => { map &&
item.meta = item.meta ? item.meta : {}; map.forEach((item) => {
// item.meta = item.meta ? item.meta : {};
if (item.meta.hidden || item.meta.type == "button") { //
return false if (item.meta.hidden || item.meta.type == "button") {
} return false;
//http }
if (item.meta.type == 'iframe') { //http
item.path = `/i/${item.name}`; if (item.meta.type == "iframe") {
} item.path = `/i/${item.name}`;
// }
if (item.children && item.children.length > 0) { //
item.children = this.filterUrl(item.children) if (item.children && item.children.length > 0) {
} item.children = this.filterUrl(item.children);
newMap.push(item) }
}) newMap.push(item);
});
return newMap; return newMap;
}, },
//退 //退
exitMaximize() { exitMaximize() {
document.getElementById('app').classList.remove('main-maximize') document.getElementById("app").classList.remove("main-maximize");
} },
} },
} };
</script> </script>

View File

@ -398,6 +398,7 @@ import * as BABYLON from "babylonjs";
import * as BABYLON_GUI from "babylonjs-gui"; import * as BABYLON_GUI from "babylonjs-gui";
import * as BABYLON_GRID from "@/utils/gridMaterial"; import * as BABYLON_GRID from "@/utils/gridMaterial";
import * as BABYLON_MATERIAL from "@/utils/babylonMaterial"; import * as BABYLON_MATERIAL from "@/utils/babylonMaterial";
import config from "@/config";
BABYLON.DracoCompression.Configuration.decoder.wasmUrl = BABYLON.DracoCompression.Configuration.decoder.wasmUrl =
"./draco_wasm_wrapper_gltf.js"; "./draco_wasm_wrapper_gltf.js";
BABYLON.DracoCompression.Configuration.decoder.wasmBinaryUrl = BABYLON.DracoCompression.Configuration.decoder.wasmBinaryUrl =

View File

@ -1,198 +1,413 @@
<template> <template>
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel">
<div class="left-panel"> <el-button
<el-button type="primary" icon="el-icon-plus" @click="table_add" v-auth="'mpoint.create'">新增</el-button> type="primary"
<el-button type="warning" @click="king_sync" v-auth="'mpoint.create'">同步亚控测点</el-button> icon="el-icon-plus"
<el-button type="primary" @click="batchUpdate" v-auth="'mpoint.update'">批量修改</el-button> @click="table_add"
</div> v-auth="'mpoint.create'"
<div class="right-panel"> >新增</el-button
<el-select v-model="query.enabled" placeholder="是否启用" @change="handleQuery" clearable style="width:100px"> >
<el-option v-for="e in boolEnum.values" :key="e.key" :value="e.key" <el-button
:label="e.text"></el-option> type="warning"
</el-select> @click="king_sync"
<el-select v-model="query.type" placeholder="测点类型" @change="handleQuery" clearable style="width:100px"> v-auth="'mpoint.create'"
<el-option v-for="e in mpointTypeEnum.values" :key="e.key" :value="e.key" >同步亚控测点</el-button
:label="e.text"></el-option> >
</el-select> <el-button
<el-select v-model="query.val_type" placeholder="值类型" @change="handleQuery" clearable style="width:100px"> type="primary"
<el-option v-for="e in valTypeEnum.values" :key="e.key" :value="e.key" @click="batchUpdate"
:label="e.text"></el-option> v-auth="'mpoint.update'"
</el-select> >批量修改</el-button
<el-select v-model="query.need_display" placeholder="是否展示" @change="handleQuery" clearable style="width:100px"> >
<el-option v-for="e in boolEnum.values" :key="e.key" :value="e.key" </div>
:label="e.text"></el-option> <div class="right-panel">
</el-select> <el-select
<el-input v-model="query.enabled"
v-model="query.search" placeholder="是否启用"
placeholder="名称/代号" @change="handleQuery"
style="width:200px" clearable
clearable style="width: 100px"
></el-input> >
<el-button <el-option
type="primary" v-for="e in boolEnum.values"
icon="el-icon-search" :key="e.key"
@click="handleQuery" :value="e.key"
></el-button> :label="e.text"
</div> ></el-option>
</el-header> </el-select>
<el-main class="nopadding"> <el-select
<scTable ref="table" :apiObj="apiObj" row-key="id" remoteSort @selection-change="selectionChange"> v-model="query.type"
placeholder="测点类型"
@change="handleQuery"
clearable
style="width: 100px"
>
<el-option
v-for="e in mpointTypeEnum.values"
:key="e.key"
:value="e.key"
:label="e.text"
></el-option>
</el-select>
<el-select
v-model="query.val_type"
placeholder="值类型"
@change="handleQuery"
clearable
style="width: 100px"
>
<el-option
v-for="e in valTypeEnum.values"
:key="e.key"
:value="e.key"
:label="e.text"
></el-option>
</el-select>
<el-select
v-model="query.need_display"
placeholder="是否展示"
@change="handleQuery"
clearable
style="width: 100px"
>
<el-option
v-for="e in boolEnum.values"
:key="e.key"
:value="e.key"
:label="e.text"
></el-option>
</el-select>
<el-input
v-model="query.search"
placeholder="名称/代号"
style="width: 200px"
clearable
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
remoteSort
:query="query"
:params="params"
@selection-change="selectionChange"
>
<el-table-column type="selection" width="50" /> <el-table-column type="selection" width="50" />
<el-table-column label="名称" prop="name" width="200" show-overflow-tooltip sortable></el-table-column> <el-table-column
<el-table-column label="别名" prop="nickname" width="120" show-overflow-tooltip sortable></el-table-column> label="名称"
<el-table-column label="代号" prop="code" width="130" show-overflow-tooltip sortable></el-table-column> prop="name"
<el-table-column label="是否启用" width="80"> width="200"
<template #default="scope"> show-overflow-tooltip
<el-icon v-if="scope.row.enabled" color="green" sortable
><CircleCheckFilled ></el-table-column>
/></el-icon> <el-table-column
<el-icon v-else color="red"><CircleCloseFilled /></el-icon> label="别名"
</template> prop="nickname"
</el-table-column> width="120"
<el-table-column label="采集状态" show-overflow-tooltip> show-overflow-tooltip
<template #default="scope"> sortable
<el-tag :type="mpointGatherStateEnum[scope.row.gather_state]?.type">{{ ></el-table-column>
mpointGatherStateEnum[scope.row.gather_state]?.text }}</el-tag> <el-table-column
</template> label="代号"
</el-table-column> prop="code"
<el-table-column label="测点类型" width="80"> width="130"
<template #default="scope">{{mpointTypeEnum[scope.row.type]?.text}} show-overflow-tooltip
</template> sortable
</el-table-column> ></el-table-column>
<el-table-column label="是否启用" width="80">
<el-table-column label="采集间隔(s)" prop="interval" width="100"></el-table-column>
<el-table-column label="值类型" prop="val_type" width="80">
<template #default="scope">{{valTypeEnum[scope.row.val_type]?.text}}
</template>
</el-table-column>
<el-table-column label="单位" prop="unit" width="80"></el-table-column>
<el-table-column label="计量物料" prop="material_name" width="100"></el-table-column>
<el-table-column label="所属工段" prop="mgroup_name" width="100"></el-table-column>
<el-table-column label="是否展示" width="80">
<template #default="scope">
<el-icon v-if="scope.row.need_display" color="green"
><CircleCheckFilled
/></el-icon>
<el-icon v-else color="red"><CircleCloseFilled /></el-icon>
</template>
</el-table-column>
<el-table-column label="报告排序" prop="report_sortstr" width="100" sortable>
</el-table-column>
<el-table-column label="创建时间" prop="create_time" show-overflow-tooltip sortable width="160"></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="140">
<template #default="scope"> <template #default="scope">
<el-button link size="small" @click="table_edit(scope.row)" v-auth="'mpoint.update'" type="primary">编辑</el-button> <el-icon v-if="scope.row.enabled" color="green"
><CircleCheckFilled
/></el-icon>
<el-icon v-else color="red"
><CircleCloseFilled
/></el-icon>
</template>
</el-table-column>
<el-table-column label="采集状态" show-overflow-tooltip>
<template #default="scope">
<el-tag
:type="
mpointGatherStateEnum[scope.row.gather_state]
?.type
"
>{{
mpointGatherStateEnum[scope.row.gather_state]
?.text
}}</el-tag
>
</template>
</el-table-column>
<el-table-column label="测点类型" width="80">
<template #default="scope"
>{{ mpointTypeEnum[scope.row.type]?.text }}
</template>
</el-table-column>
<el-table-column
label="采集间隔(s)"
prop="interval"
width="100"
></el-table-column>
<el-table-column label="值类型" prop="val_type" width="80">
<template #default="scope"
>{{ valTypeEnum[scope.row.val_type]?.text }}
</template>
</el-table-column>
<el-table-column
label="单位"
prop="unit"
width="80"
></el-table-column>
<el-table-column
label="计量物料"
prop="material_name"
width="100"
></el-table-column>
<el-table-column
label="所属工段"
prop="mgroup_name"
width="100"
></el-table-column>
<el-table-column label="是否展示" width="80">
<template #default="scope">
<el-icon v-if="scope.row.need_display" color="green"
><CircleCheckFilled
/></el-icon>
<el-icon v-else color="red"
><CircleCloseFilled
/></el-icon>
</template>
</el-table-column>
<el-table-column
label="报告排序"
prop="report_sortstr"
width="100"
sortable
>
</el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
show-overflow-tooltip
sortable
width="160"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="140"
>
<template #default="scope">
<el-button
link
size="small"
@click="mplog_record(scope.row)"
type="primary"
>原始记录</el-button
>
<el-divider direction="vertical"></el-divider> <el-divider direction="vertical"></el-divider>
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)"> <el-button
link
size="small"
@click="table_edit(scope.row)"
v-auth="'mpoint.update'"
type="primary"
>编辑</el-button
>
<el-divider direction="vertical"></el-divider>
<el-popconfirm
title="确定删除吗?"
@confirm="table_del(scope.row, scope.$index)"
>
<template #reference> <template #reference>
<el-button link size="small" v-auth="'mpoint.delete'" type="danger">删除</el-button> <el-button
link
size="small"
v-auth="'mpoint.delete'"
type="danger"
>删除</el-button
>
</template> </template>
</el-popconfirm> </el-popconfirm>
</template> </template>
</el-table-column> </el-table-column>
</scTable> </scTable>
</el-main> </el-main>
</el-container> </el-container>
<save-dialog <save-dialog
v-if="dialog.save" v-if="dialog.save"
ref="saveDialog" ref="saveDialog"
@success="handleSaveSuccess" @success="handleSaveSuccess"
@closed="dialog.save = false" @closed="dialog.save = false"
></save-dialog> ></save-dialog>
<el-drawer <el-drawer
title="测点原始记录" title="测点原始记录"
v-model="logShow" v-model="logShow"
:size="1000" :size="1000"
destroy-on-close destroy-on-close
> >
1111 <scTable ref="table" row-key="id" :data="mplogRecord">
</el-drawer> <el-table-column type="selection" width="50" />
<el-table-column label="采集时间" prop="timex"></el-table-column>
<el-table-column label="采集数值">
<template #default="scope">
<span v-if="scope.row.val_int != null">{{
scope.row.val_int
}}</span>
<span v-else-if="scope.row.val_bool != null">{{
scope.row.val_bool
}}</span>
<span v-else-if="scope.row.val_str != null">{{
scope.row.val_str
}}</span>
<span v-else-if="scope.row.val_float != null">{{
scope.row.val_float
}}</span>
</template>
</el-table-column>
</scTable>
</el-drawer>
</template> </template>
<script> <script>
import saveDialog from "./mpoint_form.vue"; import saveDialog from "./mpoint_form.vue";
import { valTypeEnum, boolEnum, mpointTypeEnum, mpointGatherStateEnum } from "@/utils/enum.js"; import {
valTypeEnum,
boolEnum,
mpointTypeEnum,
mpointGatherStateEnum,
} from "@/utils/enum.js";
export default { export default {
name: "rparty", name: "rparty",
components: { components: {
saveDialog, saveDialog,
}, },
data() { data() {
return { return {
valTypeEnum, valTypeEnum,
boolEnum, boolEnum,
mpointTypeEnum, mpointTypeEnum,
mpointGatherStateEnum, mpointGatherStateEnum,
logShow:false, logShow: false,
dialog: { dialog: {
save: false, save: false,
permission: false, permission: false,
},
apiObj: this.$API.enm.mpoint.list,
query: {},
selection: []
};
},
methods: {
//
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
mplog(row){
this.logShow = true;
},
//
table_show(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//
table_del(row) {
var id = row.id;
this.$API.enm.mpoint.delete.req(id).then(res=>{
if(res.err_msg){
this.$message.error(res.err_msg)
}else{
this.$refs.table.refresh();
this.$message.success("删除成功")
}
})
},
king_sync() {
const loading = this.$loading({text: '正在同步亚控测点...'});
this.$API.enm.mpoint.kingSync.req().then(res=>{
this.$refs.table.refresh();
}).finally(()=>{
loading.close()
})
},
//
handleSaveSuccess(data, mode) {
this.$refs.table.refresh();
},
handleQuery() {
this.$refs.table.queryData(this.query)
}, },
resetQuery() { apiObj: this.$API.enm.mpoint.list,
this.query = {}; params: {},
}, query: {},
selectionChange(rows){ selection: [],
console.log('m', rows) mplogRecord: [],
} };
}, },
methods: {
//
table_add() {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("add");
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
mplog_record(row) {
let that = this;
that.mplogRecord = [];
var nowDate = new Date();
let year = nowDate.getFullYear();
let month = nowDate.getMonth() + 1;
let day = nowDate.getDate();
let hour = nowDate.getHours();
month = month > 9 ? month : "0" + month;
day = day > 9 ? day : "0" + day;
if (hour > 0) {
hour = hour - 1;
hour = hour > 9 ? hour : "0" + hour;
} else {
hour = 23;
let timers = nowDate.getTime() - 1000 * 60 * 60; //
let useDate = new Date(timers);
year = useDate.getFullYear();
month = useDate.getMonth() + 1;
month = month > 9 ? month : "0" + month;
day = nowDate.getDate();
day = day > 9 ? day : "0" + day;
}
let obj = {};
obj.page = 0;
obj.mpoint = row.id;
obj.timex__gte =
year + "-" + month + "-" + day + " " + hour + ":00:00";
obj.timex__lte =
year + "-" + month + "-" + day + " " + hour + ":59:00";
that.$API.enm.mplogx.req(obj).then((res) => {
console.log("res", res);
that.mplogRecord = res;
that.logShow = true;
});
},
//
table_show(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//
table_del(row) {
var id = row.id;
this.$API.enm.mpoint.delete.req(id).then((res) => {
if (res.err_msg) {
this.$message.error(res.err_msg);
} else {
this.$refs.table.refresh();
this.$message.success("删除成功");
}
});
},
king_sync() {
const loading = this.$loading({ text: "正在同步亚控测点..." });
this.$API.enm.mpoint.kingSync
.req()
.then((res) => {
this.$refs.table.refresh();
})
.finally(() => {
loading.close();
});
},
//
handleSaveSuccess(data, mode) {
this.$refs.table.refresh();
},
handleQuery() {
// this.$refs.table.refresh();
this.$refs.table.queryData(this.query);
},
resetQuery() {
this.query = {};
},
selectionChange(rows) {
console.log("m", rows);
},
},
}; };
</script> </script>

View File

@ -1,104 +1,61 @@
<template> <template>
<el-container class="page-user"> <el-container>
<el-aside style="width: 240px">
<el-container>
<el-main class="nopadding">
<el-menu class="menu" :default-active="page">
<el-menu-item-group
v-for="group in menu"
:key="group.groupName"
:title="group.groupName"
>
<el-menu-item
v-for="item in group.list"
:key="item.component"
:index="item.component"
@click="openPage"
>
<el-icon v-if="item.icon"
><component :is="item.icon"
/></el-icon>
<template #title>
<span>{{ item.title }}</span>
</template>
</el-menu-item>
</el-menu-item-group>
</el-menu>
</el-main>
</el-container>
</el-aside>
<el-main> <el-main>
<Suspense> <el-card header="计算系数" shadow="hover">
<template #default> <el-form>
<component :is="page" /> <el-form-item label="料号系数">
</template> <el-input-number
<template #fallback> v-model="form.enm_lhxs"
<el-skeleton :rows="3" /> controls-position="right"
</template> placeholder="料号系数"
</Suspense> ></el-input-number>
</el-form-item>
<el-form-item style="float: right">
<el-button
type="primary"
:loading="saveLoading"
@click="submitForm"
>保存</el-button
>
</el-form-item>
</el-form>
</el-card>
</el-main> </el-main>
</el-container> </el-container>
</template> </template>
<script> <script>
import { defineAsyncComponent } from "vue";
export default { export default {
name: "userCenter",
components: {
calculate: defineAsyncComponent(() =>
import("./settings/calculate.vue")
),
},
data() { data() {
return { return {
form: {}, saveLoading: false,
menu: [ form: {
{ enm_lhxs: "",
groupName: "配置", },
list: [
{
icon: "el-icon-platform",
title: "计算系数",
component: "calculate",
},
],
},
],
userData: {},
page: "calculate",
}; };
}, },
// from
beforeRouteEnter(to, from, next) {
next((vm) => {
if (from.is) {
//
delete from.is;
//
vm.$alert("路由跳转过来后含有特殊标识,做特殊处理", "提示", {
type: "success",
center: true,
})
.then(() => {})
.catch(() => {});
}
});
},
mounted() { mounted() {
this.getSysConfig(); this.getSysConfig();
}, },
methods: { methods: {
openPage(item) {
this.page = item.index;
},
getSysConfig() { getSysConfig() {
this.$API.system.config.getInfo.req().then((res) => { this.$API.system.config.getInfo.req().then((res) => {
this.form = res.base; this.form = res.enm;
}); });
}, },
submitForm() {
this.saveLoading = true;
let obj = {};
obj.enm = this.form;
this.$API.system.config.updateInfo
.req(obj)
.then((res) => {
this.saveLoading = false;
})
.catch((res) => {
this.saveLoading = false;
});
},
}, },
}; };
</script> </script>
<style scoped></style>

View File

@ -1,52 +0,0 @@
<template>
<el-container>
<el-main>
<el-card header="计算系数" shadow="hover">
<el-form>
<el-form-item label="熟料料耗系数">
<el-input-number
v-model="form.enm_lhxs"
controls-position="right"
placeholder="熟料料耗系数"
></el-input-number>
</el-form-item>
<el-form-item style="float: right">
<el-button
type="primary"
:loading="saveLoading"
@click="submitForm"
>保存</el-button
>
</el-form-item>
</el-form>
</el-card>
</el-main>
</el-container>
</template>
<script>
export default {
data() {
return {
saveLoading: false,
form: {
enm_lhxs: "",
},
};
},
mounted() {},
methods: {
submitForm() {
this.saveLoading = true;
this.$API.system.config.update
.req(this.form)
.then((res) => {
this.saveLoading = false;
})
.catch((res) => {
this.saveLoading = false;
});
},
},
};
</script>

View File

@ -136,43 +136,13 @@ export default {
return { return {
year: "", year: "",
month: "", month: "",
days: "",
myChart: null, myChart: null,
search_date: "", search_date: "",
headerLength: 33, headerLength: 33,
itemVisible: false, itemVisible: false,
xAxisData: [], xAxisData: [],
tableDatas: [ mpointList: [],
["石灰石破碎", "破碎机", "kw.h"], //0 tableDatas: [],
["石灰石破碎", "堆取料机", "kw.h"],
["石灰石破碎", "低压变压器柜", "kw.h"],
["石灰石破碎", "石灰石破碎合计", "kw.h"],
["原料磨", "循环风机", "kw.h"],
["原料磨", "辊压机", "kw.h"],
["原料磨", "调配变压器", "kw.h"],
["原料磨", "低压变压器柜器", "kw.h"],
["原料磨", "原料磨系统合计", "kw.h"],
["回转窑", "尾排风机", "kw.h"],
["回转窑", "高温风机", "kw.h"],
["回转窑", "头排风机", "kw.h"],
["回转窑", "低压变压器柜", "kw.h"],
["回转窑", "回转窑烧成系统合计", "kw.h"],
["煤磨", "煤磨主电机", "kw.h"],
["煤磨", "煤磨排风机", "kw.h"],
["煤磨", "低压变压器柜", "kw.h"],
["煤磨", "煤磨系统合计", "kw.h"],
["余热发电", "余热发电量", "kw.h"],
["余热发电", "余热发电自用电量", "kw.h"],
["余热发电", "余热供电量", "kw.h"],
["空压机", "1#空压机", "kw.h"],
["空压机", "2#空压机", "kw.h"],
["空压机", "3#空压机", "kw.h"],
["空压机", "4#空压机", "kw.h"],
["空压机", "空压机合计", "kw.h"],
["富氧燃烧系统", "富氧燃烧耗电设备", "kw.h"],
["生产总耗电量", "生产部分总耗电", "kw.h"],
["全厂进线", "全厂耗电量", "kw.h"],
],
timeStamp: null, timeStamp: null,
tableWidth: "3300", tableWidth: "3300",
itemChartTitle: "", itemChartTitle: "",
@ -275,26 +245,20 @@ export default {
mounted() { mounted() {
let that = this; let that = this;
var nowDate = new Date(); var nowDate = new Date();
that.year = nowDate.getFullYear(); let year = nowDate.getFullYear();
that.month = nowDate.getMonth() + 1; let month = nowDate.getMonth() + 1;
that.days = new Date(that.year, that.month, 0).getDate(); month = month > 9 ? month : "0" + month;
that.search_date = year + "-" + month;
that.year = year;
that.month = month;
that.days = new Date(year, month, 0).getDate();
that.timeStamp = nowDate.getTime(); that.timeStamp = nowDate.getTime();
let month0 = that.month > 9 ? that.month : "0" + that.month;
that.search_date = that.year + "-" + month0;
that.headerLength = that.days + 4; that.headerLength = that.days + 4;
that.tableWidth = that.headerLength * 100 + ""; that.tableWidth = that.headerLength * 100 + "";
let tableDatas = that.tableDatas;
for (let i = 0; i < tableDatas.length; i++) {
for (let j = 0; j < that.days; j++) {
let k = 3 + j;
that.tableDatas[i][k] = 0;
this.$forceUpdate();
}
}
for (let n = 1; n <= that.days; n++) { for (let n = 1; n <= that.days; n++) {
that.xAxisData.push(n + "日"); that.xAxisData.push(n + "日");
} }
this.getData(); this.getMPoints();
}, },
methods: { methods: {
dateChange(e) { dateChange(e) {
@ -302,215 +266,263 @@ export default {
let arr = e.split("-"); let arr = e.split("-");
that.year = Number(arr[0]); that.year = Number(arr[0]);
that.month = Number(arr[1]); that.month = Number(arr[1]);
for (let i = 0; i < that.tableDatas.length; i++) {
for (let j = 0; j < that.days + 1; j++) {
let k = 3 + j;
that.tableDatas[i][k] = 0;
this.$forceUpdate();
}
}
let nowDate = new Date(); let nowDate = new Date();
that.timeStamp = nowDate.getTime(); that.timeStamp = nowDate.getTime();
this.getData(); this.dataLoop();
}, },
getData() { getMPoints() {
let that = this; let that = this;
function dataPush(name) { that.$API.enm.mpoint.list
let index = 0; .req({
if (name == "破碎机") { page: 0,
index = 0; enabled: true,
} else if (name == "堆取料机") { need_display: true,
index = 1; ordering: "report_sortstr",
} else if (name == "低压变压器柜") { mpoint__material__code: "elec",
index = 2;
} else if (name == "循环风机") {
index = 4;
} else if (name == "调配变压器") {
index = 6;
} else if (name == "低压变压器柜器") {
index = 7;
} else if (name == "尾排风机") {
index = 9;
} else if (name == "高温风机") {
index = 10;
} else if (name == "头排风机") {
index = 11;
} else if (name == "煤磨主电机") {
index = 14;
} else if (name == "煤磨排风机") {
index = 15;
} else if (name == "低压变压器柜") {
index = 16;
} else if (name == "余热发电量") {
index = 18;
} else if (name == "余热发电自用电量") {
index = 19;
} else if (name == "1#空压机") {
index = 21;
} else if (name == "2#空压机") {
index = 22;
} else if (name == "3#空压机") {
index = 23;
} else if (name == "4#空压机") {
index = 24;
} else if (name == "富氧燃烧耗电设备") {
index = 26;
}
return index;
}
function sumNum(a, b, c, d) {
let sum = 0;
if (typeof a !== "undefined" && a !== "NaN") {
sum = sum + Number(a);
}
if (typeof b !== "undefined" && a !== "NaN") {
sum = sum + Number(b);
}
if (typeof c !== "undefined" && a !== "NaN") {
sum = sum + Number(c);
}
if (typeof d !== "undefined" && a !== "NaN") {
sum = sum + Number(d);
}
return sum;
}
let obj = {};
obj.type = "day_s";
obj.year_s = that.year;
obj.month_s = that.month;
obj.page = 0;
obj.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(obj)
.then((res) => {
let wrapArr = [],
innerArr = [];
res.forEach((item) => {
let day = item.day_s;
if (wrapArr[day]) {
wrapArr[day].push(item);
} else {
wrapArr[day] = [];
wrapArr[day].push(item);
}
});
wrapArr.forEach((inner, inde) => {
inner.forEach((item) => {
let i = dataPush(item.mpoint_name);
let k = 0;
if (
i == 0 ||
i == 4 ||
i == 9 ||
i == 14 ||
i == 18 ||
i == 21 ||
i == 26 ||
i == 27 ||
i == 28
) {
k = 3 + inde;
} else {
k = 2 + inde;
}
that.tableDatas[i][k] = item.val;
});
});
for (let k = 0; k < that.headerLength; k++) {
let m = k + 3;
let n = k + 1;
//
that.tableDatas[3][m] = sumNum(
that.tableDatas[0][m],
that.tableDatas[1][m],
that.tableDatas[2][m]
);
//
// that.tableDatas[5][m] = sumNum();
//
that.tableDatas[8][m] =
sumNum(
that.tableDatas[4][m],
// that.tableDatas[5][m],
that.tableDatas[6][m],
that.tableDatas[7][m]
) -
sumNum(
that.tableDatas[1][m],
that.tableDatas[2][m]
);
//
// that.tableDatas[12][m] = sumNum(
// that.tableDatas[9][m],
// that.tableDatas[10][m],
// that.tableDatas[11][m]
// );
//
that.tableDatas[13][m] =
typeof that.tableDatas[12][m] !== "undefined"
? sumNum(
that.tableDatas[9][m],
that.tableDatas[10][m],
that.tableDatas[11][m],
that.tableDatas[12][m]
)
: sumNum(
that.tableDatas[9][m],
that.tableDatas[10][m],
that.tableDatas[11][m]
);
//
let sum17 = sumNum(
that.tableDatas[14][m],
that.tableDatas[15][m],
that.tableDatas[16][m]
);
that.tableDatas[17][m] =
typeof that.tableDatas[21][m] !== "undefined"
? sum17 - that.tableDatas[21][m]
: sum17;
//
that.tableDatas[20][m] =
typeof that.tableDatas[19][m] !== "undefined"
? that.tableDatas[18][m] -
that.tableDatas[19][m]
: that.tableDatas[18][m];
//
that.tableDatas[25][m] = sumNum(
that.tableDatas[21][m],
that.tableDatas[22][m],
that.tableDatas[23][m],
that.tableDatas[24][m]
);
//
that.tableDatas[27][m] = sumNum(
that.tableDatas[3][m],
that.tableDatas[8][m],
that.tableDatas[13][m],
that.tableDatas[17][m],
that.tableDatas[18][m],
that.tableDatas[25][m],
that.tableDatas[26][m]
);
//
// that.tableDatas[28][m] = sumNum(
// that.tableDatas[27][m],
// that.tableDatas[26][m]
// );
}
that.tableDatas.forEach((inner, inde) => {
let sumlast = 0;
inner.forEach((num, ind) => {
if (ind > 2 && ind < that.headerLength) {
sumlast = sumlast + Number(num);
}
});
inner[that.headerLength] = sumlast;
});
}) })
.then(() => {}); .then((res) => {
let data = res.slice(3);
that.mpointList = data;
that.dataLoop();
});
}, },
dataLoop() {
let that = this;
that.tableDatas = [];
that.mpointList.forEach((item, index) => {
let arr = [];
arr[0] =
item.mgroup_name != null
? item.mgroup_name
: item.nickname != null
? item.nickname
: item.name;
arr[1] = item.nickname != null ? item.nickname : item.name;
arr[2] = item.unit;
for (let i = 0; i < that.days; i++) {
arr[i + 3] = 0;
}
that.tableDatas.push(arr);
that.getData(item.id, index);
});
},
getData(id, index) {
let that = this;
let obj = {};
obj.type = "day";
obj.year = that.year;
obj.month = that.month;
obj.mpoint__material__code = "elec";
obj.mpoint__need_display = 1;
obj.mpoint = id;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
console.log(res);
res.forEach((item) => {
let ind = item.day + 2;
that.tableDatas[index][ind] = item.val;
});
that.$forceUpdate();
});
},
// getData() {
// let that = this;
// function dataPush(name) {
// let index = 0;
// if (name == "") {
// index = 0;
// } else if (name == "") {
// index = 1;
// } else if (name == "") {
// index = 2;
// } else if (name == "") {
// index = 4;
// } else if (name == "") {
// index = 6;
// } else if (name == "") {
// index = 7;
// } else if (name == "") {
// index = 9;
// } else if (name == "") {
// index = 10;
// } else if (name == "") {
// index = 11;
// } else if (name == "") {
// index = 14;
// } else if (name == "") {
// index = 15;
// } else if (name == "") {
// index = 16;
// } else if (name == "") {
// index = 18;
// } else if (name == "") {
// index = 19;
// } else if (name == "1#") {
// index = 21;
// } else if (name == "2#") {
// index = 22;
// } else if (name == "3#") {
// index = 23;
// } else if (name == "4#") {
// index = 24;
// } else if (name == "") {
// index = 26;
// }
// return index;
// }
// function sumNum(a, b, c, d) {
// let sum = 0;
// if (typeof a !== "undefined" && a !== "NaN") {
// sum = sum + Number(a);
// }
// if (typeof b !== "undefined" && a !== "NaN") {
// sum = sum + Number(b);
// }
// if (typeof c !== "undefined" && a !== "NaN") {
// sum = sum + Number(c);
// }
// if (typeof d !== "undefined" && a !== "NaN") {
// sum = sum + Number(d);
// }
// return sum;
// }
// let obj = {};
// obj.type = "day_s";
// obj.year_s = that.year;
// obj.month_s = that.month;
// obj.page = 0;
// obj.mpoint__ep_monitored__power_kw__gte = 100;
// this.$API.enm.mpoint.stat
// .req(obj)
// .then((res) => {
// let wrapArr = [],
// innerArr = [];
// res.forEach((item) => {
// let day = item.day_s;
// if (wrapArr[day]) {
// wrapArr[day].push(item);
// } else {
// wrapArr[day] = [];
// wrapArr[day].push(item);
// }
// });
// wrapArr.forEach((inner, inde) => {
// inner.forEach((item) => {
// let i = dataPush(item.mpoint_name);
// let k = 0;
// if (
// i == 0 ||
// i == 4 ||
// i == 9 ||
// i == 14 ||
// i == 18 ||
// i == 21 ||
// i == 26 ||
// i == 27 ||
// i == 28
// ) {
// k = 3 + inde;
// } else {
// k = 2 + inde;
// }
// that.tableDatas[i][k] = item.val;
// });
// });
// for (let k = 0; k < that.headerLength; k++) {
// let m = k + 3;
// let n = k + 1;
// //
// that.tableDatas[3][m] = sumNum(
// that.tableDatas[0][m],
// that.tableDatas[1][m],
// that.tableDatas[2][m]
// );
// //
// // that.tableDatas[5][m] = sumNum();
// //
// that.tableDatas[8][m] =
// sumNum(
// that.tableDatas[4][m],
// // that.tableDatas[5][m],
// that.tableDatas[6][m],
// that.tableDatas[7][m]
// ) -
// sumNum(
// that.tableDatas[1][m],
// that.tableDatas[2][m]
// );
// //
// // that.tableDatas[12][m] = sumNum(
// // that.tableDatas[9][m],
// // that.tableDatas[10][m],
// // that.tableDatas[11][m]
// // );
// //
// that.tableDatas[13][m] =
// typeof that.tableDatas[12][m] !== "undefined"
// ? sumNum(
// that.tableDatas[9][m],
// that.tableDatas[10][m],
// that.tableDatas[11][m],
// that.tableDatas[12][m]
// )
// : sumNum(
// that.tableDatas[9][m],
// that.tableDatas[10][m],
// that.tableDatas[11][m]
// );
// //
// let sum17 = sumNum(
// that.tableDatas[14][m],
// that.tableDatas[15][m],
// that.tableDatas[16][m]
// );
// that.tableDatas[17][m] =
// typeof that.tableDatas[21][m] !== "undefined"
// ? sum17 - that.tableDatas[21][m]
// : sum17;
// //
// that.tableDatas[20][m] =
// typeof that.tableDatas[19][m] !== "undefined"
// ? that.tableDatas[18][m] -
// that.tableDatas[19][m]
// : that.tableDatas[18][m];
// //
// that.tableDatas[25][m] = sumNum(
// that.tableDatas[21][m],
// that.tableDatas[22][m],
// that.tableDatas[23][m],
// that.tableDatas[24][m]
// );
// //
// that.tableDatas[27][m] = sumNum(
// that.tableDatas[3][m],
// that.tableDatas[8][m],
// that.tableDatas[13][m],
// that.tableDatas[17][m],
// that.tableDatas[18][m],
// that.tableDatas[25][m],
// that.tableDatas[26][m]
// );
// //
// // that.tableDatas[28][m] = sumNum(
// // that.tableDatas[27][m],
// // that.tableDatas[26][m]
// // );
// }
// that.tableDatas.forEach((inner, inde) => {
// let sumlast = 0;
// inner.forEach((num, ind) => {
// if (ind > 2 && ind < that.headerLength) {
// sumlast = sumlast + Number(num);
// }
// });
// inner[that.headerLength] = sumlast;
// });
// })
// .then(() => {});
// },
itemClick(item, index) { itemClick(item, index) {
let that = this; let that = this;
let lineData = that.tableDatas[index].slice(3, that.headerLength); let lineData = that.tableDatas[index].slice(3, that.headerLength);

View File

@ -46,7 +46,7 @@
<th>设备</th> <th>设备</th>
<th>单位</th> <th>单位</th>
<th v-for="item in 24" :key="item"> <th v-for="item in 24" :key="item">
{{ item }} {{ item - 1 }}
</th> </th>
<th>本日合计</th> <th>本日合计</th>
</tr> </tr>
@ -135,11 +135,11 @@ export default {
}, },
data() { data() {
return { return {
day: "",
year: "", year: "",
month: "", month: "",
day: "",
search_date: "", search_date: "",
tableDatas: [ tableDatas1: [
["石灰石破碎", "破碎机", "kw.h"], //0 ["石灰石破碎", "破碎机", "kw.h"], //0
["石灰石破碎", "堆取料机", "kw.h"], ["石灰石破碎", "堆取料机", "kw.h"],
["石灰石破碎", "低压变压器柜", "kw.h"], ["石灰石破碎", "低压变压器柜", "kw.h"],
@ -170,10 +170,30 @@ export default {
["生产总耗电量", "生产部分总耗电", "kw.h"], ["生产总耗电量", "生产部分总耗电", "kw.h"],
["全厂进线", "全厂耗电量", "kw.h"], ["全厂进线", "全厂耗电量", "kw.h"],
], ],
mpointList: [],
tableDatas: [],
hours: [ hours: [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 19, 20, 21, 22, 23, 24,
], ],
mgroupList: [
"石灰石破碎",
"原料磨",
"回转窑",
"煤磨",
"余热发电",
"空压机",
"富氧燃烧系统",
"生产总耗电量",
"全厂进线",
],
mgroup: "石灰石破碎",
itemChartTitle: "",
itemChartData: [],
itemChartXData: [],
itemChartYData: [],
itemChartLegend: [],
itemChartSeries: [],
timeStamp: null, timeStamp: null,
itemVisible: false, itemVisible: false,
exportLoading: false, exportLoading: false,
@ -269,12 +289,16 @@ export default {
mounted() { mounted() {
let that = this; let that = this;
var nowDate = new Date(); var nowDate = new Date();
that.year = nowDate.getFullYear(); let year = nowDate.getFullYear();
that.month = nowDate.getMonth() + 1; let month = nowDate.getMonth() + 1;
that.day = nowDate.getDate(); let day = nowDate.getDate();
that.timeStamp = nowDate.getTime(); that.timeStamp = nowDate.getTime();
let month0 = that.month > 9 ? that.month : "0" + that.month; month = month > 9 ? month : "0" + month;
that.search_date = that.year + "-" + month0 + "-" + that.day; day = day > 9 ? day : "0" + day;
that.day = day;
that.year = year;
that.month = month;
that.search_date = year + "-" + month + "-" + day;
for (let i = 0; i < that.tableDatas.length; i++) { for (let i = 0; i < that.tableDatas.length; i++) {
for (let j = 0; j < 24; j++) { for (let j = 0; j < 24; j++) {
let k = 3 + j; let k = 3 + j;
@ -285,224 +309,292 @@ export default {
for (let n = 0; n < 24; n++) { for (let n = 0; n < 24; n++) {
that.xAxisData.push(n + "时"); that.xAxisData.push(n + "时");
} }
this.getData(); this.getMPoints();
}, },
methods: { methods: {
dateChange(e) { dateChange(e) {
let that = this; let that = this;
let arr = e.split("-"); that.tableDatas = [];
let arr = that.search_date.split("-");
that.year = Number(arr[0]); that.year = Number(arr[0]);
that.month = Number(arr[1]); that.month = Number(arr[1]);
that.day = Number(arr[2]); that.day = Number(arr[2]);
for (let i = 0; i < that.tableDatas.length; i++) { // for (let i = 0; i < that.tableDatas.length; i++) {
for (let j = 0; j < 25; j++) { // for (let j = 0; j < 25; j++) {
let k = 3 + j; // let k = 3 + j;
that.tableDatas[i][k] = 0; // that.tableDatas[i][k] = 0;
this.$forceUpdate(); // this.$forceUpdate();
} // }
} // }
let nowDate = new Date(); let nowDate = new Date();
that.timeStamp = nowDate.getTime(); that.timeStamp = nowDate.getTime();
this.getData(); that.dataLoop();
}, },
getData() { getMPoints() {
let that = this; let that = this;
function dataPush(name) { that.$API.enm.mpoint.list
let index = 0; .req({
if (name == "破碎机") { page: 0,
index = 0; enabled: true,
} else if (name == "堆取料机") { need_display: true,
index = 1; ordering: "report_sortstr",
} else if (name == "低压变压器柜") { mpoint__material__code: "elec",
index = 2;
} else if (name == "循环风机") {
index = 4;
} else if (name == "调配变压器") {
index = 6;
} else if (name == "低压变压器柜器") {
index = 7;
} else if (name == "尾排风机") {
index = 9;
} else if (name == "高温风机") {
index = 10;
} else if (name == "头排风机") {
index = 11;
} else if (name == "煤磨主电机") {
index = 14;
} else if (name == "煤磨排风机") {
index = 15;
} else if (name == "低压变压器柜") {
index = 16;
} else if (name == "余热发电量") {
index = 18;
} else if (name == "余热发电自用电量") {
index = 19;
} else if (name == "1#空压机") {
index = 21;
} else if (name == "2#空压机") {
index = 22;
} else if (name == "3#空压机") {
index = 23;
} else if (name == "4#空压机") {
index = 24;
} else if (name == "富氧燃烧耗电设备") {
index = 26;
}
return index;
}
function sumNum(a, b, c, d) {
let sum = 0;
if (typeof a !== "undefined" && a !== "NaN") {
sum = sum + Number(a);
}
if (typeof b !== "undefined" && a !== "NaN") {
sum = sum + Number(b);
}
if (typeof c !== "undefined" && a !== "NaN") {
sum = sum + Number(c);
}
if (typeof d !== "undefined" && a !== "NaN") {
sum = sum + Number(d);
}
return sum;
}
let obj = {};
obj.type = "hour_s";
obj.year_s = that.year;
obj.month_s = that.month;
obj.day_s = that.day;
obj.page = 0;
obj.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(obj)
.then((res) => {
let wrapArr = [],
innerArr = [];
res.forEach((item) => {
let hour = item.hour;
if (wrapArr[hour]) {
wrapArr[hour].push(item);
} else {
wrapArr[hour] = [];
wrapArr[hour].push(item);
}
});
wrapArr.forEach((inner, inde) => {
inner.forEach((item) => {
let i = dataPush(item.mpoint_name);
let k = 0;
if (
i == 0 ||
i == 4 ||
i == 9 ||
i == 14 ||
i == 18 ||
i == 21 ||
i == 26 ||
i == 27 ||
i == 28
) {
k = 3 + inde;
} else {
k = 2 + inde;
}
that.tableDatas[i][k] = item.val;
});
});
for (let k = 0; k < 24; k++) {
let m = k + 3;
let n = k + 1;
//
that.tableDatas[3][m] = sumNum(
that.tableDatas[0][m],
that.tableDatas[1][m],
that.tableDatas[2][m]
);
//
// that.tableDatas[5][m] = sumNum();
//
that.tableDatas[8][m] =
sumNum(
that.tableDatas[4][m],
// that.tableDatas[5][m],
that.tableDatas[6][m],
that.tableDatas[7][m]
) -
sumNum(
that.tableDatas[1][m],
that.tableDatas[2][m]
);
//
// that.tableDatas[12][m] = sumNum(
// that.tableDatas[9][m],
// that.tableDatas[10][m],
// that.tableDatas[11][m]
// );
//
that.tableDatas[13][m] =
typeof that.tableDatas[12][m] !== "undefined"
? sumNum(
that.tableDatas[9][m],
that.tableDatas[10][m],
that.tableDatas[11][m],
that.tableDatas[12][m]
)
: sumNum(
that.tableDatas[9][m],
that.tableDatas[10][m],
that.tableDatas[11][m]
);
//
let sum17 = sumNum(
that.tableDatas[14][m],
that.tableDatas[15][m],
that.tableDatas[16][m]
);
that.tableDatas[17][m] =
typeof that.tableDatas[21][m] !== "undefined"
? sum17 - that.tableDatas[21][m]
: sum17;
//
that.tableDatas[20][m] =
typeof that.tableDatas[19][m] !== "undefined"
? that.tableDatas[18][m] -
that.tableDatas[19][m]
: that.tableDatas[18][m];
//
that.tableDatas[25][m] = sumNum(
that.tableDatas[21][m],
that.tableDatas[22][m],
that.tableDatas[23][m],
that.tableDatas[24][m]
);
//
that.tableDatas[27][m] = sumNum(
that.tableDatas[3][m],
that.tableDatas[8][m],
that.tableDatas[13][m],
that.tableDatas[17][m],
that.tableDatas[18][m],
that.tableDatas[25][m],
that.tableDatas[26][m]
);
//
// that.tableDatas[28][m] = sumNum(
// that.tableDatas[27][m],
// that.tableDatas[26][m]
// );
}
that.tableDatas.forEach((inner, inde) => {
let sum27 = 0;
inner.forEach((num, ind) => {
if (ind > 2 && ind < 27) {
sum27 = sum27 + Number(num);
}
});
inner[27] = sum27;
});
}) })
.then(() => {}); .then((res) => {
let data = res.slice(3);
that.mpointList = data;
that.dataLoop();
});
},
dataLoop() {
let that = this;
that.tableDatas = [];
that.mpointList.forEach((item, index) => {
let arr = [];
arr[0] =
item.mgroup_name != null
? item.mgroup_name
: item.nickname != null
? item.nickname
: item.name;
arr[1] = item.nickname != null ? item.nickname : item.name;
arr[2] = item.unit;
for (let i = 0; i < 24; i++) {
arr[i + 3] = 0;
}
that.tableDatas.push(arr);
that.getData(item.id, index);
});
},
getData(id, index) {
let that = this;
let obj = {};
obj.type = "hour";
obj.year = that.year;
obj.month = that.month;
obj.day = that.day;
obj.mpoint__material__code = "elec";
obj.mpoint__need_display = 1;
obj.mpoint = id;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
console.log(res);
res.forEach((item) => {
let ind = item.hour + 3;
that.tableDatas[index][ind] = item.val;
});
that.$forceUpdate();
});
},
// getData(id) {
// let that = this;
// function dataPush(name) {
// let index = 0;
// if (name == "") {
// index = 0;
// } else if (name == "") {
// index = 1;
// } else if (name == "") {
// index = 2;
// } else if (name == "") {
// index = 4;
// } else if (name == "") {
// index = 6;
// } else if (name == "") {
// index = 7;
// } else if (name == "") {
// index = 9;
// } else if (name == "") {
// index = 10;
// } else if (name == "") {
// index = 11;
// } else if (name == "") {
// index = 14;
// } else if (name == "") {
// index = 15;
// } else if (name == "") {
// index = 16;
// } else if (name == "") {
// index = 18;
// } else if (name == "") {
// index = 19;
// } else if (name == "1#") {
// index = 21;
// } else if (name == "2#") {
// index = 22;
// } else if (name == "3#") {
// index = 23;
// } else if (name == "4#") {
// index = 24;
// } else if (name == "") {
// index = 26;
// }
// return index;
// }
// function sumNum(a, b, c, d) {
// let sum = 0;
// if (typeof a !== "undefined" && a !== "NaN") {
// sum = sum + Number(a);
// }
// if (typeof b !== "undefined" && a !== "NaN") {
// sum = sum + Number(b);
// }
// if (typeof c !== "undefined" && a !== "NaN") {
// sum = sum + Number(c);
// }
// if (typeof d !== "undefined" && a !== "NaN") {
// sum = sum + Number(d);
// }
// return sum;
// }
// let obj = {};
// obj.type = "hour_s";
// obj.year_s = that.year;
// obj.month_s = that.month;
// obj.day_s = that.day;
// obj.page = 0;
// obj.mpoint__ep_monitored__power_kw__gte = 100;
// this.$API.enm.mpoint.stat
// .req(obj)
// .then((res) => {
// let wrapArr = [],
// innerArr = [];
// res.forEach((item) => {
// let hour = item.hour;
// if (wrapArr[hour]) {
// wrapArr[hour].push(item);
// } else {
// wrapArr[hour] = [];
// wrapArr[hour].push(item);
// }
// });
// wrapArr.forEach((inner, inde) => {
// inner.forEach((item) => {
// let i = dataPush(item.mpoint_name);
// let k = 0;
// if (
// i == 0 ||
// i == 4 ||
// i == 9 ||
// i == 14 ||
// i == 18 ||
// i == 21 ||
// i == 26 ||
// i == 27 ||
// i == 28
// ) {
// k = 3 + inde;
// } else {
// k = 2 + inde;
// }
// that.tableDatas[i][k] = item.val;
// });
// });
// for (let k = 0; k < 24; k++) {
// let m = k + 3;
// let n = k + 1;
// //
// that.tableDatas[3][m] = sumNum(
// that.tableDatas[0][m],
// that.tableDatas[1][m],
// that.tableDatas[2][m]
// );
// //
// // that.tableDatas[5][m] = sumNum();
// //
// that.tableDatas[8][m] =
// sumNum(
// that.tableDatas[4][m],
// // that.tableDatas[5][m],
// that.tableDatas[6][m],
// that.tableDatas[7][m]
// ) -
// sumNum(
// that.tableDatas[1][m],
// that.tableDatas[2][m]
// );
// //
// // that.tableDatas[12][m] = sumNum(
// // that.tableDatas[9][m],
// // that.tableDatas[10][m],
// // that.tableDatas[11][m]
// // );
// //
// that.tableDatas[13][m] =
// typeof that.tableDatas[12][m] !== "undefined"
// ? sumNum(
// that.tableDatas[9][m],
// that.tableDatas[10][m],
// that.tableDatas[11][m],
// that.tableDatas[12][m]
// )
// : sumNum(
// that.tableDatas[9][m],
// that.tableDatas[10][m],
// that.tableDatas[11][m]
// );
// //
// let sum17 = sumNum(
// that.tableDatas[14][m],
// that.tableDatas[15][m],
// that.tableDatas[16][m]
// );
// that.tableDatas[17][m] =
// typeof that.tableDatas[21][m] !== "undefined"
// ? sum17 - that.tableDatas[21][m]
// : sum17;
// //
// that.tableDatas[20][m] =
// typeof that.tableDatas[19][m] !== "undefined"
// ? that.tableDatas[18][m] -
// that.tableDatas[19][m]
// : that.tableDatas[18][m];
// //
// that.tableDatas[25][m] = sumNum(
// that.tableDatas[21][m],
// that.tableDatas[22][m],
// that.tableDatas[23][m],
// that.tableDatas[24][m]
// );
// //
// that.tableDatas[27][m] = sumNum(
// that.tableDatas[3][m],
// that.tableDatas[8][m],
// that.tableDatas[13][m],
// that.tableDatas[17][m],
// that.tableDatas[18][m],
// that.tableDatas[25][m],
// that.tableDatas[26][m]
// );
// //
// // that.tableDatas[28][m] = sumNum(
// // that.tableDatas[27][m],
// // that.tableDatas[26][m]
// // );
// }
// that.tableDatas.forEach((inner, inde) => {
// let sum27 = 0;
// inner.forEach((num, ind) => {
// if (ind > 2 && ind < 27) {
// sum27 = sum27 + Number(num);
// }
// });
// inner[27] = sum27;
// });
// })
// .then(() => {});
// },
getHourData() {
let that = this;
let m = 0;
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
let hour = date.getHours();
let minute = date.getMinutes();
let second = date.getSeconds();
}, },
getTableData() { getTableData() {
for (let i = 0; i < this.tableDatas.length; i++) { for (let i = 0; i < this.tableDatas.length; i++) {

View File

@ -45,7 +45,7 @@
<th>工段</th> <th>工段</th>
<th>设备</th> <th>设备</th>
<th>单位</th> <th>单位</th>
<th v-for="item in 12" :key="item"> <th v-for="item in months" :key="item">
{{ item }} {{ item }}
</th> </th>
<th>本年合计</th> <th>本年合计</th>
@ -135,40 +135,9 @@ export default {
data() { data() {
return { return {
year: "", year: "",
month: "",
day: "",
search_date: "", search_date: "",
tableDatas: [ mpointList: [],
["石灰石破碎", "破碎机", "kw.h"], //0 tableDatas: [],
["石灰石破碎", "堆取料机", "kw.h"],
["石灰石破碎", "低压变压器柜", "kw.h"],
["石灰石破碎", "石灰石破碎合计", "kw.h"],
["原料磨", "循环风机", "kw.h"],
["原料磨", "辊压机", "kw.h"],
["原料磨", "调配变压器", "kw.h"],
["原料磨", "低压变压器柜器", "kw.h"],
["原料磨", "原料磨系统合计", "kw.h"],
["回转窑", "尾排风机", "kw.h"],
["回转窑", "高温风机", "kw.h"],
["回转窑", "头排风机", "kw.h"],
["回转窑", "低压变压器柜", "kw.h"],
["回转窑", "回转窑烧成系统合计", "kw.h"],
["煤磨", "煤磨主电机", "kw.h"],
["煤磨", "煤磨排风机", "kw.h"],
["煤磨", "低压变压器柜", "kw.h"],
["煤磨", "煤磨系统合计", "kw.h"],
["余热发电", "余热发电量", "kw.h"],
["余热发电", "余热发电自用电量", "kw.h"],
["余热发电", "余热供电量", "kw.h"],
["空压机", "1#空压机", "kw.h"],
["空压机", "2#空压机", "kw.h"],
["空压机", "3#空压机", "kw.h"],
["空压机", "4#空压机", "kw.h"],
["空压机", "空压机合计", "kw.h"],
["富氧燃烧系统", "富氧燃烧耗电设备", "kw.h"],
["生产总耗电量", "生产部分总耗电", "kw.h"],
["全厂进线", "全厂耗电量", "kw.h"],
],
timeStamp: null, timeStamp: null,
itemVisible: false, itemVisible: false,
months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], months: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
@ -278,228 +247,72 @@ export default {
let that = this; let that = this;
var nowDate = new Date(); var nowDate = new Date();
that.year = nowDate.getFullYear(); that.year = nowDate.getFullYear();
that.search_date = that.year + ""; that.search_date = that.year;
that.timeStamp = nowDate.getTime(); that.timeStamp = nowDate.getTime();
let tableDatas = that.tableDatas; this.getMPoints();
for (let i = 0; i < tableDatas.length; i++) {
for (let j = 0; j < 12; j++) {
let k = 3 + j;
that.tableDatas[i][k] = 0;
this.$forceUpdate();
}
}
this.getData();
}, },
methods: { methods: {
dateChange() { dateChange() {
let that = this; let that = this;
for (let i = 0; i < that.tableDatas.length; i++) { that.tableDatas = [];
for (let j = 0; j < 13; j++) { that.year = that.search_date;
let k = 3 + j;
that.tableDatas[i][k] = 0;
this.$forceUpdate();
}
}
let nowDate = new Date(); let nowDate = new Date();
that.timeStamp = nowDate.getTime(); that.timeStamp = nowDate.getTime();
this.getData(); that.dataLoop();
}, },
getData() { getMPoints() {
let that = this; let that = this;
function dataPush(name) { that.$API.enm.mpoint.list
let index = 0; .req({
if (name == "破碎机") { page: 0,
index = 0; enabled: true,
} else if (name == "堆取料机") { need_display: true,
index = 1; ordering: "report_sortstr",
} else if (name == "低压变压器柜") { mpoint__material__code: "elec",
index = 2;
} else if (name == "循环风机") {
index = 4;
} else if (name == "调配变压器") {
index = 6;
} else if (name == "低压变压器柜器") {
index = 7;
} else if (name == "尾排风机") {
index = 9;
} else if (name == "高温风机") {
index = 10;
} else if (name == "头排风机") {
index = 11;
} else if (name == "煤磨主电机") {
index = 14;
} else if (name == "煤磨排风机") {
index = 15;
} else if (name == "低压变压器柜") {
index = 16;
} else if (name == "余热发电量") {
index = 18;
} else if (name == "余热发电自用电量") {
index = 19;
} else if (name == "1#空压机") {
index = 21;
} else if (name == "2#空压机") {
index = 22;
} else if (name == "3#空压机") {
index = 23;
} else if (name == "4#空压机") {
index = 24;
} else if (name == "富氧燃烧耗电设备") {
index = 26;
}
return index;
}
function sumNum(a, b, c, d) {
let sum = 0;
if (typeof a !== "undefined" && a !== "NaN") {
sum = sum + Number(a);
}
if (typeof b !== "undefined" && a !== "NaN") {
sum = sum + Number(b);
}
if (typeof c !== "undefined" && a !== "NaN") {
sum = sum + Number(c);
}
if (typeof d !== "undefined" && a !== "NaN") {
sum = sum + Number(d);
}
return sum;
}
let obj = {};
obj.type = "month_s";
obj.year_s = that.year;
obj.page = 0;
obj.mpoint__ep_monitored__power_kw__gte = 100;
this.$API.enm.mpoint.stat
.req(obj)
.then((res) => {
let wrapArr = [],
innerArr = [];
res.forEach((item) => {
let month = item.month;
if (wrapArr[month]) {
wrapArr[month].push(item);
} else {
wrapArr[month] = [];
wrapArr[month].push(item);
}
});
wrapArr.forEach((inner, inde) => {
inner.forEach((item) => {
let i = dataPush(item.mpoint_name);
let k = 0;
if (
i == 0 ||
i == 4 ||
i == 9 ||
i == 14 ||
i == 18 ||
i == 21 ||
i == 26 ||
i == 27 ||
i == 28
) {
k = 3 + inde;
} else {
k = 2 + inde;
}
that.tableDatas[i][k] = item.val;
});
});
for (let k = 0; k < 24; k++) {
let m = k + 3;
let n = k + 1;
//
that.tableDatas[3][m] = sumNum(
that.tableDatas[0][m],
that.tableDatas[1][m],
that.tableDatas[2][m]
);
//
// that.tableDatas[5][m] = sumNum();
//
that.tableDatas[8][m] =
sumNum(
that.tableDatas[4][m],
// that.tableDatas[5][m],
that.tableDatas[6][m],
that.tableDatas[7][m]
) -
sumNum(
that.tableDatas[1][m],
that.tableDatas[2][m]
);
//
// that.tableDatas[12][m] = sumNum(
// that.tableDatas[9][m],
// that.tableDatas[10][m],
// that.tableDatas[11][m]
// );
//
that.tableDatas[13][m] =
typeof that.tableDatas[12][m] !== "undefined"
? sumNum(
that.tableDatas[9][m],
that.tableDatas[10][m],
that.tableDatas[11][m],
that.tableDatas[12][m]
)
: sumNum(
that.tableDatas[9][m],
that.tableDatas[10][m],
that.tableDatas[11][m]
);
//
let sum17 = sumNum(
that.tableDatas[14][m],
that.tableDatas[15][m],
that.tableDatas[16][m]
);
that.tableDatas[17][m] =
typeof that.tableDatas[21][m] !== "undefined"
? sum17 - that.tableDatas[21][m]
: sum17;
//
that.tableDatas[20][m] =
typeof that.tableDatas[19][m] !== "undefined"
? that.tableDatas[18][m] -
that.tableDatas[19][m]
: that.tableDatas[18][m];
//
that.tableDatas[25][m] = sumNum(
that.tableDatas[21][m],
that.tableDatas[22][m],
that.tableDatas[23][m],
that.tableDatas[24][m]
);
//
that.tableDatas[27][m] = sumNum(
that.tableDatas[3][m],
that.tableDatas[8][m],
that.tableDatas[13][m],
that.tableDatas[17][m],
that.tableDatas[18][m],
that.tableDatas[25][m],
that.tableDatas[26][m]
);
//
// that.tableDatas[28][m] = sumNum(
// that.tableDatas[27][m],
// that.tableDatas[26][m]
// );
}
that.tableDatas.forEach((inner, inde) => {
let sum15 = 0;
inner.forEach((num, ind) => {
if (ind > 2 && ind < 15) {
sum15 = sum15 + Number(num);
}
});
inner[15] = sum15;
});
}) })
.then(() => {}); .then((res) => {
let data = res.slice(3);
that.mpointList = data;
that.dataLoop();
});
},
dataLoop() {
let that = this;
that.tableDatas = [];
that.mpointList.forEach((item, index) => {
let arr = [];
arr[0] =
item.mgroup_name != null
? item.mgroup_name
: item.nickname != null
? item.nickname
: item.name;
arr[1] = item.nickname != null ? item.nickname : item.name;
arr[2] = item.unit;
for (let i = 0; i < 12; i++) {
arr[i + 3] = 0;
}
that.tableDatas.push(arr);
that.getData(item.id, index);
});
},
getData(id, index) {
let that = this;
let obj = {};
obj.type = "month";
obj.year = that.year;
obj.mpoint__material__code = "elec";
obj.mpoint__need_display = 1;
obj.mpoint = id;
obj.page = 0;
this.$API.enm.mpoint.stat.req(obj).then((res) => {
console.log(res);
res.forEach((item) => {
let ind = item.month + 2;
that.tableDatas[index][ind] = item.val;
});
that.$forceUpdate();
});
}, },
itemClick(item, index) { itemClick(item, index) {
let that = this; let that = this;

View File

@ -325,6 +325,10 @@
label="发生时间" label="发生时间"
prop="start_time" prop="start_time"
></el-table-column> ></el-table-column>
<el-table-column
label="结束时间"
prop="end_time"
></el-table-column>
<el-table-column <el-table-column
label="原因类别" label="原因类别"
prop="cate" prop="cate"
@ -383,13 +387,27 @@
highlightCurrentRow highlightCurrentRow
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="处理班组"> <el-table-column label="班组名称">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.sflog_">{{ <span v-if="scope.row.sflog_">{{
scope.row.sflog_.shift_name scope.row.sflog_.shift_name
}}</span> }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="开始时间">
<template #default="scope">
<span v-if="scope.row.sflog_">{{
scope.row.sflog_.start_time
}}</span>
</template>
</el-table-column>
<el-table-column label="结束时间">
<template #default="scope">
<span v-if="scope.row.sflog_">{{
scope.row.sflog_.end_time
}}</span>
</template>
</el-table-column>
<el-table-column label="所在工段"> <el-table-column label="所在工段">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.sflog_">{{ <span v-if="scope.row.sflog_">{{
@ -550,11 +568,19 @@
</el-form> </el-form>
<el-footer> <el-footer>
<el-button <el-button
v-if="sflogExpVisiable"
type="primary" type="primary"
:loading="isSaveing" :loading="isSaveing"
@click="submit42" @click="submit42"
>保存</el-button >保存</el-button
> >
<el-button
v-else
type="primary"
:loading="isSaveing"
@click="submit4"
>保存</el-button
>
<el-button @click="visible = false" <el-button @click="visible = false"
>取消</el-button >取消</el-button
> >
@ -715,7 +741,7 @@ export default {
getStlog() { getStlog() {
let obj = {}; let obj = {};
obj.page = 0; obj.page = 0;
obj.sflog = this.form.id; obj.mgroup = this.mgroupId;
this.$API.wpm.stlog.list.req(obj).then((res) => { this.$API.wpm.stlog.list.req(obj).then((res) => {
this.stlogList = res; this.stlogList = res;
}); });
@ -735,18 +761,22 @@ export default {
this.stlogForm.handler = this.$TOOL.data.get("USER_INFO").id; this.stlogForm.handler = this.$TOOL.data.get("USER_INFO").id;
this.stlogForm.mgroup = this.mgroupId; this.stlogForm.mgroup = this.mgroupId;
this.stlogTitle = "新增异常"; this.stlogTitle = "新增异常";
this.sflogExpVisiable = false;
this.visible = true; this.visible = true;
}, },
// //
editStlog(row) { editStlog(row) {
this.stlogTitle = "编辑异常"; this.stlogTitle = "编辑异常";
this.stlogForm = row; this.stlogForm = row;
this.stlogForm.current_sflog = row.sflog;
this.sflogExpVisiable = false;
this.visible = true; this.visible = true;
}, },
handleStlog() { handleStlog() {
this.stlogTitle = "异常处理"; this.stlogTitle = "异常处理";
this.stlogForm = row; this.stlogForm = row;
this.visible = true; this.visible = true;
this.sflogExpVisiable = true;
}, },
// //
submit4() { submit4() {
@ -767,6 +797,8 @@ export default {
that.isSaveing = false; that.isSaveing = false;
}); });
} else if (that.stlogTitle == "编辑异常") { } else if (that.stlogTitle == "编辑异常") {
console.log("that.stlogForm", that.stlogForm);
console.log("that.stlogForm.id", that.stlogForm.id);
that.$API.wpm.stlog.update that.$API.wpm.stlog.update
.req(that.stlogForm.id, that.stlogForm) .req(that.stlogForm.id, that.stlogForm)
.then((res) => { .then((res) => {
@ -794,6 +826,7 @@ export default {
that.getSflogexp(that.clickItem.id); that.getSflogexp(that.clickItem.id);
}) })
.catch((res) => { .catch((res) => {
this.sflogExpVisiable = false;
that.isSaveing = false; that.isSaveing = false;
}); });
}, },
@ -818,7 +851,6 @@ export default {
console.log(row); console.log(row);
this.clickItem = row; this.clickItem = row;
this.getSflogexp(row.id); this.getSflogexp(row.id);
this.sflogExpVisiable = true;
}, },
getSflogexp(id) { getSflogexp(id) {
let obj = {}; let obj = {};

File diff suppressed because it is too large Load Diff