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.
 
 
 
 
 
 

129 lines
5.2 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-02-22 15:00
  5. * 描 述:县区信息管理
  6. */
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var page = {
  11. init: function () {
  12. page.initGird();
  13. page.bind();
  14. },
  15. bind: function () {
  16. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  17. page.search(queryJson);
  18. }, 220, 400);
  19. $('#CPARENT').lrDataSourceSelect({
  20. code: 'DIC_PROVINCE', value: 'pcode', text: 'pname',
  21. select: function (item) {
  22. if (!!item) {
  23. $('#APARENT').lrselectRefresh({
  24. url: "/DIC_CITY/GetListByProvinceCode",
  25. param: { ProvinceCode: item.pcode },
  26. value: 'CCODE',
  27. text: 'CNAME'
  28. });
  29. }
  30. }
  31. });
  32. $('#APARENT').lrselect();
  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 + '/EducationalAdministration/DIC_AREA/Form',
  43. width: 600,
  44. height: 400,
  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('AID');
  53. if (learun.checkrow(keyValue)) {
  54. learun.layerForm({
  55. id: 'form',
  56. title: '编辑',
  57. url: top.$.rootUrl + '/EducationalAdministration/DIC_AREA/Form?keyValue=' + keyValue,
  58. width: 600,
  59. height: 400,
  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('AID');
  69. if (learun.checkrow(keyValue)) {
  70. learun.layerConfirm('是否确认删除该项!', function (res) {
  71. if (res) {
  72. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/DIC_AREA/DeleteForm', { keyValue: keyValue }, function () {
  73. refreshGirdData();
  74. });
  75. }
  76. });
  77. }
  78. });
  79. },
  80. // 初始化列表
  81. initGird: function () {
  82. $('#gridtable').lrAuthorizeJfGrid({
  83. url: top.$.rootUrl + '/EducationalAdministration/DIC_AREA/GetPageList',
  84. headData: [
  85. {
  86. label: "省份", name: "CPARENT", width: 100, align: "left",
  87. formatterAsync: function (callback, value, row, op, $cell) {
  88. learun.clientdata.getAsync('custmerData', {
  89. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'DIC_PROVINCE',
  90. key: value,
  91. keyId: 'pcode',
  92. callback: function (_data) {
  93. callback(_data['pname']);
  94. }
  95. });
  96. }
  97. },
  98. {
  99. label: "地市", name: "APARENT", width: 100, align: "left",
  100. formatterAsync: function (callback, value, row, op, $cell) {
  101. learun.clientdata.getAsync('custmerData', {
  102. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'DIC_CITY',
  103. key: value,
  104. keyId: 'ccode',
  105. callback: function (_data) {
  106. callback(_data['cname']);
  107. }
  108. });
  109. }
  110. },
  111. { label: "县区编号", name: "ACODE", width: 100, align: "left" },
  112. { label: "县区名称", name: "ANAME", width: 100, align: "left" },
  113. ],
  114. mainId: 'AID',
  115. isPage: true
  116. });
  117. page.search();
  118. },
  119. search: function (param) {
  120. param = param || {};
  121. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  122. }
  123. };
  124. refreshGirdData = function () {
  125. page.search();
  126. };
  127. page.init();
  128. }