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/pre/item/MmPredictItemForm.vue   |    8 +-
 src/views/model/pre/item/index.vue               |    6 -
 src/views/data/point/index.vue                   |   10 +--
 src/views/model/sche/scheme/index.vue            |   56 ++++++++++++++++++
 src/api/model/sche/scheme/index.ts               |   13 ++++
 src/utils/dict.ts                                |    2 
 src/views/model/pre/item/MmPredictItemChart.vue  |   28 ++++++---
 src/views/model/sche/model/ScheduleModelForm.vue |   14 +++-
 8 files changed, 106 insertions(+), 31 deletions(-)

diff --git a/src/api/model/sche/scheme/index.ts b/src/api/model/sche/scheme/index.ts
index 0bcafb3..0376394 100644
--- a/src/api/model/sche/scheme/index.ts
+++ b/src/api/model/sche/scheme/index.ts
@@ -45,3 +45,16 @@
 export const deleteScheduleScheme = (id: number) => {
   return request.delete({ url: '/model/sche/scheme/delete?id=' + id })
 }
+
+// 启用
+export const enable = (ids) => {
+  const data = ids
+  return request.put({ url: '/model/sche/scheme/enable', data })
+}
+
+// 禁用
+export const disable = (ids) => {
+  const data = ids
+  return request.put({ url: '/model/sche/scheme/disable', data })
+}
+
diff --git a/src/utils/dict.ts b/src/utils/dict.ts
index 23b41c0..0795004 100644
--- a/src/utils/dict.ts
+++ b/src/utils/dict.ts
@@ -165,7 +165,7 @@
   MODEL_METHOD_SETTING_VALUE_TYPE = 'model_method_setting_value_type',
   PRED_GRANULARITY = 'pred_granularity',
   ITEM_RUN_STATUS = 'item_run_status',
-
+  RESULT_TYPE = 'result_type',
   // ========== DATA - 数据平台模块  ==========
   DATA_FIELD_TYPE = 'data_field_type',
   TAG_DATA_TYPE = 'tag_data_type',
diff --git a/src/views/data/point/index.vue b/src/views/data/point/index.vue
index f87cd1a..b11294c 100644
--- a/src/views/data/point/index.vue
+++ b/src/views/data/point/index.vue
@@ -295,9 +295,8 @@
     let ids = dataListSelections.map(item => {
       return item.id
     })
-    // 启用的二次确认
-    await message.enableConfirm(ids)
-
+    // 二次确认
+    await message.confirm('确认要开启所选测点?')
     await DaPoint.enable(ids)
     message.success(t('common.enableSuccess'))
     await getList()
@@ -307,9 +306,8 @@
     let ids = dataListSelections.map(item => {
       return item.id
     })
-    // 启用的二次确认
-    await message.disableConfirm(ids,)
-
+    // 二次确认
+    await message.confirm('确认要禁用所选测点?')
     await DaPoint.disable(ids)
     message.success(t('common.disableSuccess'))
     await getList()
diff --git a/src/views/model/pre/item/MmPredictItemChart.vue b/src/views/model/pre/item/MmPredictItemChart.vue
index 14afaed..4d24c06 100644
--- a/src/views/model/pre/item/MmPredictItemChart.vue
+++ b/src/views/model/pre/item/MmPredictItemChart.vue
@@ -3,6 +3,7 @@
     title="预测数据"
     :close-on-click-modal="false"
     width="50%"
+    @close="dialogClose"
     v-model="visible"
   >
     <el-form
@@ -12,7 +13,6 @@
     >
       <el-form-item label="开始时间">
         <el-date-picker
-          size="mini"
           v-model="dataForm.startTime"
           format="YYYY-MM-DD HH:mm:00"
           value-format="YYYY-MM-DD HH:mm:00"
@@ -22,7 +22,6 @@
       </el-form-item>
       <el-form-item label="结束时间">
         <el-date-picker
-          size="mini"
           v-model="dataForm.endTime"
           format="YYYY-MM-DD HH:mm:00"
           value-format="YYYY-MM-DD HH:mm:00"
@@ -79,9 +78,16 @@
   dataForm.value.id = row.id;
   dataForm.value.itemName = row.itemname;
   if (row.id) {
-    myChart = echarts.init(chartDomPre.value);
-    myChart.clear()
+    nextTick(() => {
+      myChart = echarts.init(chartDomPre.value);
+    });
     getDataList();
+  }
+}
+
+const dialogClose = () => {
+  if (myChart) {
+    myChart.dispose(); // 组件卸载时销毁实例
   }
 }
 
@@ -96,12 +102,12 @@
       chartParams.endTime = dataForm.value.endTime;
       const data = await McsApi.getPreDataItemChart(chartParams)
       let legendData = []
-      if (data.legend && data.legend.length > 0) {
-        data.legend.forEach(item => {
-          legendData.push(item + ":" + '真实值')
-          legendData.push(item + ":" + '预测值')
-        })
-      }
+      // if (data.legend && data.legend.length > 0) {
+      //   data.legend.forEach(item => {
+      //     legendData.push(item + ":" + '真实值')
+      //     legendData.push(item + ":" + '预测值')
+      //   })
+      // }
 
       let seriesData = []
       if (data.predictTime) {
@@ -134,6 +140,7 @@
         Object.keys(data.viewMap).forEach(key => {
           let viewData = data.viewMap[key]
           if(viewData.realData) {
+            legendData.push(key + ":" + '真实值')
             seriesData.push({
               name: key + ":" + '真实值',
               type: "line",
@@ -147,6 +154,7 @@
               },
             })
           }
+          legendData.push(key + ":" + '预测值')
           seriesData.push({
             name: key + ":" + '预测值',
             type: "line",
diff --git a/src/views/model/pre/item/MmPredictItemForm.vue b/src/views/model/pre/item/MmPredictItemForm.vue
index 22e5776..fc87750 100644
--- a/src/views/model/pre/item/MmPredictItemForm.vue
+++ b/src/views/model/pre/item/MmPredictItemForm.vue
@@ -298,7 +298,7 @@
         <el-table-column prop="valuetype" label="类型" align="center" min-width="150"/>
         <el-table-column prop="" label="值" align="center" min-width="200">
           <template #default="scope">
-            <el-input size="mini" v-model="scope.row.value" maxlength="1000"
+            <el-input v-model="scope.row.value" maxlength="1000"
                       :disabled="scope.row.key === 'pyFile'"
                       style="width:100%;height:100%"/>
           </template>
@@ -372,14 +372,12 @@
           <template #default="scope">
             <el-button
               @click="addRow(scope.$index, dataForm.mmModelParamList)"
-              type="text"
-              size="mini">
+              type="text">
               添加
             </el-button>
             <el-button
               @click="deleteRow(scope.$index, scope.row, dataForm.mmModelParamList)"
-              type="text"
-              size="mini">
+              type="text">
               删除
             </el-button>
           </template>
diff --git a/src/views/model/pre/item/index.vue b/src/views/model/pre/item/index.vue
index c1b6f60..883fe9d 100644
--- a/src/views/model/pre/item/index.vue
+++ b/src/views/model/pre/item/index.vue
@@ -97,7 +97,7 @@
       <el-table-column label="运行时间" min-width="150" align="center" prop="lastTime"/>
       <el-table-column label="运行状态" align="center" prop="runStatus">
         <template #default="scope">
-          <dict-tag :type="DICT_TYPE.ITEM_RUN_STATUS" :value="scope.row.runStatus" />
+          <dict-tag :type="DICT_TYPE.ITEM_RUN_STATUS" :value="scope.row.runStatus || 200" />
         </template>
       </el-table-column>
       <el-table-column label="运行耗时(ms)" align="center" prop="duration"/>
@@ -106,17 +106,15 @@
           <el-button
             link
             type="primary"
-            size="mini"
             @click="openForm('update', scope.row.id, scope.row.itemtypename)"
             v-hasPermi="['model:pre-item:update']"
           >
             编辑
           </el-button>
-          <el-button link size="mini" type="primary" @click="chartHandle(scope.row)">数据</el-button>
+          <el-button link type="primary" @click="chartHandle(scope.row)">数据</el-button>
           <el-button
             link
             type="danger"
-            size="mini"
             @click="handleDelete(scope.row.id)"
             v-hasPermi="['model:pre-item:delete']"
           >
diff --git a/src/views/model/sche/model/ScheduleModelForm.vue b/src/views/model/sche/model/ScheduleModelForm.vue
index d09e47a..b01f3d2 100644
--- a/src/views/model/sche/model/ScheduleModelForm.vue
+++ b/src/views/model/sche/model/ScheduleModelForm.vue
@@ -282,14 +282,21 @@
         :data="formData.modelOut"
         border
         style="width: 100%; margin-top: 5px;">
-        <el-table-column prop="resultKey`" label="输出key" align="center" min-width="100">
+        <el-table-column prop="resultKey" label="输出key" align="center" min-width="100">
           <template #default="scope">
             <el-input size="mini" v-model="scope.row.resultKey" style="width:100%;height:100%"/>
           </template>
         </el-table-column>
-        <el-table-column prop="resultType`" label="数据类型" align="center" min-width="100">
+        <el-table-column prop="resultType" label="数据类型" align="center" min-width="150">
           <template #default="scope">
-            <el-input size="mini" v-model="scope.row.resultType" style="width:100%;height:100%"/>
+            <el-select v-model="scope.row.resultType" placeholder="请选择">
+              <el-option
+                v-for="dict in getStrDictOptions(DICT_TYPE.RESULT_TYPE)"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              />
+            </el-select>
           </template>
         </el-table-column>
         <el-table-column prop="resultPort" label="角标1" align="center" min-width="100">
@@ -327,6 +334,7 @@
         <el-table-column prop="disturbancePointNo’" label="无扰切换点位" align="center" min-width="200">
           <template #default="scope">
             <el-select v-model="scope.row.disturbancePointNo"
+                       clearable
                        filterable
                        placeholder="请选择">
               <el-option
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