From 96be59a64cc1d8fcaf1034e787717663c68df4a7 Mon Sep 17 00:00:00 2001
From: 杨磊 <505174330@qq.com>
Date: 星期一, 26 五月 2025 10:39:58 +0800
Subject: [PATCH] 2025-5-26提交

---
 src/views/simulation/testSimulation/index.vue |  219 ++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 163 insertions(+), 56 deletions(-)

diff --git a/src/views/simulation/testSimulation/index.vue b/src/views/simulation/testSimulation/index.vue
index 3b62d17..dae9cec 100644
--- a/src/views/simulation/testSimulation/index.vue
+++ b/src/views/simulation/testSimulation/index.vue
@@ -1,22 +1,26 @@
 <template>
   <div class="simulation-index">
     <div class="flex ai-c">
-      <el-select v-model="aircraftActive" placeholder="Select" style="width: 140px">
+      <el-select
+        v-model="aircraftActive"
+        placeholder="Select"
+        style="width: 140px"
+      >
         <el-option
-          v-for="item in aircraftList"
-          :key="item.id"
-          :label="item.name"
-          :value="item.id"
+          v-for="item in seleStore.channelList"
+          :key="item.key"
+          :label="item.label"
+          :value="item.key"
         />
       </el-select>
       <ul class="flex tabs">
         <li
           v-for="item in modelTypeList"
-          :key="item.id"
-          @click="handleClick(item)" 
-          :class="item.id == modelTypeActive ? 'activeItem' : 'item'"
+          :key="item.key"
+          @click="handleClick(item)"
+          :class="item.key == modelTypeActive ? 'activeItem' : 'item'"
         >
-          {{ item.name }}
+          {{ item.label }}
         </li>
       </ul>
     </div>
@@ -36,22 +40,32 @@
         <div class="model-body" v-loading="listLoading">
           <el-row :gutter="20" v-if="modelDataList.length > 0">
             <el-col
-              :span="6"
+              :span="5"
               v-for="(item, index) in modelDataList"
               :key="index"
             >
               <div class="model-body-box">
                 <div class="model-img">
-                  <img :src="item.icon" alt="" />
+                  <iframe
+                    style="width: 100%; height: 100%"
+                    src="./static/modelView/index.html?md5=62d4eadc420b7403fce2be993baa095d&name=椋炶妫�&domain=https://www.jlstp.cn&target=iframe"
+                    frameborder="0"
+                  ></iframe>
                 </div>
                 <div class="model-info">
                   <h1 class="model-title" :title="item.name">
                     {{ item.name }}
                   </h1>
                   <p class="flex jc-sb">
-                    <span class="attribute hover" @click="gotoDetail(item)">灞炴��</span>
-                    <span class="report hover" @click="gotoReport(item)">娴嬭瘯鎶ュ憡</span>
-                    <span class="simulation hover" @click="gotoSimulation(item)">浠跨湡</span>
+                    <span class="attribute hover" @click="gotoDetail(item)"
+                      >灞炴��</span
+                    >
+                    <span class="report hover" @click="gotoReport(item)"
+                      >娴嬭瘯鎶ュ憡</span
+                    >
+                    <span class="simulation hover" @click="gotoSimulation(item)"
+                      >浠跨湡</span
+                    >
                   </p>
                 </div>
               </div>
@@ -74,18 +88,19 @@
       <div>鍚嶇О锛氬贰瑙嗗櫒鏁存ā鍨�</div>
       <div>灏哄锛氬贰瑙嗗櫒鏁存ā鍨�</div>
     </div>
-    
   </el-dialog>
 </template>
 
 <script setup lang="ts">
-import { ref, onMounted } from "vue";
-import { useRouter, useRoute } from 'vue-router'
-const router = useRouter()
-const route = useRoute()
+import { ref, onMounted, watch, inject } from "vue";
+import { useRouter, useRoute } from "vue-router";
+const router = useRouter();
+const route = useRoute();
+import { curStoreInfo } from "@/store/index";
+const seleStore = curStoreInfo();
 
 const aircraftList = ref([]);
-const aircraftActive = ref('1')
+const aircraftActive = ref(0);
 const modelTypeList = ref([
   {
     name: "鐫�闄嗗櫒",
@@ -104,28 +119,114 @@
 const searchValue = ref();
 const modelDataList = ref([]);
 const listLoading = ref(false);
-const detailDialogVisible = ref(false)
+const detailDialogVisible = ref(false);
+const parentChannel = ref({});
+const toolClass: any = inject("toolClass");
 onMounted(() => {
   getAircraftList();
-  getModelData();
+  // getModelData();
 });
 
+watch(
+  () => seleStore.channelInfo, // 鐩戝惉 reactive 瀵硅薄锛堥粯璁ゆ繁搴︾洃鍚級
+  (newVal) => {
+    if (newVal) {
+      console.log(newVal, "channelInfo");
+    }
+  }
+);
+watch(
+  () => seleStore.storeInfo, // 鐩戝惉 reactive 瀵硅薄锛堥粯璁ゆ繁搴︾洃鍚級
+  (newVal) => {
+    if (newVal) {
+      console.log(newVal, "storeInfo");
+    }
+  }
+);
+watch(
+  () => seleStore.channelList, // 鐩戝惉 reactive 瀵硅薄锛堥粯璁ゆ繁搴︾洃鍚級
+  (newVal) => {
+    console.log(newVal, "channelList");
+  }
+);
+watch(
+  () => parentChannel.value, // 鐩戝惉 reactive 瀵硅薄锛堥粯璁ゆ繁搴︾洃鍚級
+  (newVal) => {
+    console.log(newVal, "parentChannel");
+    if (newVal) {
+      getChildChannelList();
+    }
+  }
+);
+watch(
+  () => modelTypeActive.value, // 鐩戝惉 reactive 瀵硅薄锛堥粯璁ゆ繁搴︾洃鍚級
+  (newVal) => {
+    console.log(newVal, "modelTypeActive");
+    if (newVal) {
+      getModelList();
+    }
+  }
+);
+
+//鑾峰彇瀛愮骇棰戦亾鍒楄〃
+const getChildChannelList = async () => {
+  const treeData = await toolClass.getResourceItem(
+    parentChannel.value,
+    seleStore.storeInfo,
+    {
+      "SysType=": ["CmsChannel"],
+    },
+    {
+      ChildrenCount: [],
+    }
+  );
+  if (treeData && treeData.datas.length > 0) {
+    const fomartData = toolClass.handleTreeData(
+      treeData.datas,
+      parentChannel.value,
+      false
+    );
+    console.log(fomartData, "fomartData");
+    modelTypeList.value = fomartData;
+    modelTypeActive.value = fomartData[0].key;
+  }
+};
+
+//鑾峰彇棰勮妯″瀷鍒楄〃
+const getModelList = async () => {
+  const currentNode = modelTypeList.value.find(
+    (item) => item.key == modelTypeActive.value
+  );
+  const treeData = await toolClass.getResourceItem(
+    currentNode,
+    seleStore.storeInfo,
+    {
+      "SysType=": ["CmsItem"],
+    },
+    {
+      ModelName: [],
+      JointData: [],
+      IsSimulation: [],
+      ModelRemarks: [],
+      ChildrenCount: [],
+    }
+  );
+  console.log(treeData, "getModelList");
+  modelDataList.value = treeData.datas;
+  listLoading.value = false;
+};
+
 const getAircraftList = () => {
-  let list = [
-    {
-      name: "瀚﹀ē涓冨彿",
-      id: "1",
-    },
-    {
-      name: "鍏朵粬鍨嬪彿",
-      id: "2",
-    },
-  ];
-  aircraftList.value = list;
+  console.log(seleStore.channelList, "seleStore.channelList");
+  if (seleStore.channelList && seleStore.channelList.length > 0) {
+    aircraftList.value = seleStore.channelList;
+    aircraftActive.value = seleStore.channelList[0].key;
+    parentChannel.value = seleStore.channelList[0];
+  }
 };
 
 const handleClick = (item) => {
-  modelTypeActive.value = item.id
+  modelTypeActive.value = item.key;
 };
 const getModelData = () => {
   listLoading.value = true;
@@ -150,61 +251,67 @@
   listLoading.value = false;
 };
 
-
 //鏌ョ湅灞炴��
 const gotoDetail = () => {
-  detailDialogVisible.value = true
+  detailDialogVisible.value = true;
 };
-const handleClose = () =>{
-  detailDialogVisible.value = false
-}
+const handleClose = () => {
+  detailDialogVisible.value = false;
+};
 //鏌ョ湅娴嬭瘯鎶ュ憡
 const gotoReport = (item) => {
   router.push({
-    name: 'testReport',
-    query: {
-      id: item.id
-    }
-  })
+    name: "simulation-testReport",
+
+  });
 };
 //鎵撳紑浠跨湡
 const gotoSimulation = (item) => {
   router.push({
-    name: 'testSimulation-detail',
+    name: "simulation-detail",
     query: {
-      id: item.id
-    }
-  })
+      id: item.name,
+    },
+  });
 };
 
+//鑾峰彇棰戦亾淇℃伅
+const getChannelInfo = () => {};
 </script>
 
 <style lang="less" scoped>
 .simulation-index {
   padding: 20px;
+  background-color: #fff;
+  height: 100%;
 }
-.tabs{
+.tabs {
   margin-left: 40px;
-  li{
-    width:60px;
+  li {
+    width: 70px;
     text-align: center;
     padding: 5px 0;
-    margin:0 15px;
+    margin: 0 15px;
     cursor: pointer;
+    font-size: 14px;
   }
-  .activeItem{
-    border-bottom:2px solid #1890ff;
+  .activeItem {
+    border-bottom: 2px solid #1890ff;
   }
 }
-.page-box{
+.page-box {
   margin-top: 20px;
 }
 .list {
   margin-top: 20px;
   .model-body-box {
     border: 1px solid #f1f1f1;
+
+    .jc-sb {
+      margin-top: 20px;
+    }
     .model-img {
-      height: 240px;
+      height: 200px;
 
       img {
         width: 100%;

--
Gitblit v1.9.1