|
|
@@ -10,10 +10,14 @@ import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
|
import kd.bos.form.control.EntryGrid;
|
|
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
|
|
+import kd.bos.form.field.BasedataEdit;
|
|
|
import kd.bos.form.field.FieldEdit;
|
|
|
+import kd.bos.form.field.events.BeforeF7SelectEvent;
|
|
|
+import kd.bos.form.field.events.BeforeF7SelectListener;
|
|
|
import kd.bos.form.operate.AbstractOperate;
|
|
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
|
|
import kd.bos.org.utils.DynamicObjectUtils;
|
|
|
+import kd.bos.orm.query.QCP;
|
|
|
import kd.bos.orm.query.QFilter;
|
|
|
import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
|
|
|
import kd.hr.hbp.common.util.HRStringUtils;
|
|
|
@@ -32,7 +36,7 @@ import java.util.stream.Stream;
|
|
|
* Tyx 2025-10-27
|
|
|
* 变动核定单表单插件扩展【nckd_hpdi_empcoordbat_ext】
|
|
|
*/
|
|
|
-public class SinSurEmpChgCoordBatchEditPluginEx extends AbstractFormPlugin implements Plugin {
|
|
|
+public class SinSurEmpChgCoordBatchEditPluginEx extends AbstractFormPlugin implements Plugin, BeforeF7SelectListener {
|
|
|
|
|
|
private static final HRBaseServiceHelper COORDBILL_HELPER = new HRBaseServiceHelper("hpdi_empcoordverifbill3");
|
|
|
private static final List<String> defaultQueryFields = (List) Stream.of("id", "employeev", "assignment", "coordruleparam").collect(Collectors.toList());
|
|
|
@@ -50,6 +54,15 @@ public class SinSurEmpChgCoordBatchEditPluginEx extends AbstractFormPlugin imple
|
|
|
showEntryData(billCols);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void registerListener(EventObject e) {
|
|
|
+ super.registerListener(e);
|
|
|
+ BasedataEdit basedataEdit = this.getView().getControl("nckd_sinsurdimension");
|
|
|
+ if (basedataEdit != null) {
|
|
|
+ basedataEdit.addBeforeF7SelectListener(this);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void showEntryData(DynamicObject[] billCols) {
|
|
|
Set<String> entryFields = this.getEntryFields();
|
|
|
// 根据ID提取出来
|
|
|
@@ -87,6 +100,8 @@ public class SinSurEmpChgCoordBatchEditPluginEx extends AbstractFormPlugin imple
|
|
|
if(HRStringUtils.equalsAny(key, "nckd_welfaretype", "nckd_sinsurdimension")) {
|
|
|
int rowIndex = model.getEntryCurrentRowIndex("entryentity");
|
|
|
DynamicObject sinSurStd = (DynamicObject) model.getValue("sinsurstd_r31", rowIndex);
|
|
|
+ if(ObjectUtils.isEmpty(sinSurStd))
|
|
|
+ return;
|
|
|
getStdInfoAndStdDimfromCache(sinSurStd);
|
|
|
int subRowIndex = model.getEntryCurrentRowIndex("nckd_subentryentity");
|
|
|
DynamicObject welfaretype = (DynamicObject) model.getValue("nckd_welfaretype", subRowIndex);
|
|
|
@@ -99,11 +114,21 @@ public class SinSurEmpChgCoordBatchEditPluginEx extends AbstractFormPlugin imple
|
|
|
if(!ObjectUtils.isEmpty(newValue)) {
|
|
|
getStdInfoAndStdDimfromCache((DynamicObject) newValue);
|
|
|
int rowIndex = model.getEntryCurrentRowIndex("entryentity");
|
|
|
+ // 因为险种维度会根据参保标准+险种进行过滤,这里把子单据体的险种维度清空
|
|
|
+ clearSubEntryDimension(rowIndex);
|
|
|
getDimensionValue((DynamicObject) newValue, rowIndex);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void clearSubEntryDimension (int rowIndex) {
|
|
|
+ this.getModel().setEntryCurrentRowIndex("entryentity", rowIndex);
|
|
|
+ int rowCount = this.getModel().getEntryRowCount("nckd_subentryentity");
|
|
|
+ for (int i = 0; i < rowCount; i++) {
|
|
|
+ this.getModel().setValue("nckd_sinsurdimension", null, i, rowIndex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 从缓存中获取参保标准的信息,如果没有缓存则生成缓存
|
|
|
* @param sinSurStd
|
|
|
@@ -312,4 +337,40 @@ public class SinSurEmpChgCoordBatchEditPluginEx extends AbstractFormPlugin imple
|
|
|
return new ArrayList(queryFields);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void beforeF7Select(BeforeF7SelectEvent e) {
|
|
|
+ String fieldKey = e.getProperty().getName();
|
|
|
+ IDataModel model = this.getModel();
|
|
|
+ if(HRStringUtils.equals(fieldKey, "nckd_sinsurdimension")) {
|
|
|
+ // 单据体行号
|
|
|
+ int rowIndex = model.getEntryCurrentRowIndex("entryentity");
|
|
|
+ // 子单据体行号
|
|
|
+ int subRowIndex = e.getRow();
|
|
|
+ // 过滤前判断 参保标准和险种有没有选择
|
|
|
+ DynamicObject sinSurStd = (DynamicObject) model.getValue("sinsurstd_r31", rowIndex);
|
|
|
+ DynamicObject welfareType = (DynamicObject) model.getValue("nckd_welfaretype", subRowIndex, rowIndex);
|
|
|
+ if(ObjectUtils.isEmpty(sinSurStd)) {
|
|
|
+ this.getView().showTipNotification("请先选择“参保标准”");
|
|
|
+ e.setCancel(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if (ObjectUtils.isEmpty(welfareType)) {
|
|
|
+ this.getView().showTipNotification("请先选择“险种”");
|
|
|
+ e.setCancel(true);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 按照参保标准+险种 查询可选择的险种维度
|
|
|
+ QFilter filter = new QFilter("id", QCP.in, getDimensionValueForFilter(sinSurStd, welfareType));
|
|
|
+ e.getCustomQFilters().add(filter);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<Long> getDimensionValueForFilter (DynamicObject sinSurStd, DynamicObject welfaretype) {
|
|
|
+ Long sinSurStdId = sinSurStd.getLong("id");
|
|
|
+ Long welfaretypeId = welfaretype.getLong("id");
|
|
|
+ SITCoordinationUtils SITCoordinationUtils = new SITCoordinationUtils();
|
|
|
+ return SITCoordinationUtils.queryDimensionValue(sinSurStdId, welfaretypeId);
|
|
|
+ }
|
|
|
+
|
|
|
}
|