threshold.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <!--#include file="/inc/header.html"-->
  2. <style>
  3. .author-nav-tree {
  4. display: inline-block;
  5. width: 200px;
  6. min-height: 400px;
  7. border: 1px solid lightgrey;
  8. float: left;
  9. overflow-x: hidden;
  10. overflow-y: auto;
  11. margin-top: 10px;
  12. }
  13. #con-map {
  14. min-height: 400px;
  15. display: inline-block;
  16. margin-top: 10px;
  17. }
  18. .bif-con {
  19. width: 1200px;
  20. height:500px;
  21. margin-top: 0px;
  22. margin-left: 0px;
  23. float: left;
  24. }
  25. .bif-nav-item {
  26. /* width: 150px; */
  27. text-align: center;
  28. }
  29. </style>
  30. <div class="con-wrap" style="min-height: 400px;">
  31. <!-- <div class="tree-breadcrumb">
  32. <span class="nav-prov">首页</span>&gt;
  33. <span class="nav-prov"><a id="cansgl" href="/pages/basedata/index.html">参数管理</a></span>&gt;
  34. <span class="nav-prov"><a href="javascript:;" id="nav-item-a"></a></span>
  35. </div> -->
  36. <div id="con-map" class="main3" style="margin-top: 0px;overflow:hidden">
  37. <div class="bif-container">
  38. <div class="bif-con panel-noscroll" style="margin-left:0;width:1200px">
  39. <div id="bd-toolbar" style="margin-top: 0;padding: 10px 5px">
  40. 类型:
  41. <select id="bd-type" class="easyui-combobox search-typeOther" editable="false" name="type" style="width:150px;" panelHeight="100">
  42. <option value="0">虫害</option>
  43. <option value="1">结露</option>
  44. <option value="2">温度</option>
  45. <option value="3">验收</option>
  46. </select>&emsp;
  47. 名称:<input class="easyui-textbox easyui-validatebox search-nameOther bd-w-name" name="name" data-options="validType:'length[0,20]'">&emsp;
  48. <a href="javascript:;" class="easyui-linkbutton bd-add-s bd-search">搜索</a>
  49. <a href="#" class="easyui-linkbutton bd-add-s clear-btn2" plain="true">清空</a>
  50. </div>
  51. <div id="base-table">
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="bd-w easyui-window" style="padding-left: 10px" data-options="closed:true">
  58. <form class="bd-w-form" style="margin-top: 12px;">
  59. <input type="hidden" name="id" >
  60. <span class="deviceIn-device-w-t deviceIn-span-first">
  61. <span class="deviceIn-pitem-lit">名称:</span>
  62. <span class="deviceIn-pitem-lic"><input class="easyui-textbox name" editable=false name="name"></span>
  63. </span>
  64. <span class="deviceIn-device-w-t">
  65. <span class="deviceIn-pitem-lit">阀值:</span>
  66. <span class="deviceIn-pitem-lic"><input class="easyui-textbox easyui-validatebox value" data-options="validType:'number',required:true" name="value"></span>
  67. </span>
  68. <span class="deviceIn-device-w-t deviceIn-span-first">
  69. <span class="deviceIn-pitem-lit">备注:</span>
  70. <span class="deviceIn-pitem-lic"><input class="easyui-textbox remark" name="remarks"></span>
  71. </span>
  72. <br/>
  73. <a href="#" class="easyui-linkbutton bd-add-s btn-add-new" plain="true" style="margin-top: 20px;">确定</a>
  74. <a href="javascript:;" class="easyui-linkbutton bd-add-s " onclick="$('.bd-w').window('close');" plain="true" style="margin-top: 20px;">取消</a>
  75. </form>
  76. </div>
  77. <!--#include file="/inc/footer.html"-->
  78. </body>
  79. </html>
  80. <script type="text/javascript">
  81. $(function() {
  82. // var value=["虫害","结露","温度","验收"];
  83. baseData.initNav();
  84. loadData();
  85. search();
  86. $('.clear-btn2').on('click',function(e){
  87. e.preventDefault();
  88. $('.search-typeOther').combobox('clear');
  89. $('.search-nameOther').textbox('clear');
  90. });
  91. });
  92. function loadData(type,name){
  93. var url=config.baseUrl + config.threshold.listPage+"?1=1";
  94. if(type){
  95. url=url+"&type="+type;
  96. }
  97. if(name){
  98. url=url+"&name="+name;
  99. }
  100. $('#base-table').datagrid({
  101. url: url,
  102. method: 'post',
  103. rownumbers: true,
  104. pagination: true,
  105. fitColumns: true,
  106. singleSelect: true,
  107. selectOnCheck: false,
  108. checkOnSelect: false,
  109. toolbar: '#bd-toolbar',
  110. fit: true,
  111. columns: [[
  112. {
  113. field:'type',
  114. title:'类型',
  115. width:'20%',
  116. align: 'center',
  117. formatter: function(value, row, index) {
  118. switch(row.type){
  119. case "0":
  120. return "虫害";
  121. case "1":
  122. return "结露";
  123. case "2":
  124. return "温度";
  125. case "3":
  126. return "验收";
  127. }
  128. }
  129. },
  130. {field:'name', title:'名称', width:'20%',
  131. formatter: function(value,row,index){
  132. if(value=='' || value=='undefined' || value==null || value=='null'){
  133. }else{
  134. return '<span title='+value+'>'+value+'</span>';
  135. }
  136. }},
  137. {field:'value', title:'阀值', width:'20%',
  138. formatter: function(value,row,index){
  139. if(value=='' || value=='undefined' || value==null || value=='null'){
  140. }else{
  141. return '<span title='+value+'>'+value+'</span>';
  142. }
  143. }},
  144. {field:'remarks', title:'备注', width:'20%',
  145. formatter: function(value,row,index){
  146. if(value=='' || value=='undefined' || value==null || value=='null'){
  147. }else{
  148. return '<span title='+value+'>'+value+'</span>';
  149. }
  150. }},
  151. {
  152. field:'id',
  153. title:'操作',
  154. width:'15%',
  155. align: 'center',
  156. formatter: function(value, row, index) {
  157. return '<a class="record_record_update t-update" data-id=' + row.id + '>更新</a>';
  158. }
  159. }
  160. ]],
  161. loadFilter: function(e) {
  162. return {
  163. total: e.data.count,
  164. rows: e.data.list
  165. };
  166. },
  167. onLoadSuccess: function() {
  168. // base.delInfo('.iso-noticeMag-del', config.noticeMag.toDelete, '#noticeMag-info');
  169. update();
  170. }
  171. });
  172. }
  173. function update(){
  174. $(".record_record_update").off("click").on("click",function(){
  175. // e.preventDefault();
  176. //渲染window窗口
  177. base.renderwindow('.bd-w', {
  178. width: 750,
  179. height: 300,
  180. top: 50,
  181. title: '修改阀值'
  182. });
  183. // e.preventDefault();
  184. // base.renderwindow('.bd-w',
  185. // {
  186. // title: '修改阀值',
  187. // width: 450,
  188. // height: 250,
  189. // });
  190. var id=$(this).data('id');
  191. $('.bd-w').window('open');
  192. //将id的值绑定到确认按钮上
  193. base.ajaxFunc('get', config.threshold.getById, {id: id}, function(e) {
  194. var row = e.obj;
  195. $('.bd-w-form').form("clear").form('load',row);
  196. //当鼠标移动到文本框时显示该文本框的信息内容
  197. $(".bd-w-form input,textarea").each(function(i) {
  198. var str=$(this).val();
  199. $(this).attr("title", $(this).val());
  200. });
  201. doupdate();
  202. });
  203. });
  204. }
  205. function doupdate(){
  206. $(".btn-add-new").off().on("click",function(){
  207. var data = $('.bd-w-form').serializeArray();
  208. var valresult=$(".bd-w-form").form('validate');
  209. if(!valresult){
  210. $.messager.alert('提示', base.tooltip, 'info');
  211. return;
  212. }
  213. base.ajaxFunc('post', config.threshold.toUpdate, data, function(e) {
  214. base.requestTip(e, '.bd-w', '#base-table', 0);
  215. });
  216. });
  217. }
  218. function search(){
  219. $(".bd-search").off("click").on("click",function(){
  220. if(!$('.search-nameOther').textbox('isValid')) return;
  221. var type = $('.search-typeOther').combobox('getValue');
  222. var name = $('.search-nameOther').textbox('getValue');
  223. loadData(type,name);
  224. });
  225. }
  226. </script>