<template>
  <basic-container>
    <div class="avue-crud">
      <div v-h5uShow="!search">
        <!-- 查询模块 -->
        <el-form :inline="true" :model="query" class="header_search">
          <el-form-item label="订单编号:">
            <el-input v-model="query.stockArticleId" placeholder="请输入订单自编号"></el-input>
          </el-form-item>
          <el-form-item label="商城名称:">
            <el-input v-model="query.mallName" placeholder="请输入商城名称"></el-input>
          </el-form-item>
          <el-form-item label="门店名称:">
            <el-input v-model="query.storeName" placeholder="请输入门店名称"></el-input>
          </el-form-item>
          <el-form-item label="客户名称:">
            <el-input v-model="query.consignee" placeholder="请输入客户名称"></el-input>
          </el-form-item>
          <el-form-item label="客户电话:">
            <el-input v-model="query.deliveryPhone" placeholder="请输入客户电话"></el-input>
          </el-form-item>
          <el-form-item label="业务类型:">
            <el-select class="w100" v-model="query.businessType" placeholder="请选择业务类型">
              <el-option :key="'1'" :value="'商配'">商配 </el-option>
              <el-option :key="'2'" :value="'市配'">市配 </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="配送车次:">
            <el-input v-model="query.trainNumber" placeholder="请输入配送车次"></el-input>
          </el-form-item>
          <el-form-item label="司机签收状态:">
            <el-select class="w100" v-model="query.driverSigning" placeholder="请选择业务类型">
              <el-option :value="1">未签收 </el-option>
              <el-option :value="2">已签收 </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="配送时间:">
            <el-date-picker
              v-model="query.taskTimeSection"
              type="daterange"
              align="right"
              unlink-panels
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              value-format="YYYY-MM-DD"
              :picker-options="pickerOptions"
            >
            </el-date-picker>
          </el-form-item>
          <el-form-item label="装车时间:">
            <el-date-picker
              v-model="query.loadingTimeSection"
              type="daterange"
              align="right"
              unlink-panels
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              value-format="YYYY-MM-DD"
              :picker-options="pickerOptions"
            >
            </el-date-picker>
          </el-form-item>

          <!-- 查询按钮 -->
          <el-form-item class="el-btn">
            <el-button type="primary" icon="el-icon-search" @click="searchChange">搜 索</el-button>
            <el-button icon="el-icon-delete" @click="searchReset">清 空</el-button>
          </el-form-item>
        </el-form>
      </div>

      <div class="el-zy-top">
        <div class="order-info">
          <ul>
            <li>
              <img src="../../../../public/img/bg/Delivery.png" />
              <span>司机待签收数：{{ statistics.driverNub }}</span>
            </li>
            <li>
              <img src="../../../../public/img/bg/package.png" />
              <span>文员待审核数：{{ statistics.clerkNub }}</span>
            </li>
          </ul>
        </div>

        <el-row>
          <div class="avue-crud__header">
            <!-- 头部左侧按钮模块 -->
            <div class="avue-crud__left">
              <!--            <el-button type="primary" icon="el-icon-plus" @click="handleAdd">新 增</el-button>-->
              <!--            <el-button type="danger" icon="el-icon-delete" @click="handleDelete" plain-->
              <!--              >删 除</el-button-->
              <!--            >-->

              <el-button type="danger" icon="el-icon-download" @click="handleExportInfo" plain
                >导出
              </el-button>
            </div>
            <!-- 头部右侧按钮模块 -->
            <div class="avue-crud__right">
              <el-button icon="el-icon-refresh" @click="searchChange" circle></el-button>
              <el-button icon="Operation" @click="showdrawer(true)" circle></el-button>
              <el-button icon="el-icon-search" @click="searchHide" circle></el-button>
            </div>
          </div>
        </el-row>
      </div>

      <!-- 列表模块 -->
      <tablecmt
        ref="tableNodeRef"
        :columnList="columnList"
        :tableData="data"
        :loading="loading"
        @inputTxt="inputsc"
        @timeCheck="timesc"
        @btnCheck="btnsc"
        @selectCheck="selectsc"
        @selection="selectionsc"
      >
        <template #default="slotProps">
          <template
            v-if="
              slotProps.scope.column.label === '配送件数' ||
              '装车件数' ||
              '签收数' ||
              '未签收数' ||
              '未装车件数' ||
              '异常装车件数' ||
              '异常签收件数'
            "
          >
            <el-text @click="InformationViewing(slotProps.scope)">
              <!-- {{slotProps.scope.row.reservationNum}} -->
              {{
                slotProps.scope.column.label === '计划配送件数'
                  ? slotProps.scope.row.reservationNum
                  : slotProps.scope.column.label === '计划装车件数'
                  ? slotProps.scope.row.loadedNumber
                  : slotProps.scope.column.label === '计划签收件数'
                  ? slotProps.scope.row.receivedQuantity
                  : slotProps.scope.column.label === '计划未签收件数'
                  ? slotProps.scope.row.unreceivedQuantity
                  : slotProps.scope.column.label === '计划未装车件数'
                  ? slotProps.scope.row.unloadedNumber
                  : slotProps.scope.column.label === '异常装车件数'
                  ? slotProps.scope.row.abnormalLoadedNumber
                  : slotProps.scope.column.label === '异常签收件数'
                  ? slotProps.scope.row.abnormalReceivedQuantity
                  : ''
              }}
            </el-text>
          </template>

          <template v-if="slotProps.scope.column.label === '操作'">
            <el-text size="small" @click="editsolt(slotProps.scope)">查 看</el-text>

            <el-text
              size="small"
              v-if="slotProps.scope.row.abnormalLoadedNumber > 0"
              @click="viewAbnormalLoading(slotProps.scope)"
              >异 常 审 核</el-text
            >
            <!-- v-if="
                slotProps.scope.row.sijiSigningStatus == '司机已签收' &&
                slotProps.scope.row.wenyuanSigningStatus == '文员待审核'
              " -->
            <el-text
              v-if="
                slotProps.scope.row.sijiSigningStatus == '已完成' &&
                slotProps.scope.row.wenyuanSigningStatus == '文员待审核'
              "
              size="small"
              @click="handleSign(slotProps.scope.row)"
              >复 核</el-text
            >
          </template>

          <!--            <el-button size="small" type="danger" @click="delectsolt(slotProps.scope)"-->
          <!--              >Delete</el-button>-->
        </template>
      </tablecmt>

      <el-row class="el-fy">
        <div class="avue-crud__pagination flex-c-sb" style="width: 100%">
          <div style="font-size: 14px">勾选数量: {{ selectionList.length }}</div>
          <!-- 分页模块 -->
          <el-pagination
            align="right"
            background
            @size-change="sizeChange"
            @current-change="currentChange"
            :current-page="page.currentPage"
            :page-sizes="[30, 50, 80, 120]"
            :page-size="page.pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="page.total"
          >
          </el-pagination>
        </div>
      </el-row>
      <!-- 表单模块 -->
      <el-dialog
        :title="title"
        v-model="box"
        width="50%"
        :before-close="beforeClose"
        append-to-body
      >
        <el-form :disabled="view" ref="form" :model="form" label-width="80px">
          <el-form-item label="收货人" prop="consignee">
            <el-input v-model="form.consignee" placeholder="请输入收货人" />
          </el-form-item>
          <el-form-item label="收货人手机号" prop="consigneePhone">
            <el-input v-model="form.consigneePhone" placeholder="请输入收货人手机号" />
          </el-form-item>
          <el-form-item label="收货地址" prop="deliveryAddress">
            <el-input v-model="form.deliveryAddress" placeholder="请输入收货地址" />
          </el-form-item>

          <el-form-item label="签收类型" prop="signingType">
            <el-select v-model="form.signingType" clearable placeholder="请选择签收类型">
              <el-option
                v-for="item in signingTypeData"
                :key="item.dictKey"
                :label="item.dictValue"
                :value="item.dictKey"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <!--          <el-form-item label="文员复核图片" prop="clerkSignPictures">-->
          <!--            <el-input v-model="form.clerkSignPictures" placeholder="请上传文员复核图片" />-->
          <!--          </el-form-item>-->
          <!--          <el-form-item label="司机签收图片" prop="deliverySignPictures">-->
          <!--            <el-input v-model="form.deliverySignPictures" placeholder="请输入司机签收图片"/>-->
          <!--          </el-form-item>-->
          <!--          <el-form-item label="服务号" prop="serviceNumber">-->
          <!--            <el-input v-model="form.serviceNumber" placeholder="请输入服务号"/>-->
          <!--          </el-form-item>-->
          <el-form-item label="备注" prop="notes">
            <el-input v-model="form.notes" placeholder="请输入备注" />
          </el-form-item>
        </el-form>
        <!-- 表单按钮 -->
        <template #footer>
          <span v-if="!view" class="dialog-footer">
            <el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit"
              >提 交</el-button
            >
            <el-button icon="el-icon-circle-close" @click="box = false">取 消</el-button>
          </span>
        </template>
      </el-dialog>

      <el-dialog :title="'签收'" v-model="signBox" width="60%" append-to-body>
        <!-- <avue-form :option="signoption" v-model="signform" :data="signdata" ref="signform">
        </avue-form> -->

        <!-- <span>-------------------------------------------------------------------------------</span> -->
        <div class="TcFrom">
          <el-form :model="TcForm" label-width="120px">
            <el-form-item label="收货人姓名">
              <el-input disabled v-model="TcForm.consignee" placeholder="暂无收货人姓名" />
            </el-form-item>

            <el-form-item label="收货人电话">
              <el-input disabled v-model="TcForm.deliveryPhone" placeholder="暂无收货人电话" />
            </el-form-item>

            <el-form-item label="收货人地址">
              <el-input disabled v-model="TcForm.deliveryAddress" placeholder="暂无收货人地址" />
            </el-form-item>

            <el-form-item label="签收人类型">
              <el-radio-group v-model="TcForm.signingType" class="ml-4">
                <el-radio label="1" size="large">签收</el-radio>
                <el-radio label="2" size="large">待签收</el-radio>
              </el-radio-group>
            </el-form-item>

            <el-form-item label="备注">
              <el-input v-model="TcForm.clerkSignRemarks" placeholder="暂无备注" />
            </el-form-item>
          </el-form>
          <div class="imgName">
            <span>上门照</span>
            <br/>
            <el-button type="primary" @click="UploadTheScanningMap(1)">上传扫描图</el-button>
            <el-upload
              v-model:file-list="DoorstepPhoto"
              :action="doubledCount"
              list-type="picture-card"
              :on-preview="EnlargeTheTmageA"
              :on-remove="handleRemove"
              :on-success="ImgSuccessA"
              :headers="headers"
              multiple
            >
              <el-icon><Plus /></el-icon>
            </el-upload>
            <el-dialog v-model="dialogVisibleA">
              <img w-full :src="dialogImageUrlA" alt="IMG" />
            </el-dialog>
          </div>

          <div class="imgName">
            <span>堆码照</span>
            <br/>
            <el-button type="primary" @click="UploadTheScanningMap(2)">上传扫描图</el-button>
            <el-upload
              v-model:file-list="StackingPhoto"
              :action="doubledCount"
              list-type="picture-card"
              :on-preview="EnlargeTheTmageB"
              :on-remove="handleRemove"
              :on-success="ImgSuccessB"
              :headers="headers"
              multiple
            >
              <el-icon><Plus /></el-icon>
            </el-upload>
            <el-dialog v-model="dialogVisibleB">
              <img w-full :src="dialogImageUrlB" alt="IMG" />
            </el-dialog>
          </div>

          <div class="imgName">
            <span>易碎照</span>
            <br/>
            <el-button type="primary" @click="UploadTheScanningMap(3)">上传扫描图</el-button>
            <el-upload
              v-model:file-list="FragilePhotos"
              :action="doubledCount"
              list-type="picture-card"
              :on-preview="EnlargeTheTmageC"
              :on-remove="handleRemove"
              :on-success="ImgSuccessC"
              :headers="headers"
              multiple
            >
              <el-icon><Plus /></el-icon>
            </el-upload>
            <el-dialog v-model="dialogVisibleC">
              <img w-full :src="dialogImageUrlC" alt="IMG" />
            </el-dialog>
          </div>

          <div class="imgName">
            <span>家配照</span>
            <br/>
            <el-button type="primary" @click="UploadTheScanningMap(4)">上传扫描图</el-button>
            <el-upload
              v-model:file-list="HomePhotos"
              :action="doubledCount"
              list-type="picture-card"
              :on-preview="EnlargeTheTmageD"
              :on-remove="handleRemove"
              :on-success="ImgSuccessD"
              :headers="headers"
              multiple
            >
              <el-icon><Plus /></el-icon>
            </el-upload>
            <el-dialog v-model="dialogVisibleD">
              <img w-full :src="dialogImageUrlD" alt="IMG" />
            </el-dialog>
          </div>

          <div class="imgName">
            <span>签收照</span>
            <br/>
            <el-button type="primary" @click="UploadTheScanningMap(5)">上传扫描图</el-button>
            <el-upload
              v-model:file-list="SignForPhotos"
              :action="doubledCount"
              list-type="picture-card"
              :on-preview="EnlargeTheTmageE"
              :on-remove="handleRemove"
              :on-success="ImgSuccessE"
              :headers="headers"
              multiple
            >
              <el-icon><Plus /></el-icon>
            </el-upload>
            <el-dialog v-model="dialogVisibleE">
              <img w-full :src="dialogImageUrlE" alt="IMG" />
            </el-dialog>
          </div>
          <div class="tj-ttn">
            <el-button type="primary" @click="submitForm">确定</el-button>
            <el-button type="primary" @click="cancellation">取消</el-button>
          </div>
        </div>
      </el-dialog>
    </div>
  </basic-container>
  <edittablehead
    @setcolum="setnewcolum"
    @closce="showdrawer"
    :drawerShow="drawerShow"
    :columnList="columnList"
    v-model="columnList"
  ></edittablehead>
  <el-dialog
    title="异常装车包件列表"
    v-model="abnormalBox"
    width="50%"
    :before-close="beforeClose"
    append-to-body
  >
    <el-table
      ref="table"
      v-loading="Abnormalloading"
      @selection-change="selectionChange"
      :data="wrapdata"
      :height="height"
      style="width: 100%"
      :border="option.border"
    >
      <el-table-column type="expand" v-if="option.expand" align="center"></el-table-column>
      <template v-for="(item, index) in wrapoption.column">
        <!-- table字段 -->
        <el-table-column
          v-if="item.hide !== true"
          :prop="item.prop"
          :label="item.label"
          :show-overflow-tooltip="true"
          :width="item.width"
          :key="index"
        >
          <!--                            :align="center"-->
        </el-table-column>
      </template>
      <el-table-column fixed="right" label="操作" width="100">
        <template #default="scope">
          <el-button
            v-if="scope.row.auditingStatus === 1 || scope.row.auditingStatusName === '待审核'"
            @click="auditing(scope.row)"
            type="text"
            size="small"
            >审 核</el-button
          >
          <!--                    <el-button type="text" size="small">编辑</el-button>-->
        </template>
      </el-table-column>
    </el-table>
    <div style="width: 100%">
      <el-button type="primary" @click="fastAuditing" style="margin-left: 40%">一键审批</el-button>
      <el-button type="primary" @click="this.abnormalBox = false">关闭</el-button>
    </div>
    <!--        <div class="avue-crud__pagination" style="width: 100%">-->
    <!--            &lt;!&ndash; 分页模块 &ndash;&gt;-->
    <!--            <el-pagination-->
    <!--                    background-->
    <!--                    @size-change="wsizeChange"-->
    <!--                    @current-change="wcurrentChange"-->
    <!--                    :current-page="wpage.currentPage"-->
    <!--                    :page-sizes="[30, 50, 80, 120]"-->
    <!--                    :page-size="wpage.pageSize"-->
    <!--                    layout="total, sizes, prev, pager, next, jumper"-->
    <!--                    :total="wpage.total"-->
    <!--            >-->
    <!--                &lt;!&ndash;                        :align="center"&ndash;&gt;-->
    <!--            </el-pagination>-->
    <!--        </div>-->
    <!-- 表单按钮 -->
    <!--        <template #footer>-->
    <!--          <span v-if="!view" class="dialog-footer">-->
    <!--            <el-button type="primary" icon="el-icon-circle-check" @click="handleSubmit">提 交</el-button>-->
    <!--            <el-button icon="el-icon-circle-close" @click="box = false">取 消</el-button>-->
    <!--          </span>-->
    <!--        </template>-->
  </el-dialog>

  <el-dialog :title="numberTitle" v-model="numberDetailDialogVisible" width="70%">
    <tablecmt
      :columnList="numberDetailColumnList"
      :tableData="numberDetailData"
      :loading="loading"
      @inputTxt="inputsc"
      @timeCheck="timesc"
      @btnCheck="btnsc"
      @selectCheck="selectsc"
      @selection="selectionsc"
    >
    </tablecmt>

    <el-button @click="numberDetailDialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="numberDetailDialogVisible = false">确 定</el-button>
  </el-dialog>

  <el-dialog v-model="webCamera" title="扫描上传">
    <webCamera @upload-success="IMGUploadSuccess"  :IMGstate="IMGstate"> </webCamera>
  </el-dialog>
</template>

<script>
import {
  getList,
  getDetail,
  add,
  update,
  remove,
  getPage,
  getstatistics,
  loadingAbnormalPackageListDetail,
  loadingAbnormalPackageListAuditing,
  getSignforExport,
  numberDetail,
  $_isSignt,
} from '@/api/distribution/distributionSignfor';
import { update as updatesign } from '@/api/distribution/distributionSignfor';
import option from '@/option/distribution/distributionSignfor';
import { mapGetters } from 'vuex';
import { getDictionaryBiz } from '@/api/system/dict';
import dayjs from 'dayjs';
import { getDeliveryListExport } from '@/api/distribution/distributionDeliveryList';
import { downloadXls, handleClearTableQuery, setNodeHeight } from '@/utils/util';
import { getToken } from '@/utils/auth';
import { ElMessage, ElMessageBox } from 'element-plus';
export default {
  data() {
    return {
      abnormalReview: '', //异常审核
      imgValue:1,//扫描图标识
      IMGstate:0,
      webCamera:false,//扫描上传
      Abnormalloading: false, //审核加载效果
      dialogImageUrl: '', //图片放大地址
      dialogVisible: false, //图片状态
      dialogImageUrlA: '',
      dialogImageUrlB: '',
      dialogImageUrlC: '',
      dialogImageUrlD: '',
      dialogImageUrlE: '',
      dialogVisibleA: false,
      dialogVisibleB: false,
      dialogVisibleC: false,
      dialogVisibleD: false,
      dialogVisibleE: false,
      numberDetailDialogVisible: false,
      numberTitle: '',
      TcForm: {}, //弹窗表单
      // 上门照
      DoorstepPhoto: [],
      // 堆门照
      StackingPhoto: [],
      // 易碎照
      FragilePhotos: [],
      // 家配照
      HomePhotos: [],
      // 签收照
      SignForPhotos: [],
      reservationId: null, //当前行的ID,
      pickerOptions: {
        shortcuts: [
          {
            text: '最近一周',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit('pick', [start, end]);
            },
          },
          {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit('pick', [start, end]);
            },
          },
          {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit('pick', [start, end]);
            },
          },
        ],
      },
      columnList: [
        {
          prop: '',
          label: '序号',
          type: 0,
          values: '',
          width: 55,
          checkarr: [],
          fixed: true,
        },
        // {
        //   prop: 'number',
        //   label: '编号',
        //   type: 2,
        //   values: '',
        //   width: '150',
        //   checkarr: [],
        //   fixed: true,
        //   sortable: true,
        //   head: false,
        // },
        {
          prop: 'trainNumber',
          label: '配送车次',
          type: 2,
          values: '',
          width: '160',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'reservationCode',
          label: '预约单号',
          type: 2,
          values: '',
          width: '160',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'driverName',
          label: '司机名称',
          type: 2,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'driverPhone',
          label: '司机电话',
          type: 1,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'vehicleName',
          label: '车牌号',
          type: 2,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'taskTime',
          label: '配送时间',
          type: 4,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'stockArticleId',
          label: '订单自编号',
          type: 2,
          values: '',
          width: '200',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'consignee',
          label: '客户名称',
          type: 2,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'deliveryPhone',
          label: '客户电话',
          type: 2,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
        },
        {
          prop: 'deliveryAddress',
          label: '地址',
          type: 2,
          values: '',
          width: '300',
          checkarr: [],
          fixed: false,
          sortable: true,
        },
        {
          prop: 'warehouseName',
          label: '配送仓库',
          type: 2,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'mallName',
          label: '商城名称',
          type: 2,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'storeName',
          label: '门店名称',
          type: 2,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'deliveryTypeName',
          label: '业务类型',
          type: 3,
          values: '',
          width: '130',
          checkarr: [
            {
              label: '商配',
              value: '1',
            },
            {
              label: '市配',
              value: '2',
            },
            {
              label: '自提',
              value: '3',
            },
          ],
          fixed: false,
          sortable: true,
        },
        // {
        //   prop: 'deliveryDriverName',
        //   label: '配送司机',
        //   type: 2,
        //   values: '',
        //   width: '150',
        //   checkarr: [],
        //   fixed: false,
        //   sortable: true
        // },
        {
          prop: 'signLoadingDate',
          label: '装车时间',
          type: 4,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
        },
        // {
        //   prop: 'signingTime',
        //   label: '文员签收时间',
        //   type: 4,
        //   values: '',
        //   width: '180',
        //   checkarr: [],
        //   fixed: false,
        //   sortable: true,
        // },
        // {
        //   prop: 'sjsigningTime',
        //   label: '司机签收时间',
        //   type: 4,
        //   values: '',
        //   width: '180',
        //   checkarr: [],
        //   fixed: false,
        //   sortable: true,
        // },
        // {
        //   prop: 'deliverySignPictures',
        //   label: '签收图片',
        //   type: 1,
        //   values: '',
        //   width: '180',
        //   checkarr: [],
        //   fixed: false,
        //   sortable: true,
        // },
        {
          prop: 'reservationNum',
          label: '计划配送件数',
          type: 6,
          values: '',
          width: '150',
          checkarr: [],
          fixed: false,
          sortable: true,
          isshowSummary: true,
          head: false,
        },
        {
          prop: 'loadedNumber',
          label: '计划装车件数',
          type: 6,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          isshowSummary: true,
          sortable: true,
        },
        {
          prop: 'unloadedNumber',
          label: '计划未装车件数',
          type: 6,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          isshowSummary: true,
          sortable: true,
        },
        {
          prop: 'abnormalLoadedNumber',
          label: '异常装车件数',
          type: 6,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          isshowSummary: true,
          sortable: true,
        },
        {
          prop: 'receivedQuantity',
          label: '计划签收件数',
          type: 6,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          isshowSummary: true,
          sortable: true,
        },
        {
          prop: 'unreceivedQuantity',
          label: '计划未签收件数',
          type: 6,
          values: '',
          width: '130',
          checkarr: [],
          isshowSummary: true,
          fixed: false,
          sortable: true,
        },
        {
          prop: 'abnormalReceivedQuantity',
          label: '异常签收件数',
          type: 6,
          values: '',
          width: '130',
          checkarr: [],
          isshowSummary: true,
          fixed: false,
          sortable: true,
        },
        {
          prop: 'sijiSigningStatus',
          label: '配送状态',
          type: 1,
          values: '',
          width: '150',
          checkarr: [
            {
              value: '2',
              label: '已完成',
            },
            {
              value: '1',
              label: '未完成',
            },
          ],
          fixed: false,
          sortable: true,
        },

        {
          prop: 'wenyuanSigningStatus',
          label: '文员审核状态',
          type: 1,
          values: '',
          width: '150',
          checkarr: [
            {
              value: '2',
              label: '已签收',
            },
            {
              value: '1',
              label: '未签收',
            },
          ],
          fixed: false,
          sortable: true,
        },
        {
          prop: '',
          label: '操作',
          type: 6,
          values: '',
          width: '200',
          checkarr: [],
          fixed: 'right',
          hide: true,
        },
        // 更多列的配置...
      ],
      numberDetailColumnList: [
        // {
        //   prop: '',
        //   label: '序号',
        //   type: 0,
        //   values: '',
        //   width: 55,
        //   checkarr: [],
        //   fixed: true,
        // },
        // {
        //   prop: 'number',
        //   label: '编号',
        //   type: 2,
        //   values: '',
        //   width: '150',
        //   checkarr: [],
        //   fixed: true,
        //   sortable: true,
        //   head: false,
        // },
        {
          prop: 'waybillNumber',
          label: '运单号',
          type: 1,
          values: '',
          width: '160',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'serviceNumber',
          label: '服务号',
          type: 1,
          values: '',
          width: '160',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'orderCode',
          label: '订单自编码',
          type: 1,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'orderPackageCode',
          label: '包条码',
          type: 1,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'cargoNumber',
          label: '物料编码',
          type: 1,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'marketName',
          label: '商场名称',
          type: 1,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'descriptionGoods',
          label: '产品名称',
          type: 1,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'stockupStatusName',
          label: '备货状态',
          type: 1,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'stockupTime',
          label: '备货时间',
          type: 1,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'conditionsName',
          label: '货物类型',
          type: 1,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'loadingStatusName',
          label: '装车状态',
          type: 1,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'loadingTime',
          label: '装车时间',
          type: 1,
          values: '',
          width: '200',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'signingStatusName',
          label: '签收状态',
          type: 1,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },
        {
          prop: 'signingTime',
          label: '签收时间',
          type: 1,
          values: '',
          width: '130',
          checkarr: [],
          fixed: false,
          sortable: true,
          head: false,
        },

        // {
        //   prop: '',
        //   label: '操作',
        //   type: 6,
        //   values: '',
        //   width: '200',
        //   checkarr: [],
        //   fixed: 'right',
        //   hide: true,
        // },
        // 更多列的配置...
      ],
      numberDetailData: [],
      // 表单配置
      signoption: {
        height: 'auto',
        width: '40px',
        calcHeight: 30,
        tip: false,
        searchShow: false,
        searchMenuSpan: 6,
        border: true,
        index: true,
        viewBtn: true,
        dialogClickModal: false,
        emptyBtn: false, //隐藏清空按钮
        submitBtn: false, //隐藏提交按钮
        column: [
          {
            label: '收货人姓名',
            labelWidth: '150',
            span: 11,
            prop: 'consignee',
            type: 'input',
            width: '150px',
            align: 'center',
            disabled: true,
            // rules: [{
            //   required: true,
            //   message: "输入承运商编号",
            //   trigger: "blur"
            // }],
          },
          {
            label: '收货人电话',
            prop: 'deliveryPhone',
            labelWidth: '150',
            span: 11,
            type: 'input',
            width: '150px',
            align: 'center',
            disabled: true,
          },
          {
            label: '收货地址',
            prop: 'deliveryAddress',
            labelWidth: '150',
            span: 11,
            type: 'input',
            width: '150px',
            align: 'center',
            disabled: true,
          },
          {
            label: '签收类型',
            prop: 'signingType',
            labelWidth: '150',
            span: 11,
            type: 'radio',
            width: '150px',
            align: 'center',
            disabled: false,
            dicData: [
              {
                label: '签收',
                value: '1',
              },
              {
                label: '代签收',
                value: '2',
              },
            ],
          },
          {
            label: '签收图片',
            prop: 'deliverySignPictures',
            labelWidth: '150',
            type: 'upload',
            listType: 'picture-card',
            width: '150px',
            span: 15,
            multiple: true,
            align: 'left',
            action: '/blade-resource/oss/endpoint/put-file',
            limit: 5,
            propsHttp: {
              res: 'data',
              url: 'link',
            },
            disabled: false,
          },
          // {
          //   label: "复核图片",
          //   prop: "clerkSignPictures",
          //   type: 'upload',
          //   listType: 'picture-card',
          //   dataType: 'string',
          //   labelWidth:'150',
          //   span:15,
          //   multiple:true,
          //   width:"200px",
          //   align:'left',
          //   action: '/blade-resource/oss/endpoint/put-file',
          //   limit: 15,
          //   propsHttp: {
          //     res: 'data',
          //     url: 'link',
          //   },
          //   rules: [{
          //     required: true,
          //     message: "请上传图片",
          //     trigger: "blur"
          //   }],
          // },

          {
            label: '备注',
            prop: 'clerkSignRemarks',
            labelWidth: '150',
            span: 15,
            type: 'input',
            width: '150px',
            align: 'center',
          },
        ],
      },
      columnListedit: [],
      wrapdata: [],
      wrapoption: {
        expand: false,
        index: true,
        border: true,
        selection: true,
        column: [
          {
            label: '配送车次',
            prop: 'trainNumber',
            search: true,
            width: '100px',
          },
          {
            label: '运单号',
            prop: 'waybillNumber',
            search: true,
            width: '100px',
          },
          {
            label: '服务号',
            prop: 'serviceNumber',
            search: true,
            width: '100px',
          },
          {
            label: '订单自编号',
            prop: 'orderCode',
            width: '100px',
            search: true,
          },
          {
            label: '货物名称',
            prop: 'materialName',
            width: '100px',
            search: true,
          },
          {
            label: '包条码',
            prop: 'packageCode',
            search: true,
            width: '100px',
          },
          // {
          //   label: '仓库',
          //   prop: 'warehouse',
          //   search: true,
          //   width: '100px',
          // },
          // {
          //   label: '发站仓',
          //   prop: 'sendWarehouseName',
          //   search: true,
          //   width: '100px',
          // },
          // {
          //   label: '目的仓',
          //   prop: 'acceptWarehouseName',
          //   search: true,
          //   width: '100px',
          // },
          // {
          //   label: '发货时间',
          //   prop: 'waybillNumber',
          //   search: true,
          //   width: '100px',
          // },
          // {
          //   label: '入库时间',
          //   prop: 'warehouseEntryTimeEnd',
          //   search: true,
          //   width: '100px',
          // },
          // {
          //   label: '客户车次号',
          //   prop: 'trainNumber',
          //   search: true,
          //   width: '100px'
          // },
          // {
          //   label: '发站出库车次',
          //   prop: 'trainNumber',
          //   search: true,
          //   width: '100px'
          // },
          // {
          //   label: '入库车次',
          //   prop: 'trainNumber',
          //   search: true,
          //   width: '100px',
          // },
          {
            label: '一级品类',
            prop: 'firsts',
            search: true,
            width: '100px',
          },
          {
            label: '二级品类',
            prop: 'second',
            search: true,
            width: '100px',
          },
          {
            label: '三级品类',
            prop: 'thirdProduct',
            search: true,
            width: '100px',
          },
          // {
          //   label: '物料编号',
          //   prop: 'materialCode',
          //   search: true,
          //   width: '100px'
          // },
          // {
          //   label: '物料名称',
          //   prop: 'materialName',
          //   search: true,
          //   width: '100px'
          // },

          {
            label: '包件状态',
            prop: 'orderPackageStatusName',
            search: true,
            width: '100px',
          },
          {
            label: '冻结状态',
            prop: 'orderPackageFreezeStatusName',
            search: true,
            width: '100px',
          },
          // {
          //   label: '上架状态',
          //   prop: 'orderPackageGroundingStatusName',
          //   search: true,
          //   width: '100px',
          // },
          {
            label: '备货状态',
            prop: 'orderPackageStockupStatusName',
            search: true,
            width: '100px',
          },
          {
            label: '预约状态',
            prop: 'orderPackageReservationStatusName',
            search: true,
            width: '100px',
          },
          {
            label: '装车状态',
            prop: 'orderPackageLoadingStatusName',
            search: true,
            width: '100px',
          },
          // {
          //   label: '配送计划状态',
          //   prop: 'orderPackageDeliveryStatus',
          //   search: true,
          //   width: '130px'
          // },
          //  {
          //   label: '装车扫描时间',
          //   prop: 'orderPackageReservationStatusName',
          //   search: true,
          //   width: '150px'
          // },
          // {
          //   label: '装车方式',
          //   prop: 'scanStatus',
          //   search: true,
          //   width: '150px',
          // },
          // {
          //   label: '装车扫描人员',
          //   prop: 'orderPackageDeliveryStatus',
          //   search: true,
          //   width: '150px'
          // },
          // {
          //   label: '计划装车人',
          //   prop: 'driverName',
          //   search: true,
          //   width: '150px',
          // },
          {
            label: '实际装车人',
            prop: 'scanUser',
            search: true,
            width: '150px',
          },
          // {
          //   label: '签收扫描时间',
          //   prop: 'signingTime',
          //   search: true,
          //   width: '150px',
          // },
          {
            label: '审核状态',
            prop: 'auditingStatusName',
            search: true,
            width: '150px',
          },
          {
            label: '审核时间',
            prop: 'auditingTime',
            search: true,
            width: '150px',
          },
          {
            label: '审核人',
            prop: 'auditingUser',
            search: true,
            width: '150px',
          },

          // {
          //   label: '托盘码',
          //   prop: 'pallet',
          //   width: '100px'
          // },
          // {
          //   label: '库位号',
          //   prop: 'goodsAllocation',
          //   width: '100px'
          // }
        ],
      },

      drawerShow: false,
      height: 0,
      // 弹框标题
      title: '',
      // 是否展示弹框
      box: false,
      // 是否显示查询
      search: true,
      // 加载中
      loading: true,
      // 是否为查看模式
      view: false,
      //签收是否显示
      signBox: false,
      // 签收表单数据
      signform: {},
      // 签收列表
      signdata: [],
      // 查询信息
      query: {},
      abnormalBox: false,
      // 表单配置
      signoption: {
        height: 'auto',
        width: '40px',
        calcHeight: 30,
        tip: false,
        searchShow: false,
        searchMenuSpan: 6,
        border: true,
        index: true,
        viewBtn: true,
        dialogClickModal: false,
        emptyBtn: false, //隐藏清空按钮
        submitBtn: false, //隐藏提交按钮
        column: [
          {
            label: '收货人姓名',
            labelWidth: '150',
            span: 11,
            prop: 'consignee',
            type: 'input',
            width: '150px',
            align: 'center',
            disabled: true,
            // rules: [{
            //   required: true,
            //   message: "输入承运商编号",
            //   trigger: "blur"
            // }],
          },
          {
            label: '收货人电话',
            prop: 'deliveryPhone',
            labelWidth: '150',
            span: 11,
            type: 'input',
            width: '150px',
            align: 'center',
            disabled: true,
          },
          {
            label: '收货地址',
            prop: 'deliveryAddress',
            labelWidth: '150',
            span: 11,
            type: 'input',
            width: '150px',
            align: 'center',
            disabled: true,
          },
          {
            label: '签收类型',
            prop: 'signingType',
            labelWidth: '150',
            span: 11,
            type: 'radio',
            width: '150px',
            align: 'center',
            // disabled:true,
            dicData: [
              {
                label: '签收',
                value: '1',
              },
              {
                label: '代签收',
                value: '2',
              },
            ],
          },
          {
            label: '司机签收图片',
            prop: 'deliverySignPictures',
            labelWidth: '150',
            type: 'upload',
            listType: 'picture-card',
            width: '150px',
            span: 15,
            multiple: true,
            align: 'left',
            action: '/blade-resource/oss/endpoint/put-file',
            limit: 5,
            propsHttp: {
              res: 'data',
              url: 'link',
            },
            disabled: false,
          },
          // {
          //   label: "复核图片",
          //   prop: "clerkSignPictures",
          //   type: 'upload',
          //   listType: 'picture-card',
          //   dataType: 'string',
          //   labelWidth:'150',
          //   span:15,
          //   multiple:true,
          //   width:"200px",
          //   align:'left',
          //   action: '/blade-resource/oss/endpoint/put-file',
          //   limit: 15,
          //   propsHttp: {
          //     res: 'data',
          //     url: 'link',
          //   },
          //   rules: [{
          //     required: true,
          //     message: "请上传图片",
          //     trigger: "blur"
          //   }],
          // },

          {
            label: '备注',
            prop: 'clerkSignRemarks',
            labelWidth: '150',
            span: 15,
            type: 'input',
            width: '150px',
            align: 'center',
          },
        ],
      },
      //数量
      statistics: {},
      //签收类型
      signingTypeData: [],
      //签收状态
      signingStatusData: [],
      //业务类型
      deliveryTypeData: [],
      //来源
      orderSourceData: [],
      // 分页信息
      page: {
        currentPage: 1,
        pageSize: 30,
        total: 40,
      },
      // 表单数据
      form: {},
      // 选择行
      selectionList: [],
      // 表单配置
      option: option,
      // 表单列表
      data: [],
    };
  },
  mounted() {
    this.queryDictionary();
    this.init();
    // this.columnListedit=JSON.parse(JSON.stringify(this.columnList))
  },
  computed: {
    ...mapGetters(['permission', 'setting']),
    ids() {
      let ids = [];
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(',');
    },
    // 图片上传接口
    doubledCount() {
      return '/api/blade-resource/oss/endpoint/put-file';
    },
    // 图片上传必须携带TOKEN
    headers() {
      return { 'Blade-Auth': 'Bearer ' + getToken() };
    },
  },
  methods: {
    /**
     * 导出
     * */
    handleExportInfo() {
      let row = {};
      // if (!!this.ids) {
      //   row.ids = this.ids;
      // }
      const ids = this.selectionList.join(',');
      row.ids = ids;
      row.signingStatus = '1';
      // console.log("<><><>>",ids);
      row = { ...row, ...this.query };
      delete row.deliveryTypeName;
      getSignforExport(row).then(res => {
        // console.log(res.data);
        downloadXls(res.data, '待签收数据.xlsx');
      });
    },
    showdrawer(value) {
      this.drawerShow = value;
    },
    // 图片上传回调
    handleRemove(uploadFile, uploadFiles) {
      console.log(uploadFile, uploadFiles);
      console.log('执行了1回调');
    },
    // 数字点击
    InformationViewing(val) {
      console.log(val, '点击数字接收的值');
      console.log('12312312');
      const row = val;

      let type = 0;
      switch (row.column.label) {
        case '计划配送件数':
          this.numberTitle = '配送包件详情列表';
          type = 1;
          console.log('查看配送件数');
          break;
        case '计划装车件数':
          type = 2;
          this.numberTitle = '装车详情列表';
          break;
        case '计划未装车件数':
          type = 3;
          this.numberTitle = '未装车详情列表';
          break;
        case '计划签收件数':
          type = 4;
          this.numberTitle = '签收详情列表';
          break;
        case '计划未签收件数':
          type = 5;
          this.numberTitle = '未签收详情列表';
          break;
        case '异常装车件数':
          type = 6;
          this.numberTitle = '异常装车详情列表';
          break;
        case '异常签收件数':
          type = 7;
          this.numberTitle = '异常签收详情列表';
          break;
      }

      numberDetail(row.row.id, type).then(res => {
        this.numberDetailDialogVisible = true;
        const data = res.data.data;
        this.numberDetailData = data;
        console.log('res--------->', res);
      });
    },
    handlePictureCardPreview(uploadFile) {
      console.log(uploadFile);
      console.log('执行了2回调');
      dialogVisible.value = true;
    },
    photo(name, data) {
      if (response.success == true) {
        console.log(response, '图片上传成功');
        this.name[this.name.length - 1].url = data.data.link;
      }
    },
    // 上门照图片上传成功
    ImgSuccessA(response, uploadFile) {},
    // 堆门图片上传成功
    ImgSuccessB(response, uploadFile) {},
    // 易碎图片上传成功
    ImgSuccessC(response, uploadFile) {},
    // 家配图片上传成功
    ImgSuccessD(response, uploadFile) {
      console.log(response, 'response');
      console.log(this.HomePhotos, '加配照片');
    },
    // 签收图片上传成功
    ImgSuccessE(response, uploadFile) {},

    /**
     * 弹窗的勾选回调，用于更改头部数组
     * 固定搭配，只需要更换   columnList
     */
    setnewcolum(newarr, headarr, type) {
      // console.log(newarr,'+++++++++++')
      if (type == 1) {
        this.columnList = newarr;
        this.$functions.setStorage(window.location.pathname + 'checkList', headarr);
      } else if (type == 2) {
        this.columnList = newarr;
        this.$functions.setStorage(window.location.pathname + 'flexList', headarr);
      } else if (type == 3) {
        this.columnList = newarr;
        this.$functions.setStorage(window.location.pathname + 'sortlist', headarr);
      }
    },
    //取消
          // 上传图片处理开始
   generatePhotoArray(photoType, photoItems, reservationId) {
        const photoArray = [];
        photoItems.forEach(item => {
          photoArray.push({
            name: item.name,
            reservationId: reservationId,
            type: photoType,
            urlRoute: item.response && item.response.data ? item.response.data.link : item.url,
          });
        });
        return photoArray;
      },
    cancellation() {
      this.signBox = false;
    },
    // 上传扫描图按钮
    UploadTheScanningMap(value){
      this.IMGstate=value
      this.imgValue=value
      this.webCamera=true;//开启扫描弹窗
    },
    // 扫描图处理
    IMGUploadSuccess(res){
      let dataURL={
          name:res.data.data.originalName,
          url:res.data.data.link,
        }
      console.log(res,'扫描图返回值');
      if(this.imgValue==1){
        console.log( this.DoorstepPhoto,' this.DoorstepPhoto');
        this.DoorstepPhoto.push(dataURL)
      }
      if(this.imgValue==2){
        this.StackingPhoto.push(dataURL)
      }
      if(this.imgValue==3){
        this.FragilePhotos.push(dataURL)
      }
      if(this.imgValue==4){
        this.HomePhotos.push(dataURL)
      }
      if(this.imgValue==5){
        this.SignForPhotos.push(dataURL)
      }
    },
    //签收
    submitForm() {
      // this.isDis = true;
      // console.log(this.$refs.signform.validate, 'this.$refs.signform');
      // let row = {};
      // row.id = this.signform.id;
      // row.clerkSignPictures = this.signform.clerkSignPictures;
      // row.clerkSignRemarks = this.signform.clerkSignRemarks;
      // console.log(row, '要提交的数据');
      // this.$refs.signform.validate(valid => {
      // if (valid) {
      let row = {};
      row.map = {
        photo_1: [],
        photo_2: [],
        photo_3: [],
        photo_4: [],
        photo_5: [],
      };
      // 提交图片处理
      //最后提交
      row.id = this.signform.id;
      row.reservationId = this.reservationId;
      row.clerkSignPictures = this.signform.clerkSignPictures;
      row.clerkSignRemarks = this.TcForm.clerkSignRemarks; //备注
      row.signingStatus = '2'; //状态
      row.deliveryId = this.signform.deliveryId;

      // 本身图片处理开始
      const photoMap = {
        photo_1: 'photo_1',
        photo_2: 'photo_2',
        photo_3: 'photo_3',
        photo_4: 'photo_4',
        photo_5: 'photo_5',
      };
      this.TcForm.printVOList.forEach(item => {
        const type = item.type;
        if (photoMap.hasOwnProperty(type)) {
          const photoProperty = photoMap[type];
          row.map[photoProperty].push({
            name: item.name,
            reservationId: this.reservationId,
            type: type,
            urlRoute: item.urlRoute,
          });
        }
      });
      // 本身图片处理结束


      row.map.photo_1 = this.generatePhotoArray('photo_1', this.DoorstepPhoto, this.reservationId);
      row.map.photo_2 = this.generatePhotoArray('photo_2', this.StackingPhoto, this.reservationId);
      row.map.photo_3 = this.generatePhotoArray('photo_3', this.FragilePhotos, this.reservationId);
      row.map.photo_4 = this.generatePhotoArray('photo_4', this.HomePhotos, this.reservationId);
      row.map.photo_5 = this.generatePhotoArray('photo_5', this.SignForPhotos, this.reservationId);
      // 上传图片处理结束
      // 图片去重
      this.deduplicateByIdAndUpdate(row.map.photo_1);
      this.deduplicateByIdAndUpdate(row.map.photo_2);
      this.deduplicateByIdAndUpdate(row.map.photo_3);
      this.deduplicateByIdAndUpdate(row.map.photo_4);
      this.deduplicateByIdAndUpdate(row.map.photo_5);
      console.log(row, '要提交的参数');
      // 提交

      updatesign(row).then(res => {
        console.log(res, '提交之后返回的参数');
        this.signBox = false;
        if (res.data.code == 200) {
          ElMessage({
            message: '操作成功',
            type: 'success',
          });
        } else {
          ElMessage.error('操作失败');
        }
        this.onLoad(this.page);
      });
      //  if (!!row.id){
      // updatesign(row).then(
      //   () => {
      //     console.log(row, '要提交的值');
      //     this.$message({
      //       type: 'success',
      //       message: '操作成功!',
      //     });
      //     this.signBox = false;
      //     this.onLoad(this.page);
      //   },
      //   error => {
      //     console.log(error);
      //     this.signBox = false;
      //   }
      // );
      // }
      // });
    },
    // 图片放大
    EnlargeTheTmageA(uploadFile) {
      this.dialogImageUrlA = uploadFile.url;
      this.dialogVisibleA = true;
    },
    EnlargeTheTmageB(uploadFile) {
      this.dialogImageUrlB = uploadFile.url;
      this.dialogVisibleB = true;
    },
    EnlargeTheTmageC(uploadFile) {
      this.dialogImageUrlC = uploadFile.url;
      this.dialogVisibleC = true;
    },
    EnlargeTheTmageD(uploadFile) {
      this.dialogImageUrlD = uploadFile.url;
      this.dialogVisibleD = true;
    },
    EnlargeTheTmageE(uploadFile) {
      this.dialogImageUrlE = uploadFile.url;
      this.dialogVisibleE = true;
    },
    deduplicateByIdAndUpdate(val) {
      const result = val.filter((item, index, array) => {
        // 通过 some 方法检查当前元素之前是否已经出现过相同的ID
        return !array.slice(0, index).some(prevItem => prevItem.urlRoute === item.urlRoute);
      });

      // 清空传入的值
      val.length = 0;
      // 将去重后的参数重新赋值给传入的值
      result.forEach(item => {
        val.push(item);
      });
    },
    selectionsc(value) {
      console.log(value);
      this.selectionList = value.map(item => item.id);
    },
    delectsolt(scope) {
      const { row } = scope;
      console.log(row);
    },
    //审批异常装车包件
    auditing(row) {
      this.Abnormalloading = true;
      // const { row } = scope;
      console.log('----------->row', row);
      loadingAbnormalPackageListAuditing(row.id).then(res => {
        console.log('res-------->', res);
        if (res) {
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
          this.Abnormalloading = false;
          this.AbnormalreviewFn(this.abnormalReview); //审核完成更新数据
        }
      });
    },
    /**
     * 一键审批
     */
    fastAuditing() {
      this.Abnormalloading = true; //开启加载效果
      console.log('this.wrapdata---------->', this.wrapdata);
      let ids = [];
      this.wrapdata.forEach(item => {
        ids.push(item.id);
      });
      loadingAbnormalPackageListAuditing(ids.join(',')).then(res => {
        console.log('res-------->', res);
        if (res) {
          this.$message({
            type: 'success',
            message: '操作成功!',
          });

          this.abnormalBox = false; //关闭弹窗
          this.Abnormalloading = false; //关闭加载效果
        }
      });
      console.log('ids---------->', ids);
    },
    // 复核请求公共函数
    checkFn(row) {
      console.log('签收>>>>>>>>>>', row);
      // this.title = '查看';
      // this.view = true;
      this.signform = row;
      this.signBox = true;
      getDetail(row.id).then(res => {
        console.log(res, '点击复核的返回值==');
        this.form = res.data.data;
        this.TcForm = res.data.data;
        // 照片回显分类
        this.DoorstepPhoto = [];
        this.StackingPhoto = [];
        this.FragilePhotos = [];
        this.HomePhotos = [];
        this.SignForPhotos = [];
        if (res.data.data.printVOList.length) {
          res.data.data.printVOList.forEach(item => {
            if (item.type == 'photo_1') {
              this.DoorstepPhoto.push({ name: item.name, url: item.urlRoute });
            }
            if (item.type == 'photo_2') {
              this.StackingPhoto.push({ name: item.name, url: item.urlRoute });
            }
            if (item.type == 'photo_3') {
              this.FragilePhotos.push({ name: item.name, url: item.urlRoute });
            }
            if (item.type == 'photo_4') {
              this.HomePhotos.push({ name: item.name, url: item.urlRoute });
            }
            if (item.type == 'photo_5') {
              this.SignForPhotos.push({ name: item.name, url: item.urlRoute });
            }
          });
        }
      });
    },
    handleSign(row) {
      this.reservationId = row.reservationId; //存储当前行的ID
      let data = {
        signingId: row.id,
      };
      $_isSignt(data).then(res => {
        console.log(res, '预请求返回值');
        if (res.data.msg == '存在异常包件') {
          ElMessage({
            message: res.data.msg,
            type: 'warning',
          });
          return;
        }
        if (res.data.msg == '此任务存在未完成包件，请确认') {
          ElMessageBox.confirm(res.data.msg, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
          })
            .then(() => {
              this.checkFn(row);
            })
            .catch(() => {
              console.log('取消');
            });
          return;
        }
        if (res.data.msg == '直接进行复核操作') {
          this.checkFn(row);
        }
      });
      //  this.wid= row.id
      // this.getWrapdetails(this.wpage)
    },
    // 异常装车

    // 异常审核函数
    AbnormalreviewFn(row) {
      loadingAbnormalPackageListDetail(row.id).then(res => {
        this.wrapdata = res.data.data;
        console.log('res------------->', res.data.data);
      });
    },

    viewAbnormalLoading(scope) {
      const { row } = scope;
      console.log(scope, '异常审核');
      this.abnormalReview = row;
      // this.title = '查看';
      // this.view = true;
      this.abnormalBox = true;
      console.log('异常装车审核------------->', row);
      this.AbnormalreviewFn(this.abnormalReview);
    },
    editsolt(scope) {
      const { row } = scope;
      console.log('row>>>>>>>>>>>>>>>>>>>', row);
      console.log(row);
      this.$router.push({
        path: '/distribution/signfor/distributionSignforedt',
        query: {
          id: row.id,
          reservationId: row.reservationId,
          name: '待签收查看',
          row: JSON.stringify(row),
        },
      });
    },
    btnsc(index, row) {
      console.log(index, row);
    },
    selectsc(index, row) {
      this.query[row.prop] = index;
      if (!index) {
        delete this.query[row.prop];
      }
      if (row.prop === 'deliveryTypeName') {
        this.query.deliveryType = index;
        if (!index) delete this.query.deliveryType;
      }
      this.onLoad(this.page);
    },
    timesc(index, row) {
      if (!!index) {
        index = dayjs(index).format('YYYY-MM-DD');
      }
      this.query[row.prop] = index;
      if (!index) {
        delete this.query[row.prop];
      }
      this.onLoad(this.page);
    },
    inputsc(index, row) {
      this.query[row.prop] = index;
      if (!index) {
        delete this.query[row.prop];
      }
      this.onLoad(this.page);
    },
    queryDictionary() {
      // getDictionaryBiz('distribution_signfor_status').then(res => {
      //   this.signingTypeData = res.data.data;
      // });
      getDictionaryBiz('order_source').then(res => {
        this.orderSourceData = res.data.data;
        this.columnList[6].checkarr = res.data.data.map(item => {
          item.value = item.dictKey;
          item.label = item.dictValue;
          return item;
        });
      });
      getDictionaryBiz('distribution_signfor_status').then(res => {
        this.signingStatusData = res.data.data;
      });
      getDictionaryBiz('distribution_type').then(res => {
        this.deliveryTypeData = res.data.data;
        this.columnList[4].checkarr = res.data.data.map(item => {
          item.value = item.dictKey;
          item.label = item.dictValue;
          return item;
        });
        this.onLoad(this.page);
      });
    },
    init() {
      this.height = this.setPx(document.body.clientHeight - 340);
    },
    searchHide() {
      this.search = !this.search;
      setNodeHeight(this.$refs.tableNodeRef.$el, '', true);
    },
    searchChange() {
      console.log('this.query>>>>>>>>>>>>>>', this.query);
      if (this.query.querySigningStatus) {
        this.query.signingStatus = this.query.querySigningStatus;
      }
      if (this.query.businessType) {
        let businessType = this.query.businessType;
        switch (businessType) {
          case '商配':
            this.query.deliveryType = '1';
            break;
          case '市配':
            this.query.deliveryType = '2';
            break;
        }
      }
      this.onLoad(this.page);
    },
    searchReset() {
      this.query = {};
      this.page.currentPage = 1;
      handleClearTableQuery(this.columnList);
      this.onLoad(this.page);
    },
    handleSubmit() {
      if (!this.form.id) {
        add(this.form).then(() => {
          this.box = false;
          this.onLoad(this.page);
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
        });
      } else {
        update(this.form).then(() => {
          this.box = false;
          this.onLoad(this.page);
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
        });
      }
    },
    handleAdd() {
      this.title = '新增';
      this.form = {};
      this.box = true;
    },
    handleEdit(row) {
      this.title = '编辑';
      this.box = true;
      getDetail(row.id).then(res => {
        this.form = res.data.data;
      });
    },
    handleView(row) {
      this.title = '查看';
      this.view = true;
      this.box = true;
      getDetail(row.id).then(res => {
        this.form = res.data.data;
      });
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning('请选择至少一条数据');
        return;
      }
      this.$confirm('确定将选择数据删除?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.selectionClear();
          this.onLoad(this.page);
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
        });
    },
    rowDel(row) {
      this.$confirm('确定将选择数据删除?', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: 'success',
            message: '操作成功!',
          });
        });
    },
    beforeClose(done) {
      done();
      this.form = {};
      this.view = false;
      this.onLoad(this.page);
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      // this.$refs.table.clearSelection();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
      this.onLoad(this.page);
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
      this.onLoad(this.page);
    },
    onLoad(page, params = {}) {
      this.loading = true;
      this.query.signingStatus = '1';
      console.log('this.query>>>>>>>', this.query);
      getPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
        const data = res.data.data;
        // eslint-disable-next-line no-empty
        for (let i = 0; i < data.records.length; i++) {
          // eslint-disable-next-line no-empty
          // for (let j = 0; j < this.deliveryTypeData.length; j++) {
          //   // eslint-disable-next-line no-empty
          //   if (data.records[i].deliveryType == this.deliveryTypeData[j].dictKey) {
          //     data.records[i].deliveryType = this.deliveryTypeData[j].dictValue;
          //   }
          // }
          for (let j = 0; j < this.orderSourceData.length; j++) {
            // eslint-disable-next-line no-empty
            if (data.records[i].orderSource == this.orderSourceData[j].dictKey) {
              data.records[i].orderSource = this.orderSourceData[j].dictValue;
            }
          }
          for (let j = 0; j < this.signingStatusData.length; j++) {
            // eslint-disable-next-line no-empty
            if (data.records[i].driverSigning == this.signingStatusData[j].dictKey) {
              data.records[i].driverSigning = this.signingStatusData[j].dictValue;
            }
          }
        }
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        // this.selectionClear();
      });
      getstatistics(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(
        res => {
          this.statistics = res.data.data;
        }
      );
    },
  },
};
</script>
<style scoped lang="scss">
.el-fr-zy {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  .el-form-item {
    width: 20%;
    margin-right: 5%;
  }
  .el-select {
    width: 100%;
  }
}
.el-fr-ro {
  display: flex;
  .el-btn {
    margin-right: 0;
    width: 258px;
  }
}
.el-zy-top {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  .rows {
    width: 50%;
  }
  .avue-crud__header {
    display: flex;
    align-items: flex-end;
  }
}
.el-btn {
  :deep(.el-form-item__content) {
    align-items: flex-end;
  }
}
.order-info {
  margin-right: 3%;
  ul {
    list-style: none;
    display: flex;
    padding: 0;

    li {
      color: #172e60;
      position: relative;
      padding: 0 20px;
      display: flex;
      align-items: center;
      font-weight: 500;
      img {
        margin-right: 4px;
      }
    }
    li::after {
      content: '';
      display: block;
      width: 0.10417vw;
      height: 18px;
      background-color: #dddbdb;
      position: absolute;
      top: 2px;
      left: 0px;
    }
  }
  li:first-child::after {
    content: none;
  }
  li:first-child {
    padding-left: 0;
  }
}
.TcFrom {
  :deep(.el-form) {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    .el-form-item {
      width: 46%;
    }
  }
}
.imgName {
  span {
    font-weight: bold;
    font-size: 16px;
  }
  span::after {
    content: '';
  }
}
.tj-ttn {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
:deep(.el-dialog__body) {
  img {
    width: 100%;
  }
}

:deep(.avue-crud) {
  display: flex;
  height: 100%;
  flex-direction: column;
}
:deep(.el-card__body) {
  height: 100%;
}
:deep(.el-card) {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.el-fy {
  display: flex;
  align-items: flex-end;
}
:deep(.el-upload-list__item-thumbnail) {
  object-fit: fill;
}

// 时间选择器
:deep(.el-date-editor.el-input__wrapper) {
  height: 100% !important;
}
</style>
