ComplianceServer/oldcode/Core.Web/Views/Statistics/index.cshtml

112 lines
4.5 KiB
Plaintext

@using CRM.Core.Model.Entity
@using Core.Web.WebHelper
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<div class="x-body">
<div style="display:flex">
<form class="layui-form" action="" id="mytoolbar">
年份:
<div class="layui-inline">
<select name="year" style="height:35px;">
@foreach (var item in ViewBag.YearList as List<string>)
{
if (item == ViewBag.Year)
{
<option selected value="@item">@item</option>
}
else
{
<option value="@item">@item</option>
}
}
</select>
</div>
月份:
<div class="layui-inline">
<select name="month" style="height:35px;">
@foreach (var item in ViewBag.MonthList as List<string>)
{
if (item == ViewBag.Month)
{
<option selected value="@item">@item</option>
}
else
{
<option value="@item">@item</option>
}
}
</select>
</div>
<button style="margin-left:20px;" class="layui-btn" lay-submit lay-filter="formDemo" id="search">查询</button>
</form>
<button style="margin-left:20px;" class="layui-btn" id="export">导出</button>
</div>
<div style="display:flex">
<table class="layui-hide" id="tabl1" lay-filter="tabl1"></table>
</div>
</div>
<script>
layui.use(['table', 'laydate', 'layer', 'form'], function () {
var table = layui.table
, laydate = layui.laydate
, layer = layui.layer
, form = layui.form;
var year = '@Html.Raw(ViewBag.Year)';
var month = '@Html.Raw(ViewBag.Month)';
function init() {
var loading = layer.load('加载中...', {
shade: [0.1, '#fff'] //0.1透明度的白色背景
});
var conterData = [], deptData = [];
$.ajax({
type: "GET",
url: "/Statistics/GetListHtml?year=" + year + "&month=" + month,
success: function (da) {
layer.close(loading);
if (da.code === 0) {
table.render({
id: 'tabl1',//列表别名ID
elem: '#tabl1',//表ID
data: da.data.Result,
limit: 30,
loading: true,
width: 565,
totalRow: true,
cols: [
[{ align: 'center', title: '回访情况一览表', colspan: 3 }],
[
{ field: 'TypeName', title: '回访类型', align: 'center', totalRowText: '合计' }
, { field: 'Total', title: '回访数量', width: 180, totalRow: true, align: 'center' }
, { field: 'Proportion', title: '占比', width: 180, totalRow: true, align: 'center' }
]],
done: function (res, curr) {
var divArr = $(".layui-table-total div.layui-table-cell");
$.each(divArr, function (index, item) {
var _div = $(item);
var content = _div.html();
content = content.replace(".00", "");
_div.html(content);
});
}
});
table.reload('tabl1', {});
}
}
});
}
init();
form.on('submit(formDemo)', function (data) {
year = data.field.year;
month = data.field.month;
init();
return false;
});
$('#export').on('click', function () {
window.open("/Statistics/Export?year=" + year + "&month=" + month);
})
});
</script>