/// <summary>
/// 创建sql构建参数后
/// </summary>
/// <param name="e"></param>
public override void AfterCreateSqlBuilderParameter(SqlBuilderParameterArgs e)
{
base.AfterCreateSqlBuilderParameter(e);
//this.view是部门列表的;this.View.ParentFormView 是过滤方案的view; this.View.ParentFormView.ParentFormView是直接sql帐表
if (this.View.ParentFormView != null && this.View.ParentFormView.ParentFormView != null)
{
var sqlForm = this.View.ParentFormView.ParentFormView.BillBusinessInfo.GetForm();
//直接sql帐表的表单Id
if (sqlForm.Id == "XDUA_RYGSFX" || sqlForm.Id == "XDUA_YGGSMXTJBB")
{
var billFormId = "BOS_SQLReportFilter"; //取单据A中配置的部门数据权限
//构建数据规则过滤参数
DataRuleFilterParamenter filterParameter = new DataRuleFilterParamenter(billFormId, DataRuleFilterVersion.V2)
{
ParentFormId = billFormId,
PermissionItemId = PermissionConst.View,
BusinessInfo = this.View.BillBusinessInfo,
IsLookUp = true,
IsEnabledObjectDRInLookUp = true,
IsSupportSqlParam = true,
};
//得到单据A部门数据规则过滤对象
DataRuleFilterObject filterObject = PermissionServiceHelper.LoadDataRuleFilter(this.Context, filterParameter);
//过滤对象的过滤字符串传给部门列表sql构建参数
e.sqlBuilderParameter.DataRuleFilterString = e.sqlBuilderParameter.DataRuleFilterString.JoinFilterString(filterObject.FilterString);
}
}
}
推荐阅读