|  |  |  | 
|---|
|  |  |  | <!-- 表格和分页 --> | 
|---|
|  |  |  | <template v-slot:table-wrap> | 
|---|
|  |  |  | <ul class="toolbar" v-permissions="['business:quartz:create']"> | 
|---|
|  |  |  | <li><el-button type="primary" @click="$refs.OperaTimerWindow.open('新建任务')" icon="el-icon-plus" v-permissions="['business:devices:create']">新建</el-button></li> | 
|---|
|  |  |  | <li><el-button type="primary" @click="$refs.OperaTimerWindow.open('新建任务')" icon="el-icon-plus" v-permissions="['business:quartz:create']">新建</el-button></li> | 
|---|
|  |  |  | </ul> | 
|---|
|  |  |  | <el-table | 
|---|
|  |  |  | v-loading="isWorking.search" | 
|---|
|  |  |  | 
|---|
|  |  |  | import TableLayout from '@/layouts/TableLayout' | 
|---|
|  |  |  | import Pagination from '@/components/common/Pagination' | 
|---|
|  |  |  | import OperaTimerWindow from '@/views/timer/components/OperaTimerWindow' | 
|---|
|  |  |  | import {runOnceById} from "@/api/timer/timer"; | 
|---|
|  |  |  | import {pauseById, resumeById, runOnceById} from '@/api/timer/timer' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'Devices', | 
|---|
|  |  |  | extends: BaseTable, | 
|---|
|  |  |  | 
|---|
|  |  |  | beanName: '', | 
|---|
|  |  |  | module: '' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | pausing:false, | 
|---|
|  |  |  | running:false, | 
|---|
|  |  |  | resuming:false, | 
|---|
|  |  |  | pausing: false, | 
|---|
|  |  |  | running: false, | 
|---|
|  |  |  | resuming: false, | 
|---|
|  |  |  | room: [] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | provide() { | 
|---|
|  |  |  | provide () { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | room: () => this.room | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | pauseById (row) { | 
|---|
|  |  |  | this.__checkApi() | 
|---|
|  |  |  | this.$dialog.actionConfirm('确认暂停该任务吗?') | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | this.pausing = true | 
|---|
|  |  |  | this.api.paustById(row.id) | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | this.$message.info('暂停成功') | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(e => { | 
|---|
|  |  |  | // this.$tip.apiFailed(e) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .finally(() => { | 
|---|
|  |  |  | this.pausing = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(() => {}) | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | this.pausing = true | 
|---|
|  |  |  | this.api.pauseById(row.id) | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | this.$message.info('暂停成功') | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(e => { | 
|---|
|  |  |  | // this.$tip.apiFailed(e) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .finally(() => { | 
|---|
|  |  |  | this.pausing = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(() => {}) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | resumeById (row) { | 
|---|
|  |  |  | this.__checkApi() | 
|---|
|  |  |  | this.$dialog.actionConfirm('确认恢复该任务吗?') | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | this.resuming = true | 
|---|
|  |  |  | this.api.resumeById(row.id) | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | this.$message.info('恢复成功') | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(e => { | 
|---|
|  |  |  | // this.$tip.apiFailed(e) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .finally(() => { | 
|---|
|  |  |  | this.resuming = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(() => {}) | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | this.resuming = true | 
|---|
|  |  |  | this.api.resumeById(row.id) | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | this.$message.info('恢复成功') | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(e => { | 
|---|
|  |  |  | // this.$tip.apiFailed(e) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .finally(() => { | 
|---|
|  |  |  | this.resuming = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(() => {}) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | runById (row) { | 
|---|
|  |  |  | this.__checkApi() | 
|---|
|  |  |  | this.$dialog.actionConfirm('确认执行一次该任务吗?') | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | this.running = true | 
|---|
|  |  |  | this.api.runOnceById(row.id) | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | this.$message.info('执行成功') | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(e => { | 
|---|
|  |  |  | // this.$tip.apiFailed(e) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .finally(() => { | 
|---|
|  |  |  | this.running = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(() => {}) | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | this.running = true | 
|---|
|  |  |  | this.api.runOnceById(row.id) | 
|---|
|  |  |  | .then(() => { | 
|---|
|  |  |  | this.$message.info('执行成功') | 
|---|
|  |  |  | this.search() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(e => { | 
|---|
|  |  |  | // this.$tip.apiFailed(e) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .finally(() => { | 
|---|
|  |  |  | this.running = false | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | .catch(() => {}) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </script> | 
|---|