@using XCode.Statistics;
@{
// 所有可用层级
var vs = Model as StatLevels[];
var ds = System.EnumHelper.GetDescriptions(typeof(StatLevels));
var def = StatLevels.All;
if (vs != null && vs.Length > 0)
{
ds = vs.ToDictionary(e => (Int32)e, e => e.GetDescription());
def = vs[0];
}
var page = ViewBag.Page as Pager;
var n = page["Level"].ToInt(-1);
var level = n >= 0 ? (StatLevels)n : def;
var formatStr = "";
switch (level)
{
case StatLevels.Year: formatStr = "yyyy"; break;
case StatLevels.Month: formatStr = "yyyy-MM"; break;
case StatLevels.Day: formatStr = "yyyy-MM-dd"; break;
case StatLevels.Hour: formatStr = "yyyy-MM-dd HH"; break;
case StatLevels.Minute: formatStr = "yyyy-MM-dd HH:mm"; break;
}
}
<div class="form-group">
@Html.ForDropDownList("Level", ds, (Int32)level, null, true)
</div>
@if (level > StatLevels.All)
{
<div class="form-group">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input name="Time" id="Time" value="@page["Time"]" dateformat="@formatStr" class="form-control form_datetime" />
</div>
</div>
}
|