Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using WalkingTec.Mvvm.BlazorDemo.Model;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Demo.Models;
using WalkingTec.Mvvm.Demo.Models.Virus;
Expand Down Expand Up @@ -40,6 +41,8 @@ public DataContext(DbContextOptions<DataContext> options) : base(options) { }
public DbSet<Patient> Patients { get; set; }
public DbSet<Report> Reports { get; set; }

public DbSet<WorkFlowDemo> WorkFlowDemo { get; set; }

public override async Task<bool> DataInit(object allModules, bool IsSpa)
{
var state = await base.DataInit(allModules, IsSpa);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*************************************************************************************
*
* 文 件 名: WorkFlowDemo
* 描 述:
*
* 版 本: V0.1
* 创 建 者: 粗制乱造 (QQ:195593710)
* 创建时间: 2024/3/21 18:24:36
* ==================================================
* 历史更新记录
* 版本:V 修改时间: 修改人:
* 修改内容:
* ==================================================
*************************************************************************************/
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Elsa.Builders;
using Microsoft.EntityFrameworkCore;
using WalkingTec.Mvvm.Core;

namespace WalkingTec.Mvvm.BlazorDemo.Model
{
/// <summary>
/// 流程测试
/// </summary>
[Table("WorkFlowDemo")]

[Display(Name = "流程测试")]
public class WorkFlowDemo : BasePoco, IPersistPoco, Core.IWorkflow
{

[Display(Name = "_Model._Trains._IsValid")]
[Comment("是否有效")]
[Required(ErrorMessage = "Validate.{0}required")]
public bool IsValid { get; set; } = true;

[Display(Name ="内容")]
[Comment("内容")]
[JsonConverter(typeof(JsonStringConverter))]
public string Content { get; set; }

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
@page "/WorkFlowDemo/Approve"
@using WalkingTec.Mvvm.BlazorDemo.ViewModel.WorkFlowDemoVMs;
@inherits BasePage

<ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
<Tab IsBorderCard="true">
<TabItem Text="基本信息">
<Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">

<BootstrapInput @bind-Value="@Model.Entity.Content" />
</Row>
<Row>
<Textarea @bind-Value="@Model.Remark" ShowLabel="true"></Textarea>
</Row>
</TabItem>
<TabItem Text="审批信息">
<WTApproveHistory Model="@Model" />
</TabItem>
</Tab>
<div class="modal-footer table-modal-footer">
@if (tag == "提交")
{
<Button ButtonType="ButtonType.Submit" IsAsync="true" OnClick="OnSubmit" Text="提交" />
}
else
{
<Button ButtonType="ButtonType.Submit" IsAsync="true" OnClick="OnAgree" Text="@WtmBlazor.Localizer["Page.同意"]" />
<Button ButtonType="ButtonType.Submit" IsAsync="true" OnClick="OnBlack" Color="Color.Warning" Text="回退" />
<Button ButtonType="ButtonType.Submit" IsAsync="true" OnClick="OnDeny" Color="Color.Danger" Text="@WtmBlazor.Localizer["Page.拒绝"]" />
}
<Button OnClick="OnClose" Text="@WtmBlazor.Localizer["Sys.Close"]" />
</div>
</ValidateForm>

@code {

private WorkFlowDemoVM Model = new WorkFlowDemoVM();
private ValidateForm vform { get; set; }
[Parameter]
public string id { get; set; }
[Parameter]
public string tag { get; set; }

protected override async Task OnInitializedAsync()
{
if (id != "")
{
var rv = await WtmBlazor.Api.CallAPI<WorkFlowDemoVM>($"/api/WorkFlowDemo/{id}");
Model = rv.Data;
Model.Tag = tag;
}
await base.OnInitializedAsync();
}

private async Task Submit(EditContext context)
{
await PostsForm(vform, "/api/WorkFlowDemo/Approve", (s) => "Sys.OprationSuccess");
}

public void OnClose()
{
CloseDialog();
}

public void OnSubmit()
{
Model.ActionName = "提交";
}

public void OnAgree()
{
Model.ActionName = "同意";
}
public void OnDeny()
{
Model.ActionName = "拒绝";
}
public void OnBlack()
{
Model.ActionName = "回退";
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@page "/WorkFlowDemo/Create"
@using WalkingTec.Mvvm.BlazorDemo.ViewModel.WorkFlowDemoVMs;
@inherits BasePage

<ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
<Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">

<BootstrapInput @bind-Value="@Model.Entity.Content" />
</Row>
<div class="modal-footer table-modal-footer">
<Button Color="Color.Secondary" Icon="fa fa-close" Text="@WtmBlazor.Localizer["Sys.Close"]" OnClick="OnClose" />
<Button Color="Color.Primary" ButtonType="ButtonType.Submit" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Create"]" IsAsync="true" />
</div>
</ValidateForm>

@code {

private WorkFlowDemoVM Model = new WorkFlowDemoVM();
private ValidateForm vform { get; set; }


protected override async Task OnInitializedAsync()
{

await base.OnInitializedAsync();
}


private async Task Submit(EditContext context)
{
await PostsForm(vform, "/api/WorkFlowDemo/add", (s) => "Sys.OprationSuccess");
}

public void OnClose()
{
CloseDialog();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@page "/WorkFlowDemo/Details/{id}"
@using WalkingTec.Mvvm.BlazorDemo.ViewModel.WorkFlowDemoVMs;
@inherits BasePage

<ValidateForm @ref="vform" Model="@Model" >

<Tab IsBorderCard="true">
<TabItem Text="基本信息">
<Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">

<Display @bind-Value="@Model.Entity.Content" />
</Row>
</TabItem>
<TabItem Text="审批信息">
<WTApproveHistory Model="@Model" />
</TabItem>
</Tab>

<div class="modal-footer table-modal-footer">
<Button Color="Color.Primary" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Close"]" OnClick="OnClose" />
</div>
</ValidateForm>

@code {

private WorkFlowDemoVM Model = null;
private ValidateForm vform { get; set; }
[Parameter]
public string id { get; set; }


protected override async Task OnInitializedAsync()
{

var rv = await WtmBlazor.Api.CallAPI<WorkFlowDemoVM>($"/api/WorkFlowDemo/{id}");
Model = rv.Data;
}

public void OnClose()
{
CloseDialog();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@page "/WorkFlowDemo/Edit/{id}"
@using WalkingTec.Mvvm.BlazorDemo.ViewModel.WorkFlowDemoVMs;
@inherits BasePage

<ValidateForm @ref="vform" Model="@Model" OnValidSubmit="@Submit">
<Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">

<BootstrapInput @bind-Value="@Model.Entity.Content" />
</Row>
<div class="modal-footer table-modal-footer">
<Button Color="Color.Primary" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Close"]" OnClick="OnClose" />
<Button Color="Color.Primary" ButtonType="ButtonType.Submit" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Edit"]" IsAsync="true" />
</div>
</ValidateForm>

@code {

private WorkFlowDemoVM Model = null;
private ValidateForm vform { get; set; }
[Parameter]
public string id { get; set; }


protected override async Task OnInitializedAsync()
{

var rv = await WtmBlazor.Api.CallAPI<WorkFlowDemoVM>($"/api/WorkFlowDemo/{id}");
Model = rv.Data;
await base.OnInitializedAsync();
}

private async Task Submit(EditContext context)
{
await PostsForm(vform, $"/api/WorkFlowDemo/edit", (s) => "Sys.OprationSuccess", method: HttpMethodEnum.PUT);
}

public void OnClose()
{
CloseDialog();
}

}
Loading