企业成本核算表单优化

This commit is contained in:
xuhaihui 2025-11-26 16:50:59 +08:00
parent 2d4a110ad4
commit a96bfafcee
1 changed files with 48 additions and 1 deletions

View File

@ -6,10 +6,15 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.MainEntityType;
import kd.bos.entity.ValueMapItem;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.entity.property.ComboProp;
import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.form.field.BasedataEdit;
import kd.bos.form.field.ComboEdit;
import kd.bos.form.field.ComboItem;
import kd.bos.form.field.events.BeforeF7SelectEvent;
import kd.bos.form.field.events.BeforeF7SelectListener;
import kd.bos.form.operate.FormOperate;
@ -52,7 +57,33 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
subEntryEntity.set("zcgj_cbs", cbs);//成本核算维度明细-成本分解结构
}
this.getView().updateView("zcgj_subentryentity");//刷新成本核算维度明细
} /*else if ("costtype".equals(key)) {
//成本项
ChangeData[] changeSet = e.getChangeSet();
ChangeData changeData = changeSet[0];
Object newValue = changeData.getNewValue();//新值
MainEntityType dataEntityType = this.getModel().getDataEntityType();
ComboProp zcgj_sectype = (ComboProp) dataEntityType.getProperty("zcgj_sectype");
List<ValueMapItem> comboItems = zcgj_sectype.getComboItems();
this.getModel().setValue("zcgj_sectype", null);
List<ComboItem> comboItemss = new ArrayList<>();
List<String> item1 = new ArrayList<>();
item1.add("10.10");
item1.add("10.20");
item1.add("10.30");
List<String> item6 = new ArrayList<>();
item6.add("60.10");
if (newValue.equals("10.")) {
comboItemFor(comboItems, item1, comboItemss);
} else if (newValue.equals("60.")) {
comboItemFor(comboItems, item6, comboItemss);
}
ComboEdit comboEdit = this.getControl("zcgj_sectype");//二级分类
comboEdit.setComboItems(comboItemss);
}*/
}
public void beforeF7Select(BeforeF7SelectEvent arg0) {
@ -332,4 +363,20 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
if ("100.".equals(type)) return 100;
return null;
}
private static void comboItemFor(List<ValueMapItem> comboItems, List<String> item, List<ComboItem> comboItemss) {
//下拉字段过滤逻辑
ComboItem comboItem;
for (ValueMapItem valueMapItem : comboItems) {
String value = valueMapItem.getValue();
//将item1包含的key设置为可见
if (item.contains(value)) {
valueMapItem.setItemVisible(true);
comboItem = new ComboItem();
comboItem.setCaption(valueMapItem.getName());
comboItem.setValue(value);
comboItemss.add(comboItem);
}
}
}
}