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 5.0 KiB

4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  3. * Copyright (c) 2013-2018 北京泉江科技有限公司
  4. * 创建人:陈彬彬
  5. * 日 期:2017.04.17
  6. * 描 述:数据源
  7. */
  8. var refreshGirdData; // 更新数据
  9. var selectedRow;
  10. var bootstrap = function ($, learun) {
  11. "use strict";
  12. var page = {
  13. init: function () {
  14. page.initGrid();
  15. page.bind();
  16. },
  17. bind: function () {
  18. // 查询
  19. $('#btn_Search').on('click', function () {
  20. var keyword = $('#txt_Keyword').val();
  21. page.search({ keyword: keyword });
  22. });
  23. // 刷新
  24. $('#lr_refresh').on('click', function () {
  25. location.reload();
  26. });
  27. // 新增
  28. $('#lr_add').on('click', function () {
  29. selectedRow = null;
  30. learun.layerForm({
  31. id: 'Form',
  32. title: '添加数据源',
  33. url: top.$.rootUrl + '/LR_SystemModule/DataSource/Form',
  34. width: 700,
  35. height: 430,
  36. callBack: function (id) {
  37. return top[id].acceptClick(refreshGirdData);
  38. }
  39. });
  40. });
  41. // 编辑
  42. $('#lr_edit').on('click', function () {
  43. selectedRow = $('#gridtable').jfGridGet('rowdata');
  44. var keyValue = $('#gridtable').jfGridValue('F_Id');
  45. if (learun.checkrow(keyValue)) {
  46. learun.layerForm({
  47. id: 'Form',
  48. title: '编辑数据源',
  49. url: top.$.rootUrl + '/LR_SystemModule/DataSource/Form',
  50. width: 700,
  51. height: 430,
  52. callBack: function (id) {
  53. return top[id].acceptClick(refreshGirdData);
  54. }
  55. });
  56. }
  57. });
  58. // 删除
  59. $('#lr_delete').on('click', function () {
  60. var keyValue = $('#gridtable').jfGridValue('F_Id');
  61. if (learun.checkrow(keyValue)) {
  62. learun.layerConfirm('是否确认删除该项!', function (res) {
  63. if (res) {
  64. learun.deleteForm(top.$.rootUrl + '/LR_SystemModule/DataSource/DeleteForm', { keyValue: keyValue }, function () {
  65. refreshGirdData();
  66. });
  67. }
  68. });
  69. }
  70. });
  71. // 查看测试
  72. $('#lr_eye').on('click', function () {
  73. var code = $('#gridtable').jfGridValue('F_Code');
  74. if (learun.checkrow(code)) {
  75. learun.layerForm({
  76. id: 'TestForm',
  77. title: '数据源测试查看',
  78. url: top.$.rootUrl + '/LR_SystemModule/DataSource/TestForm?code=' + code,
  79. width: 1000,
  80. height: 800,
  81. maxmin: true,
  82. btn: null
  83. });
  84. }
  85. });
  86. },
  87. initGrid: function () {
  88. $('#gridtable').lrAuthorizeJfGrid({
  89. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetPageList',
  90. headData: [
  91. { label: "编码", name: "F_Code", width: 150, align: "left" },
  92. { label: "名称", name: "F_Name", width: 150, align: "left" },
  93. {
  94. label: "数据库", name: "F_DbId", width: 200, align: "left",
  95. formatterAsync: function (callback, value, row) {
  96. learun.clientdata.getAsync('db', {
  97. key: value,
  98. callback: function (item) {
  99. callback(item.alias + '(' + item.name + ')');
  100. }
  101. });
  102. }
  103. },
  104. { label: '创建用户', name: 'F_CreateUserName', width: 100, align: 'left' },
  105. {
  106. label: '创建时间', name: 'F_CreateDate', width: 130, align: 'left',
  107. formatter: function (cellvalue) {
  108. return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm');
  109. }
  110. },
  111. { label: "备注", name: "F_Description", width: 300, align: "left" },
  112. ],
  113. mainId: 'F_Id',
  114. reloadSelected: true,
  115. isPage: true
  116. });
  117. page.search();
  118. },
  119. search: function (param) {
  120. $('#gridtable').jfGridSet('reload', param);
  121. }
  122. };
  123. // 保存数据后回调刷新
  124. refreshGirdData = function () {
  125. page.search();
  126. }
  127. page.init();
  128. }