|
|
@@ -1,16 +1,25 @@
|
|
|
package nckd.jxccl.hr.psms.plugin.form.contribution;
|
|
|
|
|
|
+import kd.bos.bill.BillShowParameter;
|
|
|
import kd.bos.bill.OperationStatus;
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
+import kd.bos.dataentity.entity.ILocaleString;
|
|
|
+import kd.bos.dataentity.metadata.IDataEntityProperty;
|
|
|
+import kd.bos.entity.BasedataEntityType;
|
|
|
import kd.bos.entity.datamodel.events.ChangeData;
|
|
|
+import kd.bos.entity.datamodel.events.IDataModelChangeListener;
|
|
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
|
+import kd.bos.entity.property.BasedataProp;
|
|
|
import kd.bos.form.FormShowParameter;
|
|
|
import kd.bos.form.field.BasedataEdit;
|
|
|
+import kd.bos.form.field.events.AfterBindingDataEvent;
|
|
|
+import kd.bos.form.field.events.BasedataEditListener;
|
|
|
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
|
|
import kd.bos.form.field.events.BeforeF7SelectListener;
|
|
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
|
|
import kd.bos.list.ListShowParameter;
|
|
|
+import kd.bos.mvc.bill.BillView;
|
|
|
import kd.bos.orm.query.QCP;
|
|
|
import kd.bos.orm.query.QFilter;
|
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
@@ -37,7 +46,69 @@ import java.util.Objects;
|
|
|
* @date 2025/10/25 22:57
|
|
|
* @version 1.0
|
|
|
*/
|
|
|
-public class ContribBillFormPlugin extends AbstractFormPlugin implements Plugin, BeforeF7SelectListener {
|
|
|
+public class ContribBillFormPlugin extends AbstractFormPlugin implements Plugin, BeforeF7SelectListener, BasedataEditListener, IDataModelChangeListener {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void initialize() {
|
|
|
+ this.getModel().addDataModelChangeListener(this);
|
|
|
+ BasedataEdit mulEdit = this.getControl("nckd_scoreitemsub");
|
|
|
+ mulEdit.addBasedataEditListener(this);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterBindingData(AfterBindingDataEvent evt) {
|
|
|
+ BillShowParameter showParameter = (BillShowParameter) this.getView().getFormShowParameter();
|
|
|
+ String formId = showParameter.getFormId();
|
|
|
+ if(formId.equalsIgnoreCase("nckd_contribbill_i") || formId.equalsIgnoreCase("nckd_contribbill_g")){
|
|
|
+ BasedataEdit edit = (BasedataEdit) evt.getSource();
|
|
|
+ Object v = evt.getDataEntity();
|
|
|
+ Object editSearchProp = null;
|
|
|
+ Object displayProp = "";
|
|
|
+ if (v == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ BasedataEntityType dt;
|
|
|
+ if (((DynamicObject) v).getDataEntityType() instanceof BasedataEntityType) {
|
|
|
+ dt = (BasedataEntityType) ((DynamicObject) v).getDataEntityType();
|
|
|
+ } else {
|
|
|
+ dt = (BasedataEntityType) ((BasedataProp) edit.getProperty()).getComplexType();
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取数据包中的名称字段值
|
|
|
+ String nameKey = dt.getNameProperty();
|
|
|
+ IDataEntityProperty p2 = dt.findProperty(nameKey);
|
|
|
+ if (p2 != null) {
|
|
|
+ displayProp = p2.getValueFast(v);
|
|
|
+ if (displayProp instanceof ILocaleString) {
|
|
|
+ displayProp = displayProp.toString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //动态修改多选基础资料的显示属性为名称(部门)
|
|
|
+ if ("nckd_scoreitemsub".equals(edit.getKey())) {
|
|
|
+ nameKey = "nckd_scoreitemlevel";
|
|
|
+ }
|
|
|
+ IDataEntityProperty p4 = dt.findProperty(nameKey);
|
|
|
+ if (p4 != null) {
|
|
|
+ Object valueFast = p4.getValueFast(v);
|
|
|
+ if(valueFast instanceof DynamicObject){
|
|
|
+ displayProp = ConvertUtil.toDynamicObjectOrNull(valueFast).getString(FormConstant.NAME_KEY);
|
|
|
+ editSearchProp = ConvertUtil.toDynamicObjectOrNull(valueFast).getString(FormConstant.NUMBER_KEY);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //设置显示属性
|
|
|
+ evt.setDisplayProp(displayProp.toString());
|
|
|
+ //设置编辑显示属性
|
|
|
+ evt.setEditSearchProp(editSearchProp == null ? "" : editSearchProp.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ /* //修改"单项奖项目",F7显示字段
|
|
|
+ */
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public void afterCreateNewData(EventObject e) {
|