外网门户增加查询功能

This commit is contained in:
ptt 2025-06-18 13:42:10 +08:00
parent ebfe4aabfa
commit 5d329defea
2 changed files with 90 additions and 1 deletions

View File

@ -8,6 +8,11 @@ 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;
@ -16,7 +21,7 @@ import java.util.EventObject;
import java.util.HashMap;
import java.util.Map;
public class IndexEditNewPlugin extends IndexEditNew {
public class IndexEditNewPlugin extends IndexEditNew implements SearchEnterListener {
protected static final String companyLogoFlag = "companylogo";
protected static final String COMPANYLOGOFLEXPANEL = "companylogoflexpanel";
@ -48,13 +53,23 @@ public class IndexEditNewPlugin extends IndexEditNew {
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]));
@ -134,4 +149,46 @@ public class IndexEditNewPlugin extends IndexEditNew {
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<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);
}
}

View File

@ -0,0 +1,32 @@
package shkd.repc.resp.portal;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.form.IFormView;
import kd.bos.form.events.SetFilterEvent;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.list.BillList;
import kd.bos.orm.query.QFilter;
import kd.scm.bid.common.enums.BillStatusEnum;
import java.util.Date;
public class NewNoticeCardEditPlugin extends AbstractFormPlugin{
@Override
public void initialize() {
super.initialize();
((BillList)this.getControl("billlistap")).addSetFilterListener((setFilterEvent) -> {
this.setFilter(setFilterEvent);
});
}
public void setFilter(SetFilterEvent e) {
IFormView view = this.getView();
String filter = (String)view.getFormShowParameter().getCustomParam("filterInfo");
QFilter qfilter = new QFilter("billstatus", "=", "RELEASED");
if (!StringUtils.isEmpty(filter)) {
qfilter.and(QFilter.fromSerializedString(filter));
}
e.getQFilters().add(qfilter);
}
}