index.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. $('#dg').datagrid("reload",url);
  71. }
  72. // 显示编辑窗口
  73. function showEditWin(id) {
  74. if ("undefined" == typeof id) {
  75. $editWin.window('open');
  76. $('#editFrame').attr('src', '/manage/template/goEdit');
  77. } else {
  78. $editWin.window('open');
  79. $('#editFrame').attr('src', '/manage/template/goEdit?id=' + id);
  80. }
  81. }
  82. function deleteRow(id) {
  83. $.messager.confirm('Confirm', '确定要删除这条记录吗?', function(r) {
  84. if (r) {
  85. $.ajax({
  86. url: "/manage/template/del",
  87. data: "id=" + id + "&t=" + new Date(),
  88. success: function(rs) {
  89. if (rs == "delete_ok") {
  90. alert("操作已成功!");
  91. document.location.reload();
  92. } else {
  93. alert("操作失败!");
  94. }
  95. }
  96. });
  97. }
  98. });
  99. }
  100. // 关闭编辑窗口
  101. function closeEditWin(isReload) {
  102. $editWin.window('close');
  103. if (isReload == "reload") {
  104. document.location.reload();
  105. }
  106. }
  107. </script>
  108. </head>
  109. <body>
  110. <div id="dg" class="easyui-datagrid" style="width:100%;height:auto;"></div>
  111. <div id="tb" class="editform" style="display: none; padding-top: 1px;">
  112. &nbsp; 检查类别:
  113. <select id="examcla" class="easyui-combobox" style="width: 100px; ">
  114. <option value="">全部</option>
  115. {volist name="examcla" id="it"}
  116. <option value="{$it.name}">{$it.name}</option>
  117. {/volist}
  118. </select>
  119. 类别:
  120. <select id="is_public" class="easyui-combobox" style="width: 100px; ">
  121. <option value="">全部</option>
  122. <option value="1">公有</option>
  123. <option value="2">私有</option>
  124. </select>
  125. 人员:
  126. <input type="text" name="userid" id="userid" class="easyui-textbox" size="10" style="width:150px;" />
  127. <a id="submit" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width: 80px" onclick="refresh();" >查询</a>
  128. <a id="add" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="javascript:showEditWin()" style="width: 80px">添加</a>
  129. </div>
  130. <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>
  131. </body>
  132. </html>