| | |
| | | <uni-icons color="#ccc" type="info" size="128"></uni-icons> |
| | | <view class="space">没有找到符合条件的任务</view> |
| | | </view> |
| | | <view class="position-add" @click="clickAddTask()" @touchstart='btnAddTouchStart' @touchmove='btnAddTouchMove' |
| | | <view class="position-add" @click="clickAddTask" @touchstart='btnAddTouchStart' @touchmove='btnAddTouchMove' |
| | | :style="{transform:`translate(${btnAddInfo.x}px,${btnAddInfo.y}px) scale(1)`}"> |
| | | <uni-icons class="img" type="plus-filled" size="80" color="#1890FF"></uni-icons> |
| | | </view> |
| | |
| | | showToast, |
| | | showModal, |
| | | session, |
| | | showError, |
| | | showInfo |
| | | } from "@/comm/utils.js" |
| | | import TaskItemView from "./infos/task-item.vue" |
| | | import { |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | loading:false, |
| | | ip: "", |
| | | sceneId: "", |
| | | list: [], |
| | |
| | | this.ip = option.ip || "" |
| | | this.sceneId = option.sceneId || "" |
| | | this.isPageVisible = true |
| | | |
| | | this.loadData() |
| | | this.$nextTick(()=>{ |
| | | this.loadData() |
| | | }) |
| | | |
| | | }, |
| | | onShow() { |
| | | this.isPageVisible = true |
| | |
| | | |
| | | } catch (ex) { |
| | | |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | async loadTaskList() { |
| | |
| | | const res = await tasks(this.ip) |
| | | const list = res?.data || [] |
| | | this.list = list |
| | | showToast(`装载了${list.length}任务`) |
| | | } catch (ex) { |
| | | |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | | |
| | | async timerCheckTaskGroupStatus() { |
| | | try { |
| | | if (this.isPageVisible) |
| | | await this.checkTaskGroupStatus() |
| | | // setTimeout(this.timerCheckTaskGroupStatus, 1000); |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showToast(ex) |
| | | // showError(ex).then((res)=>{ |
| | | // setTimeout(this.timerCheckTaskGroupStatus, 1000); |
| | | // }) |
| | | } finally { |
| | | setTimeout(this.timerCheckTaskGroupStatus, 1000); |
| | | setTimeout(this.timerCheckTaskGroupStatus, 1000); |
| | | } |
| | | }, |
| | | async checkTaskGroupStatus() { |
| | |
| | | } catch (ex) { |
| | | |
| | | this.taskStatus = {} |
| | | this.showError(ex) |
| | | showToast(ex) |
| | | } |
| | | }, |
| | | setTaskGroupStatus(cmdID) { |
| | |
| | | }, |
| | | clickAddTask() { |
| | | const _this = this |
| | | |
| | | uni.navigateTo({ |
| | | url: `/pages/task/add?ip=${this.ip}&title=新增任务`, |
| | | events: { |
| | |
| | | this.setTaskGroupStatus(cmdID) |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | await addTaskGroupCmd(this.ip, item.taskGroupID, this.taskStatus.taskGroupCmdID, 2) |
| | | showToast("终止任务成功") |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | showToast("未找到未开始或正在执行的子任务") |
| | | } |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | }, |
| | | |
| | |
| | | this.list = [...list] |
| | | |
| | | } catch (ex) { |
| | | this.showError(ex) |
| | | showError(ex) |
| | | } |
| | | |
| | | }, |
| | | |
| | | |
| | | showError(ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.msg == "string" ? ex.msg : typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | showModal(tip, "错误", false, "确定") |
| | | }, |
| | | } |
| | | } |
| | | </script> |