浏览代码

修正双击流程图中初始化Action不弹出窗口的问题

luocaiyang 3 年之前
父节点
当前提交
1d895cf91c

+ 1 - 1
wispro.sp.api/appsettings.json

@@ -11,7 +11,7 @@
     "DefaultConnect": "Data Source=(local);Initial Catalog=spDB;User ID=sa;Password=Lqftiu807005"
   },
 
-  "UpdateScheduleSetting": "00 43 08,16 * * ? *",
+  "UpdateScheduleSetting": "00 35 14 * * ? *",
 
   "ValidAudience": "StaffPerformance",
   "ValidIssuer": "http://localhost:39476",

+ 4 - 1
wispro.sp.web/Components/FlowChart.razor.cs

@@ -130,7 +130,8 @@ namespace wispro.sp.web.Components
         {
             SelectedObject = node.NodeObject;
             flowChartUtility.SelectedShape = node;
-            StateHasChanged();
+            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(node.NodeObject));
+            
             if (node.NodeObject is entity.workflowDefine.Step)
             {
                 if (OnDoubleClickStep.HasDelegate)
@@ -141,12 +142,14 @@ namespace wispro.sp.web.Components
 
             if (node.NodeObject is entity.workflowDefine.Action)
             {
+                
                 if (OnDoubleClickAction.HasDelegate)
                 {
                     OnDoubleClickAction.InvokeAsync((entity.workflowDefine.Action)node.NodeObject);
                 }
             }
 
+            StateHasChanged();
         }
 
         void ClickTrasfer(entity.workflowDefine.TrasferCondition trasferCondition)

+ 89 - 88
wispro.sp.web/Components/InputValueSetting.razor

@@ -101,100 +101,101 @@
         </ActionColumn>
             </RowTemplate>
             
-            <ExpandTemplate  Context="rowData" >
+            <ExpandTemplate  Context="rowData"  >
                 @if (rowData.Data.InputValueSetting.valueType == entity.workflowDefine.EnumFieldType.List)
                 {
-                <AntDesign.Table 
-                                 TItem="wispro.sp.entity.workflowDefine.InputValueSetting"
-                                 DataSource="@GetChildItem(rowData.Data)"
-                                 Bordered=@true
-                                 Size=@TableSize.Middle
-                                 HidePagination>
-                    <AntDesign.Column Title="栏位名称" TData="string">
-                        @if (context == EditObj)
-                        {
-                            <Input @bind-Value="context.DisplayName" />
+                    <AntDesign.Table 
+                                     TItem="wispro.sp.entity.workflowDefine.InputValueSetting"
+                                     DataSource="@GetChildItem(rowData.Data)"
+                                     Bordered=@true
+                                     Size=@TableSize.Middle
+                                     Context="cc"
+                                     HidePagination>
+                        <AntDesign.Column Title="栏位名称" TData="string">
+                            @if (cc == EditObj)
+                            {
+                                <Input @bind-Value="cc.DisplayName" />
 
-                        }
-                        else
-                        {
-                            @context.DisplayName
-                        }
-                    </AntDesign.Column>
-                    <AntDesign.Column Title="栏位类型" TData="string">
-                        @if (context == EditObj)
-                        {
-                            <Select DataSource="@FieldTypes"
-                                    @bind-Value="@context.valueType"
-                                    LabelName="@nameof(wispro.sp.entity.EnumnDescription<wispro.sp.entity.workflowDefine.FieldType>.Description)"
-                                    ValueName="@nameof(wispro.sp.entity.EnumnDescription<wispro.sp.entity.workflowDefine.FieldType>.Value)"
-                                    Placeholder="请选项一项"
-                                    DefaultActiveFirstItem="false"
-                                    EnableSearch="true"
-                                    AllowClear="true"
-                                    Style="width:220px;">
-                            </Select>
-                        }
-                        else
-                        {
-                            <span>@wispro.sp.entity.EnumHelper.GetDescription(context.valueType)</span>
-                        }
-                    </AntDesign.Column>
-                    <AntDesign.Column Title="可选值" TData="string">
-                        @if (context == EditObj)
-                        {
-                            <Input @bind-Value="context.Options" />
-                        }
-                        else
-                        {
-                            @context.Options
-                        }
-                    </AntDesign.Column>
-                    <AntDesign.Column Title="绑定栏位" TData="string">
-                        @if (context == EditObj)
-                        {
-                            <Input @bind-Value="context.bindField" />
-                        }
-                        else
-                        {
-                            @context.bindField
-                        }
-                    </AntDesign.Column>
+                            }
+                            else
+                            {
+                                @cc.DisplayName
+                            }
+                        </AntDesign.Column>
+                        <AntDesign.Column Title="栏位类型" TData="string">
+                            @if (cc == EditObj)
+                            {
+                                <Select DataSource="@FieldTypes"
+                                        @bind-Value="@cc.valueType"
+                                        LabelName="@nameof(wispro.sp.entity.EnumnDescription<wispro.sp.entity.workflowDefine.FieldType>.Description)"
+                                        ValueName="@nameof(wispro.sp.entity.EnumnDescription<wispro.sp.entity.workflowDefine.FieldType>.Value)"
+                                        Placeholder="请选项一项"
+                                        DefaultActiveFirstItem="false"
+                                        EnableSearch="true"
+                                        AllowClear="true"
+                                        Style="width:220px;">
+                                </Select>
+                            }
+                            else
+                            {
+                                <span>@wispro.sp.entity.EnumHelper.GetDescription(cc.valueType)</span>
+                            }
+                        </AntDesign.Column>
+                        <AntDesign.Column Title="可选值" TData="string">
+                            @if (cc == EditObj)
+                            {
+                                <Input @bind-Value="cc.Options" />
+                            }
+                            else
+                            {
+                                @cc.Options
+                            }
+                        </AntDesign.Column>
+                        <AntDesign.Column Title="绑定栏位" TData="string">
+                            @if (cc == EditObj)
+                            {
+                                <Input @bind-Value="cc.bindField" />
+                            }
+                            else
+                            {
+                                @cc.bindField
+                            }
+                        </AntDesign.Column>
 
-                    <ActionColumn>
-                        @if (context == EditObj)
-                        {
-                            <Space>
-                                <SpaceItem><Button Type="@ButtonType.Text" OnClick="() => Save(context)">保存</Button></SpaceItem>
-                            </Space>
-                            <Space>
-                                <Popconfirm Title="确定要忽略当前修改?"
-                                            OnConfirm="() => OnCancel(context)"
-                                            OkText="Yes"
-                                            CancelText="No">
-                                    <a>取消</a>
-                                </Popconfirm>
-                            </Space>
-                        }
-                        else
-                        {
-                            <Space>
-                                <SpaceItem><Button Type="@ButtonType.Text" OnClick="() => Edit(context)">编辑</Button></SpaceItem>
-                            </Space>
-                            <Space>
-                                <Popconfirm Title="确定要删除当前栏位?"
-                                            OnConfirm="() => Delete(context)"
-                                            OkText="Yes"
-                                            CancelText="No">
-                                    <a>删除</a>
-                                </Popconfirm>
-                            </Space>
-                        }
-                    </ActionColumn>
-                </AntDesign.Table>
+                        <ActionColumn>
+                            @if (cc == EditObj)
+                            {
+                                <Space>
+                                    <SpaceItem><Button Type="@ButtonType.Text" OnClick="() => Save(cc)">保存</Button></SpaceItem>
+                                </Space>
+                                <Space>
+                                    <Popconfirm Title="确定要忽略当前修改?"
+                                                OnConfirm="() => OnCancel(cc)"
+                                                OkText="Yes"
+                                                CancelText="No">
+                                        <a>取消</a>
+                                    </Popconfirm>
+                                </Space>
+                            }
+                            else
+                            {
+                                <Space>
+                                    <SpaceItem><Button Type="@ButtonType.Text" OnClick="() => Edit(cc)">编辑</Button></SpaceItem>
+                                </Space>
+                                <Space>
+                                    <Popconfirm Title="确定要删除当前栏位?"
+                                                OnConfirm="() => Delete(cc)"
+                                                OkText="Yes"
+                                                CancelText="No">
+                                        <a>删除</a>
+                                    </Popconfirm>
+                                </Space>
+                            }
+                        </ActionColumn>
+                    </AntDesign.Table>
                 }
             </ExpandTemplate>
 
-</AntDesign.Table>
+        </AntDesign.Table>
     </Body>
 </Card>

+ 14 - 6
wispro.sp.web/Components/InputValueSetting.razor.cs

@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Components;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Text.Json;
 using System.Threading.Tasks;
 using wispro.sp.entity;
 
@@ -34,30 +35,35 @@ namespace wispro.sp.web.Components
 
         void AddNew(entity.workflowDefine.InputValueSetting setting)
         {
-            Console.WriteLine("AddNew");
+            JsonSerializerOptions options = new() { IgnoreNullValues = true };
+            Console.WriteLine($"AddNew Begin:{System.Text.Json.JsonSerializer.Serialize(EditAction,options)}");
+            Console.WriteLine($"setting:{System.Text.Json.JsonSerializer.Serialize(setting, options)}");
+
             var newObj = new entity.workflowDefine.InputValueSetting()
             {
                 valueType = entity.workflowDefine.EnumFieldType.Text,
                 DisplayName = "新添栏位",
-                ParentSetting = setting
+                //ParentSetting = setting
                 
             };
             EditObj = newObj;
 
-            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(EditObj));
+            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(EditObj,options));
+            Console.WriteLine($"newObj:{System.Text.Json.JsonSerializer.Serialize(newObj, options)}");
 
             if (setting != null)
             {
                 foreach(var ss in EditAction.InputValueSettingObjects)
                 {
-                    if(ss.InputValueSetting == setting)
+                    if(ss.InputValueSetting == setting )
                     {
                         if(ss.Children == null)
                         {
                             ss.Children = new List<entity.workflowDefine.InputValueSetting>();
-                            ss.Children.Add(newObj);
-                            break;
                         }
+
+                        ss.Children.Add(newObj);
+                        break;
                     }
                 }
             }
@@ -74,6 +80,8 @@ namespace wispro.sp.web.Components
                 }
                 EditAction.NewInputValueSettingObjects.Add(newSettingobj);
             }
+
+            Console.WriteLine($"AddNew End:{System.Text.Json.JsonSerializer.Serialize(EditAction, options)}");
         }
 
         async void Delete(entity.workflowDefine.InputValueSetting setting)

+ 6 - 6
wispro.sp.web/Pages/Workflow/WorkflowDetail.razor

@@ -42,10 +42,9 @@
         <wispro.sp.web.Components.FlowChart @ref="chart"
                                             workflow="@workflow" Actions="@Actions"
                                             Transfers="@Transfers" Steps="@Steps"
-                                            OnClickAction="OnClickAction"
-                                            OnClickStep="OnClickStep"
-                                            OnClickTransfer="OnClickTransfer"
                                             OnDoubleClickStep="OnDblClickStep"
+                                            OnDoubleClickAction="OnDblClickAction"
+                                            OnDoubleClickTransfer="OnDblClickTransfer"
                                             hSeparation="60"
                                             ChartWidth="900" ChartHeight="600"
                                             />
@@ -61,7 +60,8 @@
        OkText="@("保存")"
        CancelText="@("取消")"
        Width="1000"
-       MaskClosable="false">
+       MaskClosable="false"
+       DestroyOnClose>
 
     <Form Model="EditStep" LabelColSpan="6"
           WrapperColSpan="16">
@@ -123,7 +123,7 @@
        OnCancel="@EditActionCancel"
        OkText="@("确定")"
        CancelText="@("取消")"
-       Width="1000" MaskClosable="false">
+       Width="1000" MaskClosable="false" DestroyOnClose>
 
     <Form Model="EditAction" LabelColSpan="6"
           WrapperColSpan="16">
@@ -158,7 +158,7 @@
        OnCancel="@EditTransferCancel"
        OkText="@("保存")"
        CancelText="@("取消")"
-       Width="1000" MaskClosable="false">
+       Width="1000" MaskClosable="false" DestroyOnClose>
 
     <Form Model="EditTransfer" LabelColSpan="6"
           WrapperColSpan="16">

+ 29 - 4
wispro.sp.web/Pages/Workflow/WorkflowDetail.razor.cs

@@ -105,14 +105,39 @@ namespace wispro.sp.web.Pages.Workflow
 
         }
 
-        void OnClickAction(entity.workflowDefine.Action action)
+        async void OnDblClickAction(entity.workflowDefine.Action action)
         {
-            //_msgService.Info($"您点击了:【{action.Name}】操作");
+            if (action.Id == workflow.InitAction.Id)
+            {
+                EditAction = new share.ActionObject();
+                EditAction.Action = action;
+            }
+            else
+            {
+                Console.WriteLine($"BeginEditAction-Begin:{System.Text.Json.JsonSerializer.Serialize(action)}");
+                if (EditStep.actions != null)
+                {
+                    EditAction = EditStep.actions.FirstOrDefault(a => a.Action.Id == action.Id);
+                }
+            }
+
+            
+            if (EditAction != null)
+            {
+                if (EditAction.Action.Id > 0)
+                {
+                    EditAction.InputValueSettingObjects = await _wfService.getInputValueSteeing(EditAction.Action.Id);
+                }
+                ActionModalShow = true;
+            }
+            Console.WriteLine($"BeginEditAction-End:{System.Text.Json.JsonSerializer.Serialize(EditAction)}");
+            StateHasChanged();
         }
 
-        void OnClickTransfer(entity.workflowDefine.TrasferCondition transfer)
+        void OnDblClickTransfer(entity.workflowDefine.TrasferCondition transfer)
         {
-            //_msgService.Info($"您点击了:从步骤【{transfer.StepId}】到步骤【{transfer.nextStepId}】的移转条件!");
+            EditTransfer = transfer;
+            TransferModalShow = true;
         }
 
         share.NewStepObject EditStep;