// 导出 public void onClick$exportExcel() { if (qklwListbox.getSelectedCount() == 0) { try { Messagebox.show("请选择要导出的数据", "提示", Messagebox.OK, Messagebox.EXCLAMATION); } catch (InterruptedException e) { e.printStackTrace(); } return; } else { int i = 0; ArrayList<JXKH_QKLW> expertlist = new ArrayList<JXKH_QKLW>(); @SuppressWarnings("unchecked") Set<Listitem> sel = qklwListbox.getSelectedItems(); Iterator<Listitem> it = sel.iterator(); while (it.hasNext()) { Listitem item = (Listitem) it.next(); JXKH_QKLW p = (JXKH_QKLW) item.getValue(); expertlist.add(i, p); i++; } Date now = new Date(); String fileName = ConvertUtil.convertDateString(now) + "QiKanLunWenXinXi" + ".xls"; String Title = "期刊论文"; List<String> titlelist = new ArrayList<String>(); titlelist.add("序号"); titlelist.add("期刊论文名称"); titlelist.add("全部作者"); titlelist.add("院内部门"); titlelist.add("合作单位"); titlelist.add("期刊级别"); // titlelist.add("收录类别"); titlelist.add("论文级别"); // titlelist.add("收录时间"); titlelist.add("发表时间"); titlelist.add("发表刊物名称"); titlelist.add("发表刊物期次"); titlelist.add("起止页"); titlelist.add("通讯作者"); titlelist.add("信息填写人"); String c[][] = new String[expertlist.size()][titlelist.size()]; // 从SQL中读数据 for (int j = 0; j < expertlist.size(); j++) { JXKH_QKLW meeting = (JXKH_QKLW) expertlist.get(j); c[j][0] = j + 1 + ""; c[j][1] = meeting.getLwName(); // 全部作者 String memberName = ""; List<JXKH_QKLWMember> qklwMemberList = jxkhQklwService.findAwardMemberByAwardId(meeting); for (int t = 0; t < qklwMemberList.size(); t++) { JXKH_QKLWMember mem = (JXKH_QKLWMember) qklwMemberList.get(t); memberName += mem.getName() + "、"; } if (memberName != "" && memberName != null) memberName = memberName.substring(0, memberName.length() - 1); c[j][2] = memberName; // 部门 String d = ""; List<JXKH_QKLWDept> meetDeptList = jxkhQklwService.findMeetingDeptByMeetingId(meeting); for (int k = 0; k < meetDeptList.size(); k++) { JXKH_QKLWDept dept = (JXKH_QKLWDept) meetDeptList.get(k); d += dept.getName() + "、"; } if (d != "" && d != null) d = d.substring(0, d.length() - 1); c[j][3] = d; c[j][4] = meeting.getLwCoDep(); if (meeting.getQkGrade() == null) { c[j][5] = ""; } else { c[j][5] = meeting.getQkGrade().getKbName(); } // if (meeting.getLwType() == null) { // c[j][6] = ""; // } else { // c[j][6] = meeting.getLwType().getKbName(); // } c[j][6] = meeting.getLwRank(); // c[j][8] = meeting.getLwTime(); c[j][7] = meeting.getLwDate(); c[j][8] = meeting.getKwName(); c[j][9] = meeting.getLwQC(); c[j][10] = meeting.getLwPages(); c[j][11] = meeting.getLwAuthor(); c[j][12] = meeting.getLwWriter(); } ExportExcel ee = new ExportExcel(); try { ee.exportExcel(fileName, Title, titlelist, expertlist.size(), c); } catch (WriteException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
@Override public void render(Listitem item, Object data) throws Exception { if (data == null) return; final JXKH_QKLW meeting = (JXKH_QKLW) data; item.setValue(meeting); Listcell c0 = new Listcell(); Listcell c1 = new Listcell(item.getIndex() + 1 + ""); Listcell c2 = new Listcell( meeting.getLwName().length() <= 14 ? meeting.getLwName() : meeting.getLwName().substring(0, 14) + "..."); c2.setTooltiptext(meeting.getLwName()); c2.setStyle("color:blue"); c2.addEventListener( Events.ON_CLICK, new EventListener() { public void onEvent(Event event) throws Exception { Listitem item = (Listitem) event.getTarget().getParent(); JXKH_QKLW meeting = (JXKH_QKLW) item.getValue(); AddJournalWindow w = (AddJournalWindow) Executions.createComponents( "/admin/personal/deptbusinessdata/artical/journal/addJournal.zul", null, null); try { w.setMeeting(meeting); w.setAudit("AUDIT"); w.initWindow(); w.doModal(); } catch (SuspendNotAllowedException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } if (isQuery) { onClick$query(); } else { initWindow(); } } }); // 期刊类别 Listcell c3 = new Listcell(); if (meeting.getQkGrade() == null) c3.setLabel(""); else c3.setLabel(meeting.getQkGrade().getKbName()); // 积分年度 Listcell c4 = new Listcell(meeting.getjxYear()); // 该项得分 Listcell c5 = new Listcell(meeting.getScore() == null ? "" : meeting.getScore().toString()); // 填写人 Listcell c6 = new Listcell(); c6.setLabel(meeting.getLwWriter()); // 审核状态 Listcell c7 = new Listcell(); c7.setTooltiptext("点击填写审核意见"); if (meeting.getLwState() == null) { c7.setLabel("待审核"); c7.setStyle("color:red"); } else { switch (meeting.getLwState()) { case 0: c7.setLabel("待审核"); c7.setStyle("color:red"); break; case 1: c7.setLabel("部门通过"); c7.setStyle("color:red"); break; case 2: c7.setLabel("部门审核中"); c7.setStyle("color:red"); break; case 3: c7.setLabel("部门不通过"); c7.setStyle("color:red"); break; case 4: c7.setLabel("业务办通过"); c7.setStyle("color:red"); break; case 5: c7.setLabel("业务办不通过"); c7.setStyle("color:red"); break; case 6: c7.setLabel("归档"); c7.setStyle("color:red"); break; case 7: c7.setLabel("业务办暂缓通过"); c7.setStyle("color:red"); break; } } // 弹出审核意见事件 c7.addEventListener( Events.ON_CLICK, new EventListener() { public void onEvent(Event event) throws Exception { AdviceWindow w = (AdviceWindow) Executions.createComponents( "/admin/jxkh/audit/article/journal/advice.zul", null, null); try { w.setMeeting(meeting); w.initWindow(); w.doModal(); } catch (SuspendNotAllowedException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } initWindow(); } }); item.appendChild(c0); item.appendChild(c1); item.appendChild(c2); item.appendChild(c3); item.appendChild(c4); item.appendChild(c5); item.appendChild(c6); item.appendChild(c7); }