Ver Fonte

Merge branch 'ETA_1.8.0' into debug

zwxi há 11 meses atrás
pai
commit
4e1a4a1121
2 ficheiros alterados com 42 adições e 17 exclusões
  1. 42 17
      controllers/target.go
  2. BIN
      static/Data Import Template.xlsx

+ 42 - 17
controllers/target.go

@@ -804,7 +804,12 @@ func (this *TargetCommonController) TemplateDownload() {
 		this.ServeJSON()
 	}()
 
-	this.Ctx.Output.Download("./static/数据导入模板.xlsx", "数据导入模板.xlsx")
+	if this.Lang == utils.EnLangVersion {
+		this.Ctx.Output.Download("./static/Data Import Template.xlsx", "Data Import Template.xlsx")
+	} else {
+		this.Ctx.Output.Download("./static/数据导入模板.xlsx", "数据导入模板.xlsx")
+	}
+
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "下载成功"
@@ -905,22 +910,22 @@ func (this *TargetController) ImportData() {
 					return
 				}
 				templateFail := false
-				if cells[0].Value != "品种分类" {
+				if cells[0].Value != "品种分类" && cells[0].Value != "Species Category" {
 					templateFail = true
 				}
-				if cells[1].Value != "录入日期" {
+				if cells[1].Value != "录入日期" && cells[1].Value != "Input Date" {
 					templateFail = true
 				}
-				if cells[2].Value != "指标名称" {
+				if cells[2].Value != "指标名称" && cells[2].Value != "Indicator Name Indicator Name" {
 					templateFail = true
 				}
-				if cells[3].Value != "值" {
+				if cells[3].Value != "值" && cells[3].Value != "Value" {
 					templateFail = true
 				}
-				if cells[4].Value != "频度" {
+				if cells[4].Value != "频度" && cells[4].Value != "Frequency" {
 					templateFail = true
 				}
-				if cells[5].Value != "单位" {
+				if cells[5].Value != "单位" && cells[5].Value != "Unit" {
 					templateFail = true
 				}
 				if templateFail {
@@ -1286,15 +1291,30 @@ func (this *TargetController) ImportFailListDownload() {
 		return
 	}
 	xlsxFile := xlsx.NewFile()
-	sheet, err := xlsxFile.AddSheet("导入失败数据")
+	SheetName := "导入失败数据"
+	if this.Lang == utils.EnLangVersion {
+		SheetName = "Import Fail List"
+	}
+	sheet, err := xlsxFile.AddSheet(SheetName)
 	headRow := sheet.AddRow()
-	headRow.AddCell().SetValue("品种分类")
-	headRow.AddCell().SetValue("录入日期")
-	headRow.AddCell().SetValue("指标名称")
-	headRow.AddCell().SetValue("值")
-	headRow.AddCell().SetValue("频度")
-	headRow.AddCell().SetValue("单位")
-	headRow.AddCell().SetValue("备注")
+	if this.Lang == utils.EnLangVersion {
+		headRow.AddCell().SetValue("Species Category")
+		headRow.AddCell().SetValue("Input Date")
+		headRow.AddCell().SetValue("Indicator Name Indicator Name")
+		headRow.AddCell().SetValue("Value")
+		headRow.AddCell().SetValue("Frequency")
+		headRow.AddCell().SetValue("Unit")
+		headRow.AddCell().SetValue("Remark")
+	} else {
+		headRow.AddCell().SetValue("品种分类")
+		headRow.AddCell().SetValue("录入日期")
+		headRow.AddCell().SetValue("指标名称")
+		headRow.AddCell().SetValue("值")
+		headRow.AddCell().SetValue("频度")
+		headRow.AddCell().SetValue("单位")
+		headRow.AddCell().SetValue("备注")
+	}
+
 	for _, v := range item {
 		row := sheet.AddRow()
 		row.AddCell().SetValue(v.ClassifyName)
@@ -1316,7 +1336,12 @@ func (this *TargetController) ImportFailListDownload() {
 	defer func() {
 		os.Remove(savePath)
 	}()
-	this.Ctx.Output.Download(savePath, "失败列表.xlsx")
+	finalFileName := "失败列表.xlsx"
+
+	if this.Lang == utils.EnLangVersion {
+		finalFileName = "Failure List.xlsx"
+	}
+	this.Ctx.Output.Download(savePath, finalFileName)
 }
 
 // ExportDataList
@@ -1718,7 +1743,7 @@ func (this *TargetController) TargetCheck() {
 		return
 	}
 	resp := new(models.DataCheckResp)
-	count, err := data_manage.GetEdbInfoCount(utils.DATA_SOURCE_MANUAL,tradeCode)
+	count, err := data_manage.GetEdbInfoCount(utils.DATA_SOURCE_MANUAL, tradeCode)
 	if err != nil && err.Error() != utils.ErrNoRow() {
 		br.Msg = "获取数据失败"
 		br.Msg = "获取数据失败,Err:" + err.Error()

BIN
static/Data Import Template.xlsx