Merge branch 'master' of http://118.178.224.202:3000/ewide/ewide_core
This commit is contained in:
@@ -29,6 +29,7 @@ namespace Ewide.Application
|
||||
public class GetHouseCodeOutput
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string HouseCode { get; set; }
|
||||
public int Type { get; set; }
|
||||
public int Industry { get; set; }
|
||||
public string AreaCode { get; set; }
|
||||
|
||||
@@ -88,6 +88,7 @@ namespace Ewide.Application.Service.HouseProjectInfo
|
||||
var areaCodeRep = Db.GetRepository<SysAreaCode>();
|
||||
var projects = await _houseProjectInfoRep.DetachedEntities
|
||||
.Join(areaCodeRep.DetachedEntities, p => p.AreaCode, a => a.Code, (p, a) => new { p, AreaName = a.Name })
|
||||
.Where(input.Type>0, x => x.p.Type == input.Type)
|
||||
.Where(!string.IsNullOrEmpty(input.Name), x => x.p.Name.Contains(input.Name))
|
||||
.Where(!string.IsNullOrEmpty(input.Note), x => x.p.Note.Contains(input.Note))
|
||||
.Where(!string.IsNullOrEmpty(input.AreaCode), x => x.p.AreaCode == input.AreaCode)
|
||||
|
||||
@@ -93,11 +93,17 @@ namespace Ewide.Core.Service.Area
|
||||
#endif
|
||||
}
|
||||
var query = cachedAreaCodes.Where(p => p.LevelType <= level);
|
||||
var resAreaCode = new List<SysAreaCode>();
|
||||
if (areaCodeList != null)
|
||||
{
|
||||
query = query.Where(p => areaCodeList.Contains(p.Code));
|
||||
foreach (var code in areaCodeList)
|
||||
{
|
||||
var queryRes = query.Where(p => p.Code.StartsWith(code));
|
||||
resAreaCode.AddRange(queryRes);
|
||||
}
|
||||
cachedAreaCodes = resAreaCode.Distinct().ToList();
|
||||
}
|
||||
cachedAreaCodes = query.ToList();
|
||||
|
||||
return new TreeBuildUtil<AreaTreeNode>().DoTreeBuild(cachedAreaCodes.Select(u => new AreaTreeNode
|
||||
{
|
||||
Code = u.Code,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Form, Button, Table, Tooltip } from 'antd'
|
||||
import { AntIcon } from 'components'
|
||||
import { isEqual } from 'lodash'
|
||||
|
||||
const propsMap = ['columns', 'autoLoad', 'loadData', 'pageIndex', 'pageSize']
|
||||
|
||||
@@ -157,6 +158,10 @@ export default class QueryTable extends Component {
|
||||
onLoadData = async () => {
|
||||
this.onLoading()
|
||||
|
||||
if (isEqual(this.query, {})) {
|
||||
this.query = this.props.queryInitialValues
|
||||
}
|
||||
|
||||
const res = await this.loadData(
|
||||
{
|
||||
pageIndex: this.pagination.current,
|
||||
|
||||
@@ -36,6 +36,8 @@ export default class index extends Component {
|
||||
loading: false,
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.setState({ loading: false })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import { cloneDeep, isEqual } from 'lodash'
|
||||
import getDictData from 'util/dic'
|
||||
import { api } from 'common/api'
|
||||
import { CITY } from 'util/global'
|
||||
import auth from 'components/authorized/handler'
|
||||
|
||||
const initialValues = {
|
||||
type: 1,
|
||||
@@ -85,6 +86,8 @@ export default class form extends Component {
|
||||
//#region 从后端转换成前段所需格式
|
||||
await this.initMap()
|
||||
const options = { ...this.state.options }
|
||||
const { data: areaTree } = await api.getAreaTree()
|
||||
options.areaTree = areaTree
|
||||
// 有数据
|
||||
if (this.record) {
|
||||
const { type, areaCode } = this.record
|
||||
@@ -95,6 +98,16 @@ export default class form extends Component {
|
||||
areaCode.substr(0, 9),
|
||||
areaCode,
|
||||
]
|
||||
switch (areaTree[0].adCode.length) {
|
||||
case 6:
|
||||
this.record.areaCode = this.record.areaCode.slice(1)
|
||||
break
|
||||
case 9:
|
||||
this.record.areaCode = this.record.areaCode.slice(2)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
// 获取项目和片区列表
|
||||
const data = await this.getProjectsAndZones({
|
||||
areaCode: this.record.areaCode,
|
||||
@@ -107,12 +120,12 @@ export default class form extends Component {
|
||||
this.map.setCenter(position)
|
||||
}
|
||||
const codes = await getDictData('house_type', 'house_industry')
|
||||
const { data: areaTree } = await api.getAreaTree()
|
||||
options.areaTree = areaTree
|
||||
|
||||
this.setState({
|
||||
codes,
|
||||
options,
|
||||
})
|
||||
|
||||
this.showHouseCode()
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
@@ -136,7 +149,7 @@ export default class form extends Component {
|
||||
const postData = form.getFieldsValue()
|
||||
//#region 从前段转换后端所需格式
|
||||
if (postData.areaCode) {
|
||||
postData.areaCode = postData.areaCode[3]
|
||||
postData.areaCode = postData.areaCode[postData.areaCode.length - 1]
|
||||
}
|
||||
//#endregion
|
||||
return postData
|
||||
@@ -282,21 +295,22 @@ export default class form extends Component {
|
||||
type = value.type
|
||||
}
|
||||
|
||||
if (!(areaCode && areaCode.length === 4)) return null
|
||||
if (!(areaCode && areaCode.length > 0 && areaCode[areaCode.length - 1].length === 12))
|
||||
return null
|
||||
|
||||
try {
|
||||
const result = {}
|
||||
|
||||
if (mode.includes('projects')) {
|
||||
const { data: projects } = await api.houseProjectList({
|
||||
areaCode: areaCode[3],
|
||||
areaCode: areaCode[areaCode.length - 1],
|
||||
type,
|
||||
})
|
||||
result.projects = projects
|
||||
}
|
||||
if (mode.includes('zones')) {
|
||||
const { data: zones } = await api.houseZoneList({
|
||||
areaCode: areaCode[3],
|
||||
areaCode: areaCode[areaCode.length - 1],
|
||||
})
|
||||
result.zones = zones
|
||||
}
|
||||
@@ -323,8 +337,14 @@ export default class form extends Component {
|
||||
})
|
||||
} else if (values) {
|
||||
const { type, industry, areaCode, projectId, no } = values
|
||||
if (areaCode && areaCode.length === 4 && projectId && no) {
|
||||
let houseCode = areaCode[3]
|
||||
if (
|
||||
areaCode &&
|
||||
areaCode.length > 0 &&
|
||||
areaCode[areaCode.length - 1].length === 12 &&
|
||||
projectId &&
|
||||
no
|
||||
) {
|
||||
let houseCode = areaCode[areaCode.length - 1]
|
||||
const projectSort = this.state.options.projects.find(p => p.id === projectId).sort
|
||||
houseCode += projectSort.toString().padStart(3, '0')
|
||||
houseCode += no.toString().padStart(3, '0')
|
||||
@@ -368,17 +388,20 @@ export default class form extends Component {
|
||||
|
||||
// 所属区域
|
||||
else if (changedValues.hasOwnProperty('areaCode')) {
|
||||
this.setState({ loading: true })
|
||||
const data = await this.getProjectsAndZones()
|
||||
form.setFieldsValue({ projectId: undefined, zoneId: undefined })
|
||||
this.setState({
|
||||
options: {
|
||||
...this.state.options,
|
||||
...data,
|
||||
},
|
||||
loading: false,
|
||||
})
|
||||
this.showHouseCode(form.getFieldsValue())
|
||||
const flag = auth({ houseCode: 'getNextNoByCode' })
|
||||
if (flag) {
|
||||
this.setState({ loading: true })
|
||||
const data = await this.getProjectsAndZones()
|
||||
form.setFieldsValue({ projectId: undefined, zoneId: undefined })
|
||||
this.setState({
|
||||
options: {
|
||||
...this.state.options,
|
||||
...data,
|
||||
},
|
||||
loading: false,
|
||||
})
|
||||
this.showHouseCode(form.getFieldsValue())
|
||||
}
|
||||
}
|
||||
|
||||
// 所属项目
|
||||
@@ -474,7 +497,10 @@ export default class form extends Component {
|
||||
<Form.Item
|
||||
name="areaCode"
|
||||
rules={[
|
||||
{ required: true, message: '请选择房屋所在区域' },
|
||||
{
|
||||
required: true,
|
||||
message: '请选择房屋所在区域',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Cascader
|
||||
|
||||
@@ -211,7 +211,7 @@ export default class index extends Component {
|
||||
.padStart(3, '0')}`,
|
||||
path,
|
||||
param: {
|
||||
id: record.id,
|
||||
id: record && record.id,
|
||||
},
|
||||
})
|
||||
// modal.current.open({
|
||||
|
||||
@@ -1,11 +1,257 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Form, Input, DatePicker, Select, Radio, Spin, TreeSelect } from 'antd'
|
||||
import { AntIcon } from 'components'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { api } from 'common/api'
|
||||
import moment from 'moment'
|
||||
|
||||
const initialValues = {
|
||||
sex: 0,
|
||||
sysEmpParam: {},
|
||||
}
|
||||
|
||||
export default class form extends Component {
|
||||
state = {
|
||||
// 加载状态
|
||||
loading: true,
|
||||
lockRole: false,
|
||||
options: {
|
||||
orgData: [],
|
||||
roleData: [],
|
||||
},
|
||||
}
|
||||
|
||||
// 表单实例
|
||||
form = React.createRef()
|
||||
|
||||
// 初始化数据
|
||||
record = {}
|
||||
|
||||
/**
|
||||
* mount后回调
|
||||
*/
|
||||
componentDidMount() {
|
||||
this.props.created && this.props.created(this)
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充数据
|
||||
* 可以在设置this.record之后对其作出数据结构调整
|
||||
* [异步,必要]
|
||||
* @param {*} params
|
||||
*/
|
||||
async fillData(params) {
|
||||
this.record = cloneDeep(params.record || {})
|
||||
//#region 从后端转换成前段所需格式
|
||||
const orgData = await this.loadOrgData()
|
||||
const roleData = await this.LoadRoleData()
|
||||
|
||||
// 日期特殊处理
|
||||
if (this.record.birthday) {
|
||||
this.record.birthday = moment(this.record.birthday)
|
||||
}
|
||||
|
||||
// 提交的时候是"param",而获取下来却是"info",在这里转换一下
|
||||
if (this.record.sysEmpInfo) {
|
||||
this.record.sysEmpParam = this.record.sysEmpInfo
|
||||
delete this.record.sysEmpInfo
|
||||
} else if (!this.record.sysEmpParam) {
|
||||
this.record.sysEmpParam = {
|
||||
extIds: [],
|
||||
}
|
||||
}
|
||||
|
||||
if (params.orgId) {
|
||||
this.record.sysEmpParam.orgId = params.orgId
|
||||
}
|
||||
const defaultRole = params.record
|
||||
? await this.loadOwnRole(params.record.id)
|
||||
: params.orgId
|
||||
? await this.loadDefaultRole(params.orgId)
|
||||
: []
|
||||
|
||||
if (defaultRole.constructor === Array) {
|
||||
this.record.roleId = defaultRole.length > 0 ? defaultRole[0] : ''
|
||||
this.setState({
|
||||
lockRole: true,
|
||||
})
|
||||
} else {
|
||||
this.record.roleId = defaultRole.id
|
||||
this.setState({
|
||||
lockRole: defaultRole.code === 'zone_manager',
|
||||
})
|
||||
}
|
||||
|
||||
this.setState({
|
||||
options: {
|
||||
...this.state.options,
|
||||
orgData,
|
||||
roleData,
|
||||
},
|
||||
})
|
||||
|
||||
this.record = {
|
||||
...this.record,
|
||||
}
|
||||
//#endregion
|
||||
this.form.current.setFieldsValue(this.record)
|
||||
|
||||
this.setState({
|
||||
loading: false,
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
* 可以对postData进行数据结构调整
|
||||
* [异步,必要]
|
||||
* @returns
|
||||
*/
|
||||
async getData() {
|
||||
const form = this.form.current
|
||||
|
||||
const valid = await form.validateFields()
|
||||
if (valid) {
|
||||
const postData = form.getFieldsValue()
|
||||
if (this.record) {
|
||||
postData.id = this.record.id
|
||||
}
|
||||
//#region 从前段转换后端所需格式
|
||||
//console.log(postData)
|
||||
//#endregion
|
||||
return postData
|
||||
}
|
||||
}
|
||||
|
||||
//#region 自定义方法
|
||||
async loadOrgData() {
|
||||
const { data } = await api.getOrgTree()
|
||||
return data
|
||||
}
|
||||
|
||||
async LoadRoleData() {
|
||||
const { data } = await api.houseMemberDefaultRoleList()
|
||||
return data
|
||||
}
|
||||
async loadOwnRole(id) {
|
||||
const { data } = await api.houseMemberOwnRole({ id })
|
||||
return data
|
||||
}
|
||||
async loadDefaultRole(orgId) {
|
||||
const { data } = await api.houseMemberDefaultRole({ orgId })
|
||||
return data
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
1
|
||||
</div>
|
||||
<Form initialValues={initialValues} ref={this.form} className="yo-form">
|
||||
<Spin spinning={this.state.loading} indicator={<AntIcon type="loading" />}>
|
||||
<div className="yo-form-group">
|
||||
<Form.Item
|
||||
label="所属组织机构"
|
||||
name={['sysEmpParam', 'orgId']}
|
||||
rules={[{ required: true, message: '所属组织机构' }]}
|
||||
>
|
||||
<TreeSelect
|
||||
treeData={this.state.options.orgData}
|
||||
dropdownStyle={{ maxHeight: '300px', overflow: 'auto' }}
|
||||
treeDefaultExpandAll
|
||||
placeholder="请选择所属组织机构"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="角色"
|
||||
name="roleId"
|
||||
rules={[{ required: true, message: '请选择角色' }]}
|
||||
tooltip="片区内第一个用户必定为片区监管员,创建后不可更改角色"
|
||||
>
|
||||
<Select placeholder="请选择角色" disabled={this.state.lockRole}>
|
||||
{this.state.options.roleData.map(item => {
|
||||
return (
|
||||
<Select.Option key={item.id} value={item.id}>
|
||||
{item.name}
|
||||
</Select.Option>
|
||||
)
|
||||
})}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="账号"
|
||||
name="account"
|
||||
rules={[{ required: true, message: '请输入账号', trigger: 'blur' }]}
|
||||
>
|
||||
<Input autoComplete="off" placeholder="请输入账号" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="姓名"
|
||||
name="name"
|
||||
rules={[{ required: true, message: '请输入姓名', trigger: 'blur' }]}
|
||||
>
|
||||
<Input autoComplete="off" placeholder="请输入姓名" />
|
||||
</Form.Item>
|
||||
{this.props.mode == 'add' && (
|
||||
<>
|
||||
<Form.Item
|
||||
label="密码"
|
||||
name="password"
|
||||
rules={[
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||
]}
|
||||
>
|
||||
<Input.Password autoComplete="off" placeholder="请输入密码" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
label="确认密码"
|
||||
name="confirm"
|
||||
rules={[
|
||||
{ required: true, message: '请确认密码', trigger: 'blur' },
|
||||
]}
|
||||
>
|
||||
<Input.Password autoComplete="off" placeholder="请确认密码" />
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
<Form.Item label="昵称" name="nickName">
|
||||
<Input autoComplete="off" placeholder="请输入昵称" />
|
||||
</Form.Item>
|
||||
<Form.Item label="生日" name="birthday">
|
||||
<DatePicker className="w-100-p" />
|
||||
</Form.Item>
|
||||
<Form.Item label="性别" name="sex">
|
||||
<Radio.Group>
|
||||
<Radio.Button value={0}>
|
||||
<AntIcon className="mr-xxs" type="stop" />
|
||||
<span>保密</span>
|
||||
</Radio.Button>
|
||||
<Radio.Button value={1}>
|
||||
<AntIcon
|
||||
style={{ color: '#1890ff' }}
|
||||
className="mr-xxs"
|
||||
type="man"
|
||||
/>
|
||||
<span>男</span>
|
||||
</Radio.Button>
|
||||
<Radio.Button value={2}>
|
||||
<AntIcon
|
||||
style={{ color: '#eb2f96' }}
|
||||
className="mr-xxs"
|
||||
type="woman"
|
||||
/>
|
||||
<span>女</span>
|
||||
</Radio.Button>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
<Form.Item label="邮箱" name="email">
|
||||
<Input autoComplete="off" placeholder="请输入邮箱" />
|
||||
</Form.Item>
|
||||
<Form.Item label="手机号" name="phone">
|
||||
<Input autoComplete="off" placeholder="请输入手机号" />
|
||||
</Form.Item>
|
||||
<Form.Item label="电话" name="tel">
|
||||
<Input autoComplete="off" placeholder="请输入电话" />
|
||||
</Form.Item>
|
||||
</div>
|
||||
</Spin>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ const apiAction = {
|
||||
}
|
||||
|
||||
// 用于弹窗标题
|
||||
const name = '用户'
|
||||
const name = '人员'
|
||||
|
||||
export default class index extends Component {
|
||||
state = {
|
||||
|
||||
@@ -87,7 +87,8 @@ export default class form extends Component {
|
||||
this.record = {
|
||||
pid: params.pid,
|
||||
...this.record,
|
||||
areaCode: areaCode.length == 4 ? areaCode : [],
|
||||
areaCode:
|
||||
areaCode.length > 0 && areaCode[areaCode.length - 1].length == 12 ? areaCode : [],
|
||||
}
|
||||
//#endregion
|
||||
|
||||
@@ -213,6 +214,7 @@ export default class form extends Component {
|
||||
rules={[{ required: true, message: '请选择所属区域' }]}
|
||||
>
|
||||
<Cascader
|
||||
disabled={this.state.exist}
|
||||
options={this.state.options.areaData}
|
||||
fieldNames={{
|
||||
label: 'name',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { Component } from 'react'
|
||||
import { Button, Card, Form, Input, message as Message, Popconfirm } from 'antd'
|
||||
import { Button, Radio, Card, Form, Input, message as Message, Popconfirm } from 'antd'
|
||||
import {
|
||||
AntIcon,
|
||||
Auth,
|
||||
@@ -31,6 +31,7 @@ export default class index extends Component {
|
||||
codes: {
|
||||
houseType: [],
|
||||
},
|
||||
type: 1,
|
||||
}
|
||||
|
||||
// 表格实例
|
||||
@@ -246,8 +247,27 @@ export default class index extends Component {
|
||||
autoLoad={false}
|
||||
loadData={this.loadData}
|
||||
columns={this.columns}
|
||||
queryInitialValues={{
|
||||
type: 1,
|
||||
}}
|
||||
onQueryChange={values => {
|
||||
if (values.hasOwnProperty('type')) {
|
||||
this.setState({ type: values.type })
|
||||
}
|
||||
}}
|
||||
query={
|
||||
<Auth auth="houseProjectInfo:page">
|
||||
<Form.Item label="项目类型" name="type">
|
||||
<Radio.Group buttonStyle="solid">
|
||||
<Radio.Button value={0}>全部</Radio.Button>
|
||||
<Radio.Button value={1}>
|
||||
<span>住宅</span>
|
||||
</Radio.Button>
|
||||
<Radio.Button value={2}>
|
||||
<span>非住宅</span>
|
||||
</Radio.Button>
|
||||
</Radio.Group>
|
||||
</Form.Item>
|
||||
<Form.Item label="项目名称" name="name">
|
||||
<Input autoComplete="off" placeholder="请输入项目名称" />
|
||||
</Form.Item>
|
||||
|
||||
Reference in New Issue
Block a user