|
@@ -317,6 +317,50 @@ func (this *ReportApproveController) List() {
|
|
|
ormList = list
|
|
|
}
|
|
|
|
|
|
+ // 审批通过的报告显示下载按钮
|
|
|
+ reportImg := make(map[string]string)
|
|
|
+ reportPdf := make(map[string]string)
|
|
|
+ {
|
|
|
+ var reportIds, enReportIds []int
|
|
|
+ for _, v := range ormList {
|
|
|
+ if v.State != report_approve.ReportApproveStatePass {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if v.ReportType == report_approve.FlowReportTypeChinese {
|
|
|
+ reportIds = append(reportIds, v.ReportId)
|
|
|
+ }
|
|
|
+ if v.ReportType == report_approve.FlowReportTypeEnglish {
|
|
|
+ enReportIds = append(enReportIds, v.ReportId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(reportIds) > 0 {
|
|
|
+ reports, e := models.GetReportFieldsByIds(reportIds, []string{"id", "detail_img_url", "detail_pdf_url"})
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = fmt.Sprintf("GetReportFieldsByIds, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, r := range reports {
|
|
|
+ k := fmt.Sprintf("%d-%d", report_approve.FlowReportTypeChinese, r.Id)
|
|
|
+ reportImg[k] = r.DetailImgUrl
|
|
|
+ reportPdf[k] = r.DetailPdfUrl
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(enReportIds) > 0 {
|
|
|
+ enReports, e := models.GetEnglishReportFieldsByIds(enReportIds, []string{"id", "detail_img_url", "detail_pdf_url"})
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = fmt.Sprintf("GetEnglishReportFieldsByIds, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, r := range enReports {
|
|
|
+ k := fmt.Sprintf("%d-%d", report_approve.FlowReportTypeEnglish, r.Id)
|
|
|
+ reportImg[k] = r.DetailImgUrl
|
|
|
+ reportPdf[k] = r.DetailPdfUrl
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 格式化列表
|
|
|
for _, v := range ormList {
|
|
|
t := report_approve.FormatReportApproveOrm2Item(v)
|
|
@@ -334,6 +378,10 @@ func (this *ReportApproveController) List() {
|
|
|
t.ReportClassify = reportClassify
|
|
|
}
|
|
|
|
|
|
+ k := fmt.Sprintf("%d-%d", t.ReportType, t.ReportId)
|
|
|
+ t.DetailImgUrl = reportImg[k]
|
|
|
+ t.DetailPdfUrl = reportPdf[k]
|
|
|
+
|
|
|
respList = append(respList, t)
|
|
|
}
|
|
|
|