我需要根据DataInicio,DataFim的值来缓存数据。
这是用户选择开始和结束日期以获取表中所列数据的一种小形式。
表中的按钮可引至另一页,以检查外键关系中包含的某些数据。
我想要的是当用户单击按钮返回时,页面将在重定向之前显示数据。
我尝试使用缓存标记并使用“ by-by”,但似乎无法理解。
我只需要缓存数据并在用户再次发布后过期。
<cache>
<div class="card card-olive collapsed-card">
<div class="card-header">
<h3 class="card-title"><i class="fas fa-search"></i> Consultar</h3>
<div class="card-tools">
<!-- This will cause the card to collapse when clicked -->
<button type="button" class="btn btn-tool" data-widget="collapse"><i class="fas fa-plus"></i></button>
</div>
<!-- /.card-tools -->
</div>
<!-- /.card-header -->
<div class="card-body">
<form method="post">
<div class="form-row">
<div class="form-group col-md-3">
<label asp-for="DataInicio" class="control-label"></label>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1"><i class="fa fa-calendar-alt"></i></span>
</div>
<input type="text" asp-for="DataInicio" class="form-control datepicker" data-date-format="dd-mm-yyyy" value="" autocomplete="off" />
</div>
<span asp-validation-for="DataInicio" class="text-danger"></span>
</div>
<div class="form-group col-md-3">
<label asp-for="DataFim" class="control-label"></label>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1"><i class="fa fa-calendar-alt"></i></span>
</div>
<input type="text" asp-for="DataFim" class="form-control datepicker" data-date-format="dd-mm-yyyy" value="" autocomplete="off" />
</div>
<span asp-validation-for="DataFim" class="text-danger"></span>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<div class="btn-group" role="group" aria-label="Basic example">
<button type="submit" class="btn btn-outline-secondary"><i class="fa fa-search"></i> Consultar</button>
</div>
</div>
</div>
</form>
</div>
<!-- /.card-body -->
</div>
<!-- /.card -->
<table id="tblRegistos" class="table table-bordered table-sm table-striped" style="width:100%;">
<caption style="caption-side:top;">
<div class="card card-body bg-light text-bold text-center">Registos de Produção @ViewBag.Message</div>
</caption>
<thead class="thead-dark">
<tr>
<th>
@Html.DisplayNameFor(model => model.ProducaoRegistos[0].DataCriacao)
</th>
<th>
@Html.DisplayNameFor(model => model.ProducaoRegistos[0].Turno)
</th>
<th>
@(Html.DisplayNameFor(model => model.ProducaoRegistos[0].Celula))
</th>
<th>
@Html.DisplayNameFor(model => model.ProducaoRegistos[0].TotalPecasSemDefeito)
</th>
<th>
@Html.DisplayNameFor(model => model.ProducaoRegistos[0].TotalPecasComDefeito)
</th>
<th>
@Html.DisplayNameFor(model => model.ProducaoRegistos[0].TotalTempoParado)
</th>
<th class="text-center" data-orderable="false">
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.ProducaoRegistos)
{
<tr>
<td class="p-2">
@Html.DisplayFor(model => item.DataCriacao)
</td>
<td class="p-2">
@Html.DisplayFor(model => item.Turno)
@{
var cor = "";
switch (item.Turno)
{
case "Amarelo":
cor = "text-warning";
break;
case "Verde":
cor = "text-success";
break;
case "Azul":
cor = "text-primary";
break;
}
<div class="float-right">
<i class="fas fa-user-clock @cor"></i>
</div>
}
</td>
<td class="p-2">
@Html.DisplayFor(model => item.Celula)
</td>
<td class="p-2">
@(Html.DisplayFor(model => item.TotalPecasSemDefeito))
<div class="float-right">
<a asp-page="Pecas/SemDefeito/Index" asp-route-id="@item.Id" class="btn btn-sm btn-outline-secondary"><i class="fas fa-search"></i></a>
</div>
</td>
<td class="p-2">
@(Html.DisplayFor(model => item.TotalPecasComDefeito))
<div class="float-right">
<a asp-page="Pecas/ComDefeito/Index" asp-route-id="@item.Id" class="btn btn-sm btn-outline-secondary"><i class="fas fa-search"></i></a>
</div>
</td>
<td class="p-2">
@(Html.DisplayFor(model => item.TotalTempoParado))
<div class="float-right">
<a asp-page="Paragens/Index" asp-route-id="@item.Id" class="btn btn-sm btn-outline-secondary"><i class="fas fa-search"></i></a>
</div>
</td>
<td class="p-2 text-center">
<a asp-page="CheckLists/Index" asp-route-id="@item.Id" class="btn btn-info"><i class="fas fa-check"></i> Check-List</a>
</td>
</tr>
}
</tbody>
</table>
</cache>