Browse Source

完成比价分配

master
С·æ 4 years ago
parent
commit
e12f540652
  1. 84
      src/Coldairarrow.Api/Controllers/HuiYan/pricetasklogController.cs
  2. 65
      src/Coldairarrow.Api/Controllers/MDS/userController.cs
  3. 65
      src/Coldairarrow.Api/Controllers/MDS/userdepartmentController.cs
  4. 65
      src/Coldairarrow.Api/Controllers/MDS/userroleController.cs
  5. 4
      src/Coldairarrow.Api/Program.cs
  6. 5
      src/Coldairarrow.Api/Startup.cs
  7. 6
      src/Coldairarrow.Api/appsettings.json
  8. 1
      src/Coldairarrow.Business/HuiYan/catsBusiness.cs
  9. 184
      src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs
  10. 12
      src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs
  11. 93
      src/Coldairarrow.Business/MDS/userBusiness.cs
  12. 66
      src/Coldairarrow.Business/MDS/userdepartmentBusiness.cs
  13. 66
      src/Coldairarrow.Business/MDS/userroleBusiness.cs
  14. 32
      src/Coldairarrow.Entity/DTO/PricetaskUser.cs
  15. 15
      src/Coldairarrow.Entity/DTO/UserRoleDto.cs
  16. 39
      src/Coldairarrow.Entity/Enum/teamItemState.cs
  17. 57
      src/Coldairarrow.Entity/HuiYan/pricetasklog.cs
  18. 4
      src/Coldairarrow.Entity/HuiYan/teamitems.cs
  19. 95
      src/Coldairarrow.Entity/MDS/user.cs
  20. 46
      src/Coldairarrow.Entity/MDS/userdepartment.cs
  21. 56
      src/Coldairarrow.Entity/MDS/userrole.cs
  22. 18
      src/Coldairarrow.IBusiness/HuiYan/IpricetasklogBusiness.cs
  23. 20
      src/Coldairarrow.IBusiness/MDS/IuserBusiness.cs
  24. 16
      src/Coldairarrow.IBusiness/MDS/IuserdepartmentBusiness.cs
  25. 16
      src/Coldairarrow.IBusiness/MDS/IuserroleBusiness.cs
  26. 14
      src/Coldairarrow.Util/DataAccess/IMDSDbAccessor.cs
  27. 89
      src/Coldairarrow.Web/src/views/HuiYan/pricetasklog/EditForm.vue
  28. 162
      src/Coldairarrow.Web/src/views/HuiYan/pricetasklog/List.vue
  29. 110
      src/Coldairarrow.Web/src/views/MDS/user/EditForm.vue
  30. 172
      src/Coldairarrow.Web/src/views/MDS/user/List.vue
  31. 83
      src/Coldairarrow.Web/src/views/MDS/userdepartment/EditForm.vue
  32. 159
      src/Coldairarrow.Web/src/views/MDS/userdepartment/List.vue
  33. 89
      src/Coldairarrow.Web/src/views/MDS/userrole/EditForm.vue
  34. 162
      src/Coldairarrow.Web/src/views/MDS/userrole/List.vue
  35. 47
      客户端/齐越慧眼/齐越慧眼/BrowerHelper.cs
  36. 4
      客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs
  37. 12
      客户端/齐越慧眼/齐越慧眼/UserControls/CatControl.xaml.cs
  38. 13
      客户端/齐越慧眼/齐越慧眼/UserControls/ItemControl.xaml.cs
  39. 3
      客户端/齐越慧眼/齐越慧眼/UserControls/SomeBrowerControl.xaml.cs

84
src/Coldairarrow.Api/Controllers/HuiYan/pricetasklogController.cs

@ -0,0 +1,84 @@
using Coldairarrow.Business.HuiYan;
using Coldairarrow.Business.MDS;
using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.HuiYan;
using Coldairarrow.Entity.MDS;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.HuiYan
{
[Route("/HuiYan/[controller]/[action]")]
public class pricetasklogController : BaseApiController
{
#region DI
IuserBusiness _iuserBusiness;
public pricetasklogController(IpricetasklogBusiness pricetasklogBus, IuserBusiness iuserBusiness)
{
_iuserBusiness = iuserBusiness;
_pricetasklogBus = pricetasklogBus;
}
IpricetasklogBusiness _pricetasklogBus { get; }
#endregion
#region 获取
[HttpPost]
public async Task<PageResult<pricetasklog>> GetDataList(PageInput<ConditionDTO> input)
{
return await _pricetasklogBus.GetDataListAsync(input);
}
[HttpPost]
public async Task<pricetasklog> GetTheData(IdInputDTO input)
{
return await _pricetasklogBus.GetTheDataAsync(input.id);
}
#endregion
#region 提交
[HttpPost]
public async Task SaveData(pricetasklog data)
{
if (data.Id.IsNullOrEmpty())
{
InitEntity(data);
await _pricetasklogBus.AddDataAsync(data);
}
else
{
await _pricetasklogBus.UpdateDataAsync(data);
}
}
[HttpPost]
public async Task DeleteData(List<string> ids)
{
await _pricetasklogBus.DeleteDataAsync(ids);
}
#endregion
/// <summary>
/// 发布比价任务
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet, AllowAnonymous]
public AjaxResult AddTask(string id)
{
return _pricetasklogBus.AddTask(id);
}
}
}

65
src/Coldairarrow.Api/Controllers/MDS/userController.cs

@ -0,0 +1,65 @@
using Coldairarrow.Business.MDS;
using Coldairarrow.Entity.MDS;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.MDS
{
[Route("/MDS/[controller]/[action]")]
public class userController : BaseApiController
{
#region DI
public userController(IuserBusiness userBus)
{
_userBus = userBus;
}
IuserBusiness _userBus { get; }
#endregion
#region 获取
[HttpPost]
public async Task<PageResult<user>> GetDataList(PageInput<ConditionDTO> input)
{
return await _userBus.GetDataListAsync(input);
}
[HttpPost]
public async Task<user> GetTheData(IdInputDTO input)
{
return await _userBus.GetTheDataAsync(input.id);
}
#endregion
#region 提交
[HttpPost]
public async Task SaveData(user data)
{
if (data.Id.IsNullOrEmpty())
{
InitEntity(data);
await _userBus.AddDataAsync(data);
}
else
{
await _userBus.UpdateDataAsync(data);
}
}
[HttpPost]
public async Task DeleteData(List<string> ids)
{
await _userBus.DeleteDataAsync(ids);
}
#endregion
}
}

65
src/Coldairarrow.Api/Controllers/MDS/userdepartmentController.cs

@ -0,0 +1,65 @@
using Coldairarrow.Business.MDS;
using Coldairarrow.Entity.MDS;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.MDS
{
[Route("/MDS/[controller]/[action]")]
public class userdepartmentController : BaseApiController
{
#region DI
public userdepartmentController(IuserdepartmentBusiness userdepartmentBus)
{
_userdepartmentBus = userdepartmentBus;
}
IuserdepartmentBusiness _userdepartmentBus { get; }
#endregion
#region 获取
[HttpPost]
public async Task<PageResult<userdepartment>> GetDataList(PageInput<ConditionDTO> input)
{
return await _userdepartmentBus.GetDataListAsync(input);
}
[HttpPost]
public async Task<userdepartment> GetTheData(IdInputDTO input)
{
return await _userdepartmentBus.GetTheDataAsync(input.id);
}
#endregion
#region 提交
[HttpPost]
public async Task SaveData(userdepartment data)
{
if (data.Id.IsNullOrEmpty())
{
InitEntity(data);
await _userdepartmentBus.AddDataAsync(data);
}
else
{
await _userdepartmentBus.UpdateDataAsync(data);
}
}
[HttpPost]
public async Task DeleteData(List<string> ids)
{
await _userdepartmentBus.DeleteDataAsync(ids);
}
#endregion
}
}

65
src/Coldairarrow.Api/Controllers/MDS/userroleController.cs

@ -0,0 +1,65 @@
using Coldairarrow.Business.MDS;
using Coldairarrow.Entity.MDS;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.MDS
{
[Route("/MDS/[controller]/[action]")]
public class userroleController : BaseApiController
{
#region DI
public userroleController(IuserroleBusiness userroleBus)
{
_userroleBus = userroleBus;
}
IuserroleBusiness _userroleBus { get; }
#endregion
#region 获取
[HttpPost]
public async Task<PageResult<userrole>> GetDataList(PageInput<ConditionDTO> input)
{
return await _userroleBus.GetDataListAsync(input);
}
[HttpPost]
public async Task<userrole> GetTheData(IdInputDTO input)
{
return await _userroleBus.GetTheDataAsync(input.id);
}
#endregion
#region 提交
[HttpPost]
public async Task SaveData(userrole data)
{
if (data.Id.IsNullOrEmpty())
{
InitEntity(data);
await _userroleBus.AddDataAsync(data);
}
else
{
await _userroleBus.UpdateDataAsync(data);
}
}
[HttpPost]
public async Task DeleteData(List<string> ids)
{
await _userroleBus.DeleteDataAsync(ids);
}
#endregion
}
}

4
src/Coldairarrow.Api/Program.cs

@ -1,4 +1,5 @@
using Coldairarrow.Util;
using Coldairarrow.Util.DataAccess;
using Colder.Logging.Serilog;
using EFCore.Sharding;
using Microsoft.AspNetCore.Hosting;
@ -24,8 +25,11 @@ namespace Coldairarrow.Api
config.SetEntityAssemblies(GlobalAssemblies.AllAssemblies);
var dbOptions = hostContext.Configuration.GetSection("Database:BaseDb").Get<DatabaseOptions>();
var dbmdsOptions = hostContext.Configuration.GetSection("MsdDatabase:BaseDb").Get<DatabaseOptions>();
config.UseDatabase(dbOptions.ConnectionString, dbOptions.DatabaseType);
config.UseDatabase<IMDSDbAccessor>(dbmdsOptions.ConnectionString, dbmdsOptions.DatabaseType);
});
})
.ConfigureWebHostDefaults(webBuilder =>

5
src/Coldairarrow.Api/Startup.cs

@ -1,4 +1,5 @@
using Coldairarrow.Util;
using Coldairarrow.Util.DataAccess;
using EFCore.Sharding;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@ -22,6 +23,10 @@ namespace Coldairarrow.Api
public void ConfigureServices(IServiceCollection services)
{
services.AddEFCoreSharding(config => {
});
services.Configure<ApiBehaviorOptions>(options => options.SuppressModelStateInvalidFilter = true);
services.AddControllers(options =>
{

6
src/Coldairarrow.Api/appsettings.json

@ -48,6 +48,12 @@
//"ConnectionString": "Data Source=127.0.0.1/ORCL;User ID=COLDER.ADMIN.ANTDVUE;Password=123456;Connect Timeout=3"
}
},
"MsdDatabase": {
"BaseDb": {
"DatabaseType": "MySql",
"ConnectionString": "server=rm-bp1508okrh23710yfao.mysql.rds.aliyuncs.com;user id=qyroot;password=kaicn1132+-;persistsecurityinfo=True;database=mds;SslMode=none;AllowLoadLocalInfile=true;ConvertZeroDateTime=True"
}
},
//Id,,,IdId
"WorkerId": 1, //Id
"WebRootUrl": "http://localhost:5000", //,

1
src/Coldairarrow.Business/HuiYan/catsBusiness.cs

@ -19,6 +19,7 @@ namespace Coldairarrow.Business.HuiYan
public catsBusiness(IDbAccessor db, IOperator @operator)
: base(db)
{
_operator = @operator;
}

184
src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs

@ -0,0 +1,184 @@
using Coldairarrow.Business.MDS;
using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.Enum;
using Coldairarrow.Entity.HuiYan;
using Coldairarrow.Entity.MDS;
using Coldairarrow.IBusiness;
using Coldairarrow.Util;
using EFCore.Sharding;
using LinqKit;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace Coldairarrow.Business.HuiYan
{
public class pricetasklogBusiness : BaseBusiness<pricetasklog>, IpricetasklogBusiness, ITransientDependency
{
IuserBusiness _iuserBusiness;
readonly IOperator _operator;
public pricetasklogBusiness(IDbAccessor db, IuserBusiness iuserBusiness,
IOperator @operator)
: base(db)
{
_operator=@operator;
_iuserBusiness = iuserBusiness;
}
#region 外部接口
public async Task<PageResult<pricetasklog>> GetDataListAsync(PageInput<ConditionDTO> input)
{
var q = GetIQueryable();
var where = LinqHelper.True<pricetasklog>();
var search = input.Search;
//筛选
if (!search.Condition.IsNullOrEmpty() && !search.Keyword.IsNullOrEmpty())
{
var newWhere = DynamicExpressionParser.ParseLambda<pricetasklog, bool>(
ParsingConfig.Default, false, $@"{search.Condition}.Contains(@0)", search.Keyword);
where = where.And(newWhere);
}
return await q.Where(where).GetPageResultAsync(input);
}
public async Task<pricetasklog> GetTheDataAsync(string id)
{
return await GetEntityAsync(id);
}
public async Task AddDataAsync(pricetasklog data)
{
await InsertAsync(data);
}
public async Task UpdateDataAsync(pricetasklog data)
{
await UpdateAsync(data);
}
public async Task DeleteDataAsync(List<string> ids)
{
await DeleteAsync(ids);
}
#endregion
public PageResult<TeamitemDto> GetItems(PageInput<ConditionDTO> input)
{
Expression<Func<teamitems, items, TeamitemDto>> select = (a, b) => new TeamitemDto
{
GoodsId = b.GoodsId,
HasFilter = b.HasFilter,
Platform = b.Platform,
GoodsUrl = b.GoodsUrl,
Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(a.ExtensionJson)
};
var search = input.Search;
select = select.BuildExtendSelectExpre();
var q_titem = Db.GetIQueryable<teamitems>();
var q = from a in q_titem.AsExpandable()
join b in Db.GetIQueryable<items>() on a.ItemId equals b.Id into ab
from b in ab.DefaultIfEmpty()
select @select.Invoke(a, b);
//查询对应状态
var where = LinqHelper.True<TeamitemDto>().And(c => c.State == int.Parse(search.Keyword));
where = where.And(c => c.TeamId == _operator.TeamId);
var list = q.Where(where).GetPageResultAsync(input).Result;
return list;
}
/// <summary>
/// 添加比价任务
/// </summary>
/// <returns></returns>
public AjaxResult AddTask(string teamItemId)
{
var teamItem = Db.GetIQueryable<teamitems>().FirstOrDefault(c => c.Id == teamItemId&&c.UserId==_operator.UserId);
if (teamItem == null)
{
return Error("任务不存在!");
}
var users = _iuserBusiness.GetPriceTaskUserList().ToList();
Expression<Func< user, pricetasklog, PricetaskUser >> select = (a, b) => new PricetaskUser()
{
UserName = a.UserName,
MaxTaskCount = a.MaxPriceTaskCount,
Uid=a.Id
};
select = select.BuildExtendSelectExpre();
var q_User = Db.GetIQueryable<pricetasklog>().Where(c => c.CreateTime.Date == DateTime.Now.Date || c.CreateTime == DateTime.MinValue);
var q = from a in users
join b in q_User on a.Id equals b.UserId into ab
from b in ab.DefaultIfEmpty()
select @select.Invoke(a, b);
//获取当日可分配的一个用户
var user = q.GroupBy(c => c.Uid).Where(c => c.Count() < c.FirstOrDefault()?.MaxTaskCount).Select(c => new { Id = c.Key, Count = c.Count() }).OrderBy(c => c.Count).FirstOrDefault();
if (user == null)
{
//钉钉推送
return Error("当前任务量已超过任务池可用任务量!");
}
var result = Db.RunTransaction(() =>
{
int row= Db.Update<teamitems>(c => c.Id == teamItem.Id, (item) => {
item.PriceTaskUserId= user.Id;
item.State = (int)TeamItemState.;
});
if (row <= 0)
throw new Exception("系统繁忙!");
row = Db.Insert(new pricetasklog()
{
CreateTime = DateTime.Now,
Id = IdHelper.GetId(),
CreatorId = _operator.UserId,
Deleted = false,
ItemId = teamItem.ItemId,
UserId = user.Id,
State = PriceTaskState.,
TeamItemId = teamItem.Id
});
if (row <= 0)
throw new Exception("系统任务繁忙!");
});
if (result.Success)
{
return Success("发布任务成功!");
}
return Error(result.ex.Message);
}
#region 私有成员
#endregion
}
}

12
src/Coldairarrow.Business/HuiYan/teamitemsBusiness.cs

@ -1,4 +1,5 @@
using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.Enum;
using Coldairarrow.Entity.HuiYan;
using Coldairarrow.IBusiness;
using Coldairarrow.Util;
@ -89,8 +90,17 @@ namespace Coldairarrow.Business.HuiYan
from b in ab.DefaultIfEmpty()
select @select.Invoke(a, b);
int state = int.Parse(search.Keyword);
//查询对应状态
var where = LinqHelper.True<TeamitemDto>().And(c => c.State == int.Parse(search.Keyword));
var where = LinqHelper.True<TeamitemDto>();
if (state == 0)
{
where = where.And(c => c.State == state || c.State == (int)TeamItemState.);
}
else {
where = where.And(c => c.State == state);
}
where = where.And(c => c.TeamId == _operator.TeamId);

93
src/Coldairarrow.Business/MDS/userBusiness.cs

@ -0,0 +1,93 @@
using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.MDS;
using Coldairarrow.Util;
using Coldairarrow.Util.DataAccess;
using EFCore.Sharding;
using LinqKit;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace Coldairarrow.Business.MDS
{
public class userBusiness : BaseBusiness<user>, IuserBusiness, ITransientDependency
{
public userBusiness(IMDSDbAccessor db)
: base(db)
{
}
#region 外部接口
public async Task<PageResult<user>> GetDataListAsync(PageInput<ConditionDTO> input)
{
var q = GetIQueryable();
var where = LinqHelper.True<user>();
var search = input.Search;
//筛选
if (!search.Condition.IsNullOrEmpty() && !search.Keyword.IsNullOrEmpty())
{
var newWhere = DynamicExpressionParser.ParseLambda<user, bool>(
ParsingConfig.Default, false, $@"{search.Condition}.Contains(@0)", search.Keyword);
where = where.And(newWhere);
}
return await q.Where(where).GetPageResultAsync(input);
}
public async Task<user> GetTheDataAsync(string id)
{
return await GetEntityAsync(id);
}
public async Task AddDataAsync(user data)
{
await InsertAsync(data);
}
public async Task UpdateDataAsync(user data)
{
await UpdateAsync(data);
}
public async Task DeleteDataAsync(List<string> ids)
{
await DeleteAsync(ids);
}
#endregion
public IQueryable<UserRoleDto> GetPriceTaskUserList()
{
string priceTeamId = "1463029355104964608";
Expression<Func<user, userrole, UserRoleDto>> select = (a, b) => new UserRoleDto()
{
DepartmentId = b.DepartmentId,
RoleId = b.Id,
};
select = select.BuildExtendSelectExpre();
var q_User = Db.GetIQueryable<user>() ;
var q = from a in q_User.AsExpandable()
join b in Db.GetIQueryable<userrole>() on a.RoleId equals b.Id into ab
from b in ab.DefaultIfEmpty()
select @select.Invoke(a, b);
var list = q.Where(c=>c.DepartmentId==priceTeamId);
return list;
}
#region 私有成员
#endregion
}
}

66
src/Coldairarrow.Business/MDS/userdepartmentBusiness.cs

@ -0,0 +1,66 @@
using Coldairarrow.Entity.MDS;
using Coldairarrow.Util;
using Coldairarrow.Util.DataAccess;
using EFCore.Sharding;
using LinqKit;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
namespace Coldairarrow.Business.MDS
{
public class userdepartmentBusiness : BaseBusiness<userdepartment>, IuserdepartmentBusiness, ITransientDependency
{
public userdepartmentBusiness(IMDSDbAccessor db)
: base(db)
{
}
#region 外部接口
public async Task<PageResult<userdepartment>> GetDataListAsync(PageInput<ConditionDTO> input)
{
var q = GetIQueryable();
var where = LinqHelper.True<userdepartment>();
var search = input.Search;
//筛选
if (!search.Condition.IsNullOrEmpty() && !search.Keyword.IsNullOrEmpty())
{
var newWhere = DynamicExpressionParser.ParseLambda<userdepartment, bool>(
ParsingConfig.Default, false, $@"{search.Condition}.Contains(@0)", search.Keyword);
where = where.And(newWhere);
}
return await q.Where(where).GetPageResultAsync(input);
}
public async Task<userdepartment> GetTheDataAsync(string id)
{
return await GetEntityAsync(id);
}
public async Task AddDataAsync(userdepartment data)
{
await InsertAsync(data);
}
public async Task UpdateDataAsync(userdepartment data)
{
await UpdateAsync(data);
}
public async Task DeleteDataAsync(List<string> ids)
{
await DeleteAsync(ids);
}
#endregion
#region 私有成员
#endregion
}
}

66
src/Coldairarrow.Business/MDS/userroleBusiness.cs

@ -0,0 +1,66 @@
using Coldairarrow.Entity.MDS;
using Coldairarrow.Util;
using Coldairarrow.Util.DataAccess;
using EFCore.Sharding;
using LinqKit;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
namespace Coldairarrow.Business.MDS
{
public class userroleBusiness : BaseBusiness<userrole>, IuserroleBusiness, ITransientDependency
{
public userroleBusiness(IMDSDbAccessor db)
: base(db)
{
}
#region 外部接口
public async Task<PageResult<userrole>> GetDataListAsync(PageInput<ConditionDTO> input)
{
var q = GetIQueryable();
var where = LinqHelper.True<userrole>();
var search = input.Search;
//筛选
if (!search.Condition.IsNullOrEmpty() && !search.Keyword.IsNullOrEmpty())
{
var newWhere = DynamicExpressionParser.ParseLambda<userrole, bool>(
ParsingConfig.Default, false, $@"{search.Condition}.Contains(@0)", search.Keyword);
where = where.And(newWhere);
}
return await q.Where(where).GetPageResultAsync(input);
}
public async Task<userrole> GetTheDataAsync(string id)
{
return await GetEntityAsync(id);
}
public async Task AddDataAsync(userrole data)
{
await InsertAsync(data);
}
public async Task UpdateDataAsync(userrole data)
{
await UpdateAsync(data);
}
public async Task DeleteDataAsync(List<string> ids)
{
await DeleteAsync(ids);
}
#endregion
#region 私有成员
#endregion
}
}

32
src/Coldairarrow.Entity/DTO/PricetaskUser.cs

@ -0,0 +1,32 @@
using Coldairarrow.Entity.HuiYan;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coldairarrow.Entity.DTO
{
public class PricetaskUser : pricetasklog
{
public string UserName { get; set; }
private int? maxTaskCount;
/// <summary>
/// 用户ID
/// </summary>
public string Uid { get; set; }
public int? MaxTaskCount
{
get
{
if (maxTaskCount == null)
return 30;
return maxTaskCount.Value;
}
set { maxTaskCount = value; }
}
}
}

15
src/Coldairarrow.Entity/DTO/UserRoleDto.cs

@ -0,0 +1,15 @@
using Coldairarrow.Entity.MDS;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coldairarrow.Entity.DTO
{
public class UserRoleDto:user
{
public string DepartmentId { get; set; }
}
}

39
src/Coldairarrow.Entity/Enum/teamItemState.cs

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coldairarrow.Entity.Enum
{
public enum TeamItemState
{
= 0,
= 1,
= 2,
= 3,
= 4,
= 5,
= 6,
= 7
}
public enum PriceTaskState
{
= 0,
= 1,
= 2,
=3
}
}

57
src/Coldairarrow.Entity/HuiYan/pricetasklog.cs

@ -0,0 +1,57 @@
using Coldairarrow.Entity.Enum;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.HuiYan
{
/// <summary>
/// 比价任务日志
/// </summary>
[Table("pricetasklog")]
public class pricetasklog
{
/// <summary>
/// 主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
public Boolean Deleted { get; set; }
/// <summary>
/// 分配的团队用户ID
/// </summary>
public String UserId { get; set; }
/// <summary>
/// 团队商品的ID
/// </summary>
public String TeamItemId { get; set; }
/// <summary>
/// 商品表ID
/// </summary>
public String ItemId { get; set; }
/// <summary>
/// 比价状态
/// </summary>
public PriceTaskState State { get; set; }
}
}

4
src/Coldairarrow.Entity/HuiYan/teamitems.cs

@ -107,5 +107,9 @@ namespace Coldairarrow.Entity.HuiYan
/// </summary>
public Int32? RivalPLCount { get; set; }
/// <summary>
/// 接比价任务的用户ID
/// </summary>
public string PriceTaskUserId { get; set; }
}
}

95
src/Coldairarrow.Entity/MDS/user.cs

@ -0,0 +1,95 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.MDS
{
/// <summary>
/// user
/// </summary>
[Table("user")]
public class user
{
/// <summary>
/// 主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
public Boolean Deleted { get; set; }
/// <summary>
/// 用户名
/// </summary>
public String UserName { get; set; }
/// <summary>
/// 用户密码
/// </summary>
public String UserPwd { get; set; }
/// <summary>
/// 角色ID
/// </summary>
public String RoleId { get; set; }
/// <summary>
/// 用户积分
/// </summary>
public Int32? UserIntegral { get; set; }
/// <summary>
/// 花名
/// </summary>
public String UserNick { get; set; }
/// <summary>
/// 用户经验值
/// </summary>
public Int32? UserExp { get; set; }
/// <summary>
/// 当日冻结积分
/// </summary>
public Int32? FreezeIntegral { get; set; }
/// <summary>
/// 即将过期积分
/// </summary>
public Int32? FailureIntegral { get; set; }
/// <summary>
/// 最后积分检测日期
/// </summary>
public DateTime? LastIntegralDate { get; set; }
/// <summary>
/// 业务ID列表
/// </summary>
public String BusinessIds { get; set; }
/// <summary>
/// 登录IP
/// </summary>
public String LoginIp { get; set; }
/// <summary>
/// 最大比价任务数量
/// </summary>
public int? MaxPriceTaskCount { get; set; }
}
}

46
src/Coldairarrow.Entity/MDS/userdepartment.cs

@ -0,0 +1,46 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.MDS
{
/// <summary>
/// userdepartment
/// </summary>
[Table("userdepartment")]
public class userdepartment
{
/// <summary>
/// 主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
public Boolean Deleted { get; set; }
/// <summary>
/// 部门名称
/// </summary>
public String DepartmentName { get; set; }
/// <summary>
/// 上级部门
/// </summary>
public String ParentDepartmentId { get; set; }
}
}

56
src/Coldairarrow.Entity/MDS/userrole.cs

@ -0,0 +1,56 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.MDS
{
/// <summary>
/// userrole
/// </summary>
[Table("userrole")]
public class userrole
{
/// <summary>
/// 主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
public Boolean Deleted { get; set; }
/// <summary>
/// 角色名称
/// </summary>
public String RoleName { get; set; }
/// <summary>
/// 上级角色ID
/// </summary>
public String ParentRoleId { get; set; }
/// <summary>
/// 部门ID
/// </summary>
public String DepartmentId { get; set; }
/// <summary>
/// 是否管理岗位
/// </summary>
public Boolean? IsManagement { get; set; }
}
}

18
src/Coldairarrow.IBusiness/HuiYan/IpricetasklogBusiness.cs

@ -0,0 +1,18 @@
using Coldairarrow.Entity.HuiYan;
using Coldairarrow.Util;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Business.HuiYan
{
public interface IpricetasklogBusiness
{
Task<PageResult<pricetasklog>> GetDataListAsync(PageInput<ConditionDTO> input);
Task<pricetasklog> GetTheDataAsync(string id);
Task AddDataAsync(pricetasklog data);
Task UpdateDataAsync(pricetasklog data);
Task DeleteDataAsync(List<string> ids);
AjaxResult AddTask(string teamItemId);
}
}

20
src/Coldairarrow.IBusiness/MDS/IuserBusiness.cs

@ -0,0 +1,20 @@
using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.MDS;
using Coldairarrow.Util;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Business.MDS
{
public interface IuserBusiness
{
Task<PageResult<user>> GetDataListAsync(PageInput<ConditionDTO> input);
Task<user> GetTheDataAsync(string id);
Task AddDataAsync(user data);
Task UpdateDataAsync(user data);
Task DeleteDataAsync(List<string> ids);
IQueryable<UserRoleDto> GetPriceTaskUserList();
}
}

16
src/Coldairarrow.IBusiness/MDS/IuserdepartmentBusiness.cs

@ -0,0 +1,16 @@
using Coldairarrow.Entity.MDS;
using Coldairarrow.Util;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Business.MDS
{
public interface IuserdepartmentBusiness
{
Task<PageResult<userdepartment>> GetDataListAsync(PageInput<ConditionDTO> input);
Task<userdepartment> GetTheDataAsync(string id);
Task AddDataAsync(userdepartment data);
Task UpdateDataAsync(userdepartment data);
Task DeleteDataAsync(List<string> ids);
}
}

16
src/Coldairarrow.IBusiness/MDS/IuserroleBusiness.cs

@ -0,0 +1,16 @@
using Coldairarrow.Entity.MDS;
using Coldairarrow.Util;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Business.MDS
{
public interface IuserroleBusiness
{
Task<PageResult<userrole>> GetDataListAsync(PageInput<ConditionDTO> input);
Task<userrole> GetTheDataAsync(string id);
Task AddDataAsync(userrole data);
Task UpdateDataAsync(userrole data);
Task DeleteDataAsync(List<string> ids);
}
}

14
src/Coldairarrow.Util/DataAccess/IMDSDbAccessor.cs

@ -0,0 +1,14 @@
using EFCore.Sharding;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coldairarrow.Util.DataAccess
{
public interface IMDSDbAccessor: IDbAccessor
{
}
}

89
src/Coldairarrow.Web/src/views/HuiYan/pricetasklog/EditForm.vue

@ -0,0 +1,89 @@
<template>
<a-modal
:title="title"
width="40%"
:visible="visible"
:confirmLoading="loading"
@ok="handleSubmit"
@cancel="()=>{this.visible=false}"
>
<a-spin :spinning="loading">
<a-form-model ref="form" :model="entity" :rules="rules" v-bind="layout">
<a-form-model-item label="分配的团队用户ID" prop="UserId">
<a-input v-model="entity.UserId" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="团队商品的ID" prop="TeamItemId">
<a-input v-model="entity.TeamItemId" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="商品表ID" prop="ItemId">
<a-input v-model="entity.ItemId" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="比价状态" prop="State">
<a-input v-model="entity.State" autocomplete="off" />
</a-form-model-item>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
export default {
props: {
parentObj: Object
},
data() {
return {
layout: {
labelCol: { span: 5 },
wrapperCol: { span: 18 }
},
visible: false,
loading: false,
entity: {},
rules: {},
title: ''
}
},
methods: {
init() {
this.visible = true
this.entity = {}
this.$nextTick(() => {
this.$refs['form'].clearValidate()
})
},
openForm(id, title) {
this.init()
if (id) {
this.loading = true
this.$http.post('/HuiYan/pricetasklog/GetTheData', { id: id }).then(resJson => {
this.loading = false
this.entity = resJson.Data
})
}
},
handleSubmit() {
this.$refs['form'].validate(valid => {
if (!valid) {
return
}
this.loading = true
this.$http.post('/HuiYan/pricetasklog/SaveData', this.entity).then(resJson => {
this.loading = false
if (resJson.Success) {
this.$message.success('操作成功!')
this.visible = false
this.parentObj.getDataList()
} else {
this.$message.error(resJson.Msg)
}
})
})
}
}
}
</script>

162
src/Coldairarrow.Web/src/views/HuiYan/pricetasklog/List.vue

@ -0,0 +1,162 @@
<template>
<a-card :bordered="false">
<div class="table-operator">
<a-button type="primary" icon="plus" @click="hanldleAdd()">新建</a-button>
<a-button
type="primary"
icon="minus"
@click="handleDelete(selectedRowKeys)"
:disabled="!hasSelected()"
:loading="loading"
>删除</a-button>
<a-button type="primary" icon="redo" @click="getDataList()">刷新</a-button>
</div>
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="10">
<a-col :md="4" :sm="24">
<a-form-item label="查询类别">
<a-select allowClear v-model="queryParam.condition">
<a-select-option key="UserId">分配的团队用户ID</a-select-option>
<a-select-option key="TeamItemId">团队商品的ID</a-select-option>
<a-select-option key="ItemId">商品表ID</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="4" :sm="24">
<a-form-item>
<a-input v-model="queryParam.keyword" placeholder="关键字" />
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-button type="primary" @click="() => {this.pagination.current = 1; this.getDataList()}">查询</a-button>
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<a-table
ref="table"
:columns="columns"
:rowKey="row => row.Id"
:dataSource="data"
:pagination="pagination"
:loading="loading"
@change="handleTableChange"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:bordered="true"
size="small"
>
<span slot="action" slot-scope="text, record">
<template>
<a @click="handleEdit(record.Id)">编辑</a>
<a-divider type="vertical" />
<a @click="handleDelete([record.Id])">删除</a>
</template>
</span>
</a-table>
<edit-form ref="editForm" :parentObj="this"></edit-form>
</a-card>
</template>
<script>
import EditForm from './EditForm'
const columns = [
{ title: '分配的团队用户ID', dataIndex: 'UserId', width: '10%' },
{ title: '团队商品的ID', dataIndex: 'TeamItemId', width: '10%' },
{ title: '商品表ID', dataIndex: 'ItemId', width: '10%' },
{ title: '比价状态', dataIndex: 'State', width: '10%' },
{ title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } }
]
export default {
components: {
EditForm
},
mounted() {
this.getDataList()
},
data() {
return {
data: [],
pagination: {
current: 1,
pageSize: 10,
showTotal: (total, range) => `总数:${total} 当前:${range[0]}-${range[1]}`
},
filters: {},
sorter: { field: 'Id', order: 'asc' },
loading: false,
columns,
queryParam: {},
selectedRowKeys: []
}
},
methods: {
handleTableChange(pagination, filters, sorter) {
this.pagination = { ...pagination }
this.filters = { ...filters }
this.sorter = { ...sorter }
this.getDataList()
},
getDataList() {
this.selectedRowKeys = []
this.loading = true
this.$http
.post('/HuiYan/pricetasklog/GetDataList', {
PageIndex: this.pagination.current,
PageRows: this.pagination.pageSize,
SortField: this.sorter.field || 'Id',
SortType: this.sorter.order,
Search: this.queryParam,
...this.filters
})
.then(resJson => {
this.loading = false
this.data = resJson.Data
const pagination = { ...this.pagination }
pagination.total = resJson.Total
this.pagination = pagination
})
},
onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
hasSelected() {
return this.selectedRowKeys.length > 0
},
hanldleAdd() {
this.$refs.editForm.openForm()
},
handleEdit(id) {
this.$refs.editForm.openForm(id)
},
handleDelete(ids) {
var thisObj = this
this.$confirm({
title: '确认删除吗?',
onOk() {
return new Promise((resolve, reject) => {
thisObj.$http.post('/HuiYan/pricetasklog/DeleteData', ids).then(resJson => {
resolve()
if (resJson.Success) {
thisObj.$message.success('操作成功!')
thisObj.getDataList()
} else {
thisObj.$message.error(resJson.Msg)
}
})
})
}
})
}
}
}
</script>

110
src/Coldairarrow.Web/src/views/MDS/user/EditForm.vue

@ -0,0 +1,110 @@
<template>
<a-modal
:title="title"
width="40%"
:visible="visible"
:confirmLoading="loading"
@ok="handleSubmit"
@cancel="()=>{this.visible=false}"
>
<a-spin :spinning="loading">
<a-form-model ref="form" :model="entity" :rules="rules" v-bind="layout">
<a-form-model-item label="用户名" prop="UserName">
<a-input v-model="entity.UserName" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="用户密码" prop="UserPwd">
<a-input v-model="entity.UserPwd" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="角色ID" prop="RoleId">
<a-input v-model="entity.RoleId" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="用户积分" prop="UserIntegral">
<a-input v-model="entity.UserIntegral" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="花名" prop="UserNick">
<a-input v-model="entity.UserNick" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="用户经验值" prop="UserExp">
<a-input v-model="entity.UserExp" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="当日冻结积分" prop="FreezeIntegral">
<a-input v-model="entity.FreezeIntegral" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="即将过期积分" prop="FailureIntegral">
<a-input v-model="entity.FailureIntegral" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="最后积分检测日期" prop="LastIntegralDate">
<a-input v-model="entity.LastIntegralDate" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="业务ID列表" prop="BusinessIds">
<a-input v-model="entity.BusinessIds" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="登录IP" prop="LoginIp">
<a-input v-model="entity.LoginIp" autocomplete="off" />
</a-form-model-item>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
export default {
props: {
parentObj: Object
},
data() {
return {
layout: {
labelCol: { span: 5 },
wrapperCol: { span: 18 }
},
visible: false,
loading: false,
entity: {},
rules: {},
title: ''
}
},
methods: {
init() {
this.visible = true
this.entity = {}
this.$nextTick(() => {
this.$refs['form'].clearValidate()
})
},
openForm(id, title) {
this.init()
if (id) {
this.loading = true
this.$http.post('/MDS/user/GetTheData', { id: id }).then(resJson => {
this.loading = false
this.entity = resJson.Data
})
}
},
handleSubmit() {
this.$refs['form'].validate(valid => {
if (!valid) {
return
}
this.loading = true
this.$http.post('/MDS/user/SaveData', this.entity).then(resJson => {
this.loading = false
if (resJson.Success) {
this.$message.success('操作成功!')
this.visible = false
this.parentObj.getDataList()
} else {
this.$message.error(resJson.Msg)
}
})
})
}
}
}
</script>

172
src/Coldairarrow.Web/src/views/MDS/user/List.vue

@ -0,0 +1,172 @@
<template>
<a-card :bordered="false">
<div class="table-operator">
<a-button type="primary" icon="plus" @click="hanldleAdd()">新建</a-button>
<a-button
type="primary"
icon="minus"
@click="handleDelete(selectedRowKeys)"
:disabled="!hasSelected()"
:loading="loading"
>删除</a-button>
<a-button type="primary" icon="redo" @click="getDataList()">刷新</a-button>
</div>
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="10">
<a-col :md="4" :sm="24">
<a-form-item label="查询类别">
<a-select allowClear v-model="queryParam.condition">
<a-select-option key="UserName">用户名</a-select-option>
<a-select-option key="UserPwd">用户密码</a-select-option>
<a-select-option key="RoleId">角色ID</a-select-option>
<a-select-option key="UserNick">花名</a-select-option>
<a-select-option key="BusinessIds">业务ID列表</a-select-option>
<a-select-option key="LoginIp">登录IP</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="4" :sm="24">
<a-form-item>
<a-input v-model="queryParam.keyword" placeholder="关键字" />
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-button type="primary" @click="() => {this.pagination.current = 1; this.getDataList()}">查询</a-button>
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<a-table
ref="table"
:columns="columns"
:rowKey="row => row.Id"
:dataSource="data"
:pagination="pagination"
:loading="loading"
@change="handleTableChange"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:bordered="true"
size="small"
>
<span slot="action" slot-scope="text, record">
<template>
<a @click="handleEdit(record.Id)">编辑</a>
<a-divider type="vertical" />
<a @click="handleDelete([record.Id])">删除</a>
</template>
</span>
</a-table>
<edit-form ref="editForm" :parentObj="this"></edit-form>
</a-card>
</template>
<script>
import EditForm from './EditForm'
const columns = [
{ title: '用户名', dataIndex: 'UserName', width: '10%' },
{ title: '用户密码', dataIndex: 'UserPwd', width: '10%' },
{ title: '角色ID', dataIndex: 'RoleId', width: '10%' },
{ title: '用户积分', dataIndex: 'UserIntegral', width: '10%' },
{ title: '花名', dataIndex: 'UserNick', width: '10%' },
{ title: '用户经验值', dataIndex: 'UserExp', width: '10%' },
{ title: '当日冻结积分', dataIndex: 'FreezeIntegral', width: '10%' },
{ title: '即将过期积分', dataIndex: 'FailureIntegral', width: '10%' },
{ title: '最后积分检测日期', dataIndex: 'LastIntegralDate', width: '10%' },
{ title: '业务ID列表', dataIndex: 'BusinessIds', width: '10%' },
{ title: '登录IP', dataIndex: 'LoginIp', width: '10%' },
{ title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } }
]
export default {
components: {
EditForm
},
mounted() {
this.getDataList()
},
data() {
return {
data: [],
pagination: {
current: 1,
pageSize: 10,
showTotal: (total, range) => `总数:${total} 当前:${range[0]}-${range[1]}`
},
filters: {},
sorter: { field: 'Id', order: 'asc' },
loading: false,
columns,
queryParam: {},
selectedRowKeys: []
}
},
methods: {
handleTableChange(pagination, filters, sorter) {
this.pagination = { ...pagination }
this.filters = { ...filters }
this.sorter = { ...sorter }
this.getDataList()
},
getDataList() {
this.selectedRowKeys = []
this.loading = true
this.$http
.post('/MDS/user/GetDataList', {
PageIndex: this.pagination.current,
PageRows: this.pagination.pageSize,
SortField: this.sorter.field || 'Id',
SortType: this.sorter.order,
Search: this.queryParam,
...this.filters
})
.then(resJson => {
this.loading = false
this.data = resJson.Data
const pagination = { ...this.pagination }
pagination.total = resJson.Total
this.pagination = pagination
})
},
onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
hasSelected() {
return this.selectedRowKeys.length > 0
},
hanldleAdd() {
this.$refs.editForm.openForm()
},
handleEdit(id) {
this.$refs.editForm.openForm(id)
},
handleDelete(ids) {
var thisObj = this
this.$confirm({
title: '确认删除吗?',
onOk() {
return new Promise((resolve, reject) => {
thisObj.$http.post('/MDS/user/DeleteData', ids).then(resJson => {
resolve()
if (resJson.Success) {
thisObj.$message.success('操作成功!')
thisObj.getDataList()
} else {
thisObj.$message.error(resJson.Msg)
}
})
})
}
})
}
}
}
</script>

83
src/Coldairarrow.Web/src/views/MDS/userdepartment/EditForm.vue

@ -0,0 +1,83 @@
<template>
<a-modal
:title="title"
width="40%"
:visible="visible"
:confirmLoading="loading"
@ok="handleSubmit"
@cancel="()=>{this.visible=false}"
>
<a-spin :spinning="loading">
<a-form-model ref="form" :model="entity" :rules="rules" v-bind="layout">
<a-form-model-item label="部门名称" prop="DepartmentName">
<a-input v-model="entity.DepartmentName" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="上级部门" prop="ParentDepartmentId">
<a-input v-model="entity.ParentDepartmentId" autocomplete="off" />
</a-form-model-item>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
export default {
props: {
parentObj: Object
},
data() {
return {
layout: {
labelCol: { span: 5 },
wrapperCol: { span: 18 }
},
visible: false,
loading: false,
entity: {},
rules: {},
title: ''
}
},
methods: {
init() {
this.visible = true
this.entity = {}
this.$nextTick(() => {
this.$refs['form'].clearValidate()
})
},
openForm(id, title) {
this.init()
if (id) {
this.loading = true
this.$http.post('/MDS/userdepartment/GetTheData', { id: id }).then(resJson => {
this.loading = false
this.entity = resJson.Data
})
}
},
handleSubmit() {
this.$refs['form'].validate(valid => {
if (!valid) {
return
}
this.loading = true
this.$http.post('/MDS/userdepartment/SaveData', this.entity).then(resJson => {
this.loading = false
if (resJson.Success) {
this.$message.success('操作成功!')
this.visible = false
this.parentObj.getDataList()
} else {
this.$message.error(resJson.Msg)
}
})
})
}
}
}
</script>

159
src/Coldairarrow.Web/src/views/MDS/userdepartment/List.vue

@ -0,0 +1,159 @@
<template>
<a-card :bordered="false">
<div class="table-operator">
<a-button type="primary" icon="plus" @click="hanldleAdd()">新建</a-button>
<a-button
type="primary"
icon="minus"
@click="handleDelete(selectedRowKeys)"
:disabled="!hasSelected()"
:loading="loading"
>删除</a-button>
<a-button type="primary" icon="redo" @click="getDataList()">刷新</a-button>
</div>
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="10">
<a-col :md="4" :sm="24">
<a-form-item label="查询类别">
<a-select allowClear v-model="queryParam.condition">
<a-select-option key="DepartmentName">部门名称</a-select-option>
<a-select-option key="ParentDepartmentId">上级部门</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="4" :sm="24">
<a-form-item>
<a-input v-model="queryParam.keyword" placeholder="关键字" />
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-button type="primary" @click="() => {this.pagination.current = 1; this.getDataList()}">查询</a-button>
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<a-table
ref="table"
:columns="columns"
:rowKey="row => row.Id"
:dataSource="data"
:pagination="pagination"
:loading="loading"
@change="handleTableChange"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:bordered="true"
size="small"
>
<span slot="action" slot-scope="text, record">
<template>
<a @click="handleEdit(record.Id)">编辑</a>
<a-divider type="vertical" />
<a @click="handleDelete([record.Id])">删除</a>
</template>
</span>
</a-table>
<edit-form ref="editForm" :parentObj="this"></edit-form>
</a-card>
</template>
<script>
import EditForm from './EditForm'
const columns = [
{ title: '部门名称', dataIndex: 'DepartmentName', width: '10%' },
{ title: '上级部门', dataIndex: 'ParentDepartmentId', width: '10%' },
{ title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } }
]
export default {
components: {
EditForm
},
mounted() {
this.getDataList()
},
data() {
return {
data: [],
pagination: {
current: 1,
pageSize: 10,
showTotal: (total, range) => `总数:${total} 当前:${range[0]}-${range[1]}`
},
filters: {},
sorter: { field: 'Id', order: 'asc' },
loading: false,
columns,
queryParam: {},
selectedRowKeys: []
}
},
methods: {
handleTableChange(pagination, filters, sorter) {
this.pagination = { ...pagination }
this.filters = { ...filters }
this.sorter = { ...sorter }
this.getDataList()
},
getDataList() {
this.selectedRowKeys = []
this.loading = true
this.$http
.post('/MDS/userdepartment/GetDataList', {
PageIndex: this.pagination.current,
PageRows: this.pagination.pageSize,
SortField: this.sorter.field || 'Id',
SortType: this.sorter.order,
Search: this.queryParam,
...this.filters
})
.then(resJson => {
this.loading = false
this.data = resJson.Data
const pagination = { ...this.pagination }
pagination.total = resJson.Total
this.pagination = pagination
})
},
onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
hasSelected() {
return this.selectedRowKeys.length > 0
},
hanldleAdd() {
this.$refs.editForm.openForm()
},
handleEdit(id) {
this.$refs.editForm.openForm(id)
},
handleDelete(ids) {
var thisObj = this
this.$confirm({
title: '确认删除吗?',
onOk() {
return new Promise((resolve, reject) => {
thisObj.$http.post('/MDS/userdepartment/DeleteData', ids).then(resJson => {
resolve()
if (resJson.Success) {
thisObj.$message.success('操作成功!')
thisObj.getDataList()
} else {
thisObj.$message.error(resJson.Msg)
}
})
})
}
})
}
}
}
</script>

89
src/Coldairarrow.Web/src/views/MDS/userrole/EditForm.vue

@ -0,0 +1,89 @@
<template>
<a-modal
:title="title"
width="40%"
:visible="visible"
:confirmLoading="loading"
@ok="handleSubmit"
@cancel="()=>{this.visible=false}"
>
<a-spin :spinning="loading">
<a-form-model ref="form" :model="entity" :rules="rules" v-bind="layout">
<a-form-model-item label="角色名称" prop="RoleName">
<a-input v-model="entity.RoleName" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="上级角色ID" prop="ParentRoleId">
<a-input v-model="entity.ParentRoleId" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="部门ID" prop="DepartmentId">
<a-input v-model="entity.DepartmentId" autocomplete="off" />
</a-form-model-item>
<a-form-model-item label="是否管理岗位" prop="IsManagement">
<a-input v-model="entity.IsManagement" autocomplete="off" />
</a-form-model-item>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
export default {
props: {
parentObj: Object
},
data() {
return {
layout: {
labelCol: { span: 5 },
wrapperCol: { span: 18 }
},
visible: false,
loading: false,
entity: {},
rules: {},
title: ''
}
},
methods: {
init() {
this.visible = true
this.entity = {}
this.$nextTick(() => {
this.$refs['form'].clearValidate()
})
},
openForm(id, title) {
this.init()
if (id) {
this.loading = true
this.$http.post('/MDS/userrole/GetTheData', { id: id }).then(resJson => {
this.loading = false
this.entity = resJson.Data
})
}
},
handleSubmit() {
this.$refs['form'].validate(valid => {
if (!valid) {
return
}
this.loading = true
this.$http.post('/MDS/userrole/SaveData', this.entity).then(resJson => {
this.loading = false
if (resJson.Success) {
this.$message.success('操作成功!')
this.visible = false
this.parentObj.getDataList()
} else {
this.$message.error(resJson.Msg)
}
})
})
}
}
}
</script>

162
src/Coldairarrow.Web/src/views/MDS/userrole/List.vue

@ -0,0 +1,162 @@
<template>
<a-card :bordered="false">
<div class="table-operator">
<a-button type="primary" icon="plus" @click="hanldleAdd()">新建</a-button>
<a-button
type="primary"
icon="minus"
@click="handleDelete(selectedRowKeys)"
:disabled="!hasSelected()"
:loading="loading"
>删除</a-button>
<a-button type="primary" icon="redo" @click="getDataList()">刷新</a-button>
</div>
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="10">
<a-col :md="4" :sm="24">
<a-form-item label="查询类别">
<a-select allowClear v-model="queryParam.condition">
<a-select-option key="RoleName">角色名称</a-select-option>
<a-select-option key="ParentRoleId">上级角色ID</a-select-option>
<a-select-option key="DepartmentId">部门ID</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="4" :sm="24">
<a-form-item>
<a-input v-model="queryParam.keyword" placeholder="关键字" />
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-button type="primary" @click="() => {this.pagination.current = 1; this.getDataList()}">查询</a-button>
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<a-table
ref="table"
:columns="columns"
:rowKey="row => row.Id"
:dataSource="data"
:pagination="pagination"
:loading="loading"
@change="handleTableChange"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:bordered="true"
size="small"
>
<span slot="action" slot-scope="text, record">
<template>
<a @click="handleEdit(record.Id)">编辑</a>
<a-divider type="vertical" />
<a @click="handleDelete([record.Id])">删除</a>
</template>
</span>
</a-table>
<edit-form ref="editForm" :parentObj="this"></edit-form>
</a-card>
</template>
<script>
import EditForm from './EditForm'
const columns = [
{ title: '角色名称', dataIndex: 'RoleName', width: '10%' },
{ title: '上级角色ID', dataIndex: 'ParentRoleId', width: '10%' },
{ title: '部门ID', dataIndex: 'DepartmentId', width: '10%' },
{ title: '是否管理岗位', dataIndex: 'IsManagement', width: '10%' },
{ title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } }
]
export default {
components: {
EditForm
},
mounted() {
this.getDataList()
},
data() {
return {
data: [],
pagination: {
current: 1,
pageSize: 10,
showTotal: (total, range) => `总数:${total} 当前:${range[0]}-${range[1]}`
},
filters: {},
sorter: { field: 'Id', order: 'asc' },
loading: false,
columns,
queryParam: {},
selectedRowKeys: []
}
},
methods: {
handleTableChange(pagination, filters, sorter) {
this.pagination = { ...pagination }
this.filters = { ...filters }
this.sorter = { ...sorter }
this.getDataList()
},
getDataList() {
this.selectedRowKeys = []
this.loading = true
this.$http
.post('/MDS/userrole/GetDataList', {
PageIndex: this.pagination.current,
PageRows: this.pagination.pageSize,
SortField: this.sorter.field || 'Id',
SortType: this.sorter.order,
Search: this.queryParam,
...this.filters
})
.then(resJson => {
this.loading = false
this.data = resJson.Data
const pagination = { ...this.pagination }
pagination.total = resJson.Total
this.pagination = pagination
})
},
onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
hasSelected() {
return this.selectedRowKeys.length > 0
},
hanldleAdd() {
this.$refs.editForm.openForm()
},
handleEdit(id) {
this.$refs.editForm.openForm(id)
},
handleDelete(ids) {
var thisObj = this
this.$confirm({
title: '确认删除吗?',
onOk() {
return new Promise((resolve, reject) => {
thisObj.$http.post('/MDS/userrole/DeleteData', ids).then(resJson => {
resolve()
if (resJson.Success) {
thisObj.$message.success('操作成功!')
thisObj.getDataList()
} else {
thisObj.$message.error(resJson.Msg)
}
})
})
}
})
}
}
}
</script>

47
客户端/齐越慧眼/齐越慧眼/BrowerHelper.cs

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace
{
public class BrowerHelper
{
public enum ShowCommands : int
{
SW_HIDE = 0,
SW_SHOWNORMAL = 1,
SW_NORMAL = 1,
SW_SHOWMINIMIZED = 2,
SW_SHOWMAXIMIZED = 3,
SW_MAXIMIZE = 3,
SW_SHOWNOACTIVATE = 4,
SW_SHOW = 5,
SW_MINIMIZE = 6,
SW_SHOWMINNOACTIVE = 7,
SW_SHOWNA = 8,
SW_RESTORE = 9,
SW_SHOWDEFAULT = 10,
SW_FORCEMINIMIZE = 11,
SW_MAX = 11
}
[DllImport("shell32.dll")]
static extern IntPtr ShellExecute(
IntPtr hwnd,
string lpOperation,
string lpFile,
string lpParameters,
string lpDirectory,
ShowCommands nShowCmd);
/// <summary>
/// 打开指定网址
/// </summary>
/// <param name="url"></param>
public static void OpenUrl(string url)
{
ShellExecute(IntPtr.Zero, "open", url, null, null, ShowCommands.SW_SHOWNORMAL);
}
}
}

4
客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs

@ -110,7 +110,9 @@ namespace 齐越慧眼.UserControls
private void Web_StartNewWindow(object sender, NewWindowEventArgs e)
{
MainWindow.Main.brower.NewTab(e.Url);
// WpfNoticeMsg.NoticeMessage.Show(e.Url);
BrowerHelper.OpenUrl(e.Url);
//MainWindow.Main.brower.NewTab(e.Url);
//web.Load(e.Url);
}

12
客户端/齐越慧眼/齐越慧眼/UserControls/CatControl.xaml.cs

@ -13,6 +13,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using .cefhelper;
namespace .UserControls
{
@ -21,11 +22,11 @@ namespace 齐越慧眼.UserControls
/// </summary>
public partial class CatControl : UserControl
{
ChromiumWebBrowser web;
ExtChromiumBrowser web;
public CatControl()
{
InitializeComponent();
web = new ChromiumWebBrowser("nacollector://home")
web = new ExtChromiumBrowser("nacollector://home")
{
BrowserSettings =
{
@ -45,12 +46,17 @@ namespace 齐越慧眼.UserControls
web.JavascriptObjectRepository.Register("hyCoreModel", new CatsAsyncJS(), BindingOptions.DefaultBinder);
// web.WebBrowser.GetDevToolsClient().DOMStorage.SetDOMStorageItemAsync()
web.StartNewWindow += Web_StartNewWindow;
web.FrameLoadStart += Web_FrameLoadStart;
}
private void Web_StartNewWindow(object sender, NewWindowEventArgs e)
{
BrowerHelper.OpenUrl(e.Url);
}
bool isInit = false;
private void Web_FrameLoadStart(object sender, FrameLoadStartEventArgs e)

13
客户端/齐越慧眼/齐越慧眼/UserControls/ItemControl.xaml.cs

@ -16,6 +16,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using .cefhelper;
namespace .UserControls
{
@ -24,11 +25,11 @@ namespace 齐越慧眼.UserControls
/// </summary>
public partial class ItemControl : UserControl
{
ChromiumWebBrowser web;
ExtChromiumBrowser web;
public ItemControl()
{
InitializeComponent();
web = new ChromiumWebBrowser("nacollector://home/item")
web = new ExtChromiumBrowser("nacollector://home/item")
{
BrowserSettings =
{
@ -47,10 +48,16 @@ namespace 齐越慧眼.UserControls
grid.Children.Add(web);
// web.ExecuteScriptAsyncWhenPageLoaded(@$"localStorage.setItem('user', '{{""token"":""{ApiHelper.JwtToken}""}}');window.getDatas(0);");
web.FrameLoadStart += Web_FrameLoadStart;
web.StartNewWindow += Web_StartNewWindow;
grid.KeyDown += grid_KeyDown;
}
private void Web_StartNewWindow(object sender, NewWindowEventArgs e)
{
// WpfNoticeMsg.NoticeMessage.Show(e.Url);
BrowerHelper.OpenUrl(e.Url);
}
bool isInit = false;
private void grid_KeyDown(object sender, KeyEventArgs e)

3
客户端/齐越慧眼/齐越慧眼/UserControls/SomeBrowerControl.xaml.cs

@ -112,7 +112,8 @@ namespace 齐越慧眼.UserControls
private void Web_StartNewWindow(object sender, NewWindowEventArgs e)
{
MainWindow.Main.brower.NewTab(e.Url);
BrowerHelper.OpenUrl(e.Url);
//MainWindow.Main.brower.NewTab(e.Url);
//web.Load(e.Url);
}

Loading…
Cancel
Save