Ver código fonte

添加专案工作内容提交功能

luocaiyang 3 anos atrás
pai
commit
43a38a10bc

+ 157 - 3
wispro.sp.api/Controllers/ProjectController.cs

@@ -5,6 +5,7 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
+using wispro.sp.api.Job;
 using wispro.sp.entity;
 using wispro.sp.share;
 
@@ -72,7 +73,7 @@ namespace wispro.sp.api.Controllers
             return Context.ProjectContentRecords
                 .Include(p=>p.CalMonth)
                 .Include(p => p.Reviewer)
-                .Include(p => p.Project)
+                .Include(p => p.Project).ThenInclude(p => p.Customer)
                 .Include(p=>p.ProjectWorkContents)
                 .Where(p => p.Staff.Name == User.Identity.Name).ToList();
         }
@@ -82,7 +83,7 @@ namespace wispro.sp.api.Controllers
             var retObj = Context.ProjectContentRecords
                 .Include(p => p.CalMonth)
                 .Include(p => p.Reviewer)
-                .Include(p => p.Project)
+                .Include(p => p.Project).ThenInclude(p=>p.Customer)
                 .Include(p => p.ProjectWorkContents)
                 .FirstOrDefault(p=>p.Id == Id);
 
@@ -97,6 +98,7 @@ namespace wispro.sp.api.Controllers
                 {
                     ViewProjectWorkContent tem = new ViewProjectWorkContent();
                     tem.modifyState = ModifyState.UnChanged;
+                    tem.Id = wContent.Id;
                     tem.Content = wContent.Content;
                     tem.ActualPerformance = wContent.ActualPerformance;
                     tem.ContentRecordId = wContent.ContentRecordId;
@@ -108,6 +110,8 @@ namespace wispro.sp.api.Controllers
                     ret.ProjectWorkContents.Add(tem);
                 }
 
+                ret.ProjectContentRecord.ProjectWorkContents = null;
+
                 return ret;
             }
 
@@ -117,7 +121,157 @@ namespace wispro.sp.api.Controllers
 
         public ApiSaveResponse SaveProjectWorkContent(ProjectContents saveObj)
         {
-            return null;
+            ApiSaveResponse ret = new ApiSaveResponse();
+            ret.Success = true;
+
+            using (var t = Context.Database.BeginTransaction())
+            {
+                try
+                {
+                    if (saveObj.ProjectContentRecord.Id == 0)
+                    {
+                        if(string.IsNullOrEmpty(saveObj.ProjectContentRecord.ProjectNo))
+                        {
+                            ret.Success = false;
+                            ret.ErrorMessage = "没有选择专案!";
+                            return ret;
+                        }
+                        else
+                        {
+                            saveObj.ProjectContentRecord.Project = null;
+                        }
+
+                        var currentUser = Context.Staffs.FirstOrDefault(s=>s.Name == User.Identity.Name);
+                        saveObj.ProjectContentRecord.StaffId = currentUser.Id;
+                        
+                        Context.ProjectContentRecords.Add(saveObj.ProjectContentRecord);
+                        Context.SaveChanges();
+                    }
+                    else
+                    {
+                        var temObj = Context.ProjectContentRecords.FirstOrDefault(p => p.Id == saveObj.ProjectContentRecord.Id);
+                        temObj.CaseCoefficient = saveObj.ProjectContentRecord.CaseCoefficient;
+                        temObj.Point = saveObj.ProjectContentRecord.Point;
+                        temObj.ReviewerId = saveObj.ProjectContentRecord.ReviewerId;
+                        //temObj.StaffId = saveObj.ProjectContentRecord.StaffId;
+                        temObj.State = saveObj.ProjectContentRecord.State;
+                        Context.SaveChanges();
+                        saveObj.ProjectContentRecord = temObj;
+                    }
+
+                    foreach (var temContent in saveObj.ProjectWorkContents)
+                    {
+                        switch (temContent.modifyState)
+                        {
+                            case ModifyState.Deleted:
+                                Context.Database.ExecuteSqlRaw($"Delete from ProjectWorkContent where id={temContent.Id}");
+
+                                break;
+                            case ModifyState.Modified:
+                                var modifyContent = Context.ProjectWorkContents.FirstOrDefault(p => p.Id == temContent.Id);
+                                if (modifyContent != null)
+                                {
+                                    modifyContent.Content = temContent.Content;
+                                    modifyContent.ActualPerformance = temContent.ActualPerformance;
+                                    modifyContent.DifficultFactor = temContent.DifficultFactor;
+                                    modifyContent.FinalPerformance = temContent.FinalPerformance;
+                                    modifyContent.TakeTime = temContent.TakeTime;
+                                    modifyContent.TimeSpan = temContent.TimeSpan;
+                                    modifyContent.WorkDate = temContent.WorkDate;
+                                }
+                                break;
+                            case ModifyState.New:
+                                var newContent = new ProjectWorkContent();
+                                newContent.Content = temContent.Content;
+                                newContent.ActualPerformance = temContent.ActualPerformance;
+                                newContent.DifficultFactor = temContent.DifficultFactor;
+                                newContent.FinalPerformance = temContent.FinalPerformance;
+                                newContent.TakeTime = temContent.TakeTime;
+                                newContent.TimeSpan = temContent.TimeSpan;
+                                newContent.WorkDate = temContent.WorkDate;
+                                newContent.ContentRecordId = saveObj.ProjectContentRecord.Id;
+
+                                Context.ProjectWorkContents.Add(newContent);
+                                break;
+                        }
+                        Context.SaveChanges();
+                    }
+
+                    t.Commit();
+                }
+                catch(Exception ex)
+                {
+                    t.Rollback();
+                    ret.Success = false;
+                    ret.ErrorMessage = ex.Message;
+                }
+            }
+
+            return ret;
+        }
+
+        public ApiSaveResponse SubmitToReview(int Id, int reviewerId)
+        {
+            ApiSaveResponse ret = new ApiSaveResponse();
+            ret.Success = true;
+            using (var t = Context.Database.BeginTransaction())
+            {
+                try
+                {
+                    var temObj = Context.ProjectContentRecords.FirstOrDefault(p=>p.Id == Id);
+                    
+
+                    if(temObj != null)
+                    {
+                        temObj.State = 1;
+
+                        var temStaff = Context.Staffs.FirstOrDefault(s=>s.Id == reviewerId);
+
+                        if(temStaff == null)
+                        {
+                            ret.Success = false;
+                            ret.ErrorMessage = "指定审核人不存在!";
+                            return ret;
+                        }
+
+                        var calMonth = Context.CalMonths.FirstOrDefault(f=>f.Status ==0);
+
+                        if(calMonth == null)
+                        {
+                            ret.Success = false;
+                            ret.ErrorMessage = "当前没有正在处理的绩效核算月份!";
+                            return ret;
+                        }
+
+                        temObj.ReviewerId = reviewerId;
+                        temObj.CalMonthId = calMonth.Id;
+                        Context.SaveChanges();
+                        t.Commit();
+
+                        #region 邮件通知
+                        string strSubject = $"{User.Identity.Name}{calMonth.Month}月份专案工作内容";
+                        string strBody = $"<html><body>{temStaff.Name},您好!<br/></br/>&nbsp;&nbsp;&nbsp;&nbsp;<div>{User.Identity.Name}提交了专案{temObj.ProjectNo} {calMonth.Year}年{calMonth.Month}月工作内容,请在尽快确认完成!</div></body></html>";
+                        string strTo = temStaff.Mail;
+
+                        _ = QuartzUtil.AddMailJob(strSubject, strBody, temStaff.Name, strTo);
+                        #endregion
+                    }
+                    else
+                    {
+                        ret.Success = false;
+                        ret.ErrorMessage = "指定项目工作内容Id不存在!";
+                        return ret;
+                    }
+                }
+                catch (Exception ex)
+                {
+                    t.Rollback();
+                    ret.Success = false;
+                    ret.ErrorMessage = ex.Message;
+                }
+            }
+
+            return ret;
         }
     }
 }

+ 4 - 1
wispro.sp.api/Controllers/StaffController.cs

@@ -161,7 +161,10 @@ namespace wispro.sp.api.Controllers
             }
         }
 
-
+        public Staff GetUser(int Id)
+        {
+            return Context.Staffs.FirstOrDefault(p=>p.Id == Id);
+        }
         public ListApiResponse<Staff> Query(int pageIndex,int pageSize)
         {
             ListApiResponse<Staff> ret = new ListApiResponse<Staff>();

+ 33 - 4
wispro.sp.api/Job/ImportReportJob.cs

@@ -192,12 +192,33 @@ namespace wispro.sp.api.Job
 
                 System.IO.File.Move(strFilePath, strFinalPath);
             }
-            List<BasePointRule> rules = spDb.BasePointRules.ToList<BasePointRule>();
+
+            //List<BasePointRule> rules = spDb.BasePointRules.ToList<BasePointRule>();
             foreach (var item in pfItems)
             {
-                SavePerformanceItem(item, rules);
+                SaveProjectItem(item);
+            }
+
+        }
+
+        private void SaveProjectItem(PerformanceItem item)
+        {
+            var temObj = spDb.ProjectInfos.FirstOrDefault(p=>p.CaseNo == item.CaseNo);
+
+            if (temObj == null)
+            {
+                ProjectInfo project = new ProjectInfo();
+                project.CaseNo = item.CaseNo;
+                project.CaseName = item.CaseName;
+                project.CaseState = 0;
+                project.CaseType = item.CaseType;
+                project.CustomerId = item.CustomerId;
+                project.ReviewerId = item.ReviewerId;
+
+                spDb.ProjectInfos.Add(project);
             }
 
+            spDb.SaveChanges();
         }
 
         private List<PerformanceItem> GetProjectItem(string strPath,CalMonth calMonth,bool isOpenSheet)
@@ -220,8 +241,6 @@ namespace wispro.sp.api.Job
             new ExcelHelper().MerageDataTable(temdt, dt);
             #endregion
 
-            
-
             List<PerformanceItem> Items = new List<PerformanceItem>();
             int iRow = 0;
             foreach (DataRow row in temdt.Rows)
@@ -404,6 +423,11 @@ namespace wispro.sp.api.Job
                 }
             }
 
+            if (row.Table.Columns.Contains("流程负责人"))
+            {
+                item.WorkflowUserId  = GetStaff(row["流程负责人"].ToString().Trim());
+            }
+           
             return item;
         }
         private PerformanceItem Row2Item_2(DataRow row, CalMonth calMonth)
@@ -510,6 +534,11 @@ namespace wispro.sp.api.Job
                 }
             }
 
+            if (row.Table.Columns.Contains("流程负责人"))
+            {
+                item.WorkflowUserId = GetStaff(row["流程负责人"].ToString().Trim());
+            }
+
             return item;
         }
         private PerformanceItem Row2Item_1(DataRow row,  CalMonth calMonth)

+ 1 - 1
wispro.sp.utility/ExcelHelper.cs

@@ -269,7 +269,7 @@ namespace wispro.sp.utility
             {
                 iRow++;
                 
-                //判断是否有相同的记录,我方文号+处理事项+处理人相同
+                //判断是否有相同的记录,我方文号+处理事项+处理人相同+案件阶段
                 DataRow oldRow = isExists(row, retDt);
                 if (oldRow == null)
                 {

+ 50 - 0
wispro.sp.web/Components/SubmitWorkContent.razor

@@ -0,0 +1,50 @@
+@inherits FeedbackComponent<ProjectContentRecord>
+
+<Card>
+    <Form Size="@AntSizeLDSType.Small" Model="_Model">
+        <FormItem Label="我方文号">
+            <span>@_Model.ProjectNo</span>
+        </FormItem>
+        @if (_Model.Project != null)
+        {
+            <FormItem Label="案件名称">
+                <span>@_Model.Project.CaseName</span>
+            </FormItem>
+            <FormItem Label="客户">
+                <span>@_Model.Project.Customer.Name</span>
+            </FormItem>
+        }
+    </Form>
+</Card>
+<Card Title="工作内容清单">
+        @if (_Model.ProjectWorkContents != null)
+        {
+            <AntDesign.Table TItem="ProjectWorkContent"
+                             DataSource="_Model.ProjectWorkContents"
+                             Bordered=@true
+                             Size=@TableSize.Small>
+                <RowTemplate Context="pp">
+                    <AntDesign.Column Title="工作内容" TData="string">
+                            <span>@pp.Content</span>
+                    </AntDesign.Column>
+                    <AntDesign.Column Title="工作日期" TData="string">
+                            <span>@pp.WorkDate.ToString("yyyy-MM-dd")</span>
+                    </AntDesign.Column>
+                    <AntDesign.Column Title="时间跨度" TData="string">
+                            <span>@(pp.TimeSpan)天</span>
+                    </AntDesign.Column>
+                    <AntDesign.Column Title="耗时" TData="string">
+                            <span>@(pp.TakeTime)小时</span>
+                    </AntDesign.Column>
+                </RowTemplate>
+            </AntDesign.Table>
+        }
+    
+</Card>
+<Card>
+    <Form Model="_Model">
+        <FormItem Label="请谁审核">
+            <StaffSelect @bind-StaffId="_Model.Project.ReviewerId" StaffLists="Staffs" />
+        </FormItem>
+    </Form>
+</Card>

+ 38 - 0
wispro.sp.web/Components/SubmitWorkContent.razor.cs

@@ -0,0 +1,38 @@
+using AntDesign;
+using Microsoft.AspNetCore.Components;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using wispro.sp.entity;
+using wispro.sp.web.Services;
+
+namespace wispro.sp.web.Components
+{
+    public partial class SubmitWorkContent
+    {
+        ProjectContentRecord _Model;
+        private IFeedbackRef feedbackRef;
+        
+        [Inject] IUserService _UserService { get; set; }
+
+        List<Staff> Staffs;
+        
+        protected override async void OnInitialized()
+        {
+            _Model = base.Options ?? new ProjectContentRecord();
+            
+            if (_Model.ReviewerId.HasValue && _Model.Reviewer == null)
+            {
+                _Model.Reviewer = await _UserService.GetUser(_Model.ReviewerId.Value);
+            }
+
+            Staffs = await _UserService.GetAll();
+
+            base.OnInitialized();
+            feedbackRef = base.FeedbackRef;
+            StateHasChanged();
+        }
+        
+    }
+}

+ 134 - 117
wispro.sp.web/Pages/Project/AssignPoint.razor

@@ -14,129 +14,146 @@
     <Content></Content>
     <ChildContent>
         <Card>
-            <Card>
-                <Form Model="task">
-                    <FormItem Label="我方文号">
-                        <Select DataSource="@ProjectInfos"
-                                @bind-Value="@task.ProjectContentRecord.ProjectNo"
-                                LabelName="@nameof(wispro.sp.entity.ProjectInfo.CaseNo)"
-                                ValueName="@nameof(wispro.sp.entity.ProjectInfo.CaseNo)"
-                                Style="width: 200px"
-                                Placeholder="请选择"
-                                IgnoreItemChanges="false"
-                                EnableSearch="true"
-                                AllowClear
-                                OnSelectedItemChanged="OnSelectedItemChangedHandler"
-                                OnSearch="OnSearch"
-                                DefaultActiveFirstOption
-                                >
-                        </Select>
-                    </FormItem>
+            @if (isLoading)
+            {
+                <Spin></Spin>
+            }
+            else
+            {
+                //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(task));
+                //Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(ProjectInfos));
+                <Card>
+                    <Form Model="task">
+                        @if (!Id.HasValue)
+                        {
+                            <FormItem Label="我方文号">
+                                <Select DataSource="@ProjectInfos"
+                                        @bind-Value="@task.ProjectContentRecord.ProjectNo"
+                                        LabelName="@nameof(wispro.sp.entity.ProjectInfo.CaseNo)"
+                                        ValueName="@nameof(wispro.sp.entity.ProjectInfo.CaseNo)"
+                                        Style="width: 200px"
+                                        Placeholder="请选择"
+                                        IgnoreItemChanges="false"
+                                        EnableSearch="true"
+                                        AllowClear
+                                        OnSelectedItemChanged="OnSelectedItemChangedHandler"
+                                        OnSearch="OnSearch"
+                                        DefaultActiveFirstOption>
+                                </Select>
+                            </FormItem>
+                        }
+                        else
+                        {
+                            <FormItem Label="我方文号">
+                                <span>@task.ProjectContentRecord.ProjectNo</span>
+                            </FormItem>
+                        }
 
-                    @if (task.ProjectContentRecord.Project != null)
-                    {
-                        <FormItem Label="案件名称">
-                            <span>@task.ProjectContentRecord.Project.CaseName</span>
-                        </FormItem>
-                        <Collapse DefaultActiveKey="@(new[]{"1"})">
-                            <Panel Header="项目详情" Key="1">
-                                <FormItem Label="业务类型">
-                                    <span>@task.ProjectContentRecord.Project.BusinessType</span>
-                                </FormItem>
-                                <FormItem Label="客户">
-                                    <span>@task.ProjectContentRecord.Project.Customer.Name</span>
-                                </FormItem>
-                            </Panel>
-                        </Collapse>
-                    }
-                </Form>
-            </Card>
-            <Card Title="工作内容清单">
-                <Extra>
-                    <Button OnClick="AddNew" Type="@ButtonType.Primary">添加</Button>
-                </Extra>
-                <Body>
-                    @if (task.ProjectWorkContents != null)
-                    {
-                        <AntDesign.Table TItem="wispro.sp.entity.ProjectWorkContent"
-                                         DataSource="task.ProjectWorkContents"
-                                         Bordered=@true
-                                         Size=@TableSize.Small>
-                            <RowTemplate Context="pp">
-                                <AntDesign.Column Title="工作内容" TData="string">
-                                    @if (addDoItem == pp)
-                                    {
-                                        <TextArea Rows="2" @bind-Value="@pp.Content" />
-                                    }
-                                    else
-                                    {
-                                        <span>@pp.Content</span>
-                                    }
-                                </AntDesign.Column>
-                                <AntDesign.Column Title="工作日期" TData="string">
-                                    @if (addDoItem == pp)
-                                    {
-                                        <DatePicker TValue="DateTime" Picker="@DatePickerType.Date" @bind-Value="pp.WorkDate" />
+                        @if (task.ProjectContentRecord.Project != null)
+                        {
+                            <FormItem Label="案件名称">
+                                <span>@task.ProjectContentRecord.Project.CaseName</span>
+                            </FormItem>
+                            <Collapse DefaultActiveKey="@(new[] { "1" })">
+                                <Panel Header="项目详情" Key="1">
+                                    <FormItem Label="业务类型">
+                                        <span>@task.ProjectContentRecord.Project.BusinessType</span>
+                                    </FormItem>
+                                    <FormItem Label="客户">
+                                        <span>@task.ProjectContentRecord.Project.Customer.Name</span>
+                                    </FormItem>
+                                </Panel>
+                            </Collapse>
+                        }
+                    </Form>
+                </Card>
+                <Card Title="工作内容清单">
+                    <Extra>
+                        <Button OnClick="AddNew" Type="@ButtonType.Primary">添加</Button>
+                    </Extra>
+                    <Body>
+                        @if (task.ProjectWorkContents != null)
+                        {
+                            <AntDesign.Table TItem="share.ViewProjectWorkContent"
+                                             DataSource="_ShowWorkContent"
+                                             Bordered=@true
+                                             Size=@TableSize.Small>
+                                <RowTemplate Context="pp">
+                                    <AntDesign.Column Title="工作内容" TData="string">
+                                        @if (addDoItem == pp)
+                                        {
+                                            <TextArea Rows="2" @bind-Value="@pp.Content" />
+                                        }
+                                        else
+                                        {
+                                            <span>@pp.Content</span>
+                                        }
+                                    </AntDesign.Column>
+                                    <AntDesign.Column Title="工作日期" TData="string">
+                                        @if (addDoItem == pp)
+                                        {
+                                            <DatePicker TValue="DateTime" Picker="@DatePickerType.Date" @bind-Value="pp.WorkDate" />
 
-                                    }
-                                    else
-                                    {
-                                        <span>@pp.WorkDate.ToString("yyyy-MM-dd")</span>
-                                    }
-                                </AntDesign.Column>
-                                <AntDesign.Column Title="时间跨度" TData="string">
-                                    @if (addDoItem == pp)
-                                    {
-                                        <AntDesign.InputNumber @bind-Value="pp.TimeSpan" Min="1" Max="10" DefaultValue="1"></AntDesign.InputNumber>
-                                        <span>天</span>
+                                        }
+                                        else
+                                        {
+                                            <span>@pp.WorkDate.ToString("yyyy-MM-dd")</span>
+                                        }
+                                    </AntDesign.Column>
+                                    <AntDesign.Column Title="时间跨度" TData="string">
+                                        @if (addDoItem == pp)
+                                        {
+                                            <AntDesign.InputNumber @bind-Value="pp.TimeSpan" Min="1" Max="60" DefaultValue="1"></AntDesign.InputNumber>
+                                            <span>天</span>
 
-                                    }
-                                    else
-                                    {
-                                        <span>@(pp.TimeSpan)天</span>
-                                    }
-                                </AntDesign.Column>
-                                <AntDesign.Column Title="耗时" TData="string">
-                                    @if (addDoItem == pp)
-                                    {
-                                        <AntDesign.InputNumber Step="0.1" Min="-1" Max="160" @bind-Value="pp.TakeTime" /><span>小时</span>
-                                    }
-                                    else
-                                    {
-                                        <span>@(pp.TakeTime)小时</span>
-                                    }
-                                </AntDesign.Column>
-                                <ActionColumn>
-                                    @if (addDoItem == pp)
-                                    {
-                                        <Space>
-                                            <SpaceItem><Button OnClick="() => stopEdit()" Type="@ButtonType.Text">保存</Button></SpaceItem>
-                                            <SpaceItem><Button Danger OnClick="() => DeleteDoItem(pp)" Type="@ButtonType.Text">取消</Button></SpaceItem>
-                                        </Space>
-                                    }
-                                    else
-                                    {
-                                        <Space>
-                                            <SpaceItem><Button OnClick="() => EditDoItem(pp)" Type="@ButtonType.Text">修改</Button></SpaceItem>
-                                            <SpaceItem><Button Danger OnClick="() => DeleteDoItem(pp)" Type="@ButtonType.Text">删除</Button></SpaceItem>
-                                        </Space>
-                                    }
+                                        }
+                                        else
+                                        {
+                                            <span>@(pp.TimeSpan)天</span>
+                                        }
+                                    </AntDesign.Column>
+                                    <AntDesign.Column Title="耗时" TData="string">
+                                        @if (addDoItem == pp)
+                                        {
+                                            <AntDesign.InputNumber Step="0.1" Min="-1" Max="160" @bind-Value="pp.TakeTime" /><span>小时</span>
+                                        }
+                                        else
+                                        {
+                                            <span>@(pp.TakeTime)小时</span>
+                                        }
+                                    </AntDesign.Column>
+                                    <ActionColumn>
+                                        @if (addDoItem == pp)
+                                        {
+                                            <Space>
+                                                <SpaceItem><Button OnClick="() => stopEdit()" Type="@ButtonType.Text">保存</Button></SpaceItem>
+                                                <SpaceItem><Button Danger OnClick="() => DeleteDoItem(pp)" Type="@ButtonType.Text">取消</Button></SpaceItem>
+                                            </Space>
+                                        }
+                                        else
+                                        {
+                                            <Space>
+                                                <SpaceItem><Button OnClick="() => EditDoItem(pp)" Type="@ButtonType.Text">修改</Button></SpaceItem>
+                                                <SpaceItem><Button Danger OnClick="() => DeleteDoItem(pp)" Type="@ButtonType.Text">删除</Button></SpaceItem>
+                                            </Space>
+                                        }
 
-                                </ActionColumn>
-                            </RowTemplate>
+                                    </ActionColumn>
+                                </RowTemplate>
 
-                        </AntDesign.Table>
-                    }
-                </Body>
-            </Card>
-            
-            <Card>
-                <Space Style="float:right">
-                    <SpaceItem><Button Type="primary" Icon="save" OnClick="OnSave" Style="float:right">保存</Button></SpaceItem>
-                    <SpaceItem><Button Icon="cancel" OnClick="OnCancel" Style="float:right">取消</Button></SpaceItem>
-                </Space>
+                            </AntDesign.Table>
+                        }
+                    </Body>
+                </Card>
+
+                <Card>
+                    <Space Style="float:right">
+                        <SpaceItem><Button Type="primary" Icon="save" OnClick="OnSave" Style="float:right">保存</Button></SpaceItem>
+                        <SpaceItem><Button Icon="cancel" OnClick="OnCancel" Style="float:right">取消</Button></SpaceItem>
+                    </Space>
+                </Card>
+            }
             </Card>
-        </Card>
         
     </ChildContent>
 </PageContainer>

+ 37 - 28
wispro.sp.web/Pages/Project/AssignPoint.razor.cs

@@ -32,9 +32,12 @@ namespace wispro.sp.web.Pages.Project
 
         ViewProjectWorkContent addDoItem;
 
+        bool isLoading = false;
+
         [Parameter]
         public int? Id { get; set; }
 
+        
 
         private void AddNew()
         {
@@ -42,20 +45,26 @@ namespace wispro.sp.web.Pages.Project
             addDoItem.modifyState = ModifyState.New;
 
             task.ProjectWorkContents.Add(addDoItem);
-            _ShowWorkContent = task.ProjectWorkContents.Where(p => p.modifyState != ModifyState.Deleted).ToList();
+            _ShowWorkContent = GetShowWorkContents();
         }
 
         protected async override Task OnInitializedAsync()
         {
+            isLoading = true;
             ProjectInfos =await _itemService.GetProjectInfos(0);
             ShowProjectInfos = ProjectInfos;
 
             if (Id.HasValue)
             {
                 task = await _itemService.getProjectWorkContent(Id.Value);
+
+                _ShowWorkContent = GetShowWorkContents();
             }
 
+
             await base.OnInitializedAsync();
+
+            isLoading = false;
         }
 
         private void OnSelectedItemChangedHandler(ProjectInfo value)
@@ -89,52 +98,52 @@ namespace wispro.sp.web.Pages.Project
             {
                 task.ProjectWorkContents.Remove(pw);
             }
+
+            _ShowWorkContent = GetShowWorkContents();
         }
 
         void stopEdit()
         {
+            if(addDoItem.modifyState != ModifyState.New)
+            {
+                addDoItem.modifyState = ModifyState.Modified;
+            }
+            
             addDoItem = null;
         }
 
-        void DeleteDoItem(ProjectWorkContent pp)
+        void DeleteDoItem(ViewProjectWorkContent pp)
         {
-            task.ProjectWorkContents.Remove(pp);
+            pp.modifyState = ModifyState.Deleted;
+            //task.ProjectWorkContents.Remove(pp);
+            _ShowWorkContent = GetShowWorkContents();
         }
 
-        void EditDoItem(ProjectWorkContent pp)
+        void EditDoItem(ViewProjectWorkContent pp)
         {
             addDoItem = pp;
         }
 
-        
-        void addRow()
-        {
-            if (task.ProjectWorkContents == null)
-            {
-                task.ProjectWorkContents = new List<ProjectWorkContent>();
-
-            }
 
-            addDoItem = new ProjectWorkContent();
-            task.ProjectWorkContents.Add(addDoItem);
-            
-            StateHasChanged();
+        private List<ViewProjectWorkContent> GetShowWorkContents()
+        {
+            return task.ProjectWorkContents.Where(p => p.modifyState != ModifyState.Deleted).ToList();
         }
-
+       
         async Task OnSave()
         {
             //添加保存代码
-            //var response = await _itemService.AddProjectPerformanctItem(task);
-
-            //if (response.Success)
-            //{
-            //    await MsgSvr.Info("项目绩效保存成功!");
-            //    _NavigationManager.NavigateTo("/MyCaseList");
-            //}
-            //else
-            //{
-            //    await MsgSvr.Error(response.ErrorMessage);
-            //}
+
+            var response = await _itemService.SaveContent(task);
+
+            if (response.Success)
+            {
+                await MsgSvr.Info("保存成功!");
+            }
+            else
+            {
+                await MsgSvr.Error(response.ErrorMessage);
+            }
 
             _NavigationManager.NavigateTo("/Project/MyProjects");
 

+ 8 - 2
wispro.sp.web/Pages/Project/MyProject.razor

@@ -38,14 +38,20 @@
             <AntDesign.Column Title="我方文号" @bind-Field="@context.ProjectNo" Sortable Filterable />
             <AntDesign.Column Title="案件名称" DataIndex="Project.CaseName" TData="string" Sortable Filterable />
             <AntDesign.Column Title="案件类型" DataIndex="Project.CaseType" TData="string" Sortable Filterable />
-            <AntDesign.Column Title="业务类型" DataIndex="Project.BusinessType" TData="string" Sortable Filterable />
             <AntDesign.Column Title="客户" DataIndex="Project.Customer.Name" TData="string" Sortable Filterable />
             <AntDesign.Column Title="绩效月份" TData="string" Sortable Filterable>
-                @($"{context.CalMonth.Year}年{context.CalMonth.Month}月")
+                @if (context.CalMonth != null)
+                {
+                    @($"{context.CalMonth.Year}年{context.CalMonth.Month}月")
+                }
             </AntDesign.Column>
             <AntDesign.Column Title="最终绩效" TData="string">
                 @($"{context.Point}{context.CaseCoefficient}")
             </AntDesign.Column>
+            <AntDesign.Column Title="业务类型" DataIndex="Project.BusinessType" TData="string" Sortable Filterable />
+            <AntDesign.Column Title="状态" TData="string">
+                @getStatus(context.State)
+            </AntDesign.Column>
             <ActionColumn>
                 <Space>
                     @if (context.State == 0)

+ 88 - 2
wispro.sp.web/Pages/Project/MyProject.razor.cs

@@ -17,12 +17,34 @@ namespace wispro.sp.web.Pages.Project
         int _total = 0;
         bool _loading = false;
 
+        private ModalRef _modalRef;
+
         [Inject] protected PerformanceItemServices _itemService { get; set; }
         [Inject] public MessageService MsgSvr { get; set; }
         [Inject] NavigationManager _NavigationManager { get; set; }
 
-        
+        [Inject] ModalService _ModalService { get; set; }
+
+        [Inject] MessageService _msgService { get; set; }
+
 
+        private string getStatus(int state)
+        {
+            switch (state)
+            {
+                case 0:
+                    return "未提交";
+                    break;
+                case 1:
+                    return "待审核";
+                    break;
+                case 2:
+                    return "已审核";
+                    break;
+                default:
+                    return "";
+            }
+        }
         protected async override Task OnInitializedAsync()
         {
             ProjectInfos = await _itemService.GetMyProjects();
@@ -70,9 +92,73 @@ namespace wispro.sp.web.Pages.Project
             _NavigationManager.NavigateTo($"/Project/WorkContent/{projectContent.Id}");
         }
 
-        public void Submit(ProjectContentRecord projectContent)
+        async void Submit(ProjectContentRecord projectContent)
         {
+            var modalConfig = new ModalOptions();
+            modalConfig.Title = $"{projectContent.Project.CaseNo}工作内容提交审核";
+            modalConfig.Width = 850;
+            //modalConfig.Footer = null;
+            modalConfig.DestroyOnClose = true;
+            modalConfig.MaskClosable = false;
+            modalConfig.OkText = "提交";
+            modalConfig.CancelText = "取消";
+
+            _modalRef = await _ModalService
+                .CreateModalAsync<Components.SubmitWorkContent, ProjectContentRecord>(modalConfig, projectContent);
+
+            _modalRef.OnOpen = () =>
+            {
+                return Task.CompletedTask;
+            };
 
+            _modalRef.OnOk = async () =>
+            {
+                try
+                {
+                    if (projectContent.Project.ReviewerId.HasValue)
+                    {
+                        await _itemService.SubmitToReview(projectContent.Id, projectContent.Project.ReviewerId.Value);
+
+                        var SuccessConfig = new ConfirmOptions()
+                        {
+                            Content = @"提交成功!"
+                        };
+                       
+                        modalConfig.DestroyOnClose = true;
+                        _ModalService.Success(SuccessConfig);
+
+                        ProjectInfos = await _itemService.GetMyProjects();
+                    }
+                    else
+                    {
+                        _ModalService.Info(new ConfirmOptions()
+                        {
+                            Content = "请选择审核人员!",
+                        });
+                    }
+                }
+                catch (Exception ex)
+                {
+                    _ModalService.Error(new ConfirmOptions()
+                    {
+                        Title = "错误",
+                        Content = ex.Message,
+                    });
+
+                }
+
+            };
+
+            _modalRef.OnCancel = () =>
+            {
+                return Task.CompletedTask;
+            };
+
+            _modalRef.OnClose = () =>
+            {
+                return Task.CompletedTask;
+            };
+            StateHasChanged();
         }
     }
 }

+ 15 - 1
wispro.sp.web/Services/PerformanceItemServices.cs

@@ -99,6 +99,8 @@ namespace wispro.sp.web.Services
 
         }
 
+        
+
         public async Task<ListApiResponse<PerformanceItem>> Query(CalMonth calMonth, QueryModel<PerformanceItem> queryModel)
         {
             QueryFilter query = new QueryFilter();
@@ -331,7 +333,19 @@ namespace wispro.sp.web.Services
 
         public async Task<ProjectContents> getProjectWorkContent(int value)
         {
-            var data = await _httpClient.Get<ProjectContents>($"PerformanceItem/getProjectWorkContent?Id={value}");
+            var data = await _httpClient.Get<ProjectContents>($"Project/getProjectWorkContent?Id={value}");
+            return data;
+        }
+
+        public async Task<ApiSaveResponse> SaveContent(ProjectContents task)
+        {
+            var response =await  _httpClient.Post<ApiSaveResponse>("Project/SaveProjectWorkContent", task);
+            return response;
+        }
+
+        public async Task<ApiSaveResponse> SubmitToReview(int Id,int ReviewerId)
+        {
+            var data = await _httpClient.Get<ApiSaveResponse>($"Project/SubmitToReview?Id={Id}&&reviewerId={ReviewerId}");
             return data;
         }
     }

+ 22 - 0
wispro.sp.web/Services/UserService.cs

@@ -23,6 +23,8 @@ namespace wispro.sp.web.Services
 
         Task<CurrentUser> GetUser();
         Task<List<Staff>> GetReviewers(int? itemId, int appealTypeId);
+
+        Task<Staff> GetUser(int staffId);
     }
 
     public class UserService : IUserService
@@ -105,5 +107,25 @@ namespace wispro.sp.web.Services
 
             }
         }
+
+        public async Task<Staff> GetUser(int staffId)
+        {
+            try
+            {
+                var staff = await _httpClient.Get<Staff>($"Staff/GetUser?Id={staffId}");
+                return staff;
+            }
+            catch (Exception ex)
+            {
+                if (ex.Message.Contains("Unauthorized"))
+                {
+                    _jwt.NotifyUserLogOut();
+                }
+
+                return null;
+
+            }
+        }
+
     }
 }

+ 2 - 2
wospro.sp.entity/ProjectContentRecord.cs

@@ -32,14 +32,14 @@ namespace wispro.sp.entity
         /// </summary>
         public Staff Reviewer { get; set; }
 
-        public int ReviewerId { get; set; }
+        public int? ReviewerId { get; set; }
 
         /// <summary>
         /// 绩效月份
         /// </summary>
         public CalMonth CalMonth { get; set; }
 
-        public int CalMonthId { get; set; }
+        public int? CalMonthId { get; set; }
 
         /// <summary>
         /// 提交实际