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

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * 描 述:学校管理
  3. */
  4. var refreshGirdData; // 更新数据
  5. var selectedRow;
  6. var bootstrap = function ($, learun) {
  7. "use strict";
  8. var page = {
  9. init: function () {
  10. page.initGrid();
  11. page.bind();
  12. },
  13. bind: function () {
  14. // 查询
  15. $('#btn_Search').on('click', function () {
  16. var keyword = $('#txt_Keyword').val();
  17. page.search({ keyword: keyword });
  18. });
  19. // 刷新
  20. $('#lr_refresh').on('click', function () {
  21. location.reload();
  22. });
  23. // 新增
  24. $('#lr_add').on('click', function () {
  25. selectedRow = null;
  26. learun.layerForm({
  27. id: 'Form',
  28. title: '添加学校',
  29. url: top.$.rootUrl + '/LR_OrganizationModule/Company/Form',
  30. width: 750,
  31. height: 500,
  32. callBack: function (id) {
  33. return top[id].acceptClick(refreshGirdData);
  34. }
  35. });
  36. });
  37. // 编辑
  38. $('#lr_edit').on('click', function () {
  39. selectedRow = $('#gridtable').jfGridGet('rowdata');
  40. var keyValue = $('#gridtable').jfGridValue('F_CompanyId');
  41. if (learun.checkrow(keyValue)) {
  42. learun.layerForm({
  43. id: 'Form',
  44. title: '编辑学校',
  45. url: top.$.rootUrl + '/LR_OrganizationModule/Company/Form',
  46. width: 750,
  47. height: 500,
  48. callBack: function (id) {
  49. return top[id].acceptClick(refreshGirdData);
  50. }
  51. });
  52. }
  53. });
  54. // 删除
  55. $('#lr_delete').on('click', function () {
  56. var keyValue = $('#gridtable').jfGridValue('F_CompanyId');
  57. if (learun.checkrow(keyValue)) {
  58. learun.layerConfirm('是否确认删除该项!', function (res) {
  59. if (res) {
  60. learun.deleteForm(top.$.rootUrl + '/LR_OrganizationModule/Company/DeleteForm', { keyValue: keyValue }, function () {
  61. refreshGirdData();
  62. });
  63. }
  64. });
  65. }
  66. });
  67. },
  68. initGrid: function () {
  69. $('#gridtable').lrAuthorizeJfGrid({
  70. url: top.$.rootUrl + '/LR_OrganizationModule/Company/GetList',
  71. headData: [
  72. { label: "学校名称", name: "F_FullName", width: 260, align: "left" },
  73. { label: "学校编码", name: "F_EnCode", width: 150, align: "left" },
  74. { label: "学校简称", name: "F_ShortName", width: 150, align: "left" },
  75. {
  76. label: "成立时间", name: "F_FoundedTime", width: 80, align: "center",
  77. formatter: function (value) {
  78. return learun.formatDate(value, 'yyyy-MM-dd');
  79. }
  80. },
  81. { label: "负责人", name: "F_Manager", width: 80, align: "center"},
  82. { label: "备注", name: "F_Description", width: 200, align: "left" }
  83. ],
  84. isTree: true,
  85. mainId: 'F_CompanyId',
  86. parentId: 'F_ParentId'
  87. });
  88. page.search();
  89. },
  90. search: function (param) {
  91. $('#gridtable').jfGridSet('reload', param);
  92. }
  93. };
  94. // 保存数据后回调刷新
  95. refreshGirdData = function () {
  96. page.search();
  97. }
  98. page.init();
  99. }