index.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. var winHeight = $(window).height();
  10. var frameHeight = winHeight * 0.9;
  11. $(function() {
  12. $editWin = $('#edit-window').window({
  13. title: '关键词编辑',
  14. width: 800,
  15. height: frameHeight,
  16. top: ($(document).height() - frameHeight) / 2,
  17. left: ($(document).width() - 820) / 2,
  18. shadow: true,
  19. modal: true,
  20. iconCls: 'icon-edit',
  21. closed: true,
  22. minimizable: false,
  23. maximizable: false,
  24. collapsible: false
  25. });
  26. })
  27. function commandsFormatter(id, row) {
  28. var cmdEdit = "<a href='#' onclick=\"javascript:showEditWin('" + row.id + "');\" >编辑</a>&nbsp;";
  29. cmdEdit += "<a href='#' onclick=\"javascript:deleteRow('" + row.id + "');\" >删除</a>";
  30. return cmdEdit;
  31. }
  32. function ppFormatter(val){
  33. if(val=="1"){
  34. return "公有";
  35. }else if(val=="2"){
  36. return "私有";
  37. }else{
  38. return "--";
  39. }
  40. }
  41. $(function() {
  42. var height = $(document).height();
  43. $("#dg").height(height);
  44. $('#dg').datagrid({
  45. url: '/manage/template/getDatas',
  46. idField: 'id', method: 'get', rownumbers: true, showFooter: true,fitColumns : true,singleSelect:true,selectOnCheck:false,
  47. toolbar: '#tb', pageSize: dgRowSize, pageList: [dgRowSize, dgRowSize*2 , 100],pagination: true,
  48. frozenColumns:[[
  49. { field: 'exam_class_id', title: '检查类别', align: 'left' , width: "80" },
  50. { field: 'title', title: '名称', align: 'left' , width: "180" },
  51. ]],
  52. columns: [[
  53. { field: 'id', title: 'ID', hidden: true },
  54. { field: 'create_user', title: '创建人ID', align: 'center' , width: "135" },
  55. { field: 'is_public', title: '类别', align: 'center' , width: "80", formatter: ppFormatter },
  56. { field: 'impression', title: '影像所见', align: 'left' , },
  57. { field: 'description', title: '意见建议', align: 'left' , },
  58. { field: 'grid_commands', title: '操作', align: 'center', width: "100", formatter: commandsFormatter },
  59. ]],
  60. onDblClickRow: function(rowIndex, rowData) {
  61. showEditWin(rowData.id);
  62. },
  63. });
  64. });
  65. function refresh(){
  66. var examcla = $('#examcla').combobox("getValue");
  67. var is_public = $('#is_public').combobox("getValue");
  68. var userid = $('#userid').textbox("getValue");
  69. var url="/manage/template/getDatas?examcla="+(examcla==null?"":examcla)+"&is_public="+(is_public==null?"":is_public)+"&userid="+(userid==null?"":userid)+"&t="+new Date();
  70. alert(url);
  71. $('#dg').datagrid("reload",url);
  72. }
  73. // 显示编辑窗口
  74. function showEditWin(id) {
  75. if ("undefined" == typeof id) {
  76. $editWin.window('open');
  77. $('#editFrame').attr('src', '/manage/template/goEdit');
  78. } else {
  79. $editWin.window('open');
  80. $('#editFrame').attr('src', '/manage/template/goEdit?id=' + id);
  81. }
  82. }
  83. function deleteRow(id) {
  84. $.messager.confirm('Confirm', '确定要删除这条记录吗?', function(r) {
  85. if (r) {
  86. $.ajax({
  87. url: "/manage/template/del",
  88. data: "id=" + id + "&t=" + new Date(),
  89. success: function(rs) {
  90. if (rs == "delete_ok") {
  91. alert("操作已成功!");
  92. document.location.reload();
  93. } else {
  94. alert("操作失败!");
  95. }
  96. }
  97. });
  98. }
  99. });
  100. }
  101. // 关闭编辑窗口
  102. function closeEditWin(isReload) {
  103. $editWin.window('close');
  104. if (isReload == "reload") {
  105. document.location.reload();
  106. }
  107. }
  108. </script>
  109. </head>
  110. <body>
  111. <div id="dg" class="easyui-datagrid" style="width:100%;height:auto;"></div>
  112. <div id="tb" class="editform" style="display: none; padding-top: 1px;">
  113. &nbsp; 检查类别:
  114. <select id="examcla" class="easyui-combobox" style="width: 100px; ">
  115. <option value="">全部</option>
  116. {volist name="examcla" id="it"}
  117. <option value="{$it.name}">{$it.name}</option>
  118. {/volist}
  119. </select>
  120. 类别:
  121. <select id="is_public" class="easyui-combobox" style="width: 100px; ">
  122. <option value="">全部</option>
  123. <option value="1">公有</option>
  124. <option value="2">私有</option>
  125. </select>
  126. 人员:
  127. <input type="text" name="userid" id="userid" class="easyui-textbox" size="10" style="width:150px;" />
  128. <a id="submit" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width: 80px" onclick="refresh();" >查询</a>
  129. <a id="add" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="javascript:showEditWin()" style="width: 80px">添加</a>
  130. </div>
  131. <div id="edit-window" class="easyui-window" style="overflow: hidden"><iframe src="about:blank" id="editFrame" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe></div>
  132. </body>
  133. </html>