DeviceForm.cshtml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. @{
  2. ViewBag.Title = "表设备管理";
  3. Layout = "~/Views/Shared/_Form.cshtml";
  4. }
  5. <script>
  6. var keyValue = request('keyValue');
  7. $(function () {
  8. initControl();
  9. })
  10. //初始化控件
  11. function initControl() {
  12. //厂商编号
  13. $("#ManufacturerCode").ComboBoxTree({
  14. url: "/PipeNetworkManage/Meter/GetManufacturerCode",
  15. id: "ItemValue",
  16. text: "ItemName",
  17. description: "==请选择==",
  18. height: "200px"
  19. });
  20. $("#SecondaryWaterSupplyId").val(keyValue == "" ? "0" : keyValue);
  21. //获取表单
  22. if (!!keyValue) {
  23. $.SetForm({
  24. url: "/SecondaryWaterSupply/Device/GetDeviceById",
  25. param: { deviceId: keyValue },
  26. success: function (data) {
  27. $("#form1").SetWebControls(data);
  28. }
  29. });
  30. }
  31. }
  32. //保存表单
  33. function AcceptClick() {
  34. if (!$('#form1').Validform()) {
  35. return false;
  36. }
  37. var postData = $("#form1").GetWebControls(keyValue);
  38. //postData 格式化 将&nbsp; 替换为 ""
  39. for (var i in postData) {
  40. if (postData[i] == "&nbsp;") {
  41. postData[i] = "";
  42. }
  43. }
  44. $.SaveForm({
  45. url: "/SecondaryWaterSupply/Device/SaveDevice?keyValue=" + keyValue,
  46. param: { "keyValue": keyValue, "strDevice": JSON.stringify(postData) },
  47. loading: "正在保存数据...",
  48. success: function () {
  49. $.currentIframe().$("#gridTable").resetSelection();
  50. $.currentIframe().$("#gridTable").trigger("reloadGrid");
  51. }
  52. })
  53. };
  54. // 调出百度地图
  55. // 添加
  56. function btnMap() {
  57. dialogOpen({
  58. id: "BaiduMap",
  59. title: '添加测点',
  60. url: '/SecondaryWaterSupply/Device/BaiduMap',
  61. width: "1100px",
  62. height: "700px",
  63. callBack: function (iframeId) {
  64. top.frames[iframeId].AcceptClick(function callback(result) {
  65. $("#Longitude").val(result.split('|')[0]);
  66. $("#Latitude").val(result.split('|')[1]);
  67. });
  68. }
  69. });
  70. }
  71. </script>
  72. <style type="text/css">
  73. .form .formTitle {
  74. width: 80px;
  75. }
  76. </style>
  77. <div style="margin-left: 10px; margin-top: 20px; margin-right: 30px;">
  78. <table class="form">
  79. <tr>
  80. <th class="formTitle">泵房名称<font face="宋体">*</font></th>
  81. <td class="formValue" colspan="3">
  82. <input id="PumpHouseName" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" errormsg="泵房名称不能为空" placeholder="请输入泵房名称" />
  83. </td>
  84. </tr>
  85. <tr>
  86. <input id="SecondaryWaterSupplyId" class="form-control" type="hidden" />
  87. <th class="formTitle">泵站编码<font face="宋体">*</font></th>
  88. <td class="formValue" colspan="3">
  89. <input id="PumpingStationNumber" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" errormsg="泵站编码不能为空" placeholder="请输入泵站编码" />
  90. </td>
  91. </tr>
  92. <tr>
  93. <th class="formTitle">厂商编码<font face="宋体">*</font></th>
  94. <td class="formValue" colspan="3">
  95. <div id="ManufacturerCode" type="select" class="ui-select" isvalid="yes" checkexpession="NotNull" errormsg="请选择厂商编码">
  96. </div>
  97. </td>
  98. </tr>
  99. <tr>
  100. <th class="formTitle">经纬度</th>
  101. <td class="formValue">
  102. <input id="Longitude" type="text" class="form-control" readonly/>
  103. </td>
  104. <td>
  105. <input id="Latitude" type="text" class="form-control" readonly/>
  106. </td>
  107. <td>
  108. &nbsp;&nbsp;
  109. <a id="lr-add" class="btn btn-primary " onclick="btnMap()"><i class="fa fa-plus"></i>&nbsp;地图</a>
  110. </td>
  111. </tr>
  112. </table>
  113. </div>