index.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>TODO supply a title</title>
  5. {include file="../application/manage/view/commons/headers.html" }
  6. <script >
  7. // 编辑窗口
  8. var $editWin;
  9. $(function(){
  10. $editWin = $('#edit-window').window({
  11. title: '关键词编辑',
  12. width: 820,height: 500,
  13. top: ($(window).height() -500 ) /2 ,
  14. left: ($(window).width() -820 ) /2 ,
  15. shadow: true,modal: true,
  16. iconCls: 'icon-edit',closed: true,
  17. minimizable: false,maximizable: false,collapsible: false
  18. });
  19. })
  20. function commandsFormatter(id,row){
  21. var cmdEdit="<a href='#' onclick=\"javascript:showEditWin('"+row.id+"');\" >编辑</a>&nbsp;";
  22. if(row.status == 0){
  23. cmdEdit+="<a href='#' onclick=\"javascript:deleteRow('"+row.id+"');\" >删除</a>";
  24. }
  25. return cmdEdit;
  26. }
  27. function delstatusFormatter(mode){
  28. if(mode == '1'){ return "屏蔽";
  29. }else if(mode=="0"){ return "正常";
  30. }else{ return "--";
  31. }
  32. }
  33. function delstatusFormatter(mode){
  34. if(mode == '1'){ return "屏蔽";
  35. }else if(mode=="0"){ return "正常";
  36. }else{ return "--";
  37. }
  38. }
  39. $(function(){
  40. var height=$(document).height();
  41. $("#dg").height(height);
  42. $('#dg').datagrid({
  43. url:'/manage/examproject/datas',
  44. idField:'id',method: 'get',rownumbers: true,showFooter: true,singleSelect:true,selectOnCheck:false,
  45. toolbar: '#tb',fitColumns:true,pageSize:dgRowSize,pagination:true,pageList: [dgRowSize,dgRowSize*2,100],
  46. columns:[[
  47. {field:'id',title:'ID',width:180 ,hidden:true },
  48. {field:'exam_class_id',title:'父类',width:"24%",align: 'center',hidden:true},
  49. {field:'class_name',title:'检查类别',width:"24%",align: 'center'},
  50. {field:'name',title:'检查项目',align: 'center',width:"40%"},
  51. {field:'status',title:'删除状态',width:"20%",align: 'center',formatter:delstatusFormatter },
  52. {field:'grid_commands',title:'操作',align: 'center',width:240, formatter:commandsFormatter },
  53. ]],
  54. onDblClickRow :function(rowData){
  55. showEditWin(rowData.id);
  56. },
  57. });
  58. });
  59. function reload(){
  60. var institution_id=$("#institution_id").combotree("getValue");
  61. var class_id=$("#class_id").combobox("getValue");
  62. var name=$("#name").textbox("getValue");
  63. var queryParams = $('#dg').datagrid('options').queryParams;
  64. queryParams.insid=institution_id;
  65. queryParams.class_id=class_id;
  66. queryParams.name=name;
  67. $('#dg').datagrid('options').queryParams=queryParams;
  68. $('#dg').datagrid("reload");
  69. }
  70. // 显示编辑窗口
  71. function showEditWin(id){
  72. if("undefined"== typeof id){
  73. $editWin.window('open');$('#editFrame').attr('src','/manage/examproject/edit');
  74. }else{
  75. $editWin.window('open');$('#editFrame').attr('src','/manage/examproject/edit?id='+id);
  76. }
  77. }
  78. function deleteRow(id){
  79. $.messager.confirm('Confirm','确定要删除这条记录吗?',function(r){
  80. if(r){
  81. $.ajax({
  82. url:"/manage/examproject/delete",
  83. data:"ids="+id+"&t="+new Date(),
  84. success:function(rs){
  85. if(rs=="delete_ok"){
  86. alert("操作已成功!");
  87. document.location.reload();
  88. }else{
  89. alert("操作失败!");
  90. }
  91. }
  92. });
  93. }
  94. });
  95. }
  96. // 关闭编辑窗口
  97. function closeEditWin(isReload){
  98. $editWin.window('close');
  99. if(isReload=="reload"){
  100. document.location.reload();
  101. }
  102. }
  103. $(function(){
  104. $('#class_id').combotree({
  105. required:true,multiple:false,editable:false,
  106. valueField:'id',textField:'name',panelWidth:250,
  107. url:"/manage/institution/examclass"
  108. });
  109. $('#institution_id').combotree({
  110. required:true,multiple:false,editable:false,
  111. valueField:'id',textField:'name',panelWidth:550,
  112. url:"/manage/institution/insCombobox",
  113. onChange:function(newVal,oldVal){
  114. var url="/manage/institution/examclass?insid="+newVal;
  115. $('#class_id').combotree("setValue","");
  116. $('#class_id').combotree("reload",url);
  117. }
  118. });
  119. });
  120. </script>
  121. </head>
  122. <body>
  123. <div id="dg" class="easyui-datagrid" style="width:100%;height:auto;" ></div>
  124. <div id="tb" class="editform" style="display: none; padding-top: 1px;">&nbsp;
  125. 所在机构:<input type="text" name="institution_id" id="institution_id" style="width:150px;" />&nbsp;
  126. 检查分类:<input type="text" name="class_id" id="class_id" style="width:100px;" />&nbsp;
  127. 名称:<input type="text" id="name" name="name" class="easyui-textbox" style="width: 200px; vertical-align: middle;" />&nbsp;
  128. <a id="submit" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width: 80px" onclick="reload()" >查询</a>
  129. &nbsp;&nbsp;&nbsp;&nbsp;
  130. <a id="add" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="javascript:showEditWin()" style="width: 80px">添加</a>
  131. </div>
  132. <div id="edit-window" class="easyui-window" style="width: 80%;height: 450px;" ><iframe src="about:blank" id="editFrame" width="100%" height="100%" frameborder="0" scrolling="no" ></iframe></div>
  133. </body>
  134. </html>