<template>
  <div class="yp—home flex">
    <!-- 左边 -->
    <div class="leftbox">
      <div class="title">
        <span v-for="idx in 3" :key="idx" :class="'sircleL'+idx" class="sircle mr5"></span>
        <span class="ml10 mr10">专题统计</span>
        <span v-for="idx in 3" :key="idx" :class="'sircleR'+idx" class="sircle ml5"></span>
      </div>
      <div class="commCnt">
        <div class="hh50">
          <div class="comm-title">处置统计</div>
          <div class="echartsBox">
            <MoreBarEcharts echartsId="cztjEcharts" :data="obj.data_cztj"></MoreBarEcharts>
          </div>
        </div>
        <div class="hh50">
          <div class="comm-title">会商统计</div>
          <div class="echartsBox">
            <LineEcharts echartsId="hstjEcharts" :data="obj.data_hstj"></LineEcharts>
          </div>
        </div>
      </div>
    </div>
    <!-- 右边 -->
    <div class="rightbox">
      <div class="title">
        <span v-for="idx in 3" :key="idx" :class="'sircleL'+idx" class="sircle mr5"></span>
        <span class="ml10 mr10">研判首页</span>
        <span v-for="idx in 3" :key="idx" :class="'sircleR'+idx" class="sircle ml5"></span>
         <el-button class="btn" type="primary">研判报告</el-button>
      </div>
      <div class="commCnt">
        <div ref="searchBox">
          <Search :searchArr="searchConfiger" @submit="onSearch" :key="pageData.keyCount" />
        </div>
        <ul class="listBox" :style="{height:pageData.boxHeight+'px'}">
          <li class="list-item" ref="listBoxRef" v-for="(it,idx) in list" :key="idx">
            <div class="comm-title title-s">{{ it.title }}</div>
            <div class="list-table" >
              <MyTable
                :tableData="it.tableData"
                :tableColumn="pageData.tableColumn"
                :tableHeight="pageData.tableHeight"
                :key="pageData.keyCount+idx"
                :isScroll="true"
                :fixed="false"
                :tabelModel="it.title"
                :tableConfiger="pageData.tableConfiger"
                :controlsWidth="pageData.controlsWidth"
                @changePage="changePage"
              >
                <!-- 操作 -->
                <template #controls="{ row }">
                  <el-link type="primary" size="small">详情</el-link>
                  <el-link type="primary" size="small">网上会商</el-link>
                  <el-link type="primary" size="small">处置</el-link>
                  <el-link type="primary" size="small">反馈</el-link>
                </template>
              </MyTable>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script setup>
import MoreBarEcharts from "@/views/home/echarts/moreBarEcharts.vue";
import LineEcharts from "@/views/home/echarts/moreLineEcharts.vue";
import Search from "@/components/aboutTable/Search.vue";
import MyTable from "@/components/aboutTable/DarkTable.vue";
import { nextTick, onMounted, reactive ,ref } from 'vue';
import { fa } from "element-plus/es/locale.mjs";
const searchBox = ref();
const listBoxRef = ref();
const obj = reactive({
   data_cztj:{
    xData:['上访','诈骗','敲诈勒索','盗窃','涉黄','涉毒','强奸猥亵','灾害事故','自杀'],
    color:[['#0DBAC5','#28EEBF'],['#F06C0D','#EEB416']],
    labelColor:'#000',
    list:[
      {label:'总数',val:[30,20,10,60,50,60,35,45,20]},
      {label:'未办结',val:[40,30,20,50,30,44,50,45,62]},
    ]
  },
  data_hstj:{
    xData:['上访','诈骗','敲诈勒索','盗窃','涉黄','涉毒','强奸猥亵','灾害事故','自杀'],
    color:['#0386FB','#00FFFF'],
    labelColor:'#000',
    list:[
      {label:'总数',val:[30,20,10,60,50,60,35,45,20]},
      {label:'已会商',val:[40,30,20,50,30,44,50,45,62]},
    ]
  }
})
const searchConfiger = ref([
  { label: "专题来源", prop: "ztly", placeholder: "请选择",  showType: "select"},
  { label: "所属专题", prop: "sszt", placeholder: "请输入",  showType: "input"},
  { label: "线索内容", prop: "xsnr", placeholder: "请输入",  showType: "input"},
  { label: "时间段", prop: "sjd", placeholder: "请输入",  showType: "daterange"},
  { label: "会商情况", prop: "hsqk", placeholder: "请选择",  showType: "select"},
])

const list = reactive([
  { title:'上访', tableData:[
    { bt:' 张三上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 李四上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 王五上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 赵二上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 王五上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 赵二上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 王五上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 赵二上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 王五上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 赵二上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 王五上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 赵二上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 王五上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 赵二上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 王五上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 赵二上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 王五上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
    { bt:' 赵二上访', nr:'低价快速的还是', rs:'25', ztfl:'上访', sbsj:'2025/02/19',},
  ]},
  { title:'诈骗', tableData:[]},
  { title:'敲诈勒索',tableData:[]},
  { title:'盗窃',tableData:[]},
  { title:'涉黄',tableData:[]},
  { title:'涉赌',tableData:[]},
  { title:'涉毒',tableData:[]},
  { title:'强奸猥亵',tableData:[]},
])

const pageData = reactive({
 tableColumn:[
    { label: "线索标题", width:55, prop: "bt",showOverflowTooltip: true},
    { label: "线索内容", prop: "nr",showOverflowTooltip: true},
    { label: "涉及人数",width:55, prop: "rs",showOverflowTooltip: true},
    { label: "专题分类", prop: "ztfl",showOverflowTooltip: true},
    { label: "上报时间",width:55, prop: "sbsj",showOverflowTooltip: true},
  ],
  keyCount: 0,
  tableConfiger: {
    rowHieght: 61,
    showSelectType: "null",
    loading: false,
    showIndex:false,
    rowHeight: 30,
  },
  controlsWidth: 200, //操作栏宽度
});
onMounted(() => {
  tabHeightFn();
});

// 滚动加载
const changePage = (val) => {
  console.log(val,'滚动加载');
};

// 表格高度计算
const tabHeightFn = () => {
  pageData.boxHeight = window.innerHeight - searchBox.value.offsetHeight - 250;
  nextTick(() => {
    pageData.tableHeight = listBoxRef.value[0].offsetHeight - 40;
  }); 
  window.onresize = function () {
    tabHeightFn();
  };
};

</script>

<style lang="scss" scoped>
.yp—home{
  width: 100%;
  height: 100%;
  padding-top: 15px;
  box-sizing: border-box;
  color: #000;
  .leftbox{
    width:500px;
    height: 100%;
    margin-right: 10px;
    background: #fff;
  }
  .rightbox{
    flex: 1 0 0;
    background: #fff;
  }
}

@mixin common($width: 16px,$opacity:1){
  height: $width;
  width: $width;
  border-radius: 50%;
  background: #0386FB;
  opacity: $opacity;
}

// 共同
.title{
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  font-size: 24px;
  position: relative;
  .sircle{
    display: inline-block;
  }
  .sircleL1{
    @include common(8px,0.5);
  }
  .sircleL2{
    @include common(12px,0.75);
  }
  .sircleL3{
    @include common(16px);
  }
  .sircleR1{
    @include common(16px);
  }
  .sircleR2{
    @include common(12px,0.75);
  }
  .sircleR3{
    @include common(8px,0.5);
  }
  .btn{
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
  }
}

.commCnt{
  height: calc(100% - 60px);
  overflow: hidden;
  overflow-y: auto;
  padding: 10px 20px;
  box-sizing: border-box;
  .comm-title{
    position: relative;
    font-size: 20px;
    &::before{
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      width: 78px;
      height: 4px;
      background: linear-gradient( 90deg, #3596F9 0%, rgba(53,150,249,0) 100%);
      border-radius: 4px 4px 4px 4px;
    }
  }
  
  .echartsBox{
    height: calc(100% - 30px);
    margin-top: 4px;
  }
  
}

.listBox{
  margin-top: 4px;
  border-radius: 10px;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
  overflow-y: auto;
  .list-item{
    width: 49.5%;
    height: calc(100% / 2 - 5px);
    box-shadow: 0px 0px 4px 0px rgba(0,0,0,0.02);
    border-radius: 8px 8px 8px 8px;
    border: 1px solid #E8EDF6;
    padding: 4px 4px;
    box-sizing: border-box;
    margin-bottom: 5px;
    .title-s{
      font-size: 16px;
    }
    .list-table{
      height: calc(100% - 30px);
      margin-top: 5px;
    }
  }
  .list-item:nth-child(2n+1){
    margin-right: 1%;
  }
}
::v-deep .searchBox{
  margin-bottom:0 !important;
  padding: 2px !important;
}
::v-deep .pageSearch .box .item {
  width: 16%;
}

::v-deep .el-table .table_blue_row {
  background: #fff !important;
}
::v-deep .el-table th.el-table__cell{
  font-size: 13px;
  background: #EFF5F7;
}

::v-deep .el-table__empty-block{
  width: 100%!important;
}

::v-deep .el-scrollbar__view{
  border-right: none;
}

::v-deep .el-table .el-table__cell{
  padding: 0;
}

::v-deep .el-table th.el-table__cell>.cell{
  padding: 8px 0;
}

::v-deep .el-link {
  margin: 3px;
}

</style>
