廖井涛
4 天以前 2f44fc75c78e9291f07a0864199235cde689fa8d
north-glass-erp/northglass-erp/src/views/sd/order/UpdateOrderCraft.vue
@@ -13,6 +13,7 @@
import DxfParser from 'dxf-parser';
import { Leafer, Polygon,Ellipse,Line,Path } from 'leafer-ui'
import {round} from "xe-utils";
import {add} from '@/utils/decimal'
const { t } = useI18n()
const router = useRouter()
@@ -23,6 +24,9 @@
const company = companyInfo()
const xGrid = ref()
const trademarkLocation=ref([t('craft.upperLeft'),t('craft.upperRight'),t('craft.lowLeft'),t('craft.lowRight')])
const qrcodeLocation=ref({})
const gridOptions = reactive({
  loading:true,
  border:  "full",//表格加边框
@@ -158,7 +162,7 @@
        }
        case 'computedSize' :{
          let result = toolbarButtonClickEvent()
          if(!result || result.cell!=='childWidth'){
          if(!result || !(result.cell==='childWidth' || result.cell==='childHeight')){
            break
          }
          ElMessageBox.prompt('', '', {
@@ -171,8 +175,7 @@
                const value1 = value*1
                $grid.getTableData().visibleData.forEach((item,index) =>{
                  if(index>=result.start && index<=result.end){
                    item[result.cell] = item[result.cell]*1+value1
                    item[result.cell] =add(item[result.cell]*1,value1)
                  }
                })
@@ -251,7 +254,6 @@
              widthList.push(item.childWidth)
              arcList.push(item.arc)
              archRiseList.push(item.archRise)
              console.log(item.archRise)
            })
            widthList = widthList.sort();
            arcList = arcList.sort();
@@ -298,6 +300,8 @@
const trademarkAttr = ref({
  trademark:null,
  width:null,
  height:null,
  xImage:null,
  yImage:null,
  tag:null,
@@ -305,7 +309,17 @@
  tag3:null,
  xMargin:30,
  yMargin:30,
  location:[]
  location:[],
  qr1:{
    x:10,
    y:10,
    location:[]
  },
  qr2:{
    x:10,
    y:10,
    location:[]
  }
})
@@ -322,7 +336,7 @@
  if (res.code==200){
    trademarkList.value = res.data
    trademarkList.value.forEach(item =>{
      item.basicName
      item.nickname = JSON.parse(item.nickname)
    })
  }
@@ -366,32 +380,53 @@
  trademarkRow.value=row
  trademarkVisible.value= true
  /*Object.keys(trademarkAttr.value).forEach((key) => {
    if(key==='location'){
      trademarkAttr.value[key] = []
    }else if(key==='xMargin' || key==='yMargin'){
      trademarkAttr.value[key] = 30
    }else{
      trademarkAttr.value[key] = ''
  if(row.icon!=null && row.icon!==''){
    let trademark = JSON.parse(row.icon)
    if(trademark.qr2 === undefined){
      trademark.width = null
      trademark.height = null
      trademark.qr1 = {
        x:10,
        y:10,
        location:t('craft.lowLeft'),
      }
      trademark.qr2 = {
        x:10,
        y:10,
        location:t('craft.upperRight')
      }
    }
  })*/
  trademarkAttr.value = {
    trademark:"3C",
    xImage:false,
    yImage:false,
    tag:true,
    tag2:true ,
    tag3:true,
    xMargin:30,
    yMargin:30,
    location:t('craft.lowLeft')
    trademarkAttr.value = trademark
  }else{
    trademarkAttr.value = {
      trademark:trademarkList.value[0].basicName,
      width:trademarkList.value[0].nickname.width ,
      height:trademarkList.value[0].nickname.height,
      xImage:false,
      yImage:false,
      tag:true,
      tag2:true ,
      tag3:false,
      xMargin:30,
      yMargin:30,
      location:t('craft.lowLeft'),
      qr1:{
        x:10,
        y:10,
        location:t('craft.lowLeft'),
      },
      qr2:{
        x:10,
        y:10,
        location:t('craft.upperRight')
      }
    }
  }
  if(row.icon!=null){
    trademarkAttr.value = JSON.parse(row.icon)
  }
  trademarkList.value.forEach(item =>{
    if(item.basicName===trademarkAttr.value.trademark){
      iconNickname.value=item.nickname
      iconNickname.value=item.nickname.data
    }
  })
@@ -405,6 +440,7 @@
      exportToDXF()
    }
  }
  rowIndex.value.icon = JSON.stringify(trademarkAttr.value)
  trademarkVisible.value=false
  Object.keys(trademarkAttr.value).forEach((key) => (trademarkAttr.value[key] = ''))
@@ -434,6 +470,10 @@
//初始化判断是否有id传入
onMounted(()=>{
  addListener(xGrid.value,gridOptions)
  qrcodeLocation.value[t('craft.default')] = ""
  trademarkLocation.value.forEach(item =>{
    qrcodeLocation.value[item] = item
  })
  const str = route.query.orderId
  if (typeof str === 'undefined' || str === null || str === '' || str === '\n' || str === '\r'){
    return
@@ -497,12 +537,14 @@
const iconChange = () => {
  trademarkList.value.forEach(item =>{
    if(item.basicName===trademarkAttr.value.trademark){
      iconNickname.value=item.nickname
      iconNickname.value=item.nickname.data
      trademarkAttr.value.width=item.nickname.width
      trademarkAttr.value.height=item.nickname.height
    }
  })
  if(trademarkAttr.value.trademark===company.icon){
  /*if(trademarkAttr.value.trademark===company.icon){
    trademarkAttr.value.xMargin=66
  }
  }*/
}
@@ -574,7 +616,7 @@
      leafer.add(polygon);
    }, 30);
    trademarkAttr.value.location = t('craft.lowLeft')
    //trademarkAttr.value.location = t('craft.lowLeft')
  }else{
    state.value=false
    handleFileUpload()
@@ -800,7 +842,6 @@
          break;
        case 'ELLIPSE':
          console.log(entity)
          const {majorAxisEndPoint, axisRatio} = entity;
@@ -1274,11 +1315,11 @@
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        @closed="handleClosed"
        style="width: 922px;height:443px ;
        style="width: 1122px;height:750px;margin-top: 100px ;
        position: relative;" >
      <div style="width: 50%;height: 100%;float: left">
        <el-row style="">
          <el-col :span="4">{{$t('craft.TrademarkOptions')}}:</el-col>
          <el-col :span="5">{{$t('craft.TrademarkOptions')}}:</el-col>
          <el-col :span="6">
            <el-select v-model="trademarkAttr.trademark" @change ="iconChange" filterable>
              <el-option :value="item.basicName" v-for="item in trademarkList" />
@@ -1287,7 +1328,30 @@
        </el-row>
        <el-row>
          <el-col :span="4">{{$t('craft.xImage')}}:</el-col>
          <el-col :span="5">{{$t('craft.location')}}:</el-col>
          <el-col :span="25">
            <el-radio v-model="trademarkAttr.location" v-for="item in trademarkLocation" :label="item"  />
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="5">X:</el-col>
          <el-col :span="6">
            <el-input-number v-model="trademarkAttr.xMargin"/>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="5">Y:</el-col>
          <el-col :span="6">
            <el-input-number v-model="trademarkAttr.yMargin"/>
          </el-col>
        </el-row>
        <el-row >
          <el-col :span="5">{{$t('craft.xImage')}}:</el-col>
          <el-col :span="6">
            <el-select v-model="trademarkAttr.xImage">
              <el-option :value="true" :label="$t('basicData.true')"/>
@@ -1297,7 +1361,7 @@
        </el-row>
        <el-row>
          <el-col :span="4">{{$t('craft.yImage')}}:</el-col>
          <el-col :span="5">{{$t('craft.yImage')}}:</el-col>
          <el-col :span="6">
            <el-select v-model="trademarkAttr.yImage">
              <el-option :value="true" :label="$t('basicData.true')"/>
@@ -1307,7 +1371,7 @@
        </el-row>
        <el-row>
          <el-col :span="4">{{$t('craft.tag')}}:</el-col>
          <el-col :span="5">{{$t('craft.tag')}}:</el-col>
          <el-col :span="6">
            <el-select v-model="trademarkAttr.tag">
              <el-option :value="true" :label="$t('basicData.true')"/>
@@ -1315,9 +1379,9 @@
            </el-select>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="4">{{$t('craft.tag2')}}:</el-col>
<!--二维码1-->
        <el-row class="row_item">
          <el-col :span="5">{{$t('craft.tag2')}}:</el-col>
          <el-col :span="6">
            <el-select v-model="trademarkAttr.tag2">
              <el-option :value="true" :label="$t('basicData.true')"/>
@@ -1327,7 +1391,35 @@
        </el-row>
        <el-row>
          <el-col :span="4">{{$t('craft.tag3')}}:</el-col>
          <el-col :span="5">{{$t('craft.qr1Local')}}:</el-col>
          <el-col :span="25">
            <el-radio v-model="trademarkAttr.qr1.location"
                      v-for="(item,keys) in qrcodeLocation"
                      :value="item"
            >
              {{keys}}
            </el-radio>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="5">X:</el-col>
          <el-col :span="6">
            <el-input-number v-model="trademarkAttr.qr1.x"/>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="5">Y:</el-col>
          <el-col :span="6">
            <el-input-number v-model="trademarkAttr.qr1.y"/>
          </el-col>
        </el-row>
<!--二维码2-->
        <el-row class="row_item">
          <el-col :span="5">{{$t('craft.tag3')}}:</el-col>
          <el-col :span="6">
            <el-select v-model="trademarkAttr.tag3">
              <el-option :value="true" :label="$t('basicData.true')"/>
@@ -1337,38 +1429,46 @@
        </el-row>
        <el-row>
          <el-col :span="4">X:</el-col>
          <el-col :span="6">
            <el-input-number v-model="trademarkAttr.xMargin"/>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="4">Y:</el-col>
          <el-col :span="6">
            <el-input-number v-model="trademarkAttr.yMargin"/>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="4">{{$t('craft.location')}}:</el-col>
          <el-col :span="5">{{$t('craft.qr2Local')}}:</el-col>
          <el-col :span="25">
            <el-radio v-model="trademarkAttr.location" v-for="item in trademarkLocation" :label="item"  />
            <el-radio v-model="trademarkAttr.qr2.location"
                      v-for="(item,keys) in qrcodeLocation"
                      :value="item"
            >
              {{keys}}
            </el-radio>
          </el-col>
        </el-row>
        <el-row>
          <el-col >
            <el-button @click="changeTrademark" style="float:right;" type="primary" >{{$t('craft.sure')}}</el-button>
            <el-button @click="resetTrademark" style="float:right;margin-right: 0.5rem" type="primary" >{{$t('craft.reset')}}</el-button>
          <el-col :span="5">X:</el-col>
          <el-col :span="6">
            <el-input-number v-model="trademarkAttr.qr2.x"/>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="5">Y:</el-col>
          <el-col :span="6">
            <el-input-number v-model="trademarkAttr.qr2.y"/>
          </el-col>
        </el-row>
      </div>
      <div style="width: 404px;height: 254px;border: 2px solid #000;float: left;
      position: relative;display: flex;justify-content: center;align-content: center;">
          <div id="mains" ref="parent"  >
            <div id="iocn" ref="draggable"
            <div id="icon" ref="draggable"
                v-if="tagCheck(t('craft.upperLeft'))"
                :style="{marginLeft:trademarkAttr.xMargin/big+'px',marginTop:trademarkAttr.yMargin/big+'px'}"
                style="width: 20px;height: 20px;left: 0;top: 0;background-color: red;position: absolute;"
@@ -1376,13 +1476,13 @@
            >
              <el-image @dblclick="trademarkenlargement" style="width: 100%;height: 100%"   :src="iconNickname"/>
            </div>
            <div id="iocn" ref="draggable" v-if="tagCheck(t('craft.upperRight'))"  @mousedown="startDragUpperRight" :style="{marginRight:trademarkAttr.xMargin/big+'px',marginTop:trademarkAttr.yMargin/big+'px'}" style="width: 20px;height: 20px;right: 0;top: 0;background-color: red;position: absolute;">
            <div id="icon" ref="draggable" v-if="tagCheck(t('craft.upperRight'))"  @mousedown="startDragUpperRight" :style="{marginRight:trademarkAttr.xMargin/big+'px',marginTop:trademarkAttr.yMargin/big+'px'}" style="width: 20px;height: 20px;right: 0;top: 0;background-color: red;position: absolute;">
              <el-image @dblclick="trademarkenlargement" style="width: 100%;height: 100%"   :src="iconNickname"/>
            </div>
            <div id="iocn" ref="draggable" v-if="tagCheck(t('craft.lowLeft'))" @mousedown="startDragLowLeft" :style="{marginLeft:trademarkAttr.xMargin/big+'px',marginBottom:trademarkAttr.yMargin/big+'px'}" style="width: 20px;height: 20px;left: 0;bottom: 0;background-color: red;position: absolute;">
            <div id="icon" ref="draggable" v-if="tagCheck(t('craft.lowLeft'))" @mousedown="startDragLowLeft" :style="{marginLeft:trademarkAttr.xMargin/big+'px',marginBottom:trademarkAttr.yMargin/big+'px'}" style="width: 20px;height: 20px;left: 0;bottom: 0;background-color: red;position: absolute;">
              <el-image @dblclick="trademarkenlargement" style="width: 100%;height: 100%"   :src="iconNickname"/>
            </div>
            <div id="iocn" ref="draggable" v-if="tagCheck(t('craft.lowRight'))" @mousedown="startDragLowRight" :style="{marginRight:trademarkAttr.xMargin/big+'px',marginBottom:trademarkAttr.yMargin/big+'px'}" style="width: 20px;height: 20px;right: 0;bottom: 0;background-color: red;position: absolute;">
            <div id="icon" ref="draggable" v-if="tagCheck(t('craft.lowRight'))" @mousedown="startDragLowRight" :style="{marginRight:trademarkAttr.xMargin/big+'px',marginBottom:trademarkAttr.yMargin/big+'px'}" style="width: 20px;height: 20px;right: 0;bottom: 0;background-color: red;position: absolute;">
              <el-image @dblclick="trademarkenlargement" style="width: 100%;height: 100%"   :src="iconNickname"/>
            </div>
           <canvas  id="canvas" ></canvas>
@@ -1390,8 +1490,8 @@
      </div>
      <div id="width" style="height: 20px;position: absolute;top: 33px;left: 652px;">{{orderDetailWidth}}</div>
      <div id="height" style="width: 60px;position: absolute;top: 178px;left: 390px;">{{orderDetailHeight}}</div>
      <div id="width" style="height: 20px;position: absolute;top: 33px;left: 752px;">{{orderDetailWidth}}</div>
      <div id="height" style="width: 60px;position: absolute;top: 178px;right: 100px;">{{orderDetailHeight}}</div>
      <div style="float: left;margin-top: 20px;margin-left: 80px">
        <el-input class="contactNumber" @blur="getproject" type="text" v-model="data1" />
        <el-input class="contactNumber" @blur="getproject" type="text" v-model="data2"  />&nbsp;&nbsp;&nbsp;
@@ -1402,15 +1502,23 @@
        <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: 332px;left: 520px;">{{$t('order.upper')}}</div>
      <div id="width" style="height: 20px;position: absolute;top: 354px;left: 520px;">{{$t('order.down')}}</div>
      <div id="width" style="height: 20px;position: absolute;top: 312px;left: 562px;">{{$t('order.horizontal')}}</div>
      <div id="width" style="height: 20px;position: absolute;top: 312px;left: 625px;">{{$t('order.vertical')}}</div>
      <div id="width" style="height: 20px;position: absolute;top: 312px;left: 695px;">{{$t('order.horizontal')}}</div>
      <div id="width" style="height: 20px;position: absolute;top: 312px;left: 760px;">{{$t('order.vertical')}}</div>
      <div id="width" style="height: 20px;position: absolute;top: 332px;left: 520px;margin-left: 80px">{{$t('order.upper')}}</div>
      <div id="width" style="height: 20px;position: absolute;top: 354px;left: 520px;margin-left: 80px">{{$t('order.down')}}</div>
      <div id="width" style="height: 20px;position: absolute;top: 312px;left: 562px;margin-left: 80px">{{$t('order.horizontal')}}</div>
      <div id="width" style="height: 20px;position: absolute;top: 312px;left: 625px;margin-left: 80px">{{$t('order.vertical')}}</div>
      <div id="width" style="height: 20px;position: absolute;top: 312px;left: 695px;margin-left: 80px">{{$t('order.horizontal')}}</div>
      <div id="width" style="height: 20px;position: absolute;top: 312px;left: 760px;margin-left: 80px">{{$t('order.vertical')}}</div>
      <div v-if="enlargementFlag" style="width: 400px;height: 250px;float: left;position: relative;background-color: red">
        <el-image  @dblclick="trademarkenlargement" style="z-index: 9999;max-width: 100%;max-height: 100%" :src="iconNickname"/>
      </div>
      <template #footer style="width: 100%;height: 100%">
                <el-row>
                  <el-col >
                    <el-button @click="changeTrademark" style="float:right;" type="primary" >{{$t('craft.sure')}}</el-button>
                    <el-button @click="resetTrademark" style="float:right;margin-right: 0.5rem" type="primary" >{{$t('craft.reset')}}</el-button>
                  </el-col>
                </el-row>
      </template>
    </el-dialog>
  </div>
</template>
@@ -1468,4 +1576,12 @@
#mains {
  position: relative;
}
:deep(#trademark .el-dialog__body){
  height: 85%;
  width: 100%;
  overflow-y: auto;
}
.row_item{
  margin-top: 30px;
}
</style>