单据体内的多选基础资料字段实现链接效果
【应用场景】
已审核单据,单据体内的多选基础资料字段无法实现点击单元格弹出列表的功能,不方便单据查看
通过二开实现,方便单据查看
【注意事项】
需要单元格处于锁定状态
【案例演示】
【实现步骤】
<1>编写表单插件,代码如下。
#region 单据体内的多选基础资料实现链接功能 public override void EntryButtonCellClick(EntryButtonCellClickEventArgs e) { base.EntryButtonCellClick(e); ShowMulBaseDateList(e); } /// <summary> /// 单据体内的多选基础资料实现超链接功能 /// 业务对象xml里多选基础资料字段外观需要加上 /// <ListColumnStyle>1</ListColumnStyle> /// <BlAppLstColStyle>1</BlAppLstColStyle> /// </summary> /// <param name="e"></param> private void ShowMulBaseDateList(EntryButtonCellClickEventArgs e) { if (e.FieldKey.EqualsIgnoreCase("F_Jac_MulBase_83g")) { e.Cancel = true; ILookUpField field = this.View.BusinessInfo.GetField("F_Jac_MulBase_83g") as ILookUpField; if (field == null) return; FieldAppearance ap = ap = this.View.LayoutInfo.GetFieldAppearance("F_Jac_MulBase_83g"); DynamicFormShowParameter parameter = null; DynamicObject activeRow = this.Model.GetEntityDataObject(((Field)field).Entity, e.Row); parameter = field.GetLookUpListParameter(this.Model, activeRow); parameter.ParentPageId = this.View.PageId; parameter.MultiSelect = false; string strCaption = ap.Caption; BaseDataField baseDatafield = ap.Field as BaseDataField; if (baseDatafield != null && baseDatafield.LookUpObject != null && baseDatafield.LookUpObject.Name != null && !baseDatafield.LookUpObject.Name.Equals(strCaption)) { strCaption += string.Format("({0})", baseDatafield.LookUpObject.Name); } if (baseDatafield == null || baseDatafield.LookUpObject == null) return; dynamic baseValue = this.Model.GetValue(baseDatafield.Key, e.Row); DynamicFormShowParameter listpara = null; string strPermissionItemId = ""; if (parameter != null && parameter is ListShowParameter) { listpara = parameter; } else { listpara = new ListShowParameter() { FormId = baseDatafield.LookUpObject.FormId }; } if (baseDatafield.LookUpObject.PermissionControl == 1) { strPermissionItemId = GetFormPermissionItemId(baseDatafield.LookUpObject.FormId, FormOperationEnum.View.ToString()); } //打开的列表中只显示已选择的数据记录 var baseValueCollection = baseValue as DynamicObjectCollection; if (baseValueCollection != null && baseValueCollection.Any()) { var pks = ""; var quotes = baseDatafield.LookUpObject.PkFieldType == EnumPkFieldType.STRING ? "'" : ""; foreach (var baseValueObj in baseValueCollection) { pks += string.Format("{0}{1}{0},", quotes, baseValueObj[1]); } var pkFilter = new ListRegularFilterParameter(); pkFilter.Filter = string.Format("{0} in ({1})", baseDatafield.LookUpObject.PkFieldName, pks.TrimEnd(',')); ((ListShowParameter)listpara).ListFilterParameter.MergeFilter(pkFilter); } if (strPermissionItemId.IsEmpty() == false) { //加上打开列表的权限项 listpara.PermissionItemId = strPermissionItemId; } this.View.ShowForm(listpara); } } /// <summary> /// 获取单据的查看权限 /// </summary> /// <param name="formId"></param> /// <param name="formOperation"></param> /// <returns></returns> private string GetFormPermissionItemId(string formId, string formOperation) { var fm = FormMetaDataCache.GetCachedFormMetaData(this.Context, formId); var opView = fm.BusinessInfo.GetForm().GetOperation(formOperation); if (opView != null && !opView.PermissionItemId.IsNullOrEmptyOrWhiteSpace()) { return opView.PermissionItemId; } return string.Empty; } #endregion
<2>修改单据元数据。
<2-1>若是自定义字段
<2-2>若是预置字段或扩展下来的字段
随便修改一下多选基础资料字段的外观属性,保存
同样修改元数据,增加两行属性
<ListColumnStyle>1</ListColumnStyle> <BlAppLstColStyle>1</BlAppLstColStyle>
<3>拷贝插件组件到应用站点的WebSite\Bin目录下,重启IIS。
<4>BOSIDE,注册表单插件,保存元数据,开发完毕。
单据体内的多选基础资料字段实现链接效果
【应用场景】已审核单据,单据体内的多选基础资料字段无法实现点击单元格弹出列表的功能,不方便单据查看通过二开实现,方便单据查看【注意...
点击下载文档
上一篇:如何制作部署包下一篇:查看报表后台SQL进行自定义查询方案
本文2024-09-23 04:06:38发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-163192.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章