feat: 对接前端,完成通知公告
This commit is contained in:
@@ -60,6 +60,7 @@ namespace Yi.Framework.SqlSugarCore
|
|||||||
{
|
{
|
||||||
options.ConnectionString = currentConnection;
|
options.ConnectionString = currentConnection;
|
||||||
}));
|
}));
|
||||||
|
connectionCreator.SetDbAop(SqlSugarClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
|
|||||||
Name= "Entity",
|
Name= "Entity",
|
||||||
BuildPath= "D:\\code\\Entities\\@ModelEntity.cs",
|
BuildPath= "D:\\code\\Entities\\@ModelEntity.cs",
|
||||||
Remarks= "实体",
|
Remarks= "实体",
|
||||||
TemplateStr= "using SqlSugar;\r\nusing Volo.Abp;\r\nusing Volo.Abp.Auditing;\r\nusing Volo.Abp.Domain.Entities;\r\nusing Yi.Framework.Core.Data;\r\n\r\nnamespace Yi.Framework.Rbac.Domain.Entities\r\n{\r\n /// <summary>\r\n /// 实体\r\n /// </summary>\r\n [SugarTable(\"@Model\")]\r\n public class @ModelEntity : Entity<Guid>\r\n {\r\n@field\r\n }\r\n}\r\n"
|
TemplateStr= "using SqlSugar;\r\nusing lo.Abp;\r\nusing lo.Abp.Auditing;\r\nusing lo.Abp.Domain.Entities;\r\nusing Yi.Framework.Core.Data;\r\n\r\nnamespace Yi.Framework.Rbac.Domain.Entities\r\n{\r\n /// <summary>\r\n /// 实体\r\n /// </summary>\r\n [SugarTable(\"@Model\")]\r\n public class @ModelEntity : Entity<Guid>\r\n {\r\n@field\r\n }\r\n}\r\n"
|
||||||
};
|
};
|
||||||
entities.Add(entityTemplate);
|
entities.Add(entityTemplate);
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
|
|||||||
Name = "GetListInput",
|
Name = "GetListInput",
|
||||||
BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetListInput.cs",
|
BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetListInput.cs",
|
||||||
Remarks = "列表查询参数",
|
Remarks = "列表查询参数",
|
||||||
TemplateStr = "using Yi.Framework.Ddd;\r\nusing Yi.Framework.Ddd.Application.Contracts;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n /// <summary>\r\n /// 查询参数\r\n /// </summary>\r\n public class @ModelGetListInputVo : PagedAllResultRequestDto\r\n {\r\n@field\r\n }\r\n}\r\n"
|
TemplateStr = "using Yi.Framework.Ddd;\r\nusing Yi.Framework.Ddd.Application.Contracts;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n /// <summary>\r\n /// 查询参数\r\n /// </summary>\r\n public class @ModelGetListInput : PagedAllResultRequestDto\r\n {\r\n@field\r\n }\r\n}\r\n"
|
||||||
};
|
};
|
||||||
entities.Add(getListInputTemplate);
|
entities.Add(getListInputTemplate);
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
|
|||||||
Name = "GetListOutputDto",
|
Name = "GetListOutputDto",
|
||||||
BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetListOutputDto.cs",
|
BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetListOutputDto.cs",
|
||||||
Remarks = "列表返回dto",
|
Remarks = "列表返回dto",
|
||||||
TemplateStr = "using Volo.Abp.Application.Dtos;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n public class @ModelGetListOutputDto : EntityDto<Guid>\r\n {\r\n@field\r\n }\r\n}\r\n"
|
TemplateStr = "using lo.Abp.Application.Dtos;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n public class @ModelGetListOutputDto : EntityDto<Guid>\r\n {\r\n@field\r\n }\r\n}\r\n"
|
||||||
};
|
};
|
||||||
entities.Add(getListOutputDtoTemplate);
|
entities.Add(getListOutputDtoTemplate);
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
|
|||||||
Name = "GetOutputDto",
|
Name = "GetOutputDto",
|
||||||
BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetOutputDto.cs",
|
BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetOutputDto.cs",
|
||||||
Remarks = "单返回dto",
|
Remarks = "单返回dto",
|
||||||
TemplateStr = "using Volo.Abp.Application.Dtos;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n public class @ModelGetOutputDto : EntityDto<Guid>\r\n {\r\n@field\r\n }\r\n}\r\n"
|
TemplateStr = "using lo.Abp.Application.Dtos;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n public class @ModelGetOutputDto : EntityDto<Guid>\r\n {\r\n@field\r\n }\r\n}\r\n"
|
||||||
};
|
};
|
||||||
entities.Add(getOutputDtoTemplate);
|
entities.Add(getOutputDtoTemplate);
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
|
|||||||
Name = "IServices",
|
Name = "IServices",
|
||||||
BuildPath = "D:\\code\\IServices\\I@ModelService.cs",
|
BuildPath = "D:\\code\\IServices\\I@ModelService.cs",
|
||||||
Remarks = "应用服务抽象",
|
Remarks = "应用服务抽象",
|
||||||
TemplateStr = "using Volo.Abp.Application.Services;\r\nusing Yi.Framework.Ddd.Application.Contracts;\r\nusing Yi.Framework.Rbac.Application.Contracts.Dtos.@Model;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.IServices\r\n{\r\n /// <summary>\r\n /// @Model服务抽象\r\n /// </summary>\r\n public interface I@ModelService : IYiCrudAppService<@ModelGetOutputDto, @ModelGetListOutputDto, Guid, @ModelGetListInputVo, @ModelCreateInputVo, @ModelUpdateInputVo>\r\n {\r\n\r\n }\r\n}\r\n"
|
TemplateStr = "using lo.Abp.Application.Services;\r\nusing Yi.Framework.Ddd.Application.Contracts;\r\nusing Yi.Framework.Rbac.Application.Contracts.Dtos.@Model;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.IServices\r\n{\r\n /// <summary>\r\n /// @Model服务抽象\r\n /// </summary>\r\n public interface I@ModelService : IYiCrudAppService<@ModelGetOutputDto, @ModelGetListOutputDto, Guid, @ModelGetListInput, @ModelCreateInput, @ModelUpdateInput>\r\n {\r\n\r\n }\r\n}\r\n"
|
||||||
};
|
};
|
||||||
entities.Add(iServicesTemplate);
|
entities.Add(iServicesTemplate);
|
||||||
|
|
||||||
@@ -97,9 +97,19 @@ namespace Yi.Framework.CodeGen.SqlSugarCore
|
|||||||
Name = "Service",
|
Name = "Service",
|
||||||
BuildPath = "D:\\code\\Services\\@ModelService.cs",
|
BuildPath = "D:\\code\\Services\\@ModelService.cs",
|
||||||
Remarks = "应用服务",
|
Remarks = "应用服务",
|
||||||
TemplateStr = "using SqlSugar;\r\nusing Volo.Abp.Application.Dtos;\r\nusing Volo.Abp.Application.Services;\r\nusing Yi.Framework.Ddd.Application;\r\nusing Yi.Framework.Rbac.Application.Contracts.Dtos.@Model;\r\nusing Yi.Framework.Rbac.Application.Contracts.IServices;\r\nusing Yi.Framework.Rbac.Domain.Entities;\r\nusing Yi.Framework.SqlSugarCore.Abstractions;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Services\r\n{\r\n /// <summary>\r\n /// @Model服务实现\r\n /// </summary>\r\n public class @ModelService : YiCrudAppService<@ModelEntity, @ModelGetOutputDto, @ModelGetListOutputDto, Guid, @ModelGetListInputVo, @ModelCreateInputVo, @ModelUpdateInputVo>,\r\n I@ModelService\r\n {\r\n private ISqlSugarRepository<@ModelEntity, Guid> _repository;\r\n public @ModelService(ISqlSugarRepository<@ModelEntity, Guid> repository) : base(repository)\r\n {\r\n _repository = repository;\r\n }\r\n\r\n /// <summary>\r\n /// 多查\r\n /// </summary>\r\n /// <param name=\"input\"></param>\r\n /// <returns></returns>\r\n public override async Task<PagedResultDto<@ModelGetListOutputDto>> GetListAsync(@ModelGetListInputVo input)\r\n {\r\n RefAsync<int> total = 0;\r\n\r\n var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.@ModelKey), x => x.@ModelKey.Contains(input.@ModelKey!))\r\n .WhereIF(!string.IsNullOrEmpty(input.@ModelName), x => x.@ModelName!.Contains(input.@ModelName!))\r\n .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)\r\n .ToPageListAsync(input.SkipCount, input.MaxResultCount, total);\r\n return new PagedResultDto<@ModelGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));\r\n }\r\n }\r\n}\r\n"
|
TemplateStr = "using SqlSugar;\r\nusing lo.Abp.Application.Dtos;\r\nusing lo.Abp.Application.Services;\r\nusing Yi.Framework.Ddd.Application;\r\nusing Yi.Framework.Rbac.Application.Contracts.Dtos.@Model;\r\nusing Yi.Framework.Rbac.Application.Contracts.IServices;\r\nusing Yi.Framework.Rbac.Domain.Entities;\r\nusing Yi.Framework.SqlSugarCore.Abstractions;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Services\r\n{\r\n /// <summary>\r\n /// @Model服务实现\r\n /// </summary>\r\n public class @ModelService : YiCrudAppService<@ModelEntity, @ModelGetOutputDto, @ModelGetListOutputDto, Guid, @ModelGetListInput, @ModelCreateInput, @ModelUpdateInput>,\r\n I@ModelService\r\n {\r\n private ISqlSugarRepository<@ModelEntity, Guid> _repository;\r\n public @ModelService(ISqlSugarRepository<@ModelEntity, Guid> repository) : base(repository)\r\n {\r\n _repository = repository;\r\n }\r\n\r\n /// <summary>\r\n /// 多查\r\n /// </summary>\r\n /// <param name=\"input\"></param>\r\n /// <returns></returns>\r\n public override async Task<PagedResultDto<@ModelGetListOutputDto>> GetListAsync(@ModelGetListInput input)\r\n {\r\n RefAsync<int> total = 0;\r\n\r\n var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.@ModelKey), x => x.@ModelKey.Contains(input.@ModelKey!))\r\n .WhereIF(!string.IsNullOrEmpty(input.@ModelName), x => x.@ModelName!.Contains(input.@ModelName!))\r\n .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)\r\n .ToPageListAsync(input.SkipCount, input.MaxResultCount, total);\r\n return new PagedResultDto<@ModelGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));\r\n }\r\n }\r\n}\r\n"
|
||||||
};
|
};
|
||||||
entities.Add(servicesTemplate);
|
entities.Add(servicesTemplate);
|
||||||
|
|
||||||
|
TemplateEntity apiTemplate = new TemplateEntity()
|
||||||
|
{
|
||||||
|
TemplateStr = "import request from '@/utils/request'\r\n\r\n// 分页查询\r\nexport function listData(query) {\r\n return request({\r\n url: '/@model',\r\n method: 'get',\r\n params: query\r\n })\r\n}\r\n\r\n// id查询\r\nexport function getData(id) {\r\n return request({\r\n url: `/@model/${id}`,\r\n method: 'get'\r\n })\r\n}\r\n\r\n// 新增\r\nexport function addData(data) {\r\n return request({\r\n url: '/@model',\r\n method: 'post',\r\n data: data\r\n })\r\n}\r\n\r\n// 修改\r\nexport function updateData(id,data) {\r\n return request({\r\n url: `/@model/${id}`,\r\n method: 'put',\r\n data: data\r\n })\r\n}\r\n\r\n// 删除\r\nexport function delData(ids) {\r\n return request({\r\n url: `/@model`,\r\n method: 'delete',\r\n params:{id:ids}\r\n })\r\n}\r\n",
|
||||||
|
Name = "api",
|
||||||
|
BuildPath = "D:\\code\\Api\\@ModelApi.vue",
|
||||||
|
Remarks = "前端api"
|
||||||
|
};
|
||||||
|
entities.Add(apiTemplate);
|
||||||
|
|
||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using Yi.Framework.Rbac.Domain.Shared.Enums;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Notice
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Notice输入创建对象
|
||||||
|
/// </summary>
|
||||||
|
public class NoticeCreateInput
|
||||||
|
{
|
||||||
|
public string Title { get; set; }
|
||||||
|
public NoticeTypeEnum Type { get; set; }
|
||||||
|
public string Content { get; set; }
|
||||||
|
public int OrderNum { get; set; }
|
||||||
|
public bool State { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using Yi.Framework.Ddd.Application.Contracts;
|
||||||
|
using Yi.Framework.Rbac.Domain.Shared.Enums;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Notice
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 查询参数
|
||||||
|
/// </summary>
|
||||||
|
public class NoticeGetListInput : PagedAllResultRequestDto
|
||||||
|
{
|
||||||
|
public string? Title { get; set; }
|
||||||
|
public NoticeTypeEnum? Type { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using Volo.Abp.Application.Dtos;
|
||||||
|
using Yi.Framework.Rbac.Domain.Shared.Enums;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Notice
|
||||||
|
{
|
||||||
|
public class NoticeGetListOutputDto : EntityDto<Guid>
|
||||||
|
{
|
||||||
|
public string Title { get; set; }
|
||||||
|
public NoticeTypeEnum Type { get; set; }
|
||||||
|
public string Content { get; set; }
|
||||||
|
public bool IsDeleted { get; set; }
|
||||||
|
public DateTime CreationTime { get; set; }
|
||||||
|
public Guid? CreatorId { get; set; }
|
||||||
|
public Guid? LastModifierId { get; set; }
|
||||||
|
public DateTime? LastModificationTime { get; set; }
|
||||||
|
public int OrderNum { get; set; }
|
||||||
|
public bool State { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using Volo.Abp.Application.Dtos;
|
||||||
|
using Yi.Framework.Rbac.Domain.Shared.Enums;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Notice
|
||||||
|
{
|
||||||
|
public class NoticeGetOutputDto : EntityDto<Guid>
|
||||||
|
{
|
||||||
|
public string Title { get; set; }
|
||||||
|
public NoticeTypeEnum Type { get; set; }
|
||||||
|
public string Content { get; set; }
|
||||||
|
public bool IsDeleted { get; set; }
|
||||||
|
public DateTime CreationTime { get; set; }
|
||||||
|
public Guid? CreatorId { get; set; }
|
||||||
|
public Guid? LastModifierId { get; set; }
|
||||||
|
public DateTime? LastModificationTime { get; set; }
|
||||||
|
public int OrderNum { get; set; }
|
||||||
|
public bool State { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using Yi.Framework.Rbac.Domain.Shared.Enums;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Notice
|
||||||
|
{
|
||||||
|
public class NoticeUpdateInput
|
||||||
|
{
|
||||||
|
public string? Title { get; set; }
|
||||||
|
public NoticeTypeEnum? Type { get; set; }
|
||||||
|
public string? Content { get; set; }
|
||||||
|
public int? OrderNum { get; set; }
|
||||||
|
public bool? State { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using Yi.Framework.Ddd.Application.Contracts;
|
||||||
|
using Yi.Framework.Rbac.Application.Contracts.Dtos.Notice;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Rbac.Application.Contracts.IServices
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Notice服务抽象
|
||||||
|
/// </summary>
|
||||||
|
public interface INoticeService : IYiCrudAppService<NoticeGetOutputDto, NoticeGetListOutputDto, Guid, NoticeGetListInput, NoticeCreateInput, NoticeUpdateInput>
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using Volo.Abp.Application.Dtos;
|
||||||
|
using Yi.Framework.Ddd.Application;
|
||||||
|
using Yi.Framework.Rbac.Application.Contracts.Dtos.Notice;
|
||||||
|
using Yi.Framework.Rbac.Application.Contracts.IServices;
|
||||||
|
using Yi.Framework.Rbac.Domain.Entities;
|
||||||
|
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||||
|
|
||||||
|
namespace Yi.Framework.Rbac.Application.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Notice服务实现
|
||||||
|
/// </summary>
|
||||||
|
public class NoticeService : YiCrudAppService<NoticeEntity, NoticeGetOutputDto, NoticeGetListOutputDto, Guid, NoticeGetListInput, NoticeCreateInput, NoticeUpdateInput>,
|
||||||
|
INoticeService
|
||||||
|
{
|
||||||
|
private ISqlSugarRepository<NoticeEntity, Guid> _repository;
|
||||||
|
public NoticeService(ISqlSugarRepository<NoticeEntity, Guid> repository) : base(repository)
|
||||||
|
{
|
||||||
|
_repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 多查
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override async Task<PagedResultDto<NoticeGetListOutputDto>> GetListAsync(NoticeGetListInput input)
|
||||||
|
{
|
||||||
|
RefAsync<int> total = 0;
|
||||||
|
|
||||||
|
var entities = await _repository._DbQueryable.WhereIF(input.Type is not null, x => x.Type==input.Type)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(input.Title), x => x.Title!.Contains(input.Title!))
|
||||||
|
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
|
||||||
|
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
||||||
|
return new PagedResultDto<NoticeGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,8 +5,8 @@
|
|||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"launchUrl": "swagger",
|
"launchUrl": "swagger",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
//"ASPNETCORE_ENVIRONMENT": "Development",
|
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||||
"ASPNETCORE_ENVIRONMENT": "Staging"
|
//"ASPNETCORE_ENVIRONMENT": "Staging"
|
||||||
},
|
},
|
||||||
"dotnetRunMessages": true,
|
"dotnetRunMessages": true,
|
||||||
"applicationUrl": "http://localhost:19001"
|
"applicationUrl": "http://localhost:19001"
|
||||||
|
|||||||
@@ -3,16 +3,16 @@ import request from '@/utils/request'
|
|||||||
// 查询公告列表
|
// 查询公告列表
|
||||||
export function listNotice(query) {
|
export function listNotice(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/notice/list',
|
url: '/notice',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询公告详细
|
// 查询公告详细
|
||||||
export function getNotice(noticeId) {
|
export function getNotice(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/notice/' + noticeId,
|
url: `/notice/${id}`,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -20,26 +20,26 @@ export function getNotice(noticeId) {
|
|||||||
// 新增公告
|
// 新增公告
|
||||||
export function addNotice(data) {
|
export function addNotice(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/notice',
|
url: '/notice',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改公告
|
// 修改公告
|
||||||
export function updateNotice(data) {
|
export function updateNotice(id,data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/notice',
|
url: `/notice/${id}`,
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除公告
|
// 删除公告
|
||||||
export function delNotice(noticeId) {
|
export function delNotice(ids) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/notice',
|
url: `/notice`,
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
params:{id:noticeId}
|
params:{id:ids}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="公告标题" prop="noticeTitle">
|
<el-form-item label="公告标题" prop="title">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.noticeTitle"
|
v-model="queryParams.title"
|
||||||
placeholder="请输入公告标题"
|
placeholder="请输入公告标题"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter="handleQuery"
|
@keyup.enter="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="操作人员" prop="createBy">
|
<el-form-item label="类型" prop="type">
|
||||||
<el-input
|
<el-select v-model="queryParams.type" placeholder="公告类型" clearable>
|
||||||
v-model="queryParams.createBy"
|
|
||||||
placeholder="请输入操作人员"
|
|
||||||
clearable
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="类型" prop="noticeType">
|
|
||||||
<el-select v-model="queryParams.noticeType" placeholder="公告类型" clearable>
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in sys_notice_type"
|
v-for="dict in sys_notice_type"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
@@ -68,31 +60,47 @@
|
|||||||
|
|
||||||
<el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="noticeList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
<el-table-column label="序号" align="center" prop="noticeId" width="100" />
|
<el-table-column label="序号" align="center" prop="id" width="300" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="公告标题"
|
label="公告标题"
|
||||||
align="center"
|
align="center"
|
||||||
prop="noticeTitle"
|
prop="title"
|
||||||
:show-overflow-tooltip="true"
|
:show-overflow-tooltip="true"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="公告类型" align="center" prop="noticeType" width="100">
|
<el-table-column label="公告类型" align="center" prop="type" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="sys_notice_type" :value="scope.row.noticeType" />
|
<dict-tag :options="sys_notice_type" :value="scope.row.type" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
<el-table-column label="状态" align="center" prop="state" width="100">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :options="sys_notice_status" :value="scope.row.status" />
|
<el-tag type="info">{{sys_notice_state.filter(x=>x.value==scope.row.state)[0]?.label}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建者" align="center" prop="createBy" width="100" />
|
<el-table-column label="创建时间" align="center" prop="creationTime" width="100">
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="100">
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
|
<span>{{ parseTime(scope.row.creationTime, '{y}-{m}-{d}') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
icon="Promotion"
|
||||||
|
@click="handleOnlineSend(scope.row.id)"
|
||||||
|
v-hasPermi="['system:notice:edit']"
|
||||||
|
>在线发送</el-button>
|
||||||
|
|
||||||
|
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
icon="Promotion"
|
||||||
|
@click="handleOfflineSend(scope.row.id)"
|
||||||
|
v-hasPermi="['system:notice:edit']"
|
||||||
|
>离线发送</el-button>
|
||||||
|
|
||||||
|
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
type="text"
|
||||||
icon="Edit"
|
icon="Edit"
|
||||||
@@ -122,13 +130,13 @@
|
|||||||
<el-form ref="noticeRef" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="noticeRef" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="公告标题" prop="noticeTitle">
|
<el-form-item label="公告标题" prop="title">
|
||||||
<el-input v-model="form.noticeTitle" placeholder="请输入公告标题" />
|
<el-input v-model="form.title" placeholder="请输入公告标题" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="公告类型" prop="noticeType">
|
<el-form-item label="公告类型" prop="type">
|
||||||
<el-select v-model="form.noticeType" placeholder="请选择">
|
<el-select v-model="form.type" placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in sys_notice_type"
|
v-for="dict in sys_notice_type"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
@@ -140,9 +148,9 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.state">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="dict in sys_notice_status"
|
v-for="dict in sys_notice_state"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
:label="dict.value"
|
:label="dict.value"
|
||||||
>{{ dict.label }}</el-radio>
|
>{{ dict.label }}</el-radio>
|
||||||
@@ -155,7 +163,7 @@
|
|||||||
:rows="6"
|
:rows="6"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
placeholder="请输入内容"
|
placeholder="请输入内容"
|
||||||
v-model="form.noticeContent"
|
v-model="form.content"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -175,8 +183,14 @@
|
|||||||
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice";
|
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice";
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
const { sys_notice_status, sys_notice_type } = proxy.useDict("sys_notice_status", "sys_notice_type");
|
const sys_notice_state=[
|
||||||
|
{label:'启用',value:true},
|
||||||
|
{label:'停用',value:false}
|
||||||
|
];
|
||||||
|
const sys_notice_type=[
|
||||||
|
{label:'走马灯',value:'MerryGoRound'},
|
||||||
|
{label:'提示弹窗',value:'Popup'}
|
||||||
|
];
|
||||||
const noticeList = ref([]);
|
const noticeList = ref([]);
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
@@ -192,13 +206,13 @@ const data = reactive({
|
|||||||
queryParams: {
|
queryParams: {
|
||||||
skipCount: 1,
|
skipCount: 1,
|
||||||
maxResultCount: 10,
|
maxResultCount: 10,
|
||||||
noticeTitle: undefined,
|
title: undefined,
|
||||||
createBy: undefined,
|
createBy: undefined,
|
||||||
status: undefined
|
state: undefined
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
noticeTitle: [{ required: true, message: "公告标题不能为空", trigger: "blur" }],
|
title: [{ required: true, message: "公告标题不能为空", trigger: "blur" }],
|
||||||
noticeType: [{ required: true, message: "公告类型不能为空", trigger: "change" }]
|
type: [{ required: true, message: "公告类型不能为空", trigger: "change" }]
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -208,8 +222,8 @@ const { queryParams, form, rules } = toRefs(data);
|
|||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
listNotice(queryParams.value).then(response => {
|
listNotice(queryParams.value).then(response => {
|
||||||
noticeList.value = response.rows;
|
noticeList.value = response.data.items;
|
||||||
total.value = response.total;
|
total.value = response.data.totalCount;
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -221,11 +235,11 @@ function cancel() {
|
|||||||
/** 表单重置 */
|
/** 表单重置 */
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
noticeId: undefined,
|
id: undefined,
|
||||||
noticeTitle: undefined,
|
title: undefined,
|
||||||
noticeType: undefined,
|
type: undefined,
|
||||||
noticeContent: undefined,
|
content: undefined,
|
||||||
status: "0"
|
state: true
|
||||||
};
|
};
|
||||||
proxy.resetForm("noticeRef");
|
proxy.resetForm("noticeRef");
|
||||||
}
|
}
|
||||||
@@ -241,7 +255,7 @@ function resetQuery() {
|
|||||||
}
|
}
|
||||||
/** 多选框选中数据 */
|
/** 多选框选中数据 */
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection.map(item => item.noticeId);
|
ids.value = selection.map(item => item.id);
|
||||||
single.value = selection.length != 1;
|
single.value = selection.length != 1;
|
||||||
multiple.value = !selection.length;
|
multiple.value = !selection.length;
|
||||||
}
|
}
|
||||||
@@ -254,8 +268,8 @@ function handleAdd() {
|
|||||||
/**修改按钮操作 */
|
/**修改按钮操作 */
|
||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
reset();
|
reset();
|
||||||
const noticeId = row.noticeId || ids.value;
|
const id = row.id || ids.value;
|
||||||
getNotice(noticeId).then(response => {
|
getNotice(id).then(response => {
|
||||||
form.value = response.data;
|
form.value = response.data;
|
||||||
open.value = true;
|
open.value = true;
|
||||||
title.value = "修改公告";
|
title.value = "修改公告";
|
||||||
@@ -265,12 +279,13 @@ function handleUpdate(row) {
|
|||||||
function submitForm() {
|
function submitForm() {
|
||||||
proxy.$refs["noticeRef"].validate(valid => {
|
proxy.$refs["noticeRef"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (form.value.noticeId != undefined) {
|
if (form.value.id != undefined) {
|
||||||
updateNotice(form.value).then(response => {
|
updateNotice(form.value.id,form.value).then(response => {
|
||||||
proxy.$modal.msgSuccess("修改成功");
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
addNotice(form.value).then(response => {
|
addNotice(form.value).then(response => {
|
||||||
proxy.$modal.msgSuccess("新增成功");
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
@@ -283,14 +298,21 @@ function submitForm() {
|
|||||||
}
|
}
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const noticeIds = row.noticeId || ids.value
|
const ids2 = row.id || ids.value
|
||||||
proxy.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?').then(function() {
|
proxy.$modal.confirm('是否确认删除公告编号为"' + ids2 + '"的数据项?').then(function() {
|
||||||
return delNotice(noticeIds);
|
return delNotice(ids2);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
getList();
|
getList();
|
||||||
proxy.$modal.msgSuccess("删除成功");
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleOnlineSend=(id)=>{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
const handleOfflineSend=(id)=>{
|
||||||
|
|
||||||
|
}
|
||||||
getList();
|
getList();
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user