index.vue 6.36 KB
<template>
  <div class="home">
    <div class="home-left">
      <el-row :gutter="8">
        <el-col :span="12">
          <el-card shadow="hover" :body-style="{ padding: '0' }">
            <ul class="workbench flexst">
              <li v-for="(item, index) in newsListData" class="pointer" :key="index"
                :style="{ backgroundColor: item.color }">
                <i class="el-icon-s-claim"></i>
                {{ item.title }}
              </li>
            </ul>
          </el-card>
        </el-col>
        <el-col :span="12">
          <el-card shadow="hover"  style="height:245px">
            <div slot="header" class="flexst">
              <h5 class="title">系统通知</h5>
              <i class="el-icon-s-unfold pointer"></i>
            </div>
            <ul>
              <li v-for="(item, index) in noticeList" :key="index" class="flexst pointer">
                <p class="list-title">{{ item.noticeTitle }}</p>
                <p class="marginZL15">{{ item.createtime }}</p>
                <p v-if="item.userBrowse == '1'" style="color:red">未读</p>
                <p v-else>已读</p>
              </li>
            </ul>
          </el-card>
        </el-col>
      </el-row>
      <el-row :gutter="8" class="marginTop10">
        <el-col :span="12">
          <el-card shadow="hover" style="height:280px">
            <div slot="header" class="flexst">
              <h5 class="title">待办事项</h5>
              <i class="el-icon-s-unfold pointer"></i>
            </div>
            <ul>
              <li v-for="(item, index) in todoList" :key="index" class="flexst">
                <p class="right15">{{ item.dealTime }}</p>
                <p class="list-title">{{ item.dealBusiness }} ({{item.dealStep+ '环节'}})</p>
              </li>
            </ul>
          </el-card>
        </el-col>
        <el-col :span="12">
          <el-card shadow="hover" style="height:280px">
            <div slot="header" class="flexst">
              <h5 class="title">法律法规</h5>
              <i class="el-icon-s-unfold pointer"></i>
            </div>
            <ul>
              <li v-for="(item, index) in policyList" @click="handleView(item.noticeFileUrl)" :key="index" class="flexst pointer">
                <p class="right15">{{ item.noticeTitle }}</p>
                <p class="list-title">{{ item.createtime }}</p>
              </li>
            </ul>
          </el-card>
        </el-col>
      </el-row>
      <el-card shadow="hover" class="marginTop10" :body-style="{ paddingRight: '6px' }">
        <div id="mountNode"></div>
      </el-card>
    </div>
    <div class="home-right">
      <calendar />
      <el-card shadow="hover" class="marginTop10">
        <div slot="header" class="flexst">
          <h5 class="title">动态信息</h5>
          <i class="el-icon-s-unfold pointer"></i>
        </div>
        <ul>
          <li v-for="(item, index) in doneList" :key="index" class="flexst">
            <p class="right15">{{ item.dealTime }}</p>
            <p class="list-title">{{ item.dealBusiness }} ({{item.dealStep+ '环节'}})</p>
          </li>
        </ul>
      </el-card>
    </div>
  </div>
</template>
<script>
import * as G2 from '@antv/g2'
import calendar from '@/components/Calendar/index'
import { getHomeNoticeList, getHomeTodoList, getHomeDoneList } from "@/api/home.js";
import { setReadStatus } from "@/api/notice.js";
export default {
  name: 'home',
  components: { calendar },
  data () {
    return {
      newsListData: [
        {
          icon: '',
          title: '任务',
          color: '#61AEFF'
        },
        {
          icon: '',
          title: '邮件',
          color: '#43DEB3'
        },
        {
          icon: '',
          title: '消息',
          color: '#F3C143'
        },
        {
          icon: '',
          title: '日历',
          color: '#F09936'
        },
        {
          icon: '',
          title: '常用功能',
          color: '#9C92FF'
        },
        {
          icon: '',
          title: '申请',
          color: '#589FFF'
        }
      ],
      chartData: [{
        year: '1991',
        value: 15468
      }, {
        year: '1992',
        value: 16100
      }, {
        year: '1993',
        value: 15900
      }, {
        year: '1994',
        value: 17409
      }, {
        year: '1995',
        value: 17000
      }, {
        year: '1996',
        value: 31056
      }, {
        year: '1995',
        value: 17000
      }, {
        year: '1996',
        value: 31056
      }],
      noticeList: [],
      todoList: [],
      doneList: [],
      policyList: []
    }
  },
  mounted () {
    this.buildChart();
    this.queryTodoList();
    this.queryDoneList();
    this.queryNoticeList();
  },
  methods: {
    handleView (pdfUrl) {
      const href = pdfUrl
      window.open(href, '_blank');
    },
    //获取待办事项列表
    queryTodoList(){
      getHomeTodoList().then(res => {
        if(res.result){
          this.todoList = res.result
        }
      })
    },
    //获取已办事项列表
    queryDoneList(){
      getHomeDoneList().then(res => {
        if(res.result){
          this.doneList = res.result
        }
      })
    },
    //获取通知列表
    queryNoticeList(){
      getHomeNoticeList().then(res => {
        if(res.result){
            this.noticeList = res.result.noticeList
            this.policyList = res.result.policyList
        }
      })
    },
    //点击通知调取已读接口
    toSetRead(bsmNotice){
      setReadStatus({'bsmNotice':bsmNotice})
    },
    buildChart () {
      var chart = new G2.Chart({
        container: 'mountNode',
        height: 205
      });
      const e = document.createEvent('Event')
      e.initEvent('resize', true, true)
      window.dispatchEvent(e)
      chart.source(this.chartData);
      chart.scale({
        value: {
          min: 10000
        },
        year: {
          range: [0, 1]
        }
      });
      chart.axis('value', {
        label: {
          formatter: function formatter (val) {
            return (val / 10000).toFixed(1) + 'k';
          }
        }
      });
      chart.tooltip({
        crosshairs: true
      })
      chart.forceFit();
      chart.area().position('year*value').shape('smooth');
      chart.line().position('year*value').size(2).shape('smooth');
      chart.render();
    }
  }
}
</script>
<style scoped lang="scss">
@import "~@/styles/mixin.scss";
@import "./index.scss";
</style>