|
|
package service
|
|
|
|
|
|
import (
|
|
|
"github.com/linmadan/egglib-go/utils/excel"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/cost_structured"
|
|
|
)
|
|
|
|
|
|
//ExportDailyFillingAbnormalLog 导出每日 填报异常日志记录
|
|
|
type ExportDailyFillingAbnormalLog struct {
|
|
|
SourceData []cost_structured.DailyFillingAbnormalLogItem
|
|
|
SelectedField []string
|
|
|
}
|
|
|
|
|
|
var _ excel.ExcelMaker = (*ExportWorkshopAttendanceStaticsData)(nil)
|
|
|
|
|
|
func (data ExportDailyFillingAbnormalLog) AllFields() []DataFieldOptions {
|
|
|
return []DataFieldOptions{
|
|
|
{EnName: "abnormalTypeDescription", CnName: "异常类型"},
|
|
|
{EnName: "projectTypeDescription", CnName: "项目分类"},
|
|
|
{EnName: "projectName", CnName: "项目名称"},
|
|
|
{EnName: "itemName", CnName: "细项名称"},
|
|
|
{EnName: "userName", CnName: "负责人"},
|
|
|
{EnName: "actualValue", CnName: "现状值"},
|
|
|
{EnName: "targetValue", CnName: "目标值"},
|
|
|
{EnName: "remark", CnName: "填报说明"},
|
|
|
{EnName: "createdAt", CnName: "异常日期"},
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (data ExportDailyFillingAbnormalLog) DataFieldList() []excel.DataField {
|
|
|
fields := []excel.DataField{}
|
|
|
allFields := data.AllFields()
|
|
|
for _, value2 := range allFields {
|
|
|
if len(data.SelectedField) == 0 || value2.IsDefault {
|
|
|
fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName})
|
|
|
continue
|
|
|
}
|
|
|
for _, value3 := range data.SelectedField {
|
|
|
if value2.EnName == value3 {
|
|
|
fields = append(fields, excel.DataField{EnName: value2.EnName, CnName: value2.CnName})
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return fields
|
|
|
}
|
|
|
|
|
|
func (data ExportDailyFillingAbnormalLog) CellValue(index int, enName string) (value interface{}) {
|
|
|
if index > data.DataListLen() {
|
|
|
return ""
|
|
|
}
|
|
|
switch enName {
|
|
|
case "abnormalTypeDescription":
|
|
|
return data.SourceData[index].AbnormalTypeDescription
|
|
|
case "projectTypeDescription":
|
|
|
return data.SourceData[index].ProjectTypeDescription
|
|
|
case "projectName":
|
|
|
return data.SourceData[index].ProjectName
|
|
|
case "itemName":
|
|
|
return data.SourceData[index].ItemName
|
|
|
case "userName":
|
|
|
return data.SourceData[index].UserName
|
|
|
case "actualValue":
|
|
|
return data.SourceData[index].ActualValue
|
|
|
case "targetValue":
|
|
|
return data.SourceData[index].TargetValue
|
|
|
case "remark":
|
|
|
return data.SourceData[index].Remark
|
|
|
case "createdAt":
|
|
|
return data.SourceData[index].CreatedAt
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func (data ExportDailyFillingAbnormalLog) DataListLen() int {
|
|
|
return len(data.SourceData)
|
|
|
}
|
|
|
|
|
|
func (data ExportDailyFillingAbnormalLog) TableTitle() []string {
|
|
|
return nil
|
|
|
} |
...
|
...
|
|