|
@@ -0,0 +1,225 @@
|
|
|
+package fi.em.formPlugin;
|
|
|
+
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
+import kd.bos.entity.datamodel.events.ChangeData;
|
|
|
+import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
|
+import kd.bos.form.ConfirmCallBackListener;
|
|
|
+import kd.bos.form.ConfirmTypes;
|
|
|
+import kd.bos.form.MessageBoxOptions;
|
|
|
+import kd.bos.form.MessageBoxResult;
|
|
|
+import kd.bos.form.events.BeforeDoOperationEventArgs;
|
|
|
+import kd.bos.form.events.MessageBoxClosedEvent;
|
|
|
+import kd.bos.form.operate.FormOperate;
|
|
|
+import kd.bos.list.plugin.AbstractListPlugin;
|
|
|
+import kd.sdk.plugin.Plugin;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.EventObject;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+ * @author cjz
|
|
|
+ * @date 2024/8/19 9:01
|
|
|
+ * @description:薪酬计提单,根据业务类型显示分录
|
|
|
+ */
|
|
|
+public class SalaryDistributeEditPlugin extends AbstractListPlugin implements Plugin {
|
|
|
+
|
|
|
+ private static String nckd_entrytype="nckd_entrytype";
|
|
|
+ private static String nckd_generalemployees="nckd_generalemployees";
|
|
|
+ private static String nckd_earlyretired="nckd_earlyretired";
|
|
|
+ private static String nckd_retired="nckd_retired";
|
|
|
+ private static String nckd_pay="nckd_pay";
|
|
|
+ private static String oldentryNum="oldentryNum";
|
|
|
+ private static String newentryNum="newentryNum";
|
|
|
+
|
|
|
+
|
|
|
+ public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setVieeVisible(String Viewflag)
|
|
|
+ {
|
|
|
+ List<String> viewList=new ArrayList<>();
|
|
|
+ viewList.add(nckd_generalemployees);
|
|
|
+ viewList.add(nckd_earlyretired);
|
|
|
+ viewList.add(nckd_retired);
|
|
|
+ viewList.add(nckd_pay);
|
|
|
+
|
|
|
+ if (Viewflag.isEmpty()) {
|
|
|
+ for (String item:viewList) {
|
|
|
+ this.getView().setVisible(false,item);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_staffentry");
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_earlyretiredentry");
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_retireentry");
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_salaryentry");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Viewflag.equals(nckd_generalemployees)) {
|
|
|
+ for (String item:viewList) {
|
|
|
+ this.getView().setVisible(false,item);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_earlyretiredentry");
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_retireentry");
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_salaryentry");
|
|
|
+ this.getView().setVisible(true,nckd_generalemployees);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Viewflag.equals(nckd_earlyretired)) {
|
|
|
+ for (String item:viewList) {
|
|
|
+ this.getView().setVisible(false,item);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_staffentry");
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_retireentry");
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_salaryentry");
|
|
|
+ this.getView().setVisible(true,nckd_earlyretired);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Viewflag.equals(nckd_retired)) {
|
|
|
+ for (String item:viewList) {
|
|
|
+ this.getView().setVisible(false,item);
|
|
|
+ }
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_staffentry");
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_earlyretiredentry");
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_salaryentry");
|
|
|
+ this.getView().setVisible(true,nckd_retired);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Viewflag.equals(nckd_pay)) {
|
|
|
+ for (String item:viewList) {
|
|
|
+ this.getView().setVisible(false,item);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_staffentry");
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_earlyretiredentry");
|
|
|
+
|
|
|
+ this.getModel().deleteEntryData("nckd_retireentry");
|
|
|
+ this.getView().setVisible(true,nckd_pay);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void afterCreateNewData(EventObject e){
|
|
|
+ super.afterBindData(e);
|
|
|
+
|
|
|
+ this.setVieeVisible("");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void propertyChanged(PropertyChangedArgs e)
|
|
|
+ {
|
|
|
+ super.beforePropertyChanged(e);
|
|
|
+ String name=e.getProperty().getName();
|
|
|
+
|
|
|
+ DynamicObject data=this.getModel().getDataEntity();
|
|
|
+
|
|
|
+ if (nckd_entrytype.equals(name)) {
|
|
|
+
|
|
|
+ ChangeData[] changeSet=e.getChangeSet();
|
|
|
+ ChangeData changeData=changeSet[0];
|
|
|
+
|
|
|
+
|
|
|
+ oldentryNum=(String)changeData.getOldValue();
|
|
|
+ newentryNum=(String)changeData.getNewValue();
|
|
|
+ String entrytype=data.getString(nckd_entrytype);
|
|
|
+
|
|
|
+ if (entrytype.isEmpty()) {
|
|
|
+ this.setVieeVisible("");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (entrytype.equals("A")) {
|
|
|
+ ConfirmCallBackListener confirmCallBacks = new ConfirmCallBackListener(String.valueOf(false), this);
|
|
|
+ String confirmTip = "您确定要将分录类型改变为薪酬明细(一般员工)?操作会清空其他分录的数据,是否继续?";
|
|
|
+ this.getView().showConfirm(confirmTip,MessageBoxOptions.YesNo, ConfirmTypes.Default, confirmCallBacks);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (entrytype.equals("B")) {
|
|
|
+ ConfirmCallBackListener confirmCallBacks = new ConfirmCallBackListener(String.valueOf(false), this);
|
|
|
+ String confirmTip = "您确定要将分录类型改变为薪酬明细(内退)?操作会清空其他分录的数据,是否继续?";
|
|
|
+ this.getView().showConfirm(confirmTip,MessageBoxOptions.YesNo, ConfirmTypes.Default, confirmCallBacks);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (entrytype.equals("C")) {
|
|
|
+ ConfirmCallBackListener confirmCallBacks = new ConfirmCallBackListener(String.valueOf(false), this);
|
|
|
+ String confirmTip = "您确定要将分录类型改变为薪酬明细(退休)?操作会清空其他分录的数据,是否继续?";
|
|
|
+ this.getView().showConfirm(confirmTip,MessageBoxOptions.YesNo, ConfirmTypes.Default, confirmCallBacks);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (entrytype.equals("D")) {
|
|
|
+ ConfirmCallBackListener confirmCallBacks = new ConfirmCallBackListener(String.valueOf(false), this);
|
|
|
+ String confirmTip = "您确定要将分录类型改变为人力薪酬?操作会清空其他分录的数据,是否继续?";
|
|
|
+ this.getView().showConfirm(confirmTip,MessageBoxOptions.YesNo, ConfirmTypes.Default, confirmCallBacks);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void confirmCallBack(MessageBoxClosedEvent messageBoxClosedEvent) {
|
|
|
+ super.confirmCallBack(messageBoxClosedEvent);
|
|
|
+ DynamicObject data=this.getModel().getDataEntity();
|
|
|
+
|
|
|
+ String entrytype=data.getString(nckd_entrytype);
|
|
|
+
|
|
|
+ if (messageBoxClosedEvent.getResult() == MessageBoxResult.Yes) {
|
|
|
+
|
|
|
+ if (entrytype.equals("A")) {
|
|
|
+ this.setVieeVisible(nckd_generalemployees);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (entrytype.equals("B")) {
|
|
|
+ this.setVieeVisible(nckd_earlyretired);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (entrytype.equals("C")) {
|
|
|
+ this.setVieeVisible(nckd_retired);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (entrytype.equals("D")) {
|
|
|
+ this.setVieeVisible(nckd_pay);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (messageBoxClosedEvent.getResult()==MessageBoxResult.No)
|
|
|
+ {
|
|
|
+
|
|
|
+ this.getModel().beginInit();
|
|
|
+ data.set("nckd_entrytype",oldentryNum);
|
|
|
+ this.getModel().endInit();
|
|
|
+ this.getView().updateView();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|