update 完善编码信息读取
This commit is contained in:
@@ -56,4 +56,10 @@ namespace Ewide.Application
|
|||||||
public string ZoonId { get; set; }
|
public string ZoonId { get; set; }
|
||||||
public int Type { get; set; }
|
public int Type { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GetHouseCodeInput
|
||||||
|
{
|
||||||
|
[Required(ErrorMessage = "房屋编码ID不可为空")]
|
||||||
|
public string Id { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,4 +25,18 @@ namespace Ewide.Application
|
|||||||
public string Lng { get; set; }
|
public string Lng { get; set; }
|
||||||
public string Lat { get; set; }
|
public string Lat { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class GetHouseCodeOutput
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public int Type { get; set; }
|
||||||
|
public int Industry { get; set; }
|
||||||
|
public string AreaCode { get; set; }
|
||||||
|
public string ProjectId { get; set; }
|
||||||
|
public int No { get; set; }
|
||||||
|
public string ZoneId { get; set; }
|
||||||
|
public string Address { get; set; }
|
||||||
|
public string Lng { get; set; }
|
||||||
|
public string Lat { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,16 @@ LEFT JOIN sys_area_code AA ON AA.AdCode = SUBSTR(CA.AdCode,1,6) ";
|
|||||||
return await _dapperRepository.QueryPageDataDynamic(sql, input, filterFields: new string[] {"Type", "Address", "HouseCode" });
|
return await _dapperRepository.QueryPageDataDynamic(sql, input, filterFields: new string[] {"Type", "Address", "HouseCode" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("/houseCode/detail")]
|
||||||
|
public async Task<dynamic> GetHouserCode([FromQuery] GetHouseCodeInput input)
|
||||||
|
{
|
||||||
|
var houseCode = await _houseCodeRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == input.Id);
|
||||||
|
var areaCode = (await Db.GetRepository<BsHouseProjectInfo>().DetachedEntities.FirstOrDefaultAsync(p => p.Id == houseCode.ProjectId)).AreaCode;
|
||||||
|
var result = houseCode.Adapt<GetHouseCodeOutput>();
|
||||||
|
result.AreaCode = areaCode;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取同一区域下的下一个编号
|
/// 获取同一区域下的下一个编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const urls = {
|
|||||||
houseCodeEdit: ['/houseCode/edit', 'post'],
|
houseCodeEdit: ['/houseCode/edit', 'post'],
|
||||||
houseCodePage: ['/houseCode/page', 'post'],
|
houseCodePage: ['/houseCode/page', 'post'],
|
||||||
houseCodeNo: '/houseCode/getNextNoByCode',
|
houseCodeNo: '/houseCode/getNextNoByCode',
|
||||||
|
houseCodeDetail: '/houseCode/detail'
|
||||||
}
|
}
|
||||||
|
|
||||||
export default urls
|
export default urls
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { Button, Card, message as Message, Modal } from 'antd'
|
import { Button, Card, Col, message as Message, Modal, Row, Spin } from 'antd'
|
||||||
import { ComponentDynamic, Container } from 'components'
|
import { AntIcon, ComponentDynamic, Container } from 'components'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
|
|
||||||
@@ -12,6 +12,9 @@ const parts = [
|
|||||||
|
|
||||||
export default class index extends Component {
|
export default class index extends Component {
|
||||||
state = {
|
state = {
|
||||||
|
loading: true,
|
||||||
|
record: null,
|
||||||
|
|
||||||
saving: false,
|
saving: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,6 +26,19 @@ export default class index extends Component {
|
|||||||
return !isEqual(this.state, state)
|
return !isEqual(this.state, state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
// 获取详细数据
|
||||||
|
const { id } = this.props.param
|
||||||
|
if (id) {
|
||||||
|
api.houseCodeDetail({ id }).then(({ data }) => {
|
||||||
|
this.setState({
|
||||||
|
record: data,
|
||||||
|
loading: false,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async onSubmit() {
|
async onSubmit() {
|
||||||
for (const child of this.children) {
|
for (const child of this.children) {
|
||||||
try {
|
try {
|
||||||
@@ -36,8 +52,9 @@ export default class index extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#region 提交数据
|
||||||
this.setState({ saving: true })
|
this.setState({ saving: true })
|
||||||
if (!this.props.param.record) {
|
if (!this.state.record) {
|
||||||
// 新增
|
// 新增
|
||||||
try {
|
try {
|
||||||
const { success } = await api.houseCodeAdd(this.formData)
|
const { success } = await api.houseCodeAdd(this.formData)
|
||||||
@@ -57,7 +74,10 @@ export default class index extends Component {
|
|||||||
} else {
|
} else {
|
||||||
// 编辑
|
// 编辑
|
||||||
try {
|
try {
|
||||||
const { success } = await api.houseCodeEdit(this.formData)
|
const { success } = await api.houseCodeEdit({
|
||||||
|
id: this.state.record.id,
|
||||||
|
...this.formData,
|
||||||
|
})
|
||||||
if (success) {
|
if (success) {
|
||||||
Message.success('保存成功')
|
Message.success('保存成功')
|
||||||
}
|
}
|
||||||
@@ -65,39 +85,54 @@ export default class index extends Component {
|
|||||||
this.setState({ saving: false })
|
this.setState({ saving: false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { id, param } = this.props
|
const { id } = this.props
|
||||||
|
|
||||||
|
const { loading, record, saving } = this.state
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="yo-form-page">
|
<div className="yo-form-page">
|
||||||
<Container mode="fluid">
|
<Container mode="fluid" ref={this.setContainer}>
|
||||||
<br />
|
<Row gutter={16} type="flex">
|
||||||
<div className="yo-adorn--house-top" />
|
<Col flex="1">
|
||||||
<Card className="yo-form-page--body">
|
<br />
|
||||||
{parts.map((item, i) => (
|
<div className="yo-adorn--house-top" />
|
||||||
<section key={i} id={`form-${i}-${id}`}>
|
<Card className="yo-form-page--body">
|
||||||
{item.title && <h5>{parts.title}</h5>}
|
{parts.map((item, i) => (
|
||||||
<ComponentDynamic
|
<section key={i} id={`form-${i}-${id}`}>
|
||||||
is={item.component}
|
{item.title && <h5>{item.title}</h5>}
|
||||||
param={param}
|
<Spin
|
||||||
onRef={r => this.children.push(r)}
|
spinning={loading}
|
||||||
/>
|
indicator={<AntIcon type="loading" />}
|
||||||
</section>
|
wrapperClassName="h-400-min"
|
||||||
))}
|
>
|
||||||
</Card>
|
{!loading && (
|
||||||
|
<ComponentDynamic
|
||||||
|
is={item.component}
|
||||||
|
record={record}
|
||||||
|
onRef={r => this.children.push(r)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Spin>
|
||||||
|
</section>
|
||||||
|
))}
|
||||||
|
</Card>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
</Container>
|
</Container>
|
||||||
<div className="yo-form-page--bar">
|
<div className="yo-form-page--bar">
|
||||||
<Container mode="fluid">
|
<Container mode="fluid">
|
||||||
<div className="yo-form-page--bar-inner">
|
<div className="yo-form-page--bar-inner">
|
||||||
<span></span>
|
<span></span>
|
||||||
<span>
|
<span>
|
||||||
<Button>取消</Button>
|
<Button onClick={() => window.closeContentWindow()}>取消</Button>
|
||||||
<Button
|
<Button
|
||||||
|
loading={saving}
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => this.onSubmit()}
|
onClick={() => this.onSubmit()}
|
||||||
loading={this.state.saving}
|
|
||||||
>
|
>
|
||||||
保存
|
保存
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,36 +1,49 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { Button, Cascader, Form, Input, InputNumber, Radio, Spin, Select, Row, Col, Tag, Alert, Tooltip } from 'antd'
|
import {
|
||||||
|
Button,
|
||||||
|
Cascader,
|
||||||
|
Form,
|
||||||
|
Input,
|
||||||
|
InputNumber,
|
||||||
|
Radio,
|
||||||
|
Spin,
|
||||||
|
Select,
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Tag,
|
||||||
|
Alert,
|
||||||
|
Tooltip,
|
||||||
|
} from 'antd'
|
||||||
import { AntIcon, Auth } from 'components'
|
import { AntIcon, Auth } from 'components'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep, isEqual } from 'lodash'
|
||||||
import getDictData from 'util/dic'
|
import getDictData from 'util/dic'
|
||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
import { CITY } from 'util/global'
|
import { CITY } from 'util/global'
|
||||||
|
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
type: 1,
|
type: 1,
|
||||||
industry: 1
|
industry: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelCol = { flex: '150px' }
|
const labelCol = { flex: '150px' }
|
||||||
const wrapperCol = { flex: '1' }
|
const wrapperCol = { flex: '1' }
|
||||||
|
|
||||||
export default class form extends Component {
|
export default class form extends Component {
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
// 加载状态
|
// 加载状态
|
||||||
loading: true,
|
loading: true,
|
||||||
codes: {
|
codes: {
|
||||||
dicHouseType: [],
|
dicHouseType: [],
|
||||||
dicHouseIndustry: []
|
dicHouseIndustry: [],
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
areaTree: [],
|
areaTree: [],
|
||||||
projects: [],
|
projects: [],
|
||||||
zones: []
|
zones: [],
|
||||||
},
|
},
|
||||||
|
|
||||||
houseCode: '',
|
houseCode: '',
|
||||||
showIndustry: false
|
showIndustry: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表单实例
|
// 表单实例
|
||||||
@@ -41,6 +54,10 @@ export default class form extends Component {
|
|||||||
// 初始化数据
|
// 初始化数据
|
||||||
record = {}
|
record = {}
|
||||||
|
|
||||||
|
shouldComponentUpdate(props, state) {
|
||||||
|
return !isEqual(this.state, state)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mount后回调
|
* mount后回调
|
||||||
*/
|
*/
|
||||||
@@ -48,7 +65,9 @@ export default class form extends Component {
|
|||||||
if (this.props.onRef) {
|
if (this.props.onRef) {
|
||||||
this.props.onRef(this)
|
this.props.onRef(this)
|
||||||
}
|
}
|
||||||
this.fillData(this.props.param)
|
this.fillData({
|
||||||
|
record: this.props.record,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@@ -59,10 +78,9 @@ export default class form extends Component {
|
|||||||
* 填充数据
|
* 填充数据
|
||||||
* 可以在设置this.record之后对其作出数据结构调整
|
* 可以在设置this.record之后对其作出数据结构调整
|
||||||
* [异步,必要]
|
* [异步,必要]
|
||||||
* @param {*} params
|
* @param {*} params
|
||||||
*/
|
*/
|
||||||
async fillData(params) {
|
async fillData(params) {
|
||||||
|
|
||||||
this.record = cloneDeep(params.record)
|
this.record = cloneDeep(params.record)
|
||||||
//#region 从后端转换成前段所需格式
|
//#region 从后端转换成前段所需格式
|
||||||
await this.initMap()
|
await this.initMap()
|
||||||
@@ -75,12 +93,12 @@ export default class form extends Component {
|
|||||||
areaCode.substr(0, 4),
|
areaCode.substr(0, 4),
|
||||||
areaCode.substr(0, 6),
|
areaCode.substr(0, 6),
|
||||||
areaCode.substr(0, 9),
|
areaCode.substr(0, 9),
|
||||||
areaCode
|
areaCode,
|
||||||
]
|
]
|
||||||
// 获取项目和片区列表
|
// 获取项目和片区列表
|
||||||
const data = await this.getProjectsAndZones({
|
const data = await this.getProjectsAndZones({
|
||||||
areaCode: this.record.areaCode,
|
areaCode: this.record.areaCode,
|
||||||
type
|
type,
|
||||||
})
|
})
|
||||||
Object.assign(options, data)
|
Object.assign(options, data)
|
||||||
// 定位
|
// 定位
|
||||||
@@ -93,14 +111,14 @@ export default class form extends Component {
|
|||||||
options.areaTree = areaTree
|
options.areaTree = areaTree
|
||||||
this.setState({
|
this.setState({
|
||||||
codes,
|
codes,
|
||||||
options
|
options,
|
||||||
})
|
})
|
||||||
this.showHouseCode()
|
this.showHouseCode()
|
||||||
//#endregion
|
//#endregion
|
||||||
this.form.current.setFieldsValue(this.record)
|
this.form.current.setFieldsValue(this.record)
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false
|
loading: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +126,7 @@ export default class form extends Component {
|
|||||||
* 获取数据
|
* 获取数据
|
||||||
* 可以对postData进行数据结构调整
|
* 可以对postData进行数据结构调整
|
||||||
* [异步,必要]
|
* [异步,必要]
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async getData() {
|
async getData() {
|
||||||
const form = this.form.current
|
const form = this.form.current
|
||||||
@@ -116,9 +134,6 @@ export default class form extends Component {
|
|||||||
const valid = await form.validateFields()
|
const valid = await form.validateFields()
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const postData = form.getFieldsValue()
|
const postData = form.getFieldsValue()
|
||||||
if (this.record) {
|
|
||||||
postData.id = this.record.id
|
|
||||||
}
|
|
||||||
//#region 从前段转换后端所需格式
|
//#region 从前段转换后端所需格式
|
||||||
if (postData.areaCode) {
|
if (postData.areaCode) {
|
||||||
postData.areaCode = postData.areaCode[3]
|
postData.areaCode = postData.areaCode[3]
|
||||||
@@ -130,7 +145,6 @@ export default class form extends Component {
|
|||||||
|
|
||||||
//#region 自定义方法
|
//#region 自定义方法
|
||||||
initMap() {
|
initMap() {
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const amap = AMap
|
const amap = AMap
|
||||||
|
|
||||||
@@ -140,7 +154,7 @@ export default class form extends Component {
|
|||||||
const district = new amap.DistrictSearch({
|
const district = new amap.DistrictSearch({
|
||||||
subdistrict: 0,
|
subdistrict: 0,
|
||||||
extensions: 'all',
|
extensions: 'all',
|
||||||
level: 'city'
|
level: 'city',
|
||||||
})
|
})
|
||||||
|
|
||||||
district.search(city, (status, result) => {
|
district.search(city, (status, result) => {
|
||||||
@@ -152,15 +166,15 @@ export default class form extends Component {
|
|||||||
|
|
||||||
const geocoder = new amap.Geocoder({ city })
|
const geocoder = new amap.Geocoder({ city })
|
||||||
geocoder.getLocation(city, (status, result) => {
|
geocoder.getLocation(city, (status, result) => {
|
||||||
|
if (status !== 'complete' || !(result.geocodes && result.geocodes.length))
|
||||||
if (status !== 'complete' || !(result.geocodes && result.geocodes.length)) return
|
return
|
||||||
|
|
||||||
this.citycode = result.geocodes[0].addressComponent.citycode
|
this.citycode = result.geocodes[0].addressComponent.citycode
|
||||||
|
|
||||||
this.map = new amap.Map(this.refs.map, {
|
this.map = new amap.Map(this.refs.map, {
|
||||||
mask,
|
mask,
|
||||||
zoom: 12,
|
zoom: 12,
|
||||||
center: result.geocodes[0].location
|
center: result.geocodes[0].location,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.map.on('click', e => {
|
this.map.on('click', e => {
|
||||||
@@ -176,7 +190,7 @@ export default class form extends Component {
|
|||||||
path,
|
path,
|
||||||
strokeColor: '#ccc',
|
strokeColor: '#ccc',
|
||||||
strokeWeight: 4,
|
strokeWeight: 4,
|
||||||
map: this.map
|
map: this.map,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,13 +200,13 @@ export default class form extends Component {
|
|||||||
const auto = new amap.AutoComplete({
|
const auto = new amap.AutoComplete({
|
||||||
input: this.refs['map-search'].input,
|
input: this.refs['map-search'].input,
|
||||||
city,
|
city,
|
||||||
citylimit: true
|
citylimit: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
const placeSearch = new amap.PlaceSearch({
|
const placeSearch = new amap.PlaceSearch({
|
||||||
city,
|
city,
|
||||||
citylimit: true,
|
citylimit: true,
|
||||||
pageSize: 1
|
pageSize: 1,
|
||||||
})
|
})
|
||||||
|
|
||||||
auto.on('select', ({ poi: { name: keywords, adcode } }) => {
|
auto.on('select', ({ poi: { name: keywords, adcode } }) => {
|
||||||
@@ -206,15 +220,13 @@ export default class form extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
setMarker(position, geocoder) {
|
setMarker(position, geocoder) {
|
||||||
|
const set = position => {
|
||||||
const set = (position) => {
|
|
||||||
if (this.marker) {
|
if (this.marker) {
|
||||||
this.marker.setPosition(position)
|
this.marker.setPosition(position)
|
||||||
} else {
|
} else {
|
||||||
@@ -242,7 +254,6 @@ export default class form extends Component {
|
|||||||
|
|
||||||
set(position)
|
set(position)
|
||||||
resolve(position)
|
resolve(position)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.error('根据经纬度查询地址失败')
|
console.error('根据经纬度查询地址失败')
|
||||||
|
|
||||||
@@ -260,7 +271,7 @@ export default class form extends Component {
|
|||||||
this.form.current.setFieldsValue({
|
this.form.current.setFieldsValue({
|
||||||
address,
|
address,
|
||||||
lng,
|
lng,
|
||||||
lat
|
lat,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,13 +290,13 @@ export default class form extends Component {
|
|||||||
if (mode.includes('projects')) {
|
if (mode.includes('projects')) {
|
||||||
const { data: projects } = await api.houseProjectList({
|
const { data: projects } = await api.houseProjectList({
|
||||||
areaCode: areaCode[3],
|
areaCode: areaCode[3],
|
||||||
type
|
type,
|
||||||
})
|
})
|
||||||
result.projects = projects
|
result.projects = projects
|
||||||
}
|
}
|
||||||
if (mode.includes('zones')) {
|
if (mode.includes('zones')) {
|
||||||
const { data: zones } = await api.houseZoneList({
|
const { data: zones } = await api.houseZoneList({
|
||||||
areaCode: areaCode[3]
|
areaCode: areaCode[3],
|
||||||
})
|
})
|
||||||
result.zones = zones
|
result.zones = zones
|
||||||
}
|
}
|
||||||
@@ -300,7 +311,7 @@ export default class form extends Component {
|
|||||||
this.setState({ loading: true })
|
this.setState({ loading: true })
|
||||||
const { data: no } = await api.houseCodeNo({ projectId })
|
const { data: no } = await api.houseCodeNo({ projectId })
|
||||||
this.form.current.setFieldsValue({
|
this.form.current.setFieldsValue({
|
||||||
no
|
no,
|
||||||
})
|
})
|
||||||
this.setState({ loading: false })
|
this.setState({ loading: false })
|
||||||
}
|
}
|
||||||
@@ -308,7 +319,7 @@ export default class form extends Component {
|
|||||||
showHouseCode(values) {
|
showHouseCode(values) {
|
||||||
if (this.record) {
|
if (this.record) {
|
||||||
this.setState({
|
this.setState({
|
||||||
houseCode: this.record.houseCode
|
houseCode: this.record.houseCode,
|
||||||
})
|
})
|
||||||
} else if (values) {
|
} else if (values) {
|
||||||
const { type, industry, areaCode, projectId, no } = values
|
const { type, industry, areaCode, projectId, no } = values
|
||||||
@@ -323,7 +334,8 @@ export default class form extends Component {
|
|||||||
if (!industry) {
|
if (!industry) {
|
||||||
this.setState({ houseCode: '' })
|
this.setState({ houseCode: '' })
|
||||||
} else {
|
} else {
|
||||||
const tag = this.state.codes.dicHouseIndustry.find(p => p.code == industry).extCode.tag
|
const tag = this.state.codes.dicHouseIndustry.find(p => p.code == industry)
|
||||||
|
.extCode.tag
|
||||||
houseCode += `-${tag}`
|
houseCode += `-${tag}`
|
||||||
this.setState({ houseCode })
|
this.setState({ houseCode })
|
||||||
}
|
}
|
||||||
@@ -340,16 +352,16 @@ export default class form extends Component {
|
|||||||
if (changedValues.hasOwnProperty('type')) {
|
if (changedValues.hasOwnProperty('type')) {
|
||||||
this.setState({
|
this.setState({
|
||||||
showIndustry: changedValues.type == 2,
|
showIndustry: changedValues.type == 2,
|
||||||
loading: true
|
loading: true,
|
||||||
})
|
})
|
||||||
const data = await this.getProjectsAndZones()
|
const data = await this.getProjectsAndZones()
|
||||||
form.setFieldsValue({ projectId: undefined })
|
form.setFieldsValue({ projectId: undefined })
|
||||||
this.setState({
|
this.setState({
|
||||||
options: {
|
options: {
|
||||||
...this.state.options,
|
...this.state.options,
|
||||||
...data
|
...data,
|
||||||
},
|
},
|
||||||
loading: false
|
loading: false,
|
||||||
})
|
})
|
||||||
this.showHouseCode(form.getFieldsValue())
|
this.showHouseCode(form.getFieldsValue())
|
||||||
}
|
}
|
||||||
@@ -362,9 +374,9 @@ export default class form extends Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
options: {
|
options: {
|
||||||
...this.state.options,
|
...this.state.options,
|
||||||
...data
|
...data,
|
||||||
},
|
},
|
||||||
loading: false
|
loading: false,
|
||||||
})
|
})
|
||||||
this.showHouseCode(form.getFieldsValue())
|
this.showHouseCode(form.getFieldsValue())
|
||||||
}
|
}
|
||||||
@@ -392,15 +404,14 @@ export default class form extends Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
options: {
|
options: {
|
||||||
...this.state.options,
|
...this.state.options,
|
||||||
...data
|
...data,
|
||||||
},
|
},
|
||||||
loading: false
|
loading: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
const { loading, codes, options, showIndustry, houseCode } = this.state
|
const { loading, codes, options, showIndustry, houseCode } = this.state
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -409,61 +420,70 @@ export default class form extends Component {
|
|||||||
ref={this.form}
|
ref={this.form}
|
||||||
// labelCol={labelCol}
|
// labelCol={labelCol}
|
||||||
// wrapperCol={wrapperCol}
|
// wrapperCol={wrapperCol}
|
||||||
onValuesChange={(changedValues, allValues) => this.onValuesChange(changedValues, allValues)}
|
onValuesChange={(changedValues, allValues) =>
|
||||||
|
this.onValuesChange(changedValues, allValues)
|
||||||
|
}
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
|
|
||||||
>
|
>
|
||||||
<Spin spinning={loading} indicator={<AntIcon type="loading" />}>
|
<Spin spinning={loading} indicator={<AntIcon type="loading" />}>
|
||||||
<Row gutter={16}>
|
<Row gutter={16}>
|
||||||
<Col span={10}>
|
<Col span={10}>
|
||||||
<div className="yo-map-container">
|
<div className="yo-map-container">
|
||||||
<div className="yo-map--search">
|
<div className="yo-map--search">
|
||||||
<Input.Search allowClear placeholder="请输入关键字" ref="map-search" />
|
<Input.Search
|
||||||
|
allowClear
|
||||||
|
placeholder="请输入关键字"
|
||||||
|
ref="map-search"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="h-700" ref="map"></div>
|
<div className="h-700" ref="map"></div>
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={14}>
|
<Col span={14}>
|
||||||
<Form.Item label="房屋性质" name="type" rules={[{ required: true, message: '请选择房屋性质' }]}>
|
<Form.Item
|
||||||
<Radio.Group
|
label="房屋性质"
|
||||||
disabled={!!this.record}
|
name="type"
|
||||||
buttonStyle="solid"
|
rules={[{ required: true, message: '请选择房屋性质' }]}
|
||||||
>
|
>
|
||||||
|
<Radio.Group disabled={!!this.record} buttonStyle="solid">
|
||||||
{codes.dicHouseType.map(item => (
|
{codes.dicHouseType.map(item => (
|
||||||
<Radio.Button
|
<Radio.Button key={item.code} value={+item.code}>
|
||||||
key={item.code}
|
{item.value}
|
||||||
value={+item.code}
|
</Radio.Button>
|
||||||
>{item.value}</Radio.Button>
|
|
||||||
))}
|
))}
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{
|
{showIndustry && (
|
||||||
showIndustry &&
|
<Form.Item
|
||||||
<Form.Item label="所属行业、系统" name="industry" rules={[{ required: true, message: '请选择所属行业、系统' }]}>
|
label="所属行业、系统"
|
||||||
<Radio.Group
|
name="industry"
|
||||||
disabled={!!this.record}
|
rules={[{ required: true, message: '请选择所属行业、系统' }]}
|
||||||
buttonStyle="solid"
|
>
|
||||||
>
|
<Radio.Group disabled={!!this.record} buttonStyle="solid">
|
||||||
{codes.dicHouseIndustry.map(item => (
|
{codes.dicHouseIndustry.map(item => (
|
||||||
<Radio.Button
|
<Radio.Button key={item.code} value={+item.code}>
|
||||||
key={item.code}
|
{item.value}
|
||||||
value={+item.code}
|
</Radio.Button>
|
||||||
>{item.value}</Radio.Button>
|
|
||||||
))}
|
))}
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
}
|
)}
|
||||||
<Form.Item label="房屋编码" required className="mb-none">
|
<Form.Item label="房屋编码" required className="mb-none">
|
||||||
<Row gutter={16}>
|
<Row gutter={16}>
|
||||||
<Col flex="100%">
|
<Col flex="100%">
|
||||||
<Form.Item name="areaCode" rules={[{ required: true, message: '请选择房屋所在区域' }]}>
|
<Form.Item
|
||||||
|
name="areaCode"
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: '请选择房屋所在区域' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
<Cascader
|
<Cascader
|
||||||
allowClear={false}
|
allowClear={false}
|
||||||
displayRender={(labels) => labels.join(' - ')}
|
displayRender={labels => labels.join(' - ')}
|
||||||
fieldNames={{
|
fieldNames={{
|
||||||
label: 'name',
|
label: 'name',
|
||||||
value: 'code',
|
value: 'code',
|
||||||
children: 'children'
|
children: 'children',
|
||||||
}}
|
}}
|
||||||
options={options.areaTree}
|
options={options.areaTree}
|
||||||
expandTrigger="hover"
|
expandTrigger="hover"
|
||||||
@@ -473,13 +493,20 @@ export default class form extends Component {
|
|||||||
<Col flex="1">
|
<Col flex="1">
|
||||||
<Row gutter={8}>
|
<Row gutter={8}>
|
||||||
<Col flex="1">
|
<Col flex="1">
|
||||||
<Form.Item name="projectId" rules={[{ required: true, message: '请选择项目' }]}>
|
<Form.Item
|
||||||
|
name="projectId"
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: '请选择项目' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
<Select placeholder="请选择项目">
|
<Select placeholder="请选择项目">
|
||||||
{options.projects.map(item => (
|
{options.projects.map(item => (
|
||||||
<Select.Option
|
<Select.Option
|
||||||
key={item.id}
|
key={item.id}
|
||||||
value={item.id}
|
value={item.id}
|
||||||
>{item.name}({item.note})</Select.Option>
|
>
|
||||||
|
{item.name}({item.note})
|
||||||
|
</Select.Option>
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -488,8 +515,18 @@ export default class form extends Component {
|
|||||||
<Col>
|
<Col>
|
||||||
<Button.Group>
|
<Button.Group>
|
||||||
<Button>项目管理</Button>
|
<Button>项目管理</Button>
|
||||||
<Tooltip placement="top" title="重新加载项目列表">
|
<Tooltip
|
||||||
<Button icon={<AntIcon type="reload" />} onClick={() => this.onReloadProjectsOrZones('projects')}></Button>
|
placement="top"
|
||||||
|
title="重新加载项目列表"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
icon={<AntIcon type="reload" />}
|
||||||
|
onClick={() =>
|
||||||
|
this.onReloadProjectsOrZones(
|
||||||
|
'projects'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
></Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Button.Group>
|
</Button.Group>
|
||||||
</Col>
|
</Col>
|
||||||
@@ -497,9 +534,12 @@ export default class form extends Component {
|
|||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
<Col flex="1">
|
<Col flex="1">
|
||||||
<Form.Item name="no" rules={[{ required: true, message: '请输入房屋序号' }]}>
|
<Form.Item
|
||||||
|
name="no"
|
||||||
|
rules={[{ required: true, message: '请输入房屋序号' }]}
|
||||||
|
>
|
||||||
<InputNumber
|
<InputNumber
|
||||||
formatter={(value) => value.padStart(3, '0')}
|
formatter={value => value.padStart(3, '0')}
|
||||||
max={999}
|
max={999}
|
||||||
min={1}
|
min={1}
|
||||||
precision={0}
|
precision={0}
|
||||||
@@ -509,14 +549,10 @@ export default class form extends Component {
|
|||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
{
|
{showIndustry && <Col>-</Col>}
|
||||||
showIndustry &&
|
|
||||||
<Col>-</Col>
|
|
||||||
}
|
|
||||||
</Row>
|
</Row>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{
|
{houseCode && (
|
||||||
houseCode &&
|
|
||||||
<Form.Item>
|
<Form.Item>
|
||||||
<Tag
|
<Tag
|
||||||
color="purple"
|
color="purple"
|
||||||
@@ -524,27 +560,64 @@ export default class form extends Component {
|
|||||||
fontSize: '24px',
|
fontSize: '24px',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
letterSpacing: '10px',
|
letterSpacing: '10px',
|
||||||
padding: '12px'
|
padding: '12px',
|
||||||
}}
|
}}
|
||||||
>{houseCode}</Tag>
|
>
|
||||||
|
{houseCode}
|
||||||
|
</Tag>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
}
|
)}
|
||||||
<Alert
|
<Alert
|
||||||
message={<b>房屋编码说明</b>}
|
message={<b>房屋编码说明</b>}
|
||||||
description={<>
|
description={
|
||||||
房屋所在市<AntIcon type="border" /><AntIcon type="border" /><AntIcon type="border" /><AntIcon type="border" />—县(市、区)<AntIcon type="border" /><AntIcon type="border" />—街道(乡、镇)<AntIcon type="border" /><AntIcon type="border" /><AntIcon type="border" />—社区、居(村)委会)<AntIcon type="border" /><AntIcon type="border" /><AntIcon type="border" />—项目<AntIcon type="border" /><AntIcon type="border" /><AntIcon type="border" />—实物幢序号<AntIcon type="border" /><AntIcon type="border" /><AntIcon type="border" />。 根据省厅既有建筑物编号规则,房屋所在区域编号按照市、县(市、区)、街道(乡、镇)、社区、居(村)委会)、项目分类,其中市、县(市)区部分按照《中华人民共和国行政区划代码》(GB2260)标准编码,街道(乡、镇)按《县以下行政区划代码编码规则》(GB10114-88)标准编码,社区、居(村)委会部分按照统计局提供编码设定。各地上报各街道社区名称后,上述编号由系统自动生成。<br />各社区下辖项目由各地负责统一编码,住宅项目序号一般一个小区一号,采用3位数,001号起编,范围为001~999。实物幢序号由各地负责统一编码,以幢为单位,采用3位数,001号起编,范围为001~999。
|
<>
|
||||||
</>} />
|
房屋所在市
|
||||||
|
<AntIcon type="border" />
|
||||||
|
<AntIcon type="border" />
|
||||||
|
<AntIcon type="border" />
|
||||||
|
<AntIcon type="border" />
|
||||||
|
—县(市、区)
|
||||||
|
<AntIcon type="border" />
|
||||||
|
<AntIcon type="border" />
|
||||||
|
—街道(乡、镇)
|
||||||
|
<AntIcon type="border" />
|
||||||
|
<AntIcon type="border" />
|
||||||
|
<AntIcon type="border" />
|
||||||
|
—社区、居(村)委会)
|
||||||
|
<AntIcon type="border" />
|
||||||
|
<AntIcon type="border" />
|
||||||
|
<AntIcon type="border" />
|
||||||
|
—项目
|
||||||
|
<AntIcon type="border" />
|
||||||
|
<AntIcon type="border" />
|
||||||
|
<AntIcon type="border" />
|
||||||
|
—实物幢序号
|
||||||
|
<AntIcon type="border" />
|
||||||
|
<AntIcon type="border" />
|
||||||
|
<AntIcon type="border" />。
|
||||||
|
根据省厅既有建筑物编号规则,房屋所在区域编号按照市、县(市、区)、街道(乡、镇)、社区、居(村)委会)、项目分类,其中市、县(市)区部分按照《中华人民共和国行政区划代码》(GB2260)标准编码,街道(乡、镇)按《县以下行政区划代码编码规则》(GB10114-88)标准编码,社区、居(村)委会部分按照统计局提供编码设定。各地上报各街道社区名称后,上述编号由系统自动生成。
|
||||||
|
<br />
|
||||||
|
各社区下辖项目由各地负责统一编码,住宅项目序号一般一个小区一号,采用3位数,001号起编,范围为001~999。实物幢序号由各地负责统一编码,以幢为单位,采用3位数,001号起编,范围为001~999。
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<br />
|
<br />
|
||||||
<Form.Item label="所属片区" required>
|
<Form.Item label="所属片区" required>
|
||||||
<Row gutter={8}>
|
<Row gutter={8}>
|
||||||
<Col flex="1">
|
<Col flex="1">
|
||||||
<Form.Item name="zoneId" rules={[{ required: true, message: '请选择所属片区' }]} noStyle>
|
<Form.Item
|
||||||
<Select placeholder="请选择所属片区" className="w-100-p">
|
name="zoneId"
|
||||||
|
rules={[{ required: true, message: '请选择所属片区' }]}
|
||||||
|
noStyle
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
placeholder="请选择所属片区"
|
||||||
|
className="w-100-p"
|
||||||
|
>
|
||||||
{options.zones.map(item => (
|
{options.zones.map(item => (
|
||||||
<Select.Option
|
<Select.Option key={item.id} value={item.id}>
|
||||||
key={item.id}
|
{item.name}
|
||||||
value={item.id}
|
</Select.Option>
|
||||||
>{item.name}</Select.Option>
|
|
||||||
))}
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -554,26 +627,58 @@ export default class form extends Component {
|
|||||||
<Button.Group>
|
<Button.Group>
|
||||||
<Button>片区管理</Button>
|
<Button>片区管理</Button>
|
||||||
<Tooltip placement="top" title="重新加载片区列表">
|
<Tooltip placement="top" title="重新加载片区列表">
|
||||||
<Button icon={<AntIcon type="reload" />} onClick={() => this.onReloadProjectsOrZones('zones')}></Button>
|
<Button
|
||||||
|
icon={<AntIcon type="reload" />}
|
||||||
|
onClick={() =>
|
||||||
|
this.onReloadProjectsOrZones('zones')
|
||||||
|
}
|
||||||
|
></Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Button.Group>
|
</Button.Group>
|
||||||
</Col>
|
</Col>
|
||||||
</Auth>
|
</Auth>
|
||||||
</Row>
|
</Row>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="房屋地址" name="address" rules={[{ required: true, message: '请输入房屋地址' }]}>
|
<Form.Item
|
||||||
<Input autoComplete="off" placeholder="请输入房屋地址或在地图上选择地点" />
|
label="房屋地址"
|
||||||
|
name="address"
|
||||||
|
rules={[{ required: true, message: '请输入房屋地址' }]}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
autoComplete="off"
|
||||||
|
placeholder="请输入房屋地址或在地图上选择地点"
|
||||||
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="地理坐标" required>
|
<Form.Item label="地理坐标" required>
|
||||||
<Row gutter={16}>
|
<Row gutter={16}>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="lng" className="mb-none" rules={[{ required: true, message: '请在地图中选择坐标' }]}>
|
<Form.Item
|
||||||
<Input disabled placeholder="请在地图中选择坐标" prefix="经度" />
|
name="lng"
|
||||||
|
className="mb-none"
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: '请在地图中选择坐标' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
disabled
|
||||||
|
placeholder="请在地图中选择坐标"
|
||||||
|
prefix="经度"
|
||||||
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
<Col span={12}>
|
<Col span={12}>
|
||||||
<Form.Item name="lat" className="mb-none" rules={[{ required: true, message: '请在地图中选择坐标' }]}>
|
<Form.Item
|
||||||
<Input disabled placeholder="请在地图中选择坐标" prefix="纬度" />
|
name="lat"
|
||||||
|
className="mb-none"
|
||||||
|
rules={[
|
||||||
|
{ required: true, message: '请在地图中选择坐标' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
disabled
|
||||||
|
placeholder="请在地图中选择坐标"
|
||||||
|
prefix="纬度"
|
||||||
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { Button, Card, Cascader, Form, Input, InputNumber, Popconfirm, message as Message, Radio, Select } from 'antd'
|
import {
|
||||||
|
Button,
|
||||||
|
Card,
|
||||||
|
Cascader,
|
||||||
|
Form,
|
||||||
|
Input,
|
||||||
|
InputNumber,
|
||||||
|
Popconfirm,
|
||||||
|
message as Message,
|
||||||
|
Radio,
|
||||||
|
Select,
|
||||||
|
} from 'antd'
|
||||||
import { isEqual } from 'lodash'
|
import { isEqual } from 'lodash'
|
||||||
import { AntIcon, Auth, Container, QueryTable, QueryTableActions } from 'components'
|
import { AntIcon, Auth, Container, QueryTable, QueryTableActions } from 'components'
|
||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
@@ -10,25 +21,24 @@ import { getSearchInfo } from 'util/query'
|
|||||||
|
|
||||||
// 配置页面所需接口函数
|
// 配置页面所需接口函数
|
||||||
const apiAction = {
|
const apiAction = {
|
||||||
page: api.houseCodePage
|
page: api.houseCodePage,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用于弹窗标题
|
// 用于弹窗标题
|
||||||
const name = '房屋编码'
|
const name = '房屋编码'
|
||||||
|
|
||||||
export default class index extends Component {
|
export default class index extends Component {
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
codes: {
|
codes: {
|
||||||
dicHouseType: [],
|
dicHouseType: [],
|
||||||
dicHouseIndustry: []
|
dicHouseIndustry: [],
|
||||||
},
|
},
|
||||||
|
|
||||||
options: {
|
options: {
|
||||||
areaTree: []
|
areaTree: [],
|
||||||
},
|
},
|
||||||
|
|
||||||
type: ''
|
type: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
// 表格实例
|
// 表格实例
|
||||||
@@ -41,14 +51,21 @@ export default class index extends Component {
|
|||||||
dataIndex: 'houseCode',
|
dataIndex: 'houseCode',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
width: 300,
|
width: 300,
|
||||||
render: (text, record) => `${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${record.no.toString().padStart(3, '0')}`
|
render: (text, record) =>
|
||||||
|
`${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${record.no
|
||||||
|
.toString()
|
||||||
|
.padStart(3, '0')}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '房屋性质及行业',
|
title: '房屋性质及行业',
|
||||||
dataIndex: 'type',
|
dataIndex: 'type',
|
||||||
sorter: true,
|
sorter: true,
|
||||||
width: 150,
|
width: 150,
|
||||||
render: (text, record) => this.bindCodeValue(text, 'dic_house_type') + (text === 2 ? `(${this.bindCodeValue(record.industry, 'dic_house_industry')})` : '')
|
render: (text, record) =>
|
||||||
|
this.bindCodeValue(text, 'dic_house_type') +
|
||||||
|
(text === 2
|
||||||
|
? `(${this.bindCodeValue(record.industry, 'dic_house_industry')})`
|
||||||
|
: ''),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '地址',
|
title: '地址',
|
||||||
@@ -65,7 +82,7 @@ export default class index extends Component {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造函数,在渲染前动态添加操作字段等
|
* 构造函数,在渲染前动态添加操作字段等
|
||||||
* @param {*} props
|
* @param {*} props
|
||||||
*/
|
*/
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
@@ -77,20 +94,22 @@ export default class index extends Component {
|
|||||||
title: '操作',
|
title: '操作',
|
||||||
width: 150,
|
width: 150,
|
||||||
dataIndex: 'actions',
|
dataIndex: 'actions',
|
||||||
render: (text, record) => (<QueryTableActions>
|
render: (text, record) => (
|
||||||
<Auth auth="houseCode:edit">
|
<QueryTableActions>
|
||||||
<a onClick={() => this.onOpen(record)}>编辑</a>
|
<Auth auth="houseCode:edit">
|
||||||
</Auth>
|
<a onClick={() => this.onOpen(record)}>编辑</a>
|
||||||
<Auth auth="houseCode:delete">
|
</Auth>
|
||||||
<Popconfirm
|
<Auth auth="houseCode:delete">
|
||||||
placement="topRight"
|
<Popconfirm
|
||||||
title="是否确认删除"
|
placement="topRight"
|
||||||
onConfirm={() => this.onDelete(record)}
|
title="是否确认删除"
|
||||||
>
|
onConfirm={() => this.onDelete(record)}
|
||||||
<a>删除</a>
|
>
|
||||||
</Popconfirm>
|
<a>删除</a>
|
||||||
</Auth>
|
</Popconfirm>
|
||||||
</QueryTableActions>)
|
</Auth>
|
||||||
|
</QueryTableActions>
|
||||||
|
),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,9 +118,9 @@ export default class index extends Component {
|
|||||||
* 阻止外部组件引发的渲染,提升性能
|
* 阻止外部组件引发的渲染,提升性能
|
||||||
* 可自行添加渲染条件
|
* 可自行添加渲染条件
|
||||||
* [必要]
|
* [必要]
|
||||||
* @param {*} props
|
* @param {*} props
|
||||||
* @param {*} state
|
* @param {*} state
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
shouldComponentUpdate(props, state) {
|
shouldComponentUpdate(props, state) {
|
||||||
return !isEqual(this.state, state)
|
return !isEqual(this.state, state)
|
||||||
@@ -114,28 +133,30 @@ export default class index extends Component {
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { onLoading, onLoadData } = this.table.current
|
const { onLoading, onLoadData } = this.table.current
|
||||||
onLoading()
|
onLoading()
|
||||||
getDictData('dic_house_type', 'dic_house_industry').then(async (res) => {
|
getDictData('dic_house_type', 'dic_house_industry').then(async res => {
|
||||||
const { data } = await api.getAreaTree()
|
const { data } = await api.getAreaTree()
|
||||||
this.setState({
|
this.setState(
|
||||||
codes: res,
|
{
|
||||||
options: {
|
codes: res,
|
||||||
areaTree: data
|
options: {
|
||||||
|
areaTree: data,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
onLoadData()
|
||||||
}
|
}
|
||||||
}, () => {
|
)
|
||||||
onLoadData()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调用加载数据接口,可在调用前对query进行处理
|
* 调用加载数据接口,可在调用前对query进行处理
|
||||||
* [异步,必要]
|
* [异步,必要]
|
||||||
* @param {*} params
|
* @param {*} params
|
||||||
* @param {*} query
|
* @param {*} query
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
loadData = async (params, query) => {
|
loadData = async (params, query) => {
|
||||||
|
|
||||||
if (query.areaCode) {
|
if (query.areaCode) {
|
||||||
query.areaCode = query.areaCode.pop()
|
query.areaCode = query.areaCode.pop()
|
||||||
}
|
}
|
||||||
@@ -146,8 +167,8 @@ export default class index extends Component {
|
|||||||
no: '=',
|
no: '=',
|
||||||
type: '=',
|
type: '=',
|
||||||
address: 'like',
|
address: 'like',
|
||||||
houseCode: 'like'
|
houseCode: 'like',
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const { data } = await apiAction.page({
|
const { data } = await apiAction.page({
|
||||||
@@ -159,15 +180,15 @@ export default class index extends Component {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 绑定字典数据
|
* 绑定字典数据
|
||||||
* @param {*} code
|
* @param {*} code
|
||||||
* @param {*} name
|
* @param {*} name
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
bindCodeValue(code, name) {
|
bindCodeValue(code, name) {
|
||||||
name = toCamelCase(name)
|
name = toCamelCase(name)
|
||||||
const codes = this.state.codes[name]
|
const codes = this.state.codes[name]
|
||||||
if (codes) {
|
if (codes) {
|
||||||
const c = codes.find((p) => p.code == code)
|
const c = codes.find(p => p.code == code)
|
||||||
if (c) {
|
if (c) {
|
||||||
return c.value
|
return c.value
|
||||||
}
|
}
|
||||||
@@ -177,8 +198,8 @@ export default class index extends Component {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 打开新增/编辑弹窗
|
* 打开新增/编辑弹窗
|
||||||
* @param {*} modal
|
* @param {*} modal
|
||||||
* @param {*} record
|
* @param {*} record
|
||||||
*/
|
*/
|
||||||
onOpen(record) {
|
onOpen(record) {
|
||||||
const path = 'business/house/code/form'
|
const path = 'business/house/code/form'
|
||||||
@@ -187,11 +208,13 @@ export default class index extends Component {
|
|||||||
title: record ? '修改房屋编码' : '新增房屋编码',
|
title: record ? '修改房屋编码' : '新增房屋编码',
|
||||||
subTitle:
|
subTitle:
|
||||||
record &&
|
record &&
|
||||||
`${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${record.no.toString().padStart(3, '0')}`,
|
`${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${record.no
|
||||||
|
.toString()
|
||||||
|
.padStart(3, '0')}`,
|
||||||
path,
|
path,
|
||||||
param: {
|
param: {
|
||||||
record
|
id: record.id,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
// modal.current.open({
|
// modal.current.open({
|
||||||
// record
|
// record
|
||||||
@@ -201,8 +224,8 @@ export default class index extends Component {
|
|||||||
/**
|
/**
|
||||||
* 对表格上的操作进行统一处理
|
* 对表格上的操作进行统一处理
|
||||||
* [异步]
|
* [异步]
|
||||||
* @param {*} action
|
* @param {*} action
|
||||||
* @param {*} successMessage
|
* @param {*} successMessage
|
||||||
*/
|
*/
|
||||||
async onAction(action, successMessage) {
|
async onAction(action, successMessage) {
|
||||||
const { onLoading, onLoaded, onReloadData } = this.table.current
|
const { onLoading, onLoaded, onReloadData } = this.table.current
|
||||||
@@ -222,20 +245,16 @@ export default class index extends Component {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除
|
* 删除
|
||||||
* @param {*} record
|
* @param {*} record
|
||||||
*/
|
*/
|
||||||
onDelete(record) {
|
onDelete(record) {
|
||||||
this.onAction(
|
this.onAction(apiAction.delete(record), '删除成功')
|
||||||
apiAction.delete(record),
|
|
||||||
'删除成功'
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//#region 自定义方法
|
//#region 自定义方法
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
const { options, codes, type } = this.state
|
const { options, codes, type } = this.state
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -248,9 +267,9 @@ export default class index extends Component {
|
|||||||
loadData={this.loadData}
|
loadData={this.loadData}
|
||||||
columns={this.columns}
|
columns={this.columns}
|
||||||
queryInitialValues={{
|
queryInitialValues={{
|
||||||
type: ''
|
type: '',
|
||||||
}}
|
}}
|
||||||
onQueryChange={(values) => {
|
onQueryChange={values => {
|
||||||
if (values.hasOwnProperty('type')) {
|
if (values.hasOwnProperty('type')) {
|
||||||
this.setState({ type: values.type })
|
this.setState({ type: values.type })
|
||||||
}
|
}
|
||||||
@@ -259,11 +278,11 @@ export default class index extends Component {
|
|||||||
<Auth auth="houseCode:page">
|
<Auth auth="houseCode:page">
|
||||||
<Form.Item name="areaCode">
|
<Form.Item name="areaCode">
|
||||||
<Cascader
|
<Cascader
|
||||||
displayRender={(labels) => labels.join(' - ')}
|
displayRender={labels => labels.join(' - ')}
|
||||||
fieldNames={{
|
fieldNames={{
|
||||||
label: 'name',
|
label: 'name',
|
||||||
value: 'code',
|
value: 'code',
|
||||||
children: 'children'
|
children: 'children',
|
||||||
}}
|
}}
|
||||||
options={options.areaTree}
|
options={options.areaTree}
|
||||||
className="w-400"
|
className="w-400"
|
||||||
@@ -273,7 +292,7 @@ export default class index extends Component {
|
|||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="编号" name="no">
|
<Form.Item label="编号" name="no">
|
||||||
<InputNumber
|
<InputNumber
|
||||||
formatter={(value) => value && value.padStart(3, '0')}
|
formatter={value => value && value.padStart(3, '0')}
|
||||||
max={999}
|
max={999}
|
||||||
min={1}
|
min={1}
|
||||||
precision={0}
|
precision={0}
|
||||||
@@ -284,31 +303,28 @@ export default class index extends Component {
|
|||||||
<Form.Item label="房屋性质" name="type">
|
<Form.Item label="房屋性质" name="type">
|
||||||
<Radio.Group buttonStyle="solid">
|
<Radio.Group buttonStyle="solid">
|
||||||
<Radio.Button value="">全部</Radio.Button>
|
<Radio.Button value="">全部</Radio.Button>
|
||||||
{
|
{codes.dicHouseType.map(item => (
|
||||||
codes.dicHouseType.map(item => (
|
<Radio.Button key={item.code} value={item.code}>
|
||||||
<Radio.Button
|
{item.value}
|
||||||
key={item.code}
|
</Radio.Button>
|
||||||
value={item.code}
|
))}
|
||||||
>{item.value}</Radio.Button>
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{
|
{type == 2 && (
|
||||||
type == 2 &&
|
|
||||||
<Form.Item label="行业" name="industry">
|
<Form.Item label="行业" name="industry">
|
||||||
<Select allowClear className="w-150" placeholder="请选择行业">
|
<Select
|
||||||
{
|
allowClear
|
||||||
codes.dicHouseIndustry.map(item => (
|
className="w-150"
|
||||||
<Select.Option
|
placeholder="请选择行业"
|
||||||
key={item.code}
|
>
|
||||||
value={item.code}
|
{codes.dicHouseIndustry.map(item => (
|
||||||
>{item.value}</Select.Option>
|
<Select.Option key={item.code} value={item.code}>
|
||||||
))
|
{item.value}
|
||||||
}
|
</Select.Option>
|
||||||
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
}
|
)}
|
||||||
<Form.Item label="地址" name="address">
|
<Form.Item label="地址" name="address">
|
||||||
<Input autoComplete="off" placeholder="请输入地址" />
|
<Input autoComplete="off" placeholder="请输入地址" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
@@ -322,7 +338,9 @@ export default class index extends Component {
|
|||||||
<Button
|
<Button
|
||||||
icon={<AntIcon type="plus" />}
|
icon={<AntIcon type="plus" />}
|
||||||
onClick={() => this.onOpen()}
|
onClick={() => this.onOpen()}
|
||||||
>新增{name}</Button>
|
>
|
||||||
|
新增{name}
|
||||||
|
</Button>
|
||||||
</Auth>
|
</Auth>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { Button, Descriptions, message as Message, Spin, Tabs } from 'antd'
|
import { Button, Descriptions, message as Message, Spin, Tabs } from 'antd'
|
||||||
import { defaultsDeep, isEqual } from 'lodash'
|
import { isEqual, truncate } from 'lodash'
|
||||||
import { AntIcon, ComponentDynamic, Container } from 'components'
|
import { AntIcon, ComponentDynamic, Container } from 'components'
|
||||||
import { api } from 'common/api'
|
import { api } from 'common/api'
|
||||||
|
|
||||||
@@ -54,6 +54,8 @@ export default class index extends Component {
|
|||||||
|
|
||||||
loading: true,
|
loading: true,
|
||||||
record: null,
|
record: null,
|
||||||
|
|
||||||
|
saving: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
children = []
|
children = []
|
||||||
@@ -65,8 +67,8 @@ export default class index extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
// 获取详细数据
|
||||||
const { taskId } = this.props.param
|
const { taskId } = this.props.param
|
||||||
|
|
||||||
if (taskId) {
|
if (taskId) {
|
||||||
api.houseInfoGetByTaskId({ taskId }).then(({ data }) => {
|
api.houseInfoGetByTaskId({ taskId }).then(({ data }) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -90,13 +92,18 @@ export default class index extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(this.formData)
|
//#region 提交数据
|
||||||
|
this.setState({ saving: true })
|
||||||
|
|
||||||
Message.success('提交成功')
|
setTimeout(() => {
|
||||||
|
Message.success('提交成功')
|
||||||
|
this.setState({ saving: false })
|
||||||
|
}, 3000)
|
||||||
|
//#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { loading, record } = this.state
|
const { loading, record, saving } = this.state
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="yo-form-page">
|
<div className="yo-form-page">
|
||||||
@@ -105,12 +112,16 @@ export default class index extends Component {
|
|||||||
<div className="yo-form-page--bar yo-form-page--bar--with-tab">
|
<div className="yo-form-page--bar yo-form-page--bar--with-tab">
|
||||||
<Container mode="fluid">
|
<Container mode="fluid">
|
||||||
<div className="yo-form-page--bar-inner">
|
<div className="yo-form-page--bar-inner">
|
||||||
<span>{/* 可以在工具栏中增加其他控件(只能在一行内) */}</span>
|
<span></span>
|
||||||
<span>
|
<span>
|
||||||
<Button onClick={() => window.closeContentWindow()}>
|
<Button onClick={() => window.closeContentWindow()}>
|
||||||
取消
|
取消
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={() => this.onSubmit()} type="primary">
|
<Button
|
||||||
|
loading={saving}
|
||||||
|
type="primary"
|
||||||
|
onClick={() => this.onSubmit()}
|
||||||
|
>
|
||||||
保存
|
保存
|
||||||
</Button>
|
</Button>
|
||||||
</span>
|
</span>
|
||||||
@@ -175,16 +186,15 @@ export default class index extends Component {
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={i}
|
key={i}
|
||||||
className={
|
className={[
|
||||||
(this.state.actived === i.toString()
|
this.state.actived === i.toString()
|
||||||
? 'yo-tab-external-tabpane-active'
|
? 'yo-tab-external-tabpane-active'
|
||||||
: 'yo-tab-external-tabpane-inactive') +
|
: 'yo-tab-external-tabpane-inactive',
|
||||||
' yo-tab-external-tabpane'
|
'yo-tab-external-tabpane',
|
||||||
}
|
].join(' ')}
|
||||||
>
|
>
|
||||||
<ComponentDynamic
|
<ComponentDynamic
|
||||||
is={tab.component}
|
is={tab.component}
|
||||||
{...this.props}
|
|
||||||
record={record}
|
record={record}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
onRef={c => this.children.push(c)}
|
onRef={c => this.children.push(c)}
|
||||||
|
|||||||
@@ -8,47 +8,46 @@ import { token } from 'common/token'
|
|||||||
import './index.less'
|
import './index.less'
|
||||||
|
|
||||||
export default class index extends Component {
|
export default class index extends Component {
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
||||||
focusUser: false,
|
focusUser: false,
|
||||||
focusPassword: false
|
focusPassword: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
backgroundImage = require(`assets/image/login-bg-0${Math.floor(Math.random() * 4)}.jpg`)
|
backgroundImage = require(`assets/image/login-bg-0${Math.floor(Math.random() * 4)}.jpg`)
|
||||||
|
|
||||||
focus = {
|
focus = {
|
||||||
user: false,
|
user: false,
|
||||||
password: false
|
password: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
form = React.createRef()
|
form = React.createRef()
|
||||||
|
|
||||||
onLogin = (values) => {
|
onLogin = values => {
|
||||||
this.setState({
|
this.setState({ loading: true })
|
||||||
loading: true
|
|
||||||
})
|
|
||||||
|
|
||||||
let { account, password } = values
|
let { account, password } = values
|
||||||
password = encryptByRSA(password, RSA_PUBLIC_KEY)
|
password = encryptByRSA(password, RSA_PUBLIC_KEY)
|
||||||
api.login({ account, password }).then(({ success, data, message }) => {
|
api.login({ account, password })
|
||||||
if (success) {
|
.then(({ success, data, message }) => {
|
||||||
token.value = data
|
if (success) {
|
||||||
Message.success('登录成功')
|
token.value = data
|
||||||
this.props.history.replace('/')
|
Message.success('登录成功')
|
||||||
} else {
|
this.props.history.replace('/')
|
||||||
Message.error(message)
|
} else {
|
||||||
}
|
Message.error(message)
|
||||||
}).catch(({ message }) => {
|
}
|
||||||
if (typeof message === 'object' && message[0]) {
|
})
|
||||||
Message.error(message[0].messages[0])
|
.catch(({ message }) => {
|
||||||
}
|
if (typeof message === 'object' && message[0]) {
|
||||||
})
|
Message.error(message[0].messages[0])
|
||||||
|
}
|
||||||
|
this.setState({ loading: false })
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="yo-login">
|
<div className="yo-login">
|
||||||
<img src={this.backgroundImage.default} alt="" />
|
<img src={this.backgroundImage.default} alt="" />
|
||||||
@@ -62,8 +61,14 @@ export default class index extends Component {
|
|||||||
label="用户名"
|
label="用户名"
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
onBlur={() => { this.setState({ focusUser: !!this.form.current.getFieldValue('account') }); }}
|
onBlur={() => {
|
||||||
onFocus={() => { this.setState({ focusUser: true }) }}
|
this.setState({
|
||||||
|
focusUser: !!this.form.current.getFieldValue('account'),
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
onFocus={() => {
|
||||||
|
this.setState({ focusUser: true })
|
||||||
|
}}
|
||||||
size="large"
|
size="large"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
/>
|
/>
|
||||||
@@ -75,8 +80,15 @@ export default class index extends Component {
|
|||||||
label="密码"
|
label="密码"
|
||||||
>
|
>
|
||||||
<Input.Password
|
<Input.Password
|
||||||
onBlur={() => { this.setState({ focusPassword: !!this.form.current.getFieldValue('password') }) }}
|
onBlur={() => {
|
||||||
onFocus={() => { this.setState({ focusPassword: true }) }}
|
this.setState({
|
||||||
|
focusPassword:
|
||||||
|
!!this.form.current.getFieldValue('password'),
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
onFocus={() => {
|
||||||
|
this.setState({ focusPassword: true })
|
||||||
|
}}
|
||||||
size="large"
|
size="large"
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
/>
|
/>
|
||||||
@@ -89,7 +101,9 @@ export default class index extends Component {
|
|||||||
htmlType="submit"
|
htmlType="submit"
|
||||||
size="large"
|
size="large"
|
||||||
type="primary"
|
type="primary"
|
||||||
>登录</Button>
|
>
|
||||||
|
登录
|
||||||
|
</Button>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
Reference in New Issue
Block a user