@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; } @model PagedList<Department> <div class="row-fluid"> <div class="span4"> <div> </div> </div> <div class="span8"> @using (Html.BeginForm(null, null, null, FormMethod.Get, new { id = "search" })) { <div class="dataTables_filter"> <label> <button type="submit" class="btn">搜索 <i class="icon-search"></i></button> </label> <label> <span>手机:</span> @Html.TextBox("Mobile", null, new { @class = "m-wrap small" }) </label> <label> <span>姓名:</span> @Html.TextBox("LoginName", null, new { @class = "m-wrap small" }) </label> </div> } </div> </div> <div class="row-fluid"> <div class="span12"> @using (Html.BeginForm("ExportExcel", "User", null, FormMethod.Post, new { id = "ExportForm" })) { <div class="dataTables_filter"> <label> <button class="btn" id="Export" data-target="userDiv" data-file="用户列表">导出Excel <i class="icon-signout"></i></button> </label> <input type="hidden" name="ExportContent" /> <input type="hidden" name="ExportFileName" /> </div> } </div> </div> @{ foreach (Department s in Model) { <div id="[email protected]" onclick="showdiv(this)"> <table class="table table-striped table-hover table-bordered" id="userDiv"> <thead> <tr> <th class="hidden-480" style="text-align: left"> @s.Name </th> </tr> </thead> </table> </div> <div @*id="@s.ID"*@ id="[email protected]" class="trhidd" style="display:none"> <table class="table table-striped table-hover table-bordered"> <thead> <tr> <th class="hidden-480">序号</th> <th class="hidden-480">姓名</th> <th class="hidden-480">月任务</th> <th class="hidden-480">目前完成度</th> <th class="hidden-480">其他</th> <th class="hidden-480">操作</th> </tr> </thead> @{ var db = new BaseDbContext(); List<User> us = db.Users.Where(p => p.DepartmentID == s.ID).ToList(); if (us.Count>0) { foreach (var uss in us) { decimal prop = 0; var dbContent = new CrmDbContext(); crm_MonthPlanDetails monpd = dbContent.MonthPlanDetailss.Where(p => p.UserID == uss.ID).FirstOrDefault(); if (monpd!=null) { decimal pro = monpd.FirstWeekDegree + monpd.SecondWeekDegree + monpd.ThirdWeekDegree + monpd.FourthWeekDegree; prop = (pro / monpd.MonthPlan)*100; } <tbody> <tr> <td style="text-align: center" class="hidden-480">@(us.IndexOf(uss) + 1)</td> <td style="text-align: center" class="hidden-480">@uss.RemarkName</td> @if (monpd != null) { <td style="text-align: center" class="hidden-480">@monpd.MonthPlan</td> } else { <td style="text-align: center" class="hidden-480">0</td> } <td style="text-align: center" class="hidden-480"> @if (monpd!=null) { @Html.TextBox("wanchengdu", prop.ToString("f2"), "", new {@readonly=true }) <span>%</span> } else { @Html.TextBox("wanchengdu", 0, "", new {@readonly=true }) <span>%</span> } </td> <td style="text-align: center" class="hidden-480">其他</td> <td style="text-align: center" class="hidden-480"> <a class="btn mini purple thickbox" title=‘查看详细信息‘ href="@Url.Action("Select", new { id = uss.ID })?TB_iframe=true&height=700&width=600"> <i class="icon-edit"></i> 查看 </a> </td> </tr> </tbody> } } } </table> </div> } } <div class="dataTables_paginate paging_bootstrap pagination" style="margin-bottom:10px"> @Html.Pager(Model, new PagerOptions() { ShowTotalItemCount = true }) </div> @section PageSpecificStyleSheetIncludes{ } @section PageSpecificJavascriptIncludes{ <script src="~/Assets/js/jquery-1.8.3.min.js"></script> <script type="text/javascript"> //$(document).ready(function () //{ // $(this).click(function () // { // //var a = new Array(); // //$(".trhidd").each(function (key,id) // //{ // // var id = $(this).attr("id"); // // id = $(this).data("id"); // // a[key] = id; // // alert(a[key]); // //}); // //for (var i = 0; i < a.length; i++) { // // alert(a[i]); // // $(a[i]).slideToggle("slow"); // //} // var id = $(this).data("id"); // alert(id); // $(".trhidd").slideToggle("slow"); // }) //}) function showdiv(div) { var a = div.id; var c = ("b-" + a); $("#"+c+"").slideToggle("fast") } </script> }
时间: 2024-10-24 01:27:13