lining 6 years ago
parent
commit
20667ff722

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

@@ -24,7 +24,25 @@ func GetDeviceStatisticsService(xormEngine *xorm.Engine) *DeviceStatisticsServic
 func (s *DeviceStatisticsService) GetCountsByDate(tablename, where string) (total int) {
 	var resultsSlice []map[string][]byte
 	var total1 int64
-	sql := `select count(*) As counts from ` + tablename + ` where ` + where
+	sql := `select count(*) As counts from ` + tablename + ` a `
+	sql += ` LEFT JOIN s5OVELimsDateEntry b ON a.DataEntryId = b.Id`
+	sql += `  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)
+}
+
+//本月检测
+func (s *DeviceStatisticsService) GetCountsByDateEquipment(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]

+ 150 - 87
src/dashoo.cn/backend/api/controllers/lims/devicestatistics.go

@@ -2,10 +2,12 @@ package lims
 
 import (
 	"dashoo.cn/backend/api/business/devicestatistics"
+	"dashoo.cn/backend/api/business/organize"
 	. "dashoo.cn/backend/api/controllers"
 	"dashoo.cn/utils"
 	"fmt"
 	"strconv"
+	"strings"
 	"time"
 )
 
@@ -13,14 +15,14 @@ type DeviceStatisticsController struct {
 	BaseController
 }
 
-
-
 // @Title 获取列表
 // @Description get user by token
 // @Success 200 {object}
 // @router /list [get]
 func (this *DeviceStatisticsController) GetEntityList() {
 
+	unitId := this.GetString("unitCheckId")
+
 	// svcPerm := permission.GetPermissionService(utils.DBE)
 	//isauth := svcPerm.IsAuthorized(this.User.Id, "Administrator")
 	// organizeSvc := organize.GetOrganizeService(utils.DBE)
@@ -31,22 +33,64 @@ func (this *DeviceStatisticsController) GetEntityList() {
 	//fromdate := GetFirstDateOfMonth(time.Now()).Format("2006-01-02 15:04:05")
 	//todate := GetLastDateOfMonth(time.Now()).Format("2006-01-02") + " 23:59:59"
 
-	where := "(CreateOn < DATE_ADD(CURDATE()-DAY(CURDATE())+1,INTERVAL 1 MONTH)) and CheckResult != ''"
-	//fromdateyear := strconv.Itoa(time.Now().Year()) + "-01-01 00:00:00"
-	//todateyear := strconv.Itoa(time.Now().Year()) + "-12-31 23:59:59"
-	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='○'"
+	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 thrId == this.User.DepartmentId {
+			unitId = organizeSvc.GetMyUnitDepartmentId(this.User.DepartmentId)
+			//var throrg []organize.Base_Organize
+			throrg := organizeSvc.GetAllThirdChildByTopId(unitId, "")
+			for _, item := range throrg {
+				thrIds += strconv.Itoa(item.Id) + ","
+			}
+			ethrIds = organizeSvc.GetAllChildById(unitId)
+			thrIds = strings.Trim(thrIds, ",")
+		//} else {
+		//	ethrIds = thrId
+		//}
+	}
+	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
 
-	//if isauth || thrunitId == "100001215" {
+	if thrId != "100001219" {
 		//  防雷装置(等电位)
 		var deviceEQ devicestatistics.DeviceStatistics
-		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"
-		numEQ := svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
-		numWM :=svc.GetWaitCountsMonth("187")
-		numWY :=svc.GetWaitCountsYear("187")
+		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 " + wheree
+		numEQ := svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+		numWM := svc.GetWaitCountsMonth("187")
+		numWY := svc.GetWaitCountsYear("187")
 		deviceEQ.DeviceName = "防雷装置(等电位)"
 		deviceEQ.DeviceQty = int(numEQ)
 		deviceEQ.WaitYear = int(numWY)
@@ -60,13 +104,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
 
 		//  防雷装置
 		var deviceLPT devicestatistics.DeviceStatistics
-		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"
-		numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
-		numWM =svc.GetWaitCountsMonth("286")
-		numWY =svc.GetWaitCountsYear("286")
+		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 " + wheree
+		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+		numWM = svc.GetWaitCountsMonth("286")
+		numWY = svc.GetWaitCountsYear("286")
 		deviceLPT.DeviceName = "防雷装置"
 		deviceLPT.DeviceQty = numEQ
 		deviceLPT.WaitYear = int(numWY)
@@ -80,13 +124,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
 
 		//  漏电保护器
 		var deviceLP devicestatistics.DeviceStatistics
-		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"
-		numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
-		numWM =svc.GetWaitCountsMonth("181")
-		numWY =svc.GetWaitCountsYear("181")
+		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" + wheree
+		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+		numWM = svc.GetWaitCountsMonth("181")
+		numWY = svc.GetWaitCountsYear("181")
 		deviceLP.DeviceName = "漏电保护器"
 		deviceLP.DeviceQty = numEQ
 		deviceLP.WaitYear = int(numWY)
@@ -100,13 +144,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
 
 		//  电气接地
 		var deviceEG devicestatistics.DeviceStatistics
-		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"
-		numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
-		numWM =svc.GetWaitCountsMonth("179")
-		numWY =svc.GetWaitCountsYear("179")
+		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 " + wheree
+		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+		numWM = svc.GetWaitCountsMonth("179")
+		numWY = svc.GetWaitCountsYear("179")
 		deviceEG.DeviceName = "电气接地"
 		deviceEG.DeviceQty = numEQ
 		deviceEG.WaitYear = int(numWY)
@@ -117,20 +161,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" {
-		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 '%不合格%'"
+	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
 		//阻火器 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" + wheree
+		numEQ := svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+		numWM := svc.GetWaitCountsMonth("156")
+		numWY := svc.GetWaitCountsYear("156")
 		deviceZHQ.DeviceName = "阻火器"
 		deviceZHQ.DeviceQty = numEQ
 		deviceZHQ.WaitYear = int(numWY)
@@ -144,13 +188,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
 
 		// 呼吸阀 LimsReportHuxf
 		var deviceHXF devicestatistics.DeviceStatistics
-		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"
-		numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
-		numWM =svc.GetWaitCountsMonth("183")
-		numWY =svc.GetWaitCountsYear("183")
+		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 " + wheree
+		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+		numWM = svc.GetWaitCountsMonth("183")
+		numWY = svc.GetWaitCountsYear("183")
 		deviceHXF.DeviceName = "呼吸阀"
 		deviceHXF.DeviceQty = numEQ
 		deviceHXF.WaitYear = int(numWY)
@@ -164,13 +208,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
 
 		// 液压安全阀 LimsReportYeyaqf
 		var deviceYYF devicestatistics.DeviceStatistics
-		totalYearNo = svc.GetCountsByDate(this.User.AccCode + LimsReportYeyaqfName, whereYno)
-		totalYear = svc.GetCountsByDate(this.User.AccCode + LimsReportYeyaqfName, whereY)
-		num = svc.GetCountsByDate(this.User.AccCode + LimsReportYeyaqfName, where)
-		whereN ="TemplateTypeId=154"
-		numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
-		numWM =svc.GetWaitCountsMonth("154")
-		numWY =svc.GetWaitCountsYear("154")
+		totalYearNo = svc.GetCountsByDate(this.User.AccCode+LimsReportYeyaqfName, whereYno)
+		totalYear = svc.GetCountsByDate(this.User.AccCode+LimsReportYeyaqfName, whereY)
+		num = svc.GetCountsByDate(this.User.AccCode+LimsReportYeyaqfName, where)
+		whereN = "TemplateTypeId=154 " + wheree
+		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+		numWM = svc.GetWaitCountsMonth("154")
+		numWY = svc.GetWaitCountsYear("154")
 		deviceYYF.DeviceName = "液压安全阀"
 		deviceYYF.DeviceQty = numEQ
 		deviceYYF.WaitYear = int(numWY)
@@ -184,13 +228,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
 
 		// 空气泡沫产生器 LimsReportAirFoamGenerator
 		var deviceKQPM devicestatistics.DeviceStatistics
-		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"
-		numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
-		numWM =svc.GetWaitCountsMonth("189")
-		numWY =svc.GetWaitCountsYear("189")
+		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 " + wheree
+		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+		numWM = svc.GetWaitCountsMonth("189")
+		numWY = svc.GetWaitCountsYear("189")
 		deviceKQPM.DeviceName = "空气泡沫产生器"
 		deviceKQPM.DeviceQty = numEQ
 		deviceKQPM.WaitYear = int(numWY)
@@ -198,19 +242,19 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		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)
+			deviceKQPM.PassRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", (float64(totalYear)/(float64(totalYearNo)+float64(totalYear)))*100), 64)
 		}
 		devicelist = append(devicelist, deviceKQPM)
 
 		// 游梁式抽油机 LimsReportBeamPumpingUnits
 		var deviceYL devicestatistics.DeviceStatistics
-		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"
-		numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
-		numWM =svc.GetWaitCountsMonth("141")
-		numWY =svc.GetWaitCountsYear("141")
+		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 " + wheree
+		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+		numWM = svc.GetWaitCountsMonth("141")
+		numWY = svc.GetWaitCountsYear("141")
 		deviceYL.DeviceName = "游梁式抽油机"
 		deviceYL.DeviceQty = numEQ
 		deviceYL.WaitYear = int(numWY)
@@ -224,13 +268,13 @@ func (this *DeviceStatisticsController) GetEntityList() {
 
 		// 无游梁式抽油机 LimsReportNoBeamPumpingUnit
 		var deviceWYL devicestatistics.DeviceStatistics
-		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"
-		numEQ = svc.GetCountsByDate(this.User.AccCode + LimsCheckEquipmentListName, whereN)
-		numWM =svc.GetWaitCountsMonth("173")
-		numWY =svc.GetWaitCountsYear("173")
+		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 " + wheree
+		numEQ = svc.GetCountsByDateEquipment(this.User.AccCode+LimsCheckEquipmentListName, whereN)
+		numWM = svc.GetWaitCountsMonth("173")
+		numWY = svc.GetWaitCountsYear("173")
 		deviceWYL.DeviceName = "无游梁式抽油机"
 		deviceWYL.DeviceQty = numEQ
 		deviceWYL.WaitYear = int(numWY)
@@ -242,8 +286,7 @@ func (this *DeviceStatisticsController) GetEntityList() {
 		}
 		devicelist = append(devicelist, deviceWYL)
 
-	//}
-
+	}
 
 	var datainfo ErrorDataInfo
 	datainfo.Item = devicelist
@@ -252,20 +295,40 @@ func (this *DeviceStatisticsController) GetEntityList() {
 
 }
 
+// @Title 获取字典列表
+// @Description get user by token
+// @Success 200 {object} map[string]interface{}
+// @router /dictlist [get]
+func (this *DeviceStatisticsController) GetDictList() {
+	dictList := make(map[string]interface{})
+	var unitorg []organize.Base_Organize
+	svc := organize.GetOrganizeService(utils.DBE)
+	//unitId := svc.GetMyUnitDepartmentId(this.User.DepartmentId)
+	//unitorg = svc.GetAllThirdChildByTopId(unitId, "")
 
+	where := "Category='unit'"
+	svc.GetEntities(&unitorg, where)
+	dictList["unitorg"] = unitorg
 
+	var datainfo DataInfo
+	datainfo.Items = dictList
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
 
 //获取传入的时间所在月份的第一天,即某月第一天的0点。如传入time.Now(), 返回当前月份的第一天0点时间。
 
 func GetFirstDateOfMonth(d time.Time) time.Time {
-	d = d.AddDate(0, 0, -d.Day() + 1)
+	d = d.AddDate(0, 0, -d.Day()+1)
 	return GetZeroTime(d)
 }
+
 //获取传入的时间所在月份的最后一天,即某月最后一天的0点。如传入time.Now(), 返回当前月份的最后一天0点时间。
 func GetLastDateOfMonth(d time.Time) time.Time {
 	return GetFirstDateOfMonth(d).AddDate(0, 1, -1)
 }
+
 //获取某一天的0点时间
 func GetZeroTime(d time.Time) time.Time {
 	return time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, d.Location())
-}
+}

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

@@ -170,7 +170,7 @@ module.exports = {
      'pages/lims/oiltestingdaily/**/*.*',
      'pages/lims/preparation/**/*.*',
      'pages/lims/tasksbalance/**/*.*',
-     'pages/system/**/*.*',
+     // 'pages/system/**/*.*',
      'pages/setting/**/*.*',
      'pages/prototype/**/*.*',
      'pages/material/**/*.*',

+ 2 - 2
src/dashoo.cn/frontend_web/nuxt.config.js

@@ -163,8 +163,8 @@ module.exports = {
   },
 
   axios: {
-    // baseURL: '//localhost:10091/api/' // 本机开发使用
-    baseURL: '//47.92.212.59:10091/api/' // Lims使用
+    baseURL: '//localhost:10091/api/' // 本机开发使用
+    // baseURL: '//47.92.212.59:10091/api/' // Lims使用
 
     // proxyHeaders: false
   },

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

@@ -5,5 +5,11 @@ export default {
       method: 'GET',
       params: params
     })
+  },
+  getDictList (myAxios) {
+    return myAxios({
+      url: '/devicestatistics/dictlist/',
+      method: 'GET'
+    })
   }
 }

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

@@ -3,11 +3,11 @@
     <div style="width: 100%; overflow-y: auto" v-loading="downloading">
       <div slot="header" style="padding-top: 0px">
         <el-card>
-        <span style="float: left; margin-top:10px;">
-          <img v-if="user.photo" :src="'http://'+user.host+user.photo" class="avatar-index">
-          <img v-else class="avatar-index" src="../assets/img/avatar-default.jpg" :alt="user.name"> &nbsp;[
-          {{user.Realname}} ]
-        </span>
+        <!--<span style="float: left; margin-top:10px;">-->
+          <!--<img v-if="user.photo" :src="'http://'+user.host+user.photo" class="avatar-index">-->
+          <!--<img v-else class="avatar-index" src="../assets/img/avatar-default.jpg" :alt="user.name"> &nbsp;[-->
+          <!--{{user.Realname}} ]-->
+        <!--</span>-->
           <span style="float: right; margin-right:10px;">
           <!--<el-form ref="form" :inline="true" style="float: right;">-->
             <!--<el-form-item label="查询日期">-->
@@ -22,48 +22,48 @@
             <!--</el-form-item>-->
           <!--</el-form>-->
         </span>
-          <el-form ref="form" :inline="true" style="float: left; margin-left:20px;">
-            <el-form-item>
-              <router-link :to="'/lims/dataentry/tacktodo'">
-                <el-button type="primary" plain style="margin-left:5px;" size="mini" v-if="!allshow && permissions[permissionscode.entry]">
-                  数据录入
-                  <span style="color:#0000FF">【{{usertotal.EntryTotal}}】</span>
-                </el-button>
-              </router-link>
-            </el-form-item>
-            <el-form-item>
-              <router-link :to="'/lims/dataentry/tacktodo'">
-                <el-button type="primary" plain style="margin-left:5px;" size="mini" v-if="!allshow && permissions[permissionscode.check]">
-                  数据校核
-                  <span style="color:#0000FF">【{{usertotal.CheckTotal}}】</span>
-                </el-button>
-              </router-link>
-            </el-form-item>
-            <el-form-item>
-              <router-link :to="'/lims/dataentry/tacktodo'">
-                <el-button type="primary" plain style="margin-left:5px;" size="mini" v-if="!tjz && !allshow && permissions[permissionscode.audit]">
-                  数据预审
-                  <span style="color:#0000FF">【{{usertotal.AuditTotal}}】</span>
-                </el-button>
-              </router-link>
-            </el-form-item>
-            <el-form-item>
-              <router-link :to="'/lims/dataentry/tacktodo'">
-                <el-button type="primary" plain style="margin-left:5px;" size="mini" v-if="!allshow && permissions[permissionscode.audit]">
-                  数据审批
-                  <span style="color:#0000FF">【{{usertotal.AuditTotal}}】</span>
-                </el-button>
-              </router-link>
-            </el-form-item>
-            <el-form-item>
-              <router-link :to="'/lims/createreport/reporttodo'">
-                <el-button type="primary" plain style="margin-left:5px;" size="mini" v-if="!allshow && permissions[permissionscode.sign]">
-                  报告签发
-                  <span style="color:#0000FF">【{{usertotal.SignTotal}}】</span>
-                </el-button>
-              </router-link>
-            </el-form-item>
-          </el-form>
+          <!--<el-form ref="form" :inline="true" style="float: left; margin-left:20px;">-->
+            <!--<el-form-item>-->
+              <!--<router-link :to="'/lims/dataentry/tacktodo'">-->
+                <!--<el-button type="primary" plain style="margin-left:5px;" size="mini" v-if="!allshow && permissions[permissionscode.entry]">-->
+                  <!--数据录入-->
+                  <!--<span style="color:#0000FF">【{{usertotal.EntryTotal}}】</span>-->
+                <!--</el-button>-->
+              <!--</router-link>-->
+            <!--</el-form-item>-->
+            <!--<el-form-item>-->
+              <!--<router-link :to="'/lims/dataentry/tacktodo'">-->
+                <!--<el-button type="primary" plain style="margin-left:5px;" size="mini" v-if="!allshow && permissions[permissionscode.check]">-->
+                  <!--数据校核-->
+                  <!--<span style="color:#0000FF">【{{usertotal.CheckTotal}}】</span>-->
+                <!--</el-button>-->
+              <!--</router-link>-->
+            <!--</el-form-item>-->
+            <!--<el-form-item>-->
+              <!--<router-link :to="'/lims/dataentry/tacktodo'">-->
+                <!--<el-button type="primary" plain style="margin-left:5px;" size="mini" v-if="!tjz && !allshow && permissions[permissionscode.audit]">-->
+                  <!--数据预审-->
+                  <!--<span style="color:#0000FF">【{{usertotal.AuditTotal}}】</span>-->
+                <!--</el-button>-->
+              <!--</router-link>-->
+            <!--</el-form-item>-->
+            <!--<el-form-item>-->
+              <!--<router-link :to="'/lims/dataentry/tacktodo'">-->
+                <!--<el-button type="primary" plain style="margin-left:5px;" size="mini" v-if="!allshow && permissions[permissionscode.audit]">-->
+                  <!--数据审批-->
+                  <!--<span style="color:#0000FF">【{{usertotal.AuditTotal}}】</span>-->
+                <!--</el-button>-->
+              <!--</router-link>-->
+            <!--</el-form-item>-->
+            <!--<el-form-item>-->
+              <!--<router-link :to="'/lims/createreport/reporttodo'">-->
+                <!--<el-button type="primary" plain style="margin-left:5px;" size="mini" v-if="!allshow && permissions[permissionscode.sign]">-->
+                  <!--报告签发-->
+                  <!--<span style="color:#0000FF">【{{usertotal.SignTotal}}】</span>-->
+                <!--</el-button>-->
+              <!--</router-link>-->
+            <!--</el-form-item>-->
+          <!--</el-form>-->
         </el-card>
 
         <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">

+ 29 - 40
src/dashoo.cn/frontend_web/src/pages/lims/secondcenter/towLevelCenter.vue

@@ -5,17 +5,17 @@
         <span>
           <i class="icon icon-table2"></i> 统计
         </span>
-        <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
+        <el-form ref="form" :inline="true" style="float: right; margin-top: -10px" v-if="beijiance">
           <!--<el-form-item label="检测时间">
             <el-date-picker size="mini" style="width: 220px" v-model="CreateOn" type="daterange" range-separator="至"
                             start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
           </el-form-item>-->
 
-          <!--<el-form-item label="被检单位">
-            <el-select ref="refQueryProjectType" style="margin-right:10px; margin-top: -4px;" size="mini" v-model="UnitCheckId" clearable filterable placeholder="按被检单位查询" @change="ProjectTypeChangeHandler" @clear="ProjectTypeClearHandler">
-              <el-option v-for="item in UnitCheckOptions" :key="item.id" :label="item.FullName" :value="item.Id"></el-option>
+          <el-form-item label="被检单位">
+            <el-select ref="refQueryProjectType" style="margin-right:10px; margin-top: -4px;" size="mini" v-model="UnitCheckId" clearable filterable placeholder="按被检单位查询">
+              <el-option v-for="item in UnitCheckOptions" :key="item.Id" :label="item.Fullname" :value="item.Id"></el-option>
             </el-select>
-          </el-form-item>-->
+          </el-form-item>
 
           <!--<el-form-item label="检测单位">
             <el-select ref="refQueryProjectType" style="margin-right:10px; margin-top: -4px;" size="mini" v-model="QueryProjectTypeId" clearable filterable placeholder="按检测单位查询" @change="ProjectTypeChangeHandler" @clear="ProjectTypeClearHandler">
@@ -29,9 +29,9 @@
             </el-select>
           </el-form-item>-->
 
-          <!--<el-form-item>
-            <el-button type="primary" size="mini">查询</el-button>
-          </el-form-item>-->
+          <el-form-item>
+            <el-button type="primary" size="mini" @click="initData">查询</el-button>
+          </el-form-item>
         </el-form>
       </div>
       <el-table :data="tableData" style="width: 100%" stripe>
@@ -70,12 +70,19 @@
 
 <script>
   import api from '@/api/lims/secondcenter'
-
+  import {
+    mapGetters
+  } from 'vuex'
   const DataSet = require('@antv/data-set')
 
   export default {
+    computed: mapGetters({
+      authUser: 'authUser'
+    }),
     data () {
       return {
+        beijiance: false,
+        jiancedidian: false,
         formSearch: {
           daterange: [],
           checkPosition: '',
@@ -130,46 +137,28 @@
           label: '无游梁式抽油机'
         }],
 
-        UnitCheckOptions: [{
-          value: '187',
-          label: '防雷装置(等电位)'
-        }, {
-          value: '286',
-          label: '防雷装置'
-        }, {
-          value: '181',
-          label: '漏电保护器'
-        }, {
-          value: '179',
-          label: '电气接地'
-        }, {
-          value: '156',
-          label: '阻火器'
-        }, {
-          value: '183',
-          label: '呼吸阀'
-        }, {
-          value: '154',
-          label: '液压安全阀'
-        }, {
-          value: '189',
-          label: '空气泡沫产生器'
-        }, {
-          value: '141',
-          label: '游梁式抽油机'
-        }, {
-          value: '173',
-          label: '无游梁式抽油机'
-        }]
+        UnitCheckOptions: []
 
       }
     },
     created () {
+      if (this.authUser.Profile.DepartmentId === '100001219' || this.authUser.Profile.DepartmentId === '100001215') {
+        this.beijiance = true
+      } else {
+
+      }
+      this.getDictOptions()
       this.initData()
     },
     methods: {
+      getDictOptions () {
+        api.getDictList(this.$axios).then(res => {
+          this.UnitCheckOptions = res.data.items['unitorg']
+        })
+      },
       initData () {
         let params = {
+          unitCheckId: this.UnitCheckId
         }
         api.getList(params, this.$axios).then(res => {
           this.tableData = res.data.item