/// <summary> /// 添加序号 /// </summary> private void AddLineNumber(TableColumnBuilder builder) { if (_config.GetValue <TableColumnType?>(UiConst.Type) != TableColumnType.LineNumber) { return; } builder.AppendContent("{{row.lineNumber}}"); }
/// <summary> /// 添加布尔类型列 /// </summary> private void AddBoolColumn(TableColumnBuilder builder, string column) { if (column.IsEmpty()) { return; } builder.AppendContent($"{{{{row.{column}?'{R.Yes}':'{R.No}'}}}}"); }
/// <summary> /// 添加日期类型列 /// </summary> private void AddDateColumn(TableColumnBuilder builder, string column) { if (column.IsEmpty()) { return; } var format = _config.GetValue(UiConst.DateFormat); if (string.IsNullOrWhiteSpace(format)) { format = "yyyy-MM-dd"; } builder.AppendContent($"{{{{ row.{column} | date:\"{format}\" }}}}"); }
/// <summary> /// 添加复选框 /// </summary> protected void AddCheckbox(TableColumnBuilder builder) { if (_config.GetValue <TableColumnType?>(UiConst.Type) != TableColumnType.Checkbox) { return; } var tableId = _config.Context.GetValueFromItems <TableShareConfig>(TableConfig.TableShareKey)?.TableId; builder.AddAttribute("[nzShowCheckbox]", $"{tableId}_wrapper.multiple"); builder.AddAttribute("(click)", "$event.stopPropagation()"); builder.AddAttribute("(nzCheckedChange)", $"{tableId}_wrapper.checkedSelection.toggle(row)"); builder.AddAttribute("[nzChecked]", $"{tableId}_wrapper.checkedSelection.isSelected(row)"); builder.AppendContent(new TableRadioBuilder(tableId)); }
/// <summary> /// 添加默认列 /// </summary> private void AddDefaultColumn(TableColumnBuilder builder, string column) { if (column.IsEmpty()) { return; } var length = _config.GetValue <int?>(UiConst.Truncate); if (length == null) { builder.AppendContent($"{{{{row.{column}}}}}"); return; } builder.Truncate(column, length.SafeValue()); }