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.
 
 
 
 
 
 

147 lines
5.5 KiB

  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  3. * Copyright (c) 2013-2018 北京泉江科技有限公司
  4. * 创建人:陈彬彬
  5. * 日 期:2017.03.22
  6. * 描 述:数据字典管理
  7. */
  8. var refreshGird;
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var classify_itemCode = '';
  12. var page = {
  13. init: function () {
  14. page.initTree();
  15. page.initGrid();
  16. page.bind();
  17. },
  18. bind: function () {
  19. // 查询
  20. $('#btn_Search').on('click', function () {
  21. var keyword = $('#txt_Keyword').val();
  22. page.search({ keyword: keyword });
  23. });
  24. // 刷新
  25. $('#lr_refresh').on('click', function () {
  26. location.reload();
  27. });
  28. // 新增
  29. $('#lr_add').on('click', function () {
  30. if (!classify_itemCode) {
  31. learun.alert.warning('请选择字典分类!');
  32. return false;
  33. }
  34. top.selectedDataItemRow = null;
  35. var parentId = $('#gridtable').jfGridValue('F_ItemDetailId') || '0';
  36. learun.layerForm({
  37. id: 'form',
  38. title: '添加字典',
  39. url: top.$.rootUrl + '/LR_SystemModule/DataItem/Form?parentId=' + parentId + '&itemCode=' + classify_itemCode,
  40. width: 500,
  41. height: 370,
  42. callBack: function (id) {
  43. return top[id].acceptClick(refreshGird);
  44. }
  45. });
  46. });
  47. // 编辑
  48. $('#lr_edit').on('click', function () {
  49. var keyValue = $('#gridtable').jfGridValue('F_ItemDetailId');
  50. top.selectedDataItemRow = $('#gridtable').jfGridGet('rowdata');
  51. if (learun.checkrow(keyValue)) {
  52. learun.layerForm({
  53. id: 'form',
  54. title: '编辑字典',
  55. url: top.$.rootUrl + '/LR_SystemModule/DataItem/Form?itemCode=' + classify_itemCode,
  56. width: 500,
  57. height: 370,
  58. callBack: function (id) {
  59. return top[id].acceptClick(refreshGird);
  60. }
  61. });
  62. }
  63. });
  64. // 删除
  65. $('#lr_delete').on('click', function () {
  66. var keyValue = $('#gridtable').jfGridValue('F_ItemDetailId');
  67. if (learun.checkrow(keyValue)) {
  68. learun.layerConfirm('是否确认删除该项!', function (res) {
  69. if (res) {
  70. learun.deleteForm(top.$.rootUrl + '/LR_SystemModule/DataItem/DeleteDetailForm', { keyValue: keyValue }, function () {
  71. refreshGird();
  72. });
  73. }
  74. });
  75. }
  76. });
  77. /*分类管理*/
  78. $('#lr_category').on('click', function () {
  79. learun.layerForm({
  80. id: 'ClassifyIndex',
  81. title: '分类管理',
  82. url: top.$.rootUrl + '/LR_SystemModule/DataItem/ClassifyIndex',
  83. width: 800,
  84. height: 500,
  85. maxmin: true,
  86. btn: null,
  87. end: function () {
  88. location.reload();
  89. }
  90. });
  91. });
  92. },
  93. initTree: function () {
  94. $('#lr_left_tree').lrtree({
  95. url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetClassifyTree',
  96. nodeClick: function (item) {
  97. classify_itemCode = item.value;
  98. $('#titleinfo').text(item.text + '(' + classify_itemCode + ')');
  99. page.search();
  100. }
  101. });
  102. },
  103. initGrid: function () {
  104. $('#gridtable').jfGrid({
  105. url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetDetailList',
  106. headData: [
  107. {
  108. label: '标准编码', name: 'F_ItemCodeGB', width: 200, align: 'left'
  109. },
  110. { label: '项目名', name: 'F_ItemName', width: 200, align: 'left' },
  111. { label: '项目值', name: 'F_ItemValue', width: 200, align: 'left' },
  112. { label: '简拼', name: 'F_SimpleSpelling', width: 150, align: 'left' },
  113. { label: '排序', name: 'F_SortCode', width: 80, align: 'center' },
  114. {
  115. label: "有效", name: "F_EnabledMark", width: 50, align: "center",
  116. formatter: function (cellvalue) {
  117. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  118. }
  119. },
  120. { label: "备注", name: "F_Description", width: 200, align: "left" }
  121. ],
  122. isTree: true,
  123. mainId: 'F_ItemDetailId',
  124. parentId: 'F_ParentId',
  125. });
  126. },
  127. search: function (param) {
  128. param = param || {};
  129. param.itemCode = classify_itemCode;
  130. $('#gridtable').jfGridSet('reload', param);
  131. }
  132. };
  133. refreshGird = function () {
  134. page.search();
  135. };
  136. page.init();
  137. }