Commit 7f6e11b6 by wangonghui
parents c44f4204 60aadce1
...@@ -8,8 +8,17 @@ ...@@ -8,8 +8,17 @@
d:DataContext="{d:DesignInstance Type=local:FieldEditViewModel}" d:DataContext="{d:DesignInstance Type=local:FieldEditViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<common:NavigationControl ItemsSource="{Binding Path=NavigationConfigs}" <Grid.RowDefinitions>
SelectedValue="{Binding Path=SelectedNavigationConfig,Mode=OneWay}"></common:NavigationControl> <RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 按钮组 -->
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Button Width="80" Height="24" Content="保存字段" Command="{Binding SaveCommand}"></Button>
</StackPanel>
<!-- 字段编辑 -->
<common:NavigationControl ItemsSource="{Binding Path=NavigationConfigs}" Grid.Row="1"
SelectedValue="{Binding Path=SelectedNavigationConfig,Mode=OneWay}"></common:NavigationControl>
</Grid>
</UserControl> </UserControl>
using System; using DevExpress.Xpf.Core;
using LiteDB;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
...@@ -7,6 +9,7 @@ using System.Windows; ...@@ -7,6 +9,7 @@ using System.Windows;
using VIZ.Framework.Common; using VIZ.Framework.Common;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.Package.Domain; using VIZ.Package.Domain;
using VIZ.Package.Service;
using VIZ.Package.Storage; using VIZ.Package.Storage;
namespace VIZ.Package.Module namespace VIZ.Package.Module
...@@ -14,12 +17,12 @@ namespace VIZ.Package.Module ...@@ -14,12 +17,12 @@ namespace VIZ.Package.Module
/// <summary> /// <summary>
/// 字段编辑视图模型 /// 字段编辑视图模型
/// </summary> /// </summary>
public class FieldEditViewModel : ViewModelBase, IFieldEditService public class FieldEditViewModel : FieldEditViewModelBase, IFieldEditService
{ {
public FieldEditViewModel() public FieldEditViewModel()
{ {
// 初始化导航配置 // 初始化命令
this.InitNavigationConfigs(); this.InitCommand();
// 初始化消息 // 初始化消息
this.InitMessage(); this.InitMessage();
...@@ -29,115 +32,33 @@ namespace VIZ.Package.Module ...@@ -29,115 +32,33 @@ namespace VIZ.Package.Module
} }
/// <summary> /// <summary>
/// 初始化消息 /// 初始化命令
/// </summary> /// </summary>
private void InitMessage() private void InitCommand()
{ {
ApplicationDomainEx.MessageManager.Register<ControlFieldChangedMessage>(this, this.OnControlFieldChangedMessage); this.SaveCommand = new VCommand(this.Save);
} }
/// <summary> /// <summary>
/// 初始化导航配置 /// 初始化消息
/// </summary> /// </summary>
private void InitNavigationConfigs() private void InitMessage()
{ {
// 文本编辑器 ApplicationDomainEx.MessageManager.Register<ControlFieldChangedMessage>(this, this.OnControlFieldChangedMessage);
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.text.ToString(),
ViewType = typeof(TextEditPanel),
ViewCreated = this.OnViewCreated
});
// 富文本编辑器
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.richtext.ToString(),
ViewType = typeof(RichTextEditPanel),
ViewCreated = this.OnViewCreated
});
// Boolean类型
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.boolean.ToString(),
ViewType = typeof(BooleanEditPanel),
ViewCreated = this.OnViewCreated
});
// 图片选择
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.image.ToString(),
ViewType = typeof(ImageEditPanel),
ViewCreated = this.OnViewCreated
});
// 列表编辑
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.list.ToString(),
ViewType = typeof(ListEditPanel),
ViewCreated = this.OnViewCreated
});
// 数字
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.integer.ToString(),
ViewType = typeof(IntegerEditPanel),
ViewCreated = this.OnViewCreated
});
// 二元编辑
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.duplet.ToString(),
ViewType = typeof(DupletEditPanel),
ViewCreated = this.OnViewCreated
});
// 三元编辑
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.triplet.ToString(),
ViewType = typeof(TripletEditPanel),
ViewCreated = this.OnViewCreated
});
} }
// ============================================================= // =============================================================
// Property // Field & Service
// ============================================================= // =============================================================
#region NavigationConfigs -- 导航配置
private List<NavigationConfig> navigationConfigs = new List<NavigationConfig>();
/// <summary>
/// 导航配置
/// </summary>
public List<NavigationConfig> NavigationConfigs
{
get { return navigationConfigs; }
set { navigationConfigs = value; this.RaisePropertyChanged(nameof(NavigationConfigs)); }
}
#endregion
#region SelectedNavigationConfig -- 当前选中的导航配置
private NavigationConfig selectedNavigationConfig;
/// <summary> /// <summary>
/// 当前选中的导航配置 /// 控制对象服务
/// </summary> /// </summary>
public NavigationConfig SelectedNavigationConfig private ControlObjectService controlObjectService = new ControlObjectService();
{
get { return selectedNavigationConfig; }
set { selectedNavigationConfig = value; this.RaisePropertyChanged(nameof(SelectedNavigationConfig)); }
}
#endregion // =============================================================
// Property
// =============================================================
#region ControlObject -- 控制对象 #region ControlObject -- 控制对象
...@@ -168,6 +89,52 @@ namespace VIZ.Package.Module ...@@ -168,6 +89,52 @@ namespace VIZ.Package.Module
#endregion #endregion
// ============================================================= // =============================================================
// Command
// =============================================================
#region SaveCommand -- 保存命令
/// <summary>
/// 保存命令
/// </summary>
public VCommand SaveCommand { get; set; }
/// <summary>
/// 保存
/// </summary>
private void Save()
{
// 当前没有打开的页或模板 || 当前没有打开的项目
if (ApplicationDomainEx.CurrentPage == null || ApplicationDomainEx.ProjectDbContext == null)
{
DXMessageBox.Show("保存失败!");
return;
}
// 字段树服务不可用
IFieldTreeService service = ApplicationDomainEx.ServiceManager.GetService<IFieldTreeService>(ViewServiceKeys.FIELD_TREE_SERVICE);
if (service == null)
{
DXMessageBox.Show("保存失败!");
return;
}
// 当前没有控制对象
ControlObjectModel obj = service.GetControlObject();
if (obj == null)
{
return;
}
// 保存
this.controlObjectService.SaveControlFields(ApplicationDomainEx.CurrentPage, obj.AllFiledNodes);
DXMessageBox.Show("保存成功!");
}
#endregion
// =============================================================
// Message // Message
// ============================================================= // =============================================================
...@@ -207,29 +174,8 @@ namespace VIZ.Package.Module ...@@ -207,29 +174,8 @@ namespace VIZ.Package.Module
// Public Function // Public Function
// ============================================================= // =============================================================
/// <summary>
/// 获取当前正在编辑字段的值
/// </summary>
/// <returns>当前正在编辑字段的值</returns>
public string GetCurrentEditFieldValue()
{
if (this.SelectedNavigationConfig == null || this.SelectedNavigationConfig.View == null)
return null;
this.SelectedNavigationConfig.View.TryGetTarget(out object target);
FrameworkElement view = target as FrameworkElement;
if (view == null)
return null;
EditPanelModelBase vm = view.DataContext as EditPanelModelBase;
if (vm == null)
return null;
return vm.GetFieldValue();
}
// ============================================================= // =============================================================
// Private Function // Protected Function
// ============================================================= // =============================================================
/// <summary> /// <summary>
...@@ -237,7 +183,7 @@ namespace VIZ.Package.Module ...@@ -237,7 +183,7 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
/// <param name="config">导航配置</param> /// <param name="config">导航配置</param>
/// <param name="obj">视图</param> /// <param name="obj">视图</param>
private void OnViewCreated(NavigationConfig config, object obj) protected override void OnViewCreated(NavigationConfig config, object obj)
{ {
FrameworkElement view = obj as FrameworkElement; FrameworkElement view = obj as FrameworkElement;
if (view == null) if (view == null)
......
using DevExpress.Mvvm.POCO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using VIZ.Framework.Common;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Storage;
namespace VIZ.Package.Module
{
/// <summary>
/// 字段编辑视图模型
/// </summary>
public abstract class FieldEditViewModelBase : ViewModelBase
{
/// <summary>
/// 字段编辑视图模型
/// </summary>
public FieldEditViewModelBase()
{
// 初始化导航配置
this.InitNavigationConfigs();
}
/// <summary>
/// 初始化导航配置
/// </summary>
private void InitNavigationConfigs()
{
// 文本编辑器
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.text.ToString(),
ViewType = typeof(TextEditPanel),
ViewCreated = this.OnViewCreated
});
// 富文本编辑器
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.richtext.ToString(),
ViewType = typeof(RichTextEditPanel),
ViewCreated = this.OnViewCreated
});
// Boolean类型
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.boolean.ToString(),
ViewType = typeof(BooleanEditPanel),
ViewCreated = this.OnViewCreated
});
// 图片选择
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.image.ToString(),
ViewType = typeof(ImageEditPanel),
ViewCreated = this.OnViewCreated
});
// 列表编辑
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.list.ToString(),
ViewType = typeof(ListEditPanel),
ViewCreated = this.OnViewCreated
});
// 数字
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.integer.ToString(),
ViewType = typeof(IntegerEditPanel),
ViewCreated = this.OnViewCreated
});
// 二元编辑
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.duplet.ToString(),
ViewType = typeof(DupletEditPanel),
ViewCreated = this.OnViewCreated
});
// 三元编辑
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.triplet.ToString(),
ViewType = typeof(TripletEditPanel),
ViewCreated = this.OnViewCreated
});
}
// =============================================================
// Property
// =============================================================
#region NavigationConfigs -- 导航配置
private List<NavigationConfig> navigationConfigs = new List<NavigationConfig>();
/// <summary>
/// 导航配置
/// </summary>
public List<NavigationConfig> NavigationConfigs
{
get { return navigationConfigs; }
set { navigationConfigs = value; this.RaisePropertyChanged(nameof(NavigationConfigs)); }
}
#endregion
#region SelectedNavigationConfig -- 当前选中的导航配置
private NavigationConfig selectedNavigationConfig;
/// <summary>
/// 当前选中的导航配置
/// </summary>
public NavigationConfig SelectedNavigationConfig
{
get { return selectedNavigationConfig; }
set { selectedNavigationConfig = value; this.RaisePropertyChanged(nameof(SelectedNavigationConfig)); }
}
#endregion
// =============================================================
// Public Function
// =============================================================
/// <summary>
/// 获取当前正在编辑字段的值
/// </summary>
/// <returns>当前正在编辑字段的值</returns>
public string GetCurrentEditFieldValue()
{
if (this.SelectedNavigationConfig == null || this.SelectedNavigationConfig.View == null)
return null;
this.SelectedNavigationConfig.View.TryGetTarget(out object target);
FrameworkElement view = target as FrameworkElement;
if (view == null)
return null;
EditPanelModelBase vm = view.DataContext as EditPanelModelBase;
if (vm == null)
return null;
return vm.GetFieldValue();
}
// =============================================================
// Private Function
// =============================================================
/// <summary>
/// 视图创建后触发
/// </summary>
/// <param name="config">导航配置</param>
/// <param name="obj">视图</param>
protected abstract void OnViewCreated(NavigationConfig config, object obj);
}
}
\ No newline at end of file
...@@ -16,116 +16,12 @@ namespace VIZ.Package.Module ...@@ -16,116 +16,12 @@ namespace VIZ.Package.Module
/// <summary> /// <summary>
/// 字段编辑窗口视图模型 /// 字段编辑窗口视图模型
/// </summary> /// </summary>
public class FieldEditWindowModel : ViewModelBase public class FieldEditWindowModel : FieldEditViewModelBase
{ {
public FieldEditWindowModel()
{
// 初始化导航配置
this.InitNavigationConfigs();
}
/// <summary>
/// 初始化导航配置
/// </summary>
private void InitNavigationConfigs()
{
// 文本编辑器
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.text.ToString(),
ViewType = typeof(TextEditPanel),
ViewCreated = this.OnViewCreated
});
// 富文本编辑器
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.richtext.ToString(),
ViewType = typeof(RichTextEditPanel),
ViewCreated = this.OnViewCreated
});
// Boolean类型
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.boolean.ToString(),
ViewType = typeof(BooleanEditPanel),
ViewCreated = this.OnViewCreated
});
// 图片选择
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.image.ToString(),
ViewType = typeof(ImageEditPanel),
ViewCreated = this.OnViewCreated
});
// 列表编辑
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.list.ToString(),
ViewType = typeof(ListEditPanel),
ViewCreated = this.OnViewCreated
});
// 数字
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.integer.ToString(),
ViewType = typeof(IntegerEditPanel),
ViewCreated = this.OnViewCreated
});
// 二元编辑
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.duplet.ToString(),
ViewType = typeof(DupletEditPanel),
ViewCreated = this.OnViewCreated
});
// 三元编辑
this.NavigationConfigs.Add(new NavigationConfig
{
Key = VizControlFieldType.triplet.ToString(),
ViewType = typeof(TripletEditPanel),
ViewCreated = this.OnViewCreated
});
}
// ============================================================= // =============================================================
// Property // Property
// ============================================================= // =============================================================
#region NavigationConfigs -- 导航配置
private List<NavigationConfig> navigationConfigs = new List<NavigationConfig>();
/// <summary>
/// 导航配置
/// </summary>
public List<NavigationConfig> NavigationConfigs
{
get { return navigationConfigs; }
set { navigationConfigs = value; this.RaisePropertyChanged(nameof(NavigationConfigs)); }
}
#endregion
#region SelectedNavigationConfig -- 当前选中的导航配置
private NavigationConfig selectedNavigationConfig;
/// <summary>
/// 当前选中的导航配置
/// </summary>
public NavigationConfig SelectedNavigationConfig
{
get { return selectedNavigationConfig; }
set { selectedNavigationConfig = value; this.RaisePropertyChanged(nameof(SelectedNavigationConfig)); }
}
#endregion
#region ColumnDefinition -- 列定义 #region ColumnDefinition -- 列定义
private GridColumnDefinition columnDefinition; private GridColumnDefinition columnDefinition;
...@@ -224,7 +120,7 @@ namespace VIZ.Package.Module ...@@ -224,7 +120,7 @@ namespace VIZ.Package.Module
} }
// ============================================================= // =============================================================
// Private Function // Protected Function
// ============================================================= // =============================================================
/// <summary> /// <summary>
...@@ -232,7 +128,7 @@ namespace VIZ.Package.Module ...@@ -232,7 +128,7 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
/// <param name="config">导航配置</param> /// <param name="config">导航配置</param>
/// <param name="obj">视图</param> /// <param name="obj">视图</param>
private void OnViewCreated(NavigationConfig config, object obj) protected override void OnViewCreated(NavigationConfig config, object obj)
{ {
FrameworkElement view = obj as FrameworkElement; FrameworkElement view = obj as FrameworkElement;
if (view == null) if (view == null)
......
...@@ -7,6 +7,7 @@ using System.Threading.Tasks; ...@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using VIZ.Framework.Core; using VIZ.Framework.Core;
using VIZ.Package.Domain; using VIZ.Package.Domain;
using VIZ.Package.Service; using VIZ.Package.Service;
using VIZ.Package.Storage;
namespace VIZ.Package.Module namespace VIZ.Package.Module
{ {
...@@ -53,6 +54,11 @@ namespace VIZ.Package.Module ...@@ -53,6 +54,11 @@ namespace VIZ.Package.Module
/// </summary> /// </summary>
private VizCommandControlObjectService vizCommandControlObjectService = new VizCommandControlObjectService(); private VizCommandControlObjectService vizCommandControlObjectService = new VizCommandControlObjectService();
/// <summary>
/// 控制对象服务
/// </summary>
private ControlObjectService controlObjectService = new ControlObjectService();
// ============================================================= // =============================================================
// Property // Property
// ============================================================= // =============================================================
...@@ -131,12 +137,23 @@ namespace VIZ.Package.Module ...@@ -131,12 +137,23 @@ namespace VIZ.Package.Module
ThreadHelper.SafeRun(action: () => ThreadHelper.SafeRun(action: () =>
{ {
// 获取控制对象
ControlObjectModel controlObject = this.vizCommandControlObjectService.GetControlObject(ApplicationDomainEx.PreviewConn); ControlObjectModel controlObject = this.vizCommandControlObjectService.GetControlObject(ApplicationDomainEx.PreviewConn);
WPFHelper.BeginInvoke(() => // 从本地数据库中获取字段数据
List<ControlFieldEntity> fields = this.controlObjectService.GetControlFields(msg.Page);
// 从本地数据库中更新值
controlObjectService.UpdateControlFieldValue(controlObject.AllFiledNodes, fields);
WPFHelper.Invoke(() =>
{ {
this.ControlObject = controlObject; this.ControlObject = controlObject;
}); });
// 将当前值上至预览
this.vizCommandControlObjectService.SetControlObject(ApplicationDomainEx.PreviewConn, this.ControlObject);
}, final: () => }, final: () =>
{ {
WPFHelper.BeginInvoke(() => WPFHelper.BeginInvoke(() =>
...@@ -184,7 +201,10 @@ namespace VIZ.Package.Module ...@@ -184,7 +201,10 @@ namespace VIZ.Package.Module
if (oldField != null && oldField.Type == Storage.VizControlFieldType.list) if (oldField != null && oldField.Type == Storage.VizControlFieldType.list)
{ {
IFieldEditService service = ApplicationDomainEx.ServiceManager.GetService<IFieldEditService>(ViewServiceKeys.FIELD_EDIT_SERVICE); IFieldEditService service = ApplicationDomainEx.ServiceManager.GetService<IFieldEditService>(ViewServiceKeys.FIELD_EDIT_SERVICE);
if (service != null)
{
oldField.Value = service.GetCurrentEditFieldValue();
}
} }
} }
} }
......
...@@ -91,6 +91,7 @@ ...@@ -91,6 +91,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="ControlObject\FieldEdit\Service\IFieldEditService.cs" /> <Compile Include="ControlObject\FieldEdit\Service\IFieldEditService.cs" />
<Compile Include="ControlObject\FieldEdit\ViewModel\FieldEditViewModelBase.cs" />
<Compile Include="ControlObject\FieldTree\Service\IFieldTreeService.cs" /> <Compile Include="ControlObject\FieldTree\Service\IFieldTreeService.cs" />
<Compile Include="Main\ViewModel\MainConnViewModel.cs" /> <Compile Include="Main\ViewModel\MainConnViewModel.cs" />
<Compile Include="Main\View\MainConnView.xaml.cs"> <Compile Include="Main\View\MainConnView.xaml.cs">
......
using LiteDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Package.Domain;
using VIZ.Package.Storage;
namespace VIZ.Package.Service
{
/// <summary>
/// 控制对象服务
/// </summary>
public class ControlObjectService
{
/// <summary>
/// 保存控制字段
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="fields">控制字段</param>
public void SaveControlFields(PageModelBase pageBase, IList<ControlFieldNodeModel> fields)
{
Guid id = Guid.Empty;
if (pageBase is PageTemplateModel template)
{
id = template.TemplateID;
}
else if (pageBase is PageModel page)
{
id = page.PageID;
}
ILiteCollection<ControlFieldEntity> collection = ApplicationDomainEx.ProjectDbContext.GetControlFiled(id);
collection.DeleteAll();
List<ControlFieldEntity> list = new List<ControlFieldEntity>();
foreach (ControlFieldNodeModel field in fields)
{
ControlFieldEntity entity = new ControlFieldEntity();
entity.FieldIdentifier = field.FieldIdentifier;
entity.Value = field.Value;
entity.Type = field.Type;
list.Add(entity);
}
collection.Insert(list);
}
/// <summary>
/// 保存控制字段
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="fields">控制字段</param>
public void SaveControlFields(PageModelBase pageBase, IList<ControlFieldEntity> fields)
{
Guid id = Guid.Empty;
if (pageBase is PageTemplateModel template)
{
id = template.TemplateID;
}
else if (pageBase is PageModel page)
{
id = page.PageID;
}
ILiteCollection<ControlFieldEntity> collection = ApplicationDomainEx.ProjectDbContext.GetControlFiled(id);
collection.DeleteAll();
collection.Insert(fields);
}
/// <summary>
/// 获取控制字段
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <returns>控制字段</returns>
public List<ControlFieldEntity> GetControlFields(PageModelBase pageBase)
{
Guid id = Guid.Empty;
if (pageBase is PageTemplateModel template)
{
id = template.TemplateID;
}
else if (pageBase is PageModel page)
{
id = page.PageID;
}
ILiteCollection<ControlFieldEntity> collection = ApplicationDomainEx.ProjectDbContext.GetControlFiled(id);
return collection.FindAll().ToList();
}
/// <summary>
/// 更新控制字段值
/// </summary>
/// <param name="models">模型</param>
/// <param name="entitys">实体</param>
public void UpdateControlFieldValue(IList<ControlFieldNodeModel> models, IList<ControlFieldEntity> entitys)
{
Dictionary<string, ControlFieldEntity> dic = entitys.ToDictionary(p => p.FieldIdentifier, p => p);
foreach (ControlFieldNodeModel model in models)
{
if (!dic.TryGetValue(model.FieldIdentifier, out ControlFieldEntity entity))
continue;
if (model.Type != entity.Type)
continue;
model.Value = entity.Value;
}
}
}
}
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="DB\Conn\ConnService.cs" /> <Compile Include="DB\Conn\ConnService.cs" />
<Compile Include="DB\ControlObject\ControlObjectService.cs" />
<Compile Include="DB\Page\PageService.cs" /> <Compile Include="DB\Page\PageService.cs" />
<Compile Include="Logic\Plugin\PluginService.cs" /> <Compile Include="Logic\Plugin\PluginService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
......
using LiteDB;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Storage
{
/// <summary>
/// 控制动态字段实体
/// </summary>
public class ControlDynamicFieldEntity : ControlFieldEntity
{
/// <summary>
/// 所属字段
/// </summary>
public string OwnerFieldIdentifier { get; set; }
/// <summary>
/// 行数, 从0开始
/// </summary>
public int Row { get; set; }
}
}
...@@ -66,17 +66,9 @@ namespace VIZ.Package.Storage ...@@ -66,17 +66,9 @@ namespace VIZ.Package.Storage
/// <returns>控制字段</returns> /// <returns>控制字段</returns>
public ILiteCollection<ControlFieldEntity> GetControlFiled(Guid id) public ILiteCollection<ControlFieldEntity> GetControlFiled(Guid id)
{ {
return this.Database.GetCollection<ControlFieldEntity>(id.ToString()); string name = $"PAGE_{id.ToString().Replace("-", string.Empty)}";
}
/// <summary> return this.Database.GetCollection<ControlFieldEntity>(name);
/// 根据ID获取控制动态字段, ID 为 TemplateID 或者 PageID
/// </summary>
/// <param name="id">TemplateID 或者 PageID</param>
/// <returns>控制动态字段</returns>
public ILiteCollection<ControlDynamicFieldEntity> GetControlDynamicFiled(Guid id)
{
return this.Database.GetCollection<ControlDynamicFieldEntity>(id.ToString());
} }
/// <summary> /// <summary>
......
...@@ -70,7 +70,6 @@ ...@@ -70,7 +70,6 @@
<Compile Include="Entity\Config\ConfigContext.cs" /> <Compile Include="Entity\Config\ConfigContext.cs" />
<Compile Include="Entity\Conn\ConnEntity.cs" /> <Compile Include="Entity\Conn\ConnEntity.cs" />
<Compile Include="Entity\Conn\ConnGroupEntity.cs" /> <Compile Include="Entity\Conn\ConnGroupEntity.cs" />
<Compile Include="Entity\ControlObject\ControlDynamicFieldEntity.cs" />
<Compile Include="Entity\ControlObject\ControlFieldEntity.cs" /> <Compile Include="Entity\ControlObject\ControlFieldEntity.cs" />
<Compile Include="Entity\Page\PageEntityBase.cs" /> <Compile Include="Entity\Page\PageEntityBase.cs" />
<Compile Include="Entity\Page\PageEntity.cs" /> <Compile Include="Entity\Page\PageEntity.cs" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment