3
2
Pārlūkot izejas kodu

设备台账页面

Liuqi 6 gadi atpakaļ
vecāks
revīzija
a796f9cf91

+ 31 - 3
src/dashoo.cn/backend/api/controllers/lims/Limscustomerposition.go

@@ -150,9 +150,10 @@ func (this *LimsCustomerpositionController) CustomerpositionTree() {
 	svc := limscustomerposition.GetLimsCustomerpositionService(utils.DBE)
 
 	where := " 1=1 "
-	CustomerId := this.GetString("CustomerId")
-	if CustomerId != "" {
-		where = where + " and CustomerId = '" + CustomerId + "'"
+	CustomerId := this.User.UnitId
+	UnitId := strconv.Itoa(CustomerId)
+	if UnitId != "" {
+		where = where + " and CustomerId = '" + UnitId + "'"
 	}
 
 	if this.User.UintThirdId > 0 {
@@ -160,12 +161,39 @@ func (this *LimsCustomerpositionController) CustomerpositionTree() {
 	}
 
 	svc.GetEntitysByOrderbyWhere(this.User.AccCode+LimsCustomerpositionName, where, "SortCode, Id asc", &list)
+
+	for i := 0; i < len(list); i++ {
+		if list[i].ParentId == 0  {
+			list[i].ParentId = list[i].ThrUnitId
+		}
+	}
+	var listorganize []organize.Base_Organize
+
+	organizeSvc := organize.GetOrganizeService(utils.DBE)
+	thrunitId := organizeSvc.GetMyThrUnitDepartmentId(this.User.DepartmentId)
+	if thrunitId == this.User.DepartmentId {
+		Uidstring := strconv.Itoa(this.User.UnitId)
+		listorganize = organizeSvc.GetAllThirdChildByTopId(Uidstring,this.User.Id)
+	} else {
+		where = where + " and Id = '" + thrunitId + "'"
+		svc.GetEntitysByOrderbyWhere("Base_Organize", where, "SortCode, Id asc", &listorganize)
+	}
+
+	for _, value := range listorganize {
+		var newline limscustomerposition.LimsCustomerPosition
+		newline.Id = value.Id
+		newline.ParentId = 0
+		newline.PositionName = value.Fullname
+		list = append(list, newline)
+	}
+
 	var datainfo DataInfo
 	datainfo.Items = list
 	this.Data["json"] = &datainfo
 	this.ServeJSON()
 }
 
+
 // @Title 根据组织结构获取树形结构
 // @Description 获取树形结构
 // @Success 200 {object} limscustomerposition.LimsCustomerPosition

+ 30 - 7
src/dashoo.cn/backend/api/controllers/lims/limscheckequipmentlist.go

@@ -44,6 +44,7 @@ func (this *LimsCheckEquipmentListController) GetEntityList() {
 	Id := this.GetString("Id")
 	DepartmentId := this.GetString("DepartmentId")
 	OrderNo := this.GetString("OrderNo")
+	ThrUnitId := this.GetString("ThrUnitId")
 	PositionCheckId := this.GetString("PositionCheckId")
 	PositionCheck := this.GetString("PositionCheck")
 	PositionID := this.GetString("PositionID")
@@ -55,12 +56,33 @@ func (this *LimsCheckEquipmentListController) GetEntityList() {
 	status := this.GetString("Status")
 
 	TemplateTypeId := this.GetString("TemplateTypeId")
-	PositionAllTypeId := this.GetString("PositionAllTypeId")
+	//PositionAllTypeId := this.GetString("ThrUnitId")
 	QueryCheckDate := this.GetString("QueryCheckDate")
 	statusValue := this.GetString("statusValue")
 
+	//取出三级单位下的位置
+
+	strPositionList := ""
+	orgSvc := organize.GetOrganizeService(utils.DBE)
+	positionSvc := limscustomerposition.GetLimsCustomerpositionService(utils.DBE)
+	var entitys []limscustomerposition.LimsCustomerPosition
+	entitys = positionSvc.GetPositionCheckList(this.User.AccCode+LimsCustomerpositionName, ThrUnitId)
+
+	PositionAllTypeId := ""
+	if entitys != nil {
+		for _, value := range entitys {
+			PositionAllTypeId += strconv.Itoa(value.Id) + ","
+		}
+		PositionAllTypeId = strings.Trim(PositionAllTypeId, ",")
+	} else {
+		PositionAllTypeId = ThrUnitId
+	}
+
+
+
+
 	if Id != "" {
-		where = where + " and Id like '%" + Id + "%'"
+		where = where +  "and Id like '%" + Id + "%'"
 	}
 
 	if DepartmentId != "" {
@@ -68,8 +90,11 @@ func (this *LimsCheckEquipmentListController) GetEntityList() {
 	}
 
 	if PositionAllTypeId != "" {
-		where = where + " and (PositionCheckId = '" + PositionAllTypeId + "' or PositionID = '" + PositionAllTypeId + "')"
+		where = where + " and (PositionCheckId in (" + PositionAllTypeId + ") or PositionID = '" + PositionAllTypeId + "')"
 	}
+	//if ThrUnitId != "" {
+	//	where = where + "and ThrUnitId like '%" + ThrUnitId + "%'"
+	//}
 
 	if OrderNo != "" {
 		where = where + " and OrderNo like '%" + OrderNo + "%'"
@@ -129,9 +154,7 @@ func (this *LimsCheckEquipmentListController) GetEntityList() {
 		}
 	}
 	// 把安装位置取出来
-	strPositionList := ""
-	orgSvc := organize.GetOrganizeService(utils.DBE)
-	positionSvc := limscustomerposition.GetLimsCustomerpositionService(utils.DBE)
+
 	if this.User.UintThirdId > 0 {
 		var entitys []limscustomerposition.LimsCustomerPosition
 		entitys = positionSvc.GetPositionCheckList(this.User.AccCode+LimsCustomerpositionName, strconv.Itoa(this.User.UintThirdId))
@@ -154,7 +177,7 @@ func (this *LimsCheckEquipmentListController) GetEntityList() {
 		}
 		strPositionList += "0"
 	}
-
+	
 	if len(strPositionList) > 0 {
 		where = where + " and PositionCheckId in (" + strPositionList + ")"
 	}

+ 5 - 5
src/dashoo.cn/frontend_web/src/pages/lims/checkequipmentlist/index.vue

@@ -684,8 +684,7 @@ export default {
 
     orgtreeNodeClick (data) {
       this.selectNodeId = data.id + ''
-      this.selectNodeName = data.PositionName + ''
-
+      this.selectNodeName = data.FullName + ''
       this.currentPage = 1
       this.initDatas()
     },
@@ -697,7 +696,7 @@ export default {
         Order: this.Column.Order,
         Prop: this.Column.Prop,
         TemplateTypeId: this.QueryProjectTypeId + '',
-        PositionAllTypeId: this.selectNodeId + '',
+        ThrUnitId: this.selectNodeId + '',
         statusValue: this.statusValue
       }
       let myCreateOn = []
@@ -825,7 +824,8 @@ export default {
       }
       positionApi.customerPositionTree(params, this.$axios).then(res => {
         this.customerTreeList = window.toolfun_gettreejson(res.data.items, 'Id', 'ParentId',
-          'Id,CustomerId,ParentId,PositionName,PositionCode,PositionType,PositionTypeId')
+          'Id,CustomerId,ParentId,PositionName,Fullname,PositionCode,PositionType,PositionTypeId')
+        console.log(this.customerTreeList)
       })
         .catch(err => {
           // handle error
@@ -1014,7 +1014,7 @@ export default {
         return
       }
 
-      if (this.PositionList.length !== 2) {
+      if (this.PositionList.length !== 3) {
         this.$message({
           type: 'warning',
           message: '请选择安装位置'