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.

Index.js 4.6 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2017-12-12 11:52
  5. * 描 述:消息策略
  6. */
  7. var selectedRow;
  8. var refreshGirdData;
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. page.initGrid();
  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 + '/LR_SystemModule/DbField/Form',
  33. width: 450,
  34. height: 300,
  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: 'editform',
  47. title: '编辑',
  48. url: top.$.rootUrl + '/LR_SystemModule/DbField/Form?keyValue=' + keyValue,
  49. width: 450,
  50. height: 300,
  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 + '/LR_SystemModule/DbField/DeleteForm', { keyValue: keyValue }, function () {
  64. refreshGirdData();
  65. });
  66. }
  67. });
  68. }
  69. });
  70. },
  71. initGrid: function () {
  72. $('#gridtable').lrAuthorizeJfGrid({
  73. url: top.$.rootUrl + '/LR_SystemModule/DbField/GetPageList',
  74. headData: [
  75. { label: '列名', name: 'F_Name', width: 150, align: "left" },
  76. { label: '描述', name: 'F_Remark', width: 150, align: "left" },
  77. {
  78. label: '数据类型', name: 'F_DataType', width: 80, align: "center",
  79. formatterAsync: function (callback, value, row) {
  80. learun.clientdata.getAsync('dataItem', {
  81. key: value,
  82. code: 'DbFieldType',
  83. callback: function (_data) {
  84. callback(_data.text);
  85. }
  86. });
  87. }
  88. },
  89. { label: '字段长度', name: 'F_Length', width: 80, align: "center" },
  90. { label: '创建人', name: 'F_CreateUserName', width: 100, align: "center" },
  91. {
  92. label: "创建时间", name: "F_CreateDate", width: 120, align: "center",
  93. formatter: function (cellvalue) {
  94. return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm');
  95. }
  96. },
  97. ],
  98. mainId: 'F_Id',
  99. reloadSelected: true,
  100. isPage: true,
  101. sidx: 'F_CreateDate',
  102. sord: 'DESC'
  103. });
  104. page.search();
  105. },
  106. search: function (param) {
  107. param = param || {};
  108. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  109. }
  110. };
  111. refreshGirdData = function () {
  112. page.search();
  113. };
  114. page.init();
  115. }