| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- <template>
- <view>
- <view class="status_bar"></view>
- <view class="" style="position: relative;top: 40px;">
- <view style="position: fixed;z-index: 100;">
- <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="基地设备"></uni-nav-bar>
- </view>
- <view class="ass_list">
- <view class="equipment" v-for="(items,indexs) in assignments" :key="items.id" v-if="tishiTF" @click="skip(JSON.stringify(items))">
- <view class="equipment_top">
- <image :src="$imageURL+'/bigdata_app'+items.src" mode="" class="equipment_top_img"></image>
- <span class="equipment_top_name">{{items.type_name}}</span>
- </view>
- <view class="equipment_bot">
- <p class="equipment_bot_id">设备ID:{{items.d_id}}</p>
- <p class="equipment_bot_name">设备名称:{{items.device_id}}</p>
- <view class="equipment_state">在线</view>
- </view>
- </view>
- <view class="tishi" v-if="!tishiTF">
- 暂无数据
- </view>
- </view>
- </view>
- <view class="top" v-if="isTop" @click="top">
- <image :src="$imageURL+'/bigdata_app'+'/image/6209a98f0cb3b5086f2ca36152c9269.png'" mode=""></image>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- base_id: "",
- assignments: [],
- images: [{
- path: "/image/fourMoodBase/1.png",
- id: 3
- }, {
- path: "/image/fourMoodBase/5.png",
- id: 5
- }, {
- path: "/image/fourMoodBase/2.png",
- id: 6
- }, {
- path: "/image/fourMoodBase/4.png",
- id: 3
- }, {
- path: "/image/fourMoodBase/qxz.png",
- id: 5
- }, {
- path: "/image/fourMoodBase/jk.png",
- id: 6
- }, {
- path: "/image/fourMoodBase/bzy.png",
- id: 7
- },{
- path: "/image/fourMoodBase/10.png",
- id: 10
- }],
- tishiTF: false,
- isTop:false
- }
- },
- methods: {
- async ybase(id) { //获取分布位置
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=base.bases.base_map_list',
- data: {
- base_id: id
- }
- })
- this.assignments = res
- console.log(this.assignments)
- for (var i = 0; i < this.images.length; i++) {
- for (var j = 0; j < this.assignments.length; j++) {
- if (this.assignments[j].equip_type == this.images[i].id) {
- this.assignments[j].src = this.images[i].path
- }
- }
- }
- if (this.assignments.length == 0) {
- this.tishiTF = false
- } else {
- this.tishiTF = true
- }
- },
- async camera() { //设备列表
- const res = await this.$myRequest({
- url: '/api/api_gateway?method=camera.camera_manage.list_camera',
- data: {
- page_size: 1,
- }
- })
- this.accessToken = res.accessToken
- },
- clickLeft() {
- uni.navigateTo({
- url:"./index"
- })
- },
- top() {
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 500
- })
- },
- skip(items){
- console.log(items)
- var item = JSON.parse(items)
- switch (item.equip_type){
- case 5 :
- uni.navigateTo({
- url: "../environment/equipment?shebei=" + items
- })
- break
- case 6 :
- uni.navigateTo({
- url: "/pages/webview/webview?device_id=" + item.device_id + "&accessToken=" + this.accessToken
- })
- break
- case 10 :
- uni.navigateTo({
- url: '/pages/cb/xy2.0/particulars?info=' + items
- });
- break
- default:
- uni.navigateTo({
- url: '/pages/cb/equip-detail/equip-detail?info=' + items
- });
- break
- }
- }
- },
- onLoad(option) {
- this.base_id = option.id
- this.ybase(option.id)
- this.camera()
- },
- onPageScroll(e) { //nvue暂不支持滚动监听,可用bindingx代替
- if (e.scrollTop > 200) { //距离大于200时显示
- this.isTop = true
- } else { //距离小于200时隐藏
- this.isTop = false
- }
- },
- }
- </script>
- <style lang="scss">
- .ass_list {
- position: absolute;
- top: 54px;
- width: 100%;
- margin-bottom: 40px;
- .tishi {
- width: 100%;
- text-align: center;
- height: 100rpx;
- line-height: 100rpx;
- font-size: 36rpx;
- }
- .equipment {
- width: 90%;
- margin: 20rpx auto;
- box-shadow: 0 0 10rpx #bcb9ca;
- padding: 20rpx 30rpx;
- box-sizing: border-box;
- .equipment_top {
- height: 60rpx;
- width: 100%;
- border-bottom: 1px solid #dfe5ec;
- position: relative;
- .equipment_top_img {
- width: 40rpx;
- height: 40rpx;
- position: absolute;
- }
- .equipment_top_name {
- font-size: 28rpx;
- margin-left: 60rpx;
- }
- }
- .equipment_bot {
- padding: 30rpx 0;
- position: relative;
- .equipment_bot_id {
- font-weight: 700;
- font-size: 15px;
- margin-bottom: 16rpx;
- }
- .equipment_bot_name {
- font-size: 13px;
- }
- .equipment_state {
- position: absolute;
- top: 20rpx;
- right: 0;
- width: 100rpx;
- height: 100rpx;
- text-align: center;
- line-height: 100rpx;
- color: #42b983;
- }
- }
- }
- }
- .top {
- position: fixed;
- right: 30px;
- bottom: 100px;
- z-index: 100;
- image{
- width: 100rpx;
- height: 100rpx;
- }
- }
- </style>
|