# Avue 配置

控制器基类BaseController封装了对客户端Avue表格组件配置信息的支持,通过以下方法可方便的输出Avue 表格组件所需要的表格配置信息。

# GetTableOption

获取表格配置信息,主要实现了通过WinForm数据集列配置信息生成Avue 表格组件所需要的列配置信息。

//获取业务数据
var qq = new DsRequest();
qq.ModuleId = moduleId_ParamDefine;
qq.DataSetName = "GetData";
qq.TableNames = "T01";
var res = GetDataSet(qq);
if (!res.IsSuccess) { return Error(res.ErrMsg); }

//获取表格配置信息
var tableOption = GetTableOption(qq, "参数定义", false, true);

//封装匿名对象
var obj = new
{
    listData = res.DataTable,
    tableOption = tableOption
};

//返回客户端
return Success(obj);

# GetTableOptionColumn

当遇到通过WinForm数据集列配置信息无法实现的配置,可以在调用GetTableOption()方法得到表格配置对象后,再通过此方法从中获取到某一列的列配置对象,其类型是一个dynamic动态类型,可以任意增加自定义属性。

Avue 表格组件使用文档 (opens new window)

//获取业务数据
var qq = new DsRequest();
qq.ModuleId = moduleId_ParamDefine;
qq.DataSetName = "GetData";
qq.TableNames = "T01";
var res = GetDataSet(qq);
if (!res.IsSuccess) { return Error(res.ErrMsg); }

//获取表格配置信息
var tableOption = GetTableOption(qq, "参数定义", false, true);

#region 表格扩展配置

//修改表格配置
tableOption.excelBtn = true;
tableOption.title = "我修改了表格标题";

//修改表配置
var col = GetTableOptionColumn(tableOption, "Code");
if (col != null)
{
    col.label = "代码代码";
    col.hello = "world";
}

#endregion

//封装匿名对象
var obj = new
{
    listData = res.DataTable,
    tableOption = tableOption
};

//返回客户端
return Success(obj);