|
@@ -1,11 +1,30 @@
|
|
|
package nckd.jimin.jyyy.fi.plugin.form;
|
|
|
|
|
|
import kd.bos.bill.AbstractMobBillPlugIn;
|
|
|
+import kd.bos.dataentity.entity.DynamicObject;
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
+import kd.bos.dataentity.resource.ResManager;
|
|
|
+import kd.bos.entity.datamodel.IDataModel;
|
|
|
+import kd.bos.entity.datamodel.events.ChangeData;
|
|
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
|
+import kd.bos.form.ConfirmCallBackListener;
|
|
|
import kd.bos.form.IFormView;
|
|
|
+import kd.bos.form.MessageBoxOptions;
|
|
|
+import kd.bos.form.control.Control;
|
|
|
+import kd.bos.form.field.MulBasedataEdit;
|
|
|
import kd.bos.logging.Log;
|
|
|
import kd.bos.logging.LogFactory;
|
|
|
+import kd.fi.er.business.servicehelper.CommonServiceHelper;
|
|
|
+import kd.fi.er.business.utils.ErCommonUtils;
|
|
|
+import kd.fi.er.business.utils.SystemParamterUtil;
|
|
|
+import kd.fi.er.business.utils.TripBillTravelerUtils;
|
|
|
+import kd.fi.er.formplugin.budget.BudgetCommonUtil;
|
|
|
+import nckd.base.helper.CommonHelperUtils;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+
|
|
|
import java.util.Date;
|
|
|
+import java.util.EventObject;
|
|
|
+import java.util.Iterator;
|
|
|
|
|
|
/**
|
|
|
* 出差申请移动端添加行程
|
|
@@ -16,11 +35,19 @@ import java.util.Date;
|
|
|
public class TripReqMobFormPlugin extends AbstractMobBillPlugIn {
|
|
|
private static final Log log = LogFactory.getLog(TripReqMobFormPlugin.class);
|
|
|
|
|
|
+ public void registerListener(EventObject e) {
|
|
|
+ this.addClickListeners(new String[]{"btn_save"});
|
|
|
+ }
|
|
|
@Override
|
|
|
public void propertyChanged(PropertyChangedArgs e) {
|
|
|
super.propertyChanged(e);
|
|
|
+ String key = e.getProperty().getName();
|
|
|
+ ChangeData[] changeData = e.getChangeSet();
|
|
|
+ Object newValue = changeData[0].getNewValue();
|
|
|
+ Object oldValue = changeData[0].getOldValue();
|
|
|
+ int rowIndex = changeData[0].getRowIndex();
|
|
|
|
|
|
- switch (e.getProperty().getName()) {
|
|
|
+ switch (key) {
|
|
|
case "nckd_startdatetime":
|
|
|
setStandardDateFieldValue("nckd_startdatetime", "startdate");
|
|
|
break;
|
|
@@ -41,9 +68,47 @@ public class TripReqMobFormPlugin extends AbstractMobBillPlugIn {
|
|
|
}
|
|
|
|
|
|
Date dateValue = (Date) this.getModel().getValue(fieldName);
|
|
|
-
|
|
|
this.getModel().setValue(standardFieldName, dateValue);
|
|
|
-// IFormView parentView = this.getView().getParentView();
|
|
|
-// parentView.updateView(standardFieldName);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void click(EventObject evt) {
|
|
|
+ Control source = (Control)evt.getSource();
|
|
|
+ String key = source.getKey();
|
|
|
+
|
|
|
+ IDataModel model = this.getModel();
|
|
|
+ IDataModel parentModel = this.getView().getParentView().getModel();
|
|
|
+ IFormView parentView = this.getView().getParentView();
|
|
|
+
|
|
|
+ switch (key) {
|
|
|
+ case "btn_save":
|
|
|
+ DynamicObject dataEntity = model.getDataEntity(true);
|
|
|
+ DynamicObjectCollection tripentry = dataEntity.getDynamicObjectCollection("tripentry");
|
|
|
+ DynamicObjectCollection parentTripEntry = parentModel.getEntryEntity("tripentry");
|
|
|
+
|
|
|
+ //根据第一行程开始时间判断是否后补单据
|
|
|
+ int diffDays = 0;
|
|
|
+ if(tripentry.size() > 0){
|
|
|
+ DynamicObject entry = tripentry.get(0);
|
|
|
+ int index = entry.getInt("index");
|
|
|
+ if(index > 1){
|
|
|
+ entry = parentTripEntry.get(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(entry.getDate("startdate") != null){
|
|
|
+ //计算字段【后补判断】
|
|
|
+ Date startDate = CommonHelperUtils.getDateStringFormat(entry.getDate("startdate"), "yyyy-MM-dd");
|
|
|
+ Date curDate = CommonHelperUtils.getDateStringFormat(new Date(), "yyyy-MM-dd");
|
|
|
+
|
|
|
+ diffDays = CommonHelperUtils.diffDateD(startDate, curDate);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ parentModel.setValue("nckd_amends", diffDays);
|
|
|
+ parentView.updateView("nckd_amends");
|
|
|
+ this.getView().sendFormAction(parentView);
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|