<template>
    <basic-container>
        <div class="avue-crud">
            <el-row :hidden="!search" style="padding: 6px 18px">
                <!-- 查询模块 -->
                <el-form :inline="true" :model="query">
                    <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 v-model="query.businessType" placeholder="请选择业务类型">
                            <el-option
                                    :key="'1'"
                                    :value="'商配'">商配
                            </el-option>
                            <el-option
                                    :key="'2'"
                                    :value="'市配'">市配
                            </el-option>
                        </el-select>
                        <!--            <el-input v-model="query.deliveryType" placeholder="请选择业务类型"></el-input>-->
                    </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 v-model="query.driverSigning" placeholder="请选择业务类型">
                            <el-option
                                    :value="1">未签收
                            </el-option>
                            <el-option
                                    :value="2">已签收
                            </el-option>
                        </el-select>
                        <!--            <el-input v-model="query.querySigningStatus" placeholder="请选择签收状态"></el-input>-->
                    </el-form-item>
                    <!--                        <el-form-item label="顾客姓名:">-->
                    <!--                            <el-input v-model="query.customerName" placeholder="请输入服务类型"></el-input>-->
                    <!--                        </el-form-item>-->
                    <!-- 查询按钮 -->
                    <el-form-item>
                        <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>
            </el-row>
            <!-- <tablecmt
            :columnList="columnList"
            :tableData="tableData"
            @inputTxt='inputsc'
            @timeCheck="timesc"
            @btnCheck="btnsc"
            @selectCheck="selectsc"
            @selection="selectionsc"
            >
            <template #default="slotProps">
              <el-button
                  size="small"
                  @click="editsolt(slotProps.scope)"
                  >Edit</el-button
                >
                <el-button
                  size="small"
                  type="danger"
                  @click="delectsolt(slotProps.scope)"
                  >Delete</el-button
                >
            </template>
            </tablecmt> -->
            <!--      <el-row :hidden="!search" style="padding: 6px 18px">-->
            <!--        &lt;!&ndash; 查询模块 &ndash;&gt;-->
            <!--        <el-form :inline="true" :model="query">-->
            <!--          &lt;!&ndash; 查询按钮 &ndash;&gt;-->
            <!--          <el-form-item>-->
            <!--            <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>-->
            <!--      </el-row>-->
            <el-row :gutter="24" class="rows">
                <el-col :xl="7" :lg="7" :md="8" :sm="24">
                    <span>司机待签收数：{{statistics.driverNub}}</span>
                </el-col>
                <el-col :xl="10" :lg="7" :md="8" :sm="24">
                    <span>文员待审核数：{{statistics.clerkNub}}</span>
                </el-col>
            </el-row>
            <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-->
                        <!--            >-->
                    </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>
            <el-row>
                <!-- 列表模块 -->
                <tablecmt
                        :columnList="columnList"
                        :tableData="data"
                        :loading="loading"
                        @inputTxt="inputsc"
                        @timeCheck="timesc"
                        @btnCheck="btnsc"
                        @selectCheck="selectsc"
                        @selection="selectionsc"
                >
                    <template #default="slotProps">
                        <el-button size="small" @click="editsolt(slotProps.scope)">查 看</el-button>
                        <el-button size="small" @click="handleSign(slotProps.scope.row)">复 核</el-button>
                        <!--            <el-button size="small" type="danger" @click="delectsolt(slotProps.scope)"-->
                        <!--              >Delete</el-button>-->
                    </template>
                </tablecmt>
                <!-- <el-table ref="table" v-loading="loading"
                          @selection-change="selectionChange"
                          :data="data"
                          :height="height"
                          style="width: 100%"
                          :border="option.border">
                  <el-table-column type="selection" v-if="option.selection" width="55" align="center"></el-table-column>
                  <el-table-column type="expand" v-if="option.expand" align="center"></el-table-column>
                  <el-table-column v-if="option.index" label="#" type="index" width="50" align="center">
                  </el-table-column>
                  <template v-for="(item,index) in option.column">
                    <el-table-column v-if="item.hide!==true"
                                     :prop="item.prop"
                                     :label="item.label"
                                     :width="item.width"
                                     :key="index">
                    </el-table-column>
                  </template>
                  <el-table-column prop="menu" label="操作" :width="220" align="center">
                    <template #="{row}">
                      <el-button type="primary" text icon="el-icon-view" @click="handleView(row)">查看</el-button>
                      <el-button type="primary" text icon="el-icon-edit" @click="handleEdit(row)">签收</el-button>
                    </template>
                  </el-table-column>
                </el-table> -->
            </el-row>
            <el-row>
                <div class="avue-crud__pagination" style="width: 100%">
                    <!-- 分页模块 -->
                    <el-pagination
                            align="right"
                            background
                            @size-change="sizeChange"
                            @current-change="currentChange"
                            :current-page="page.currentPage"
                            :page-sizes="[10, 20, 30, 40, 50, 100]"
                            :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="45%"
                       append-to-body>
                <avue-form :option="signoption"
                           v-model="signform"
                           :data="signdata"
                           ref="signform"
                >
                </avue-form>
                <div style="bottom: 7%;margin-left: 250px;width: 50%">
                    <div style="width: 100%">
                        <el-button type="primary" @click="submitForm" style="margin-right: 40%">确定</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"
    ></edittablehead>
</template>

<script>
  import {
    getList,
    getDetail,
    add,
    update,
    remove,
    getPage,
    getstatistics
  } 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';

  export default {
    data() {
      return {
        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: '150',
            checkarr: [],
            fixed: false,
            sortable: true,
            head: false
          },
          {
            prop: 'stockArticleId',
            label: '订单自编号',
            type: 2,
            values: '',
            width: '150',
            checkarr: [],
            fixed: false,
            sortable: true,
            head: false
          },
          {
            prop: 'consignee',
            label: '客户名称',
            type: 2,
            values: '',
            width: '150',
            checkarr: [],
            fixed: false,
            sortable: true,
            head: false
          },
          {
            prop: 'deliveryPhone',
            label: '客户电话',
            type: 2,
            values: '',
            width: '180',
            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: '150',
            checkarr: [],
            fixed: false,
            sortable: true,
            head: false,
          },
          {
            prop: 'mallName',
            label: '商城名称',
            type: 2,
            values: '',
            width: '150',
            checkarr: [],
            fixed: false,
            sortable: true,
            head: false
          },
          {
            prop: 'storeName',
            label: '门店名称',
            type: 2,
            values: '',
            width: '150',
            checkarr: [],
            fixed: false,
            sortable: true,
            head: false
          },
          {
            prop: 'deliveryTypeName',
            label: '业务类型',
            type: 3,
            values: '',
            width: '150',
            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: 'deliveryTime',
            label: '装车时间',
            type: 4,
            values: '',
            width: '180',
            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: 1,
            values: '',
            width: '180',
            checkarr: [],
            fixed: false,
            sortable: true
          },
          {
            prop: 'loadedNumber',
            label: '装车件数',
            type: 1,
            values: '',
            width: '180',
            checkarr: [],
            fixed: false,
            sortable: true
          },
          {
            prop: 'receivedQuantity',
            label: '司机签收数',
            type: 1,
            values: '',
            width: '180',
            checkarr: [],
            fixed: false,
            sortable: true
          },
          {
            prop: 'signingStatusAll',
            label: '司机签收状态',
            type: 3,
            values: '',
            width: '150',
            checkarr: [
              {
                value: '2',
                label: '已签收'
              },
              {
                value: '1',
                label: '未签收'
              }
            ],
            fixed: false,
            sortable: true
          },
          {
            prop: '',
            label: '操作',
            type: 6,
            values: '',
            width: '150',
            checkarr: [],
            fixed: 'right',
            hide: true
          }
          // 更多列的配置...
        ],
        // 表单配置
        signoption: {
          height: 'auto',
          width: '40px',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          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: [],
        drawerShow: false,
        height: 0,
        // 弹框标题
        title: '',
        // 是否展示弹框
        box: false,
        // 是否显示查询
        search: true,
        // 加载中
        loading: true,
        // 是否为查看模式
        view: false,
        //签收是否显示
        signBox: false,
        // 签收表单数据
        signform: {},
        // 签收列表
        signdata: [],
        // 查询信息
        query: {},
        // 表单配置
        signoption: {
          height: 'auto',
          width: '40px',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          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: 10,
          total: 40
        },
        // 表单数据
        form: {},
        // 选择行
        selectionList: [],
        // 表单配置
        option: option,
        // 表单列表
        data: []
      };
    },
    mounted() {
      this.queryDictionary();
      this.init();
      /**
       * 初始化获取本地缓存的编辑隐藏的列表
       *  固定搭配，不能更改
       */
      let checkListnewarr = this.$functions.getStorage(window.location.pathname + 'checkList');
      let flexListnewarr = this.$functions.getStorage(window.location.pathname + 'flexList');
      let sortlistnewarr = this.$functions.getStorage(window.location.pathname + 'sortlist');
      if (checkListnewarr) {
        this.columnList.map(item => {
          item.head = false;
        });
        checkListnewarr.map(ite => {
          this.columnList.map(item => {
            if (ite == item.label) {
              item.head = true;
            }
          });
        });
      } else {
        let arr = [];
        this.columnList.map(item => {
          if (item.head) {
            arr.push(item.label);
          }
        });
        this.$functions.setStorage(window.location.pathname + 'checkList', arr);
      }
      if (flexListnewarr) {
        this.columnList.map(item => {
          item.fixed = false;
        });
        flexListnewarr.map(ite => {
          this.columnList.map(item => {
            if (ite == item.label) {
              if (item.type == 6) {
                item.fixed = 'right';
              } else {
                item.fixed = true;
              }
            }
          });
        });
      } else {
        let arr = [];
        this.columnList.map(item => {
          if (item.fixed) {
            arr.push(item.label);
          }
        });
        this.$functions.setStorage(window.location.pathname + 'flexList', arr);
      }
      if (sortlistnewarr) {
        this.columnList.map(item => {
          item.sortable = false;
        });
        sortlistnewarr.map(ite => {
          this.columnList.map(item => {
            if (ite == item.label) {
              item.sortable = true;
            }
          });
        });
      } else {
        let arr = [];
        this.columnList.map(item => {
          if (item.sortable) {
            arr.push(item.label);
          }
        });
        this.$functions.setStorage(window.location.pathname + 'sortlist', arr);
      }
      // 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(',');
      }
    },
    methods: {
      showdrawer(value) {
        this.drawerShow = value;
      },
      /**
       * 弹窗的勾选回调，用于更改头部数组
       * 固定搭配，只需要更换   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);
        }

      },
      //取消
      cancellation() {
        this.signBox = false;
      },
      //签收
      submitForm() {
        // this.isDis = true;
        this.$refs.signform.validate(valid => {
          if (valid) {
            let row = {};
            row.id = this.signform.id;
            row.clerkSignPictures = this.signform.clerkSignPictures;
            row.clerkSignRemarks = this.signform.clerkSignRemarks;
            row.signingStatus = '2';
            //  if (!!row.id){
            updatesign(row).then(() => {
              this.$message({
                type: 'success',
                message: '操作成功!'
              });
              this.signBox = false;
              this.onLoad(this.page);
            }, error => {
              console.log(error);
              this.signBox = false;
            });
          }
        });
      },
      selectionsc(value) {
        console.log(value);
      },
      delectsolt(scope) {
        const { row } = scope;
        console.log(row);
      },
      handleSign(row) {
        console.log('签收>>>>>>>>>>', row);
        // this.title = '查看';
        // this.view = true;
        this.signform = row;
        this.signBox = true;
        //  this.wid= row.id
        // this.getWrapdetails(this.wpage)
      },
      editsolt(scope) {
        const { row } = scope;
        console.log('row>>>>>>>>>>>>>>>>>>>', row);
        console.log(row);
        this.$router.push({
          path: '/distribution/signfor/distributionSignforedt',
          query: {
            id: row.id,
            name: '待签收查看'
          }
        });
      },
      btnsc(index, row) {
        console.log(index, row);
      },
      selectsc(index, row) {
        this.query[row.prop] = index;
        if (!index) {
          delete this.query[row.prop];
        }
        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;
      },
      searchChange() {
        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;
        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;
      },
      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>
