Browse Source

fix:修改管理规则字段

zqbao 6 months ago
parent
commit
e5a81d0a44

+ 4 - 4
models/data_manage/excel/excel_info_rule_mapping.go

@@ -11,10 +11,10 @@ type ExcelInfoRuleMapping struct {
 	ExcelInfoId            int       `description:"Excel信息ID"`
 	RuleType               int       `description:"规则类型"`
 	LeftValue              string    `description:"左值"`
-	LeftValueShow          string    `description:"左值前端显示"`
+	LeftValueBack          string    `description:"左值后端存储"`
 	LeftValueType          int       `description:"左值类型"`
 	RightValue             string    `description:"右值"`
-	RightValueShow         string    `description:"右值前端显示"`
+	RightValueBack         string    `description:"右值后端存储"`
 	RightValueType         int       `description:"右值类型"`
 	FontColor              string    `description:"字体颜色"`
 	BackgroundColor        string    `description:"背景颜色"`
@@ -31,10 +31,10 @@ type ExcelInfoRuleMappingView struct {
 	ExcelInfoId            int    `description:"Excel信息ID"`
 	RuleType               int    `description:"规则类型"`
 	LeftValue              string `description:"左值"`
-	LeftValueShow          string `description:"左值前端显示"`
+	LeftValueBack          string `description:"左值后端存储"`
 	LeftValueType          int    `description:"左值类型"`
 	RightValue             string `description:"右值"`
-	RightValueShow         string `description:"右值前端显示"`
+	RightValueBack         string `description:"右值后端存储"`
 	RightValueType         int    `description:"右值类型"`
 	FontColor              string `description:"字体颜色"`
 	BackgroundColor        string `description:"背景颜色"`

+ 20 - 37
services/data/excel/excel_info.go

@@ -681,31 +681,31 @@ func ExcelRuleFormat(req *request.ExcelRuleMappingReq, lang string) (res *excel.
 		switch req.LeftValue {
 		// 今天
 		case "today":
-			res.LeftValueShow = "今天"
+			res.LeftValueBack = req.LeftValue
 		// 明天
 		case "tomorrow":
-			res.LeftValueShow = "明天"
+			res.LeftValueBack = req.LeftValue
 		// 最近7天
 		case "last7days":
-			res.LeftValueShow = "最近7天"
+			res.LeftValueBack = req.LeftValue
 		// 上周
 		case "lastweek":
-			res.LeftValueShow = "上周"
+			res.LeftValueBack = req.LeftValue
 		// 本周
 		case "thisweek":
-			res.LeftValueShow = "本周"
+			res.LeftValueBack = req.LeftValue
 		// 下周
 		case "nextweek":
-			res.LeftValueShow = "下周"
+			res.LeftValueBack = req.LeftValue
 		// 上月
 		case "lastmonth":
-			res.LeftValueShow = "上月"
+			res.LeftValueBack = req.LeftValue
 		// 本月
 		case "thismonth":
-			res.LeftValueShow = "本月"
+			res.LeftValueBack = req.LeftValue
 		// 下月
 		case "nextmonth":
-			res.LeftValueShow = "下月"
+			res.LeftValueBack = req.LeftValue
 		default:
 			err = errors.New("发生日期规则错误")
 			return
@@ -719,9 +719,9 @@ func ExcelRuleFormat(req *request.ExcelRuleMappingReq, lang string) (res *excel.
 		if err != nil {
 			return nil, err
 		}
-		res.LeftValue = fmt.Sprintf("%d,%d", x, y)
+		res.LeftValueBack = fmt.Sprintf("%d,%d", x, y)
 	default:
-		res.LeftValue = req.LeftValue
+		res.LeftValueBack = req.LeftValue
 	}
 	switch req.RightValueType {
 	// 坐标
@@ -730,17 +730,17 @@ func ExcelRuleFormat(req *request.ExcelRuleMappingReq, lang string) (res *excel.
 		if err != nil {
 			return nil, err
 		}
-		res.RightValue = fmt.Sprintf("%d,%d", x, y)
-		res.RightValueShow = req.RightValue
+		res.RightValue = req.RightValue
+		res.RightValueBack = fmt.Sprintf("%d,%d", x, y)
 	default:
 		res.RightValue = req.RightValue
-		res.RightValueShow = req.RightValue
+		res.RightValueBack = req.RightValue
 	}
-	if res.LeftValueShow == "" {
-		res.LeftValueShow = req.LeftValue
+	if res.LeftValueBack == "" {
+		res.LeftValueBack = req.LeftValue
 	}
-	if res.RightValueShow == "" {
-		res.RightValueShow = req.RightValue
+	if res.RightValueBack == "" {
+		res.RightValueBack = req.RightValue
 	}
 	res.RuleType = req.RuleType
 	res.ExcelInfoId = req.ExcelInfoId
@@ -782,14 +782,14 @@ func ModifyExcelRule(req *request.ExcelRuleMappingReq, lang string) (err error)
 	var updateCols []string
 	if excelInfo.LeftValue != editExcelInfo.LeftValue {
 		updateCols = append(updateCols, "LeftValue")
-		updateCols = append(updateCols, "LeftValueShow")
+		updateCols = append(updateCols, "LeftValueBack")
 	}
 	if excelInfo.LeftValueType != editExcelInfo.LeftValueType {
 		updateCols = append(updateCols, "LeftValueType")
 	}
 	if excelInfo.RightValue != editExcelInfo.RightValue {
 		updateCols = append(updateCols, "RightValue")
-		updateCols = append(updateCols, "RightValueShow")
+		updateCols = append(updateCols, "RightValueBack")
 	}
 	if excelInfo.RightValueType != editExcelInfo.RightValueType {
 		updateCols = append(updateCols, "RightValueType")
@@ -824,23 +824,6 @@ func GetExcelRuleList(excelInfoId int) (resp *response.ExcelRuleListResp, err er
 	if err != nil {
 		return
 	}
-	for _, v := range excelInfoList {
-		switch v.RuleType {
-		// 大于
-		case 1:
-			v.LeftValueShow = "大于" + v.LeftValueShow
-		// 小于
-		case 2:
-			v.LeftValueShow = "小于" + v.LeftValueShow
-		// 介于
-		case 3:
-			v.LeftValueShow = "介于" + v.LeftValueShow + "到" + v.RightValueShow
-		// 等于
-		case 4:
-			v.LeftValueShow = "等于" + v.LeftValueShow
-		}
-	}
-
 	resp.List = excelInfoList
 	return
 }

+ 5 - 5
services/excel/lucky_sheet_table.go

@@ -186,7 +186,7 @@ func checkCellRule(ruleInfo *excel.ExcelInfoRuleMappingView, value string, table
 	switch ruleInfo.RuleType {
 	// 大于
 	case 1:
-		conditionValue, ok := getCellValueByType(ruleInfo.LeftValue, ruleInfo.LeftValueType, tableDataList)
+		conditionValue, ok := getCellValueByType(ruleInfo.LeftValueBack, ruleInfo.LeftValueType, tableDataList)
 		if !ok {
 			return false
 		}
@@ -195,7 +195,7 @@ func checkCellRule(ruleInfo *excel.ExcelInfoRuleMappingView, value string, table
 		}
 	// 小于
 	case 2:
-		conditionValue, ok := getCellValueByType(ruleInfo.LeftValue, ruleInfo.LeftValueType, tableDataList)
+		conditionValue, ok := getCellValueByType(ruleInfo.LeftValueBack, ruleInfo.LeftValueType, tableDataList)
 		if !ok {
 			return false
 		}
@@ -204,11 +204,11 @@ func checkCellRule(ruleInfo *excel.ExcelInfoRuleMappingView, value string, table
 		}
 	// 介于
 	case 3:
-		leftcondValue, ok := getCellValueByType(ruleInfo.LeftValue, ruleInfo.LeftValueType, tableDataList)
+		leftcondValue, ok := getCellValueByType(ruleInfo.LeftValueBack, ruleInfo.LeftValueType, tableDataList)
 		if !ok {
 			return false
 		}
-		rightcondValue, ok := getCellValueByType(ruleInfo.RightValue, ruleInfo.RightValueType, tableDataList)
+		rightcondValue, ok := getCellValueByType(ruleInfo.RightValueBack, ruleInfo.RightValueType, tableDataList)
 		if !ok {
 			return false
 		}
@@ -217,7 +217,7 @@ func checkCellRule(ruleInfo *excel.ExcelInfoRuleMappingView, value string, table
 		}
 	// 等于
 	case 4:
-		conditionValue, ok := getCellValueByType(ruleInfo.LeftValue, ruleInfo.LeftValueType, tableDataList)
+		conditionValue, ok := getCellValueByType(ruleInfo.LeftValueBack, ruleInfo.LeftValueType, tableDataList)
 		if !ok {
 			return false
 		}