123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <template>
- <view class="deviceRegistWrapper" ref="contentWrapper">
- <!-- 筛选框start -->
-
- <view>
- <view style="height:103px"></view>
- <view class="ding">
- <view class="cu-bar search bg-gray filter-section" style="with:50%;">
- <view class="search-form round bg-white">
- <select name="" id="" placeholder="">
- <option value="">请选择设备类型</option>
- <option value="">类型1</option>
- <option value="">类型2</option>
- </select>
- </view>
- <view class="search-form round bg-white">
- <input type="text" placeholder="选输入设备点位" confirm-type="search"></input>
- </view>
- </view>
-
- <view class="cu-bar search bg-gray filter-section">
- <view class="search-form round bg-white" style="margin-bottom:26rpx">
- <input class="" @focus="InputFocus" v-model="siteName" @blur="InputBlur" :adjust-position="false"
- type="text" placeholder="选择传输方式" confirm-type="search"></input>
- </view>
- <view class="action">
- <button class="cu-btn bg-blue round" @click="searchData()">查询</button>
- </view>
- </view>
-
-
- </view>
- </view>
-
- <!-- 筛选框end -->
- <!-- 设备注册列表start -->
- <block class="">
- <view class="processList deviceRegistList" style="height: calc(100vh - 241px);">
- <view class="cu-list menu-avatar ">
- <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''"
- v-for="(item,index) in newDeviceManage" :key="index" :data-target="'move-box-' + index">
- <checkbox-group class="block" @change="CheckboxChange">
- <view class="cu-form-group margin-top">
- <checkbox class='blue' :class="checkbox[0].checked?'checked':''"
- :checked="checkbox[0].checked?true:false" value="A"></checkbox>
- </view>
- </checkbox-group>
- <view class="cu-avatar round lg" style="background-image:url(../../static/device-icon.png)">
- </view>
- <view class="content" @longpress="showDetail(item)">
- <view class="pro-title">
- <view class="cut">{{item.title}}</view>
- </view>
- <view class="pro-des ">
- <view class="text-cut">
- {{item.des}}
- </view>
- </view>
- <view class="pro-date ">{{item.time}}</view>
-
- <view class="showDetail" v-if="item.isShow">
- <view>修改设备</view>
- <view>删除设备</view>
- </view>
- </view>
- <view class="nav-right num">
- <view class="text-grey">
- <span class="online" v-if="item.status==0">在线</span>
- <span class="offline" v-if="item.status==1">离线</span>
- <span class="error" v-if="item.status==2">故障</span>
- <text class="icon iconfont margin-right-xs margin-left-lg"></text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </block>
- <!-- 设备注册列表end -->
- <view class="share grid col-3 ">
- <view class="checkAll">
- <checkbox-group class="block" @change="CheckboxChange" style="display:inline-block">
- <view class="cu-form-group margin-top">
- <checkbox class='blue' :class="checkbox[0].checked?'checked':''"
- :checked="checkbox[0].checked?true:false" value="A"></checkbox>
- </view>
- </checkbox-group>全选
- </view>
- <view class="share-item text-center">
- <view><text class="icon iconfont margin-xs" style="color:#19A402"></text></view>
- <view @tap="goDeviceAdd()">新增</view>
- </view>
- <view class="share-item text-center">
- <view><text class="icon iconfont margin-xs" style="color:#FF0303"></text></view>
- <view>删除</view>
- </view>
- <view class="share-item text-center">
- <view><text class="icon iconfont margin-xs" style="color:#FF642E"></text></view>
- <view>导出</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import json from '../../data/json.js';
- export default {
- data() {
- return {
- checkbox: [{
- value: 'A',
- checked: false
- }],
- deviceManage: json.deviceManage,
- siteListRes: 0,
- siteName: '',
- type: '0',
- siteListData: [],
- modalName: null,
- listTouchStart: 0,
- listTouchDirection: null,
- CustomBar: this.CustomBar,
- };
- },
- onPullDownRefresh() {
- console.log('refresh');
- setTimeout(function() {
- uni.stopPullDownRefresh();
- }, 1000);
- },
- computed: {
- newDeviceManage() {
- return this.deviceManage.map(item => {
- this.$set(item, "isShow", false)
- return item
- })
- }
- },
- mounted() {
- document.addEventListener('click', (e) => {
- if (e.target.className != 'showDetail') {
- this.deviceManage.forEach(item => {
- item.isShow = false
- })
- }
- })
- },
- methods: {
-
- // 页面跳转
- goDeviceAdd() {
- alert(1)
-
- // uni.navigateTo({
- // url: '/pages/deviceDetail/deviceDetail',
- // });
- uni.navigateTo({
- url: '/pages/deviceManage/deviceAdd/deviceAdd',
- });
- },
- CheckboxChange(e) {
- var items = this.checkbox,
- values = e.detail.value;
- for (var i = 0, lenI = items.length; i < lenI; ++i) {
- items[i].checked = false;
- for (var j = 0, lenJ = values.length; j < lenJ; ++j) {
- if (items[i].value == values[j]) {
- items[i].checked = true;
- break
- }
- }
- }
- },
- // 隐藏显示
- showDetail(e) {
- // alert(1)
- // 存储点击那一项的状态
- const nowStatu = e.isShow;
- // 将每一项列表的isShow设置为false,让所有的列表都隐藏
- this.deviceManage.forEach(item => {
- item.isShow = false
- })
- // 用于再次点击该项的取反
- e.isShow = !nowStatu
- },
- InputFocus(e) {
- this.InputBottom = e.detail.height
- },
- InputBlur(e) {
- this.InputBottom = 0
- },
-
-
- }
- }
- </script>
- <style >
- .showDetail {
- position: absolute;
- background: #fff;
- box-shadow: 0 1px 6px 0 rgb(32 33 36 / 28%);
- border-radius: 10rpx;
- top: 50rpx;
- right: 47%;
- z-index: 3000000;
- font-size: 28rpx;
- }
- .showDetail view{
- padding: 0rpx 20rpx;
- }
- .showDetail view:first-child{
- border-bottom:1px solid #EDEDED;
- }
-
- </style>
|