廖井涛
2025-07-25 6499ec45765ccbcf78c765445d0102aa4d918f98
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
 
 
 
 
<script setup>
import { Leafer, Polygon,Ellipse,Line,Path } from 'leafer-ui'
import {nextTick, onMounted, onUnmounted, onUpdated, reactive, ref, watch} from "vue"
import { saveAs } from 'file-saver';
import DXFWriter from 'dxf-writer';
import DxfParser from 'dxf-parser';
import {round} from "xe-utils";
import request from "@/utils/request";
import {ElMessage} from "element-plus";
 
let XMargin=ref(30)
let YMargin=ref(30)
let points=ref([])
let data1=ref(0)
let data2=ref(0)
let data3=ref(0)
let data4=ref(0)
let data5=ref(0)
let data6=ref(0)
let data7=ref(0)
let data8=ref(0)
 
let datas1=ref(0)
let datas2=ref(0)
let datas3=ref(0)
let datas4=ref(0)
let datas5=ref(0)
let datas6=ref(0)
let datas7=ref(0)
let datas8=ref(0)
let big=0
let leafer;
 
onMounted(() => {
  const main =document.getElementById('mains')
  const width =document.getElementById('width')
  const height =document.getElementById('height')
  const iocn =document.getElementById('iocn')
  width.innerHTML=1500
  height.innerHTML=600
  if(1500/400>600/300){
    big=1500/400
  }else{
    big=600/300
  }
  let widthAgv=1500/big
  let heightAgv=600/big
  main.style.width=widthAgv+"px"
  main.style.height=heightAgv+"px"
  main.style.backgroundColor="white"
  iocn.style.marginLeft=XMargin.value/big+"px"
  iocn.style.marginTop=YMargin.value/big+"px"
  datas2.value=heightAgv
  datas8.value=heightAgv
  datas5.value=widthAgv
  datas7.value=widthAgv
  leafer=new Leafer({ view: 'canvas' })
 
  points.value=[0, heightAgv, 0, 0, widthAgv, 0, widthAgv,heightAgv]
  const polygon = new Polygon({
    points: points.value,
    fill: '#32cd79',
    origin: [0, 0],
    scale:0.5
  })
  leafer.add(polygon)
 
})
const getproject = () =>  {
  leafer=new Leafer({ view: 'canvas' })
  points.value=[datas1.value+(parseInt(data1.value)/big), datas2.value-(parseInt(data2.value)/big), datas3.value+(parseInt(data3.value)/big), datas4.value+(parseInt(data4.value)/big),
    datas5.value-(parseInt(data5.value)/big), datas6.value+(parseInt(data6.value)/big), datas7.value-(parseInt(data7.value)/big), datas8.value-(parseInt(data8.value)/big)]
  const polygon = new Polygon({
    points: points.value,
    fill: '#32cd79',
    origin: [0, 0]
  })
  leafer.add(polygon)
 
}
 
const exportToDXF = () => {
  const dxf = new DXFWriter();
  const polygonPoints = points.value.map((coord, index) => ({
    x: index % 2 === 0 ? coord : undefined,
    y: index % 2 !== 0 ? -coord : undefined
  })).filter(point => point.x !== undefined && point.y !== undefined);
 
  let arr=[]
  for (let i=0;i<points.value.length;i++){
    let a=[]
    if(i % 2 === 0){
      a.push(points.value[i]*big)
      a.push((points.value[i+1]*big))
      a.push(0)
      arr.push(a)
    }
 
  }
  let minX = Infinity, minY = Infinity;
  let maxX = -Infinity, maxY = -Infinity;
  arr.forEach(p => {
    minX = Math.min(Math.abs(p[0]),minX );
    minY = Math.min(Math.abs(p[1]),minY);
    maxX = Math.max(Math.abs(p[0]),maxX );
    maxY = Math.max(Math.abs(p[1]),maxY);
  });
 
  arr.forEach(p => {
    p[1]=maxY-minY-p[1]
  });
 
 
  dxf.drawPolyline(arr,{ closed: true, layer: '0' })
 
  const blob = new Blob([dxf.toDxfString()], { type: 'text/plain;charset=utf-8' });
  saveAs(blob, 'map.dxf');
}
 
 
function toBottomOrigin(y, canvasHeight) {
  return canvasHeight - y; // 将左上角Y坐标转换为左下角坐标系
}
 
function addPolygonAsLines(dxf, points, layer = '0') {
  for (let i = 0; i < points.length; i++) {
    const nextIdx = (i + 1) % points.length;
    dxf.drawPolygon(
        points[i].x, points[i].y,
        points[nextIdx].x, points[nextIdx].y
    );
  }
}
 
const uploadToServer = (data, fileName) => {
  request.post('/order/upload-dxf', {
    fileName: fileName,
    fileData: data
  }, {
    headers: {'Content-Type': 'application/json'}
  });
};
 
const file = ref(null);
const triggerFileSelect = () => {
  request.post("/order/selectUploadDxf").then((res) => {
    if (res.code === "200" ) {
      console.log(res.data)
      const b64Data = res.data.data.file_data;
      const byteCharacters = atob(b64Data);
      const parser = new DxfParser();
      const dxfData = parser.parseSync(byteCharacters)
      console.log(dxfData)
    }
  })
};
 
 
 
const fileToBase64 = (file) => {
  return new Promise((resolve, reject) => {
    const reader = new FileReader();
    reader.onload = () => resolve(reader.result);
    reader.onerror = reject;
    reader.readAsDataURL(file);
  });
};
 
const handleFileUpload =  async (event) => {
  const main = document.getElementById('mains')
  const width = document.getElementById('width')
  const height = document.getElementById('height')
  leafer.removeAll()
  leafer = new Leafer({view: 'canvas'});
  const file = event.target.files[0];
  try {
    const base64 = await fileToBase64(file);
    const pureBase64 = base64.replace(/^data:.+;base64,/, "");
    uploadToServer(pureBase64, file.name)
  } catch (error) {
    console.error('转换失败:', error);
  }
  if (file) {
    const reader = new FileReader();
    reader.onload = async (e) => {
      const text = e.target.result;
      try {
        const parser = new DxfParser();
        const dxfData = parser.parseSync(text);
 
        let minX = Infinity, minY = Infinity;
        let maxX = -Infinity, maxY = -Infinity;
        dxfData.entities.forEach(entity => {
          if (entity.type === 'LINE' || entity.type === 'LWPOLYLINE') {
            entity.vertices.forEach(vertices => {
              minX = Math.min(Math.abs(vertices.x), minX);
              minY = Math.min(Math.abs(vertices.y), minY);
              maxX = Math.max(Math.abs(vertices.x), maxX);
              maxY = Math.max(Math.abs(vertices.y), maxY);
            })
          }
          if (entity.type === 'ARC') {
            const center = {x: entity.center.x, y: entity.center.y};
            const radius = entity.radius;
            const startAngle = entity.startAngle * (180 / Math.PI);
            const endAngle = entity.endAngle * (180 / Math.PI);
 
            const points = [];
            const steps = 32;
            for (let i = 0; i <= steps; i++) {
              const angle = startAngle + (endAngle - startAngle) * (i / steps);
              const x = center.x + radius * Math.cos(angle * Math.PI / 180);
              const y = center.y + radius * Math.sin(angle * Math.PI / 180);
              points.push({x, y});
            }
 
 
            points.forEach(p => {
              minX = Math.min(minX, p.x);
              minY = Math.min(minY, p.y);
              maxX = Math.max(maxX, p.x);
              maxY = Math.max(maxY, p.y);
            });
          }
        });
        if ((maxX - minX) / 400 > (maxY - minY) / 300) {
          big = (maxX - minX) / 400
        } else {
          big = (maxY - minY) / 300
        }
 
        Object.values(dxfData.entities).forEach(entity => {
          /*const bounds = drawEntity(entity);
 
          if (bounds) {
            minX = Math.min(minX, bounds.minX);
            minY = Math.min(minY, bounds.minY);
            maxX = Math.max(maxX, bounds.maxX);
            maxY = Math.max(maxY, bounds.maxY);
          }*/
          switch (entity.type) {
 
            case 'LINE':
              /*main.style.width=(maxX-minX)+"px"
              main.style.height=(maxY-minY)+"px"
              width.innerHTML=round(maxX-minX,2)
              height.innerHTML=round(maxY-minY,2)
              const line = new Line({
                points: [(Math.abs(entity.vertices[0].x)-minX)/big, toBottomOrigin((Math.abs(entity.vertices[0].y)-minY)/big,(maxY-minY)/big),
                  (Math.abs(entity.vertices[1].x)-minX)/big, toBottomOrigin((Math.abs(entity.vertices[1].y)-minY)/big,(maxY-minY)/big)],
                stroke: '#f00',
                strokeWidth: 2
              })*/
              main.style.width = (maxX - minX) / big + "px"
              main.style.height = (maxY - minY) / big + "px"
              width.innerHTML = round(maxX - minX, 2)
              height.innerHTML = round(maxY - minY, 2)
              const line = new Line({
                points: [(Math.abs(entity.vertices[0].x) - minX) / big, ((maxY - minY) - (Math.abs(entity.vertices[0].y) - minY)) / big,
                  (Math.abs(entity.vertices[1].x) - minX) / big, ((maxY - minY) - (Math.abs(entity.vertices[1].y) - minY)) / big],
                stroke: '#f00',
                strokeWidth: 1
              })
              setTimeout(() => {
                leafer.add(line);
              }, 30);
              break;
            case 'LWPOLYLINE':
 
              main.style.width = (maxX - minX) / big + "px"
              main.style.height = (maxY - minY) / big + "px"
              main.style.backgroundColor = "white"
              width.innerHTML = round(maxX - minX, 2)
              height.innerHTML = round(maxY - minY, 2)
              let point = entity.vertices.map(v => [
                (Math.abs(v.x) - minX) / big,
                toBottomOrigin((Math.abs(v.y) - minY) / big, (maxY - minY) / big),
              ]).flat()
              const polygon = new Polygon({
                points: point,
                fill: '#32cd79',
              })
              setTimeout(() => {
                leafer.add(polygon);
              }, 30);
 
              break;
            case 'CIRCLE':
              big = (entity.radius * 2) / 400
              main.style.width = entity.radius * 2 / big + "px"
              main.style.height = entity.radius * 2 / big + "px"
              width.innerHTML = round(entity.radius * 2, 2)
              height.innerHTML = round(entity.radius * 2, 2)
              const ellipse = new Ellipse({
                width: entity.radius * 2 / big,
                height: entity.radius * 2 / big,
                fill: "#32cd79"
              })
              setTimeout(() => {
                leafer.add(ellipse);
              }, 30);
 
              break;
            case 'ELLIPSE':
              console.log(entity)
 
              const {majorAxisEndPoint, axisRatio} = entity;
 
              const dx = majorAxisEndPoint.x;
              const dy = majorAxisEndPoint.y;
              const a = Math.sqrt(dx ** 2 + dy ** 2);
              const c = a * axisRatio;
              const θ = Math.atan2(dy, dx);
              const l = axisRatio * (180 / Math.PI);
 
              if ((a * 2) / 400 > (c * 2) / 300) {
                big = (a * 2) / 400
              } else {
                big = (c * 2) / 300
              }
 
              main.style.width = a * 2 / big + "px"
              main.style.height = c * 2 / big + "px"
              width.innerHTML = round(a * 2, 2)
              height.innerHTML = round(c * 2, 2)
              const ellipse2 = new Ellipse({
                width: a * 2 / big,
                height: c * 2 / big,
                fill: "#32cd79",
              })
 
              setTimeout(() => {
                leafer.add(ellipse2);
              }, 30);
 
              break;
            case 'ARC':
              const center = {x: entity.center.x, y: entity.center.y};
              const radius = entity.radius;
              const startAngle = entity.startAngle * (180 / Math.PI);
              const endAngle = entity.endAngle * (180 / Math.PI);
 
              if ((maxX - minX) / 400 > (maxY - minY) / 300) {
                big = (maxX - minX) / 400
              } else {
                big = (maxY - minY) / 300
              }
 
 
              // 计算圆弧的起点和终点
              const startX = (center.x + radius * Math.cos(entity.startAngle) - minX);
              const startY = (maxY - minY) - ((center.y + radius * Math.sin(entity.startAngle)) - minY);
              const endX = (center.x + radius * Math.cos(entity.endAngle) - minX);
              const endY = (maxY - minY) - ((center.y + radius * Math.sin(entity.endAngle)) - minY);
 
              // 创建圆弧路径
              const path = new Path({
                path: `M ${startX / big} ${startY / big} A ${radius / big} ${radius / big} 0 ${endAngle - startAngle > 180 ? 1 : 0} 0 ${endX / big} ${endY / big}`,
                stroke: '#f00',
                strokeWidth: 1,
              });
 
 
              setTimeout(() => {
                leafer.add(path);
              }, 30);
 
 
              break;
 
          }
        })
        // 自动缩放视图
        /*if (minX !== Infinity) {
          const width = maxX - minX;
          const height = maxY - minY;
          const centerX = (minX + maxX) / 2;
          const centerY = (minY + maxY) / 2;
 
          main.style.width=width/big+"px"
          main.style.height=height/big+"px"
 
        }*/
 
      } catch (error) {
        console.error('解析DXF文件时出错:', error);
      }
    };
    reader.readAsText(file);
  }
};
 
function drawEntity(entity) {
  switch (entity.type) {
    case 'LWPOLYLINE':
      return drawPolyline(entity);
    case 'POLYLINE':
      return drawPolyline(entity);
    case 'LINE':
      return drawLine(entity);
    case 'CIRCLE':
      return drawCircle(entity);
    case 'ARC':
      return drawArc(entity);
    case 'SPLINE':
      return drawSpline(entity);
    default:
      console.warn('Unsupported entity type:', entity.type);
      return null;
  }
}
 
let minX = Infinity, minY = Infinity;
let maxX = -Infinity, maxY = -Infinity;
// 绘制多段线
function drawPolyline(polyline) {
  const points = polyline.vertices.map(v => {
    return { x: Math.abs(v.x), y: Math.abs(v.y) }; // 翻转Y坐标
  });
 
  // 处理闭合多边形
  if (polyline.flags && polyline.flags.includes('closed') && points.length > 0) {
    points.push({...points[0]});
  }
 
  // 计算边界
 
  points.forEach(p => {
    minX = Math.min(p.x,minX);
    minY = Math.min(p.y,minY);
    maxX = Math.max(p.x,maxX);
    maxY = Math.max(p.y,maxY);
  });
 
  let agvX=maxX-minX
  let agvY=maxY-minY
 
 
  // 创建Leafer多边形
  const polygon = new Polygon({
    points: points.flatMap(p => [(p.x-minX)/big,(agvY-(p.y-minY))/big]),
    fill: 'rgba(100, 150, 255, 0.3)',
    stroke: '#32cd79',
    strokeWidth: 2,
    cornerRadius: 0,
    draggable: true
  });
 
  // 保存原始DXF数据
  polygon.dxfData = {
    type: polyline.type,
    layer: polyline.layer || '0',
    color: polyline.color || 7
  };
  setTimeout(() => {
    leafer.add(polygon);
  }, 30);
 
 
  return { minX, minY, maxX, maxY };
}
 
// 绘制直线
function drawLine(line) {
  const points = line.vertices.map(v => {
    return { x: Math.abs(v.x), y: Math.abs(v.y) };
  });
 
  points.forEach(p => {
    minX = Math.min(p.x,minX);
    minY = Math.min(p.y,minY);
    maxX = Math.max(p.x,maxX);
    maxY = Math.max(p.y,maxY);
  });
 
  let agvX=maxX-minX
  let agvY=maxY-minY
 
  const lineObj = new Line({
    points:[
      (points[0].x-minX)/big,(agvY-(points[0].y-minY))/big,
      (points[1].x-minX)/big,(agvY-(points[1].y-minY))/big
    ],
    stroke: '#32cd79',
    strokeWidth: 2
  });
 
  setTimeout(() => {
    leafer.add(lineObj);
  }, 30);
 
  return { minX, minY, maxX, maxY };
}
 
// 绘制圆
function drawCircle(circle) {
  const center = { x: circle.center.x, y: circle.center.y };
  const radius = circle.radius;
 
   minX = center.x - radius;
   minY = center.y - radius;
   maxX = center.x + radius;
   maxY = center.y + radius;
 
  const circleObj = new Leafer.Ellipse({
    x: center.x,
    y: center.y,
    radiusX: radius,
    radiusY: radius,
    fill: 'rgba(100, 150, 255, 0.3)',
    stroke: '#32cd79',
    strokeWidth: 2
  });
 
  circleObj.dxfData = {
    type: 'CIRCLE',
    layer: circle.layer || '0',
    color: circle.color || 7
  };
 
  leafer.add(circleObj);
 
  return { minX, minY, maxX, maxY };
}
 
// 绘制圆弧
function drawArc(arc) {
  const center = { x: arc.center.x, y: arc.center.y };
  const radius = arc.radius;
  const startAngle = arc.startAngle*(180/Math.PI);
  const endAngle = arc.endAngle*(180/Math.PI);
 
  const points = [];
  const steps = 32;
  for (let i = 0; i <= steps; i++) {
    const angle = startAngle + (endAngle - startAngle) * (i / steps);
    const x = center.x + radius * Math.cos(angle * Math.PI / 180);
    const y = center.y + radius * Math.sin(angle * Math.PI / 180);
    points.push({ x, y });
  }
 
 
  points.forEach(p => {
    minX = Math.min(minX, p.x);
    minY = Math.min(minY, p.y);
    maxX = Math.max(maxX, p.x);
    maxY = Math.max(maxY, p.y);
  });
  let agvX=maxX-minX
  let agvY=maxY-minY
 
  // 计算圆弧的起点和终点
  const startX = (center.x-minX)/big + radius/big * Math.cos(arc.startAngle);
  const startY = (agvY-(center.y-minY))/big + radius/big * Math.sin(arc.startAngle);
  const endX = (center.x-minX)/big + radius/big * Math.cos(arc.endAngle);
  const endY = (agvY-(center.y-minY))/big + radius/big * Math.sin(arc.endAngle);
 
  // 创建圆弧路径
  const path = new Path({
    path: `M ${endX} ${endY} A ${radius/big} ${radius/big} 0 ${endAngle - startAngle > 180 ? 1 : 0} 0 ${startX} ${startY}`,
    stroke: '#32cd79',
    strokeWidth: 2,
  });
 
 
  setTimeout(() => {
    leafer.add(path);
  }, 30);
 
 
  return { minX, minY, maxX, maxY };
}
 
// 绘制样条曲线(简化实现)
function drawSpline(spline) {
  if (!spline.controlPoints || spline.controlPoints.length < 2) {
    console.warn('Invalid SPLINE entity');
    return null;
  }
 
  const points = spline.controlPoints.map(p => {
    return { x: p.x, y: -p.y };
  });
 
  // 创建样条曲线路径(使用三次贝塞尔曲线近似)
  let pathData = `M ${points[0].x} ${points[0].y}`;
 
  if (points.length === 2) {
    pathData += ` L ${points[1].x} ${points[1].y}`;
  } else {
    for (let i = 1; i < points.length; i++) {
      const p0 = points[i-1];
      const p1 = points[i];
      const cp1x = p0.x + (p1.x - p0.x) / 3;
      const cp1y = p0.y + (p1.y - p0.y) / 3;
      const cp2x = p1.x - (p1.x - p0.x) / 3;
      const cp2y = p1.y - (p1.y - p0.y) / 3;
 
      pathData += ` C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${p1.x} ${p1.y}`;
    }
  }
 
  const path = new Leafer.Path({
    path: pathData,
    stroke: '#32cd79',
    strokeWidth: 2,
    fill: 'none'
  });
 
  path.dxfData = {
    type: 'SPLINE',
    layer: spline.layer || '0',
    color: spline.color || 7
  };
 
  leafer.add(path);
 
  // 计算边界
  points.forEach(p => {
    minX = Math.min(minX, p.x);
    minY = Math.min(minY, p.y);
    maxX = Math.max(maxX, p.x);
    maxY = Math.max(maxY, p.y);
  });
 
  return { minX, minY, maxX, maxY };
}
 
const handleInputX = (newValue) => {
  const iocn =document.getElementById('iocn')
  if(newValue+20*big<=1500){
    iocn.style.marginLeft=newValue/big+"px"
  }
 
};
const handleInputY = (newValue) => {
  const iocn =document.getElementById('iocn')
  iocn.style.marginTop=newValue/big+"px"
};
 
 
 
</script>
 
<template>
  <div style="width: 460px;height: 320px;justify-content: center;display: flex;">
    <div>
      <div id="width" style="height: 20px;"></div>
      <div id="height" style="width: 60px;margin-left: -40px;"></div>
      <div id="mains" style="margin-top: -20px" >
        <div id="iocn" style="width: 20px;height: 20px;position: absolute;"></div>
        <canvas  id="canvas" ></canvas>
      </div>
    </div>
 
 
  </div>
 
  <el-input class="contactNumber" @blur="getproject" type="text" v-model="data1" />
  <el-input class="contactNumber" @blur="getproject" type="text" v-model="data2"  />
  <el-input class="contactNumber" @blur="getproject" type="text" v-model="data3"  />
  <el-input class="contactNumber" @blur="getproject" type="text" v-model="data4"  /><br>
  <el-input class="contactNumber" @blur="getproject" type="text" v-model="data5"  />
  <el-input class="contactNumber" @blur="getproject" type="text" v-model="data6"  />
  <el-input class="contactNumber" @blur="getproject" type="text" v-model="data7"  />
  <el-input class="contactNumber" @blur="getproject" type="text" v-model="data8"  /><br>
  <el-button type="primary" @click="exportToDXF">导出DXF</el-button>
  <div>
    <input type="file" @change="handleFileUpload" accept=".dxf" />
  </div>
  <el-input-number @input="handleInputX"   v-model="XMargin"/>
  <el-input-number @input="handleInputY"   v-model="YMargin"/>
 
  <button @click="triggerFileSelect">选择文件</button>
</template>
 
<style>
.contactNumber{
  width: 60px;
  height:20px;
  border: none;
  box-shadow: none;
  font-size: 15px;
}
 
#mains {
  position: relative;
}
input[type="file"] {
  margin-top: 10px;
}
</style>