<template>


  <div class="twinfo_show_list_pc_1">
   <div class="container">
      <div class="row">
         <div class="col-lg-2 col-md-3 col-sm-4 col-xs-12">
            <div class="showlist-sidemenu">
               <ul>
                  <li v-for="(list,i) in menuLeft" :key="i" :class="{'active':active===i}" @click="getList(i,list.catName)"><a href="javascript:void(0)">{{list.catName}}</a></li>

               </ul>
            </div>
         </div>
         <div class="col-lg-10 col-md-9 col-sm-8 col-xs-12">
            <div class="showlist-main">
               <div class="showlist-title">
                  <span class="sp1">{{iname}}</span>
               </div>
               <div class="showlist-body">
                  <span class="statistics">共有<i>{{totalCount}}</i>条新闻</span>
                  <ul>
                     <li v-for="(list,i) in listMenu" :key="i"><a target="_blank" :href="'/infodetail?id='+list.articleId">{{list.title}}</a><span>{{list.newsPubDate}}</span></li>

                  </ul>
               </div>
            </div>
         </div>
      </div>
      <div class="row">
         <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
            <div class="search-result-page">
                <div style="margin-top:30px;">
                  <el-pagination
                  background
                  layout="total, sizes, prev, pager, next, jumper"
                  :page-sizes="[10, 20, 50, 100]"
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="currentPage4"
                  :total="totalCount">
                  </el-pagination>
                </div>
            </div>
         </div>
      </div>
   </div>
</div>

</template>

<script>
import formMixin from "../../../src/mixins/formMixin";
import lenye_base from "lenye_base";
import * as $ from "fy-kit";
import login from "../../login";
import msg from "../../message";
import pagination from "../../pagination";

export default {
  name: "ElList",
  mixins: [formMixin],
  components: {
    login,
    msg,
    pagination
  },
  props: {
    placeholder: {
      type: String,
      default: "总访问量a"
    }
  },
  data() {
    return {
      active:0,
      menuLeft:[],
      listMenu:[],
      totalCount:0,
      currentPage4:1,
      rows:10,
      page:1,
      catName:'',
      iname:''
    };
  },
  mounted() {
    this.getInfo(0);
  },
  computed: {
    defaultAttrs() {
      return {
        placeholder: this.t("ele-form.input") + this.desc._label
      };
    }
  },
  methods: {
    handleSizeChange(val) {
        this.rows = val;
        this.getList(this.active,this.catName);

    },
    handleCurrentChange(val) {
        this.page = val;
        this.getList(this.active,this.catName);
    },
    getList(num,catName){
      this.catName =catName;
      this.iname =  catName;
       $.util
        .ajax(
          lenye_base.base_data.getapiUrl() +
            "/news-service/common/newsArticle/queryShowPage.do",
          lenye_base.base_data.getformatting({
            siteId: lenye_base.site_data.getsiteData().siteId,
            catName,
             rows: this.rows,
            page:this.page,
            //parentName:$.util.storage('parentName').get().getValue()
          })
        )
        .then(res => {
          if (res.success == "1") {
            this.listMenu = res.data;
            this.totalCount = res.totalCount;
            this.active = num;
          }else{
            msg.error(res.message);
          }
        });
    },
    getInfo(num){
       $.util
        .ajax(
          lenye_base.base_data.getapiUrl() +

             "/news-service/common/newsCategory/queryUsableTree.do",
          lenye_base.base_data.getformatting({
            siteId: lenye_base.site_data.getsiteData().siteId,
            cascade:1,
            parentName: $.util.urlParams("name") || ''
          })
        )
        .then(res => {
          if (res.success == "1") {
            this.menuLeft = res.data;
            this.iname = res.data[0].catName;
            this.getList(num,res.data[0].catName);
          }else{
            msg.error(res.message);
          }
        });
    },
    query() {
      $.util
        .ajax(
          lenye_base.base_data.getapiUrl() +
            "/cert-service/common/ctUserCert/queryManagePage.do",
          lenye_base.base_data.getformatting({
            sites: lenye_base.site_data.getsiteData().siteId,
            ucIdcard:this.ucIdcard,
            ucName: this.ucName,
            ucCertNo: this.ucCertNo,
          })
        )
        .then(res => {
          if (res.success != "1") {
            msg.error(res.message);
          }
        });
    }

  }
};
</script>
