<!-- 委员会公文列表 -->
<template>
  <div class="autoBox box1" style="position: relative; background: #f5f5f5">
    <div class="center" style="display: flex; margin-top: -20px">
      <div class="left">
        <div class="centerLeft1">
          <div class="top">
            <div class="top1"></div>
            <div class="top2"></div>
            <div class="allApplication">
              <span>{{ $t("common.document") }}</span>
            </div>
            <div @click="back" class="more mouse">
              <span>{{ "<" }}{{ $t("common.return") }}</span>
            </div>
          </div>
          <div class="tab">
            <div class="leftTitle">
              <span style="font-size: 14px; font-weight: 700"
                >{{ $t("common.name") }}:</span
              >
            </div>
            <div class="input">
              <el-input
                style="width: 261px; margin-left: 8px; margin-top: 6px"
                v-model="search"
                :placeholder="$t('common.pleaseInput')"
              >
                <!--<i slot="prefix" class="el-input__icon el-icon-search"></i>-->
              </el-input>
            </div>
            <div class="time" style="margin-left: 40px">
              <span
                style="font-size: 14px; font-weight: 700; margin-right: 10px"
                >{{ $t("common.time") }}:</span
              >

              <el-date-picker
                v-model="value1"
                type="daterange"
                format="yyyy-MM-dd"
                value-format="yyyy-MM-dd"
                :range-separator="$t('common.to')"
                :start-placeholder="$t('common.startTime')"
                :end-placeholder="$t('common.endTime')"
              >
              </el-date-picker>
            </div>
            <div
              class="noticeButton"
              style="margin-left: 20px; margin-top: 5px"
            >
              <el-button
                @click="searchTitle"
                style="width: 90px"
                type="primary"
                >{{ $t("common.search") }}</el-button
              >
              <el-button @click="reset" style="width: 90px">{{ $t("common.reset") }}</el-button>
            </div>
          </div>
          <div v-if="showNav" class="nav">
            <div
              style="padding: 5px 0 0 0"
              class="cursor"
              v-show="islogin && titleIndex == 0"
            >
              <div style="width: 100%">
                <div
                  style="
                    color: #333;
                    font-size: 16px;
                    margin-bottom: 10px;
                    line-height: 29px;
                  "
                >
                  <ul>
                    <li
                      @click="officialDocumentDetail(item)"
                      v-for="(item, index) in documentList"
                      :key="index"
                      class="content"
                    >
                      <el-card>
                        <div class="list">
                          <span class="title">{{ item.title }}</span>
                          <p class="center">{{ item.content }}</p>
                          <span>{{item.releasePeopleName}}</span>
                          <span style="color: rgba(0, 0, 0, 0.65);padding-left: 20px;">
                            {{ item.releaseTime }}
                          </span>
                        </div>
                      </el-card>
                    </li>
                  </ul>
                </div>
              </div>
            </div>
          </div>

          <div v-else style="margin-left: 43%; margin-top: 15%" class="nav">
            <div>
              <el-empty :description="$t('common.noData')"></el-empty>
            </div>
          </div>
          <!-- 分页 -->
          <div class="pag">
            <el-pagination
              type="index"
              background
              layout="prev, pager, next"
              :page-size="3"
              :total="total - 0"
              @current-change="handleCurrentChange"
            ></el-pagination>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getNotificationList } from "@/api/committee/committeeWorkSpace";
import Screen from "@/components/screen";
export default {
  name: "CommitteeOfficialDocumentList",
  props: ["isDistinguish"],
  components: {
    Screen,
  },
  data() {
    return {
      value1: "",
      titleIndex: 0,
      islogin: true,
      search: "",
      screen1s: {
        value: "common.type",
        item: [],
      },
      screen1def: null,
      screen2Item: null,
      documentList: [],
      total: "",
      pageNo: "",
      showNav: null,
      startTime: "",
      endTime: "",
    };
  },
  watch: {
    value1: {
      handler: function () {
        this.startTime = this.value1[0];
        this.endTime = this.value1[1];
      },
      deep: true,
    },
  },
  mounted() {
    window.scrollTo(0, 0);
    this.initData();
  },
  destroyed() {},
  methods: {
    initData() {
      this.accessToDocumentsList();
    },
    // 获取公文列表
    accessToDocumentsList() {
      var params = "1";
      var query = this.pageNo ? this.pageNo : "1";
      var queryConditions = this.search ? this.search : "";
      // var start = this.startTime?this.startTime:""
      // var end = this.endTime?this.endTime:""
      getNotificationList(params, query, queryConditions).then((res) => {
        var data = res.data;
        if (JSON.stringify(data) !== "{}") {
          this.documentList = res.data.nrcCommitteeDocumentAnnouncements;
          this.total = res.data.page.totalCount;
          this.showNav = true;
        } else {
          this.showNav = false;
        }
      });
    },
    handleCurrentChange(val) {
      this.pageNo = val;
      this.accessToDocumentsList();
    },
    // 公文详情
    officialDocumentDetail(item) {
      var params = {
        name: "noticeDetail",
        type: false,
        category: "1",
        id: item.id,
      };
      this.$emit("applicationType", params);
    },

    // 查询
    searchTitle() {
      this.accessToDocumentsList();
      console.log(this.value1);
    },
    // 清空
    reset() {
      this.search = "";
      this.value1 = "";
      this.accessToDocumentsList();
    },
    back() {
      var params = {
        name: "workspace",
        type: false,
      };
      this.$emit("applicationType", params);
    },
    screenBack() {},
    changeTitle(i) {
      this.titleIndex = i;
    },
  },
};
</script>
<style scoped>
.mouse {
  cursor: pointer;
}
.newsTitle {
  display: inline-block;
  /* width: 46%; */
  width: 100px;
  padding: 0 5px;
  height: 40px;
  text-align: center;
  line-height: 40px;
  border-radius: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.title1 {
  background: #286fcf;
  color: #fff;
}
.title2 {
  background: #e9eef2;
  color: #286fcf;
}
.box1 {
  padding: 0 0 20px 0;
  position: absolute;
}
.center {
  display: flex;
}
.topImg img {
  display: inline-block;
  width: 1200px;
  height: 324px;
}
.centerLeft1 {
  height: 900px;
  width: 1200px;
  border-radius: 0px;
  background: #fff;
}
.centerLeft1 .tab {
  position: absolute;
  left: 57px;
  top: 79px;
  display: flex;
  align-items: center;
}
.centerLeft1 .nav {
  position: absolute;
  top: 139px;
  left: 19px;
}
.nav .content {
  width: 1160px;
  /* height: 187px;  */
  margin: 30px 0;
}
.list .title {
  display: inline-block;
  width: 804px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "PingFang SC";
  font-style: normal;
  font-weight: 700;
  font-size: 20px;
  line-height: 22px;
  align-items: center;
  color: rgba(0, 0, 0, 0.85);
  font-feature-settings: "tnum" on, "lnum" on;
}
.list .center {
  font-weight: 400;
  color: rgba(0, 0, 0, 0.85);
  font-size: 14px;
  text-indent: 2em;
  width: 1115px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.left {
  position: relative;
}
.top .top1 {
  position: absolute;
  width: 5.5px;
  height: 10.5px;
  left: 20px;
  top: 35px;
  background: #376ac7;
  z-index: 1;
}
.top .top2 {
  position: absolute;
  width: 5.5px;
  height: 15px;
  left: 20px;
  top: 35px;
  background: #83bd50;
}
.top .allApplication {
  position: absolute;
  height: 22px;
  left: 34px;
  top: 31px;
}
.top .allApplication span {
  font-family: "PingFang SC";
  font-style: normal;
  font-weight: 600;
  font-size: 16px;
  line-height: 22px;
  color: #375586;
}
.top .notice {
  position: absolute;
  height: 22px;
  left: 160px;
  top: 32px;
}
.top .notice span {
  font-family: "PingFang SC";
  font-style: normal;
  font-weight: 600;
  font-size: 16px;
  line-height: 22px;
  color: rgba(10, 10, 10, 0.85);
}
.top .more {
  position: absolute;
  height: 16px;
  right: 21px;
  top: 31px;
}
.top .more span {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 500;
  font-size: 14px;
  line-height: 16px;
  color: #4790f7;
}
.pag {
  position: absolute;
  bottom: 0;
  right: 45%;
}
</style>