付款单根据业务小类设置 成本中心,利润中心是否必填 #afterBindData #propertyChanged
s
This commit is contained in:
parent
8f8f2b7e39
commit
eb087d77c4
|
|
@ -1,7 +1,11 @@
|
||||||
package shjh.jhzj7.fi.fi.plugin.form;
|
package shjh.jhzj7.fi.fi.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
import kd.bos.form.ClientProperties;
|
import kd.bos.form.ClientProperties;
|
||||||
|
import kd.bos.form.field.BasedataEdit;
|
||||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -16,13 +20,47 @@ public class TextFieldDemo extends AbstractFormPlugin {
|
||||||
@Override
|
@Override
|
||||||
public void afterBindData(EventObject e) {
|
public void afterBindData(EventObject e) {
|
||||||
|
|
||||||
// this.getView().setEnable(false, "settletype");
|
// 获取成本中心和利润中心的控件
|
||||||
// this.getView().setEnable(true, "settletype");
|
BasedataEdit shjh_costcenter = this.getView().getControl("shjh_costcenter");
|
||||||
|
BasedataEdit shjh_profitcenter = this.getView().getControl("shjh_pc");
|
||||||
|
//根据业务小类设置 成本中心,利润中心是否必填
|
||||||
|
DynamicObject shjhBizsmall = (DynamicObject)this.getView().getModel().getValue("shjh_bizsmall");
|
||||||
|
if (null != shjhBizsmall) {
|
||||||
|
shjhBizsmall = BusinessDataServiceHelper.loadSingle(shjhBizsmall.getPkValue(),"shjh_bizsmalltype");
|
||||||
|
// 获取成本中心和利润中心的必填配置
|
||||||
|
boolean shjhCc = shjhBizsmall.getBoolean("shjh_cc");
|
||||||
|
boolean shjhPc = shjhBizsmall.getBoolean("shjh_pc");
|
||||||
|
// 设置成本中心必填状态
|
||||||
|
shjh_costcenter.setMustInput(shjhCc);
|
||||||
|
// 设置利润中心必填状态
|
||||||
|
shjh_profitcenter.setMustInput(shjhPc);
|
||||||
|
}else {
|
||||||
|
shjh_costcenter.setMustInput(false);
|
||||||
|
shjh_profitcenter.setMustInput(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
|
||||||
|
// 获取成本中心和利润中心的控件
|
||||||
// Map<String, Object> ctlMap = new HashMap<>();
|
BasedataEdit shjh_costcenter = this.getView().getControl("shjh_costcenter");
|
||||||
// ctlMap.put(ClientProperties.Editable, true);
|
BasedataEdit shjh_profitcenter = this.getView().getControl("shjh_pc");
|
||||||
// this.getView().updateControlMetadata("settletype", ctlMap);
|
//根据业务小类设置 成本中心,利润中心是否必填
|
||||||
|
DynamicObject shjhBizsmall = (DynamicObject)this.getView().getModel().getValue("shjh_bizsmall");
|
||||||
|
if (null != shjhBizsmall) {
|
||||||
|
shjhBizsmall = BusinessDataServiceHelper.loadSingle(shjhBizsmall.getPkValue(),"shjh_bizsmalltype");
|
||||||
|
// 获取成本中心和利润中心的必填配置
|
||||||
|
boolean shjhCc = shjhBizsmall.getBoolean("shjh_cc");
|
||||||
|
boolean shjhPc = shjhBizsmall.getBoolean("shjh_pc");
|
||||||
|
// 设置成本中心必填状态
|
||||||
|
shjh_costcenter.setMustInput(shjhCc);
|
||||||
|
// 设置利润中心必填状态
|
||||||
|
shjh_profitcenter.setMustInput(shjhPc);
|
||||||
|
}else {
|
||||||
|
shjh_costcenter.setMustInput(false);
|
||||||
|
shjh_profitcenter.setMustInput(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue