<template>
  <div id="category">
    <!--头部-->
    <!-- <Header/> -->
    <div class="header-title">
      <!--      <span style="height: 100%;width: 2rem;line-height: 46px;float: left;font-size: 15px;" @click="returnClick"><van-icon name="arrow-left" /></span>-->
      <span class="header-title-btn">
        <van-button round type="info" size="mini" :class="{ buttonClick: onClick === 2 }" style="padding: 0 10px"
          @click="titleClick(1)">名单</van-button>
        <van-button round type="info" size="mini" :class="{ buttonClick: onClick === 1 }"
          style="margin-left: 0px;padding: 0 10px" @click="titleClick(2)">监控</van-button>
      </span>
      <span class="operate-btn" v-if="onClick === 1" @click="operateClick">{{ operate === true ? '取消' : '操作' }}</span>
    </div>

    <div v-if="onClick === 1" class="manage-body">
      <van-grid :column-num="4">
        <van-grid-item>
          <div class="van-item-style">经营动态</div>
          <div style="font-size: 15px;font-weight: bold;">{{ totalOperateCount }}</div>
        </van-grid-item>
        <van-grid-item>
          <div class="van-item-style">风险信息</div>
          <div style="font-size: 15px;font-weight: bold;color: red;">{{ totalRiskCount }}</div>
        </van-grid-item>
        <van-grid-item>
          <div class="van-item-style">工商变更</div>
          <div style="font-size: 15px;font-weight: bold;color: #ee8c15;">{{ totalChangeCount }}</div>
        </van-grid-item>
        <van-grid-item>
          <div class="van-item-style">舆情声誉</div>
          <div style="font-size: 15px;font-weight: bold;">{{ totalNewsCount }}</div>
        </van-grid-item>
      </van-grid>
      <van-nav-bar title="" left-text="我的分组" :right-text="'共计企业' + enterpriseCount + '家  >'" @click-left="onClickLeft"
        @click-right="onClickRight" style="margin-top: 20px;" />
    </div>
    <van-row v-if="onClick === 1" type="flex" style="text-align: center;font-size: 13px;margin: 10px 0 10px 0;">
      <!--      <van-col span="8" class="col-weight" @click="timeCli">按加入时间<van-icon :name="timeCliType === true?'arrow-up':'arrow-down'" class="icon-mg" /></van-col>-->
      <!--      <van-col span="8" class="col-weight" @click="nameCli">按名称<van-icon :name="nameCliType === true?'arrow-up':'arrow-down'" class="icon-mg" /></van-col>-->
      <!--      <van-col span="8" class="col-weight" @click="riskCli">按风险量<van-icon :name="riskCliType === true?'arrow-up':'arrow-down'" class="icon-mg" /></van-col>-->
    </van-row>
    <div v-if="onClick === 1">
      <van-checkbox-group v-model="result" ref="checkboxGroup">
        <van-cell-group style="padding-bottom: 50px">
          <van-cell v-for="(item, index) in followList" clickable :key="index" @click="toggle(item.id, index, item)"
            style="padding-bottom: 20px">
            <template #icon>
              <div class="card-icon bg-2372eb" v-if="item.colorNum == 1"><van-icon style="top: 2px"
                  :name="require('@/images/part_one/icon_company.png')" size="25" /></div>
              <div class="card-icon bg-ee8c15" v-if="item.colorNum == 2"><van-icon style="top: 2px"
                  :name="require('@/images/part_one/icon_company.png')" size="25" /></div>
              <div class="card-icon bg-11c95f" v-if="item.colorNum == 3"><van-icon style="top: 2px"
                  :name="require('@/images/part_one/icon_company.png')" size="25" /></div>
              <div class="card-icon bg-e21183" v-if="item.colorNum == 4"><van-icon style="top: 2px"
                  :name="require('@/images/part_one/icon_company.png')" size="25" /></div>
              <div class="card-icon bg-fde809" v-if="item.colorNum == 5"><van-icon style="top: 2px"
                  :name="require('@/images/part_one/icon_company.png')" size="25" /></div>
              <div class="card-icon bg-17b9d7" v-if="item.colorNum == 6"><van-icon style="top: 2px"
                  :name="require('@/images/part_one/icon_company.png')" size="25" /></div>
              <div class="card-icon bg-db2c2c" v-if="item.colorNum == 7"><van-icon style="top: 2px"
                  :name="require('@/images/part_one/icon_company.png')" size="25" /></div>
              <div class="card-icon bg-9232db" v-if="item.colorNum == 8"><van-icon style="top: 2px"
                  :name="require('@/images/part_one/icon_company.png')" size="25" /></div>
            </template>
            <template #title>
              <div style="margin-top: 20px;font-size: 15px;font-weight: bold;">{{ item.companyName }}</div>
            </template>
            <!--        <template #label>-->
            <!--          <van-tag color="#E9F1FD" text-color="#2372EB" style="margin-top: 5px;padding: 2px;">动态信息：{{ item.operateCount+item.riskCount+item.changeCount+item.newsCount }}</van-tag>-->
            <!--        </template>-->
            <template #right-icon>
              <div @click="toMonitor(item.companyId)" style="height: 100%">
                <van-tag plain type="primary" style="height: 20px;margin-top: 1.5rem;margin-right: 10px;">监控台</van-tag>
              </div>
              <div @click.stop="toReport(item.companyId)" style="height: 100%">
                <van-tag plain type="primary" style="height: 20px;margin-top: 1.5rem;margin-right: 10px;">报告</van-tag>
              </div>
              <van-checkbox v-if="operate === true" :name="item.id" ref="checkboxes" />
            </template>
          </van-cell>
        </van-cell-group>
      </van-checkbox-group>
    </div>
    <div v-if="operate === true" style="position: fixed;width: 100%;bottom: 60px;">
      <van-row type="flex" style="text-align: center;font-size: 13px;margin: 20px 0 10px 0;">
        <van-col span="12" class="col-weight"><van-button plain color="#595959" @click="checkAll"
            style="width: 90%;border-radius: 5px;">{{ checkboxAll ? '全选' : '取消全选' }}</van-button></van-col>
        <van-col span="12" class="col-weight"><van-button plain color="#F5BB75" @click="unFollow"
            style="width: 90%;border-radius: 5px;">取消关注</van-button></van-col>
      </van-row>
    </div>
    <div v-if="onClick === 2" style="padding-bottom: 50px;">
      <div v-if="pageLoading == true">
        <van-popup position="bottom" :style="{ height: '50%' }" v-model="isShowDatePicker">
          <van-datetime-picker :min-date="minDate" @confirm="onConfirm" @cancel="startDateCancel"
            v-if="startDateShow"></van-datetime-picker>
          <van-datetime-picker :min-date="minDate" @confirm="onEndConfirm" @cancel="endDateCancel"
            v-if="endDateShow"></van-datetime-picker>
        </van-popup>
        <div>
          <van-dropdown-menu active-color="#1989fa" :closeOnClickOutside=false>
            <van-dropdown-item title="风险类型" ref="type">
              <div style="margin: 10px 10px 0 10px;">
                <!--              <van-tree-select :items="items" :active-id="1" :main-active-index="0" @click-nav="onNav" @click-item="onItem" />-->
                <van-picker show-toolbar :columns="items" cancel-button-text="" confirm-button-text=""
                  @cancel="onRegionCancel" @confirm="onRegionConfirm" />
              </div>
              <!--            <div style="padding: 10px 16px;margin-bottom: 45px;">-->
              <!--              <van-button class="br-6" style="width: 45%;float: left;"  type="default" @click="onPickerCancel">-->
              <!--                重置-->
              <!--              </van-button>-->
              <!--              <van-button class="br-6" style="width: 45%;float: right;" type="info" @click="onPickerSure">-->
              <!--                确认-->
              <!--              </van-button>-->
              <!--            </div>-->
            </van-dropdown-item>
            <van-dropdown-item title="时间" ref="year">
              <div style="margin: 10px 10px 0 10px;">
                <van-tag type="primary" v-for="(item, index) in yearList" :key="index"
                  @click="clickYearLabels(item, index)" :color="yearName == item.value ? '#E9F1FD' : '#F2F3F5'"
                  :text-color="yearName == item.value ? '#2372EB' : '#6D6F6D'" class="mg-lt-5 pd-5 pd-bt-10 mg-10 fs-13"
                  size="large">{{ item.value }}</van-tag>
                <!--              <van-search v-model="startDateValue" placeholder="请输入开始日期" @focus="startDateSearch" left-icon="notes-o"></van-search>-->
                <!--              <van-search v-model="endDateValue" placeholder="请输入结束日期" @focus="endDateSearch" left-icon="notes-o"></van-search>-->
                <!--              <van-calendar style="padding-bottom: 60px;" v-model="startDateShow" @confirm="onConfirm" color="#1989fa" :min-date="minStartDate" :max-date="maxStartDate" />-->
                <!--              <van-calendar style="padding-bottom: 60px;" v-model="endDateShow" @confirm="onEndConfirm" color="#1989fa" :min-date="minStartDate" :max-date="maxStartDate" />-->
                <van-cell title="选择开始日期" :value="startDateValue" @click="startDateSearch" />
                <van-cell title="选择结束日期" :value="endDateValue" @click="endDateSearch" />
              </div>
              <div style="padding: 10px 16px;margin-bottom: 45px;">
                <van-button class="br-6" style="width: 45%;float: left;" type="default" @click="confirmDateCancel">
                  重置
                </van-button>
                <van-button class="br-6" style="width: 45%;float: right;" type="info" @click="confirmDateSure">
                  确认
                </van-button>
              </div>
            </van-dropdown-item>
            <van-dropdown-item title="分组对象" ref="group">
              <div style="margin: 10px 10px 0 10px;">
                <van-tag type="primary" v-for="(item, index) in groupList" :key="index"
                  @click="clickGroupLabels(item, index)" :color="groupName == item.groupId ? '#E9F1FD' : '#F2F3F5'"
                  :text-color="groupName == item.groupId ? '#2372EB' : '#6D6F6D'" class="mg-lt-5 pd-5 pd-bt-10 mg-10 fs-13"
                  size="large">{{ item.groupName }}</van-tag>

              </div>
              <div style="padding: 10px 16px;margin-bottom: 45px;">
                <van-button class="br-6" style="width: 45%;float: left;" type="default" @click="groupConfirmCancel">
                  重置
                </van-button>
                <van-button class="br-6" style="width: 45%;float: right;" type="info" @click="groupConfirmSure">
                  确认
                </van-button>
              </div>
            </van-dropdown-item>
          </van-dropdown-menu>
        </div>
        <div v-if="typeName === '工商风险'" v-for="(item, index) in companyChangeList" :key="index">
          <van-cell-group>
            <van-cell clickable @click="monitorType(item)" style="padding-bottom: 20px">
              <template #icon>
                <div class="card-icon" v-if="item.colorNum == 1" :style="{ backgroundColor: '#2372eb' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 2" :style="{ backgroundColor: '#ee8c15' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 3" :style="{ backgroundColor: '#11c95f' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 4" :style="{ backgroundColor: '#e21183' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 5" :style="{ backgroundColor: '#fde809' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 6" :style="{ backgroundColor: '#17b9d7' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 7" :style="{ backgroundColor: '#db2c2c' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 8" :style="{ backgroundColor: '#9232db' }"><van-icon
                    name="newspaper-o" /></div>
              </template>
              <template #title>
                <div style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{ item.companyName }}</div>
                <div style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{ item.changeDate }}</div>
              </template>
              <template #label>
                <van-tag color="#E9F1FD" text-color="#2372EB" style="margin-top: 10px;">工商风险</van-tag>
              </template>
            </van-cell>
          </van-cell-group>
          <div style="background-color: #fff;overflow: hidden;">
            <div class="firm-info">
              <van-grid :column-num="2">
                <van-grid-item style="width: 50%;flex-basis: 50% !important;word-break: break-all;padding-left: 10px;">
                  <div class="van-item-style">变更前:</div>
                  <div class="fs-14 cl-595959 fw-bold">{{ item.beforeContent }}</div>
                </van-grid-item>
                <van-grid-item style="width: 50%;flex-basis: 50% !important;word-break: break-all;padding-right: 10px">
                  <div class="van-item-style">变更后:</div>
                  <div class="fs-14 cl-595959 fw-bold">{{ item.afterContent }}</div>
                </van-grid-item>
              </van-grid>
            </div>
          </div>
        </div>
        <div v-if="typeName === '司法风险'" v-for="(item, index) in monitorNewsList" :key="index">
          <van-cell-group>
            <van-cell clickable @click="monitorType(item)" style="padding-bottom: 20px">
              <template #icon>
                <div class="card-icon" v-if="item.colorNum == 1" :style="{ backgroundColor: '#2372eb' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 2" :style="{ backgroundColor: '#ee8c15' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 3" :style="{ backgroundColor: '#11c95f' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 4" :style="{ backgroundColor: '#e21183' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 5" :style="{ backgroundColor: '#fde809' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 6" :style="{ backgroundColor: '#17b9d7' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 7" :style="{ backgroundColor: '#db2c2c' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 8" :style="{ backgroundColor: '#9232db' }"><van-icon
                    name="newspaper-o" /></div>
              </template>
              <template #title>
                <div v-if="typeValue === '失信信息'" style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{
                  item.companyName }}</div>
                <div v-if="typeValue === '被执行人信息'" style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{
                  item.companyName }}</div>
                <div v-if="typeValue === '裁判文书'" style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{
                  item.caseName }}</div>
                <div v-if="typeValue === '法院公告'" style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{
                  item.companyName }}</div>
                <div v-if="typeValue === '限制高消费'" style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{
                  item.peopleenforced }}</div>
              </template>
              <template #label>
                <van-tag v-if="typeValue === '失信信息'" color="#E9F1FD" text-color="#2372EB"
                  style="margin-top: 10px;">失信信息</van-tag>
                <van-tag v-if="typeValue === '被执行人信息'" color="#E9F1FD" text-color="#2372EB"
                  style="margin-top: 10px;">被执行人信息</van-tag>
                <van-tag v-if="typeValue === '裁判文书'" color="#E9F1FD" text-color="#2372EB"
                  style="margin-top: 10px;">裁判文书</van-tag>
                <van-tag v-if="typeValue === '法院公告'" color="#E9F1FD" text-color="#2372EB"
                  style="margin-top: 10px;">法院公告</van-tag>
                <van-tag v-if="typeValue === '限制高消费'" color="#E9F1FD" text-color="#2372EB"
                  style="margin-top: 10px;">限制高消费</van-tag>
              </template>
            </van-cell>
          </van-cell-group>
          <div style="background-color: #fff;overflow: hidden;">
            <van-grid v-if="typeValue === '被执行人信息'" class="van-item" :column-num="1">
              <van-grid-item style="font-size: 15px;">
                <div>
                  <span style="font-weight: bold;">案号：</span>
                  <span style="color: #646566;">{{ item.anNo }}</span>
                </div>
                <div style="margin-top: 5px;">
                  <span style="font-weight: bold;">立案时间：</span>
                  <span style="color: #646566;">{{ item.lianDate }}</span>
                </div>
                <div style="margin-top: 5px;">
                  <span style="font-weight: bold;">执行法院：</span>
                  <span style="color: #646566;">{{ item.executeGov }}</span>
                </div>
                <div style="margin-top: 5px;">
                  <span style="font-weight: bold;">被执行人：</span>
                  <span style="color: #646566;">{{ item.name }}</span>
                </div>
              </van-grid-item>
            </van-grid>
            <van-grid v-if="typeValue === '失信信息'" class="van-item" :column-num="1">
              <van-grid-item style="font-size: 15px;">
                <div>
                  <span style="font-weight: bold;">案号：</span>
                  <span style="color: #646566;">{{ item.anNo }}</span>
                </div>
                <div style="margin-top: 5px;">
                  <span style="font-weight: bold;">案由：</span>
                  <span style="color: #646566;">{{ item.actionremark }}</span>
                </div>
                <div style="margin-top: 5px;">
                  <span style="font-weight: bold;">立案时间：</span>
                  <span style="color: #646566;">{{ item.lianDate }}</span>
                </div>
              </van-grid-item>
            </van-grid>
            <van-grid v-if="typeValue === '裁判文书'" class="van-item" :column-num="1">
              <van-grid-item style="font-size: 15px;">
                <div>
                  <span style="font-weight: bold;">案号：</span>
                  <span style="color: #646566;">{{ item.caseNo }}</span>
                </div>
                <div style="margin-top: 5px;">
                  <span style="font-weight: bold;">案由：</span>
                  <span style="color: #646566;">{{ item.caseReason }}</span>
                </div>
                <div style="margin-top: 5px;">
                  <span style="font-weight: bold;">裁定时间：</span>
                  <span style="color: #646566;">{{ item.judgeDate }}</span>
                </div>
              </van-grid-item>
            </van-grid>
            <van-grid v-if="typeValue === '法院公告'" class="van-item" :column-num="1">
              <van-grid-item style="font-size: 15px;">
                <div>
                  <span style="font-weight: bold;">案号：</span>
                  <span style="color: #646566;">{{ item.caseNo }}</span>
                </div>
                <div style="margin-top: 5px;">
                  <span style="font-weight: bold;">内容：</span>
                  <span style="color: #646566;">{{ item.content }}</span>
                </div>
                <div style="margin-top: 5px;">
                  <span style="font-weight: bold;">刊登时间：</span>
                  <span style="color: #646566;">{{ item.publishDate }}</span>
                </div>
              </van-grid-item>
            </van-grid>
            <van-grid v-if="typeValue === '限制高消费'" class="van-item" :column-num="1">
              <van-grid-item style="font-size: 15px;">
                <div>
                  <span style="font-weight: bold;">案号：</span>
                  <span style="color: #646566;">{{ item.casenumber }}</span>
                </div>
                <div style="margin-top: 5px;">
                  <span style="font-weight: bold;">案由：</span>
                  <span style="color: #646566;">{{ item.subjectmatter }}</span>
                </div>
                <div style="margin-top: 5px;">
                  <span style="font-weight: bold;">发布：</span>
                  <span style="color: #646566;">{{ item.inserttime }}</span>
                </div>
              </van-grid-item>
            </van-grid>
          </div>
        </div>
        <div v-if="typeName === '舆情信息'" v-for="(item, index) in monitorNewsList" :key="index">
          <van-cell-group>
            <van-cell clickable @click="monitorType(item)" style="padding-bottom: 20px">
              <template #icon>
                <div class="card-icon" v-if="item.colorNum == 1" :style="{ backgroundColor: '#2372eb' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 2" :style="{ backgroundColor: '#ee8c15' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 3" :style="{ backgroundColor: '#11c95f' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 4" :style="{ backgroundColor: '#e21183' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 5" :style="{ backgroundColor: '#fde809' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 6" :style="{ backgroundColor: '#17b9d7' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 7" :style="{ backgroundColor: '#db2c2c' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 8" :style="{ backgroundColor: '#9232db' }"><van-icon
                    name="newspaper-o" /></div>
              </template>
              <template #title>
                <div style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{ item.companyName }}</div>
              </template>
              <template #label>
                <van-tag color="#E9F1FD" text-color="#2372EB" style="margin-top: 10px;">舆情信息</van-tag>
              </template>
            </van-cell>
          </van-cell-group>
          <div style="background-color: #fff;overflow: hidden;">
            <van-grid class="van-item" :column-num="1">
              <van-grid-item style="font-size: 15px;">
                <div style="padding-top:10px" class="fw-bold mg-lt-16">{{ item.title }}</div>
                <van-cell-group>
                  <van-cell :title="item.source" :value="item.publishTime" />
                </van-cell-group>
              </van-grid-item>
            </van-grid>
          </div>
        </div>
        <div v-if="typeName === '经营动态'" v-for="(item, index) in monitorNewsList" :key="index">
          <van-cell-group>
            <van-cell clickable @click="monitorType(item)" style="padding-bottom: 20px">
              <template #icon>
                <div class="card-icon" v-if="item.colorNum == 1" :style="{ backgroundColor: '#2372eb' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 2" :style="{ backgroundColor: '#ee8c15' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 3" :style="{ backgroundColor: '#11c95f' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 4" :style="{ backgroundColor: '#e21183' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 5" :style="{ backgroundColor: '#fde809' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 6" :style="{ backgroundColor: '#17b9d7' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 7" :style="{ backgroundColor: '#db2c2c' }"><van-icon
                    name="newspaper-o" /></div>
                <div class="card-icon" v-if="item.colorNum == 8" :style="{ backgroundColor: '#9232db' }"><van-icon
                    name="newspaper-o" /></div>
              </template>
              <template #title>
                <div v-if="typeValue === '行政许可'" style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{ item.name
                }}</div>
                <div v-if="typeValue === '招投标信息'" style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{
                  item.companyname }}</div>
                <div v-if="typeValue === '进出口信息'" style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{
                  item.companyName }}</div>
                <div v-if="typeValue === '融资信息'" style="margin-top: 15px;font-size: 15px;font-weight: bold;">{{
                  item.companyName }}</div>
              </template>
              <template #label>
                <van-tag v-if="typeValue === '行政许可'" color="#E9F1FD" text-color="#2372EB"
                  style="margin-top: 10px;">行政许可</van-tag>
                <van-tag v-if="typeValue === '招投标信息'" color="#E9F1FD" text-color="#2372EB"
                  style="margin-top: 10px;">招投标信息</van-tag>
                <van-tag v-if="typeValue === '进出口信息'" color="#E9F1FD" text-color="#2372EB"
                  style="margin-top: 10px;">进出口信息</van-tag>
                <van-tag v-if="typeValue === '融资信息'" color="#E9F1FD" text-color="#2372EB"
                  style="margin-top: 10px;">融资信息</van-tag>
              </template>
            </van-cell>
          </van-cell-group>
          <div style="background-color: #fff;overflow: hidden;">
            <van-grid class="van-item" :column-num="1">
              <van-grid-item v-if="typeValue === '行政许可'" style="font-size: 15px;">
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">决定文书：{{ item.caseNo }}</div>
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">决定日期：{{ item.lianDate }}</div>
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">许可机关：{{ item.executeGov }}</div>
                <!--              <div style="padding-bottom: 10px" class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">许可内容：{{ item.content }}</div>-->
              </van-grid-item>
              <van-grid-item v-if="typeValue === '招投标信息'" style="font-size: 15px;">
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">招投标类型：{{ item.tendertype }}</div>
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">发布日期：{{ item.timerelease }}</div>
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">招采单位：{{ item.tenderee }}</div>
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">中标单位：{{ item.wintenderer }}</div>
                <div style="padding-bottom: 10px" class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">中标金额：{{ item.winbidprice }}元
                </div>
              </van-grid-item>
              <van-grid-item v-if="typeValue === '进出口信息'" style="font-size: 15px;">
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">注册日期：{{ item.regDate }}</div>
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">注册海关：{{ item.regGov }}</div>
                <div style="padding-bottom: 10px" class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">行政区划：{{ item.administrativeArea
                }}元</div>
              </van-grid-item>
              <van-grid-item v-if="typeValue === '融资信息'" style="font-size: 15px;">
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">融资日期：{{ item.date }}</div>
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">融资金额：{{ item.amount }}</div>
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">投资方：{{ item.investment }}</div>
                <div class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">产品名称：{{ item.productName }}</div>
                <div style="padding-bottom: 10px" class="fs-14 mg-lt-16 mg-bt-5 mg-tp-8">估值：{{ item.valuation }}</div>
              </van-grid-item>
            </van-grid>
          </div>
        </div>
      </div>
      <van-loading style="text-align: center;margin-top: 50%" v-if="pageLoading == false" />
    </div>
  </div>
</template>

<script>
// 1. 引入组件
import Header from "./components/header/Header"
import ContentView from "./components/contentView/ContentView";
import {
  postAttentionInfo,
  postQueryByLoginUser,
  postBatchDelateAttention,
  postDeleteGroupInfo, postQueryByName,
  postCompanyChangePage,
  postMonitorNewsPage,
  postMonitorShixinPage,
  postMonitorZhixingPage,
  postMonitorJudgementPage,
  postMonitorCourtPage,
  postMonitorLimitHighconsumePage,
  postMonitorCreditChinaLicensePage,
  postMonitorBiddingBaseinfoPage,
  postMonitorImportExportDetailPage,
  postMonitorFinancingPage
} from "@/service/api/category";

import { Button, Col, Row, Icon, Tag, Checkbox, CheckboxGroup, Toast, DropdownMenu, DropdownItem, TreeSelect, Picker, Calendar, Search } from 'vant';


export default {
  name: "Category",
  data() {
    return {
      // 是否显示正在加载
      pageLoading: true,
      onClick: 1,
      operate: false,
      enterpriseCount: 0,
      timeCliType: true,
      nameCliType: true,
      riskCliType: true,
      followList: [],
      totalChangeCount: '',
      totalNewsCount: '',
      totalOperateCount: '',
      totalRiskCount: '',
      colorList: ['#2372EB', '#17B9D7', '#EE8C15', '#DB2C2C'],
      result: [],
      checkboxAll: true,
      groupList: [],
      groupName: '',
      groupValue: '',
      items: [
        { text: '工商风险', children: [{ text: '全部', id: 1 }, { text: '法定代表人变更', id: 2 }, { text: '主要人员变更', id: 3 }, { text: '股东变更', id: 4 }, { text: '注册资本变更', id: 5 }, { text: '企业类型变更', id: 6 }] },
        { text: '司法风险', children: [{ text: '失信信息', id: 7 }, { text: '被执行人信息', id: 8 }, { text: '裁判文书', id: 9 }, { text: '法院公告', id: 10 }, { text: '限制高消费', id: 11 }] },
        { text: '舆情信息', children: [{ text: '' }] },
        { text: '经营动态', children: [{ text: '行政许可', id: 12 }, { text: '招投标信息', id: 13 }, { text: '进出口信息', id: 14 }, { text: '融资信息', id: 15 }] }
      ],
      yearList: [{ value: '今天' }, { value: '近7天' }, { value: '近30天' }],
      yearName: '',
      yearValue: '',
      typeName: '工商风险',
      typeValue: '',
      // items: [
      //     {text: 'sssssss'},
      //   {text: 'xxxxxxxxxxxxxx'}
      //   ],
      companyChangeList: [],
      monitorNewsList: [],
      startDateValue: '',
      endDateValue: '',
      startTime: '',
      endTime: '',
      isShowDatePicker: false,
      minDate: new Date(2000, 0, 1),
      date: '',
      startDateShow: false,
      endDateShow: false,
      minStartDate: new Date(1996, 0, 1),
      maxStartDate: new Date(2025, 0, 31),
      currentPage: 1,
      currentYuqingPage: 1,
      currentShixinPage: 1,
      currentZhixingPage: 1,
      currentWenshuPage: 1,
      currentFayuanPage: 1,
      currentXiaofeiPage: 1,
      currentXingzhengPage: 1,
      currentZhaobiaoPage: 1,
      currentJinchuPage: 1,
      currentRongziPage: 1,
      loading: false,
      isEndLoading: false,
      userId: '',
    }
  },
  components: {
    Header,
    ContentView,
    VanButton: Button,
    VanRow: Row,
    VanCol: Col,
    VanIcon: Icon,
    VanTag: Tag,
    VanCheckbox: Checkbox,
    VanCheckboxGroup: CheckboxGroup,
    VanDropdownMenu: DropdownMenu,
    VanDropdownItem: DropdownItem,
    VanToast: Toast,
    VanTreeSelect: TreeSelect,
    VanPicker: Picker,
    VanCalendar: Calendar,
    VanSearch: Search,

  },
  mounted() {
    window.addEventListener('scroll', this.scrollBottom);
  },
  destroyed() {
    window.removeEventListener('scroll', this.scrollBottom)
  },
  created() {
    this.userId = localStorage.getItem('userId')
    sessionStorage.removeItem('jumpType')
    sessionStorage.removeItem('dashboardType');
    // if( sessionStorage.getItem('isFromHome') && sessionStorage.getItem('isFromHome') == 'isYes' ){
    //   this.titleClick(2);
    //   sessionStorage.removeItem('isFromHome');
    // }
    this.postAttention();
    this.postGroupList();
    this.postCompanyChange();
  },
  methods: {
    // 获取关注信息
    async postAttention() {
      let params = {
        pageNum: 1,
        pageSize: 999,
      }
      let result = await postAttentionInfo(params);
      if (result == null) {
        this.followList = [];
      } else {
        result.attentionCompanyInfoVoList.forEach((item, index) => {
          item.color = this.colorList[index % 4]
        })
        this.followList = result.attentionCompanyInfoVoList;
        this.enterpriseCount = result.attentionCompanyInfoVoList.length;
        this.totalChangeCount = result.totalChangeCount;
        this.totalNewsCount = result.totalNewsCount;
        this.totalOperateCount = result.totalOperateCount;
        this.totalRiskCount = result.totalRiskCount;
      }
    },
    // async postGroupList() {
    //   let result = await postQueryByLoginUser();
    //   console.log(111,result)
    // },
    // 名单监控切换
    titleClick(i) {
      this.onClick = i;
    },
    // 操作切换
    operateClick() {
      this.operate = !this.operate;
    },
    timeCli() {
      this.timeCliType = !this.timeCliType;
    },
    nameCli() {
      this.nameCliType = !this.nameCliType;
    },
    riskCli() {
      this.riskCliType = !this.riskCliType;
    },
    // 点击取关复选框
    toggle(id, index, data) {
      if (this.operate === false) {
        console.log(data)
        sessionStorage.setItem('companyId', data.companyId);
        sessionStorage.setItem('followId', data.id);
        sessionStorage.setItem('dashboardType', 'category');
        this.$router.push({ path: 'CustomerDashboard' });
      }
      // this.$refs.checkboxes[index].toggle();
      this.checkboxAll = true;
      if (this.result.includes(id)) {
        let index = this.result.findIndex(item => item == id)
        this.result.splice(index, 1)
      } else {
        this.result.push(id)
      }
    },
    // 点击全选
    checkAll() {
      this.result = [];
      if (this.checkboxAll == true) {
        this.$refs.checkboxGroup.toggleAll(true);
        this.checkboxAll = false;
      } else {
        this.$refs.checkboxGroup.toggleAll();
        this.checkboxAll = true;
      }
    },
    // 点击取关
    async unFollow() {
      if (this.result.length == 0) {
        Toast.fail('请选择公司')
      } else {
        let result = await postBatchDelateAttention({ ids: this.result });
        this.result = [];
        Toast.success('取关成功');
        this.postAttention();
      }
    },
    onClickLeft() { },
    onClickRight() {
      this.$router.push({ path: '/myGroup' })
    },

    // onNav(index) {
    //   console.log(index)
    // },
    // onItem(data) {
    //   console.log(data)
    // },
    // 查工商信息
    async postCompanyChange() {
      let params = {
        changeType: this.typeValue,
        groupId: this.groupValue,
        startTime: this.startTime,
        endTime: this.endTime,
        pageSize: 10,
        pageNum: this.currentPage
      }
      let result = await postCompanyChangePage(params);
      // this.companyChangeList = result.records;
      if (result) {
        this.pageLoading = true;
        if (this.loading) {
          this.companyChangeList = this.companyChangeList.concat(result.records);
        } else {
          this.companyChangeList = result.records;
        }
        if (this.companyChangeList.length < result.total) {
          this.isEndLoading = false;
        } else {
          this.isEndLoading = true;
        }
        this.loading = false;
      }
    },
    // 查舆情信息
    async postMonitorNews() {
      let params = {
        groupId: this.groupValue,
        startTime: this.startTime,
        endTime: this.endTime,
        pageSize: 10,
        pageNum: this.currentYuqingPage,
      }
      let result = await postMonitorNewsPage(params);
      // this.monitorNewsList = result.records;
      if (result) {
        this.pageLoading = true;
        if (this.loading) {
          this.monitorNewsList = this.monitorNewsList.concat(result.records);
        } else {
          this.monitorNewsList = result.records;
        }
        if (this.monitorNewsList.length < result.total) {
          this.isEndLoading = false;
        } else {
          this.isEndLoading = true;
        }
        this.loading = false;
      }
    },
    // 查失信信息
    async postMonitorShixin() {
      let params = {
        groupId: this.groupValue,
        startTime: this.startTime,
        endTime: this.endTime,
        pageSize: 10,
        pageNum: this.currentShixinPage
      }
      let result = await postMonitorShixinPage(params);
      // this.monitorNewsList = result.records;
      if (result) {
        this.pageLoading = true;
        if (this.loading) {
          this.monitorNewsList = this.monitorNewsList.concat(result.records);
        } else {
          this.monitorNewsList = result.records;
        }
        if (this.monitorNewsList.length < result.total) {
          this.isEndLoading = false;
        } else {
          this.isEndLoading = true;
        }
        this.loading = false;
      }
    },
    // 查被执行人信息
    async postMonitorZhixing() {
      let params = {
        groupId: this.groupValue,
        startTime: this.startTime,
        endTime: this.endTime,
        pageSize: 10,
        pageNum: this.currentZhixingPage
      }
      let result = await postMonitorZhixingPage(params);
      // this.monitorNewsList = result.records;
      if (result) {
        this.pageLoading = true;
        if (this.loading) {
          this.monitorNewsList = this.monitorNewsList.concat(result.records);
        } else {
          this.monitorNewsList = result.records;
        }
        if (this.monitorNewsList.length < result.total) {
          this.isEndLoading = false;
        } else {
          this.isEndLoading = true;
        }
        this.loading = false;
      }
    },
    // 查裁判文书信息
    async postMonitorJudgement() {
      let params = {
        groupId: this.groupValue,
        startTime: this.startTime,
        endTime: this.endTime,
        pageSize: 10,
        pageNum: this.currentWenshuPage
      }
      let result = await postMonitorJudgementPage(params);
      // this.monitorNewsList = result.records;
      if (result) {
        this.pageLoading = true;
        if (this.loading) {
          this.monitorNewsList = this.monitorNewsList.concat(result.records);
        } else {
          this.monitorNewsList = result.records;
        }
        if (this.monitorNewsList.length < result.total) {
          this.isEndLoading = false;
        } else {
          this.isEndLoading = true;
        }
        this.loading = false;
      }
    },
    // 查法院公告信息
    async postMonitorCourt() {
      let params = {
        groupId: this.groupValue,
        startTime: this.startTime,
        endTime: this.endTime,
        pageSize: 10,
        pageNum: this.currentFayuanPage
      }
      let result = await postMonitorCourtPage(params);
      // this.monitorNewsList = result.records;
      if (result) {
        this.pageLoading = true;
        if (this.loading) {
          this.monitorNewsList = this.monitorNewsList.concat(result.records);
        } else {
          this.monitorNewsList = result.records;
        }
        if (this.monitorNewsList.length < result.total) {
          this.isEndLoading = false;
        } else {
          this.isEndLoading = true;
        }
        this.loading = false;
      }
    },
    // 查限制高消费信息
    async postLimitHighconsume() {
      let params = {
        groupId: this.groupValue,
        startTime: this.startTime,
        endTime: this.endTime,
        pageSize: 10,
        pageNum: this.currentXiaofeiPage
      }
      let result = await postMonitorLimitHighconsumePage(params);
      // this.monitorNewsList = result.records;
      if (result) {
        this.pageLoading = true;
        if (this.loading) {
          this.monitorNewsList = this.monitorNewsList.concat(result.records);
        } else {
          this.monitorNewsList = result.records;
        }
        if (this.monitorNewsList.length < result.total) {
          this.isEndLoading = false;
        } else {
          this.isEndLoading = true;
        }
        this.loading = false;
      }
    },
    // 查行政许可信息
    async postCreditChinaLicense() {
      let params = {
        groupId: this.groupValue,
        startTime: this.startTime,
        endTime: this.endTime,
        pageSize: 10,
        pageNum: this.currentXingzhengPage
      }
      let result = await postMonitorCreditChinaLicensePage(params);
      // this.monitorNewsList = result.records;
      if (result) {
        this.pageLoading = true;
        if (this.loading) {
          this.monitorNewsList = this.monitorNewsList.concat(result.records);
        } else {
          this.monitorNewsList = result.records;
        }
        if (this.monitorNewsList.length < result.total) {
          this.isEndLoading = false;
        } else {
          this.isEndLoading = true;
        }
        this.loading = false;
      }
    },
    // 查招投标信息
    async postBiddingBaseinfo() {
      let params = {
        groupId: this.groupValue,
        startTime: this.startTime,
        endTime: this.endTime,
        pageSize: 10,
        pageNum: this.currentZhaobiaoPage
      }
      let result = await postMonitorBiddingBaseinfoPage(params);
      // this.monitorNewsList = result.records;
      if (result) {
        this.pageLoading = true;
        if (this.loading) {
          this.monitorNewsList = this.monitorNewsList.concat(result.records);
        } else {
          this.monitorNewsList = result.records;
        }
        if (this.monitorNewsList.length < result.total) {
          this.isEndLoading = false;
        } else {
          this.isEndLoading = true;
        }
        this.loading = false;
      }
    },
    // 查进出口信息
    async postImportExportDetail() {
      let params = {
        groupId: this.groupValue,
        startTime: this.startTime,
        endTime: this.endTime,
        pageSize: 10,
        pageNum: this.currentJinchuPage
      }
      let result = await postMonitorImportExportDetailPage(params);
      // this.monitorNewsList = result.records;
      if (result) {
        this.pageLoading = true;
        if (this.loading) {
          this.monitorNewsList = this.monitorNewsList.concat(result.records);
        } else {
          this.monitorNewsList = result.records;
        }
        if (this.monitorNewsList.length < result.total) {
          this.isEndLoading = false;
        } else {
          this.isEndLoading = true;
        }
        this.loading = false;
      }
    },
    // 查融资信息
    async postImportFinancing() {
      let params = {
        groupId: this.groupValue,
        startTime: this.startTime,
        endTime: this.endTime,
        pageSize: 10,
        pageNum: this.currentRongziPage
      }
      let result = await postMonitorFinancingPage(params);
      // this.monitorNewsList = result.records;
      if (result) {
        this.pageLoading = true;
        if (this.loading) {
          this.monitorNewsList = this.monitorNewsList.concat(result.records);
        } else {
          this.monitorNewsList = result.records;
        }
        if (this.monitorNewsList.length < result.total) {
          this.isEndLoading = false;
        } else {
          this.isEndLoading = true;
        }
        this.loading = false;
      }
    },
    onRegionCancel() {
      this.$refs.type.toggle(false);
    },
    onRegionConfirm(selectedValues) {
      console.log(selectedValues)
      this.$refs.type.toggle(false);
      this.typeName = selectedValues[0];
      this.typeValue = selectedValues[1];
      if (this.typeValue == '全部') {
        this.typeValue = '';
      }
      if (this.typeName == '工商风险') {
        this.currentPage = 1;
      } else if (this.typeName == '舆情信息') {
        this.currentYuqingPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '失信信息') {
        this.currentShixinPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '被执行人信息') {
        this.currentZhixingPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '裁判文书') {
        this.currentWenshuPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '法院公告') {
        this.currentFayuanPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '限制高消费') {
        this.currentXiaofeiPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '行政许可') {
        this.currentXingzhengPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '招投标信息') {
        this.currentZhaobiaoPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '进出口信息') {
        this.currentJinchuPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '融资信息') {
        this.currentRongziPage = 1;
      } else {
        this.currentPage = 1;
      }
      this.changeTypeOk();
    },
    // onPickerCancel() {},
    // onPickerSure() {
    //   this.onRegionConfirm();
    // },

    // 分组信息查询
    async postGroupList() {
      let result = await postQueryByName({ pageSize: 999, pageNum: 1 });
      if (result == null) {
        this.groupList = [];
      } else {
        this.groupList = result.records;
      }
    },
    // 根据分组信息查询
    clickGroupLabels(tag, i) {
      this.groupName = tag.groupId;
    },
    // 分组信息点击重置
    groupConfirmCancel() {
      this.groupName = '';
      this.groupValue = '';
      if (this.typeName == '工商风险') {
        this.currentPage = 1;
      } else if (this.typeName == '舆情信息') {
        this.currentYuqingPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '失信信息') {
        this.currentShixinPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '被执行人信息') {
        this.currentZhixingPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '裁判文书') {
        this.currentWenshuPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '法院公告') {
        this.currentFayuanPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '限制高消费') {
        this.currentXiaofeiPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '行政许可') {
        this.currentXingzhengPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '招投标信息') {
        this.currentZhaobiaoPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '进出口信息') {
        this.currentJinchuPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '融资信息') {
        this.currentRongziPage = 1;
      } else {
        this.currentPage = 1;
      }
      this.changeTypeOk();
    },
    // 分组信息点击确定
    groupConfirmSure() {
      this.$refs.group.toggle(false);
      this.groupValue = this.groupName;
      if (this.typeName == '工商风险') {
        this.currentPage = 1;
      } else if (this.typeName == '舆情信息') {
        this.currentYuqingPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '失信信息') {
        this.currentShixinPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '被执行人信息') {
        this.currentZhixingPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '裁判文书') {
        this.currentWenshuPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '法院公告') {
        this.currentFayuanPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '限制高消费') {
        this.currentXiaofeiPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '行政许可') {
        this.currentXingzhengPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '招投标信息') {
        this.currentZhaobiaoPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '进出口信息') {
        this.currentJinchuPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '融资信息') {
        this.currentRongziPage = 1;
      } else {
        this.currentPage = 1;
      }
      this.changeTypeOk();
    },
    clickYearLabels(tag, i) {
      this.yearName = tag.value;
      this.endDateValue = '';
      this.startDateValue = '';
      this.endTime = '';
      this.startTime = '';
    },
    startDateSearch() {
      this.yearName = '';
      this.yearValue = '';
      this.isShowDatePicker = true;
      this.startDateShow = true;
    },

    endDateSearch() {
      this.yearName = '';
      this.yearValue = '';
      this.isShowDatePicker = true;
      this.endDateShow = true;
    },

    formatDate(date) {
      if (date.getMonth() + 1 < 10) {
        return `${date.getYear() + 1900}-0${date.getMonth() + 1}-${date.getDate()}`;
      } else {
        return `${date.getYear() + 1900}-${date.getMonth() + 1}-${date.getDate()}`;
      }
    },
    formatUpdateDate(date) {
      if (date.getMonth() + 1 < 10) {
        if (date.getDate() < 10) {
          return `${date.getYear() + 1900}0${date.getMonth() + 1}0${date.getDate()}`;
        } else {
          return `${date.getYear() + 1900}0${date.getMonth() + 1}${date.getDate()}`;
        }
      } else {
        if (date.getDate() < 10) {
          return `${date.getYear() + 1900}${date.getMonth() + 1}0${date.getDate()}`;
        } else {
          return `${date.getYear() + 1900}${date.getMonth() + 1}${date.getDate()}`;
        }
      }
    },
    onConfirm(date) {
      this.startDateShow = false;
      this.isShowDatePicker = false;
      this.startDateValue = this.formatDate(date)
      this.startTime = this.formatUpdateDate(date)
    },
    onEndConfirm(date) {
      this.endDateShow = false;
      this.isShowDatePicker = false;
      this.endDateValue = this.formatDate(date)
      this.endTime = this.formatUpdateDate(date)
    },
    startDateCancel() {
      this.startDateValue = '';
      this.startDateShow = false;
      this.endDateShow = false;
      this.isShowDatePicker = false;
    },
    endDateCancel() {
      this.endDateValue = '';
      this.startDateShow = false;
      this.endDateShow = false;
      this.isShowDatePicker = false;
    },

    confirmDateCancel() {
      this.endDateValue = '';
      this.startDateValue = '';
      this.endTime = '';
      this.startTime = '';
      this.yearName = '';
      this.yearValue = '';
      if (this.typeName == '工商风险') {
        this.currentPage = 1;
      } else if (this.typeName == '舆情信息') {
        this.currentYuqingPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '失信信息') {
        this.currentShixinPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '被执行人信息') {
        this.currentZhixingPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '裁判文书') {
        this.currentWenshuPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '法院公告') {
        this.currentFayuanPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '限制高消费') {
        this.currentXiaofeiPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '行政许可') {
        this.currentXingzhengPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '招投标信息') {
        this.currentZhaobiaoPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '进出口信息') {
        this.currentJinchuPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '融资信息') {
        this.currentRongziPage = 1;
      } else {
        this.currentPage = 1;
      }
      this.changeTypeOk();
      this.$refs.year.toggle(false);
    },
    confirmDateSure() {
      const timestamp = Date.now();
      if (this.yearName !== '') {
        if (this.yearName == '今天') {
          this.endTime = this.geshiTime(timestamp);
          this.startTime = this.geshiTime(timestamp);
        } else if (this.yearName == '近7天') {
          this.endTime = this.geshiTime(timestamp);
          this.startTime = this.geshiTime(timestamp - 24 * 60 * 60 * 7 * 1000);;
        } else if (this.yearName == '近30天') {
          this.endTime = this.geshiTime(timestamp);
          this.startTime = this.geshiTime(timestamp - 24 * 60 * 60 * 30 * 1000);;
        }
      }
      if (this.typeName == '工商风险') {
        this.currentPage = 1;
      } else if (this.typeName == '舆情信息') {
        this.currentYuqingPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '失信信息') {
        this.currentShixinPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '被执行人信息') {
        this.currentZhixingPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '裁判文书') {
        this.currentWenshuPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '法院公告') {
        this.currentFayuanPage = 1;
      } else if (this.typeName == '司法风险' && this.typeValue == '限制高消费') {
        this.currentXiaofeiPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '行政许可') {
        this.currentXingzhengPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '招投标信息') {
        this.currentZhaobiaoPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '进出口信息') {
        this.currentJinchuPage = 1;
      } else if (this.typeName == '经营动态' && this.typeValue == '融资信息') {
        this.currentRongziPage = 1;
      } else {
        this.currentPage = 1;
      }
      this.changeTypeOk();
      this.$refs.year.toggle(false);
    },
    // 格式化时间
    geshiTime(time) {
      const date = new Date(time);
      const year = date.getFullYear();
      const month = date.getMonth() + 1;
      const day = date.getDate();
      if (month < 10) {
        if (day < 10) {
          return time = `${year}0${month}0${day}`
        } else {
          return time = `${year}0${month}${day}`
        }
      } else {
        if (day < 10) {
          return time = `${year}${month}0${day}`
        } else {
          return time = `${year}${month}${day}`
        }
      }
    },
    changeTypeOk() {
      this.pageLoading = false;
      if (this.typeName == '工商风险') {
        this.postCompanyChange();
      } else if (this.typeName == '舆情信息') {
        this.postMonitorNews();
      } else if (this.typeName == '司法风险' && this.typeValue == '失信信息') {
        this.postMonitorShixin();
      } else if (this.typeName == '司法风险' && this.typeValue == '被执行人信息') {
        this.postMonitorZhixing();
      } else if (this.typeName == '司法风险' && this.typeValue == '裁判文书') {
        this.postMonitorJudgement();
      } else if (this.typeName == '司法风险' && this.typeValue == '法院公告') {
        this.postMonitorCourt();
      } else if (this.typeName == '司法风险' && this.typeValue == '限制高消费') {
        this.postLimitHighconsume();
      } else if (this.typeName == '经营动态' && this.typeValue == '行政许可') {
        this.postCreditChinaLicense();
      } else if (this.typeName == '经营动态' && this.typeValue == '招投标信息') {
        this.postBiddingBaseinfo();
      } else if (this.typeName == '经营动态' && this.typeValue == '进出口信息') {
        this.postImportExportDetail();
      } else if (this.typeName == '经营动态' && this.typeValue == '融资信息') {
        this.postImportFinancing();
      } else {
        this.postCompanyChange();
      }
    },

    // 滚动到页面底部时，请求内容
    scrollBottom() {
      let scrollTop = document.documentElement.scrollTop || document.body.scrollTop  //页面滚动的高度
      let clientHeight = document.documentElement.clientHeight  //可视区域高度
      let scrollHeight = document.documentElement.scrollHeight  //可滚动内容的高度
      let bottomOfWindow = scrollTop + clientHeight + 1000 >= scrollHeight    //是否滚动到底部
      //loading 和 this.tableData.length和this.total是自己的判断条件
      if (scrollTop !== 0 && bottomOfWindow && !this.loading) {
        this.loading = true;
        if (this.typeName == '工商风险') {
          this.currentPage += 1;
        } else if (this.typeName == '舆情信息') {
          this.currentYuqingPage += 1;
        } else if (this.typeName == '司法风险' && this.typeValue == '失信信息') {
          this.currentShixinPage += 1;
        } else if (this.typeName == '司法风险' && this.typeValue == '被执行人信息') {
          this.currentZhixingPage += 1;
        } else if (this.typeName == '司法风险' && this.typeValue == '裁判文书') {
          this.currentWenshuPage += 1;
        } else if (this.typeName == '司法风险' && this.typeValue == '法院公告') {
          this.currentFayuanPage += 1;
        } else if (this.typeName == '司法风险' && this.typeValue == '限制高消费') {
          this.currentXiaofeiPage += 1;
        } else if (this.typeName == '经营动态' && this.typeValue == '行政许可') {
          this.currentXingzhengPage += 1;
        } else if (this.typeName == '经营动态' && this.typeValue == '招投标信息') {
          this.currentZhaobiaoPage += 1;
        } else if (this.typeName == '经营动态' && this.typeValue == '进出口信息') {
          this.currentJinchuPage += 1;
        } else if (this.typeName == '经营动态' && this.typeValue == '融资信息') {
          this.currentRongziPage += 1;
        } else {
          this.currentPage += 1;
        }
        this.scrollOk();
      }
    },

    scrollOk() {
      if (this.typeName == '工商风险') {
        this.postCompanyChange();
      } else if (this.typeName == '舆情信息') {
        this.postMonitorNews();
      } else if (this.typeName == '司法风险' && this.typeValue == '失信信息') {
        this.postMonitorShixin();
      } else if (this.typeName == '司法风险' && this.typeValue == '被执行人信息') {
        this.postMonitorZhixing();
      } else if (this.typeName == '司法风险' && this.typeValue == '裁判文书') {
        this.postMonitorJudgement();
      } else if (this.typeName == '司法风险' && this.typeValue == '法院公告') {
        this.postMonitorCourt();
      } else if (this.typeName == '司法风险' && this.typeValue == '限制高消费') {
        this.postLimitHighconsume();
      } else if (this.typeName == '经营动态' && this.typeValue == '行政许可') {
        this.postCreditChinaLicense();
      } else if (this.typeName == '经营动态' && this.typeValue == '招投标信息') {
        this.postBiddingBaseinfo();
      } else if (this.typeName == '经营动态' && this.typeValue == '进出口信息') {
        this.postImportExportDetail();
      } else if (this.typeName == '经营动态' && this.typeValue == '融资信息') {
        this.postImportFinancing();
      } else {
        this.postCompanyChange();
      }
    },

    monitorType(type) {
      sessionStorage.setItem('jumpType', 'category')
      if (this.typeName == '工商风险') {
        sessionStorage.setItem('changeDetail', JSON.stringify(type))
        this.$router.push({ path: 'BusinessChangeDetail' })
      } else if (this.typeName == '司法风险' && this.typeValue == '失信信息') {
        sessionStorage.setItem('PromiseInfoData', JSON.stringify(type))
        this.$router.push({ path: 'PromiseInfoDetail' })
      } else if (this.typeName == '司法风险' && this.typeValue == '裁判文书') {
        sessionStorage.setItem('JudgmentsDetailData', JSON.stringify(type))
        this.$router.push({ path: 'JudgmentsDetail' })
      } else if (this.typeName == '司法风险' && this.typeValue == '被执行人信息') {
        sessionStorage.setItem('judgmentDebtorInfoData', JSON.stringify(type))
        this.$router.push({ path: 'JudgmentDebtorInfoDetail' })
      } else if (this.typeName == '司法风险' && this.typeValue == '法院公告') {
        sessionStorage.setItem('courtAnnouncementsData', JSON.stringify(type))
        this.$router.push({ path: 'CourtAnnouncementsDetail' })
      } else if (this.typeName == '舆情信息') {
        sessionStorage.setItem('OpinionReputationData', JSON.stringify(type))
        this.$router.push({ path: 'OpinionReputation' })
      }
      console.log(type)
      // if (type === 'b') {
      //   this.$router.push({path: 'Judicature'})
      // } else if (type === 'c') {
      //   this.$router.push({path: 'OpinionReputation'})
      // } else if (type === 'd') {
      //   this.$router.push({path: 'OtherRisks'})
      // } else if (type === 'a') {
      //   console.log(111)
      //   this.$router.push({path: 'IndustrialChange'})
      // }
    },
    toMonitor(id) {
      this.operate = true;
      sessionStorage.setItem('monitorId', id);
      sessionStorage.setItem('isFromHome', 'isNo');
      this.$router.push({ path: '/MonitorStation' })
    },
    toReport(companyId){
      sessionStorage.setItem('companyId',companyId);
      this.$router.push({ path: '/NewReport' })
    },
    returnClick() {
      sessionStorage.setItem('tabBarActiveIndex', '0');
      this.$router.push({ path: '/dashboard/home' })
    },
  },
  beforeDestroy() {
    // PubSub.unsubscribe('categoryAddToCart');
  }
}
</script>

<style lang="less" scoped>
.header-title {
  height: 46px;
  width: 100%;
  background-color: #fff;
  text-align: center;
}

.header-title-btn {
  border-radius: 15px;
  margin-top: 0.5rem;
  background-color: #f4f4f4;
  align-items: center;
  justify-content: center;
  display: inline-flex;
}

.buttonClick {
  color: #595959 !important;
  background-color: #f4f4f4;
  border: 1px solid #f4f4f4;
}

.van-item-style {
  font-size: 15px;
  font-weight: bold;
  color: #96989e;
  margin-bottom: 5px;
}

.operate-btn {
  position: absolute;
  top: 13px;
  right: 20px;
  color: #2372EB;
  font-weight: bold;
  font-size: small;
}

.seven-add {
  font-size: 11px;
  padding: 1px 5px;
  color: #fff;
  background-color: #EE8C15;
  margin-top: 20px;
}

.manage-body {
  margin-top: 10px;
  background-color: #fff;
  padding: 20px 10px 0px 10px;
}

/deep/ .van-nav-bar__text {
  color: gray !important;
  font-weight: bold;
}

.icon-mg {
  margin-left: 3px;
}

.col-weight {
  font-weight: bold;
}

.card-icon {
  float: left;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.7rem;
  border-radius: 5px;
  margin: 0 auto;
  text-align: center;
  margin-top: 20px;
  //background-color: #EE8C15;
  color: #fff;
  margin-right: 10px;
  line-height: 2.5rem;
}

/deep/ .van-card__thumb {
  width: 60px;
}

.search-btn {
  margin: 10px;
  font-size: 15px;
  color: #595959;
}

.van-item /deep/ .van-grid-item__content--center {
  -webkit-align-items: left;
  align-items: normal;
  margin-left: 10px;
}

/deep/ .van-grid-item__content {
  padding-top: 3px !important;
  background-color: #fafbfd;
}

/deep/ .van-dropdown-menu__bar--opened {
  z-index: 10 !important;
}

/deep/ .van-button--mini {
  height: 28px !important;
  font-size: 14px !important;
}

.bg-2372eb {
  background: #2372EB;
}

.bg-ee8c15 {
  background: #ee8c15;
}

.bg-11c95f {
  background: #11c95f;
}

.bg-e21183 {
  background: #e21183;
}

.bg-fde809 {
  background: #fde809;
}

.bg-17b9d7 {
  background: #17b9d7;
}

.bg-db2c2c {
  background: #db2c2c;
}

.bg-9232db {
  background: #9232db;
}

.bg-8c8c8c {
  background: #8c8c8c;
}</style>