Parcourir la source

增加模拟数据及运行功能

lichunyang il y a 1 mois
Parent
commit
86123df35e

BIN
src/assets/icons/simulationData.png


+ 7 - 7
src/components/layout/TopoButtonBar.vue

@@ -64,13 +64,12 @@
       </el-tab-pane>
     </el-tabs>
   </div>
-
 </template>
 
 <script setup>
 import { ref, computed } from "vue"
 import { useI18n } from "vue-i18n"
-
+import { useProjectStore } from "@/store/project"
 import libraryIcon from "@/assets/icons/library.png" // 图层
 import addLayerIcon from "@/assets/icons/addLayer.png" // 新建图层
 // 显示
@@ -110,6 +109,7 @@ import documentIcon from "@/assets/icons/document.png" // 文档
 import commentIcon from "@/assets/icons/comment.png" // 注释
 // 仿真
 import runIcon from "@/assets/icons/run.png" // 运行
+import simulationDataIcon from "@/assets/icons/simulationData.png" // 模拟数据
 import preprocessingIcon from "@/assets/icons/preprocessing.png" // 预处理
 import stopIcon from "@/assets/icons/stop.png" // 停止
 // 结果
@@ -127,6 +127,7 @@ import toolIcon from "@/assets/icons/tool.png" // 工具
 import visualizationIcon from "@/assets/icons/visualization.png" // 可视化
 import splitIcon from "@/assets/icons/split.png" // 切分
 const { t } = useI18n()
+const projectStore = useProjectStore()
 const emit = defineEmits(["button-click"])
 const modeSwitch = ref(false) // 开关状态,默认关闭(连接模式)
 const fakeTabs = [
@@ -307,7 +308,7 @@ const tabs = [
     icon: "",
     buttons: [
       { action: "run", label: t("buttons.run"), icon: runIcon },
-      { action: "preprocess", label: t("buttons.preprocess"), icon: preprocessingIcon},
+      { action: "simulationData", label: t("buttons.simulationData"), icon: simulationDataIcon},
       { action: "stop", label: t("buttons.stop"), icon: stopIcon }
     ]
   },
@@ -382,7 +383,6 @@ const buttonStates = ref({
   showNodeId: false
 })
 
-
 const handleButtonClick = (button) => {
   if (button.isToggle) {
     buttonStates.value[button.action] = !buttonStates.value[button.action]
@@ -396,13 +396,13 @@ const handleButtonClick = (button) => {
 
   switch (button.action) {
     case "run":
-      console.log("点击了 运行 按钮")
+      emit('run-button-click', button.action);
       break
     case "stop":
       console.log("点击了 停止 按钮")
       break
-    case "preprocess":
-      
+    case "simulationData":
+      emit('open-simulationData-dialog', projectStore.pid);
       break
     default:
       break

+ 1 - 0
src/locales/en.json

@@ -194,6 +194,7 @@
     "comment" : "Comment",
     "run" : "Run",
     "preprocess": "Preprocess",
+    "simulationData" : "SimulationData",
     "stop" : "Stop",
     "dashboard" : "Dashboard",
     "resultDisplay" : "ResultDisplay",

+ 1 - 0
src/locales/zh-CN.json

@@ -195,6 +195,7 @@
     "comment" : "注释",
     "run" : "运行",
     "preprocess": "预处理",
+    "simulationData" : "模拟数据",
     "stop" : "停止",
     "dashboard" : "仪表盘",
     "resultDisplay" : "结果显示",

+ 10 - 1
src/views/model/index.vue

@@ -86,7 +86,9 @@
                   <span>Topology</span>
                 </div>
               </div>
-              <TopoButtonBar @button-click="btnfunc" />
+              <TopoButtonBar 
+              @run-button-click="btnfunc" 
+              @open-simulationData-dialog="handleOpenSimulationDataDialog"/>
             </div>
             <!-- <div class="main-header">
               <div class="topologyStyle">Topology</div> -->
@@ -444,6 +446,13 @@ const confirmDelete = () => {
   }
 }
 
+// 处理 topoButtonBar 触发的 open-data-dialog 事件
+const handleOpenSimulationDataDialog = (pid) => {
+  if (pid) {
+    SLdatadialogref.value?.openDialog?.(pid);
+  }
+};
+
 const btnfunc = (name) => {
   if (name === "run") {
     if (runtype.value === "") {