From 6227519a1bd9007aedae11b77b0b3b1851837c38 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期四, 03 七月 2025 14:41:04 +0800
Subject: [PATCH] 仿真测试页面,模型三位投影模块布局1修改

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

diff --git a/src/views/simulation/testSimulation/index.vue b/src/views/simulation/testSimulation/index.vue
index 3b62d17..aa593c9 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,28 +40,39 @@
         <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> -->
+                  <showModel :md5="item.md5" :index="index"></showModel>
                 </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>
             </el-col>
           </el-row>
-          <div v-if="modelDataList.length == 0">
+          <div v-if="noData">
             <el-empty :image-size="140" />
           </div>
         </div>
@@ -74,18 +89,20 @@
       <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";
+import showModel from "../../../components/showModel.vue";
+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,77 +121,126 @@
 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");
+const noData = ref<boolean>(false)
 onMounted(() => {
+  listLoading.value = true
   getAircraftList();
-  getModelData();
 });
 
-const getAircraftList = () => {
-  let list = [
+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,
     {
-      name: "瀚﹀ē涓冨彿",
-      id: "1",
+      "SysType=": ["CmsChannel"],
     },
     {
-      name: "鍏朵粬鍨嬪彿",
-      id: "2",
-    },
-  ];
-  aircraftList.value = list;
+      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 handleClick = (item) => {
-  modelTypeActive.value = item.id
-};
-const getModelData = () => {
-  listLoading.value = true;
-  let list = [
+//鑾峰彇棰勮妯″瀷鍒楄〃
+const getModelList = async () => {
+  listLoading.value = true
+  const currentNode = modelTypeList.value.find(
+    (item) => item.key == modelTypeActive.value
+  );
+  const treeData = await toolClass.getResourceItem(
+    currentNode,
+    seleStore.storeInfo,
     {
-      name: "宸¤鍣ㄦ暣妯″瀷",
-      icon: "",
-      id: "1",
+      "SysType=": ["CmsItem"],
     },
     {
-      name: "澶╃嚎",
-      icon: "",
-      id: "2",
-    },
-    {
-      name: "澶槼缈�",
-      icon: "",
-      id: "3",
-    },
-  ];
-  modelDataList.value = list;
+      ModelName: [],
+      ModelFile: [],
+      JointData: [],
+      IsSimulation: [],
+      ModelRemarks: [],
+      ChildrenCount: [],
+    }
+  );
+  for (let index = 0; index < treeData.datas.length; index++) {
+    const item = treeData.datas[index];
+    item.md5 = null;
+    try {
+      const fileData = item.fieldList.find((citem: any) => citem.FileList.length);
+      item.md5 = fileData.FileList[0].File.Md5;
+    } catch (error) {}
+  }
+  if(!treeData.datas.length) noData.value = true
+  modelDataList.value = treeData.datas;
   listLoading.value = false;
 };
 
+const getAircraftList = () => {
+  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.key;
+};
 
 //鏌ョ湅灞炴��
 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,
+    },
+  });
 };
 
 </script>
@@ -182,29 +248,36 @@
 <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;
+    min-height:300px;
+    .jc-sb {
+      margin-top: 20px;
+    }
     .model-img {
-      height: 240px;
+      height: 200px;
 
       img {
         width: 100%;

--
Gitblit v1.9.1