diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs index 3efac64..60048d3 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs @@ -88,6 +88,7 @@ namespace Ewide.Application.Service.HouseProjectInfo var areaCodeRep = Db.GetRepository(); 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) diff --git a/Api/Ewide.Core/Service/Area/AreaCodeService.cs b/Api/Ewide.Core/Service/Area/AreaCodeService.cs index 66bf906..337431e 100644 --- a/Api/Ewide.Core/Service/Area/AreaCodeService.cs +++ b/Api/Ewide.Core/Service/Area/AreaCodeService.cs @@ -93,11 +93,17 @@ namespace Ewide.Core.Service.Area #endif } var query = cachedAreaCodes.Where(p => p.LevelType <= level); + var resAreaCode = new List(); 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().DoTreeBuild(cachedAreaCodes.Select(u => new AreaTreeNode { Code = u.Code, diff --git a/web-react/src/components/query-table/index.jsx b/web-react/src/components/query-table/index.jsx index 62dc0bd..01a3b19 100644 --- a/web-react/src/components/query-table/index.jsx +++ b/web-react/src/components/query-table/index.jsx @@ -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, diff --git a/web-react/src/pages/business/house/project/form.jsx b/web-react/src/pages/business/house/project/form.jsx index 750743b..31a7ea1 100644 --- a/web-react/src/pages/business/house/project/form.jsx +++ b/web-react/src/pages/business/house/project/form.jsx @@ -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: '请选择所属区域' }]} > { + if (values.hasOwnProperty('type')) { + this.setState({ type: values.type }) + } + }} query={ + + + 全部 + + 住宅 + + + 非住宅 + + +