litian
2025-03-18 4a8d8a5f49321d9597251e7ba69bf39f78baa51b
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
<template>
  <div class="simulation-result">
    <div style="width: 100%; height: 100%; background: #fff" id="myDiv">
      <div class="titleBox">
        <div class="name">
          <span>{{ name }}仿真</span>
          <img
            src="@/assets/images/icon/fullScreen.png"
            @click="enlargeDiv('true')"
            v-if="enlarge"
          />
          <img
            src="@/assets/images/icon/halfScreen.png"
            @click="enlargeDiv('false')"
            v-else
          />
        </div>
        <div class="back hover" @click="goBack">
          <el-icon ><ArrowLeftBold /></el-icon>返回
        </div>
      </div>
      <div class="flex bodyBox">
        <div class="modelBox"></div>
        <div class="shadowBox">
          <div id="shadowX">
            <div class="title">
              <span>X轴投影</span>
              <img
                src="@/assets/images/icon/fullScreen.png"
                @click="enlargeXDiv('true')"
                v-if="enlargeX"
              />
              <img
                src="@/assets/images/icon/halfScreen.png"
                @click="enlargeXDiv('false')"
                v-else
              />
            </div>
            <div class="shadowX-body"></div>
          </div>
          <div id="shadowY">
            <div class="title">
              <span>Y轴投影</span>
              <img
                src="@/assets/images/icon/fullScreen.png"
                @click="enlargeYDiv('true')"
                v-if="enlargeY"
              />
              <img
                src="@/assets/images/icon/halfScreen.png"
                @click="enlargeYDiv('false')"
                v-else
              />
            </div>
            <div class="shadowY-body"></div>
          </div>
          <div id="shadowZ">
            <div class="title">
              <span>Z轴投影</span>
              <img
                src="@/assets/images/icon/fullScreen.png"
                @click="enlargeZDiv('true')"
                v-if="enlargeZ"
              />
              <img
                src="@/assets/images/icon/halfScreen.png"
                @click="enlargeZDiv('false')"
                v-else
              />
            </div>
            <div class="shadowZ-body"></div>
          </div>
        </div>
      </div>
      <div class="flex operateBox" id="operateBox">
        <div id="instruct">
          <div class="title jc-sb">
            <div class="title">
              <span>指令</span>
              <img
                src="@/assets/images/icon/fullScreen.png"
                @click="enlargeInstructDiv('true')"
                v-if="enlargeI"
              />
              <img
                src="@/assets/images/icon/halfScreen.png"
                @click="enlargeInstructDiv('false')"
                v-else
              />
            </div>
            <div class="upBold">
              <el-icon @click="operateBoxDiv('true')" v-if="operate"
                ><ArrowUpBold
              /></el-icon>
              <el-icon @click="operateBoxDiv('false')" v-else
                ><ArrowDownBold
              /></el-icon>
            </div>
          </div>
          <div class="instruct-body">
            <div class="instruct-list">
              <div v-for="(item, index) in instructList" :key="index">
                >{{ item }}
              </div>
            </div>
            <div class="inputBox">
              <el-input
                v-model="instructContent"
                placeholder="请输入指令"
                @keyup.enter="setInstruct"
              />
            </div>
          </div>
        </div>
        <div id="resize"></div>
        <div id="log">
          <div class="title jc-sb">
            <div class="title">
              <span>日志</span>
              <img
                src="@/assets/images/icon/fullScreen.png"
                @click="enlargeLogDiv('true')"
                v-if="enlargeL"
              />
              <img
                src="@/assets/images/icon/halfScreen.png"
                @click="enlargeLogDiv('false')"
                v-else
              />
            </div>
            <div class="upBold">
              <el-icon @click="operateBoxDiv('true')" v-if="operate"
                ><ArrowUpBold
              /></el-icon>
              <el-icon @click="operateBoxDiv('false')" v-else
                ><ArrowDownBold
              /></el-icon>
            </div>
          </div>
          <div class="log-body">
            <div class="log-list">
              <div v-for="(item, index) in instructList" :key="index">
                >{{ item }}
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <el-dialog v-model="reportDialogForm" title="生成测试报告" width="500">
    <el-form :model="reportInfo">
      <el-form-item label="报告名称" label-width="100px">
        <el-input v-model="reportInfo.reportName" autocomplete="off" />
      </el-form-item>
      <el-form-item label="测试时间" label-width="100px">
        <el-input v-model="reportInfo.testTime" autocomplete="off" disabled/>
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="reportDialogForm = false">否</el-button>
        <el-button type="primary" @click="reportDialogForm = false">
         是
        </el-button>
      </div>
    </template>
  </el-dialog>
</template>
 
<script setup lang="ts">
import { ref, reactive,onMounted } from "vue";
const name = ref("飞跃器整模型");
const reportDialogForm = ref(false)
const reportInfo = reactive({
  reportName:'',
  testTime: '',
})
const enlarge = ref(true);
const enlargeX = ref(true);
const enlargeY = ref(true);
const enlargeZ = ref(true);
const enlargeI = ref(true);
const enlargeL = ref(true);
const instructContent = ref("");
const operate = ref(true);
const instructList = ref([]);
const logList = ref([]);
 
const goBack =()=>{
  var time = new Date(Date.now());
        var year = time.getFullYear();
        var month = time.getMonth()+1;
        var day = time.getDate();
        var hour = time.getHours();
        var minute = time.getMinutes();
        var second = time.getSeconds();
        reportInfo.testTime = year+'-'+(month<10?'0'+month:month)+'-'+(day<10?'0'+day:day)+' '+(hour<10?'0'+hour:hour)+':'+(minute<10?'0'+minute:minute)+':'+(second<10?'0'+second:second)
    reportDialogForm.value = true
 
}
 
 
const enlargeDiv = (state) => {
  let divStyle = document.getElementById("myDiv");
  if (state == "true") {
    enlarge.value = false;
    let screenWidth = window.innerWidth; // 获取屏幕宽度
    let screenHeight = window.innerHeight; // 获取屏幕高度
    divStyle.style.width = screenWidth + "px"; // 设置宽度为屏幕宽度
    divStyle.style.height = screenHeight + "px"; // 设置高度为屏幕高度
    divStyle.style.left = "0"; // 设置左边距为0,使其从屏幕左侧开始
    divStyle.style.top = "0"; // 设置顶部边距为0,使其从屏幕顶部开始
    divStyle.style.position = "fixed"; // 使用fixed定位,确保覆盖整个屏幕
  } else {
    enlarge.value = true;
    divStyle.style.width = "100%"; // 还原宽度
    divStyle.style.height = "100%"; // 还原高度
    divStyle.style.left = ""; // 清除左边距
    divStyle.style.top = ""; // 清除顶部边距
    divStyle.style.position = ""; // 清除定位属性
  }
};
const enlargeXDiv = (state) => {
  let divStyle = document.getElementById("shadowX");
  if (state == "true") {
    enlargeX.value = false;
    let screenWidth = window.innerWidth;
    let screenHeight = window.innerHeight;
    divStyle.style.width = screenWidth + "px";
    divStyle.style.height = screenHeight + "px";
    divStyle.style.left = "0";
    divStyle.style.top = "0";
    divStyle.style.position = "fixed";
  } else {
    enlargeX.value = true;
    divStyle.style.width = "100%";
    divStyle.style.height = "calc((100% - 6px) / 3)";
    divStyle.style.left = "";
    divStyle.style.top = "";
    divStyle.style.position = "";
  }
};
const enlargeYDiv = (state) => {
  let divStyle = document.getElementById("shadowY");
  if (state == "true") {
    enlargeY.value = false;
    let screenWidth = window.innerWidth;
    let screenHeight = window.innerHeight;
    divStyle.style.width = screenWidth + "px";
    divStyle.style.height = screenHeight + "px";
    divStyle.style.left = "0";
    divStyle.style.top = "0";
    divStyle.style.position = "fixed";
  } else {
    enlargeY.value = true;
    divStyle.style.width = "100%";
    divStyle.style.height = "calc((100% - 6px) / 3)";
    divStyle.style.left = "";
    divStyle.style.top = "";
    divStyle.style.position = "";
  }
};
const enlargeZDiv = (state) => {
  let divStyle = document.getElementById("shadowZ");
  if (state == "true") {
    enlargeZ.value = false;
    let screenWidth = window.innerWidth;
    let screenHeight = window.innerHeight;
    divStyle.style.width = screenWidth + "px";
    divStyle.style.height = screenHeight + "px";
    divStyle.style.left = "0";
    divStyle.style.top = "0";
    divStyle.style.position = "fixed";
  } else {
    enlargeZ.value = true;
    divStyle.style.width = "100%";
    divStyle.style.height = "calc((100% - 6px) / 3)";
    divStyle.style.left = "";
    divStyle.style.top = "";
    divStyle.style.position = "";
  }
};
const enlargeInstructDiv = (state) => {
  let divStyle = document.getElementById("instruct");
  if (state == "true") {
    enlargeI.value = false;
    let screenWidth = window.innerWidth;
    let screenHeight = window.innerHeight;
    divStyle.style.width = screenWidth + "px";
    divStyle.style.height = screenHeight + "px";
    divStyle.style.left = "0";
    divStyle.style.top = "0";
    divStyle.style.position = "fixed";
  } else {
    enlargeI.value = true;
    divStyle.style.width = "100%";
    divStyle.style.height = "100%";
    divStyle.style.left = "";
    divStyle.style.top = "";
    divStyle.style.position = "";
  }
};
const enlargeLogDiv = (state) => {
  let divStyle = document.getElementById("log");
  if (state == "true") {
    enlargeL.value = false;
    let screenWidth = window.innerWidth;
    let screenHeight = window.innerHeight;
    divStyle.style.width = screenWidth + "px";
    divStyle.style.height = screenHeight + "px";
    divStyle.style.left = "0";
    divStyle.style.top = "0";
    divStyle.style.position = "fixed";
  } else {
    enlargeL.value = true;
    divStyle.style.width = "100%";
    divStyle.style.height = "100%";
    divStyle.style.left = "";
    divStyle.style.top = "";
    divStyle.style.position = "";
  }
};
 
const operateBoxDiv = (state) => {
  let divStyle = document.getElementById("operateBox");
  if (state == "true") {
    operate.value = false;
    divStyle.style.width = "100%";
    divStyle.style.height = "calc(100% - 36px)";
    divStyle.style.left = "0";
    divStyle.style.top = "36px";
    divStyle.style.position = "absolute";
  } else {
    operate.value = true;
    divStyle.style.height = "calc(100% - 36px - 70%)";
    divStyle.style.left = "";
    divStyle.style.top = "";
    divStyle.style.position = "";
  }
};
 
const setInstruct = () => {
  console.log(instructContent.value);
  instructList.value.push(instructContent.value);
  logList.value.push(instructContent.value);
  instructContent.value = "";
};
 
 
onMounted(() => {
  handleResize();
});
//指令日志框宽度拖拽
const handleResize = () => {
  let operateDom = document.getElementById("operateBox");
  let instructDom = document.getElementById("instruct");
  let logDom = document.getElementById("log");
  let resizeDom = document.getElementById("resize");
 
  for (let i = 0; i < resizeDom.length; i++) {
        // 鼠标按下事件
        console.log(1)
        resizeDom[i].onmousedown = function (e) {
            //颜色改变提醒
            resizeDom[i].style.background = '#f0f2f5'
            var startX = e.clientX
            resizeDom[i].left = resizeDom[i].offsetLeft
            // 鼠标拖动事件
            document.onmousemove = function (e) {
              console.log(2)
                var endX = e.clientX
                var moveLen = resizeDom[i].left + (endX - startX) // (endx-startx)=移动的距离。resize[i].left+移动的距离=左边区域最后的宽度
                var maxT = operateDom[i].clientWidth - resizeDom[i].offsetWidth // 容器宽度 - 左边区域的宽度 = 右边区域的宽度
 
                if (moveLen < 200) moveLen = 200 // 左边区域的最小宽度为32px
                if (moveLen > maxT - 200) moveLen = maxT - 200 //右边区域最小宽度为150px
 
                resizeDom[i].style.left = moveLen // 设置左侧区域的宽度
                for (let j = 0; j < instructDom.length; j++) {
                  instructDom[j].style.width = moveLen + 'px'
                    logDom[j].style.width = operateDom[i].clientWidth - moveLen - 10 + 'px'
                }
            }
            // 鼠标松开事件
            document.onmouseup = function (evt) {
                //颜色恢复
                resizeDom[i].style.background = '#f0f2f5'
                document.onmousemove = null
                document.onmouseup = null
                resizeDom[i].releaseCapture && resizeDom[i].releaseCapture() //当你不在需要继续获得鼠标消息就要应该调用ReleaseCapture()释放掉
            }
            resizeDom[i].setCapture && resizeDom[i].setCapture() //该函数在属于当前线程的指定窗口里设置鼠标捕获
            return false
        }
    }
};
</script>
 
<style lang="less" scoped>
.simulation-result {
  width: 100%;
  height: 100%;
  position: relative;
}
.titleBox {
  height: 36px;
  line-height: 36px;
  background: #409eff;
  position: relative;
  .name {
    display: flex;
    justify-content: center; /* 水平居中 */
    align-items: center;
    img {
      margin-left: 10px;
    }
  }
  .back {
    position: absolute;
    left: 10px;
    top: 0;
    display: flex;
    align-items: center;
    color: #ffffff;
  }
}
.title {
  background: #409eff;
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  img {
    margin-left: 10px;
  }
}
.bodyBox {
  height: 70%;
  .modelBox {
    width: 60%;
    border: 1px solid #f1f1f1;
  }
  .shadowBox {
    width: 40%;
  }
  #shadowX,
  #shadowY,
  #shadowZ {
    background: #fff;
    height: calc((100% - 6px) / 3);
    border: 1px solid #f1f1f1;
  }
}
.operateBox {
  height: calc(100% - 36px - 70%);
  box-sizing: border-box;
  overflow: hidden;
  #instruct,
  #log {
    background: #fff;
    border: 1px solid #f1f1f1;
    width: calc((100% - 4px) / 2);
    height: 100%;
    box-sizing: border-box;
    float: left;
  }
  #resize {
    width: 3px;
    position: relative;
    cursor: col-resize;
    background-size: cover;
    background-position: center;
    &:hover {
      background: #45a3ff;
    }
  }
 
  .upBold {
    display: flex;
    align-items: center;
    color: #fff;
  }
 
  .instruct-body {
    height: calc(100% - 36px);
    position: relative;
    .instruct-list {
      height: calc(100% - 52px);
      overflow-y: auto;
      padding: 10px;
    }
    .inputBox {
      width: 100%;
      position: absolute;
      bottom: 0;
    }
  }
  .log-body {
    height: calc(100% - 36px);
    .log-list {
      height: calc(100% - 20px);
      overflow-y: auto;
      padding: 10px;
    }
  }
}
</style>