<template>
  <div style="flex:1;" class="flex">
    <button class="btn btn-xs" v-show="!criteriaShow" @click="show()">
      <span class="glyphicon glyphicon-chevron-down" style="color: #000;"></span>
    </button>
    <criteria-paged :model="model" v-ref:paged>
      <criteria partial='criteria' v-show="$parent.criteriaShow" @condition-changed='$parent.search' v-ref:criteria>
        <div novalidate class="form-horizontal select-overspread container-fluid auto" partial>
          <div class="row">
            <div class="col-sm-4" style="width: 20%">
              <label class="font_normal_body"> &nbsp;&nbsp;&nbsp;小区&nbsp;&nbsp;&nbsp;</label>
              <v-select
                placeholder='小区选择'
                :value-single="true"
                v-model='model.f_residential_area'
                :value.sync="model.f_residential_area"
                class="select select_list"
                :options='$parent.$parent.villagesChick'
                condition="f_residential_area like '%{}%'"
                close-on-select clear-button search valueSingle="true"></v-select>
            </div>
            <div class="col-sm-4" style="width: 20%">
              <label class="font_normal_body">所属区域</label>
              <v-select
                placeholder='所属区域'
                :value-single="true"
                v-model='model.street'
                :value.sync="model.street"
                class="select select_list"
                :options='$parent.$parent.streets'
                condition="tui.f_street ='{}'"
                close-on-select clear-button></v-select>
            </div>

            <div class="col-sm-4" style="width: 12%;margin-left: 2%">
              <datepicker id="startyear"
                          v-model='model.startyear'
                          :value.sync="model.startyear"
                          placeholder="下发开始年"
                          :disabled-days-of-Week="[]"
                          :format="'yyyy'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="col-sm-4" style="width: 12%;margin-left: 2%">
              <datepicker id="startmon"
                          v-model='model.startmon'
                          :value.sync="model.startmon"
                          placeholder="下发开始月"
                          :disabled-days-of-Week="[]"
                          :format="'MM'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="col-sm-4" style="width: 12% ;margin-left: 2%">
              <datepicker id="endyear"
                          v-model='model.endyear'
                          :value.sync="model.endyear"
                          placeholder="下发结束年"
                          :disabled-days-of-Week="[]"
                          :format="'yyyy'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="col-sm-4" style="width: 12% ;margin-left: 2%">
              <datepicker id="endmon"
                          v-model='model.endmon'
                          :value.sync="model.endmon"
                          placeholder="下发结束月"
                          :disabled-days-of-Week="[]"
                          :format="'MM'"
                          :show-reset-button="reset">
              </datepicker>
            </div>

          </div>
          <div class="row">
            <div class="col-sm-4" style="width: 12%;margin-left: 2%">
              <datepicker id="startdate1"
                          v-model='model.date3'
                          :value.sync="model.date3"
                          placeholder="安检开始时间"
                          :disabled-days-of-Week="[]"
                          :format="'yyyy-MM-dd'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="col-sm-4" style="width: 12%;margin-left: 2%">
              <datepicker id="enddate1"
                          v-model='model.date4'
                          :value.sync="model.date4"
                          placeholder="安检结束时间"
                          :disabled-days-of-Week="[]"
                          :format="'yyyy-MM-dd'"
                          :show-reset-button="reset">
              </datepicker>
            </div>
            <div class="col-sm-4" style="width: 20%">
              <label class="font_normal_body">是否派发</label>
              <v-select
                placeholder='是否派发'
                :value-single="true"
                v-model='model.is_sell'
                :value.sync="model.is_sell"
                class="select select_list"
                :options='$parent.$parent.is_sells'
                close-on-select clear-button></v-select>
            </div>
            <div class="col-sm-4" style="width: 20%">
              <label class="font_normal_body">用户类型</label>
              <v-select
                placeholder='用户类型'
                :value-single="true"
                v-model='model.f_user_type'
                :value.sync="model.f_user_type"
                class="select select_list"
                :options='$parent.$parent.user_types'
                close-on-select clear-button></v-select>
            </div>
            <div class="col-sm-8"></div>
            <div style="float: right;margin-right: 10px">
              <export-excel-safe :data="$parent.$parent.searchData"
                                 :field="$parent.$parent.excelHeaders"
                                 sqlurl="rs/logic/SafeExportExcel" sql-name="getAreaSafeRatioList"
                                 template-name='小区安检率汇总'></export-excel-safe>
              <div style="float: right" class="button_spacing"
                   :class="{'button_shrink_left':$parent.$parent.$parent.showItem,'button_shrink_right':!$parent.$parent.$parent.showItem}"
                   @click="$parent.$parent.hiddenr()"></div>
            </div>
            <div class="span" style="float:right;margin-right:10px">
              <button class="btn btn-primary width-80" @click="search()">查询</button>
            </div>
          </div>
        </div>
      </criteria>
      <data-grid :model="model" partial="list" class="list_area table_sy" v-ref:grid>
        <template partial='head'>
          <tr>
            <th>
              <nobr>小区名称</nobr>
            </th>
            <th>
              <nobr>小区总户数</nobr>
            </th>
            <th>
              <nobr>应派发户数</nobr>
            </th>
            <th>
              <nobr>已派发户数</nobr>
            </th>
            <th>
              <nobr>未派发户数</nobr>
            </th>
            <th>
              <nobr>入户数</nobr>
            </th>
            <th>
              <nobr>不遇数</nobr>
            </th>
            <th>
              <nobr>拒检数</nobr>
            </th>
            <th>
              <nobr>未检数</nobr>
            </th>
            <th>
              <nobr>安检率</nobr>
            </th>
          </tr>
        </template>
        <template partial='body'>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.f_residential_area}}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.allhushu}}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.needxiafa}}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.yxiafa}}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.wxiafa}}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.ruhu}}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.buyu}}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.jujian}}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.weijian}}</td>
          <td v-bind:class="{newcolor:row.code==1}" style="text-align: center">{{row.f_check_bv}}</td>
        </template>
      </data-grid>
    </criteria-paged>
  </div>
</template>

<script>
  import {PagedList} from 'vue-client'
  import {HttpResetClass} from 'vue-client'
  import co from 'co'
  import * as Util from './../Util'
  import Vue from 'vue'

  export default {
    title: '小区安检率统计页面',
    data() {
      let options = []
      let year = (new Date()).getFullYear()
      for (let i = year; i <= year + 3; i++)
        options.push({label: i + '', value: i + ''})
      let moptions = []
      for (let i = 1; i <= 12; i++)
        moptions.push({label: i + '', value: i + ''})

      return {
        model: new PagedList('rs/sql/getAreaSafeRatioList', 20, {
          orderitem: "'f_userinfo_code'",
          startyear: 'this.startyear',
          startmon: 'this.startmon',
          endyear: 'this.endyear',
          endmon: 'this.endmon',
          timetype: "'dd'",
          con1: "this.con1",
          f_itemname: 'this.check_item',
          f_itemvalue: 'this.check_itemValue',
          f_filialeids: `'(${this.$login.f.orgid})'`
        }),
        date1: '',
        date2: '',
        startyear: `${new Date().getFullYear()}`,
        startmon: '01',
        is_sells:[{label: '全部', value: ''}, {label: '已下发', value: '已下发'}, {label: '未下发', value: '未下发'}],
        endyear: `${new Date().getFullYear()}`,
        endmon: `${new Date().getMonth() + 1}`,
        f_check_start: `${new Date().getFullYear()}-01-01`,
        y_check_end: `${new Date().getFullYear()}-${new Date().getMonth() + 1}-${new Date().getDate()}`,
        searchData: {
          condition: '1=1',
          con1: '1=1',
          f_itemvalue: '',
          f_itemname: '',
          orderitem: "f_userinfo_code",
          timetype: "dd",
          f_filialeids: `(${this.$login.f.orgid})`,
          startyear: '',
          startmon: '',
          endyear: '',
          endmon: '',
        },
        excelHeaders: {
          //用户编号	用户名称	用户电话	安检次数	用户类型	小区名称	地址	安检日期	安检状态	安检结果
          'f_residential_area': '小区名称',
          'allhushu': '小区总户数',
          'needxiafa': '应派发户数',
          'yxiafa': '已派发户数',
          'wxiafa': '未派发户数',
          'ruhu': '入户数',
          'buyu': '不遇数',
          'jujian': '拒检数',
          'weijian': '未检数',
          'f_check_bv': '安检率'
        },
        orgstrs: [{label: '全部', value: ''}],
        user_types:[{label: '全部', value: ''},{label: '民用', value: '民用'},{label: '非民用', value: '非民用'}],
        checkersid: [],
        SafeCheckXZ: '',
        civil: '',   //民用安检周期
        civilian: '',      //非民用安检周期
        SafeCheckXZs: [{label: '全部', value: ''}, {label: '已入户', value: '已入户'}, {label: '未入户', value: '未入户'}], // 安检筛选选项
        safe_rhs: [{label: '全部', value: ''}, {label: '今年已入户', value: '今年已入户'}, {label: '今年未入户', value: '今年未入户'}], // 安检筛选选项
        SafeCheckSXs: [{label: '是', value: '是'}, {label: '否', value: '否'}, {label: '全部', value: ''},],
        checkstatus: [{label: '全部', value: ''}, {label: '到访不遇', value: '到访不遇'}, {label: '拒检', value: '拒检'}],
        IsShares: [{label: '是', value: '是'}, {label: '否', value: '否'}],
        IsShare: '否',
        checker: {},
        NoBuys: [{label: '是', value: '是'}, {label: '否', value: '否'}],
        criteriaShow: true,
        checkers: [],
        chosenOrg: {id: 0},
        checkedAll: false,
        checkrows: [],
        yearmodel: [],
        streets: [],
        adjustables: [],
        f_plan_year: year + '',
        f_plan_month: moptions[new Date().getMonth()].value,
        f_effective_start_time: '',  //计划有效起始时间
        f_effective_end_time: '',    //计划有效结束时间
        checkboxModel: {},
        c_year_list: options,
        c_month_list: moptions,
        areas: this.areas(),
        //checkstatus: this.checkstatus(),
        // usertypes: this.usertypes(),
        // userstates: this.userstates(),
        sqlname: '',
        creatPlanWay: '',
        showModal: false,
        yearStreet: '',
        villagesModel: '', //小区绑定值
        villagesChick: [], //小区选择值
        buildingModel: '', //地址绑定值
        buildingChick: [],  //地址选择值
        hasHousehold: '',
        // check_items: [{label: '全部', value: ''}, ...this.$appdata.getParam('安检项名')],
        check_item: '',
        check_itemValue: ''
      }
    },
    props: {
      checkplan: { // 传入一条安检计划信息
        type: Object
      },
      additemshow: {
        type: Boolean,
        default: false
      }
    },
    ready() {
      // 获取分公司信息
      this.getfengongsi()
      this.model.chosenOrg = {id: 0}
      this.model.f_filialeids = this.$login.f.f_orgids
      this.model.f_filiale = this.$login.f.f_fengongsi
      this.model.f_OrgStr = this.$login.f.orgpathstr
      this.initstreets()

      //小区初始化
      this.initVillage()
      this.$refs.paged.$refs.criteria.model.f_user_type = '民用'
      this.$refs.paged.$refs.criteria.search();
    },
    methods: {
      show1() {
        this.showModal = true
      },
      y_search() {
        let condition = ''
        if (!this.y_check_start || !this.y_check_end) {
          this.$showMessage("请选择开始和结束时间")
        }
        condition += `and f_onsite_time > '${this.y_check_start} 00:00:00' and f_onsite_time < '${this.y_check_end} 23:59:59'`
        new HttpResetClass().load('POST', 'rs/sql/FetchYearCheckRatio', {
          data: {
            condition: condition,
            f_createfile_date: `${new Date().getFullYear()}-01-01 00:00:00`,
            usertype: '民用',
            f_street: this.yearStreet
          }
        }, {resolveMsg: null, rejectMsg: '获取地址失败!'}).then((res) => {
          console.log('---' + JSON.stringify(res))
          this.yearmodel = res.data
        })
      },
      //初始化小区
      async initVillage() {
        this.villagesChick = []
        let HttpReset = new HttpResetClass()
        let req = await HttpReset.load('POST', 'rs/sql/safe_singleTable_GroupBy', {
          data: {
            items: 'f_residential_area',
            tablename: 't_area',
            condition: '1 = 1',
            groupitem: 'f_residential_area'
          }
        }, {resolveMsg: null, rejectMsg: '获取小区列表失败!'})
        let redata = []
        req.data.forEach((row, n) => {
          redata.push({label: row.f_residential_area, value: row.f_residential_area, data: row})
        })
        redata.push({label: '非民用小区', value: '非民用小区'})
        redata.unshift({label: '全部', value: '', data: ''})
        this.villagesChick = redata
      },
      //初始化街道 添加小区
      async initstreets() {
        this.streetslist = []
        let HttpReset = new HttpResetClass()
        let req = await HttpReset.load('POST', 'rs/sql/address_singleTableOrderBy', {
          data: {
            items: '*',
            tablename: 't_street',
            orderitem: 'id',
            condition: `f_orgid = '${this.$login.f.orgid}'`
          }
        }, {resolveMsg: null, rejectMsg: '获取地址失败!'})
        let redata = []
        req.data.forEach((row, n) => {
          redata.push({label: row.f_street, value: row.f_street, data: row, id: row.id})
        })
        this.streets = redata
      },
      hiddenr() {
        this.$parent.showItem = !this.$parent.showItem
      },
      hidden() {
        this.criteriaShow = !this.criteriaShow
      },
      // 获取县域分公司内容
      getfengongsi() {
        let val = {
          source: 'this.getParentByType($organization$).getSpecialResByType($organization$)',
          userid: `${this.$login.f.id}`
        }
        let http = new HttpResetClass()
        http.load('POST', '/rs/search', {data: val}, {resolveMsg: null, rejectMsg: null}).then((res) => {
          res.data.forEach((item) => {
            this.orgstrs.push({label: item.name, value: item.id})
          })
          console.log(this.orgstrs.length)
        })
      },
      getDefect(val) {
        if (val) {
          try {
            var defect = JSON.parse(val)
            return defect.result
          } catch (e) {
            console.log(val)
            return '正常'
          }
        }
        return '正常'
      },
      checkerchange(val) {
        this.checkboxModel.f_checker = val.name
        this.checkboxModel.f_checker_id = val.id
      },
      search(args) {
        let con1 = '1=1 and'
        if (args.model.date3 && args.model.date4) {
          con1 += ` f_onsite_time >= '${args.model.date3}' and f_onsite_time <= '${args.model.date4}'`
        } else  if (args.model.date3 && (args.model.date4 ==''|| args.model.date4 ==null )){
          this.$showMessage('需要选择安检结束时间！')
          return
        }else if(args.model.date4 && (args.model.date3 ==''|| args.model.date3 ==null )){
          this.$showMessage('需要选择安检开始时间！')
          return
        }else{
          con1 += ` f_onsite_time >= '${this.f_check_start}' and f_onsite_time <= '${this.y_check_end}'`
        }
        if (this.$refs.paged.$refs.criteria.model.is_sell == '已下发'){
          args.condition += ` and xfqk.f_userinfoid is not null `
        }else if(this.$refs.paged.$refs.criteria.model.is_sell == '未下发'){
          args.condition += ` and xfqk.f_userinfoid is null `
        }
        if (this.$refs.paged.$refs.criteria.model.f_user_type){
          args.condition += ` and tui.f_user_type = '${this.$refs.paged.$refs.criteria.model.f_user_type}'`
        }
        if (args.model.startyear && args.model.startmon && args.model.endyear && args.model.endmon) {
          this.model.startyear = args.model.startyear
          this.model.startmon = args.model.startmon
          this.model.endyear = args.model.endyear
          this.model.endmon = args.model.endmon
        } else if (!args.model.startyear && !args.model.startmon && !args.model.endyear && !args.model.endmon) {
          this.model.startyear = this.startyear
          this.model.startmon = this.startmon
          this.model.endyear = this.endyear
          this.model.endmon = this.endmon
        } else {
          this.$showMessage('需要选择 开始年月/结束年月！！！')
          return
        }
        this.model.check_item = this.check_item
        this.model.check_itemValue = this.check_itemValue
        args.condition += " and tui.f_filialeid =  '" + this.$login.f.orgid + "'"
        this.searchData.condition = args.condition
        this.searchData.con1 = con1
        this.searchData.f_itemvalue = this.check_item
        this.searchData.f_itemname = this.check_itemValue

        this.searchData.startyear = this.$refs.paged.$refs.criteria.model.startyear
        this.searchData.startmon = this.$refs.paged.$refs.criteria.model.startmon
        this.searchData.endyear = this.$refs.paged.$refs.criteria.model.endyear
        this.searchData.endmon = this.$refs.paged.$refs.criteria.model.endmon

        this.model.con1 = con1
        return this.model.search(args.condition, args.model)
      },
      usertypes() {
        // return [{label: '全部', value: ''}, ...this.$appdata.getParam('用户类型')]
      },
      userstates() {
        // return [{label: '全部', value: ''}, ...this.$appdata.getParam('用户状态')]
      },
      show() {
        this.criteriaShow = true
      },
      hidden() {
        this.criteriaShow = false
      },
      confirm() {
        if (!this.checkboxModel.f_plan_name) {
          this.$showMessage('请填写安检计划名称!')
          return
        }
        if (this.IsShare == '否') {
          if (!this.checkboxModel.f_checker_id) {
            this.$showMessage('请选择安检员！')
            return
          }
        }
        let gen = saveGen(this)
        return co(gen)
      },
      changeStates() {
        if (this.checkedAll) {//实现反选/
          this.checkrows = [];
          for (let i = 0; i < this.$refs.paged.model.rows.length; i++) {
            this.$set('$refs.paged.model.rows[' + i + '].checked', false)
          }
        } else {//实现全选
          for (let i = 0; i < this.$refs.paged.model.rows.length; i++) {
            this.$set('$refs.paged.model.rows[' + i + '].checked', true)
          }
          let _this = this
          let condition = this.$refs.paged.$refs.criteria.condition
          let url = this.model.url
          this.$resetpost(`${url}?pageSize=9999999`, {
            data: {
              condition: condition,
              groupitem: '',
              orderitem: 'f_residential_area',
              f_usertype: this.model.f_usertype,
              f_filialeids: this.model.f_filialeids,
              month: this.model.month,
              safeCycle: this.model.safeCycle,
              f_checktime_start: this.model.f_checktime_start,
              f_checktime_end: this.model.f_checktime_end,
              SafeCheckSX: this.model.SafeCheckSX,
              f_last_check_state: this.model.f_last_check_state
            },
          }, {resolveMsg: null, rejectMsg: null}, -1).then(
            (respanse) => {
              if (respanse.data.length >= 5000) {
                this.$showMessage("数据量太大，请重新选择")
              } else {
                _this.checkrows = []
                for (let j = 0; j < respanse.data.length; j++) {
                  _this.checkrows.push(respanse.data[j])
                }
                console.log(_this.checkrows);
              }
            })
        }
      },
      addChecked(item) {
        console.log(item);
        if (!item.checked) {
          this.checkrows.push(item);
          console.log(this.checkrows);
        } else {
          for (let i = 0; i < this.checkrows.length; i++) {
            if (item.f_userinfo_id == this.checkrows[i].f_userinfo_id) {
              this.checkrows.splice(i, 1)
            }
          }
        }
      },
      ToshowModal() {
        this.creatPlanWay = 'single'
        if (this.checkrows.length > 0) {
          this.showModal = true
        } else {
          this.$showMessage("请选择需要安检的用户!")
        }
      },
      FiltrationPlan() {
        if (this.model.rows.length == 0) {
          this.$showMessage("暂无可生成的计划！")
          return
        }
        this.creatPlanWay = 'filtration'
        this.showModal = true
      },
      AllPlan() {
        if (this.model.rows.length == 0) {
          this.$showMessage("暂无可生成的计划！")
          return
        }
        this.creatPlanWay = 'all'
        this.showModal = true
      },
      cancel() {
        this.showModal = false
      },
      areas() {
        let rs = []
        for (let i = 0; i < this.$login.f.f_allArea.length; i++) {
          let temp = {
            label: this.$login.f.f_allArea[i].label,
            value: this.$login.f.f_allArea[i].label
          }
          rs.push(temp)
        }
        return [{label: '全部', value: ''}, ...rs]
      },
    },

    watch: {
      'check_item'() {
        this.check_itemValue = ''
      },
      'model.model.f_residential_area'() {
        this.model.model.f_building = []
        this.buildingChick = []
        if (!this.model.model) {
          return
        }
        if (!this.model.model.f_residential_area) {
          return
        }
        let HttpReset = new HttpResetClass()
        let redata = []
        HttpReset.load('POST', '/rs/sql/safe_singleTable_GroupBy', {
          data: {
            items: "f_building",
            tablename: "t_user_address",
            condition: `f_filialeid = ${this.$login.f.orgid} and f_residential_area= '${this.model.model.f_residential_area}'`,
            groupitem: "f_building  order by cast((case PATINDEX('%[^0-9]%', f_building) when 0 then f_building else 999 end) as int)"
          }
        }, {resolveMsg: null, rejectMsg: '获取楼栋列表失败!'}).then(res => {
          res.data.forEach((row, n) => {
            redata.push({label: row.f_building, value: row.f_building, data: row})
          })
          this.buildingChick = redata;
        })
      },
      'model.f_usertype'(val) {
        if (val == '民用') {
          this.model.safeCycle = this.civil
        } else if (val == '非民用') {
          this.model.safeCycle = this.civilian
        }
      },
      'model.SafeCheckXZ'(val) {
        this.model.SafeCheckSC = ''
        if (val == '已安检') {
          this.model.SafeCheckCQ = ''
          this.model.SafeCheckSX = {
            f_check_end: '', // 安检时间  查询起始条件
            f_check_start: ''// 安检时间  查询终止条件
          }
        } else {
          // 当使用筛选条件时，清空不需要的条件选项
          this.model.f_issue_start = ''
          this.model.f_issue_end = ''
          this.$refs.paged.$refs.criteria.model.f_check_start = ''
          this.$refs.paged.$refs.criteria.model.f_check_end = ''
          this.$refs.paged.$refs.criteria.model.f_last_check_state = ''
          this.model.month = ''
          if (val == '应安检') {
            this.model.SafeCheckSC = '否'

            this.model.f_issue_start = Util.toStartDateString()
            this.model.f_issue_end = Util.toStandardDateString()
          }
          // this.model.f_checktime_start = ''
          // this.model.f_checktime_end = ''
        }
      },
      'model.SafeCheckSC'(val) {
        if (val == '') {
          this.model.f_issue_start = ''
          this.model.f_issue_end = ''
        }
      },
      // 'checker'(val){
      //   console.log("checker",this.checker)
      //   if(val){
      //     this.checkboxModel.f_checker = this.checker[0].name
      //     this.checkboxModel.f_checker_id = this.checker[0].id
      //   }
      // },
      'model.rows'() {
        // if (!this.checkedAll) {//实现反选/
        // this.checkrows = [];
        for (let i = 0; i < this.$refs.paged.model.rows.length; i++) {
          var k = false
          for (let j = 0; j < this.checkrows.length; j++) {
            if (this.$refs.paged.model.rows[i].f_userinfo_id == this.checkrows[j].f_userinfo_id) {
              this.$set('$refs.paged.model.rows[' + i + '].checked', true)
              k = true
              continue
            }
          }
          if (!k) {
            this.$set('$refs.paged.model.rows[' + i + '].checked', false)
          }
        }
      }
    },
    computed: {
      selected() {
        return this.$refs.paged.$refs.grid.selected
      },
      check_itemValues() {
        // return [...this.$appdata.getParam(this.check_item)]
      }
    }
  }
</script>
<style scoped>
  .newcolor {
    color: red;
  }

  .table th {
    background-color: #f2f6fa;
    color: black;
  }
</style>
