From d5207d8eaff6188ae0d79c07de17d0b8dbaed65a Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期一, 06 一月 2025 11:45:14 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/model/sche/scheme/index.vue |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/src/views/model/sche/scheme/index.vue b/src/views/model/sche/scheme/index.vue
index 54f4b3f..1c94533 100644
--- a/src/views/model/sche/scheme/index.vue
+++ b/src/views/model/sche/scheme/index.vue
@@ -36,6 +36,20 @@
           重置
         </el-button>
         <el-button
+          type="success"
+          plain
+          @click="enable"
+          v-hasPermi="['sche:scheme:update']"
+        >启用
+        </el-button>
+        <el-button
+          type="danger"
+          plain
+          @click="disable"
+          v-hasPermi="['sche:scheme:update']"
+        >禁用
+        </el-button>
+        <el-button
           type="primary"
           plain
           @click="openForm('create')"
@@ -50,7 +64,8 @@
 
   <!-- 列表 -->
   <ContentWrap>
-    <el-table v-loading="loading" :data="list">
+    <el-table v-loading="loading" :data="list" @selection-change="selectionChangeHandle">
+      <el-table-column type="selection" header-align="center" align="center" fixed="left" width="50"/>
       <el-table-column label="方案编号" align="center" prop="code" min-width="100"/>
       <el-table-column label="方案名称" header-align="center" align="left" prop="name" min-width="100"/>
       <el-table-column label="触发方式" align="center" prop="triggerMethod" min-width="100">
@@ -63,8 +78,14 @@
       <el-table-column label="调整类型" align="center" prop="scheduleType" min-width="100"/>
       <el-table-column label=" 调整策略" align="center" prop="scheduleStrategy" min-width="100"/>
       <el-table-column label="调度时间" align="center" prop="scheduleTime" min-width="160" />
+      <el-table-column label="运行状态" align="center" prop="runStatus">
+        <template #default="scope">
+          <el-tag v-if="scope.row.runStatus + '' === '100'" size="small" type="success">{{scope.row.runStatus}}</el-tag>
+          <el-tag v-else size="small" type="danger">{{scope.row.runStatus}}</el-tag>
+        </template>
+      </el-table-column>
       <el-table-column label="备注" header-align="center" align="left" prop="remark" min-width="160" />
-      <el-table-column label="状态" align="center" prop="status" min-width="100">
+      <el-table-column label="是否启用" align="center" prop="status" min-width="100">
         <template #default="scope">
           <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
         </template>
@@ -118,6 +139,9 @@
   import * as ScheduleSchemeApi from '@/api/model/sche/scheme'
   import ScheduleSchemeForm from './ScheduleSchemeForm.vue'
   import RecordList from  './record/index.vue'
+  import * as DaPoint from "@/api/data/da/point";
+  import {reactive} from "vue";
+  import {InfraJobStatusEnum} from "@/utils/constants";
 
   defineOptions({name: 'ScheduleScheme'})
 
@@ -186,6 +210,34 @@
     recordRef.value.open(id)
   }
 
+  let dataListSelections = reactive([])
+  // 多选
+  function selectionChangeHandle (val) {
+    dataListSelections = val
+  }
+  // 启用
+  async function enable() {
+    let ids = dataListSelections.map(item => {
+      return item.id
+    })
+    // 二次确认
+    await message.confirm('是否确认要启用所选调度方案?')
+    await ScheduleSchemeApi.enable(ids)
+    message.success(t('common.enableSuccess'))
+    await getList()
+  }
+  // 禁用
+  async function disable(){
+    let ids = dataListSelections.map(item => {
+      return item.id
+    })
+    // 二次确认
+    await message.confirm('确认要禁用所选调度方案?')
+    await ScheduleSchemeApi.disable(ids)
+    message.success(t('common.disableSuccess'))
+    await getList()
+  }
+
   /** 初始化 **/
   onMounted(async () => {
     await getList()

--
Gitblit v1.9.3