Blame view

src/views/home/index.vue 12.9 KB
1
<!--
2
 * @Description:
3
 * @Autor: renchao
1  
renchao@pashanhoo.com committed
4
 * @LastEditTime: 2024-02-01 10:04:32
5
-->
赵千 committed
6
<template>
任超 committed
7 8
  <div class="home">
    <div class="home-left">
9 10 11
      <el-row :gutter="8" class="height50">
        <el-col :span="12" class="height100">
          <el-card shadow="hover" :body-style="{ padding: '0' }" class="height100 homeItem">
蔡俊立 committed
12 13
            <div slot="header" class="flexst">
              <h5 class="title">常办项目</h5>
任超 committed
14
              <el-button type="primary" @click="setFrequencyProject">配置常办</el-button>
蔡俊立 committed
15
            </div>
16
            <ul class="workbench flexst" style="margin:5px">
任超 committed
17
              <li v-for="(item, index) in projectList" @click="handleProject(item)" class="pointer" :key="index"
任超 committed
18
                :style="{ backgroundColor: newsListColor[index] }">
任超 committed
19
                <i class="el-icon-s-claim"></i>
蔡俊立 committed
20
                {{ item.name }}
任超 committed
21 22
              </li>
            </ul>
任超 committed
23 24
          </el-card>
        </el-col>
25 26
        <el-col :span="12" class="height100">
          <el-card shadow="hover" class="height100">
任超 committed
27
            <div slot="header" class="flexst">
蔡俊立 committed
28
              <h5 class="title">系统通知</h5>
蔡俊立 committed
29 30
              <el-popover placement="right" width="50" trigger="hover">
                <ul class="pointer">
1  
renchao@pashanhoo.com committed
31
                  <li @click="handleMore('xxtz')">查看更多</li>
蔡俊立 committed
32 33 34
                </ul>
                <i class="el-icon-s-unfold pointer" slot="reference"></i>
              </el-popover>
任超 committed
35
            </div>
任超 committed
36 37 38
            <ul>
              <li v-for="(item, index) in noticeList" :key="index" @click="handleNotice(item)" class="flexst pointer">
                <p class="list-title">{{ item.noticeTitle }}</p>
蔡俊立 committed
39
                <p class="marginZL15">{{ item.noticePublishTime.substring(0, 10) }}</p>
任超 committed
40
                <p v-if="item.userBrowse == '1'" style="color:red">未读</p>
蔡俊立 committed
41
                <p v-else style="color:green">已读</p>
任超 committed
42 43
              </li>
            </ul>
任超 committed
44 45 46
          </el-card>
        </el-col>
      </el-row>
47 48 49
      <el-row :gutter="8" class="marginTop10 height50">
        <el-col :span="12" class="height100">
          <el-card shadow="hover" class="height100">
任超 committed
50 51
            <div slot="header" class="flexst">
              <h5 class="title">待办事项</h5>
1  
renchao@pashanhoo.com committed
52 53 54 55 56 57
              <el-popover placement="right" width="50" trigger="hover">
                <ul class="pointer">
                  <li @click="handleMore('dbsx')">查看更多</li>
                </ul>
                <i class="el-icon-s-unfold pointer" slot="reference"></i>
              </el-popover>
任超 committed
58 59
            </div>
            <ul>
蔡俊立 committed
60
              <li v-for="(item, index) in todoList" :key="index" class="flexst">
任超 committed
61
                <p class="right15">{{ item.dealTime.substring(0, 10) }}</p>
任超 committed
62
                <p class="list-title" style="text-align:right">{{ item.dealBusiness }} ({{ item.dealStep + '环节' }})</p>
任超 committed
63 64 65 66
              </li>
            </ul>
          </el-card>
        </el-col>
67 68
        <el-col :span="12" class="height100">
          <el-card shadow="hover" class="height100">
任超 committed
69
            <div slot="header" class="flexst">
田浩浩 committed
70
              <h5 class="title">政策法规</h5>
蔡俊立 committed
71 72
              <el-popover placement="right" width="50" trigger="hover">
                <ul class="pointer">
1  
renchao@pashanhoo.com committed
73
                  <li @click="handleMore('flfg')">查看更多</li>
蔡俊立 committed
74 75 76
                </ul>
                <i class="el-icon-s-unfold pointer" slot="reference"></i>
              </el-popover>
任超 committed
77 78
            </div>
            <ul>
任超 committed
79 80
              <li v-for="(item, index) in policyList" @click="handleView(item.noticeFileUrl)" :key="index"
                class="flexst pointer">
任超 committed
81 82
                <p class="right15 list-title">{{ item.noticeTitle }}</p>
                <p>{{ item.createtime.substring(0, 10) }}</p>
任超 committed
83 84 85 86 87
              </li>
            </ul>
          </el-card>
        </el-col>
      </el-row>
88
      <!-- <el-card shadow="hover" class="marginTop10 box-mountNode" id="mountNodeCon"
任超 committed
89
        :body-style="{ padding: '8px 6px 0 6px' }">
任超 committed
90
        <div id="mountNode"></div>
91
      </el-card> -->
任超 committed
92
    </div>
1  
renchao@pashanhoo.com committed
93
    <!-- <div class="home-right">
任超 committed
94
      <el-card shadow="hover">
任超 committed
95 96 97 98 99
        <div slot="header" class="flexst">
          <h5 class="title">用户登录时间</h5>
        </div>
        <div id="loginTime"></div>
      </el-card>
100
      <el-card class="marginTop10" shadow="hover" style="height:60%">
蔡俊立 committed
101 102 103 104 105
        <div slot="header" class="flexst">
          <h5 class="title">动态信息</h5>
          <i class="el-icon-s-unfold pointer"></i>
        </div>
        <ul>
任超 committed
106
          <li v-for="(item, index) in doneList.slice(0, 13)" :key="index" class="flexst dynamicInfo">
任超 committed
107 108
            <p class="right15">{{ item.dealTime.substring(0, 10) }}</p>
            <p class="list-title">{{ item.dealBusiness }} ({{ item.dealStep + '环节' }})</p>
蔡俊立 committed
109 110
          </li>
        </ul>
任超 committed
111
      </el-card>
1  
renchao@pashanhoo.com committed
112
    </div> -->
任超 committed
113
    <addDialog ref="addProject" v-model="projectDialog" :bindItem="projectList" />
赵千 committed
114 115 116
  </div>
</template>
<script>
117 118
  import * as G2 from '@antv/g2'
  import vueSeamlessScroll from "vue-seamless-scroll"
119
  import { getHomeNoticeList, getHomeTodoList, getHomeDoneList, getHomeFrequentProjects } from "@/api/home.js";
120
  import { setReadStatus } from '@/api/sysNotice'
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
  import addDialog from "./components/addProject.vue";
  export default {
    name: 'home',
    components: { vueSeamlessScroll, addDialog },
    data () {
      return {
        listData: [
          {
            icon: '',
            title: '任务'
          },
          {
            icon: '',
            title: '邮件'
          },
          {
            icon: '',
            title: '消息'
          },
          {
            icon: '',
            title: '日历'
          },
          {
            icon: '',
            title: '常用功能'
          },
          {
            icon: '',
            title: '申请'
          }
        ],
        newsListColor: ['#61AEFF', '#43DEB3', '#F3C143', '#F09936', '#9C92FF', '#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: '1996',
          value: 31056
        }],
        // 系统通知
        noticeData: {},
        noticeList: [],//通知列表
        todoList: [],//待办列表
        doneList: [],//已办列表
        policyList: [],//法律法规列表
        projectList: [],//常办项目列表
        projectDialog: false,
        moreNotice: {
          fullPath: '/system/xttz/xttzview',
          name: '系统通知',
          path: '/system/xttz/xttzview',
          meta: { title: '系统通知' }
任超 committed
189
        },
190
      }
蔡俊立 committed
191
    },
192
    mounted () {
193
      // this.buildChart();//构建图标
1  
renchao@pashanhoo.com committed
194
      // this.loginTimeChart()
195 196 197 198
      this.queryTodoList();//获取待办列表
      this.queryDoneList();//获取已办列表
      this.queryNoticeList();//获取通知、法律法规列表
      this.queryProjectList();//获取常办项目列表
蔡俊立 committed
199
    },
200
    methods: {
1  
renchao@pashanhoo.com committed
201 202 203 204 205 206 207 208
      handleMore (val) {
        let obj = {
          'xxtz': '/system/xttz',
          'dbsx': '/ywbl/dbx',
          'flfg': '/system/flfg'
        }
        this.$router.push(obj[val])
      },
yuanbo committed
209 210 211 212 213
      /**
       * @description: handleProject
       * @param {*} item
       * @author: renchao
       */
214 215 216 217
      handleProject (item) {
        let url = item.uri.split('/').slice(0, 3).join('/')
        this.$router.push(url)
      },
yuanbo committed
218 219 220 221 222
      /**
       * @description: handleView
       * @param {*} pdfUrl
       * @author: renchao
       */
223 224 225 226 227
      handleView (pdfUrl) {
        const href = pdfUrl
        window.open(href, '_blank');
      },
      //获取待办事项列表
yuanbo committed
228 229 230 231
      /**
       * @description: 获取待办事项列表
       * @author: renchao
       */
232 233 234 235 236 237 238 239
      queryTodoList () {
        getHomeTodoList().then(res => {
          if (res.result) {
            this.todoList = res.result
          }
        })
      },
      //获取已办事项列表
yuanbo committed
240 241 242 243
      /**
       * @description: 获取已办事项列表
       * @author: renchao
       */
244 245 246 247 248 249 250 251
      queryDoneList () {
        getHomeDoneList().then(res => {
          if (res.result) {
            this.doneList = res.result
          }
        })
      },
      //获取通知列表
yuanbo committed
252 253 254 255
      /**
       * @description: 获取通知列表
       * @author: renchao
       */
256 257 258 259 260 261 262 263 264 265 266 267
      queryNoticeList () {
        getHomeNoticeList().then(res => {
          if (res.result) {
            this.noticeList = res.result.noticeList
            this.noticeList.forEach(item => {
              item.noticePublishTime = this._timedate(item.noticePublishTime)
            })
            this.policyList = res.result.policyList
          }
        })
      },
      //获取常办项目列表
yuanbo committed
268 269 270 271
      /**
       * @description: 获取常办项目列表
       * @author: renchao
       */
272 273 274 275 276 277 278 279 280
      queryProjectList () {
        getHomeFrequentProjects().then(res => {
          if (res.result && res.result.length > 0) {
            this.projectList = res.result
          } else {
            this.projectList = this.listData
          }
        })
      },
yuanbo committed
281 282 283 284
      /**
       * @description: _timedate
       * @author: renchao
       */
285 286 287 288 289 290 291 292 293 294
      _timedate (d) {
        var td = new Date();
        td = new Date(td.getFullYear(), td.getMonth(), td.getDate());
        var od = new Date(d);
        od = new Date(od.getFullYear(), od.getMonth(), od.getDate());
        var xc = (od - td) / 1000 / 60 / 60 / 24;
        if (xc == -1) {
          return "昨天";
        } else if (xc == 0) {
          return "今天";
任超 committed
295
        } else {
296
          return d
蔡俊立 committed
297
        }
298
      },
yuanbo committed
299 300 301 302
      /**
       * @description: buildChart
       * @author: renchao
       */
303 304 305 306 307 308 309 310 311 312 313 314 315
      buildChart () {
        let height = document.getElementById("mountNodeCon").offsetHeight - 20
        var chart = new G2.Chart({
          container: 'mountNode',
          height: height
        });
        chart.source(this.chartData);
        chart.scale({
          value: {
            min: 10000
          },
          year: {
            range: [0, 1]
任超 committed
316
          }
317 318 319 320 321 322
        });
        chart.axis('value', {
          label: {
            formatter: function formatter (val) {
              return (val / 10000).toFixed(1) + 'k';
            }
任超 committed
323
          }
324 325 326 327 328 329 330 331 332
        });
        chart.tooltip({
          crosshairs: true
        })
        chart.forceFit();
        chart.area().position('year*value').shape('smooth');
        chart.line().position('year*value').size(2).shape('smooth');
        chart.render();
      },
yuanbo committed
333 334 335 336
      /**
       * @description: loginTimeChart
       * @author: renchao
       */
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
      loginTimeChart () {
        var data = [{
          item: '用户1',
          count: 40,
          percent: 0.4
        }, {
          item: '用户2',
          count: 21,
          percent: 0.21
        }, {
          item: '用户3',
          count: 17,
          percent: 0.17
        }]
        var chart = new G2.Chart({
          container: 'loginTime',
          height: 260
        });
        chart.source(data, {
          percent: {
            formatter: function formatter (val) {
              val = val * 100 + '小时';
              return val;
            }
          }
        });
        chart.coord('theta');
        chart.tooltip({
          showTitle: false
        });
        chart.interval().position('percent').color('item').label('percent', {
          offset: -40,
          textStyle: {
            textAlign: 'center',
            shadowBlur: 2,
            shadowColor: 'rgba(0, 0, 0, .45)'
          }
        }).tooltip('item*percent', function (item, percent) {
          percent = percent * 100 + '小时';
          return {
            name: item,
            value: percent
          };
        }).style({
          lineWidth: 1,
          stroke: '#fff'
        });
        chart.forceFit();
        chart.render();
      },
      //跳转到更多通知列表页面
yuanbo committed
388 389 390 391
      /**
       * @description: 跳转到更多通知列表页面
       * @author: renchao
       */
392 393 394 395
      jumpToMoreNotice () {
        console.log(this.$route);
      },
      //配置常办项目
yuanbo committed
396 397 398 399
      /**
       * @description: 配置常办项目
       * @author: renchao
       */
400 401 402
      setFrequencyProject () {
        this.projectDialog = true;
      },
yuanbo committed
403 404 405 406
      /**
       * @description: handleNotice
       * @author: renchao
       */
407 408 409 410 411 412 413 414
      handleNotice (item) {
        setReadStatus({ bsmNotice: item.bsmNotice }).then(res => {
          if (res.code == 200) {
            this.queryNoticeList()
          }
        })
        this.$alertMes(item.noticeTitle, item.noticeContent)
      }
任超 committed
415
    }
赵千 committed
416 417
  }
</script>
任超 committed
418
<style scoped lang="scss">
419 420 421 422 423 424
  .height50 {
    height: calc(50% - 4px);
  }
  .height100 {
    height: 100%;
  }
425 426 427 428 429
  @import "~@/styles/mixin.scss";
  @import "./index.scss";
  /deep/.el-card__header {
    padding: 8px 15px;
  }
任超 committed
430

431 432 433 434
  /deep/.el-card__body {
    padding: 3px 10px 5px 10px;
    overflow: hidden;
  }
435
</style>