From 82e7ac70bd5307877ede8914f8fe9185bb8730ca Mon Sep 17 00:00:00 2001 From: ky_yusj <2655568377@qq.com> Date: Tue, 11 May 2021 13:30:38 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/BsHouseProjectInfo.cs | 2 +- .../Dto/HouseProjectInfoInput.cs | 2 +- .../HouseProjectInfo/Dto/HouseProjectOutput.cs | 2 +- .../HouseProjectInfo/HouseProjectInfoService.cs | 10 +++++----- .../{houseprojectinfo => house/project}/form.vue | 16 ++++++++++------ .../project}/index.vue | 0 6 files changed, 18 insertions(+), 14 deletions(-) rename Web/src/pages/business/{houseprojectinfo => house/project}/form.vue (90%) rename Web/src/pages/business/{houseprojectinfo => house/project}/index.vue (100%) diff --git a/Api/Ewide.Application/Entity/BsHouseProjectInfo.cs b/Api/Ewide.Application/Entity/BsHouseProjectInfo.cs index b456dea..1f294e2 100644 --- a/Api/Ewide.Application/Entity/BsHouseProjectInfo.cs +++ b/Api/Ewide.Application/Entity/BsHouseProjectInfo.cs @@ -29,7 +29,7 @@ namespace Ewide.Application.Entity [Comment("区域ID")] [MaxLength(36)] [Required] - public string AreaId { get; set; } + public string AreaCode { get; set; } [Comment("类型")] [Required] diff --git a/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs b/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs index 3867919..636af34 100644 --- a/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs +++ b/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs @@ -13,7 +13,7 @@ namespace Ewide.Application.Service.HouseProjectInfo.Dto public string Name { get; set; } public string Note { get; set; } public int Sort { get; set; } - public string AreaId { get; set; } + public string AreaCode { get; set; } public int Type { get; set; } } public class AddProjectInput : HouseProjectInfoInput diff --git a/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectOutput.cs b/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectOutput.cs index 9558ace..307b548 100644 --- a/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectOutput.cs +++ b/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectOutput.cs @@ -12,7 +12,7 @@ namespace Ewide.Application.Service.HouseProjectInfo.Dto public string Name { get; set; } public string Note { get; set; } public int Sort { get; set; } - public string AreaId { get; set; } + public string AreaCode { get; set; } public string AreaName { get; set; } public int Type { get; set; } } diff --git a/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs b/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs index f2e6e0c..dbe658a 100644 --- a/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs +++ b/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs @@ -63,7 +63,7 @@ namespace Ewide.Application.Service.HouseProjectInfo public async Task UpdateProject(UpdateProjectInput input) { var project = input.Adapt(); - await project.UpdateExcludeAsync(new[] { nameof(BsHouseProjectInfo.AreaId)}, true); + await project.UpdateExcludeAsync(new[] { nameof(BsHouseProjectInfo.AreaCode) }, true); } /// @@ -85,12 +85,12 @@ namespace Ewide.Application.Service.HouseProjectInfo [HttpPost("/houseProjectInfo/page")] public async Task QueryProjectPageList([FromBody] HouseProjectInfoInput input) { - var areaID = !string.IsNullOrEmpty(input.AreaId); + var areaID = !string.IsNullOrEmpty(input.AreaCode); var areaCodeRep = Db.GetRepository(); var projects = await _houseProjectInfoRep.DetachedEntities - .Join(areaCodeRep.DetachedEntities, p => p.AreaId, a => a.Code, (p, a) => new { p, AreaName = a.Name }) - .Where(areaID, x => x.p.AreaId == input.AreaId) - .Select(x => new { x.p.Id, x.p.Name, x.p.Note, x.p.Sort, x.p.AreaId, x.AreaName, x.p.Type }.Adapt()).ToPagedListAsync(input.PageNo, input.PageSize); + .Join(areaCodeRep.DetachedEntities, p => p.AreaCode, a => a.Code, (p, a) => new { p, AreaName = a.Name }) + .Where(areaID, x => x.p.AreaCode == input.AreaCode) + .Select(x => new { x.p.Id, x.p.Name, x.p.Note, x.p.Sort, x.p.AreaCode, x.AreaName, x.p.Type }.Adapt()).ToPagedListAsync(input.PageNo, input.PageSize); return XnPageResult.PageResult(projects); } diff --git a/Web/src/pages/business/houseprojectinfo/form.vue b/Web/src/pages/business/house/project/form.vue similarity index 90% rename from Web/src/pages/business/houseprojectinfo/form.vue rename to Web/src/pages/business/house/project/form.vue index 67f82aa..b65d1a6 100644 --- a/Web/src/pages/business/houseprojectinfo/form.vue +++ b/Web/src/pages/business/house/project/form.vue @@ -12,7 +12,7 @@ - + @@ -43,16 +43,18 @@ export default { data() { return { /** 表单数据 */ - form: { areaId: '' }, + form: {}, /** 验证格式 */ rules: { /* ... */ note: [{ required: true, message: '请输入备注' }], + name: [{ required: true, message: '请输入项目名称' }], + sort: [{ required: true, message: '请输入排序' }], + areaCode: [{ required: true, message: '请选择所属区域' }], }, /** 加载异步数据状态 */ loading: false, - /** 其他成员属性 */ areaData: [], /* ... */ @@ -96,10 +98,9 @@ export default { ...defaultForm, ...params.record, /** 在此处添加其他默认数据转换 */ - areaId: areaCode[3], + areaCode, /* ... */ }); - this.areaCode = areaCode; }, /** @@ -111,7 +112,7 @@ export default { this.$refs.form.validate((valid) => { if (valid) { const record = this.$_.cloneDeep(this.form); - + record.areaCode = record.areaCode[record.areaCode.length - 1]; /** 验证通过后可以对数据进行转换得到想要提交的格式 */ /* ... */ @@ -162,6 +163,9 @@ export default { return res.data; }); }, + displayRender({ labels }) { + return labels[labels.length - 1]; + }, /* ... */ }, }; diff --git a/Web/src/pages/business/houseprojectinfo/index.vue b/Web/src/pages/business/house/project/index.vue similarity index 100% rename from Web/src/pages/business/houseprojectinfo/index.vue rename to Web/src/pages/business/house/project/index.vue