Bläddra i källkod

Merge remote-tracking branch 'origin/master'

jtd 2 dagar sedan
förälder
incheckning
f84e7acdeb

+ 319 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/tsc/plugin/mob/common/FormModel.java

@@ -0,0 +1,319 @@
+package nckd.jxccl.hr.tsc.plugin.mob.common;
+import java.io.Serializable;
+import java.util.Map;
+import kd.bos.base.BaseShowParameter;
+import kd.bos.base.MobileBaseShowParameter;
+import kd.bos.bill.BillShowParameter;
+import kd.bos.bill.MobileBillShowParameter;
+import kd.bos.form.FormShowParameter;
+import kd.bos.form.MobileFormShowParameter;
+import kd.bos.form.ShowType;
+import kd.bos.form.StyleCss;
+import kd.bos.list.ListFilterParameter;
+import kd.bos.list.ListShowParameter;
+import kd.bos.list.MobileListShowParameter;
+import kd.bos.report.ReportShowParameter;
+import kd.bos.script.annotations.KSMethod;
+import kd.bos.script.annotations.KSObject;
+import kd.sdk.annotation.SdkDeprecated;
+
+@KSObject
+public class FormModel implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private String formId;
+    private String formName;
+    private String formType;
+    private Boolean callBack;
+    private Map<String, Object> customParam;
+    private ShowType showType;
+    private String templateId;
+    private Boolean lookup;
+    private FormShowParameter formShowParameter;
+    private String targetKey;
+    private ListFilterParameter listFilterParameter;
+    private Boolean closeCurrentPage;
+    private int width;
+    private int height;
+    private boolean showTitle;
+
+    public FormModel(String formId) {
+        this.width = Integer.MIN_VALUE;
+        this.height = Integer.MIN_VALUE;
+        this.showTitle = true;
+        this.formId = formId;
+        this.callBack = false;
+        this.formType = "14";
+    }
+
+    @SdkDeprecated
+    public FormModel(String formId, String formName, String formType) {
+        this(formId, formName, formType, false);
+    }
+
+    @SdkDeprecated
+    public FormModel(String formId, String formName, String formType, boolean callBack) {
+        this(formId, formName, formType, callBack, (Map)null);
+    }
+
+    @SdkDeprecated
+    public FormModel(String formId, String formName, String formType, boolean callBack, Map<String, Object> customParam) {
+        this.width = Integer.MIN_VALUE;
+        this.height = Integer.MIN_VALUE;
+        this.showTitle = true;
+        this.formId = formId;
+        this.formName = formName;
+        this.formType = formType;
+        this.callBack = callBack;
+        this.customParam = customParam;
+    }
+
+    @KSMethod
+    @SdkDeprecated
+    public String getFormId() {
+        return this.formId;
+    }
+
+    public void setFormId(String formId) {
+        this.formId = formId;
+    }
+
+    public String getFormName() {
+        return this.formName;
+    }
+
+    public void setFormName(String formName) {
+        this.formName = formName;
+    }
+
+    public String getFormType() {
+        return this.formType;
+    }
+
+    public void setFormType(String formType) {
+        this.formType = formType;
+    }
+
+    @KSMethod
+    @SdkDeprecated
+    public Boolean getCallBack() {
+        return this.callBack == null ? Boolean.FALSE : this.callBack;
+    }
+
+    @SdkDeprecated
+    public void setCallBack(Boolean callBack) {
+        this.callBack = callBack;
+    }
+
+    @SdkDeprecated
+    public Map<String, Object> getCustomParam() {
+        return this.customParam;
+    }
+
+    @SdkDeprecated
+    public void setCustomParam(Map<String, Object> customParam) {
+        this.customParam = customParam;
+    }
+
+    public ShowType getShowType() {
+        if (this.showType == null) {
+            switch (this.formType) {
+                case "7":
+                case "2":
+                case "1":
+                case "0":
+                case "3":
+                case "9":
+                    this.showType = ShowType.MainNewTabPage;
+                    break;
+                case "14":
+                case "15":
+                    this.showType = ShowType.Modal;
+                    break;
+                case "8":
+                case "10":
+                case "6":
+                case "4":
+                case "5":
+                    this.showType = ShowType.Floating;
+                    break;
+                case "11":
+                case "12":
+                    this.showType = ShowType.NewWindow;
+            }
+        }
+
+        return this.showType;
+    }
+
+    @SdkDeprecated
+    public void setShowType(ShowType showType) {
+        this.showType = showType;
+    }
+
+    public String getTemplateId() {
+        if (this.templateId == null) {
+            switch (this.formType) {
+                case "0":
+                    this.templateId = "bos_list";
+                    break;
+                case "9":
+                    this.templateId = "bos_treelist";
+                    break;
+                case "10":
+                    this.templateId = "er_basetemplate";
+                    break;
+                case "4":
+                case "12":
+                    this.templateId = "er_billtemplate";
+            }
+        }
+
+        return this.templateId;
+    }
+
+    public void setTemplateId(String templateId) {
+        this.templateId = templateId;
+    }
+
+    public Boolean getLookup() {
+        return this.lookup == null ? Boolean.FALSE : this.lookup;
+    }
+
+    public void setLookup(Boolean lookup) {
+        this.lookup = lookup;
+    }
+
+    @KSMethod
+    @SdkDeprecated
+    public FormShowParameter getFormShowParameter() {
+        switch (this.formType) {
+            case "0":
+            case "9":
+                this.formShowParameter = new ListShowParameter();
+                break;
+            case "1":
+            case "14":
+                this.formShowParameter = new FormShowParameter();
+                break;
+            case "2":
+                this.formShowParameter = new BillShowParameter();
+                break;
+            case "3":
+                this.formShowParameter = new ReportShowParameter();
+                break;
+            case "7":
+                this.formShowParameter = new BaseShowParameter();
+                break;
+            case "5":
+            case "11":
+                this.formShowParameter = new MobileFormShowParameter();
+                break;
+            case "6":
+                this.formShowParameter = new MobileBillShowParameter();
+                break;
+            case "4":
+            case "10":
+            case "12":
+                this.formShowParameter = new MobileListShowParameter();
+                break;
+            case "8":
+                this.formShowParameter = new MobileBaseShowParameter();
+                break;
+            case "13":
+            case "15":
+                this.formShowParameter = new MobileFormShowParameter();
+        }
+
+        if (this.formShowParameter instanceof ListShowParameter) {
+            ListShowParameter listShowParameter = (ListShowParameter)this.formShowParameter;
+            listShowParameter.setBillFormId(this.getFormId());
+            listShowParameter.setFormId(this.getTemplateId());
+            listShowParameter.setLookUp(this.getLookup());
+            listShowParameter.setListFilterParameter(this.getListFilterParameter());
+        } else {
+            this.formShowParameter.setFormId(this.getFormId());
+        }
+
+        this.formShowParameter.getOpenStyle().setShowType(this.getShowType());
+        this.formShowParameter.getOpenStyle().setTargetKey(this.getTargetKey());
+        this.formShowParameter.setCaption(this.getFormName());
+        if (this.getCustomParam() != null) {
+            this.formShowParameter.getCustomParams().putAll(this.getCustomParam());
+        }
+
+        this.formShowParameter.getOpenStyle().setShowType(this.getShowType());
+        if (this.width > Integer.MIN_VALUE && this.height > Integer.MIN_VALUE) {
+            StyleCss inlineStyleCss = new StyleCss();
+            inlineStyleCss.setWidth(String.valueOf(this.width));
+            inlineStyleCss.setHeight(String.valueOf(this.height));
+            this.formShowParameter.getOpenStyle().setInlineStyleCss(inlineStyleCss);
+        }
+
+        this.formShowParameter.setShowTitle(this.showTitle);
+        return this.formShowParameter;
+    }
+
+    public String getTargetKey() {
+        if (this.targetKey == null) {
+            switch (this.formType) {
+                case "7":
+                case "2":
+                case "1":
+                case "0":
+                case "3":
+                case "9":
+                    this.targetKey = "_submaintab_";
+            }
+        }
+
+        return this.targetKey;
+    }
+
+    @SdkDeprecated
+    public void setTargetKey(String targetKey) {
+        this.targetKey = targetKey;
+    }
+
+    public ListFilterParameter getListFilterParameter() {
+        return this.listFilterParameter;
+    }
+
+    public void setListFilterParameter(ListFilterParameter listFilterParameter) {
+        this.listFilterParameter = listFilterParameter;
+    }
+
+    public Boolean getCloseCurrentPage() {
+        return this.closeCurrentPage == null ? Boolean.FALSE : this.closeCurrentPage;
+    }
+
+    public void setCloseCurrentPage(Boolean closeCurrentPage) {
+        this.closeCurrentPage = closeCurrentPage;
+    }
+
+    public int getWidth() {
+        return this.width;
+    }
+
+    @SdkDeprecated
+    public void setWidth(int width) {
+        this.width = width;
+    }
+
+    public int getHeight() {
+        return this.height;
+    }
+
+    @SdkDeprecated
+    public void setHeight(int height) {
+        this.height = height;
+    }
+
+    public boolean isShowTitle() {
+        return this.showTitle;
+    }
+
+    @SdkDeprecated
+    public void setShowTitle(boolean showTitle) {
+        this.showTitle = showTitle;
+    }
+}

+ 77 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/tsc/plugin/mob/common/MainPageModel.java

@@ -0,0 +1,77 @@
+package nckd.jxccl.hr.tsc.plugin.mob.common;
+
+import java.util.HashMap;
+import java.util.Map;
+import kd.sdk.annotation.SdkDeprecated;
+
+public class MainPageModel {
+    private String formId;
+    private String formName;
+    private String formType;
+    private Boolean callBack;
+    private Map<String, Object> customParam;
+
+    @SdkDeprecated
+    public String getFormId() {
+        return this.formId;
+    }
+
+    public void setFormId(String formId) {
+        this.formId = formId;
+    }
+
+    @SdkDeprecated
+    public String getFormName() {
+        return this.formName;
+    }
+
+    public void setFormName(String formName) {
+        this.formName = formName;
+    }
+
+    @SdkDeprecated
+    public String getFormType() {
+        return this.formType;
+    }
+
+    public void setFormType(String formType) {
+        this.formType = formType;
+    }
+
+    @SdkDeprecated
+    public Boolean getCallBack() {
+        return this.callBack;
+    }
+
+    public void setCallBack(Boolean callBack) {
+        this.callBack = callBack;
+    }
+
+    @SdkDeprecated
+    public Map<String, Object> getCustomParam() {
+        return this.customParam;
+    }
+
+    public void setCustomParam(Map<String, Object> customParam) {
+        this.customParam = customParam;
+    }
+
+    @SdkDeprecated
+    public MainPageModel(String formId, String formName, String formType, boolean callBack, Map<String, Object> customParam) {
+        this.formId = formId;
+        this.formName = formName;
+        this.formType = formType;
+        this.callBack = callBack;
+        this.customParam = customParam;
+    }
+
+    @SdkDeprecated
+    public MainPageModel(String formId, String formName, String formType) {
+        this(formId, formName, formType, false);
+    }
+
+    @SdkDeprecated
+    public MainPageModel(String formId, String formName, String formType, boolean callBack) {
+        this(formId, formName, formType, callBack, new HashMap());
+    }
+}

+ 114 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/tsc/plugin/mob/common/TscNaviBarPlugin.java

@@ -0,0 +1,114 @@
+package nckd.jxccl.hr.tsc.plugin.mob.common;
+
+import kd.bos.bill.AbstractMobBillPlugIn;
+import kd.bos.dataentity.resource.ResManager;
+import kd.bos.form.CloseCallBack;
+import kd.bos.form.FormShowParameter;
+import kd.bos.form.ShowType;
+import kd.bos.form.control.Control;
+import kd.bos.form.control.events.ClickListener;
+import kd.bos.form.control.events.ItemClickEvent;
+import kd.bos.form.control.events.RowClickEventListener;
+import kd.bos.form.plugin.AbstractFormPlugin;
+import kd.bos.list.ListShowParameter;
+import kd.bos.list.MobileListShowParameter;
+import org.apache.commons.lang.StringUtils;
+
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 应聘自助移动端底部工具栏通用插件
+ * @author Tyx
+ * 时间 2026/1/16 14:12
+ */
+public class TscNaviBarPlugin extends AbstractMobBillPlugIn implements ClickListener, RowClickEventListener {
+
+    protected static final Map<String, MainPageModel> controlMap = new HashMap();
+
+    public TscNaviBarPlugin() {
+
+    }
+
+    @Override
+    public void registerListener(EventObject e) {
+        super.registerListener(e);
+        this.addItemClickListeners("mtoolbarap");
+        Set<String> controlIdSet = controlMap.keySet();
+        String[] controlIds = (String[])controlIdSet.toArray(new String[controlIdSet.size()]);
+        this.addClickListeners(controlIds);
+    }
+
+    @Override
+    public void itemClick(ItemClickEvent evt) {
+        super.itemClick(evt);
+        String key = evt.getItemKey();
+        MainPageModel mainPageModel = this.getMultilingualModel(controlMap, key);
+        FormModel formModel = null;
+        if (mainPageModel != null) {
+            formModel = new FormModel(mainPageModel.getFormId(), mainPageModel.getFormName(), mainPageModel.getFormType(), mainPageModel.getCallBack());
+        }
+        if (formModel != null) {
+            String formId = formModel.getFormId();
+            if (StringUtils.isEmpty(formId)) {
+                this.getView().showMessage(ResManager.loadKDString("敬请期待", "TripNaviBarPlugin_5", "fi-er-formplugin", new Object[0]));
+            } else {
+                showPage(formModel, this);
+            }
+        }
+    }
+
+    /**
+     * 点击事件
+     * @param evt
+     */
+    @Override
+    public void click(EventObject evt) {
+        super.click(evt);
+        Control control = (Control)evt.getSource();
+        String key = control.getKey();
+
+    }
+
+    /**
+     * 打开页面
+     * @param formModel
+     * @param formPlugin
+     * @return
+     */
+    public static String showPage(FormModel formModel, AbstractFormPlugin formPlugin) {
+        MobileListShowParameter listShowParameter = new MobileListShowParameter();
+        listShowParameter.setFormId("bos_moblist");
+        listShowParameter.setBillFormId(formModel.getFormId());
+        listShowParameter.getOpenStyle().setShowType(ShowType.Floating);
+        if (formModel.getCallBack()) {
+            listShowParameter.setCloseCallBack(new CloseCallBack(formPlugin, formModel.getFormId()));
+        }
+
+        formPlugin.getView().showForm(listShowParameter);
+        return listShowParameter.getPageId();
+    }
+
+
+
+    private MainPageModel getMultilingualModel(Map<String, MainPageModel> controlMap, String key) {
+        MainPageModel model = controlMap.get(key);
+        if (model == null) {
+            return null;
+        } else {
+            return model;
+        }
+    }
+
+    static {
+        controlMap.put("nckd_mbaritemap1", new MainPageModel("nckd_announcementsmob", "政策公告", "5"));
+        controlMap.put("nckd_mbaritemap2", new MainPageModel("nckd_advertmob", "招聘职位", "5"));
+        controlMap.put("nckd_mbaritemap3", new MainPageModel("er_trip", "我的应聘", "5"));  // TODO
+        controlMap.put("nckd_mbaritemap4", new MainPageModel("er_myviewpage_m", "我的简历", "5")); // TODO
+        controlMap.put("nckd_mbaritemap5", new MainPageModel("er_myviewpage_m", "我的收藏", "5")); // TODO
+    }
+
+
+}