update 项目管理

This commit is contained in:
2021-05-11 13:30:38 +08:00
parent 452c0291aa
commit 82e7ac70bd
6 changed files with 18 additions and 14 deletions

View File

@@ -29,7 +29,7 @@ namespace Ewide.Application.Entity
[Comment("区域ID")]
[MaxLength(36)]
[Required]
public string AreaId { get; set; }
public string AreaCode { get; set; }
[Comment("类型")]
[Required]

View File

@@ -13,7 +13,7 @@ namespace Ewide.Application.Service.HouseProjectInfo.Dto
public string Name { get; set; }
public string Note { get; set; }
public int Sort { get; set; }
public string AreaId { get; set; }
public string AreaCode { get; set; }
public int Type { get; set; }
}
public class AddProjectInput : HouseProjectInfoInput

View File

@@ -12,7 +12,7 @@ namespace Ewide.Application.Service.HouseProjectInfo.Dto
public string Name { get; set; }
public string Note { get; set; }
public int Sort { get; set; }
public string AreaId { get; set; }
public string AreaCode { get; set; }
public string AreaName { get; set; }
public int Type { get; set; }
}

View File

@@ -63,7 +63,7 @@ namespace Ewide.Application.Service.HouseProjectInfo
public async Task UpdateProject(UpdateProjectInput input)
{
var project = input.Adapt<BsHouseProjectInfo>();
await project.UpdateExcludeAsync(new[] { nameof(BsHouseProjectInfo.AreaId)}, true);
await project.UpdateExcludeAsync(new[] { nameof(BsHouseProjectInfo.AreaCode) }, true);
}
/// <summary>
@@ -85,12 +85,12 @@ namespace Ewide.Application.Service.HouseProjectInfo
[HttpPost("/houseProjectInfo/page")]
public async Task<dynamic> QueryProjectPageList([FromBody] HouseProjectInfoInput input)
{
var areaID = !string.IsNullOrEmpty(input.AreaId);
var areaID = !string.IsNullOrEmpty(input.AreaCode);
var areaCodeRep = Db.GetRepository<SysAreaCode>();
var projects = await _houseProjectInfoRep.DetachedEntities
.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<HouseProjectOutput>()).ToPagedListAsync(input.PageNo, input.PageSize);
.Join(areaCodeRep.DetachedEntities, p => p.AreaCode, a => a.Code, (p, a) => new { p, AreaName = a.Name })
.Where(areaID, x => x.p.AreaCode == input.AreaCode)
.Select(x => new { x.p.Id, x.p.Name, x.p.Note, x.p.Sort, x.p.AreaCode, x.AreaName, x.p.Type }.Adapt<HouseProjectOutput>()).ToPagedListAsync(input.PageNo, input.PageSize);
return XnPageResult<HouseProjectOutput>.PageResult(projects);
}

View File

@@ -12,7 +12,7 @@
<!-- 表单控件 -->
<a-form-model-item label="所属区域" prop="areaCode">
<!-- <a-tree-select :dropdown-style="{ maxHeight: '300px', overflow: 'auto' }" :tree-data="areaData" :replace-fields="{ value: 'code', title: 'name', children: 'children' }" placeholder="请选择所属区域" tree-default-expand-all v-model="form.areaId" /> -->
<a-cascader :field-names="{ label: 'name', value: 'code', children: 'children' }" :options="areaData" expand-trigger="hover" placeholder="请选择所属区域" v-model="areaCode" />
<a-cascader :field-names="{ label: 'name', value: 'code', children: 'children' }" :options="areaData" expand-trigger="hover" placeholder="请选择所属区域" v-model="form.areaCode" :display-render="displayRender" />
</a-form-model-item>
<a-form-model-item label="项目名称" prop="name">
<a-input placeholder="请输入项目名称" v-model="form.name" />
@@ -43,16 +43,18 @@ export default {
data() {
return {
/** 表单数据 */
form: { areaId: '' },
form: {},
/** 验证格式 */
rules: {
/* ... */
note: [{ required: true, message: '请输入备注' }],
name: [{ required: true, message: '请输入项目名称' }],
sort: [{ required: true, message: '请输入排序' }],
areaCode: [{ required: true, message: '请选择所属区域' }],
},
/** 加载异步数据状态 */
loading: false,
/** 其他成员属性 */
areaData: [],
/* ... */
@@ -96,10 +98,9 @@ export default {
...defaultForm,
...params.record,
/** 在此处添加其他默认数据转换 */
areaId: areaCode[3],
areaCode,
/* ... */
});
this.areaCode = areaCode;
},
/**
@@ -111,7 +112,7 @@ export default {
this.$refs.form.validate((valid) => {
if (valid) {
const record = this.$_.cloneDeep(this.form);
record.areaCode = record.areaCode[record.areaCode.length - 1];
/** 验证通过后可以对数据进行转换得到想要提交的格式 */
/* ... */
@@ -162,6 +163,9 @@ export default {
return res.data;
});
},
displayRender({ labels }) {
return labels[labels.length - 1];
},
/* ... */
},
};