3
2
Selaa lähdekoodia

首页 数据钻取

lining 6 vuotta sitten
vanhempi
commit
ba99a02ba8

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

@@ -10,3 +10,21 @@ type DeviceStatistics struct {
 	FinishYear  int    `xorm:"INT(11)"`     //全年检测
 	PassRate    float64                       // 合格率
 }
+
+type DeviceStatisticsOil struct {
+	TemplateTypeId int    `xorm:"INT(11)"`
+	UnitId      int
+	UnitName    string
+	DeviceName  string `xorm:"VARCHAR(50)"` //设备名称
+	DeviceQty   int    `xorm:"INT(11)"`     //客户编码
+	WaitMonth   int    `xorm:"INT(11)"`     // 本月待检
+	FinishMonth int    `xorm:"INT(11)"`     //本月检测
+	WaitYear    int    `xorm:"INT(11)"`     // 本年待检
+	FinishYear  int    `xorm:"INT(11)"`     //全年检测
+	PassRate    float64                       // 合格率
+}
+
+type PassRate struct {
+	Name        string
+	PassRate    float64                       // 合格率
+}

+ 549 - 11
src/dashoo.cn/backend/api/controllers/lims/devicestatistics.go

@@ -2,6 +2,7 @@ package lims
 
 import (
 	"dashoo.cn/backend/api/business/devicestatistics"
+	limscustomerposition2 "dashoo.cn/backend/api/business/limscustomerposition"
 	"dashoo.cn/backend/api/business/organize"
 	. "dashoo.cn/backend/api/controllers"
 	"dashoo.cn/business2/permission"
@@ -42,6 +43,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 	ethrIds := ""
 	//unitId := ""
 	wheret := ""
+	// 100001215 特检   100001219 宇信
 	if thrId == "100001219" || thrId == "100001215" {
 		if unitId != "" {
 			throrg := organizeSvc.GetAllThirdChildByTopId(unitId, "")
@@ -327,7 +329,6 @@ func (this *DeviceStatisticsController) GetDictList() {
 	this.ServeJSON()
 }
 
-
 // @Title 判断是否有权限
 // @Description get user by token
 // @Success 200 {object}
@@ -346,14 +347,11 @@ func (this *DeviceStatisticsController) GetAuthority() {
 	svcPerm := permission.GetPermissionService(utils.DBE)
 	dictList["isauth"] = svcPerm.IsAuthorized(this.User.Id, code)
 
-
-
 	var datainfo DataInfo
 	datainfo.Items = &dictList
 	this.Data["json"] = &datainfo
 	this.ServeJSON()
 
-
 }
 
 // @Title
@@ -369,23 +367,22 @@ func (this *DeviceStatisticsController) GetDeviceTotal() {
 
 	ids := svc.GetAllChildById("100000304")
 	where := "TemplateTypeId=" + templateTypeId + " and DepartmentId IN (" + ids + ")"
-	total := svcd.GetDeviceCounts(this.User.AccCode + LimsCheckEquipmentListName, where)
-
+	total := svcd.GetDeviceCounts(this.User.AccCode+LimsCheckEquipmentListName, where)
 
 	where = "TemplateTypeId=" + templateTypeId + " and DepartmentId IN (" + ids + ")"
-	total = svcd.GetDeviceCounts(this.User.AccCode + LimsCheckEquipmentListName, where)
+	total = svcd.GetDeviceCounts(this.User.AccCode+LimsCheckEquipmentListName, where)
 
 	where = "TemplateTypeId=" + templateTypeId + " and DepartmentId IN (" + ids + ")"
-	total = svcd.GetDeviceCounts(this.User.AccCode + LimsCheckEquipmentListName, where)
+	total = svcd.GetDeviceCounts(this.User.AccCode+LimsCheckEquipmentListName, where)
 
 	where = "TemplateTypeId=" + templateTypeId + " and DepartmentId IN (" + ids + ")"
-	total = svcd.GetDeviceCounts(this.User.AccCode + LimsCheckEquipmentListName, where)
+	total = svcd.GetDeviceCounts(this.User.AccCode+LimsCheckEquipmentListName, where)
 
 	where = "TemplateTypeId=" + templateTypeId + " and DepartmentId IN (" + ids + ")"
-	total = svcd.GetDeviceCounts(this.User.AccCode + LimsCheckEquipmentListName, where)
+	total = svcd.GetDeviceCounts(this.User.AccCode+LimsCheckEquipmentListName, where)
 
 	where = "TemplateTypeId=" + templateTypeId + " and DepartmentId IN (" + ids + ")"
-	total = svcd.GetDeviceCounts(this.User.AccCode + LimsCheckEquipmentListName, where)
+	total = svcd.GetDeviceCounts(this.User.AccCode+LimsCheckEquipmentListName, where)
 
 	var datainfo ErrorDataInfo
 	datainfo.Item = total
@@ -394,6 +391,547 @@ func (this *DeviceStatisticsController) GetDeviceTotal() {
 
 }
 
+// @Title 合格率
+// @Description get user by token
+// @Success 200 {object}
+// @router /getpassrate [get]
+//func (this *DeviceStatisticsController) GetPassRate() {
+//	templateTypeId := this.GetString("TemplateTypeId")
+//	var passRate devicestatistics.PassRate
+//	svc := devicestatistics.GetDeviceStatisticsService(utils.DBE)
+//
+//	where := ""
+//	whereYno := "(a.CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and a.CheckResult='×' " + where
+//	whereY := "(a.CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and a.CheckResult='○' " + where
+//	if templateTypeId == "187" {
+//
+//	} else if templateTypeId == "286" {
+//		totalYearNo := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereYno)
+//		totalYear := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereY)
+//		FinishYear := int(totalYearNo) + int(totalYear)
+//		if FinishYear != 0 {
+//			passRate.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+//		}
+//	} else if templateTypeId == "181" {
+//		totalYearNo := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereYno)
+//		totalYear := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereY)
+//		FinishYear := int(totalYearNo) + int(totalYear)
+//		if FinishYear != 0 {
+//			passRate.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+//		}
+//	} else if templateTypeId == "179" {
+//		totalYearNo := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereYno)
+//		totalYear := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereY)
+//		FinishYear := int(totalYearNo) + int(totalYear)
+//		if FinishYear != 0 {
+//			passRate.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+//		}
+//	} else if templateTypeId == "156" {
+//		totalYearNo := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereYno)
+//		totalYear := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereY)
+//		FinishYear := int(totalYearNo) + int(totalYear)
+//		if FinishYear != 0 {
+//			passRate.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+//		}
+//	} else if templateTypeId == "183" {
+//		totalYearNo := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereYno)
+//		totalYear := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereY)
+//		FinishYear := int(totalYearNo) + int(totalYear)
+//		if FinishYear != 0 {
+//			passRate.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+//		}
+//	} else if templateTypeId == "154" {
+//		totalYearNo := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereYno)
+//		totalYear := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereY)
+//		FinishYear := int(totalYearNo) + int(totalYear)
+//		if FinishYear != 0 {
+//			passRate.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+//		}
+//	} else if templateTypeId == "189" {
+//		totalYearNo := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereYno)
+//		totalYear := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereY)
+//		FinishYear := int(totalYearNo) + int(totalYear)
+//		if FinishYear != 0 {
+//			passRate.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+//		}
+//	} else if templateTypeId == "141" {
+//		totalYearNo := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereYno)
+//		totalYear := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereY)
+//		FinishYear := int(totalYearNo) + int(totalYear)
+//		if FinishYear != 0 {
+//			passRate.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+//		}
+//	} else if templateTypeId == "173" {
+//		totalYearNo := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereYno)
+//		totalYear := svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereY)
+//		FinishYear := int(totalYearNo) + int(totalYear)
+//		if FinishYear != 0 {
+//			passRate.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+//		}
+//	}
+//
+//	var datainfo ErrorDataInfo
+//	datainfo.Item = total
+//	this.Data["json"] = &datainfo
+//	this.ServeJSON()
+//
+//}
+
+// @Title 获取列表
+// @Description get user by token
+// @Success 200 {object}
+// @router /listoil [get]
+func (this *DeviceStatisticsController) GetEntityListOil() {
+
+	unitId := this.GetString("unitCheckId")
+	templateTypeId := this.GetString("TemplateTypeId")
+
+	// 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.DeviceStatisticsOil
+	svc := devicestatistics.GetDeviceStatisticsService(utils.DBE)
+	//fromdate := GetFirstDateOfMonth(time.Now()).Format("2006-01-02 15:04:05")
+	//todate := GetLastDateOfMonth(time.Now()).Format("2006-01-02") + " 23:59:59"
+
+	organizeSvc := organize.GetOrganizeService(utils.DBE)
+
+	thrId := organizeSvc.GetMyThrUnitDepartmentId(this.User.DepartmentId)
+
+	thrIds := ""
+	ethrIds := ""
+	//unitId := ""
+	wheret := ""
+	if thrId == "100001219" || thrId == "100001215" {
+		if unitId != "" {
+			throrg := organizeSvc.GetAllThirdChildByTopId(unitId, "")
+			if throrg == nil {
+				thrIds = "-1"
+			} else {
+				for _, item := range throrg {
+					thrIds += strconv.Itoa(item.Id) + ","
+				}
+				thrIds = strings.Trim(thrIds, ",")
+				ethrIds = organizeSvc.GetAllChildById(unitId)
+			}
+		}
+
+	} else {
+		if unitId != "" {
+			throrg := organizeSvc.GetAllThirdChildByTopId(unitId, "")
+			if throrg == nil {
+				thrIds = "-1"
+			} else {
+				for _, item := range throrg {
+					thrIds += strconv.Itoa(item.Id) + ","
+				}
+				thrIds = strings.Trim(thrIds, ",")
+				ethrIds = organizeSvc.GetAllChildById(unitId)
+			}
+		}
+	}
+	if thrIds != "" {
+		wheret = " and b.TestDepartId in (" + thrIds + ")"
+	}
+	wheree := ""
+	if ethrIds != "" {
+		wheree = " and DepartmentId in (" + ethrIds + ")"
+	}
+
+	where := "(a.CreateOn < DATE_ADD(CURDATE()-DAY(CURDATE())+1,INTERVAL 1 MONTH)) and a.CheckResult != ''" + wheret
+	whereYno := "(a.CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and a.CheckResult='×' " + wheret
+	whereY := "(a.CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and a.CheckResult='○' " + wheret
+
+
+	var unitidArr  = [][]string{
+		{"100000304","第一采油厂"},{"100000402","第二采油厂"},{"100000506","第三采油厂"},{"100000787","第四采油厂"},{"100000852","第五采油厂"},{"100000952","第六采油厂"},
+	}
+
+	if thrId != "100001219" {
+		totalYearNo := 0
+		totalYear := 0
+		num := 0
+		numEQ := 0
+		numWM := 0
+		numWY := 0
+		whereN := ""
+		if templateTypeId == "187" {
+			//  防雷装置(等电位)
+			for _,unit := range unitidArr {
+				var position []limscustomerposition2.LimsCustomerPosition
+				wherep := "PositionTypeId = '1' and CustomerId = " + unit[0]
+				svc.GetEntitysByWhere(this.User.AccCode + LimsCustomerpositionName, wherep, &position )
+				positionids := ""
+				for _,item := range position {
+					positionids = positionids + strconv.Itoa(item.Id) + ","
+				}
+				positionids = strings.Trim(positionids, ",")
+				if positionids != "" {
+					var deviceEQ devicestatistics.DeviceStatisticsOil
+					whereYno = whereYno + " and b.CustomerId=" + unit[0]
+					whereY = whereY + " and b.CustomerId=" + unit[0]
+					totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportEquipotentName, whereYno)
+					totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportEquipotentName, whereY)
+					num = svc.GetCountsByDate(this.User.AccCode+LimsReportEquipotentName, where)
+					whereN := "TemplateTypeId=187 And  PositionCheckId IN (" + positionids + ")" + wheree
+					numEQ := svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+					numWM := svc.GetWaitCountsMonth("187")
+					numWY := svc.GetWaitCountsYear("187")
+					deviceEQ.UnitId,_ = strconv.Atoi(unit[0])
+					deviceEQ.UnitName = unit[1]
+					deviceEQ.TemplateTypeId = 187
+					deviceEQ.DeviceName = "防雷装置(等电位)"
+					deviceEQ.DeviceQty = int(numEQ)
+					deviceEQ.WaitYear = int(numWY)
+					deviceEQ.WaitMonth = int(numWM)
+					deviceEQ.FinishMonth = int(num)
+					deviceEQ.FinishYear = int(totalYearNo) + int(totalYear)
+					if deviceEQ.FinishYear != 0 {
+						deviceEQ.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+					}
+					devicelist = append(devicelist, deviceEQ)
+				}
+			}
+		}
+		if templateTypeId == "286" {
+			for _,unit := range unitidArr {
+				//  防雷装置
+				var position []limscustomerposition2.LimsCustomerPosition
+				wherep := "PositionTypeId = '1' and CustomerId = " + unit[0]
+				svc.GetEntitysByWhere(this.User.AccCode + LimsCustomerpositionName, wherep, &position )
+				positionids := ""
+				for _,item := range position {
+					positionids = positionids + strconv.Itoa(item.Id) + ","
+				}
+				positionids = strings.Trim(positionids, ",")
+				if positionids != "" {
+					var deviceLPT devicestatistics.DeviceStatisticsOil
+					whereYno = whereYno + " and b.CustomerId=" + unit[0]
+					whereY = whereY + " and b.CustomerId=" + unit[0]
+					totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportLightProtectName, whereYno)
+					totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportLightProtectName, whereY)
+					num = svc.GetCountsByDate(this.User.AccCode+LimsReportLightProtectName, where)
+					whereN = "TemplateTypeId=286 And  PositionCheckId IN (" + positionids + ")" + wheree
+					numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+					numWM = svc.GetWaitCountsMonth("286")
+					numWY = svc.GetWaitCountsYear("286")
+					deviceLPT.UnitId,_ = strconv.Atoi(unit[0])
+					deviceLPT.UnitName = unit[1]
+					deviceLPT.TemplateTypeId = 286
+					deviceLPT.DeviceName = "防雷装置"
+					deviceLPT.DeviceQty = numEQ
+					deviceLPT.WaitYear = int(numWY)
+					deviceLPT.WaitMonth = int(numWM)
+					deviceLPT.FinishMonth = int(num)
+					deviceLPT.FinishYear = int(totalYearNo) + int(totalYear)
+					if deviceLPT.FinishYear != 0 {
+						deviceLPT.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+					}
+					devicelist = append(devicelist, deviceLPT)
+				}
+			}
+		}
+
+		if templateTypeId == "181" {
+			for _, unit := range unitidArr {
+				var position []limscustomerposition2.LimsCustomerPosition
+				wherep := "PositionTypeId = '1' and CustomerId = " + unit[0]
+				svc.GetEntitysByWhere(this.User.AccCode + LimsCustomerpositionName, wherep, &position )
+				positionids := ""
+				for _,item := range position {
+					positionids = positionids + strconv.Itoa(item.Id) + ","
+				}
+				positionids = strings.Trim(positionids, ",")
+				if positionids != "" {
+					//  漏电保护器
+					var deviceLP devicestatistics.DeviceStatisticsOil
+					whereYno = whereYno + " and b.CustomerId=" + unit[0]
+					whereY = whereY + " and b.CustomerId=" + unit[0]
+					totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportLeakProtectName, whereYno)
+					totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportLeakProtectName, whereY)
+					num = svc.GetCountsByDate(this.User.AccCode+LimsReportLeakProtectName, where)
+					whereN = "TemplateTypeId=181 And  PositionCheckId IN (" + positionids + ")" + wheree
+					numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+					numWM = svc.GetWaitCountsMonth("181")
+					numWY = svc.GetWaitCountsYear("181")
+					deviceLP.UnitId,_ = strconv.Atoi(unit[0])
+					deviceLP.UnitName = unit[1]
+					deviceLP.TemplateTypeId = 181
+					deviceLP.DeviceName = "漏电保护器"
+					deviceLP.DeviceQty = numEQ
+					deviceLP.WaitYear = int(numWY)
+					deviceLP.WaitMonth = int(numWM)
+					deviceLP.FinishMonth = int(num)
+					deviceLP.FinishYear = int(totalYearNo) + int(totalYear)
+					if deviceLP.FinishYear != 0 {
+						deviceLP.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+					}
+					devicelist = append(devicelist, deviceLP)
+
+				}
+			}
+		}
+		if templateTypeId == "179" {
+			for _, unit := range unitidArr {
+				var position []limscustomerposition2.LimsCustomerPosition
+				wherep := "PositionTypeId = '1' and CustomerId = " + unit[0]
+				svc.GetEntitysByWhere(this.User.AccCode+LimsCustomerpositionName, wherep, &position)
+				positionids := ""
+				for _, item := range position {
+					positionids = positionids + strconv.Itoa(item.Id) + ","
+				}
+				positionids = strings.Trim(positionids, ",")
+				if positionids != "" {
+					//  电气接地
+					var deviceEG devicestatistics.DeviceStatisticsOil
+					whereYno = whereYno + " and b.CustomerId=" + unit[0]
+					whereY = whereY + " and b.CustomerId=" + unit[0]
+					totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportElecGroundName, whereYno)
+					totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportElecGroundName, whereY)
+					num = svc.GetCountsByDate(this.User.AccCode+LimsReportElecGroundName, where)
+					whereN = "TemplateTypeId=179 And  PositionCheckId IN (" + positionids + ")" + wheree
+					numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+					numWM = svc.GetWaitCountsMonth("179")
+					numWY = svc.GetWaitCountsYear("179")
+					deviceEG.UnitId,_ = strconv.Atoi(unit[0])
+					deviceEG.UnitName = unit[1]
+					deviceEG.TemplateTypeId = 179
+					deviceEG.DeviceName = "电气接地"
+					deviceEG.DeviceQty = numEQ
+					deviceEG.WaitYear = int(numWY)
+					deviceEG.WaitMonth = int(numWM)
+					deviceEG.FinishMonth = int(num)
+					deviceEG.FinishYear = int(totalYearNo) + int(totalYear)
+					if deviceEG.FinishYear != 0 {
+						deviceEG.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+					}
+					devicelist = append(devicelist, deviceEG)
+				}
+			}
+		}
+
+
+	}
+
+	if thrId != "100001215" {
+		whereYno = "(a.CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and a.CheckResult LIKE '%不合格%'" + wheret
+		whereY = "(a.CreateOn < DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAYOFYEAR(NOW())-1 DAY),INTERVAL 1 YEAR)) and a.CheckResult LIKE '%合格%' AND CheckResult NOT LIKE '%不合格%' " + wheret
+		numWY := 0
+		numWM := 0
+		numEQ := 0
+		whereN := ""
+		num := 0
+		totalYear := 0
+		totalYearNo := 0
+		if templateTypeId == "156" {
+			for _, unit := range unitidArr {
+				var position []limscustomerposition2.LimsCustomerPosition
+				wherep := "PositionTypeId = '1' and CustomerId = " + unit[0]
+				svc.GetEntitysByWhere(this.User.AccCode + LimsCustomerpositionName, wherep, &position )
+				positionids := ""
+				for _,item := range position {
+					positionids = positionids + strconv.Itoa(item.Id) + ","
+				}
+				positionids = strings.Trim(positionids, ",")
+				if positionids != "" {
+					//阻火器 LimsReportZuhq
+					var deviceZHQ devicestatistics.DeviceStatisticsOil
+					whereYno = whereYno + " and b.CustomerId=" + unit[0]
+					whereY = whereY + " and b.CustomerId=" + unit[0]
+					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 And  PositionCheckId IN (" + positionids + ")" + wheree
+					numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+					numWM = svc.GetWaitCountsMonth("156")
+					numWY = svc.GetWaitCountsYear("156")
+					deviceZHQ.UnitId ,_ = strconv.Atoi(unit[0])
+					deviceZHQ.UnitName = unit[1]
+					deviceZHQ.TemplateTypeId = 156
+					deviceZHQ.DeviceName = "阻火器"
+					deviceZHQ.DeviceQty = numEQ
+					deviceZHQ.WaitYear = int(numWY)
+					deviceZHQ.WaitMonth = int(numWM)
+					deviceZHQ.FinishMonth = int(num)
+					deviceZHQ.FinishYear = int(totalYearNo) + int(totalYear)
+					if deviceZHQ.FinishYear != 0 {
+						deviceZHQ.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+					}
+					devicelist = append(devicelist, deviceZHQ)
+				}
+			}
+		}
+
+		if templateTypeId == "183" {
+			for _, unit := range unitidArr {
+				var position []limscustomerposition2.LimsCustomerPosition
+				wherep := "PositionTypeId = '1' and CustomerId = " + unit[0]
+				svc.GetEntitysByWhere(this.User.AccCode+LimsCustomerpositionName, wherep, &position)
+				positionids := ""
+				for _, item := range position {
+					positionids = positionids + strconv.Itoa(item.Id) + ","
+				}
+				positionids = strings.Trim(positionids, ",")
+				if positionids != "" {
+					// 呼吸阀 LimsReportHuxf
+					var deviceHXF devicestatistics.DeviceStatisticsOil
+					whereYno = whereYno + " and b.CustomerId=" + unit[0]
+					whereY = whereY + " and b.CustomerId=" + unit[0]
+					totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportHuxfName, whereYno)
+					totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportHuxfName, whereY)
+					num = svc.GetCountsByDate(this.User.AccCode+LimsReportHuxfName, where)
+					whereN = "TemplateTypeId=183 And  PositionCheckId IN (" + positionids + ")" + wheree
+					numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+					numWM = svc.GetWaitCountsMonth("183")
+					numWY = svc.GetWaitCountsYear("183")
+					deviceHXF.UnitId,_ = strconv.Atoi(unit[0])
+					deviceHXF.UnitName = unit[1]
+					deviceHXF.TemplateTypeId = 183
+					deviceHXF.DeviceName = "呼吸阀"
+					deviceHXF.DeviceQty = numEQ
+					deviceHXF.WaitYear = int(numWY)
+					deviceHXF.WaitMonth = int(numWM)
+					deviceHXF.FinishMonth = int(num)
+					deviceHXF.FinishYear = int(totalYearNo) + int(totalYear)
+					if deviceHXF.FinishYear != 0 {
+						deviceHXF.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+					}
+					devicelist = append(devicelist, deviceHXF)
+				}
+			}
+		}
+		if templateTypeId == "189" {
+			for _, unit := range unitidArr {
+				var position []limscustomerposition2.LimsCustomerPosition
+				wherep := "PositionTypeId = '1' and CustomerId = " + unit[0]
+				svc.GetEntitysByWhere(this.User.AccCode+LimsCustomerpositionName, wherep, &position)
+				positionids := ""
+				for _, item := range position {
+					positionids = positionids + strconv.Itoa(item.Id) + ","
+				}
+				positionids = strings.Trim(positionids, ",")
+				if positionids != "" {
+					// 空气泡沫产生器 LimsReportAirFoamGenerator
+					var deviceKQPM devicestatistics.DeviceStatisticsOil
+					whereYno = whereYno + " and b.CustomerId=" + unit[0]
+					whereY = whereY + " and b.CustomerId=" + unit[0]
+					totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportKqpmName, whereYno)
+					totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportKqpmName, whereY)
+					num = svc.GetCountsByDate(this.User.AccCode+LimsReportKqpmName, where)
+					whereN = "TemplateTypeId=189 And  PositionCheckId IN (" + positionids + ")" + wheree
+					numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+					numWM = svc.GetWaitCountsMonth("189")
+					numWY = svc.GetWaitCountsYear("189")
+					deviceKQPM.UnitId,_ = strconv.Atoi(unit[0])
+					deviceKQPM.UnitName = unit[1]
+					deviceKQPM.TemplateTypeId = 189
+					deviceKQPM.DeviceName = "空气泡沫产生器"
+					deviceKQPM.DeviceQty = numEQ
+					deviceKQPM.WaitYear = int(numWY)
+					deviceKQPM.WaitMonth = int(numWM)
+					deviceKQPM.FinishMonth = int(num)
+					deviceKQPM.FinishYear = int(totalYearNo) + int(totalYear)
+					if deviceKQPM.FinishYear != 0 {
+						deviceKQPM.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+					}
+					devicelist = append(devicelist, deviceKQPM)
+				}
+			}
+		}
+
+
+		if templateTypeId == "141" {
+			for _, unit := range unitidArr {
+				var position []limscustomerposition2.LimsCustomerPosition
+				wherep := "PositionTypeId = '1' and CustomerId = " + unit[0]
+				svc.GetEntitysByWhere(this.User.AccCode+LimsCustomerpositionName, wherep, &position)
+				positionids := ""
+				for _, item := range position {
+					positionids = positionids + strconv.Itoa(item.Id) + ","
+				}
+				positionids = strings.Trim(positionids, ",")
+				if positionids != "" {
+					// 游梁式抽油机 LimsReportBeamPumpingUnits
+					var deviceYL devicestatistics.DeviceStatisticsOil
+					whereYno = whereYno + " and b.CustomerId=" + unit[0]
+					whereY = whereY + " and b.CustomerId=" + unit[0]
+					totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportBeamPumpingUnitName, whereYno)
+					totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportBeamPumpingUnitName, whereY)
+					num = svc.GetCountsByDate(this.User.AccCode+LimsReportBeamPumpingUnitName, where)
+					whereN = "TemplateTypeId=141 And  PositionCheckId IN (" + positionids + ")" + wheree
+					numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+					numWM = svc.GetWaitCountsMonth("141")
+					numWY = svc.GetWaitCountsYear("141")
+					deviceYL.UnitId,_ = strconv.Atoi(unit[0])
+					deviceYL.UnitName = unit[1]
+					deviceYL.TemplateTypeId = 141
+					deviceYL.DeviceName = "游梁式抽油机"
+					deviceYL.DeviceQty = numEQ
+					deviceYL.WaitYear = int(numWY)
+					deviceYL.WaitMonth = int(numWM)
+					deviceYL.FinishMonth = int(num)
+					deviceYL.FinishYear = int(totalYearNo) + int(totalYear)
+					if deviceYL.FinishYear != 0 {
+						deviceYL.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+					}
+					devicelist = append(devicelist, deviceYL)
+				}
+			}
+		}
+
+		if templateTypeId == "173" {
+			for _, unit := range unitidArr {
+				var position []limscustomerposition2.LimsCustomerPosition
+				wherep := "PositionTypeId = '1' and CustomerId = " + unit[0]
+				svc.GetEntitysByWhere(this.User.AccCode+LimsCustomerpositionName, wherep, &position)
+				positionids := ""
+				for _, item := range position {
+					positionids = positionids + strconv.Itoa(item.Id) + ","
+				}
+				positionids = strings.Trim(positionids, ",")
+				if positionids != "" {
+					// 无游梁式抽油机 LimsReportNoBeamPumpingUnit
+					var deviceWYL devicestatistics.DeviceStatisticsOil
+					whereYno = whereYno + " and b.CustomerId=" + unit[0]
+					whereY = whereY + " and b.CustomerId=" + unit[0]
+					totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereYno)
+					totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, whereY)
+					num = svc.GetCountsByDate(this.User.AccCode+LimsReportNoBeamPumpingUnitName, where)
+					whereN = "TemplateTypeId=173 And  PositionCheckId IN (" + positionids + ")" + wheree
+					numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+					numWM = svc.GetWaitCountsMonth("173")
+					numWY = svc.GetWaitCountsYear("173")
+					deviceWYL.UnitId,_ = strconv.Atoi(unit[0])
+					deviceWYL.UnitName = unit[1]
+					deviceWYL.TemplateTypeId = 173
+					deviceWYL.DeviceName = "无游梁式抽油机"
+					deviceWYL.DeviceQty = numEQ
+					deviceWYL.WaitYear = int(numWY)
+					deviceWYL.WaitMonth = int(numWM)
+					deviceWYL.FinishMonth = int(num)
+					deviceWYL.FinishYear = int(totalYearNo) + int(totalYear)
+					if deviceWYL.FinishYear != 0 {
+						deviceWYL.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
+					}
+					devicelist = append(devicelist, deviceWYL)
+				}
+			}
+		}
+
+
+
+
+	}
+
+	var datainfo ErrorDataInfo
+	datainfo.Item = devicelist
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+
+}
+
 //获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。
 
 func GetFirstDateOfMonth(d time.Time) time.Time {

+ 7 - 0
src/dashoo.cn/frontend_web/src/api/lims/secondcenter.js

@@ -18,5 +18,12 @@ export default {
       method: 'GET',
       params: params
     })
+  },
+  getListOil (params, myAxios) {
+    return myAxios({
+      url: '/devicestatistics/listoil',
+      method: 'GET',
+      params: params
+    })
   }
 }

+ 11 - 2
src/dashoo.cn/frontend_web/src/pages/lims/reportelecground/subdata/datalist.vue

@@ -1041,8 +1041,17 @@
       },
       // 编辑
       EditEntity (row) {
-        this.$refs['DataoperaCompoment'].subListEditEntity(row.Id)
-        this.$refs['DataoperaCompoment'].dialogVisible = true
+        this.$axios.get('/limsdataentry/getdataentry/' + this.queryParams.DataEntryId).then(res => {
+          if (!res.data.TestDepartId || res.data.TestDepartId === '' ||
+            !res.data.PositionCheckId || res.data.PositionCheckId === '') {
+            this.$message.warning('受检单位、检测地点不能为空!')
+            return
+          }
+          this.$refs['DataoperaCompoment'].subListEditEntity(row.Id, res.data.PositionCheckId)
+          this.$refs['DataoperaCompoment'].dialogVisible = true
+        }).catch(error => {
+          console.log(error)
+        })
       },
 
       jstimehandle (val) {

+ 1 - 0
src/dashoo.cn/frontend_web/src/pages/lims/reportelecground/subdata/dataopera.vue

@@ -392,6 +392,7 @@
           }
         }
         this.groupOptions[0].options = arr
+        console.log(this.groupOptions, 'this.groupOptionsthis.groupOptions')
         Object.assign(this.groupOptions1, this.groupOptions[0].options)
         Object.assign(this.groupOptions2, this.groupOptions[1].options)
       },

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

@@ -16,8 +16,7 @@
         </el-select>
       </el-form-item>
       <el-form-item>
-        <el-button type="primary"
-                   @click="onSubmit">查询</el-button>
+        <el-button type="primary">查询</el-button>
       </el-form-item>
     </el-form>
 
@@ -25,11 +24,11 @@
       <el-col :span="12">
         <v-chart :forceFit="true"
                  :height="height"
-                 :data="data"
+                 :data="tableData"
                  :scale="scale">
           <v-tooltip />
           <v-axis />
-          <v-bar position="year*sales" />
+          <v-bar position="UnitName*DeviceQty" />
         </v-chart>
       </el-col>
       <el-col :span="12">
@@ -37,28 +36,28 @@
                   size="mini"
                   :height="450"
                   stripe>
-          <el-table-column prop="address"
+          <el-table-column prop="UnitName"
                            width="190"
                            fixed="left"
                            label="检测地点">
           </el-table-column>
 
-          <el-table-column prop="number"
+          <el-table-column prop="DeviceQty"
                            label="设备总量"
                            width="180">
           </el-table-column>
 
-          <el-table-column prop="number"
+          <el-table-column prop="WaitYear"
                            label="全年待检"
                            width="180">
           </el-table-column>
 
-          <el-table-column prop="name"
+          <el-table-column prop="FinishYear"
                            label="全年已检"
                            width="180">
           </el-table-column>
 
-          <el-table-column prop="name"
+          <el-table-column prop="PassRate"
                            label="合格率"
                            width="180">
           </el-table-column>
@@ -83,19 +82,7 @@
 </style>
 
 <script>
-// const data = [
-//   { year: '采油一厂', sales: 38 },
-//   { year: '采油二厂', sales: 52 },
-//   { year: '采油三厂', sales: 61 },
-//   { year: '采油四厂', sales: 145 },
-//   { year: '采油五厂', sales: 48 },
-//   { year: '采油六厂', sales: 38 }
-// ]
-
-// const scale = [{
-//   dataKey: 'sales',
-//   tickInterval: 20
-// }]
+import api from '@/api/lims/secondcenter'
 
 export default {
   props: {
@@ -108,40 +95,12 @@ export default {
         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: '采油四厂'
-      }],
+      tableData: [],
       pieStyle: {
         stroke: '#fff',
         lineWidth: 1
@@ -155,7 +114,16 @@ export default {
     }
   },
   methods: {
-    onSubmit () {
+    getTableData (Pid, Uid) {
+      let params = {
+        TemplateTypeId: Pid,
+        unitCheckId: Uid
+      }
+      console.log(params, 'paramsparams')
+      api.getListOil(params, this.$axios).then(res => {
+        console.log(res, '=========')
+        this.tableData = res.data.item
+      })
     }
   }
 }

+ 130 - 0
src/dashoo.cn/frontend_web/src/pages/lims/secondcenter/finishYear.vue

@@ -0,0 +1,130 @@
+<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">查询</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10">
+      <el-col :span="12">
+        <v-chart :forceFit="true"
+                 :height="height"
+                 :data="tableData"
+                 :scale="scale">
+          <v-tooltip />
+          <v-axis />
+          <v-bar position="UnitName*FinishYear" />
+        </v-chart>
+      </el-col>
+      <el-col :span="12">
+        <el-table :data="tableData"
+                  size="mini"
+                  :height="450"
+                  stripe>
+          <el-table-column prop="UnitName"
+                           width="190"
+                           fixed="left"
+                           label="检测地点">
+          </el-table-column>
+
+          <el-table-column prop="DeviceQty"
+                           label="设备总量"
+                           width="180">
+          </el-table-column>
+
+          <el-table-column prop="WaitYear"
+                           label="全年待检"
+                           width="180">
+          </el-table-column>
+
+          <el-table-column prop="FinishYear"
+                           label="全年已检"
+                           width="180">
+          </el-table-column>
+
+          <el-table-column prop="PassRate"
+                           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>
+import api from '@/api/lims/secondcenter'
+
+export default {
+  props: {
+    TemplateTypeId: String
+  },
+  data () {
+    return {
+      formSearch: {
+        daterange: [],
+        checkPosition: '',
+        equipments: []
+      },
+      scale: [{
+        dataKey: 'sales',
+        tickInterval: 20
+      }],
+      height: 400,
+      tableData: [],
+      pieStyle: {
+        stroke: '#fff',
+        lineWidth: 1
+      },
+      labelConfig: ['percent', {
+        formatter: (val, item) => {
+          return item.point.item + ': ' + val
+        }
+      }]
+
+    }
+  },
+  methods: {
+    getTableData (Pid, Uid) {
+      let params = {
+        TemplateTypeId: Pid,
+        unitCheckId: Uid
+      }
+      console.log(params, 'paramsparams')
+      api.getListOil(params, this.$axios).then(res => {
+        console.log(res, '=========')
+        this.tableData = res.data.item
+      })
+    }
+  }
+}
+</script>

+ 130 - 0
src/dashoo.cn/frontend_web/src/pages/lims/secondcenter/passRate.vue

@@ -0,0 +1,130 @@
+<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">查询</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10">
+      <el-col :span="12">
+        <v-chart :forceFit="true"
+                 :height="height"
+                 :data="tableData"
+                 :scale="scale">
+          <v-tooltip />
+          <v-axis />
+          <v-bar position="UnitName*PassRate" />
+        </v-chart>
+      </el-col>
+      <el-col :span="12">
+        <el-table :data="tableData"
+                  size="mini"
+                  :height="450"
+                  stripe>
+          <el-table-column prop="UnitName"
+                           width="190"
+                           fixed="left"
+                           label="检测地点">
+          </el-table-column>
+
+          <el-table-column prop="DeviceQty"
+                           label="设备总量"
+                           width="180">
+          </el-table-column>
+
+          <el-table-column prop="WaitYear"
+                           label="全年待检"
+                           width="180">
+          </el-table-column>
+
+          <el-table-column prop="FinishYear"
+                           label="全年已检"
+                           width="180">
+          </el-table-column>
+
+          <el-table-column prop="PassRate"
+                           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>
+  import api from '@/api/lims/secondcenter'
+
+  export default {
+    props: {
+      TemplateTypeId: String
+    },
+    data () {
+      return {
+        formSearch: {
+          daterange: [],
+          checkPosition: '',
+          equipments: []
+        },
+        scale: [{
+          dataKey: 'sales',
+          tickInterval: 20
+        }],
+        height: 400,
+        tableData: [],
+        pieStyle: {
+          stroke: '#fff',
+          lineWidth: 1
+        },
+        labelConfig: ['percent', {
+          formatter: (val, item) => {
+            return item.point.item + ': ' + val
+          }
+        }]
+
+      }
+    },
+    methods: {
+      getTableData (Pid, Uid) {
+        let params = {
+          TemplateTypeId: Pid,
+          unitCheckId: Uid
+        }
+        console.log(params, 'paramsparams')
+        api.getListOil(params, this.$axios).then(res => {
+          console.log(res, '=========')
+          this.tableData = res.data.item
+        })
+      }
+    }
+  }
+</script>

+ 33 - 47
src/dashoo.cn/frontend_web/src/pages/lims/secondcenter/pieCheckResult.vue

@@ -24,40 +24,34 @@
         </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 :data="tableData"
+                  size="mini"
+                  :height="450"
+                  stripe>
+          <el-table-column prop="UnitName"
+                           width="190"
+                           fixed="left"
+                           label="检测地点">
           </el-table-column>
 
-          <el-table-column
-            prop="number"
-            label="设备总量"
-            width="180">
+          <el-table-column prop="DeviceQty"
+                           label="设备总量"
+                           width="180">
           </el-table-column>
 
-          <el-table-column
-            prop="number"
-            label="全年待检"
-            width="180">
+          <el-table-column prop="WaitYear"
+                           label="全年待检"
+                           width="180">
           </el-table-column>
 
-          <el-table-column
-            prop="name"
-            label="全年已检"
-            width="180">
+          <el-table-column prop="FinishYear"
+                           label="全年已检"
+                           width="180">
           </el-table-column>
 
-          <el-table-column
-            prop="name"
-            label="合格率"
-            width="180">
+          <el-table-column prop="PassRate"
+                           label="合格率"
+                           width="180">
           </el-table-column>
 
         </el-table>
@@ -81,6 +75,7 @@
 </style>
 
 <script>
+  import api from '@/api/lims/secondcenter'
   const DataSet = require('@antv/data-set')
 
   const sourceData = [
@@ -115,27 +110,7 @@
           equipments: []
         },
         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: '采油四厂'
-        }],
+        tableData: [],
 
         data,
         scale,
@@ -153,6 +128,17 @@
     },
     methods: {
       onSubmit () {
+      },
+      getTableData (Pid, Uid) {
+        let params = {
+          TemplateTypeId: Pid,
+          unitCheckId: Uid
+        }
+        console.log(params, 'paramsparams')
+        api.getListOil(params, this.$axios).then(res => {
+          console.log(res, '=========')
+          this.tableData = res.data.item
+        })
       }
     }
   }

+ 74 - 10
src/dashoo.cn/frontend_web/src/pages/lims/secondcenter/towLevelCenter.vue

@@ -54,13 +54,13 @@
 
         <el-table-column prop="WaitYear" label="全年待检">
           <template slot-scope="scope">
-            <el-link @click="showCheckTotal(scope.row)">{{scope.row.WaitYear}}</el-link>
+            <el-link @click="showWaitYear(scope.row)">{{scope.row.WaitYear}}</el-link>
           </template>
         </el-table-column>
 
         <el-table-column prop="FinishYear" label="全年已检">
           <template slot-scope="scope">
-            <el-link @click="showCheckTotal(scope.row)">{{scope.row.FinishYear}}</el-link>
+            <el-link @click="showFinishYear(scope.row)">{{scope.row.FinishYear}}</el-link>
           </template>
         </el-table-column>
 
@@ -68,7 +68,7 @@
 
         <el-table-column prop="PassRate" label="合格率(%)">
           <template slot-scope="scope">
-            <el-link @click="showCheckTotal(scope.row)">{{scope.row.PassRate}}</el-link>
+            <el-link @click="showPassRate(scope.row)">{{scope.row.PassRate}}</el-link>
           </template>
         </el-table-column>
       </el-table>
@@ -85,17 +85,29 @@
     </el-card>
 
     <el-dialog :visible.sync="pieDialogVisible" width="85%" title="防雷装置检测率">
-      <pie-check-result></pie-check-result>
+      <pie-check-result ref="PieCheckResultRef"></pie-check-result>
     </el-dialog>
 
     <el-dialog :visible.sync="totalDialogVisible" width="85%" :title="totalDialogTitle">
-      <check-total :TemplateTypeId="TemplateTypeId"></check-total>
+      <check-total ref="Checktotalref"></check-total>
     </el-dialog>
 
     <el-dialog  width="85%" :title="totalDialogTitle">
       <annual-checked></annual-checked>
     </el-dialog>
 
+    <el-dialog :visible.sync="rateDialogVisible" width="85%" :title="rateDialogTitle">
+      <pass-rate ref="RateRef"></pass-rate>
+    </el-dialog>
+
+    <el-dialog :visible.sync="waitYearDialogVisible" width="85%" :title="waitYearDialogTitle">
+      <wait-year ref="WaitYearRef"></wait-year>
+    </el-dialog>
+
+    <el-dialog :visible.sync="finishYearDialogVisible" width="85%" :title="finishYearDialogTitle">
+      <finish-year ref="FinishYearRef"></finish-year>
+    </el-dialog>
+
   </div>
 
 
@@ -107,6 +119,9 @@
   import pieCheckResult from './pieCheckResult.vue'
   import checkTotal from './checkTotal.vue'
   import annualChecked from './annualChecked.vue'
+  import passRate from './passRate.vue'
+  import waitYear from './waitYear.vue'
+  import finishYear from './finishYear.vue'
 
   import {
     mapGetters
@@ -120,7 +135,10 @@
     components: {
       pieCheckResult,
       checkTotal,
-      annualChecked
+      annualChecked,
+      passRate,
+      waitYear,
+      finishYear
     },
     data () {
       return {
@@ -129,6 +147,12 @@
         pieDialogVisible: false,
         totalDialogVisible: false,
         totalDialogTitle: '',
+        rateDialogTitle: '',
+        rateDialogVisible: false,
+        waitYearDialogTitle: '',
+        waitYearDialogVisible: false,
+        finishYearDialogVisible: false,
+        finishYearDialogTitle: '',
         Isauthority: false,
         beijiance: false,
         jiancedidian: false,
@@ -200,12 +224,50 @@
     },
     methods: {
       showPie (row) {
-        this.pieDialogVisible = true
+        let _this = this
+        _this.TemplateTypeId = row.TemplateTypeId
+        _this.pieDialogVisible = true
+        setTimeout(function () {
+          _this.$refs['PieCheckResultRef'].getTableData(_this.TemplateTypeId, _this.UnitCheckId)
+        }, (200))
+      },
+      showPassRate (row) {
+        let _this = this
+        _this.TemplateTypeId = row.TemplateTypeId
+        _this.rateDialogTitle = row.DeviceName + '合格率'
+        _this.rateDialogVisible = true
+        setTimeout(function () {
+          _this.$refs['RateRef'].getTableData(_this.TemplateTypeId, _this.UnitCheckId)
+        }, (200))
       },
       showCheckTotal (row) {
-        this.TemplateTypeId = row.Id
-        this.totalDialogTitle = row.DeviceName + '全年已检'
-        this.totalDialogVisible = true
+        let _this = this
+        _this.TemplateTypeId = row.TemplateTypeId
+        _this.totalDialogTitle = row.DeviceName + '设备总量'
+        _this.totalDialogVisible = true
+        console.log(this.TemplateTypeId)
+        setTimeout(function () {
+          console.log('qw')
+          _this.$refs['Checktotalref'].getTableData(_this.TemplateTypeId, _this.UnitCheckId)
+        }, (500))
+      },
+      showWaitYear (row) {
+        let _this = this
+        _this.TemplateTypeId = row.TemplateTypeId
+        _this.waitYearDialogTitle = row.DeviceName + '全年待检'
+        _this.waitYearDialogVisible = true
+        setTimeout(function () {
+          _this.$refs['WaitYearRef'].getTableData(_this.TemplateTypeId, _this.UnitCheckId)
+        }, (200))
+      },
+      showFinishYear (row) {
+        let _this = this
+        _this.TemplateTypeId = row.TemplateTypeId
+        _this.finishYearDialogTitle = row.DeviceName + '全年已检'
+        _this.finishYearDialogVisible = true
+        setTimeout(function () {
+          _this.$refs['FinishYearRef'].getTableData(_this.TemplateTypeId, _this.UnitCheckId)
+        }, (200))
       },
       getAuthority () {
         let params = {
@@ -216,6 +278,7 @@
           if (res.data.items['unitId'] !== '') {
             this.UnitCheckId = parseInt(res.data.items['unitId'])
           }
+          console.log(this.UnitCheckId, 'this.UnitCheckIdthis.UnitCheckId')
           this.initData()
         })
       },
@@ -231,6 +294,7 @@
         }
         api.getList(params, this.$axios).then(res => {
           this.tableData = res.data.item
+          console.log(this.tableData, 'this.tableDatathis.tableData')
           this.newTableData = []
           for (let idx in this.tableData) {
             this.newTableData.push({

+ 130 - 0
src/dashoo.cn/frontend_web/src/pages/lims/secondcenter/waitYear.vue

@@ -0,0 +1,130 @@
+<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">查询</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10">
+      <el-col :span="12">
+        <v-chart :forceFit="true"
+                 :height="height"
+                 :data="tableData"
+                 :scale="scale">
+          <v-tooltip />
+          <v-axis />
+          <v-bar position="UnitName*WaitYear" />
+        </v-chart>
+      </el-col>
+      <el-col :span="12">
+        <el-table :data="tableData"
+                  size="mini"
+                  :height="450"
+                  stripe>
+          <el-table-column prop="UnitName"
+                           width="190"
+                           fixed="left"
+                           label="检测地点">
+          </el-table-column>
+
+          <el-table-column prop="DeviceQty"
+                           label="设备总量"
+                           width="180">
+          </el-table-column>
+
+          <el-table-column prop="WaitYear"
+                           label="全年待检"
+                           width="180">
+          </el-table-column>
+
+          <el-table-column prop="FinishYear"
+                           label="全年已检"
+                           width="180">
+          </el-table-column>
+
+          <el-table-column prop="PassRate"
+                           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>
+import api from '@/api/lims/secondcenter'
+
+export default {
+  props: {
+    TemplateTypeId: String
+  },
+  data () {
+    return {
+      formSearch: {
+        daterange: [],
+        checkPosition: '',
+        equipments: []
+      },
+      scale: [{
+        dataKey: 'sales',
+        tickInterval: 20
+      }],
+      height: 400,
+      tableData: [],
+      pieStyle: {
+        stroke: '#fff',
+        lineWidth: 1
+      },
+      labelConfig: ['percent', {
+        formatter: (val, item) => {
+          return item.point.item + ': ' + val
+        }
+      }]
+
+    }
+  },
+  methods: {
+    getTableData (Pid, Uid) {
+      let params = {
+        TemplateTypeId: Pid,
+        unitCheckId: Uid
+      }
+      console.log(params, 'paramsparams')
+      api.getListOil(params, this.$axios).then(res => {
+        console.log(res, '=========')
+        this.tableData = res.data.item
+      })
+    }
+  }
+}
+</script>