|
|
@@ -0,0 +1,53 @@
|
|
|
+package nckd.jxccl.opmc.pm.plugin.form;
|
|
|
+
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
+import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
|
+import kd.bos.form.control.Control;
|
|
|
+import kd.bos.form.field.BasedataEdit;
|
|
|
+import kd.bos.form.field.events.BeforeF7SelectEvent;
|
|
|
+import kd.bos.form.field.events.BeforeF7SelectListener;
|
|
|
+import kd.bos.form.plugin.AbstractFormPlugin;
|
|
|
+import kd.bos.orm.query.QCP;
|
|
|
+import kd.bos.orm.query.QFilter;
|
|
|
+import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+
|
|
|
+import java.util.EventObject;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @ClassName: KpiTutorHeadFormPlugin
|
|
|
+ * @Description: 绩效辅导负责人表单插件
|
|
|
+ * @Author: PJJ
|
|
|
+ * @Date: 2026/1/14 上午10:59
|
|
|
+ * @Version: 1.0
|
|
|
+ */
|
|
|
+public class KpiTutorHeadFormPlugin extends AbstractFormPlugin implements BeforeF7SelectListener {
|
|
|
+ @Override
|
|
|
+ public void registerListener(EventObject e) {
|
|
|
+ super.registerListener(e);
|
|
|
+ BasedataEdit user = this.getView().getControl("nckd_user");
|
|
|
+ user.addBeforeF7SelectListener(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void beforeF7Select(BeforeF7SelectEvent e) {
|
|
|
+ String name = e.getProperty().getName();
|
|
|
+ if (StringUtils.equals(name, "nckd_user")) {
|
|
|
+ Object org = this.getModel().getValue("nckd_org");
|
|
|
+ if (ObjectUtils.isEmpty(org)) {
|
|
|
+ e.setCancel(true);
|
|
|
+ this.getView().showTipNotification("请先选择绩效组织!");
|
|
|
+ } else {
|
|
|
+ QFilter qFilter = new QFilter("entryentity.ispartjob", QCP.equals, false);
|
|
|
+ qFilter.and("status", QCP.equals, "C");
|
|
|
+ qFilter.and("enable", QCP.equals, "1");
|
|
|
+ DynamicObjectCollection query = QueryServiceHelper.query("bos_user", "id,number,name", qFilter.toArray());
|
|
|
+ List<Long> userIds = query.stream().map(i -> i.getLong("id")).collect(Collectors.toList());
|
|
|
+ e.getCustomQFilters().add(new QFilter("id",QCP.in,userIds));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|