3
2
Ver Fonte

统计图表

yuedefeng há 6 anos atrás
pai
commit
b961b707a2

+ 15 - 17
src/dashoo.cn/backend/api/controllers/lims/devicestatistics.go

@@ -2,9 +2,7 @@ package lims
 
 import (
 	"dashoo.cn/backend/api/business/devicestatistics"
-	"dashoo.cn/backend/api/business/organize"
 	. "dashoo.cn/backend/api/controllers"
-	"dashoo.cn/business2/permission"
 	"dashoo.cn/utils"
 	"fmt"
 	"strconv"
@@ -23,10 +21,10 @@ type DeviceStatisticsController struct {
 // @router /list [get]
 func (this *DeviceStatisticsController) GetEntityList() {
 
-	svcPerm := permission.GetPermissionService(utils.DBE)
-	isauth := svcPerm.IsAuthorized(this.User.Id, "Administrator")
-	organizeSvc := organize.GetOrganizeService(utils.DBE)
-	thrunitId := organizeSvc.GetMyThrUnitDepartmentId(this.User.DepartmentId)
+	// svcPerm := permission.GetPermissionService(utils.DBE)
+	//isauth := svcPerm.IsAuthorized(this.User.Id, "Administrator")
+	// organizeSvc := organize.GetOrganizeService(utils.DBE)
+	// thrunitId := organizeSvc.GetMyThrUnitDepartmentId(this.User.DepartmentId)
 
 	var devicelist []devicestatistics.DeviceStatistics
 	svc := devicestatistics.GetDeviceStatisticsService(utils.DBE)
@@ -39,7 +37,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 	whereYno := "(CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and CheckResult='×'"
 	whereY := "(CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and CheckResult='○'"
 
-	if isauth || thrunitId == "100001215" {
+	//if isauth || thrunitId == "100001215" {
 		//  防雷装置(等电位)
 		var deviceEQ devicestatistics.DeviceStatistics
 		totalYearNo := svc.GetCountsByDate(this.User.AccCode + LimsReportEquipotentName, whereYno)
@@ -119,20 +117,20 @@ func (this *DeviceStatisticsController) GetEntityList() {
 			deviceEG.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
 		}
 		devicelist = append(devicelist, deviceEG)
-	}
+	//}
 
-	if isauth || thrunitId == "100001219" {
+	//if isauth || thrunitId == "100001219" {
 		whereYno = "(CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and CheckResult LIKE '%不合格%' "
 		whereY = "(CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and CheckResult LIKE '%合格%' AND CheckResult NOT LIKE '%不合格%'"
 		//阻火器 LimsReportZuhq
 		var deviceZHQ devicestatistics.DeviceStatistics
-		totalYearNo := svc.GetCountsByDate(this.User.AccCode + LimsReportZuhqName, whereYno)
-		totalYear := svc.GetCountsByDate(this.User.AccCode + LimsReportZuhqName, whereY)
-		num := svc.GetCountsByDate(this.User.AccCode + LimsReportZuhqName, where)
-		whereN :="TemplateTypeId=156"
-		numEQ := svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
-		numWM :=svc.GetWaitCountsMonth("156")
-		numWY :=svc.GetWaitCountsYear("156")
+		totalYearNo = svc.GetCountsByDate(this.User.AccCode + LimsReportZuhqName, whereYno)
+		totalYear = svc.GetCountsByDate(this.User.AccCode + LimsReportZuhqName, whereY)
+		num = svc.GetCountsByDate(this.User.AccCode + LimsReportZuhqName, where)
+		whereN ="TemplateTypeId=156"
+		numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
+		numWM =svc.GetWaitCountsMonth("156")
+		numWY =svc.GetWaitCountsYear("156")
 		deviceZHQ.DeviceName = "阻火器"
 		deviceZHQ.DeviceQty = numEQ
 		deviceZHQ.WaitYear = int(numWY)
@@ -244,7 +242,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		}
 		devicelist = append(devicelist, deviceWYL)
 
-	}
+	//}
 
 
 	var datainfo ErrorDataInfo

+ 5 - 5
src/dashoo.cn/frontend_web/nuxt.config.ignore.js

@@ -162,16 +162,16 @@ module.exports = {
 	  baseURL: '//localhost:10091/api/'
   },
   ignore: [
-      // 'pages/lims/report*/**/*.*',
-     // 'pages/lims/createreport/**/*.*',
-     // 'pages/lims/dataentry/**/*.*',
+      'pages/lims/report*/**/*.*',
+     'pages/lims/createreport/**/*.*',
+     'pages/lims/dataentry/**/*.*',
      'pages/lims/deliver/**/*.*',
      'pages/lims/drillingdaily/**/*.*',
      'pages/lims/oiltestingdaily/**/*.*',
      'pages/lims/preparation/**/*.*',
      'pages/lims/tasksbalance/**/*.*',
-     // 'pages/system/**/*.*',
-     // 'pages/setting/**/*.*',
+     'pages/system/**/*.*',
+     'pages/setting/**/*.*',
      'pages/prototype/**/*.*',
      'pages/material/**/*.*',
      'pages/report/**/*.*',

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/index.vue

@@ -374,7 +374,7 @@
         const params = {
           _currentPage: this.currentPageFinished,
           _size: this.sizeFinished,
-          whtintime: this.formatDateTime(this.WhtinTime)
+          // whtintime: this.formatDateTime(this.WhtinTime)
         }
         this.$axios.get('/limsindex/getdone', {
           params

+ 1 - 1
src/dashoo.cn/frontend_web/src/pages/index2.vue

@@ -320,7 +320,7 @@
         const params = {
           _currentPage: this.currentPage,
           _size: this.pageSize,
-          whtintime: this.formatDateTime(this.WhtinTime)
+          // whtintime: this.formatDateTime(this.WhtinTime)
         }
         this.$axios.get('/limsindex/getdone', {
             params

+ 4 - 4
src/dashoo.cn/frontend_web/src/pages/lims/secondcenter/index.vue

@@ -1,11 +1,11 @@
 <template>
   <div>
-    <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
+   <!-- <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
       <el-menu-item index="1">部门首页</el-menu-item>
       <el-menu-item index="2">设备统计</el-menu-item>
-    </el-menu>
-    <tow-level-center v-if="activeIndex==1"></tow-level-center>
-    <device-center v-if="activeIndex==2"></device-center>
+    </el-menu>-->
+    <tow-level-center></tow-level-center>
+    <!--<device-center v-if="activeIndex==2"></device-center>-->
   </div>
 </template>
 <script>

+ 35 - 116
src/dashoo.cn/frontend_web/src/pages/lims/secondcenter/towLevelCenter.vue

@@ -51,70 +51,13 @@
       </el-table>
     </el-card>
 
-    <!--<el-card class="box-card" style="margin-top: 5px">-->
-
-      <!--<el-table-->
-        <!--:data="tableData"-->
-        <!--style="width: 100%"-->
-        <!--stripe>-->
-        <!--<el-table-column-->
-          <!--prop="address"-->
-          <!--label="检测地点">-->
-        <!--</el-table-column>-->
-
-        <!--<el-table-column-->
-          <!--prop="name"-->
-          <!--label="去年设备总量"-->
-          <!--width="180">-->
-        <!--</el-table-column>-->
-
-        <!--<el-table-column-->
-          <!--prop="name"-->
-          <!--label="今年设备总量"-->
-          <!--width="180">-->
-        <!--</el-table-column>-->
-
-        <!--<el-table-column-->
-          <!--prop="name"-->
-          <!--label="变化量"-->
-          <!--width="180">-->
-        <!--</el-table-column>-->
-
-        <!--<el-table-column-->
-          <!--prop="name"-->
-          <!--label="去年检测率"-->
-          <!--width="180">-->
-        <!--</el-table-column>-->
-
-        <!--<el-table-column-->
-        <!--prop="name"-->
-        <!--label="今年检测率"-->
-        <!--width="180">-->
-        <!--</el-table-column>-->
-
-      <!--</el-table>-->
-    <!--</el-card>-->
-
     <el-card class="box-card" style="margin-top: 5px">
-      <div slot="header">
-        <legend style="color:#436EEE"></legend>
-        <i class="icon icon-database"> 图表展示</i>
-      </div>
-      <v-chart :forceFit="true" :height="height" :data="tableData" :scale="scale">
+      <v-chart :force-fit="true" :height="height" :data="data" :scale="scale">
         <v-tooltip />
-        <v-legend
-          :custom="legendCustom"
-          :allow-all-canceled="legendAllowAllCanceled"
-          :items="legendItems"
-        />
-        <v-axis
-          data-key="people"
-          :grid="axisGrid"
-          :label="axisLabel"
-        />
-        <v-bar position="DeviceName*WaitYear" color="#3182bd" />
-        <v-smooth-line position="DeviceName*FinishYear" color="#fdae6b" :size="gemoSize" />
-        <v-point shape="circle" position="DeviceName*FinishYear" color="#fdae6b" :size="gemoSize" />
+        <v-axis />
+        <v-legend />
+        <v-line position="DeviceName*DeviceNum" color="device" />
+        <v-point position="DeviceName*DeviceNum" color="device" :size="4" :v-style="style" :shape="'circle'" />
       </v-chart>
     </el-card>
 
@@ -126,26 +69,7 @@
 <script>
   import api from '@/api/lims/secondcenter'
 
-  const data = [
-    { time: '10:10', call: 4, waiting: 2, people: 2 },
-    { time: '10:15', call: 2, waiting: 6, people: 3 },
-    { time: '10:20', call: 13, waiting: 2, people: 5 },
-    { time: '10:25', call: 9, waiting: 9, people: 1 },
-    { time: '10:30', call: 5, waiting: 2, people: 3 },
-    { time: '10:35', call: 8, waiting: 2, people: 1 },
-    { time: '10:40', call: 13, waiting: 1, people: 2 }
-  ]
-
-  const scale = [{
-    dataKey: 'DeviceQty',
-    min: 0
-  }, {
-    dataKey: 'FinishYear',
-    min: 0
-  }, {
-    dataKey: 'WaitYear',
-    min: 0
-  }]
+  const DataSet = require('@antv/data-set')
 
   export default {
     data () {
@@ -155,42 +79,20 @@
           checkPosition: '',
           equipments: []
         },
-
-        data,
-        scale,
+        dv: null,
+        data: null,
+        scale: [{
+          dataKey: '全年待检设备数量',
+          min: 0
+        }, {
+          dataKey: '全年已检设备数量',
+          min: 0
+        }],
         height: 400,
+        style: { stroke: '#fff', lineWidth: 1 },
 
-        axisLabel: {
-          textStyle: {
-            fill: '#fdae6b'
-          }
-        },
-        axisGrid: null,
-
-        gemoSize: 3,
-
-        legendCustom: true,
-        legendAllowAllCanceled: true,
-        legendItems: [
-          {
-            value: '全年待检',
-            marker: {
-              symbol: 'square',
-              fill: '#3182bd',
-              radius: 5}
-          },
-          {
-            value: '全年已检',
-            marker:
-              {symbol: 'hyphen',
-                stroke: '#fdae6b',
-                radius: 5,
-                lineWidth: 3
-              }
-          }
-        ],
-
-        tableData: []
+        tableData: [],
+        newTableData: []
       }
     },
     created () {
@@ -202,6 +104,23 @@
         }
         api.getList(params, this.$axios).then(res => {
           this.tableData = res.data.item
+          this.newTableData = []
+          for (let idx in this.tableData) {
+            this.newTableData.push({
+              DeviceName: this.tableData[idx].DeviceName,
+              全年待检设备数量: this.tableData[idx].WaitYear,
+              全年已检设备数量: this.tableData[idx].FinishYear
+            })
+          }
+          console.log(this.newTableData)
+          this.dv = new DataSet.View().source(this.newTableData)
+          this.dv.transform({
+            type: 'fold',
+            fields: ['全年待检设备数量', '全年已检设备数量'],
+            key: 'device',
+            value: 'DeviceNum'
+          })
+          this.data = this.dv.rows
         }).catch(err => {
           console.log(err)
         })