Merge branch 'master' of http://118.178.224.202:3000/ewide/ewide_core
This commit is contained in:
29
Api/Ewide.Application/Entity/BsHouseLog.cs
Normal file
29
Api/Ewide.Application/Entity/BsHouseLog.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
[Table("bs_house_log")]
|
||||
[Comment("房屋流转日志")]
|
||||
public class BsHouseLog : Core.DEntityBase
|
||||
{
|
||||
[Comment("房屋编码Id")]
|
||||
[MaxLength(36)]
|
||||
public string HouseCodeId { get; set; }
|
||||
|
||||
[Comment("目标处理人Id,可多个")]
|
||||
public string TargetUserIds { get; set; }
|
||||
|
||||
[Comment("步骤类型")]
|
||||
public HouseLogType Type { get; set; }
|
||||
|
||||
[Comment("状态")]
|
||||
public HouseLogStatus Status { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -257,5 +257,10 @@ namespace Ewide.Application
|
||||
[Comment("最后提交时间")]
|
||||
public DateTime? LastSubmitTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有效
|
||||
/// </summary>
|
||||
[Comment("是否有效")]
|
||||
public bool IsEnabled { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
43
Api/Ewide.Application/Enum/HouseLog.cs
Normal file
43
Api/Ewide.Application/Enum/HouseLog.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
public enum HouseLogType
|
||||
{
|
||||
[Description("创建房屋编码")]
|
||||
CreateCode = 1,
|
||||
|
||||
[Description("人员选房")]
|
||||
SelectMember = 2,
|
||||
|
||||
[Description("房屋建档")]
|
||||
CreateInfo = 3,
|
||||
|
||||
[Description("审核")]
|
||||
Check = 4,
|
||||
|
||||
[Description("审核通过")]
|
||||
Agree = 5,
|
||||
|
||||
[Description("审核退回")]
|
||||
Disagree = 6
|
||||
|
||||
}
|
||||
|
||||
public enum HouseLogStatus
|
||||
{
|
||||
[Description("待处理")]
|
||||
Handle = 0,
|
||||
|
||||
[Description("正在处理")]
|
||||
Handling = 1,
|
||||
|
||||
[Description("已处理")]
|
||||
Handled = 2,
|
||||
}
|
||||
}
|
||||
@@ -489,6 +489,11 @@
|
||||
最后提交时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Application.BsHouseTask.IsEnabled">
|
||||
<summary>
|
||||
是否有效
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Application.BsHouseTaskCheckRecord.TaskId">
|
||||
<summary>
|
||||
任务Id
|
||||
@@ -616,6 +621,11 @@
|
||||
住宅查询
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Ewide.Application.Service.HouseLogService">
|
||||
<summary>
|
||||
房屋流转日志
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ewide.Application.Service.HouseMemberService.QueryMemberPageList(Ewide.Core.Service.UserInput)">
|
||||
<summary>
|
||||
分页查询用户
|
||||
@@ -726,11 +736,11 @@
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Application.Service.HouseProjectInfo.HouseProjectInfoService.GetProjectById(System.String)">
|
||||
<member name="M:Ewide.Application.Service.HouseProjectInfo.HouseProjectInfoService.GetById(System.String)">
|
||||
<summary>
|
||||
通过ID获取项目
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="projectId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Application.Service.HouseProjectInfo.HouseProjectInfoService.QueryProjectPageList(Ewide.Application.Service.HouseProjectInfo.Dto.PageProjectInput)">
|
||||
@@ -1446,6 +1456,21 @@
|
||||
上报备注
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Application.HouseTaskOutput.SubmitTime">
|
||||
<summary>
|
||||
提交时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Application.HouseTaskOutput.LastSubmitTime">
|
||||
<summary>
|
||||
最后提交时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Application.HouseTaskOutput.IsEnabled">
|
||||
<summary>
|
||||
是否有效
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Ewide.Application.AddHouseZoneInput.Pid">
|
||||
<summary>
|
||||
所属街道
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Ewide.Application
|
||||
public string CommName { get; set; }
|
||||
public string ZoneName { get; set; }
|
||||
public string ProjectNote { get; set; }
|
||||
public string ProjectFullName { get; set; }
|
||||
public string FullProjName { get; set; }
|
||||
public string HouseCode { get; set; }
|
||||
public int No { get; set; }
|
||||
public string Lng { get; set; }
|
||||
|
||||
@@ -13,6 +13,7 @@ using Dapper;
|
||||
using Ewide.Core.Extension;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ewide.Application.Service.HouseCode
|
||||
{
|
||||
@@ -25,13 +26,20 @@ namespace Ewide.Application.Service.HouseCode
|
||||
private readonly IRepository<BsHouseCode> _houseCodeRep;
|
||||
private readonly IDapperRepository _dapperRepository;
|
||||
|
||||
public HouseCodeService(IRepository<BsHouseCode> HouseCodeRep, IDapperRepository dapperRepository)
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IHouseLogService _houseLogService;
|
||||
|
||||
public HouseCodeService(IRepository<BsHouseCode> HouseCodeRep, IDapperRepository dapperRepository, IUserManager userManager, IHouseLogService houseLogService)
|
||||
{
|
||||
_houseCodeRep = HouseCodeRep;
|
||||
_dapperRepository = dapperRepository;
|
||||
|
||||
_userManager = userManager;
|
||||
_houseLogService = houseLogService;
|
||||
}
|
||||
|
||||
[HttpPost("/houseCode/add")]
|
||||
[UnitOfWork]
|
||||
public async Task AddHouseCode(AddHouseCodeInput input)
|
||||
{
|
||||
var houseProjectInfoRep = Db.GetRepository<BsHouseProjectInfo>();
|
||||
@@ -42,10 +50,16 @@ namespace Ewide.Application.Service.HouseCode
|
||||
var areaCode = await areaCodeRep.DetachedEntities.FirstOrDefaultAsync(a => a.Code == input.AreaCode && a.LevelType == 4);
|
||||
if(areaCode == null) throw Oops.Oh("区域编码有误,添加失败");
|
||||
input.HouseCode = areaCode.AdCode + houseProject.Sort.ToString().PadLeft(3, '0') + input.No.ToString().PadLeft(3, '0');
|
||||
var id = System.Guid.NewGuid().ToString().ToLower();
|
||||
var houseCode = input.Adapt<BsHouseCode>();
|
||||
houseCode.Id = id;
|
||||
var isExist = await _houseCodeRep.AnyAsync(p => p.HouseCode == houseCode.HouseCode);
|
||||
if (isExist) throw Oops.Oh("房屋编码已存在,不可重复添加");
|
||||
await _houseCodeRep.InsertAsync(houseCode);
|
||||
await houseCode.InsertAsync();
|
||||
|
||||
// 添加到流转日志
|
||||
await _houseLogService.AddThenDone(id, _userManager.User, HouseLogType.CreateCode);
|
||||
await _houseLogService.Add(id, _userManager.User, HouseLogType.SelectMember);
|
||||
}
|
||||
|
||||
[HttpPost("/houseCode/edit")]
|
||||
@@ -65,7 +79,9 @@ namespace Ewide.Application.Service.HouseCode
|
||||
[HttpPost("/houseCode/page")]
|
||||
public async Task<dynamic> QueryPage([FromBody] QueryHouseCodeInput input)
|
||||
{
|
||||
var sql = @"SELECT HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.Name,'(',Proj.Note,')') FullProjName FROM bs_house_code HC
|
||||
var sql = @"SELECT
|
||||
HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',Proj.Note,')'), '')) FullProjName
|
||||
FROM bs_house_code HC
|
||||
LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId
|
||||
LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode
|
||||
LEFT JOIN sys_area_code RA ON RA.AdCode = SUBSTR(CA.AdCode,1,9)
|
||||
|
||||
@@ -28,17 +28,28 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo
|
||||
private readonly IRepository<BsHouseCode> _houseCodeRep;
|
||||
private readonly IRepository<BsHouseInfo> _houseInfoRep;
|
||||
private readonly IRepository<BsHouseTask> _houseTaskRep;
|
||||
private readonly IRepository<SysUser> _sysUserRep;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDapperRepository _dapperRepository;
|
||||
|
||||
private readonly IHouseLogService _houseLogService;
|
||||
|
||||
public HouseInfoService(IRepository<BsHouseCode> HouseCodeRep,IRepository<BsHouseInfo> HouseInfoRep, IRepository<BsHouseTask> HouseTaskRep, IUserManager userManager, IDapperRepository dapperRepository)
|
||||
|
||||
public HouseInfoService(
|
||||
IRepository<BsHouseCode> HouseCodeRep,
|
||||
IRepository<BsHouseInfo> HouseInfoRep,
|
||||
IRepository<BsHouseTask> HouseTaskRep,
|
||||
IRepository<SysUser> sysUserRep,
|
||||
IUserManager userManager, IDapperRepository dapperRepository, IHouseLogService houseLogService)
|
||||
{
|
||||
_houseCodeRep = HouseCodeRep;
|
||||
_houseInfoRep = HouseInfoRep;
|
||||
_houseTaskRep = HouseTaskRep;
|
||||
_sysUserRep = sysUserRep;
|
||||
_userManager = userManager;
|
||||
_dapperRepository = dapperRepository;
|
||||
|
||||
_houseLogService = houseLogService;
|
||||
}
|
||||
|
||||
[HttpPost("/houseInfo/save")]
|
||||
@@ -46,11 +57,7 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo
|
||||
[AllowAnonymous]
|
||||
public async Task Save([FromBody] HouseInfoInputSave input)
|
||||
{
|
||||
//根据任务审核记录判断是否是审核操作,从而确定 DataStatus
|
||||
//审核操作,则为 input.TaskCheckRecord.PassOrBackDataStatus
|
||||
//非审核操作,则为 DataStatus.Saved
|
||||
var isCheckAction = input.TaskCheckRecord != null;
|
||||
await InputDataProcess(input, isCheckAction ? input.TaskCheckRecord.PassOrBackDataStatus : DataStatus.Saved);
|
||||
await InputDataProcess(input, DataStatus.Saved);
|
||||
}
|
||||
|
||||
[HttpPost("/houseInfo/submitToCheck")]
|
||||
@@ -61,8 +68,15 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo
|
||||
await InputDataProcess(input,DataStatus.Submited);
|
||||
}
|
||||
|
||||
[HttpPost("/houseInfo/check")]
|
||||
[UnitOfWork]
|
||||
public async Task Check([FromBody] HouseInfoInputSave input)
|
||||
{
|
||||
await InputDataProcess(input, input.TaskCheckRecord.PassOrBackDataStatus );
|
||||
}
|
||||
|
||||
[HttpGet("/houseInfo/getByTaskId")]
|
||||
[AllowAnonymous]
|
||||
[UnitOfWork]
|
||||
public async Task<HouseInfoOutputForDetailPage> GetByTaskId([Required] string taskId)
|
||||
{
|
||||
//获取任务实体
|
||||
@@ -71,7 +85,9 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo
|
||||
|
||||
//获取房屋编码信息
|
||||
var houseCodeOutputAsync = await _dapperRepository.QueryAsync<HouseCodeOutput>(
|
||||
@"SELECT HC.Id,HC.Address,HC.ProjectId,HC.ZoneId,HC.Type,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,O.Name ZoneName,Proj.Note ProjectNote,CONCAT(Proj.Name,'(',Proj.Note,')') ProjectFullName,HC.HouseCode,HC.Lng,HC.Lat,HC.No FROM bs_house_code HC
|
||||
@"SELECT
|
||||
HC.Id,HC.Address,HC.ProjectId,HC.ZoneId,HC.Type,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,O.Name ZoneName,Proj.Note ProjectNote,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',Proj.Note,')'), '')) FullProjName,HC.HouseCode,HC.Lng,HC.Lat,HC.No
|
||||
FROM bs_house_code HC
|
||||
LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId
|
||||
LEFT JOIN sys_org O ON HC.ZoneId = O.Id
|
||||
LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode
|
||||
@@ -97,6 +113,12 @@ WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId }
|
||||
taskOutput.PatrolUser = String.IsNullOrEmpty(houseTask.PatrolUser) ? currentUser.Name : houseTask.PatrolUser;
|
||||
houseInfoOutputForDetailPage.PatrolInfo = taskOutput;
|
||||
|
||||
if (houseInfo == null || houseInfo.State <= (int)DataStatus.Submited)
|
||||
{
|
||||
// 未建档或者当前数据未提交时打开,标记为已读
|
||||
await _houseLogService.Read(houseCodeOutput.Id);
|
||||
}
|
||||
|
||||
if (houseInfo == null)
|
||||
{
|
||||
houseInfoOutputForDetailPage.HouseInfo = new HouseInfoOutput();
|
||||
@@ -120,9 +142,9 @@ WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId }
|
||||
var houseEntity = await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(h => h.HouseCodeId == input.houseCode.Id);
|
||||
|
||||
//建档审核通过的房屋数据修改时,对应的建档任务Task不处理
|
||||
var houseTask = input.PatrolInfo.Adapt<BsHouseTask>();
|
||||
if (houseEntity == null || houseEntity.State != 6)
|
||||
{
|
||||
var houseTask = input.PatrolInfo.Adapt<BsHouseTask>();
|
||||
houseTask.HouseCodeId = input.houseCode.Id;
|
||||
//任务没有暂存状态,其他状态与HouseInfo的State一致
|
||||
houseTask.Status = dataStatus == DataStatus.TempSaved ? (int)DataStatus.Saved : (int)dataStatus;
|
||||
@@ -146,12 +168,36 @@ WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId }
|
||||
await houseInfo.UpdateExcludeAsync(new[] { nameof(BsHouseInfo.HouseGrade) }, true);
|
||||
}
|
||||
|
||||
if(dataStatus == DataStatus.Submited)
|
||||
{
|
||||
await _houseLogService.Done(input.houseCode.Id);
|
||||
|
||||
var org = await _userManager.GetUserOrgInfo();
|
||||
|
||||
var _sysEmpRep = Db.GetRepository<SysEmp>();
|
||||
var _sysUserRoleRep = Db.GetRepository<SysUserRole>();
|
||||
var _sysRoleRep = Db.GetRepository<SysRole>();
|
||||
var zoneManagerList = await (from u in _sysUserRep.DetachedEntities
|
||||
join e in _sysEmpRep.DetachedEntities on u.Id equals e.Id
|
||||
join ur in _sysUserRoleRep.DetachedEntities on u.Id equals ur.SysUserId
|
||||
join r in _sysRoleRep.DetachedEntities on ur.SysRoleId equals r.Id
|
||||
where e.OrgId == org.Id && r.Code == Enum.GetName(HouseManagerRole.ZoneManager).ToUnderScoreCase()
|
||||
select u).ToListAsync();
|
||||
|
||||
await _houseLogService.Add(input.houseCode.Id, zoneManagerList, HouseLogType.Check);
|
||||
}
|
||||
//审核操作则新增一条审核记录
|
||||
if (dataStatus == DataStatus.Back || dataStatus == DataStatus.Passed)
|
||||
{
|
||||
var checkRecord = input.TaskCheckRecord.Adapt<BsHouseTaskCheckRecord>();
|
||||
await checkRecord.InsertAsync();
|
||||
await _houseLogService.Done(input.houseCode.Id);
|
||||
await _houseLogService.AddThenDone(input.houseCode.Id, _userManager.User, dataStatus == DataStatus.Passed ? HouseLogType.Agree : HouseLogType.Disagree);
|
||||
if (dataStatus == DataStatus.Back)
|
||||
{
|
||||
var user = await _sysUserRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(houseTask.UserID));
|
||||
await _houseLogService.Add(input.houseCode.Id, user, HouseLogType.CreateInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
public class HouseLogInput
|
||||
{
|
||||
[Required(ErrorMessage = "Id不能为空")]
|
||||
public string Id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
public class HouseLogOutput
|
||||
{
|
||||
public string TargetUserNames { get; set; }
|
||||
public int Type { get; set; }
|
||||
public int Status { get; set; }
|
||||
public DateTime CreatedTime { get; set; }
|
||||
public DateTime? UpdatedTimeg { get; set; }
|
||||
public string CreatedUserName { get; set; }
|
||||
public string UpdatedUserName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
using Dapper;
|
||||
using Ewide.Core;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.DatabaseAccessor.Extensions;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DynamicApiController;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 房屋流转日志
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Name = "HouseLog", Order = 210)]
|
||||
public class HouseLogService : IHouseLogService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IDapperRepository _dapperRep;
|
||||
|
||||
private readonly IRepository<BsHouseLog> _bsHouseLogRep;
|
||||
|
||||
public HouseLogService(IDapperRepository dapperRep, IRepository<BsHouseLog> bsHouseLogRep)
|
||||
{
|
||||
_dapperRep = dapperRep;
|
||||
_bsHouseLogRep = bsHouseLogRep;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task Add(string houseCodeId, SysUser targetUser, HouseLogType type)
|
||||
{
|
||||
await Add(houseCodeId, new List<SysUser> { targetUser }, type);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task Add(string houseCodeId, List<SysUser> targetUsers, HouseLogType type)
|
||||
{
|
||||
await new BsHouseLog
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
HouseCodeId = houseCodeId,
|
||||
TargetUserIds = String.Join(",", targetUsers.Select(p => p.Id)),
|
||||
Type = type,
|
||||
Status = HouseLogStatus.Handle
|
||||
}.InsertAsync();
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task Read(string houseCodeId)
|
||||
{
|
||||
var log = await _bsHouseLogRep
|
||||
.Where(p => p.HouseCodeId.Equals(houseCodeId) && p.Status.Equals(HouseLogStatus.Handle))
|
||||
.OrderByDescending(p => p.CreatedTime)
|
||||
.FirstOrDefaultAsync();
|
||||
if (log != null)
|
||||
{
|
||||
log.Status = HouseLogStatus.Handling;
|
||||
await log.UpdateAsync();
|
||||
}
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task Done(string houseCodeId)
|
||||
{
|
||||
var log = await _bsHouseLogRep
|
||||
.Where(p => p.HouseCodeId.Equals(houseCodeId) && !p.Status.Equals(HouseLogStatus.Handled))
|
||||
.OrderByDescending(p => p.CreatedTime)
|
||||
.FirstOrDefaultAsync();
|
||||
if (log != null)
|
||||
{
|
||||
log.Status = HouseLogStatus.Handled;
|
||||
await log.UpdateAsync();
|
||||
}
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task AddThenRead(string houseCodeId, SysUser targetUser, HouseLogType type)
|
||||
{
|
||||
await AddThenRead(houseCodeId, new List<SysUser> { targetUser }, type);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task AddThenRead(string houseCodeId, List<SysUser> targetUsers, HouseLogType type)
|
||||
{
|
||||
await new BsHouseLog
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
HouseCodeId = houseCodeId,
|
||||
TargetUserIds = String.Join(",", targetUsers.Select(p => p.Id)),
|
||||
Type = type,
|
||||
Status = HouseLogStatus.Handling
|
||||
}.InsertAsync();
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task AddThenDone(string houseCodeId, SysUser targetUser, HouseLogType type)
|
||||
{
|
||||
await AddThenDone(houseCodeId, new List<SysUser> { targetUser }, type);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task AddThenDone(string houseCodeId, List<SysUser> targetUsers, HouseLogType type)
|
||||
{
|
||||
await new BsHouseLog
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
HouseCodeId = houseCodeId,
|
||||
TargetUserIds = String.Join(",", targetUsers.Select(p => p.Id)),
|
||||
Type = type,
|
||||
Status = HouseLogStatus.Handled
|
||||
}.InsertAsync();
|
||||
}
|
||||
|
||||
[HttpGet("/houseLog/list")]
|
||||
public async Task<dynamic> List([FromQuery] HouseLogInput input)
|
||||
{
|
||||
var sql = @"SELECT *,
|
||||
(SELECT GROUP_CONCAT(`Name`) FROM sys_user
|
||||
WHERE Id IN (
|
||||
SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(_HL.TargetUserIds,',',HT.help_topic_id + 1),',',-1)
|
||||
FROM bs_house_log _HL
|
||||
JOIN mysql.help_topic HT ON HT.help_topic_id < (LENGTH(_HL.TargetUserIds) - LENGTH(REPLACE(_HL.TargetUserIds,',','')) + 1)
|
||||
WHERE _HL.Id = HL.Id
|
||||
)
|
||||
) TargetUserNames
|
||||
FROM bs_house_log HL
|
||||
WHERE HouseCodeId = @HouseCodeId
|
||||
ORDER BY HL.CreatedTime DESC, Type DESC";
|
||||
|
||||
return await _dapperRep.QueryAsync<HouseLogOutput>(sql, new { houseCodeId = input.Id });
|
||||
}
|
||||
|
||||
[HttpGet("/houseLog/listByInfoId")]
|
||||
public async Task<dynamic> ListByInfoId([FromQuery] HouseLogInput input)
|
||||
{
|
||||
var info = await Db.GetRepository<BsHouseInfo>().DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(input.Id));
|
||||
return await List(new HouseLogInput
|
||||
{
|
||||
Id = info.HouseCodeId
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet("/houseLog/listByTaskId")]
|
||||
public async Task<dynamic> ListByTaskId([FromQuery] HouseLogInput input)
|
||||
{
|
||||
var task = await Db.GetRepository<BsHouseTask>().DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(input.Id));
|
||||
return await List(new HouseLogInput
|
||||
{
|
||||
Id = task.HouseCodeId
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Ewide.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application.Service
|
||||
{
|
||||
public interface IHouseLogService
|
||||
{
|
||||
Task Add(string houseCodeId, SysUser targetUser, HouseLogType type);
|
||||
Task Add(string houseCodeId, List<SysUser> targetUsers, HouseLogType type);
|
||||
Task Read(string houseCodeId);
|
||||
Task Done(string houseCodeId);
|
||||
Task AddThenRead(string houseCodeId, SysUser targetUser, HouseLogType type);
|
||||
Task AddThenRead(string houseCodeId, List<SysUser> targetUsers, HouseLogType type);
|
||||
Task AddThenDone(string houseCodeId, SysUser targetUser, HouseLogType type);
|
||||
Task AddThenDone(string houseCodeId, List<SysUser> targetUsers, HouseLogType type);
|
||||
Task<dynamic> List(HouseLogInput input);
|
||||
Task<dynamic> ListByInfoId(HouseLogInput input);
|
||||
Task<dynamic> ListByTaskId(HouseLogInput input);
|
||||
}
|
||||
}
|
||||
@@ -322,14 +322,5 @@ WHERE SU.Id=@Id";
|
||||
|
||||
return roles;
|
||||
}
|
||||
|
||||
[HttpGet("/houseMember/test")]
|
||||
[Microsoft.AspNetCore.Authorization.AllowAnonymous]
|
||||
public async Task<dynamic> Test([FromQuery] string str)
|
||||
{
|
||||
var result1 = str.ToCamelCase();
|
||||
var result2 = str.ToUnderScoreCase();
|
||||
return result1 + "," + result2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,12 +69,12 @@ namespace Ewide.Application.Service.HouseProjectInfo
|
||||
/// <summary>
|
||||
/// 通过ID获取项目
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/houseProjectInfo/detailById")]
|
||||
public async Task<BsHouseProjectInfo> GetProjectById([Required] string id)
|
||||
[HttpGet("/houseProjectInfo/getById")]
|
||||
public async Task<BsHouseProjectInfo> GetById([Required] string projectId)
|
||||
{
|
||||
return await _houseProjectInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == id);
|
||||
return await _houseProjectInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == projectId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Ewide.Application.Service.HouseProjectInfo
|
||||
Task AddProject(AddProjectInput input);
|
||||
Task DeleteProject(DeleteProjectInput input);
|
||||
Task UpdateProject(UpdateProjectInput input);
|
||||
Task<BsHouseProjectInfo> GetProjectById([FromRoute] string id);
|
||||
Task<BsHouseProjectInfo> GetById([FromRoute] string projectId);
|
||||
Task<dynamic> GetProject([FromQuery] QueryProjectInput input);
|
||||
Task<dynamic> QueryProjectPageList([FromQuery] PageProjectInput input);
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using Dapper;
|
||||
using Ewide.Core;
|
||||
using Ewide.Core.Extension;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.DatabaseAccessor.Extensions;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DynamicApiController;
|
||||
using Furion.FriendlyException;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
@@ -19,26 +21,38 @@ namespace Ewide.Application.Service
|
||||
[ApiDescriptionSettings(Name = "HouseSelector", Order = 180)]
|
||||
public class HouseSelectorService : IHouseSelectorService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IDapperRepository _dapperRep;
|
||||
|
||||
private readonly IRepository<BsHouseMemberRelation> _bsHouseMemberRelationRep;
|
||||
private readonly IRepository<BsHouseCode> _bsHouseCodeRep;
|
||||
private readonly IRepository<BsHouseTask> _bsHouseTaskRep;
|
||||
private readonly IRepository<SysUser> _sysUserRep;
|
||||
private readonly IHouseZoneService _houseZoneService;
|
||||
|
||||
private readonly IHouseLogService _houseLogService;
|
||||
|
||||
public HouseSelectorService(
|
||||
IUserManager userManager,
|
||||
IDapperRepository dapperRep,
|
||||
IRepository<BsHouseMemberRelation> bsHouseMemberRelationRep,
|
||||
IRepository<BsHouseCode> bsHouseCodeRep,
|
||||
IRepository<BsHouseTask> bsHouseTaskRep,
|
||||
IHouseZoneService houseZoneService
|
||||
IRepository<SysUser> sysUserRep,
|
||||
IHouseZoneService houseZoneService,
|
||||
IHouseLogService houseLogService
|
||||
)
|
||||
{
|
||||
_userManager = userManager;
|
||||
|
||||
_dapperRep = dapperRep;
|
||||
_bsHouseMemberRelationRep = bsHouseMemberRelationRep;
|
||||
_bsHouseCodeRep = bsHouseCodeRep;
|
||||
_bsHouseTaskRep = bsHouseTaskRep;
|
||||
_sysUserRep = sysUserRep;
|
||||
_houseZoneService = houseZoneService;
|
||||
|
||||
_houseLogService = houseLogService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -50,7 +64,7 @@ namespace Ewide.Application.Service
|
||||
public async Task<dynamic> HouseSelectorList([FromBody] QueryHouseSelectorInput input)
|
||||
{
|
||||
var sql = @"SELECT
|
||||
HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`,'(',Proj.Note,')') FullProjName
|
||||
HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',Proj.Note,')'), '')) FullProjName
|
||||
FROM bs_house_code HC
|
||||
LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId
|
||||
LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode
|
||||
@@ -77,7 +91,7 @@ WHERE HM.Id IS NULL";
|
||||
public async Task<dynamic> HouseSelectedList([FromBody] QueryHouseSelectorInput input)
|
||||
{
|
||||
var sql = @"SELECT
|
||||
HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`,'(',Proj.Note,')') FullProjName
|
||||
HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',Proj.Note,')'), '')) FullProjName
|
||||
FROM bs_house_code HC
|
||||
LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId
|
||||
LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode
|
||||
@@ -128,8 +142,10 @@ INNER JOIN (SELECT * FROM bs_house_member_relation WHERE SysUserId = @UserId) HM
|
||||
|
||||
if (ids.Count == 0) throw Oops.Oh("当前房屋在此之前已经全部被选中,请确认");
|
||||
|
||||
var selectedUser = await _sysUserRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(input.UserId));
|
||||
|
||||
// 从用户所在片区中过滤房屋
|
||||
var zoneId = await _houseZoneService.GetZoneByUser(input.UserId);
|
||||
var zoneId = await _houseZoneService.GetZoneByUser(selectedUser.Id);
|
||||
var house = await _bsHouseCodeRep.DetachedEntities.Where(p => ids.Contains(p.Id) && p.ZoneId == zoneId).Select(p => p.Id).ToListAsync();
|
||||
|
||||
if (house.Count == 0) throw Oops.Oh("选中的房屋错误");
|
||||
@@ -137,32 +153,52 @@ INNER JOIN (SELECT * FROM bs_house_member_relation WHERE SysUserId = @UserId) HM
|
||||
#endregion
|
||||
|
||||
// 选定房屋
|
||||
house.ForEach(p =>
|
||||
house.ForEach(async p =>
|
||||
{
|
||||
new BsHouseMemberRelation
|
||||
{
|
||||
SysUserId = input.UserId,
|
||||
HouseCodeId = p
|
||||
}.Insert();
|
||||
|
||||
var initTask = _bsHouseTaskRep.DetachedEntities.FirstOrDefault(t =>t.HouseCodeId == p && t.TaskType == 0);
|
||||
if (initTask == null)
|
||||
var originalTask = _bsHouseTaskRep.DetachedEntities.FirstOrDefault(t =>t.HouseCodeId == p && t.TaskType == 0);
|
||||
if (originalTask == null)
|
||||
{
|
||||
new BsHouseTask
|
||||
{
|
||||
Id = System.Guid.NewGuid().ToString(),
|
||||
HouseCodeId = p,
|
||||
UserID = input.UserId,
|
||||
UserID = selectedUser.Id,
|
||||
EndTime = System.DateTime.Now.AddMonths(1),
|
||||
Status = 0,
|
||||
TaskType = 0
|
||||
}.Insert();
|
||||
|
||||
await _houseLogService.Done(p);
|
||||
await _houseLogService.Add(p, selectedUser, HouseLogType.CreateInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
initTask.UserID = input.UserId;
|
||||
initTask.Update();
|
||||
await _houseLogService.AddThenDone(p, _userManager.User, HouseLogType.SelectMember);
|
||||
if (originalTask.Status != 6)//建档未完成,生成新建档任务分配给新的人员;原建档任务数据保留,有效性设置为false,取消巡查关系
|
||||
{
|
||||
var newTask = originalTask.Adapt<BsHouseTask>();
|
||||
newTask.Id = System.Guid.NewGuid().ToString();
|
||||
newTask.UserID = input.UserId;
|
||||
newTask.EndTime = System.DateTime.Now.AddMonths(1);
|
||||
newTask.Insert();
|
||||
|
||||
originalTask.IsEnabled = false;
|
||||
originalTask.Update();
|
||||
|
||||
await _houseLogService.Add(p, selectedUser, HouseLogType.CreateInfo);
|
||||
}//已建档完成,不再分配建档任务,仅更换巡查关系
|
||||
else
|
||||
{
|
||||
var originalRelation = _bsHouseMemberRelationRep.DetachedEntities.FirstOrDefault(r => r.HouseCodeId == p && r.SysUserId == originalTask.UserID);
|
||||
originalRelation.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
new BsHouseMemberRelation
|
||||
{
|
||||
SysUserId = selectedUser.Id,
|
||||
HouseCodeId = p
|
||||
}.Insert();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -154,5 +154,20 @@ namespace Ewide.Application
|
||||
public string ReportRemark { get; set; }
|
||||
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 提交时间
|
||||
/// </summary>
|
||||
public DateTime? SubmitTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后提交时间
|
||||
/// </summary>
|
||||
public DateTime? LastSubmitTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有效
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,40 +29,44 @@ namespace Ewide.Application.Service
|
||||
private readonly IDapperRepository _dapperRepository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public HouseTaskService(IRepository<BsHouseTask> HouseTaskRep, IRepository<BsHouseInfo> HouseInfoRep, IDapperRepository dapperRepository, IUserManager userManager)
|
||||
private readonly IHouseLogService _houseLogService;
|
||||
|
||||
public HouseTaskService(IRepository<BsHouseTask> HouseTaskRep, IRepository<BsHouseInfo> HouseInfoRep, IDapperRepository dapperRepository, IUserManager userManager, IHouseLogService houseLogService)
|
||||
{
|
||||
_houseTaskRep = HouseTaskRep;
|
||||
_houseInfoRep = HouseInfoRep;
|
||||
_dapperRepository = dapperRepository;
|
||||
_userManager = userManager;
|
||||
|
||||
_houseLogService = houseLogService;
|
||||
}
|
||||
|
||||
[HttpPost("/houseTask/page")]
|
||||
public async Task<dynamic> QueryPage([FromBody] QueryHouseTaskInput input)
|
||||
{
|
||||
var sql = @"SELECT T.Id,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,Proj.Name,CONCAT(Proj.Name,'(',Proj.Note,')') FullProjName,HC.HouseCode,HC.Address,T.EndTime,HC.Type,HC.Industry,HC.No,T.Status,IFNULL(HI.State,0) State FROM `bs_house_task` T
|
||||
var sql = @"SELECT T.Id,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,Proj.Name,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',Proj.Note,')'), '')) FullProjName,HC.HouseCode,HC.Address,T.EndTime,HC.Type,HC.Industry,HC.No,T.Status,IFNULL(HI.State,0) State FROM `bs_house_task` T
|
||||
LEFT JOIN bs_house_code HC ON T.HouseCodeId = HC.Id
|
||||
LEFT JOIN bs_house_info HI ON HI.HouseCodeId = T.HouseCodeId
|
||||
LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId
|
||||
LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode
|
||||
LEFT JOIN sys_area_code RA ON RA.AdCode = SUBSTR(CA.AdCode,1,9)
|
||||
LEFT JOIN sys_area_code AA ON AA.AdCode = SUBSTR(CA.AdCode,1,6)
|
||||
WHERE {0}";
|
||||
WHERE T.IsEnabled = 1 {0}";
|
||||
var user = await _userManager.CheckUserAsync();
|
||||
if (user == null) throw Oops.Oh("登录信息丢失");
|
||||
|
||||
var userRoles = await _userManager.GetUserRoleList();
|
||||
var userOrg = await _userManager.GetUserOrgInfo();
|
||||
var param = new DynamicParameters();
|
||||
if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.HouseSecurityManager).ToUnderScoreCase()).Count() > 0)
|
||||
if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.HouseSecurityManager).ToUnderScoreCase()).Any())
|
||||
{
|
||||
sql = String.Format(sql, " T.UserID=@UserID ");
|
||||
sql = String.Format(sql, " AND T.UserID=@UserID ");
|
||||
param.Add("UserID", user.Id);
|
||||
}
|
||||
|
||||
if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.ZoneManager).ToUnderScoreCase()).Count() > 0)
|
||||
if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.ZoneManager).ToUnderScoreCase()).Any())
|
||||
{
|
||||
sql = String.Format(sql, " (T.Status=3 OR T.Status=6) AND HC.ZoneId = @ZoneId ");
|
||||
sql = String.Format(sql, " AND (T.Status=3 OR T.Status=6) AND HC.ZoneId = @ZoneId ");
|
||||
param.Add("ZoneId", userOrg.Id);
|
||||
}
|
||||
|
||||
@@ -90,6 +94,9 @@ WHERE {0}";
|
||||
houseInfo.State = 5;
|
||||
await houseInfo.UpdateExcludeAsync(new[] { nameof(BsHouseInfo.HouseGrade) }, true);
|
||||
}
|
||||
|
||||
// 提交时流转日志
|
||||
await _houseLogService.Done(houseTask.HouseCodeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,12 @@ namespace Ewide.Application.Service
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
[HttpGet("/houseZone/getById")]
|
||||
public async Task<dynamic> GetById([Required] string zoneId)
|
||||
{
|
||||
return await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == zoneId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询片区
|
||||
/// </summary>
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace Ewide.Core.Extension.DataFilter.Entity
|
||||
/// <param name="filterFields"></param>
|
||||
public void SetSearchInfo(SearchInfo[] searchInfo, IEnumerable<string> filterFields)
|
||||
{
|
||||
if (searchInfo == null) return;
|
||||
try
|
||||
{
|
||||
foreach (var elem in searchInfo)
|
||||
|
||||
@@ -232,7 +232,7 @@ WHERE SNU.UserId = @UserId AND SN.Status = @Status";
|
||||
},
|
||||
new[]
|
||||
{
|
||||
"Type","Title"
|
||||
"Type","Title","ReadStatus"
|
||||
}
|
||||
);
|
||||
|
||||
@@ -254,8 +254,10 @@ WHERE SNU.UserId = @UserId AND SN.Status = @Status";
|
||||
[HttpGet("/sysNotice/unread")]
|
||||
public async Task<int> GetUnreadCount()
|
||||
{
|
||||
var noticeList = await _sysNoticeRep.Where(u => u.Status != (int)NoticeStatus.DELETED).Select(s => s.Id).ToListAsync();
|
||||
return await _sysNoticeUserRep.Where(u => u.UserId == _userManager.UserId && noticeList.Contains(u.NoticeId) && u.ReadStatus == (int)NoticeUserStatus.UNREAD).CountAsync();
|
||||
//删除 或者 草稿都不让显示
|
||||
var noticeList = await _sysNoticeRep.Where(u => u.Status != (int)NoticeStatus.DELETED&& u.Status != (int)NoticeStatus.DRAFT).Select(s => s.Id).ToListAsync();
|
||||
var noticeUserList = await _sysNoticeUserRep.Where(u => u.UserId == _userManager.UserId && noticeList.Contains(u.NoticeId) && u.ReadStatus == (int)NoticeUserStatus.UNREAD).ToListAsync();
|
||||
return noticeUserList.Count();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -547,10 +547,13 @@
|
||||
line-height: @layout-header-height - 16px;
|
||||
|
||||
height: @layout-header-height - 20px;
|
||||
|
||||
color: fade(@black, 35%);
|
||||
.anticon {
|
||||
color: fade(@black, 35%);
|
||||
}
|
||||
&:hover {
|
||||
color: @icon-color-hover;
|
||||
background-color: fade(@black, 5%);
|
||||
.anticon {
|
||||
color: @icon-color-hover;
|
||||
@@ -596,10 +599,12 @@
|
||||
}
|
||||
.header-actions {
|
||||
.header-action {
|
||||
color: fade(@white, 60%);
|
||||
.anticon {
|
||||
color: fade(@white, 60%);
|
||||
}
|
||||
&:hover {
|
||||
color: @white;
|
||||
background-color: fade(@white, 20%);
|
||||
.anticon {
|
||||
color: @white;
|
||||
|
||||
@@ -541,10 +541,13 @@
|
||||
line-height: @layout-header-height - 16px;
|
||||
|
||||
height: @layout-header-height - 20px;
|
||||
|
||||
color: fade(@black, 35%);
|
||||
.anticon {
|
||||
color: fade(@black, 35%);
|
||||
}
|
||||
&:hover {
|
||||
color: @icon-color-hover;
|
||||
background-color: fade(@black, 5%);
|
||||
.anticon {
|
||||
color: @icon-color-hover;
|
||||
@@ -590,10 +593,12 @@
|
||||
}
|
||||
.header-actions {
|
||||
.header-action {
|
||||
color: fade(@white, 60%);
|
||||
.anticon {
|
||||
color: fade(@white, 60%);
|
||||
}
|
||||
&:hover {
|
||||
color: @white;
|
||||
background-color: fade(@white, 20%);
|
||||
.anticon {
|
||||
color: @white;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const urls = {
|
||||
houseInfoGetByTaskId: ['/houseInfo/getByTaskId', 'get'],
|
||||
houseInfoSave: ['houseInfo/save', 'post'],
|
||||
houseInfoCheck: ['houseInfo/check', 'post'],
|
||||
houseInfoSubmitToCheck: ['/houseInfo/submitToCheck', 'post']
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ const urls = {
|
||||
houseProejctDelete: ['/houseProjectInfo/delete', 'post'],
|
||||
houseProejctDetail: ['/houseProjectInfo/detail', 'get'],
|
||||
houseProjectNextSort: ['/houseProjectInfo/nextSort', 'get'],
|
||||
houseProjectList: ['houseProjectInfo/list', 'get']
|
||||
houseProjectList: ['houseProjectInfo/list', 'get'],
|
||||
houseProjectGetById: ['houseProjectInfo/getById', 'get']
|
||||
}
|
||||
|
||||
export default urls
|
||||
@@ -8,7 +8,8 @@ const urls = {
|
||||
houseZoneList: '/houseZone/list',
|
||||
houseZoneAutoIncrement: '/houseZone/autoIncrement',
|
||||
houseZoneAdd: ['/houseZone/add', 'post'],
|
||||
houseZoneEdit: ['/houseZone/edit', 'post']
|
||||
houseZoneEdit: ['/houseZone/edit', 'post'],
|
||||
houseZoneGetById: ['/houseZone/getById', 'get']
|
||||
}
|
||||
|
||||
export default urls
|
||||
72
web-react/src/components/business/house-log.jsx
Normal file
72
web-react/src/components/business/house-log.jsx
Normal file
@@ -0,0 +1,72 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Spin, Steps, Timeline } from 'antd'
|
||||
import { AntIcon } from 'components'
|
||||
import { api } from 'common/api'
|
||||
import getDictData from 'util/dic'
|
||||
import { toCamelCase } from 'util/format'
|
||||
|
||||
export default class houseLog extends Component {
|
||||
state = {
|
||||
loading: true,
|
||||
codes: {
|
||||
houseLogType: [],
|
||||
},
|
||||
data: [],
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
const { id, infoId, taskId } = this.props
|
||||
const state = { loading: false }
|
||||
|
||||
state.codes = await getDictData('house_log_type')
|
||||
|
||||
if (id) {
|
||||
} else if (infoId) {
|
||||
} else if (taskId) {
|
||||
const { data } = await api.houseLogListByTaskId({ id: taskId })
|
||||
state.data = data
|
||||
}
|
||||
this.setState(state)
|
||||
}
|
||||
|
||||
bindCodeValue(code, name) {
|
||||
name = toCamelCase(name)
|
||||
const codes = this.state.codes[name]
|
||||
if (codes) {
|
||||
const c = codes.find(p => p.code == code)
|
||||
if (c) {
|
||||
return c.value
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
render() {
|
||||
const { loading, codes, data } = this.state
|
||||
|
||||
return (
|
||||
<Spin spinning={loading} indicator={<AntIcon type="loading" />}>
|
||||
<Timeline mode="left">
|
||||
{data.map((item, i) => (
|
||||
<Timeline.Item
|
||||
key={i}
|
||||
dot={
|
||||
[
|
||||
,
|
||||
<AntIcon type="clock-circle" />,
|
||||
<AntIcon type="check-circle" />,
|
||||
][item.status]
|
||||
}
|
||||
>
|
||||
<h5 className="h5">
|
||||
{this.bindCodeValue(item.type, 'house_log_type')}
|
||||
</h5>
|
||||
<p className="text-gray">{item.updatedTime}</p>
|
||||
<p>{item.targetUserNames}</p>
|
||||
</Timeline.Item>
|
||||
))}
|
||||
</Timeline>
|
||||
</Spin>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -14,3 +14,5 @@ export { default as QueryList } from './query-list'
|
||||
export { default as QueryTable } from './query-table'
|
||||
export { default as QueryTableActions } from './query-table-actions'
|
||||
export { default as QueryTreeLayout } from './query-tree-layout'
|
||||
|
||||
export { default as HouseLog } from './business/house-log'
|
||||
@@ -26,7 +26,7 @@ export default class QueryTableActions extends Component {
|
||||
(series && node.className == className) ||
|
||||
(!node.nextElementSibling && node.className == className)
|
||||
) {
|
||||
node.remove()
|
||||
node.style.display = 'none'
|
||||
series = false
|
||||
} else if (node.className == className) {
|
||||
series = true
|
||||
|
||||
@@ -50,11 +50,11 @@ export default class index extends Component {
|
||||
title: '房屋编码',
|
||||
dataIndex: 'houseCode',
|
||||
sorter: true,
|
||||
width: 300,
|
||||
width: 400,
|
||||
render: (text, record) => (
|
||||
<>
|
||||
{`${record.areaName}-${record.roadName}-${record.commName}-${
|
||||
record.note
|
||||
record.fullProjName
|
||||
}-${record.no.toString().padStart(3, '0')}`}
|
||||
<br />
|
||||
<Tag color="purple">{text}</Tag>
|
||||
@@ -77,9 +77,9 @@ export default class index extends Component {
|
||||
},
|
||||
{
|
||||
title: '登记时间',
|
||||
width: 180,
|
||||
dataIndex: 'createdTime',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Form, Button, Input, Descriptions, message as Message, Modal, Spin, Tabs } from 'antd'
|
||||
import { merge, isEqual, pickBy } from 'lodash'
|
||||
import { AntIcon, ComponentDynamic, Container } from 'components'
|
||||
import { AntIcon, ComponentDynamic, Container, Auth } from 'components'
|
||||
import { api } from 'common/api'
|
||||
|
||||
const tabs = [
|
||||
@@ -58,7 +58,7 @@ const actions = {
|
||||
after: 'close',
|
||||
},
|
||||
check: {
|
||||
action: 'houseInfoSave',
|
||||
action: 'houseInfoCheck',
|
||||
remark: '审核',
|
||||
after: 'close',
|
||||
},
|
||||
@@ -222,6 +222,7 @@ export default class index extends Component {
|
||||
<Container mode="fluid">
|
||||
<div className="yo-form-page--bar-inner">
|
||||
<span>
|
||||
<Auth auth={{ houseInfo: 'check' }}>
|
||||
{this.state.taskStatus == 3 && (
|
||||
<Form ref={this.checkForm} layout="inline">
|
||||
<Form.Item
|
||||
@@ -257,6 +258,7 @@ export default class index extends Component {
|
||||
</Form.Item>
|
||||
</Form>
|
||||
)}
|
||||
</Auth>
|
||||
</span>
|
||||
<span>
|
||||
{this.state.taskStatus >= -1 && this.state.taskStatus < 3 && (
|
||||
@@ -302,7 +304,7 @@ export default class index extends Component {
|
||||
`${record.houseCode.areaName}-${
|
||||
record.houseCode.roadName
|
||||
}-${record.houseCode.commName}-${
|
||||
record.houseCode.projectFullName
|
||||
record.houseCode.fullProjName
|
||||
}-${record.houseCode.no.toString().padStart(3, '0')}`}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item span="2" label="编码">
|
||||
|
||||
@@ -48,9 +48,9 @@ export default class index extends Component {
|
||||
sorter: true,
|
||||
width: 300,
|
||||
render: (text, record) =>
|
||||
`${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${record.no
|
||||
.toString()
|
||||
.padStart(3, '0')}`,
|
||||
`${record.areaName}-${record.roadName}-${record.commName}-${
|
||||
record.fullProjName
|
||||
}-${record.no.toString().padStart(3, '0')}`,
|
||||
},
|
||||
{
|
||||
title: '房屋性质及行业',
|
||||
|
||||
@@ -48,9 +48,9 @@ export default class index extends Component {
|
||||
sorter: true,
|
||||
width: 300,
|
||||
render: (text, record) =>
|
||||
`${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${record.no
|
||||
.toString()
|
||||
.padStart(3, '0')}`,
|
||||
`${record.areaName}-${record.roadName}-${record.commName}-${
|
||||
record.fullProjName
|
||||
}-${record.no.toString().padStart(3, '0')}`,
|
||||
},
|
||||
{
|
||||
title: '房屋性质及行业',
|
||||
|
||||
@@ -41,19 +41,29 @@ export default class form extends Component {
|
||||
* @param {*} params
|
||||
*/
|
||||
async fillData(params) {
|
||||
const areaCodeDefault = params.record
|
||||
? params.record.areaCode
|
||||
: params.pid
|
||||
? params.pid
|
||||
: ''
|
||||
let areaCodeDefault = params.pid ? params.pid : ''
|
||||
this.houseType = params.record ? params.record.type : 1
|
||||
this.record = cloneDeep(params.record)
|
||||
if (params.id) {
|
||||
this.setState({
|
||||
loading: true,
|
||||
})
|
||||
|
||||
api.houseProjectGetById({ projectId: params.id }).then(({ data }) => {
|
||||
areaCodeDefault = data.areaCode
|
||||
this.record = data
|
||||
|
||||
this.setState({
|
||||
loading: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
// this.record = cloneDeep(params.record)
|
||||
this.initRecord = cloneDeep(params.record)
|
||||
//#region 从后端转换成前段所需格式
|
||||
const areaData = await this.loadAreaData()
|
||||
|
||||
this.setState({
|
||||
exist: !!params.record,
|
||||
exist: !!params.id,
|
||||
options: { areaData },
|
||||
})
|
||||
|
||||
@@ -81,8 +91,10 @@ export default class form extends Component {
|
||||
if (areaCodeDefault) {
|
||||
findCode(areaData)
|
||||
this.areaCode = areaCodeDefault
|
||||
if (!this.state.exist) {
|
||||
this.nextSort(this.areaCode, this.houseType)
|
||||
}
|
||||
}
|
||||
|
||||
this.record = {
|
||||
pid: params.pid,
|
||||
|
||||
@@ -88,7 +88,7 @@ export default class index extends Component {
|
||||
render: (text, record) => (
|
||||
<QueryTableActions>
|
||||
<Auth auth="houseProjectInfo:edit">
|
||||
<a onClick={() => this.onOpen(this.editForm, record)}>编辑</a>
|
||||
<a onClick={() => this.onOpen(this.editForm, record.id)}>编辑</a>
|
||||
</Auth>
|
||||
<Auth auth="houseProjectInfo:delete">
|
||||
<Popconfirm
|
||||
@@ -200,10 +200,11 @@ export default class index extends Component {
|
||||
* @param {*} modal
|
||||
* @param {*} record
|
||||
*/
|
||||
onOpen(modal, record) {
|
||||
onOpen(modal, id) {
|
||||
modal.current.open({
|
||||
pid: this.selectCode,
|
||||
record,
|
||||
// record,
|
||||
id,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ export default class index extends Component {
|
||||
render: (text, record) => (
|
||||
<>
|
||||
{`${record.areaName}-${record.roadName}-${record.commName}-${
|
||||
record.note
|
||||
record.fullProjName
|
||||
}-${record.no.toString().padStart(3, '0')}`}
|
||||
<br />
|
||||
<Tag color="purple">{text}</Tag>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Card, Form, Input, message as Message, Radio, Select, Tag } from 'antd'
|
||||
import { Card, Checkbox, Form, Input, message as Message, Radio, Select, Tag } from 'antd'
|
||||
import { Auth, Container, QueryTable, QueryTableActions } from 'components'
|
||||
import { api } from 'common/api'
|
||||
import auth from 'components/authorized/handler'
|
||||
@@ -7,6 +7,7 @@ import { isEqual } from 'lodash'
|
||||
import getDictData from 'util/dic'
|
||||
import { toCamelCase } from 'util/format'
|
||||
import { getSearchInfo } from 'util/query'
|
||||
import { checkboxCheckedNone } from 'util/tool'
|
||||
|
||||
/**
|
||||
* 注释段[\/**\/]为必须要改
|
||||
@@ -49,11 +50,11 @@ export default class index extends Component {
|
||||
title: '房屋编码',
|
||||
dataIndex: 'houseCode',
|
||||
sorter: true,
|
||||
width: 300,
|
||||
width: 400,
|
||||
render: (text, record) => (
|
||||
<>
|
||||
{`${record.areaName}-${record.roadName}-${record.commName}-${
|
||||
record.note
|
||||
record.fullProjName
|
||||
}-${record.no.toString().padStart(3, '0')}`}
|
||||
<br />
|
||||
<Tag color="purple">{text}</Tag>
|
||||
@@ -245,12 +246,22 @@ export default class index extends Component {
|
||||
columns={this.columns}
|
||||
queryInitialValues={{
|
||||
type: '',
|
||||
state: 0,
|
||||
state: [-1, 0, 1, 2],
|
||||
}}
|
||||
onQueryChange={values => {
|
||||
if (values.hasOwnProperty('type')) {
|
||||
this.setState({ type: values.type })
|
||||
}
|
||||
if (values.hasOwnProperty('state')) {
|
||||
const value = checkboxCheckedNone({
|
||||
value: values.state,
|
||||
length: codes.houseStatus.length,
|
||||
required: true,
|
||||
})
|
||||
return {
|
||||
state: value,
|
||||
}
|
||||
}
|
||||
}}
|
||||
query={
|
||||
<Auth auth={{ [authName]: 'page' }}>
|
||||
@@ -286,14 +297,14 @@ export default class index extends Component {
|
||||
<Input autoComplete="off" placeholder="请输入房屋唯一编码" />
|
||||
</Form.Item>
|
||||
<Form.Item label="建档状态" name="state">
|
||||
<Select allowClear className="w-150" placeholder="建档状态">
|
||||
<Select.Option value="">全部</Select.Option>
|
||||
<Checkbox.Group>
|
||||
<Checkbox value="">全部</Checkbox>
|
||||
{codes.houseStatus.map(item => (
|
||||
<Select.Option key={item.code} value={+item.code}>
|
||||
<Checkbox key={item.code} value={+item.code}>
|
||||
{item.value}
|
||||
</Select.Option>
|
||||
</Checkbox>
|
||||
))}
|
||||
</Select>
|
||||
</Checkbox.Group>
|
||||
</Form.Item>
|
||||
</Auth>
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Form, Input, InputNumber, Spin, TreeSelect } from 'antd'
|
||||
import { AntIcon } from 'components'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { cloneDeep, pickBy } from 'lodash'
|
||||
import { api } from 'common/api'
|
||||
import { numberToChinese } from 'util/format'
|
||||
import store from 'store'
|
||||
@@ -54,12 +54,25 @@ export default class form extends Component {
|
||||
*/
|
||||
async fillData(params) {
|
||||
const { user } = this.state
|
||||
this.record = cloneDeep(params.record)
|
||||
if (params.id) {
|
||||
this.setState({
|
||||
loading: true,
|
||||
})
|
||||
|
||||
api.houseZoneGetById({ zoneId: params.id }).then(({ data }) => {
|
||||
this.record = data
|
||||
|
||||
this.setState({
|
||||
loading: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
// this.record = cloneDeep(params.record)
|
||||
//#region 从后端转换成前段所需格式
|
||||
const orgData = await this.loadOrgData()
|
||||
|
||||
this.setState({
|
||||
exist: !!params.record,
|
||||
exist: !!params.id,
|
||||
options: { orgData },
|
||||
})
|
||||
|
||||
@@ -78,7 +91,7 @@ export default class form extends Component {
|
||||
}
|
||||
|
||||
//#endregion
|
||||
if (!params.record && !!params.orgId) {
|
||||
if (!params.id && !!params.orgId) {
|
||||
this.onOrgIdChanged(params.orgId)
|
||||
}
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
|
||||
@@ -80,7 +80,7 @@ export default class index extends Component {
|
||||
render: (text, record) => (
|
||||
<QueryTableActions>
|
||||
<Auth auth="houseZone:edit">
|
||||
<a onClick={() => this.onOpen(this.editForm, record)}>编辑</a>
|
||||
<a onClick={() => this.onOpen(this.editForm, record.id)}>编辑</a>
|
||||
</Auth>
|
||||
<Auth auth="houseZone:delete">
|
||||
<Popconfirm
|
||||
@@ -180,10 +180,11 @@ export default class index extends Component {
|
||||
* @param {*} modal
|
||||
* @param {*} record
|
||||
*/
|
||||
onOpen(modal, record) {
|
||||
onOpen(modal, id) {
|
||||
modal.current.open({
|
||||
orgId: this.selectId,
|
||||
record,
|
||||
// record,
|
||||
id,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,6 @@ export default class form extends Component {
|
||||
*/
|
||||
async getData() {
|
||||
const form = this.form.current
|
||||
console.log(this.record)
|
||||
const valid = await form.validateFields()
|
||||
if (valid) {
|
||||
const postData = form.getFieldsValue()
|
||||
|
||||
@@ -56,28 +56,38 @@ export default class index extends Component {
|
||||
{
|
||||
title: '标题',
|
||||
dataIndex: 'title',
|
||||
width: 300,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '发布人',
|
||||
dataIndex: 'publicUserName',
|
||||
width: 120,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '发布时间',
|
||||
dataIndex: 'createdTime',
|
||||
width: 150,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '发布单位',
|
||||
dataIndex: 'publicOrgName',
|
||||
width: 200,
|
||||
width: 150,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
width: 120,
|
||||
sorter: true,
|
||||
render: text => this.bindCodeValue(text, 'notice_type'),
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
width: 120,
|
||||
render: text => this.bindCodeValue(text, 'notice_status'),
|
||||
},
|
||||
]
|
||||
@@ -94,7 +104,7 @@ export default class index extends Component {
|
||||
if (flag) {
|
||||
this.columns.push({
|
||||
title: '操作',
|
||||
width: 150,
|
||||
width: 200,
|
||||
dataIndex: 'actions',
|
||||
render: (text, record) => (
|
||||
<QueryTableActions>
|
||||
@@ -178,6 +188,7 @@ export default class index extends Component {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
subUniqueKey(text, index) {
|
||||
return text.substr(index, 5)
|
||||
}
|
||||
@@ -252,26 +263,23 @@ export default class index extends Component {
|
||||
* @param {*} id
|
||||
*/
|
||||
onDelete(id) {
|
||||
this.onAction(apiAction.Status({ id, Status: 3 }), '删除成功')
|
||||
this.onAction(apiAction.Status({ id, status: 3 }), '删除成功')
|
||||
}
|
||||
/**
|
||||
* 发布
|
||||
* @param {*} id
|
||||
*/
|
||||
onPublish(id) {
|
||||
this.onAction(apiAction.Status({ id, Status: 1 }), '发布成功')
|
||||
this.onAction(apiAction.Status({ id, status: 1 }), '发布成功')
|
||||
}
|
||||
/**
|
||||
* 撤回
|
||||
* @param {*} id
|
||||
*/
|
||||
onGoBack(id) {
|
||||
this.onAction(apiAction.Status({ id, Status: 2 }), '撤回成功')
|
||||
this.onAction(apiAction.Status({ id, status: 2 }), '撤回成功')
|
||||
} //
|
||||
|
||||
//#region 自定义方法
|
||||
//#endregion
|
||||
|
||||
render() {
|
||||
const { codes } = this.state
|
||||
return (
|
||||
@@ -280,7 +288,6 @@ export default class index extends Component {
|
||||
<Card bordered={false}>
|
||||
<QueryTable
|
||||
ref={this.table}
|
||||
rowkey={record => record.id}
|
||||
autoLoad={false}
|
||||
loadData={this.loadData}
|
||||
columns={this.columns}
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Spin, Divider, Modal, Row } from 'antd'
|
||||
import { Spin, Divider, Modal, Row, Form, Upload } from 'antd'
|
||||
import { api } from 'common/api'
|
||||
import { AntIcon } from 'components'
|
||||
import { BlobToBase64, GetFileName, PreviewFile } from 'util/file'
|
||||
|
||||
export default class form extends Component {
|
||||
state = {
|
||||
detailVisible: false,
|
||||
detailLoading: false,
|
||||
detailData: {},
|
||||
fileValue: false,
|
||||
}
|
||||
|
||||
filedu = React.createRef()
|
||||
/**
|
||||
* mount后回调
|
||||
*/
|
||||
@@ -20,12 +23,57 @@ export default class form extends Component {
|
||||
async onOpenDetail(id) {
|
||||
this.setState({ detailLoading: true, detailVisible: true })
|
||||
const { data } = await api.sysNoticeDetail({ id })
|
||||
|
||||
this.setState({
|
||||
detailLoading: false,
|
||||
detailData: data,
|
||||
fileValue: false,
|
||||
})
|
||||
|
||||
if (data) {
|
||||
const { attachments } = data
|
||||
if (attachments) {
|
||||
const fileValue = []
|
||||
const fileList = attachments.split(',')
|
||||
for (const fileId of fileList) {
|
||||
try {
|
||||
const file = await PreviewFile(fileId)
|
||||
const base64 = await BlobToBase64(file)
|
||||
fileValue.push({
|
||||
uid: fileId,
|
||||
response: fileId,
|
||||
name: file.name,
|
||||
url: base64,
|
||||
status: 'done',
|
||||
})
|
||||
} catch {
|
||||
const { data: file } = await api.sysFileInfoDetail({ id: fileId })
|
||||
fileValue.push({
|
||||
uid: fileId,
|
||||
response: '文件已丢失',
|
||||
name: file.fileOriginName,
|
||||
status: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
this.setState({
|
||||
fileValue,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async onFileDownload(file) {
|
||||
const { data, headers } = await api.sysFileInfoDownload({ id: file.response })
|
||||
const url = window.URL.createObjectURL(data)
|
||||
const fileName = GetFileName(headers['content-disposition'])
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = fileName
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
a.remove()
|
||||
}
|
||||
render() {
|
||||
const { detailLoading, detailVisible, detailData } = this.state
|
||||
return (
|
||||
@@ -43,6 +91,21 @@ export default class form extends Component {
|
||||
dangerouslySetInnerHTML={{ __html: detailData.content }}
|
||||
></div>
|
||||
<Divider />
|
||||
{this.state.fileValue && (
|
||||
<Row>
|
||||
<span>
|
||||
查看附件
|
||||
<Upload
|
||||
fileList={this.state.fileValue}
|
||||
showUploadList={{
|
||||
showDownloadIcon: true,
|
||||
}}
|
||||
onDownload={file => this.onFileDownload(file)}
|
||||
></Upload>
|
||||
</span>
|
||||
</Row>
|
||||
)}
|
||||
<Divider />
|
||||
<Row justify="space-between" className="text-gray">
|
||||
<span>发布人:{detailData.publicUserName}</span>
|
||||
<span>发布时间:{detailData.publicTime} </span>
|
||||
|
||||
@@ -20,6 +20,7 @@ export default class index extends Component {
|
||||
codes: {
|
||||
noticeStatus: [],
|
||||
noticeType: [],
|
||||
readStatus: [],
|
||||
},
|
||||
}
|
||||
|
||||
@@ -33,25 +34,39 @@ export default class index extends Component {
|
||||
{
|
||||
title: '标题',
|
||||
dataIndex: 'title',
|
||||
width: 300,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '发布人',
|
||||
dataIndex: 'publicUserName',
|
||||
width: 150,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '发布时间',
|
||||
dataIndex: 'createdTime',
|
||||
width: 200,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '发布单位',
|
||||
dataIndex: 'publicOrgName',
|
||||
width: 200,
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
width: 120,
|
||||
render: text => this.bindCodeValue(text, 'notice_type'),
|
||||
},
|
||||
{
|
||||
title: '已读未读',
|
||||
dataIndex: 'readStatus',
|
||||
width: 120,
|
||||
render: text => this.bindCodeValue(text, 'read_status'),
|
||||
},
|
||||
]
|
||||
|
||||
/**
|
||||
@@ -94,33 +109,13 @@ export default class index extends Component {
|
||||
componentDidMount() {
|
||||
const { onLoading, onLoadData } = this.table.current
|
||||
onLoading()
|
||||
getDictData('notice_status', 'notice_type').then(codes => {
|
||||
getDictData('notice_status', 'notice_type', 'read_status').then(codes => {
|
||||
this.setState({ codes }, () => {
|
||||
onLoadData()
|
||||
})
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 对表格上的操作进行统一处理
|
||||
* [异步]
|
||||
* @param {*} action
|
||||
* @param {*} successMessage
|
||||
*/
|
||||
async onAction(action, successMessage) {
|
||||
const { onLoading, onLoaded, onReloadData } = this.table.current
|
||||
onLoading()
|
||||
try {
|
||||
if (action) {
|
||||
await action
|
||||
}
|
||||
if (successMessage) {
|
||||
Message.success(successMessage)
|
||||
}
|
||||
onReloadData()
|
||||
} catch {
|
||||
onLoaded()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用加载数据接口,可在调用前对query进行处理
|
||||
* [异步,必要]
|
||||
@@ -134,6 +129,7 @@ export default class index extends Component {
|
||||
queryType: {
|
||||
type: QueryType.Equal,
|
||||
title: QueryType.Like,
|
||||
readStatus: QueryType.Equal,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -200,6 +196,19 @@ export default class index extends Component {
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item label="已读未读" name="readStatus">
|
||||
<Select
|
||||
placeholder="请选择是否已读"
|
||||
className="w-200"
|
||||
allowClear
|
||||
>
|
||||
{codes.readStatus.map(item => (
|
||||
<Select.Option key={item.code} value={item.code}>
|
||||
{item.value}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</Auth>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -38,6 +38,11 @@ export const RSA_PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQU
|
||||
*/
|
||||
export const CITY = '黄石市'
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export const AMAP_WEBAPI_KEY = 'ca01719fe09757131a1249c273619a17'
|
||||
|
||||
/**
|
||||
* 响应式响应宽度
|
||||
*/
|
||||
|
||||
23
web-react/src/util/tool/index.js
Normal file
23
web-react/src/util/tool/index.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { first, last } from "lodash"
|
||||
|
||||
export const checkboxCheckedNone = (arg) => {
|
||||
let { value, length, noneValue, required } = arg
|
||||
if (length === undefined) length = 2
|
||||
if (noneValue === undefined) noneValue = ''
|
||||
if (required === undefined) required = false
|
||||
|
||||
if (first(value) === noneValue && value.length > 1) {
|
||||
// 在'无'之后选中其他值
|
||||
value.shift()
|
||||
} else if (
|
||||
value.length >= length
|
||||
||
|
||||
(last(value) === noneValue && value.length > 1)
|
||||
||
|
||||
(!value.length && required)
|
||||
) {
|
||||
// 在其他值之后选中'无'
|
||||
value = [noneValue]
|
||||
}
|
||||
return value
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import { api } from 'common/api'
|
||||
|
||||
import Logo from '../logo'
|
||||
import Search from './search'
|
||||
import Weather from './weather'
|
||||
import Notice from './notice'
|
||||
import User from './user'
|
||||
|
||||
@@ -53,6 +54,7 @@ export default class index extends Component {
|
||||
<Search />
|
||||
</div>
|
||||
<div className="header-actions">
|
||||
<Weather />
|
||||
<Tooltip placement="bottom" title="重新加载框架">
|
||||
<span
|
||||
className="header-action"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Badge, Button, Divider, List, Menu, Modal, Popover, Row, Spin } from 'antd'
|
||||
import { Badge, Button, Divider, List, Menu, Modal, Popover, Row, Spin, Upload, Tag } from 'antd'
|
||||
import { AntIcon, Image } from 'components'
|
||||
import { api } from 'common/api'
|
||||
import InfiniteScroll from 'react-infinite-scroller'
|
||||
import { BlobToBase64, GetFileName, PreviewFile } from 'util/file'
|
||||
import moment from 'moment'
|
||||
|
||||
export default class notice extends Component {
|
||||
@@ -16,6 +17,7 @@ export default class notice extends Component {
|
||||
detailVisible: false,
|
||||
detailLoading: false,
|
||||
detailData: {},
|
||||
fileValue: false,
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
@@ -42,7 +44,6 @@ export default class notice extends Component {
|
||||
sortField: 'createdTime',
|
||||
sortOrder: 'descend',
|
||||
})
|
||||
|
||||
if (!items.length) {
|
||||
return this.finish()
|
||||
}
|
||||
@@ -59,7 +60,51 @@ export default class notice extends Component {
|
||||
this.setState({
|
||||
detailLoading: false,
|
||||
detailData: data,
|
||||
fileValue: false,
|
||||
})
|
||||
|
||||
if (data) {
|
||||
const { attachments } = data
|
||||
if (attachments) {
|
||||
const fileValue = []
|
||||
const fileList = attachments.split(',')
|
||||
for (const fileId of fileList) {
|
||||
try {
|
||||
const file = await PreviewFile(fileId)
|
||||
const base64 = await BlobToBase64(file)
|
||||
fileValue.push({
|
||||
uid: fileId,
|
||||
response: fileId,
|
||||
name: file.name,
|
||||
url: base64,
|
||||
status: 'done',
|
||||
})
|
||||
} catch {
|
||||
const { data: file } = await api.sysFileInfoDetail({ id: fileId })
|
||||
fileValue.push({
|
||||
uid: fileId,
|
||||
response: '文件已丢失',
|
||||
name: file.fileOriginName,
|
||||
status: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
this.setState({
|
||||
fileValue,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
async onFileDownload(file) {
|
||||
const { data, headers } = await api.sysFileInfoDownload({ id: file.response })
|
||||
const url = window.URL.createObjectURL(data)
|
||||
const fileName = GetFileName(headers['content-disposition'])
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = fileName
|
||||
a.click()
|
||||
window.URL.revokeObjectURL(url)
|
||||
a.remove()
|
||||
}
|
||||
|
||||
renderList() {
|
||||
@@ -88,6 +133,13 @@ export default class notice extends Component {
|
||||
</small>
|
||||
</>
|
||||
}
|
||||
description={
|
||||
item.readStatus == 0 ? (
|
||||
<Tag color="#f50">未读</Tag>
|
||||
) : (
|
||||
<Tag color="#2db7f5">已读</Tag>
|
||||
)
|
||||
}
|
||||
/>
|
||||
<div className="ellipsis-3 text-gray">{item.content}</div>
|
||||
</List.Item>
|
||||
@@ -140,6 +192,21 @@ export default class notice extends Component {
|
||||
dangerouslySetInnerHTML={{ __html: detailData.content }}
|
||||
></div>
|
||||
<Divider />
|
||||
{this.state.fileValue && (
|
||||
<Row className="text-gray">
|
||||
<span>
|
||||
查看附件
|
||||
<Upload
|
||||
fileList={this.state.fileValue}
|
||||
showUploadList={{
|
||||
showDownloadIcon: true,
|
||||
}}
|
||||
onDownload={file => this.onFileDownload(file)}
|
||||
></Upload>
|
||||
</span>
|
||||
</Row>
|
||||
)}
|
||||
<Divider />
|
||||
<Row justify="space-between" className="text-gray">
|
||||
<span>发布人:{detailData.publicUserName}</span>
|
||||
<span>发布时间:{detailData.publicTime} </span>
|
||||
|
||||
51
web-react/src/views/main/_layout/header/weather.jsx
Normal file
51
web-react/src/views/main/_layout/header/weather.jsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Space } from 'antd'
|
||||
import AntIcon from 'components/ant-icon'
|
||||
import { axios } from 'common/api'
|
||||
import { AMAP_WEBAPI_KEY } from 'util/global'
|
||||
|
||||
export default class weather extends Component {
|
||||
state = {
|
||||
weather: '',
|
||||
temperature: 0,
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
const {
|
||||
data: { adcode },
|
||||
} = await axios.get('https://restapi.amap.com/v3/ip', {
|
||||
params: {
|
||||
key: AMAP_WEBAPI_KEY,
|
||||
},
|
||||
})
|
||||
const {
|
||||
data: { lives },
|
||||
} = await axios.get('http://restapi.amap.com/v3/weather/weatherInfo', {
|
||||
params: {
|
||||
key: AMAP_WEBAPI_KEY,
|
||||
city: adcode,
|
||||
},
|
||||
})
|
||||
if (Array.isArray(lives)) {
|
||||
const { weather, temperature } = lives.shift()
|
||||
this.setState({
|
||||
weather,
|
||||
temperature,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { weather, temperature } = this.state
|
||||
|
||||
return (
|
||||
<span className="header-action">
|
||||
<Space align="center" style={{ lineHeight: 1 }}>
|
||||
<AntIcon type="cloud" />
|
||||
<span>{temperature}℃</span>
|
||||
<span>{weather}</span>
|
||||
</Space>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user