<template>
  <div class="content-main">
    <h2
      style="
        font-weight: 600;
        font-size: 24px;
        text-align: center;
        margin-bottom: 10px;
      "
    >
      <span style="position:relative">
        天津市地储交易统计汇总表
        <span style="position: absolute;top:-4px;left:-160px">
          <el-date-picker
            v-model="searchForm.nd"
            @change="changeNd"
            type="year"
            value-format="yyyy"
            style="width:140px"
            :clearable="false"
            placeholder="选择年">
          </el-date-picker>
        </span>
      </span>
    </h2>
	  <el-tabs v-model="activeName" @tab-click="handletabClick">
		  <el-tab-pane label="交易统计表" name="statistics"></el-tab-pane>
		  <el-tab-pane label="交易汇总表" name="summary"></el-tab-pane>
	  </el-tabs>
    <el-form :inline="true" :model="searchForm" class="search-bm-boder">
      <el-row>
        <el-form-item label="场次:">
          <el-input
            v-model="searchForm.cc"
            clearable
            style="width: 170px"
            placeholder="请输入场次"
          ></el-input>
        </el-form-item>
        <el-form-item label="委托单位:">
          <el-input
            v-model="searchForm.wtf"
            clearable
            style="width: 170px"
            placeholder="请输入委托单位"
          ></el-input>
        </el-form-item>
        <el-form-item label="交易级别:">
          <el-select
            clearable
            v-model="searchForm.jyjb"
            style="width: 150px"
            placeholder="请选择"
          >
            <el-option
              v-for="(item, index) in jyjbList"
              :key="index"
              :label="item.dictName"
              :value="item.dictCode"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="交易类型:">
          <el-select
            clearable
            v-model="searchForm.jylx"
            style="width: 150px"
            placeholder="请选择"
          >
            <el-option
              v-for="(item, index) in statusList"
              :key="index"
              :label="item.dictName"
              :value="item.dictCode"
            ></el-option>
          </el-select>
        </el-form-item>

        <el-form-item>
          <div class="search-button">
            <span class="search-line"></span>
            <div
              class="search-select"
              @click="searchShowMoreBool = !searchShowMoreBool"
            >
              更多条件
              <i class="el-icon-arrow-up" v-show="searchShowMoreBool"></i>
              <i class="el-icon-arrow-down" v-show="!searchShowMoreBool"></i>
            </div>
            <el-button
              type="primary"
              @click="searchInfo"
              size="small"
              class="iconfont iconchaxun"
              >查询</el-button
            >
            <el-button
              type="primary"
              @click="chongzhi"
              size="small"
              class="iconfont iconzhongzhi"
              >重置</el-button
            >
          </div>
        </el-form-item>
      </el-row>
      <el-row v-show="searchShowMoreBool">
        <el-form-item label="交易方式:">
          <el-select
            clearable
            v-model="searchForm.jyfs"
            style="width: 150px"
            placeholder="请选择"
          >
            <el-option
              v-for="(item, index) in jyfsList"
              :key="index"
              :label="item.dictName"
              :value="item.dictCode"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="合同号:" v-if="activeName=='statistics'">
          <el-input
            v-model="searchForm.hth"
            clearable
            style="width: 170px"
            placeholder="请输入合同号"
          ></el-input>
        </el-form-item>
        <el-form-item label="品种:">
          <el-cascader
            style="width:170px"
            :options="pzOptions"
            :props="pzProps"
            :show-all-levels="false"
            v-model="searchForm.pzbm"
            placeholder="请选择"
            clearable
          ></el-cascader>
        </el-form-item>
        <el-form-item label="交易日期:" prop="dateList">
          <el-date-picker
            class="dateInputCompatible"
            clearable
            v-model="searchForm.dateList"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="交易结果:" v-if="activeName=='statistics'">
          <el-select
            clearable
            v-model="searchForm.jyjg"
            style="width: 150px"
            placeholder="请选择"
          >
            <el-option
              v-for="(item, index) in jyjgList"
              :key="index"
              :label="item.dictName"
              :value="item.dictCode"
            ></el-option>
          </el-select>
        </el-form-item>
      </el-row>
    </el-form>
    <el-row  class="exportBtnBg">
      <el-button type="primary" class="iconfont icondaochu11" size="small" @click="handleExport">导出</el-button>
    </el-row>
    <el-table :data="tableData" border stripe tooltip-effect="dark">
      <!-- <el-table-column
        type="index"
        label="序号"
        align="center"
        width="60"
      ></el-table-column> -->
      <el-table-column
        prop="cc"
        label="场次"
        align="center"
        width="120"
        show-overflow-tooltip
      ></el-table-column>
      <el-table-column
        prop="ccbh"
        label="场次编号"
        align="center"
        width="220"
        show-overflow-tooltip
        v-if="activeName=='statistics'"
      ></el-table-column>
      <el-table-column
        prop="jyrq"
        label="交易日期"
        align="center"
        width="120"
        show-overflow-tooltip
      ></el-table-column>
      <el-table-column
        prop="wtf"
        label="委托单位"
        align="center"
        width="200"
        show-overflow-tooltip
      ></el-table-column>
      <el-table-column
        prop="jyjb"
        label="交易级别"
        align="center"
        width="80"
        show-overflow-tooltip
      >
      </el-table-column>
      <el-table-column
        prop="jylxmc"
        label="交易类型"
        align="center"
        width="80"
        show-overflow-tooltip
      >
      </el-table-column>
      <el-table-column
        prop="jyfsmc"
        label="交易方式"
        align="center"
        width="100"
        show-overflow-tooltip
      >
      </el-table-column>
      <el-table-column
        prop="pzmc"
        label="品种"
        align="center"
        width="120"
        show-overflow-tooltip
      ></el-table-column>
      <el-table-column
        prop="bdh"
        label="标的号"
        align="center"
        width="160"
        show-overflow-tooltip
        v-if="activeName=='statistics'"
      ></el-table-column>
      <el-table-column
        prop="hth"
        label="合同号"
        align="center"
        width="160"
        show-overflow-tooltip
        v-if="activeName=='statistics'"
      ></el-table-column>
      <el-table-column
        prop="bdsl"
        label="标的数量(吨)"
        align="center"
        width="120"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          <span v-if="scope.row.bdsl == null"></span>
          <span v-else>{{
            String(scope.row.bdsl).indexOf(".") > -1
              ? Number(scope.row.bdsl).toLocaleString(undefined, {
                  minimumFractionDigits: 3,
                  maximumFractionDigits: 3,
                })
              : Number(scope.row.bdsl).toLocaleString()
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="htsl"
        label="合同数量(吨)"
        align="center"
        width="120"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          <span v-if="scope.row.htsl == null"></span>
          <span v-else>{{
            String(scope.row.htsl).indexOf(".") > -1
              ? Number(scope.row.htsl).toLocaleString(undefined, {
                  minimumFractionDigits: 3,
                  maximumFractionDigits: 3,
                })
              : Number(scope.row.htsl).toLocaleString()
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="lysl"
        label="履约数量(吨)"
        align="center"
        width="120"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          <span v-if="scope.row.lysl == null"></span>
          <span v-else>{{
            String(scope.row.lysl).indexOf(".") > -1
              ? Number(scope.row.lysl).toLocaleString(undefined, {
                  minimumFractionDigits: 3,
                  maximumFractionDigits: 3,
                })
              : Number(scope.row.lysl).toLocaleString()
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="wysl"
        label="违约数量(吨)"
        align="center"
        width="120"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          <span v-if="scope.row.wysl == null"></span>
          <span v-else>{{
            String(scope.row.wysl).indexOf(".") > -1
              ? Number(scope.row.wysl).toLocaleString(undefined, {
                  minimumFractionDigits: 3,
                  maximumFractionDigits: 3,
                })
              : Number(scope.row.wysl).toLocaleString()
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="qpj"
        label="起拍价(元/吨)"
        align="center"
        width="120"
        show-overflow-tooltip
        v-if="activeName=='statistics'"
      >
      </el-table-column>
      <el-table-column
        prop="cjj"
        label="成交价(元/吨)"
        align="center"
        width="120"
        show-overflow-tooltip
        v-if="activeName=='statistics'"
      >
      </el-table-column>
      <el-table-column
        prop="jyjg"
        label="交易结果"
        align="center"
        width="80"
        show-overflow-tooltip
        v-if="activeName=='statistics'"
      >
      </el-table-column>
      <el-table-column
        prop="cjkh"
        label="成交客户"
        align="center"
        width="200"
        show-overflow-tooltip
        v-if="activeName=='statistics'"
      >
      </el-table-column>
      <el-table-column
        prop="ccdw"
        label="承储单位"
        align="center"
        width="200"
        show-overflow-tooltip
        v-if="activeName=='statistics'"
      >
      </el-table-column>
      <el-table-column
        prop="ch"
        label="仓号"
        align="center"
        width="100"
        v-if="activeName=='statistics'"
      >
      </el-table-column>
      <el-table-column
        prop="htje"
        label="合同金额(元)"
        align="center"
        width="120"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          <span v-if="scope.row.htje == null"></span>
          <span v-else>{{
            String(scope.row.htje).indexOf(".") > -1
              ? Number(scope.row.htje).toLocaleString(undefined, {
                  minimumFractionDigits: 2,
                  maximumFractionDigits: 2,
                })
              : Number(scope.row.htje).toLocaleString()
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="lyje"
        label="履约金额(元)"
        align="center"
        width="120"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          <span v-if="scope.row.lyje == null"></span>
          <span v-else>{{
            String(scope.row.lyje).indexOf(".") > -1
              ? Number(scope.row.lyje).toLocaleString(undefined, {
                  minimumFractionDigits: 2,
                  maximumFractionDigits: 2,
                })
              : Number(scope.row.lyje).toLocaleString()
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="wtfsxfl"
        label="委托方手续费率"
        align="center"
        width="120"
        show-overflow-tooltip
        v-if="activeName=='statistics'"
      >
      </el-table-column>
      <el-table-column
        prop="khsxfl"
        label="客户手续费率"
        align="center"
        width="120"
        show-overflow-tooltip
        v-if="activeName=='statistics'"
      >
      </el-table-column>
      <el-table-column
        prop="sxfje"
        label="手续费金额(元)"
        align="center"
        width="120"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          <span v-if="scope.row.sxfje == null"></span>
          <span v-else>{{
            String(scope.row.sxfje).indexOf(".") > -1
              ? Number(scope.row.sxfje).toLocaleString(undefined, {
                  minimumFractionDigits: 2,
                  maximumFractionDigits: 2,
                })
              : Number(scope.row.sxfje).toLocaleString()
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="lybzj"
        label="履约保证金(元/吨)"
        align="center"
        width="120"
        show-overflow-tooltip
        v-if="activeName=='statistics'"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.lybzj == null"></span>
          <span v-else>{{
            String(scope.row.lybzj).indexOf(".") > -1
              ? Number(scope.row.lybzj).toLocaleString(undefined, {
                  minimumFractionDigits: 2,
                  maximumFractionDigits: 2,
                })
              : Number(scope.row.lybzj).toLocaleString()
          }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="jybzj"
        label="交易保证金(元/吨)"
        align="center"
        width="120"
        show-overflow-tooltip
        v-if="activeName=='statistics'"
      >
        <template slot-scope="scope">
          <span v-if="scope.row.jybzj == null"></span>
          <span v-else>{{
            String(scope.row.jybzj).indexOf(".") > -1
              ? Number(scope.row.jybzj).toLocaleString(undefined, {
                  minimumFractionDigits: 2,
                  maximumFractionDigits: 2,
                })
              : Number(scope.row.jybzj).toLocaleString()
          }}</span>
        </template>
      </el-table-column>

      <el-table-column align="center" label="说明编辑" width="100px" v-if="activeName=='statistics'">
        <template slot-scope="scope">
          <el-tooltip
            class="item"
            effect="light"
            content="查看"
            placement="top"
            v-if="scope.row.dcjybzxx"
          >
            <el-button
              type="primary"
              size="small"
              @click="showInfo(scope.row)"
              class="operate_show_btn iconfont iconchakan2"
            ></el-button>
          </el-tooltip>
          <el-tooltip
            class="item"
            effect="light"
            content="编辑"
            placement="top"
          >
            <el-button
              type="primary"
              size="small"
              @click="editInfo(scope.row)"
              class="operate_show_btn iconfont iconxiugai"
            ></el-button>
          </el-tooltip>
        </template>
      </el-table-column>
    </el-table>
    <el-row class="pagination-wrap">
      <el-pagination
        @current-change="handleCurrentChange"
        @size-change="handleSizeChange"
        :current-page="pageForm.pageNum"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="pageForm.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="pageForm.total"
      ></el-pagination>
    </el-row>
  <el-dialog title="说明编辑" :visible.sync="dialogVisible" width="680px" top="20vh" :close-on-click-modal="false">
    <el-row style="height:30px">
      <span>特殊备注：</span>
    </el-row>
    <el-row style="margin-bottom: 10px">
      <el-input
        type="textarea"
        :disabled="isShow"
        :rows="3"
        placeholder="请输入备注"
        v-model="dialogData.tsbz">
      </el-input>
    </el-row>
    <el-row style="height:30px">
      <span>原因：</span>
    </el-row>
    <el-row style="margin-bottom: 20px">
      <el-input
        type="textarea"
        :disabled="isShow"
        :rows="3"
        placeholder="请输入原因"
        v-model="dialogData.yy">
      </el-input>
    </el-row>
    <el-row style="height:50px">
      <el-col :span="12">
        <span>登记人:</span>
        <el-input
          v-model="dialogData.bjr"
          :disabled="isShow"
          clearable
          style="width: 220px"
          placeholder="请输入登记人"
        ></el-input>
      </el-col>
      <el-col :span="12">
        <span>登记日期:</span>
        <el-date-picker
          class="input-width"
          v-model="dialogData.bjrq"
          :disabled="isShow"
          type="date"
          clearable
          value-format="yyyy-MM-dd"
          format="yyyy-MM-dd"
          placeholder="选择日期"
        ></el-date-picker>
      </el-col>
    </el-row>
    <el-row style="text-align: center; margin-top: 20px">
      <el-button
        class="iconfont iconbaocun"
        type="primary"
        @click="handleSave()"
        v-if="!isShow"
        >保存</el-button
      >
      <el-button
        class="iconfont iconfanhui"
        type="primary"
        @click="dialogVisible = false"
        >返回</el-button
      >
    </el-row>
  </el-dialog>
  </div>
</template>

<script>
import {
  statisticalList,
  selectDcjyhzPage,
  dcjlExport,
  dcjyhzExport,
  saveMsg,
} from "@/api/transaction/statisticalReport/transactionStatisticsSummary/index";
import { getPzOptions } from "@/api/transaction/tradeEntrust/outInDepotEntrust/index.js";
// 引入导出Excel表格依赖
import FileSaver from "file-saver";
import XLSX from "xlsx";
import { getNowDate } from "@/utils";
export default {
  data() {
    return {
      pzProps: {
        label: "dictName",
        value: "dictCode",
        children: "subDataDictionarys",
        emitPath: false,
      },
      pzOptions: [],

      searchShowMoreBool: false,
      statusList: [
        {
          dictCode: "0",
          dictName: "采购",
        },
        {
          dictCode: "1",
          dictName: "销售",
        },
      ], //引用json状态
      jyfsList: [
        {
          dictCode: "0",
          dictName: "竞价",
        },
        {
          dictCode: "1",
          dictName: "挂牌",
        },
        {
          dictCode: "2",
          dictName: "购销双向",
        },
      ],
      jyjbList: [
        {
          dictCode: "1",
          dictName: "市储",
        },
        {
          dictCode: "2",
          dictName: "区储",
        },
        {
          dictCode: "3",
          dictName: "市自",
        },
      ],
      jyjgList: [
        {
          dictCode: "1",
          dictName: "流拍",
        },
        {
          dictCode: "2",
          dictName: "成交",
        },
        {
          dictCode: "3",
          dictName: "待维护",
        },
      ],
      tableData: [],
      listLoading: true,
      searchForm: {
        nd: new Date().getFullYear()+'',
        cc: "",
        jyjb: "",
        jylx: "",
        jyfs: "",
        jyjg: "",
        hth: "",
        pzbm: "",
        dateList: [],
      },
      pageForm: {
        pageNum: 1,
        pageSize: 10,
        total: 1,
      },
      buttonNameList: [],

	    activeName:"statistics",//统计表、汇总表
      dialogVisible: false,
      dialogData: {
        tsbz: "",
        yy: "",
        bjr: "",
        bjrq: "",
      },
      isShow:false,
    };
  },
  beforeCreate() {
    getPzOptions(11).then((res) => {
      this.pzOptions = res.data;
    });
  },
  created() {
    // this.getresourceCode();
    this.getCcList("start");
  },
  methods: {
    /* getresourceCode() {
      let codeData = {
        resourceCode: sessionStorage.getItem("resourceCode"),
        userId: sessionStorage.getItem("userCode"),
      };
      authorityControl(codeData).then((res) => {
        this.buttonNameList = [];
        res.data.forEach((item) => {
          this.buttonNameList.push(item.resourceName);
        });
        this.getCcList("start");
      });
    }, */
    getCcList(type) {
      // pageType 1 场次  2：底价
      let { pageNum, pageSize } = this.pageForm;
      for (var key in this.searchForm) {
        if (this.searchForm[key] === "") this.searchForm[key] = null;
        if (typeof this.searchForm[key] === "string")
          this.searchForm[key] = this.searchForm[key].trim();
      }
      if (type != "start") {
        //非初始化调用：查询、分页
        sessionStorage.setItem("searchData", JSON.stringify(this.searchForm));
        sessionStorage.setItem("pageData", JSON.stringify(this.pageForm));
      } else {
        //初始化分两种情况，详情页等返回后的初始化，以及第一次进入此菜单的初始化
        if (JSON.parse(sessionStorage.getItem("searchData"))) {
          //详情页返回后，将对应查询条件和分页的字段赋值，页面回显参数
          this.searchForm = JSON.parse(sessionStorage.getItem("searchData"));
          this.pageForm = JSON.parse(sessionStorage.getItem("pageData"));
        } else {
          //第一次进去此菜单时，保存上方默认的data
          sessionStorage.setItem("searchData", JSON.stringify(this.searchForm));
          sessionStorage.setItem("pageData", JSON.stringify(this.pageForm));
        }
      }
      let data = {
        ...this.searchForm,
        ...this.pageForm,
      };
      if (this.searchForm.dateList) {
        data.jyrqStart = this.searchForm.dateList[0]
        data.jyrqEnd = this.searchForm.dateList[1]
      }else{
        data.jyrqStart = null
        data.jyrqEnd = null
      }
      if (this.activeName == "statistics") {
        statisticalList(data)
          .then((res) => {
            if (res.infoCode == 200) {
              this.tableData = res.data.items || [];
              this.pageForm.total = res.data.total;
            }
          })
          .catch((err) => {
            console.log(err);
          });
      }else{
        selectDcjyhzPage(data)
          .then((res) => {
            if (res.infoCode == 200) {
              this.tableData = res.data.items || [];
              this.pageForm.total = res.data.total;
            }
          })
          .catch((err) => {
            console.log(err);
          });
      }
    },

    chongzhi() {
      this.searchForm = {
        cc: "",
        jyjb: "",
        jylx: "",
        jyfs: "",
        hth: "",
        pzbm: "",
        dateList: [],
      };
      // this.searchForm.nd = new Date().getFullYear()
      this.$set(this.searchForm, "nd", new Date().getFullYear()+'');
      this.pageForm.pageNum = 1;
      this.getCcList();
    },

    //点击搜索时
    searchInfo() {
      this.pageForm.pageNum = 1;
      this.getCcList();
    },
    //点击查看
    showInfo(row) {
      this.isShow = true
      this.dialogVisible = true
      this.dialogData.tsbz = row.dcjybzxx.tsbz
      this.dialogData.yy = row.dcjybzxx.yy
      this.dialogData.bjr = row.dcjybzxx.bjr
      this.dialogData.bjrq = row.dcjybzxx.bjrq
    },
    //点击编辑
    editInfo(row) {
      this.isShow = false
      this.dialogVisible = true
      this.dialogData.bdh = row.bdh
      this.dialogData.htbh = row.hth
      if (row.dcjybzxx) {
        this.dialogData.tsbz = row.dcjybzxx.tsbz
        this.dialogData.yy = row.dcjybzxx.yy
        this.dialogData.bjr = row.dcjybzxx.bjr
        this.dialogData.bjrq = row.dcjybzxx.bjrq
        this.dialogData.id = row.dcjybzxx.id
      }else{
        this.dialogData.tsbz = ""
        this.dialogData.yy = ""
        this.dialogData.bjrq = getNowDate()
        this.dialogData.bjr = sessionStorage.getItem("userName")
      }
    },
    //保存
    handleSave() {
      let data = {
        ...this.dialogData,
      }
      saveMsg(data)
        .then((res) => {
          if (res.infoCode == 200) {
            this.$message.success("保存成功");
            this.dialogVisible = false
            this.getCcList();
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    // showInfo(row, type) {
    //   console.log(type, "type");
    //   this.$router.push({
    //     path: "/transaction/fieldPlan/detail",
    //     query: {
    //       ccbm: row.ccbm,
    //       data: row,
    //       type: "show",
    //     },
    //   });
    // },
    //导出
    handleExport(row) {
      let data = {
        ...this.searchForm,
        ...this.pageForm,
      };
      if (this.searchForm.dateList) {
        data.jyrqStart = this.searchForm.dateList[0]
        data.jyrqEnd = this.searchForm.dateList[1]
      }else{
        data.jyrqStart = null
        data.jyrqEnd = null
      }
      if (this.activeName == "statistics") {
        dcjlExport(data)
          .then((res) => {
            let exportName = "交易统计表.xlsx";
            let blob = new Blob([res], { type: "application/vnd.ms-excel;charset=utf-8" });
            if (!!window.ActiveXObject || "ActiveXObject" in window) {
              window.navigator.msSaveOrOpenBlob(blob, exportName);
            } else {
              const link = document.createElement("a");
              link.style.display = "none";
              link.href = URL.createObjectURL(blob);
              link.setAttribute("download", exportName);
              document.body.appendChild(link);
              link.click();
              document.body.removeChild(link);
            }
          })
          .catch();
      }else{
        dcjyhzExport(data)
          .then((res) => {
            let exportName = "交易汇总表.xlsx";
            let blob = new Blob([res], { type: "application/vnd.ms-excel;charset=utf-8" });
            if (!!window.ActiveXObject || "ActiveXObject" in window) {
              window.navigator.msSaveOrOpenBlob(blob, exportName);
            } else {
              const link = document.createElement("a");
              link.style.display = "none";
              link.href = URL.createObjectURL(blob);
              link.setAttribute("download", exportName);
              document.body.appendChild(link);
              link.click();
              document.body.removeChild(link);
            }
          })
          .catch();
      }
    },

    //分页
    handleSizeChange(val) {
      this.pageForm.pageSize = val;
      this.getCcList();
    },
    handleCurrentChange(val) {
      this.pageForm.pageNum = val;
      this.getCcList();
    },
    //定义导出Excel表格事件
    exportExcel() {
      /* 从表生成工作簿对象 */
      var wb = XLSX.utils.table_to_book(document.querySelector("#out-table"));
      /* 获取二进制字符串作为输出 */
      var wbout = XLSX.write(wb, {
        bookType: "xlsx",
        bookSST: true,
        type: "array",
      });
      try {
        FileSaver.saveAs(
          //Blob 对象表示一个不可变、原始数据的类文件对象。
          //Blob 表示的不一定是JavaScript原生格式的数据。
          //File 接口基于Blob，继承了 blob 的功能并将其扩展使其支持用户系统上的文件。
          //返回一个新创建的 Blob 对象，其内容由参数中给定的数组串联组成。
          new Blob([wbout], { type: "application/octet-stream" }),
          //设置导出文件名称
          "sheetjs.xlsx"
        );
      } catch (e) {
        if (typeof console !== "undefined") console.log(e, wbout);
      }
      return wbout;
    },
	  handletabClick(tab,event){
	    this.searchForm = { 
        cc: "",
        jyjb: "",
        jylx: "",
        jyfs: "",
        hth: "",
        pzbm: "",
        dateList: [],
      };
      this.$set(this.searchForm, "nd", new Date().getFullYear()+'');
	  	this.pageForm= {
	  		pageNum: 1,
	  		pageSize: 10,
	  	},
	    this.activeName=tab.name
	    this.searchShowMoreBool = false
	    this.getCcList()
	  },
	  changeNd(val){
      this.pageForm.pageNum = 1;
      this.getCcList();
	  },
  },
};
</script>

<style lang="scss" scoped>
.pagination-wrap {
  text-align: right;
  margin-top: 10px;
}

/* .input-w-220 {
  width: 220px;
} */
.iconfont {
  font-size: 13px;
}

/* .iconfont {
  color: white;
} */
#out-table {
  border: 2px solid black;
}
#khxx_icon {
  padding: 0 5px !important;
  height: 26px !important;
  background: #169bd5 !important;
  
}
</style>
