|
|
@@ -0,0 +1,1613 @@
|
|
|
+<template>
|
|
|
+ <div style="min-width:1395px">
|
|
|
+ <div class="heading">
|
|
|
+ <div class="search icon-before icon-search">
|
|
|
+ <el-cascader :options="orgtreelist" :props="orgtreeprops" clearable change-on-select :show-all-levels="false" v-model="selectedorg"
|
|
|
+ :placeholder="$t('message.equipment.select')"></el-cascader>
|
|
|
+ <input type="text" v-model="keyword" :placeholder="$t('message.sgmanage.Enter')">
|
|
|
+ </div>
|
|
|
+ <el-button type="primary" size="small" icon="search" @click="seachdata">{{ $t('message.search') }}</el-button>
|
|
|
+ <template v-if="permission_auth.add">
|
|
|
+ <el-button type="primary" size="small" icon="plus" @click="newDevice()">{{ $t('message.equipment.New') }}</el-button>
|
|
|
+ </template>
|
|
|
+ <el-button type="primary" size="small" @click="batchopera()">
|
|
|
+ <i class="icon icon-stack"></i> {{ $t('message.equipment.Batch') }}</el-button>
|
|
|
+ </div>
|
|
|
+ <p style="text-align:center" v-show="isnodata">{{ $t('message.nodata') }}</p>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8" v-for="(v, index) in equipmentlist" style="min-width:220px;">
|
|
|
+ <el-card style="margin:5px;min-width:220px;border-radius:10px;">
|
|
|
+ <div slot="header" style="font-weight: 800; font-size: 14px;height:17px;">
|
|
|
+ <div style="float: left;height:23px;overflow:hidden;width:70%" :title="v.Equipment.Code">设备名: {{v.Equipment.Code}}</div>
|
|
|
+ <el-button-group style="float: right">
|
|
|
+ <template v-if="permission_auth.edit">
|
|
|
+ <el-button :title="$t('message.equipment.edit')" size="mini" @click="opendeitquipmentDialog(v.Equipment, index)">
|
|
|
+ <i class="icon icon-pencil" style="height:12px;color:#2b3b49"></i>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template v-if="permission_auth.add">
|
|
|
+ <el-button :title="$t('message.equipment.Delete')" size="mini" @click="deleteEquipment(v.Equipment.Id, index, v.Equipment.CSerial)">
|
|
|
+ <i class="icon icon-bin" style="height:12px;;color:#2b3b49"></i>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template v-if="permission_auth.addchannel">
|
|
|
+ <el-button :title="$t('message.equipment.sensor')" size="mini" @click="newChannel(v.Equipment.Id, v.Equipment.Code)">
|
|
|
+ <i class="icon icon-eye-plus" style="height:12px;;color:#2b3b49"></i>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-button-group>
|
|
|
+ <!-- <el-dropdown size="mini" split-button type="primary">
|
|
|
+ 操作
|
|
|
+ <el-dropdown-menu slot="dropdown" style="color:black">
|
|
|
+ <el-dropdown-item>编辑设备</el-dropdown-item>
|
|
|
+ <el-dropdown-item>删除设备</el-dropdown-item>
|
|
|
+ <el-dropdown-item>添加传感器</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown> -->
|
|
|
+ </div>
|
|
|
+ <el-row style="margin-top:-10px;">
|
|
|
+ <el-col :span="6" style="padding:10px;">
|
|
|
+ <img :src="remoteurl+v.Equipment.Photo" style="width: 100%;">
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="18" style="padding:0px 0px 0px 35px">
|
|
|
+ <p class="devplab" :title="v.Equipment.Brands">{{ $t('message.equipment.Brand') }}:{{v.Equipment.Brands}}</p>
|
|
|
+ <p class="devplab" style="height:17px;overflow:hidden;white-space:nowrap;" :title="v.Equipment.DModel">{{ $t('message.equipment.model') }}:{{v.Equipment.DModel}}</p>
|
|
|
+ <p class="devplab">{{ $t('message.equipment.Device') }}:
|
|
|
+ <el-tag type="success" v-if="v.Equipment.DeviceState === 1">{{ $t('message.management.normal') }}</el-tag>
|
|
|
+ <el-tag v-if="v.Equipment.DeviceState === 2">{{ $t('message.triggerinfos.service') }}</el-tag>
|
|
|
+ <el-tag v-if="v.Equipment.DeviceState === 3">{{ $t('message.equipment.Disable') }}</el-tag>
|
|
|
+ <el-tag v-if="v.Equipment.DeviceState === 4">{{ $t('message.triggerinfos.Defrost') }}</el-tag>
|
|
|
+ </p>
|
|
|
+ <p class="devplab" style="height:17px;overflow:hidden;" :title="v.Equipment.OrganizeName">{{ $t('message.sgmanage.OrganizeName') }}:{{v.Equipment.OrganizeName}}</p>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-carousel indicator-position="none" :interval="5000" :autoplay="true" height="270px">
|
|
|
+ <el-carousel-item v-for="(item, carouselindex) in v.ChannelLats">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="16" >
|
|
|
+ <div style="font-size: 14px; font-weight: 600;height:18px;">
|
|
|
+ <router-link :to="'/devices/chart/'+item.Serial+'_'+item.DataItem+'?xn='+item.Title">
|
|
|
+ <div style="float: left;width:75%;color:#24313C" :title="item.Title">传感器: {{item.Title}}</div>
|
|
|
+ </router-link>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" >
|
|
|
+ <div style="float: right">
|
|
|
+ <!-- <i class="icon icon-stop2" style="color:#FF4949;" v-if="item.DState === 2" :title="$t('message.index.offline')"></i>
|
|
|
+ <i class="icon icon-stop2" style="color:#7FFF00;" v-if="item.DState === 1" :title="$t('message.index.online')"></i> -->
|
|
|
+ <router-link :to="'/devices/chart/'+item.Serial+'_'+item.DataItem+'?xn='+item.Title+'&ma='+v.Equipment.MaxValue+'&mi='+v.Equipment.MinValue">
|
|
|
+ <a>数据曲线</a>
|
|
|
+ <!-- <i class="icon icon-stats-dots chartico" style="margin:0" :title="$t('message.equipment.curve')"></i> -->
|
|
|
+ </router-link>
|
|
|
+ <b>|</b>
|
|
|
+ <router-link :to="'/devices/gps/'+item.Serial+'_'+item.DataItem" >
|
|
|
+ <!-- v-if="contains(havegps,item.DataItem)" -->
|
|
|
+ <a>路线轨迹</a>
|
|
|
+ <!-- <i class="icon icon-location2 chartico" style="margin:0" :title="$t('message.equipment.Map')"></i> -->
|
|
|
+ </router-link>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="2" style="margin-top:5px;">
|
|
|
+ <el-col :span="8" v-if="contains(havetemp,item.DataItem)">
|
|
|
+ <div class="indgrid-content temperaturecolcor" style="margin:5px;">
|
|
|
+ {{ $t('message.index.temperature') }}
|
|
|
+ <!-- <hr class="indcontenthr" /> -->
|
|
|
+ <div class="indata" >{{item.Temp}}</div>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(havehum,item.DataItem)">
|
|
|
+ <div class="indgrid-content contenthum" style="margin:5px">
|
|
|
+ {{ $t('message.index.humidity') }}
|
|
|
+ <!-- <hr class="indcontenthr" /> -->
|
|
|
+ <div class="indata">{{item.Hum}}</div>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(haveo2,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ O2 %
|
|
|
+ <hr class="contenthr" /> {{item.O2}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(haveco2,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ CO2 %
|
|
|
+ <hr class="contenthr" /> {{item.Co2}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(windspeed,item.DataItem)">
|
|
|
+ <div class="grid-content contentwindspeed">
|
|
|
+ {{ $t('message.index.wind') }}
|
|
|
+ <hr class="contenthr" /> {{item.WindSpeed}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(ots,item.DataItem)">
|
|
|
+ <div class="grid-content contentpressure">
|
|
|
+ Pa
|
|
|
+ <hr class="contenthr" /> {{item.Ots}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(doorlock,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ 门禁
|
|
|
+ <hr class="contenthr" /> {{item.Doorlock}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(displacement,item.DataItem)">
|
|
|
+ <div class="grid-content contentpressure">
|
|
|
+ Pa
|
|
|
+ <hr class="contenthr" /> {{item.Displacement}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(pressure,item.DataItem)">
|
|
|
+ <div class="grid-content contentpressure">
|
|
|
+ {{ $t('message.index.pressure') }}
|
|
|
+ <hr class="contenthr" /> {{item.Pressure}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(clo2,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ ClO2
|
|
|
+ <hr class="contenthr" /> {{item.ClO2}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(h2o,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ us/cm
|
|
|
+ <hr class="contenthr" /> {{item.H2O}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(so2,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ SO2 ppm
|
|
|
+ <hr class="contenthr" /> {{item.SO2}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(c2h4,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ C2H4
|
|
|
+ <hr class="contenthr" /> {{item.C2H4}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(c2h2,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ C2H2
|
|
|
+ <hr class="contenthr" /> {{item.C2H2}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(cl2,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ Cl2
|
|
|
+ <hr class="contenthr" /> {{item.Cl2}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(o3,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ O3
|
|
|
+ <hr class="contenthr" /> {{item.O3}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(tvoc,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ TVOC
|
|
|
+ <hr class="contenthr" /> {{item.TVOC}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(havepower,item.DataItem)">
|
|
|
+ <div class="grid-content contentpw">
|
|
|
+ {{ $t('message.index.power') }}
|
|
|
+ <hr class="contenthr" /> {{item.Power}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(havesupply,item.DataItem)">
|
|
|
+ <div class="grid-content contentvolt">
|
|
|
+ {{ $t('message.index.electric') }}
|
|
|
+ <hr class="contenthr" /> {{item.Supply}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8" v-if="contains(haveliquidlevel,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ {{ $t('message.equipment.level') }}
|
|
|
+ <hr class="contenthr" /> {{item.LiquidLevel}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="5" v-if="contains(wuyuansu,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ 顶部温度
|
|
|
+ <hr class="contenthr" /> {{item.Temp}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="5" v-if="contains(wuyuansu,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ 底部温度
|
|
|
+ <hr class="contenthr" /> {{item.ThreeACVA}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="5" v-if="contains(wuyuansu,item.DataItem)">
|
|
|
+ <div class="grid-content contentwindspeed">
|
|
|
+ 液位
|
|
|
+ <hr class="contenthr" /> {{item.ThreeACVB}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="4" v-if="contains(wuyuansu,item.DataItem)">
|
|
|
+ <div class="grid-content contento2">
|
|
|
+ 腔内温度
|
|
|
+ <hr class="contenthr" /> {{item.ThreeACVC}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="5" v-if="contains(wuyuansu,item.DataItem)">
|
|
|
+ <div class="grid-content contenthum">
|
|
|
+ 腔内湿度
|
|
|
+ <hr class="contenthr" /> {{item.Hum}}
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="5">
|
|
|
+ <el-col :span="12" style="margin-top:5px">
|
|
|
+ <p v-if="item.Vol !=='0'" class="devplab">{{ $t('message.management.Sensor') }}:{{item.Vol}} V [ {{voltageinfo(item.Vol, item.DataItem)}} ]</p>
|
|
|
+ <p v-if="item.Vol =='0'" class="devplab">{{ $t('message.management.Sensor') }}:12 V [ 正常 ]</p>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" style="margin-top:5px">
|
|
|
+ <p class="devplab">{{ $t('message.management.number') }}:{{item.Serial}}</p>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" style="margin-top:-15px">
|
|
|
+ <p v-if="item.Rssi !=='0'" class="devplab" style="height:15px;overflow:hidden;">{{ $t('message.management.signal') }}:{{item.Rssi}} [{{rssiinfo(item.Rssi)}}] </p>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" style="margin-top:-15px">
|
|
|
+ <p v-if="item.Rssi !=='0'" class="devplab" style="height:15px;overflow:hidden;"> {{ $t('message.equipment.internet') }}:{{item.Signal}} [{{signalinfo(item.Signal)}}]</p>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" style="margin-top:-15px">
|
|
|
+ <p v-if="item.Rssi =='0'" class="devplab" style="height:15px;overflow:hidden;">{{ $t('message.management.signal') }}:-- [-] </p>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" style="margin-top:-12px">
|
|
|
+ <p v-if="item.Rssi =='0'" class="devplab" style="height:15px;overflow:hidden;"> {{ $t('message.equipment.internet') }}:{{item.Signal}} [{{signalinfo(item.Signal)}}]</p>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" style="margin-top:-12px;">
|
|
|
+ <p class="devplab" >{{ $t('message.equipment.Update') }}:{{item.Time}}</p>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" style="margin-top:-15px">
|
|
|
+ <p class="devplab">传感器状态:
|
|
|
+ <el-tag type="success" v-if="item.DState === 1">在线</el-tag>
|
|
|
+ <el-tag type="danger" v-if="item.DState === 2">离线</el-tag>
|
|
|
+ </p>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <div>
|
|
|
+ <el-row gutter="0">
|
|
|
+ <el-col span="6">
|
|
|
+ <el-button style="width:100%;color:#409EFF;font-weight:bold;" size="mini" @click="editChannel(item,index,carouselindex,v.Equipment.Code,v.Equipment.MaxValue,v.Equipment.MinValue )">{{ $t('message.edit') }}</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col span="6">
|
|
|
+ <el-button style="width:100%;color:#F56C6C;font-weight:bold;" size="mini" @click="deletedata(item.Serial,index,v.Equipment.Code)">{{ $t('message.delete') }}</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col span="6">
|
|
|
+ <el-button style="width:100%;color:#409EFF;font-weight:bold;" size="mini" @click="clickdropdown('new',item.Serial,item.DataItem,item.Title, index, carouselindex)">{{ $t('message.equipment.alarm') }}</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col span="6">
|
|
|
+ <el-button style="width:100%;color:#F56C6C;font-weight:bold;" size="mini" @click="clickdropdown('list',item.Serial,item.DataItem,item.Title, index, carouselindex)">{{ $t('message.equipment.caveat') }}
|
|
|
+ <span> [ {{item.TriggerCount}} ] </span>
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ <!-- <el-button-group >
|
|
|
+ <template v-if="permission_auth.editchannel">
|
|
|
+ <el-button type="primary" size="mini" @click="editChannel(item,index,carouselindex,v.Equipment.Code,v.Equipment.MaxValue,v.Equipment.MinValue )">{{ $t('message.edit') }}</el-button>
|
|
|
+ </template>
|
|
|
+ <template v-if="permission_auth.addchannel">
|
|
|
+ <el-button type="primary" size="mini" @click="deletedata(item.Serial,index,v.Equipment.Code)">{{ $t('message.delete') }}</el-button>
|
|
|
+ </template>
|
|
|
+ <template v-if="permission_auth.addtrigger">
|
|
|
+ <el-button type="primary" size="mini" @click="clickdropdown('new',item.Serial,item.DataItem,item.Title, index, carouselindex)">{{ $t('message.equipment.alarm') }}</el-button>
|
|
|
+ </template>
|
|
|
+ <template v-if="permission_auth.addtrigger">
|
|
|
+ <el-button type="primary" size="mini" @click="clickdropdown('list',item.Serial,item.DataItem,item.Title, index, carouselindex)">{{ $t('message.equipment.caveat') }}
|
|
|
+ <span> [ {{item.TriggerCount}} ] </span>
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template v-if="permission_auth.calibration">
|
|
|
+ <el-button v-if="!contains(havepower,item.DataItem)" type="primary" size="mini" @click="clickdropdown('adju',item.Serial,item.DataItem,item.Title, -1, -1)">{{ $t('message.equipment.calibration') }}</el-button>
|
|
|
+ </template>
|
|
|
+ </el-button-group> -->
|
|
|
+ </el-carousel-item>
|
|
|
+ </el-carousel>
|
|
|
+
|
|
|
+ </el-card>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+
|
|
|
+ <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[12, 16, 20, 24]"
|
|
|
+ :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="equipmentcurrentItemCount">
|
|
|
+ </el-pagination>
|
|
|
+
|
|
|
+ <channel-dialog @close="channelDialogCallback" :act="dialogAct" :visible.sync="datadialogVisible"></channel-dialog>
|
|
|
+ <trigger-dialog @close="triggerDialogCallback" :act="dialogAct" :visible.sync="triggerdialogVisible"></trigger-dialog>
|
|
|
+ <batchopera-dialog @close="batchoperaDialogCallback" :visible.sync="batchoperadialogVisible"></batchopera-dialog>
|
|
|
+ <equipment-dialog @close="deviceDialogCallback" :visible.sync="devicedialogVisible"></equipment-dialog>
|
|
|
+
|
|
|
+
|
|
|
+ <el-dialog :title="triggerlistdialogtitle" :visible.sync="triggerlistdialogVisible" top="5%">
|
|
|
+ <el-table :data="triggerlist">
|
|
|
+ <el-table-column :label="$t('message.equipment.condition')" width="100" show-overflow-tooltip>
|
|
|
+ <template scope="scope">
|
|
|
+ <p v-if="scope.row.Trigger.column === 'temperature'">{{ $t('message.management.temperature')}} {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'humidity'">{{ $t('message.management.humidity')}} {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'co2'">CO2 {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'o2'">O2 {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'windspeed'">{{ $t('message.management.wind') }} {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'pressure'">{{ $t('message.management.pressure') }} {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'ots'">{{ $t('message.management.ots') }} {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'doorlock'">{{ $t('message.management.doorlock') }} {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'clo2'">ClO2 {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'h2o'">H2O {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'so2'">SO2 {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'c2h4'">C2H4 {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'c2h2'">C2H2 {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'cl2'">Cl2 {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'o3'">O3 {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'tvoc'">TVOC {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'voltage'">{{ $t('message.management.power') }} {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'electricalpower'">{{ $t('message.management.power') }} {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'electricalsupply'">{{ $t('message.equipment.electric') }}</p>
|
|
|
+ <p v-if="scope.row.Trigger.column === 'liquidlevel'">{{ $t('message.management.level') }} {{scope.row.Trigger.itemname}} {{scope.row.Trigger.value}}</p>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('message.abnormalsetting.Item')" prop="ANames" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column :label="$t('message.equipment.strategy')" width="100" show-overflow-tooltip>
|
|
|
+ <template scope="scope">
|
|
|
+ <p v-if="scope.row.Trigger.etype === 1">{{ $t('message.equipment.No') }}</p>
|
|
|
+ <p v-if="scope.row.Trigger.etype === 2">{{ $t('message.equipment.abnormality') }} {{scope.row.Trigger.count}} 次</p>
|
|
|
+ <p v-if="scope.row.Trigger.etype === 3">{{ $t('message.equipment.first') }}</p>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column property="datastate" :label="$t('message.management.status')" width="130">
|
|
|
+ <template scope="scope">
|
|
|
+ <el-tag type="success" v-if="scope.row.Trigger.enabled === 1">{{ $t('message.equipment.Enable') }}</el-tag>
|
|
|
+ <el-tag type="warning" v-if="scope.row.Trigger.enabled === 0">{{ $t('message.equipment.Disable') }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="$t('message.operating')" width="130">
|
|
|
+ <template scope="scope">
|
|
|
+ <el-button @click="updateTrigger(scope.row)" type="text" size="small">{{ $t('message.edit') }}</el-button>
|
|
|
+ <el-button @click="deletetriggerdata(scope.row.Trigger.id)" type="text" size="small">{{ $t('message.delete') }}</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div slot="footer" class="dialog-footer" style="margin-top:-20px;">
|
|
|
+ <el-button @click="triggerlistdialogVisible = false">{{ $t('message.cancel') }}</el-button>
|
|
|
+ <el-button type="primary" @click="savetriggerenabled('1')">{{ $t('message.equipment.Enable') }}</el-button>
|
|
|
+ <el-button type="warning" @click="savetriggerenabled('0')">{{ $t('message.equipment.disable') }}</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog :title="adjudialogtitle" :visible.sync="adjudialogVisible" top="5%">
|
|
|
+ <el-form :model="adjuform" :rules="rulesadju" ref="adjuform">
|
|
|
+ <el-form-item :label="$t('message.equipment.Temperature')" prop="temp" label-width="120px" v-if="contains(havetemp,triggerform.dataitem)">
|
|
|
+ <el-input v-model="adjuform.temp" auto-complete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('message.equipment.Humidity')" prop="hum" label-width="120px" v-if="contains(havehum,triggerform.dataitem)">
|
|
|
+ <el-input v-model="adjuform.hum"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('message.equipment.O2')" label-width="120px" prop="o2" v-if="contains(haveo2,triggerform.dataitem)">
|
|
|
+ <el-input v-model="adjuform.o2" auto-complete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('message.equipment.CO2')" prop="co2" label-width="120px" v-if="contains(haveco2,triggerform.dataitem)">
|
|
|
+ <el-input v-model="adjuform.co2" auto-complete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="adjudialogVisible = false">{{ $t('message.cancel') }}</el-button>
|
|
|
+ <el-button type="primary" @click="saveadjuform('adjuform');">{{ $t('message.confirm') }}</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <!--编辑设备-->
|
|
|
+ <el-dialog :title="editorgantitle" :visible.sync="editorganVisible" top="5%">
|
|
|
+ <el-form :model="editequipmentform" :rules="editequipmentrules" ref="editequipmentform">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item :label="$t('message.management.Device')" label-width="120px" required prop="code">
|
|
|
+ <el-input v-model="editequipmentform.code"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('message.equipment.Brand')" label-width="120px" required>
|
|
|
+ <el-select v-model="editequipmentform.brands" :placeholder="$t('message.equipment.Choose')" @change="selectDModel" @visible-change="opendialoging = false">
|
|
|
+ <el-option v-for="item in brandoptions" :label="item.label" :value="item.value"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('message.equipment.model')" label-width="120px" required>
|
|
|
+ <el-select v-model="editequipmentform.dModel" :placeholder="$t('message.equipment.modelaa')" @change="selectPhoto" @visible-change="handleVisible">
|
|
|
+ <el-option v-for="item in modeloptions" :label="item.label" :value="item.value"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12" style="text-align: center">
|
|
|
+ <img :src="photoUrl" style="width: 120px; height: 110px">
|
|
|
+ <div>{{spareData}}</div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item :label="$t('message.sgmanage.OrganizeName')" label-width="120px" required>
|
|
|
+ <el-cascader :options="orgtreelist" :props="orgtreeprops" change-on-select :show-all-levels="false" v-model="editequselectedorg"
|
|
|
+ :placeholder="$t('message.equipment.select')" :disabled="!permission_auth.edit_org"></el-cascader>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item :label="$t('message.equipment.equipment')" label-width="120px" required>
|
|
|
+ <el-select v-model="equipmentstate" :placeholder="$t('message.equipment.rolechange')">
|
|
|
+ <el-option :label="$t('message.management.normal')" value="1"></el-option>
|
|
|
+ <el-option :label="$t('message.triggerinfos.service')" value="2"></el-option>
|
|
|
+ <el-option :label="$t('message.equipment.Disable')" value="3"></el-option>
|
|
|
+ <el-option :label="$t('message.triggerinfos.Defrost')" value="4"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="editorganVisible = false">{{ $t('message.cancel') }}</el-button>
|
|
|
+ <el-button type="primary" @click="saveeditequipmentform()">{{ $t('message.confirm') }}</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import ChannelDialog from '../../components/devices/channel_dialog'
|
|
|
+ import TriggerDialog from '../../components/devices/trigger_dialog'
|
|
|
+ import EquipmentsortDialog from '../../components/devices/equipmentsort_dialog'
|
|
|
+ import BatchoperaDialog from '../../components/devices/batchopera_dialog'
|
|
|
+ import EquipmentDialog from '../../components/devices/equipment_dialog'
|
|
|
+ import {
|
|
|
+ mapGetters
|
|
|
+ } from 'vuex'
|
|
|
+ export default {
|
|
|
+ name: 'equipment',
|
|
|
+ components: {
|
|
|
+ ChannelDialog,
|
|
|
+ TriggerDialog,
|
|
|
+ EquipmentsortDialog,
|
|
|
+ BatchoperaDialog,
|
|
|
+ EquipmentDialog
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ var checktriggercvalue = (rule, value, callback) => {
|
|
|
+ if (!isNaN(parseFloat(value)) && !isNaN(value)) {
|
|
|
+ callback()
|
|
|
+ } else {
|
|
|
+ callback(new Error(this.$t('message.equipment.numeric')))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ remoteurl: 'http://47.92.238.200:8081',
|
|
|
+ addnew: false,
|
|
|
+ currentItemCount: 0,
|
|
|
+ currentItemCount3: 0,
|
|
|
+ equipmentcurrentItemCount: 0, // 设备列表总数
|
|
|
+ currentPage: 1,
|
|
|
+ size: 12,
|
|
|
+ list: [],
|
|
|
+ isnodata: false,
|
|
|
+ loading: false,
|
|
|
+ havetemp: '0,6,7,9,10,14,15,16',
|
|
|
+ havehum: '0,7,9,14,16',
|
|
|
+ haveo2: '17',
|
|
|
+ haveco2: '9,26',
|
|
|
+ windspeed: '18',
|
|
|
+ pressure: '19',
|
|
|
+ ots: '29',
|
|
|
+ doorlock: '31',
|
|
|
+ wuyuansu: '32',
|
|
|
+ displacement: '30',
|
|
|
+ clo2: '20',
|
|
|
+ h2o: '27',
|
|
|
+ so2: '28',
|
|
|
+ c2h4: '21',
|
|
|
+ c2h2: '25',
|
|
|
+ cl2: '22',
|
|
|
+ o3: '23',
|
|
|
+ tvoc: '24',
|
|
|
+ havepower: '13',
|
|
|
+ havesupply: '13',
|
|
|
+ havevol: '0,6,7,9,10',
|
|
|
+ haveliquidlevel: '15',
|
|
|
+ havegps: '16',
|
|
|
+ itemiss1: '0,10',
|
|
|
+ keyword: '',
|
|
|
+ dialogAct: 'new',
|
|
|
+ datadialogVisible: false,
|
|
|
+ operatingindex: -1, // 传感器编辑索引
|
|
|
+ triggerform: {
|
|
|
+ column: 'temperature',
|
|
|
+ item: '1',
|
|
|
+ value: '',
|
|
|
+ aid: [],
|
|
|
+ etype: '1',
|
|
|
+ count: '2',
|
|
|
+ rangeweek: ['1', '2', '3', '4', '5', '6', '7'],
|
|
|
+ rangetime: [0, 48],
|
|
|
+ enabled: '1',
|
|
|
+ content: this.$t('message.Your'),
|
|
|
+ dataitem: '',
|
|
|
+ serial: '',
|
|
|
+ title: '',
|
|
|
+ operatingitem: 0,
|
|
|
+ id: 0
|
|
|
+ },
|
|
|
+ triggerdialogVisible: false,
|
|
|
+ triggerlistdialogtitle: '',
|
|
|
+ triggerlistdialogVisible: false,
|
|
|
+ triggerlist: [],
|
|
|
+ adjudialogtitle: '',
|
|
|
+ adjudialogVisible: false,
|
|
|
+ adjuform: {
|
|
|
+ temp: '0',
|
|
|
+ hum: '0',
|
|
|
+ co2: '0',
|
|
|
+ o2: '0',
|
|
|
+ windspeed: '0',
|
|
|
+ pressure: '0',
|
|
|
+ ots: '0',
|
|
|
+ doorlock: '0',
|
|
|
+ displacement: '0',
|
|
|
+ clo2: '0',
|
|
|
+ h2o: '0',
|
|
|
+ so2: '0',
|
|
|
+ c2h4: '0',
|
|
|
+ c2h2: '0',
|
|
|
+ cl2: '0',
|
|
|
+ o3: '0',
|
|
|
+ tvoc: '0'
|
|
|
+ },
|
|
|
+ rulesadju: {
|
|
|
+ temp: [{
|
|
|
+ validator: checktriggercvalue,
|
|
|
+ trigger: 'blur'
|
|
|
+ }],
|
|
|
+ hum: [{
|
|
|
+ validator: checktriggercvalue,
|
|
|
+ trigger: 'blur'
|
|
|
+ }],
|
|
|
+ co2: [{
|
|
|
+ validator: checktriggercvalue,
|
|
|
+ trigger: 'blur'
|
|
|
+ }],
|
|
|
+ o2: [{
|
|
|
+ validator: checktriggercvalue,
|
|
|
+ trigger: 'blur'
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ permission_auth: { // 按钮权限
|
|
|
+ add: false,
|
|
|
+ edit: false,
|
|
|
+ edit_org: false,
|
|
|
+ addchannel: false,
|
|
|
+ editchannel: false,
|
|
|
+ addtrigger: false,
|
|
|
+ calibration: false
|
|
|
+ },
|
|
|
+ batchoperadialogVisible: false,
|
|
|
+ devicelist: [], // 走马灯数据
|
|
|
+ carouselIndex: 0,
|
|
|
+ alldevicelist: [],
|
|
|
+ updated: true,
|
|
|
+ organlist: [], // 分页用
|
|
|
+ editorgantitle: '', // 新对话框,编辑组织
|
|
|
+ editorganVisible: false,
|
|
|
+ opendialoging: false,
|
|
|
+ modeloptions: [], // 2017-09-26
|
|
|
+ brandoptions: [],
|
|
|
+ photoUrl: '',
|
|
|
+ spareData: '',
|
|
|
+ equipmentstate: '1',
|
|
|
+ operatingequipmentindex: -1, // 点击编辑设备时记录修改的索引,便于修改成功后做界面更新,而不需要重新加载数据
|
|
|
+ operatingequipmentid: 0, // 编辑id
|
|
|
+ editequipmentform: {
|
|
|
+ code: '',
|
|
|
+ brands: '',
|
|
|
+ dModel: '',
|
|
|
+ organizeName: '',
|
|
|
+ organizeId: 0,
|
|
|
+ devicestate: '1',
|
|
|
+ title: '',
|
|
|
+ serial: '',
|
|
|
+ about: '',
|
|
|
+ modelid: 0
|
|
|
+ },
|
|
|
+ editequipmentrules: {
|
|
|
+ code: [{
|
|
|
+ required: true,
|
|
|
+ message: this.$t('message.equipment.name'),
|
|
|
+ trigger: 'blur'
|
|
|
+ }],
|
|
|
+ organizeId: [{
|
|
|
+ required: true,
|
|
|
+ message: this.$t('message.equipment.organization'),
|
|
|
+ trigger: 'blur'
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ devicedialogVisible: false, // 添加设备对话框
|
|
|
+ equipmentlist: [],
|
|
|
+ modellist: [],
|
|
|
+ sortedModelList: [],
|
|
|
+ equipmentindex: 0, // 用来保存位置数据
|
|
|
+ channelindex: 0,
|
|
|
+ orgtreelist: [],
|
|
|
+ orgtreeprops: {
|
|
|
+ value: 'id',
|
|
|
+ label: 'Fullname',
|
|
|
+ children: 'children'
|
|
|
+ },
|
|
|
+ selectedorg: [],
|
|
|
+ editequselectedorg: [],
|
|
|
+ mess: '',
|
|
|
+ me: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ created() {
|
|
|
+ this.getpermissions()
|
|
|
+ this.initData()
|
|
|
+ this.getBrands()
|
|
|
+ this.getorgtreelist()
|
|
|
+ let _this = this
|
|
|
+ Window.equimentinterval = setInterval(function () {
|
|
|
+ _this.loaddataall()
|
|
|
+ }, 120000)
|
|
|
+ },
|
|
|
+ updated() {
|
|
|
+ if (this.currentItemCount !== 0 && this.currentItemCount3 !== 0 && this.updated) {
|
|
|
+ this.updated = false
|
|
|
+ this.handleCarousel()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: mapGetters({
|
|
|
+ session: 'session'
|
|
|
+ }),
|
|
|
+ methods: {
|
|
|
+ initData() {
|
|
|
+ // toggle loading
|
|
|
+ // this.loading = true
|
|
|
+ let _this = this
|
|
|
+ const params = {
|
|
|
+ _currentPage: this.currentPage,
|
|
|
+ _size: this.size,
|
|
|
+ keyword: this.keyword,
|
|
|
+ selected: this.selectedorg[this.selectedorg.length - 1]
|
|
|
+ }
|
|
|
+ // 获取设备列表equipment
|
|
|
+ this.$services.equipment.get('list', {
|
|
|
+ params
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ _this.equipmentlist = res.data.items
|
|
|
+ _this.equipmentcurrentItemCount = res.data.currentItemCount
|
|
|
+ if (_this.equipmentcurrentItemCount > 0) {
|
|
|
+ _this.isnodata = false
|
|
|
+ } else {
|
|
|
+ _this.isnodata = true
|
|
|
+ }
|
|
|
+ // 加载传感器数据
|
|
|
+ _this.loaddataall()
|
|
|
+ // 加载报警数
|
|
|
+ _this.loadtriggercountall()
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleSizeChange(value) {
|
|
|
+ this.size = value
|
|
|
+ this.currentPage = 1
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ handleCurrentChange(value) {
|
|
|
+ this.currentPage = value
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ loaddata(code, i, j) {
|
|
|
+ let _this = this
|
|
|
+ return _this.$services.channel.get('datavalue/' + code, null)
|
|
|
+ .then(res => {
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Temp = res.data.Temp
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Hum = res.data.Hum
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Vol = res.data.Vol
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Rssi = res.data.Rssi
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Time = res.data.Time
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].O2 = res.data.O2
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Co2 = res.data.Co2
|
|
|
+ if (res.data.Doorlock === '0') {
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Doorlock = '关闭'
|
|
|
+ } else {
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Doorlock = '开启'
|
|
|
+ }
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].WindSpeed = res.data.WindSpeed
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Pressure = res.data.Pressure
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].ClO2 = res.data.ClO2
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].H2O = res.data.H2O
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].SO2 = res.data.SO2
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].C2H4 = res.data.C2H4
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].C2H2 = res.data.C2H2
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Cl2 = res.data.Cl2
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].O3 = res.data.O3
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].TVOC = res.data.TVOC
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Power = res.data.Power
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Supply = res.data.Supply
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].DState = res.data.DState
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].Signal = res.data.Signal
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].LiquidLevel = res.data.LiquidLevel
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].ThreeACVA = res.data.ThreeACVA
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].ThreeACVB = res.data.ThreeACVB
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].ThreeACVC = res.data.ThreeACVC
|
|
|
+ })
|
|
|
+ },
|
|
|
+ loaddataall() {
|
|
|
+ for (let i = 0; i < this.equipmentlist.length; i++) {
|
|
|
+ for (let j = 0; j < this.equipmentlist[i].ChannelLats.length; j++) {
|
|
|
+ this.loaddata(this.equipmentlist[i].ChannelLats[j].Serial, i, j)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ contains(strs, str) {
|
|
|
+ let arrs = strs.split(',')
|
|
|
+ for (let v in arrs) {
|
|
|
+ if (arrs[v] === (str + '')) return true
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ },
|
|
|
+ seachdata() {
|
|
|
+ this.currentPage = 1
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ deletedata(code, index, equipmentcode) {
|
|
|
+ let _this = this
|
|
|
+ // var confirmtext = '此操作将永久删除该传感器所有数据, 是否继续?'
|
|
|
+ let confirmtype = 'warning'
|
|
|
+ if (_this.equipmentlist[index].ChannelLats.length < 2) {
|
|
|
+ // confirmtext = `此操作将永久删除该传感器所有数据,同时会删除设备【${equipmentcode}】的所有数据, 是否继续?`
|
|
|
+ confirmtype = 'error'
|
|
|
+ }
|
|
|
+ _this.$confirm(this.$t('message.warn'), this.$t('message.prompt'), {
|
|
|
+ confirmButtonText: this.$t('message.submit'),
|
|
|
+ cancelButtonText: this.$t('message.cancel'),
|
|
|
+ type: confirmtype
|
|
|
+ }).then(() => {
|
|
|
+ _this.$services.channel.delete(code, null)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ this.deletedata2(code)
|
|
|
+ // 更新界面
|
|
|
+ this.initData()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ // 增加传感器
|
|
|
+ newChannel(id, code) {
|
|
|
+ let _this = this
|
|
|
+ _this.dialogAct = 'new'
|
|
|
+ let packnew = {
|
|
|
+ equipid: id,
|
|
|
+ title: code
|
|
|
+ }
|
|
|
+ _this.$store.dispatch('deviceNewModel', packnew)
|
|
|
+ _this.datadialogVisible = true
|
|
|
+ },
|
|
|
+ // 编辑传感器
|
|
|
+ editChannel(v, index, carouselindex, ecode, maxValue, minValue) {
|
|
|
+ // 记录索引便于界面更新
|
|
|
+ this.operatingequipmentindex = index
|
|
|
+ this.operatingindex = carouselindex
|
|
|
+ this.dialogAct = 'edit'
|
|
|
+ let packnew = {
|
|
|
+ title: v.Title,
|
|
|
+ Serial: v.Serial,
|
|
|
+ equipmentCode: ecode,
|
|
|
+ MaxValue: maxValue,
|
|
|
+ MinValue: minValue
|
|
|
+ }
|
|
|
+ this.$store.dispatch('deviceEditModel', packnew)
|
|
|
+ this.datadialogVisible = true
|
|
|
+ },
|
|
|
+ // 传感器编辑保存数据回调
|
|
|
+ channelDialogCallback(ack) {
|
|
|
+ if (ack === 'new') {
|
|
|
+ this.initData() // 实现及时更新id功能,待优化与测试
|
|
|
+ } else {
|
|
|
+ // 更新界面
|
|
|
+ // 上传更新数据
|
|
|
+ this.$services.channel.put('/' + this.$store.state.devices.deviceModel.serial, this.$store.state.devices.deviceModel)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ this.adjudialogVisible = false
|
|
|
+ this.initData()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 计算射频信号
|
|
|
+ rssiinfo(value) {
|
|
|
+ if (value === '') {
|
|
|
+ return '--'
|
|
|
+ }
|
|
|
+ if (value > -70) {
|
|
|
+ return this.$t('message.alerts.Strong')
|
|
|
+ } else if (value > -90) {
|
|
|
+ return this.$t('message.alerts.general')
|
|
|
+ } else {
|
|
|
+ return this.$t('message.alerts.weak')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 计算网络信号
|
|
|
+ signalinfo(value) {
|
|
|
+ if (value === '') {
|
|
|
+ return '--'
|
|
|
+ }
|
|
|
+ if (value > 20) {
|
|
|
+ return this.$t('message.alerts.Strong')
|
|
|
+ } else if (value > 15) {
|
|
|
+ return this.$t('message.alerts.general')
|
|
|
+ } else {
|
|
|
+ return this.$t('message.alerts.weak')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 计算电量
|
|
|
+ voltageinfo(value, item) {
|
|
|
+ // if (this.contains(this.itemiss1, item)) {
|
|
|
+ if (value < 2.6) {
|
|
|
+ return '低电'
|
|
|
+ } else {
|
|
|
+ return '正常'
|
|
|
+ }
|
|
|
+ // } else {
|
|
|
+ // if (value < 3.6) {
|
|
|
+ // return 0
|
|
|
+ // } else if (value < 4.1) {
|
|
|
+ // return parseInt((value - 3.6) * 100 / 0.5)
|
|
|
+ // } else {
|
|
|
+ // return 100
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ resetForm(formName) {
|
|
|
+ this.$refs[formName].resetFields()
|
|
|
+ },
|
|
|
+ clickdropdown(command, serial, dataitem, title, index, carouselindex) {
|
|
|
+ // 记录索引便于界面更新
|
|
|
+ this.operatingequipmentindex = index
|
|
|
+ this.operatingindex = carouselindex
|
|
|
+ this.triggerform.serial = serial
|
|
|
+ this.triggerform.dataitem = dataitem
|
|
|
+ this.triggerform.title = title
|
|
|
+ let value = {
|
|
|
+ serial: serial,
|
|
|
+ dataitem: dataitem,
|
|
|
+ title: title
|
|
|
+ }
|
|
|
+ this.$store.dispatch('triggerSetDeviceModel', value)
|
|
|
+ if (command === 'new') { // 新建报警
|
|
|
+ this.dialogAct = 'new'
|
|
|
+ // this.triggerform.operatingitem = 1
|
|
|
+ // 初始值
|
|
|
+ let column
|
|
|
+ if (this.contains(this.havepower, dataitem)) {
|
|
|
+ column = 'electricalpower'
|
|
|
+ } else {
|
|
|
+ column = 'temperature'
|
|
|
+ }
|
|
|
+ // 新修改,即时修改报警项目数
|
|
|
+ var triggerpack = {
|
|
|
+ index: index,
|
|
|
+ cindex: carouselindex,
|
|
|
+ column: column
|
|
|
+ }
|
|
|
+ this.$store.dispatch('triggerNewModel', triggerpack)
|
|
|
+ this.triggerdialogVisible = true
|
|
|
+ } else if (command === 'list') {
|
|
|
+ this.opentriggerlist()
|
|
|
+ } else if (command === 'adju') {
|
|
|
+ // this.adjudialogtitle = `传感器校准设置(${this.triggerform.title})`
|
|
|
+ this.mess = this.$t('message.triggerinfos.processing')
|
|
|
+ this.adjudialogtitle = this.mess + `${this.triggerform.title}`
|
|
|
+ this.$services.channel.get('adjudata/' + this.triggerform.serial, null)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ this.adjuform.temp = res.data.CalibrationValue + ''
|
|
|
+ this.adjuform.hum = res.data.CalibrationHumidity + ''
|
|
|
+ this.adjuform.co2 = res.data.CalibrationCO2 + ''
|
|
|
+ this.adjuform.o2 = res.data.CalibrationO2 + ''
|
|
|
+ this.adjuform.windspeed = res.data.WindSpeed + ''
|
|
|
+ this.adjuform.displacement = res.data.Displacement + ''
|
|
|
+ this.adjuform.pressure = res.data.Pressure + ''
|
|
|
+ this.adjuform.ots = res.data.Ots + ''
|
|
|
+ this.adjuform.doorlock = res.data.Doorlock + ''
|
|
|
+ this.adjuform.clo2 = res.data.ClO2 + ''
|
|
|
+ this.adjuform.h2o = res.data.H2O + ''
|
|
|
+ this.adjuform.so2 = res.data.SO2 + ''
|
|
|
+ this.adjuform.c2h4 = res.data.C2H4 + ''
|
|
|
+ this.adjuform.c2h2 = res.data.C2H2 + ''
|
|
|
+ this.adjuform.cl2 = res.data.Cl2 + ''
|
|
|
+ this.adjuform.o3 = res.data.O3 + ''
|
|
|
+ this.adjuform.tvoc = res.data.TVOC + ''
|
|
|
+ this.adjudialogVisible = true
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ opentriggerlist() {
|
|
|
+ this.triggerlistdialogVisible = true
|
|
|
+ this.me = this.$t('message.triggerinfos.processing')
|
|
|
+this.triggerlistdialogtitle = this.me + `(${this.triggerform.title})`
|
|
|
+ // this.triggerlistdialogtitle = `报警设置列表(${this.triggerform.title})`
|
|
|
+ this.$services.trigger.get('list/' + this.triggerform.serial, null)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ this.triggerlist = res.data.items
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ gettriggercount(code, i, j) {
|
|
|
+ let _this = this
|
|
|
+ _this.$services.trigger.get('count/' + code, null)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ _this.equipmentlist[i].ChannelLats[j].TriggerCount = res.data.message
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ loadtriggercountall() {
|
|
|
+ for (let i = 0; i < this.equipmentlist.length; i++) {
|
|
|
+ for (let j = 0; j < this.equipmentlist[i].ChannelLats.length; j++) {
|
|
|
+ this.gettriggercount(this.equipmentlist[i].ChannelLats[j].Serial, i, j)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ savetriggerenabled(enabled) {
|
|
|
+ let _this = this
|
|
|
+ let enabledstr = enabled === '1' ? this.$t('message.equipment.Enable') : this.$t('message.equipment.enabled')
|
|
|
+ _this.$confirm(this.$t('message.equipment.whether') + enabledstr + this.$t('message.equipment.this'), this.$t('message.prompt'), {
|
|
|
+ confirmButtonText: this.$t('message.submit'),
|
|
|
+ cancelButtonText: this.$t('message.cancel'),
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ _this.triggerform.enabled = enabled
|
|
|
+ _this.$services.trigger.put('setenabled', _this.triggerform)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ // 更新界面
|
|
|
+ _this.opentriggerlist()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ updateTrigger(val) {
|
|
|
+ this.$store.dispatch('triggerEditModel', val)
|
|
|
+ this.dialogAct = 'edit'
|
|
|
+ this.triggerdialogVisible = true
|
|
|
+ },
|
|
|
+ triggerDialogCallback(ack) {
|
|
|
+ let _this = this
|
|
|
+ if (ack === 'new') {
|
|
|
+ _this.equipmentlist[_this.operatingequipmentindex].ChannelLats[_this.operatingindex].TriggerCount = (parseInt(
|
|
|
+ _this.equipmentlist[_this.operatingequipmentindex].ChannelLats[_this.operatingindex].TriggerCount) + 1) +
|
|
|
+ ''
|
|
|
+ } else if (ack === 'edit') {
|
|
|
+ // 更新报警列表
|
|
|
+ this.opentriggerlist()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deletetriggerdata(id) {
|
|
|
+ let _this = this
|
|
|
+ _this.$confirm(this.$t('message.warn'), this.$t('message.prompt'), {
|
|
|
+ confirmButtonText: this.$t('message.submit'),
|
|
|
+ cancelButtonText: this.$t('message.cancel'),
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ _this.$services.trigger.delete(id, null)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ // 更新界面
|
|
|
+ _this.equipmentlist[_this.operatingequipmentindex].ChannelLats[_this.operatingindex].TriggerCount =
|
|
|
+ (parseInt(_this.equipmentlist[_this.operatingequipmentindex].ChannelLats[_this.operatingindex].TriggerCount) -
|
|
|
+ 1) + ''
|
|
|
+ _this.opentriggerlist()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ deletetriggerdata2(id) {
|
|
|
+ let _this = this
|
|
|
+ _this.$services.trigger.delete(id, null)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ console.log('-------idididid------', id)
|
|
|
+ // 更新界面
|
|
|
+ _this.equipmentlist[_this.operatingequipmentindex].ChannelLats[_this.operatingindex].TriggerCount =
|
|
|
+ (parseInt(_this.equipmentlist[_this.operatingequipmentindex].ChannelLats[_this.operatingindex].TriggerCount) -
|
|
|
+ 1) + ''
|
|
|
+ // _this.opentriggerlist()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ },
|
|
|
+ saveadjuform(formName) {
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.$services.channel.put('adjudata/' + this.triggerform.serial, this.adjuform)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ this.adjudialogVisible = false
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getpermissions() {
|
|
|
+ // 界面需要的权限
|
|
|
+ let percodes =
|
|
|
+ `'perm.equ.add','perm.equ.edit','perm.equ.edit.org','perm.equ.addchannel','perm.equ.editchannel','perm.equ.addtrigger','perm.equ.calibration'`
|
|
|
+ const params = {
|
|
|
+ percodes: percodes
|
|
|
+ }
|
|
|
+ let _this = this
|
|
|
+ // 定义window变量,eval使用需要
|
|
|
+ let foo = window
|
|
|
+ foo.permission_auth = _this.permission_auth
|
|
|
+ // request
|
|
|
+ _this.$services.permissions.get('isauths', {
|
|
|
+ params
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ // 根据字段进行数据解析
|
|
|
+ if (res.data && res.data.length > 0) {
|
|
|
+ res.data.forEach(row => {
|
|
|
+ foo.eval('permission_auth.' + row.Code.substring(9).replace('.', '_') + '=' + row.Isperm)
|
|
|
+ })
|
|
|
+ // 将数据返回界面
|
|
|
+ _this.permission_auth = foo.permission_auth
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ },
|
|
|
+ // 自定义排序
|
|
|
+ batchopera() {
|
|
|
+ this.batchoperadialogVisible = true
|
|
|
+ },
|
|
|
+ // 自定义排序保存数据回调
|
|
|
+ batchoperaDialogCallback() {
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ deviceDialogCallback(ack) {
|
|
|
+ this.initData()
|
|
|
+ },
|
|
|
+ newDevice() {
|
|
|
+ this.devicedialogVisible = true
|
|
|
+ },
|
|
|
+ handleCarousel() {
|
|
|
+ this.alldevicelist = []
|
|
|
+ for (var i = 0; i < this.equipmentlist.length; i++) {
|
|
|
+ for (var j = 0; j < this.list.length; j++) {
|
|
|
+ if (this.equipmentlist[i].Id === this.list[j].EquipMentId) {
|
|
|
+ this.devicelist.push(this.list[j])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.alldevicelist.push(this.devicelist)
|
|
|
+ this.devicelist = []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ opendeitquipmentDialog(value, index) {
|
|
|
+ let _this = this
|
|
|
+ this.$services.organizes.get('parentlist/' + value.OrganizeId, {})
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.operatingequipmentindex = index // 记录索引,更新界面使用
|
|
|
+ _this.modeloptions = []
|
|
|
+ _this.operatingequipmentid = value.Id
|
|
|
+ _this.editorganVisible = true
|
|
|
+ _this.opendialoging = true
|
|
|
+ _this.equipmentstate = value.DeviceState + '' // 设备类型的中间变量
|
|
|
+ _this.dd = this.$t('message.equipment.edit')
|
|
|
+ _this.editorgantitle = _this.dd + ' (' + value.Code + ')'
|
|
|
+ _this.editequipmentform.code = value.Code
|
|
|
+ _this.editequipmentform.brands = value.Brands
|
|
|
+ _this.editequipmentform.dModel = value.DModel
|
|
|
+ _this.editequipmentform.organizeId = value.OrganizeId
|
|
|
+ _this.editequipmentform.organizeName = value.OrganizeName
|
|
|
+ _this.editequipmentform.devicestate = value.DeviceState
|
|
|
+ _this.selectPhoto(value.DModel)
|
|
|
+ // 选中状态
|
|
|
+ _this.editequselectedorg = []
|
|
|
+ let pidarr = res.data.message.split(',')
|
|
|
+ for (var i = pidarr.length - 1; i >= 0; i--) {
|
|
|
+ if (pidarr[i] !== '0') {
|
|
|
+ _this.editequselectedorg.push(parseInt(pidarr[i]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: this.$t('message.equipment.error')
|
|
|
+ })
|
|
|
+ this.datadialogVisible = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ saveeditequipmentform() {
|
|
|
+ let _this = this
|
|
|
+ this.$refs['editequipmentform'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ // 所属组织赋值
|
|
|
+ this.editequipmentform.organizeId = this.editequselectedorg[this.editequselectedorg.length - 1]
|
|
|
+ // 设备类型赋值
|
|
|
+ _this.editequipmentform.devicestate = parseInt(_this.equipmentstate)
|
|
|
+ _this.$services.equipment.put('equipment/' + _this.operatingequipmentid, _this.editequipmentform)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ // 更新界面
|
|
|
+ _this.equipmentlist[_this.operatingequipmentindex].Equipment.Code = _this.editequipmentform.code
|
|
|
+ _this.equipmentlist[_this.operatingequipmentindex].Equipment.Brands = _this.editequipmentform.brands
|
|
|
+ _this.equipmentlist[_this.operatingequipmentindex].Equipment.DModel = _this.editequipmentform.dModel
|
|
|
+ _this.equipmentlist[_this.operatingequipmentindex].Equipment.OrganizeId = _this.editequipmentform
|
|
|
+ .organizeId
|
|
|
+ _this.equipmentlist[_this.operatingequipmentindex].Equipment.OrganizeName = res.data.backup
|
|
|
+ _this.equipmentlist[_this.operatingequipmentindex].Equipment.DeviceState = _this.editequipmentform
|
|
|
+ .devicestate
|
|
|
+ // 关闭弹框
|
|
|
+ _this.editorganVisible = false
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 2017-09-26
|
|
|
+ selectDModel(value) {
|
|
|
+ if (!this.opendialoging) {
|
|
|
+ // toggle loading
|
|
|
+ let _this = this
|
|
|
+ this.modeloptions = []
|
|
|
+ // request
|
|
|
+ this.$services.equipment.get('dmodels/' + value, {})
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ for (var i = 0; i < res.data.items.length; i++) {
|
|
|
+ _this.modeloptions.push({
|
|
|
+ value: res.data.items[i],
|
|
|
+ label: res.data.items[i]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ _this.editequipmentform.dModel = _this.modeloptions[0].value
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ selectPhoto(value) {
|
|
|
+ let _this = this
|
|
|
+ this.$services.equipment.get('getbydmodel/' + value, {})
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ _this.photoUrl = _this.remoteurl + res.data.Photo
|
|
|
+ _this.spareData = '[' + res.data.DItemName + ' ' + res.data.SpareData + ']'
|
|
|
+ // 给modelid字段赋值,后台可以直接获取,不用再查询
|
|
|
+ _this.editequipmentform.modelid = res.data.Id
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getBrands() {
|
|
|
+ let _this = this
|
|
|
+ this.$services.equipment.get('brands', {})
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ for (var i = 0; i < res.data.items.length; i++) {
|
|
|
+ _this.brandoptions.push({
|
|
|
+ value: res.data.items[i],
|
|
|
+ label: res.data.items[i]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleVisible(status) {
|
|
|
+ this.modeloptions = []
|
|
|
+ if (status) {
|
|
|
+ let _this = this
|
|
|
+ this.$services.equipment.get('dmodels/' + _this.editequipmentform.brands, {})
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ for (var i = 0; i < res.data.items.length; i++) {
|
|
|
+ _this.modeloptions.push({
|
|
|
+ value: res.data.items[i],
|
|
|
+ label: res.data.items[i]
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deleteEquipment(code, index, v) {
|
|
|
+ let _this = this
|
|
|
+ _this.$confirm(this.$t('message.equipment.will'), this.$t('message.prompt'), {
|
|
|
+ confirmButtonText: this.$t('message.submit'),
|
|
|
+ cancelButtonText: this.$t('message.cancel'),
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ _this.$services.equipment.delete(code, null)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ if (res.data.code === 0) {
|
|
|
+ _this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ // 更新界面
|
|
|
+ this.deletedata2(v)
|
|
|
+ this.initData()
|
|
|
+ } else {
|
|
|
+ _this.$message({
|
|
|
+ type: 'warning',
|
|
|
+ message: res.data.message
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {})
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ getorgtreelist() {
|
|
|
+ let _this = this
|
|
|
+ // request
|
|
|
+ _this.$services.organizes.get('list', {})
|
|
|
+ .then(res => {
|
|
|
+ _this.orgtreelist = _this.toolfun_gettreejson(res.data.items, 'Id', 'Parentid', 'Id,Fullname')
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 删除设备连带着删除报警
|
|
|
+ deletedata2(v) {
|
|
|
+ this.$services.trigger.get('list/' + v, null)
|
|
|
+ .then(res => {
|
|
|
+ // response
|
|
|
+ // this.triggerlist = res.data.items
|
|
|
+ for (var i = 0; i < res.data.items.length; i++) {
|
|
|
+ console.log('---------ID----------', res.data.items[i].Trigger.id)
|
|
|
+ this.deletetriggerdata2(res.data.items[i].Trigger.id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ // handle error
|
|
|
+ console.error(err)
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ toolfun_gettreejson(rows, idFieldName, pidFieldName, fileds) { // 工具方法,将扁平数据转化成tree格式数据
|
|
|
+ function nodejsonexists(rows, ParentId) {
|
|
|
+ for (var i = 0; i < rows.length; i++) {
|
|
|
+ if (rows[i][idFieldName] === ParentId) {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let nodes = []
|
|
|
+ // get the top level nodes
|
|
|
+ for (let i = 0; i < rows.length; i++) {
|
|
|
+ let row = rows[i]
|
|
|
+ if (!nodejsonexists(rows, row[pidFieldName])) {
|
|
|
+ var data = {
|
|
|
+ id: row[idFieldName]
|
|
|
+ }
|
|
|
+ let arrFiled = fileds.split(',')
|
|
|
+ for (var j = 0; j < arrFiled.length; j++) {
|
|
|
+ if (arrFiled[j] !== idFieldName) {
|
|
|
+ data[arrFiled[j]] = row[arrFiled[j]]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ nodes.push(data)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let toDo = []
|
|
|
+ for (let i = 0; i < nodes.length; i++) {
|
|
|
+ toDo.push(nodes[i])
|
|
|
+ }
|
|
|
+ while (toDo.length) {
|
|
|
+ let node = toDo.shift() // the parent node
|
|
|
+ // get the children nodes
|
|
|
+ for (let i = 0; i < rows.length; i++) {
|
|
|
+ let row = rows[i]
|
|
|
+ if (row[pidFieldName] === node.id) {
|
|
|
+ let child = {
|
|
|
+ id: row[idFieldName]
|
|
|
+ }
|
|
|
+ let arrFiled = fileds.split(',')
|
|
|
+ for (let j = 0; j < arrFiled.length; j++) {
|
|
|
+ if (arrFiled[j] !== idFieldName) {
|
|
|
+ child[arrFiled[j]] = row[arrFiled[j]]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (node.children) {
|
|
|
+ node.children.push(child)
|
|
|
+ } else {
|
|
|
+ node.children = [child]
|
|
|
+ }
|
|
|
+ toDo.push(child)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return nodes
|
|
|
+ },
|
|
|
+ strsplit(str, char) { // 处理字符串,将字符串按符号分隔成数组
|
|
|
+ return str.split(char)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // https://router.vuejs.org/zh-cn/essentials/dynamic-matching.html#响应路由参数的变化
|
|
|
+ // https://router.vuejs.org/zh-cn/advanced/data-fetching.html
|
|
|
+ watch: {
|
|
|
+ $route() {
|
|
|
+ this.initData()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+<style >
|
|
|
+ .el-pagination {
|
|
|
+ margin: 1rem 0 2rem;
|
|
|
+ text-align: right;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-card__header {
|
|
|
+ background:#2b3b49;
|
|
|
+ color:#FFF;
|
|
|
+ }
|
|
|
+
|
|
|
+ .devplab {
|
|
|
+ font-size: 13px;
|
|
|
+ color: #424242;
|
|
|
+ }
|
|
|
+ .el-card__body {
|
|
|
+ padding: 15px 20px 0px 20px
|
|
|
+ }
|
|
|
+ .bottom {
|
|
|
+ margin-top: 13px;
|
|
|
+ line-height: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .button {
|
|
|
+ padding: 0;
|
|
|
+ float: right;
|
|
|
+ }
|
|
|
+
|
|
|
+ .image {
|
|
|
+ width: 100%;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+
|
|
|
+ .clearfix:before,
|
|
|
+ .clearfix:after {
|
|
|
+ display: table;
|
|
|
+ content: "";
|
|
|
+ }
|
|
|
+
|
|
|
+ .clearfix:after {
|
|
|
+ clear: both
|
|
|
+ }
|
|
|
+
|
|
|
+ .grid-content {
|
|
|
+ height: 55px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .contenttemp {
|
|
|
+ background: #F4A460;
|
|
|
+ color: white;
|
|
|
+ text-align: center;
|
|
|
+ padding: 5px 0 5px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ .contento2 {
|
|
|
+ background: #72CB6F;
|
|
|
+ color: white;
|
|
|
+ text-align: center;
|
|
|
+ padding: 5px 0 5px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .contentwindspeed {
|
|
|
+ background: #40E0D0;
|
|
|
+ color: white;
|
|
|
+ text-align: center;
|
|
|
+ padding: 5px 0 5px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .contentpressure {
|
|
|
+ background: #000080;
|
|
|
+ color: white;
|
|
|
+ text-align: center;
|
|
|
+ padding: 5px 0 5px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .contentvolt {
|
|
|
+ background: #6984E3;
|
|
|
+ color: white;
|
|
|
+ text-align: center;
|
|
|
+ padding: 5px 0 5px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .contentpw {
|
|
|
+ background: #EDDC49;
|
|
|
+ color: white;
|
|
|
+ text-align: center;
|
|
|
+ padding: 5px 0 5px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .contenthr {
|
|
|
+ height: 2px;
|
|
|
+ border: none;
|
|
|
+ border-top: 1px dotted white;
|
|
|
+ }
|
|
|
+
|
|
|
+ .chartico {
|
|
|
+ color: #20A0FF;
|
|
|
+ margin-left: 10px;
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .devtitle {
|
|
|
+ font-weight: bold;
|
|
|
+ color: #5C5C5C;
|
|
|
+ font-family: '黑体';
|
|
|
+ font-size: 13px
|
|
|
+ }
|
|
|
+
|
|
|
+ .temperaturecolcor {
|
|
|
+ border-radius:5px;
|
|
|
+ /* background: #30c283db; */
|
|
|
+ /* background-image:url('/assets/images/avatar-default.jpg'); */
|
|
|
+ background: url('../../assets/images/1.png') center center no-repeat;
|
|
|
+ background-size:120px 80px;
|
|
|
+ color: white;
|
|
|
+ /* width: 60px; */
|
|
|
+ /* height: 60px; */
|
|
|
+ /* margin: 0px 5px 10px 0px; */
|
|
|
+ text-align: center;
|
|
|
+ padding: 15px 0px 10px 0px;
|
|
|
+ height: 55px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .contenthum {
|
|
|
+ /* background: #5FBDB7; */
|
|
|
+ border-radius:5px;
|
|
|
+ background: url('../../assets/images/2.png') center center no-repeat;
|
|
|
+ background-size:120px 80px;
|
|
|
+ color: white;
|
|
|
+ text-align: center;
|
|
|
+ padding: 15px 0px 10px 0px;
|
|
|
+ height: 55px;
|
|
|
+ /* margin: 0px 5px 5px 0px; */
|
|
|
+ }
|
|
|
+ .indata {
|
|
|
+ font-size: 18px;
|
|
|
+ margin-top: 5px;
|
|
|
+ }
|
|
|
+ p
|
|
|
+ {
|
|
|
+ white-space: nowrap;
|
|
|
+ font-size: 10px;
|
|
|
+ font-weight:bold;
|
|
|
+ }
|
|
|
+
|
|
|
+ ::-webkit-input-placeholder {
|
|
|
+ color: #7A7A7A;
|
|
|
+ }
|
|
|
+
|
|
|
+</style>
|