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.
 
 
 
 
 
 

151 lines
6.2 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2018-07-02 17:20
  5. * 描 述:App首页图片管理
  6. */
  7. var selectedRow;
  8. var refreshGirdData;
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. page.initGird();
  14. page.bind();
  15. },
  16. bind: function () {
  17. // 查询
  18. $('#btn_Search').on('click', function () {
  19. var keyword = $('#txt_Keyword').val();
  20. page.search({ keyword: keyword });
  21. });
  22. // 刷新
  23. $('#lr_refresh').on('click', function () {
  24. location.reload();
  25. });
  26. // 新增
  27. $('#lr_add').on('click', function () {
  28. selectedRow = null;
  29. learun.layerForm({
  30. id: 'form',
  31. title: '新增',
  32. url: top.$.rootUrl + '/AppManager/DTImg/Form',
  33. width: 505,
  34. height: 340,
  35. callBack: function (id) {
  36. return top[id].acceptClick(refreshGirdData);
  37. }
  38. });
  39. });
  40. // 编辑
  41. $('#lr_edit').on('click', function () {
  42. var keyValue = $('#gridtable').jfGridValue('F_Id');
  43. selectedRow = $('#gridtable').jfGridGet('rowdata');
  44. if (learun.checkrow(keyValue)) {
  45. learun.layerForm({
  46. id: 'form',
  47. title: '编辑',
  48. url: top.$.rootUrl + '/AppManager/DTImg/Form?keyValue=' + keyValue,
  49. width: 505,
  50. height: 340,
  51. callBack: function (id) {
  52. return top[id].acceptClick(refreshGirdData);
  53. }
  54. });
  55. }
  56. });
  57. // 删除
  58. $('#lr_delete').on('click', function () {
  59. var keyValue = $('#gridtable').jfGridValue('F_Id');
  60. if (learun.checkrow(keyValue)) {
  61. learun.layerConfirm('是否确认删除该项!', function (res) {
  62. if (res) {
  63. learun.deleteForm(top.$.rootUrl + '/AppManager/DTImg/DeleteForm', { keyValue: keyValue }, function () {
  64. refreshGirdData();
  65. });
  66. }
  67. });
  68. }
  69. });
  70. // 启用
  71. $('#lr_enabled').on('click', function () {
  72. var keyValue = $('#gridtable').jfGridValue('F_Id');
  73. var enabledMark = $('#gridtable').jfGridValue('F_EnabledMark');
  74. if (learun.checkrow(keyValue)) {
  75. if (enabledMark != 1) {
  76. learun.layerConfirm('是否确认启用该项!', function (res) {
  77. if (res) {
  78. learun.postForm(top.$.rootUrl + '/AppManager/DTImg/UpDateSate', { keyValue: keyValue, state: 1 }, function () {
  79. refreshGirdData();
  80. });
  81. }
  82. });
  83. }
  84. else {
  85. learun.alert.warning('该项已启用!');
  86. }
  87. }
  88. });
  89. // 禁用
  90. $('#lr_disabled').on('click', function () {
  91. var keyValue = $('#gridtable').jfGridValue('F_Id');
  92. var enabledMark = $('#gridtable').jfGridValue('F_EnabledMark');
  93. if (learun.checkrow(keyValue)) {
  94. if (enabledMark == 1) {
  95. learun.layerConfirm('是否确认禁用该项!', function (res) {
  96. if (res) {
  97. learun.postForm(top.$.rootUrl + '/AppManager/DTImg/UpDateSate', { keyValue: keyValue, state: 0 }, function () {
  98. refreshGirdData();
  99. });
  100. }
  101. });
  102. }
  103. else {
  104. learun.alert.warning('该项已禁用!');
  105. }
  106. }
  107. });
  108. },
  109. initGird: function () {
  110. $('#gridtable').lrAuthorizeJfGrid({
  111. url: top.$.rootUrl + '/AppManager/DTImg/GetPageList',
  112. headData: [
  113. { label: '说明', name: 'F_Des', width: 200, align: "left" },
  114. {
  115. label: '图片', name: 'F_FileName', width: 197.5, align: "left",
  116. formatter(value, row, op, $cell) {
  117. return '<img src="' + top.$.rootUrl + '/AppManager/DTImg/GetImg?keyValue=' + row.F_Id + '" style="position: absolute;height:60px;width:187.5px;top:5px;left:5px;" >';
  118. }
  119. },
  120. {
  121. label: '状态', name: 'F_EnabledMark', width: 80, align: "center",
  122. formatter: function (cellvalue, row) {
  123. if (cellvalue == 1) {
  124. return '<span class=\"label label-success\" style=\"cursor: pointer;\">启用</span>';
  125. } else if (cellvalue == 0) {
  126. return '<span class=\"label label-default\" style=\"cursor: pointer;\">禁用</span>';
  127. }
  128. }
  129. },
  130. { label: '排序码', name: 'F_SortCode', width: 100, align: "left" }
  131. ],
  132. mainId: 'F_Id',
  133. isPage: true,
  134. rowHeight: 70,
  135. sidx:'F_EnabledMark Desc,F_SortCode ASC'
  136. });
  137. page.search();
  138. },
  139. search: function (param) {
  140. param = param || {};
  141. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  142. }
  143. };
  144. refreshGirdData = function () {
  145. page.search();
  146. };
  147. page.init();
  148. }