package shkd.repc.resp.portal; import kd.bos.bill.OperationStatus; import kd.bos.context.RequestContext; import kd.bos.dataentity.resource.ResManager; import kd.bos.dataentity.utils.StringUtils; import kd.bos.form.*; import kd.bos.form.container.Container; import kd.bos.form.control.Control; import kd.bos.form.control.Label; import kd.bos.form.control.Search; import kd.bos.form.control.events.SearchEnterEvent; import kd.bos.form.control.events.SearchEnterListener; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.repc.common.util.CacheMCData; import kd.repc.resp.formplugin.portal.IndexEditNew; import kd.repc.resp.formplugin.portal.PortalLableStyleChangeUtil; import java.util.EventObject; import java.util.HashMap; import java.util.Map; public class IndexEditNewPlugin extends IndexEditNew implements SearchEnterListener { protected static final String companyLogoFlag = "companylogo"; protected static final String COMPANYLOGOFLEXPANEL = "companylogoflexpanel"; static String openPanelRegFlag = "openPanelRegFlag"; @Override public void beforeBindData(EventObject e) { super.beforeBindData(e); ((Label)this.getView().getControl("label_bidproj")).setText( ResManager.loadKDString("询比价公告", "IndexEditNew_3", "repc-resp-formplugin", new Object[0])); } @Override public void click(EventObject eventobject) { Control source = (Control)eventobject.getSource(); String portalConfigId = this.getPortalConfigId(); String key = source.getKey(); if (!"reg".equals(key)) { String isOpenPanelReg = this.getPageCache().get(openPanelRegFlag); if ("true".equalsIgnoreCase(isOpenPanelReg)) { this.getView().setVisible(false, new String[]{"panel_reg"}); this.getView().setVisible(true, new String[]{"flexpanelap"}); this.getPageCache().put(openPanelRegFlag, "false"); } } IFormView view = this.getView(); this.setHeadflexpanelBackgroundImg(false); switch (key) { case "label_home": (new PortalLableStyleChangeUtil()).addClickedLableStyle(view, "label_home", ResManager.loadKDString("首页", "IndexEditNew_2", "repc-resp-formplugin", new Object[0])); this.getView().invokeOperation("refresh"); Search search = this.getView().getControl("qeug_searchap"); search.setSearchKey(""); this.getView().updateView("qeug_searchap"); break; case "label_bidproj": (new PortalLableStyleChangeUtil()).addClickedLableStyle(view, "label_bidproj", ResManager.loadKDString("询比价公告", "IndexEditNew_3", "repc-resp-formplugin", new Object[0])); this.loadCards(portalConfigId, this.getCardInfo("bidprojannolarge"), (Map)null); Search search1 = this.getView().getControl("qeug_searchap"); search1.setSearchKey(""); this.getView().updateView("qeug_searchap"); break; case "label_recruit": (new PortalLableStyleChangeUtil()).addClickedLableStyle(view, "label_recruit", ResManager.loadKDString("招募公告", "IndexEditNew_4", "repc-resp-formplugin", new Object[0])); this.loadCards(portalConfigId, this.getCardInfo("recruitannolarge"), (Map)null); Search search2 = this.getView().getControl("qeug_searchap"); search2.setSearchKey(""); this.getView().updateView("qeug_searchap"); break; case "label_bidwon": (new PortalLableStyleChangeUtil()).addClickedLableStyle(view, "label_bidwon", ResManager.loadKDString("中标公告", "IndexEditNew_5", "repc-resp-formplugin", new Object[0])); this.loadCards(portalConfigId, this.getCardInfo("bidwinannolarge"), (Map)null); break; case "label_helpcenter": (new PortalLableStyleChangeUtil()).addClickedLableStyle(view, "label_helpcenter", ResManager.loadKDString("帮助中心", "IndexEditNew_6", "repc-resp-formplugin", new Object[0])); this.loadCards(portalConfigId, this.getCardInfo("bidwinannolarge"), (Map)null); break; case "label_logintip": String globalSessionId = RequestContext.get().getGlobalSessionId(); String registeredId = CacheMCData.getAttribute(globalSessionId, "registeredid"); if (StringUtils.isEmpty(registeredId)) { this.showLoginRegTipForm(ResManager.loadKDString("会话超时请重新登录。", "IndexEditNew_7", "repc-resp-formplugin", new Object[0])); } this.getView().setVisible(false, new String[]{"flexpanelap"}); Map map = new HashMap(); this.getView().setVisible(Boolean.FALSE, new String[]{"btn_templogin", "link_login", "label_regist"}); this.getView().setVisible(Boolean.TRUE, new String[]{"label_logintip", "btn_exit"}); map.put("formId", "resp_portalregister"); FormShowParameter formShowPara = FormShowParameter.createFormShowParameter(map); formShowPara.setCustomParam("registeredid", this.getPageCache().get("registeredid")); this.openForm("resp_portalregister", formShowPara); break; case "morecompanyflex": this.filterPanelMoreOrLittleData("morecompanyflex", "orgs", "companymoreorlittile"); break; case "morepurtypeflex": this.filterPanelMoreOrLittleData("morepurtypeflex", "purtypes", "purtypemoreorlittile"); break; case "moresuppliertypeflex": this.filterPanelMoreOrLittleData("moresuppliertypeflex", "supplierypes", "suppliertypemoreorlittile"); break; case "companyflexpanelap": this.filterBidProjAnnoSmallData(); this.filterRecruitAnnoSmallData(); break; case "purtypeflexpanelap": this.filterBidWinAnnoSmallData(); break; case "suppliertypeflexpanelap": this.filterRecruitAnnoSmallData(); } } @Override public void setHeadflexpanelBackgroundImg(boolean flag) { Container flexPanel = (Container)this.getView().getControl("flexpanelap1"); if (flag) { // flexPanel.setBackgroundImg("/images/pc/other/AI_bg_108_110.png"); } else { flexPanel.setBackgroundImg((String)null); } } private void openForm(String formId, FormShowParameter formShowPara) { this.getPageCache().put(openPanelRegFlag, "true"); OpenStyle openStyle = formShowPara.getOpenStyle(); this.getView().setVisible(true, new String[]{"panel_reg"}); openStyle.setTargetKey("panel_reg"); openStyle.setShowType(ShowType.InContainer); CloseCallBack callBack = new CloseCallBack(this, formId); formShowPara.setCloseCallBack(callBack); formShowPara.setCustomParam("companyname", this.getPageCache().get("companyname")); this.getView().showForm(formShowPara); } private void showLoginRegTipForm(String regTip) { FormShowParameter showParameter = new FormShowParameter(); showParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage); showParameter.setStatus(OperationStatus.VIEW); showParameter.setFormId("login_regtip"); showParameter.setCustomParam("regtip", regTip); CloseCallBack back = new CloseCallBack(this, "login_expire_tip"); showParameter.setCloseCallBack(back); this.getView().showForm(showParameter); } @Override public void registerListener(EventObject e) { super.registerListener(e); Search search = this.getView().getControl("qeug_searchap"); //插件类实现SearchEnterListener接口,才能注册 search.addEnterListener(this); } @Override public void search(SearchEnterEvent evt) { Search search = (Search)evt.getSource(); //搜索控件标识,可以根据该标识,判断是哪个控件,然后做逻辑处理 String key = search.getKey(); //搜索的文本内容 String text = evt.getText(); // 招募公告 QFilter filterInfo = new QFilter("annorecruittitle", QCP.like,"%"+ text +"%"); String filter = filterInfo == null ? null : filterInfo.toSerializedString(); Map custom = new HashMap(); custom.put("filterInfo", filter); this.loadCards(this.getPortalConfigId(), this.getCardInfo("recruitannosmall"), custom); this.loadCards(this.getPortalConfigId(), this.getCardInfo("recruitannolarge"), custom); //通知公告 QFilter filterInfo1 = new QFilter("notification_title", QCP.like,"%"+ text +"%"); String filter1 = filterInfo1 == null ? null : filterInfo1.toSerializedString(); Map custom1 = new HashMap(); custom1.put("filterInfo", filter1); this.loadCards(this.getPortalConfigId(), this.getCardInfo("notice"), custom1); //招标公告 QFilter filterInfo2 = new QFilter("annotitle", QCP.like,"%"+ text +"%"); String filter2 = filterInfo2 == null ? null : filterInfo2.toSerializedString(); Map custom2 = new HashMap(); custom2.put("filterInfo", filter2); this.loadCards(this.getPortalConfigId(), this.getCardInfo("bidprojannosmall"), custom2); this.loadCards(this.getPortalConfigId(), this.getCardInfo("bidprojannolarge"), custom2); } }