liukangdong
2024-09-29 b2d360d9113b6955287108ca9e90d76a1f3c1419
admin/src/views/timer/timer.vue
@@ -16,7 +16,7 @@
    <!-- 表格和分页 -->
    <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"
@@ -70,7 +70,7 @@
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,
@@ -83,13 +83,13 @@
        beanName: '',
        module: ''
      },
      pausing:false,
      running:false,
      resuming:false,
      pausing: false,
      running: false,
      resuming: false,
      room: []
    }
  },
  provide() {
  provide () {
    return {
      room: () => this.room
    }
@@ -107,61 +107,61 @@
    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>