金蝶云星空——过滤界面文本框弹出选单界面

1.在过滤界面拖一个文本控件,设置其“显示编辑按钮”:true。若是需要禁止输入,只能通过编辑按钮进行修改,则设置“编辑风格”:仅按钮编辑
2.创建服务插件,注意过滤界面是继承:动态表单-->公共过滤 的,所以服务插件中的需要继承的是:AbstractDynamicFormPlugIn
3.文本框的编辑按钮的事件在:BeforeF7Select 中可以获取到

using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;

namespace WeiWaiFaLiaoQingDanFilter4
{
    /// <summary>
    /// 委外发料清单过滤窗口——表单插件
    /// </summary>
    [Description("委外发料清单过滤窗口——表单插件—采购订单弹出可选窗口")]
    //参考:https://vip.kingdee.com/article/393320998612955648?productLineId=1&lang=zh-CN
    public class TextEditButtonPlugIn : AbstractDynamicFormPlugIn
    {
        //参考:https://vip.kingdee.com/article/66518760642775808?productLineId=1&lang=zh-CN
        public override void BeforeF7Select(BeforeF7SelectEventArgs e)
        {
            base.BeforeF7Select(e);
            //FPOBILLNOS是文本框的标识
            if (e.FieldKey.EqualsIgnoreCase("FPOBILLNOS"))
            {
                this.ShowPurchaseOrder();
            }
        }

        //参考:https://vip.kingdee.com/article/158494475516452352?share_fromuid=2147411495&productLineId=1&lang=zh-CN
        //参考:https://vip.kingdee.com/article/67241621690988800?productLineId=1&lang=zh-CN
        private void ShowPurchaseOrder()
        {

            //打开单据列表
            ListShowParameter listShowPara = new ListShowParameter();
            listShowPara.FormId = "PUR_PurchaseOrder";
            listShowPara.PageId = Guid.NewGuid().ToString();
            listShowPara.ParentPageId = this.View.PageId;
            listShowPara.MultiSelect = true;//允许多选
            listShowPara.ListType = (int)Kingdee.BOS.Core.Enums.BOSEnums.Enu_ListType.BaseList;
            //listShowPara.ListType = (int)Kingdee.BOS.Core.Enums.BOSEnums.Enu_ListType.SelBill;
            listShowPara.IsLookUp = true;
            //过滤条件已审核
            listShowPara.ListFilterParameter.Filter = listShowPara.ListFilterParameter.Filter.JoinFilterString(" FDocumentStatus ='C' ");
            listShowPara.IsShowUsed = true;
            listShowPara.IsShowApproved = false;

            //基于委托回调机制,实现往父窗体中传递数据
            this.View.ShowForm(listShowPara, delegate (FormResult result)
            {
                if (result.ReturnData != null)
                {
                    ListSelectedRowCollection returnData = result.ReturnData as ListSelectedRowCollection;
                    if (returnData.Count > 0)
                    {
                        List<string> billNumbers = returnData.Select(o => o.BillNo).ToList();
                        //赋值到字段
                        this.View.Model.SetValue("FPoBillNos", string.Join(",", billNumbers));//将用户多选的数据进行拼接
                        this.View.UpdateView("FPoBillNos");
                    }
                }
            });
        }
    }
}

posted @ 2024-10-29 08:22  shanzm  阅读(13)  评论(0编辑  收藏  举报
TOP