feat: 从localstorage中获取token
This commit is contained in:
parent
767e2d8048
commit
1a1aa3ebcb
|
@ -67,7 +67,8 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12" class="panel_item">
|
<el-col :span="12" class="panel_item">
|
||||||
<div class="panel_label"><img src="img/total_production.png"
|
<div class="panel_label"><img src="img/total_production.png"
|
||||||
style="height: 24px;vertical-align:middle;" />产品产量</div>
|
style="height: 24px;vertical-align:middle;" />产品产量
|
||||||
|
</div>
|
||||||
<div class="pannel_number">
|
<div class="pannel_number">
|
||||||
<span class="panel_value">{{ sectionData.total_production }}</span>
|
<span class="panel_value">{{ sectionData.total_production }}</span>
|
||||||
<span class="panel_unit">(t)</span>
|
<span class="panel_unit">(t)</span>
|
||||||
|
@ -76,7 +77,8 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="16" style="height: 72px;margin-top: 4px">
|
<el-row :gutter="16" style="height: 72px;margin-top: 4px">
|
||||||
<el-col :span="12" class="panel_item">
|
<el-col :span="12" class="panel_item">
|
||||||
<div class="panel_label"><img src="img/run_rate.png" style="height: 24px;vertical-align:middle;" /> 运转率</div>
|
<div class="panel_label"><img src="img/run_rate.png" style="height: 24px;vertical-align:middle;" /> 运转率
|
||||||
|
</div>
|
||||||
<div class="pannel_number">
|
<div class="pannel_number">
|
||||||
<span class="panel_value">{{ sectionData.run_rate }}</span>
|
<span class="panel_value">{{ sectionData.run_rate }}</span>
|
||||||
<span class="panel_unit">(%)</span>
|
<span class="panel_unit">(%)</span>
|
||||||
|
@ -402,11 +404,10 @@ export default {
|
||||||
},
|
},
|
||||||
init() {
|
init() {
|
||||||
var that = this
|
var that = this
|
||||||
// console.log(tool.cookie.get("TOKEN"))
|
|
||||||
if (typeof (WebSocket) === "undefined") {
|
if (typeof (WebSocket) === "undefined") {
|
||||||
alert("您的浏览器不支持socket")
|
alert("您的浏览器不支持socket")
|
||||||
} else {
|
} else {
|
||||||
this.ws = new WebSocket(this.path + tool.cookie.get("TOKEN"))
|
this.ws = new WebSocket(this.path + tool.data.get("TOKEN"))
|
||||||
//监听是否连接成功
|
//监听是否连接成功
|
||||||
this.ws.onopen = () => {
|
this.ws.onopen = () => {
|
||||||
// console.log("socket连接成功");
|
// console.log("socket连接成功");
|
||||||
|
|
|
@ -8,63 +8,75 @@
|
||||||
<el-col>
|
<el-col>
|
||||||
<el-card header="产量及完成度" style="border-radius: 5px;box-shadow: none;">
|
<el-card header="产量及完成度" style="border-radius: 5px;box-shadow: none;">
|
||||||
<div class="itemsWrap">
|
<div class="itemsWrap">
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.电石渣">{{ monthData.电石渣.total_production }}</div>
|
<div class="item-number" v-if="monthData.电石渣">{{ monthData.电石渣.total_production
|
||||||
|
}}</div>
|
||||||
<div class="item-name">月电石渣产量</div>
|
<div class="item-name">月电石渣产量</div>
|
||||||
<el-progress :percentage="90" :text-inside="true" :stroke-width="14">
|
<el-progress :percentage="90" :text-inside="true" :stroke-width="14">
|
||||||
<span class="item-percent">90%</span>
|
<span class="item-percent">90%</span>
|
||||||
</el-progress>
|
</el-progress>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.原料磨">{{ monthData.原料磨.total_production }}</div>
|
<div class="item-number" v-if="monthData.原料磨">{{ monthData.原料磨.total_production
|
||||||
|
}}</div>
|
||||||
<div class="item-name">月生料产量</div>
|
<div class="item-name">月生料产量</div>
|
||||||
<el-progress :percentage="95" :text-inside="true" :stroke-width="14">
|
<el-progress :percentage="95" :text-inside="true" :stroke-width="14">
|
||||||
<span class="item-percent">95%</span>
|
<span class="item-percent">95%</span>
|
||||||
</el-progress>
|
</el-progress>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.回转窑">{{ monthData.回转窑.total_production }}</div>
|
<div class="item-number" v-if="monthData.回转窑">{{ monthData.回转窑.total_production
|
||||||
|
}}</div>
|
||||||
<div class="item-name">月熟料产量</div>
|
<div class="item-name">月熟料产量</div>
|
||||||
<el-progress :percentage="98" :text-inside="true" :stroke-width="14">
|
<el-progress :percentage="98" :text-inside="true" :stroke-width="14">
|
||||||
<span class="item-percent">98%</span>
|
<span class="item-percent">98%</span>
|
||||||
</el-progress>
|
</el-progress>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.水泥磨">{{ monthData.水泥磨.total_production }}</div>
|
<div class="item-number" v-if="monthData.水泥磨">{{ monthData.水泥磨.total_production
|
||||||
|
}}</div>
|
||||||
<div class="item-name">月水泥产量</div>
|
<div class="item-name">月水泥产量</div>
|
||||||
<el-progress :percentage="95" :text-inside="true" :stroke-width="14">
|
<el-progress :percentage="95" :text-inside="true" :stroke-width="14">
|
||||||
<span class="item-percent">95%</span>
|
<span class="item-percent">95%</span>
|
||||||
</el-progress>
|
</el-progress>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: inline-block;">
|
<div style="display: inline-block;">
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="yearData.电石渣">{{ yearData.电石渣.total_production }}</div>
|
<div class="item-number" v-if="yearData.电石渣">{{
|
||||||
|
yearData.电石渣.total_production }}</div>
|
||||||
<div class="item-name">本年累计电石渣产量</div>
|
<div class="item-name">本年累计电石渣产量</div>
|
||||||
<el-progress :percentage="75" status="success" :text-inside="true" :stroke-width="14">
|
<el-progress :percentage="75" status="success" :text-inside="true"
|
||||||
|
:stroke-width="14">
|
||||||
<span class="item-percent">75%</span>
|
<span class="item-percent">75%</span>
|
||||||
</el-progress>
|
</el-progress>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="yearData.原料磨">{{ yearData.原料磨.total_production }}</div>
|
<div class="item-number" v-if="yearData.原料磨">{{
|
||||||
|
yearData.原料磨.total_production }}</div>
|
||||||
<div class="item-name">本年累计生料产量</div>
|
<div class="item-name">本年累计生料产量</div>
|
||||||
<el-progress :percentage="70" status="success" :text-inside="true" :stroke-width="14">
|
<el-progress :percentage="70" status="success" :text-inside="true"
|
||||||
|
:stroke-width="14">
|
||||||
<span class="item-percent">70%</span>
|
<span class="item-percent">70%</span>
|
||||||
</el-progress>
|
</el-progress>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="yearData.回转窑">{{ yearData.回转窑.total_production }}</div>
|
<div class="item-number" v-if="yearData.回转窑">{{
|
||||||
|
yearData.回转窑.total_production }}</div>
|
||||||
<div class="item-name">本年累计熟料产量</div>
|
<div class="item-name">本年累计熟料产量</div>
|
||||||
<el-progress :percentage="80" status="success" :text-inside="true" :stroke-width="14">
|
<el-progress :percentage="80" status="success" :text-inside="true"
|
||||||
|
:stroke-width="14">
|
||||||
<span class="item-percent">80%</span>
|
<span class="item-percent">80%</span>
|
||||||
</el-progress>
|
</el-progress>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="yearData.水泥磨">{{ yearData.水泥磨.total_production }}</div>
|
<div class="item-number" v-if="yearData.水泥磨">{{
|
||||||
|
yearData.水泥磨.total_production }}</div>
|
||||||
<div class="item-name">本年累计水泥产量</div>
|
<div class="item-name">本年累计水泥产量</div>
|
||||||
<el-progress :percentage="75" status="success" :text-inside="true" :stroke-width="14">
|
<el-progress :percentage="75" status="success" :text-inside="true"
|
||||||
|
:stroke-width="14">
|
||||||
<span class="item-percent">75%</span>
|
<span class="item-percent">75%</span>
|
||||||
</el-progress>
|
</el-progress>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -72,76 +84,92 @@
|
||||||
<el-col>
|
<el-col>
|
||||||
<el-card header="能耗" style="border-radius: 5px;box-shadow: none;">
|
<el-card header="能耗" style="border-radius: 5px;box-shadow: none;">
|
||||||
<div class="itemsWrap">
|
<div class="itemsWrap">
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.电石渣">{{ monthData.电石渣.elec_consume_unit }}</div>
|
<div class="item-number" v-if="monthData.电石渣">{{ monthData.电石渣.elec_consume_unit
|
||||||
|
}}</div>
|
||||||
<div class="item-name">月电石渣分布电耗</div>
|
<div class="item-name">月电石渣分布电耗</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.原料磨">{{ monthData.原料磨.elec_consume_unit }}</div>
|
<div class="item-number" v-if="monthData.原料磨">{{ monthData.原料磨.elec_consume_unit
|
||||||
|
}}</div>
|
||||||
<div class="item-name">月生料分布电耗</div>
|
<div class="item-name">月生料分布电耗</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.回转窑">{{ monthData.回转窑.elec_consume_unit }}</div>
|
<div class="item-number" v-if="monthData.回转窑">{{ monthData.回转窑.elec_consume_unit
|
||||||
|
}}</div>
|
||||||
<div class="item-name">月熟料分布电耗</div>
|
<div class="item-name">月熟料分布电耗</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.回转窑">{{ monthData.回转窑.coal_consume_unit }}</div>
|
<div class="item-number" v-if="monthData.回转窑">{{ monthData.回转窑.coal_consume_unit
|
||||||
|
}}</div>
|
||||||
<div class="item-name">熟料月单位标煤耗</div>
|
<div class="item-name">熟料月单位标煤耗</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: inline-block;">
|
<div style="display: inline-block;">
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.回转窑">{{ monthData.回转窑.celec_consume_unit }}</div>
|
<div class="item-number" v-if="monthData.回转窑">{{
|
||||||
<div class="item-name">熟料月综合电耗</div>
|
monthData.回转窑.celec_consume_unit }}</div>
|
||||||
</div>
|
<div class="item-name">熟料月综合电耗</div>
|
||||||
|
</div>
|
||||||
<div class="items" >
|
|
||||||
<div class="item-number" v-if="monthData.回转窑">{{ monthData.回转窑.cen_consume_unit }}</div>
|
<div class="items">
|
||||||
<div class="item-name">熟料月综合能耗</div>
|
<div class="item-number" v-if="monthData.回转窑">{{
|
||||||
</div>
|
monthData.回转窑.cen_consume_unit }}</div>
|
||||||
<div class="items" >
|
<div class="item-name">熟料月综合能耗</div>
|
||||||
<div class="item-number" v-if="monthData.水泥磨">{{ monthData.水泥磨.elec_consume_unit }}</div>
|
</div>
|
||||||
<div class="item-name">月水泥粉磨分布电耗</div>
|
<div class="items">
|
||||||
</div>
|
<div class="item-number" v-if="monthData.水泥磨">{{
|
||||||
<div class="items" >
|
monthData.水泥磨.elec_consume_unit }}</div>
|
||||||
<div class="item-number" v-if="monthData.水泥磨">{{ monthData.水泥磨.cen_consume_unit }}</div>
|
<div class="item-name">月水泥粉磨分布电耗</div>
|
||||||
<div class="item-name">水泥月综合能耗</div>
|
</div>
|
||||||
</div>
|
<div class="items">
|
||||||
|
<div class="item-number" v-if="monthData.水泥磨">{{
|
||||||
|
monthData.水泥磨.cen_consume_unit }}</div>
|
||||||
|
<div class="item-name">水泥月综合能耗</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="itemsWrap">
|
<div class="itemsWrap">
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="yearData.电石渣">{{ yearData.电石渣.elec_consume_unit }}</div>
|
<div class="item-number" v-if="yearData.电石渣">{{ yearData.电石渣.elec_consume_unit
|
||||||
|
}}</div>
|
||||||
<div class="item-name">本年度电石渣分布电耗</div>
|
<div class="item-name">本年度电石渣分布电耗</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="yearData.原料磨">{{ yearData.原料磨.elec_consume_unit }}</div>
|
<div class="item-number" v-if="yearData.原料磨">{{ yearData.原料磨.elec_consume_unit
|
||||||
|
}}</div>
|
||||||
<div class="item-name">本年度生料分布电耗</div>
|
<div class="item-name">本年度生料分布电耗</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="yearData.回转窑">{{ yearData.回转窑.elec_consume_unit }}</div>
|
<div class="item-number" v-if="yearData.回转窑">{{ yearData.回转窑.elec_consume_unit
|
||||||
|
}}</div>
|
||||||
<div class="item-name">本年度熟料分布电耗</div>
|
<div class="item-name">本年度熟料分布电耗</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="yearData.回转窑">{{ yearData.回转窑.coal_consume_unit }}</div>
|
<div class="item-number" v-if="yearData.回转窑">{{ yearData.回转窑.coal_consume_unit
|
||||||
|
}}</div>
|
||||||
<div class="item-name">本年度熟料单位标煤耗</div>
|
<div class="item-name">本年度熟料单位标煤耗</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: inline-block;">
|
<div style="display: inline-block;">
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="yearData.回转窑">{{ yearData.回转窑.celec_consume_unit }}</div>
|
<div class="item-number" v-if="yearData.回转窑">{{
|
||||||
|
yearData.回转窑.celec_consume_unit }}</div>
|
||||||
<div class="item-name">本年度熟料综合电耗</div>
|
<div class="item-name">本年度熟料综合电耗</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="yearData.回转窑">{{ yearData.回转窑.cen_consume_unit }}</div>
|
<div class="item-number" v-if="yearData.回转窑">{{
|
||||||
|
yearData.回转窑.cen_consume_unit }}</div>
|
||||||
<div class="item-name">本年度熟料综合能耗</div>
|
<div class="item-name">本年度熟料综合能耗</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="yearData.水泥磨">{{ yearData.水泥磨.elec_consume_unit }}</div>
|
<div class="item-number" v-if="yearData.水泥磨">{{
|
||||||
|
yearData.水泥磨.elec_consume_unit }}</div>
|
||||||
<div class="item-name">本年度水泥粉磨分布电耗</div>
|
<div class="item-name">本年度水泥粉磨分布电耗</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="yearData.水泥磨">{{ yearData.水泥磨.cen_consume_unit }}</div>
|
<div class="item-number" v-if="yearData.水泥磨">{{
|
||||||
|
yearData.水泥磨.cen_consume_unit }}</div>
|
||||||
<div class="item-name">本年度水泥综合能耗</div>
|
<div class="item-name">本年度水泥综合能耗</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -150,21 +178,25 @@
|
||||||
<el-card header="成本统计" style="border-radius: 5px;box-shadow: none;">
|
<el-card header="成本统计" style="border-radius: 5px;box-shadow: none;">
|
||||||
<div class="itemsWrap">
|
<div class="itemsWrap">
|
||||||
<div class="items">
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.电石渣">{{ monthData.电石渣.production_cost_unit }}</div>
|
<div class="item-number" v-if="monthData.电石渣">{{
|
||||||
|
monthData.电石渣.production_cost_unit }}</div>
|
||||||
<div class="item-name">月电石渣成本</div>
|
<div class="item-name">月电石渣成本</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.原料磨">{{ monthData.原料磨.production_cost_unit }}</div>
|
<div class="item-number" v-if="monthData.原料磨">{{
|
||||||
|
monthData.原料磨.production_cost_unit }}</div>
|
||||||
<div class="item-name">月生料成本</div>
|
<div class="item-name">月生料成本</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.回转窑">{{ monthData.回转窑.production_cost_unit }}</div>
|
<div class="item-number" v-if="monthData.回转窑">{{
|
||||||
|
monthData.回转窑.production_cost_unit }}</div>
|
||||||
<div class="item-name">月熟料成本</div>
|
<div class="item-name">月熟料成本</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="items" >
|
<div class="items">
|
||||||
<div class="item-number" v-if="monthData.水泥磨">{{ monthData.水泥磨.production_cost_unit }}</div>
|
<div class="item-number" v-if="monthData.水泥磨">{{
|
||||||
|
monthData.水泥磨.production_cost_unit }}</div>
|
||||||
<div class="item-name">月水泥成本</div>
|
<div class="item-name">月水泥成本</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -173,12 +205,12 @@
|
||||||
<el-badge :value="warningNum" :max="99" style="margin: 10px;">
|
<el-badge :value="warningNum" :max="99" style="margin: 10px;">
|
||||||
<div class="items" style="margin:0;" @click="interEvent">
|
<div class="items" style="margin:0;" @click="interEvent">
|
||||||
<div class="item-number">能耗超标报警</div>
|
<div class="item-number">能耗超标报警</div>
|
||||||
</div>
|
</div>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
<el-badge :value="warningNum2" :max="99" style="margin: 10px;">
|
<el-badge :value="warningNum2" :max="99" style="margin: 10px;">
|
||||||
<div class="items" style="margin:0" @click="interEquipment">
|
<div class="items" style="margin:0" @click="interEquipment">
|
||||||
<div class="item-number">设备检验</div>
|
<div class="item-number">设备检验</div>
|
||||||
</div>
|
</div>
|
||||||
</el-badge>
|
</el-badge>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -189,216 +221,225 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
time: '',
|
time: '',
|
||||||
day: '',
|
day: '',
|
||||||
year_s:'',
|
year_s: '',
|
||||||
month_s:'',
|
month_s: '',
|
||||||
yearData:[],
|
yearData: [],
|
||||||
monthData:[],
|
monthData: [],
|
||||||
warningNum:0,
|
warningNum: 0,
|
||||||
warningNum2:0,
|
warningNum2: 0,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$emit('on-mounted');
|
||||||
|
let that = this;
|
||||||
|
var myDate = new Date();
|
||||||
|
let year = myDate.getFullYear();
|
||||||
|
let month = myDate.getMonth() + 1;
|
||||||
|
that.year_s = year;
|
||||||
|
that.month_s = month;
|
||||||
|
that.getYearData();
|
||||||
|
that.getMonthData();
|
||||||
|
that.getWraningNum();
|
||||||
|
// this.showTime();
|
||||||
|
// setInterval(()=>{
|
||||||
|
// this.showTime()
|
||||||
|
// },1000)
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 动态绑定Class
|
||||||
|
bindClass(type) {
|
||||||
|
let classInfo = {
|
||||||
|
socketDom: true, redColor: false,
|
||||||
|
orangeColor: false, yellowColor: false, blueColor: true
|
||||||
|
}
|
||||||
|
if (type == '') {
|
||||||
|
classInfo.redColor = true
|
||||||
|
}
|
||||||
|
return classInfo
|
||||||
|
},
|
||||||
|
init() {
|
||||||
|
var that = this
|
||||||
|
if (typeof (WebSocket) === "undefined") {
|
||||||
|
alert("您的浏览器不支持socket")
|
||||||
|
} else {
|
||||||
|
this.ws = new WebSocket(this.path + tool.data.get("TOKEN"))
|
||||||
|
//监听是否连接成功
|
||||||
|
this.ws.onopen = () => {
|
||||||
|
// console.log("socket连接成功");
|
||||||
|
setTimeout(() => {
|
||||||
|
that.ws.send(JSON.stringify({ 'type': 'event' }))
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
|
||||||
|
//接听服务器发回的信息并处理展示
|
||||||
|
this.ws.onmessage = (msg) => {
|
||||||
|
let data = JSON.parse(msg.data)
|
||||||
|
console.log(data)
|
||||||
|
that.getWraningNum();
|
||||||
|
// if(data.type=='event'){
|
||||||
|
// that.bindClass();
|
||||||
|
// }if(data.type=='ticket'){
|
||||||
|
|
||||||
|
// }if(data.type=='remaind'){
|
||||||
|
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
// 监听并处理error事件
|
||||||
|
this.ws.onerror = function (error) {
|
||||||
|
console.log('ws断开,尝试重连')
|
||||||
|
setTimeout(() => {
|
||||||
|
this.ws = null;
|
||||||
|
this.init()
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
getMessage(msg) {
|
||||||
this.$emit('on-mounted');
|
|
||||||
let that = this;
|
|
||||||
var myDate = new Date();
|
|
||||||
let year = myDate.getFullYear();
|
|
||||||
let month = myDate.getMonth()+1;
|
|
||||||
that.year_s = year;
|
|
||||||
that.month_s = month;
|
|
||||||
that.getYearData();
|
|
||||||
that.getMonthData();
|
|
||||||
that.getWraningNum();
|
|
||||||
// this.showTime();
|
|
||||||
// setInterval(()=>{
|
|
||||||
// this.showTime()
|
|
||||||
// },1000)
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 动态绑定Class
|
|
||||||
bindClass(type){
|
|
||||||
let classInfo = { socketDom: true, redColor: false,
|
|
||||||
orangeColor:false, yellowColor:false, blueColor:true }
|
|
||||||
if(type==''){
|
|
||||||
classInfo.redColor = true
|
|
||||||
}
|
|
||||||
return classInfo
|
|
||||||
},
|
|
||||||
init() {
|
|
||||||
var that = this
|
|
||||||
// console.log(tool.cookie.get("TOKEN"))
|
|
||||||
if(typeof(WebSocket) === "undefined"){
|
|
||||||
alert("您的浏览器不支持socket")
|
|
||||||
}else{
|
|
||||||
this.ws = new WebSocket(this.path+tool.cookie.get("TOKEN"))
|
|
||||||
//监听是否连接成功
|
|
||||||
this.ws.onopen = ()=> {
|
|
||||||
// console.log("socket连接成功");
|
|
||||||
setTimeout(()=>{
|
|
||||||
that.ws.send(JSON.stringify({'type': 'event'}))
|
|
||||||
},500)
|
|
||||||
}
|
|
||||||
|
|
||||||
//接听服务器发回的信息并处理展示
|
|
||||||
this.ws.onmessage = (msg)=>{
|
|
||||||
let data = JSON.parse(msg.data)
|
|
||||||
console.log(data)
|
|
||||||
that.getWraningNum();
|
|
||||||
// if(data.type=='event'){
|
|
||||||
// that.bindClass();
|
|
||||||
// }if(data.type=='ticket'){
|
|
||||||
|
|
||||||
// }if(data.type=='remaind'){
|
|
||||||
|
|
||||||
// }
|
|
||||||
};
|
|
||||||
// 监听并处理error事件
|
|
||||||
this.ws.onerror = function(error) {
|
|
||||||
console.log('ws断开,尝试重连')
|
|
||||||
setTimeout(()=>{
|
|
||||||
this.ws = null;
|
|
||||||
this.init()
|
|
||||||
}, 5000)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getMessage(msg) {
|
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
if (this.ws) {
|
if (this.ws) {
|
||||||
this.ws.close();
|
this.ws.close();
|
||||||
this.ws = null;
|
this.ws = null;
|
||||||
console.log("socket已经关闭");
|
console.log("socket已经关闭");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//获取报警事件数量
|
//获取报警事件数量
|
||||||
getWraningNum(){
|
getWraningNum() {
|
||||||
let that = this;
|
let that = this;
|
||||||
that.$API.ecm.event.list.req({cates__code__in:'consume_exceed',is_handled:0,page:1}).then((res) => {
|
that.$API.ecm.event.list.req({ cates__code__in: 'consume_exceed', is_handled: 0, page: 1 }).then((res) => {
|
||||||
that.warningNum = res.count;
|
that.warningNum = res.count;
|
||||||
})
|
})
|
||||||
that.$API.em.equipment.list.req({tag:'near_check',type:20,page:1}).then((res) => {
|
that.$API.em.equipment.list.req({ tag: 'near_check', type: 20, page: 1 }).then((res) => {
|
||||||
debugger;
|
debugger;
|
||||||
that.warningNum2 = res.count;
|
that.warningNum2 = res.count;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getYearData(){
|
getYearData() {
|
||||||
let that = this;
|
let that = this;
|
||||||
let obj = {};
|
let obj = {};
|
||||||
obj.year_s = this.year_s;
|
obj.year_s = this.year_s;
|
||||||
obj.type = 'year_s';
|
obj.type = 'year_s';
|
||||||
obj.page = 0;
|
obj.page = 0;
|
||||||
this.$API.enm.enstat.req(obj).then((res) => {
|
this.$API.enm.enstat.req(obj).then((res) => {
|
||||||
let yearData = {};
|
let yearData = {};
|
||||||
res.forEach(item => {
|
res.forEach(item => {
|
||||||
let label = item.mgroup_name;
|
let label = item.mgroup_name;
|
||||||
yearData[label] = item;
|
yearData[label] = item;
|
||||||
});
|
});
|
||||||
that.yearData = yearData;
|
that.yearData = yearData;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getMonthData(){
|
getMonthData() {
|
||||||
let that = this;
|
let that = this;
|
||||||
let obj = {};
|
let obj = {};
|
||||||
obj.year_s = this.year_s;
|
obj.year_s = this.year_s;
|
||||||
obj.month_s = this.month_s;
|
obj.month_s = this.month_s;
|
||||||
obj.type = 'month_s';
|
obj.type = 'month_s';
|
||||||
obj.page = 0;
|
obj.page = 0;
|
||||||
that.$API.enm.enstat.req(obj).then((res) => {
|
that.$API.enm.enstat.req(obj).then((res) => {
|
||||||
let monthData = {};
|
let monthData = {};
|
||||||
res.forEach(item => {
|
res.forEach(item => {
|
||||||
let label = item.mgroup_name;
|
let label = item.mgroup_name;
|
||||||
monthData[label] = item;
|
monthData[label] = item;
|
||||||
});
|
});
|
||||||
that.monthData = monthData;
|
that.monthData = monthData;
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
showTime(){
|
showTime() {
|
||||||
this.time = this.$TOOL.dateFormat(new Date(), 'hh:mm:ss')
|
this.time = this.$TOOL.dateFormat(new Date(), 'hh:mm:ss')
|
||||||
this.day = this.$TOOL.dateFormat(new Date(), 'yyyy年MM月dd日')
|
this.day = this.$TOOL.dateFormat(new Date(), 'yyyy年MM月dd日')
|
||||||
},
|
},
|
||||||
interEvent(){
|
interEvent() {
|
||||||
this.$router.replace({path:'/events'})
|
this.$router.replace({ path: '/events' })
|
||||||
},
|
},
|
||||||
interEquipment(){
|
interEquipment() {
|
||||||
this.$router.replace({path:'/em/equipmentc'})
|
this.$router.replace({ path: '/em/equipmentc' })
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.items{
|
.items {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
border: 1px solid #cccccc;
|
border: 1px solid #cccccc;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
box-shadow: 0 0 10px 6px #eeeeee57;
|
box-shadow: 0 0 10px 6px #eeeeee57;
|
||||||
}
|
}
|
||||||
.item-number{
|
|
||||||
font-weight: 600;
|
.item-number {
|
||||||
font-size: 24px;
|
font-weight: 600;
|
||||||
color: #1e2126;
|
font-size: 24px;
|
||||||
letter-spacing: .1px;
|
color: #1e2126;
|
||||||
text-align: left;
|
letter-spacing: .1px;
|
||||||
line-height: 36px;
|
text-align: left;
|
||||||
}
|
line-height: 36px;
|
||||||
.item-name{
|
}
|
||||||
font-size: 14px;
|
|
||||||
color: #4e5b71;
|
.item-name {
|
||||||
letter-spacing: .1px;
|
font-size: 14px;
|
||||||
text-align: left;
|
color: #4e5b71;
|
||||||
line-height: 20px;
|
letter-spacing: .1px;
|
||||||
}
|
text-align: left;
|
||||||
.item-percent{
|
line-height: 20px;
|
||||||
font-size: 12px;
|
}
|
||||||
color: #ffffff;
|
|
||||||
letter-spacing: .08px;
|
.item-percent {
|
||||||
text-align: left;
|
font-size: 12px;
|
||||||
line-height: 12px;
|
color: #ffffff;
|
||||||
}
|
letter-spacing: .08px;
|
||||||
.socketDom{
|
text-align: left;
|
||||||
position: absolute;
|
line-height: 12px;
|
||||||
top: 10vh;
|
}
|
||||||
left: 50%;
|
|
||||||
font-size: 20px;
|
.socketDom {
|
||||||
font-weight:bold;
|
position: absolute;
|
||||||
transform: translateX(-50%);
|
top: 10vh;
|
||||||
z-index: 101;
|
left: 50%;
|
||||||
color: #ffffff;
|
font-size: 20px;
|
||||||
border: 1px solid #99fffe;
|
font-weight: bold;
|
||||||
background: rgba(11, 101, 140, 0.451);
|
transform: translateX(-50%);
|
||||||
padding: 10px 20px;
|
z-index: 101;
|
||||||
border-radius: 5px;
|
color: #ffffff;
|
||||||
|
border: 1px solid #99fffe;
|
||||||
|
background: rgba(11, 101, 140, 0.451);
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 5px;
|
||||||
|
|
||||||
}
|
}
|
||||||
.redColor{
|
|
||||||
color: red;
|
.redColor {
|
||||||
border: 1px solid red;
|
color: red;
|
||||||
background: rgba(255, 0, 0, 0.2);
|
border: 1px solid red;
|
||||||
|
background: rgba(255, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
.orangeColor{
|
|
||||||
color: orange;
|
.orangeColor {
|
||||||
border: 1px solid orange;
|
color: orange;
|
||||||
background: rgba(255,165,0,.2);
|
border: 1px solid orange;
|
||||||
|
background: rgba(255, 165, 0, .2);
|
||||||
}
|
}
|
||||||
.yellowColor{
|
|
||||||
color: yellow;
|
.yellowColor {
|
||||||
background: rgba(255,255,0,.2);
|
color: yellow;
|
||||||
border: 1px solid yellow;
|
background: rgba(255, 255, 0, .2);
|
||||||
|
border: 1px solid yellow;
|
||||||
}
|
}
|
||||||
.blueColor{
|
|
||||||
color: #2378f7;
|
.blueColor {
|
||||||
background: rgb(35, 120, 247,.2);
|
color: #2378f7;
|
||||||
border: 1px solid #2378f7;
|
background: rgb(35, 120, 247, .2);
|
||||||
|
border: 1px solid #2378f7;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue