|
@@ -4,7 +4,12 @@ using Microsoft.AspNetCore.Components.Web;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
+using System.Text.Json;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using wispro.sp.entity;
|
|
|
+using wispro.sp.share;
|
|
|
using wispro.sp.web.Models;
|
|
|
+using wispro.sp.web.Services;
|
|
|
|
|
|
namespace wispro.sp.web.Pages.Project
|
|
|
{
|
|
@@ -12,96 +17,55 @@ namespace wispro.sp.web.Pages.Project
|
|
|
{
|
|
|
[Inject] public MessageService MsgSvr { get; set; }
|
|
|
|
|
|
- [Parameter]
|
|
|
- public string id { get; set; }
|
|
|
+ [Inject] protected PerformanceItemServices _itemService { get; set; }
|
|
|
+ [Inject] NavigationManager _NavigationManager { get; set; }
|
|
|
+
|
|
|
|
|
|
private AntDesign.Modal model;
|
|
|
|
|
|
- Task task = new()
|
|
|
+ ProjectPointRecord task = new()
|
|
|
{
|
|
|
- ProjectInfo = new ProjectInfo()
|
|
|
- {
|
|
|
- CaseNo = "S2112394",
|
|
|
- CaseName = "美的-洗碗机专利调查",
|
|
|
- DoItem = "提出报告",
|
|
|
- DoPerson = new List<string>() { "李申", "何倚雯", "王晴", "陆跃" },
|
|
|
- ResponseMan = "黄瑜"
|
|
|
- },
|
|
|
- Id = 1,
|
|
|
- Name = "2021年9月专案点数分配任务",
|
|
|
- Type = "专案点数分配任务",
|
|
|
- ResponseMan = "黄瑜",
|
|
|
- State = "待处理",
|
|
|
- LimiteDate = DateTime.Now.AddDays(4),
|
|
|
- UIUrl = "/Project/AssignPoint"
|
|
|
- };
|
|
|
-
|
|
|
- List<ProjectPoint> projectPoints=new List<ProjectPoint>() {
|
|
|
- new ProjectPoint(){ doItem="检索条件策略", DoItemCoefficient="B", person="李申", Point=1.0},
|
|
|
- new ProjectPoint(){ doItem="检索条件策略", DoItemCoefficient="B", person="何倚雯", Point=2.0},
|
|
|
- new ProjectPoint(){ doItem="检索条件策略", DoItemCoefficient="B", person="王晴", Point=1.5},
|
|
|
- new ProjectPoint(){ doItem="检索条件策略", DoItemCoefficient="B", person="陆跃", Point=1.0},
|
|
|
- new ProjectPoint(){ doItem="专利分类", DoItemCoefficient="B", person="李申", Point=2.0},
|
|
|
- new ProjectPoint(){ doItem="专利分类", DoItemCoefficient="B", person="何倚雯", Point=1.5},
|
|
|
- new ProjectPoint(){ doItem="专利分类", DoItemCoefficient="B", person="王晴", Point=2.5},
|
|
|
- new ProjectPoint(){ doItem="专利分类", DoItemCoefficient="B", person="陆跃", Point=3.0},
|
|
|
+
|
|
|
+ CaseNo = "S2112394",
|
|
|
+ CaseName = "美的-洗碗机专利调查",
|
|
|
+
|
|
|
+ ProjectDoItemPoints = new List<ProjectDoItemPoint>()
|
|
|
+ {
|
|
|
+ new ProjectDoItemPoint(){ DoItem="检索策略评估", DoItemCoefficient="B",
|
|
|
+ PersonPoints=new List<PersonPoint>{
|
|
|
+ new PersonPoint(){Id="1", Person ="李申", Point=1.0 },
|
|
|
+ new PersonPoint(){Id="2", Person ="张三", Point=1.0 },
|
|
|
+ new PersonPoint(){Id="3", Person ="李四", Point=1.0 },
|
|
|
+ }},
|
|
|
+ new ProjectDoItemPoint(){ DoItem="专利分类", DoItemCoefficient="A",
|
|
|
+ PersonPoints=new List<PersonPoint>{
|
|
|
+ new PersonPoint(){Id="1", Person ="李申", Point=2.0 },
|
|
|
+ new PersonPoint(){Id="2", Person ="张三", Point=1.50 },
|
|
|
+ new PersonPoint(){Id="3", Person ="李四", Point=2.5 },
|
|
|
+ }},
|
|
|
+ }
|
|
|
};
|
|
|
-
|
|
|
-
|
|
|
- private class AddDoItem
|
|
|
- {
|
|
|
- public string Name { get; set; }
|
|
|
-
|
|
|
- public string nanduxishu { get; set; }
|
|
|
|
|
|
- public List<ProjectPoint> AddprojectPoints { get; set; }
|
|
|
- }
|
|
|
-
|
|
|
- private AddDoItem addDoItem;
|
|
|
+ ProjectDoItemPoint addDoItem;
|
|
|
+ bool isAdd = false;
|
|
|
private bool _visible = false;
|
|
|
private void AddNew()
|
|
|
{
|
|
|
- addDoItem = new AddDoItem();
|
|
|
- addDoItem.AddprojectPoints = new List<ProjectPoint>();
|
|
|
- foreach (string name in task.ProjectInfo.DoPerson)
|
|
|
- {
|
|
|
- addDoItem.AddprojectPoints.Add(new ProjectPoint()
|
|
|
- {
|
|
|
- //doItem = addDoItem.nanduxishu,
|
|
|
- //DoItemCoefficient = addDoItem.nanduxishu,
|
|
|
- person = name,
|
|
|
- Point = 0
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- _visible = true;
|
|
|
+ addDoItem = new ProjectDoItemPoint();
|
|
|
+ isAdd = true;
|
|
|
+ _visible = true;
|
|
|
}
|
|
|
|
|
|
private void HandleOk(MouseEventArgs e)
|
|
|
{
|
|
|
-
|
|
|
- if (!string.IsNullOrEmpty(addDoItem.Name))
|
|
|
+ if (isAdd)
|
|
|
{
|
|
|
- List<ProjectPoint> temList = new List<ProjectPoint>();
|
|
|
-
|
|
|
- if(projectPoints== null)
|
|
|
- {
|
|
|
- projectPoints = new List<ProjectPoint>();
|
|
|
- }
|
|
|
-
|
|
|
- if (addDoItem.AddprojectPoints != null)
|
|
|
+ if (!string.IsNullOrEmpty(addDoItem.DoItem))
|
|
|
{
|
|
|
- foreach(ProjectPoint pp in addDoItem.AddprojectPoints)
|
|
|
- {
|
|
|
- pp.doItem = addDoItem.Name;
|
|
|
- pp.DoItemCoefficient = addDoItem.nanduxishu;
|
|
|
- }
|
|
|
-
|
|
|
+ task.ProjectDoItemPoints.Add(addDoItem);
|
|
|
}
|
|
|
-
|
|
|
- projectPoints.AddRange(addDoItem.AddprojectPoints);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
_visible = false;
|
|
|
model.Dispose();
|
|
|
}
|
|
@@ -120,6 +84,12 @@ namespace wispro.sp.web.Pages.Project
|
|
|
MsgSvr.Info($"开始编辑{editId}");
|
|
|
}
|
|
|
|
|
|
+ void deletePersonPoint(string id)
|
|
|
+ {
|
|
|
+ var delObj = addDoItem.PersonPoints.FirstOrDefault<PersonPoint>(f => f.Id == id);
|
|
|
+ addDoItem.PersonPoints.Remove(delObj);
|
|
|
+ }
|
|
|
+
|
|
|
void stopEdit()
|
|
|
{
|
|
|
//var editedData = addDoItem.AddprojectPoints.FirstOrDefault(x => x.person == editId);
|
|
@@ -127,28 +97,89 @@ namespace wispro.sp.web.Pages.Project
|
|
|
editId = null;
|
|
|
}
|
|
|
|
|
|
- void Delete(string id)
|
|
|
+ void Delete(string doItem, string person)
|
|
|
{
|
|
|
+ Console.WriteLine(JsonSerializer.Serialize(task));
|
|
|
if (_visible)
|
|
|
{
|
|
|
- var editedData = addDoItem.AddprojectPoints.FirstOrDefault(x => x.person == id);
|
|
|
- addDoItem.AddprojectPoints.Remove(editedData);
|
|
|
+ var editedData = addDoItem.PersonPoints.FirstOrDefault(x => x.Person == person);
|
|
|
+ addDoItem.PersonPoints.Remove(editedData);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- var editedData = projectPoints.FirstOrDefault(x => x.person == id);
|
|
|
- projectPoints.Remove(editedData);
|
|
|
+
|
|
|
+ var editedData = task.ProjectDoItemPoints .FirstOrDefault(x => x.DoItem == doItem);
|
|
|
+ Console.WriteLine(JsonSerializer.Serialize(editedData));
|
|
|
+ var personPoint = editedData.PersonPoints.FirstOrDefault(x => x.Id == person);
|
|
|
+ Console.WriteLine(JsonSerializer.Serialize(personPoint));
|
|
|
+ editedData.PersonPoints.Remove(personPoint);
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+ Console.WriteLine(JsonSerializer.Serialize(task));
|
|
|
+ StateHasChanged();
|
|
|
}
|
|
|
|
|
|
- void OnSave()
|
|
|
+ void DeleteDoItem(string doItem)
|
|
|
+ {
|
|
|
+ var delData = task.ProjectDoItemPoints.FirstOrDefault(x => x.DoItem == doItem);
|
|
|
+ task.ProjectDoItemPoints.Remove(delData);
|
|
|
+ }
|
|
|
+
|
|
|
+ void EditDoItem(string doItem)
|
|
|
+ {
|
|
|
+ isAdd = false;
|
|
|
+ addDoItem = task.ProjectDoItemPoints.FirstOrDefault(x => x.DoItem == doItem);
|
|
|
+ _visible = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ private string GetId(List<PersonPoint> personPoints)
|
|
|
+ {
|
|
|
+ int i = personPoints.Count;
|
|
|
+
|
|
|
+ begin:
|
|
|
+ foreach(var pp in personPoints)
|
|
|
+ {
|
|
|
+ if(pp.Id == i.ToString())
|
|
|
+ {
|
|
|
+ i++;
|
|
|
+ goto begin;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return i.ToString();
|
|
|
+
|
|
|
+ }
|
|
|
+ void addRow()
|
|
|
+ {
|
|
|
+ if(addDoItem.PersonPoints == null)
|
|
|
+ {
|
|
|
+ addDoItem.PersonPoints = new List<PersonPoint>();
|
|
|
+ }
|
|
|
+
|
|
|
+ string strId = GetId(addDoItem.PersonPoints);
|
|
|
+
|
|
|
+ addDoItem.PersonPoints.Add(
|
|
|
+ new PersonPoint() { Id = strId, Person ="修改处理人姓名", Point = 0}
|
|
|
+ ) ;
|
|
|
+ editId = strId;
|
|
|
+ StateHasChanged();
|
|
|
+ }
|
|
|
+
|
|
|
+ async Task OnSave()
|
|
|
{
|
|
|
//添加保存代码
|
|
|
+ await _itemService.AddProjectPerformanctItem(task);
|
|
|
+ await MsgSvr.Info("项目绩效保存成功!");
|
|
|
+ _NavigationManager.NavigateTo("/MyCaseList");
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void OnCancel()
|
|
|
{
|
|
|
-
|
|
|
+ _NavigationManager.NavigateTo("/MyCaseList");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|