setting_poweruser_state.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="X-UA-Compatible" content="IE=8" />
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>企业状态设置</title>
  7. <link rel="stylesheet" type="text/css" href="http://static.vbdsm.com/js/lib/easyui/themes/vber/easyui.css" />
  8. <link rel="stylesheet" type="text/css" href="http://static.vbdsm.com/js/lib/easyui/themes/icon.css" />
  9. <script type="text/javascript" src="http://static.vbdsm.com/js/lib/jquery-1.8.0.min.js"></script>
  10. <script type="text/javascript" src="http://static.vbdsm.com/js/lib/highcharts/highcharts.js"></script>
  11. <script type="text/javascript" src="http://static.vbdsm.com/js/lib/easyui/jquery.easyui.min.js"></script>
  12. <script type="text/javascript" src="http://static.vbdsm.com/js/lib/easyui/locale/easyui-lang-zh_CN.js"></script>
  13. <script type="text/javascript" src="http://static.vbdsm.com/js/lib/loadmask/jquery.loadmask.min.js"></script>
  14. <script type="text/javascript" src="http://static.vbdsm.com/js/static.support.js"></script>
  15. <script type="text/javascript" src="http://static.vbdsm.com/js/easyui.support.js"></script>
  16. <script type="text/javascript" src="http://static.vbdsm.com/js/common.tools.js"></script>
  17. <script type="text/javascript" src="http://static.vbdsm.com/js/util.js"></script>
  18. <style type="text/css">
  19. body * {
  20. font-family: "微软雅黑";
  21. font-size: 12px;
  22. }
  23. .w120 {
  24. width: 120px;
  25. }
  26. </style>
  27. <script type="text/javascript" charset="UTF-8"></script>
  28. </head>
  29. <body style="margin: 10">
  30. <div style="width: 100%; height: 100%">
  31. <table style="width: 500px">
  32. <tr>
  33. <td>连续时长:</td>
  34. <td><input type="text" id="duration" class="w120" /> 天</td>
  35. </tr>
  36. <tr>
  37. <td>正常在线率:</td>
  38. <td><input type="text" id="startNormal" class="w120" /> (%) &nbsp;&nbsp;-&nbsp;&nbsp; <input type="text" id="endNormal" class="w120" /> (%)</td>
  39. </tr>
  40. <tr>
  41. <td>半停产在线率:</td>
  42. <td><input type="text" id="startHalfStop" class="w120" /> (%) &nbsp;&nbsp;-&nbsp;&nbsp; <input type="text" id="endHalfStop" class="w120" /> (%)</td>
  43. </tr>
  44. <tr>
  45. <td>停产在线率:</td>
  46. <td><input type="text" id="startStop" class="w120" /> (%) &nbsp;&nbsp;-&nbsp;&nbsp; <input type="text" id="endStop" class="w120" /> (%)</td>
  47. </tr>
  48. <tr align="left">
  49. <td colspan="2" style="padding-top: 10px">
  50. <a href="javascript:void(0)" onclick="javascript: return update();" id="btn-save" icon="icon-save">保存</a>
  51. </td>
  52. </tr>
  53. </table>
  54. </div>
  55. <script>
  56. $("#btn-save").linkbutton()
  57. $(function () {
  58. ajax({
  59. url: "/web/poweruserState/getData.json",
  60. type: "post",
  61. dataType: "json",
  62. success: function (json) {
  63. if (json.data != null) {
  64. var data = json.data
  65. $("#duration").val(data.duration)
  66. $("#startNormal").val(data.startNormal)
  67. $("#endNormal").val(data.endNormal)
  68. $("#startHalfStop").val(data.startHalfStop)
  69. $("#endHalfStop").val(data.endHalfStop)
  70. $("#startStop").val(data.startStop)
  71. $("#endStop").val(data.endStop)
  72. }
  73. },
  74. })
  75. })
  76. //保存
  77. function update() {
  78. confirm("警告", "确认要修改吗?", function (data) {
  79. if (data) {
  80. var duration = $("#duration").val()
  81. var startNormal = $("#startNormal").val()
  82. var endNormal = $("#endNormal").val()
  83. var startHalfStop = $("#startHalfStop").val()
  84. var endHalfStop = $("#endHalfStop").val()
  85. var startStop = $("#startStop").val()
  86. var endStop = $("#endStop").val()
  87. if (validate(duration) && validate(startNormal) && validate(endNormal) && validate(startHalfStop) && validate(endHalfStop) && validate(startStop) && validate(endStop)) {
  88. var jsonData = {}
  89. jsonData.duration = duration
  90. jsonData.startNormal = startNormal
  91. jsonData.endNormal = endNormal
  92. jsonData.startHalfStop = startHalfStop
  93. jsonData.endHalfStop = endHalfStop
  94. jsonData.startStop = startStop
  95. jsonData.endStop = endStop
  96. ajax({
  97. url: "/web/poweruserState/modify.json",
  98. type: "post",
  99. dataType: "json",
  100. data: jsonData,
  101. success: function (json) {
  102. alert(json.msg)
  103. },
  104. })
  105. } else {
  106. alert("请检查输入数据的准确性,不能为空!")
  107. return false
  108. }
  109. }
  110. })
  111. }
  112. //文本框验证
  113. function validate(value) {
  114. if (value == "" || value == null) {
  115. return false
  116. } else {
  117. if (isNaN(value)) {
  118. return false
  119. } else {
  120. return true
  121. }
  122. }
  123. }
  124. </script>
  125. </body>
  126. </html>