chenlu
2025-08-22 285af7c086a4764740bd676493ec8d6e74722fea
north-glass-erp/northglass-erp/src/components/sd/order/UpdateAlienEditor.vue
@@ -71,13 +71,18 @@
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 a1=ref(0);let a2=ref(0);let b1=ref(0);let b2=ref(0)
let c1=ref(0);let c2=ref(0);let d1=ref(0);let d2=ref(0)
//下拉框下输入的四个参数
let aValue=ref("0");let bValue=ref("0");let cValue=ref("0");let dValue=ref("0")
//下拉框的四个参数
let select1=ref("2");let select2=ref("2");let select3=ref("2");let select4=ref("2");let select5=ref("1")
let big=0
let leafer;
@@ -90,6 +95,7 @@
const ongetproject = (row) =>  {
  if(row.fileName==null||row.fileName==""){
    orderDetailWidth.value=row.width
    orderDetailHeight.value=row.height
    const main =document.getElementById('mains')
@@ -147,6 +153,7 @@
}
//绘制自由多边形
const getproject = () => {
    validate1()
    if(leafer!==undefined){
@@ -172,6 +179,7 @@
}
//添加圆
const add = () => {
  if (state.value){
    const height = document.getElementById('height')
@@ -204,6 +212,7 @@
  }
}
//添加矩形
const addRect = () => {
  if (state.value){
    const height = document.getElementById('height')
@@ -239,7 +248,7 @@
  }
}
//添加矩形的挖缺
const addDrilling = () => {
  if (state.value){
    const width = parseInt(document.getElementById('width').innerHTML)
@@ -315,19 +324,13 @@
      load()
      exportToDXF(1)
    }else{
      ElMessage.warning("请输入大于0的有效参数")
      //ElMessage.warning("请输入大于0的有效参数")
    }
  }
}
function getDistance(p1, p2) {
  const dx = p2[0] - p1[0];
  const dy = p1[1] - p2[1];
  return Math.sqrt(dx * dx + dy * dy);
}
//获取坐标最近的方法
function getDistancess(list,xy, fx) {
  if (list == null  || xy == null || xy.length != 3) {
    return null;
@@ -448,6 +451,7 @@
}
//绘制矩形的切角挖角弧度
const getproject2 = () => {
  states.value=true
  if (states.value){
@@ -458,31 +462,6 @@
    leafer=new Leafer({ view: 'canvas' })
    substringData()
    points.value=[]
    /*const radius = 50
    const cornerPoints = []
    const startX = 0 + radius  // 左上角右移
    const startY = 0
    const endX = 0
    const endY = 0 + radius    // 左上角下移
    const segments = 8 // 圆弧分段数,越多越平滑
    for (let i = 0; i <= segments; i++) {
      const angle = (Math.PI / 2) * (i / segments) // 90度角分段
      const x = radius - radius * Math.cos(angle)
      const y = radius - radius * Math.sin(angle)
      cornerPoints.push(x, y)
    }
    points.value = [
      0, 100,
      ...cornerPoints,  // 左上角圆弧点
      radius, 0,        // 回到圆弧起始点
      100, 0,          // 右上角
      100, 100        // 右下角
                // 左下角
    ]*/
    let state=0
@@ -573,25 +552,9 @@
    })
    leafer.add(polygon)
    /*if((select1.value=="1"&&bValue.value!=="0")||(select2.value=="1"&&cValue.value!=="0")||(select3.value=="1"&&aValue.value!=="0")||(select4.value=="1"&&dValue.value!=="0")){
      const polygon = new Polygon({
        points: points.value,
        stroke: '#f00',
        zIndex:2,
        cornerRadius: state/big
      })
      leafer.add(polygon)
    }else{
      const polygon = new Polygon({
        points: points.value,
        stroke: '#f00',
        zIndex:2,
      })
      leafer.add(polygon)
    }*/
    fileJson.value.polygon=[parseInt(a1.value),parseInt(a2.value),parseInt(b1.value),parseInt(b2.value),
      parseInt(c1.value),parseInt(c2.value),parseInt(d1.value),parseInt(d2.value)]
      parseInt(c1.value),parseInt(c2.value),parseInt(d1.value),parseInt(d2.value),select1.value,select2.value,select3.value,select4.value]
    load()
@@ -600,7 +563,7 @@
}
//绘制后的数据处理
const exportToDXF = async (value) => {
  const dxf = new DXFWriter();
@@ -685,7 +648,7 @@
}
//解析dxf文件
const fileToBase64 = (file) => {
  return new Promise((resolve, reject) => {
    const reader = new FileReader();
@@ -695,10 +658,13 @@
  });
};
//反向y坐标计算
function toBottomOrigin(y, canvasHeight) {
  return canvasHeight - y; // 将左上角Y坐标转换为左下角坐标系
}
//导入文件方法
const handleFile =  async (event) => {
  state.value=false
  const main = document.getElementById('mains')
@@ -732,6 +698,8 @@
  }
}
//解析dxf文件并显示方法
const handleFileUpload =  () => {
  const main =document.getElementById('mains')
  const width =document.getElementById('width')
@@ -956,6 +924,8 @@
  }
};
//界面输入框下拉框赋值
const selectData =  (item) => {
  if(item.quadrilateral!=null){
    state.value=true
@@ -977,10 +947,36 @@
    c2.value=item.polygon[5]
    d1.value=item.polygon[6]
    d2.value=item.polygon[7]
    if(item.polygon[0]==item.polygon[1]){
      aValue.value=item.polygon[0]+""
    }else{
      aValue.value=item.polygon[0]+"/"+item.polygon[1]
    }
    if(item.polygon[2]==item.polygon[3]){
      bValue.value=item.polygon[2]+""
    }else{
      bValue.value=item.polygon[2]+"/"+item.polygon[3]
    }
    if(item.polygon[4]==item.polygon[5]){
      cValue.value=item.polygon[4]+""
    }else{
      cValue.value=item.polygon[4]+"/"+item.polygon[5]
    }
    if(item.polygon[6]==item.polygon[7]){
      dValue.value=item.polygon[6]+""
    }else{
      dValue.value=item.polygon[6]+"/"+item.polygon[7]
    }
    select1.value=item.polygon[8]
    select2.value=item.polygon[9]
    select3.value=item.polygon[10]
    select4.value=item.polygon[11]
  }
}
//清空输入框
const validate = async () => {
  data1.value=0
  data2.value=0
@@ -994,6 +990,7 @@
  return true
}
//清空输入框
const validate1 = async () => {
  a1.value=0
  a2.value=0
@@ -1008,6 +1005,7 @@
  cValue.value="0"
  dValue.value="0"
}
//清空输入框
const validate2 = async () => {
  data1.value=0
  data2.value=0
@@ -1018,11 +1016,14 @@
  data7.value=0
  data8.value=0
}
//返回父级界面方法
defineExpose({
  validate,
  ongetproject
})
//保存方法
const save =  () => {
  if(fileName.value!=null&&fileDate.value!=null){
    fileJson.value.quadrilateral=[parseInt(data5.value),parseInt(data6.value),parseInt(data1.value),parseInt(data2.value),
@@ -1033,10 +1034,11 @@
    emits('getUploadPicture', fileName.value,fileDate.value,fileJson.value)
  }else{
    ElMessage.warning("未参与修改")
  }
}
//重置方法
const reset =  () => {
  validate1()
@@ -1120,6 +1122,7 @@
  circle.value.r = val;
}
//下拉框触发
const handleChange=(value)=> {
  getproject2()
  /*if(value=="1"){
@@ -1131,6 +1134,8 @@
  }*/
}
//通过/截取输入框的值
const  substringData = () =>{
  const indexA = aValue.value.indexOf("/");
  if(indexA==-1){
@@ -1166,6 +1171,7 @@
  }
}
const isQuadrilateral =  (maxY,minY,maxX,minX,point) => {
  state.value=true
  datas1.value=0
@@ -1196,6 +1202,7 @@
  ]
})
//表格删除
const getTableRow = (row,type) =>{
  switch (type) {
    case 'delete':{
@@ -1224,6 +1231,8 @@
  }
}
//重新加载保存的字典对象数据
const load= () =>{
  if (pointsRect.value.length > 0) {
@@ -1286,12 +1295,12 @@
    <el-input class="contactNumber" @blur="getproject" type="text" v-model="data7"  />
    <el-input class="contactNumber" @blur="getproject" type="text" v-model="data8"  /><br>
  </div>
  <div id="width" style="height: 20px;position: absolute;top: 342px;left: 725px;">{{$t('order.upper')}}</div>
  <div id="width" style="height: 20px;position: absolute;top: 364px;left: 725px;">{{$t('order.down')}}</div>
  <div id="width" style="height: 20px;position: absolute;top: 322px;left: 767px;">{{$t('order.horizontal')}}</div>
  <div id="width" style="height: 20px;position: absolute;top: 322px;left: 825px;">{{$t('order.vertical')}}</div>
  <div id="width" style="height: 20px;position: absolute;top: 322px;left: 900px;">{{$t('order.horizontal')}}</div>
  <div id="width" style="height: 20px;position: absolute;top: 322px;left: 965px;">{{$t('order.vertical')}}</div>
  <div  style="height: 20px;position: absolute;top: 342px;left: 725px;">{{$t('order.upper')}}</div>
  <div  style="height: 20px;position: absolute;top: 364px;left: 725px;">{{$t('order.down')}}</div>
  <div  style="height: 20px;position: absolute;top: 322px;left: 767px;">{{$t('order.horizontal')}}</div>
  <div  style="height: 20px;position: absolute;top: 322px;left: 825px;">{{$t('order.vertical')}}</div>
  <div  style="height: 20px;position: absolute;top: 322px;left: 900px;">{{$t('order.horizontal')}}</div>
  <div  style="height: 20px;position: absolute;top: 322px;left: 965px;">{{$t('order.vertical')}}</div>
  <div style="float: left;margin-top: 30px;margin-left: 690px;">
    <label for="file-upload" class="custom-file-upload">
      {{$t('order.selectFile')}}