index.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 dateFormatter(date){
  21. if(typeof date=="undefined"){ return "--"; }
  22. return new Date(date).format("yyyyMMdd hh:mm:ss");
  23. }
  24. function commandsFormatter(id,row){
  25. var cmdEdit="<a href='#' onclick=\"javascript:showEditWin('"+row.id+"');\" >编辑</a>&nbsp;";
  26. if(row.status == 0){
  27. cmdEdit+="<a href='#' onclick=\"javascript:deleteRow('"+row.id+"');\" >删除</a>";
  28. }
  29. return cmdEdit;
  30. }
  31. function chargereadFormatter(mode){
  32. if(typeof mode=="undefined"){ return "--"; }
  33. if(mode=="1"){ return "已读";
  34. }else if(mode=="0"){ return "未读";
  35. }else{ return "--";
  36. }
  37. }
  38. function delstatusFormatter(mode){
  39. if(mode == '1'){ return "屏蔽";
  40. }else if(mode=="0"){ return "正常";
  41. }else{ return "--";
  42. }
  43. }
  44. $(function(){
  45. var height=$(document).height();
  46. $("#dg").height(height);
  47. $('#dg').datagrid({
  48. url:'/manage/messages/datas',
  49. idField:'id',method: 'get',rownumbers: true,showFooter: true,
  50. toolbar: '#tb',pageList: [dgRowSize,dgRowSize*2,100],pagination:true,pageSize:dgRowSize,
  51. columns:[[
  52. {field:'id',title:'ID',width:180 ,hidden:true },
  53. {field:'title',title:'标题',align: 'center',width:180},
  54. {field:'content',title:'内容',width:"15%",align: 'center'},
  55. {field:'is_read',title:'是否已读',width:80,align: 'center',formatter:chargereadFormatter},
  56. {field:'doctor_id',title:'所属医生',width:"20%",align: 'center',hidden:true },
  57. {field:'doctor_name',title:'所属医生',width:"20%",align: 'center' },
  58. {field:'status',title:'删除状态',width:"20%",align: 'center',formatter:delstatusFormatter },
  59. {field:'ctime',title:'创建时间',align: 'center', width:135, formatter:dateFormatter },
  60. {field:'grid_commands',title:'操作',align: 'center',width:100, formatter:commandsFormatter },
  61. ]],
  62. onDblClickRow :function(rowData){
  63. showEditWin(rowData.id);
  64. },
  65. });
  66. $('#institution_id').combotree({
  67. required:true,multiple:false,editable:false,
  68. valueField:'id',textField:'name',panelWidth:350,
  69. url:"/manage/doctors/insCombobox"
  70. });
  71. });
  72. function reload(){
  73. var insId=$('#institution_id').combotree("getValue");
  74. var status=$('#status').combobox("getValue");
  75. var url="/manage/messages/datas?status="+(status==null?"":status)+"&insId="+(insId==null?"":insId)+"&t="+new Date();
  76. $('#dg').datagrid("reload",url);
  77. }
  78. // 显示编辑窗口
  79. function showEditWin(id){
  80. if("undefined"== typeof id){
  81. $editWin.window('open');$('#editFrame').attr('src','/manage/messages/edit');
  82. }else{
  83. $editWin.window('open');$('#editFrame').attr('src','/manage/messages/edit?id='+id);
  84. }
  85. }
  86. function deleteRow(id){
  87. $.messager.confirm('Confirm','确定要删除这条记录吗?',function(r){
  88. if(r){
  89. $.ajax({
  90. url:"/manage/messages/delete",
  91. data:"ids="+id+"&t="+new Date(),
  92. success:function(rs){
  93. if(rs=="delete_ok"){
  94. alert("操作已成功!");
  95. document.location.reload();
  96. }else{
  97. alert("操作失败!");
  98. }
  99. }
  100. });
  101. }
  102. });
  103. }
  104. // 关闭编辑窗口
  105. function closeEditWin(isReload){
  106. $editWin.window('close');
  107. if(isReload=="reload"){
  108. document.location.reload();
  109. }
  110. }
  111. </script>
  112. </head>
  113. <body>
  114. <div id="dg" class="easyui-datagrid" style="width:100%;height:auto;" ></div>
  115. <div id="tb" class="editform" style="display: none; padding-top: 1px;">&nbsp;
  116. 机构:<input name="institution_id" id="institution_id" type="text" size="20" value="" />&nbsp;
  117. 读取状态:<select id="status" class="easyui-combobox" name="params.status" style="width: 100px; " >
  118. <option value="" >查询全部</option><option value="0" >未读</option><option value="1" >已读</option>
  119. </select>&nbsp;
  120. <a id="submit" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" style="width: 80px">查询</a>
  121. <a id="reset" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear'" style="width: 80px" onclick="reset()" >重置</a>
  122. &nbsp;&nbsp;&nbsp;&nbsp;
  123. </div>
  124. <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>
  125. </body>
  126. </html>