소스 검색

设备总数

lining 6 년 전
부모
커밋
b952a8ec06

+ 1 - 0
src/dashoo.cn/backend/api/business/devicestatistics/devicestatistics.go

@@ -1,6 +1,7 @@
 package devicestatistics
 
 type DeviceStatistics struct {
+	TemplateTypeId int    `xorm:"INT(11)"`
 	DeviceName  string `xorm:"VARCHAR(50)"` //设备名称
 	DeviceQty   int    `xorm:"INT(11)"`     //客户编码
 	WaitMonth   int    `xorm:"INT(11)"`     // 本月待检

+ 15 - 0
src/dashoo.cn/backend/api/business/devicestatistics/devicestatisticsService.go

@@ -95,4 +95,19 @@ func (s *DeviceStatisticsService) GetWaitCountsYear(Id string) (total int) {
 		}
 	}
 	return int(total1)
+}
+
+func (s *DeviceStatisticsService) GetDeviceCounts(tablename, where string) (total int) {
+	var resultsSlice []map[string][]byte
+	var total1 int64
+	sql := `select count(*) As counts from ` + tablename+ ` where ` + where
+	resultsSlice, _ = s.DBE.Query(sql)
+	if len(resultsSlice) > 0 {
+		results := resultsSlice[0]
+		for _, value := range results {
+			total1, _ = strconv.ParseInt(string(value), 10, 64)
+			break
+		}
+	}
+	return int(total1)
 }

+ 47 - 0
src/dashoo.cn/backend/api/controllers/lims/devicestatistics.go

@@ -92,6 +92,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		numEQ := svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
 		numWM := svc.GetWaitCountsMonth("187")
 		numWY := svc.GetWaitCountsYear("187")
+		deviceEQ.TemplateTypeId = 187
 		deviceEQ.DeviceName = "防雷装置(等电位)"
 		deviceEQ.DeviceQty = int(numEQ)
 		deviceEQ.WaitYear = int(numWY)
@@ -112,6 +113,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
 		numWM = svc.GetWaitCountsMonth("286")
 		numWY = svc.GetWaitCountsYear("286")
+		deviceLPT.TemplateTypeId = 286
 		deviceLPT.DeviceName = "防雷装置"
 		deviceLPT.DeviceQty = numEQ
 		deviceLPT.WaitYear = int(numWY)
@@ -132,6 +134,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
 		numWM = svc.GetWaitCountsMonth("181")
 		numWY = svc.GetWaitCountsYear("181")
+		deviceLP.TemplateTypeId = 181
 		deviceLP.DeviceName = "漏电保护器"
 		deviceLP.DeviceQty = numEQ
 		deviceLP.WaitYear = int(numWY)
@@ -152,6 +155,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
 		numWM = svc.GetWaitCountsMonth("179")
 		numWY = svc.GetWaitCountsYear("179")
+		deviceEG.TemplateTypeId = 179
 		deviceEG.DeviceName = "电气接地"
 		deviceEG.DeviceQty = numEQ
 		deviceEG.WaitYear = int(numWY)
@@ -176,6 +180,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		numEQ := svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
 		numWM := svc.GetWaitCountsMonth("156")
 		numWY := svc.GetWaitCountsYear("156")
+		deviceZHQ.TemplateTypeId = 156
 		deviceZHQ.DeviceName = "阻火器"
 		deviceZHQ.DeviceQty = numEQ
 		deviceZHQ.WaitYear = int(numWY)
@@ -196,6 +201,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
 		numWM = svc.GetWaitCountsMonth("183")
 		numWY = svc.GetWaitCountsYear("183")
+		deviceHXF.TemplateTypeId = 183
 		deviceHXF.DeviceName = "呼吸阀"
 		deviceHXF.DeviceQty = numEQ
 		deviceHXF.WaitYear = int(numWY)
@@ -216,6 +222,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
 		numWM = svc.GetWaitCountsMonth("154")
 		numWY = svc.GetWaitCountsYear("154")
+		deviceYYF.TemplateTypeId = 154
 		deviceYYF.DeviceName = "液压安全阀"
 		deviceYYF.DeviceQty = numEQ
 		deviceYYF.WaitYear = int(numWY)
@@ -236,6 +243,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
 		numWM = svc.GetWaitCountsMonth("189")
 		numWY = svc.GetWaitCountsYear("189")
+		deviceKQPM.TemplateTypeId = 189
 		deviceKQPM.DeviceName = "空气泡沫产生器"
 		deviceKQPM.DeviceQty = numEQ
 		deviceKQPM.WaitYear = int(numWY)
@@ -256,6 +264,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
 		numWM = svc.GetWaitCountsMonth("141")
 		numWY = svc.GetWaitCountsYear("141")
+		deviceYL.TemplateTypeId = 141
 		deviceYL.DeviceName = "游梁式抽油机"
 		deviceYL.DeviceQty = numEQ
 		deviceYL.WaitYear = int(numWY)
@@ -276,6 +285,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
 		numWM = svc.GetWaitCountsMonth("173")
 		numWY = svc.GetWaitCountsYear("173")
+		deviceWYL.TemplateTypeId = 173
 		deviceWYL.DeviceName = "无游梁式抽油机"
 		deviceWYL.DeviceQty = numEQ
 		deviceWYL.WaitYear = int(numWY)
@@ -346,6 +356,43 @@ func (this *DeviceStatisticsController) GetAuthority() {
 
 }
 
+// @Title
+// @Description get user by token
+// @Success 200 {object}
+// @router /getdevicetotal [get]
+func (this *DeviceStatisticsController) GetDeviceTotal() {
+	templateTypeId := this.GetString("TemplateTypeId")
+	//unitId := this.GetString("UnitID")
+
+	svc := organize.GetOrganizeService(utils.DBE)
+	svcd := devicestatistics.GetDeviceStatisticsService(utils.DBE)
+
+	ids := svc.GetAllChildById("100000304")
+	where := "TemplateTypeId=" + templateTypeId + " and DepartmentId IN (" + ids + ")"
+	total := svcd.GetDeviceCounts(this.User.AccCode + LimsCheckEquipmentListName, where)
+
+
+	where = "TemplateTypeId=" + templateTypeId + " and DepartmentId IN (" + ids + ")"
+	total = svcd.GetDeviceCounts(this.User.AccCode + LimsCheckEquipmentListName, where)
+
+	where = "TemplateTypeId=" + templateTypeId + " and DepartmentId IN (" + ids + ")"
+	total = svcd.GetDeviceCounts(this.User.AccCode + LimsCheckEquipmentListName, where)
+
+	where = "TemplateTypeId=" + templateTypeId + " and DepartmentId IN (" + ids + ")"
+	total = svcd.GetDeviceCounts(this.User.AccCode + LimsCheckEquipmentListName, where)
+
+	where = "TemplateTypeId=" + templateTypeId + " and DepartmentId IN (" + ids + ")"
+	total = svcd.GetDeviceCounts(this.User.AccCode + LimsCheckEquipmentListName, where)
+
+	where = "TemplateTypeId=" + templateTypeId + " and DepartmentId IN (" + ids + ")"
+	total = svcd.GetDeviceCounts(this.User.AccCode + LimsCheckEquipmentListName, where)
+
+	var datainfo ErrorDataInfo
+	datainfo.Item = total
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+
+}
 
 //获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。
 

+ 149 - 0
src/dashoo.cn/frontend_web/src/pages/lims/secondcenter/annualChecked.vue

@@ -0,0 +1,149 @@
+<template>
+  <div>
+    <el-form :inline="true"
+             :model="formSearch"
+             class="demo-form-inline"
+             size="mini">
+      <el-form-item label="检测地点">
+        <el-select v-model="formSearch.checkPosition"
+                   placeholder="检测地点">
+          <el-option label="采油一厂"
+                     value="shanghai"></el-option>
+          <el-option label="采油二厂"
+                     value="beijing"></el-option>
+          <el-option label="采油三厂"
+                     value="beijing2"></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary"
+                   @click="onSubmit">查询</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10">
+      <el-col :span="12">
+        <v-chart :forceFit="true"
+                 :height="height"
+                 :data="data"
+                 :scale="scale">
+          <v-tooltip />
+          <v-axis />
+          <v-bar position="year*sales" />
+        </v-chart>
+      </el-col>
+      <el-col :span="12">
+        <el-table :data="tableData"
+                  size="mini"
+                  :height="450"
+                  stripe>
+          <el-table-column prop="address"
+                           width="190"
+                           fixed="left"
+                           label="检测地点">
+          </el-table-column>
+
+          <el-table-column prop="number"
+                           label="设备总量"
+                           width="180">
+          </el-table-column>
+
+          <el-table-column prop="number"
+                           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-col>
+
+    </el-row>
+
+  </div>
+
+</template>
+
+<style>
+.el-table .warning-row {
+  background: oldlace;
+}
+
+.el-table .success-row {
+  background: #f0f9eb;
+}
+</style>
+
+<script>
+
+export default {
+  created () {
+
+  },
+  data () {
+    return {
+      formSearch: {
+        daterange: [],
+        checkPosition: '',
+        equipments: []
+      },
+      data: [
+        { year: '采油一厂', sales: 38 },
+        { year: '采油二厂', sales: 52 },
+        { year: '采油三厂', sales: 61 },
+        { year: '采油四厂', sales: 145 },
+        { year: '采油五厂', sales: 48 },
+        { year: '采油六厂', sales: 38 }
+      ],
+      scale: [{
+        dataKey: 'sales',
+        tickInterval: 20
+      }],
+      height: 400,
+      tableData: [{
+        precent: 70,
+        date: '120',
+        name: '111',
+        address: '采油一厂'
+      }, {
+        precent: 60,
+        date: '120',
+        name: '111',
+        address: '采油二厂'
+      }, {
+        precent: 66,
+        date: '120',
+        name: '111',
+        address: '采油三厂'
+      }, {
+        precent: 80,
+        date: '120',
+        name: '111',
+        address: '采油四厂'
+      }],
+      pieStyle: {
+        stroke: '#fff',
+        lineWidth: 1
+      },
+      labelConfig: ['percent', {
+        formatter: (val, item) => {
+          return item.point.item + ': ' + val
+        }
+      }]
+
+    }
+  },
+  methods: {
+    onSubmit () {
+    }
+  }
+}
+</script>

+ 2 - 2
src/dashoo.cn/frontend_web/src/pages/lims/secondcenter/checkTotal.vue

@@ -98,8 +98,8 @@
 // }]
 
 export default {
-  created () {
-
+  props: {
+    TemplateTypeId: String
   },
   data () {
     return {

+ 12 - 3
src/dashoo.cn/frontend_web/src/pages/lims/secondcenter/towLevelCenter.vue

@@ -89,7 +89,11 @@
     </el-dialog>
 
     <el-dialog :visible.sync="totalDialogVisible" width="85%" :title="totalDialogTitle">
-      <check-total></check-total>
+      <check-total :TemplateTypeId="TemplateTypeId"></check-total>
+    </el-dialog>
+
+    <el-dialog  width="85%" :title="totalDialogTitle">
+      <annual-checked></annual-checked>
     </el-dialog>
 
   </div>
@@ -102,6 +106,8 @@
 
   import pieCheckResult from './pieCheckResult.vue'
   import checkTotal from './checkTotal.vue'
+  import annualChecked from './annualChecked.vue'
+
   import {
     mapGetters
   } from 'vuex'
@@ -113,10 +119,12 @@
     }),
     components: {
       pieCheckResult,
-      checkTotal
+      checkTotal,
+      annualChecked
     },
     data () {
       return {
+        TemplateTypeId: '',
         loading: true,
         pieDialogVisible: false,
         totalDialogVisible: false,
@@ -195,7 +203,8 @@
         this.pieDialogVisible = true
       },
       showCheckTotal (row) {
-        this.totalDialogTitle = row.DeviceName + '设备总量'
+        this.TemplateTypeId = row.Id
+        this.totalDialogTitle = row.DeviceName + '全年已检'
         this.totalDialogVisible = true
       },
       getAuthority () {