瀏覽代碼

xxd 合并代码

fujunwen 4 年之前
父節點
當前提交
d29dfa2d32

static/g.js → public/g.js


+ 6 - 1
public/index.html

@@ -8,6 +8,7 @@
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <script src="<%= BASE_URL %>systemConf.js"></script>
+    <script src="<%= BASE_URL %>g.js"></script>
     <title>万达广场管理说明书</title>
     <style>
         .map-p-label{
@@ -15,6 +16,11 @@
             border:none!important;
             box-shadow:none!important;
         }
+        .my-leaflet-div-icon{
+            width: auto!important;
+            white-space: nowrap;
+            word-break: normal;
+        }
         .leaflet-container{
             background: #f7f9fa!important;
         }
@@ -84,7 +90,6 @@
         <strong>We're sorry but wandaspecificationofsanming doesn't work properly without JavaScript enabled. Please enable
             it to continue.</strong>
         </noscript>
-    <script src="http://localhost/g.js" type="text/JavaScript"></script>
     <div id="app"></div>
  
 </body>

+ 6 - 0
src/App.vue

@@ -291,4 +291,10 @@ body {
     line-height: 26px;
   }
 }
+.el-dialog__header{
+  border-bottom: 1px solid rgba(239,240,241,1);
+}
+.gantt-chart .el-dialog__title{
+  font-weight: 500;
+}
 </style>

+ 3 - 16
src/api/coreDeviceReport.js

@@ -1,28 +1,15 @@
 /*
  * @Author: your name
  * @Date: 2020-07-03 19:04:47
- * @LastEditTime: 2020-07-09 19:58:31
- * @LastEditors: your name
+ * @LastEditTime: 2020-07-12 11:15:12
+ * @LastEditors: Please set LastEditors
  * @Description: In User Settings Edit
  * @FilePath: \wanda-bm-guide\src\api\coreDeviceReport.js
  */
 
 // 核心设备报表 接口
 import httputils from '@/api/httputils'
-
-<<<<<<< HEAD
-// 系统列表
-// export function queryEquipmentList() {
-//     return httputils.getJson(`/data/v_glsms_systemcfg/querySmsxt`)
-// }
-=======
-/**
- * 系统列表
- */
-export function querySystemList() {
-  return httputils.getJson(`/data/v_glsms_systemcfg/querySmsxt`);
-}
->>>>>>> develop-cd-xxd
+ 
 /**
  * 系统列表
  */

+ 1 - 0
src/api/equipmentList.js

@@ -1,3 +1,4 @@
+ 
 import httputils from "@/api/httputils"
 
 // 设备设施-主要设备清单

+ 14 - 0
src/api/ganttChart.js

@@ -1,5 +1,19 @@
 import httputils from "@/api/httputils";
 
+/**
+ * 获取甘特图数据
+ * @param {*} url 
+ * @param {*} getParams 
+ */
 export function queryGanttChart(url, getParams) {
   return httputils.getJson(url, getParams);
+}
+
+/**
+ * 获取甘特图任务数据
+ * @param {*} url 
+ * @param {*} getParams 
+ */
+export function queryGanttDetail(url, getParams) {
+  return httputils.getJson(url, getParams);
 }

+ 10 - 1
src/api/specificationUpdateRecord.js

@@ -1,6 +1,15 @@
 // 说明说更新记录 接口
 import httputils from "@/api/httputils";
 
+export function queryEventypes(url, param) {
+  return httputils.postJson(url, param);
+}
+
+/**
+ * 获取表数据
+ * @param {*} url 
+ * @param {*} param 
+ */
 export function getSpecificaltionData(url, param) {
   return httputils.getJson(url, param);
-}
+}

二進制
src/assets/imgs/analysis/picture.png


二進制
src/assets/imgs/analysis/report_pdf.png


二進制
src/assets/imgs/analysis/report_word.png


+ 21 - 0
src/assets/svg/menu.svg

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="16px" height="12px" viewBox="0 0 16 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 64 (93537) - https://sketch.com -->
+    <title>菜单</title>
+    <desc>Created with Sketch.</desc>
+    <g id="各种首页" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="甘特图-弹窗" transform="translate(-301.000000, -563.000000)" fill-rule="nonzero">
+            <g id="编组-3">
+                <g id="菜单" transform="translate(301.000000, 561.000000)">
+                    <rect id="矩形" fill="#000000" opacity="0" x="0" y="0" width="16" height="16"></rect>
+                    <path d="M0.699333328,3.66666667 C0.699333328,4.21895142 1.14704858,4.66666667 1.69933333,4.66666667 C2.25161808,4.66666667 2.69933333,4.21895142 2.69933333,3.66666667 C2.69933333,3.11438192 2.25161808,2.66666667 1.69933333,2.66666667 C1.14704858,2.66666667 0.699333328,3.11438192 0.699333328,3.66666667 Z" id="路径" fill="#8D9399"></path>
+                    <path d="M0.666666672,8.28 C0.666666672,8.83228475 1.11438192,9.28 1.66666667,9.28 C2.21895142,9.28 2.66666667,8.83228475 2.66666667,8.28 C2.66666667,7.72771525 2.21895142,7.28 1.66666667,7.28 C1.11438192,7.28 0.666666672,7.72771525 0.666666672,8.28 Z" id="路径" fill="#8D9399"></path>
+                    <path d="M0.666666672,12.984 C0.666666672,13.5362847 1.11438192,13.984 1.66666667,13.984 C2.21895142,13.984 2.66666667,13.5362847 2.66666667,12.984 C2.66666667,12.4317153 2.21895142,11.984 1.66666667,11.984 C1.11438192,11.984 0.666666672,12.4317153 0.666666672,12.984 Z" id="路径" fill="#8D9399"></path>
+                    <path d="M4.38333333,2.988 L14.3833333,2.988 C14.8277778,2.988 15.05,3.21022222 15.05,3.65466667 L15.05,3.65466667 C15.05,4.09911112 14.8277778,4.32133333 14.3833333,4.32133333 L4.38333333,4.32133333 C3.93888888,4.32133333 3.71666667,4.09911111 3.71666667,3.65466667 L3.71666667,3.65466667 C3.71666667,3.21022222 3.93888889,2.988 4.38333333,2.988 L4.38333333,2.988 Z" id="路径" fill="#8D9399"></path>
+                    <path d="M4.38333333,7.65466667 L14.3833333,7.65466667 C14.8277778,7.65466667 15.05,7.87688889 15.05,8.32133333 L15.05,8.32133333 C15.05,8.76577778 14.8277778,8.988 14.3833333,8.988 L4.38333333,8.988 C3.93888888,8.988 3.71666667,8.76577778 3.71666667,8.32133333 L3.71666667,8.32133333 C3.71666667,7.87688888 3.93888889,7.65466667 4.38333333,7.65466667 Z" id="路径" fill="#8D9399"></path>
+                    <path d="M4.38333333,12.3213333 L14.3833333,12.3213333 C14.8277778,12.3213333 15.05,12.5435556 15.05,12.988 L15.05,12.988 C15.05,13.4324444 14.8277778,13.6546667 14.3833333,13.6546667 L4.38333333,13.6546667 C3.93888888,13.6546667 3.71666667,13.4324444 3.71666667,12.988 L3.71666667,12.988 C3.71666667,12.5435556 3.93888889,12.3213333 4.38333333,12.3213333 Z" id="路径" fill="#8D9399"></path>
+                </g>
+            </g>
+        </g>
+    </g>
+</svg>

文件差異過大導致無法顯示
+ 16 - 0
src/assets/svg/picture.svg


文件差異過大導致無法顯示
+ 20 - 0
src/assets/svg/plan_time.svg


文件差異過大導致無法顯示
+ 18 - 0
src/assets/svg/real_time.svg


文件差異過大導致無法顯示
+ 19 - 0
src/assets/svg/report.svg


文件差異過大導致無法顯示
+ 18 - 0
src/assets/svg/task.svg


+ 1 - 0
src/main.ts

@@ -1,3 +1,4 @@
+ 
 import Vue from 'vue'
 import router from './router'
 import store from './store'

+ 18 - 13
src/router/index.js

@@ -7,10 +7,10 @@ let level = 0
 Vue.use(VueRouter)
 const routes = [
     // 登陆页面
-    // {
-    //     path: '/',
-    //     redirect: '/home/overview',        // 只有区域,及区域以上用户才能进入总部首页这一套
-    // },
+    {
+        path: '/',
+        redirect: '/home/overview',        // 只有区域,及区域以上用户才能进入总部首页这一套
+    },
     {
         path: "/404",
         component: () => import("../components/404"),
@@ -19,6 +19,10 @@ const routes = [
         path:'/group',
         component: () => import('../views/statistics/index')
     },
+    {
+        path:'/group',
+        component: () => import('../views/statistics/index')
+    },
     // home
     {
         path: '/home',
@@ -79,21 +83,22 @@ router.beforeEach(async (to, from, next) => {
         const token = query().token
         const ssoToken = store.getters['ssoToken']
         if (ssoToken) {
-            if (to.path === '/group' ||  to.path === '/home/overview') {
-                next()
-                return
-            } 
+            // if (to.path === '/group' ||  to.path === '/home/homepage') {
+            //     next()
+            //     return
+            // } 
             store.commit('SETSSOTOKEN', ssoToken)
             await store.dispatch('getUserInfo', router)
             await store.dispatch('getFloors')
             await store.dispatch('getBrand')
             let level =store.state.accessLevel
             console.log(level)
-            if (level ===0) {
-                next('/group')
-            } else {
-                next('/home/overview')
-            }
+            // if (level ===0) {
+            //     next('/group')
+            // } else {
+            //     next('/home/homepage')
+            // }
+            next()
         } else if (token) {
             store.commit('SETSSOTOKEN', token)
             await store.dispatch('getUserInfo', router)

+ 153 - 60
src/utils/ganttChart/GanttChart.js

@@ -1,9 +1,5 @@
 import moment from 'moment';
 /**
- * 数据定义区域
- *
- */
-/**
  * 甘特图
  * @param {} options 
  */
@@ -28,7 +24,7 @@ export function GanttChart(options) {
   // 拖动过程事件
   this.dragingEvent = null;
   // 拖动偏移量
-  this.offsetDis = options['viewWidth'] || 800;
+  this.offsetDis = (options['viewWidth']/2) || 800;
   // 拖动定时器
   this.dragTimer = null;
   // 每天的间隔宽度
@@ -42,20 +38,21 @@ export function GanttChart(options) {
   // 总天数
   this.daysCount = options['daysCount'] || 60;
   // 任务图距离顶部高度
-  this.graphTopDis = 20
+  this.graphTopDis = 40
   
   // 每像素代表的小时数
   this.timePerPix = this.cWidth/this.daysCount/24/3600
   // 当前视图开始时间,向前推N天
   this.startAt = moment().subtract(this.daysCount / 3, 'days');
   this.endAt = moment(this.startAt).add(this.daysCount, 'days');
-  this.graphDiv = document.getElementById(options['chartContainer']);
+  this.graphDiv = document.getElementById(options['chartParentContainer']);
+  this.chartContainer = options['chartContainer']
   // 图形容器组
   this.graphGroup = null;
   // 上一次拖动的事件
   this.lastDragEv = null;
-  // 回调事件
-  this.callback = options.callback || null;
+  // 当日刻度线
+  this.todayTimeLineEl = null;
 }
 
 
@@ -113,6 +110,7 @@ GanttChart.prototype.forceRefreshGraph = function() {
   this.tasks.forEach((topTask) => {
     topTask.gGroup = null;
   });
+  this.todayTimeLineEl = null
   this.gCanvas.destroy();
   this.initDrawingReady();
 }
@@ -122,17 +120,21 @@ GanttChart.prototype.forceRefreshGraph = function() {
  */
 GanttChart.prototype.initDrawingReady = function() {
   this.initCanvas();
-  this.initDragHandler();
-  this.drawTimeZone();
-  this.processData();
-  this.drawTasks();
-  this.graphGroup = null
+  setTimeout(() => {
+    this.initDragHandler();
+    this.drawTimeZone();
+    this.processData();
+    this.drawTasks();
+    this.graphGroup = null
+  }, 200);
 }
 
 /**
  * 翻页
  */
 GanttChart.prototype.pageTo = function(dir = 'next') {
+  this.draging = false;
+  this.endEvent = null;
   if (dir == 'next') {
     // 向后翻页`
     this.startAt = this.startAt.add(this.daysCount, 'days');
@@ -154,7 +156,7 @@ let lastClickAt = null;
  * 改变graphDiv 滚动距离
  * 到达边界距离后,刷新页面
  */
-GanttChart.prototype.doDrag = function(sEvent, eEvent) {
+GanttChart.prototype.doDrag = function(sEvent, eEvent) {  
   if (sEvent == null) {
     sEvent = this.startEvent;
   }
@@ -173,7 +175,7 @@ GanttChart.prototype.doDrag = function(sEvent, eEvent) {
     this.offsetDis = this.viewWidth;
     this.pageTo('prev');
   }
-  if (this.offsetDis - 20 >= 2964 ){ //cWidth - viewWidth) {
+  if ((this.offsetDis - 20) >= this.viewWidth*2.2 ){ //cWidth - viewWidth) {
     // 向后滑动,向后翻页
     console.log('此处应该向后翻页', this.startAt.format('YYYY-MM-DD'),this.endAt.format('YYYY-MM-DD'),this.offsetDis);
     this.offsetDis = this.viewWidth;
@@ -185,10 +187,9 @@ GanttChart.prototype.doDrag = function(sEvent, eEvent) {
 /**
  * 初始化抓取拖动事件
  */
-
 GanttChart.prototype.initDragHandler = function() {
   this.graphDiv.scrollLeft = this.offsetDis;
-  let _canvas = document.getElementsByTagName('canvas')[1];
+  let _canvas = this._canvas
   _canvas.addEventListener('mousedown', (ev) => {
     this.draging = true;
     this.startEvent = ev;
@@ -199,6 +200,13 @@ GanttChart.prototype.initDragHandler = function() {
     this.lastDragEv = ev;
   });
 
+
+  _canvas.addEventListener('mouseleave', (ev) => {
+    console.log('leave...恢复')
+    this.draging = false;
+    this.endEvent = ev;
+  });
+
   _canvas.addEventListener('mouseup', (ev) => {
     this.draging = false;
     this.endEvent = ev;
@@ -215,11 +223,6 @@ GanttChart.prototype.initDragHandler = function() {
       this.lastDragEv = ev;
     }
   });
-  _canvas.addEventListener('mouseleave', (ev) => {
-    console.log('leave...恢复')
-    this.draging = false;
-    this.endEvent = ev;
-  });
 }
 /**
  * 初始化画布
@@ -227,11 +230,13 @@ GanttChart.prototype.initDragHandler = function() {
  */
 
 GanttChart.prototype.initCanvas = function() {
+  console.error('初始化画布...')
   this.gCanvas = new G.Canvas({
-    container: 'ganttContainer',
+    container: this.chartContainer,
     width: this.cWidth,
-    height: 800,
+    height: this.cHeight,
   });
+  this._canvas = document.getElementsByTagName('canvas')[0];
 }
 
 /**
@@ -242,45 +247,59 @@ GanttChart.prototype.drawTimeZone = function() {
   console.log('时间段', this.startAt.format('YYYY-MM-DD'),this.endAt.format('YYYY-MM-DD'));
   let start = moment(this.startAt);
   let timeGroup = this.gCanvas.addGroup();
+  this.timeGroupEl = timeGroup
   timeGroup._tname = 'TimeGroup';
-  // 绘制第一级
-  timeGroup.addShape('text', {
-    attrs: {
-      x: 20,
-      y: 20,
-      fontSize: 12,
-      text: start.format('YYYY-MM'),
-      lineDash: [10, 10],
-      fill: '#8D9399',
-    },
-  });
-  timeGroup.addShape('text', {
-    attrs: {
-      x: 20 + this.viewWidth,
-      y: 20,
-      fontSize: 12,
-      text: start.add(this.daysCount / 3, 'days').format('YYYY-MM'),
-      lineDash: [10, 10],
-      fill: '#8D9399',
-    },
-  });
-  timeGroup.addShape('text', {
+  let startSecond = moment(this.startAt);
+
+  // 顶部底部边框
+  timeGroup.addShape('rect',{
     attrs: {
-      x: 20 + this.viewWidth * 2,
-      y: 20,
-      fontSize: 12,
-      text: start.add(this.daysCount / 3, 'days').format('YYYY-MM'),
-      lineDash: [10, 10],
-      fill: '#8D9399',
+      x: 0,
+      y: 0,
+      width: this.cWidth,
+      height: 40,
+      fill: '#dbcccc',
+      radius: [2, 4],
     },
-  });
-  let startSecond = moment(this.startAt);
+  })
   // 绘制第二级
+  let nowAtStr = moment().format('YYYY-MM-DD')
   for (let i = 0; i < this.daysCount; i++) {
-    let timeText = startSecond.add(1, 'days').format('DD');
+    let tempAt = startSecond.add(1, 'days')
+    let timeText = tempAt.format('DD');
+    if(timeText == '01'){
+      // 第一天,顶部需要绘制年月
+      timeGroup.addShape('text', {
+        attrs: {
+          x: this.dayStep * i,
+          y: 20,
+          fontSize: 12,
+          text: tempAt.format('YYYY-MM'),
+          lineDash: [10, 10],
+          fill: '#8D9399',
+        },
+      });
+      
+    }
+    let isToday = nowAtStr == tempAt.format('YYYY-MM-DD')
+    if(isToday){
+      //是今日,需要画线
+      console.log('绘制 当日刻度线')
+      this.todayTimeLineOffsetPos = this.dayStep * i
+      timeGroup.addShape('rect',{
+        attrs: {
+          x: this.dayStep * i-10,
+          y: 25,
+          width: 30,
+          height: 16,
+          fill: '#0091FF',
+          radius: [2, 4],
+        },
+      })
+    }
     timeGroup.addShape('text', {
       attrs: {
-        x: 40 * i,
+        x: this.dayStep * i,
         y: 40,
         fontSize: 10,
         text: timeText,
@@ -288,6 +307,17 @@ GanttChart.prototype.drawTimeZone = function() {
         fill: '#8D9399',
       },
     });
+
+    timeGroup.addShape('rect', {
+      attrs: {
+        x: this.dayStep * i-10,
+        y: 20,
+        width: 1,
+        height: this.cHeight,
+        fill: '#deebeb',
+        radius: [2, 4],
+      },
+    });
   }
 }
 
@@ -364,10 +394,55 @@ GanttChart.prototype.drawTasks = function() {
       taskGroup = this.graphGroup.addGroup();
       taskGroup._tname = 'TaskGroup_' + topTask.id;
       topTask.gGroup = taskGroup;
-      // 第二层循环,用于 区分具体多少任务,例如,维保-商管1/商管2...    
-      topTask.dataList.forEach((taskP, index) => {                            
-        let taskPGroup = taskGroup.addGroup();
+
+      // 组名背景矩形
+      // let TopGroupRectEl = taskGroup.addShape('rect', {
+      //   attrs: {
+      //     x: 0,
+      //     y: topTask.renderOptions.startY,
+      //     width: this.cWidth,
+      //     height: this.taskRowHeight,
+      //     fill: '#a6ed53',
+      //     radius: [2, 4],
+      //   },
+      // });
+      // 第二层循环,用于 区分具体多少任务,例如,维保-商管1/商管2...
+      topTask.dataList.forEach((taskP, index) => {
+        let taskPGroup = taskGroup.addGroup()
         taskGroup.addGroup(taskPGroup);
+        // 任务背景矩形,主要用于Hover效果变更颜色
+        if(true){
+          let tempTaskContainerEl = taskPGroup.addShape('rect', {
+            attrs: {
+              x: 0,
+              y: topTask.renderOptions.startY + ((index+1)* (this.taskRowHeight + this.rowSpanDis))-5,
+              width: this.cWidth,
+              height: this.taskRowHeight+10,
+              fill: '#fff',
+              // stroke: 'black',
+              radius: [2, 4],
+            },
+          });
+          tempTaskContainerEl.setZIndex(1)
+          tempTaskContainerEl._pdata = taskP
+          tempTaskContainerEl.on('mouseenter',(ev)=>{
+            tempTaskContainerEl.attr({fill: '#F5F6F7'})
+            tempTaskContainerEl._pdata.tasks.forEach(_tempTask=>{
+              if(_tempTask._rectEl){
+                _tempTask._rectEl.setZIndex(5)
+              }
+            })
+          })
+          tempTaskContainerEl.on('mouseleave',(ev)=>{
+            tempTaskContainerEl.attr({fill: '#fff'})
+            tempTaskContainerEl._pdata.tasks.forEach(_tempTask=>{
+              if(_tempTask._rectEl){
+                _tempTask._rectEl.setZIndex(5)
+              }
+            })
+          })
+          taskP._containerEl = tempTaskContainerEl
+        }
         // 第三层循环,用户区分每个子任务的执行时间段,例如:维保-商管1-2020.05-2020.06 / 2020.08- 2020.09
         taskP.tasks.forEach((_taskItem, _index) => {
           let _isInView = this.isInView(_taskItem)
@@ -386,7 +461,9 @@ GanttChart.prototype.drawTasks = function() {
                 radius: [2, 4],
               },
             });
+            rectEl.setZIndex(5)
             rectEl._pdata = _taskItem;
+            _taskItem._rectEl = rectEl
             rectEl.on('mouseover', (ev) => {
               this.handleClick(ev.target, 'enter', ev);
             });
@@ -408,6 +485,22 @@ GanttChart.prototype.drawTasks = function() {
       }
     }
   });
+
+  // 画当前线条 TODO,放前面不行
+  let todayAt = new Date()
+  if(this.startAt < todayAt && this.endAt > todayAt){
+    this.todayTimeLineEl = this.gCanvas.addShape('rect',{
+      attrs: {
+        x: this.todayTimeLineOffsetPos,
+        y: 40,
+        width: 3,
+        height: this.cHeight,
+        fill: '#0091FF',
+        radius: [2, 4],
+      }
+    })
+    this.todayTimeLineEl.setZIndex(50)
+  }
 }
 
 /**

+ 438 - 0
src/utils/ganttChart/GanttChart_old.js

@@ -0,0 +1,438 @@
+import moment from 'moment';
+/**
+ * 数据定义区域
+ *
+ */
+/**
+ * 甘特图
+ * @param {} options 
+ */
+export function GanttChart(options) {
+  // 任务列表
+  this.tasks = options.tasks || [];
+  // AntVG Canvas
+  this.gCanvas = null;
+  // 视口宽度 800,可视区域
+  this.viewWidth = options['viewWidth'] || 800;
+  // 物理画布宽度 800
+  this.cWidth = options['cWidth'] || 2400;
+  this.cHeight = options['cHeight'] || 600;
+  // 画布偏移位置
+  this.startPos = 0;
+  // 是否拖动中
+  this.draging = false;
+  // 开始拖动事件
+  this.startEvent = null;
+  // 结束拖动事件
+  this.endEvent = null;
+  // 拖动过程事件
+  this.dragingEvent = null;
+  // 拖动偏移量
+  this.offsetDis = options['viewWidth'] || 800;
+  // 拖动定时器
+  this.dragTimer = null;
+  // 每天的间隔宽度
+  this.dayStep = 40;
+  // 分组标题高度
+  this.groupTitleHeight = 38;
+  // 任务矩形高度
+  this.taskRowHeight = 16;
+  // 每行任务的纵向间距
+  this.rowSpanDis = 22;
+  // 总天数
+  this.daysCount = options['daysCount'] || 60;
+  // 任务图距离顶部高度
+  this.graphTopDis = 20
+  
+  // 每像素代表的小时数
+  this.timePerPix = this.cWidth/this.daysCount/24/3600
+  // 当前视图开始时间,向前推N天
+  this.startAt = moment().subtract(this.daysCount / 3, 'days');
+  this.endAt = moment(this.startAt).add(this.daysCount, 'days');
+  this.graphDiv = document.getElementById(options['chartContainer']);
+  // 图形容器组
+  this.graphGroup = null;
+  // 上一次拖动的事件
+  this.lastDragEv = null;
+  // 回调事件
+  this.callback = options.callback || null;
+}
+
+
+/**
+ * 设置数据
+ * @param {*} _tasks 
+ */
+GanttChart.prototype.changeTasks = function(_tasks){
+  this.tasks = _tasks
+}
+
+/**
+ * 打开关闭分组
+ */
+
+GanttChart.prototype.toggle = function(index) {
+  if (this.tasks[index].open) {
+    this.tasks[index].open = false;
+  } else {
+    this.tasks[index].open = true;
+  }
+  this.processData();
+  this.drawTasks();
+}
+
+/**
+ * 预处理数据
+ */
+GanttChart.prototype.processData = function() {
+  for (let i = 0; i < this.tasks.length; i++) {
+    let currentTopTask = this.tasks[i];
+    let lastTopTask = null;
+    currentTopTask.renderOptions = {};
+    if (i != 0) {
+      // 非0个,要补上前面的数据
+      lastTopTask = this.tasks[i - 1];
+      currentTopTask.renderOptions.startY = lastTopTask.renderOptions.endY + 20;
+    } else {
+      // 第一个
+      currentTopTask.renderOptions.startY = this.graphTopDis;
+    }
+    if (currentTopTask.open) {
+      currentTopTask.renderOptions.endY =
+        currentTopTask.renderOptions.startY + this.rowSpanDis + this.groupTitleHeight + currentTopTask.dataList.length * this.taskRowHeight;
+    } else {
+      currentTopTask.renderOptions.endY = currentTopTask.renderOptions.startY + this.groupTitleHeight;
+    }
+  }
+}
+
+/**
+ * 强制清空图像,重绘
+ */
+GanttChart.prototype.forceRefreshGraph = function() {
+  this.tasks.forEach((topTask) => {
+    topTask.gGroup = null;
+  });
+  this.gCanvas.destroy();
+  this.initDrawingReady();
+}
+
+/**
+ * 准备绘制,用于初始化和强制刷新
+ */
+GanttChart.prototype.initDrawingReady = function() {
+  this.initCanvas();
+  this.initDragHandler();
+  this.drawTimeZone();
+  this.processData();
+  this.drawTasks();
+  this.graphGroup = null
+}
+
+/**
+ * 翻页
+ */
+GanttChart.prototype.pageTo = function(dir = 'next') {
+  if (dir == 'next') {
+    // 向后翻页`
+    this.startAt = this.startAt.add(this.daysCount, 'days');
+    this.offsetDis = 0
+  } else {
+    // 向前翻页
+    this.startAt = this.startAt.subtract(this.daysCount, 'days');
+    this.offsetDis = 2*this.viewWidth
+  }
+  this.endAt = moment(this.startAt).add(this.daysCount, 'days');
+  console.log('已翻页', this.startAt.format('YYYY-MM-DD'),this.endAt.format('YYYY-MM-DD'), this.offsetDis);
+  // offsetDis = viewWidth;
+  this.forceRefreshGraph();
+}
+// 上次点击时间,用于滚动时误触停止
+let lastClickAt = null;
+/**
+ * 执行拖动
+ * 改变graphDiv 滚动距离
+ * 到达边界距离后,刷新页面
+ */
+GanttChart.prototype.doDrag = function(sEvent, eEvent) {
+  if (sEvent == null) {
+    sEvent = this.startEvent;
+  }
+  
+  let sPos = sEvent.clientX;
+  let cPos = eEvent.clientX;
+  // 滚动距离
+  let dis = cPos - sPos;
+  let tempDis = this.offsetDis
+  // console.log('offsetDis before:', this.offsetDis, dis)
+  this.offsetDis = this.offsetDis - dis / 2;
+  // console.log('draging...',tempDis, this.offsetDis, dis)
+  if (this.offsetDis <= -20) {
+    // 向前滑动,向前翻页
+    console.log('此处应该向前翻页', this.startAt.format('YYYY-MM-DD'),this.endAt.format('YYYY-MM-DD'),this.offsetDis);
+    this.offsetDis = this.viewWidth;
+    this.pageTo('prev');
+  }
+  if (this.offsetDis - 20 >= 2964 ){ //cWidth - viewWidth) {
+    // 向后滑动,向后翻页
+    console.log('此处应该向后翻页', this.startAt.format('YYYY-MM-DD'),this.endAt.format('YYYY-MM-DD'),this.offsetDis);
+    this.offsetDis = this.viewWidth;
+    this.pageTo('next');
+  }
+  this.graphDiv.scrollLeft = this.offsetDis;
+}
+
+/**
+ * 初始化抓取拖动事件
+ */
+
+GanttChart.prototype.initDragHandler = function() {
+  this.graphDiv.scrollLeft = this.offsetDis;
+  let _canvas = document.querySelector('#ganttContainer>canvas');
+  _canvas.addEventListener('mousedown', (ev) => {
+    this.draging = true;
+    this.startEvent = ev;
+    this.dragingEvent = null;
+    this.endEvent = null;
+    this.lastClickAt = new Date();
+    this.lastClickAt = ev;
+    this.lastDragEv = ev;
+  });
+
+  _canvas.addEventListener('mouseup', (ev) => {
+    this.draging = false;
+    this.endEvent = ev;
+  });
+
+  _canvas.addEventListener('mousemove', (ev) => {
+    // console.log('this over', this)
+    if (this.draging) {
+      if (new Date() - this.lastClickAt < 20) {
+        return false;
+      }
+      this.dragingEvent = ev;
+      this.doDrag(this.lastDragEv, ev);
+      this.lastDragEv = ev;
+    }
+  });
+  _canvas.addEventListener('mouseleave', (ev) => {
+    console.log('leave...恢复')
+    this.draging = false;
+    this.endEvent = ev;
+  });
+}
+/**
+ * 初始化画布
+ *
+ */
+
+GanttChart.prototype.initCanvas = function() {
+  this.gCanvas = new G.Canvas({
+    container: 'ganttContainer',
+    width: this.cWidth,
+    height: 800,
+  });
+}
+
+/**
+ * 绘制时间区域
+ */
+
+GanttChart.prototype.drawTimeZone = function() {
+  console.log('时间段', this.startAt.format('YYYY-MM-DD'),this.endAt.format('YYYY-MM-DD'));
+  let start = moment(this.startAt);
+  let timeGroup = this.gCanvas.addGroup();
+  timeGroup._tname = 'TimeGroup';
+  // 绘制第一级
+  timeGroup.addShape('text', {
+    attrs: {
+      x: 20,
+      y: 20,
+      fontSize: 12,
+      text: start.format('YYYY-MM'),
+      lineDash: [10, 10],
+      fill: '#8D9399',
+    },
+  });
+  timeGroup.addShape('text', {
+    attrs: {
+      x: 20 + this.viewWidth,
+      y: 20,
+      fontSize: 12,
+      text: start.add(this.daysCount / 3, 'days').format('YYYY-MM'),
+      lineDash: [10, 10],
+      fill: '#8D9399',
+    },
+  });
+  timeGroup.addShape('text', {
+    attrs: {
+      x: 20 + this.viewWidth * 2,
+      y: 20,
+      fontSize: 12,
+      text: start.add(this.daysCount / 3, 'days').format('YYYY-MM'),
+      lineDash: [10, 10],
+      fill: '#8D9399',
+    },
+  });
+  let startSecond = moment(this.startAt);
+  // 绘制第二级
+  for (let i = 0; i < this.daysCount; i++) {
+    let timeText = startSecond.add(1, 'days').format('DD');
+    timeGroup.addShape('text', {
+      attrs: {
+        x: 40 * i,
+        y: 40,
+        fontSize: 10,
+        text: timeText,
+        lineDash: [10, 10],
+        fill: '#8D9399',
+      },
+    });
+  }
+}
+
+/**
+ * 处理点击
+ */
+GanttChart.prototype.handleClick = function(task, flag, ev) {
+  // let detailDiv = document.getElementById('detailDiv')
+  if(flag == 'enter'){
+    // detailDiv.style.display = 'block'
+    // detailDiv.style.left = ev.clientX+'px';
+    // detailDiv.style.top = ev.clientY+'px';
+    // document.getElementById('detailTaskName').textContent = task._pdata.description
+    // document.getElementById('detailTaskStatus').textContent = task._pdata.status
+    // document.getElementById('detailTaskStartDate').textContent = task._pdata.startDate
+    // document.getElementById('detailTaskEndDate').textContent = task._pdata.endDate
+    console.log('show:', task);
+  } else if (flag === 'leave'){
+    // detailDiv.style.display = 'none'
+    console.log('hide:', task);
+  } else {
+    this.callback(task);
+    console.log('click:', task);
+  }
+}
+
+
+/**
+ * 根据任务状态区分颜色
+ * 
+ */
+GanttChart.prototype.statusColor =function(task) {
+  switch (task.status) {
+    case '按时完成':
+      return 'aqua';
+      break;
+    case '计划批准':
+      return '#ff9800';
+      break;
+    case '已完成':
+      return '#19b720';
+      break;
+    default:
+      break;
+  }
+}
+
+/**
+ * 判断任务是否在视图内
+ * 
+ */ 
+GanttChart.prototype.isInView = function(task) {
+  let isLessThanEndAt = (task.endDate <= this.startAt.format('YYYY-MM-DD'))
+  let isGreaterThanStartAt = task.startDate >= this.endAt.format('YYYY-MM-DD')
+  return !(isLessThanEndAt || isGreaterThanStartAt)
+}
+
+/**
+ * 分组绘制任务块
+ *
+ */
+
+GanttChart.prototype.drawTasks = function() {
+  if (this.graphGroup) {
+    this.graphGroup.clear();
+  } else {
+    this.graphGroup = this.gCanvas.addGroup();
+    this.graphGroup._tname = 'graphGroup';
+  }
+  // 第一层循环,用于分组,例如,维保--xxxx
+  this.tasks.forEach((topTask, topIndex) => {
+    if (topTask.open) {
+      let taskGroup = null;
+      taskGroup = this.graphGroup.addGroup();
+      taskGroup._tname = 'TaskGroup_' + topTask.id;
+      topTask.gGroup = taskGroup;
+      // 第二层循环,用于 区分具体多少任务,例如,维保-商管1/商管2...    
+      topTask.dataList.forEach((taskP, index) => {                            
+        let taskPGroup = taskGroup.addGroup();
+        taskGroup.addGroup(taskPGroup);
+        // 第三层循环,用户区分每个子任务的执行时间段,例如:维保-商管1-2020.05-2020.06 / 2020.08- 2020.09
+        taskP.tasks.forEach((_taskItem, _index) => {
+          let _isInView = this.isInView(_taskItem)
+          // 在视图中才显示
+          if(_isInView){
+            let pos = this.calRectPos(_taskItem);
+            // console.log('render rect:', _taskItem, pos, topTask.renderOptions.startY + index * taskRowHeight);
+            let rectEl = taskPGroup.addShape('rect', {
+              attrs: {
+                x: pos.x,
+                y: topTask.renderOptions.startY + (index* (this.taskRowHeight + this.rowSpanDis)),
+                width: pos.width,
+                height: this.taskRowHeight,
+                fill: this.statusColor(_taskItem),
+                stroke: 'black',
+                radius: [2, 4],
+              },
+            });
+            rectEl._pdata = _taskItem;
+            rectEl.on('mouseover', (ev) => {
+              this.handleClick(ev.target, 'enter', ev);
+            });
+            rectEl.on('mouseleave', (ev) => {
+              this.handleClick(ev.target, 'leave', ev);
+            });
+            rectEl.on('click', (ev) => {
+              this.handleClick(ev.target, 'click', ev);
+            });
+          }
+        });
+      });
+
+      taskGroup.show();
+    } else {
+      if (topTask.gGroup) {
+        // topTask.gGroup.hide()
+        topTask.gGroup = null;
+      }
+    }
+  });
+}
+
+/**
+ * 根据 Task 计算矩形位置
+ *
+ */
+GanttChart.prototype.calRectPos = function(taskItem) {
+  let duraStartAt = new Date(taskItem.startDate) - new Date(this.startAt.format('YYYY-MM-DD'));
+  let secondsStartAt = duraStartAt/1000
+
+  let duraEndAt = new Date(taskItem.endDate) - new Date(taskItem.startDate);        
+  let secondsEndAt = duraEndAt/1000
+  return {
+    x: secondsStartAt * this.timePerPix,
+    y: 0,
+    width: secondsEndAt * this.timePerPix,
+    height: 0,
+  };
+}
+
+/**
+ * 主函数
+ *
+ */
+
+GanttChart.prototype.main = function() {  
+  this.initDrawingReady();
+}

+ 71 - 21
src/views/analysis/CoreDeviceReport.vue

@@ -28,12 +28,12 @@
     </div>
     <div class="main-right">
       <div class="search-container">
-        <Input iconType="search" v-model="searchKey" placeholder="搜索" width="192"/>
+        <Input iconType="search" v-model="searchKey" placeholder="搜索" width="192" @pressEnter="getTableData" @clear="getTableData"/>
       </div>
       <el-table :data="tableData" style="width: 100%;margin-bottom: 63px;" @row-click="showEquipmentStatus">
         <el-table-column label="序号" type="index" :index="indexMethod"></el-table-column>
         <el-table-column prop="sbjc" label="设备简称"></el-table-column>
-        <el-table-column prop="assetnum" label="设备编号"></el-table-column>
+        <el-table-column prop="sbjbm" label="设备编号"></el-table-column>
         <el-table-column prop="is_exception" label="状态">
           <template slot-scope="scope">
             <span style="display: inline-block;width: 6px;height:6px;border-radius: 3px;background: #0091FF;" :style="{'background': !scope.row.is_exception?'#0091FF' : '#F54E45'}"></span>
@@ -102,11 +102,14 @@
       <el-dialog :title="detailTitle" :visible.sync="showDetail" width="1260px">
         <div class="detail-container">
           <div class="pictures-menu">
-
+            <div v-for="(item) in pictureList" :key="'id_' + item.id" class="item">
+              <img :src="item.url" alt="">
+            </div>
           </div>
         </div>
       </el-dialog>
     </div>
+  </div>
 </template>
 
 <script>
@@ -120,11 +123,11 @@ export default {
       systemId: '', // 当前系统Id
       systemList: [], // 系统
       systemContentData: [
-        {id: 1, name: '高压配电柜', isMaintenance: true, num: 95, statusNum: 0, abnormal: false, isActive: true},
-        {id: 2, name: '变压器', isMaintenance: false, num: 256, statusNum: 12, abnormal: true, isActive: false},
-        {id: 3, name: '低压配电柜', isMaintenance: false, num: 354, statusNum: 0, abnormal: false, isActive: false},
-        {id: 4, name: '直流屏', isMaintenance: false, num: 175, statusNum: 0, abnormal: false, isActive: false},
-        {id: 5, name: '柴油发电机组', isMaintenance: false, num: 186, status: 0, abnormal: false, isActive: false},
+        // {id: 1, name: '高压配电柜', isMaintenance: true, num: 95, statusNum: 0, abnormal: false, isActive: true},
+        // {id: 2, name: '变压器', isMaintenance: false, num: 256, statusNum: 12, abnormal: true, isActive: false},
+        // {id: 3, name: '低压配电柜', isMaintenance: false, num: 354, statusNum: 0, abnormal: false, isActive: false},
+        // {id: 4, name: '直流屏', isMaintenance: false, num: 175, statusNum: 0, abnormal: false, isActive: false},
+        // {id: 5, name: '柴油发电机组', isMaintenance: false, num: 186, status: 0, abnormal: false, isActive: false},
       ], // 系统下的各种组成
       searchKey: '', // 搜索关键字
       tableData: [
@@ -149,6 +152,7 @@ export default {
 
       showDetail: false, // 显示照片、报告详情
       detailTitle: '图片预览', // 弹窗名称
+      pictureList: [], // 图片列表
     }
   },
 
@@ -161,8 +165,8 @@ export default {
 
   mounted() {
     this.getSystemList();
-    this.getEquipmentOfSystem();
-    this.getTableData();
+    // this.getEquipmentOfSystem();
+    
   },
 
   methods: {
@@ -181,6 +185,13 @@ export default {
             })
           })
           this.systemList = newData;
+          const { query } = this.$route;
+          if (!_.isEmpty(query)) {
+            this.systemId = query.smsxt || newData[0].id;
+          } else {
+            this.systemId = newData[0].id;
+          }
+          this.getEquipmentOfSystem();
         }
       })
     },
@@ -189,6 +200,7 @@ export default {
      */
     changeCurSystem(val) {
       console.log('val', val)
+      this.getEquipmentOfSystem();
     },
     /**
      * 获取系统下的设备
@@ -197,28 +209,52 @@ export default {
       let param = {
         plazaId: 1000423,
         ccode: 1002347,
-      }
-      if (this.systemId !== '') {
-        param.smsxt = this.systemId;
+        smsxt: this.systemId
       }
       queryEquipmentList('/data/home/querySystemCard', param).then((res) => {
-        console.log('res', res)
+        const { result, data } = res;
+        if (result === 'success') {
+          let newData = [];
+          _.forEach(data[0].assetTypeList, (item, index) => {
+            newData.push({
+              id: item.id,
+              name: item.category_name,
+              isMaintenance: item.is_detecting,
+              statusNum: item.is_exception_num,
+              num: item.asset_num,
+              abnormal: item.is_exception_num !== 0,
+              isActive: index === 0,
+              category_code: item.category_code
+            })
+          })
+          this.systemContentData = newData;
+          const { query } = this.$route;
+          if (!_.isEmpty(query) && query.equipId) {
+            _.map(this.systemContentData, (o) => {return o.isActive = o.id == query.equipId});
+          }
+          this.getTableData();
+        }
       })
     },
     /**
      * 切换系统下的设备
      */
     changeEquipment(id) {
-      _.map(this.systemContentData, (o) => {return o.isActive = o.id === id})
+      _.map(this.systemContentData, (o) => {return o.isActive = o.id === id});
+      this.getTableData();
     },
     /**
      * 获取表数据
      */
     getTableData() {
       let query = {
-        category_code: 'gdc'
+        category_code: _.find(this.systemContentData, (o) => {return o.isActive}).category_code
+      }
+      let url = `/data/glsms_asset/query?plazaId=1000423&page=${this.curPage}&size=${this.pageSize}`;
+      if (_.trim(this.searchKey) !== '') {
+        url = `${url}&keyword=${this.searchKey}:sbjc,sbjbm`
       }
-      queryTableData(`/data/glsms_asset/query?plazaId=1000423&page=${this.curPage}&size=${this.pageSize}`, query).then((res) => {
+      queryTableData(url, query).then((res) => {
         const { result, count, data } = res;
         if (result === 'success') {
           this.tatol = count;
@@ -334,13 +370,24 @@ export default {
      */
     getDetailData(val) {
       let param = {
-        file_type: 1, // val.file_type
-        file_type_id: 2467908, // val.file_type_id
+        file_type: 0, // val.file_type
+        file_type_id: 1144, // val.file_type_id
         type: this.detailTitle === '图片预览'? 0 : 1
       }
 
       queryDetailData('/data/base/queryFileDetails', param).then((res) => {
         console.log('res', res)
+        const { result, data } = res;
+        if (result === 'success') {
+          let newData = [];
+          _.forEach(data, (item) => {
+            newData.push({
+              id: item.id,
+              url: item.urlname
+            })
+          })
+          this.pictureList = newData;
+        }
       })
     }
   }
@@ -458,8 +505,11 @@ export default {
     .pictures-menu{
       margin-right: 21px;
       width: 180px;
+      .item{
+        >img{
+          width: 180px;
+        }
+      }
     }
-
   }
-
 </style>

+ 246 - 7
src/views/analysis/GanttChart.vue

@@ -35,21 +35,96 @@
         <div id="ganttContainer"></div>
       </div>
       <el-dialog :title="detailTitle" :visible.sync="showDetail" width="840px">
-
+        <div class="dialog-container">
+          <div class="row task-status">
+            <div>
+              <Task class="icon"/>
+              <div class="title">任务状态</div>
+            </div>
+            <div>进行中</div>
+          </div>
+          <div class="row">
+            <div>
+              <PlanTime class="icon" />
+              <div class="title">计划时间</div>
+            </div>
+            <div class="info">{{this.ganttDetail.planTime}}</div>
+          </div>
+          <div class="row">
+            <div>
+              <RealTime class="icon" />
+              <div class="title">实际执行时间</div>
+            </div>
+            <div class="info">{{this.ganttDetail.realTime}}</div>
+          </div>
+          <div class="row picture">
+            <div>
+              <Picture class="icon" />
+              <div class="title">照片</div>
+            </div>
+            <div>
+              <div>
+                <div class="num">12张</div>
+                <div class="more">查看更多</div>
+              </div>
+              <div class="pictrue-container">
+                <div v-for="(item) in pictures" :key="'id_' + item.id">
+                  <img :src="item.imgSrc" alt="" />
+                  <div class="info">{{item.title}}</div>
+                </div>
+              </div>
+            </div>
+          </div>
+          <div class="row picture">
+            <div>
+              <Report class="icon" />
+              <div class="title">报告</div>
+            </div>
+            <div>
+              <div>
+                <div class="num">2张</div>
+              </div>
+              <div class="pictrue-container">
+                <div v-for="(item) in reports" :key="'id_' + item.id">
+                  <img :src="item.imgSrc" alt="" />
+                  <div class="info">{{item.title}}</div>
+                </div>
+              </div>
+            </div>
+          </div>
+          <div class="row test-content">
+            <div>
+              <Menu class="icon" />
+              <div class="title">检测内容</div>
+            </div>
+            <el-table :data="tableData">
+              <el-table-column property="time" label="设备简称"></el-table-column>
+              <el-table-column property="evenType" label="设备编号"></el-table-column>
+              <el-table-column property="objid" label="设备数"></el-table-column>
+              <el-table-column property="content" label="空间位置"></el-table-column>
+            </el-table>
+          </div>
+        </div>
       </el-dialog>
     </div>
   </div>
 </template>
 
 <script>
-import { queryGanttChart } from '../../api/ganttChart';
-import { querySystemList } from '../../api/coreDeviceReport';
+import { queryGanttChart, queryGanttDetail } from '../../api/ganttChart';
+import { querySystemList, queryDetailData } from '../../api/coreDeviceReport';
 import { Tree } from 'meri-design';
 import _ from 'lodash';
 import moment from 'moment';
 // import '../../utils/ganttChart/g.js';
 import { GanttChart } from '../../utils/ganttChart/GanttChart.js';
 import { parse } from 'path';
+import Task from '../../assets/svg/task.svg';
+import PlanTime from '../../assets/svg/plan_time.svg';
+import RealTime from '../../assets/svg/real_time.svg';
+import Picture from '../../assets/svg/picture.svg';
+import Report from '../../assets/svg/report.svg';
+import Menu from '../../assets/svg/menu.svg';
 export default {
   data () {
     return {
@@ -67,10 +142,27 @@ export default {
       // 弹窗相关
       showDetail: false, // 弹框显示状态
       detailTitle: '', // 弹窗标题
+      pictures: [
+        {id: 1, imgSrc: require('../../assets/imgs/analysis/picture.png'), title: '2019年5月高压用具检测报告.jpg'},
+        {id: 2, imgSrc: require('../../assets/imgs/analysis/picture.png'), title: '2019年5月高压用具检测报告.jpg'},
+      ], // 照片
+      reports: [
+        {id: 1, imgSrc: require('../../assets/imgs/analysis/report_pdf.png'), title: '2019年5月高压用具检测报告.pdf'},
+        {id: 2, imgSrc: require('../../assets/imgs/analysis/report_word.png'), title: '2019年5月高压用具检测报告.docx'},
+      ], // 报告
+      ganttDetail: {}, // 甘特图明细
+      tableData: [], // 表数据
     }
   },
 
-  components: {},
+  components: {
+    Task,
+    PlanTime,
+    RealTime,
+    Picture,
+    Report,
+    Menu
+  },
 
   computed: {},
 
@@ -93,8 +185,13 @@ export default {
               name: item.name
             })
           })
-          this.systemId = newData[0].id;
           this.systemList = newData;
+          const { query } = this.$route;
+          if (!_.isEmpty(query) && query.smsxt) {
+            this.systemId = query.smsxt;
+          } else {
+            this.systemId = newData[0].id;
+          }
           this.getGanttChartData();
         }
       })
@@ -143,7 +240,8 @@ export default {
               id: index + 1,
               name: name[index],
               open: true,
-              children: name[index] === '专维'?[] : this.disGanttData(dsfList)
+              // children: name[index] === '专维'?[] : this.disGanttData(dsfList)
+              children: this.disGanttData(data[index])
             })
           })
           
@@ -166,10 +264,11 @@ export default {
           console.log('taskData', taskData)
           let width = this.$refs.chartContainer.offsetWidth;
           window.gc = new GanttChart({
+            chartParentContainer: 'chartContainer',
+            chartContainer: 'ganttContainer',
             viewWidth: width,
             cWidth: 3*width,
             tasks: taskData,
-            chartContainer: 'chartContainer',
             daysCount: parseInt(3*width/40),
             callback: this.showDialog
           });
@@ -202,6 +301,7 @@ export default {
      */
     toggleNode(status) {
       console.log('status', status)
+
     },
     /**
      * 显示弹窗
@@ -209,6 +309,54 @@ export default {
     showDialog(task) {
       this.showDetail = true;
       this.detailTitle = task._pdata.description;
+      this.getGanttDetailData();
+      this.getPictureOrReportData(0);
+      this.getPictureOrReportData(1);
+    },
+    /**
+     * 获取甘特图详情
+     */
+    getGanttDetailData() {
+      let param = {
+        plazaId: 1000423,
+        type: 2,
+        id: 1078467
+      }
+      queryGanttDetail('/data/base/queryGanttChartDetails', param).then((res) => {
+        const { result, data } = res;
+        if (result === 'success') {
+          const { status, planStartDate, planEndDate, realStartDate, realEndDate } = data;
+          let newData = {
+            status,
+            color: '',
+            planTime: this.dealDetailTime(planStartDate, planEndDate),
+            realTime: this.dealDetailTime(realStartDate, realEndDate)
+          }
+          this.ganttDetail = newData;
+        }
+      })
+    },
+    /**
+     * 处理时间
+     */
+    dealDetailTime(startTime, endTime) {
+      let start = moment.unix(startTime / 1000).format('YYYY.MM.DD HH:mm:ss'),
+          end = moment.unix(endTime / 1000).format('YYYY.MM.DD HH:mm:ss');
+      return `${start}-${end}`
+    },
+    /**
+     * 获取甘特图的图片/报告详情
+     */
+    getPictureOrReportData(type) {
+      let param = {
+        file_type: 1,
+        file_type_id: 1985,
+        type: type
+      }
+      queryDetailData('/data/base/queryFileDetails', param).then((res) => {
+        console.log('photo', res)
+
+      })
     }
   }
 }
@@ -276,6 +424,97 @@ export default {
     .chart-container{
       flex: 1;
       overflow: hidden;
+      background: #fff;
+    }
+  }
+  .dialog-container{
+    max-height: 580px;
+    overflow: auto ;
+    .row{
+      display: flex;
+      >div:first-child{
+        margin-right: 24px;
+        display: flex;
+        align-items: center;
+      }
+      &:not(:last-of-type){
+        margin-bottom: 14px;
+      }
+      .info{
+        font-size: 14px;
+        color: #1F2429;
+        line-height: 22px;
+      }
+    }
+    .icon{
+      margin-right: 6px;
+      width: 16px;
+    }
+    .title{
+      width: 84px;
+      font-size: 14px;
+      color: #646C73;
+      line-height: 22px;
+      font-weight: 400;
+    }
+    .task-status>div:nth-of-type(2){
+      width: 58px;
+      height: 24px;
+      background: rgba(91,143,249,0.2);
+      border-radius: 2px;
+      color: #5B8FF9;
+      line-height: 24px;
+      text-align: center;
+    }
+    .picture{
+      margin-bottom: 19px!important;
+      >div:first-child{
+        align-items: baseline;
+      }
+      >div:nth-of-type(2){
+        flex: 1;
+      }
+      >div:nth-of-type(2)>div:first-child{
+        margin-bottom: 12px;
+        display: flex;
+      }
+      .num,
+      .more{
+        font-size: 14px;
+        line-height: 22px;
+        font-weight: 400;
+      }
+      .num{
+        margin-right: 22px;
+        color: #1F2429;
+      }
+      .more{
+        color: #025BAA;
+        cursor: pointer;
+      }
+    }
+    .pictrue-container{
+      >div{
+        padding: 10px 16px;
+        width: 100%;
+        border-radius:4px;
+        border:1px solid rgba(233,233,233,1);
+        display: flex;
+        align-items: center;
+        >img{
+          width: 24px;
+          margin-right: 15px;
+        }
+      }
+      >div:not(:last-child){
+        margin-bottom: 8px;
+      }
+    }
+    .test-content{
+      display: block;
+      >div:first-child{
+        margin-bottom: 13px;
+      }
     }
   }
 }

+ 44 - 9
src/views/analysis/SpecificationUpdateRecord.vue

@@ -43,20 +43,22 @@
 </template>
 
 <script>
-import { getSpecificaltionData } from '../../api/specificationUpdateRecord';
+import { getSpecificaltionData, queryEventypes } from '../../api/specificationUpdateRecord';
 import moment from 'moment';
 import _ from 'lodash';
 export default {
   data () {
     return {
-      incidentList: [
+      incidentList: [], // 事件列表
+      oraginIncidentList: [
+        {id: 'all', name: '全部'},
         {id: 0, name: '专维'},
         {id: 1, name: '维保'},
         {id: 2, name: '第三方检测'},
         {id: 3, name: '重点关注'},
-      ], // 事件列表
-      incidentType: '', // 事件类型
-      timeVal: '', // 时间
+      ], // 事件列表字典表
+      incidentType: 'all', // 事件类型
+      timeVal: null, // 时间
       tableData: [], // 表数据
       curPage: 1, // 当前页码
       pageSize: 10, // 每页条数
@@ -71,11 +73,45 @@ export default {
   computed: {},
 
   mounted() {
-    this.getTableData();
+    this.initTimePicker();
+    this.getEvenType();
   },
 
   methods: {
     /**
+     * 初始化时间
+     */
+    initTimePicker() {
+      let endTime = new Date(),
+          startTime = new Date(endTime.getTime() - 1000*60*60*24*30);
+      this.timeVal = [startTime, endTime];
+    },
+    /**
+     * 获取事件类型
+     */
+    getEvenType() {
+      let query = {
+        tableName: 'rpt_change_record',
+        columnName: {
+          objtype: 'objtype'
+        }
+      }
+      queryEventypes(`/data/base/queryOptions?plazaId=1000423`, [query]).then((res) => {
+        const { result, data } = res;
+        if (result === 'success') {
+          let newData = [this.oraginIncidentList[0]];
+          _.forEach(data.rpt_change_record.objtype, (item) => {
+            newData.push({
+              id: item.key,
+              name: _.find(this.oraginIncidentList, (o) => {return item.key === o.id}).name
+            })
+          })
+          this.incidentList = newData;
+          this.getTableData();
+        }
+      })
+    },
+    /**
      * 获取表数据
      */
     getTableData() {
@@ -92,7 +128,7 @@ export default {
       if (this.endTime !== '') {
         param.changeDateEndDate = this.endTime;
       }
-      if (this.incidentType !== '') {
+      if (this.incidentType !== 'all') {
         param.objtype = this.incidentType;
       }
       getSpecificaltionData('/data/rpt_change_record/query', param).then((res) => {
@@ -125,8 +161,7 @@ export default {
         this.startTime = moment.unix(new Date(this.timeVal[0]).getTime() / 1000).format('YYYYMMDDHHmmss');
         this.endTime = moment.unix(new Date(this.timeVal[1]).getTime() / 1000).format('YYYYMMDDHHmmss');
       } else {
-        this.startTime = 20171027000000;
-        this.endTime = 20171028000000;
+        this.initTimePicker();
       }
       this.getTableData();
     }

+ 8 - 0
src/views/analysis/index.vue

@@ -46,6 +46,14 @@ export default {
 		GanttChart
 	},
 	mounted() {
+		const { query } = this.$route;
+		if (!_.isEmpty(query)) {
+			if (query.module === 'specification') {
+				_.map(this.navList, (o) => {return o.isActive = o.id === 2});
+			} else if (query.module === 'gantt') {
+				_.map(this.navList, (o) => {return o.isActive = o.id === 3});
+			}
+		}
 		this.findCurModule();
 	},
 	methods: {

+ 20 - 30
src/views/homepage/index.vue

@@ -20,17 +20,14 @@
                         </section>
                     </div>
                 </div>
-                <div v-else class='empty-content' style='border-top:none; height:8rem;line-height:8rem;'>暂无数据</div>
-                <div v-if='item.rptGlsmsStatisticsList && item.rptGlsmsStatisticsList.length' class='alert-list' @click='navToGanttPage(item, equip)'>
-                    <div class='alert-item' v-for='(option , index) in  item.rptGlsmsStatisticsList' :key='index'>
-                        <img v-if='option.total' :src='srcList[option.type][option.level]' />
-                        <div class='content' v-if='option.total'>
-                            <p class='line'>
-                                <span>{{option.type === 1 ? '维保': option.type === 0 ? '专维' : '第三方检测' }}</span>
-                                <span>
-                                    <em :style='{color:item.level == 1? "#646C73": item.level == 2 ? "#E07A04 " :"#C13830"}'>{{option.unfinished}}</em>/
-                                    <em>{{option.total}}</em>
-                                </span>
+                <div v-else class="empty-content"   style="border-top:none; height:8rem;line-height:8rem;">暂无数据</div>
+                <div v-if="item.rptGlsmsStatisticsList && item.rptGlsmsStatisticsList.length" class="alert-list" @click="navToGanttPage(item)">
+                    <div class="alert-item"  v-for="(option , index) in  item.rptGlsmsStatisticsList" :key="index" >
+                        <img v-if="option.total"  :src="srcList[option.type][option.level]" > 
+                        <div  class="content" v-if="option.total">
+                            <p class="line">
+                                <span >{{option.type === 1 ? '维保': option.type === 0 ? '专维' :  '第三方检测' }}</span>
+                                <span><em :style="{color:item.level == 1? '#646C73': item.level == 2 ? '#E07A04 ' :'#C13830'}">{{option.unfinished}}</em>/<em>{{option.total}}</em></span>
                             </p>
                             <p class='desc'>当月未完成/总任务</p>
                         </div>
@@ -155,17 +152,12 @@ export default {
         navToInnerPage(item, equip) {
             this.$router.push({ path: './analysis', query: { smsxt: item.smsxt, equipId: equip.id } })
         },
+         
         /**
          * 跳转到甘特图详情页
          */
-        navToGanttPage(item, equip) {
-            this.$router.push({ path: './analysis', query: { smsxt: item.smsxt } })
-        },
-        /**
-         * 跳转到甘特图详情页
-         */
-        navToGanttPage (item, equip) {
-            this.$router.push({path:"./analysis", query:{smsxt:item.smsxt}})
+        navToGanttPage (item) {
+            this.$router.push({path:"./analysis", query:{smsxt:item.smsxt, module:'gantt'}})
         },
         //TODO plazaId目前是写死的 后期需要更换成用户对应的ID
         testAjax() {
@@ -178,7 +170,6 @@ export default {
                 if (res.result == 'success') {
                     let result = res.data
                     if (result && Array.isArray(result)) {
-                        result[0].is_exception_num = 12
                         this.cardsList = result
                     }
                 }
@@ -260,7 +251,7 @@ export default {
         flex-wrap: wrap;
         justify-content: space-between;
         align-content: flex-start;
-        width: 70%;
+        width: 75%;
         .cards-item {
             width: calc(50% - 5px);
             height: 24%;
@@ -277,10 +268,7 @@ export default {
             }
             .equipment-list {
                 display: flex;
-                padding-bottom: 2rem;
-                margin-bottom: 0.8rem;
-                padding: 1rem;
-                padding-top: 0;
+                padding:0 1rem 1.2rem;
                 .equipment-item {
                     width: 33.33%;
                     padding: 0.6rem;
@@ -302,7 +290,7 @@ export default {
                         }
                         .exception-number {
                             position: absolute;
-                            right: -20px;
+                            right: -20%;
                             top: -5px;
                             height: 1.6rem;
                             border-radius: 8rem;
@@ -339,11 +327,10 @@ export default {
                 display: flex;
                 align-items: center;
                 justify-content: flex-start;
-                padding-top: 2rem;
                 border-top: 1px solid #f5f6f7;
+                height: 44%;
                 border-radius: 4px;
                 cursor: pointer;
-                padding: 2.2rem 1.4rem;
                 &:hover {
                     background: #f5f6f7;
                 }
@@ -354,7 +341,7 @@ export default {
                     img {
                         width: 4rem;
                         height: 4rem;
-                        margin-right: 1.4rem;
+                        margin:0 1rem;
                     }
                     .content {
                         border-right: 1px solid #f5f6f7;
@@ -369,6 +356,7 @@ export default {
                                 font-size: 1.2rem;
                                 color: #1f2429;
                                 font-weight: bold;
+                                white-space: nowrap;
                             }
                             em {
                                 font-weight: normal;
@@ -383,6 +371,7 @@ export default {
                             color: #8d9399;
                             font-size: 1.2rem;
                             text-align: right;
+                            white-space: nowrap;
                         }
                     }
                 }
@@ -398,7 +387,7 @@ export default {
         }
     }
     .homepage-nav-list {
-        width: calc(30% - 10px);
+        width: calc(25% - 10px);
         nav:first-child {
             height: 320px;
         }
@@ -435,6 +424,7 @@ export default {
                     }
                     article:nth-of-type(2) {
                         width: 30%;
+                        padding-left: 1.2rem;
                         white-space: nowrap;
                         overflow: hidden;
                         text-overflow: ellipsis;

文件差異過大導致無法顯示
+ 495 - 570
src/views/statistics/index.vue