diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs index 3813291..a162309 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs @@ -120,7 +120,7 @@ WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId } var houseEntity = await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(h => h.HouseCodeId == input.houseCode.Id); //建档审核通过的房屋数据修改时,对应的建档任务Task不处理 - if (houseEntity.State != 6) + if (houseEntity == null || houseEntity.State != 6) { var houseTask = input.PatrolInfo.Adapt(); houseTask.HouseCodeId = input.houseCode.Id; diff --git a/web-react/src/common/api/requests/business/houseSafety/houseInfo.js b/web-react/src/common/api/requests/business/houseSafety/houseInfo.js index 7d6a58e..0177ae8 100644 --- a/web-react/src/common/api/requests/business/houseSafety/houseInfo.js +++ b/web-react/src/common/api/requests/business/houseSafety/houseInfo.js @@ -1,6 +1,7 @@ const urls = { houseInfoGetByTaskId: ['/houseInfo/getByTaskId', 'get'], - houseInfoSave: ['houseInfo/save', 'post'] + houseInfoSave: ['houseInfo/save', 'post'], + houseInfoSubmitToCheck: ['/houseInfo/submitToCheck', 'post'] } export default urls \ No newline at end of file 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 36ee7bf..a605223 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 @@ -98,7 +98,44 @@ export default class ownership extends Component { * @param {*} changedValues * @param {*} allValues */ - async onValuesChange(changedValues, allValues) {} + async onValuesChange(changedValues, allValues) { + const form = this.form.current + const { houseInfo } = changedValues + + if ( + houseInfo.hasOwnProperty('straightHouseCount') || + houseInfo.hasOwnProperty('selfHouseCount') || + houseInfo.hasOwnProperty('otherCount') || + houseInfo.hasOwnProperty('businessCount') || + houseInfo.hasOwnProperty('changeHouseCount') || + houseInfo.hasOwnProperty('resettlementHouseCount') || + houseInfo.hasOwnProperty('privateHouseCount') + ) { + const { + houseInfo: { + straightHouseCount, + selfHouseCount, + otherCount, + businessCount, + changeHouseCount, + resettlementHouseCount, + privateHouseCount, + }, + } = allValues + form.setFieldsValue({ + houseInfo: { + houseCount: + +straightHouseCount + + +selfHouseCount + + +otherCount + + +businessCount + + +changeHouseCount + + +resettlementHouseCount + + +privateHouseCount, + }, + }) + } + } //#endregion render() { 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 4c3a474..637371a 100644 --- a/web-react/src/pages/business/house/info/form/index.jsx +++ b/web-react/src/pages/business/house/info/form/index.jsx @@ -1,5 +1,5 @@ import React, { Component } from 'react' -import { Button, Descriptions, message as Message, Spin, Tabs } from 'antd' +import { Form, Button, Input, Descriptions, message as Message, Spin, Tabs } from 'antd' import { merge, isEqual } from 'lodash' import { AntIcon, ComponentDynamic, Container } from 'components' import { api } from 'common/api' @@ -56,11 +56,13 @@ export default class index extends Component { saveDisabled: true, saving: false, + taskStatus: 0, } children = [] formData = {} + checkform = React.createRef() shouldComponentUpdate(props, state) { return !isEqual(this.state, state) @@ -72,6 +74,7 @@ export default class index extends Component { if (taskId) { api.houseInfoGetByTaskId({ taskId }).then(({ data }) => { this.setState({ + taskStatus: data.patrolInfo.status, record: data, loading: false, }) @@ -86,7 +89,7 @@ export default class index extends Component { } } - async onSubmit() { + async onSubmit(action, append) { for (const child of this.children) { try { const data = await child.getData() @@ -97,13 +100,35 @@ export default class index extends Component { } //#region 提交数据 + + if (append) { + this.formData = { + ...this.formData, + ...append, + } + } + if (this.formData.houseCode) { + this.formData.houseCode.id = this.state.record.houseCode.id + } + + if (this.formData.patrolInfo && this.props.param.taskId) { + this.formData.patrolInfo.id = this.props.param.taskId + } + console.log(this.formData) this.setState({ saving: true }) - setTimeout(() => { - Message.success('提交成功') - this.setState({ saving: false }) - }, 3000) + api[action](this.formData) + .then(({ data }) => {}) + .catch(() => {}) + .finally(() => { + this.setState({ saving: false }) + }) + + // setTimeout(() => { + // Message.success('提交成功') + // this.setState({ saving: false }) + // }, 3000) //#endregion } @@ -117,19 +142,55 @@ export default class index extends Component {
- + {this.state.taskStatus == 3 && ( +
+ + + + + + + +
+ )} +
+ + {this.state.taskStatus >= -1 && this.state.taskStatus < 3 && ( + + )} + {this.state.taskStatus == 2 && ( + + )} -
diff --git a/web-react/src/pages/business/house/info/form/patrol/grade.jsx b/web-react/src/pages/business/house/info/form/patrol/grade.jsx index 6e23fc6..3dc1074 100644 --- a/web-react/src/pages/business/house/info/form/patrol/grade.jsx +++ b/web-react/src/pages/business/house/info/form/patrol/grade.jsx @@ -69,7 +69,8 @@ export default class handling extends Component { //#region 从后端转换成前段所需格式 if (this.record) { const { patrolInfo } = this.record - patrolInfo.initGrade = this.getInitGrade(getState('business').completedDate) + if (this.record.houseInfo.completedDate) + patrolInfo.initGrade = this.getInitGrade(getState('business').completedDate) } _state.codes = await getDictData( 'house_patrol_init_grade', @@ -130,19 +131,18 @@ export default class handling extends Component { - - - {codes.housePatrolInitGrade.map(item => { - return ( - - {item.value} - - ) - })} - - + + {codes.housePatrolInitGrade.map(item => { + return ( + + {item.value} + + ) + })} + 删除 , - + this.onResetPassword(record)}>重置密码 , - - this.onOpen(this.dataForm, record)}>授权额外数据 - , + // + // this.onOpen(this.dataForm, record)}>授权额外数据 + // , ]} > ( + <> + {`${record.areaName}-${record.roadName}-${record.commName}-${ + record.note + }-${record.no.toString().padStart(3, '0')}`} +
+ {text} + + ), + }, + { + title: '房屋性质及行业', + dataIndex: 'type', + sorter: true, + width: 150, + render: text => this.bindCodeValue(text, 'house_type'), + }, + { + title: '地址', + dataIndex: 'address', + sorter: true, + }, + { + title: '任务截止时间', + dataIndex: 'endTime', + sorter: true, + width: 150, + }, + ] + + /** + * 构造函数,在渲染前动态添加操作字段等 + * @param {*} props + */ + constructor(props) { + super(props) + + const flag = auth({ houseInfo: 'getByTaskId' }) + + if (flag) { + this.columns.push({ + title: '操作', + width: 150, + dataIndex: 'actions', + render: (text, record) => ( + + + this.onOpen(record.id)}>审核 + + + ), + }) + } + } + + /** + * 阻止外部组件引发的渲染,提升性能 + * 可自行添加渲染条件 + * [必要] + * @param {*} props + * @param {*} state + * @returns + */ + shouldComponentUpdate(props, state) { + return !isEqual(this.state, state) + } + + /** + * 加载字典数据,之后开始加载表格数据 + * 如果必须要加载字典数据,可直接对表格设置autoLoad=true + */ + componentDidMount() { + const { onLoading, onLoadData } = this.table.current + onLoading() + getDictData('house_type', 'house_industry').then(codes => { + this.setState({ codes }, () => { + onLoadData() + }) + }) + } + + /** + * 调用加载数据接口,可在调用前对query进行处理 + * [异步,必要] + * @param {*} params + * @param {*} query + * @returns + */ + loadData = async (params, query) => { + const { data } = await apiAction.page({ + ...params, + ...query, + }) + return data + } + + /** + * 绑定字典数据 + * @param {*} code + * @param {*} name + * @returns + */ + bindCodeValue(code, name) { + name = toCamelCase(name) + const codes = this.state.codes[name] + if (codes) { + const c = codes.find(p => p.code == code) + if (c) { + return c.value + } + } + return null + } + + /** + * 打开新增/编辑弹窗 + * @param {*} modal + * @param {*} record + */ + onOpen(taskId) { + window.openContentWindow({ + title: '房屋登记', + path: 'business/house/info/form', + param: { + taskId, + }, + }) + } + + /** + * 对表格上的操作进行统一处理 + * [异步] + * @param {*} action + * @param {*} successMessage + */ + async onAction(action, successMessage) { + const { onLoading, onLoaded, onReloadData } = this.table.current + onLoading() + try { + if (action) { + await action + } + if (successMessage) { + Message.success(successMessage) + } + onReloadData() + } catch { + onLoaded() + } + } + + //#region 自定义方法 + //#endregion + + render() { + const { codes, type } = this.state + + return ( + +
+ + { + if (values.hasOwnProperty('type')) { + this.setState({ type: values.type }) + } + }} + query={ + + + + 全部 + {codes.houseType.map(item => ( + + {item.value} + + ))} + + + {type == 2 && ( + + + + )} + + + + + + + + } + /> + +
+ ) + } +} diff --git a/web-react/src/pages/business/house/task/index.jsx b/web-react/src/pages/business/house/task/index.jsx index a386e3c..c8ebf49 100644 --- a/web-react/src/pages/business/house/task/index.jsx +++ b/web-react/src/pages/business/house/task/index.jsx @@ -1,6 +1,6 @@ import React, { Component } from 'react' -import { Button, Card, Form, Input, message as Message, Popconfirm, Radio, Select, Tag } from 'antd' -import { AntIcon, Auth, Container, ModalForm, QueryTable, QueryTableActions } from 'components' +import { Card, Form, Input, message as Message, Radio, Select, Tag } from 'antd' +import { Auth, Container, QueryTable, QueryTableActions } from 'components' import { api } from 'common/api' import auth from 'components/authorized/handler' import { isEqual } from 'lodash'