工程资金付款申请单申请人带出主职部门插件
This commit is contained in:
parent
753f145350
commit
57763f863b
|
@ -0,0 +1,53 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.bill.BillShowParameter;
|
||||||
|
import kd.bos.bill.OperationStatus;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1:付款申请单通用插件
|
||||||
|
*/
|
||||||
|
public class PaymentapplyGeneralPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterBindData(EventObject e) {
|
||||||
|
super.afterBindData(e);
|
||||||
|
//如果是新增时
|
||||||
|
BillShowParameter bsp=(BillShowParameter)this.getView().getFormShowParameter();
|
||||||
|
if(bsp.getStatus()== OperationStatus.ADDNEW ){
|
||||||
|
DynamicObject person = this.getModel().getDataEntity().getDynamicObject("person");
|
||||||
|
if(person!=null){
|
||||||
|
long mainOrgId = UserServiceHelper.getUserMainOrgId(person.getLong("id"));
|
||||||
|
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||||
|
this.getView().updateView("zcgj_persondepart");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
String name = e.getProperty().getName();
|
||||||
|
if("person".equals(name)){
|
||||||
|
ChangeData changeData = e.getChangeSet()[0];//获取改变的数据
|
||||||
|
DynamicObject oldValue = (DynamicObject) changeData.getOldValue();
|
||||||
|
DynamicObject newValue = (DynamicObject) changeData.getNewValue();
|
||||||
|
if(newValue !=null){
|
||||||
|
long userid = newValue.getLong("id");
|
||||||
|
long mainOrgId = UserServiceHelper.getUserMainOrgId(userid);
|
||||||
|
this.getModel().setValue("zcgj_persondepart", mainOrgId);
|
||||||
|
this.getView().updateView("zcgj_persondepart");
|
||||||
|
}else{
|
||||||
|
this.getView().showErrorNotification("申请人不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue