<template>
  <div class="app-container" v-loading="fullscreenLoading" style="overflow-x: auto;padding: 0px;padding-top: 15px;background: #fff">
    <div style="">
      <div
        class="el-page-header"
        style="padding-bottom: 5px;">
        <div class="el-page-header__content" style="float: left">
          <el-button v-if="isEdit && !forceupdateDisable" size="mini" type="warning" @click="handleUpdate">
            修改并暂存
          </el-button>
          <el-button v-if="forceupdateDisable" size="mini" type="warning" @click="handleForceupdate">
            强制修改
          </el-button>
          <el-button v-if="isEdit  && !forceupdateDisable" size="mini" type="success" @click="handleSubmit">修改并提交
          </el-button>
          <el-button :disabled="disabledBtn" v-if="!isEdit  && !forceupdateDisable" size="mini" type="success" @click="newSubmit">新建保存
          </el-button>
          <el-button size="mini" type="success" @click="isEdit?editRefreshBtn():addRefreshBtn()">刷新
          </el-button>
        </div>
        <div style="float: left;margin-left: 10px;width: 1250px" class="info-con">
          <el-row :gutter="1">
            <el-col style="width: 180px;" :span="3">
              <span style="color: #7c7c7c">施工单名称</span>

              <el-tooltip class="item" effect="dark" :content="$route.query.clientName" placement="bottom">
                <span style="display: inline-block;width: 100px;vertical-align:middle" class="ellipsis">{{ $route.query.clientName }}</span>
              </el-tooltip>
            </el-col>
            <el-col style="width: 150px;" :span="3">
              <span style="color: #7c7c7c">施工单号&nbsp;</span><span>{{ printBillDetail.billCode }}</span>
            </el-col>
            <el-col style="width: 210px;" :span="3">
              <span style="color: #7c7c7c">客户名称</span>
              <el-tooltip style="display: inline-block" class="item" effect="dark" :content="printBillDetail.clientName"
                          placement="bottom">
              <span style="width: 150px;display: inline-block;vertical-align:middle"
                    class="ellipsis"> {{ printBillDetail.clientName }}</span>
              </el-tooltip>
            </el-col>
            <el-col style="width: 180px;" :span="3">
              <span style="color: #7c7c7c">产品类型&nbsp;</span><span>{{ printBillDetail.productName }}</span>
            </el-col>
            <el-col style="width: 180px;" :span="3">
              <span style="color: #7c7c7c">下单时间&nbsp;</span><span
              v-if="printBillDetail.createTime">{{ printBillDetail.createTime | getTime }}</span>
            </el-col>
            <el-col style="width: 140px;" :span="3">
              <el-select size="mini" :disabled="forceupdateDisable" v-model="idCompany" value-key="id" filterable placeholder="选择分厂">
                <el-option
                  v-for="item in typeOptions"
                  :key="item.id"
                  :label="item.companyName"
                  :value="item.id">
                </el-option>
              </el-select>
            </el-col>
            <el-col style="width: 140px;" :span="3">
              <el-date-picker
                size="mini"
                style="width: 140px"
                :disabled="forceupdateDisable"
                v-model="printBillDetail.deliveryDate"
                type="date"
                value-format="yyyy-MM-dd"
                :picker-options="pickerOptions"
                placeholder="交货日期">
              </el-date-picker>
            </el-col>
          </el-row>
        </div>
        <div style="clear: both"></div>
      </div>
      <div class="bill-con" style="background: #fff;height: auto;">
        <el-row>
          <el-card shadow="never"  class="box-card">
            <!--              <div slot="header" class="clearfix">-->
            <!--                <span>订单信息</span>-->
            <!--              </div>-->
            <div>
              <el-form size="mini" :inline="true" :model="formInline" class="demo-form-inline">
                <el-col style="margin-bottom: 7px" :span="24">
                  <span style="line-height: 30px;color: #e4493c">费用：</span>
                  <el-form-item label="制版">
                    <el-input
                      oninput = "value=value.replace(/[^\d.]/g,'')"
                      :disabled="forceupdateDisable"
                      style="width: 85px"
                      v-model.trim="formInline.billMoneyPlate"></el-input>
                  </el-form-item>
                  <el-form-item label="纸张">
                    <span class="el-input el-input--mini" style="width: 90px;color: #e4493c !important;border:1px solid #ddd;padding-left: 5px;background: #f0f2f5">{{billMoneyPaper}}</span>
                  </el-form-item>
                  <el-form-item label="印工">
                    <!--                      <el-input style="width: 85px;color: #e4493c" v-model="formInline.billMoneyPrint"></el-input>-->
                    <span class="el-input el-input--mini" style="width: 90px;color: #e4493c !important;border:1px solid #ddd;padding-left: 5px;background: #f0f2f5">{{billMoneyPrint}}</span>
                  </el-form-item>
                  <el-form-item label="后工">
                    <el-input oninput = "value=value.replace(/[^\d.]/g,'')" :disabled="forceupdateDisable" style="width: 90px" v-model.trim="formInline.billMoneyProcess"></el-input>
                  </el-form-item>
                  <el-form-item label="合计">
                    <!--                      <el-input style="width:90px;color: #e4493c" v-model="formInline.billMoneyTotal"></el-input>-->
                    <span class="el-input el-input--mini" style="width: 90px;color: #e4493c !important;border:1px solid #ddd;padding-left: 5px;background: #f0f2f5">{{billMoneyTotal}}</span>
                  </el-form-item>
                  <!--                    <el-form-item label="调整">-->
                  <!--                      <el-input oninput = "value=value.replace(/[^\d.]/g,'')" :disabled="forceupdateDisable" style="width: 90px" v-model.trim="formInline.billMoneyAdjust"></el-input>-->
                  <!--                    </el-form-item>-->

                  <el-form-item label="订单金额">
                    <span class="el-input el-input--mini" style="width: 90px;color: #e4493c !important;border:1px solid #ddd;padding-left: 5px;background: #f0f2f5">{{formInline.orderMoneyTotal}}</span>
                  </el-form-item>
                  <el-checkbox size="mini" border type="warning" @change="checkedForcedBtn(checkedForced)" v-model="checkedForced">强制下单</el-checkbox>
                  <!--                    <span style="line-height: 30px;color: #e4493c">发货：</span>-->
                  <!--                    <el-form-item label="快递">-->
                  <!--                      <el-input style="width: 95px" v-model="formInline.user"></el-input>-->
                  <!--                    </el-form-item>-->
                  <!--                    <el-form-item label="出货标记">-->
                  <!--                      <el-input style="width: 85px" v-model="formInline.user"></el-input>-->
                  <!--                    </el-form-item>-->

                </el-col>
                <div style="width: 100%;height: 185px;">
                  <el-col :span="24">
                    <el-form-item label="说明" prop="">
                      <el-input
                        style="width: 240px;height: 90px"
                        :rows="7"
                        type="textarea"
                        v-model="formInline.billNote"></el-input>
                    </el-form-item>
                    <el-form-item prop="">
                      <div @click.stop="openMemo"  style="color: #606266;font-size: 12px;width: 36px;float: left;cursor: pointer">备注</div>
                      <div @click.stop="openMemo" id="eagleMapContainer" @mousedown.stop="dragEagle" style="width: 800px;height: 140px;border: 1px solid #ddd;padding: 5px;background: #fff;line-height: 18px;font-size: 13px;overflow-y: auto;cursor: n-resize;word-wrap:break-word;float: left">
                        <p
                          style="line-height: 16px;border-bottom: 1px solid red;font-size: 12px;"
                          v-for="(item,index) in orderMemosArray"
                          :key="index"
                        >{{ item }}
                        </p>
                      </div>
                      <div style="clear: both"></div>
                      <!--                      <el-input style="width: 300px" :rows="10" type="textarea" v-model=""></el-input>-->
                    </el-form-item>
                    <el-form-item label="信息" prop="">
                      <div
                        class="ProduceInfo-con"
                        style="width: 410px;height: 140px;border: 1px solid #dddd;padding: 5px;line-height: 16px;font-size: 12px;overflow-y: auto">
                        <p
                          style="line-height: 18px;font-size: 13px;"
                          v-for="(item,indexItem) in orderProduceInfosArray"
                          :key="indexItem"
                        >{{ item }}</p>
                      </div>

                    </el-form-item>

                  </el-col>
                </div>
              </el-form>
            </div>
          </el-card>
        </el-row>
      </div>
      <div style="width: 100%;">
        <el-tabs size="mini" type="border-card">
          <el-tab-pane size="mini" label="生产信息">
            <div style="width: 1750px;position: relative;border-bottom: none">
              <span style="position: absolute;z-index: 99;left: 8px;top: 2px;color: #7c7c7c;cursor: pointer;"><i
                class="el-icon-more"></i></span>
              <el-popover
                placement="right"
                width="400"
                trigger="hover">
                <div
                  style="line-height: 30px;border-bottom: 1px solid #ddd;"
                  v-for="(breedItem, index) in printBillBreedList"
                  :key="index"
                >
                  <div v-if="breedItem.breedName">{{ breedItem.breedName }}</div>
                  <div
                    v-for="(partItem, indexItem) in breedItem.partList"
                    :key="partItem.id"
                  >
                    <div v-if="partItem.orderName" style="margin-left: 15px">
                      {{ partItem.orderName }};-{{ partItem.productName }}
                    </div>
                  </div>

                </div>

                <span slot="reference"
                      style="position: absolute;z-index: 99;left: 8px;top: 2px;color: #7c7c7c;cursor: pointer;"><i
                  class="el-icon-more"></i></span>
              </el-popover>
              <div class="card-tit">用料</div>
              <div style="float: left;overflow-x: auto;width: 1580px;">
                <el-table
                  ref="tableMaterials"
                  @row-contextmenu="rowContextmenu"
                  v-loading="listLoading"
                  height="310"
                  class="tb-edits"
                  row-key="index"
                  highlight-current-row
                  @row-click="handleCurrentChange"
                  border
                  size="mini"
                  :data="printBillBreedList"
                  style="width:100%;">
                  <el-table-column
                    width="180px"
                    show-overflow-tooltip
                    label="版名称">
                    <template slot-scope="scope">
                      <el-input
                        size="mini"
                        v-model="scope.row.breedName"
                        placeholder="请输入内容"
                        @change="handleEdit(scope.$index, scope.row.breedName)"></el-input>
                      <!--                      <span>{{ scope.row.breedName }}</span>-->
                      <span>{{scope.row.breedName}}</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    show-overflow-tooltip
                    width="100px"
                    label="类型"
                  >
                    <template slot-scope="{row}">
                      <span>
                        {{ row.breedTypeName }}
                      </span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="自带"
                    width="40px"
                  >
                    <template slot-scope="scope">
                      <el-checkbox :disabled="forceupdateDisable" @change="changeProvide($event,scope.$index,scope.row.selfProvidedPaper)"
                                   v-model="scope.row.selfProvidedPaper==1"></el-checkbox>
                    </template>
                  </el-table-column>
                  <el-table-column
                    width="160px"
                    label="大纸规格"
                  >
                    <template slot-scope="scope">
                      <el-select
                        :disabled="forceupdateDisable"
                        style="display: inline-block;width: 150px;"
                        size="mini"
                        filterable
                        allow-create
                        v-model.trim="scope.row.wholePaperSize"
                        @blur.native="wholePaperSizeBlur($event,scope.$index,scope.row.wholePaperSize)"
                        @change.native="wholePaperSizeBlur($event,scope.$index,scope.row.wholePaperSize)"
                        @change="selectBlur1(scope.$index,scope.row.wholePaperSize)"
                      >
                        <el-option
                          v-for="item in PaperSizeOptions"
                          :key="item.id"
                          :label="item.dictValue"
                          :value="item.dictValue"
                        ></el-option>
                      </el-select>
                    </template>
                  </el-table-column>
                  <el-table-column
                    width="180px"
                    label="纸张"
                  >
                    <template slot-scope="scope">
                      <span
                        v-show="!forceupdateDisable"
                        style="display: inline-block;color: #409EFF;cursor: pointer"
                        @click="checkPaper(scope.$index,scope.row.paperName)"
                        size="mini">选择纸张
                      </span>
                      <el-tooltip style="display: inline-block" class="item" effect="dark" :content="scope.row.paperName" placement="top-start">
                        <span style="display: inline-block;width: 120px;vertical-align:middle" class="ellipsis">{{ scope.row.paperName }}</span>
                      </el-tooltip>
                    </template>
                  </el-table-column>
                  <el-table-column
                    width="97px"
                    label="纸张开数">
                    <template slot-scope="scope">
                      <el-select
                        :disabled="forceupdateDisable"
                        style="display: block;width: 90px;"
                        size="mini"
                        filterable
                        v-model="scope.row.cutName"
                        @change="selectNumber(scope.$index,scope.row.cutName)"
                      >
                        <el-option
                          v-for="(item,index) in paperCutList"
                          :key="item.id"
                          :label="item.cutName"
                          :value="item.cutCount+','+item.cutName+','+index"
                        ></el-option>
                      </el-select>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="开纸尺寸"
                    width="110px"
                  >
                    <template slot-scope="scope">
                      <el-input
                        :disabled="forceupdateDisable"
                        size="mini"
                        v-model.trim="scope.row.cutSize"
                        placeholder="请输入内容"
                        @input="handleEditCutSize(scope.$index, scope.row.cutSize)"></el-input>
                      <span>{{ scope.row.cutSize }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="版套数"
                    width="60px"
                  >
                    <template slot-scope="scope">
                      <el-input
                        oninput = "value=Number(value.replace(/[^\d.]/g,''))"
                        :disabled="forceupdateDisable"
                        size="mini"
                        class="edit-class"
                        v-model.trim="scope.row.breedSets"
                        placeholder="请输入内容"
                        @input="handleBreedSets(scope.$index, scope.row.breedSets)"></el-input>
                      <span>{{ scope.row.breedSets }}</span>
                    </template>
                  </el-table-column>

                  <el-table-column
                    width="100px"
                    label="正用量"
                  >
                    <template slot-scope="scope">
                      <el-input
                        oninput = "value=Number(value.replace(/[^\d.]/g,''))"
                        :disabled="forceupdateDisable"
                        size="mini"
                        v-model.trim="scope.row.printCount"
                        placeholder="请输入内容"
                        @change="handlePrintCountChange(scope.$index, scope.row.printCount,1)"
                        @input="handlePrintCount(scope.$index, scope.row.printCount,1)"></el-input>
                      <span>{{ scope.row.printCount }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    width="100px"
                    label="印刷伸放"
                  >
                    <template slot-scope="scope">
                      <el-input
                        size="mini"
                        oninput = "value=Number(value.replace(/[^\d.]/g,''))"
                        v-model.trim="scope.row.printFlowCount"
                        placeholder="请输入内容"
                        @input="handlePrintCount(scope.$index, scope.row.printFlowCount,2)"></el-input>
                      <span>{{ scope.row.printFlowCount }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    width="100px"
                    label="后工放数"
                  >
                    <template slot-scope="scope">
                      <el-input
                        size="mini"
                        oninput = "value=Number(value.replace(/[^\d.]/g,''))"
                        v-model.trim="scope.row.craftFlowCount"
                        placeholder="请输入内容"
                        @input="handlePrintCount(scope.$index, scope.row.craftFlowCount,3)"></el-input>
                      <span>{{ scope.row.craftFlowCount }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="wholePaperCount"
                    label="大纸张数"
                  >
                  </el-table-column>

                  <el-table-column
                    prop="paperPrice"
                    label="纸张价格(元)"
                  >
                    <template slot-scope="scope">
                      <el-input
                        size="mini"
                        oninput = "value=value.replace(/[^\d.]/g,'')"
                        v-model.trim="scope.row.paperPrice"
                        @input="handleChangePaperPrice(scope.$index)"
                        placeholder="请输入内容"
                        ></el-input>
                      <span>{{ scope.row.paperPrice }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="金额(元)"
                  >
                    <template slot-scope="{row}">
                      <span>{{ row.breedPaperPrice }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="idActualPaperInfo"
                    label="实际发纸"
                  >
                  </el-table-column>
                </el-table>
              </div>
              <div style="clear: both"></div>
            </div>
            <div style="width: 1750px;border-top: none;">
              <div class="card-tit">印刷</div>
              <div style="float: left;overflow-x: auto;width: 1580px;">
                <el-table
                  ref="tablePrinting"
                  v-loading="listLoading"
                  class="tb-edits"
                  row-key="index"
                  height="310"
                  highlight-current-row
                  @row-click="handleCurrentChange"
                  border
                  size="mini"
                  :data="printBillBreedList"
                  style="width: 100%">
                  <el-table-column
                    prop="breedName"
                    width="180px"
                    show-overflow-tooltip
                    label="版名称"
                  >
                    <template slot-scope="scope">
                      <span>{{scope.row.breedName}}</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="类别"
                    show-overflow-tooltip
                    width="100px"
                  >
                    <template slot-scope="{row}">
                     <span>
                        {{ row.breedTypeName }}
                     </span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="印刷机台"
                    width="130px"
                  >
                    <template slot-scope="scope">
                      <el-select
                        style="display: inline-block;width: 120px;"
                        size="mini"
                        filterable
                        v-model="scope.row.machineName"
                        @change="selectMachine(scope.$index,scope.row.machineName)"
                      >
                        <el-option
                          v-for="item in optionsMachine"
                          :key="item.id"
                          :label="item.machineName"
                          :value="item.id+','+item.machineName+','+item.psSize+','+item.idMachineType+','+item.machineType.typeName"
                        ></el-option>
                      </el-select>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="breedName"
                    width="120px"
                    label="印刷机型"
                  >
                    <template slot-scope="scope">
                      <span>
                          {{ scope.row.machineTypeName }}
                      </span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="印刷色数"
                    width="100px"
                  >
                    <template slot-scope="scope">
                      <el-select
                        style="display: inline-block;width: 90px;"
                        size="mini"
                        filterable
                        v-model="scope.row.colorCount"
                        @blur="selectBlur($event,scope.$index,scope.row.colorCount)"
                        @change="selectColorCount(scope.$index,scope.row.colorCount)"
                      >
                        <el-option
                          v-for="item in printRequireOptions"
                          :key="item.id"
                          :label="item.dictValue"
                          :value="item.dictValue"
                        ></el-option>
                      </el-select>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="专色"
                    width="120px"
                  >
                    <template slot-scope="scope">
                      <el-select
                        clearable
                        style="display: inline-block;width: 110px;"
                        size="mini"
                        filterable
                        v-model="scope.row.specialColor"
                        @change="selectSpecialColor(scope.$index,scope.row.specialColor)"
                      >
                        <el-option
                          v-for="item in specialColorOptions"
                          :key="item.id"
                          :label="item.dictValue"
                          :value="item.dictValue"
                        ></el-option>
                      </el-select>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="翻版方式"
                    width="100px"
                  >
                    <template slot-scope="scope">
                      <el-select
                        style="display: inline-block;width: 90px;"
                        size="mini"
                        filterable
                        placeholder="请选择"
                        v-model="scope.row.breedFlipType"
                        @visible-change="breedFlipTypeClick(scope.$index,scope.row.colorCount)"
                        @change="selectBreedFlipType(scope.$index,scope.row.breedFlipType)"
                      >
                        <el-option
                          v-for="item in options"
                          :key="item.breedFlipType"
                          :label="item.value"
                          :value="item.breedFlipType"
                          :disabled="item.disabled"
                        ></el-option>
                      </el-select>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="联板规格"
                    prop="breedSize"
                  >
                  </el-table-column>
                  <el-table-column
                    label="ps版规格"
                    prop="psSize"
                  >
                  </el-table-column>
                  <el-table-column
                    prop="psGroupCount"
                    label="PS版套数"
                  >
                    <template slot-scope="scope">
                      <el-input
                        size="mini"
                        oninput = "value=Number(value.replace(/[^\d.]/g,''))"
                        v-model.trim="scope.row.psGroupCount"
                        placeholder="请输入内容"
                        @input="handlePs(scope.$index, scope.row.psGroupCount)"></el-input>
                      <span>{{ scope.row.psGroupCount }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="ps版块数"
                    prop="psCount"
                  >
                    <template slot-scope="scope">
                      <el-input
                        size="mini"
                        oninput = "value=Number(value.replace(/[^\d.]/g,''))"
                        v-model.trim="scope.row.psCount"
                        placeholder="请输入内容"
                        @input="handlePs(scope.$index, scope.row.psCount)"></el-input>
                      <span>{{ scope.row.psCount }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="下机数"
                    prop="completeCount"
                  >
                  </el-table-column>
                  <el-table-column
                    label="千印数"
                    prop="printCount1000"
                  >
                    <template slot-scope="scope">
                      <span>{{ scope.row.printCount1000.toFixed(3) }}</span>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="金额"
                    prop="printCosts"
                  >
                  </el-table-column>

                </el-table>
              </div>
              <div style="clear: both"></div>
            </div>
          </el-tab-pane>
          <el-tab-pane label="订单部件">
            <el-table
              border
              size="mini"
              :data="printOrderList"
              style="width: 100%">
              <el-table-column
                prop="orderName"
                width="120"
                label="印品名称"
              >
              </el-table-column>
              <el-table-column
                width="120"
                show-overflow-tooltip
                prop="clientName"
                label="客户名称"
              >
              </el-table-column>
              <el-table-column
                width="90"
                prop="orderPrice"
                label="订单价格"
              >
              </el-table-column>
              <el-table-column
                width="120"
                prop="orderCode"
                label="订单编号"
              >
              </el-table-column>
              <el-table-column
                prop="orderMemo"
                width="300px"
                label="生产备注"
                show-overflow-tooltip
              >
                <template slot-scope="scope">
                  <span>{{ scope.row.orderMemo }}</span>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="工序信息">
            <el-table
              border
              size="mini"
              :data="processList"
              style="width: 100%">
              <el-table-column
                prop="id"
                label="id"
              >
              </el-table-column>
              <el-table-column
                prop="processName"
                label="工序名称"
              >
              </el-table-column>
              <el-table-column
                prop="partHeight"
                label="部件长"
              >
              </el-table-column>
              <el-table-column
                prop="partWidth"
                label="部件宽"
              >
              </el-table-column>
              <el-table-column
                prop="rotationAngle"
                label="旋转角度"
              >
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="版式示意">
          </el-tab-pane>
          <el-tab-pane label="外协单">
          </el-tab-pane>
          <el-tab-pane label="缩略图">
            <el-table
              border
              size="mini"
              :data="dataThumbs"
              style="width: 100%">
              <el-table-column
                prop="fileName"
                show-overflow-tooltip
                label="文件名称"
              >
              </el-table-column>
              <el-table-column
                show-overflow-tooltip
                prop="url"
                label="查看文件"
              >

                <template slot-scope="scope">
<!--                  <a href="javascript:;" style="color: #20a0ff" @click="openImg(scope.row)">查看文件</a>-->
<!--                  <img width="40px;" height="40px" :src="scope.row.url">-->
                 <div style="line-height: 30px">
                   <el-image
                     style="width: 30px; height: 30px"
                     :src="scope.row.url.split('?')[0]"
                     :preview-src-list="srcList">
                   </el-image>
                   <a style="color: #20a0ff;vertical-align: text-bottom;display: inline-block;" :href="scope.row.url">下载</a>
                 </div>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
        </el-tabs>
      </div>
      <el-dialog title="选择纸张" :visible.sync="dialogVisible" width="800px">
        <el-input size="mini" v-model="searchPaper.keyWord" placeholder="关键字" style="width: 200px;" class="filter-item"/>
        <el-button  size="mini" class="filter-item" type="primary" icon="el-icon-search" @click="getPaperSearch">
          搜索
        </el-button>
        <div style="height: 10px;width: 100%"></div>
        <el-table
          size="mini"
          :data="tableData"
          v-loading="listLoading"
          style="width: 100%;margin-bottom: 20px;"
          row-key="id"
          border>
          <el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-button @click="choosePaperClick(scope.row)" type="primary" size="mini">
                选择
              </el-button>
            </template>
          </el-table-column>
          <el-table-column
            prop="paperName"
            width="130px"
            label="档案名称">
          </el-table-column>
          <el-table-column
            prop="paperTypeName"
            label="纸张类型">
          </el-table-column>

          <el-table-column
            prop="mtSuttle"
            label="克重">
          </el-table-column>
          <!--          <el-table-column-->
          <!--            prop="priceType"-->
          <!--            label="计价方式">-->
          <!--            <template slot-scope="{row}">-->
          <!--        <span v-if="row.priceType==0" type="success">-->
          <!--          吨价-->
          <!--        </span>-->
          <!--              <span v-else-if="row.priceType==1" type="danger">-->
          <!--          平方单价-->
          <!--        </span>-->
          <!--            </template>-->
          <!--          </el-table-column>-->
          <!--          <el-table-column-->
          <!--            prop="priceType"-->
          <!--            label="单价">-->
          <!--            <template slot-scope="scope">-->
          <!--              <span>{{ scope.row.paperPrice }}</span>-->
          <!--            </template>-->
          <!--          </el-table-column>-->

        </el-table>
        <pagination
          v-show="listData.total>0"
          :total="listData.total"
          :page.sync="listData.page"
          :limit.sync="listData.pageSize"
          @pagination="getPaperInfo"/>
      </el-dialog>
    </div>
    <context-button
      v-if="menuVisible"
      @foo="foo"
      ref="contextbutton"
      @handleOne="handleOne"
      @handleTwo="handleTwo"
      @handleThree="handleThree"
      @handleFour="handleFour"></context-button>
    <!--增加版式开始-->
    <el-dialog width="900px" title="选择订单部件" :visible.sync="dialogTableVisible">
      <el-button type="primary" style="margin-bottom: 10px;" @click="breedClick" size="mini">确定选择</el-button>
      <el-table
        ref="multipleTable"
        border
        highlight-current-row
        tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange"
        @row-click="handleRowClick"
        :data="BreedInfoList">
        <el-table-column
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column property="date" label="展开尺寸" width="150">
          <template slot-scope="scope">
            <span>{{ scope.row.orderPart.partSize }}</span>
          </template>
        </el-table-column>
        <el-table-column property="paperName" label="纸张类型" width="200"></el-table-column>
        <el-table-column property="paperName" label="克重">
          <template slot-scope="scope">
            <span>{{ scope.row.orderPart.partDesc }}</span>
          </template>
        </el-table-column>
        <el-table-column property="address" label="数量">
          <template slot-scope="scope">
            <span>{{ scope.row.orderPart.partQty }}</span>
          </template>
        </el-table-column>
        <el-table-column property="address" label="面数">
          <template slot-scope="{row}">
            <span v-if="row.orderPart.faceCount==2">双面</span>
            <span v-else-if="row.orderPart.faceCount==1">单面</span>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <!--增加版式结束-->
    <!--删除版式开始-->
    <el-dialog
      title="删除版式"
      :visible.sync="dialogVisibleDelete"
      width="700px"
    >
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>版包含以下订单部件</span>
        </div>
<!--        <div v-for="(item,index) in partList" :key="index" class="text item li-span">-->
<!--          <span :class='{bg:index==isactive}' @click="handleBreedList1(partList,item,index)"> {{ item.productPartName }}</span>-->
<!--        </div>-->
        <el-checkbox-group v-model="checkedPartList" @change="handleCheckedPartListChange">
          <el-checkbox disabled style="display: block" v-for="item in partList" :label="item" :key="item.idProduct">{{item.productPartName}}</el-checkbox>
        </el-checkbox-group>
      </el-card>
      <div style="margin-bottom: 15px;margin-top: 15px;">
        <span>操作方法:</span>
        <el-radio-group @change="changeResource" v-model="resource">
          <el-radio label="删除"></el-radio>
          <el-radio label="转移到选择的大板"></el-radio>
        </el-radio-group>
      </div>
      <el-card v-if="resource == '转移到选择的大板'" class="box-card">
        <div slot="header" class="clearfix">
          <span>版名</span>
        </div>
        <div v-for="(item,index) in printBillBreedList" :key="index" v-if="item.keyId!=rowId" class="text item li-span">
          <span v-if="item.keyId!=rowId" :class='{bg:index==isactive2}'
                @click="handleBreedList2(item,index)"> {{ item.breedName }}</span>
        </div>
      </el-card>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleDelete =false">取 消</el-button>
        <el-button v-if="resource == '删除'" type="primary" @click="deleteBreed">确 定</el-button>
      </span>
    </el-dialog>
    <!--删除版式结束-->
    <!--复制版式开始-->
    <el-dialog
      title="复制版式"
      :visible.sync="dialogVisibleCopy"
      width="450px"
    >
      <el-form ref="form" :model="formCopy" label-width="80px">
        <el-form-item label="复制数量">
          <el-input v-model="formCopy.num"></el-input>
        </el-form-item>
        <el-form-item label="清空数据">
          <el-switch v-model="formCopy.delivery"></el-switch>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleCopy = false">取 消</el-button>
        <el-button type="primary" @click="copyDreedClick()">确 定</el-button>
      </span>
    </el-dialog>
    <!--复制版式结束-->
    <el-dialog
      title="缩略图"
      :visible.sync="dialogVisibleImg"
      width="450px"
      >
      <div> <img :src="urlImg"></div>
    </el-dialog>
    <el-dialog width="400px" title="是否需要重新拼版" :visible.sync="dialogAgain">
      <div  style="width: 100%;font-size: 16px">
        <el-checkbox style="font-size: 16px" v-model="checkedAgain">需要重新拼版</el-checkbox>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogAgain = false">取 消</el-button>
        <el-button type="primary" @click="handleSubmitAgain">确 定</el-button>
      </div>
    </el-dialog>
  </div>

</template>

<script>
// ceshi git
import {
  getInfoById,
  submitPrintBill,
  updatePrintBill,
  queryPaperCutInfo,
  getPrinterNameList,
  getDictTypeInfo,
  newPrintBill,
  getAllCompanyInfoList,
  getPaperQuoteInfoByBaseAndBrand,
  forceUpdatePrintBill,
  quoteMachineTypePrintFee,
  getPrintBillThumbs,
  getOrderThumbsByIds
} from '@/api/printbill/printbill.js'
import {
  getInfo
} from '@/api/printbill/editionList.js'
import {getPaperInfoList} from '@/api/baseInfo/paper/basePaperInfo.js'
import contextButton from '../brintBillButton/index.vue'
import {updateMaterialInfo} from "@/api/baseInfo/accessories/accessoriesInfo";
// import {getDictTypeInfo} from "@/api/productFile/partWorkProcessInfo";

export default {
  name: "list",
  props: {
    isEdit: {
      type: Boolean,
      default: false
    }
  },
  components: {
    contextButton
  },
  computed: {
    billMoneyPaper() {
      this.formInline.billMoneyPaper = (this.printBillBreedList.reduce((total, item) => total + (Number(item.breedPaperPrice)), 0)).toFixed(2)
      return (this.printBillBreedList.reduce((total, item) => total + (Number(item.breedPaperPrice)), 0)).toFixed(2);
    },
    billMoneyPrint(){
      this.formInline.billMoneyPrint = (this.printBillBreedList.reduce((total, item) => total + (Number(item.printCosts)), 0)).toFixed(2)
      return (this.printBillBreedList.reduce((total, item) => total + (Number(item.printCosts)), 0)).toFixed(2);
    },
    billMoneyTotal(){
      this.formInline.billMoneyTotal = (Number(this.formInline.billMoneyPaper)+Number(this.formInline.billMoneyPrint)).toFixed(2);
      return (Number(this.formInline.billMoneyPaper)+Number(this.formInline.billMoneyPrint)).toFixed(2);
    },

  },
  data() {
    return {
      fullscreenLoading:false,
      checkedAgain:false,
      dialogAgain:false,
      needSpliceBreedAgain:"",
      billType:"",
      disabledBtn:false,
      srcList:[],
      urlImg:"",
      dialogVisibleImg:false,
      dataThumbs:[],
      checkedForced:false,
      billMoneyTotalWatch:"",
      forceupdateDisable:false,
      printBillBreedListCopy:[],
      checkedPartList:[],
      searchPaper:{
        keyWord:""
      },
      priceType: "",
      title: "",
      breedNum: "",
      rowId: "",
      typeOptions: [],
      idCompany: '',
      gridData: [],
      tempData: {},
      formCopy: {
        delivery: false,
        num:""
      },
      tempData2: {
        actualPaperName: null,
        billYear: 0,
        breedFlipType: 0,
        breedName: '',
        breedNo: 0,
        breedPaperPrice: 0,
        breedPlateSize: null,
        breedProcess: '',
        breedSets: 0,
        breedSize: null,
        breedStatus: 0,
        breedTypeName: '',
        colorCount: null,
        completeCount: 0,
        containsOrderIds: null,
        craftFlowCount: 0,
        createBy: 0,
        createTime: null,
        createTimeLong: 0,
        cutCount: 0,
        cutName: null,
        cutSize: null,
        id: -1,
        idActualPaperInfo: 0,
        idMachine: 0,
        idMachineType: 0,
        idPaperBaseInfo: 0,
        idPaperCutInfo: 0,
        idPlateSizeTemplate: 0,
        idPrintBill: 0,
        machineName: null,
        machineTypeName: null,
        paperBand: null,
        paperName: '',
        paperPrice: null,
        partCount: 0,
        partList: [],
        preOutLockManId: 0,
        preOutLockManName: null,
        preOutLockState: 0,
        preOutStockLockIdRoom: 0,
        preOutStockLockQty: 0,
        preOutStockState: 0,
        printCosts: null,
        printCount: '',
        printCount1000: 0,
        printFlowCount: 0,
        printRequire: '',
        processList: [],
        psCount: 0,
        psGroupCount: 0,
        psSize: null,
        selfProvidedPaper: 0,
        specialColor: null,
        updateBy: 0,
        updateTime: null,
        updateTimeLong: 0,
        voidFlag: 0,
        wholePaperCount: 0,
        wholePaperSize: null,
        workPartList: []
      },
      dialogVisibleCopy: false,
      isactive2: 999,
      isactive: 999,
      resource: '删除',
      partList: [],
      dialogVisibleDelete: false,
      multipleSelection: [],
      BreedInfoList: [],
      dialogTableVisible: false,
      menuVisible: false,
      billData: {},
      scopeIndex: 9998,
      dialogVisible: false,
      listData: {
        total: 0,
        page: 1,
        pageSize: 10
      },
      listData2: {
        total: 0,
        page: 1,
        pageSize: 10
      },
      tableData: [],
      specialColorOptions: [],
      printRequireOptions: [],
      PaperSizeOptions: [],
      optionsMachine: [],
      options: [
        {
          breedFlipType: 0,
          value: '请选择'
        },
        {
          breedFlipType: 1,
          value: '正反',
          disabled: false
        }, {
          breedFlipType: 2,
          value: '滚翻',
          disabled: false
        }, {
          breedFlipType: 3,
          value: '自翻',
          disabled: false
        }, {
          breedFlipType: 4,
          value: '单面',
          disabled: false
        }],
      listLoading: false,
      indexRow: 999,
      indexItem: 999,
      cutCount: '',
      paperCutList: [],
      dialogFormVisible: false,
      orderProduceInfosArray: [],
      orderMemosArray:[],
      printBillDetail: {},
      formInline: {
        billMoneyAdjust:0
      },
      sizeInfoList: [],
      printBillBreedList: [], // 生产信息
      printOrderList: [], // 订单列表
      processList: [], // 工序列表
      menuId: '',
      ruleForm: {},
      rules: {},
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() < Date.now()
        }
      }
    }
  },
  mounted() {
    // console.log(this.isEdit);
    const _that = this;
    _that.dataThumbs = [];
    _that.urlImg = "";
    _that.getCompanyInfoList()//获取工厂信息
    if (_that.isEdit) {
      if(_that.$route.query.type=="forceupdate"){
        _that.forceupdateDisable = true;
        _that.title = '强制修改施工单信息'
        _that.setPageForceupdateTitle()
      }else {
        _that.forceupdateDisable = false;
        _that.title = '编辑施工单信息';
        _that.setPageTitle()
      }
      _that.tempRoute = Object.assign({}, this.$route);
      _that.getClientData();
      _that.getPrintBillThumbs();//获取缩略图
      // set page title
    } else {
      _that.title = '增加施工单信息'
      var billData = localStorage.getItem('bill')
      _that.printBillDetail = JSON.parse(billData);
      _that.getPrintName();
      _that.getDictPrintRequire();
      // console.log(_that.printBillDetail);
      _that.billType = _that.printBillDetail.billType

      _that.processList = _that.printBillDetail.printBillBreedList[0].processList
      _that.printOrderList = _that.printBillDetail.printOrderList
      _that.printBillBreedList = _that.printBillDetail.printBillBreedList
      // console.log('_that.printBillBreedList666', _that.printBillDetail.printBillBreedList)
      _that.getPaperPrice(_that.printBillBreedList);//获取纸张价格
      if (_that.printBillDetail.orderProduceInfos) {
        // console.log(_that.printBillDetail.orderProduceInfos);
        _that.orderProduceInfosArray = _that.printBillDetail.orderProduceInfos.split('`')
      } else {
        _that.orderProduceInfosArray = []
      }
      if (_that.printBillDetail.orderMemos) {
        // console.log(_that.printBillDetail.orderProduceInfos);
        _that.orderMemosArray = _that.printBillDetail.orderMemos.split('`')
      } else {
        _that.orderMemosArray = []
      }
      // console.log(_that.orderProduceInfosArray);
      _that.formInline = {
        billMoneyPlate: _that.printBillDetail.billMoneyPlate,
        billMoneyPaper: _that.printBillDetail.billMoneyPaper,
        billMoneyPrint: _that.printBillDetail.billMoneyPrint,
        billMoneyProcess: _that.printBillDetail.billMoneyProcess,
        billMoneyTotal: _that.printBillDetail.billMoneyTotal,
        billMoneyAdjust: 0,
        orderMoneyTotal: _that.printBillDetail.orderMoneyTotal,
        billNote: _that.printBillDetail.billNote,
        orderProduceInfos: _that.printBillDetail.orderProduceInfos,
        orderMemos: _that.printBillDetail.orderMemos || ''
      }
      _that.getOrderThumbsByIds();//获取缩略图
    }
    // alert("1")
    return new Promise(function (resolve, reject) {
      setTimeout(() => {
        _that.getCutInfo()
        _that.getPaperInfo()
        // _that.getBreedInfo()
        resolve(0)
      }, 500)
    })
  },
  methods: {
    openImg(row){
      const _that = this;
      _that.dialogVisibleImg = true;
      _that.urlImg = row.url;
    },
    getPrintBillThumbs(){
      const _that = this;
      var data = {
        'idPrintBill': _that.$route.query.idPrintBill
      }
      getPrintBillThumbs(data).then(res => {
          _that.dataThumbs = [];
          _that.srcList = []
        if (res.httpCode == 200) {
          for (let i = 0; i < res.data.length; i++) {
            var dataItem = res.data[i];

            for (let j = 0; j < dataItem.thumbList.length; j++) {
              _that.dataThumbs.push(dataItem.thumbList[j])
              _that.srcList.push(dataItem.thumbList[j].url.split('?')[0])
            }
          }
        } else {
        }

      }).catch(err => {
      })
    },
    getOrderThumbsByIds(){
      const _that = this;
      var data = {
        'orderIds': _that.$route.query.containsOrderIds
      }
      getOrderThumbsByIds(data).then(res => {
        _that.dataThumbs = [];
        _that.srcList = [];
        if (res.httpCode == 200) {
          for (let i = 0; i < res.data.length; i++) {
            var dataItem = res.data[i];

            for (let j = 0; j < dataItem.thumbList.length; j++) {
              _that.dataThumbs.push(dataItem.thumbList[j])
              _that.srcList.push(dataItem.thumbList[j].url.split('?')[0])
            }
          }
        } else {
        }
      }).catch(err => {
      })
    },
    openMemo(){
      const _that = this;
      if(document.getElementsByClassName("customClassWidth").length>0) {//js判断元素是否存在
        _that.$notify.closeAll()
        return
      }
      if(_that.orderMemosArray.length>0){
        var htmls = "<div style=''>"
        for (let i = 0; i < _that.orderMemosArray.length; i++) {
          var item = _that.orderMemosArray[i];
          htmls+="<div style='line-height: 16px;border-bottom: 1px solid red;font-size: 12px;padding-right: 15px;word-wrap:break-word;width: 750px'>"+item+"</div>"
        }
        htmls+="</div>"
      }
      _that.$notify({
        _that: '备注',
        dangerouslyUseHTMLString: true,
        message: htmls,
        duration: 0,
        customClass:"customClassWidth",
      });
    },
    dragEagle(e){
      //拖动改变div 的高度
      var targetDiv = document.getElementById('eagleMapContainer')
      var targetDivHeight = targetDiv.offsetHeight

      // clientY是该表高度，也可以取clientX改变宽度
      var startY = e.clientY
      document.onmousemove = function(e) {
        e.preventDefault()
        var distY = Math.abs(e.clientY - startY)
        if (e.clientY < startY) {
          targetDiv.style.height = targetDivHeight - distY + 'px'
        }
        if (e.clientY > startY) {
          targetDiv.style.height = (targetDivHeight + distY) + 'px'
        }
        // 最大高度，也可以通过css  max-height设置
        if (parseInt(targetDiv.style.height) >= 400) {
          targetDiv.style.height = 400 + 'px'
        }
      }
      document.onmouseup = function() {
        document.onmousemove = null
      }
    },
    checkedForcedBtn(val){
      const _that = this;
      if(val){
        _that.formInline.billMoneyAdjust = 1
      }else {
        _that.formInline.billMoneyAdjust = 0
      }
    },
    getPaperSearch(){
      const _that = this;
      _that.listData.page = 1;
      _that.getPaperInfo();
    },
    handleCheckedPartListChange(val){
      const _that = this;
      // console.log("111",val);
      // console.log("222",_that.checkedPartList);
    },
    copyDreedClick() {
      Array.prototype.insert = function(index, value){
        this.splice(index,0, value);
      }

      // var array = [1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0,"张三","李四","王五"]
      //

      // console.log(array)
      // array.insert(4, 10)
      // console.log(array)
      // array.insert(3, "测试")
      // console.log(array)
      // return
      const _that = this;
      if (!_that.formCopy.num) {
        _that.$message('请先填写复制的数量');
        return
      }
      _that.printBillBreedListCopy = JSON.parse(JSON.stringify(_that.printBillBreedList));
      if (!_that.formCopy.value) {
        _that.printBillBreedListCopy.forEach((ele, i) => {
          if (_that.rowId == ele.keyId) {
            // delete a1[i]
            for (let j = 0; j < _that.formCopy.num; j++) {
              var tempData = {}
              tempData = JSON.parse(JSON.stringify(_that.tempData))
              tempData.id = -1;
              _that.printBillBreedList.insert((i+1), tempData)
            }
          }
        })

      } else {
        _that.printBillBreedListCopy.forEach((ele, i) => {
          if (_that.rowId == ele.keyId) {
            // delete a1[i]
            for (let j = 0; j < _that.formCopy.num; j++) {
              var tempData2 = {}
              _that.tempData2.partList = _that.tempData.partList
              tempData2 = JSON.parse(JSON.stringify(_that.tempData2))
              _that.printBillBreedList.insert((i+1), tempData2)
            }
          }
        })
      }
      for (let j = 0; j < _that.printBillBreedList.length; j++) {
        var itemData = _that.printBillBreedList[j];
        _that.$set(itemData, 'keyId', j);
        // itemData.id = itemData.id - j;
        // if (j > 0) {
        //
        // }
        itemData.breedNo = j + 1;
        itemData.breedName = "第" + (j + 1) + "套版" + "(" + itemData.paperName + ")";
      }
      // console.log("_that.printBillBreedListcopy111",_that.printBillBreedList);
      _that.printBillBreedListCopy = JSON.parse(JSON.stringify(_that.printBillBreedList));
      _that.dialogVisibleCopy = false
    },
    handlePs() {
    },
    changeResource() {
      const _that = this;
      if (_that.resource == '删除') {
        _that.isactive2 = 999
      }
    },
    handleBreedList1(partList,item, index) {
      const _that = this
      // console.log(_that.printBillBreedList);
      // console.log(partList);

      _that.isactive = index
    },

    handleBreedList2(item, index) {
      const _that = this
      _that.isactive2 = index;
      // console.log("11111",index);
      _that.printBillBreedList.forEach((ele, i) => {
        // 比较a1和a2，如果a1里面的数据a2中已经存在了，就删除

        if (_that.rowId == ele.keyId) {
          // delete a1[i]concat
          // console.log("2222",_that.printBillBreedList[i].partList);
          _that.printBillBreedList[index].partList = _that.printBillBreedList[index].partList.concat(_that.printBillBreedList[i].partList);
          _that.printBillBreedList.splice(i, 1);

        }
      })
      _that.dialogVisibleDelete = false;
      _that.$message.success('转移成功')
    },
    deleteBreed() {
      // 删除版式确定
      const _that = this
      if (_that.resource == '转移到选择的大板' && _that.isactive2 == 999) {
        _that.$message('请先选择转移的大板')
        return
      }
      if (_that.resource == '删除') {
        _that.printBillBreedList.forEach((ele, i) => {
          // 比较a1和a2，如果a1里面的数据a2中已经存在了，就删除
          if (_that.rowId == ele.keyId) {
            // delete a1[i]
            _that.printBillBreedList.splice(i, 1);
          }
        })
        _that.dialogVisibleDelete = false
        _that.$message.success('删除成功')
      }
    },
    breedClick() {
      const _that = this
      if (_that.multipleSelection.length <= 0) {
        _that.$message('先选择部件')
        return
      }
      _that.dialogTableVisible = false
      // console.log(_that.printBillBreedList);
      // console.log(_that.multipleSelection);
      var data = {
        actualPaperName: null,
        billYear: 0,
        breedFlipType: 0,
        breedName: '',
        breedNo: 0,
        breedPaperPrice: 0,
        breedPlateSize: null,
        breedProcess: '',
        breedSets: 0,
        breedSize: null,
        breedStatus: 0,
        breedTypeName: '',
        colorCount: null,
        completeCount: 0,
        containsOrderIds: null,
        craftFlowCount: 0,
        createBy: 0,
        createTime: null,
        createTimeLong: 0,
        cutCount: 0,
        cutName: null,
        cutSize: null,
        id: 0,
        idActualPaperInfo: 0,
        idMachine: 0,
        idMachineType: 0,
        idPaperBaseInfo: 0,
        idPaperCutInfo: 0,
        idPlateSizeTemplate: 0,
        idPrintBill: 0,
        machineName: null,
        machineTypeName: null,
        paperBand: null,
        paperName: '',
        paperPrice: null,
        partCount: 0,
        partList: [],
        preOutLockManId: 0,
        preOutLockManName: null,
        preOutLockState: 0,
        preOutStockLockIdRoom: 0,
        preOutStockLockQty: 0,
        preOutStockState: 0,
        printCosts: null,
        printCount: '',
        printCount1000: 0,
        printFlowCount: 0,
        printRequire: '',
        processList: [],
        psCount: 0,
        psGroupCount: 0,
        psSize: null,
        selfProvidedPaper: 0,
        specialColor: null,
        updateBy: 0,
        updateTime: null,
        updateTimeLong: 0,
        voidFlag: 0,
        wholePaperCount: 0,
        wholePaperSize: null,
        workPartList: []
      }
      for (let i = 0; i < _that.multipleSelection.length; i++) {
        data.partList.push(_that.multipleSelection[i])
      }
      _that.printBillBreedList.push(data)
    },
    handleOne() {
      const _that = this
      _that.dialogTableVisible = true
      // console.log(_that.printBillBreedList)
      _that.$nextTick(() => {
        _that.$refs.multipleTable.clearSelection()
      })
    },
    handleTwo(row) {
      // console.log(row)
      const _that = this;
      _that.rowId = row.keyId;
      _that.resource = '删除';
      // console.log(_that.rowId);
      _that.isactive2 = 999;
      _that.isactive = 999;
      _that.dialogVisibleDelete = true
      _that.partList = row.partList;
      _that.checkedPartList = row.partList;
    },
    handleThree(row) {
      const _that = this;
      _that.rowId = row.keyId;
      // console.log(row)
      _that.dialogVisibleCopy = true
      _that.tempData = row;
      _that.formCopy.num = "";
      _that.breedNum = _that.printBillBreedList.length;
      // console.log(_that.breedNum);
    },
    handleFour() {
    },
    // 点击复选框触发，复选框样式的改变
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    // 点击行触发，选中或不选中复选框
    handleRowClick(row, column, event) {
      // this.$refs.multipleTable.toggleRowSelection(row);
    },
    rowContextmenu(row, column, event) {
      const _that = this;
      if(_that.billType==1){
        return
      }
      _that.menuVisible = false
      _that.menuVisible = true
      if (row.lockFlag == 0) {
        // this.$refs.fileTable.toggleRowSelection(row);
      }

      // 阻止右键默认行为
      event.preventDefault()
      _that.$nextTick(() => {
        _that.$refs.contextbutton.init(row, column, event)
      })
    },
    foo() { // 取消鼠标监听事件 菜单栏
      this.menuVisible = false
      document.removeEventListener('click', this.foo)
    },
    choosePaperClick(row) {
      // 确定选择纸张paperPrice
      const _that = this;

      _that.priceType = row.priceType;
      _that.printBillDetail.printBillBreedList[_that.scopeIndex].paperName = row.paperName
      _that.printBillDetail.printBillBreedList[_that.scopeIndex].idPaperBaseInfo = row.id
      _that.dialogVisible = false

      var reqParams = [];
      var parms = {
        'idPaperBaseInfo': "",
        'idPaperBrand': 0
      }
      parms.idPaperBaseInfo = row.id;
      parms.idPaperBrand = 0;
      reqParams.push(parms)

      var parmsData = {
        "reqParams": JSON.stringify(reqParams)
      }
      getPaperQuoteInfoByBaseAndBrand(parmsData).then(response => {
        var brandData = response.data[0];
        _that.printBillDetail.printBillBreedList[_that.scopeIndex].paperPrice = brandData.paperPrice;
        _that.printBillDetail.printBillBreedList[_that.scopeIndex].paperSuttle = brandData.paperBaseInfo.mtSuttle;
        // console.log(brandData);
        _that.getBreedPaperPrice(_that.scopeIndex, row.mtSuttle, brandData.paperPrice);//获取纸张金额
      })

    },
    choosePaper() {
      const _that = this
    },
    checkPaper(index, value) {
      const _that = this
      _that.dialogVisible = true
      _that.scopeIndex = index
    },
    getPaperInfo() {
      const _that = this
      _that.listLoading = true
      var params = {
        voidFlag: 0,
        keyWord:_that.searchPaper.keyWord
      }
      var page = {
        pageIndex: _that.listData.page,
        pageSize: _that.listData.pageSize
      }
      var data = {
        'params': JSON.stringify(params),
        'page': JSON.stringify(page)
      }
      // console.log(data);
      getPaperInfoList(data).then(response => {
        const data = response.data
        // //  组合表单数据
        _that.tableData = data
        // console.log('基础纸张档案列表',_that.tableData)
        _that.listData.total = response.total
        // console.log(_that.tableData)
        _that.listLoading = false
      }).catch(err => {
        _that.$message.error(err)
        _that.listLoading = false
      })
    },
    breedFlipTypeClick(index, colorCount) {
      //点击翻版方式
      const _that = this;
      // console.log(colorCount);
      var valueArray = colorCount.split('+');
      if (colorCount.indexOf("0") != -1) {
        _that.options[1].disabled = true;
        _that.options[2].disabled = true;
        _that.options[3].disabled = true;
        _that.options[4].disabled = false;

        if (valueArray[0] != valueArray[1]) {
          _that.options[2].disabled = true;
          _that.options[3].disabled = true;
        }

      } else {
        _that.options[4].disabled = true;
        _that.options[1].disabled = false;
        _that.options[2].disabled = false;
        _that.options[3].disabled = false;
        if (valueArray[0] != valueArray[1]) {
          _that.options[2].disabled = true;
          _that.options[3].disabled = true;
        }
      }
    },
    selectColorCount(index, value) {
      // 印刷色数

      const _that = this
      _that.indexRow = index;
      // _that.printBillDetail.printBillBreedList[_that.indexRow].breedFlipType = "";
      var valueArray = value.split('+');
      // console.log(valueArray);
      if (value.indexOf("0") != -1) {
        _that.options[1].disabled = true;
        _that.options[2].disabled = true;
        _that.options[3].disabled = true;
        _that.options[4].disabled = false;
        _that.printBillDetail.printBillBreedList[_that.indexRow].breedFlipType = 4;
        _that.getPsGroupCount(_that.indexRow);//获取PS版套数

        if (valueArray[0] != valueArray[1]) {
          _that.options[2].disabled = true;
          _that.options[3].disabled = true;
          if (_that.printBillBreedList[_that.indexRow].breedFlipType == 2 || _that.printBillBreedList[_that.indexRow].breedFlipType == 3) {
            _that.printBillBreedList[_that.indexRow].breedFlipType = 0;
            _that.printBillBreedList[_that.indexRow].printCount1000 = 0;
            _that.printBillBreedList[_that.indexRow].psGroupCount = 0;
            _that.printBillBreedList[_that.indexRow].printCosts = 0;
          }
        }

      } else {
        _that.options[4].disabled = true;
        _that.options[1].disabled = false;
        _that.options[2].disabled = false;
        _that.options[3].disabled = false;
        if (_that.printBillDetail.printBillBreedList[_that.indexRow].breedFlipType == 4) {
          _that.printBillDetail.printBillBreedList[_that.indexRow].breedFlipType = 0;
          _that.printBillBreedList[_that.indexRow].printCount1000 = 0;
          _that.printBillBreedList[_that.indexRow].psGroupCount = 0;
          _that.printBillBreedList[_that.indexRow].printCosts = 0;
        } else {
          _that.getPsGroupCount(_that.indexRow);//获取PS版套数
        }
        if (valueArray[0] != valueArray[1]) {
          _that.options[2].disabled = true;
          _that.options[3].disabled = true;
          if (_that.printBillBreedList[_that.indexRow].breedFlipType == 2 || _that.printBillBreedList[_that.indexRow].breedFlipType == 3) {
            _that.printBillBreedList[_that.indexRow].breedFlipType = 0;
            _that.printBillBreedList[_that.indexRow].psGroupCount = 0;
            _that.printBillBreedList[_that.indexRow].printCosts = 0;
          }
        }

      }
      if (_that.printBillBreedList[_that.indexRow].breedFlipType == 0) {
        // _that.$message('请选择翻版方式')
      } else if (_that.printBillBreedList[_that.indexRow].breedFlipType == 4) {
        _that.printBillBreedList[_that.indexRow].printCount1000 = _that.printBillBreedList[_that.indexRow].breedSets * _that.printBillBreedList[_that.indexRow].printCount * 0.001
      } else {
        _that.printBillBreedList[_that.indexRow].printCount1000 = _that.printBillBreedList[_that.indexRow].breedSets * _that.printBillBreedList[_that.indexRow].printCount * 0.002
      }
      _that.getPsCount(_that.printBillBreedList[_that.indexRow].colorCount, _that.printBillBreedList[_that.indexRow].specialColor, _that.indexRow);//获取ps版块数
      _that.getPintCosts(_that.indexRow)
    },
    selectSpecialColor(index, value) {
      // 专色
      const _that = this
      // console.log(value);
      _that.indexRow = index
      _that.printBillDetail.printBillBreedList[_that.indexRow].specialColor = value;

      // console.log(value)
      _that.getPsGroupCount(_that.indexRow);//获取PS版套数
      _that.getPsCount(_that.printBillBreedList[_that.indexRow].colorCount, _that.printBillBreedList[_that.indexRow].specialColor, _that.indexRow);//获取ps版块数
      _that.getPintCosts(_that.indexRow)

    },
    selectBlur(e, index, value) {
      const _that = this
      _that.indexRow = index;
      var valueArray = [];
      var val = "";
      if (e.target.value.length > 0) {
        valueArray = e.target.value.split('+');
        val = e.target.value
      } else {
        valueArray = value.split('+');
        val = value;
      }

      if (val.indexOf("0") != -1) {
        _that.options[1].disabled = true;
        _that.options[2].disabled = true;
        _that.options[3].disabled = true;
        _that.options[4].disabled = false;
        _that.printBillDetail.printBillBreedList[_that.indexRow].breedFlipType = 4;
        _that.getPsGroupCount(_that.indexRow);//获取PS版套数
        if (valueArray[0] != valueArray[1]) {
          _that.options[2].disabled = true;
          _that.options[3].disabled = true;
          if (_that.printBillBreedList[_that.indexRow].breedFlipType == 2 || _that.printBillBreedList[_that.indexRow].breedFlipType == 3) {
            _that.printBillBreedList[_that.indexRow].breedFlipType = 0;
            _that.printBillBreedList[_that.indexRow].printCount1000 = 0;
            _that.printBillBreedList[_that.indexRow].psGroupCount = 0;
            _that.printBillBreedList[_that.indexRow].printCosts = 0;
          }
        }
      } else {

        _that.options[4].disabled = true;
        _that.options[1].disabled = false;
        _that.options[2].disabled = false;
        _that.options[3].disabled = false;
        if (_that.printBillDetail.printBillBreedList[_that.indexRow].breedFlipType == 4) {
          _that.printBillDetail.printBillBreedList[_that.indexRow].breedFlipType = 0;
          _that.printBillBreedList[_that.indexRow].printCount1000 = 0;
          _that.printBillBreedList[_that.indexRow].psGroupCount = 0;
          _that.printBillBreedList[_that.indexRow].printCosts = 0;
        } else {
          _that.getPsGroupCount(_that.indexRow);//获取PS版套数
        }
        if (valueArray[0] != valueArray[1]) {
          _that.options[2].disabled = true;
          _that.options[3].disabled = true;
          if (_that.printBillBreedList[_that.indexRow].breedFlipType == 2 || _that.printBillBreedList[_that.indexRow].breedFlipType == 3) {
            _that.printBillBreedList[_that.indexRow].breedFlipType = 0;
            _that.printBillBreedList[_that.indexRow].psGroupCount = 0;
            _that.printBillBreedList[_that.indexRow].printCosts = 0;
          }
        }
      }
      if (_that.printBillBreedList[_that.indexRow].breedFlipType == 0) {
        // _that.$message('请选择翻版方式')
      } else if (_that.printBillBreedList[_that.indexRow].breedFlipType == 4) {
        _that.printBillBreedList[_that.indexRow].printCount1000 = _that.printBillBreedList[_that.indexRow].breedSets * _that.printBillBreedList[_that.indexRow].printCount * 0.001
      } else {
        _that.printBillBreedList[_that.indexRow].printCount1000 = _that.printBillBreedList[_that.indexRow].breedSets * _that.printBillBreedList[_that.indexRow].printCount * 0.002
      }
      _that.printBillBreedList[_that.indexRow].colorCount = val;
      _that.getPsCount(_that.printBillBreedList[_that.indexRow].colorCount, _that.printBillBreedList[_that.indexRow].specialColor, _that.indexRow);//获取ps版块数
      _that.getPintCosts(_that.indexRow)


    },
    changeProvide(e, index, value) {
      var _that = this
      //checkedProvidedPaper
      _that.indexRow = index;
      // console.log(value);
      if (!value) {
        _that.printBillDetail.printBillBreedList[_that.indexRow].selfProvidedPaper = 1;
        _that.printBillBreedList[_that.indexRow].breedPaperPrice = 0;
      } else {
        _that.printBillDetail.printBillBreedList[_that.indexRow].selfProvidedPaper = 0;
        _that.getBreedPaperPrice(_that.indexRow, _that.printBillBreedList[_that.indexRow].paperSuttle, _that.printBillBreedList[_that.indexRow].paperPrice);//获取纸张金额
      }
    },
    selectBlur1(index, value) {
      //大纸规格变化

      var _that = this
      _that.indexRow = index;
      _that.printBillDetail.printBillBreedList[_that.indexRow].wholePaperSize = value;
      _that.getBreedPaperPrice(_that.indexRow, _that.printBillBreedList[_that.indexRow].paperSuttle, _that.printBillBreedList[_that.indexRow].paperPrice);//获取纸张金额
      _that.getCutSize(index);//获取开纸尺寸
      if (!_that.isEdit) {
        return
      }
      _that.getWholePaperCount(index);//获取大纸张数
      _that.getPsGroupCount(_that.indexRow);//获取PS版套数
      _that.getPsCount(_that.printBillBreedList[_that.indexRow].colorCount, _that.printBillBreedList[_that.indexRow].specialColor, _that.indexRow);//获取ps版块数
      _that.getBreedPaperPrice(_that.indexRow, _that.printBillBreedList[_that.indexRow].paperSuttle, _that.printBillBreedList[_that.indexRow].paperPrice);//获取纸张金额
      _that.getprintCount1000(_that.indexRow);//获取千印数
      // _that.getPintCosts(_that.indexRow)//获取印工金额11
    },
    wholePaperSizeBlur(e, index, value) {
      var _that = this;
      _that.indexRow = index;
      // console.log(_that.sizeInfoList);

      _that.printBillBreedList[_that.indexRow].wholePaperSize = _that.trimVal(e.target.value);
      _that.getBreedPaperPrice(_that.indexRow, _that.printBillBreedList[_that.indexRow].paperSuttle, _that.printBillBreedList[_that.indexRow].paperPrice);//获取纸张金额
      _that.getCutSize(index);//获取开纸尺寸
      if (!_that.isEdit) {
        return
      }
      _that.getWholePaperCount(index);//获取大纸张数
      _that.getPsGroupCount(_that.indexRow);//获取PS版套数
      _that.getPsCount(_that.printBillBreedList[_that.indexRow].colorCount, _that.printBillBreedList[_that.indexRow].specialColor, _that.indexRow);//获取ps版块数
      _that.getBreedPaperPrice(_that.indexRow, _that.printBillBreedList[_that.indexRow].paperSuttle, _that.printBillBreedList[_that.indexRow].paperPrice);//获取纸张金额
      _that.getprintCount1000(_that.indexRow);//获取千印数
      // _that.getPintCosts(_that.indexRow)//获取印工金额11
    },
    trimVal(str) {
      return str.replace(/(^\s*)|(\s*$)/g, "");
    },
    getBreedPaperPrice(indexRow, mtSuttle, paperPrice) {
      // 获取纸张金额 锚点
      const _that = this;
      // console.log(indexRow);
      // console.log(mtSuttle);
      // console.log(paperPrice);
      if(_that.printBillBreedList[indexRow].selfProvidedPaper==1){
        _that.printBillBreedList[indexRow].breedPaperPrice = 0;
        return
      }
      if(!_that.printBillBreedList[indexRow].wholePaperSize){
        return
      }
      var wholePaperSize = _that.printBillBreedList[indexRow].wholePaperSize.split('*');
      if (_that.priceType == 0) {
        //吨价
        //console.log("吨价",(parseInt(wholePaperSize[0]) * parseInt(wholePaperSize[1]) * parseInt(mtSuttle) * parseInt(paperPrice) * _that.printBillBreedList[indexRow].wholePaperCount * 0.000001 * 0.000001).toFixed(2));
        // console.log(parseInt(wholePaperSize[0]) * parseInt(wholePaperSize[1]) * parseInt(mtSuttle) * parseInt(paperPrice) * _that.printBillBreedList[indexRow].wholePaperCount * 0.000001 * 0.000001);
        _that.printBillBreedList[indexRow].breedPaperPrice = _that.getNum((parseInt(wholePaperSize[0]) * parseInt(wholePaperSize[1]) * parseInt(mtSuttle) * parseInt(paperPrice) * _that.printBillBreedList[indexRow].wholePaperCount * 0.000001 * 0.000001).toFixed(2))
      } else if (_that.priceType == 1) {
        //平方
        // console.log(wholePaperSize[0]);
        // console.log(wholePaperSize[1]);
        // console.log(Number(paperPrice));
        // console.log(_that.printBillBreedList[indexRow].wholePaperCount);
        // console.log(parseInt(wholePaperSize[1]) * 0.001);
        // console.log(parseInt(wholePaperSize[0]) * 0.001 * parseInt(wholePaperSize[1]) * 0.001);
        // console.log(parseInt(wholePaperSize[0]) * 0.001 * parseInt(wholePaperSize[1]) * 0.001 * parseInt(paperPrice));

        // console.log("平方",(parseInt(wholePaperSize[0]) * 0.001 * parseInt(wholePaperSize[1]) * 0.001 * Number(paperPrice) * _that.printBillBreedList[indexRow].wholePaperCount).toFixed(2));
        _that.printBillBreedList[indexRow].breedPaperPrice = _that.getNum((parseInt(wholePaperSize[0]) * 0.001 * parseInt(wholePaperSize[1]) * 0.001 * Number(paperPrice) * _that.printBillBreedList[indexRow].wholePaperCount).toFixed(2));
      }
    },
    handleChangePaperPrice(index){
      //修改纸张价格
      const _that = this;
      _that.indexRow = index;
      _that.getBreedPaperPrice(_that.indexRow, _that.printBillBreedList[_that.indexRow].paperSuttle, _that.printBillBreedList[_that.indexRow].paperPrice);//获取纸张金额
    },
    getNum(val) {
      // console.log("val",val);
      if (isNaN(val)) {
        return 0;
      }else {
        return val;
      }

    },
    getPsGroupCount(indexRow) {
      //获取ps版套数
      const _that = this;
      var z = _that.printBillBreedList[indexRow].breedSets;
      if (!_that.printBillBreedList[indexRow].specialColor) {
        if (_that.printBillBreedList[indexRow].breedFlipType == 1) {
          _that.printBillBreedList[indexRow].psGroupCount = (2 + 0) * parseInt(z);
        } else if (_that.printBillBreedList[indexRow].breedFlipType == 0) {
          _that.printBillBreedList[indexRow].psGroupCount = 0;
          // _that.$message('请选择翻版方式')
        } else {
          _that.printBillBreedList[indexRow].psGroupCount = (1 + 0) * parseInt(z);
        }

      } else {
        if (_that.printBillBreedList[indexRow].breedFlipType == 1) {
          _that.printBillBreedList[indexRow].psGroupCount = (2 + 1) * parseInt(z);
        } else if (_that.printBillBreedList[indexRow].breedFlipType == 0) {
          // _that.$message('请选择翻版方式');
          _that.printBillBreedList[indexRow].psGroupCount = 0;
        } else {
          _that.printBillBreedList[indexRow].psGroupCount = (1 + 1) * parseInt(z);
        }
      }
    },
    getPsCount(a, b, indexRow) {
      //获取ps版块数
      const _that = this;
      var numValueA = 0
      var numValueB = 0
      if (!a) {
        numValueA = 0
      } else {
        var numA = a.replace(/[^0-9]/ig, '')
        // console.log("num222", num)
        var numArrayA = numA.split('') // 按字符空隙分隔
        for (let i = 0; i < numArrayA.length; i++) {
          var s = numArrayA[i]
          numValueA += parseFloat(s)
        }
        if (_that.printBillBreedList[indexRow].breedFlipType == 2 || _that.printBillBreedList[indexRow].breedFlipType == 3) {
          numValueA = numValueA * 0.5
        } else {

        }
      }
      if (!b) {
        numValueB = 0
      } else {
        var numB = b.replace(/[^0-9]/ig, '')
        // console.log("num222", num)
        var numArrayB = numB.split('') // 按字符空隙分隔
        for (let i = 0; i < numArrayB.length; i++) {
          var s = numArrayB[i]
          numValueB += parseFloat(s)
        }
      }
      var z = _that.printBillBreedList[indexRow].breedSets;

      // console.log("213132132321",numValueA);
      _that.printBillBreedList[indexRow].psCount = (numValueA + numValueB) * parseInt(z);
    },
    selectMachine(index, value) {
      // 机型名称
      const _that = this
      _that.indexRow = index
      _that.printBillDetail.printBillBreedList[_that.indexRow].machineName = value.split(',')[1];
      _that.printBillDetail.printBillBreedList[_that.indexRow].machineTypeName = value.split(',')[4];
      _that.printBillDetail.printBillBreedList[_that.indexRow].idMachine = value.split(',')[0];
      _that.printBillDetail.printBillBreedList[_that.indexRow].idMachineType = value.split(',')[3];
      _that.printBillDetail.printBillBreedList[_that.indexRow].psSize = value.split(',')[2];
      _that.getPintCosts(_that.indexRow);
    },
    selectBreedFlipType(index, value) {
      // 翻版方式
      const _that = this;
      _that.indexRow = index;
      // if (!_that.printBillBreedList[_that.indexRow].colorCount) {
      //   _that.$message('请先选择印刷色数');
      //   _that.printBillDetail.printBillBreedList[_that.indexRow].breedFlipType = "";
      //   return
      // }
      // console.log(value)
      _that.printBillBreedList[_that.indexRow].completeCount = _that.printBillBreedList[_that.indexRow].breedSets * _that.printBillBreedList[_that.indexRow].printCount;
      _that.printBillBreedList[_that.indexRow].printCount1000 = _that.printBillBreedList[_that.indexRow].breedSets * _that.printBillBreedList[_that.indexRow].printCount;
      _that.printBillDetail.printBillBreedList[_that.indexRow].breedFlipType = value;
      if (value == 0) {
        _that.printBillBreedList[_that.indexRow].printCosts=0
        _that.$message('请选择翻版方式')
      } else if (value == 4) {
        _that.printBillBreedList[_that.indexRow].printCount1000 = _that.printBillBreedList[_that.indexRow].breedSets * _that.printBillBreedList[_that.indexRow].printCount * 0.001
      } else {
        _that.printBillBreedList[_that.indexRow].printCount1000 = _that.printBillBreedList[_that.indexRow].breedSets * _that.printBillBreedList[_that.indexRow].printCount * 0.002
      }
      _that.getPsGroupCount(_that.indexRow);//获取PS版套数
      _that.getPsCount(_that.printBillBreedList[_that.indexRow].colorCount, _that.printBillBreedList[_that.indexRow].specialColor, _that.indexRow);//获取ps版块数
      _that.getPintCosts(_that.indexRow);
    },

    handleBreedSets(index, breedSets) {
      // 版套数
      const _that = this;
      if(!breedSets){
        return
      }
      _that.indexRow = index;
      _that.printBillBreedList[_that.indexRow].completeCount = _that.printBillBreedList[_that.indexRow].breedSets * _that.printBillBreedList[_that.indexRow].printCount;
      _that.getWholePaperCount(index);//获取大纸张数
      _that.getPsGroupCount(_that.indexRow);//获取PS版套数
      _that.getPsCount(_that.printBillBreedList[_that.indexRow].colorCount, _that.printBillBreedList[_that.indexRow].specialColor, _that.indexRow);//获取ps版块数
      _that.getBreedPaperPrice(_that.indexRow, _that.printBillBreedList[_that.indexRow].paperSuttle, _that.printBillBreedList[_that.indexRow].paperPrice);//获取纸张金额
      _that.getprintCount1000(_that.indexRow);//获取千印数
      _that.getPintCosts(_that.indexRow)//获取印工金额11
    },
    getCutSize(index){//获取开纸尺寸
      const _that = this;
      _that.indexRow = index;
      if (!_that.printBillBreedList[_that.indexRow].wholePaperSize || !_that.printBillBreedList[_that.indexRow].cutName) {
        // _that.$message("请先选择大纸规格");
        return
      }
      if (_that.printBillBreedList[_that.indexRow].cutName == "全开") {
        _that.printBillBreedList[_that.indexRow].cutSize = _that.printBillBreedList[_that.indexRow].wholePaperSize;
      } else {
        if (_that.sizeInfoList.length > 0) {
          for (let i = 0; i < _that.sizeInfoList.length; i++) {
            var datas = _that.sizeInfoList[i]
            if (datas.wholePaperSize == _that.printBillDetail.printBillBreedList[_that.indexRow].wholePaperSize) {
              _that.printBillBreedList[_that.indexRow].cutSize = datas.cutPaperSize;
              break
            }
          }
        }
      }

    },
    getWholePaperCount(index){//获取大纸张数
      const _that = this;
      _that.indexRow = index;
      if (!_that.printBillBreedList[_that.indexRow].cutCount || !_that.printBillBreedList[_that.indexRow].printCount  || !_that.printBillBreedList[_that.indexRow].breedSets) {
        return
      }
      var total = parseInt(_that.printBillBreedList[_that.indexRow].printCount) + parseInt(_that.printBillBreedList[_that.indexRow].printFlowCount) + parseInt(_that.printBillBreedList[_that.indexRow].craftFlowCount)
      var plateTotal = parseInt(total * _that.printBillBreedList[index].breedSets)
      // console.log(_that.printBillDetail.printBillBreedList[_that.indexRow].cutCount);
      _that.printBillBreedList[_that.indexRow].wholePaperCount = _that.getNum(Math.ceil(plateTotal / parseInt(_that.printBillBreedList[_that.indexRow].cutCount)))

    },
    getprintCount1000(index){
      //获取千印数
      const _that = this
      if(!_that.printBillBreedList[index].breedSets || !_that.printBillBreedList[index].printCount || _that.printBillDetail.printBillBreedList[index].breedFlipType == 0){
        _that.printBillBreedList[_that.indexRow].printCount1000 = 0;
      }else {
        if (_that.printBillDetail.printBillBreedList[index].breedFlipType == 1 || _that.printBillDetail.printBillBreedList[index].breedFlipType == 2 ||  _that.printBillDetail.printBillBreedList[index].breedFlipType == 3) {
          _that.printBillBreedList[index].printCount1000 = _that.printBillBreedList[index].breedSets * _that.printBillBreedList[index].printCount * 0.002
        } else if (_that.printBillDetail.printBillBreedList[index].breedFlipType == 4) {
          _that.printBillBreedList[index].printCount1000 = _that.printBillBreedList[index].breedSets * _that.printBillBreedList[index].printCount * 0.001
        }

        _that.printBillBreedList[index].completeCount = _that.printBillBreedList[index].breedSets * _that.printBillBreedList[index].printCount;
      }
    },
    getPintCosts(index){
      //获取印工金额
      const _that = this;
      if(!_that.printBillBreedList[index].breedSets || !_that.printBillBreedList[index].printCount || _that.printBillBreedList[index].printCount==0 || !_that.printBillBreedList[index].machineName ||  !_that.printBillBreedList[index].breedFlipType  || _that.printBillBreedList[index].breedFlipType==0){
        _that.printBillBreedList[index].printCosts=0
      }else {
        var datas = {
          breedSets:_that.printBillBreedList[index].breedSets,
          printCount:_that.printBillBreedList[index].printCount,
          breedFlipType:_that.printBillBreedList[index].breedFlipType
        }
        var dataParms = {
          idMachineType:_that.printBillBreedList[index].idMachineType,
          params: JSON.stringify(datas)
        }
        quoteMachineTypePrintFee(dataParms).then(res => {
          // console.log(res.data.resultMap.printFee);
          if(res.data.resultMap){
            _that.printBillBreedList[index].printCosts = res.data.resultMap.printFee
          }

        }).catch(err => {
          // _that.$message(err)
        })
      }
    },
    selectNumber(index, cutName) { // 选择纸张开数
      const _that = this

      // console.log(cutName)
      _that.indexItem = cutName.split(',')[2];
      // console.log(_that.paperCutList);
      _that.sizeInfoList = _that.paperCutList[_that.indexItem].sizeInfoList;
      _that.indexRow = index;
      _that.printBillDetail.printBillBreedList[_that.indexRow].cutName = cutName.split(',')[1]
      _that.printBillDetail.printBillBreedList[_that.indexRow].cutCount = cutName.split(',')[0]
      _that.getCutSize(index);//获取开纸尺寸
      _that.getWholePaperCount(index);//获取大纸张数
      _that.getBreedPaperPrice(_that.indexRow, _that.printBillBreedList[_that.indexRow].paperSuttle, _that.printBillBreedList[_that.indexRow].paperPrice);//获取纸张金额
    },
    handlePaper(index) {
      const _that = this
      _that.dialogFormVisible = true
      _that.indexRow = index
    },
    newSubmit() {
      const _that = this
      // _that.$bus.$on('bill', data => {
      //   console.log(data);
      // })
      if (!_that.idCompany || _that.idCompany==0) {
        _that.$message('请选择分厂信息')
        return
      }
      if(!_that.checkedForced){
        if (Number(_that.formInline.billMoneyTotal)>Number(_that.formInline.orderMoneyTotal)) {
          _that.$message.warning('合计金额不能高于订单金额')
          return
        }
      }
      for (let i = 0; i < _that.printBillBreedList.length; i++) {
        var datas = _that.printBillBreedList[i];
        if (!datas.machineName) {
          _that.$message.warning('请先选择印刷机台')
          return
        }
      }
      _that.disabledBtn = true;
      _that.$store.dispatch('tagsView/delView', _that.$route)
      _that.printBillDetail.idCompany = _that.idCompany;
      _that.printBillDetail.billMoneyPlate = _that.formInline.billMoneyPlate;
      _that.printBillDetail.billMoneyPaper = _that.formInline.billMoneyPaper;
      _that.printBillDetail.billMoneyPrint = _that.formInline.billMoneyPrint;
      _that.printBillDetail.billMoneyProcess = _that.formInline.billMoneyProcess;
      _that.printBillDetail.billMoneyTotal = _that.formInline.billMoneyTotal;
      _that.printBillDetail.billMoneyAdjust = _that.formInline.billMoneyAdjust;
      _that.printBillDetail.orderMoneyTotal = _that.formInline.orderMoneyTotal;
      _that.printBillDetail.billNote = _that.formInline.billNote;
      _that.printBillDetail.orderProduceInfos = _that.formInline.orderProduceInfos;
      _that.printBillDetail.orderMemos = _that.formInline.orderMemos || '';
      _that.printBillDetail.deliveryDate = _that.ruleForm.deliveryDate;
      // console.log("_that.printBillDetail",_that.printBillDetail);
      var printbill = JSON.stringify(_that.printBillDetail)
      newPrintBill(printbill).then(res => {
        // console.log(res);
        _that.disabledBtn = false;
        window.localStorage.removeItem('bill')
        _that.$message.success('提交成功')
        _that.$router.push('/printbill/editionList')
      }).catch(err => {
        // _that.$message(err)
        _that.disabledBtn = false;
      })
    },
    handleSubmit() {
      //修改并提交
      const _that = this
      // _that.$bus.$on('bill', data => {
      //   console.log(data);
      // })
      // console.log(_that.idCompany)
      if (!_that.idCompany || _that.idCompany==0) {
        _that.$message('请选择分厂信息')
        return
      }
      if(!_that.checkedForced){
        if (Number(_that.formInline.billMoneyTotal)>Number(_that.formInline.orderMoneyTotal)) {
          _that.$message.warning('合计金额不能高于订单金额')
          return
        }
      }
      for (let i = 0; i < _that.printBillBreedList.length; i++) {
        var datas = _that.printBillBreedList[i];
        if (!datas.machineName) {
          _that.$message.warning('请先选择印刷机台')
          return
        }
      }
      _that.checkedAgain = false;
      if(_that.needSpliceBreedAgain==1){
        this.dialogAgain = true;
        return
      }
      _that.submitPrint();
      // for (let i = 0; i < _that.printBillBreedList.length; i++) {
      //   var datas = _that.printBillBreedList[i];
      //   if (!datas.colorCount) {
      //     _that.$message('请输入印刷色数')
      //     return
      //   }
      // }

    },
    handleSubmitAgain(){
      const _that = this;
      _that.submitPrint();
    },
    submitPrint(){
      const _that = this;
      if(_that.checkedAgain){
        _that.printBillDetail.spliceBreedAgain = 1;
      }else {
        _that.printBillDetail.spliceBreedAgain = 0;
      }
      _that.printBillDetail.idCompany = _that.idCompany;
      _that.printBillDetail.billMoneyPlate = _that.formInline.billMoneyPlate;
      _that.printBillDetail.billMoneyPaper = _that.formInline.billMoneyPaper;
      _that.printBillDetail.billMoneyPrint = _that.formInline.billMoneyPrint;
      _that.printBillDetail.billMoneyProcess = _that.formInline.billMoneyProcess;
      _that.printBillDetail.billMoneyTotal = _that.formInline.billMoneyTotal;
      _that.printBillDetail.billMoneyAdjust = _that.formInline.billMoneyAdjust;
      _that.printBillDetail.orderMoneyTotal = _that.formInline.orderMoneyTotal;
      _that.printBillDetail.billNote = _that.formInline.billNote;
      _that.printBillDetail.orderProduceInfos = _that.formInline.orderProduceInfos;
      _that.printBillDetail.orderMemos = _that.formInline.orderMemos || '';
      _that.printBillDetail.deliveryDate = _that.ruleForm.deliveryDate;
      var printbill = JSON.stringify(_that.printBillDetail);
      // console.log(_that.printBillDetail);

      // console.log(_that.printBillDetail);
      submitPrintBill(printbill).then(res => {
        _that.$message.success('提交成功')
        _that.$store.dispatch('tagsView/delView', _that.$route)
        _that.$router.push('/printbill/list')
      }).catch(err => {
        // _that.$message(err)
      })
    },
    handleForceupdate() {
      //强制修改
      const _that = this
      // _that.$bus.$on('bill', data => {
      //   console.log(data);
      // })
      // console.log(_that.idCompany)
      // for (let i = 0; i < _that.printBillBreedList.length; i++) {
      //   var datas = _that.printBillBreedList[i];
      //   if (!datas.colorCount) {
      //     _that.$message('请输入印刷色数')
      //     return
      //   }
      // }
      if(!_that.checkedForced){
        if (Number(_that.formInline.billMoneyTotal)>Number(_that.formInline.orderMoneyTotal)) {
          _that.$message.warning('合计金额不能高于订单金额')
          return
        }
      }
      for (let i = 0; i < _that.printBillBreedList.length; i++) {
        var datas = _that.printBillBreedList[i];
        if (!datas.machineName) {
          _that.$message.warning('请先选择印刷机台')
          return
        }
      }
      _that.printBillDetail.idCompany = _that.idCompany
      _that.printBillDetail.billMoneyPlate = _that.formInline.billMoneyPlate
      _that.printBillDetail.billMoneyPaper = _that.formInline.billMoneyPaper
      _that.printBillDetail.billMoneyPrint = _that.formInline.billMoneyPrint
      _that.printBillDetail.billMoneyProcess = _that.formInline.billMoneyProcess
      _that.printBillDetail.billMoneyTotal = _that.formInline.billMoneyTotal
      _that.printBillDetail.billMoneyAdjust = _that.formInline.billMoneyAdjust
      _that.printBillDetail.orderMoneyTotal = _that.formInline.orderMoneyTotal
      _that.printBillDetail.billNote = _that.formInline.billNote
      _that.printBillDetail.orderProduceInfos = _that.formInline.orderProduceInfos
      _that.printBillDetail.orderMemos = _that.formInline.orderMemos || ''
      _that.printBillDetail.deliveryDate = _that.ruleForm.deliveryDate
      var printbill = JSON.stringify(_that.printBillDetail)
      // console.log(_that.printBillDetail);

      // console.log(_that.printBillDetail);
      forceUpdatePrintBill(printbill).then(res => {
        _that.$message.success('强制修改成功')
        _that.$store.dispatch('tagsView/delView', _that.$route)
        _that.$router.push('/printbill/list')
      }).catch(err => {
        // _that.$message(err)
      })
    },
    handleUpdate() {
      const _that = this;
      if (!_that.idCompany|| _that.idCompany==0) {
        _that.$message('请选择分厂信息')
        return
      }
      if(!_that.checkedForced){
        if (Number(_that.formInline.billMoneyTotal)>Number(_that.formInline.orderMoneyTotal)) {
          _that.$message.warning('合计金额不能高于订单金额')
          return
        }
      }


      for (let i = 0; i < _that.printBillBreedList.length; i++) {
        var datas = _that.printBillBreedList[i];
        if (!datas.machineName) {
          _that.$message.warning('请先选择印刷机台')
          return
        }
      }
      _that.printBillDetail.idCompany = _that.idCompany
      _that.printBillDetail.billMoneyPlate = _that.formInline.billMoneyPlate
      _that.printBillDetail.billMoneyPaper = _that.formInline.billMoneyPaper
      _that.printBillDetail.billMoneyPrint = _that.formInline.billMoneyPrint
      _that.printBillDetail.billMoneyProcess = _that.formInline.billMoneyProcess
      _that.printBillDetail.billMoneyTotal = _that.formInline.billMoneyTotal
      _that.printBillDetail.billMoneyAdjust = _that.formInline.billMoneyAdjust
      _that.printBillDetail.orderMoneyTotal = _that.formInline.orderMoneyTotal
      _that.printBillDetail.billNote = _that.formInline.billNote
      _that.printBillDetail.orderProduceInfos = _that.formInline.orderProduceInfos
      _that.printBillDetail.orderMemos = _that.formInline.orderMemos || ''
      _that.printBillDetail.deliveryDate = _that.ruleForm.deliveryDate;
      // console.log(_that.printBillDetail.billMoneyPaper);
      // console.log(_that.printBillDetail.billMoneyPrint);
      // console.log(_that.printBillDetail.billMoneyTotal);

      // console.log(_that.formInline.orderMemos);
      // var data = {
      //   "printbill": JSON.stringify(_that.printBillDetail)
      // }
      var printbill = JSON.stringify(_that.printBillDetail)
      updatePrintBill(printbill).then(res => {
        // console.log(res);
        _that.$message.success('成功');
        _that.$store.dispatch('tagsView/delView', _that.$route);
        _that.$router.push('/printbill/list');
      }).catch(err => {
        // _that.$message(err)
      })
    },
    // 行内编辑
    handleCurrentChange(row, event, column) {
      // console.log(row, event, column, event.currentTarget);
      this.$refs.tablePrinting.setCurrentRow(row);
      this.$refs.tableMaterials.setCurrentRow(row);
    },

    handlePrintCount(index, value,type) {
      const _that = this
      _that.indexRow = index;
      _that.getWholePaperCount(_that.indexRow);//获取大纸张数
      _that.getPintCosts(_that.indexRow);
      _that.printBillBreedList[_that.indexRow].completeCount = _that.printBillBreedList[_that.indexRow].breedSets * _that.printBillBreedList[_that.indexRow].printCount;

      _that.getBreedPaperPrice(_that.indexRow, _that.printBillBreedList[_that.indexRow].paperSuttle, _that.printBillBreedList[_that.indexRow].paperPrice);//获取纸张金额
      _that.getprintCount1000(_that.indexRow);
    },
    handlePrintCountChange(index, value,type){
      const _that = this
      _that.indexRow = index;

      _that.getWholePaperCount(_that.indexRow);//获取大纸张数
      _that.getPintCosts(_that.indexRow)
      _that.printBillBreedList[_that.indexRow].completeCount = _that.printBillBreedList[_that.indexRow].breedSets * _that.printBillBreedList[_that.indexRow].printCount;

      _that.getBreedPaperPrice(_that.indexRow, _that.printBillBreedList[_that.indexRow].paperSuttle, _that.printBillBreedList[_that.indexRow].paperPrice);//获取纸张金额
      _that.getprintCount1000(_that.indexRow);

    },
    handleEdit(index, row) {
      const _that = this
    },
    handleEditCutSize(index, row){
      const _that = this;
      if (!_that.isEdit) {
        return
      }
      _that.indexRow = index;
      _that.getWholePaperCount(index);//获取大纸张数
      _that.getPsGroupCount(_that.indexRow);//获取PS版套数
      _that.getPsCount(_that.printBillBreedList[_that.indexRow].colorCount, _that.printBillBreedList[_that.indexRow].specialColor, _that.indexRow);//获取ps版块数
      _that.getBreedPaperPrice(_that.indexRow, _that.printBillBreedList[_that.indexRow].paperSuttle, _that.printBillBreedList[_that.indexRow].paperPrice);//获取纸张金额
      _that.getprintCount1000(_that.indexRow);//获取千印数
    },
    addRefreshBtn() {
      const _that = this;
      _that.title = '增加施工单信息';
      var billData = localStorage.getItem('bill')
      _that.printBillDetail = JSON.parse(billData)
      // console.log(_that.printBillDetail)
      // console.log("_that.printBillDetail123123", _that.printBillDetail);
      _that.setTagsViewTitle()
      _that.processList = _that.printBillDetail.printBillBreedList[0].processList
      _that.printOrderList = _that.printBillDetail.printOrderList
      _that.printBillBreedList = _that.printBillDetail.printBillBreedList
      // console.log("_that.printBillBreedList", _that.printBillDetail.printBillBreedList);
      if (_that.printBillDetail.orderProduceInfos) {
        _that.orderProduceInfosArray = _that.printBillDetail.orderProduceInfos.split('`')
      } else {
        _that.orderProduceInfosArray = []
      }
      if (_that.printBillDetail.orderMemos) {
        // console.log(_that.printBillDetail.orderProduceInfos);
        _that.orderMemosArray = _that.printBillDetail.orderMemos.split('`')
      } else {
        _that.orderMemosArray = []
      }

      // console.log(_that.orderProduceInfosArray);
      _that.formInline = {
        billMoneyPlate: _that.printBillDetail.billMoneyPlate,
        billMoneyPaper: _that.printBillDetail.billMoneyPaper,
        billMoneyPrint: _that.printBillDetail.billMoneyPrint,
        billMoneyProcess: _that.printBillDetail.billMoneyProcess,
        billMoneyTotal: _that.printBillDetail.billMoneyTotal,
        billMoneyAdjust: 0,
        orderMoneyTotal: _that.printBillDetail.orderMoneyTotal,
        billNote: _that.printBillDetail.billNote,
        orderProduceInfos: _that.printBillDetail.orderProduceInfos,
        orderMemos: _that.printBillDetail.orderMemos || ''
      }
    },
    editRefreshBtn() {
      this.getClientData();
      this.setTagsViewTitle();
    },
    setTagsViewTitle() {
      const _that = this
      var title = "";
      if (_that.isEdit) {
        if(_that.$route.query.type=="forceupdate"){
          title = '强制修改施工单'
        }else {
          title = '编辑施工单';
        }
        const route = Object.assign({}, this.tempRoute, {title: `${title}-${_that.$route.query.clientName}`})
        // console.log("tempRoute2",route);
        // console.log("route",route)
        _that.$store.dispatch('tagsView/updateVisitedView', route)
      } else {
        title = '增加施工单';
      }
    },
    setPageTitle() {
      const title = '编辑施工单'
      document.title = `${title}-${this.$route.query.clientName}`
    },
    setPageForceupdateTitle() {
      const title = '强制修改施工单'
      document.title = `${title}-${this.$route.query.clientName}`
    },
    getClientData() {
      const _that = this
      // console.log(_that.$route.query.idPrintBill);
      // console.log(this.$route.query.clientName);
      _that.fullscreenLoading = true;
      var data = {
        idPrintBill: _that.$route.query.idPrintBill
      }
      _that.setTagsViewTitle()
      return new Promise(function (resolve, reject) {
        setTimeout(() => {
          getInfoById(data).then(res => {
            _that.fullscreenLoading = false;
            _that.printBillDetail = res.data;
            _that.$nextTick(() => {
              if(!res.data.idCompany || res.data.idCompany==0){
                _that.idCompany = _that.typeOptions[0].id;
              }else {
                _that.idCompany = res.data.idCompany;
              }
            })


            _that.needSpliceBreedAgain = res.data.needSpliceBreedAgain
            _that.billType = res.data.billType;
            _that.processList = res.data.printBillBreedList[0].processList
            _that.printOrderList = res.data.printOrderList
            _that.printBillBreedList = res.data.printBillBreedList
            // console.log('_that.printBillBreedList1111',_that.printBillBreedList)
            if (_that.printBillDetail.orderProduceInfos) {
              _that.orderProduceInfosArray = _that.printBillDetail.orderProduceInfos.split('`');
            } else {
              _that.orderProduceInfosArray = [];
            }
            if (_that.printBillDetail.orderMemos) {
              // console.log(_that.printBillDetail.orderProduceInfos);
              _that.orderMemosArray = _that.printBillDetail.orderMemos.split('`')
            } else {
              _that.orderMemosArray = []
            }
            if (_that.printBillDetail.billType == 1) {
              //合版
              for (let i = 0; i < _that.printBillBreedList.length; i++) {
                var itemData = _that.printBillBreedList[i];
                if (itemData.breedFlipType == 4) {
                  itemData.colorCount = "4+0"
                } else {
                  itemData.colorCount = "4+4"
                }
                _that.getPsGroupCount(i);//获取PS版套数
                _that.getPsCount(itemData.colorCount, itemData.specialColor, i);//获取ps版块数
                _that.getPintCosts(i);//获取印工
                if(!_that.printBillBreedList[i].breedSets || !_that.printBillBreedList[i].printCount || _that.printBillBreedList[i].printCount==0 || !_that.printBillBreedList[i].machineTypeName ||  !_that.printBillBreedList[i].breedFlipType  || _that.printBillBreedList[i].breedFlipType==0){
                  _that.printBillBreedList[i].printCosts=0;
                }else {
                }
              }
            }else {
              for (let i = 0; i < _that.printBillBreedList.length; i++) {
                var itemData = _that.printBillBreedList[i];
                _that.getPsGroupCount(i);//获取PS版套数
                _that.getPsCount(itemData.colorCount, itemData.specialColor, i);//获取ps版块数
                _that.getPintCosts(i);//获取印工
                if(!_that.printBillBreedList[i].breedSets || !_that.printBillBreedList[i].printCount || _that.printBillBreedList[i].printCount==0 || !_that.printBillBreedList[i].machineTypeName ||  !_that.printBillBreedList[i].breedFlipType  || _that.printBillBreedList[i].breedFlipType==0){
                  _that.printBillBreedList[i].printCosts=0;
                }
              }
            }

            // console.log(_that.orderProduceInfosArray);
            _that.formInline = {
              billMoneyPlate: _that.printBillDetail.billMoneyPlate,
              billMoneyPaper: _that.printBillDetail.billMoneyPaper,
              billMoneyPrint: _that.printBillDetail.billMoneyPrint,
              billMoneyProcess: _that.printBillDetail.billMoneyProcess,
              billMoneyTotal: _that.printBillDetail.billMoneyTotal,
              billMoneyAdjust: 0,
              orderMoneyTotal: _that.printBillDetail.orderMoneyTotal,
              billNote: _that.printBillDetail.billNote,
              orderProduceInfos: _that.printBillDetail.orderProduceInfos,
              orderMemos: _that.printBillDetail.orderMemos || ''
            }
            _that.getPaperPrice(_that.printBillBreedList);//获取纸张价格
            return new Promise(function (resolve, reject) {
              setTimeout(() => {
                _that.getPrintName();
                _that.getDictPrintRequire();
                _that.$forceUpdate();//重绘
                resolve(0)
              }, 500)
            })
          }).catch(err => {
            _that.fullscreenLoading = false;
            // _that.$message(err)
          })
          resolve(0)
        }, 500)

      })

    },
    getPaperPrice(datalist) {
      const _that = this;
      var reqParams = [];
      for (let i = 0; i < datalist.length; i++) {
        var datas = datalist[i];
        _that.$set(datas, 'keyId', i);
        var parms = {
          'idPaperBaseInfo': "",
          'idPaperBrand': 0
        }
        parms.idPaperBaseInfo = datas.idPaperBaseInfo;
        parms.idPaperBrand = 0;
        reqParams.push(parms)
      }
      var parmsData = {
        "reqParams": JSON.stringify(reqParams)
      }
      // console.log(parmsData);
      getPaperQuoteInfoByBaseAndBrand(parmsData).then(response => {
        // console.log(response);
        var brandData = response.data;
        _that.priceType = brandData[0].priceType;
        for (let i = 0; i < datalist.length; i++) {
          for (let j = 0; j < brandData.length; j++) {
            if (datalist[i].paperName == brandData[j].paperBaseName) {
              // console.log("11111",datalist[i].paperPrice);
              _that.printBillBreedList[i].paperSuttle = brandData[j].paperBaseInfo.mtSuttle;
              if(_that.printBillBreedList[i].selfProvidedPaper==1){
                if(datalist[i].paperPrice==0 || datalist[i].paperPrice=="" || datalist[i].paperPrice==null || datalist[i].paperPrice==undefined){
                  _that.printBillBreedList[i].paperPrice = brandData[j].paperPrice;
                }
                _that.printBillBreedList[i].breedPaperPrice = 0;
              }else {
                if(datalist[i].paperPrice==0 || datalist[i].paperPrice=="" || datalist[i].paperPrice==null || datalist[i].paperPrice==undefined){
                  _that.printBillBreedList[i].paperPrice = brandData[j].paperPrice;
                  _that.getBreedPaperPrice(i, brandData[j].paperBaseInfo.mtSuttle, brandData[j].paperPrice);//获取纸张金额
                }
              }

            }
          }
        }
      }).catch(err => {
      })
    },
    getCutInfo() {
      const _that = this
      // 获取纸张开数档案
      var params = {
        params: {
          getDetail: 1
        }
      }
      queryPaperCutInfo(params).then(response => {
        const data = response.data

        _that.$nextTick(() => {
          _that.paperCutList = response.data;
        })
        // console.log("paperCutList",data);
        // //  组合表单数据
      }).catch(err => {
        _that.listLoading = false
      })
    },
    // 获取机台名称
    getPrintName() {
      var _that = this
      var data = {}
      getPrinterNameList(data).then(res => {
        // console.log('1', res.data)
        if (res.httpCode == 200) {
          _that.optionsMachine = res.data;
        } else {
          // _that.$message(res.msg)
        }
      }).catch(err => {
        // _that.$message(err);
      })
    },
    // 获取印刷色数
    getDictPrintRequire() {
      const _that = this
      var data = {
        'dictTypeTextMulti': 'PrintingColorNumber,SpotColorNumber,PaperSize'
      }

      // console.log(data)
      getDictTypeInfo(data).then(response => {
        // console.log("_that.printRequireOptions",response.data);
        const data = response.data
        _that.$nextTick(() => {
          _that.printRequireOptions = data.PrintingColorNumber.result
          _that.specialColorOptions = data.SpotColorNumber.result
          _that.PaperSizeOptions = data.PaperSize.result;
          // console.log("2",_that.PaperSizeOptions);
        })

      }).catch(err => {
        // _that.$message(err)
      })
    },

    // 增加

    // 刷新表格
    tableRefresh() {
      // 刷新变革
      this.getTableInfo()
    },

    // 搜索
    searchData() {
      this.listData.page = 1
      this.getTableInfo()
    },
    getBreedInfo() {
      const _that = this
      var dataSearch = {};
      dataSearch["processState"] = 2;
      dataSearch["postPDF"] = 1;
      var page = {
        pageIndex: _that.listData2.page,
        pageSize: _that.listData2.pageSize
      }
      // console.log("1111",dataSearch);
      var data = {
        "params": JSON.stringify(dataSearch),
        "page": JSON.stringify(page),
      }
      getInfo(data).then(response => {
        // _that.BreedInfoList = data;
        // console.log("_that.list",response.data);
        var workPartlist = []
        for (let i = 0; i < response.data.length; i++) {
          var datas = response.data[i]
          // console.log(datas)
          for (let j = 0; j < datas.workPartList.length; j++) {
            workPartlist.push(datas.workPartList[j])
          }
        }

        // console.log("workPartlist",workPartlist);
        _that.BreedInfoList = workPartlist;
      }).catch(err => {
        console.log(err)
      })
    },
    getCompanyInfoList() {
      const _that = this
      getAllCompanyInfoList().then(response => {
        _that.typeOptions = response.data;
        // console.log(!_that.isEdit && response.data.length > 0);
        if (!_that.isEdit) {
          _that.idCompany = response.data[0].id;
        } else {
          if (_that.idCompany == 0 || _that.idCompany == "" || _that.idCompany == undefined) {
            _that.idCompany = response.data[0].id;
          }
        }
      }).catch(err => {
        console.log(err)
      })
    },
    indexMethod(index) {
      return index + 1
    },
  }
}
</script>
<style>
.customClassWidth {
  width: 780px !important;
  text-align: left !important;
}
.customClassWidth .el-notification__group .el-notification__content{
  text-align: left !important;
}
.bill-con .textarea {
  white-space: pre-line;
}

.area-select .area-selected-trigger {
  padding: 0px 20px 7px 12px !important;
}

.area-select {
  height: 40px !important;
}
</style>

<style lang="scss" scoped>
.el-notification__content{
}
::v-deep .el-tabs__item{
  height: 28px;
  line-height: 28px;
  font-size: 13px;
  font-weight: bold;
}
::v-deep .el-tabs__content {
  padding: 0px;
}
::v-deep .el-card__header{
  padding: 5px 7px;
  font-size: 13px;
  font-weight: bold;
}
::v-deep .el-form-item__label{
  font-size: 12px;
  font-weight: normal;
}
::v-deep .el-card{
  border: none;
}
::v-deep .el-card__body{
  padding: 0px;
}
::v-deep .el-form-item--mini{
  margin-bottom: -10px;
}
.li-span {
  display: block;
  line-height: 28px;
  height: 28px;
  color: #7c7c7c;
  cursor: pointer !important;
  padding-left: 5px;
  padding-right: 5px;
}

.li-span span {
  display: block;
  width: 100%;
  height: 28px;
  margin-left: 5px;
}

.li-span:hover {
  background: #f6f6f6;
}

.info-con {
  font-size: 12px;
  line-height: 28px;
}

.info-con span {
  font-size: 12px;
}

.card-tit {
  float: left;
  height: 100%;
  min-height: 200px;
  max-height: 200px;
  font-size: 14px;
  color: #7c7c7c;
  width: 20px;
  margin: 0 auto;
  line-height: 20px;
  padding: 20px;
  padding-left: 10px;
  border-right: 1px solid #ddd;
}

.el-page-header__content {
  color: #409EFF;
}

.area-select {
  height: 40px;
}

.filter-container {
  margin-bottom: 15px;
}


.ProduceInfo-con p {
  padding: 0px;
  margin: 5px;
}

.bg {
  background: #EBEEF5;
  color: #409EFF;
  padding-left: 5px;
}

.tb-edits .el-input {
  display: none
}

.tb-edits .current-row .el-input {
  display: block
}
//::v-deep.tb-edits .current-row {
//  background: red !important;
//}
::v-deep .tb-edits .el-table__body tr.current-row>td {
  color: #fff;
  background-color: #a0cef3 !important;
}
.tb-edits .current-row .el-input + span {
  display: none
}
</style>
