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.
 
 
 
 
 
 

127 lines
5.0 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-03-06 17:19
  5. * 描 述:通讯录
  6. */
  7. var selectedRow;
  8. var refreshGirdData;
  9. var uid;
  10. var bootstrap = function ($, learun) {
  11. "use strict";
  12. var page = {
  13. init: function () {
  14. page.initGird();
  15. page.bind();
  16. page.initData();
  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. selectedRow = null;
  31. learun.layerForm({
  32. id: 'form',
  33. title: '新增',
  34. url: top.$.rootUrl + '/EducationalAdministration/AddressBook/Form',
  35. width: 700,
  36. height: 400,
  37. callBack: function (id) {
  38. return top[id].acceptClick(refreshGirdData);
  39. }
  40. });
  41. });
  42. // 编辑
  43. $('#lr_edit').on('click', function () {
  44. var keyValue = $('#gridtable').jfGridValue('AId');
  45. selectedRow = $('#gridtable').jfGridGet('rowdata');
  46. if (learun.checkrow(keyValue)) {
  47. learun.layerForm({
  48. id: 'form',
  49. title: '编辑',
  50. url: top.$.rootUrl + '/EducationalAdministration/AddressBook/Form?keyValue=' + keyValue,
  51. width: 700,
  52. height: 400,
  53. callBack: function (id) {
  54. return top[id].acceptClick(refreshGirdData);
  55. }
  56. });
  57. }
  58. });
  59. // 删除
  60. $('#lr_delete').on('click', function () {
  61. var keyValue = $('#gridtable').jfGridValue('AId');
  62. if (learun.checkrow(keyValue)) {
  63. learun.layerConfirm('是否确认删除该项!', function (res) {
  64. if (res) {
  65. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/AddressBook/DeleteForm', { keyValue: keyValue}, function () {
  66. refreshGirdData();
  67. });
  68. }
  69. });
  70. }
  71. });
  72. },
  73. initData: function () {
  74. learun.httpAsyncGet(top.$.rootUrl + '/UserCenter/GetUserInfo', function (res) {
  75. if (res.code == 200) {
  76. var baseinfo = res.data.baseinfo;
  77. uid = baseinfo.userId;
  78. }
  79. });
  80. },
  81. initGird: function () {
  82. $('#gridtable').lrAuthorizeJfGrid({
  83. url: top.$.rootUrl + '/EducationalAdministration/AddressBook/GetPageList',
  84. headData: [
  85. { label: '姓名', name: 'AName', width: 200, align: "left" },
  86. {
  87. label: "性别", name: "AGender", width: 200, align: "left",
  88. formatter: function (cellvalue) {
  89. return cellvalue == true ? "男" : "女";
  90. }
  91. },
  92. { label: '单位名称', name: 'ACompany', width: 200, align: "left" },
  93. { label: '单位电话', name: 'ACTell', width: 200, align: "left" },
  94. { label: '手机', name: 'AMobile', width: 200, align: "left" },
  95. { label: '电子邮件', name: 'AEmail', width: 200, align: "left" },
  96. {
  97. label: "是否共享", name: "AIsShare", width: 200, align: "center",
  98. formatter: function (cellvalue) {
  99. return cellvalue == "1" ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  100. }
  101. }
  102. ],
  103. mainId:'AId',
  104. isPage: true,
  105. onSelectRow: function (rowdata) {
  106. if (rowdata.ASaverId != uid) {
  107. $("#lr_edit").hide();
  108. $("#lr_delete").hide();
  109. } else {
  110. $("#lr_edit").show();
  111. $("#lr_delete").show();
  112. }
  113. }
  114. });
  115. page.search();
  116. },
  117. search: function (param) {
  118. param = param || {};
  119. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  120. }
  121. };
  122. refreshGirdData = function () {
  123. page.search();
  124. };
  125. page.init();
  126. }