| | |
| | | <scroll-view scroll-y :style="{ height: useHeight, width: '100%' }" @scrolltolower="scrolltolower"> |
| | | <view class="onveMain"> |
| | | <view class="once" v-for="(item, index) in taskinfoList" :key="index"> |
| | | <view class="onve-left"> |
| | | <view class="onve-left" @click="goToDetail(item.id)"> |
| | | <!-- <view class="o-l-img"> |
| | | <image src="" mode=""></image> |
| | | </view> --> |
| | |
| | | </view> |
| | | </view> |
| | | <view class="onve-right"> |
| | | <u-button class='greens' size="mini" v-if="current == 0">开始任务</u-button> |
| | | <u-button class='greens' size="mini" v-if="current == 1">完成任务</u-button> |
| | | <u-button class='o-r-down' plain type="error" size="mini" v-if="current == 1">事件上报 |
| | | <u-button class='greens' size="mini" v-if="current == 0" @click="startTask(item)">开始任务</u-button> |
| | | <u-button class='greens' size="mini" v-if="current == 1" @click="finishTask(item)">完成任务</u-button> |
| | | <u-button class='o-r-down' plain type="error" size="mini" v-if="current == 1" @click="goToEventsReported(item.id)">事件上报 |
| | | </u-button> |
| | | </view> |
| | | </view> |
| | |
| | | |
| | | <script> |
| | | import { |
| | | getList |
| | | } from "@/api/taskinfo/list.js"; |
| | | getList,update |
| | | } from "@/api/taskinfo/taskinfo"; |
| | | export default { |
| | | data() { |
| | | return { |
| | |
| | | }, |
| | | taskinfoList: null |
| | | } |
| | | }, |
| | | onShow() { |
| | | this.getList() |
| | | }, |
| | | created() { |
| | | this.getList() |
| | |
| | | this.page.total = data.total; |
| | | this.taskinfoList = this.taskinfoList.concat(data.records) |
| | | }) |
| | | }, |
| | | // 跳转详情页 |
| | | goToDetail(id) { |
| | | uni.navigateTo({ |
| | | url: '/pages/taskinfo/detail?id=' + id |
| | | }) |
| | | }, |
| | | //任务开始事件 |
| | | startTask(item){ |
| | | uni.showModal({ |
| | | title:"提示", |
| | | content:"是否开始任务?", |
| | | success:(res)=> { |
| | | if(res.confirm){ |
| | | item.state = '1' |
| | | item.routeRange = '\'' + item.routeRange + '\'' |
| | | update(item).then(res=>{ |
| | | if(res.code == 200){ |
| | | this.page.currentPage = 1 |
| | | this.getList() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | //任务结束事件 |
| | | finishTask(item){ |
| | | uni.showModal({ |
| | | title:"提示", |
| | | content:"是否结束任务?", |
| | | success:(res)=> { |
| | | if(res.confirm){ |
| | | item.state = '2' |
| | | item.routeRange = '\'' + item.routeRange + '\'' |
| | | update(item).then(res=>{ |
| | | if(res.code == 200){ |
| | | this.page.currentPage = 1 |
| | | this.getList() |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | //事件上报 |
| | | goToEventsReported(id){ |
| | | uni.navigateTo({ |
| | | url:"/pages/eventgm/eventsReported?id="+id |
| | | }) |
| | | } |
| | | } |
| | | } |