update 项目管理

This commit is contained in:
2021-05-11 18:22:31 +08:00
parent 82e7ac70bd
commit 5cb9791fbd
6 changed files with 40 additions and 14 deletions

View File

@@ -37,7 +37,7 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Ewide.Application.Service.HouseProjectInfo.HouseProjectInfoService.QueryProjectPageList(Ewide.Application.Service.HouseProjectInfo.Dto.HouseProjectInfoInput)">
<member name="M:Ewide.Application.Service.HouseProjectInfo.HouseProjectInfoService.QueryProjectPageList(Ewide.Application.Service.HouseProjectInfo.Dto.PageProjectInput)">
<summary>
分页查询
</summary>

View File

@@ -36,4 +36,9 @@ namespace Ewide.Application.Service.HouseProjectInfo.Dto
{
}
public class PageProjectInput: HouseProjectInfoInput
{
public string pid { get; set; }
}
}

View File

@@ -6,6 +6,7 @@ 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;
@@ -83,13 +84,13 @@ namespace Ewide.Application.Service.HouseProjectInfo
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/houseProjectInfo/page")]
public async Task<dynamic> QueryProjectPageList([FromBody] HouseProjectInfoInput input)
public async Task<dynamic> QueryProjectPageList([FromBody] PageProjectInput input)
{
var areaID = !string.IsNullOrEmpty(input.AreaCode);
var areaCodeRep = Db.GetRepository<SysAreaCode>();
var projects = await _houseProjectInfoRep.DetachedEntities
.Join(areaCodeRep.DetachedEntities, p => p.AreaCode, a => a.Code, (p, a) => new { p, AreaName = a.Name })
.Where(areaID, x => x.p.AreaCode == input.AreaCode)
.Where(!string.IsNullOrEmpty(input.AreaCode), x => x.p.AreaCode == input.AreaCode)
.Where(!string.IsNullOrEmpty(input.pid) , x=> x.p.AreaCode.Contains(input.pid))
.Select(x => new { x.p.Id, x.p.Name, x.p.Note, x.p.Sort, x.p.AreaCode, x.AreaName, x.p.Type }.Adapt<HouseProjectOutput>()).ToPagedListAsync(input.PageNo, input.PageSize);
return XnPageResult<HouseProjectOutput>.PageResult(projects);
}
@@ -107,5 +108,24 @@ namespace Ewide.Application.Service.HouseProjectInfo
return userDto;
}
[HttpGet("/houseProjectInfo/nextSort")]
public async Task<int> GetNextProjectSortByAreaCode([FromQuery] HouseProjectInfoInput input)
{
//var projects = await _houseProjectInfoRep.DetachedEntities
// .Where(p => p.AreaCode == input.AreaCode && p.Type == input.Type)
// .Select(p => p.Sort)
// .DefaultIfEmpty()
// .MaxAsync();
if (input.Type > 2 || input.Type < 1)
{
throw Oops.Oh("类型参数异常");
}
var p = await _houseProjectInfoRep.DetachedEntities
.Where(p => p.AreaCode == input.AreaCode && p.Type == input.Type)
.MaxAsync(p => (int?)p.Sort);
return p.GetValueOrDefault(0) + 1;
}
}
}

View File

@@ -16,6 +16,8 @@ namespace Ewide.Application.Service.HouseProjectInfo
Task UpdateProject(UpdateProjectInput input);
Task<BsHouseProjectInfo> GetProjectById([FromRoute] string id);
Task<dynamic> GetProject([FromQuery] QueryProjectInput input);
Task<dynamic> QueryProjectPageList([FromQuery] HouseProjectInfoInput input);
Task<dynamic> QueryProjectPageList([FromQuery] PageProjectInput input);
Task<int> GetNextProjectSortByAreaCode([FromQuery] HouseProjectInfoInput input);
}
}

View File

@@ -51,6 +51,7 @@ export default {
name: [{ required: true, message: '请输入项目名称' }],
sort: [{ required: true, message: '请输入排序' }],
areaCode: [{ required: true, message: '请选择所属区域' }],
type: [{ required: true, message: '请选择类型' }],
},
/** 加载异步数据状态 */
@@ -68,7 +69,7 @@ export default {
*/
onFillData(params) {
// 从字符串areaCode查找到整个层级
const areaCodeDeault = params.record ? params.record.areaId : params.pid ? params.pid : '';
const areaCodeDeault = params.record ? params.record.areaCode : params.pid ? params.pid : '';
const areaCode = [];
const findCode = (data, level) => {
level = level || 0;
@@ -98,7 +99,7 @@ export default {
...defaultForm,
...params.record,
/** 在此处添加其他默认数据转换 */
areaCode,
areaCode: areaCode.length == 4 ? areaCode : [],
/* ... */
});
},

View File

@@ -8,13 +8,7 @@
<container>
<br />
<a-card :bordered="false">
<yo-table
:columns="columns"
:load-data="loadData"
@query="onQuery"
@resetQuery="onResetQuery"
ref="table"
>
<yo-table :columns="columns" :load-data="loadData" @query="onQuery" @resetQuery="onResetQuery" ref="table">
<Auth auth="sysArea:page" slot="query">
<!-- 此处添加查询表单控件 -->
<!-- ... -->
@@ -147,6 +141,10 @@ export default {
* 传给yo-table以示意数据接口及其参数和返回的数据结构
*/
loadData(params) {
if (!params.sortField) {
params.sortField = 'code';
params.sortOrder = 'ascend';
}
return this.$api[api.page]({
...params,
...this.query,