|  |  | 
 |  |  |       <!--  -->
 | 
 |  |  |       <scroll-view scroll-y="true" class="scroll_Y" @scrolltolower="scrolltolower">
 | 
 |  |  |          <view class="list">
 | 
 |  |  |             <view class="item" v-for="item in list" @click="itemClick(item)">
 | 
 |  |  |                <image v-if="item.status == 0 || item.status == 1" src="@/static/side/xunjianed.png" class="icon"></image>
 | 
 |  |  |                <image v-else src="@/static/side/xunjian.png" class="icon"></image>
 | 
 |  |  |             <view class="item" v-for="item in list">
 | 
 |  |  |                <image @click="itemClick(item)" v-if="item.status == 0 || item.status == 1" src="@/static/side/xunjianed.png" class="icon"></image>
 | 
 |  |  |                <image @click="itemClick(item)" v-else src="@/static/side/xunjian.png" class="icon"></image>
 | 
 |  |  |                <view class="content">
 | 
 |  |  |                   <view class="name_wrap line">
 | 
 |  |  |                      <view class="name">{{item.planTitle}}</view>
 | 
 |  |  |                      <view class="status" :class="{
 | 
 |  |  |                      <view class="name" @click="itemClick(item)">{{item.planTitle}}</view>
 | 
 |  |  |                      <view class="status" @click="itemClick(item)" :class="{
 | 
 |  |  |                         green: item.status == 1,
 | 
 |  |  |                         red: item.status == 2,
 | 
 |  |  |                         gray: item.status == 3 || item.status == 4
 | 
 |  |  |                      }">{{statusM[item.status]}}</view>
 | 
 |  |  |                   </view>
 | 
 |  |  |                   <view class="line" v-if="item.startDate">任务日期:{{ item.startDate.slice(0, 11) }}</view>
 | 
 |  |  |                   <view class="line">执行时间:{{ item.startDate.slice(11, 16) }} 至 {{ item.endDate.slice(11, 16) }}</view>
 | 
 |  |  |                   <view class="line" @click="itemClick(item)" v-if="item.startDate">任务日期:{{ item.startDate.slice(0, 11) }}</view>
 | 
 |  |  |                   <view class="line" @click="itemClick(item)">执行时间:{{ item.startDate.slice(11, 16) }} 至 {{ item.endDate.slice(11, 16) }}</view>
 | 
 |  |  |                   <view class="line">
 | 
 |  |  |                      <view>完成情况:{{item.finishNum || 0}}/{{item.patrolNum}}</view>
 | 
 |  |  |                      <view class="btn">
 | 
 |  |  |                      <view @click="itemClick(item)">完成情况:{{item.finishNum || 0}}/{{item.patrolNum}}</view>
 | 
 |  |  |                      <view v-if="param.queryStatus == '0,1'" class="btn" @click="openSc(item)">
 | 
 |  |  |                         <image src="@/static/side/ic_saoma@2x.png" class="saoma" mode=""></image>
 | 
 |  |  |                         <view>扫码巡检</view>
 | 
 |  |  |                      </view>
 | 
 |  |  | 
 |  |  |          </view>
 | 
 |  |  |       </scroll-view>
 | 
 |  |  | 
 | 
 |  |  |       <!--  -->
 | 
 |  |  |       <!--  --> | 
 |  |  |       <!--  --> | 
 |  |  |       <view class="reader-box" @click="stopScan" v-if="isScaning"> | 
 |  |  |          <view class="reader" id="reader"></view> | 
 |  |  |       </view>
 | 
 |  |  |    </view>
 | 
 |  |  | </template>
 | 
 |  |  | 
 | 
 |  |  | <script>
 | 
 |  |  |    import {
 | 
 |  |  |       ywPatrolTaskPost
 | 
 |  |  |    } from '@/api'
 | 
 |  |  |       ywPatrolTaskPost, | 
 |  |  |       getPointRecordByCode
 | 
 |  |  |    } from '@/api' | 
 |  |  |    import { | 
 |  |  |       Html5Qrcode | 
 |  |  |    } from 'html5-qrcode';
 | 
 |  |  |    export default {
 | 
 |  |  |       data() {
 | 
 |  |  |          return {
 | 
 |  |  | 
 |  |  |                2: '已超期',
 | 
 |  |  |                3: '已完成',
 | 
 |  |  |                4: '已取消',
 | 
 |  |  |             }
 | 
 |  |  |             }, | 
 |  |  |             html5Qrcode: null, | 
 |  |  |             isScaning: false, | 
 |  |  |             // activeItem: {}
 | 
 |  |  |          };
 | 
 |  |  |       },
 | 
 |  |  |       onLoad() {
 | 
 |  |  |          this.getList()
 | 
 |  |  |       },
 | 
 |  |  |       methods: { | 
 |  |  |          openSc(item) { | 
 |  |  |             this.isScaning = true; | 
 |  |  |             Html5Qrcode.getCameras().then((devices) => { | 
 |  |  |                if (devices && devices.length) { | 
 |  |  |                   this.html5Qrcode = new Html5Qrcode('reader'); | 
 |  |  |                   this.html5Qrcode.start({ | 
 |  |  |                         facingMode: 'environment' | 
 |  |  |                      }, { | 
 |  |  |                         focusMode: 'continuous', //设置连续聚焦模式 | 
 |  |  |                         fps: 5, //设置扫码识别速度 | 
 |  |  |                         qrbox: 280 //设置二维码扫描框大小 | 
 |  |  |                      }, | 
 |  |  |                      (decodeText, decodeResult) => { | 
 |  |  |                         if (decodeText) { //这里decodeText就是通过扫描二维码得到的内容 | 
 |  |  |                            this.stopScan(); //关闭扫码功能 | 
 |  |  |                            getPointRecordByCode({ | 
 |  |  |                               taskId: item.id, | 
 |  |  |                               pointCode: decodeText | 
 |  |  |                            }).then(ress=> { | 
 |  |  |                               if(ress.data){ | 
 |  |  |                                  uni.navigateTo({ | 
 |  |  |                                     url: '/pages/polling/point?id=' + ress.data.id | 
 |  |  |                                  }) | 
 |  |  |                               }else{ | 
 |  |  |                                  this.showToast('未匹配到巡检点,请重新扫描') | 
 |  |  |                               } | 
 |  |  |                            }) | 
 |  |  |                         } | 
 |  |  |                      }, | 
 |  |  |                      (err) => { | 
 |  |  |                         // console.log(err);  //错误信息 | 
 |  |  |                      } | 
 |  |  |                   ); | 
 |  |  |                } | 
 |  |  |             }); | 
 |  |  |          }, | 
 |  |  | 			 | 
 |  |  |          stopScan() { | 
 |  |  |             console.log('停止扫码') | 
 |  |  |             this.isScaning = false; | 
 |  |  |             if (this.html5Qrcode) { | 
 |  |  |                this.html5Qrcode.stop(); | 
 |  |  |             } | 
 |  |  |          }, | 
 |  |  |          scrolltolower() { | 
 |  |  |             const { | 
 |  |  |                total, | 
 |  |  | 
 |  |  |          }
 | 
 |  |  |       }
 | 
 |  |  |    }
 | 
 |  |  |  | 
 |  |  |    .reader-box { | 
 |  |  |       position: fixed; | 
 |  |  |       top: 0; | 
 |  |  |       bottom: 0; | 
 |  |  |       left: 0; | 
 |  |  |       right: 0; | 
 |  |  |       background-color: rgba(0, 0, 0, 0.5); | 
 |  |  |    } | 
 |  |  | 	 | 
 |  |  |    .reader { | 
 |  |  |       width: 100%; | 
 |  |  |       // width: 540rpx; | 
 |  |  |       // height: 540rpx; | 
 |  |  |       position: absolute; | 
 |  |  |       top: 50%; | 
 |  |  |       left: 50%; | 
 |  |  |       transform: translate(-50%, -50%); | 
 |  |  |    } | 
 |  |  | </style> |