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.
 
 
 
 
 
 

207 regels
8.4 KiB

  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  3. * Copyright (c) 2013-2018 北京泉江科技有限公司
  4. * 创建人:陈彬彬
  5. * 日 期:2017.04.17
  6. * 描 述:流程模板管理
  7. */
  8. var refreshGirdData; // 更新数据
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var type = '';
  12. var page = {
  13. init: function () {
  14. page.initGrid();
  15. page.bind();
  16. },
  17. bind: function () {
  18. // 左侧数据加载
  19. $('#lr_left_tree').lrtree({
  20. url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetDetailTree',
  21. param: { itemCode: 'function' },
  22. nodeClick: function (item) {
  23. type = item.value;
  24. $('#titleinfo').text(item.text);
  25. page.search();
  26. }
  27. });
  28. // 查询
  29. $('#btn_Search').on('click', function () {
  30. var keyword = $('#txt_Keyword').val();
  31. page.search({ keyword: keyword });
  32. });
  33. // 刷新
  34. $('#lr_refresh').on('click', function () {
  35. location.reload();
  36. });
  37. // 新增
  38. $('#lr_add').on('click', function () {
  39. learun.layerForm({
  40. id: 'Form',
  41. title: '新增移动功能',
  42. url: top.$.rootUrl + '/AppManager/FunctionManager/Form?type=' + type,
  43. width: 600,
  44. height: 450,
  45. callBack: function (id) {
  46. return top[id].acceptClick(refreshGirdData);
  47. }
  48. });
  49. });
  50. // 编辑
  51. $('#lr_edit').on('click', function () {
  52. var keyValue = $('#gridtable').jfGridValue('F_Id');
  53. if (learun.checkrow(keyValue)) {
  54. learun.layerForm({
  55. id: 'Form',
  56. title: '编辑移动功能',
  57. url: top.$.rootUrl + '/AppManager/FunctionManager/Form?keyValue=' + keyValue,
  58. width: 600,
  59. height: 450,
  60. callBack: function (id) {
  61. return top[id].acceptClick(refreshGirdData);
  62. }
  63. });
  64. }
  65. });
  66. // 删除
  67. $('#lr_delete').on('click', function () {
  68. var keyValue = $('#gridtable').jfGridValue('F_Id');
  69. if (learun.checkrow(keyValue)) {
  70. learun.layerConfirm('是否确认删除该功能!', function (res) {
  71. if (res) {
  72. learun.deleteForm(top.$.rootUrl + '/AppManager/FunctionManager/DeleteForm', { keyValue: keyValue }, function () {
  73. refreshGirdData();
  74. });
  75. }
  76. });
  77. }
  78. });
  79. // 启用
  80. $('#lr_enable').on('click', function () {
  81. var keyValue = $('#gridtable').jfGridValue('F_Id');
  82. var enabledMark = $('#gridtable').jfGridValue('F_EnabledMark');
  83. if (learun.checkrow(keyValue)) {
  84. if (enabledMark != 1) {
  85. learun.layerConfirm('是否启用该功能!', function (res) {
  86. if (res) {
  87. learun.postForm(top.$.rootUrl + '/AppManager/FunctionManager/UpDateSate', { keyValue: keyValue, state: 1 }, function () {
  88. refreshGirdData();
  89. });
  90. }
  91. });
  92. }
  93. else {
  94. learun.alert.warning('该功能已启用!');
  95. }
  96. }
  97. });
  98. // 禁用
  99. $('#lr_disabled').on('click', function () {
  100. var keyValue = $('#gridtable').jfGridValue('F_Id');
  101. var enabledMark = $('#gridtable').jfGridValue('F_EnabledMark');
  102. if (learun.checkrow(keyValue)) {
  103. if (enabledMark == 1) {
  104. learun.layerConfirm('是否禁用该功能!', function (res) {
  105. if (res) {
  106. learun.postForm(top.$.rootUrl + '/AppManager/FunctionManager/UpDateSate', { keyValue: keyValue, state: 0 }, function () {
  107. refreshGirdData();
  108. });
  109. }
  110. });
  111. }
  112. else {
  113. learun.alert.warning('该功能已禁用!');
  114. }
  115. }
  116. });
  117. /*分类管理*/
  118. $('#lr_category').on('click', function () {
  119. learun.layerForm({
  120. id: 'ClassifyIndex',
  121. title: '分类管理',
  122. url: top.$.rootUrl + '/LR_SystemModule/DataItem/DetailIndex?itemCode=function',
  123. width: 800,
  124. height: 500,
  125. maxmin: true,
  126. btn: null,
  127. end: function () {
  128. learun.clientdata.update('dataItem');
  129. location.reload();
  130. }
  131. });
  132. });
  133. },
  134. initGrid: function () {
  135. $('#gridtable').lrAuthorizeJfGrid({
  136. url: top.$.rootUrl + '/AppManager/FunctionManager/GetPageList',
  137. headData: [
  138. { label: "功能名称", name: "F_Name", width: 150, align: "left" },
  139. {
  140. label: "分类", name: "F_Type", width: 120, align: "left",
  141. formatterAsync: function (callback, value, row) {
  142. learun.clientdata.getAsync('dataItem', {
  143. key: value,
  144. code: 'function',
  145. callback: function (_data) {
  146. callback(_data.text);
  147. }
  148. });
  149. }
  150. },
  151. {
  152. label: "类型", name: "F_IsSystem", width: 100, align: "center",
  153. formatter: function (cellvalue, row) {
  154. if (cellvalue == 1) {
  155. return '<span class=\"label label-info\" style=\"cursor: pointer;\">代码开发</span>';
  156. } else {
  157. return '<span class=\"label label-warning\" style=\"cursor: pointer;\">自定义表单</span>';
  158. }
  159. }
  160. },
  161. {
  162. label: "状态", name: "F_EnabledMark", width: 60, align: "center",
  163. formatter: function (cellvalue, row) {
  164. if (cellvalue == 1) {
  165. return '<span class=\"label label-success\" style=\"cursor: pointer;\">正常</span>';
  166. } else if (cellvalue == 0) {
  167. return '<span class=\"label label-default\" style=\"cursor: pointer;\">禁用</span>';
  168. }
  169. }
  170. },
  171. { label: "编辑人", name: "F_CreateUserName", width: 120, align: "left" },
  172. {
  173. label: "编辑时间", name: "F_CreateDate", width: 150, align: "left",
  174. formatter: function (cellvalue) {
  175. return learun.formatDate(cellvalue, 'yyyy-MM-dd');
  176. },
  177. sort: true
  178. }
  179. ],
  180. mainId: 'F_Id',
  181. sidx:'F_SortCode',
  182. reloadSelected: true,
  183. isPage: true
  184. });
  185. page.search();
  186. },
  187. search: function (param) {
  188. param = param || {};
  189. param.type = type;
  190. $('#gridtable').jfGridSet('reload', param);
  191. }
  192. };
  193. // 保存数据后回调刷新
  194. refreshGirdData = function () {
  195. page.search();
  196. }
  197. page.init();
  198. }