diff --git a/Api/Ewide.Application/Ewide.Application.xml b/Api/Ewide.Application/Ewide.Application.xml index 1faa368..fb7a3f4 100644 --- a/Api/Ewide.Application/Ewide.Application.xml +++ b/Api/Ewide.Application/Ewide.Application.xml @@ -726,11 +726,11 @@ - + 通过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/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); 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)}>编辑