| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386 |
- <template>
- <view>
- <view class="status_bar"></view>
- <view class="" style="position: relative;top: 40px;">
- <view style="position: fixed;z-index: 100;width: 100%;">
- <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="设备详情"></uni-nav-bar>
- </view>
- <view class="info">
- <view class="info_item">
- <image
- :src="eqinfo.item.is_online==1?'https://www.hnyfwlw.com:8006/bigdata_app/image/cb/onBg.png':'https://www.hnyfwlw.com:8006/bigdata_app/image/cb/offBg.png'"
- mode="" class="bgi"></image>
- <p style="font-size: 32rpx;" @click="copy(eqinfo.item.imei || eqinfo.item.device_id)">设备
- ID:{{eqinfo.item.imei || eqinfo.item.device_id}}
- <image src="https://www.hnyfwlw.com:8006/bigdata_app/image/environment/fuzhi.png" mode=""
- class="tishi"></image>
- </p>
- <p>设备名称:{{eqinfo.item.device_name?eqinfo.item.device_name:"无"}}</p>
- <p>设备型号:{{eqinfo.item.dtype}}</p>
- <p>最近上报时间:{{eqinfo.item.addtime|timeFormat()}}</p>
- <p>设备地址:{{city||eqinfo.item.address}}</p>
- </view>
- </view>
- <view class="control">
- <view class="control_item" v-if="$QueryPermission(316) || $QueryPermission(75)" @click="control">
- <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/8.png'" mode=""></image>
- <p>设备控制</p>
- </view>
- <view class="control_item" v-if="$QueryPermission(318)|| $QueryPermission(77)" @click="charts">
- <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/10.png'" mode=""></image>
- <p>历史数据</p>
- </view>
- <view class="control_item" v-if="$QueryPermission(317)|| $QueryPermission(76)" @click="sim">
- <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/9.png'" mode=""></image>
- <p>SIM卡详情</p>
- </view>
- <view class="control_item" @click="repairs">
- <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/environment/7.png'" mode=""></image>
- <p>一键报修</p>
- </view>
- </view>
- <view class="realtime">
- <p class="realtime_title">实时数据</p>
- <view class="realtime_text">
- <view class="realtime_text_item">
- <view class="realtime_text_item_info" v-for="item,index in olddatas" :key="index">
- <view class="item_info_img">
- <image :src="'https://www.hnyfwlw.com:8006/bigdata_app'+item.icon" mode=""></image>
- </view>
- <view class="item_info_text">
- <p>{{item.txt}}</p>
- <p style="margin-top: 20rpx;">{{item.value}}</p>
- </view>
- </view>
- </view>
- </view>
- <view class="realtime_tishi" v-if="!newdatesTF && !dataloadingtf">
- 暂无数据
- </view>
- <view class="realtime_tishi" v-if="dataloadingtf">
- <p class="dataloading">加载中</p>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- eqinfo: {
- item: {
- }
- },
- olddata: {},
- olddatas: [],
- newdatesTF: false, //暂无数据提示
- dataloadingtf: false, //加载中提示
- work: "",
- shujutf: false,
- kongtf: false,
- simtf: false
- }
- },
- methods: {
- modification() {
- this.olddatas = [{
- icon: '/image/cb/icon02.png',
- txt: '设备开关',
- value: this.olddata.ds,
- },
- {
- icon: '/image/cb/icon05.png',
- txt: '工作状态',
- value: this.work
- },
- {
- icon: '/image/prevention/44.png',
- txt: '电击次数',
- value: this.olddata.ct
- },
- {
- icon: '/image/prevention/33.png',
- txt: '定时时长',
- value: this.olddata.tt
- }, {
- icon: '/image/cb/icon08.png',
- txt: '环境温度(℃)',
- value: this.olddata.at == "" ? "--" : this.olddata.at
- }, {
- icon: '/image/cb/icon07.png',
- txt: '环境湿度(%)',
- value: this.olddata.ah == "" ? "--" : this.olddata.ah
- }, {
- icon: '/image/prevention/icon16.png',
- txt: '信号强度',
- value: this.olddata.csq
- }, {
- icon: '/image/prevention/100.png',
- txt: '清虫间隔(min)',
- value: this.olddata.clt_t
- }, {
- icon: '/image/prevention/101.png',
- txt: '雨控状态',
- value: this.olddata.rps
- }, {
- icon: '/image/prevention/102.png',
- txt: '温控状态',
- value: this.olddata.tps
- },
- {
- icon: '/image/prevention/105.png',
- txt: '充电电压',
- value: this.olddata.cv
- },
- {
- icon: '/image/prevention/106.png',
- txt: '电池电压',
- value: this.olddata.bv
- }
- ]
- },
- async history() { //设备列表
- var newtime = +new Date() / 1000
- var oldtime = newtime - 24 * 60 * 60
- this.dataloadingtf = true
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
- data: {
- device_type_id: 2,
- device_id: this.eqinfo.item.imei,
- start_time: parseInt(oldtime),
- end_time: parseInt(newtime)
- }
- })
- this.dataloadingtf = false
- if (res.data.length != 0) {
- this.olddata = res.data[0].d_h_t
- this.newdatesTF = true;
- this.work = this.olddata.ws;
- // if (Number(this.olddata.ws) == 0) {
- // this.work = "待机"
- // } else if (Number(this.olddata.ws) == 1) {
- // this.work = "工作"
- // } else {
- // this.work = "充电"
- // }
- } else {
- this.newdatesTF = false
- }
- this.modification()
- },
- async eqlist(id) { //搜索
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=forecast.worm_lamp.lamp_list',
- data: {
- device_type_id: 2,
- device_id: id
- }
- })
- this.eqinfo.item = res.data[0]
- this.dataloadingtf = true
- this.history()
- },
- clickLeft() {
- uni.navigateBack({
- delta: 1
- })
- },
- sim() {
- // sim卡详情
- uni.navigateTo({
- url: "./sim?id=" + this.eqinfo.item.d_id
- })
- },
- repairs() {
- console.log(this.eqinfo.item)
- var device_id = this.eqinfo.item.equip_id || this.eqinfo.item.device_id
- uni.navigateTo({
- url: "../afterSale/addafter?device_id=" + device_id + "&device_type=" + 2
- })
- },
- control() { //设备控制
- uni.navigateTo({
- url: "./control?id=" + this.eqinfo.item.d_id
- })
- },
- charts() { //历史数据
- uni.navigateTo({
- url: "./ucharts?d_id=" + this.eqinfo.item.d_id + "&imei=" + this.eqinfo.item.imei
- })
- },
- copy(item) {
- uni.setClipboardData({
- data: item,
- success: function() {
- console.log('success');
- }
- });
- },
- selectaddress(lat, lng) { //获取分布位置
- uni.request({
- type: "GET",
- url: "https://restapi.amap.com/v3/geocode/regeo?output=JSON&location=" + lng + "," + lat +
- "&key=27273b81090f78759e4057f94474516f&radius=1000&extensions=all",
- dataType: "json",
- complete: ress => {
- console.log(ress.data.regeocode.formatted_address)
- this.city = ress.data.regeocode.formatted_address
- }
- });
- },
- },
- onLoad(option) {
- this.$forceUpdate()
- this.eqinfo.item = JSON.parse(option.shebei)
- console.log(JSON.parse(option.shebei))
- this.history()
- // this.eqlist(JSON.parse(option.shebei).device_id || JSON.parse(option.shebei).imei)
- this.selectaddress(this.eqinfo.item.lat, this.eqinfo.item.lng)
- }
- }
- </script>
- <style lang="scss">
- .info {
- width: 100%;
- position: absolute;
- top: 44px;
- .info_item {
- width: 90%;
- margin: 0 auto;
- height: 260rpx;
- padding: 26rpx 50rpx;
- position: relative;
- box-sizing: border-box;
- .bgi {
- width: 100%;
- height: 260rpx;
- position: absolute;
- top: 0;
- left: 0;
- z-index: -1;
- }
- p {
- font-size: 24rpx;
- color: #FFFFFF;
- margin-bottom: 10rpx;
- .tishi {
- width: 30rpx;
- height: 30rpx;
- margin: 0rpx 0 0 20rpx;
- }
- }
- }
- }
- .control {
- width: 90%;
- position: absolute;
- top: 372rpx;
- left: 5%;
- display: flex;
- justify-content: space-between;
- text-align: center;
- padding: 0 30rpx;
- box-sizing: border-box;
- .control_item {
- width: 120rpx;
- height: 120rpx;
- image {
- width: 70rpx;
- height: 70rpx;
- }
- p {
- font-size: 24rpx;
- }
- }
- }
- .realtime {
- width: 100%;
- position: absolute;
- top: 500rpx;
- .realtime_title {
- font-weight: 700;
- width: 90%;
- margin: 0 auto;
- }
- .realtime_tishi {
- width: 90%;
- margin: 0 auto;
- text-align: center;
- font-size: 32rpx;
- padding-top: 40rpx;
- .dataloading:after {
- overflow: hidden;
- display: inline-block;
- vertical-align: bottom;
- animation: ellipsis 2s infinite;
- content: "\2026";
- }
- @keyframes ellipsis {
- from {
- width: 2px;
- }
- to {
- width: 15px;
- }
- }
- }
- .realtime_text {
- width: 90%;
- margin: 0 auto;
- .realtime_text_item {
- width: 100%;
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- margin-bottom: 50rpx;
- .realtime_text_item_info {
- width: 48%;
- box-shadow: 0 0 10rpx #bcb9ca;
- margin-top: 20rpx;
- display: flex;
- padding: 20rpx 20rpx;
- box-sizing: border-box;
- .item_info_img {
- width: 30%;
- text-align: center;
- margin-right: 30rpx;
- image {
- width: 64rpx;
- height: 64rpx;
- margin-top: 10rpx;
- }
- }
- .item_info_text {
- font-size: 24rpx;
- }
- }
- }
- }
- }
- </style>
|