merge
This commit is contained in:
@@ -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<BsHouseTask>();
|
||||
houseTask.HouseCodeId = input.houseCode.Id;
|
||||
|
||||
@@ -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
|
||||
@@ -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() {
|
||||
|
||||
@@ -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 {
|
||||
<div className="yo-form-page--bar yo-form-page--bar--with-tab">
|
||||
<Container mode="fluid">
|
||||
<div className="yo-form-page--bar-inner">
|
||||
<span></span>
|
||||
<span>
|
||||
{this.state.taskStatus == 3 && (
|
||||
<Form ref={this.checkForm} layout="inline">
|
||||
<Form.Item
|
||||
label="审核意见"
|
||||
name={['taskCheckRecord', 'content']}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: '请输入审核意见',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Input.TextArea
|
||||
autoSize
|
||||
autoComplete="off"
|
||||
placeholder="请输入审核意见"
|
||||
className="w-500"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary">通过</Button>
|
||||
<Button type="primary">退回</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
)}
|
||||
</span>
|
||||
<span>
|
||||
{this.state.taskStatus >= -1 && this.state.taskStatus < 3 && (
|
||||
<Button
|
||||
disabled={saveDisabled}
|
||||
loading={saving}
|
||||
type="primary"
|
||||
onClick={() => this.onSubmit('houseInfoSave')}
|
||||
>
|
||||
保存
|
||||
</Button>
|
||||
)}
|
||||
{this.state.taskStatus == 2 && (
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => this.onSubmit('houseInfoSubmitToCheck')}
|
||||
>
|
||||
提交审核
|
||||
</Button>
|
||||
)}
|
||||
<Button onClick={() => window.closeContentWindow()}>
|
||||
取消
|
||||
</Button>
|
||||
<Button
|
||||
disabled={saveDisabled}
|
||||
loading={saving}
|
||||
type="primary"
|
||||
onClick={() => this.onSubmit()}
|
||||
>
|
||||
保存
|
||||
</Button>
|
||||
</span>
|
||||
</div>
|
||||
</Container>
|
||||
|
||||
@@ -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 {
|
||||
<Form.Item
|
||||
label="初始等级"
|
||||
name={['patrolInfo', 'initGrade']}
|
||||
tooltip="初始等级无法手动更改,由房屋详情的竣工日期决定:2000年之后竣工的为一级,1995年~1999年竣工的为二级,1980年~1994年竣工的为三级,早于1980年竣工的为四级。选择房屋竣工日期后,初始等级会自动填充。"
|
||||
rules={[{ required: true, message: '请选择初始等级' }]}
|
||||
>
|
||||
<Tooltip title="初始等级无法手动更改,由房屋详情的竣工日期决定:2000年之后竣工的为一级,1995年~1999年竣工的为二级,1980年~1994年竣工的为三级,早于1980年竣工的为四级。选择房屋竣工日期后,初始等级会自动填充。">
|
||||
<Radio.Group disabled buttonStyle="solid">
|
||||
{codes.housePatrolInitGrade.map(item => {
|
||||
return (
|
||||
<Radio.Button key={item.code} value={+item.code}>
|
||||
{item.value}
|
||||
</Radio.Button>
|
||||
)
|
||||
})}
|
||||
</Radio.Group>
|
||||
</Tooltip>
|
||||
<Radio.Group disabled buttonStyle="solid">
|
||||
{codes.housePatrolInitGrade.map(item => {
|
||||
return (
|
||||
<Radio.Button key={item.code} value={+item.code}>
|
||||
{item.value}
|
||||
</Radio.Button>
|
||||
)
|
||||
})}
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
|
||||
265
web-react/src/pages/business/house/task/check/index.jsx
Normal file
265
web-react/src/pages/business/house/task/check/index.jsx
Normal file
@@ -0,0 +1,265 @@
|
||||
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 { api } from 'common/api'
|
||||
import auth from 'components/authorized/handler'
|
||||
import { isEqual } from 'lodash'
|
||||
import getDictData from 'util/dic'
|
||||
import { toCamelCase } from 'util/format'
|
||||
|
||||
/**
|
||||
* 注释段[\/**\/]为必须要改
|
||||
*/
|
||||
|
||||
/**
|
||||
* 配置页面所需接口函数
|
||||
*/
|
||||
const apiAction = {
|
||||
page: api.houseTaskPage,
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一配置权限标识
|
||||
* [必要]
|
||||
*/
|
||||
const authName = 'houseTask'
|
||||
|
||||
export default class index extends Component {
|
||||
state = {
|
||||
codes: {
|
||||
houseType: [],
|
||||
houseIndustry: [],
|
||||
},
|
||||
|
||||
type: '',
|
||||
}
|
||||
|
||||
// 表格实例
|
||||
table = React.createRef()
|
||||
|
||||
// 新增窗口实例
|
||||
addForm = React.createRef()
|
||||
// 编辑窗口实例
|
||||
editForm = React.createRef()
|
||||
|
||||
columns = [
|
||||
{
|
||||
title: '房屋编码',
|
||||
dataIndex: 'houseCode',
|
||||
sorter: true,
|
||||
width: 300,
|
||||
render: (text, record) => (
|
||||
<>
|
||||
{`${record.areaName}-${record.roadName}-${record.commName}-${
|
||||
record.note
|
||||
}-${record.no.toString().padStart(3, '0')}`}
|
||||
<br />
|
||||
<Tag color="purple">{text}</Tag>
|
||||
</>
|
||||
),
|
||||
},
|
||||
{
|
||||
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) => (
|
||||
<QueryTableActions>
|
||||
<Auth auth={{ houseInfo: 'getByTaskId' }}>
|
||||
<a onClick={() => this.onOpen(record.id)}>审核</a>
|
||||
</Auth>
|
||||
</QueryTableActions>
|
||||
),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 阻止外部组件引发的渲染,提升性能
|
||||
* 可自行添加渲染条件
|
||||
* [必要]
|
||||
* @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 (
|
||||
<Container mode="fluid">
|
||||
<br />
|
||||
<Card bordered={false}>
|
||||
<QueryTable
|
||||
ref={this.table}
|
||||
autoLoad={false}
|
||||
loadData={this.loadData}
|
||||
columns={this.columns}
|
||||
queryInitialValues={{
|
||||
type: '',
|
||||
}}
|
||||
onQueryChange={values => {
|
||||
if (values.hasOwnProperty('type')) {
|
||||
this.setState({ type: values.type })
|
||||
}
|
||||
}}
|
||||
query={
|
||||
<Auth auth={{ [authName]: 'page' }}>
|
||||
<Form.Item label="房屋性质" name="type">
|
||||
<Radio.Group buttonStyle="solid">
|
||||
<Radio.Button value="">全部</Radio.Button>
|
||||
{codes.houseType.map(item => (
|
||||
<Radio.Button key={item.code} value={item.code}>
|
||||
{item.value}
|
||||
</Radio.Button>
|
||||
))}
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
{type == 2 && (
|
||||
<Form.Item label="行业" name="industry">
|
||||
<Select
|
||||
allowClear
|
||||
className="w-150"
|
||||
placeholder="请选择行业"
|
||||
>
|
||||
{codes.houseIndustry.map(item => (
|
||||
<Select.Option key={item.code} value={item.code}>
|
||||
{item.value}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item label="地址" name="address">
|
||||
<Input autoComplete="off" placeholder="请输入地址" />
|
||||
</Form.Item>
|
||||
<Form.Item label="房屋唯一编码" name="houseCode">
|
||||
<Input autoComplete="off" placeholder="请输入房屋唯一编码" />
|
||||
</Form.Item>
|
||||
</Auth>
|
||||
}
|
||||
/>
|
||||
</Card>
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user