Explorar o código

平台首页容器数量、样本数量、容器条形图修改

hanmj %!s(int64=6) %!d(string=hai) anos
pai
achega
c680d214af

+ 83 - 16
src/dashoo.cn/backend/api/controllers/casbin/user.go

@@ -3,6 +3,7 @@ package casbin
 import (
 	"encoding/json"
 	"fmt"
+	"strconv"
 	"strings"
 
 	"dashoo.cn/backend/api/business/accountinfo"
@@ -10,7 +11,7 @@ import (
 	"dashoo.cn/backend/api/business/logsinfo"
 	"dashoo.cn/backend/api/business/organize"
 	"dashoo.cn/backend/api/business/printscheme"
-	"dashoo.cn/backend/api/business/role"
+	//"dashoo.cn/backend/api/business/role"
 	"dashoo.cn/backend/api/models"
 	"dashoo.cn/business2/auth"
 	"dashoo.cn/business2/permission"
@@ -24,6 +25,7 @@ import (
 	"dashoo.cn/backend/api/business/samplesinfo"
 
 	. "dashoo.cn/backend/api/controllers"
+	organize2 "dashoo.cn/business2/organize"
 	"dashoo.cn/utils"
 )
 
@@ -479,28 +481,65 @@ func (this *UserController) UserChangePWD() {
 // @Success	200	{object} controllers.Request
 // @router /getaccountinfo [get]
 func (this *UserController) GetAccountInfo() {
-	svcs := equipment.GetEquipmentService(utils.DBE)
-	svcrole := role.GetRoleService(utils.DBE)
-	roleids := svcrole.GetRoleidsByuid(utils.ToStr(this.User.Id))
+	svc := equipment.GetEquipmentService(utils.DBE)
+	svcPermission := permission.GetPermissionService(utils.DBE)
+	eids := svcPermission.GetEquipmentIdById(utils.ToStr(this.User.Id))
+
+	userSvc := userRole.GetUserService(utils.DBE)
+	organizeSvc := organize2.GetOrganizeService(utils.DBE)
+	departList := organizeSvc.GetChildByTopId(this.User.DepartmentId)
+	//取出当前部门及下级部门的所有用户列表
+	var subUserList []userRole.Base_User
+	whereUser := " 1=1 "
+	whereUser += " and DepartmentId in (" + departList + ")"
+	userSvc.GetEntities(&subUserList, whereUser)
+	var userIds string
+
+	for _, tmpUser := range subUserList {
+		userIds += strconv.Itoa(tmpUser.Id) + ","
+	}
+	userIds = strings.Trim(userIds, ",")
+
 	where := " a.AccCode = '" + this.User.AccCode + "'"
-	where = where + " and (a.CreateUserId=" + utils.ToStr(this.User.Id) + " or a.Id in (select EquipmentId Id FROM Base_RoleEquipment where RoleId in (" + strings.Join(roleids, ",") + ")))"
+	if eids != "" {
+		where = where + " and (a.CreateUserId in (" + userIds + ")" + " or a.Id in (" + eids + "))"
+	} else {
+		where = where + "and a.CreateUserId in (" + userIds + ")"
+	}
 
-	devicetotal, _ := svcs.GetEquipmenViewtList(1, 1, "a.Id", where)
+	devicetotal, _ := svc.GetEquipmenViewtList(0, 1, "a.Id desc", where)
 
+	svc2 :=samplesinfo.GetSamplesInfoService(utils.DBE)
 	//已录入样本
 	where1 := " IState =1 and DeletionStateCode=0 "
+	yilurutotal, _ := svc2.GetPagingEntitiesWithOrderSearch(this.User.AccCode, 1,1, "Id desc", where1)
+
+
+
+
 
+	svcs := equipment.GetEquipmentService(utils.DBE)
+	//svcrole := role.GetRoleService(utils.DBE)
+	//roleids := svcrole.GetRoleidsByuid(utils.ToStr(this.User.Id))
+	//where := " a.AccCode = '" + this.User.AccCode + "'"
+	//where = where + " and (a.CreateUserId=" + utils.ToStr(this.User.Id) + " or a.Id in (select EquipmentId Id FROM Base_RoleEquipment where RoleId in (" + strings.Join(roleids, ",") + ")))"
+	//
+	//devicetotal, _ := svcs.GetEquipmenViewtList(1, 1, "a.Id", where)
+
+	////已录入样本
+	//where1 := " IState =1 and DeletionStateCode=0 "
+	//
 	poweeids := svcs.GetPowerEquipmentids(this.User.AccCode, utils.ToStr(this.User.Id))
-	where1 = where1 + " and  a.EquipmentId in(" + strings.Join(poweeids, ",") + ")"
-	svc := samplesinfo.GetSamplesInfoService(utils.DBE)
-	yilurutotal, _ := svc.GetPagingEntitiesWithOrderSearch(this.User.AccCode, 1, 1, "Id desc", where1)
+	//where1 = where1 + " and  a.EquipmentId in(" + strings.Join(poweeids, ",") + ")"
+	//svc := samplesinfo.GetSamplesInfoService(utils.DBE)
+	//yilurutotal, _ := svc.GetPagingEntitiesWithOrderSearch(this.User.AccCode, 1, 1, "Id desc", where1)
 	// 预录入
 	where2 := " a.IState in (2,3,4,7,8) and a.DeletionStateCode=0 "
-	yulurutotal, _ := svc.GetPagingEntitiesWithOrderSearch(this.User.AccCode, 1, 1, "Id desc", where2)
+	yulurutotal, _ := svc2.GetPagingEntitiesWithOrderSearch(this.User.AccCode, 1, 1, "Id desc", where2)
 
 	//待复存
 	where3 := " DeletionStateCode=0 and (IState=6 or ( IState=5 and a.EquipmentId in(" + strings.Join(poweeids, ",") + ")))"
-	daifuchuntotal, _ := svc.GetPagingEntitiesWithOrderSearch(this.User.AccCode, 1, 1, "Id desc", where3)
+	daifuchuntotal, _ := svc2.GetPagingEntitiesWithOrderSearch(this.User.AccCode, 1, 1, "Id desc", where3)
 
 	//已归档
 	svcf := samplesfileinfo.GetSamplesFileInfoService(utils.DBE)
@@ -543,13 +582,41 @@ func (this *UserController) GetTotalByGroupbysampletype() {
 // @Success	200	{object} controllers.Request
 // @router /totalbyeuipment [get]
 func (this *UserController) GetTotalByGroupbydevice() {
-	svcrole := role.GetRoleService(utils.DBE)
-	roleids := svcrole.GetRoleidsByuid(utils.ToStr(this.User.Id))
-	where := " a.AccCode = '" + this.User.AccCode + "'"
-	where = where + " and b.IState =1 and b.DeletionStateCode=0 and (a.CreateUserId=" + utils.ToStr(this.User.Id) + " or a.Id in (select EquipmentId Id FROM Base_RoleEquipment where RoleId in (" + strings.Join(roleids, ",") + ")))"
+	//svcrole := role.GetRoleService(utils.DBE)
+	//roleids := svcrole.GetRoleidsByuid(utils.ToStr(this.User.Id))
+	//where := " a.AccCode = '" + this.User.AccCode + "'"
+	//where = where + " and b.IState =1 and b.DeletionStateCode=0 and (a.CreateUserId=" + utils.ToStr(this.User.Id) + " or a.Id in (select EquipmentId Id FROM Base_RoleEquipment where RoleId in (" + strings.Join(roleids, ",") + ")))"
+	//
+	//svc := samplesinfo.GetSamplesInfoService(utils.DBE)
+
+
+
+	//svc := equipment.GetEquipmentService(utils.DBE)
+	svcPermission := permission.GetPermissionService(utils.DBE)
+	eids := svcPermission.GetEquipmentIdById(utils.ToStr(this.User.Id))
+
+	userSvc := userRole.GetUserService(utils.DBE)
+	organizeSvc := organize2.GetOrganizeService(utils.DBE)
+	departList := organizeSvc.GetChildByTopId(this.User.DepartmentId)
+	//取出当前部门及下级部门的所有用户列表
+	var subUserList []userRole.Base_User
+	whereUser := " 1=1 "
+	whereUser += " and DepartmentId in (" + departList + ")"
+	userSvc.GetEntities(&subUserList, whereUser)
+	var userIds string
+
+	for _, tmpUser := range subUserList {
+		userIds += strconv.Itoa(tmpUser.Id) + ","
+	}
+	userIds = strings.Trim(userIds, ",")
 
+	where := " a.AccCode = '" + this.User.AccCode + "'"
+	if eids != "" {
+		where = where + " and (a.CreateUserId in (" + userIds + ")" + " or a.Id in (" + eids + "))"
+	} else {
+		where = where + "and a.CreateUserId in (" + userIds + ")"
+	}
 	svc := samplesinfo.GetSamplesInfoService(utils.DBE)
-
 	this.Data["json"] = svc.GetTJBydevice(this.User.AccCode, where)
 	this.ServeJSON()
 }

+ 3 - 3
src/dashoo.cn/frontend_web/src/pages/equipment/_opera/manage_new.vue

@@ -618,7 +618,7 @@
       var checkSampleCode = (rule, value, callback) => {
         if (value === '') {
           callback(new Error('请输入样本编码'))
-          return        } else {
+        } else {
           callback()
         }
       }
@@ -4738,8 +4738,8 @@
       }
     }
 
-    width: 530px;
-    height: 440px;
+    width: 400px;
+    // height: 600px;
     position: relative;
     display: inline-block;
     float: left;