From 69a1b3bf45738f048361ee4ccb6bdc64fce35720 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期三, 12 三月 2025 11:31:46 +0800
Subject: [PATCH] 更新

---
 admin/src/views/timer/timer.vue |  169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 169 insertions(+), 0 deletions(-)

diff --git a/admin/src/views/timer/timer.vue b/admin/src/views/timer/timer.vue
new file mode 100644
index 0000000..fc76f3e
--- /dev/null
+++ b/admin/src/views/timer/timer.vue
@@ -0,0 +1,169 @@
+<template>
+  <TableLayout :permissions="['business:quartz:query']">
+    <!-- 鎼滅储琛ㄥ崟 -->
+    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
+      <el-form-item label="Bean鍚嶇О" prop="beanName">
+        <el-input v-model="searchForm.beanName" placeholder="璇疯緭鍏ュ彂甯冧汉" @keypress.enter.native="search"></el-input>
+      </el-form-item>
+      <el-form-item label="妯″潡鍚嶇О" prop="module">
+        <el-input v-model="searchForm.module" placeholder="璇疯緭鍏ュ彂甯冧汉" @keypress.enter.native="search"></el-input>
+      </el-form-item>
+      <section>
+        <el-button type="primary" @click="search">鎼滅储</el-button>
+        <!-- <el-button type="primary" :loading="isWorking.export" v-permissions="['business:devices:exportExcel']" @click="exportExcel">瀵煎嚭</el-button> -->
+        <el-button @click="reset">閲嶇疆</el-button>
+      </section>
+    </el-form>
+    <!-- 琛ㄦ牸鍜屽垎椤� -->
+    <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>
+      </ul>
+      <el-table
+          :height="tableHeightNew"
+        v-loading="isWorking.search"
+        :data="tableData.list"
+        stripe
+        border
+        @selection-change="handleSelectionChange"
+      >
+        <el-table-column type="index" prop="index" label="搴忓彿" align="center" min-width="50px"></el-table-column>
+        <el-table-column prop="beanName" label="BEAN鍚嶇О" align="center" min-width="150px"></el-table-column>
+        <el-table-column prop="module" label="妯″潡鍚嶇О" align="center" min-width="180px"></el-table-column>
+        <el-table-column prop="params" label="鎵ц鍙傛暟" align="center" min-width="180px"></el-table-column>
+        <el-table-column prop="state" label="鐘舵��" align="center" min-width="100px">
+          <template slot-scope="{row}">
+              <span v-if="row.state ==1" style="color:green">姝e父</span>
+              <span v-if="row.state ==2" style="color: red">鏆傚仠</span>
+              <span v-if="row.state ==3" style="color: red">宸插垹闄�</span>
+          </template>
+        </el-table-column>
+        <el-table-column prop="cronExpres" label="琛ㄨ揪寮�" align="center" min-width="100px"></el-table-column>
+        <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" align="center" min-width="180px"></el-table-column>
+        <el-table-column prop="remark" label="澶囨敞" align="center" min-width="180px"></el-table-column>
+        <el-table-column
+          v-if="containPermissions(['business:quartz:update'])"
+          label="鎿嶄綔"
+          fixed="right"
+          min-width="220"
+          align="center"
+        >
+          <template slot-scope="{row}">
+            <el-button type="text" @click="$refs.OperaTimerWindow.open('缂栬緫浠诲姟', row)" v-permissions="['business:quartz:update']">缂栬緫</el-button>
+            <el-button type="text"  @click="runById(row)"  v-permissions="['business:quartz:update']">鎵ц涓�娆�</el-button>
+            <el-button type="text"   v-if="row.state == 1" style="color: red" @click="pauseById(row)"  v-permissions="['business:quartz:update']">鏆傚仠</el-button>
+            <el-button type="text"  v-if="row.state == 2" style="color: green" @click="resumeById(row)"   v-permissions="['business:quartz:update']">鎭㈠</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <pagination
+        @size-change="handleSizeChange"
+        @current-change="handlePageChange"
+        :pagination="tableData.pagination"
+      ></pagination>
+    </template>
+    <!-- 鏂板缓/淇敼 -->
+    <OperaTimerWindow ref="OperaTimerWindow" @success="handlePageChange"/>
+  </TableLayout>
+</template>
+
+<script>
+import BaseTable from '@/components/base/BaseTable'
+import TableLayout from '@/layouts/TableLayout'
+import Pagination from '@/components/common/Pagination'
+import OperaTimerWindow from '@/views/timer/components/OperaTimerWindow'
+import {runOnceById} from "@/api/timer/timer";
+export default {
+  name: 'Devices',
+  extends: BaseTable,
+  components: { TableLayout, Pagination, OperaTimerWindow },
+  data () {
+    return {
+      // 鎼滅储
+      searchForm: {
+        id: '',
+        beanName: '',
+        module: ''
+      },
+      pausing:false,
+      running:false,
+      resuming:false,
+      room: []
+    }
+  },
+  provide() {
+    return {
+      room: () => this.room
+    }
+  },
+  created () {
+    this.config({
+      module: '璁惧绠$悊淇℃伅琛�',
+      api: '/timer/timer',
+      'field.id': 'id',
+      'field.main': 'id'
+    })
+    this.search()
+  },
+  methods: {
+    pauseById (row) {
+      this.__checkApi()
+      this.$dialog.actionConfirm('纭鏆傚仠璇ヤ换鍔″悧?')
+          .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(() => {})
+    },
+    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(() => {})
+    }
+  },
+}
+
+</script>

--
Gitblit v1.9.3