From da14389a47342861b042332e8e83e1d927e9519e Mon Sep 17 00:00:00 2001 From: ky_yusj <2655568377@qq.com> Date: Tue, 6 Jul 2021 17:25:22 +0800 Subject: [PATCH 1/3] =?UTF-8?q?update=20=20=20=E9=A1=B9=E7=9B=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E3=80=81=E7=89=87=E5=8C=BA=E7=AE=A1=E7=90=86=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E8=AF=BB=E6=95=B0=E6=8D=AE=E6=96=B9=E5=BC=8F=E6=9B=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/Ewide.Application/Ewide.Application.xml | 2 +- .../HouseProjectInfoService.cs | 8 +++--- .../HouseSafety/HouseZone/HouseZoneService.cs | 6 ++++ .../business/houseSafety/houseProjectInfo.js | 3 +- .../business/houseSafety/houseZone.js | 3 +- .../src/pages/business/house/project/form.jsx | 28 +++++++++++++------ .../pages/business/house/project/index.jsx | 7 +++-- .../src/pages/business/house/zone/form.jsx | 21 +++++++++++--- .../src/pages/business/house/zone/index.jsx | 7 +++-- 9 files changed, 60 insertions(+), 25 deletions(-) diff --git a/Api/Ewide.Application/Ewide.Application.xml b/Api/Ewide.Application/Ewide.Application.xml index 1faa368..32fc69a 100644 --- a/Api/Ewide.Application/Ewide.Application.xml +++ b/Api/Ewide.Application/Ewide.Application.xml @@ -730,7 +730,7 @@ 通过ID获取项目 - + diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs index 60048d3..d0f8112 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs @@ -69,12 +69,12 @@ namespace Ewide.Application.Service.HouseProjectInfo /// /// 通过ID获取项目 /// - /// + /// /// - [HttpGet("/houseProjectInfo/detailById")] - public async Task GetProjectById([Required] string id) + [HttpGet("/houseProjectInfo/getById")] + public async Task GetById([Required] string projectId) { - return await _houseProjectInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == id); + return await _houseProjectInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == projectId); } /// diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs index e5aac58..791374b 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs @@ -64,6 +64,12 @@ namespace Ewide.Application.Service .ToListAsync(); } + [HttpGet("/houseZone/getById")] + public async Task GetById([Required] string zoneId) + { + return await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == zoneId); + } + /// /// 分页查询片区 /// diff --git a/web-react/src/common/api/requests/business/houseSafety/houseProjectInfo.js b/web-react/src/common/api/requests/business/houseSafety/houseProjectInfo.js index 6b3175f..2ab0b53 100644 --- a/web-react/src/common/api/requests/business/houseSafety/houseProjectInfo.js +++ b/web-react/src/common/api/requests/business/houseSafety/houseProjectInfo.js @@ -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 \ No newline at end of file diff --git a/web-react/src/common/api/requests/business/houseSafety/houseZone.js b/web-react/src/common/api/requests/business/houseSafety/houseZone.js index d042f01..29f4a98 100644 --- a/web-react/src/common/api/requests/business/houseSafety/houseZone.js +++ b/web-react/src/common/api/requests/business/houseSafety/houseZone.js @@ -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 \ No newline at end of file diff --git a/web-react/src/pages/business/house/project/form.jsx b/web-react/src/pages/business/house/project/form.jsx index 31a7ea1..cee85f4 100644 --- a/web-react/src/pages/business/house/project/form.jsx +++ b/web-react/src/pages/business/house/project/form.jsx @@ -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,7 +91,9 @@ export default class form extends Component { if (areaCodeDefault) { findCode(areaData) this.areaCode = areaCodeDefault - this.nextSort(this.areaCode, this.houseType) + if (!this.state.exist) { + this.nextSort(this.areaCode, this.houseType) + } } this.record = { diff --git a/web-react/src/pages/business/house/project/index.jsx b/web-react/src/pages/business/house/project/index.jsx index 68ec611..1f6d8f7 100644 --- a/web-react/src/pages/business/house/project/index.jsx +++ b/web-react/src/pages/business/house/project/index.jsx @@ -88,7 +88,7 @@ export default class index extends Component { render: (text, record) => ( - this.onOpen(this.editForm, record)}>编辑 + this.onOpen(this.editForm, record.id)}>编辑 { + 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) diff --git a/web-react/src/pages/business/house/zone/index.jsx b/web-react/src/pages/business/house/zone/index.jsx index fb8857f..bf84083 100644 --- a/web-react/src/pages/business/house/zone/index.jsx +++ b/web-react/src/pages/business/house/zone/index.jsx @@ -80,7 +80,7 @@ export default class index extends Component { render: (text, record) => ( - this.onOpen(this.editForm, record)}>编辑 + this.onOpen(this.editForm, record.id)}>编辑 Date: Tue, 6 Jul 2021 17:26:54 +0800 Subject: [PATCH 2/3] fix --- .../HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs index 2d6824d..e8b05c6 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs @@ -14,7 +14,7 @@ namespace Ewide.Application.Service.HouseProjectInfo Task AddProject(AddProjectInput input); Task DeleteProject(DeleteProjectInput input); Task UpdateProject(UpdateProjectInput input); - Task GetProjectById([FromRoute] string id); + Task GetById([FromRoute] string projectId); Task GetProject([FromQuery] QueryProjectInput input); Task QueryProjectPageList([FromQuery] PageProjectInput input); From 40a267997f300b492146022cf2f102ca3c662970 Mon Sep 17 00:00:00 2001 From: ky_yusj <2655568377@qq.com> Date: Tue, 6 Jul 2021 17:57:38 +0800 Subject: [PATCH 3/3] merge --- Api/Ewide.Application/Ewide.Application.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Api/Ewide.Application/Ewide.Application.xml b/Api/Ewide.Application/Ewide.Application.xml index 32fc69a..fb7a3f4 100644 --- a/Api/Ewide.Application/Ewide.Application.xml +++ b/Api/Ewide.Application/Ewide.Application.xml @@ -726,7 +726,7 @@ - + 通过ID获取项目