Customers.cshtml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. @using ShwasherSys.Authorization.Permissions
  2. @using ShwasherSys.Models.Layout
  3. @using ShwasherSys.Models.Modal
  4. @{
  5. /**/
  6. ViewBag.ActiveMenu = PermissionNames.PagesCustomerInfoCustomers; //The menu item will be active for this page.
  7. ViewBag.Title = "客户基础信息维护";
  8. List<SelectListItem> saleTypeItems = ViewBag.SaleType;
  9. var searchForm = new SearchFormViewModal(new List<SearchItem>()
  10. {
  11. new SearchItem("id", "客户编号"),
  12. new SearchItem("customerName", "客户名称"),
  13. new SearchItem("saleType", "销售类型",FiledType.Inull,ExpType.Equal).SetSearchItem(saleTypeItems),
  14. });
  15. }
  16. <div class="table-box mr-4 iwb-bootstrap-table">
  17. @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu, searchForm })
  18. <table id="table"
  19. data-url="/api/services/app/Customers/GetAll"
  20. data-striped="true" data-id-field="id" data-unique-id="id"
  21. data-method="post"
  22. data-side-pagination="server"
  23. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  24. data-cache="false"
  25. data-pagination="true" data-page-size="30" data-page-number="1" data-page-list="[30,50,100,200]" data-pagination-detail-h-align="right" data-pagination-h-align="left"
  26. data-query-params="QueryParams"
  27. data-response-handler="ResponseHandler"
  28. data-click-to-select="true"
  29. data-single-select="true">
  30. <thead>
  31. <tr class="row" id="header">
  32. <th data-field="state" data-checkbox="true"></th>
  33. <th data-align="center" data-field="id">客户编号</th>
  34. <th data-align="center" data-field="customerName">客户名称</th>
  35. <th data-align="center" data-field="fax">传真电话</th>
  36. <th data-align="center" data-field="linkMan">联系人</th>
  37. <th data-align="center" data-field="telephone">联系电话</th>
  38. <th data-align="center" data-field="saleType" data-formatter="SaleTypeFormatter">客户类型</th>
  39. <th data-align="center" data-formatter="ActionsFormatter"></th>
  40. </tr>
  41. </thead>
  42. </table>
  43. </div>
  44. @section modal{
  45. <section>
  46. <!--Main Modal-->
  47. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  48. <div class="modal-dialog modal-dialog-centered" role="document">
  49. <div class="modal-content">
  50. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("客户"))
  51. @{
  52. var inputs = new List<InputViewModel>
  53. {
  54. new InputViewModel("id", displayName: "客户编号"),
  55. new InputViewModel("customerName", displayName: "客户名称"),
  56. new InputViewModel("saleType",InputTypes.List,displayName: "客户类型").SetSelectOptions(saleTypeItems),
  57. new InputViewModel("linkMan", displayName: "联系人").SetNotRequired(),
  58. new InputViewModel("telephone", displayName: " 电话").SetNotRequired(),
  59. new InputViewModel("fax", displayName: "传真").SetNotRequired(),
  60. new InputViewModel("zip", displayName: "邮编").SetNotRequired(),
  61. new InputViewModel("email",displayName: "电子邮件").SetNotRequired(),
  62. new InputViewModel("webSite", displayName: "网址").SetNotRequired(),
  63. new InputViewModel("address", displayName: "地址").SetNotRequired(),
  64. };
  65. //var specials = new List<SpecialInputModel>();
  66. }
  67. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  68. @Html.Partial("Modals/_ModalFooter", "0")
  69. </div>
  70. </div>
  71. </div>
  72. </section>
  73. }
  74. @section scripts
  75. {
  76. <script type="text/javascript">
  77. $(function () {
  78. //show完毕前执行
  79. LoadTable();
  80. var funs = window.funs || { none: function () { console.log("No type"); } };
  81. funs["btnUpdate"] = function () { BtnUpdate({ readonly: "id" }); };
  82. });
  83. function ActionsFormatter(v, r) {
  84. var str = '<span class="table-action" onclick="ShowDetail(\'' +
  85. r.id +
  86. '\')"><i class="iconfont icon-right"></i>客户详情</span>';
  87. return str;
  88. }
  89. function ShowDetail(id) {
  90. window.location.href = "CustomerDetail/" + id;
  91. }
  92. function SaleTypeFormatter(v, r) {
  93. console.log(v);
  94. var saleType = $('#modal #saleType option[value="' + v + '"]').html();
  95. //console.log( $('#modal #saleType option[value="' + v + '"]'));
  96. return '<span class="table-action")>'+saleType+'</span>';
  97. }
  98. </script>
  99. }