Now OpenExpressApp support some property editors: base data type(string,
datatime, enum) and some given type(dropdown lookup、memo、attachment)
目前支持屬性編輯方式有:
基礎類型(字符串、日期、枚舉)、特定類型(下拉列表、memo彈出框、附件)
類圖如下:


下面分別對其他幾種編輯方式進行簡要說明,以便大家對這幾種類型的使用有所了解。
1 基礎類型
1.1 枚舉
1.1.1 運行界面

1.1.2 類庫編寫
1.1.2.1 定義枚舉類型
public enum BudgetType
{
[EnumAttr("不確定")]
Unknown = 0,
[EnumAttr("招標控制價源數據")]
TenderPriceSource = 1,
[EnumAttr("投標報價源數據")]
TenderOfferSource = 2,
[EnumAttr("調整預算源數據")]
BudgetAdjustmentSource = 3,
[EnumAttr("竣工結算源數據")]
FinalAccountSource = 4,
[EnumAttr("投標報價修正數據")]
TenderOfferModified = 5,
[EnumAttr("調整預算修正數據")]
BudgetAdjustmentModified = 6,
[EnumAttr("竣工結算修正數據")]
FinalAccountModified = 7,
}
1.1.2.2 類庫引用枚舉類型
private static PropertyInfo<BudgetType> BudgetTypeProperty =
RegisterProperty(new PropertyInfo<BudgetType>("BudgetType"));
[Column][EntityProperty]
[ShowInListAttribute, ShowInDetail, Label("預算書類型")]
public BudgetType BudgetType
{
get { return GetProperty(BudgetTypeProperty); }
set { SetProperty(BudgetTypeProperty, value); }
}
1.2 日期
1.2.1 運行界面

1.2.2 類庫編寫
private static PropertyInfo<DateTime> SignDateProperty =
RegisterProperty(new PropertyInfo<DateTime>("SignDate"));
[Column]
[EntityProperty]
[Required, ShowInListAttribute, ShowInDetail, Label("簽約日期")]
public DateTime SignDate
{
get { return GetProperty(SignDateProperty); }
set { SetProperty(SignDateProperty, value); }
}
2 下拉列表(列表和樹形)
2.1 運行界面

2.2 類庫編寫
在對象屬性上添加Lookup屬性,系統自動會生成下拉編輯類型,如果下拉對象類型實現了ITreeNode接口,則會自動生成下拉樹,否則下拉普通列表
//項目合同科目
private static PropertyInfo<Guid> projectContractSubjectIdProperty =
RegisterProperty(new PropertyInfo<Guid>("ProjectContractSubjectId"));
[Column][EntityProperty][ShowInDetail]
[Lookup("ProjectContractSubject", DataSourceProperty = "Project.ProjectContractSubjects")]
[QueryItemValueType(QueryItemValueType.Id), NavigateQueryItem]
public Guid ProjectContractSubjectId
{
get { return GetProperty(projectContractSubjectIdProperty); }
set { SetProperty(projectContractSubjectIdProperty, value); }
}
3 memo彈出框
3.1 運行界面

3.2 類庫編寫
在對象屬性上添加Editor屬性,指定編輯器為EditorNames.Memo類型
private static PropertyInfo<string> DescriptionProperty =
RegisterProperty(new PropertyInfo<string>("Description"));
[Column]
[EntityProperty]
[Required, ShowInList, Label("備注")]
[OpenExpressApp.MetaAttribute.EditorAttribute(EditorNames.Memo)]
public string Description
{
get { return GetProperty(DescriptionProperty); }
set { SetProperty(DescriptionProperty, value); }
}
4 附件
4.1 運行界面

4.2 類庫編寫
在對象屬性上添加Editor屬性,指定編輯方式為EditorNames.FileData
//FileAttachment
private static PropertyInfo<Guid?> FileIdProperty =
RegisterProperty(new PropertyInfo<Guid?>("FileId"));
[Column][EntityProperty]
[Editor(EditorNames.FileData)]
[Lookup("FileAttachment"), ShowInList]
public Guid? FileId
{
get { return GetProperty(FileIdProperty); }
private set { SetProperty(FileIdProperty, value); }
}
private static PropertyInfo<FileAttachment> FileAttachmentProperty =
RegisterProperty(new PropertyInfo<FileAttachment>("FileAttachment"));
public FileAttachment FileAttachment
{
get
{
return GetProperty(FileAttachmentProperty);
}
set
{
SetProperty(FileAttachmentProperty, value);
}
}
標簽:
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:互聯網