闫增涛
2025-06-12 e2952ba4b6a392047ddbc3542465a81413c64eb9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<template>
  <div class="simulation-index">
    <div class="flex ai-c">
      <el-select
        v-model="aircraftActive"
        placeholder="Select"
        style="width: 140px"
      >
        <el-option
          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.key"
          @click="handleClick(item)"
          :class="item.key == modelTypeActive ? 'activeItem' : 'item'"
        >
          {{ item.label }}
        </li>
      </ul>
    </div>
    <div class="page-box">
      <div class="search">
        <el-input
          v-model="searchValue"
          style="width: 400px"
          placeholder="请输入搜索关键字"
        >
          <template #suffix>
            <el-icon class="el-input__icon"><search /></el-icon>
          </template>
        </el-input>
      </div>
      <div class="list">
        <div class="model-body" v-loading="listLoading">
          <el-row :gutter="20" v-if="modelDataList.length > 0">
            <el-col
              :span="5"
              v-for="(item, index) in modelDataList"
              :key="index"
            >
              <div class="model-body-box">
                <div class="model-img">
                  <!-- <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
                    >
                  </p>
                </div>
              </div>
            </el-col>
          </el-row>
          <div v-if="noData">
            <el-empty :image-size="140" />
          </div>
        </div>
      </div>
    </div>
  </div>
  <el-dialog
    v-model="detailDialogVisible"
    title="属性"
    width="500"
    :before-close="handleClose"
  >
    <div>
      <div>名称:巡视器整模型</div>
      <div>尺寸:巡视器整模型</div>
    </div>
  </el-dialog>
</template>
 
<script setup lang="ts">
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(0);
const modelTypeList = ref([
  {
    name: "着陆器",
    id: "2",
  },
  {
    name: "巡视器",
    id: "3",
  },
  {
    name: "飞跃器",
    id: "4",
  },
]);
const modelTypeActive = ref("3");
const searchValue = ref();
const modelDataList = ref([]);
const listLoading = ref(false);
const detailDialogVisible = ref(false);
const parentChannel = ref({});
const toolClass: any = inject("toolClass");
const noData = ref<boolean>(false)
onMounted(() => {
  listLoading.value = true
  getAircraftList();
});
 
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 () => {
  listLoading.value = true
  const currentNode = modelTypeList.value.find(
    (item) => item.key == modelTypeActive.value
  );
  const treeData = await toolClass.getResourceItem(
    currentNode,
    seleStore.storeInfo,
    {
      "SysType=": ["CmsItem"],
    },
    {
      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;
};
const handleClose = () => {
  detailDialogVisible.value = false;
};
//查看测试报告
const gotoReport = (item) => {
  router.push({
    name: "simulation-testReport",
  });
};
//打开仿真
const gotoSimulation = (item) => {
  router.push({
    name: "simulation-detail",
    query: {
      id: item.name,
    },
  });
};
 
</script>
 
<style lang="less" scoped>
.simulation-index {
  padding: 20px;
  background-color: #fff;
  height: 100%;
}
.tabs {
  margin-left: 40px;
  li {
    width: 70px;
    text-align: center;
    padding: 5px 0;
    margin: 0 15px;
    cursor: pointer;
    font-size: 14px;
  }
  .activeItem {
    border-bottom: 2px solid #1890ff;
  }
}
.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: 200px;
 
      img {
        width: 100%;
        height: 100%;
        object-fit: contain;
      }
    }
 
    .model-info {
      height: 80px;
      padding: 20px;
      .model-title {
        font-size: 16px;
      }
      p {
        line-height: 30px;
        font-size: 16px;
      }
      .attribute {
        color: #1890ff;
      }
      .report {
        color: #1fbc1f;
      }
      .simulation {
        color: #ee1818;
      }
    }
  }
}
</style>