| | |
| | | <!-- -->
|
| | | <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' && item.flag && (item.status == 0 || item.status == 1 || item.status == 2)" 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>
|
| | |
|
| | | <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() {
|
| | | onShow() { |
| | | this.page = 1 |
| | | this.list = []
|
| | | 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就是通过扫描二维码得到的内容 |
| | | const index = decodeText.indexOf('ywid') |
| | | let pointCode = decodeText.slice(index + 5) |
| | | this.stopScan(); //关闭扫码功能 |
| | | getPointRecordByCode({ |
| | | taskId: item.id, |
| | | pointCode |
| | | }).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, |
| | |
| | | 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() |
| | | let userInfo = uni.getStorageSync('userInfo') || {} |
| | | item.flag = new Date().getTime() > time && item.userIds.indexOf(userInfo.id) > -1 |
| | | })
|
| | | this.total = res.data.total
|
| | | })
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | .scroll_Y {
|
| | | height: calc(100vh - 230rpx);
|
| | | height: calc(100vh - 130rpx);
|
| | | }
|
| | |
|
| | | .list {
|
| | | .list { |
| | | |
| | | .item {
|
| | | display: flex;
|
| | | // height: 290rpx;
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | .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> |