Index.cshtml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. @using MES.Production.Service;
  2. @using Central.Control.Domain;
  3. @using Ant.Service.Common;
  4. @using CommonToolHelper;
  5. @{
  6. ViewBag.Title = "Index";
  7. Layout = "~/Views/Shared/_Layout.cshtml";
  8. var codelist = ViewData["codelist"] as List<SYS_CODE>;
  9. }
  10. @model PageInfo<COM_CUSCONTACT>
  11. <!-- table star -->
  12. <div class="row col-lg-12">
  13. <div class="wrapper wrapper-content animated fadeInUp">
  14. <div class="ibox">
  15. <div class="ibox-title">
  16. <h5>我的通讯录</h5>
  17. <div class="ibox-tools rboor">
  18. <a class="btn btn-primary btn-xs p310" id="insert"><i class="im-plus"></i> 新增</a>
  19. <a class="btn btn-primary btn-xs p310" id="modify"><i class="im-pencil2"></i> 编辑</a>
  20. <a class="btn btn-primary btn-xs p310" id="delete" action="remove"><i class="im-remove4"></i> 删除</a>
  21. </div>
  22. </div>
  23. <div class="ibox-content">
  24. <!-- search star -->
  25. @using (Ajax.BeginForm("Index", null, new AjaxOptions() { }, new { @id = "form1", @class = "form-horizontal", @method = "get" }))
  26. {
  27. <div class="form-horizontal clearfix">
  28. <div class="col-lg-4 col-sm-3 pl0" style="width:50%;">
  29. <div class="form-group">
  30. <label class="control-label" style="width:100px; float:left;">客户类别:</label>
  31. <div class="col-lg-8 col-sm-7" style="width:150px !important;">
  32. <select id="code" name="code" class="input-sm form-control input-s-sm inline" style="width:auto;" onchange="submit()">
  33. <option value="" @(ViewData["code"].ToString() == "" ? "selected=\"selected\"" : "")>全部</option>
  34. @{
  35. foreach (var item in codelist)
  36. {
  37. <option value="@item.ID" @(ViewData["code"].ToString() == item.ID.ToString() ? "selected=\"selected\"" : "")>@item.NAMETEXT</option>
  38. }
  39. }
  40. </select>
  41. </div>
  42. <label class="control-label" style="width:50px; float:left;">性别:</label>
  43. <div class="col-lg-8 col-sm-7" style="width:120px !important;">
  44. <select id="sex" name="sex" class="input-sm form-control input-s-sm inline" onchange="submit()">
  45. <option value="" @(ViewData["sex"].ToString() == "" ? "selected" : "")>全部</option>
  46. <option value="1" @(ViewData["sex"].ToString() == "1" ? "selected" : "")>男</option>
  47. <option value="0" @(ViewData["sex"].ToString() == "0" ? "selected" : "")>女</option>
  48. </select>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="col-lg-4 col-sm-4" style="float:right;">
  53. <div class="form-group">
  54. <div class="col-lg-12 col-sm-12 input-group">
  55. @Html.TextBox("Search", null, new { @class = "input-sm form-control", @placeholder = "请输入查询关键词" })
  56. <span class="input-group-btn">
  57. <button type="button" onclick="submit()" class="btn btn-sm btn-primary"> 搜索</button>
  58. </span>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <!-- search end -->
  64. <div id="example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  65. <table id="example" class="table table-striped table-bordered table-hover dataTables-example dataTable" cellspacing="0" width="100%">
  66. <thead>
  67. <tr>
  68. <th class="tn" style="padding: 10px 5px !important;width:50px !important;"><input name="checkall" id="checkall" type="checkbox" value=""></th>
  69. <th>类型</th>
  70. <th>姓名</th>
  71. <th>性别</th>
  72. <th>手机号</th>
  73. <th>固话</th>
  74. <th>QQ</th>
  75. <th>公司名称</th>
  76. </tr>
  77. </thead>
  78. <tbody>
  79. @{foreach (var item in Model.List)
  80. {
  81. <tr>
  82. <td class="tn"><input name="checkbox_name" type="checkbox" value="@item.ID"></td>
  83. <td>
  84. @{var it = codelist.Find(p => p.ID.ToString() == item.FK_TYPE);
  85. if (it != null)
  86. {
  87. @Html.Raw(it.NAMETEXT);
  88. }
  89. }
  90. </td>
  91. <td><a href="javascript:Show('@item.ID')"> @item.NAME</a></td>
  92. <td>@(item.SEX == 0 ? "女" : "男")</td>
  93. <td>@item.PHOME</td>
  94. <td>@item.TELNO</td>
  95. <td>@item.QQ</td>
  96. <td>@item.COMPANY</td>
  97. </tr>
  98. }
  99. }
  100. </tbody>
  101. </table>
  102. <!-- page -->
  103. <div class="bottom">
  104. <div class="dataTables_info" id="example_info" post="status" aria-live="polite">显示第 @Model.BeginPage 至 @Model.EndPage 项结果,共 @Model.Count 项</div>
  105. <div class="dataTables_length" id="example_length">
  106. <label>
  107. 显示
  108. <select name="example_length" onchange="submit()" aria-controls="example" class="form-control input-sm">
  109. <option value="10" @(Model.PageSize == 10 ? "selected" : "")>10</option>
  110. <option value="25" @(Model.PageSize == 25 ? "selected" : "")>25</option>
  111. <option value="50" @(Model.PageSize == 50 ? "selected" : "")>50</option>
  112. <option value="100" @(Model.PageSize == 100 ? "selected" : "")>100</option>
  113. </select> 项结果
  114. </label>
  115. </div>
  116. @CommonHtmlHelper.PaginationPager(Model.Index, Model.PageSize, Model.Count, 7, Model.Url)
  117. <div class="clear"></div>
  118. </div>
  119. <!-- page -->
  120. </div>
  121. }
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <!-- table end -->
  127. @section scripts{
  128. <script type="text/javascript">
  129. //列表增加
  130. $("#insert").click(function () {
  131. dig.addModel('添加/编辑模块', "/Com/CusContact/Detail", 750, 700, function () {
  132. if (this.returnValue == 'yes') {
  133. location.reload();
  134. }
  135. });
  136. });
  137. //列表选择修改
  138. $('#modify').click(function () {
  139. var vals = '';
  140. var num = 0;
  141. $('input[name="checkbox_name"]:checked').each(function () {
  142. vals = $(this).val();
  143. num++;
  144. });
  145. if (!vals) {
  146. dig.alertError("提示", "对不起,请选中您要操作的记录!");
  147. return;
  148. }
  149. if (num > 1) {
  150. dig.alertError("提示", "对不起,每次只能修改一条记录!");
  151. return;
  152. }
  153. dig.addModel("添加/编辑模块", "/Com/CusContact/Detail/" + vals, 700, 450, function () {
  154. if (this.returnValue == 'yes') {
  155. location.reload();
  156. }
  157. });
  158. });
  159. //点击详情
  160. function Show(n) {
  161. dig.addModel('查看', "/Com/CusContact/Detail/" + n, 700, 450, function () {
  162. if (this.returnValue == 'yes') {
  163. location.reload();
  164. }
  165. });
  166. };
  167. </script>
  168. }