纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
5.3 KiB

3 years ago
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Index.cshtml";
  4. }
  5. <script>
  6. $(function () {
  7. gridList();
  8. })
  9. function gridList() {
  10. var $gridList = $("#gridList");
  11. $gridList.dataGrid({
  12. url: "/SystemSecurity/DbBackup/GetGridJson",
  13. height: $(window).height() - 96,
  14. colModel: [
  15. { label: "主键", name: "F_Id", hidden: true, key: true },
  16. { label: '数据库名', name: 'F_DbName', width: 100, align: 'left' },
  17. { label: '备份名称', name: 'F_FileName', width: 200, align: 'left' },
  18. { label: '大小', name: 'F_FileSize', width: 100, align: 'left' },
  19. {
  20. label: '备份模式', name: 'F_BackupType', width: 100, align: 'left',
  21. formatter: function (cellvalue) {
  22. if (cellvalue == "1") {
  23. return "完整备份";
  24. } else if (cellvalue == "2") {
  25. return "差异备份";
  26. }
  27. }
  28. },
  29. {
  30. label: '备份时间', name: 'F_CreatorTime', width: 100, align: 'left',
  31. formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i', newformat: 'Y-m-d H:i' }
  32. },
  33. { label: '备份人员', name: 'F_CreatorUserId', width: 100, align: 'left' },
  34. { label: '备份说明', name: 'F_Description', width: 300, align: 'left' }
  35. ]
  36. });
  37. $("#txt_condition .dropdown-menu li").click(function () {
  38. var text = $(this).find('a').html();
  39. var value = $(this).find('a').attr('data-value');
  40. $("#txt_condition .dropdown-text").html(text).attr('data-value', value)
  41. });
  42. $("#btn_search").click(function () {
  43. var queryJson = {
  44. condition: $("#txt_condition").find('.dropdown-text').attr('data-value'),
  45. keyword: $("#txt_keyword").val()
  46. }
  47. $gridList.jqGrid('setGridParam', {
  48. postData: { queryJson: JSON.stringify(queryJson) },
  49. }).trigger('reloadGrid');
  50. });
  51. }
  52. function btn_add() {
  53. $.modalOpen({
  54. id: "Form",
  55. title: "新增备份",
  56. url: "/SystemSecurity/DbBackup/Form",
  57. width: "450px",
  58. height: "360px",
  59. callBack: function (iframeId) {
  60. top.frames[iframeId].submitForm();
  61. }
  62. });
  63. }
  64. function btn_delete() {
  65. $.deleteForm({
  66. url: "/SystemSecurity/DbBackup/DeleteForm",
  67. param: { keyValue: $("#gridList").jqGridRowValue().F_Id },
  68. success: function () {
  69. $.currentWindow().$("#gridList").trigger("reloadGrid");
  70. }
  71. })
  72. }
  73. function btn_download() {
  74. var keyValue = $("#gridList").jqGridRowValue().F_Id;
  75. $.download("/SystemSecurity/DbBackup/DownloadBackup", "keyValue=" + keyValue, 'post');
  76. }
  77. </script>
  78. <div class="topPanel">
  79. <div class="toolbar">
  80. <div class="btn-group">
  81. <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
  82. </div>
  83. <div class="btn-group">
  84. <a id="NF-add" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新建备份</a>
  85. </div>
  86. <div class="operate">
  87. <ul class="nav nav-pills">
  88. <li class="first">已选中<span>1</span>项</li>
  89. <li><a id="NF-delete" authorize="yes" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除备份</a></li>
  90. <li class="split"></li>
  91. <li><a id="NF-download" authorize="yes" onclick="btn_download()"><i class="fa fa-cloud-download"></i>下载备份</a></li>
  92. </ul>
  93. <a href="javascript:;" class="close"></a>
  94. </div>
  95. <script>$('.toolbar').authorizeButton()</script>
  96. </div>
  97. <div class="search">
  98. <table>
  99. <tr>
  100. <td>
  101. <div id="txt_condition" class="btn-group">
  102. <a class="btn btn-default dropdown-text" data-toggle="dropdown">选择条件</a>
  103. <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
  104. <ul class="dropdown-menu">
  105. <li><a href="javascript:void()" data-value="DbName">数据库名</a></li>
  106. <li><a href="javascript:void()" data-value="FileName">备份名称</a></li>
  107. </ul>
  108. </div>
  109. </td>
  110. <td style="padding-left: 2px;">
  111. <div class="input-group">
  112. <input id="txt_keyword" type="text" class="form-control" placeholder="请输入要查询关键字" style="width: 200px;">
  113. <span class="input-group-btn">
  114. <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>
  115. </span>
  116. </div>
  117. </td>
  118. </tr>
  119. </table>
  120. </div>
  121. </div>
  122. <div class="gridPanel">
  123. <table id="gridList"></table>
  124. </div>