update 细节调整
This commit is contained in:
@@ -98,7 +98,7 @@ export default class aspect extends Component {
|
||||
houseInfo.facadePhoto = fileValue
|
||||
}
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
this.form.current && this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState({ loading: false })
|
||||
this.call()
|
||||
|
||||
@@ -124,7 +124,7 @@ export default class attachments extends Component {
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
this.form.current && this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState({ loading: false })
|
||||
this.call()
|
||||
|
||||
@@ -59,6 +59,13 @@ export default class building extends Component {
|
||||
})
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
dispatch({
|
||||
type: 'PATROL_REMOVE_INIT_GRADE_BY_COMPLETED_DATE',
|
||||
id: this.props.id,
|
||||
})
|
||||
}
|
||||
|
||||
call() {
|
||||
if (this.props.onRef) {
|
||||
this.props.onRef(this)
|
||||
@@ -79,10 +86,12 @@ export default class building extends Component {
|
||||
const { houseInfo } = this.record
|
||||
if (houseInfo.completedDate) {
|
||||
houseInfo.completedDate = moment(houseInfo.completedDate)
|
||||
debugger
|
||||
dispatch({
|
||||
type: 'PATROL_INIT_GRADE_BY_COMPLETED_DATE',
|
||||
value: +houseInfo.completedDate.format('YYYY'),
|
||||
date: {
|
||||
id: this.props.id,
|
||||
value: +houseInfo.completedDate.format('YYYY'),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -110,7 +119,7 @@ export default class building extends Component {
|
||||
)
|
||||
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
this.form.current && this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState(_state)
|
||||
this.call()
|
||||
@@ -172,7 +181,10 @@ export default class building extends Component {
|
||||
if (houseInfo.hasOwnProperty('completedDate')) {
|
||||
dispatch({
|
||||
type: 'PATROL_INIT_GRADE_BY_COMPLETED_DATE',
|
||||
value: +houseInfo.completedDate.format('YYYY'),
|
||||
date: {
|
||||
id: this.props.id,
|
||||
value: +houseInfo.completedDate.format('YYYY'),
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,13 +72,16 @@ export default class drawing extends Component {
|
||||
if (houseInfo.drawingMaterial) {
|
||||
houseInfo.drawingMaterial = houseInfo.drawingMaterial.split(',')
|
||||
}
|
||||
this.setState({ showDrawingMaterialText: houseInfo.drawingMaterial.includes('100') })
|
||||
this.setState({
|
||||
showDrawingMaterialText:
|
||||
!!houseInfo.drawingMaterial && houseInfo.drawingMaterial.includes('100'),
|
||||
})
|
||||
}
|
||||
const codes = await getDictData('dic_house_storage_of_drawings')
|
||||
console.log(codes)
|
||||
this.setState({ codes })
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
this.form.current && this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState({ loading: false })
|
||||
this.call()
|
||||
|
||||
@@ -75,7 +75,7 @@ export default class identification extends Component {
|
||||
)
|
||||
this.setState({ codes })
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
this.form.current && this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState({ loading: false })
|
||||
this.call()
|
||||
|
||||
@@ -67,7 +67,7 @@ export default class ownership extends Component {
|
||||
const codes = await getDictData('dic_house_property_rights')
|
||||
this.setState({ codes })
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
this.form.current && this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState({ loading: false })
|
||||
this.call()
|
||||
|
||||
@@ -62,7 +62,7 @@ export default class unit extends Component {
|
||||
this.record = cloneDeep(params.record)
|
||||
//#region 从后端转换成前段所需格式
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
this.form.current && this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState({ loading: false })
|
||||
this.call()
|
||||
|
||||
@@ -47,7 +47,7 @@ export default class base extends Component {
|
||||
this.record.patrolInfo.patrolDate = patrolDate ? moment(patrolDate) : patrolDate
|
||||
}
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
this.form.current && this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState({ loading: false })
|
||||
this.call()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Form, Input, Radio, Spin } from 'antd'
|
||||
import { Form, Tooltip, Radio, Spin } from 'antd'
|
||||
import { AntIcon } from 'components'
|
||||
import { cloneDeep, first, isEqual, last, sortBy } from 'lodash'
|
||||
import getDictData from 'util/dic'
|
||||
@@ -64,6 +64,7 @@ export default class handling extends Component {
|
||||
*/
|
||||
async fillData(params) {
|
||||
this.record = cloneDeep(params.record)
|
||||
|
||||
const _state = { loading: false }
|
||||
//#region 从后端转换成前段所需格式
|
||||
if (this.record) {
|
||||
@@ -76,7 +77,7 @@ export default class handling extends Component {
|
||||
'dic_house_grade'
|
||||
)
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
this.form.current && this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState(_state)
|
||||
this.call()
|
||||
@@ -101,18 +102,22 @@ export default class handling extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
getInitGrade(year) {
|
||||
if (year > 1999) {
|
||||
return 1
|
||||
}
|
||||
if (year > 1994 && year < 2000) {
|
||||
return 2
|
||||
}
|
||||
if (year > 1979 && year < 1995) {
|
||||
return 3
|
||||
}
|
||||
if (year < 1980) {
|
||||
return 4
|
||||
getInitGrade(completedDate) {
|
||||
const date = completedDate.find(p => p.id === this.props.id)
|
||||
if (date) {
|
||||
const { value: year } = date
|
||||
if (year > 1999) {
|
||||
return 1
|
||||
}
|
||||
if (year > 1994 && year < 2000) {
|
||||
return 2
|
||||
}
|
||||
if (year > 1979 && year < 1995) {
|
||||
return 3
|
||||
}
|
||||
if (year < 1980) {
|
||||
return 4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,15 +132,17 @@ export default class handling extends Component {
|
||||
name={['patrolInfo', 'initGrade']}
|
||||
rules={[{ required: true, message: '请选择初始等级' }]}
|
||||
>
|
||||
<Radio.Group disabled buttonStyle="solid">
|
||||
{codes.dicHousePatrolInitGrade.map(item => {
|
||||
return (
|
||||
<Radio.Button key={item.code} value={+item.code}>
|
||||
{item.value}
|
||||
</Radio.Button>
|
||||
)
|
||||
})}
|
||||
</Radio.Group>
|
||||
<Tooltip title="初始等级无法手动更改,由房屋详情的竣工日期决定:2000年之后竣工的为一级,1995年~1999年竣工的为二级,1980年~1994年竣工的为三级,早于1980年竣工的为四级。选择房屋竣工日期后,初始等级会自动填充。">
|
||||
<Radio.Group disabled buttonStyle="solid">
|
||||
{codes.dicHousePatrolInitGrade.map(item => {
|
||||
return (
|
||||
<Radio.Button key={item.code} value={+item.code}>
|
||||
{item.value}
|
||||
</Radio.Button>
|
||||
)
|
||||
})}
|
||||
</Radio.Group>
|
||||
</Tooltip>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
|
||||
@@ -50,7 +50,7 @@ export default class handling extends Component {
|
||||
'dic_house_patrol_rectify_Reform'
|
||||
)
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
this.form.current && this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState(_state)
|
||||
this.call()
|
||||
|
||||
@@ -100,7 +100,7 @@ export default class inspection extends Component {
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
this.form.current && this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState({ loading: false })
|
||||
this.call()
|
||||
@@ -204,7 +204,7 @@ export default class inspection extends Component {
|
||||
<Col span={12}>
|
||||
<Form.Item label="沉降倾斜情况" name={['patrolInfo', 'settlementTilt']}>
|
||||
<Input.TextArea
|
||||
autoSize={{ minRows: 4 }}
|
||||
autoSize={{ minRows: 4.6 }}
|
||||
placeholder="请输入沉降倾斜情况"
|
||||
/>
|
||||
</Form.Item>
|
||||
@@ -242,7 +242,7 @@ export default class inspection extends Component {
|
||||
<Col span={12}>
|
||||
<Form.Item label="其他情况" name={['patrolInfo', 'otherInfo']}>
|
||||
<Input.TextArea
|
||||
autoSize={{ minRows: 4 }}
|
||||
autoSize={{ minRows: 4.6 }}
|
||||
placeholder="请输入其他情况"
|
||||
/>
|
||||
</Form.Item>
|
||||
@@ -278,7 +278,7 @@ export default class inspection extends Component {
|
||||
</Row>
|
||||
<Form.Item label="主要安全隐患综述" name={['patrolInfo', 'mainSafety']}>
|
||||
<Input.TextArea
|
||||
autoSize={{ minRows: 4 }}
|
||||
autoSize={{ minRows: 4.6 }}
|
||||
placeholder="请输入主要安全隐患综述"
|
||||
/>
|
||||
</Form.Item>
|
||||
|
||||
@@ -47,7 +47,7 @@ export default class result extends Component {
|
||||
//#region 从后端转换成前段所需格式
|
||||
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
this.form.current && this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState({ loading: false })
|
||||
this.call()
|
||||
|
||||
@@ -1,8 +1,30 @@
|
||||
const business = (state = {}, action) => {
|
||||
switch (action.type) {
|
||||
case 'PATROL_INIT_GRADE_BY_COMPLETED_DATE':
|
||||
const _state = { ...state, completedDate: action.value }
|
||||
return _state
|
||||
{
|
||||
const completedDate = state.completedDate || []
|
||||
const { date } = action
|
||||
const record = completedDate.find(p => p.id === date.id)
|
||||
if (record) {
|
||||
record.value = date.value
|
||||
} else {
|
||||
completedDate.push(date)
|
||||
}
|
||||
const _state = { ...state, completedDate }
|
||||
return _state
|
||||
}
|
||||
case 'PATROL_REMOVE_INIT_GRADE_BY_COMPLETED_DATE':
|
||||
{
|
||||
const completedDate = state.completedDate || []
|
||||
const record = completedDate.find(p => p.id === action.id)
|
||||
if (!record) {
|
||||
return state
|
||||
} else {
|
||||
completedDate.splice(completedDate.indexOf(record), 1)
|
||||
const _state = { ...state, completedDate }
|
||||
return _state
|
||||
}
|
||||
}
|
||||
default:
|
||||
return state
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user