diff --git a/Api/Ewide.Application/Entity/BsHouseProjectInfo.cs b/Api/Ewide.Application/Entity/BsHouseProjectInfo.cs index d24e173..b456dea 100644 --- a/Api/Ewide.Application/Entity/BsHouseProjectInfo.cs +++ b/Api/Ewide.Application/Entity/BsHouseProjectInfo.cs @@ -31,10 +31,6 @@ namespace Ewide.Application.Entity [Required] public string AreaId { get; set; } - [Comment("区域名称")] - [MaxLength(500)] - public string AreaName { get; set; } - [Comment("类型")] [Required] public int Type { get; set; } diff --git a/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs b/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs index 0bbb214..3867919 100644 --- a/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs +++ b/Api/Ewide.Application/Service/HouseProjectInfo/Dto/HouseProjectInfoInput.cs @@ -14,7 +14,6 @@ namespace Ewide.Application.Service.HouseProjectInfo.Dto public string Note { get; set; } public int Sort { get; set; } public string AreaId { get; set; } - public string AreaName { get; set; } public int Type { get; set; } } public class AddProjectInput : HouseProjectInfoInput diff --git a/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs b/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs index 42b951c..f2e6e0c 100644 --- a/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs +++ b/Api/Ewide.Application/Service/HouseProjectInfo/HouseProjectInfoService.cs @@ -63,7 +63,7 @@ namespace Ewide.Application.Service.HouseProjectInfo public async Task UpdateProject(UpdateProjectInput input) { var project = input.Adapt(); - await project.UpdateExcludeAsync(new[] { nameof(BsHouseProjectInfo.AreaId), nameof(BsHouseProjectInfo.AreaName)}, true); + await project.UpdateExcludeAsync(new[] { nameof(BsHouseProjectInfo.AreaId)}, true); } /// @@ -86,9 +86,11 @@ namespace Ewide.Application.Service.HouseProjectInfo public async Task QueryProjectPageList([FromBody] HouseProjectInfoInput input) { var areaID = !string.IsNullOrEmpty(input.AreaId); + var areaCodeRep = Db.GetRepository(); var projects = await _houseProjectInfoRep.DetachedEntities - .Where(areaID, p => p.AreaId == input.AreaId) - .Select(p => p.Adapt()).ToPagedListAsync(input.PageNo, input.PageSize); + .Join(areaCodeRep.DetachedEntities, p => p.AreaId, a => a.Code, (p, a) => new { p, AreaName = a.Name }) + .Where(areaID, x => x.p.AreaId == input.AreaId) + .Select(x => new { x.p.Id, x.p.Name, x.p.Note, x.p.Sort, x.p.AreaId, x.AreaName, x.p.Type }.Adapt()).ToPagedListAsync(input.PageNo, input.PageSize); return XnPageResult.PageResult(projects); } diff --git a/Web/src/pages/business/houseprojectinfo/form.vue b/Web/src/pages/business/houseprojectinfo/form.vue index 33c582c..a7110b8 100644 --- a/Web/src/pages/business/houseprojectinfo/form.vue +++ b/Web/src/pages/business/houseprojectinfo/form.vue @@ -10,6 +10,10 @@
+ + + + @@ -19,6 +23,12 @@ + + + 住宅 + 非住宅 + +
@@ -28,11 +38,7 @@ /* 表单内容默认值 */ const defaultForm = { /* ... */ - areaId: '330266001001', - areaName: '测试社区', - type: 1, }; - export default { data() { return { @@ -48,6 +54,7 @@ export default { loading: false, /** 其他成员属性 */ + areaData: [], /* ... */ }; }, @@ -58,11 +65,38 @@ export default { * 在打开编辑页时允许填充数据 */ onFillData(params) { + // 从字符串areaCode查找到整个层级 + const areaCodeDeault = params.record ? params.record.areaId : params.pid ? params.pid : ''; + const areaCode = []; + const findCode = (data, level) => { + level = level || 0; + for (let i = 0; i < data.length; i++) { + const item = data[i]; + areaCode[level] = item.code; + + if (item.code === areaCodeDeault) { + areaCode.length = level + 1; + return true; + } + + if (item.children && item.children.length) { + const found = findCode(item.children, level + 1); + if (found) { + return true; + } + } + } + }; + + if (areaCodeDeault) { + findCode(this.areaData); + } /** 将默认数据覆盖到form */ this.form = this.$_.cloneDeep({ ...defaultForm, ...params.record, /** 在此处添加其他默认数据转换 */ + areaCode: areaCode, /* ... */ }); }, @@ -116,11 +150,17 @@ export default { async onInit(params) { this.loading = true; /** 可以在这里await获取一些异步数据 */ + this.areaData = await this.onLoadAreaData(); /* ... */ this.loading = false; }, /** 当前组件的其他方法 */ + onLoadAreaData() { + return this.$api.getAreaTree().then((res) => { + return res.data; + }); + }, /* ... */ }, }; diff --git a/Web/src/pages/business/houseprojectinfo/index.vue b/Web/src/pages/business/houseprojectinfo/index.vue index 1347bb3..c8e8577 100644 --- a/Web/src/pages/business/houseprojectinfo/index.vue +++ b/Web/src/pages/business/houseprojectinfo/index.vue @@ -80,7 +80,7 @@ export default { name: '项目', /* 查询条件 */ - query: { name: '' }, + query: {}, /* 表格字段 */ columns: [ @@ -94,6 +94,11 @@ export default { dataIndex: 'areaName', sorter: true, }, + { + title: '备注', + dataIndex: 'note', + sorter: true, + }, { title: '类型', dataIndex: 'type', @@ -225,6 +230,10 @@ export default { * 从列表页调用窗口的打开方法 */ onOpen(formName, record) { + // if (formName == 'add-form' && !this.query.pid) { + // this.$message.warn('请选择项目所属街道', 0.5); + // return null; + // } this.$refs[formName].onOpen({ record, pid: this.query.pid, diff --git a/Web/src/pages/system/user/index.vue b/Web/src/pages/system/user/index.vue index 644d66f..48bafe8 100644 --- a/Web/src/pages/system/user/index.vue +++ b/Web/src/pages/system/user/index.vue @@ -16,17 +16,8 @@ - - {{ item.value }} + + {{ item.value }} @@ -75,14 +66,7 @@
{{ record.nickName || record.name }}
{{ record.account }}
- +
@@ -95,13 +79,7 @@
- +
@@ -216,15 +194,10 @@ export default { * 加载字典数据时的必要方法 */ onLoadCodes() { - this.$api - .$queue([ - this.$api.sysDictTypeDropDownAwait({ code: 'sex' }), - this.$api.sysDictTypeDropDownAwait({ code: 'common_status' }), - ]) - .then(([sex, commonStatus]) => { - this.codes.find((p) => p.code === 'sex').values = sex.data; - this.codes.find((p) => p.code === 'common_status').values = commonStatus.data; - }); + this.$api.$queue([this.$api.sysDictTypeDropDownAwait({ code: 'sex' }), this.$api.sysDictTypeDropDownAwait({ code: 'common_status' })]).then(([sex, commonStatus]) => { + this.codes.find((p) => p.code === 'sex').values = sex.data; + this.codes.find((p) => p.code === 'common_status').values = commonStatus.data; + }); }, bindCodeValue(code, name) { const c = this.codes.find((p) => p.code == name).values.find((p) => p.code == code);