...
|
...
|
@@ -556,3 +556,83 @@ func (data ExportWorkshopAttendanceStaticsData) DataListLen() int { |
|
|
func (data ExportWorkshopAttendanceStaticsData) TableTitle() []string {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//ExportWorkshopProductiveData 导出员工产能数据
|
|
|
type ExportSecondLevelData struct {
|
|
|
SourceData []allied_creation_manufacture.SecondLevelRecordItem
|
|
|
SelectedField []string
|
|
|
}
|
|
|
|
|
|
var _ excel.ExcelMaker = (*ExportSecondLevelData)(nil)
|
|
|
|
|
|
func (data ExportSecondLevelData) AllFields() []DataFieldOptions {
|
|
|
return []DataFieldOptions{
|
|
|
{EnName: "workshopName", CnName: "车间名称"},
|
|
|
{EnName: "lineName", CnName: "线别"},
|
|
|
{EnName: "sectionName", CnName: "工段"},
|
|
|
{EnName: "workOn", CnName: "班别"},
|
|
|
{EnName: "userName", CnName: "姓名"},
|
|
|
{EnName: "employeeType", CnName: "员工类型"},
|
|
|
{EnName: "batchNumber", CnName: "批次号"},
|
|
|
{EnName: "planProductName", CnName: "生产品名"},
|
|
|
{EnName: "weightBefore", CnName: "二级品"},
|
|
|
{EnName: "createdAt", CnName: "提报时间"},
|
|
|
{EnName: "orgName", CnName: "组织机构"},
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (data ExportSecondLevelData) 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 ExportSecondLevelData) CellValue(index int, enName string) (value interface{}) {
|
|
|
if index > data.DataListLen() {
|
|
|
return ""
|
|
|
}
|
|
|
switch enName {
|
|
|
case "workshopName":
|
|
|
return data.SourceData[index].WorkshopName
|
|
|
case "lineName":
|
|
|
return data.SourceData[index].LineName
|
|
|
case "sectionName":
|
|
|
return data.SourceData[index].SectionName
|
|
|
case "userName":
|
|
|
return data.SourceData[index].ProductWorker.UserName
|
|
|
case "workOn":
|
|
|
return domain.WorkOnDescription(data.SourceData[index].WorkOn)
|
|
|
case "employeeType":
|
|
|
return domain.EmployeeTypeDescription(data.SourceData[index].ProductWorker.EmployeeType)
|
|
|
case "batchNumber":
|
|
|
return data.SourceData[index].BatchNumber
|
|
|
case "planProductName":
|
|
|
return data.SourceData[index].PlanProductName
|
|
|
case "weightBefore":
|
|
|
return fmt.Sprintf("%vKg", data.SourceData[index].WeightBefore)
|
|
|
case "createdAt":
|
|
|
return data.SourceData[index].CreatedAt
|
|
|
case "orgName":
|
|
|
return data.SourceData[index].OrgName
|
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func (data ExportSecondLevelData) DataListLen() int {
|
|
|
return len(data.SourceData)
|
|
|
}
|
|
|
|
|
|
func (data ExportSecondLevelData) TableTitle() []string {
|
|
|
return nil
|
|
|
} |
...
|
...
|
|