Skip to content

单据状态字段

本节介绍如何使用单据状态字段组件

表单元数据设计

编写业务插件响应按钮点击事件

CSharp
using Kejie.BOS.Core.DynamicForm;
using Kejie.BOS.Core.DynamicForm.Plugin;
using Kejie.BOS.Core.DynamicForm.Plugin.Args;
using Kejie.BOS.Core.DynamicService;

namespace Kejie.Demo.Plugin
{
    public class DeskControl: DynamicFormPlugin
    {
        public DeskControl(IDynamicFormView view) : base(view)
        {
        }

        public override async Task BeforeInvokeEvent(BeforeInvokeEventArgs e)
        {
            if (e.Key == "FBtnConfirm" && e.EventName == "click")
            {
                View.ShowConfirm("确认订单", "您要确认此订单吗?", async isOK =>
                {
                    await View.SetValue("FStatus", "B");                 
                    View.ReturnToParentView("ok");
                    View.ShowSuccess("订单已确认");
                });

                return;
            }

            if (e.Key == "FBtnFinish" && e.EventName == "click")
            {
                View.ShowConfirm("完成订单", "您确定要完成此订单吗?", async isOK =>
                {
                    await View.SetValue("FStatus", "C");                   
                    View.ReturnToParentView("ok");
                    View.ShowSuccess("订单已完成");
                });

                return;
            }

            if (e.Key.StartsWith("FBtnCancel") && e.EventName == "click")
            {
                View.ShowConfirm("取消订单", "您确定要取消此订单吗?", async isOK =>
                {
                    await View.SetValue("FStatus", "D");                  
                    View.ReturnToParentView("ok");
                    View.ShowSuccess("订单已取消");
                });
                return;
            }            

            await base.BeforeInvokeEvent(e);
        }
    }
}

效果图