点击按钮,调用子窗口,返回数据

实现的效果是:点击测试按钮,弹出子窗口,输入日期、金额返回数据到父窗口

取消按钮:

测试按钮插件代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Util;


namespace cux.button.test
{
    [Description("按钮测试")]
    [HotUpdate]
    public class KdBosExecuteServicePlugIn : AbstractBillPlugIn
    {
        public override void BarItemClick(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
        {
            base.BarItemClick(e);

            if (e.BarItemKey.Equals("PBQO_tbButton"))
            {
                //如果不返回数据可以这样调用
                /* this.View.ShowForm(new DynamicFormShowParameter()
                 {
                     ParentPageId = this.View.PageId,
                     FormId = "kdddbaabfd7234eb98e8193efd1340729"
                 });*/

                //返回数据这样调用
                this.View.ShowForm(new DynamicFormShowParameter()
                {
                    ParentPageId = this.View.PageId,
                    FormId = "kdddbaabfd7234eb98e8193efd1340729"
                }, (Action<Kingdee.BOS.Core.DynamicForm.FormResult>)(result =>
                {
                    if (result.ReturnData == null)
                        return;
                    Dictionary<string, object> dictionary = result.ReturnData as Dictionary<string, object>;
                    DateTime dateTime1 = Convert.ToDateTime(dictionary["FDate"]);
                    Decimal  fAmount = Convert.ToDecimal(dictionary["FAmount"]);
                 
                    //   DateTime dateTime1 = Convert.ToDateTime(result.ReturnData);
     
                }
               ));
            }
        }

    }
}
    

点击OK插件代码

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

namespace cux.button.test
{
    [Description("测试动态表单插件")]
    [HotUpdate]
    public class TestDynamicFormPlugin : AbstractDynamicFormPlugIn
    {
        
        public override void AfterButtonClick(AfterButtonClickEventArgs e)
        {
            base.AfterButtonClick(e);
            if (!e.Key.Equals("FOkButton", StringComparison.OrdinalIgnoreCase))
                return;
            if (this.Model.GetValue("FDate") == null)
                this.View.ShowWarnningMessage("追加日期未录入!", "", MessageBoxOptions.OK, (Action<MessageBoxResult>)null, MessageBoxType.Advise);
            else if (this.Model.GetValue("FAmount") == null || Convert.ToDecimal(this.Model.GetValue("FAmount")) == new Decimal(0))
            {
                this.View.ShowWarnningMessage("金额未录入!", "", MessageBoxOptions.OK, (Action<MessageBoxResult>)null, MessageBoxType.Advise);
            }
            else
            {
                this.View.ReturnToParentWindow(new Kingdee.BOS.Core.DynamicForm.FormResult((object)new Dictionary<string, object>()
        {
          {
            "FDate",
            this.Model.GetValue("FDate")
          },
          {
            "FAmount",
            this.Model.GetValue("FAmount")
          }/*,
          {
            "FRemark",
            this.Model.GetValue("FRemark")
          }*/
        }));
                this.View.Close();
            }
        }
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值