评估任务动态打分页面新增查询、重置按钮
This commit is contained in:
parent
1b725ff2fb
commit
1d6c18a427
|
@ -20,6 +20,7 @@ import kd.bos.exception.KDException;
|
|||
import kd.bos.form.ClientProperties;
|
||||
import kd.bos.form.FormShowParameter;
|
||||
import kd.bos.form.IFormView;
|
||||
import kd.bos.form.control.Button;
|
||||
import kd.bos.form.control.Control;
|
||||
import kd.bos.form.control.EntryGrid;
|
||||
import kd.bos.form.control.Toolbar;
|
||||
|
@ -31,6 +32,7 @@ import kd.bos.form.field.BasedataEdit;
|
|||
import kd.bos.form.field.IntegerEdit;
|
||||
import kd.bos.form.operate.FormOperate;
|
||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||
import kd.bos.metadata.entity.EntityMetadata;
|
||||
import kd.bos.metadata.entity.businessfield.BasedataField;
|
||||
import kd.bos.metadata.entity.commonfield.IntegerField;
|
||||
import kd.bos.metadata.entity.commonfield.TextField;
|
||||
|
@ -44,6 +46,7 @@ import kd.sdk.plugin.Plugin;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 动态表单插件
|
||||
|
@ -57,7 +60,8 @@ public class BatchEvaluatePageFormPlugin extends AbstractFormPlugin implements P
|
|||
|
||||
ArrayList<Integer> indexColumnMaxNumber;//标准分集合
|
||||
|
||||
|
||||
private static final Map<String,String> nameAndTargetMap=new ConcurrentHashMap<>();//字段名称和标识map
|
||||
//private static final ConcurrentHashMap<String, String> nameAndTargetMap = new ConcurrentHashMap<>();//字段名称和标识map(线程安全)
|
||||
JSONArray primaryKeyValues;//主键集合
|
||||
|
||||
String scoremethod;//评分制/ 标准分制:standard ; 权重制: weight ; 份额制: share
|
||||
|
@ -72,7 +76,12 @@ public class BatchEvaluatePageFormPlugin extends AbstractFormPlugin implements P
|
|||
super.registerListener(e);
|
||||
Toolbar mbar = this.getView().getControl("qeug_toolbarap1");
|
||||
mbar.addItemClickListener(this);
|
||||
|
||||
// 字段过滤按钮点击
|
||||
Button button = this.getView().getControl("qeug_fieldquery");
|
||||
button.addClickListener(this);
|
||||
// 字段重置按钮点击
|
||||
Button button2 = this.getView().getControl("qeug_reset");
|
||||
button2.addClickListener(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,6 +142,60 @@ public class BatchEvaluatePageFormPlugin extends AbstractFormPlugin implements P
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字段按钮——方便用户填写数据
|
||||
* @param evt
|
||||
*/
|
||||
@Override
|
||||
public void click(EventObject evt) {
|
||||
super.click(evt);
|
||||
|
||||
Control source = (Control) evt.getSource();
|
||||
String key = source.getKey();
|
||||
|
||||
// 使用副本遍历
|
||||
Map<String,String> copyMap = new HashMap<>(nameAndTargetMap);
|
||||
|
||||
if (key.equalsIgnoreCase("qeug_fieldquery")){
|
||||
String queryFilter = (String) this.getModel().getValue("qeug_fieldfilter");
|
||||
if (queryFilter==null || "".equals(queryFilter)){
|
||||
this.getView().showTipNotification("请填写查询条件!");
|
||||
return;
|
||||
}
|
||||
// 首先显示所有列
|
||||
EntryGrid entryGrid = this.getView().getControl("qeug_entryentity");
|
||||
if (entryGrid != null) {
|
||||
// 显示供应商列(始终显示)
|
||||
entryGrid.setColumnProperty("qeug_supplier", ClientProperties.GridColHidden, true);
|
||||
// 遍历所有列,根据条件设置可见性
|
||||
for (Map.Entry<String, String> entry : copyMap.entrySet()) {
|
||||
String columnName = entry.getValue();
|
||||
// 如果列名包含查询条件,则显示;否则隐藏
|
||||
boolean shouldShow = entry.getKey().contains(queryFilter);
|
||||
entryGrid.setColumnProperty(columnName, ClientProperties.GridColHidden, shouldShow);
|
||||
}
|
||||
}
|
||||
}
|
||||
//重置按钮-将数据显隐性还原
|
||||
else if (key.equalsIgnoreCase("qeug_reset")){
|
||||
EntryGrid entryGrid = this.getView().getControl("qeug_entryentity");
|
||||
if (entryGrid != null) {
|
||||
// 重置所有列的可见性
|
||||
for (Map.Entry<String, String> entry : copyMap.entrySet()) {
|
||||
String columnName = entry.getValue();
|
||||
entryGrid.setColumnProperty(columnName, ClientProperties.GridColHidden, true);
|
||||
}
|
||||
|
||||
// 确保供应商列可见
|
||||
entryGrid.setColumnProperty("qeug_supplier", ClientProperties.GridColHidden, true);
|
||||
|
||||
// 清空查询条件
|
||||
this.getModel().setValue("qeug_fieldfilter", "");
|
||||
this.getView().updateView("qeug_fieldfilter");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||
super.beforeDoOperation(args);
|
||||
|
@ -501,6 +564,7 @@ public class BatchEvaluatePageFormPlugin extends AbstractFormPlugin implements P
|
|||
for (int i = 0; i < indexNames.size(); i++) {
|
||||
IntegerProp integerProp = new IntegerProp();
|
||||
integerProp.setName("qeug_number" + i);
|
||||
nameAndTargetMap.put(indexNames.get(i),"qeug_number" + i);
|
||||
integerProp.setDisplayName(new LocaleString(indexNames.get(i)));//标题
|
||||
integerProp.setScale(2);
|
||||
if ("standard".equals(scoremethod)){
|
||||
|
|
|
@ -49,7 +49,7 @@ public class MyEvalListPlugin extends AbstractListPlugin implements Plugin {
|
|||
formShowParameter.getOpenStyle().setShowType(ShowType.Modal);
|
||||
StyleCss inlineStyleCss = new StyleCss();
|
||||
inlineStyleCss.setHeight("600");
|
||||
inlineStyleCss.setWidth("1000");
|
||||
inlineStyleCss.setWidth("1500");
|
||||
formShowParameter.getOpenStyle().setInlineStyleCss(inlineStyleCss);
|
||||
getView().showForm(formShowParameter);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue