<template>
  <div class="main flex-column clearfix">
    <div
      class="flex-1 flex flex-column padding-10 overflow-auto"
      style="width: 100%; position: relative"
    >
      <div class="margin-bt-10 white flexboc">
        <div class="flexb">
          <el-radio-group
            v-model="dayType"
            size="medium"
            @change="dayTypeChange"
            style="margin-right: 10px;width: 297px;"
          >
            <el-radio-button label="DAY">日</el-radio-button>
            <el-radio-button label="MONTH">月</el-radio-button>
            <el-radio-button label="QUARTER">季</el-radio-button>
            <el-radio-button label="YEAR">年</el-radio-button>
          </el-radio-group>
          <el-date-picker
            v-if="dayType == 'DAY'"
            v-model="dayValue"
            value-format="YYYY-MM-DD"
            style="width: 270px"
            type="daterange"
            unlink-panels
            range-separator="至"
            start-placeholder="开始时间"
            end-placeholder="结束时间"
            @change="dayChange"
          />
          <el-date-picker
            v-else
            v-model="dayValue"
            :value-format="formatValue"
            style="width: 270px"
            :type="TypeValue"
            range-separator="至"
            start-placeholder="开始时间"
            end-placeholder="结束时间"
            @change="dayChange"
          />
          <el-select
            v-if="dayType === 'QUARTER'"
            v-model="listQuery.quarter"
            @change="quarterChange"
          >
            <el-option
              v-for="item in quarterList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
          <el-button
            style="margin: 0 10px"
            type="info"
            @click="reset()"
          >
            重置
          </el-button>
          <!-- <CheckBox :data="resource.checkItem" @changeData="changeDataItem"></CheckBox> -->
        </div>
        <div>
          <el-button
            style="margin-left: 10px"
            type="info"
            @click="exportExcel"
          >导出</el-button>
          <el-button
            style="margin-left: 10px"
            type="info"
            @click="exportExcelXq"
          >导出详情</el-button>
        </div>
      </div>
      <div
        style="position: absolute; width: 100%"
        :style="{ height: tableHeight + 'px' }"
      >
        <el-table
          ref="table"
          :data="tableData"
          v-loading="loading"
          border
          height="100%"
          class="table flex-1 flex-auto overflow-auto"
          row-class-name="table-row"
          cell-class-name="table-cell"
          header-row-class-name="table-header-row"
          header-cell-class-name="table-header-cell"
          style="width: 100%"
          @cell-click="cellClick"
        >
          <el-table-column
            width="350"
            label="单位名称"
            show-overflow-tooltip
            prop="ssbm"
          >
          </el-table-column>
          <el-table-column
            label="报备率"
            align="center"
            prop="bbl"
          >
            <el-table-column
              prop="ybb"
              label="应报备"
              align="center"
            />
            <el-table-column
              prop="sjbb"
              label="已报备"
              align="center"
            />
            <el-table-column
              label="未报备"
              align="center"
              prop="wbb"
            />
            <el-table-column
              label="比例"
              align="center"
              prop="bbbl"
              width="100"
            >
              <template #default="{ row }">
                <p v-if="row.ybb">{{ ((Number(row.sjbb) / Number(row.ybb)) * 100).toFixed(2) }}%</p>
                <p v-else>0%</p>
              </template>
            </el-table-column>
            <el-table-column
              label="报备扣分"
              align="center"
              prop="bbkf"
              width="120"
            />
            <!-- <el-table-column label="报备得分" align="center" prop="bbf" width="120"/> -->
          </el-table-column>

          <el-table-column
            label="重点区域巡逻率"
            align="center"
            prop="xll"
          >
            <el-table-column
              prop="yxl"
              label="应巡逻"
              align="center"
            />
            <el-table-column
              width="90px"
              prop="zsxl"
              label="最少巡逻"
              align="center"
            />
            <el-table-column
              prop="sjxl"
              label="已巡逻"
              align="center"
            />
            <el-table-column
              prop="wxl"
              label="未巡逻"
              align="center"
            />
            <el-table-column
              prop="xlbl"
              label="巡逻比例"
              align="center"
              width="100"
            >
              <template #default="{ row }">
                <p v-if="row.yxl">{{ ((Number(row.sjxl) / Number(row.yxl)) * 100).toFixed(2) }}%</p>
                <p v-else>0%</p>
              </template>
            </el-table-column>
            <!-- <el-table-column prop="xlf" label="巡逻得分" align="center" width="120"/> -->
            <!-- <el-table-column
              prop="xlkf"
              label="巡逻扣分"
              align="center"
              width="120"
            /> -->
          </el-table-column>

          <el-table-column
            label="巡逻时长率"
            align="center"
            prop="xlscl"
          >
            <el-table-column
              prop="yxlsc"
              label="应巡时长"
              align="center"
              width="120"
            />
            <el-table-column
              prop="sjxlsc"
              label="已巡时长"
              align="center"
              width="120"
            />
            <el-table-column
              prop="wxlsc"
              label="未巡时长"
              align="center"
              width="120"
            />
            <el-table-column
              prop="xlscbl"
              label="巡逻时长比例"
              align="center"
              width="120"
            >
              <template #default="{ row }">
                <p v-if="row.yxlsc">{{((Number(row.sjxlsc) / Number(row.yxlsc)) * 100).toFixed(2)}}%</p>
                <p v-else>0%</p>
              </template>
            </el-table-column>
            <!-- <el-table-column prop="xlscf" label="巡逻时长得分" align="center" width="120"/> -->
            <!-- <el-table-column
              prop="xlsckf"
              label="巡逻时长扣分"
              align="center"
              width="120"
            /> -->
          </el-table-column>

          <el-table-column
            label="巡逻里程率"
            align="center"
          >
            <el-table-column
              prop="yxllc"
              label="应巡里程"
              align="center"
              width="120"
            />
            <el-table-column
              prop="sjxllc"
              label="已巡里程"
              align="center"
              width="120"
            />
            <el-table-column
              prop="wxllc"
              label="未巡里程"
              align="center"
              width="120"
            />
            <el-table-column
              label="巡逻里程比例"
              align="center"
              prop="xllcbl"
              width="120"
            >
              <template #default="{ row }">
                <p v-if="row.yxllc">{{((Number(row.sjxllc) / Number(row.yxllc)) * 100).toFixed(2)}}%</p>
                <p v-else>0%</p>
              </template>
            </el-table-column>
            <!-- <el-table-column prop="xllcf" label="巡逻里程得分" align="center" width="120"/> -->
            <!-- <el-table-column
              prop="xllckf"
              label="巡逻里程扣分"
              align="center"
              width="120"
            /> -->
          </el-table-column>

          <!-- <el-table-column label="盘查人" align="center" prop="pcl">
            <el-table-column prop="ycr" label="应盘人" align="center" />
            <el-table-column prop="sjcr" label="已盘人" align="center" />
            <el-table-column prop="wcr" label="未盘人" align="center" />
            <el-table-column prop="pcrbl" label="盘人比例" align="center" width="100">
              <template #default="{ row }">
                <p v-if="row.ycr">{{ ((Number(row.sjcr) / Number(row.ycr)) * 100).toFixed(2) }}%</p>
                <p v-else>0%</p>
              </template>
            </el-table-column>
            <el-table-column prop="crf" label="盘人得分" align="center" width="120" />
          </el-table-column>

          <el-table-column label="盘查车" align="center" prop="pcl">
            <el-table-column prop="ycc" label="应盘车" align="center" />
            <el-table-column prop="sjcc" label="已盘车" align="center" />
            <el-table-column prop="wcc" label="未盘车" align="center" />
            <el-table-column prop="pccbl" label="盘车比例" align="center" width="100">
              <template #default="{ row }">
                <p v-if="row.ycc">{{ ((Number(row.sjcc) / Number(row.ycc)) * 100).toFixed(2) }}%</p>
                <p v-else>0%</p>
              </template>
            </el-table-column>
            <el-table-column prop="ccf" label="盘车得分" align="center"  width="120"/>
          </el-table-column>

          <el-table-column label="盘查物品" align="center" prop="pcl">
            <el-table-column prop="ycw" label="应盘物" align="center" width="120"/>
            <el-table-column prop="sjcw" label="已盘物" align="center" width="120" />
            <el-table-column prop="wcw" label="未盘物" align="center" width="120" />
            <el-table-column label="盘物比例" align="center" prop="wbbl" width="100">
              <template #default="{ row }">
                <p v-if="row.ycw">{{ ((Number(row.sjcw) / Number(row.ycw)) * 100).toFixed(2) }}%</p>
                <p v-else>0%</p>
              </template>
            </el-table-column>
            <el-table-column prop="cwf" label="盘物得分" align="center" width="120" />
          </el-table-column>

          <el-table-column label="签收率" align="center" prop="qsl">
            <el-table-column prop="yqs" label="应签收" align="center" />
            <el-table-column prop="sjqs" label="已签收" align="center" />
            <el-table-column label="未签收" align="center" prop="wqs">
              <template #default="{ row }">  <p>{{ row.wqs < 0 ? 0 : row.wqs }}</p> </template>
            </el-table-column>
            <el-table-column label="比例" align="center" prop="qsbl" width="100">
              <template #default="{ row }">
                <p v-if="row.yqs">{{ ((Number(row.sjqs) / Number(row.yqs)) * 100).toFixed(2) }}%</p>
                <p v-else>0%</p>
              </template>
            </el-table-column>
            <el-table-column prop="qsf" label="签收得分" align="center" width="120"/>
          </el-table-column> -->
          <el-table-column
            label="三项扣分"
            align="center"
            prop="sxkf"
            width="100"
          />

          <el-table-column
            label="三项得分"
            align="center"
            prop="total"
            width="100"
          />

        </el-table>
      </div>
      <div class="fenye">
        <el-pagination
          class="pagination"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="listQuery.pageCurrent"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="listQuery.pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        ></el-pagination>
      </div>
    </div>

    <el-dialog
      v-model="bblPopVisible"
      width="90%"
      v-if="bblPopVisible"
    >
      <BblComp
        :childTitle="childTitle"
        :ssbmdm="ssbmdm"
        :searchType="searchType"
      />
    </el-dialog>
    <el-dialog
      v-model="qslPopVisible"
      width="90%"
      v-if="qslPopVisible"
    >
      <QslComp
        :childTitle="childTitle"
        :ssbmdm="ssbmdm"
        :searchType="searchType"
      />
    </el-dialog>
    <el-dialog
      v-model="chlPopVisible"
      width="90%"
      v-if="chlPopVisible"
    >
      <ChlComp
        :childTitle="childTitle"
        :ssbmdm="ssbmdm"
        :searchType="searchType"
      />
    </el-dialog>
    <!-- 盘查人 -->
    <el-dialog
      :title="dialogTitle"
      v-model="pcrPopVisible"
      width="90%"
      v-if="pcrPopVisible"
    >
      <PrlComp
        v-if="searchType == '04'"
        :childTitle="childTitle"
        :ssbmdm="ssbmdm"
        :searchType="searchType"
      />
      <PclComp
        v-if="searchType == '05'"
        :childTitle="childTitle"
        :ssbmdm="ssbmdm"
        :searchType="searchType"
      />
      <SclComp
        v-if="searchType == '06'"
        :childTitle="childTitle"
        :ssbmdm="ssbmdm"
        :searchType="searchType"
      />
      <LclComp
        v-if="searchType == '07'"
        :childTitle="childTitle"
        :ssbmdm="ssbmdm"
        :searchType="searchType"
      />
    </el-dialog>
  </div>
</template>

<script setup>
import * as XLSX from "xlsx";
import CheckBox from "@/components/checkBox/index";
import { getItem } from "@/utils/storage";
import { timeValidate } from "@/utils/tools";
import { qcckGet, qcckPost } from "@/api/qcckApi.js";
import eventBus from "@/utils/eventBus";
import { parseTime, timestampToStr } from "@/utils/index";
import { download } from "@/utils/request";
import { ZHJMXF_URL, ASSESS_SCORE_URL } from "@/settings";
import { defineProps, watch, ref, onMounted, nextTick } from "vue";
import { JXgetPageList, exportJxkh } from "@/api/performance";
// import { api } from "@/api/main";
import BblComp from "./componets/bbl-comp";
import QslComp from "./componets/qsl-comp";
import ChlComp from "./componets/chl-comp";
import PrlComp from "./componets/pr-comp";
import PclComp from "./componets/pc-comp";
import SclComp from "./componets/sc-comp";
import LclComp from "./componets/lc-comp";
const tableHeight = ref(); // 表格高度
let resource = ref({
  checkItem: {
    // list: ["报备率", "重点区域巡逻率", "巡逻时长率",'巡逻里程率','盘查人','盘查车','盘查物品','签收率'],
    // hasChoose: ["报备率", "重点区域巡逻率", "巡逻时长率",'巡逻里程率']
    list: [],
    hasChoose: []
  }
});

onMounted(() => {
  formatValue.value = "YYYY-MM-DD";
  getDay();
  getTableList();
  tabHeightFn();
  window.onresize = function () {
    tabHeightFn();
  };
});

const ssbmdm = ref(""); //给子弹窗传的ssbmdm
const searchType = ref(""); //给子弹窗传的searchType
const pickerOptions = ref({
  disabledDate(time) {
    return time.getItem > Date.now() - 8.64e6;
  }
});
const dialogTitle = ref("");
const listQuery = ref({
  pageCurrent: 1,
  pageSize: 20,
  type: "01",
  searchType: "",
  kssj: "",
  jssj: "",
  month: "",
  quarter: "",
  year: "",
  ssbmdm: "",
  cxcj: "01"
});
const userInfo = ref(JSON.parse(localStorage.getItem("userInfo")));
const btnVisibe = ref(false);
const rate = ref({});
const liData = ref({});
const loading = ref(false);
const bblPopVisible = ref(false);
const qslPopVisible = ref(false);
const chlPopVisible = ref(false);
const pcrPopVisible = ref(false); //盘查人
const loading2 = ref(false);
const searchDay = ref("");
const dayTypeValue = ref("01");
const dayType = ref("DAY");
const list = ref([]);
const list2 = ref([]);
const tableData = ref([]);
const total = ref(0);
const childTitle = ref(""); //弹窗表格的title
const dateList = ref("");
const TypeValue = ref("daterange");
const formatValue = ref("");
const dayValue = ref(""); //日期的v-model
const quarterList = ref([
  {
    value: "01",
    label: "1季度"
  },
  {
    value: "02",
    label: "2季度"
  },
  {
    value: "03",
    label: "3季度"
  },
  {
    value: "04",
    label: "4季度"
  }
]);
// 顶部年月日切换
const dayTypeChange = (val) => {
  dayType.value = val;
  searchDay.value = "";
  listQuery.value.quarter = "";
  listQuery.value.kssj = "";
  listQuery.value.jssj = "";
  listQuery.value.month = "";
  listQuery.value.year = "";
  switch (val) {
    case "YEAR":
      handleDate("04", "year", "YYYY");
      dayValue.value = "";
      const d = new Date();
      dayTypeValue.value = d.getFullYear();
      break;
    case "QUARTER":
      handleDate("03", "year", "YYYY");
      dayValue.value = "";
      break;
    case "MONTH":
      handleDate("02", "month", "YYYY-MM");
      dayValue.value = "";
      getMonth();
      break;
    case "DAY":
      listQuery.value.type = "01";
      getDay();
      break;
  }
};

// 算汇总率
const changeDataItem = (val) => {
  resource.value.checkItem.hasChoose = val;
  tableData.value.forEach((item) => {
    let hz_bbl = val.includes("报备率") ? item.bbf : 0;
    let hz_zdqyxll = val.includes("重点区域巡逻率") ? item.xlf : 0;
    let hz_xlscl = val.includes("巡逻时长率") ? item.xlscf : 0;
    let hz_xllcl = val.includes("巡逻里程率") ? item.xllcf : 0;
    let hz_pcr = val.includes("盘查人") ? item.crf : 0;
    let hz_pcc = val.includes("盘查车") ? item.ccf : 0;
    let hz_pcwp = val.includes("盘查物品") ? item.cwf : 0;
    let hz_qsl = val.includes("签收率") ? item.qsf : 0;
    let sxkf = item.sxkf || 0;

    let numz = 10 - sxkf.toFixed(2);
    item.total = numz < 0 ? 0 : numz;
    item.wxl = item.wxl < 0 ? 0 : item.wxl;
    item.wbb = item.wbb < 0 ? 0 : item.wbb;
    item.hz =
      Number(hz_bbl) +
      Number(hz_qsl) +
      Number(hz_pcwp) +
      Number(hz_zdqyxll) +
      Number(hz_xlscl) +
      Number(hz_xllcl) +
      Number(hz_pcr) +
      Number(hz_pcc);
  });
};
// 点击年月日切换
const handleDate = (type, val, format) => {
  listQuery.value.type = type;
  TypeValue.value = val;
  formatValue.value = format;
};
const quarterChange = (val) => {
  listQuery.value.quarter = val;
  if (dayType.value == "QUARTER" && listQuery.value.year) {
    getTableList(true);
  }
};
// 切换天
const dayChange = (val) => {
  if (typeof val == "string") {
    if (dayType.value == "QUARTER" || dayType.value == "YEAR") {
      listQuery.value.year = val;
      if (dayType.value == "QUARTER" && listQuery.value.quarter) {
        getTableList(true);
      }
      if (dayType.value == "YEAR") {
        getTableList(true);
      }
    } else {
      listQuery.value.month = val;
      getTableList(true);
    }
    listQuery.value.kssj = "";
    listQuery.value.jssj = "";
  } else {
    listQuery.value.kssj = dayValue.value[0];
    listQuery.value.jssj = dayValue.value[1];
    getTableList(true);
  }
};

// 表格高度计算
const tabHeightFn = () => {
  tableHeight.value = window.innerHeight - 180;
};

// 导出
function exportExcel() {
  const headers = [
    "单位名称",
    "应报备",
    "已报备",
    "未报备",
    "比例",
    "报备扣分",
    "应巡逻",
    "最少巡逻",
    "已巡逻",
    "实际巡逻",
    "未巡逻",
    "巡逻比例",
    // "巡逻扣分",
    "应巡时长",
    "已巡时长",
    "未巡时长",
    "巡逻时长比例",
    // "巡逻时长扣分",
    "应巡里程",
    "已巡里程",
    "未巡里程",
    "巡逻里程比例",
    // "巡逻里程扣分",
    "三项扣分",
    "三项得分"
  ];
  const data = tableData.value.map((item) => [
    item.ssbm,
    item.ybb,
    item.sjbb,
    item.wbb,
    ((Number(item.sjbb) / Number(item.ybb)) * 100).toFixed(2) + "%",
    item.bbkf,
    item.yxl,
    item.zsxl,
    item.zsxl,
    item.sjxl,
    item.wxl,
    ((Number(item.sjxl) / Number(item.zsxl)) * 100).toFixed(2) + "%",
    // item.xlkf,
    item.yxlsc,
    item.sjxlsc,
    item.wxlsc,
    ((Number(item.sjxlsc) / Number(item.yxlsc)) * 100).toFixed(2) + "%",
    // item.xlsckf,
    item.yxllc,
    item.sjxllc,
    item.wxllc,
    ((Number(item.sjxllc) / Number(item.yxllc)) * 100).toFixed(2) + "%",
    // item.xllckf,
    item.sxkf,
    item.total
  ]);
  const worksheet = XLSX.utils.aoa_to_sheet([headers, ...data]);
  const workbook = XLSX.utils.book_new();
  XLSX.utils.book_append_sheet(workbook, worksheet, "sheet1");
  XLSX.writeFile(workbook, "绩效考核.xlsx");
  // download( "/mosty-api/mosty-jcgl/khtj/export",listQuery.value, `绩效考核_${new Date().getTime()}.xlsx`);
}

function exportExcelXq() {
  download(
    "/mosty-api/mosty-jcgl/khtj/export",
    listQuery.value,
    `绩效考核_${new Date().getTime()}.xlsx`
  );
}

// 获取初始化数据
const getTableList = (fyShow) => {
  if (fyShow) {
    listQuery.value.pageCurrent = 1;
  }
  JXgetPageList(listQuery.value).then((res) => {
    let list = res.records ? res.records : [];
    let arr = resource.value.checkItem.hasChoose;
    list.forEach((item) => {
      let hz_bbl = arr.includes("报备率") ? item.bbf : 0;
      let hz_zdqyxll = arr.includes("重点区域巡逻率") ? item.xlf : 0;
      let hz_xlscl = arr.includes("巡逻时长率") ? item.xlscf : 0;
      let hz_xllcl = arr.includes("巡逻里程率") ? item.xllcf : 0;
      let hz_pcr = arr.includes("盘查人") ? item.crf : 0;
      let hz_pcc = arr.includes("盘查车") ? item.ccf : 0;
      let hz_pcwp = arr.includes("盘查物品") ? item.cwf : 0;
      let hz_qsl = arr.includes("签收率") ? item.qsf : 0;
      let sxkf = item.sxkf || 0;

      let numz = 10 - sxkf.toFixed(2);
      item.total = numz < 0 ? 0 : numz;
      item.wxl = item.wxl < 0 ? 0 : item.wxl;
      item.wbb = item.wbb < 0 ? 0 : item.wbb;
      item.hz =
        Number(hz_bbl) +
        Number(hz_qsl) +
        Number(hz_pcwp) +
        Number(hz_zdqyxll) +
        Number(hz_xlscl) +
        Number(hz_xllcl) +
        Number(hz_pcr) +
        Number(hz_pcc);
    });
    tableData.value = list;
    total.value = res.total;
  });
};
// 获取昨天
const getDay = () => {
  dayValue.value = [
    timeValidate(new Date(), "ymd"),
    timeValidate(new Date(), "ymd")
  ];
  listQuery.value.kssj = timeValidate(new Date(), "ymd");
  listQuery.value.jssj = timeValidate(new Date(), "ymd");
};
// 获取当前月
const getMonth = () => {
  const d = new Date();
  const m = d.getMonth() + 1;
  dayTypeValue.value = m;
};
// 获取当前季度
const getQuarter = () => {
  const d = new Date();
  const m = d.getMonth() + 1;
  if (m <= 3) {
    dayTypeValue.value = "01";
  } else if (m <= 6) {
    dayTypeValue.value = "02";
  } else if (m <= 9) {
    dayTypeValue.value = "03";
  } else if (m <= 12) {
    dayTypeValue.value = "04";
  }
};
// 单元格点击事件
const cellClick = (row, column, cell, event) => {
  listQuery.value.cxcj = "02";
  childTitle.value = row.ssbm;
  ssbmdm.value = row.ssbmdm;
  bblPopVisible.value = false;
  qslPopVisible.value = false;
  chlPopVisible.value = false;
  if (column.label != "单位名称") {
    switch (column.property) {
      case "ybb":
      case "sjbb":
      case "wbb":
      case "bbbl":
        searchType.value = "01";
        bblPopVisible.value = true;
        break;
      case "yxl":
      case "sjxl":
      case "wxl":
      case "xlbl":
        searchType.value = "02";
        chlPopVisible.value = true;
        break;
      case "yqs":
      case "sjqs":
      case "wqs":
      case "qsbl":
        searchType.value = "03";
        qslPopVisible.value = true;
        break;
      case "ycr":
      case "sjcr":
      case "wcr":
      case "pcrbl":
        searchType.value = "04";
        pcrPopVisible.value = true;
        dialogTitle.value = "盘查人数";
        break;
      case "ycc":
      case "sjcc":
      case "wcc":
      case "pccbl":
        searchType.value = "05";
        dialogTitle.value = "盘查车辆";
        pcrPopVisible.value = true;
        break;
      case "yxlsc":
      case "sjxlsc":
      case "wxlsc":
      case "xlscbl":
        searchType.value = "06";
        dialogTitle.value = "时长详情";
        pcrPopVisible.value = true;
        break;
      case "yxllc":
      case "sjxllc":
      case "wxllc":
      case "xllcbl":
        searchType.value = "07";
        dialogTitle.value = "里程详情";
        pcrPopVisible.value = true;
        break;
    }
  }
};
/**
 * pageSize 改变触发
 */
const handleSizeChange = (currentSize) => {
  listQuery.value.pageSize = currentSize;
  getTableList(false);
};

/**
 * 页码改变触发
 */
const handleCurrentChange = (currentPage) => {
  listQuery.value.pageCurrent = currentPage;
  getTableList(false);
};

// 重置
const reset = () => {
  dayType.value = "DAY";
  listQuery.value = {
    pageCurrent: 1,
    pageSize: 20,
    type: "01",
    searchType: "",
    kssj: "",
    jssj: "",
    month: "",
    quarter: "",
    year: "",
    ssbmdm: "",
    cxcj: "01"
  };
  getDay();
  getTableList();
};

const fromattDate = (str) => {
  const format = "yyyy-mm-dd hh:mi:ss";
  return parseTime(str);
};
// 格式化得分类型
const fromartType = (str) => {
  let s = "";
  switch (str) {
    case 1:
      s = "巡逻";
      break;
    case 2:
      s = "报备";
      break;
    case 3:
      s = "指令签收";
      break;
    default:
      s = "巡逻";
      break;
  }
  return s;
};
// 格式化地址
const fromartAdress = (str) => {
  if (!str) return "";
  let s = str.replace(/四川省/g, "");
  s = s.replace(/泸州市公安局/g, "... ");
  s = s.replace(/泸州市/g, "... ");
  return s;
};
</script>

<style lang="scss" scoped>
.flexboc {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.flexb {
  display: flex;
  align-items: center;
}
::v-deep .el-table__body-wrapper {
  height: 70vh;
  overflow: auto;
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar-track {
  background-color: #f11c1c !important;
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar {
  width: 20px;
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
  background-color: #f11c1c !important;
}
.margin-bt-10 {
  display: flex;
}
.el-select {
  width: 200px;
}
.khcard {
  flex: 1;
  margin: 5px;
  color: #fff;
  padding: 10px;
  line-height: 30px;
  text-align: center;
  background: rgba(90, 150, 239, 0.75);
}
.khcard-numb {
  font-size: 30px;
  color: #ff8850;
}
.tj-card-body {
  padding: 10px 5px;
  display: flex;
  flex-direction: column;
}
.tj-card-title {
  height: 36px;
  line-height: 36px;
  /* background: url(~@/assets/images/cjyj-yj-6.png) no-repeat center; */
  background-size: contain;
  text-align: center;
  color: #6ccef5;
  margin: 0 auto;
  font-size: 18px;
  margin: 0 5px 5px;
  position: relative;
}
.tib-close {
  position: absolute;
  right: 5px;
  top: 0;
  cursor: pointer;
}
</style>
<style scoped>
.el-table th.el-table__cell {
  background: #0d2944;
  color: #61f9ff;
}
.el-radio-button:first-child .el-radio-button__inner {
  border-left: 1px solid #1693ff;
}
.el-radio-button__inner {
  border: 1px solid #1693ff;
  background: transparent;
  color: #1693ff;
}
.table {
  background: none;
  border-top: 1px solid #1f4164;
  border-left: 1px solid #1f4164;
}
.table ::v-deep .table-header-cell {
  background: none !important;
  border-bottom: 1px solid #1f4164 !important;
  border-right: 1px solid #1f4164 !important;
  color: #61f9ff;
  text-align: center;
  font-weight: bold;
  font-size: 14px;
}
.table ::v-deep .table-cell {
  font-size: 16px;
  border-right: 1px solid #1f4164 !important;
  border-bottom: 1px solid #1f4164 !important;
  cursor: pointer;
}
.table ::v-deep .table-header-row {
  background-color: #0d2944;
}
.table ::v-deep .table-row {
  color: #24b6dd;
  background: rgba(13, 41, 68, 0.5);
  border-top: 1px solid #1f4164;
}
.el-table--group::after,
.el-table--border::after,
.el-table::before {
  background-color: #0d2944 !important;
}
.table ::v-deep tr:hover > td.table-cell,
.table ::v-deep tr.current-row > td.table-cell {
  background-color: rgba(34, 83, 140, 0.7);
}
.el-picker-panel__icon-btn {
  color: #fff !important;
}
.white {
  margin-top: 10px;
}
.fenye {
  position: fixed;
  bottom: 10px;
}
::v-deep .el-scrollbar__bar.is-horizontal {
  height: 16px;
}
</style>
