用款申请单列表插件添加,添加过滤条件和默认值
This commit is contained in:
parent
13d14d5152
commit
be81c7c282
|
@ -0,0 +1,46 @@
|
|||
package zcgj.zcdev.zcdev.fs.plugin.form;
|
||||
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.filter.FilterColumn;
|
||||
import kd.bos.form.events.FilterContainerInitArgs;
|
||||
import kd.bos.form.field.events.BeforeFilterF7SelectEvent;
|
||||
import kd.bos.list.ListShowParameter;
|
||||
import kd.bos.list.plugin.AbstractListPlugin;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用款申请单列表插件
|
||||
* 说明:1:过滤所属组织字段值为当前用户存在的部门
|
||||
* 2:设置所属组织字段为默认组织
|
||||
*/
|
||||
public class paymentApplicationListPlugin extends AbstractListPlugin {
|
||||
|
||||
@Override
|
||||
public void filterContainerInit(FilterContainerInitArgs args) {
|
||||
super.filterContainerInit(args);
|
||||
List<FilterColumn> commonFilterColumns = args.getCommonFilterColumns();
|
||||
for (FilterColumn commonFilterColumn : commonFilterColumns) {
|
||||
String fieldName = commonFilterColumn.getFieldName();
|
||||
if ("zcgj_org.name".equals(fieldName)) {
|
||||
String userid = RequestContext.get().getUserId();//获取当前用户id
|
||||
long userMainOrgId = UserServiceHelper.getUserMainOrgId(Long.parseLong(userid));
|
||||
commonFilterColumn.setDefaultValue(String.valueOf(userMainOrgId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void filterContainerBeforeF7Select(BeforeFilterF7SelectEvent evt) {
|
||||
super.filterContainerBeforeF7Select(evt);
|
||||
String key = evt.getFieldName();
|
||||
if ("zcgj_org.id".equals(key)) {
|
||||
String userid = RequestContext.get().getUserId();//获取当前用户id
|
||||
List<Long> ids = UserServiceHelper.getOrgsUserJoin(Long.parseLong(userid));//获取用户所有部门id
|
||||
evt.addCustomQFilter(new QFilter("id", QFilter.in, ids));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue