update 项目管理
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
<param name="id"></param>
|
<param name="id"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</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>
|
||||||
分页查询
|
分页查询
|
||||||
</summary>
|
</summary>
|
||||||
|
|||||||
@@ -36,4 +36,9 @@ namespace Ewide.Application.Service.HouseProjectInfo.Dto
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class PageProjectInput: HouseProjectInfoInput
|
||||||
|
{
|
||||||
|
public string pid { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Furion.DatabaseAccessor;
|
|||||||
using Furion.DatabaseAccessor.Extensions;
|
using Furion.DatabaseAccessor.Extensions;
|
||||||
using Furion.DependencyInjection;
|
using Furion.DependencyInjection;
|
||||||
using Furion.DynamicApiController;
|
using Furion.DynamicApiController;
|
||||||
|
using Furion.FriendlyException;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@@ -83,13 +84,13 @@ namespace Ewide.Application.Service.HouseProjectInfo
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("/houseProjectInfo/page")]
|
[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 areaCodeRep = Db.GetRepository<SysAreaCode>();
|
||||||
var projects = await _houseProjectInfoRep.DetachedEntities
|
var projects = await _houseProjectInfoRep.DetachedEntities
|
||||||
.Join(areaCodeRep.DetachedEntities, p => p.AreaCode, a => a.Code, (p, a) => new { p, AreaName = a.Name })
|
.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);
|
.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);
|
return XnPageResult<HouseProjectOutput>.PageResult(projects);
|
||||||
}
|
}
|
||||||
@@ -107,5 +108,24 @@ namespace Ewide.Application.Service.HouseProjectInfo
|
|||||||
|
|
||||||
return userDto;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ namespace Ewide.Application.Service.HouseProjectInfo
|
|||||||
Task UpdateProject(UpdateProjectInput input);
|
Task UpdateProject(UpdateProjectInput input);
|
||||||
Task<BsHouseProjectInfo> GetProjectById([FromRoute] string id);
|
Task<BsHouseProjectInfo> GetProjectById([FromRoute] string id);
|
||||||
Task<dynamic> GetProject([FromQuery] QueryProjectInput input);
|
Task<dynamic> GetProject([FromQuery] QueryProjectInput input);
|
||||||
Task<dynamic> QueryProjectPageList([FromQuery] HouseProjectInfoInput input);
|
Task<dynamic> QueryProjectPageList([FromQuery] PageProjectInput input);
|
||||||
|
|
||||||
|
Task<int> GetNextProjectSortByAreaCode([FromQuery] HouseProjectInfoInput input);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export default {
|
|||||||
name: [{ required: true, message: '请输入项目名称' }],
|
name: [{ required: true, message: '请输入项目名称' }],
|
||||||
sort: [{ required: true, message: '请输入排序' }],
|
sort: [{ required: true, message: '请输入排序' }],
|
||||||
areaCode: [{ required: true, message: '请选择所属区域' }],
|
areaCode: [{ required: true, message: '请选择所属区域' }],
|
||||||
|
type: [{ required: true, message: '请选择类型' }],
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 加载异步数据状态 */
|
/** 加载异步数据状态 */
|
||||||
@@ -68,7 +69,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
onFillData(params) {
|
onFillData(params) {
|
||||||
// 从字符串areaCode查找到整个层级
|
// 从字符串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 areaCode = [];
|
||||||
const findCode = (data, level) => {
|
const findCode = (data, level) => {
|
||||||
level = level || 0;
|
level = level || 0;
|
||||||
@@ -98,7 +99,7 @@ export default {
|
|||||||
...defaultForm,
|
...defaultForm,
|
||||||
...params.record,
|
...params.record,
|
||||||
/** 在此处添加其他默认数据转换 */
|
/** 在此处添加其他默认数据转换 */
|
||||||
areaCode,
|
areaCode: areaCode.length == 4 ? areaCode : [],
|
||||||
/* ... */
|
/* ... */
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,13 +8,7 @@
|
|||||||
<container>
|
<container>
|
||||||
<br />
|
<br />
|
||||||
<a-card :bordered="false">
|
<a-card :bordered="false">
|
||||||
<yo-table
|
<yo-table :columns="columns" :load-data="loadData" @query="onQuery" @resetQuery="onResetQuery" ref="table">
|
||||||
:columns="columns"
|
|
||||||
:load-data="loadData"
|
|
||||||
@query="onQuery"
|
|
||||||
@resetQuery="onResetQuery"
|
|
||||||
ref="table"
|
|
||||||
>
|
|
||||||
<Auth auth="sysArea:page" slot="query">
|
<Auth auth="sysArea:page" slot="query">
|
||||||
<!-- 此处添加查询表单控件 -->
|
<!-- 此处添加查询表单控件 -->
|
||||||
<!-- ... -->
|
<!-- ... -->
|
||||||
@@ -147,6 +141,10 @@ export default {
|
|||||||
* 传给yo-table以示意数据接口及其参数和返回的数据结构
|
* 传给yo-table以示意数据接口及其参数和返回的数据结构
|
||||||
*/
|
*/
|
||||||
loadData(params) {
|
loadData(params) {
|
||||||
|
if (!params.sortField) {
|
||||||
|
params.sortField = 'code';
|
||||||
|
params.sortOrder = 'ascend';
|
||||||
|
}
|
||||||
return this.$api[api.page]({
|
return this.$api[api.page]({
|
||||||
...params,
|
...params,
|
||||||
...this.query,
|
...this.query,
|
||||||
|
|||||||
Reference in New Issue
Block a user