index.js 29.3 KB
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
/* eslint-disable */
// eslint-disable-next-line no-plusplus
// eslint-disable-next-line no-mixed-operators

import React, { Component } from 'react';
import * as commonUtils from '../../../utils/utils';
import styles from './index.less';

const dScale = 5;
export default class ShowImg extends Component {
  constructor(props) {
    super(props);
    this.state = {
    };
  }


  /* 根据不同条件 计算排版数 */
  //竖排(上机高、上机宽、部件高、部件宽、出血咬口) dPartsLength --》dMachineLength,dPartsWidth--》dMachineWidth
  getSp = (dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth)=>{
    var dMachineWidth = dMachineWidth;
    var dMachineLength = dMachineLength;
    //计算合版数量
    var iTemp = Math.floor(dMachineWidth / dPartsWidth) * Math.floor(dMachineLength /dPartsLength );
    return iTemp;
  }
  //横排(上机高、上机宽、部件高、部件宽、出血咬口) dPartsLength --》dMachineWidth,dPartsWidth--》dMachineLength
  getHp = (dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth) =>{
    var dMachineWidth = dMachineWidth;
    var dMachineLength = dMachineLength;
    //计算合版数量
    var iTemp = Math.floor(dMachineWidth / dPartsLength) * Math.floor(dMachineLength / dPartsWidth);
    return iTemp;
  }
  //横竖取大
  getHSQD = (dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth) =>{
    var iTemp =this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
    var iTemp2 =this.getSp(dMachineLength,dMachineWidth,dPartsLength,dPartsWidth);
    if(iTemp2>iTemp){
      iTemp = iTemp2;
      // tag= 2;//竖排
    }
    return iTemp;
  }


  getTag = (dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth) =>{
    let num = 1;
    var iTemp =this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
    var iTemp2 =this.getSp(dMachineLength,dMachineWidth,dPartsLength,dPartsWidth);
    if(iTemp2>iTemp){
      num= 2;//竖排
    }
    return num;
  }

  //传入参数  宽、高、长、宽
  getHHP =(dMatLength,dMatWidth ,dLength ,dWidth) =>{
    var p_dMatLength = dMatLength;//
    var p_dMatWidth = dMatWidth;//
    var p_dLength = dLength;//长度*2+两个出血位
    var p_dWidth = dWidth;//高度+两个出血位
    var tr = Math.floor(p_dMatWidth / p_dWidth);
    var td = Math.floor(p_dMatLength / p_dLength);
    //计算合版数量
    var iTemp = Math.floor(p_dMatLength / p_dLength) * Math.floor(p_dMatWidth / p_dWidth);
    var iTemp2 = 0;
    var tmp = true;
    if(dLength>=dWidth){
      //竖向调用进来的 竖+横
      tmp = dMatWidth > p_dLength;
    }else{
      tmp = dMatLength > dWidth;
    }
    var tr2 = 0;
    var td2 = 0;
    //横排
    if(dLength>=dWidth){
      if ((p_dMatLength - td * p_dLength) >=  p_dWidth && tmp)
      {
        if(dLength>=dWidth){
          //横+竖 才会左边
          // floats=" style='float:left';";
        }
        tr2 = Math.floor(p_dMatWidth/ p_dLength);
        td2 = Math.floor((p_dMatLength - td * p_dLength)/p_dWidth);
      }
    }else{//竖排
      if ((p_dMatWidth - tr * p_dWidth) >=  p_dLength && tmp){
        tr2 = Math.floor((p_dMatWidth - tr * p_dWidth)/p_dLength);
        td2 = Math.floor(p_dMatLength/ p_dWidth);
        // dTableWidth2 = td2*p_dWidth;
        // dTableHeight2 = tr2*p_dLength;
        // dTrWidth2 = td2*p_dWidth;
        // dTrHeight2 = p_dLength;
        // dTdWidth2 = dLength;
        // dTdHeight2 = dWidth;
      }
    }
    iTemp2 = tr2*td2;
    iTemp = iTemp+iTemp2;
    return iTemp;
  }

  //添加HTML
  // <select id="sPrintingPlate"  name="sPrintingPlate">
  // <option value="1">横竖取大</opion>
  // <option value="3">横排</opion>
  // <option value="4">竖排</opion>
  // <option value="2">混排</opion>
   addHtml=(dMachineLength, dMachineWidth , dPartsLength , dPartsWidth, dBoold ,dBite,sPrintingPlate,xxfx,wlfx)=>{

    const elements = [];
    var dDivHeight = dMachineLength+dBite;//传入的为减去咬口计算时的高度
    var dDivWidth = dMachineWidth;//宽度
    var dTableWidth = 0;
    var dTableHeight = 0;
    var dTrWidth = 0;
    var dTrHeight = 0;
    var dTdWidth = 0;
    var dTdHeight = 0;
    var tr = 0;
    var td = 0;
    if(sPrintingPlate===3){//横排(垂直纹路)
      dTableHeight = Math.floor(dMachineLength / dPartsWidth)*dPartsWidth;
      dTableWidth = Math.floor(dMachineWidth / dPartsLength)*dPartsLength;
      dTrWidth =  Math.floor(dMachineWidth / dPartsLength)*dPartsLength;
      dTrHeight = dPartsWidth;
      dTdWidth = dPartsLength;
      dTdHeight = dPartsWidth;
      tr =  Math.floor(dMachineLength / dPartsWidth);
      td = Math.floor(dMachineWidth / dPartsLength);
    } else {//竖排(顺纹路)
      dTableHeight = Math.floor(dMachineLength / dPartsLength)*dPartsLength;
      dTableWidth = Math.floor(dMachineWidth / dPartsWidth)*dPartsWidth;
      dTrWidth = Math.floor(dMachineWidth / dPartsWidth)*dPartsWidth;
      dTrHeight = dPartsLength;
      dTdWidth = dPartsWidth;
      dTdHeight = dPartsLength;
      tr = Math.floor(dMachineLength / dPartsLength);
      td = Math.floor(dMachineWidth / dPartsWidth);
    }
    // alert("宽度:"+(dTdWidth-2*dBoold)+"  高度:"+(dTdHeight-2*dBoold)+" 出血:"+dBoold);
     const sStyleObject = {};
     // sStyleObject.position = 'absolute';
     // sStyleObject.background = '#DDDDFF';
     sStyleObject.width = dDivWidth / dScale + 10;
     sStyleObject.height = dDivHeight / dScale + 10;
     sStyleObject.color = 'red';
     const num = {};
     num.display = 'block';
     num.position = 'absolute';
     num.width = '28px';
     num.top = '48%';
     num.fontSize = '12px';

    var floats =  "";
    // var html ="";
    // var div = "<div style='background:#DDDDFF;width:" + dDivWidth + "px;height:" + dDivHeight +"px' dBite =" + dBite + " dBoold =" + dBoold + " >";
    // var table = this.getTable(dTableWidth,dTableHeight,dTrWidth,dTrHeight,dTdWidth,dTdHeight,floats,dBoold,tr,td,xxfx);
    // html = div + table + "</div>";

     elements.push(<div style={sStyleObject} className={wlfx ===1 ? styles.area :styles.area2} dBite ={dBite} dBlood ={dBoold}>
       <div className={styles.divHeight}><div className={styles.divArrowLeft} /><div className={styles.divHeightLine}>{dMachineWidth + dBite}</div><div className={styles.divArrowRight} /></div> <div className={styles.divWidth}><div className={styles.divArrowTop} /><div className={styles.divWidthLine}><span style={num}>{dMachineLength}</span></div> <div className={styles.divArrowTop} /></div>
       {this.getTable(dTableWidth,dTableHeight,dTrWidth,dTrHeight,dTdWidth,dTdHeight,floats,dBoold,tr,td,xxfx)}
     </div>);

     return elements;
  }

  handleGetChildTd = (dTableWidth, dTableHeight, dTrWidth, dTrHeight, dTdWidth, dTdHeight, floats, dBoold, tr, td, xxfx , i) => {
    const tdArr = [];
    /* xxfx  虚线方向 2:横虚线 1:树虚线;3:无需虚线 */
    // console.log('虚线方向:', xxfx);
    const sTdDiv ={};
    sTdDiv.fontSize ='12px';
    sTdDiv.position ='relative';
    const { controlData, controlSelectedRowKeys} = this.props;
    let dCutMethod = 1; /* 默认三边裁 */
    if(commonUtils.isNotEmptyArr(controlData) && commonUtils.isNotEmptyArr(controlSelectedRowKeys)) {
      const iIndex = controlData.findIndex(item => controlSelectedRowKeys.includes(item.sId));
      if (iIndex > -1) {
        const tableDataRow = controlData[iIndex];
        const sSpineDirection = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.sSpineDirection, 0)); /* 书脊方向 */
        dCutMethod = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.sCutMethod, 0));  /* 裁切方式 */
        if(sSpineDirection ===1){ /* 长 */
          /* 长书脊逻辑 */
          if(xxfx ===2) { /* 横虚线 */
            sTdDiv.width = dTdWidth / dScale;
            // sTdDiv.height = '25%';
            sTdDiv.borderBottom='1px dashed #ff0000';
          } else if(xxfx ===1) {  /* 树虚线 */
            sTdDiv.width = dTdWidth / dScale / 2;
            sTdDiv.height = dTdHeight / dScale ;
            sTdDiv.borderRight='1px dashed #ff0000';
          }
        } else{
          /* 短书脊逻辑 */
          if(xxfx ===1) { /* 横虚线 */
            sTdDiv.width = dTdWidth / dScale;
            // sTdDiv.height = '25%';
            sTdDiv.borderBottom='1px dashed #ff0000';
          } else if(xxfx ===2) {  /* 树虚线 */
            sTdDiv.width = dTdWidth / dScale / 2;
            sTdDiv.height = dTdHeight / dScale ;
            sTdDiv.borderRight='1px dashed #ff0000';
          }
        }

      }
    }

    for (let j = 0; j < td; j++) {
      tdArr.push(<td width={dTdWidth/dScale }  height={dTdHeight/dScale } dZyBoold={dBoold } xxfx={xxfx} style={{'position':'relative'}}>
      {((td === 1 && j ===0))  && i === 0 ? <div className={dCutMethod === 1 ? styles.tdStyleM : styles.tdStyleM}><div className={styles.tdWidth}>{dTdWidth - dBoold * 2 }</div> </div> : ''}
        {((td === 1 && j ===0))  && i === 0  ? <div className={dCutMethod ===1 ? styles.tdStyleM1 : styles.tdStyleM1}><div className={styles.tdWidth}>{dTdHeight - dBoold * 2  }</div> </div> : ''}
        {((td > 1 && j ===0))  && i === 0 ? <div className={dCutMethod === 1 ? styles.tdStyleM : styles.tdStyleM}><div className={styles.tdWidth}>{dTdWidth - dBoold * 2 }</div> </div> : ''}
        {((td > 1 && j ===0))  && i === 0  ? <div className={dCutMethod ===1 ? styles.tdStyleM1 : styles.tdStyleM1}><div className={styles.tdWidth}>{dTdHeight - dBoold * 2 }</div> </div> : ''}
        <div style={sTdDiv}></div>
      </td>);
    }
    return tdArr;
  }

  handleGetChildTr = (dTableWidth, dTableHeight, dTrWidth, dTrHeight, dTdWidth, dTdHeight, floats, dBoold, tr, td, xxfx) => {
    const trArr = [];
    // eslint-disable-next-line no-plusplus
    for (let i = 0; i < tr; i++) {
      trArr.push(<tr width={dTrWidth / dScale } height={dTrHeight / dScale }>
        {this.handleGetChildTd(dTableWidth, dTableHeight, dTrWidth, dTrHeight, dTdWidth, dTdHeight, floats, dBoold, tr, td, xxfx, i)}
      </tr>);
    }
    return trArr;
  }

  //dDivWidth 对应length,height:对应上级Width xxfx  虚线方向 2:横虚线 1:树虚线;3:无需虚线
   getTable = (dTableWidth, dTableHeight, dTrWidth, dTrHeight, dTdWidth, dTdHeight, floats, dBoold, tr, td, xxfx) =>{
    const table = [];
    table.push(<table bgcolor="yellow" border="1" width={dTableWidth / dScale } height={ dTableHeight / dScale } className={styles.sTable} style={{floats:floats}} >
      {this.handleGetChildTr(dTableWidth, dTableHeight, dTrWidth, dTrHeight, dTdWidth, dTdHeight, floats, dBoold, tr, td, xxfx)}
    </table>)
    // var table = " <table  bgcolor ='yellow' border='1' width ='" + dTableWidth /4 + "' height ='" + dTableHeight /4 + "' " + floats + ">";
    // for(var i = 0;i<tr;i++){
    //   table = table + "<tr width ='"+dTrWidth/4 +"' height ='"+dTrHeight/4 +"' dSxBoold='"+dBoold*4+"' >";
    //   for(var j = 0;j<td;j++){
    //     table = table + "<td width ='"+dTdWidth/4+"' height = '"+dTdHeight/4+"' dZyBoold='"+dBoold*4+"' xxfx='"+xxfx+"' ></td>";
    //   }
    //   table = table + "</tr>";
    //
    // }
    // table = table+ "</table>";
    return table;
  }

  // //横向+竖 添加HTML
   getHHPHtml = (dMatLength,dMatWidth ,dLength ,dWidth,dBoold ,dBite,wlfx) =>{
    const elements =[];
    var p_dMatLength = dMatLength;
    var p_dMatWidth = dMatWidth;//减去咬口后的高度
    var p_dLength = dLength;//长度*2+两个出血位
    var p_dWidth = dWidth;//高度+两个出血位

    var dDivWidth =  dMatLength;
    var dDivHeight = dMatWidth;
    var dTableWidth = Math.floor(p_dMatLength / p_dLength)*p_dLength;
    var dTableHeight = Math.floor(p_dMatWidth / p_dWidth)*p_dWidth;
    var dTrWidth = Math.floor(p_dMatLength / p_dLength)*p_dLength;
    var dTrHeight = p_dWidth;
    var dTdWidth = dLength;
    var dTdHeight = dWidth;
    var iTemp2 = 0;
    var floats="";
    var tr = Math.floor(p_dMatWidth / p_dWidth);
    var td = Math.floor(p_dMatLength / p_dLength);

    var tmp = true;
    if(dLength >= dWidth){
      //竖向调用进来的 竖+横
      tmp = dMatWidth > p_dLength;
    }else{
      tmp = dMatLength > p_dWidth;
    }
    var tr2 = 0;
    var td2 = 0;
    //大的长 - Math.floor(大长 / 小长)*小长>= 小短, 并且大的高度>小的长度
    var dTableWidth2 = 0;
    var dTableHeight2 = 0;
    var dTrWidth2 = 0;
    var dTrHeight2 = 0;
    var dTdWidth2 = 0;
    var dTdHeight2 = 0;

    if(dLength>=dWidth){
      // alert(p_dMatLength - td * p_dLength);
      // alert(p_dWidth);
      if ((p_dMatLength - td * p_dLength) >=  p_dWidth && tmp)
      {
        if(dLength>=dWidth){
          //横+竖 才会左边
          floats=" style='float:left';";
        }
        tr2 = Math.floor(p_dMatWidth/ p_dLength);
        td2 = Math.floor((p_dMatLength - td * p_dLength)/p_dWidth);
        dTableWidth2 = td2*p_dWidth;
        dTableHeight2 = tr2*p_dLength;
        dTrWidth2 = td2*p_dWidth;
        dTrHeight2 = p_dLength;
        dTdWidth2 = p_dWidth;
        dTdHeight2 = p_dLength;
      }
    }else{
      if ((p_dMatWidth - tr * p_dWidth) >=  p_dLength && tmp)
      {
        tr2 = Math.floor((p_dMatWidth - tr * p_dWidth)/p_dLength);
        td2 = Math.floor(p_dMatLength/ p_dWidth);
        dTableWidth2 = td2*p_dWidth;
        dTableHeight2 = tr2*p_dLength;
        dTrWidth2 = td2*p_dWidth;
        dTrHeight2 = p_dLength;
        dTdWidth2 = p_dWidth;
        dTdHeight2 = p_dLength;
      }
    }

    iTemp2 = tr2 * td2;
     // var html ="";
     // var div = "<div style=\"background:#DDDDFF;width:" + dMatLength + "px;height:" + dMatWidth + " \" width =" + dMatLength + "px height ='" + dMatWidth + "' dBite ='" + dBite + "'  >";
     // var table = getTable(dTableWidth,dTableHeight,dTrWidth,dTrHeight,dTdWidth,dTdHeight,floats,dBoold,tr,td,0);
     //
     //
     // if(iTemp2>0){
     //   table = table + getTable(dTableWidth2,dTableHeight2,dTrWidth2,dTrHeight2,dTdWidth2,dTdHeight2,floats,dBoold,tr2,td2,0);
     // }
     // html = div + table + "</div>";
     // $("#table").html(html);
     const sStyleObject = {};
     // sStyleObject.position = 'absolute';
     // sStyleObject.background = '#DDDDFF';
     sStyleObject.width = dMatLength / dScale + 10;
     sStyleObject.height = dMatWidth / dScale + 10;
     sStyleObject.color = 'red';
     const num = {};
     num.display = 'block';
     num.position = 'absolute';
     num.width = '28px';
     num.top = '48%';
     num.fontSize = '12px';

    if(iTemp2>0){
      elements.push(<div className={wlfx ===1 ? styles.area :styles.area2} style={sStyleObject} width={dMatLength/dScale}  height={dMatWidth / dScale} dBite ={dBite} dBlood ={dBoold}>
        <div className={styles.divHeight}><div className={styles.divArrowLeft} /><div className={styles.divHeightLine}>{dMatLength + dBite}</div><div className={styles.divArrowRight} /></div> <div className={styles.divWidth}><div className={styles.divArrowTop} /><div className={styles.divWidthLine}><span style={num}>{dMatWidth}</span></div> <div className={styles.divArrowTop} /></div>
        {this.getTable(dTableWidth,dTableHeight,dTrWidth,dTrHeight,dTdWidth,dTdHeight,floats,dBoold,tr,td,0)}
        {this.getTable(dTableWidth2,dTableHeight2,dTrWidth2,dTrHeight2,dTdWidth2,dTdHeight2,floats,dBoold,tr2,td2,0)}
      </div>);
    } else {
      elements.push(<div className={wlfx ===1 ? styles.area :styles.area2} style={sStyleObject} width={dMatLength/dScale}  height={dMatWidth / dScale} dBite ={dBite} dBlood ={dBoold}>
        <div className={styles.divHeight}><div className={styles.divArrowLeft} /><div className={styles.divHeightLine}>{dMatLength + dBite}</div><div className={styles.divArrowRight} /></div> <div className={styles.divWidth}><div className={styles.divArrowTop} /><div className={styles.divWidthLine}><span style={num}>{dMatWidth}</span></div> <div className={styles.divArrowTop} /></div>
        {this.getTable(dTableWidth,dTableHeight,dTrWidth,dTrHeight,dTdWidth,dTdHeight,floats,dBoold,tr,td,0)}
      </div>);
    }
    return elements;
  }


  /* 计算排版数 */
  handleGetImgPQty = (tableDataRow) => {
    let divStr =[];
    let dSingleQty = 0; /* 排版数 */
    let tag = 1;//1横排还是2竖排
    let dPartsWidth = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.dPartsWidth, 0)); /* 产品长 */
    let dPartsLength = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.dPartsLength, 0)); /* 产品宽 */
    let dMachineWidth = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.dMachineWidth, 0)); /* 上机宽 */
    let dMachineLength = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.dMachineLength, 0)); /* 上机长 */

    const dBoold = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.dBlood, 0)); /* 出血位 */
    const dBite = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.dBite, 0)); /* 咬口 */
    // console.log('dPartsWidth', dPartsWidth, dPartsLength);
    var dMachineTmp = 0;
    var dPartsTmp = 0;
    var tagval = "";
    var xxfx = 3;//虚线方向 1:横虚线 2:树虚线;3:无需虚线
    var wlfx = 1;//竖纹
    //机器长宽转换
    if(dMachineWidth > dMachineLength){
      dMachineTmp = dMachineWidth;//上级高
      dMachineWidth = dMachineLength;//上级宽
      dMachineLength = dMachineTmp;
      wlfx = 2;
    }
    //长宽转换(dLength 高度、dWidth 表示宽度,高度永远大于宽度)
    if(dPartsWidth > dPartsLength){
      dPartsTmp = dPartsWidth;//上级高
      dPartsWidth = dPartsLength;//上级宽
      dPartsLength = dPartsTmp;
    }
    dMachineWidth = dMachineWidth-dBite;

    const sCutMethod = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.sCutMethod, 0));  /* 裁切方式 */
    const sSpineDirection = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.sSpineDirection, 0)); /* 书脊方向 */
    const sPrintingPlate =  commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.sPrintingPlate, 0)); /* 排版方式 */
    // console.log('sPrintingPlate', sPrintingPlate);
    // console.log('sCutMethod', sCutMethod);
    // console.log('sSpineDirection', sSpineDirection);
    let tmpBl = 1;//排版数乘的数字,如果书类为2 默认是1
    let tmp = 0;
    //三边裁切
    if( sCutMethod === 1){
      //长书(1,3,4)
      if(sSpineDirection=== 1){
        dPartsLength = dPartsLength;
        dPartsWidth = dPartsWidth*2;
      }else{
        dPartsWidth = dPartsWidth
        dPartsLength = dPartsLength*2;
      }
      tmpBl = 2;
      dPartsWidth = dPartsWidth + 2*dBoold;
      dPartsLength = dPartsLength + 2*dBoold;
      if(sPrintingPlate === 1){ /* 横竖取大 */
        tmp = this.getHSQD(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
        dSingleQty = tmp*2;
        tag =  this.getTag(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
        if(tag===2){
          // alert("横竖取大==版数:"+tmp*2);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,1 , wlfx);
        } else {
          // alert("横竖取大==版数:"+tmp*2);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,2, wlfx);
        }

        // console.log('横竖取大排版数:', dSingleQty);
      }else if(sPrintingPlate ===3){  /* 横排 */
        if(wlfx===1 && sSpineDirection===1){
          //长书脊
          tmp = this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,2, wlfx);
          dSingleQty = tmp*2;
        }else if(wlfx===2 && sSpineDirection===1){
          //长书脊
          tmp = this.getSp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,1, wlfx);
          dSingleQty = tmp*2;
        }else if(wlfx===1 && sSpineDirection===2){
          //长书脊
          tmp = this.getSp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,1, wlfx);
          dSingleQty = tmp*2;
        }else if(wlfx==2 && sSpineDirection==2){
          //长书脊
          tmp = this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,2, wlfx);
          dSingleQty = tmp*2;
        }
      }else if(sPrintingPlate===4) {  /* 竖排 */
        //竖排
        if(wlfx===1 && sSpineDirection===1){
          //长书脊
          tmp = this.getSp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,1, wlfx);
          dSingleQty = tmp*2;
        }else if(wlfx===2 && sSpineDirection===1){
          //长书脊
          tmp = this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,2, wlfx);
          dSingleQty = tmp*2;
        }else if(wlfx===1 && sSpineDirection===2){
          //长书脊
          tmp = this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,2, wlfx);
          dSingleQty = tmp*2;
        }else if(wlfx===2 && sSpineDirection===2){
          //长书脊
          tmp = this.getSp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,1, wlfx);
          dSingleQty = tmp*2;
        }
      }else if(sPrintingPlate===2){ /* 混排 */
        //混排 横排 多余部分 看看是否能够竖着排 如果竖排 看看能否再横着排(折页没有混排)
      }
    }else{ /* 四边裁 */
      dPartsWidth = dPartsWidth+2*dBoold;
      dPartsLength = dPartsLength+2*dBoold;
      if(sPrintingPlate===1){
        tmp = this.getHSQD(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
        tag =  this.getTag(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
        //1:横虚线 2:树虚线;3:无需虚线
        if(tag===2){
          //alert("横竖取大==版数:"+tmp);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,3, wlfx);
        }else{
          //alert("横竖取大==版数:"+tmp);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,3, wlfx);
        }
        dSingleQty = tmp;
      }else if(sPrintingPlate===3){
        if(wlfx===1){
          //长书级
          tmp = this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
          dSingleQty = tmp;
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,3, wlfx);
        }else{
          //长书级
          tmp = this.getSp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
          dSingleQty = tmp;
          // $("#dPlateQty").val(tmp);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,3, wlfx);
        }
        // var tmp = getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
        // alert("横排版数:"+tmp);
        // addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,2);
      }else if(sPrintingPlate===4) {
        //竖排
        if(wlfx===1){
          //长书级
          tmp = this.getSp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
          dSingleQty = tmp;
          // $("#dPlateQty").val(tmp);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,4,3, wlfx);
        }else{
          //长书级
          tmp = this.getHp(dMachineLength,dMachineWidth ,dPartsLength ,dPartsWidth);
          dSingleQty = tmp;
          // $("#dPlateQty").val(tmp);
          divStr = this.addHtml(dMachineLength,dMachineWidth ,dPartsLength,dPartsWidth,dBoold ,dBite,3,3, wlfx);
        }
      }else if(sPrintingPlate===2){
        //混排 横排 多余部分 看看是否能够竖着排 如果竖排 看看能否再横着排(折页没有混排)
        if( sCutMethod===1){
          console.log("书没有混排");
          return;
        }
        //竖排+横排
        let htTmpTag = 0;
        let tmp3 = 0;
        tmp = this.getHHP(dMachineWidth,dMachineLength ,dPartsLength ,dPartsWidth);
        tmp3 = this.getHHP(dMachineWidth,dMachineLength ,dPartsWidth,dPartsLength);
        if(tmp<tmp3){
          tmp = tmp3;
          htTmpTag = 1;
        }
        // alert("混拼排版数:"+tmp);
        // $("#dPlateQty").val(tmp);
        dSingleQty = tmp;

        //哪个大取哪个
        if(htTmpTag==0){
          divStr = this.getHHPHtml(dMachineWidth,dMachineLength,dPartsLength,dPartsWidth,dBoold ,dBite,wlfx);
        }else{
          divStr =this.getHHPHtml(dMachineWidth,dMachineLength ,dPartsWidth,dPartsLength,dBoold ,dBite,wlfx);
        }

      }
    }

    const lrl= ((tmp*dPartsLength*dPartsWidth)/(dMachineWidth*(dMachineLength+dBite)))*100 ;

    /* 增加利润率显示 */
    const dProfit = commonUtils.convertFixNum(lrl,2)  ;
    const dProfitStr = commonUtils.isNotEmptyNumber(dProfit) ? dProfit +'%' : 0;
    divStr.push(<div className={styles.fontArea}>
      <div  style={{fontSize:'12px',color:'#000'}}> 开版利用率:<span style={{color:'#ff0000'}}>{dProfitStr}</span> </div>
      <div  style={{fontSize:'12px',color:'#000'}}> 排版数:<span style={{color:'#ff0000'}}>{dSingleQty}</span> </div>
    </div>);
    return divStr;
  }


  render() {
    let element ='';
    const { controlData, controlSelectedRowKeys, slaveSelectedRowKeys, slaveData} = this.props;
    if(commonUtils.isNotEmptyArr(controlData) && commonUtils.isNotEmptyArr(controlSelectedRowKeys)){
      const iIndex = controlData.findIndex(item => controlSelectedRowKeys.includes(item.sId));
      if (iIndex > -1) {
        const tableDataRow = controlData[iIndex];
        if(tableDataRow) {
          /* 通过控制表找关联从表的长、宽 */
          let slaveDataRow = {};
          if(commonUtils.isNotEmptyArr(slaveData)) {
            if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
              slaveDataRow = slaveData[0];
            } else if (commonUtils.isEmptyObject(tableDataRow.sCombinedMemo) || tableDataRow.sCombinedMemo === '合版信息') {
              const iIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sId));
              if (iIndex > -1) {
                slaveDataRow = slaveData[iIndex];
              }
            } else {
              const iIndex = slaveData.findIndex(item => tableDataRow.sCombinedMemo.includes(item.sProductNo));
              if (iIndex > -1) {
                slaveDataRow = slaveData[iIndex];
              }
            }
          }

          if(commonUtils.isNotEmptyObject(slaveDataRow)) {
            /* 如果有展开尺寸 则取展开尺寸 否则取产品规格 */
            let sProductStyle = '';
            if(slaveDataRow.sPartsStyle) {
              sProductStyle = slaveDataRow.sPartsStyle;
            }else if(slaveDataRow.sProductStyle) {
              sProductStyle = slaveDataRow.sProductStyle;
            }
            if (sProductStyle) {
              let dProductLength = !commonUtils.isEmpty(sProductStyle) && sProductStyle.split('*').length > 1  ? sProductStyle.split('*')[0] : 0;
              dProductLength = commonUtils.convertStrToNumber(commonUtils.isNull(dProductLength, 0)); /* 产品长 */
              dProductLength = (typeof dProductLength === 'number' && !isNaN(dProductLength)) ? dProductLength : 0; /* 产品长 */
              let dProductWidth = !commonUtils.isEmpty(sProductStyle) && sProductStyle.split('*').length > 1 ? sProductStyle.split('*')[1] : 0;
              dProductWidth = commonUtils.convertStrToNumber(commonUtils.isNull(dProductWidth, 0)); /* 产品宽 */
              dProductWidth = (typeof dProductLength === 'number' && !isNaN(dProductLength)) ? dProductWidth : 0; /* 产品宽 */
              tableDataRow.dPartsWidth = dProductLength;
              tableDataRow.dPartsLength = dProductWidth;
              /* 控制表增加 如果 产品长>产品宽 sSpineDirection 默认1 否则 2 */
              if (dProductLength > dProductWidth) {
                tableDataRow.sSpineDirection = "2"; /* 短书脊 */
              } else {
                tableDataRow.sSpineDirection = "1";  /* 长书脊 */
              }
              tableDataRow.sCutMethod = "2"; /* 默认四边裁 */
              tableDataRow.sPrintingPlate = "1"; /* 默认四边裁 */
            }
          }
          const dLength = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.dPartsWidth, 0));  /* 产品长 */
          const dWidth = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.dPartsLength, 0)); /* 产品宽 */
          const dMachineLength = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.dMachineLength, 0)); /* 上机长 */
          const dMachineWidth = commonUtils.convertStrToNumber(commonUtils.isNull(tableDataRow.dMachineWidth, 0)); /* 上机宽q */
          if(dLength ===0 || dWidth===0 || dMachineLength===0 || dMachineWidth===0 ){
            element='';
          } else{
            element = this.handleGetImgPQty(tableDataRow);
          }
        }
      }
    }
    return (
      <div id="table" className={styles.bigDiv}>
       {element}
      </div>
    );
  }
}