From c35d84dd80ddca92a3813396fbe49a547d7e5d65 Mon Sep 17 00:00:00 2001
From: ky_yusj <2655568377@qq.com>
Date: Tue, 6 Jul 2021 14:30:23 +0800
Subject: [PATCH] update
---
Api/Ewide.Application/Entity/BsHouseInfo.cs | 61 ----
Api/Ewide.Application/Entity/BsHouseTask.cs | 61 ++++
Api/Ewide.Application/Ewide.Application.xml | 270 +++++++--------
.../HouseInfo/Dto/HouseInfoInput.cs | 47 +--
.../HouseInfo/Dto/HouseInfoOutput.cs | 47 +--
.../HouseTask/Dto/HouseTaskInput.cs | 45 +++
.../HouseTask/Dto/HouseTaskOutput.cs | 47 +++
.../src/pages/business/house/code/index.jsx | 4 +-
.../house/info/form/base/building.jsx | 287 +++++++++-------
.../house/info/form/base/identification.jsx | 4 +-
.../business/house/info/form/base/index.jsx | 16 +-
.../house/info/form/base/investigation.jsx | 13 +-
.../house/info/form/base/ownership.jsx | 19 +-
.../pages/business/house/info/form/index.jsx | 25 +-
.../business/house/info/form/patrol/index.jsx | 4 +
.../house/info/form/patrol/investigation.jsx | 312 ++++++++++++++++++
16 files changed, 822 insertions(+), 440 deletions(-)
create mode 100644 web-react/src/pages/business/house/info/form/patrol/investigation.jsx
diff --git a/Api/Ewide.Application/Entity/BsHouseInfo.cs b/Api/Ewide.Application/Entity/BsHouseInfo.cs
index 838106f..f7c8ea8 100644
--- a/Api/Ewide.Application/Entity/BsHouseInfo.cs
+++ b/Api/Ewide.Application/Entity/BsHouseInfo.cs
@@ -264,67 +264,6 @@ namespace Ewide.Application
[MaxLength(36)]
public string WuYeUnitId { get; set; }
- ///
- /// 房屋场地
- ///
- [Comment("房屋场地")]
- [MaxLength(100)]
- public string HouseSite { get; set; }
-
- ///
- /// 相邻施工
- ///
- [Comment("相邻施工")]
- [MaxLength(100)]
- public string AdjacentConstruction { get; set; }
-
- ///
- /// 化学侵蚀
- ///
- [Comment("化学侵蚀")]
- [MaxLength(100)]
- public string ChemicalErosion { get; set; }
-
- ///
- /// 结构拆改
- ///
- [Comment("结构拆改")]
- public int? StructuralDismantling { get; set; }
-
- ///
- /// 加层改造
- ///
- [Comment("加层改造")]
- public int? AddingLayer { get; set; }
-
- ///
- /// 修缮加固
- ///
- [Comment("修缮加固")]
- [MaxLength(100)]
- public string RepairAndReinforce { get; set; }
-
- ///
- /// 历史灾害
- ///
- [Comment("历史灾害")]
- [MaxLength(100)]
- public string HistoricalCalamity { get; set; }
-
- ///
- /// 使用功能变更
- ///
- [Comment("使用功能变更")]
- [MaxLength(100)]
- public string FunctionalChange { get; set; }
-
- ///
- /// 其他调查内容
- ///
- [Comment("其他调查内容")]
- [MaxLength(1000)]
- public string OtherContents { get; set; }
-
///
/// 图纸资料存档处
///
diff --git a/Api/Ewide.Application/Entity/BsHouseTask.cs b/Api/Ewide.Application/Entity/BsHouseTask.cs
index a316fd1..ba20803 100644
--- a/Api/Ewide.Application/Entity/BsHouseTask.cs
+++ b/Api/Ewide.Application/Entity/BsHouseTask.cs
@@ -76,6 +76,67 @@ namespace Ewide.Application
[Comment("综合等级")]
public int? ComprehensiveGrade { get; set; }
+ ///
+ /// 房屋场地
+ ///
+ [Comment("房屋场地")]
+ [MaxLength(100)]
+ public string HouseSite { get; set; }
+
+ ///
+ /// 相邻施工
+ ///
+ [Comment("相邻施工")]
+ [MaxLength(100)]
+ public string AdjacentConstruction { get; set; }
+
+ ///
+ /// 化学侵蚀
+ ///
+ [Comment("化学侵蚀")]
+ [MaxLength(100)]
+ public string ChemicalErosion { get; set; }
+
+ ///
+ /// 结构拆改
+ ///
+ [Comment("结构拆改")]
+ public int? StructuralDismantling { get; set; }
+
+ ///
+ /// 加层改造
+ ///
+ [Comment("加层改造")]
+ public int? AddingLayer { get; set; }
+
+ ///
+ /// 修缮加固
+ ///
+ [Comment("修缮加固")]
+ [MaxLength(100)]
+ public string RepairAndReinforce { get; set; }
+
+ ///
+ /// 历史灾害
+ ///
+ [Comment("历史灾害")]
+ [MaxLength(100)]
+ public string HistoricalCalamity { get; set; }
+
+ ///
+ /// 使用功能变更
+ ///
+ [Comment("使用功能变更")]
+ [MaxLength(100)]
+ public string FunctionalChange { get; set; }
+
+ ///
+ /// 其他调查内容
+ ///
+ [Comment("其他调查内容")]
+ [MaxLength(1000)]
+ public string OtherContents { get; set; }
+
///
/// 主要安全隐患综述
///
diff --git a/Api/Ewide.Application/Ewide.Application.xml b/Api/Ewide.Application/Ewide.Application.xml
index 38cf1b7..1faa368 100644
--- a/Api/Ewide.Application/Ewide.Application.xml
+++ b/Api/Ewide.Application/Ewide.Application.xml
@@ -219,51 +219,6 @@
物业单位ID
-
-
- 房屋场地
-
-
-
-
- 相邻施工
-
-
-
-
- 化学侵蚀
-
-
-
-
- 结构拆改
-
-
-
-
- 加层改造
-
-
-
-
- 修缮加固
-
-
-
-
- 历史灾害
-
-
-
-
- 使用功能变更
-
-
-
-
- 其他调查内容
-
-
图纸资料存档处
@@ -394,6 +349,51 @@
综合等级
+
+
+ 房屋场地
+
+
+
+
+ 相邻施工
+
+
+
+
+ 化学侵蚀
+
+
+
+
+ 结构拆改
+
+
+
+
+ 加层改造
+
+
+
+
+ 修缮加固
+
+
+
+
+ 历史灾害
+
+
+
+
+ 使用功能变更
+
+
+
+
+ 其他调查内容
+
+
主要安全隐患综述
@@ -916,51 +916,6 @@
其它套数
-
-
- 房屋场地
-
-
-
-
- 相邻施工
-
-
-
-
- 化学侵蚀
-
-
-
-
- 结构拆改
-
-
-
-
- 加层改造
-
-
-
-
- 修缮加固
-
-
-
-
- 历史灾害
-
-
-
-
- 使用功能变更
-
-
-
-
- 其他调查内容
-
-
房屋等级 1,2,3,4,C,d
@@ -1141,51 +1096,6 @@
其它套数
-
-
- 房屋场地
-
-
-
-
- 相邻施工
-
-
-
-
- 化学侵蚀
-
-
-
-
- 结构拆改
-
-
-
-
- 加层改造
-
-
-
-
- 修缮加固
-
-
-
-
- 历史灾害
-
-
-
-
- 使用功能变更
-
-
-
-
- 其他调查内容
-
-
房屋等级 1,2,3,4,C,d
@@ -1296,6 +1206,51 @@
其他情况附件
+
+
+ 房屋场地
+
+
+
+
+ 相邻施工
+
+
+
+
+ 化学侵蚀
+
+
+
+
+ 结构拆改
+
+
+
+
+ 加层改造
+
+
+
+
+ 修缮加固
+
+
+
+
+ 历史灾害
+
+
+
+
+ 使用功能变更
+
+
+
+
+ 其他调查内容
+
+
主要安全隐患综述
@@ -1386,6 +1341,51 @@
综合等级
+
+
+ 房屋场地
+
+
+
+
+ 相邻施工
+
+
+
+
+ 化学侵蚀
+
+
+
+
+ 结构拆改
+
+
+
+
+ 加层改造
+
+
+
+
+ 修缮加固
+
+
+
+
+ 历史灾害
+
+
+
+
+ 使用功能变更
+
+
+
+
+ 其他调查内容
+
+
主要安全隐患综述
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoInput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoInput.cs
index 191fb3a..6977a3f 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoInput.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoInput.cs
@@ -138,52 +138,7 @@ namespace Ewide.Application
#endregion
#region 管理情况manager
#endregion
- #region 调查情况investigation
- ///
- /// 房屋场地
- ///
- public string HouseSite { get; set; }
-
- ///
- /// 相邻施工
- ///
- public string AdjacentConstruction { get; set; }
-
- ///
- /// 化学侵蚀
- ///
- public string ChemicalErosion { get; set; }
-
- ///
- /// 结构拆改
- ///
- public int? StructuralDismantling { get; set; }
-
- ///
- /// 加层改造
- ///
- public int? AddingLayer { get; set; }
-
- ///
- /// 修缮加固
- ///
- public string RepairAndReinforce { get; set; }
-
- ///
- /// 历史灾害
- ///
- public string HistoricalCalamity { get; set; }
-
- ///
- /// 使用功能变更
- ///
- public string FunctionalChange { get; set; }
-
- ///
- /// 其他调查内容
- ///
- public string OtherContents { get; set; }
- #endregion
+
#region 鉴定治理identification
///
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoOutput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoOutput.cs
index 21322f0..104f44d 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoOutput.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/Dto/HouseInfoOutput.cs
@@ -138,52 +138,7 @@ namespace Ewide.Application
#endregion
#region 管理情况manager
#endregion
- #region 调查情况investigation
- ///
- /// 房屋场地
- ///
- public string HouseSite { get; set; }
-
- ///
- /// 相邻施工
- ///
- public string AdjacentConstruction { get; set; }
-
- ///
- /// 化学侵蚀
- ///
- public string ChemicalErosion { get; set; }
-
- ///
- /// 结构拆改
- ///
- public int? StructuralDismantling { get; set; }
-
- ///
- /// 加层改造
- ///
- public int? AddingLayer { get; set; }
-
- ///
- /// 修缮加固
- ///
- public string RepairAndReinforce { get; set; }
-
- ///
- /// 历史灾害
- ///
- public string HistoricalCalamity { get; set; }
-
- ///
- /// 使用功能变更
- ///
- public string FunctionalChange { get; set; }
-
- ///
- /// 其他调查内容
- ///
- public string OtherContents { get; set; }
- #endregion
+
#region 鉴定治理identification
///
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskInput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskInput.cs
index 1f02d17..53bdf4b 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskInput.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskInput.cs
@@ -42,7 +42,52 @@ namespace Ewide.Application
public int DamageGrade { get; set; }
//[Required(ErrorMessage = "巡查综合等级不能为空")]
public int ComprehensiveGrade { get; set; }
+ #region 调查情况investigation
+ ///
+ /// 房屋场地
+ ///
+ public string HouseSite { get; set; }
+ ///
+ /// 相邻施工
+ ///
+ public string AdjacentConstruction { get; set; }
+
+ ///
+ /// 化学侵蚀
+ ///
+ public string ChemicalErosion { get; set; }
+
+ ///
+ /// 结构拆改
+ ///
+ public int? StructuralDismantling { get; set; }
+
+ ///
+ /// 加层改造
+ ///
+ public int? AddingLayer { get; set; }
+
+ ///
+ /// 修缮加固
+ ///
+ public string RepairAndReinforce { get; set; }
+
+ ///
+ /// 历史灾害
+ ///
+ public string HistoricalCalamity { get; set; }
+
+ ///
+ /// 使用功能变更
+ ///
+ public string FunctionalChange { get; set; }
+
+ ///
+ /// 其他调查内容
+ ///
+ public string OtherContents { get; set; }
+ #endregion
///
/// 主要安全隐患综述
///
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs
index 60461ff..d824a23 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs
@@ -46,6 +46,53 @@ namespace Ewide.Application
///
public int? ComprehensiveGrade { get; set; }
+ #region 调查情况investigation
+ ///
+ /// 房屋场地
+ ///
+ public string HouseSite { get; set; }
+
+ ///
+ /// 相邻施工
+ ///
+ public string AdjacentConstruction { get; set; }
+
+ ///
+ /// 化学侵蚀
+ ///
+ public string ChemicalErosion { get; set; }
+
+ ///
+ /// 结构拆改
+ ///
+ public int? StructuralDismantling { get; set; }
+
+ ///
+ /// 加层改造
+ ///
+ public int? AddingLayer { get; set; }
+
+ ///
+ /// 修缮加固
+ ///
+ public string RepairAndReinforce { get; set; }
+
+ ///
+ /// 历史灾害
+ ///
+ public string HistoricalCalamity { get; set; }
+
+ ///
+ /// 使用功能变更
+ ///
+ public string FunctionalChange { get; set; }
+
+ ///
+ /// 其他调查内容
+ ///
+ public string OtherContents { get; set; }
+ #endregion
+
///
/// 主要安全隐患综述
///
diff --git a/web-react/src/pages/business/house/code/index.jsx b/web-react/src/pages/business/house/code/index.jsx
index 267e342..175d5f1 100644
--- a/web-react/src/pages/business/house/code/index.jsx
+++ b/web-react/src/pages/business/house/code/index.jsx
@@ -167,10 +167,10 @@ export default class index extends Component {
const searchInfo = getSearchInfo({
query,
queryType: {
- no: '=',
+ areaCode: '=',
+ houseCode: 'like',
type: '=',
address: 'like',
- houseCode: 'like',
},
})
diff --git a/web-react/src/pages/business/house/info/form/base/building.jsx b/web-react/src/pages/business/house/info/form/base/building.jsx
index 4a638ef..9977b3d 100644
--- a/web-react/src/pages/business/house/info/form/base/building.jsx
+++ b/web-react/src/pages/business/house/info/form/base/building.jsx
@@ -19,6 +19,18 @@ import moment from 'moment'
import { CITY } from 'util/global'
import store from 'store'
+const initialValues = {
+ houseInfo: {
+ houseUsedStatus: 1,
+ landAttribute: 1,
+ curtainWall: 0,
+ faceBrick: 0,
+ coating: 0,
+ painting: 0,
+ elevator: '0',
+ },
+}
+
const { getState, dispatch } = store
const layout = {
@@ -32,6 +44,7 @@ export default class building extends Component {
state = {
loading: true,
codes: {
+ houseUsedStatus: [],
landAttribute: [],
houseStructureType: [],
houseAseismicGrade: [],
@@ -109,6 +122,7 @@ export default class building extends Component {
}
}
_state.codes = await getDictData(
+ 'house_used_status',
'land_attribute',
'house_structure_type',
'house_aseismic_grade',
@@ -357,6 +371,7 @@ export default class building extends Component {
return (
}>
+
+ {codes.houseUsedStatus.map(item => (
+
+ {item.value}
+
+ ))}
+
+
+
+
+
+
+ {codes.landAttribute.map(item => {
+ return (
+
+ {item.value}
+
+ )
+ })}
+
+
+
-
-
-
- {codes.landAttribute.map(item => {
- return (
-
- {item.value}
-
- )
- })}
-
-
@@ -681,118 +712,6 @@ export default class building extends Component {
-
-
-
-
-
-
-
-
-
- 户
-
-
-
-
-
-
-
-
-
-
-
-
-
- 单元
-
-
-
-
-
-
-
-
-
-
-
-
-
- 户
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -916,6 +835,118 @@ export default class building extends Component {
+
+
+
+
+
+
+
+
+
+ 户
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 单元
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 户
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web-react/src/pages/business/house/info/form/base/identification.jsx b/web-react/src/pages/business/house/info/form/base/identification.jsx
index 48da9a9..ef818e1 100644
--- a/web-react/src/pages/business/house/info/form/base/identification.jsx
+++ b/web-react/src/pages/business/house/info/form/base/identification.jsx
@@ -135,7 +135,7 @@ export default class identification extends Component {
))}
-
))}
-
+ */}
)
diff --git a/web-react/src/pages/business/house/info/form/base/index.jsx b/web-react/src/pages/business/house/info/form/base/index.jsx
index 4e857ba..66a2477 100644
--- a/web-react/src/pages/business/house/info/form/base/index.jsx
+++ b/web-react/src/pages/business/house/info/form/base/index.jsx
@@ -13,14 +13,14 @@ const parts = [
title: '权属情况',
component: () => import('./ownership'),
},
- {
- title: '调查情况',
- component: () => import('./investigation'),
- },
- {
- title: '鉴定治理',
- component: () => import('./identification'),
- },
+ // {
+ // title: '调查情况',
+ // component: () => import('./investigation'),
+ // },
+ // {
+ // title: '鉴定治理',
+ // component: () => import('./identification'),
+ // },
{
title: '图纸资料存档处',
component: () => import('./drawing'),
diff --git a/web-react/src/pages/business/house/info/form/base/investigation.jsx b/web-react/src/pages/business/house/info/form/base/investigation.jsx
index cbc8794..623a8d1 100644
--- a/web-react/src/pages/business/house/info/form/base/investigation.jsx
+++ b/web-react/src/pages/business/house/info/form/base/investigation.jsx
@@ -4,7 +4,18 @@ import { AntIcon } from 'components'
import { cloneDeep, first, isEqual, last, sortBy } from 'lodash'
import getDictData from 'util/dic'
-const initialValues = {}
+const initialValues = {
+ houseInfo: {
+ houseSite: ['1'],
+ adjacentConstruction: ['0'],
+ chemicalErosion: ['0'],
+ structuralDismantling: 0,
+ addingLayer: 0,
+ repairAndReinforce: ['0'],
+ historicalCalamity: ['0'],
+ functionalChange: ['0'],
+ },
+}
const layout = {
labelCol: { flex: '150px' },
diff --git a/web-react/src/pages/business/house/info/form/base/ownership.jsx b/web-react/src/pages/business/house/info/form/base/ownership.jsx
index a605223..9307940 100644
--- a/web-react/src/pages/business/house/info/form/base/ownership.jsx
+++ b/web-react/src/pages/business/house/info/form/base/ownership.jsx
@@ -4,7 +4,18 @@ import { AntIcon } from 'components'
import { cloneDeep, isEqual } from 'lodash'
import getDictData from 'util/dic'
-const initialValues = {}
+const initialValues = {
+ houseInfo: {
+ straightHouseCount: 0,
+ selfHouseCount: 0,
+ privateHouseCount: 0,
+ businessCount: 0,
+ changeHouseCount: 0,
+ resettlementHouseCount: 0,
+ otherCount: 0,
+ houseCount: 0,
+ },
+}
const layout = {
labelCol: { flex: '150px' },
@@ -151,7 +162,11 @@ export default class ownership extends Component {
this.onValuesChange(changedValues, allValues)
}
>
-
+
{codes.housePropertyRights.map(item => (
diff --git a/web-react/src/pages/business/house/info/form/index.jsx b/web-react/src/pages/business/house/info/form/index.jsx
index 1bf327c..bfae1a8 100644
--- a/web-react/src/pages/business/house/info/form/index.jsx
+++ b/web-react/src/pages/business/house/info/form/index.jsx
@@ -87,6 +87,20 @@ export default class index extends Component {
componentDidMount() {
// 获取详细数据
+ this.onLoadInitData()
+ }
+
+ call(child, index) {
+ this.children[index] = child
+ if (this.children.filter(p => p).length === tabs.filter(p => p.show).length) {
+ this.setState({ saveDisabled: false })
+ }
+ }
+
+ onLoadInitData() {
+ this.setState({
+ loading: true,
+ })
const { taskId } = this.props.param
if (taskId) {
api.houseInfoGetByTaskId({ taskId }).then(({ data }) => {
@@ -103,13 +117,6 @@ export default class index extends Component {
}
}
- call(child, index) {
- this.children[index] = child
- if (this.children.filter(p => p).length === tabs.filter(p => p.show).length) {
- this.setState({ saveDisabled: false })
- }
- }
-
async onSave() {
await this.onPostData(actions.save)
}
@@ -180,7 +187,7 @@ export default class index extends Component {
if (success) {
Message.success(action.remark + '成功')
this.setState({ saving: false })
- if (this.props.param.table) {
+ if (this.props.param.table.current) {
this.props.param.table.current.onReloadData()
}
switch (action.after) {
@@ -188,7 +195,7 @@ export default class index extends Component {
window.closeContentWindow()
break
default:
- this.componentDidMount()
+ this.onLoadInitData()
break
}
}
diff --git a/web-react/src/pages/business/house/info/form/patrol/index.jsx b/web-react/src/pages/business/house/info/form/patrol/index.jsx
index 79f7503..ac4c4b5 100644
--- a/web-react/src/pages/business/house/info/form/patrol/index.jsx
+++ b/web-react/src/pages/business/house/info/form/patrol/index.jsx
@@ -17,6 +17,10 @@ const parts = [
title: '等级划分',
component: () => import('./grade'),
},
+ {
+ title: '调查情况',
+ component: () => import('./investigation'),
+ },
{
title: '处理情况',
component: () => import('./handling'),
diff --git a/web-react/src/pages/business/house/info/form/patrol/investigation.jsx b/web-react/src/pages/business/house/info/form/patrol/investigation.jsx
new file mode 100644
index 0000000..620f437
--- /dev/null
+++ b/web-react/src/pages/business/house/info/form/patrol/investigation.jsx
@@ -0,0 +1,312 @@
+import React, { Component } from 'react'
+import { Checkbox, Form, Input, Radio, Spin } from 'antd'
+import { AntIcon } from 'components'
+import { cloneDeep, first, isEqual, last, sortBy } from 'lodash'
+import getDictData from 'util/dic'
+
+const initialValues = {
+ patrolInfo: {
+ houseSite: ['1'],
+ adjacentConstruction: ['0'],
+ chemicalErosion: ['0'],
+ structuralDismantling: 0,
+ addingLayer: 0,
+ repairAndReinforce: ['0'],
+ historicalCalamity: ['0'],
+ functionalChange: ['0'],
+ },
+}
+
+const layout = {
+ labelCol: { flex: '150px' },
+ wrapperCol: { flex: '1' },
+}
+
+const checkboxKeys = [
+ 'houseSite',
+ 'adjacentConstruction',
+ 'chemicalErosion',
+ 'repairAndReinforce',
+ 'historicalCalamity',
+ 'functionalChange',
+]
+
+export default class investigation extends Component {
+ state = {
+ loading: true,
+ codes: {
+ houseHouseSite: [],
+ houseAdjacentConstruction: [],
+ houseChemicalErosion: [],
+ houseStructuralDismantling: [],
+ houseAddingLayer: [],
+ houseRepairAndReinforce: [],
+ houseHistoricalCalamity: [],
+ houseFunctionalChange: [],
+ },
+ options: {},
+ }
+
+ // 表单实例
+ form = React.createRef()
+
+ // 初始化数据
+ record = {}
+
+ /**
+ * 阻止外部组件引发的渲染,提升性能
+ * 可自行添加渲染条件
+ * [必要]
+ * @param {*} props
+ * @param {*} state
+ * @returns
+ */
+ shouldComponentUpdate(props, state) {
+ return !isEqual(this.state, state)
+ }
+
+ /**
+ * DOM加载完成钩子,绑定数据
+ */
+ componentDidMount() {
+ this.fillData({
+ record: this.props.record,
+ })
+ }
+
+ /**
+ * 加载完成,通知父级组件并传递自身
+ */
+ call() {
+ const { onRef } = this.props
+ if (onRef) onRef(this)
+ }
+
+ /**
+ * 填充数据
+ * 可以在设置this.record之后对其作出数据结构调整
+ * [异步,必要]
+ * @param {*} params
+ */
+ async fillData(params) {
+ this.record = cloneDeep(params.record)
+ //#region 从后端转换成前段所需格式
+ if (this.record) {
+ const { patrolInfo } = this.record
+ // checkbox
+ checkboxKeys.forEach(key => {
+ if (patrolInfo[key]) {
+ patrolInfo[key] = patrolInfo[key].split(',')
+ }
+ })
+ }
+ const codes = await getDictData(
+ 'house_house_site',
+ 'house_adjacent_construction',
+ 'house_chemical_erosion',
+ 'house_structural_dismantling',
+ 'house_adding_layer',
+ 'house_repair_and_reinforce',
+ 'house_historical_calamity',
+ 'house_functional_change'
+ )
+ this.setState({ codes })
+ //#endregion
+ this.form.current.setFieldsValue(this.record)
+
+ this.setState({ loading: false })
+ this.call()
+ }
+
+ /**
+ * 获取数据
+ * 可以对postData进行数据结构调整
+ * [异步,必要]
+ * @returns
+ */
+ async getData() {
+ const form = this.form.current
+
+ const valid = await form.validateFields()
+ if (valid) {
+ const postData = form.getFieldsValue()
+ //#region 从前段转换后端所需格式
+ const { patrolInfo } = postData
+ // checkbox
+ checkboxKeys.forEach(key => {
+ if (patrolInfo[key]) {
+ patrolInfo[key] = sortBy(patrolInfo[key], p => +p).join(',')
+ }
+ })
+ //#endregion
+ return postData
+ }
+ }
+
+ //#region 自定义方法
+ /**
+ * 表单change事件处理,包括了所有字段的change
+ * [异步,非必要]
+ * @param {*} changedValues
+ * @param {*} allValues
+ */
+ async onValuesChange(changedValues, allValues) {
+ const { patrolInfo } = changedValues
+ const key = Object.keys(patrolInfo).shift()
+ if (
+ [
+ 'adjacentConstruction',
+ 'chemicalErosion',
+ 'repairAndReinforce',
+ 'historicalCalamity',
+ 'functionalChange',
+ ].includes(key)
+ ) {
+ this.checkedNone(patrolInfo[key], key)
+ }
+ }
+
+ checkedNone(value, key) {
+ const form = this.form.current
+ if (first(value) == 0 && value.length > 1) {
+ // 在'无'之后选中其他值
+ value.shift()
+ form.setFieldsValue({
+ patrolInfo: { [key]: value },
+ })
+ } else if (last(value) == 0 && value.length > 1) {
+ // 在其他值之后选中'无'
+ value = ['0']
+ form.setFieldsValue({
+ patrolInfo: { [key]: value },
+ })
+ }
+ return value
+ }
+ //#endregion
+
+ render() {
+ const { loading, codes } = this.state
+
+ return (
+ }>
+
+
+ {codes.houseHouseSite.map(item => (
+
+ {item.value}
+
+ ))}
+
+
+
+
+ {codes.houseAdjacentConstruction.map(item => (
+
+ {item.value}
+
+ ))}
+
+
+
+
+ {codes.houseChemicalErosion.map(item => (
+
+ {item.value}
+
+ ))}
+
+
+
+
+ {codes.houseStructuralDismantling.map(item => (
+
+ {item.value}
+
+ ))}
+
+
+
+
+ {codes.houseAddingLayer.map(item => (
+
+ {item.value}
+
+ ))}
+
+
+
+
+ {codes.houseRepairAndReinforce.map(item => (
+
+ {item.value}
+
+ ))}
+
+
+
+
+ {codes.houseHistoricalCalamity.map(item => (
+
+ {item.value}
+
+ ))}
+
+
+
+
+ {codes.houseFunctionalChange.map(item => (
+
+ {item.value}
+
+ ))}
+
+
+
+
+
+
+
+ )
+ }
+}