RemoveMeterForm.cshtml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. @{
  2. ViewBag.Title = "Form";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <style type="text/css">
  6. .ui-select .ui-select-text {
  7. margin-bottom: 5px;
  8. }
  9. fieldset {
  10. padding: .35em .625em .75em;
  11. margin: 0 2px;
  12. border: 1px solid silver;
  13. }
  14. legend {
  15. padding: .5em;
  16. border: 0;
  17. width: auto;
  18. }
  19. </style>
  20. <script type="text/javascript">
  21. var meterId = request('keyValue');
  22. var AreaName = $.currentIframe().$("#pointGridTable").jqGridRowValue("AreaName");
  23. var BldgName = $.currentIframe().$("#pointGridTable").jqGridRowValue("BldgName");
  24. var ApmtName = $.currentIframe().$("#pointGridTable").jqGridRowValue("ApmtName");
  25. var RoomName = $.currentIframe().$("#pointGridTable").jqGridRowValue("RoomName");
  26. var data = {};
  27. data.AreaName = AreaName;
  28. data.BldgName = BldgName;
  29. data.ApmtName = ApmtName;
  30. data.RoomName = RoomName;
  31. $(function () {
  32. initControl();
  33. });
  34. //初始化控件
  35. function initControl() {
  36. //小区
  37. $("#AreaId").ComboBox({
  38. url: "/NBManage/NBHistorySearch/GetAreaListJson",
  39. id: "AreaId",
  40. text: "AreaName",
  41. description: "选择小区",
  42. height: "100px"
  43. }).bind("change", function () {
  44. value = $(this).attr('data-value');
  45. SetComboxInit("BldgId", "选择楼宇");
  46. SetComboxInit("ApmtId", "选择单元");
  47. SetComboxInit("RoomId", "选择房间");
  48. $("#BldgId").ComboBox({
  49. url: "/NBManage/NBHistorySearch/GetBldgListJson",
  50. param: { parentId: value },
  51. id: "BldgId",
  52. text: "BldgName",
  53. description: "选择楼宇",
  54. height: "100px"
  55. }).bind("change", function () {
  56. value = $(this).attr('data-value');
  57. SetComboxInit("ApmtId", "选择单元");
  58. SetComboxInit("RoomId", "选择房间");
  59. $("#ApmtId").ComboBox({
  60. url: "/NBManage/NBHistorySearch/GetApmtListJson",
  61. param: { parentId: value },
  62. id: "ApmtId",
  63. text: "ApmtName",
  64. description: "选择单元",
  65. height: "100px"
  66. }).bind("change", function () {
  67. value = $(this).attr('data-value');
  68. SetComboxInit("RoomId", "选择房间");
  69. $("#RoomId").ComboBox({
  70. url: "/NBManage/NBHistorySearch/GetRoomListJson",
  71. param: { parentId: value },
  72. id: "RoomID",
  73. text: "RoomName",
  74. description: "选择房间",
  75. height: "100px"
  76. });
  77. });
  78. })
  79. });
  80. function SetComboxInit(domId, text) {
  81. $("#" + domId).removeAttr('data-value');
  82. $("#" + domId).removeAttr('data-text');
  83. $("#" + domId + " .ui-select-text").text(text);
  84. $("#" + domId).ComboBoxTree({
  85. height: "100px"
  86. })
  87. }
  88. $("#RoomId").ComboBox({
  89. description: "选择房间",
  90. height: "100px"
  91. })
  92. $("#ApmtId").ComboBox({
  93. description: "选择单元",
  94. height: "100px"
  95. })
  96. $("#BldgId").ComboBox({
  97. description: "选择楼宇",
  98. height: "100px"
  99. })
  100. if (meterId) {
  101. $("#form1").SetWebControls(data);
  102. }
  103. }
  104. //保存表单
  105. function AcceptClick() {
  106. if (!$('#form2').Validform()) {
  107. return false;
  108. }
  109. var postData = $("#form2").GetWebControls();
  110. //postData 格式化 将&nbsp; 替换为 ""
  111. for (var i in postData) {
  112. if (postData[i] == "&nbsp;") {
  113. postData[i] = "";
  114. }
  115. }
  116. $.SaveForm({
  117. url: "/NBManage/NBUserManage/SaveMeterRemove",
  118. param: { "meterId": meterId, "jsonData": JSON.stringify(postData) },
  119. loading: "正在保存数据...",
  120. success: function () {
  121. $.currentIframe().$("#pointGridTable").resetSelection();
  122. $.currentIframe().$("#pointGridTable").trigger("reloadGrid");
  123. }
  124. })
  125. }
  126. </script>
  127. <div style="margin-left: 10px; margin-top: 20px; margin-right: 30px;">
  128. <fieldset>
  129. <legend>
  130. <i class="fa fa-edit"></i>&nbsp;旧位置
  131. </legend>
  132. <table id="form1" class="form">
  133. <tr>
  134. <td class="formValue" colspan="3">
  135. <input id="AreaName" type="text" class="form-control" readonly style="float: left; width: 24%; margin-right: 3px;" />
  136. <input id="BldgName" type="text" class="form-control" readonly style="float: left; width: 24%; margin-right: 3px;" />
  137. <input id="ApmtName" type="text" class="form-control" readonly style="float: left; width: 24%; margin-right: 3px;" />
  138. <input id="RoomName" type="text" class="form-control" readonly style="float: left; width: 24%; margin-right: 3px;" />
  139. </td>
  140. </tr>
  141. </table>
  142. </fieldset>
  143. <input type="hidden" id="MeterId" />
  144. <fieldset>
  145. <legend>
  146. <i class="fa fa-edit"></i>&nbsp;新位置
  147. </legend>
  148. <table id="form2" class="form">
  149. <tr>
  150. <td class="formValue" colspan="3">
  151. <div id="queryCondition">
  152. <div id="AreaId" type="select" class="ui-select" style="float: left; width: 24%; margin-right: 3px;" isvalid="yes" checkexpession="NotNull" ></div>
  153. <div id="BldgId" type="select" class="ui-select" style="float: left; width: 24%; margin-right: 3px;" isvalid="yes" checkexpession="NotNull" ></div>
  154. <div id="ApmtId" type="select" class="ui-select" style="float: left; width: 24%; margin-right: 3px;" isvalid="yes" checkexpession="NotNull" ></div>
  155. <div id="RoomId" type="select" class="ui-select" style="float: left; width: 24%; margin-right: 3px;" isvalid="yes" checkexpession="NotNull" ></div>
  156. </div>
  157. </td>
  158. </tr>
  159. </table>
  160. </fieldset>
  161. </div>