caipin 4 лет назад
Родитель
Сommit
e276cb759d
2 измененных файлов с 6 добавлено и 6 удалено
  1. 2 2
      comm/functions.go
  2. 4 4
      services/tree_service.go

+ 2 - 2
comm/functions.go

@@ -149,7 +149,7 @@ func MakeFolderContract(Data []*viewmodels.FolderContract, node *viewmodels.Fold
 		if math.IsNaN(quotient) {
 			quotient = 0
 		}
-		node.ContractsIncomeProgress = fmt.Sprintf("%.0f", (quotient)*100) + "%"
+		node.ContractsIncomeProgress = fmt.Sprintf("%.2f", (quotient)*100)
 		// 支出相关
 		// node.ContractsPay =  fmt.Sprintf("%.2f", totalPay)
 		node.ContractsPay = fmt.Sprintf("%.2f", totalPay)
@@ -157,7 +157,7 @@ func MakeFolderContract(Data []*viewmodels.FolderContract, node *viewmodels.Fold
 		if math.IsNaN(quotient) {
 			quotient = 0
 		}
-		node.ContractsPayProgress = fmt.Sprintf("%.0f", (quotient)*100) + "%"
+		node.ContractsPayProgress = fmt.Sprintf("%.2f", (quotient)*100)
 		// 安全巡检
 		node.SafeTotal = safeTotal
 		node.SafeRectification = safeTotalRectification

+ 4 - 4
services/tree_service.go

@@ -231,9 +231,9 @@ func (s *treeService) GetAllContract(projectId int, account *models.CmProjectAcc
 			ContractsReturned, err := strconv.ParseFloat(data.ContractsReturned, 64)
 			if err != nil || ContractsReturned == 0 {
 				ContractsReturned = 0
-				folder.ContractsIncomeProgress = "0%"
+				folder.ContractsIncomeProgress = "0"
 			} else {
-				folder.ContractsIncomeProgress = fmt.Sprintf("%.2f", (ContractsReturned/ContractsIncome)*100) + "%"
+				folder.ContractsIncomeProgress = fmt.Sprintf("%.2f", (ContractsReturned/ContractsIncome)*100)
 			}
 
 			contractsPay, _ := strconv.ParseFloat(data.ContractsPay, 64)
@@ -249,9 +249,9 @@ func (s *treeService) GetAllContract(projectId int, account *models.CmProjectAcc
 			ContractsPaid, err := strconv.ParseFloat(data.ContractsPaid, 64)
 			if err != nil || ContractsPaid == 0 {
 				ContractsPaid = 0
-				folder.ContractsPayProgress = "0%"
+				folder.ContractsPayProgress = "0"
 			} else {
-				folder.ContractsPayProgress = fmt.Sprintf("%.2f", (ContractsPaid/ContractsPay)*100) + "%"
+				folder.ContractsPayProgress = fmt.Sprintf("%.2f", (ContractsPaid/ContractsPay)*100)
 			}
 
 			// 安全