Factories.cshtml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. @using ShwasherSys.Authorization.Permissions
  2. @using ShwasherSys.Models.Layout
  3. @using ShwasherSys.Models.Modal
  4. @{
  5. /**/
  6. ViewBag.ActiveMenu = PermissionNames.PagesBasicInfoFactories; //The menu item will be active for this page.
  7. ViewBag.Title = "办公场所信息维护";
  8. // List<SelectListItem> classification = ViewBag.Classification;
  9. var regionInfo = ViewBag.RegionInfo;
  10. }
  11. <div class="table-box mr-4 iwb-bootstrap-table">
  12. @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu })
  13. <table id="table"
  14. data-url="/api/services/app/Factories/GetAll"
  15. data-striped="true" data-id-field="id" data-unique-id="id"
  16. data-method="post"
  17. data-side-pagination="server"
  18. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  19. data-cache="false"
  20. 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"
  21. data-query-params="QueryParams"
  22. data-response-handler="ResponseHandler"
  23. data-click-to-select="true"
  24. data-single-select="true">
  25. <thead>
  26. <tr class="row" id="header">
  27. <th data-field="state" data-checkbox="true"></th>
  28. <th data-align="center" data-field="id">编号</th>
  29. <th data-align="center" data-field="factoryName">办公场所名称</th>
  30. <th data-align="center" data-field="linkMan">联系人</th>
  31. <th data-align="center" data-field="telephone">电话</th>
  32. <th data-align="center" data-field="remark">说明</th>
  33. </tr>
  34. </thead>
  35. </table>
  36. </div>
  37. @section modal{
  38. <section>
  39. <!--Main Modal-->
  40. <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
  41. <div class="modal-dialog modal-dialog-centered" role="document">
  42. <div class="modal-content">
  43. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("办公场所"))
  44. @{
  45. var inputs = new List<InputViewModel>
  46. {
  47. new InputViewModel("id", displayName: "编号"),
  48. new InputViewModel("factoryName", displayName: "办公场所名称"),
  49. new InputViewModel("shortNames", displayName: "缩写名称"),
  50. new InputViewModel("address", displayName: "地址").SetNotRequired(),
  51. new InputViewModel("zip", displayName: "邮编").SetNotRequired(),
  52. new InputViewModel("factoryURL", displayName: "网址").SetNotRequired(),
  53. new InputViewModel("linkMan", displayName: "联系人").SetNotRequired(),
  54. new InputViewModel("telephone", displayName: "电话"),
  55. new InputViewModel("regionID",InputTypes.List, displayName: "所在地区"),
  56. new InputViewModel("remark",InputTypes.Textarea, "说明").SetNotRequired(),
  57. };
  58. //var specials = new List<SpecialInputModel>();
  59. }
  60. @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
  61. @Html.Partial("Modals/_ModalFooter", "0")
  62. </div>
  63. </div>
  64. </div>
  65. </section>
  66. }
  67. @section scripts
  68. {
  69. <script src="~/Content/Plugins/select2/js/select2tree.js"></script>
  70. @*<script src="~/Content/Plugins/kindeditor/kindeditor-all.js"></script>
  71. <script src="~/Content/Plugins/kindeditor/lang/zh-CN.js"></script>*@
  72. <script type="text/javascript">
  73. $(function () {
  74. //show完毕前执行
  75. LoadTable();
  76. var funs = window.funs || { none: function () { console.log("No type"); } };
  77. //funs["btnUpdate"] = function () { BtnUpdate({ readonly: "id" }); };
  78. });
  79. function BtnCreate(url) {
  80. console.log("Create");
  81. abp.ajax({
  82. contentType: 'application/x-www-form-urlencoded',
  83. url: "/api/services/app/Regions/GetRegionSelectStrs",
  84. success: function(res) {
  85. $("#regionID").empty().html(res);
  86. //var url = $($this).data("url") + "";
  87. OpenModal({
  88. modaltitle: window.opCreate,
  89. //data: { ParentNo: "0" },
  90. url: url,
  91. select2tree: "regionID"
  92. });
  93. }
  94. });
  95. }
  96. function BtnUpdate(url) {
  97. console.log("Update");
  98. var row = $("#table").bootstrapTable("getSelections")[0];
  99. if (row) {
  100. abp.ajax({
  101. contentType: 'application/x-www-form-urlencoded',
  102. url: "/api/services/app/Regions/GetRegionSelectStrs",
  103. success: function(res) {
  104. $("#regionID").empty().html(res);
  105. //var url = $($this).data("url") + "";
  106. OpenModal({
  107. modaltitle: window.opUpdate,
  108. data: row,
  109. url: url,
  110. readonly: "id",
  111. select2tree: "regionID"
  112. });
  113. }
  114. });
  115. } else {
  116. abp.message.warn(abp.localization.localize("ChooseOneToOp"));
  117. }
  118. }
  119. </script>
  120. }