Index.cshtml 2.11 KB
@using Hh.Mes.POJO.ViewModel;
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
    ViewData["Title"] = "系统文件日志";
    Layout = "~/Views/Shared/_Layout.cshtml";
    <style type="text/css">
        .list-content {
            background: #fff;
            border-radius: 6px;
            margin-top: 10px;
            padding: 10px 15px;
            box-shadow: 1px 1px 3px rgb(0 0 0 / 20%);
        }
        .list-ul-li {
            padding: 7px 15px 7px 35px;
        }
    </style>
}
@model IEnumerable<FileLogVM>
<div class="col-sm-12 list-content">
    <div class="layui-collapse" lay-accordion="" style=" border-radius: 6px;">
        @if (Model.Any())
        {
            @foreach (var item in Model)
            {
                <div class="layui-colla-item">
                    <h2 class="layui-colla-title"> @item.DirectoryName</h2>
                    <div class="layui-colla-content layui-show">
                        <ul>
                            @foreach (var file in item.FileNames)
                            {
                                <li class="list-ul-li"><a href="#" style="color: #182adf;text-decoration: revert;" onclick="OpenLog('@item.DirectoryName','@file.FileName')">@file.FileName</a> ---- @file.FileSize</li>
                            }
                        </ul>
                    </div>
                </div>
            }
        }
        else
        {
            <div>暂无数据</div>
        }
    </div>
</div>
@section Scripts
    {
    <script type="text/javascript">
        function OpenLog(directoryName, fileName) {
            layui.use('layer', function () {
                var layer = layui.layer;
                layer.open({
                    type: 2,
                    title: `${directoryName} - ${fileName}`,
                    shadeClose: true,
                    shade: false,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['893px', '600px'],
                    content: `GetFileText?directoryName=${directoryName}&fileLogName=${fileName}`
                });
            });
        }
    </script>
}