update 完成选房
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Application.Entity
|
||||
namespace Ewide.Application
|
||||
{
|
||||
[Table("bs_house_code")]
|
||||
[Comment("房屋编码表")]
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application.Entity
|
||||
namespace Ewide.Application
|
||||
{
|
||||
[Table("bs_house_member_relation")]
|
||||
[Comment("房屋与人员关联表")]
|
||||
@@ -21,6 +21,6 @@ namespace Ewide.Application.Entity
|
||||
[Comment("bs_house_code主键Id")]
|
||||
[MaxLength(36)]
|
||||
[Required]
|
||||
public string CodeId { get; set; }
|
||||
public string HouseCodeId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,10 +524,45 @@
|
||||
选房相关
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ewide.Application.Service.HouseSelectorService.HouseSelectorList(Ewide.Application.QueryHouseSelectorInput)">
|
||||
<summary>
|
||||
获取人员允许绑定的房屋编码列表
|
||||
</summary>
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Application.Service.HouseSelectorService.HouseSelectedList(Ewide.Application.QueryHouseSelectorInput)">
|
||||
<summary>
|
||||
获取人员已经绑定的房屋编码列表
|
||||
</summary>
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Application.Service.HouseSelectorService.Select(Ewide.Application.HouseSelectInput)">
|
||||
<summary>
|
||||
从人员选择房屋
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Ewide.Application.Service.HouseZoneService">
|
||||
<summary>
|
||||
片区相关
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Ewide.Application.Service.HouseZoneService.GetHouseZoneList(Ewide.Application.HouseZoneInput)">
|
||||
<summary>
|
||||
获取片区列表
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Ewide.Application.Service.HouseZoneService.GetZoneByUser(System.String)">
|
||||
<summary>
|
||||
根据用户Id获取所在片区的Id
|
||||
</summary>
|
||||
<param name="userId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application.Service.HouseCode.Dto
|
||||
namespace Ewide.Application
|
||||
{
|
||||
public class HouseCodeInput
|
||||
{
|
||||
|
||||
@@ -7,10 +7,18 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
public class HouseSelectorInput
|
||||
public class HouseSelectInput
|
||||
{
|
||||
[Required(ErrorMessage = "区域编码不可为空")]
|
||||
[MinLength(9, ErrorMessage = "区域编码长度必须为9位及以上")]
|
||||
public string AreaCode { get; set; }
|
||||
[Required(ErrorMessage = "用户Id不能为空")]
|
||||
public string UserId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "房屋编码Id不能为空")]
|
||||
public string[] Ids { get; set; }
|
||||
}
|
||||
|
||||
public class QueryHouseSelectorInput : QueryHouseCodeInput
|
||||
{
|
||||
[Required(ErrorMessage = "用户Id不能为空")]
|
||||
public string UserId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Ewide.Core;
|
||||
using Dapper;
|
||||
using Ewide.Core.Extension;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.DatabaseAccessor.Extensions;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DynamicApiController;
|
||||
using Furion.FriendlyException;
|
||||
@@ -17,5 +19,153 @@ namespace Ewide.Application.Service
|
||||
[ApiDescriptionSettings(Name = "HouseSelector", Order = 180)]
|
||||
public class HouseSelectorService : IHouseSelectorService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IDapperRepository _dapperRep;
|
||||
|
||||
private readonly IRepository<BsHouseMemberRelation> _bsHouseMemberRelationRep;
|
||||
private readonly IRepository<BsHouseCode> _bsHouseCodeRep;
|
||||
private readonly IHouseZoneService _houseZoneService;
|
||||
|
||||
public HouseSelectorService(
|
||||
IDapperRepository dapperRep,
|
||||
IRepository<BsHouseMemberRelation> bsHouseMemberRelationRep,
|
||||
IRepository<BsHouseCode> bsHouseCodeRep,
|
||||
IHouseZoneService houseZoneService
|
||||
)
|
||||
{
|
||||
_dapperRep = dapperRep;
|
||||
_bsHouseMemberRelationRep = bsHouseMemberRelationRep;
|
||||
_bsHouseCodeRep = bsHouseCodeRep;
|
||||
_houseZoneService = houseZoneService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取人员允许绑定的房屋编码列表
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseSelector/selectorPage")]
|
||||
public async Task<dynamic> HouseSelectorList([FromBody] QueryHouseSelectorInput input)
|
||||
{
|
||||
var sql = @"SELECT
|
||||
HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`,'(',Proj.Note,')') FullProjName
|
||||
FROM bs_house_code HC
|
||||
LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId
|
||||
LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode
|
||||
LEFT JOIN sys_area_code RA ON RA.AdCode = SUBSTR(CA.AdCode,1,9)
|
||||
LEFT JOIN sys_area_code AA ON AA.AdCode = SUBSTR(CA.AdCode,1,6)
|
||||
LEFT JOIN bs_house_member_relation HM ON HC.Id = HM.HouseCodeId
|
||||
INNER JOIN (SELECT * FROM sys_emp WHERE Id = @UserId) E ON HC.ZoneId = E.OrgId
|
||||
WHERE 1=1
|
||||
AND HM.Id IS NULL
|
||||
AND HC.Address LIKE @Address
|
||||
AND HC.HouseCode LIKE @HouseCode";
|
||||
return await _dapperRep.QueryPageData(sql, input, param: new
|
||||
{
|
||||
input.UserId,
|
||||
Address = "%" + input.Address + "%",
|
||||
HouseCode = "%" + input.HouseCode + "%"
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取人员已经绑定的房屋编码列表
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseSelector/selectedPage")]
|
||||
public async Task<dynamic> HouseSelectedList([FromBody] QueryHouseSelectorInput input)
|
||||
{
|
||||
var sql = @"SELECT
|
||||
HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`,'(',Proj.Note,')') FullProjName
|
||||
FROM bs_house_code HC
|
||||
LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId
|
||||
LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode
|
||||
LEFT JOIN sys_area_code RA ON RA.AdCode = SUBSTR(CA.AdCode,1,9)
|
||||
LEFT JOIN sys_area_code AA ON AA.AdCode = SUBSTR(CA.AdCode,1,6)
|
||||
INNER JOIN (SELECT * FROM bs_house_member_relation WHERE SysUserId = @UserId) HM ON HC.Id = HM.HouseCodeId
|
||||
WHERE 1=1
|
||||
AND HC.Address LIKE @Address
|
||||
AND HC.HouseCode LIKE @HouseCode";
|
||||
return await _dapperRep.QueryPageData(sql, input, param: new
|
||||
{
|
||||
input.UserId,
|
||||
Address = "%" + input.Address + "%",
|
||||
HouseCode = "%" + input.HouseCode + "%"
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从人员选择房屋
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/houseSelector/select")]
|
||||
[UnitOfWork]
|
||||
public async Task Select([FromBody] HouseSelectInput input)
|
||||
{
|
||||
#region 验证房屋是否在当前用户可选范围内
|
||||
|
||||
var ids = input.Ids.Distinct().ToList();
|
||||
if (ids.Count == 0) throw Oops.Oh("没有选中任何房屋");
|
||||
|
||||
// 验证当前用户是否安全员 **须补充
|
||||
|
||||
// 已经被选中的房屋,从ids中剔除
|
||||
var houseSelected = await _bsHouseMemberRelationRep.DetachedEntities
|
||||
.Where(p => ids.Contains(p.HouseCodeId))
|
||||
.Select(p => p.HouseCodeId)
|
||||
.ToListAsync();
|
||||
if (houseSelected.Count > 0)
|
||||
{
|
||||
houseSelected.ForEach(p =>
|
||||
{
|
||||
var index = ids.IndexOf(p);
|
||||
if (index > -1)
|
||||
{
|
||||
ids.RemoveAt(index);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (ids.Count == 0) throw Oops.Oh("当前房屋在此之前已经全部被选中,请确认");
|
||||
|
||||
// 从用户所在片区中过滤房屋
|
||||
var zoneId = await _houseZoneService.GetZoneByUser(input.UserId);
|
||||
var house = await _bsHouseCodeRep.DetachedEntities.Where(p => ids.Contains(p.Id) && p.ZoneId == zoneId).Select(p => p.Id).ToListAsync();
|
||||
|
||||
if (house.Count == 0) throw Oops.Oh("选中的房屋错误");
|
||||
|
||||
#endregion
|
||||
|
||||
// 选定房屋
|
||||
house.ForEach(p =>
|
||||
{
|
||||
new BsHouseMemberRelation
|
||||
{
|
||||
SysUserId = input.UserId,
|
||||
HouseCodeId = p
|
||||
}.Insert();
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("/houseSelector/revoke")]
|
||||
[UnitOfWork]
|
||||
public async Task Revoke([FromBody] HouseSelectInput input)
|
||||
{
|
||||
var ids = input.Ids.Distinct().ToList();
|
||||
if (ids.Count == 0) throw Oops.Oh("没有选中任何房屋");
|
||||
|
||||
var selected = await _bsHouseMemberRelationRep.Where(p => ids.Contains(p.HouseCodeId) && p.SysUserId == input.UserId).ToListAsync();
|
||||
|
||||
selected.ForEach(p =>
|
||||
{
|
||||
p.Delete();
|
||||
});
|
||||
}
|
||||
|
||||
public async Task SelectMember()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,5 +9,10 @@ namespace Ewide.Application.Service
|
||||
{
|
||||
public interface IHouseSelectorService
|
||||
{
|
||||
Task<dynamic> HouseSelectorList([FromQuery] QueryHouseSelectorInput input);
|
||||
Task<dynamic> HouseSelectedList([FromQuery] QueryHouseSelectorInput input);
|
||||
Task Select([FromBody] HouseSelectInput input);
|
||||
Task Revoke([FromBody] HouseSelectInput input);
|
||||
Task SelectMember();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using Furion.FriendlyException;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -17,13 +18,28 @@ namespace Ewide.Application.Service
|
||||
[ApiDescriptionSettings(Name = "HouseZone", Order = 180)]
|
||||
public class HouseZoneService : IHouseZoneService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IRepository<SysOrg> _sysOrgRep;
|
||||
private readonly IRepository<SysEmp> _sysEmpRep;
|
||||
public HouseZoneService(
|
||||
IRepository<SysOrg> sysOrgRep,
|
||||
IRepository<SysEmp> sysEmpRep
|
||||
)
|
||||
{
|
||||
_sysOrgRep = sysOrgRep;
|
||||
_sysEmpRep = sysEmpRep;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取片区列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/houseZone/list")]
|
||||
public async Task<dynamic> GetHouseZoneList([FromQuery] HouseZoneInput input)
|
||||
{
|
||||
var areaCode = input.AreaCode.Substring(0, 9);
|
||||
var _sysOrgRep = Db.GetRepository<SysOrg>();
|
||||
var road = await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.AreaCode == areaCode);
|
||||
if (road == null) throw Oops.Oh("街道编码错误");
|
||||
if (road == null) throw Oops.Oh("未在组织机构中配置街道");
|
||||
return await _sysOrgRep.DetachedEntities
|
||||
.Where(p => p.Pid == road.Id)
|
||||
.Where(p => p.Type == (int)OrgType.片区)
|
||||
@@ -35,5 +51,20 @@ namespace Ewide.Application.Service
|
||||
})
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据用户Id获取所在片区的Id
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("houseZone/getByUser")]
|
||||
public async Task<string> GetZoneByUser([FromQuery][Required(ErrorMessage = "用户Id不能为空")] string userId)
|
||||
{
|
||||
var data = await _sysEmpRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == userId);
|
||||
if(data == null) throw Oops.Oh("用户不在组织机构中");
|
||||
var org = await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == data.OrgId && p.Type == (int)OrgType.片区);
|
||||
if(org == null) throw Oops.Oh("用户不在片区中");
|
||||
return org.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,5 +10,6 @@ namespace Ewide.Application.Service
|
||||
public interface IHouseZoneService
|
||||
{
|
||||
Task<dynamic> GetHouseZoneList([FromQuery] HouseZoneInput input);
|
||||
Task<string> GetZoneByUser([FromQuery] string userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,11 +33,13 @@ namespace Ewide.Core
|
||||
/// </summary>
|
||||
[Description("自定义数据")]
|
||||
DEFINE = 5,
|
||||
|
||||
/// <summary>
|
||||
/// 本部门所在区域及以下区域
|
||||
/// </summary>
|
||||
[Description("本部门所在区域及以下区域")]
|
||||
AREA_WITH_CHILD = 6,
|
||||
|
||||
/// <summary>
|
||||
/// 本部门所在区域数据 不包括下面区域
|
||||
/// </summary>
|
||||
|
||||
@@ -9,6 +9,7 @@ namespace Ewide.Core.Service
|
||||
Task AddOrg(AddOrgInput input);
|
||||
Task DeleteOrg(DeleteOrgInput input);
|
||||
Task<List<string>> GetDataScopeListByDataScopeType(int dataScopeType, string orgId);
|
||||
List<string> GetDataScopeList(List<string> dataScopes);
|
||||
Task<SysOrg> GetOrg([FromQuery] QueryOrgInput input);
|
||||
Task<List<OrgOutput>> GetOrgList([FromQuery] OrgInput input);
|
||||
Task<dynamic> GetOrgTree([FromQuery] OrgInput input);
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Ewide.Core.Service
|
||||
/// </summary>
|
||||
/// <param name="dataScopes"></param>
|
||||
/// <returns></returns>
|
||||
private List<string> GetDataScopeList(List<string> dataScopes)
|
||||
public List<string> GetDataScopeList(List<string> dataScopes)
|
||||
{
|
||||
var dataScopeList = new List<string>();
|
||||
// 如果是超级管理员则获取所有组织机构,否则只获取其数据范围的机构数据
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.Service.Role
|
||||
namespace Ewide.Core.Service
|
||||
{
|
||||
public interface ISysRoleAreaService
|
||||
{
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
@import './lib/authority-view.less';
|
||||
@import './lib/icon-selector.less';
|
||||
@import './lib/anchor.less';
|
||||
@import './lib/disabled.less';
|
||||
@import './theme/primary.less';
|
||||
// @import './lib/font-weight.less';
|
||||
@import './public.less';
|
||||
|
||||
36
Web/src/assets/style/lib/disabled.less
Normal file
36
Web/src/assets/style/lib/disabled.less
Normal file
@@ -0,0 +1,36 @@
|
||||
@import (reference) '~@/assets/style/extend.less';
|
||||
.ant-btn-primary-disabled,
|
||||
.ant-btn-primary.disabled,
|
||||
.ant-btn-primary[disabled],
|
||||
.ant-btn-primary-disabled:hover,
|
||||
.ant-btn-primary.disabled:hover,
|
||||
.ant-btn-primary[disabled]:hover,
|
||||
.ant-btn-primary-disabled:focus,
|
||||
.ant-btn-primary.disabled:focus,
|
||||
.ant-btn-primary[disabled]:focus,
|
||||
.ant-btn-primary-disabled:active,
|
||||
.ant-btn-primary.disabled:active,
|
||||
.ant-btn-primary[disabled]:active,
|
||||
.ant-btn-primary-disabled.active,
|
||||
.ant-btn-primary.disabled.active,
|
||||
.ant-btn-primary[disabled].active {
|
||||
opacity: .5;
|
||||
color: @btn-primary-color;
|
||||
border-color: @btn-primary-bg;
|
||||
background-color: @btn-primary-bg;
|
||||
box-shadow: @btn-primary-shadow;
|
||||
text-shadow: @btn-text-shadow;
|
||||
}
|
||||
.ant-radio-button-wrapper-disabled:first-child,
|
||||
.ant-radio-button-wrapper-disabled:hover {
|
||||
opacity: .5;
|
||||
color: @radio-button-color;
|
||||
background-color: @radio-button-bg;
|
||||
}
|
||||
.ant-radio-button-wrapper-disabled.ant-radio-button-wrapper-checked {
|
||||
opacity: .5;
|
||||
color: @btn-primary-color;
|
||||
border-color: @btn-primary-bg;
|
||||
background-color: @btn-primary-bg;
|
||||
box-shadow: @btn-primary-shadow;
|
||||
}
|
||||
@@ -2,9 +2,17 @@
|
||||
.ant-radio-button-wrapper {
|
||||
margin-right: @padding-xs;
|
||||
margin-bottom: @padding-xs;
|
||||
|
||||
border-left: @border-width-base @border-style-base @normal-color;
|
||||
&:not(:first-child) {
|
||||
&::before {
|
||||
left: 0;
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ant-radio-button-wrapper-checked {
|
||||
&:not(.ant-radio-button-wrapper-disabled),
|
||||
&:not(.ant-radio-button-wrapper-disabled):hover {
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +391,6 @@
|
||||
padding: 0 @padding-md 0 @padding-lg;
|
||||
|
||||
color: @logo-color;
|
||||
background-color: @nav-background;
|
||||
box-shadow: @logo-box-shadow;
|
||||
img {
|
||||
max-height: 100%;
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
houseSelect: ['/houseSelector/select', 'post'],
|
||||
houseSelectRevoke: ['/houseSelector/revoke', 'post'],
|
||||
houseSelectorPage: ['/houseSelector/selectorPage', 'post'],
|
||||
houseSelectedPage: ['/houseSelector/selectedPage', 'post'],
|
||||
}
|
||||
13
Web/src/common/api/requests/business/houseSafety/index.js
Normal file
13
Web/src/common/api/requests/business/houseSafety/index.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import houseProjectInfo from './houseProjectInfo'
|
||||
import houseZone from './houseZone'
|
||||
import houseCode from './houseCode'
|
||||
import houseMember from './houseMember'
|
||||
import houseSelector from './houseSelector'
|
||||
|
||||
export default {
|
||||
...houseProjectInfo,
|
||||
...houseZone,
|
||||
...houseCode,
|
||||
...houseMember,
|
||||
...houseSelector
|
||||
}
|
||||
@@ -1,11 +1,5 @@
|
||||
import houseProjectInfo from './houseProjectInfo'
|
||||
import houseZone from './houseZone'
|
||||
import houseCode from './houseCode'
|
||||
import houseMember from './houseMember'
|
||||
import houseSafety from './houseSafety'
|
||||
|
||||
export default {
|
||||
...houseProjectInfo,
|
||||
...houseZone,
|
||||
...houseCode,
|
||||
...houseMember
|
||||
...houseSafety,
|
||||
}
|
||||
@@ -502,9 +502,12 @@ export default {
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
await this.getProjects(autoChange);
|
||||
await this.getZones(autoChange);
|
||||
this.loading = false;
|
||||
try {
|
||||
await this.getProjects(autoChange);
|
||||
await this.getZones(autoChange);
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
|
||||
async getProjects(autoChange = false) {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
<a-button
|
||||
@click="openContentWindow({
|
||||
title: '房屋表单',
|
||||
path: 'business/house/houseInfo/form',
|
||||
path: 'business/house/info/form',
|
||||
});"
|
||||
>(test)打开表单</a-button>
|
||||
</div>
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
<div slot="avatar">
|
||||
<yo-image :id="record.avatar" :size="48" icon="user" shape="square" type="avatar" />
|
||||
<a-button
|
||||
@click="$refs['selector-modal'].onOpen()"
|
||||
@click="onOpenSelector(record)"
|
||||
class="block w-100-p mt-xxs"
|
||||
size="small"
|
||||
type="primary"
|
||||
@@ -344,6 +344,10 @@ export default {
|
||||
record.statusChanging = false;
|
||||
});
|
||||
},
|
||||
|
||||
onOpenSelector(record) {
|
||||
this.$refs['selector-modal'].onOpen({ userId: record.id });
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -9,10 +9,10 @@
|
||||
>
|
||||
<a-tabs :animated="false" :tab-bar-style="{ marginBottom: 0 }" default-active-key="1">
|
||||
<a-tab-pane key="1" tab="选房">
|
||||
<selector-list />
|
||||
<selector-list :user-id="userId" @reload-all="onReloadAll" ref="selector-list" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="已选">
|
||||
<selected-list />
|
||||
<selected-list :user-id="userId" @reload-all="onReloadAll" ref="selected-list" />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</a-modal>
|
||||
@@ -34,12 +34,14 @@ export default {
|
||||
|
||||
/** 其他成员属性 */
|
||||
/* ... */
|
||||
userId: '',
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
onOpen(param) {
|
||||
this.visible = true;
|
||||
this.userId = param.userId;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -55,6 +57,14 @@ export default {
|
||||
|
||||
/** 当前组件的其他方法 */
|
||||
/* ... */
|
||||
onReloadAll() {
|
||||
if (this.$refs['selector-list']) {
|
||||
this.$refs['selector-list'].onReloadData();
|
||||
}
|
||||
if (this.$refs['selected-list']) {
|
||||
this.$refs['selected-list'].onReloadData();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -1,3 +1,285 @@
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
<!--
|
||||
普通查询表格
|
||||
v 1.2
|
||||
2021-04-30
|
||||
Lufthafen
|
||||
-->
|
||||
<a-card :bordered="false" class="mb-none">
|
||||
<yo-table
|
||||
:auto-load="false"
|
||||
:columns="columns"
|
||||
:load-data="loadData"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: (keys) => selectedRowKeys = keys }"
|
||||
@query="onQuery"
|
||||
@resetQuery="onResetQuery"
|
||||
ref="table"
|
||||
>
|
||||
<Auth auth="houseSelector:selectedPage" slot="query">
|
||||
<!-- 此处添加查询表单控件 -->
|
||||
<!-- ... -->
|
||||
<a-form-model-item label="编号">
|
||||
<a-input-number
|
||||
:formatter="(number) => number && `000${number}`.slice(-3)"
|
||||
:max="999"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
placeholder="请输入房屋序号"
|
||||
v-model="query.no"
|
||||
/>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="房屋性质">
|
||||
<a-radio-group @change="onChangeQueryType" button-style="solid" v-model="query.type">
|
||||
<a-radio-button :value="0">全部</a-radio-button>
|
||||
<a-radio-button
|
||||
:key="item.code"
|
||||
:value="+item.code"
|
||||
v-for="item in codes.type"
|
||||
>{{item.value}}</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="行业" v-if="query.type == 2">
|
||||
<a-select class="w-150" placeholder="请选择行业" v-model="query.industry">
|
||||
<a-select-option
|
||||
:key="item.code"
|
||||
:value="+item.code"
|
||||
v-for="item in codes.industry"
|
||||
>{{item.value}}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="地址">
|
||||
<a-input placeholder="请输入地址" v-model="query.address" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="房屋唯一编码">
|
||||
<a-input placeholder="请输入房屋唯一编码" v-model="query.houseCode" />
|
||||
</a-form-model-item>
|
||||
</Auth>
|
||||
<Auth auth="houseSelector:revoke" slot="operator">
|
||||
<a-popconfirm
|
||||
:disabled="!selectedRowKeys.length"
|
||||
@confirm="onHouseSelectRevoke"
|
||||
placement="bottomLeft"
|
||||
title="是否确认撤销"
|
||||
>
|
||||
<a-button :disabled="!selectedRowKeys.length" :loading="saving" type="danger">撤销</a-button>
|
||||
</a-popconfirm>
|
||||
</Auth>
|
||||
<!-- 格式化字段内容 -->
|
||||
<!-- ... -->
|
||||
<template slot="houseCode" slot-scope="text, record">
|
||||
<span>{{`${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${`000${record.no}`.slice(-3)}`}}</span>
|
||||
</template>
|
||||
<template slot="type" slot-scope="text, record">
|
||||
<span>{{bindCodeValue(text, 'type') + (text === 2 ? `(${bindCodeValue(record.industry, 'industry')})` : '')}}</span>
|
||||
</template>
|
||||
</yo-table>
|
||||
</a-card>
|
||||
</template>
|
||||
<script>
|
||||
/* 在此管理整个页面需要的接口名称 */
|
||||
const api = {
|
||||
page: 'houseSelectedPage',
|
||||
/* ... */
|
||||
};
|
||||
|
||||
export default {
|
||||
props: ['userId'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
api,
|
||||
|
||||
/* 查询条件 */
|
||||
query: {
|
||||
type: 0,
|
||||
},
|
||||
|
||||
/* 表格字段 */
|
||||
columns: [
|
||||
{
|
||||
title: '房屋编码',
|
||||
dataIndex: 'houseCode',
|
||||
sorter: true,
|
||||
scopedSlots: { customRender: 'houseCode' },
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
title: '房屋性质及行业',
|
||||
dataIndex: 'type',
|
||||
sorter: true,
|
||||
scopedSlots: { customRender: 'type' },
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
title: '地址',
|
||||
dataIndex: 'address',
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '登记时间',
|
||||
dataIndex: 'createdTime',
|
||||
sorter: true,
|
||||
width: 150,
|
||||
},
|
||||
],
|
||||
|
||||
/* 字典编码储存格式 */
|
||||
codes: {
|
||||
type: [],
|
||||
industry: [],
|
||||
},
|
||||
|
||||
options: {},
|
||||
|
||||
selectedRowKeys: [],
|
||||
|
||||
saving: false,
|
||||
};
|
||||
},
|
||||
|
||||
async created() {
|
||||
/** 按需加载字典编码 */
|
||||
await this.onLoadCodes();
|
||||
this.onQuery();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 必要的方法
|
||||
* 传给yo-table以示意数据接口及其参数和返回的数据结构
|
||||
*/
|
||||
loadData(params) {
|
||||
const query = this.$_.cloneDeep(this.query);
|
||||
if (!query.userId) {
|
||||
query.userId = this.userId;
|
||||
}
|
||||
|
||||
return this.$api[api.page]({
|
||||
...params,
|
||||
...query,
|
||||
}).then((res) => {
|
||||
return res.data;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 有查询功能时的必要方法
|
||||
* 加载数据时初始化分页信息
|
||||
*/
|
||||
onQuery() {
|
||||
this.$refs.table.onReloadData(true);
|
||||
},
|
||||
|
||||
/**
|
||||
* 有查询功能时的必要方法
|
||||
* 重置查询条件
|
||||
*/
|
||||
onResetQuery() {
|
||||
/** 在这里重置查询条件时,可对特殊的字段做保留处理 */
|
||||
this.query = {
|
||||
type: 0,
|
||||
};
|
||||
this.onQuery();
|
||||
},
|
||||
|
||||
/**
|
||||
* 必要方法
|
||||
* 重新列表数据
|
||||
*/
|
||||
onReloadData() {
|
||||
this.$refs.table.onReloadData();
|
||||
},
|
||||
|
||||
/**
|
||||
* 必要方法
|
||||
* 加载字典数据
|
||||
* 如果不需要获取相应的字典数据,此方法内容可空
|
||||
*/
|
||||
onLoadCodes() {
|
||||
return this.$api
|
||||
.sysDictTypeDropDowns({ code: ['dic_house_type', 'dic_house_industry'] })
|
||||
.then(({ data: { dic_house_type, dic_house_industry } }) => {
|
||||
this.codes.type = dic_house_type;
|
||||
this.codes.industry = dic_house_industry;
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 必要方法
|
||||
* 绑定数据字典值
|
||||
*/
|
||||
bindCodeValue(code, name) {
|
||||
const c = this.codes[name].find((p) => p.code == code);
|
||||
if (c) {
|
||||
return c.value;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* 必要方法
|
||||
* 从列表页调用窗口的打开方法
|
||||
*/
|
||||
onOpen(record) {
|
||||
this.openContentWindow({
|
||||
key: record ? record.id : 'business/house/code/form',
|
||||
title: record ? '修改房屋编码' : '新增房屋编码',
|
||||
subTitle:
|
||||
record &&
|
||||
`${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${`000${record.no}`.slice(-3)}`,
|
||||
path: 'business/house/code/form',
|
||||
param: {
|
||||
record,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 必要方法
|
||||
* 可以用做一系列操作的公共回调,此方法中会重新加载当前列表
|
||||
*/
|
||||
onResult(success, successMessage) {
|
||||
if (success) {
|
||||
this.$message.success(successMessage);
|
||||
this.onReloadData();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 必要方法
|
||||
* 删除时调用
|
||||
*/
|
||||
onDelete(record) {
|
||||
this.$refs.table.onLoading();
|
||||
this.$api[api.delete](record)
|
||||
.then(({ success }) => {
|
||||
this.onResult(success, '删除成功');
|
||||
})
|
||||
.finally(() => {
|
||||
this.$refs.table.onLoaded();
|
||||
});
|
||||
},
|
||||
|
||||
onChangeQueryType() {
|
||||
if (this.query.type < 2 && this.query.hasOwnProperty('industry')) {
|
||||
this.$delete(this.query, 'industry');
|
||||
}
|
||||
},
|
||||
|
||||
onHouseSelectRevoke() {
|
||||
this.saving = true;
|
||||
this.$refs.table.onLoading();
|
||||
this.$api
|
||||
.houseSelectRevoke({ ids: this.selectedRowKeys, userId: this.userId })
|
||||
.then(({ success }) => {
|
||||
this.$message.success('选房成功');
|
||||
})
|
||||
.finally(() => {
|
||||
this.saving = false;
|
||||
this.selectedRowKeys = [];
|
||||
this.$emit('reload-all');
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -10,12 +10,12 @@
|
||||
:auto-load="false"
|
||||
:columns="columns"
|
||||
:load-data="loadData"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
|
||||
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: (keys) => selectedRowKeys = keys }"
|
||||
@query="onQuery"
|
||||
@resetQuery="onResetQuery"
|
||||
ref="table"
|
||||
>
|
||||
<Auth auth="houseCode:page" slot="query">
|
||||
<Auth auth="houseSelector:selectorPage" slot="query">
|
||||
<!-- 此处添加查询表单控件 -->
|
||||
<!-- ... -->
|
||||
<a-form-model-item label="编号">
|
||||
@@ -55,8 +55,13 @@
|
||||
<a-input placeholder="请输入房屋唯一编码" v-model="query.houseCode" />
|
||||
</a-form-model-item>
|
||||
</Auth>
|
||||
<Auth auth="houseCode:add" slot="operator">
|
||||
<a-button type="primary">确认选择</a-button>
|
||||
<Auth auth="houseSelector:select" slot="operator">
|
||||
<a-button
|
||||
:disabled="!selectedRowKeys.length"
|
||||
:loading="saving"
|
||||
@click="onHouseSelect"
|
||||
type="primary"
|
||||
>确认选择</a-button>
|
||||
</Auth>
|
||||
<!-- 格式化字段内容 -->
|
||||
<!-- ... -->
|
||||
@@ -72,17 +77,17 @@
|
||||
<script>
|
||||
/* 在此管理整个页面需要的接口名称 */
|
||||
const api = {
|
||||
page: 'houseCodePage',
|
||||
page: 'houseSelectorPage',
|
||||
/* ... */
|
||||
};
|
||||
|
||||
export default {
|
||||
props: ['userId'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
api,
|
||||
|
||||
name: '',
|
||||
|
||||
/* 查询条件 */
|
||||
query: {
|
||||
type: 0,
|
||||
@@ -126,6 +131,8 @@ export default {
|
||||
options: {},
|
||||
|
||||
selectedRowKeys: [],
|
||||
|
||||
saving: false,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -141,8 +148,8 @@ export default {
|
||||
*/
|
||||
loadData(params) {
|
||||
const query = this.$_.cloneDeep(this.query);
|
||||
if (query.areaCode) {
|
||||
query.areaCode = query.areaCode[query.areaCode.length - 1];
|
||||
if (!query.userId) {
|
||||
query.userId = this.userId;
|
||||
}
|
||||
|
||||
return this.$api[api.page]({
|
||||
@@ -257,8 +264,19 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
onSelectChange(selectedRowKeys) {
|
||||
this.selectedRowKeys = selectedRowKeys;
|
||||
onHouseSelect() {
|
||||
this.saving = true;
|
||||
this.$refs.table.onLoading();
|
||||
this.$api
|
||||
.houseSelect({ ids: this.selectedRowKeys, userId: this.userId })
|
||||
.then(({ success }) => {
|
||||
this.$message.success('选房成功');
|
||||
})
|
||||
.finally(() => {
|
||||
this.saving = false;
|
||||
this.selectedRowKeys = [];
|
||||
this.$emit('reload-all');
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user