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.

DetailIndex.js 4.3 KiB

4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  3. * Copyright (c) 2013-2018 北京泉江科技有限公司
  4. * 创建人:陈彬彬
  5. * 日 期:2017.03.22
  6. * 描 述:数据字典明细管理
  7. */
  8. var classify_itemCode = request('itemCode');
  9. var refreshGird;
  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. top.selectedDataItemRow = null;
  30. var parentId = $('#gridtable').jfGridValue('F_ItemDetailId') || '0';
  31. learun.layerForm({
  32. id: 'form',
  33. title: '添加字典',
  34. url: top.$.rootUrl + '/LR_SystemModule/DataItem/Form?parentId=' + parentId + '&itemCode=' + classify_itemCode,
  35. width: 500,
  36. height: 370,
  37. callBack: function (id) {
  38. return top[id].acceptClick(refreshGird);
  39. }
  40. });
  41. });
  42. // 编辑
  43. $('#lr_edit').on('click', function () {
  44. var keyValue = $('#gridtable').jfGridValue('F_ItemDetailId');
  45. top.selectedDataItemRow = $('#gridtable').jfGridGet('rowdata');
  46. if (learun.checkrow(keyValue)) {
  47. learun.layerForm({
  48. id: 'form',
  49. title: '编辑字典',
  50. url: top.$.rootUrl + '/LR_SystemModule/DataItem/Form?itemCode=' + classify_itemCode,
  51. width: 500,
  52. height: 370,
  53. callBack: function (id) {
  54. return top[id].acceptClick(refreshGird);
  55. }
  56. });
  57. }
  58. });
  59. // 删除
  60. $('#lr_delete').on('click', function () {
  61. var keyValue = $('#gridtable').jfGridValue('F_ItemDetailId');
  62. if (learun.checkrow(keyValue)) {
  63. learun.layerConfirm('是否确认删除该项!', function (res) {
  64. if (res) {
  65. learun.deleteForm(top.$.rootUrl + '/LR_SystemModule/DataItem/DeleteDetailForm', { keyValue: keyValue }, function () {
  66. refreshGird();
  67. });
  68. }
  69. });
  70. }
  71. });
  72. },
  73. initGrid: function () {
  74. $('#gridtable').jfGrid({
  75. url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetDetailList',
  76. headData: [
  77. { label: '项目名', name: 'F_ItemName', width: 200, align: 'left' },
  78. { label: '项目值', name: 'F_ItemValue', width: 200, align: 'left' },
  79. { label: '简拼', name: 'F_SimpleSpelling', width: 150, align: 'left' },
  80. { label: '排序', name: 'F_SortCode', width: 80, align: 'center' },
  81. {
  82. label: "有效", name: "F_EnabledMark", width: 50, align: "center",
  83. formatter: function (cellvalue) {
  84. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  85. }
  86. },
  87. { label: "备注", name: "F_Description", width: 200, align: "left" }
  88. ],
  89. isTree: true,
  90. mainId: 'F_ItemDetailId',
  91. parentId: 'F_ParentId',
  92. });
  93. page.search();
  94. },
  95. search: function (param) {
  96. param = param || {};
  97. param.itemCode = classify_itemCode;
  98. $('#gridtable').jfGridSet('reload', param);
  99. }
  100. };
  101. refreshGird = function () {
  102. page.search();
  103. };
  104. page.init();
  105. }