2 Commity 7d2da9c07a ... 1219087913

Autor SHA1 Správa Dátum
  liyongyong 1219087913 Merge branch 'main' of https://git.sxidc.com/kingdee_large_screen/pc_kingdee_large_screen 1 rok pred
  liyongyong 25fd3b02c4 加头部时间 1 rok pred
3 zmenil súbory, kde vykonal 35 pridanie a 13 odobranie
  1. 1 1
      manpower/index.html
  2. 22 12
      manpower/js/index.js
  3. 12 0
      manpower/js/request.js

+ 1 - 1
manpower/index.html

@@ -24,7 +24,7 @@
     <div id="app">
       <header class="my-header">
         <span>数智人力&nbsp;&nbsp;智慧山西</span>
-        <span class="right">2023-1-16 10:23:00</span>
+        <span class="right">{{time}}</span>
       </header>
       <div class="main">
         <div class="left">

+ 22 - 12
manpower/js/index.js

@@ -4,6 +4,7 @@ let app = new Vue({
   el: '#app',
   data() {
     return {
+      time: '',
       year: '2022',
       config1: {
         number: [100],
@@ -127,6 +128,10 @@ let app = new Vue({
     }
   },
   mounted() {
+    this.time = formatDate()
+    this.timer = setInterval(()=> {
+      this.time = formatDate()
+    },1000)
     this.centerData = data
     // 左侧图表
     this.initChartL1()
@@ -150,6 +155,11 @@ let app = new Vue({
     this.initChartR7()
     this.initChartR8()
   },
+  beforeDestroy() {
+    if (this.timer) {
+      clearInterval(this.timer);
+    }
+  },
   methods: {
     numFormat(value) {
       if (!value) return '0'
@@ -626,18 +636,18 @@ let app = new Vue({
             },
             markLine: {
               data: [
-                // {
-                //   name: '省属企业平均水平(万/人)',
-                //   yAxis: 50.13,
-                //   lineStyle: {
-                //     color: '#fff',
-                //   },
-                //   label: {
-                //     formatter: '{b}',
-                //     position: 'middle',
-                //     color: '#fff',
-                //   },
-                // },
+                {
+                  name: '省属企业平均水平(万/人)',
+                  yAxis: 50.13,
+                  lineStyle: {
+                    color: '#fff',
+                  },
+                  label: {
+                    formatter: '{b}',
+                    position: 'end',
+                    color: '#fff',
+                  },
+                },
                 {
                   name: '央企平均水平(万/人)',
                   yAxis: 69.4,

+ 12 - 0
manpower/js/request.js

@@ -177,3 +177,15 @@ function stringify(data) {
   ret = ret.substring(0, ret.lastIndexOf('&'))
   return ret
 }
+
+// 格式化日期
+function formatDate(time) {
+  let date = time ? new Date(Number(time)) : new Date();
+  let Y = date.getFullYear() + '-';
+  let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+  let D = date.getDate() < 10 ? '0' + date.getDate() + ' ' : date.getDate() + ' ';
+  let h = date.getHours() < 10 ? '0' + date.getHours() + ':' : date.getHours() + ':';
+  let m = date.getMinutes() < 10 ? '0' + date.getMinutes() + ':' : date.getMinutes() + ':';
+  let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
+  return Y + M + D + h + m + s;
+}