<template>
  <div style="background: #eee">
    <div class="title" style="margin-left: 0px">
      <div class="item">
        <span class="font" style="font-size: 32px">生产中心全流程监控平台</span>
      </div>
      <div class="right-box">
        <div class="item">
          <span class="font"
            >{{ riqi }} &nbsp; &nbsp;{{ days }} &nbsp; {{ shijian }}</span
          >
        </div>
        <div class="item">
          <img class="top-bar__img" :src="info.avatar" />
          <span class="font">
            {{ info.user_name }}
          </span>
        </div>
        <div class="item">
          <div class="back" @click="$router.back()">
            <i class="icon-mes-fanhui"></i>
            <span class="font">返回</span>
          </div>
        </div>
      </div>
    </div>
    <div class="box">
      <div class="box-container">
        <!-- <p class="tab">切割入窑、蒸养和质检报工</p> -->
        <div style="display: flex">
          <div class="titleBox">
            <div class="topdate">
              <div class="topdate1">
                <div @click="getDateMeg('today')">今日</div>
                <div @click="getDateMeg('yestoday')">昨日</div>
              </div>
              <div class="topdate2">24h</div>
            </div>
            <div class="handle-item">
              <div class="handle-name">浇注</div>
              <div class="div-input">
                <div style="margin-bottom: 24px">
                  A: {{ pouring[0] ? pouring[0].num : '' }}
                </div>
                <div>B: {{ pouring[1] ? pouring[1].num : '' }}</div>
              </div>
            </div>
            <div class="handle-item">
              <div class="handle-name">挂网</div>
              <div class="div-input">
                <div style="margin-bottom: 24px">
                  A:
                  {{
                    teamGroupData.putMesh && teamGroupData.putMesh[0]
                      ? teamGroupData.putMesh[0].num
                      : ''
                  }}
                </div>
                <div>
                  B:
                  {{
                    teamGroupData.putMesh && teamGroupData.putMesh[1]
                      ? teamGroupData.putMesh[1].num
                      : ''
                  }}
                </div>
              </div>
            </div>
            <div class="handle-item">
              <div class="handle-name">切割</div>
              <div class="div-input">
                <div style="margin-bottom: 24px">
                  A:
                  {{
                    teamGroupData.cutting && teamGroupData.cutting[0]
                      ? teamGroupData.cutting[0].num
                      : ''
                  }}
                </div>
                <div>
                  B:
                  {{
                    teamGroupData.cutting && teamGroupData.cutting[1]
                      ? teamGroupData.cutting[1].num
                      : ''
                  }}
                </div>
              </div>
            </div>
            <div class="handle-item">
              <div class="handle-name">蒸养</div>
              <div class="div-input">
                <div style="margin-bottom: 24px">
                  入釜:
                  {{
                    teamGroupData.steamCuring && teamGroupData.steamCuring[0]
                      ? teamGroupData.steamCuring[0].num
                      : ''
                  }}
                </div>
                <div>
                  出釜:
                  {{
                    teamGroupData.steamCuring && teamGroupData.steamCuring[1]
                      ? teamGroupData.steamCuring[1].num
                      : ''
                  }}
                </div>
              </div>
            </div>
          </div>
          <div class="rightBox">
            <div class="rightBoxTir">
              <p>浇注: 班组A</p>
              <p>挂网: 班组B</p>
              <p>切割: 班组C</p>
            </div>
            <div class="rightInfo">
              <div
                class="top-active"
                @click="$router.push('/production-management/teamSingle')"
              >
                班组工作统计
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="bottomBox" v-loading="pageLoading">
        <!-- 质检统计 -->
        <div class="quality-inspection-statistics">
          <div class="statistics-title">质检统计</div>
          <el-radio-group v-model="statisticsBtn" @change="statisticsChange">
            <el-radio-button label="day">当天</el-radio-button>
            <el-radio-button label="week">本周</el-radio-button>
            <el-radio-button label="month">本月</el-radio-button>
          </el-radio-group>
          <div class="date-picker">
            <span style="width: 120px">自定义范围</span>
            <el-date-picker
              v-model="date"
              type="daterange"
              range-separator="至"
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
              @change="datePickerChange"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
            >
            </el-date-picker>
          </div>
          <div class="list">
            <div style="margin-top: 10px">
              总合格率：{{ echartsData.totalQualified }}%
            </div>
            <div id="echarts" style="width: 430px; height: 240px"></div>
            <div style="font-size: 14px; display: flex">
              <div style="width: 50%">
                <div>板材生产总量：{{ echartsData.boardQualiNum }}</div>
                <div>板材合格总量：{{ echartsData.boardQualifiedNum }}</div>
              </div>
              <div style="width: 50%">
                <div>砌块生产总量：{{ echartsData.blockQualiNum }}</div>
                <div>砌块合格总量：{{ echartsData.blockQualifiedNum }}</div>
              </div>
            </div>
            <div class="list1">入库列表</div>
            <el-table :data="warehousingList" style="width: 100%">
              <el-table-column
                prop="model"
                label="规格"
                width="110"
              ></el-table-column>
              <el-table-column
                prop="square"
                label="总方量"
                width="80"
              ></el-table-column>
              <el-table-column
                prop="qualifiedSum"
                label="合格"
                width="60"
                align="center"
              ></el-table-column>
              <el-table-column
                prop="scrapNumber"
                label="报废"
                width="60"
              ></el-table-column>
              <el-table-column
                prop="cutRepairNumber"
                label="切补修"
                width="70"
              ></el-table-column>
            </el-table>
            <el-pagination
              @current-change="handleCurrentChange"
              @size-change="handleSizeChange"
              :current-page="pagination.pageNum"
              :pager-count="5"
              :page-size="pagination.pageSize"
              layout="total, prev, pager, next"
              :total="pagination.total"
            >
            </el-pagination>
          </div>
        </div>
        <!-- 质检、出釜、入窑 -->
        <div class="bottomBox2">
          <div class="technological-process">
            <div>转道</div>
            <div>质检</div>
            <div>出釜</div>
            <div>蒸养</div>
            <div>入釜</div>
            <div>入窑</div>
            <div>切割</div>
          </div>
          <div class="bottomBoxItem">
            <div>
              <div
                style="display: flex; padding-bottom: 8px"
                v-for="(item, index) in getFambeChangeList"
                :key="index"
              >
                <div
                  class="handler-diversion"
                  @click="qualityTesting(item, '1')"
                  style="height: 52px"
                  :style="{
                    'background-color': item.number > 0 ? '#429153' : '#c9c9c9'
                  }"
                >
                  <span class="fambe-no">{{
                    item.famBeNo | fambeNoFormat
                  }}</span>
                  <span>转道</span>
                </div>
              </div>
            </div>
            <div>
              <div
                style="display: flex; padding-bottom: 8px"
                v-for="(item, index) in getFambeQualityList"
                :key="index"
              >
                <p class="imgBox" @click="qualityTesting(item, '0')">
                  <img
                    v-if="item.isEaLingKiln == 0 && item.startTime == null"
                    src="./images/hui.png"
                  />
                  <img v-else src="./images/ground.png" />
                  <span class="handler-number">{{
                    item.famBeNo | fambeNoFormat
                  }}</span>
                  <span class="handler-text">质检</span>
                </p>
                <div
                  class="item1"
                  @click="editDia(item, 'detail', '检')"
                  :style="{
                    background: item.number == 0 ? '#fff' : '#2788E8',
                    color: item.number == 0 ? '#000' : '#fff'
                  }"
                >
                  <span style="line-height: 53px" v-if="item.number == 0"
                    >空</span
                  >
                  <div class="message-box" v-else>
                    <div style="line-height: 53px">
                      出釜未检 | <span class="font12"> 已等待 </span
                      >{{ item.startTime | computedTimeSlot }}小时
                    </div>
                  </div>
                </div>
                <p
                  class="imgBox"
                  @click="ToOnekeyQualityFun(item)"
                  v-loading.fullscreen.lock="fullscreenLoading"
                >
                  <img
                    v-if="item.endTime != null || item.number2 == '0'"
                    src="./images/hui.png"
                  />
                  <img v-else src="./images/ground.png" />
                  <span class="handler-number">{{
                    item.famBeNo | fambeNoFormat
                  }}</span>
                  <span class="handler-text">出釜</span>
                </p>
              </div>
            </div>
            <div>
              <div
                style="display: flex; padding-bottom: 8px"
                v-for="(item, index) in getFambeKettleList"
                :key="index"
              >
                <div
                  class="item1"
                  @click="editDia(item, 'detail', '釜')"
                  :style="{
                    background: !item.startTime ? '#fff' : '#EA8C48',
                    color: !item.startTime ? '#000' : '#fff'
                  }"
                >
                  <span style="line-height: 53px" v-if="!item.startTime"
                    >空釜</span
                  >
                  <div class="message-box" style="padding-top: 5px" v-else>
                    <div class="font12">
                      入釜时间: {{ item.startTime }}&nbsp;&nbsp;{{
                        item.pressure
                      }}
                    </div>
                    <div>
                      <span class="font12">入釜时长</span>
                      {{ item.startTime | computedTimeSlot }}小时
                    </div>
                  </div>
                </div>
                <p
                  class="imgBox"
                  @click="ToOnekeyKettleFun(item)"
                  v-loading.fullscreen.lock="fullscreenLoading"
                >
                  <img
                    v-if="
                      item.isEaLingKiln == 1 &&
                      item.number <= 0 &&
                      item.number2 > 0
                    "
                    src="./images/ground.png"
                  />
                  <img v-else src="./images/hui.png" />

                  <span class="handler-number">{{
                    item.famBeNo | fambeNoFormat
                  }}</span>
                  <span class="handler-text">入釜</span>
                </p>
              </div>
            </div>
            <!-- 入窑 -->
            <div>
              <div
                style="display: flex; padding-bottom: 8px"
                v-for="(item, index) in getFambeStateList"
                :key="index"
              >
                <div
                  class="item1"
                  @click="editDia(item, 'detail', '窑')"
                  :style="{
                    background:
                      item.number == 0
                        ? '#fff'
                        : item.number != 18
                        ? '#F7B24A'
                        : '#157A2C',
                    color: item.number == 0 ? '#000' : '#fff'
                  }"
                >
                  <span
                    v-if="item.isEaLingKiln == 0"
                    style="font-size: 20px; line-height: 53px"
                  >
                    {{ item.number == 0 ? '空窑' : item.number + '/' + 18 }}
                  </span>
                  <div class="entry-kiln message-box" v-else>
                    <div class="font12">
                      {{ item.startTime | formatYear }}~{{
                        item.endTime | formatYear
                      }}
                      {{ item.tem }} {{ item.hum }}
                    </div>
                    <div>
                      <span v-if="item.endTime && item.isEaLingKiln === 1"
                        >封窑 |
                      </span>
                      <span v-if="item.number == 18">满窑 | </span>
                      <span class="font12">封窑时长</span>
                      {{ item.endTime | computedTimeSlot }}小时
                    </div>
                  </div>
                </div>
                <p
                  class="imgBox"
                  @click="kilnEntry(item, index)"
                  :style="{
                    transform:
                      currentIndex === index ? 'scale(1.5)' : 'scale(1)'
                  }"
                >
                  <span v-if="currentIndex === index">
                    <img src="./images/active-arrow.png" alt="" />
                    <span class="handler-text">当前入窑</span>
                  </span>
                  <span v-else>
                    <img
                      v-if="item.isEaLingKiln == 1 || item.number == '18'"
                      src="./images/hui.png"
                    />
                    <img v-else src="./images/ground.png" />
                    <span class="handler-number">{{
                      item.famBeNo | fambeNoFormat
                    }}</span>
                    <span class="handler-text">入窑</span>
                  </span>
                </p>
                <div
                  class="edit"
                  @click="editDia(item, 'edit', '窑')"
                  :style="{
                    color: item.isEaLingKiln == 0 ? '#157A2C' : '#BCBCBC'
                  }"
                >
                  编辑/封窑
                </div>
              </div>
            </div>
          </div>
          <div class="kiln-entry">
            <el-table
              :data="cuttingTaskTableData"
              border
              v-loading="OnekeyLoa"
              style="flex: 0.7"
            >
              <el-table-column
                label="序号"
                type="index"
                align="center"
                width="50"
              />
              <el-table-column label="高度" width="80" align="center">
                <template slot-scope="scope">
                  <span>{{ scope.row.height }}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="model"
                label="规格型号"
                width="120"
                align="center"
              >
                <template slot-scope="scope">
                  <span>{{ scope.row.length }}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="slottingType"
                align="center"
                label="附加工艺"
              >
                <template slot-scope="scope">
                  <span>{{
                    getDictValue('开槽类型', scope.row.slottingType + '')
                  }}</span>
                </template></el-table-column
              >
              <el-table-column
                prop="productName"
                align="center"
                label="产品名称"
                width="120"
              />
              <el-table-column
                prop="weight"
                align="center"
                label="等级"
                width="80"
              >
                <template slot-scope="scope">
                  <span>{{ weightObj[scope.row.weight] }}</span>
                </template>
              </el-table-column>
              <el-table-column prop="qgSum" align="center" label="切割余量" />
              <el-table-column prop="gwSum" align="center" label="排程模数" />
              <el-table-column label="排产日期" align="center" width="100">
                <template slot-scope="scope">
                  <span>{{ scope.row.issuedTime }}</span>
                </template>
              </el-table-column>
              <el-table-column label="操作" align="center" width="60">
                <template slot-scope="scope">
                  <div class="bottom-table-handle">
                    <el-button
                      size="small"
                      type="text"
                      @click="onekeyScrapFun(scope.row)"
                      >报废</el-button
                    >
                  </div>
                </template>
              </el-table-column>
            </el-table>
            <div class="handle-input">
              <div>
                <el-button type="primary" size="small" @click="handleFormGroups"
                  >小车编组</el-button
                >
              </div>
              <div v-for="item in addModelsList" :key="item.id">
                <el-input
                  v-model="item.addModel"
                  disabled
                  placeholder="入窑规格一"
                ></el-input>
                <el-input
                  v-model.number="item.addModulus"
                  oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"
                  @input="handleInputModulus(item)"
                  placeholder="请输入模数"
                ></el-input>
              </div>
            </div>
            <div class="entry" @click="handleGroupEntry">
              <span>编组进窑</span>
              <i class="el-icon-caret-right"></i>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 质检弹框 -->
    <el-dialog
      :visible.sync="qualityTestingDialog"
      width="95%"
      v-loading="ealingKilnLoading"
      element-loading-text="数据加载中..."
      element-loading-spinner="el-icon-loading"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      class="quality-testing-dialog"
    >
      <div slot="title" class="quality-test-dialog-title">
        <span v-if="isDiversion == '0'"
          >质检(釜号{{ dialogFambeNo | fambeNoFormat }})</span
        >
        <span v-if="isDiversion == '1'"
          >转道({{ dialogFambeNo | fambeNoFormat }})</span
        >
      </div>
      <el-table
        :data="qualityTestingData"
        border
        :span-method="objectSpanMethod"
      >
        <el-table-column label="车号" align="center">
          <template v-slot="scope">
            <div>{{ scope.row.vehicleNo }}</div>
          </template>
        </el-table-column>
        <el-table-column
          prop="productCode"
          label="产品编码"
          width="130"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="productName"
          label="产品名称"
          width="100"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="specification"
          label="规格型号"
          width="120"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="planId"
          label="计划号"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="total"
          label="总数量(块)"
          width="100"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="qualifiedSum"
          label="合格数量(块)"
          width="130"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="noQualifiedSum"
          label="不合格数量(块)"
          width="160"
          align="center"
        ></el-table-column>
        <el-table-column label="报废" align="center">
          <el-table-column label="数量" align="center" width="120">
            <template v-slot="scope">
              <el-input
                class="table-input"
                v-model.number="scope.row.scrapNumber"
                oninput="value = value.replace(/[^\d]+/g, '')"
                @input="numberInput(scope.row, 'scrapNumber')"
                @blur="numberInputBlur(scope.row, 'scrapNumber')"
                placeholder="输入数量"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="原因" align="center" width="120">
            <template v-slot="scope">
              <div @click="choiceReason(scope.row, 'scrapReason')">
                <div v-if="!scope.row.scrapReason" style="color: #d3d6dc">
                  选择原因
                </div>
                <div v-else>{{ scope.row.scrapReason }}</div>
              </div>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="待切补" align="center">
          <el-table-column label="数量" align="center" width="120">
            <template v-slot="scope">
              <el-input
                class="table-input"
                v-model.number="scope.row.cutRepairNumber"
                oninput="value = value.replace(/[^\d]+/g, '')"
                @input="numberInput(scope.row, 'cutRepairNumber')"
                @blur="numberInputBlur(scope.row, 'cutRepairNumber')"
                placeholder="输入数量"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="原因" align="center" width="120">
            <template v-slot="scope">
              <div @click="choiceReason(scope.row, 'cutRepairReason')">
                <div v-if="!scope.row.cutRepairReason" style="color: #d3d6dc">
                  选择原因
                </div>
                <div v-else>{{ scope.row.cutRepairReason }}</div>
              </div>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="降品/修正" align="center">
          <el-table-column label="数量" align="center" width="120">
            <template v-slot="scope">
              <el-input
                class="table-input"
                v-model.number="scope.row.correctNumber"
                oninput="value = value.replace(/[^\d]+/g, '')"
                @input="numberInput(scope.row, 'correctNumber')"
                @blur="numberInputBlur(scope.row, 'correctNumber')"
                placeholder="输入数量"
              ></el-input>
            </template>
          </el-table-column>
          <el-table-column label="原因" align="center" width="120">
            <template v-slot="scope">
              <div @click="choiceReason(scope.row, 'correctReason')">
                <div v-if="!scope.row.correctReason" style="color: #d3d6dc">
                  选择原因
                </div>
                <div v-else>{{ scope.row.correctReason }}</div>
              </div>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column width="120"> </el-table-column>
      </el-table>
      <el-table :data="qualityTestingData2" border>
        <el-table-column
          prop="productCode"
          label="产品编码"
          width=""
          align="center"
        ></el-table-column>
        <el-table-column
          prop="productName"
          label="产品名称"
          width="100"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="specification"
          label="规格型号"
          width=""
          align="center"
        ></el-table-column>

        <el-table-column
          prop="total"
          label="总数量(块)"
          width=""
          align="center"
        ></el-table-column>
        <el-table-column
          prop="qualifiedSum"
          label="合格数量(块)"
          width="130"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="noQualifiedSum"
          label="不合格数量(块)"
          width="160"
          align="center"
        ></el-table-column>
        <el-table-column label="报废" align="center">
          <el-table-column label="数量" align="center" width="120">
            <template v-slot="scope">
              <span>{{ scope.row.scrapNumber }}</span>
            </template>
          </el-table-column>
          <el-table-column label="原因" align="center" width="120">
            <template v-slot="scope">
              <span>{{ scope.row.scrapReason }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="待切补" align="center">
          <el-table-column label="数量" align="center" width="120">
            <template v-slot="scope">
              <span>{{ scope.row.cutRepairNumber }}</span>
            </template>
          </el-table-column>
          <el-table-column label="原因" align="center" width="120">
            <template v-slot="scope">
              <span>{{ scope.row.cutRepairReason }}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="降品/修正" align="center">
          <el-table-column label="数量" align="center" width="120">
            <template v-slot="scope">
              <span>{{ scope.row.correctNumber }}</span>
            </template>
          </el-table-column>
          <el-table-column label="原因" align="center" width="120">
            <template v-slot="scope">
              <span>{{ scope.row.correctReason }}</span>
            </template>
          </el-table-column>
        </el-table-column>

        <el-table-column label="入库仓库" align="center" width="120">
          <template v-slot="scope">
            <el-select v-model="scope.row.depotId">
              <el-option
                v-for="item in depotList"
                :key="item.id"
                :value="item.id"
                :label="item.name"
                @click.native="handleChangeDepot(scope.row, item)"
              ></el-option>
            </el-select>
          </template>
        </el-table-column>
      </el-table>
      <div class="dialog-btns">
        <el-button
          type="info"
          @click="handleDiversionDialog"
          v-if="isDiversion != '1'"
          >转道</el-button
        >
        <el-button
          type="info"
          @click="handleQualitySubmits('0')"
          v-loading.fullscreen.lock="fullscreenLoading"
          >暂存</el-button
        >
        <el-button
          type="primary"
          @click="handleQualitySubmits('1')"
          v-loading.fullscreen.lock="fullscreenLoading"
          >提交</el-button
        >
      </div>
      <!-- 查询可转道下拉弹窗 -->
      <el-dialog
        width="20%"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        :visible.sync="diversionDialog"
        :before-close="handleCloseDiversion"
        append-to-body
      >
        <div slot="title">转道</div>
        <div style="text-align: center; padding: 20px 0">
          <el-select v-model="selectedDiversion">
            <el-option
              v-for="item in allowDiversionList"
              :key="item.famBeNo"
              :label="item.famBeNo + '号'"
              :value="item.id"
            ></el-option>
          </el-select>
        </div>
        <div slot="footer" style="text-align: right">
          <el-button size="small" @click="handleCloseDiversion">关闭</el-button>
          <el-button size="small" @click="handleDiversion">确定</el-button>
        </div>
      </el-dialog>
      <!-- 报废原因、待切补原因、降品/修正原因弹框 -->
      <el-dialog
        width="40%"
        :close-on-click-modal="false"
        :close-on-press-escape="false"
        :visible.sync="innerVisible"
        :before-close="handleCloseTrait"
        append-to-body
      >
        <div slot="title" class="info-dialog-title">{{ reasonType }}原因</div>
        <div class="checkbox-group">
          <el-checkbox-group v-model="traitChecked">
            <el-checkbox
              v-for="item in failTraitList"
              :key="item.dictValue"
              :label="item.dictValue"
              >{{ item.dictValue }}</el-checkbox
            >
          </el-checkbox-group>
        </div>
        <div class="info-dialog-btns">
          <el-button type="info" @click="closeTraitDialog">取消</el-button>
          <el-button type="primary" @click="confirmTraitChecked"
            >确定</el-button
          >
        </div>
      </el-dialog>
    </el-dialog>

    <!-- 编辑 -->
    <el-dialog
      :title="seat + '工单'"
      :visible.sync="editVisible"
      width="80%"
      v-loading="ealingKilnLoading"
      element-loading-text="数据加载中..."
      element-loading-spinner="el-icon-loading"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      :center="true"
    >
      <el-table :data="editList" border style="width: 100%">
        <el-table-column label="模组序号" type="index" width="100px" />
        <el-table-column prop="id" label="切割工单号" />
        <el-table-column prop="productionPlanId" label="计划号" />
        <el-table-column prop="teamName" width="100" label="班组" />
        <el-table-column prop="productCode" label="产品编码" />
        <el-table-column prop="productName" width="100" label="产品名称" />
        <el-table-column prop="projectName" label="项目名称" />
        <el-table-column prop="customerName" label="客户名称" />
        <el-table-column prop="specification" label="规格型号" />
        <el-table-column prop="brSpecification" label="并入规格型号" />
        <el-table-column prop="qgSum" width="60" label="模数" />
        <el-table-column prop="enterKilnTime" label="入窑时间" />
        <el-table-column
          prop="address"
          label="操作"
          width="200px"
          v-if="editDiaType == 'edit'"
        >
          <template slot-scope="scope">
            <div>
              <span>将该模移动到</span>
              <el-select v-model="scope.row.value" placeholder="请选择">
                <el-option
                  v-for="item in getFambeNoptions"
                  :key="item.famBeNo"
                  :label="item.fambeNoSts"
                  :value="item.id"
                >
                </el-option>
              </el-select>
              <div style="display: flex">
                <el-button
                  @click="saveFambeWorkOrderFun(scope.row)"
                  size="medium"
                  type="primary"
                  >执行</el-button
                >
                <el-button
                  style="margin-left: 10px"
                  size="medium"
                  @click="revokeWorkFun(scope.row)"
                  >撤回</el-button
                >
              </div>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        @size-change="handleSizeChange2"
        @current-change="handleCurrentChange2"
        :current-page="editListPagination.currentPage"
        :page-size="editListPagination.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="editListPagination.total"
        background
      ></el-pagination>
      <span slot="footer" class="dialog-footer">
        <el-button @click="editVisible = false">关闭</el-button>
        <el-button
          v-if="isEaLingKiln != 1 && seat == '当前窑'"
          type="primary"
          @click="ealingKilnFun"
          >封窑</el-button
        >
      </span>
    </el-dialog>
    <!-- 切割任务表 -->
    <el-dialog
      title="切割任务表"
      :visible.sync="cuttingTaskTableDialog"
      v-loading="OnekeyLoa"
      width="60%"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
    >
      <el-table
        :data="getOnekeyWorkReportByPageList"
        border
        style="width: 100%"
        @selection-change="cuttingTaskTableDataSelectChange"
      >
        <el-table-column
          label="选择"
          type="selection"
          align="center"
          width="50"
        ></el-table-column>
        <el-table-column label="序号" type="index" align="center" width="50" />
        <el-table-column
          label="高度"
          prop="height"
          align="center"
          filterable
          :filters="heightFilterArr"
          :filter-method="filterHeightMethod"
        >
        </el-table-column>
        <el-table-column prop="model" label="规格型号" align="center">
          <template slot-scope="scope">
            <span>{{ scope.row.length }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="slottingType" align="center" label="附加工艺">
          <template slot-scope="scope">
            <span>{{
              getDictValue('开槽类型', scope.row.slottingType + '')
            }}</span>
          </template></el-table-column
        >
        <el-table-column
          prop="productName"
          align="center"
          label="产品名称"
          width="120"
          filterable
          :filters="materialNameFilterArr"
          :filter-method="filterMaterialNameMethod"
        />
        <el-table-column
          prop="weight"
          align="center"
          label="等级"
          width="80"
          filterable
          :filters="[
            { text: 'A', value: 1 },
            { text: 'B', value: 2 },
            { text: 'C', value: 3 }
          ]"
          :filter-method="filterWeightMethod"
        >
          <template slot-scope="scope">
            <span>{{ weightObj[scope.row.weight] }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="qgSum" align="center" label="切割余量" />
        <el-table-column prop="gwSum" align="center" label="排程模数" />
        <el-table-column label="排产日期" align="center" width="100">
          <template slot-scope="scope">
            <span>{{ scope.row.issuedTime }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="60">
          <template slot-scope="scope">
            <span class="handle_stop"
            v-if="$hasPermission('mes:oneClickWorkReporting:stop')"
            @click="handleStop(scope.row)">中止</span>
          </template>
        </el-table-column>
      </el-table>
      <div style="text-align: right; padding-top: 10px">
        <el-pagination
          layout="total, sizes, prev, pager, next, jumper"
          :current-page="cuttingTaskPagination.currentPage"
          :page-size="cuttingTaskPagination.pageSize"
          :total="cuttingTaskPagination.total"
          :page-sizes="[5, 10, 15, 20, 30]"
          @current-change="cuttingTaskCurrentChange"
          @size-change="cuttingTaskSizeChange"
        >
        </el-pagination>
      </div>
      <div style="text-align: center">
        <el-button size="small" @click="cuttingTaskTableDialog = false"
          >关闭</el-button
        >
        <el-button size="small" type="primary" @click="addCuttingTask"
          >确定</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { mapState } from 'vuex';
import * as echarts from 'echarts';

import {
  onekeyGetFambeState,
  ListEnter,
  ToOnekeyFambe,
  onekeyScrap,
  onekeyStop,
  getFambeByPage,
  saveFambeWorkOrder,
  ealingKiln,
  ToOnekeyKettle,
  getQualityDetails,
  getQualityDetails2,
  qualitySubmits,
  queryCount,
  getTeamGroup,
  enterWarehouse,
  revokeWork,
  qualityTestingTurnReach,
  qualityEnterWarehouse,
  relieveKiln
  // queryKilnXCH
} from '@/api/manufacture/spreadWorkOrder';
import dictMixins from '@/mixins/dictMixins';
import { getWarehouseList } from '@/api/mes';
export default {
  mixins: [dictMixins],
  data() {
    return {
      pageLoading: false,
      date: [],
      riqi: '',
      days: '',
      shijian: '',
      cuttingTaskMultipleSelection: [],
      cuttingTaskIds: [],
      searchForm: {},
      getFambeStateList: [],
      cuttingTaskTableDialog: false,
      cuttingTaskTableData: [],
      currentPage2: 1,
      pageSize2: 10,
      getOnekeyWorkReportByPageList: [],
      OnekeyLoa: false,
      ToOnekeyFambeItem: null,
      isEaLingKiln: '0',
      editVisible: false,
      editList: [],
      editListPagination: {
        currentPage: 1,
        pageSize: 10,
        total: 0
      },
      cuttingTaskPagination: {
        currentPage: 1,
        pageSize: 10,
        total: 0
      },
      currentFambeNo: '', // 在编辑里面分页的时候用作参数
      kilnEntryFambeNo: '', // 点击入窑按钮保存当前窑号，编组进窑时用到
      currentSeat: '',
      getFambeNoptions: [],
      value: '',
      getFambeKettleList: [],
      getFambeQualityList: [],
      getFambeChangeList: [],
      heightFilterArr: [],
      materialNameFilterArr: [],
      statisticsBtn: 'day',
      qualityTestingDialog: false, // 质检弹框显示/隐藏
      qualityTestingData: [], // 质检弹框表格数据
      qualityTestingData2: [], // 质检弹框表格2数据
      diversionDialog: false, // 可转道弹窗
      selectedDiversion: '', // 选中的转道
      allowDiversionList: [], // 可转道选项
      innerVisible: false, // 质检弹框内嵌弹框
      reasonType: '', // 内嵌弹框title类型: 报废、待切补、降品/修正
      failTraitList: [], // 质检弹框内嵌弹框报废原因列表
      traitChecked: [], // 报废原因选中项列表
      warehousingList: [], // 入库列表
      dialogFambeNo: '', // 弹窗头部釜号 famBeNo
      depotList: [], // 入库仓库数据列表
      choiceReasonRow: {}, // 选择报废原因的表格某行
      choiceReasonType: '', // 报废: scrapReason、待切补: cutRepairReason、降品/修正: correctReason
      // blockQualified、boardQualified、totalQualified、unqualified
      echartsData: {
        totalQualified: '0', // 总合格率
        blockQualified: '0', // 砌块合格率
        boardQualified: '0', // 板材合格率
        noQualifiedSum: '0' // 不合格率
      },
      weightObj: {
        1: 'A',
        2: 'B',
        3: 'C'
      },
      teamGroupData: {},
      seat: '',
      pouring: [],
      pagination: {
        pageNum: 1,
        pageSize: 10,
        total: 0
      },
      fambeLoading: false, // 入窑loading
      ealingKilnLoading: false, // 封窑loading
      fullscreenLoading: false,
      addModelsList: [],
      tempModelsList: [],
      currentIndex: -1,
      ids: [],
      editDiaType: '',
      timerId: null,
      isDiversion: '',
      dialogFambeId: ''
    };
  },
  computed: {
    ...mapState({
      info: (store) => store.user.info //用户数据
    })
  },
  filters: {
    fambeNoFormat(value) {
      let result = '';
      result = value < 10 ? '0' + value : value;
      return result;
    },
    formatYear(time) {
      let result = time && time.substr(time.indexOf('-') + 1);
      return result;
    },
    computedTimeSlot(time) {
      if (!time) {
        return 0;
      }
      let times = new Date(time).getTime();
      let nowTimes = new Date().getTime();
      let slot = nowTimes - times;
      let timeSlot = (slot / 1000 / 60 / 60).toFixed(1);
      return timeSlot;
    }
  },
  created() {
    this.requestDict('开槽类型');
    this.requestDict('不合格品原因');

    if (this.ToOnekeyFambeItem) {
      this.ToOnekeyFambeItem.famBeNo = '';
    }
    this.currentIndex = -1;
    this.apiFun();
    // this.handleList(this.searchForm);
  },
  mounted() {
    this.gettime();
    this.mewtime();
    this.getWarehousingList();
    setTimeout(() => {
      this._initEcharts();
    }, 300);
    // this.getOnekeyWorkReportByPageFun()
    this.getDateMeg('today');
    // 每三分钟刷新一次页面数据
    this.timerId = setInterval(() => {
      this.getWarehousingList();
      this._initEcharts();
      this.apiFun();
      // this.getOnekeyWorkReportByPageFun()
      this.getDateMeg('today');
    }, 180000);
  },
  methods: {
    _initEcharts() {
      var myChart = echarts.init(document.getElementById('echarts'));

      // 指定图表的配置项和数据
      var option = {
        title: {
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          // bottom: 0,
          icon: 'circle',
          orient: 'vertical',
          x: 'left',
          y: 'center',
          padding: [0, 0, 0, 45]
        },
        color: ['#3aa1ff', '#36cbcb', '#4ecb73'],
        series: [
          {
            type: 'pie',
            // stillShowZeroSum: false, // 如果数据和为 0，不显示饼图
            radius: '70%',
            center: ['60%', '50%'], // 第一个控制饼图x轴位置
            data: [
              { value: this.echartsData.boardQualified, name: '板材合格率' },
              { value: this.echartsData.blockQualified, name: '砌块合格率' },
              { value: this.echartsData.noQualifiedSum, name: '不合格率' }
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      };

      // 使用刚指定的配置项和数据显示图表。
      myChart.setOption(option);
    },
    // 封装方法：获取今天、昨天、明天
    getDay(dates) {
      var dd = new Date();
      var n = dates || 0;
      dd.setDate(dd.getDate() + n);
      var y = dd.getFullYear();
      var m = dd.getMonth() + 1;
      var d = dd.getDate();
      m = m < 10 ? '0' + m : m;
      d = d < 10 ? '0' + d : d;
      var day = y + '-' + m + '-' + d;
      return day;
    },
    // 封装方法：获取本周起始日期
    getMonday(val) {
      let date = new Date(val);
      let new_year = date.getFullYear(); // 取当前的年份
      let month = date.getMonth();
      let new_month = month + 1; // 取当前的月份
      let mon = '';
      let day = '';
      if (month > 12) {
        new_month -= 12; // 月份减
        new_year++; // 年份增
      }
      let firstDay = new Date(new_year, new_month, 1); // 取当年当月中的第一天
      let lastDay = new Date(
        firstDay.getTime() - 1000 * 60 * 60 * 24
      ).getDate(); // 获取当月最后一天日期
      if (firstDay.getMonth() < 10) {
        mon = '0' + firstDay.getMonth();
      } else {
        mon = firstDay.getMonth();
      }
      if (lastDay < 10) {
        day = '0' + lastDay;
      } else {
        day = lastDay;
      }
      let startDate =
        firstDay.getFullYear() + '-' + mon + '-' + '0' + firstDay.getDate();
      let endDate = firstDay.getFullYear() + '-' + mon + '-' + day;
      let dateRange = [startDate, endDate];
      return dateRange;
    },
    //封装方法：获取本月、上月、下月的起始、结束日期
    getDate(type, dates) {
      var now = new Date();
      var nowTime = now.getTime();
      var day = now.getDay();
      var longTime = 24 * 60 * 60 * 1000;
      var n = longTime * 7 * (dates || 0);
      if (type == 's') {
        var dd = nowTime - (day - 1) * longTime + n;
      }
      if (type == 'e') {
        var dd = nowTime + (7 - day) * longTime + n;
      }
      dd = new Date(dd);
      var y = dd.getFullYear();
      var m = dd.getMonth() + 1;
      var d = dd.getDate();
      m = m < 10 ? '0' + m : m;
      d = d < 10 ? '0' + d : d;
      var day = y + '-' + m + '-' + d;
      return day;
    },

    // 获取今天(today)、昨天(yestoday)的数据 getTeamGroup
    async getDateMeg(type) {
      return;
      let artisanTime = '';
      if (type === 'today') {
        artisanTime = this.getDay(0);
      } else if (type === 'yestoday') {
        artisanTime = this.getDay(-1);
      }
      // console.log(artisanTime)
      const res = await getTeamGroup({ artisanTime });
      // console.log('今天/明天：', res.data)
      if (res.data.code === 200) {
        this.teamGroupData = res.data.data;
      } else this.teamGroupData = [];
      // const pouringRes = await getPouring({ artisanTime });
      // console.log('浇注：', pouringRes)
      if (res.data.code === 200) {
        this.pouring = res.data.data.cutting;
      }
    },
    // 获取质检统计数据 - statisticsBtn 默认传当天班次 artisanTime，startTime，endTime
    async getWarehousingList(type = 'day') {
      const res = await queryCount(type);
      if (res.data.code == 0) {
        this.echartsData = {
          totalQualified: res.data.data.TOTALGEL, // 总合格率
          blockQualified: res.data.data.QKHGL, // 砌块合格率
          boardQualified: res.data.data.BCHGL, // 板材合格率
          noQualifiedSum: res.data.data.NOHGL, // 不合格率
          boardQualiNum: res.data.data.BCTOTAL, // 板材生产总量
          boardQualifiedNum: res.data.data.BCQUALIFIED, // 板材合格总量
          blockQualiNum: res.data.data.QKTOTAL, // 砌块生产总量
          blockQualifiedNum: res.data.data.QKQUALIFIED // 砌块合格总量
        };
        this._initEcharts();

        // this.warehousingList = res.data.data.list.records;
        // this.pagination.total = res.data.data.list.records.length;
      } else {
        this.warehousingList = [];
      }
    },
    // 查询转道号
    async getFambeChange() {
      let res = await onekeyGetFambeState({ type: 4 });
      this.getFambeChangeList = res.data.data.sort(this.aaa('famBeNo'));
    },
    // 质检统计按钮变化
    statisticsChange(val) {
      this.getWarehousingList(val);
    },
    // 筛选等级
    filterWeightMethod(value, row, column) {
      const property = column['property'];
      return row[property] === value;
    },
    // 筛选高度
    filterHeightMethod(value, row, column) {
      const height = row.model.split('*')[2];
      return height === value;
    },
    // 筛选产品名称
    filterMaterialNameMethod(value, row, column) {
      const property = column['property'];
      return row[property] === value;
    },

    // 质检统计表格分页器
    handleCurrentChange(page) {
      this.pagination.pageNum = page;
      this.getWarehousingList(this.statisticsBtn);
    },
    handleSizeChange(size) {
      this.pagination.pageSize = size;
      this.pagination.pageNum = 1;
      this.getWarehousingList(this.statisticsBtn);
    },

    // 日期自定义范围改变
    async datePickerChange(val) {
      let query = {
        startTime: val[0],
        endTime: val[1],
        pageNum: this.pagination.pageNum,
        pageSize: this.pagination.pageSize
      };
      const res = await getWarehousingList(query);
      // console.log(res)
    },
    // 质检弹框业务逻辑
    async qualityTesting(item, type) {
      console.log(item, 'item');
      console.log(type, 'item');
      // 质检
      if (item.number == 0 && item.startTime == null && type == '0') return;
      // 转道
      if (item.number == 0 && type == '1') return;
      this.isDiversion = type;
      try {
        this.qualityTestingDialog = true;
        this.ealingKilnLoading = true;
        this.dialogFambeNo = item.famBeNo;
        this.dialogFambeId = item.id;

        const res = await getQualityDetails(item.id);

        if (res.data.code == 0) {
          if (res.data.data.length > 0) {
            this.qualityTestingData = res.data.data;

            // 将数量参数类型全部改成Number类型
            this.qualityTestingData.map((item) => {
              // 入库仓库
              // if (item.productName.includes('板材')) {
              //   item.depotId = '55'
              //   item.depotName = '室内堆场'
              // } else if (item.productName.includes('砌块')) {
              //   item.depotId = '56'
              //   item.depotName = '室外堆场'
              // }
              // 总数量
              item.total = item.total ? Number(item.total) : 0;
              // 合格数量
              item.qualifiedSum = item.qualifiedSum
                ? Number(item.qualifiedSum)
                : item.total;
              // 不合格数量
              item.noQualifiedSum = item.noQualifiedSum
                ? Number(item.noQualifiedSum)
                : 0;
              // 报废数量
              item.scrapNumber = item.scrapNumber
                ? Number(item.scrapNumber)
                : 0;
              // 待切补数量
              item.cutRepairNumber = item.cutRepairNumber
                ? Number(item.cutRepairNumber)
                : 0;
              // 降品/修正数量
              item.correctNumber = item.correctNumber
                ? Number(item.correctNumber)
                : 0;
            });

            // console.log('qualityTestingData:', this.qualityTestingData);
          } else {
            this.qualityTestingData = [];
          }
        } else {
          this.qualityTestingData = [];
        }

        // 获取弹窗入库仓库下拉数据列表
        const res2 = await getWarehouseList();
        // console.log('入库仓库下拉数据列表:', res2.data.data)
        // if (res2.code == 0) {
        this.depotList = res2;
        // 获取质检弹窗表格2数据
        const res3 = await getQualityDetails2(item.id);
        if (res.data.code == 0) {
          this.qualityTestingData2 = res3.data.data;
        }
        this.ealingKilnLoading = false;
      } catch (error) {
        this.ealingKilnLoading = false;
      }
    },

    // 选择入库仓库 row: 表格一行，item：仓库一项的值
    handleChangeDepot(row, data) {
      row.depotName = data.name;
    },

    // 获取报废、待切补、降品/修正原因
    // 报废: scrapReason、待切补: cutRepairReason、降品/修正: correctReason
    choiceReason(row, reason) {
      this.choiceReasonRow = row;
      this.choiceReasonType = reason;
      switch (reason) {
        case 'scrapReason':
          this.reasonType = '报废';
          break;
        case 'cutRepairReason':
          this.reasonType = '待切补';
          break;
        case 'correctReason':
          this.reasonType = '降品/修正';
          break;

        default:
          break;
      }

      // 点击选择原因就打开原因多选弹框，并请求接口渲染多选框数据
      this.innerVisible = true;

      this.requestDict('不合格品原因').then((res) => {
        this.failTraitList = res;
        if (row[reason]) {
          this.traitChecked = row[reason].split(',');
        }
      });
    },
    // 报废原因弹框关闭回调
    handleCloseTrait(done) {
      this.traitChecked = [];
      done();
    },
    handleClose() {},
    // 关闭报废原因弹框
    closeTraitDialog() {
      this.innerVisible = false;
      this.traitChecked = [];
    },
    // 确认选择报废原因 - 添加到质检弹框表格原因列
    confirmTraitChecked() {
      // 报废: scrapReason、待切补: cutRepairReason、降品/修正: correctR
      this.qualityTestingData.forEach((item) => {
        if (item.id == this.choiceReasonRow.id) {
          this.choiceReasonRow[this.choiceReasonType] =
            this.traitChecked.toString();
        }
      });
      this.qualityTestingData2.forEach((item) => {
        let text = [];
        this.qualityTestingData.forEach((val) => {
          if (item.productCode == val.productCode) {
            if (val[this.choiceReasonType]) {
              text.push(...val[this.choiceReasonType].split(','));
            }
          }
        });
        if (text.length > 0) {
          console.log(text);
          item[this.choiceReasonType] = [...new Set(text)].toString();
        }
      });

      this.traitChecked = [];
      this.innerVisible = false;
    },
    // 出釜
    async ToOnekeyQualityFun(item) {
      console.log(item, 'dsds');
      // if (!this.permission.oneClickWorkReporting_OutCauldron) return;
      if (item.endTime != null || item.number2 == '0') return;
      this.$confirm('请仔细核对窑内数据是否满足出釜条件,确认出釜吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(async () => {
          this.fullscreenLoading = true;
          try {
            await ToOnekeyKettle({
              famBeNo: item.famBeNo,
              type: 2,
              famBeId: item.id
            });
            await relieveKiln({ famBeId: item.famBeNo });
            this.$message.success('出釜成功');

            await this.apiFun();

            this.getDateMeg('today');
            this.getWarehousingList('day');
            this.fullscreenLoading = false;
          } catch (error) {
            this.fullscreenLoading = false;
          }
        })
        .catch(() => {});
    },
    // 入釜
    async ToOnekeyKettleFun(item) {
      if (item.isEaLingKiln == 1 && item.number <= 0 && item.number2 > 0) {
        let text;
        if (item.number2 == 18) {
          text = '窑内已满模,确认入釜操作吗';
        } else {
          text = '窑内不满模,确认入釜操作吗';
        }
        this.$confirm(text, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(async () => {
            this.fullscreenLoading = true;
            try {
              await ToOnekeyKettle({
                famBeNo: item.famBeNo,
                type: 1,
                famBeId: item.id
              });
              await relieveKiln({ famBeId: item.famBeNo });
              this.$message.success('入釜成功');
              await this.apiFun();
              // await this.handleList(this.searchForm);

              for (let i = 0; i < this.getFambeKettleList.length; i++) {
                // 在点了入釜操作之后，将窑里的板块和砌块字段丢到釜里
                for (let j = 0; j < this.getFambeStateList.length; j++) {
                  if (
                    this.getFambeKettleList[i].famBeNo ===
                    this.getFambeStateList[j].famBeNo
                  ) {
                    this.getFambeKettleList[i].board =
                      this.getFambeStateList[j].board;
                    this.getFambeKettleList[i].block =
                      this.getFambeStateList[j].block;
                  }
                }
              }
              this.getDateMeg('today');
              this.getWarehousingList('day');
              this.fullscreenLoading = false;
            } catch (error) {
              this.fullscreenLoading = false;
            }
          })
          .catch(() => {});
      }
    },
    // 获取出釜数据 getFambeKettleList
    async getFambeKettleFun() {
      let res = await onekeyGetFambeState({ type: 2 });
      this.getFambeKettleList = res.data.data.sort(this.aaa('famBeNo'));

      // let res2 = await getAutoclaveBITwo();
      // console.log('获取釜压力值：', res2)
      // if (res2.data.code === 200) {
      //   for (let i = 0; i < this.getFambeKettleList.length; i++) {
      //     let item1 = this.getFambeKettleList[i];
      //     for (let j = 0; j < res2.data.data.length; j++) {
      //       let item2 = res2.data.data[j];
      //       const reg = new RegExp(`[\s\S]*釜${item1.famBeNo}$`);
      //       if (item2.position && reg.test(item2.position)) {
      //         this.getFambeKettleList[i].pressure = item2.pressure;
      //         this.getFambeKettleList[i].tem = item2.tem;
      //         break;
      //       }
      //     }
      //   }
      // }

      this.getFambeKettleList.map((item) => {
        this.getFambeStateList.map((c) => {
          if (item.famBeNo == c.famBeNo) {
            item.number2 = c.number;
            item.isEaLingKiln = c.isEaLingKiln;
          }
        });
      });
      console.log('出釜数据: ', this.getFambeKettleList);
    },

    // 获取质检数据 getFambeQualityList
    async getFambeQualityFun() {
      let res = await onekeyGetFambeState({ type: 3 });
      this.getFambeQualityList = res.data.data.sort(this.aaa('famBeNo'));
      this.getFambeQualityList.map((item) => {
        this.getFambeKettleList.map((c) => {
          if (item.famBeNo === c.famBeNo) {
            item.number2 = c.number;
          }
        });
      });
      console.log('质检数据: ', this.getFambeQualityList);
    },

    async apiFun() {
      // this.pageLoading = true
      await this.onekeyGetFambeStateFun();
      await this.getFambeKettleFun();
      await this.getFambeQualityFun();
      await this.getFambeChange();
      // this.pageLoading = false
    },

    async saveFambeWorkOrderFun(item) {
      if (!item.value) {
        this.$message.warning('请选择窑号');

        return;
      }
      let obj = {
        famBeId: item.value,
        tid: item.id
      };
      const data = await saveFambeWorkOrder(obj);
      if (data.data.code == 0) {
        this.editVisible = false;
        this.$message({
          type: 'success',
          message: '转道成功!'
        });
        const res = await getFambeByPage({ id: item.value });
        this.ealingKilnLoading = false;
        this.editList = res.data.data;
        this.editListPagination.total = res.data.data.total;
        await this.apiFun();
      }
    },
    //撤回
    revokeWorkFun(row) {
      this.$confirm('确认要撤回这条数据吗, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(async () => {
          await revokeWork({
            tid: row.id
          });
          await this.apiFun();
          this.editVisible = false;
          // 编组进窑成功后重新刷新底部表格数据，并将编组的小车数据重新赋值
          let ids = this.cuttingTaskTableData.map((item) => item.id);
          // 调新接口刷新页面下面表格数据
          await this._getCuttingTaskData(ids);
          this.$message({
            type: 'success',
            message: '撤回成功!'
          });
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消撤回'
          });
        });
    },

    async getFambeNoFun(id) {
      let res = await onekeyGetFambeState({ type: 1 });

      this.getFambeNoptions = res.data.data.filter(
        (item) => item.id != id && item.isEaLingKiln != 1
      );
      this.getFambeNoptions.forEach((e) => {
        e.fambeNoSts = e.famBeNo + '号窑';
      });
    },
    // 封窑
    async ealingKilnFun() {
      if (this.editList.length == 0) {
        this.$message.warning('没有数据，不能操作封窑。');
        return;
      }
      this.$confirm('确认是否封窑吗？', '提示', {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(async () => {
          try {
            this.ealingKilnLoading = true;
            const ealingKilnRes = await ealingKiln({
              famBeId: this.ToOnekeyFambeItem.famBeNo
            });
            console.log('封窑结果：', ealingKilnRes.data);
            this.$message.success('封窑成功');
            this.editVisible = false;
            this.currentIndex = -1;
            await this.apiFun();
            this.ealingKilnLoading = false;
          } catch (error) {
            this.ealingKilnLoading = false;
          }
        })
        .catch(() => {});
    },

    // 封装获取窑、釜、检工单列表数据
    async _getEditList(id, seat) {
      this.ealingKilnLoading = true;
      let obj = {
        id
      };
      try {
        const res = await getFambeByPage(obj);
        this.ealingKilnLoading = false;
        this.editList = res.data.data;
        console.log(res, ' this.editList');
        this.editListPagination.total = res.data.data.total;
      } catch (error) {
        this.ealingKilnLoading = false;
      }
    },
    async editDia(item, type, seat) {
      // console.log(type);
      if (item.isEaLingKiln == 1 && type == 'edit') return;
      if (Number(item.number) > 0) {
        switch (seat) {
          case '窑':
            this.seat = '当前窑';
            break;
          case '釜':
            this.seat = '当前釜';
            break;
          case '检':
            this.seat = '当前质检';
            break;
          default:
            break;
        }
        this.editDiaType = type;
        // 保存起来在分页的时候传递
        console.log(item, 'item');
        this.currentFambeNo = item.famBeNo;
        this.currentSeat = seat;
        this.editVisible = true;
        (this.editListPagination.currentPage = 1),
          (this.editListPagination.pageSize = 10),
          this._getEditList(item.id, seat);
        this.getFambeNoFun(item.id);
        // 执行和封窑要用到fambeNo
        this.ToOnekeyFambeItem = item;
        this.isEaLingKiln = this.getFambeStateList.find(
          (val) => val.famBeNo == item.famBeNo
        ).isEaLingKiln;
      }
    },
    // 报废
    onekeyScrapFun(item) {
      this.$confirm('确认报废这条数据吗, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(async () => {
          await onekeyScrap({
            tid: item.id,
            cuttingWork: item.productName.includes('板材') ? '1' : '2'
          });
          // 编组进窑成功后重新刷新底部表格数据，并将编组的小车数据重新赋值
          let ids = this.cuttingTaskTableData.map((item) => item.id);
          // 调新接口刷新页面下面表格数据
          await this._getCuttingTaskData(ids);
          this.$message({
            type: 'success',
            message: '报废成功!'
          });
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消报废'
          });
        });
    },
    // 切割任务表 - 终止
    handleStop(row) {
      this.$confirm('确认终止这条切割任务吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(async () => {
          await onekeyScrap({
            tid: row.id,
            cuttingWork: row.productName.includes('板材') ? '1' : '2'
          });
        // 编组进窑成功后重新刷新底部表格数据，并将编组的小车数据重新赋值
        let ids = this.cuttingTaskTableData.map((item) => item.id);
          // 调新接口刷新页面下面表格数据
          await this._getCuttingTaskData(ids);
          this.getOnekeyWorkReportByPageFun();
        })
        .catch(() => {});
    },
    handleCurrentChange2(currentPage) {
      this.editListPagination.currentPage = currentPage;
      this._getEditList(this.currentFambeNo, this.currentSeat);
    },
    handleSizeChange2(pageSize) {
      this.editListPagination.pageSize = pageSize;
      this.editListPagination.currentPage = 1;
      this._getEditList(this.currentFambeNo, this.currentSeat);
    },
    // 小车编组按钮 - 打开切割任务表并请求数据
    handleFormGroups() {
      this.cuttingTaskTableDialog = true;
      this.$nextTick(() => {
        this.getOnekeyWorkReportByPageFun();
      });
    },

    // 获取切割任务表数据
    async getOnekeyWorkReportByPageFun() {
      this.OnekeyLoa = true;
      this.heightFilterArr = [];
      this.materialNameFilterArr = [];
      const res = await ListEnter({
        pageNum: this.cuttingTaskPagination.currentPage,
        pageSize: this.cuttingTaskPagination.pageSize,
        listStatus: [3]
      });
      // console.log(res);
      this.getOnekeyWorkReportByPageList = res.data.data.list;
      this.OnekeyLoa = false;
      this.cuttingTaskPagination.total = res.data.data.count;
    },

    // 切割任务表分页器方法
    cuttingTaskCurrentChange(page) {
      this.cuttingTaskPagination.currentPage = page;
      this.getOnekeyWorkReportByPageFun();
    },
    cuttingTaskSizeChange(size) {
      this.cuttingTaskPagination.currentPage = 1;
      this.cuttingTaskPagination.pageSize = size;
      this.getOnekeyWorkReportByPageFun();
    },

    // 切割任务表多选
    cuttingTaskTableDataSelectChange(val) {
      console.log(val);
      this.cuttingTaskMultipleSelection = val;
      this.cuttingTaskIds = val.map((item) => item.id);
    },

    // 切割任务表弹窗确定添加逻辑
    async addCuttingTask() {
      if (this.cuttingTaskMultipleSelection.length == 0) {
        return this.$message.warning('请选择要添加的任务！');
      } else if (this.cuttingTaskMultipleSelection.length > 3) {
        return this.$message.warning('最多只能选择3条任务！');
      }
      await this._getCuttingTaskData(this.cuttingTaskIds);
      this.cuttingTaskTableDialog = false;
    },

    // 封装获取页面底部编组表格数据
    async _getCuttingTaskData(ids) {
      const res = await ListEnter({
        listStatus: [3]
      });
      let list = res.data.data.list;
      if (list) {
        this.cuttingTaskTableData = list.filter(
          (item) => item.qgSum > 0 && ids.includes(item.id)
        );
        // 页面底部右边的小车编组框回显规格
        this.addModelsList = [];
        this.cuttingTaskTableData.map((item) => {
          this.addModelsList.push({
            id: item.id,
            addModulus: null,
            addModel: item.productName.includes('砌块')
              ? item.model
              : item.length,
            cuttingMargin: Number(item.qgSum)
          });
        });
      } else {
        this.cuttingTaskTableData = [];
      }
    },

    /**
     * @param {*} item
     * addModel: "313+238" 规格
     * addModulus: 3 输入的模数
     * cuttingMargin: 20 切割余量
     * id: "1603218014371639297" 编组进窑时要传递的id
     */
    handleInputModulus(item) {
      // console.log(item);
      // console.log(this.addModelsList);
      if (item.addModulus > item.cuttingMargin) {
        item.addModulus = null;
        return this.$alert('模数不能大于切割余量！');
      }
      let modulusSums = 0;
      // debugger
      for (let i = 0; i < this.addModelsList.length; i++) {
        modulusSums += Number(this.addModelsList[i].addModulus);
        if (modulusSums > 3) {
          item.addModulus = null;
          return this.$alert('小车编组总模数不能大于3！');
        }
      }
    },
    // 编组进窑按钮操作
    async handleGroupEntry() {
      // console.log('famBeNo:', this.kilnEntryFambeNo)
      if (!this.kilnEntryFambeNo) {
        return this.$alert('请选择窑号！');
      }

      let obj = {
        taskList: [],
        famBeId: this.kilnEntryFambeNo
      };
      this.addModelsList.map((item) => {
        // 没有输入模数数量的就不传 id 和 数量

        if (item.addModulus > 0) {
          obj.taskList.push({
            tid: item.id,
            moCount: item.addModulus
          });
        }
      });
      if (obj.taskList.length == 0) {
        return this.$alert('请选择至少一条数据和模数！');
      }

      // 判断addModelsObj里addModulus(输入的模数)是否＞cuttingMargin(切割余量)
      let flag = false;
      for (let i = 0; i < this.cuttingTaskTableData.length; i++) {
        for (let j = 0; j < this.addModelsList.length; j++) {
          if (
            this.addModelsList[j].addModulus >
            Number(this.cuttingTaskTableData[i].qgSum)
          ) {
            flag = true;
            break;
          }
        }
      }
      if (flag) {
        return this.$alert('报工模数不能大于切割余量！');
      }

      this.tempModelsList = this.addModelsList;
      try {
        this.pageLoading = true;
        await ToOnekeyFambe(obj);
        this.fambeLoading = false;
        await this.apiFun();
        // 编组进窑成功后重新刷新底部表格数据，并将编组的小车数据重新赋值
        let ids = this.cuttingTaskTableData.map((item) => item.id);
        await this._getCuttingTaskData(ids);
        // 把编组进窑前输入的模数重新回显到输入框
        for (let i = 0; i < this.tempModelsList.length; i++) {
          for (let j = 0; j < this.addModelsList.length; j++) {
            if (this.tempModelsList[i].id === this.addModelsList[j].id) {
              this.addModelsList[j].addModulus =
                this.tempModelsList[i].addModulus;
              break;
            }
          }
        }
        this.pageLoading = false;
        this.$message.success('入窑成功');
        // 如果编组完之后满窑
        for (let i = 0; i < this.getFambeStateList.length; i++) {
          if (
            this.getFambeStateList[i].famBeNo == this.kilnEntryFambeNo &&
            this.getFambeStateList[i].number == '18'
          ) {
            this.currentIndex = -1;
            this.kilnEntryFambeNo = '';
            break;
          }
        }
      } catch (error) {
        this.fambeLoading = false;
        this.pageLoading = false;
      }
    },
    // 入窑
    async kilnEntry(item, index) {
      // if (!this.permission.oneClickWorkReporting_kilnEntry) return;
      if (
        item.isEaLingKiln == 1 ||
        item.number == '18' ||
        item.famBeNo == this.kilnEntryFambeNo
      )
        return;
      this.$confirm(`确认切换到${item.famBeNo}号窑吗？`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          this.kilnEntryFambeNo = item.famBeNo;
          this.currentIndex = index;
        })
        .catch(() => {});
    },

    aaa(prop) {
      return function (obj1, obj2) {
        var val1 = obj1[prop];
        var val2 = obj2[prop];
        if (!isNaN(Number(val1)) && !isNaN(Number(val2))) {
          val1 = Number(val1);
          val2 = Number(val2);
        }
        if (val1 > val2) {
          return -1;
        } else if (val1 < val2) {
          return 1;
        } else {
          return 0;
        }
      };
    },
    // 获取入窑数据 getFambeStateList
    async onekeyGetFambeStateFun() {
      let res = await onekeyGetFambeState({ type: 1 });
      this.getFambeStateList = res.data.data.sort(this.aaa('famBeNo'));
      // const getFambeStateList = JSON.parse(
      //   window.localStorage.getItem('getFambeStateList')
      // );
      // const res2 = await getThermometerBITwo();
      // console.log('获取窑温度和湿度：', res2)
      // if (res2.data.code === 200) {
      //   for (let i = 0; i < this.getFambeStateList.length; i++) {
      //     let item = this.getFambeStateList[i];
      //     for (let j = 0; j < res2.data.data.length; j++) {
      //       let item2 = res2.data.data[j];
      //       if (
      //         item2.position &&
      //         item2.position.includes(`窑${item.famBeNo}`)
      //       ) {
      //         this.getFambeStateList[i].tem = item2.tem;
      //         this.getFambeStateList[i].hum = item2.hum;
      //         break;
      //       }
      //     }
      //   }
      // }

      // if (getFambeStateList) {
      //   this.getFambeStateList.map((item) => {
      //     getFambeStateList.map((c) => {
      //       if (item.famBeNo === c.famBeNo) {
      //         item.board = c.board
      //         item.block = c.block
      //       }
      //     })
      //   })
      // }
      console.log('入窑数据:', this.getFambeStateList);
    },
    mewtime() {
      setInterval(() => {
        this.gettime();
      }, 1000);
    },
    gettime() {
      var date = new Date();
      let year = date.getFullYear();
      let mou = date.getMonth() + 1;
      let day = date.getDate();
      let days = date.getDay();
      switch (days) {
        case 1:
          days = '星期一';
          break;
        case 2:
          days = '星期二';
          break;
        case 3:
          days = '星期三';
          break;
        case 4:
          days = '星期四';
          break;
        case 5:
          days = '星期五';
          break;
        case 6:
          days = '星期六';
          break;
        case 0:
          days = '星期日';
          break;
      }
      let hou = date.getHours(); //获取当前小时数(0-23)
      let min = date.getMinutes(); //获取当前分钟数(0-59)
      let sec = date.getSeconds(); //获取当前秒数(0-59)
      if (mou < 10) mou = '0' + mou;
      if (day < 10) day = '0' + day;
      if (hou < 10) hou = '0' + hou;
      if (min < 10) min = '0' + min;
      if (sec < 10) sec = '0' + sec;
      this.riqi = year + '/' + mou + '/' + day;
      this.days = days;
      this.shijian = hou + ':' + min + ':' + sec;
    },

    // 总数量: total，合格数量: qualified，不合格数量: noQualifiedSum
    // 报废数量、待切补、降品/修正输入框输入事件
    totalNumber(productCode) {
      let scrapNumber = 0,
        cutRepairNumber = 0,
        correctNumber = 0;
      this.qualityTestingData.forEach((item) => {
        if (item.productCode == productCode) {
          scrapNumber += item.scrapNumber;
          cutRepairNumber += item.cutRepairNumber;
          correctNumber += item.correctNumber;
        }
      });
      this.qualityTestingData2.forEach((item) => {
        if (item.productCode == productCode) {
          item.scrapNumber = Number(scrapNumber);
          item.cutRepairNumber = Number(cutRepairNumber);
          item.correctNumber = Number(correctNumber);
          item.noQualifiedSum =
            Number(scrapNumber) +
            Number(cutRepairNumber) +
            Number(correctNumber);
          item.qualifiedSum = Number(item.total) - Number(item.noQualifiedSum);
        }
      });
    },
    numberInput(row, type) {
      let noQualifiedSum =
        Number(row.scrapNumber) +
        Number(row.cutRepairNumber) +
        Number(row.correctNumber);
      if (noQualifiedSum > row.total) {
        row[type] = 0;
        noQualifiedSum = 0;
        this.$alert('不合格数量不能大于总数量！');
        // return;
      }
      row.noQualifiedSum = noQualifiedSum;
      row.qualifiedSum = Number(row.total) - Number(row.noQualifiedSum);
      this.totalNumber(row.productCode);
    },

    mergeCol(id, rowIndex) {
      // 合并单元格
      // id：属性名
      // rowIndex：行索引值
      var idName = this.qualityTestingData[rowIndex][id]; // 获取当前单元格的值
      if (rowIndex > 0) {
        // 判断是不是第一行
        // eslint-disable-next-line eqeqeq
        if (
          this.qualityTestingData[rowIndex][id] !=
          this.qualityTestingData[rowIndex - 1][id]
        ) {
          // 先判断当前单元格的值是不是和上一行的值相等
          var i = rowIndex;
          var num = 0; // 定义一个变量i，用于记录行索引值并进行循环，num用于计数
          while (i < this.qualityTestingData.length) {
            // 当索引值小于table的数组长度时，循环执行
            if (this.qualityTestingData[i][id] === idName) {
              // 判断循环的单元格的值是不是和当前行的值相等
              i++; // 如果相等，则索引值加1
              num++; // 合并的num计数加1
            } else {
              i = this.qualityTestingData.length; // 如果不相等，将索引值设置为table的数组长度，跳出循环
            }
          }
          return {
            rowspan: num, // 最终将合并的行数返回
            colspan: 1
          };
        } else {
          return {
            rowspan: 0, // 如果相等，则将rowspan设置为0
            colspan: 1
          };
        }
      } else {
        // 如果是第一行，则直接返回
        let i = rowIndex;
        let num = 0;
        while (i < this.qualityTestingData.length) {
          // 当索引值小于table的数组长度时，循环执行
          if (this.qualityTestingData[i][id] === idName) {
            i++;
            num++;
          } else {
            i = this.qualityTestingData.length;
          }
        }
        return {
          rowspan: num,
          colspan: 1
        };
      }
    },

    // 质检弹窗合并序号列
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      switch (columnIndex) {
        case 0:
          return this.mergeCol('vehicleNo', rowIndex);
          break;

        default:
          break;
      }
    },

    // 数量输入框失去焦点 - 如果输入框内没有输入数字，就让它默认为 0
    numberInputBlur(row, type) {
      // scrapNumber、cutRepairNumber、correctNumber
      for (let i = 0; i < this.qualityTestingData.length; i++) {
        let item = this.qualityTestingData[i];
        if (item.id === row.id) {
          this.qualityTestingData[i][type] = item[type]
            ? Number(item[type])
            : 0;
        }
      }
    },
    // 打开可转的道弹窗
    handleDiversionDialog() {
      this.diversionDialog = true;
      onekeyGetFambeState({ type: 4 })
        .then((res) => {
          if (res.data.code == 0) {
            this.allowDiversionList = res.data.data.filter(
              (item) => item.number == 0
            );
          } else {
            this.allowDiversionList = [];
          }
        })
        .catch(() => {});
    },
    // 关闭可转道弹窗
    handleCloseDiversion() {
      this.diversionDialog = false;
    },
    // 转道
    handleDiversion() {
      if (!this.selectedDiversion) {
        this.$message.warning('请选择窑号');

        return;
      }
      this._handleQualitySubmits(
        {
          famBeId: this.selectedDiversion,
          tid: this.dialogFambeId
        },
        2
      );
    },

    // 质检弹窗 - 暂存/提交
    handleQualitySubmits(type, isInit) {
      if (this.qualityTestingData.length === 0) {
        this.$message.warning('无数据，不能操作。');
        return;
      }
      // 判断如果输入了数量就校验原因是否选择
      for (let i = 0; i < this.qualityTestingData.length; i++) {
        let item = this.qualityTestingData[i];
        console.log(item);
        if (Number(item.correctNumber) > 0 && !item.correctReason) {
          return this.$message.warning('请选择降品/修正原因');
        }
        if (Number(item.cutRepairNumber) > 0 && !item.cutRepairReason) {
          return this.$message.warning('请选择待切补原因');
        }
        if (Number(item.scrapNumber) > 0 && !item.scrapReason) {
          return this.$message.warning('请选择报废原因');
        }
      }

      var list = [];
      if (type == '0') {
        list = JSON.parse(JSON.stringify(this.qualityTestingData));
        this._handleQualitySubmits(
          list.map((item) => {
            item.famBeNo = this.dialogFambeId;
            if (isInit) {
              item.id = '';
            }
            return item;
          }),
          type,
          isInit
        );
      } else {
        let isDepotId = true;
        this.qualityTestingData2.forEach((item) => {
          if (!item.depotId) {
            isDepotId = false;
          }
        });
        if (!isDepotId) {
          return this.$message.warning('请选择入库仓库');
        }
        this.$confirm('确认提交质检数据吗？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        })
          .then(() => {
            list = JSON.parse(JSON.stringify(this.qualityTestingData2));
            list.forEach((item) => {
              item.list = this.qualityTestingData.filter(
                (val) => val.productCode == item.productCode
              );
            });

            this._handleQualitySubmits(list, type, isInit);
          })
          .catch(() => {});
      }
      // console.log(list);
    },
    // 封装提交暂存方法
    async _handleQualitySubmits(data, type, isInit) {
      let typeName = type == '0' ? '暂存' : type == '1' ? '提交' : '转道';
      try {
        this.fullscreenLoading = true;
        if (type == 1) {
          await qualityEnterWarehouse(data);
          await enterWarehouse({
            famBeId: this.dialogFambeId
          });
        } else if (type == 2) {
          await qualityTestingTurnReach(data);
        } else {
          await qualitySubmits(data);
        }
        this.qualityTestingDialog = false;
        this.diversionDialog = false;
        this.fullscreenLoading = false;
        this.apiFun();
        // 质检完成刷新入库列表
        await this.getWarehousingList('day');
        // await this.handleList(this.searchForm);
        await this.getDateMeg('today');
        this.$message.success(`${typeName}成功！`);
      } catch (error) {
        this.fullscreenLoading = false;
      }
    }
  },
  beforeDestroy() {
    clearInterval(this.timerId);
  }
};
</script>

<style lang="scss" scoped>
:deep(.el-button--medium) {
  padding: 10px 20px !important;
  font-size: 14px !important;
  border-radius: 4px !important;
}
#echarts {
  margin-left: -50px;
}
.quality-test-dialog-title {
  font-size: 18px;
  font-weight: 700;
}
.dialog-btns {
  text-align: center;
  margin-top: 30px;
  :deep(.el-button) {
    padding: 10px 40px;
  }
  :deep(.el-button--primary) {
    background-color: #157a2c;
    border-color: #157a2c;
  }
}
.disTab {
  span {
    width: 96px;
    height: 30px;
    display: inline-block;
    border: 1px solid #eee;
    text-align: center;
    line-height: 30px;
  }
  .disTabActive {
    background: #157a2c;
    color: #fff;
  }
}
.handler-diversion {
  color: #fff;
  line-height: 50px;
  height: 50px;
  text-align: center;
  width: 80px;
  > .fambe-no {
    font-size: 20px;
    font-weight: 700;
  }
}
.imgBox {
  position: relative;
  cursor: pointer;
  img {
    position: absolute;
    top: 4px;
    left: 0;
    width: 80px;
    height: 50px;
  }
  .handler-number {
    color: #fff;
    position: absolute;
    right: 36px;
    bottom: -3px;
    font-size: 20px;
  }
  .handler-text {
    color: #fff;
    font-size: 12px;
    position: absolute;
    bottom: -3px;
    right: 10px;
  }
}
.box {
  background: #eee;
  padding: 0 20px 20px 20px;
  .box-container {
    height: 148px;
    margin-top: 10px;
  }
  .tab {
    font-size: 20px;
    font-family: -700;
    font-weight: bold;
  }
  .titleBox {
    width: 1237px;
    height: 148px;
    background: #fff;
    padding: 11px 31px 11px 20px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    box-sizing: border-box;
    font-size: 16px;
  }
  .topdate {
    display: flex;
    &:first-child {
      margin-right: 51px;
    }
    .topdate1 {
      padding-top: 11px;
      box-sizing: border-box;
      div {
        width: 88px;
        height: 58px;
        background: #f0f3f3;
        text-align: center;
        line-height: 58px;
        cursor: pointer;
        &:first-child {
          background: #d0e4d5;
          margin-bottom: 10px;
        }
      }
    }
  }
  .topdate2 {
    width: 61px;
    height: 148px;
    text-align: center;
    line-height: 148px;
    background: #f0f3f3;
    margin-left: 10px;
  }
  .handle-item {
    display: flex;
    margin-right: 20px;
    .handle-name {
      width: 76px;
      height: 89px;
      background: #d0e4d5;
      text-align: center;
      line-height: 89px;
    }
    .div-input {
      display: flex;
      flex-direction: column;
      height: 89px;
      margin-left: 8px;
      div {
        width: 140px;
        height: 32px;
        border: 1px solid #dedede;
        border-radius: 4px;
        font-size: 16px;
        line-height: 32px;
        box-sizing: border-box;
      }
    }
  }
}
.list {
  :deep(.el-pagination) {
    text-align: center;
  }
  .list1 {
    font-size: 20px;
    font-family: 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC',
      sans-serif, 'PingFangSC-Semibold', 'PingFang SC Semibold', 'PingFang SC',
      sans-serif-650;
    font-weight: bold;
    margin-top: 10px;
  }
}
.bottomBox {
  display: flex;
  margin-top: 15px;

  .quality-inspection-statistics {
    width: 22%;
    min-width: 415px;
    height: 822px;
    padding: 20px;
    box-sizing: border-box;
    background: #fff;
    overflow: hidden;
    .date-picker {
      display: flex;
      padding-top: 15px;
      align-items: center;
      :deep(.el-date-editor) .el-range__icon,
      :deep(.el-date-editor) .el-range-separator {
        line-height: 24px;
      }
    }
    :deep(.el-radio-group) {
      .el-radio-button__inner {
        padding: 9px 6px;
      }
      .el-radio-button:nth-child(2),
      .el-radio-button:nth-child(3) {
        .el-radio-button__inner {
          padding: 9px 20px;
        }
      }
    }
    .statistics-title {
      font-size: 20px;
      font-weight: 700;
      border-left: 4px solid #157a2c;
      margin-left: -20px;
      padding-left: 20px;
      margin-bottom: 10px;
    }
    .bottomTitleActive {
      background: #157a2c;
      color: #fff;
    }
  }
  .bottomBox2 {
    flex: 1;
    margin-left: 10px;
    .technological-process {
      display: flex;
      width: 100%;
      div {
        font-size: 20px;
        height: 50px;
        line-height: 50px;
        background-color: #d0e4d5;
        text-align: center;
        &:first-child {
          width: 120px;
          border-right: 1px solid #fff;
        }
        &:nth-child(2) {
          width: 360px;
          border-right: 1px solid #fff;
        }
        &:nth-child(3) {
          width: 102px;
          border-right: 1px solid #fff;
        }
        &:nth-child(4) {
          width: 292px;
          border-right: 1px solid #fff;
        }
        &:nth-child(5) {
          width: 108px;
          border-right: 1px solid #fff;
        }
        &:nth-child(6) {
          width: 360px;
          border-right: 1px solid #fff;
        }
        &:nth-child(7) {
          width: 109px;
        }
      }
    }
  }
}
.bottomBoxItem {
  display: flex;
  margin: 20px 0 0;
  .edit {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  p {
    width: 70px;
    height: 50px;
    margin: 0;
    padding: 0;
    margin-left: 20px;
    margin-right: 20px;
    text-align: center;
    line-height: 50px;
  }

  .item1 {
    width: 290px;
    height: 52px;
    color: #fff;
    background: #157a2c;
    border-radius: 4px;
    font-size: 20px;
    text-align: center;
    // line-height: 65px;
    .font12 {
      font-size: 12px;
    }
    .entry-kiln {
      font-size: 20px;
      height: 100%;
      padding-top: 5px;
      border-radius: 4px;
      background-color: #157a2c;
      box-sizing: border-box;
      // > div {
      //   line-height: 1.6;
      // }
    }
    .message-box {
      position: relative;
      .left-block {
        position: absolute;
        left: 0;
        top: 0;
        width: 30px;
        height: 65px;
        background-color: #fff;
        opacity: 0.2;
      }
      .block-text {
        width: 30px;
        height: 65px;
        position: absolute;
        left: 2px;
        color: #fff;
        font-size: 12px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-around;
      }
    }
  }
}
.rightBox {
  width: 623px;
  height: 148px;
  margin-left: 20px;
  background: #ffffff;
  display: flex;
  align-items: center;
  padding-left: 20px;
  box-sizing: border-box;
  .rightBoxTir {
    width: 187px;
    height: 109px;
    background: #f0f3f3;
    font-size: 16px;
    text-align: center;
    p {
      margin: 10px;
    }
  }
  .rightInfo {
    padding-left: 27px;
    flex: 1;
    .top-active {
      width: 114px;
      height: 32px;
      line-height: 32px;
      text-align: center;
      font-size: 14px;
      color: #fff;
      background-color: #157a2c;
      border: 1px solid;
      border-radius: 4px;
      margin-bottom: 6px;
      cursor: pointer;
      box-sizing: border-box;
    }
    :deep(.el-radio-button) {
      padding: 0;
      margin-bottom: 6px;
      .el-radio-button__inner {
        padding: 8px 14px;
        border-radius: 4px;
      }
    }
    .select-button {
      :deep(.el-radio-button) {
        padding: 0;
        margin-right: 10px;
        .el-radio-button__inner {
          padding: 8px 21px;
          border: 1px solid #157a2c;
        }
      }
    }
  }
}
.title {
  width: 100%;
  height: 60px;
  background: #157a2c;
  display: flex;
  align-items: center;

  .item:nth-child(1) {
    flex: 1.1;
  }
  .right-box {
    flex: 0.9;
    display: flex;
    align-items: center;
    .item {
      margin-left: 50px;
    }
  }
  .item {
    text-align: right;
    i {
      color: #ffffff;
      margin-right: 10px;
    }
    .font {
      font-size: 16px;
      font-family: MicrosoftYaHei-Bold, MicrosoftYaHei;
      font-weight: bold;
      color: #ffffff;
      line-height: 16px;
    }
  }
  .back {
    margin-right: 20px;
    i {
      width: 14px;
      height: 11px;
      color: #ffffff;
      margin-right: 10px;
    }
    .font {
      height: 14px;
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #ffffff;
      line-height: 14px;
    }
  }
}

.isUnfold {
  position: absolute;
  cursor: pointer;
  font-size: 40px;
  left: 1.5%;
  bottom: 23%;
  color: #a2a2a2;
}
.el-table {
  :deep(.el-button) {
    margin: 20px 0;
  }
  :deep(.el-input__inner) {
    padding-right: 18px;
    // margin: 22px 0;
    text-align: center;
  }
}
.table-input {
  :deep(.el-input__inner) {
    border: 0;
  }
}
:deep(.el-dialog__body) {
  .el-input__icon {
    line-height: 32px;
  }
}
.info-dialog-title {
  font-size: 18px;
  font-weight: 700;
}
.info-dialog-btns {
  text-align: center;
  :deep(.el-button) {
    padding: 6px 14px;
    &:nth-child(2) {
      background-color: #157a2c;
    }
  }
}
.checkbox-group {
  :deep(.el-checkbox) {
    margin-bottom: 20px;
  }
  :deep(.el-checkbox__inner) {
    width: 16px;
    height: 16px;
  }
  :deep(.el-checkbox__label) {
    font-size: 16px;
  }
}

.bottom-table-handle {
  // display: flex;
  // justify-content: space-between;
  :deep(.el-button) {
    margin: 0;
  }
  :deep(.el-button--text) {
    color: #ca3022;
    font-size: 14px;
    &:hover {
      color: red;
    }
  }
}

.kiln-entry {
  display: flex;
  height: 140px;
  // padding-left: 20px;
  position: relative;
  .handle-input {
    flex: 0.2;
    margin-left: 10px;
    :deep(.el-input__inner) {
      background-color: #fff;
      color: #000;
      &::placeholder {
        color: #000;
      }
      &::-webkit-input-placeholder {
        color: #000;
      }
      &::-moz-input-placeholder {
        color: #000;
      }
      &::-ms-input-placeholder {
        color: #000;
      }
    }
    > div {
      display: flex;
      margin-bottom: 5px;
      &:last-child {
        margin-bottom: 0;
      }
      :deep(.el-input) {
        width: 180px;
        margin-right: 5px;
        &:last-child {
          width: 120px;
          margin-right: 0;
        }
      }
    }
  }
  .entry {
    width: 164px;
    position: absolute;
    right: 10px;
    top: 20px;
    // flex: 0.1;
    // display: flex;
    // margin-right: 40px;
    // margin-top: 2%;
    // align-items: center;
    // transform: rotate(-90deg);
    cursor: pointer;

    > span {
      font-size: 24px;
      width: 44px;
      height: 125px;
      line-height: 40px;
      color: #fff;
      text-indent: 14px;
      background-color: #409eff;
      writing-mode: vertical-lr;
      z-index: 1;
    }
    > i {
      font-size: 120px;
      color: #409eff;
      transform: translate(-81px, -95px) rotate(-90deg);
    }
  }
}
:deep(.el-dialog__wrapper) .el-dialog__title {
  font-size: 18px;
}
.handle_stop {
  cursor: pointer;
  color: #ed706a;
  &:hover {
    color: #ff0d00;
  }
}
</style>
