294 lines
15 KiB
Java
294 lines
15 KiB
Java
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.form.events.BeforeDoOperationEventArgs;
|
||
import kd.bos.form.operate.FormOperate;
|
||
import kd.bos.orm.query.QCP;
|
||
import kd.bos.orm.query.QFilter;
|
||
import kd.bos.orm.util.CollectionUtils;
|
||
import kd.bos.session.SessionManager;
|
||
import kd.repc.common.util.CacheMCData;
|
||
import kd.repc.common.util.CustomCacheUtil;
|
||
import kd.repc.resp.formplugin.portal.IndexEditNew;
|
||
import kd.repc.resp.formplugin.portal.PortalLableStyleChangeUtil;
|
||
import kd.repc.resp.formplugin.registered.RegisteredUtils;
|
||
|
||
import java.util.EventObject;
|
||
import java.util.HashMap;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
public class IndexEditNewPlugin extends IndexEditNew implements SearchEnterListener {
|
||
String[] lablekeys = new String[]{"qeug_label_notification"};
|
||
|
||
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 "qeug_label_notification":
|
||
(new PortalLableStyleChangeUtil()).addClickedLableStyle(view, "qeug_label_notification", ResManager.loadKDString("通知公告", "IndexEditNew_8", "repc-resp-formplugin", new Object[0]));
|
||
HashMap<String, String> cardInfo = new HashMap();
|
||
cardInfo.put("formId", "qeug_resp_notice_new");
|
||
cardInfo.put("container", "qeug_gc_notice_new");
|
||
cardInfo.put("cardId", "qeug_card_resp_notice_new");
|
||
this.loadCards(portalConfigId, cardInfo, (Map)null);
|
||
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<String, Object> 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);
|
||
}
|
||
|
||
@Override
|
||
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||
super.beforeDoOperation(args);
|
||
FormOperate operate = (FormOperate)args.getSource();
|
||
String key = operate.getOperateKey();
|
||
String[] switchKeys = new String[]{"home", "bidprojanno", "bidwinanno", "recruitanno", "contactus", "notification"};
|
||
List<String> switchKeyList = CollectionUtils.arrayToList(switchKeys);
|
||
String globalSessionId;
|
||
if (switchKeyList.contains(key)) {
|
||
this.setHeadflexpanelBackgroundImg(true);
|
||
globalSessionId = this.getPageCache().get("registeredid");
|
||
if (!StringUtils.isEmpty(globalSessionId)) {
|
||
this.getView().setVisible(Boolean.FALSE, new String[]{"btn_templogin", "link_login", "label_regist"});
|
||
this.getView().setVisible(Boolean.TRUE, new String[]{"label_logintip", "btn_exit"});
|
||
} else {
|
||
this.getView().setVisible(Boolean.TRUE, new String[]{"btn_templogin", "link_login", "label_regist"});
|
||
this.getView().setVisible(Boolean.FALSE, new String[]{"label_logintip", "btn_exit"});
|
||
}
|
||
|
||
this.getView().getModel().setValue("showcontrol", key);
|
||
} else if ("reg".equals(key)) {
|
||
this.setHeadflexpanelBackgroundImg(true);
|
||
this.getView().setVisible(false, new String[]{"flexpanelap"});
|
||
if (RegisteredUtils.isOldRegisterEnable()) {
|
||
this.openForm("resp_regpolicy", "resp_regpolicy", (Map)null);
|
||
} else {
|
||
this.openForm("resp_registered", "resp_registered", (Map)null);
|
||
}
|
||
} else if ("suplogin".equals(key)) {
|
||
this.getView().setVisible(false, new String[]{"flexpanelap"});
|
||
this.setHeadflexpanelBackgroundImg(true);
|
||
this.openForm("resp_suplogin", "resp_suplogin", (Map)null);
|
||
} else if ("exit".equals(key)) {
|
||
this.getPageCache().put("registeredid", (String)null);
|
||
globalSessionId = RequestContext.get().getGlobalSessionId();
|
||
CacheMCData.setAttribute(globalSessionId, "registeredid", "");
|
||
CacheMCData.setAttribute(globalSessionId, "label_logintip", "");
|
||
String mobilePhone = (String) CustomCacheUtil.getAttributes(globalSessionId);
|
||
if (StringUtils.isNotEmpty(mobilePhone)) {
|
||
String cacheKey = RequestContext.get().getAccountId() + "_" + mobilePhone;
|
||
String ipKey = cacheKey + "_ip";
|
||
String appKey = cacheKey + "_app";
|
||
String token = (String)CustomCacheUtil.getAttributes(cacheKey);
|
||
SessionManager.removeSession(token);
|
||
CustomCacheUtil.remove(ipKey);
|
||
CustomCacheUtil.remove(appKey);
|
||
}
|
||
|
||
this.getView().setVisible(Boolean.TRUE, new String[]{"flexpanelap"});
|
||
this.getView().setVisible(Boolean.FALSE, new String[]{"panel_reg"});
|
||
this.getView().getModel().setValue("showcontrol", "home");
|
||
this.getView().setVisible(Boolean.TRUE, new String[]{"btn_templogin", "link_login", "label_regist"});
|
||
this.getView().setVisible(Boolean.FALSE, new String[]{"label_logintip", "btn_exit"});
|
||
}
|
||
|
||
}
|
||
|
||
private void openForm(String formId, String callBackFormId, Map<String, Object> resultMap) {
|
||
this.getPageCache().put(openPanelRegFlag, "true");
|
||
Map<String, Object> map = new HashMap();
|
||
map.put("formId", formId);
|
||
FormShowParameter para = FormShowParameter.createFormShowParameter(map);
|
||
para.setCustomParam("companyname", this.getPageCache().get("companyname"));
|
||
if (resultMap != null) {
|
||
para.setCustomParam("INFO_REGSUP", resultMap);
|
||
}
|
||
|
||
OpenStyle openStyle = para.getOpenStyle();
|
||
this.getView().setVisible(true, new String[]{"panel_reg"});
|
||
openStyle.setTargetKey("panel_reg");
|
||
openStyle.setShowType(ShowType.InContainer);
|
||
CloseCallBack callBack = new CloseCallBack(this, callBackFormId);
|
||
para.setCloseCallBack(callBack);
|
||
this.getView().showForm(para);
|
||
}
|
||
|
||
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);
|
||
|
||
|
||
for(int i = 0; i < this.lablekeys.length; ++i) {
|
||
this.addClickListeners(new String[]{this.lablekeys[i]});
|
||
}
|
||
|
||
// Container qeug_label_notification = (Container)this.getView().getControl("qeug_label_notification");
|
||
// qeug_label_notification.addClickListener(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<String, Object> 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<String, Object> 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<String, Object> custom2 = new HashMap();
|
||
custom2.put("filterInfo", filter2);
|
||
this.loadCards(this.getPortalConfigId(), this.getCardInfo("bidprojannosmall"), custom2);
|
||
this.loadCards(this.getPortalConfigId(), this.getCardInfo("bidprojannolarge"), custom2);
|
||
|
||
}
|
||
}
|