|
@@ -650,6 +650,66 @@ func GetCustomAnalysisOpButton(sysUser *system.Admin, belongUserId int, permissi
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func AddExcelRule(leftValue, rightValue string, leftValueType, rightValueType, ruleType int, scope, fontColor, backGroundColor, remark string) (err error) {
|
|
|
+func AddExcelRule(leftValue, rightValue string, leftValueType, rightValueType, ruleType int, scope, fontColor, backgroundColor, remark, lang string) (err error) {
|
|
|
+ // 发生日期
|
|
|
+ tmpExcelRule := new(excel.ExcelInfoRuleMapping)
|
|
|
+ switch ruleType {
|
|
|
+ // 大于
|
|
|
+ case 1:
|
|
|
+ tmpExcelRule.LeftValueShow = "大于" + leftValue
|
|
|
+ // 小于
|
|
|
+ case 2:
|
|
|
+ tmpExcelRule.LeftValueShow = "小于" + leftValue
|
|
|
+ // 介于
|
|
|
+ case 3:
|
|
|
+ tmpExcelRule.LeftValueShow = "介于" + leftValue + "到" + rightValue
|
|
|
+ tmpExcelRule.RightValueShow = rightValue
|
|
|
+ // 等于
|
|
|
+ case 4:
|
|
|
+ tmpExcelRule.LeftValueShow = "等于" + leftValue
|
|
|
+ // 发生日期
|
|
|
+ case 5:
|
|
|
+ switch leftValue {
|
|
|
+ case "today":
|
|
|
+ tmpExcelRule.LeftValueShow = "今天"
|
|
|
+ // 明天
|
|
|
+ case "tomorrow":
|
|
|
+ tmpExcelRule.LeftValueShow = "明天"
|
|
|
+ // 最近7天
|
|
|
+ case "last7days":
|
|
|
+ tmpExcelRule.LeftValueShow = "最近7天"
|
|
|
+ // 上周
|
|
|
+ case "lastweek":
|
|
|
+ tmpExcelRule.LeftValueShow = "上周"
|
|
|
+ // 本周
|
|
|
+ case "thisweek":
|
|
|
+ tmpExcelRule.LeftValueShow = "本周"
|
|
|
+ // 下周
|
|
|
+ case "nextweek":
|
|
|
+ tmpExcelRule.LeftValueShow = "下周"
|
|
|
+ // 上月
|
|
|
+ case "lastmonth":
|
|
|
+ tmpExcelRule.LeftValueShow = "上月"
|
|
|
+ // 本月
|
|
|
+ case "thismonth":
|
|
|
+ tmpExcelRule.LeftValueShow = "本月"
|
|
|
+ // 下月
|
|
|
+ case "nextmonth":
|
|
|
+ tmpExcelRule.LeftValueShow = "下月"
|
|
|
+ default:
|
|
|
+ err = errors.New("发生日期规则错误")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ tmpExcelRule.LeftValueType = leftValueType
|
|
|
+ tmpExcelRule.FontColor = fontColor
|
|
|
+ tmpExcelRule.BackgroundColor = backgroundColor
|
|
|
+ tmpExcelRule.Remark = remark
|
|
|
+ tmpExcelRule.RemarkEn = remark
|
|
|
+ tmpExcelRule.ScopeShow = scope
|
|
|
+
|
|
|
+ tmpExcelRule.CreateTime = time.Now()
|
|
|
+ _, err = tmpExcelRule.Insert()
|
|
|
return
|
|
|
}
|