renkang
2025-01-03 ccf28d1fed1aa2e5437dbe64b5133ba1cbde6ec7
h5/pages/polling/task.vue
@@ -44,18 +44,25 @@
                  <view class="line" @click="itemClick(item)">执行时间:{{ item.startDate.slice(11, 16) }} 至 {{ item.endDate.slice(11, 16) }}</view>
                  <view class="line">
                     <view @click="itemClick(item)">完成情况:{{item.finishNum || 0}}/{{item.patrolNum}}</view>
                     <view v-if="param.queryStatus == '0,1'" class="btn" @click="openSc(item)">
                     <view v-if="param.queryStatus == '0,1' && item.flag && (item.status == 0 || item.status == 1)" class="btn" @click="openSc(item)">
                        <image src="@/static/side/ic_saoma@2x.png" class="saoma" mode=""></image>
                        <view>扫码巡检</view>
                     </view>
                  </view>
               </view>
            </view>
            <view v-if="list.length == 0" class="empty_wrap">
               <image src="@/static/empty.png" mode=""></image>
               <view class="">暂无数据</view>
            </view>
         </view>
      </scroll-view>
      <!--  -->
      <!--  -->
      <view class="reader-box" @click="stopScan" v-if="isScaning">
         <view class="reader" id="reader"></view>
      </view>
   </view>
</template>
@@ -87,15 +94,16 @@
            },
            html5Qrcode: null,
            isScaning: false,
            activeItem: {}
            // activeItem: {}
         };
      },
      onLoad() {
      onShow() {
         this.page = 1
         this.list = []
         this.getList()
      },
      methods: {
         openSc(item) {
            this.activeItem = item
            this.isScaning = true;
            Html5Qrcode.getCameras().then((devices) => {
               if (devices && devices.length) {
@@ -115,7 +123,11 @@
                              pointCode: decodeText
                           }).then(ress=> {
                              if(ress.data){
                                 uni.navigateTo({
                                    url: '/pages/polling/point?id=' + ress.data.id
                                 })
                              }else{
                                 this.showToast('未匹配到巡检点,请重新扫描')
                              }
                           })
                        }
@@ -178,7 +190,11 @@
               page,
               capacity: 10
            }).then(res => {
               this.list = [...this.list, ...res.data.records]
               this.list = [...this.list, ...res.data.records]
               this.list.forEach(item => {
               let time = new Date(item.startDate).getTime()
               item.flag = new Date().getTime() > time
               })
               this.total = res.data.total
            })
         }
@@ -266,10 +282,11 @@
   }
   .scroll_Y {
      height: calc(100vh - 230rpx);
      height: calc(100vh - 130rpx);
   }
   .list {
   .list {
      .item {
         display: flex;
         // height: 290rpx;
@@ -349,4 +366,23 @@
         }
      }
   }
   .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>