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.
 
 
 
 
 
 

125 lines
5.0 KiB

  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  3. * Copyright (c) 2013-2018 北京泉江科技有限公司
  4. * 创建人:陈彬彬
  5. * 日 期:2017.11.12
  6. * 描 述:客户管理
  7. */
  8. var refreshGirdData; // 更新数据
  9. var selectedRow;
  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. selectedRow = null;//新增前请清空已选中行
  30. learun.layerForm({
  31. id: 'form',
  32. title: '新增客户',
  33. url: top.$.rootUrl + '/LR_CRMModule/Customer/Form',
  34. width: 1000,
  35. height: 620,
  36. maxmin: true,
  37. callBack: function (id) {
  38. return top[id].acceptClick(refreshGirdData);
  39. }
  40. });
  41. });
  42. // 编辑
  43. $('#lr_edit').on('click', function () {
  44. selectedRow = $('#gridtable').jfGridGet('rowdata');
  45. var keyValue = $('#gridtable').jfGridValue('F_CustomerId');
  46. if (learun.checkrow(keyValue)) {
  47. learun.layerForm({
  48. id: 'form',
  49. title: '编辑客户',
  50. url: top.$.rootUrl + '/LR_CRMModule/Customer/Form',
  51. width: 1000,
  52. height: 620,
  53. maxmin: true,
  54. callBack: function (id) {
  55. return top[id].acceptClick(refreshGirdData);
  56. }
  57. });
  58. }
  59. });
  60. // 删除
  61. $('#lr_delete').on('click', function () {
  62. var keyValue = $('#gridtable').jfGridValue('F_CustomerId');
  63. if (learun.checkrow(keyValue)) {
  64. learun.layerConfirm('是否确认删除该项!', function (res) {
  65. if (res) {
  66. learun.deleteForm(top.$.rootUrl + '/LR_CRMModule/Customer/DeleteForm', { keyValue: keyValue }, function () {
  67. refreshGirdData();
  68. });
  69. }
  70. });
  71. }
  72. });
  73. },
  74. initGrid: function () {
  75. $('#gridtable').jfGrid({
  76. url: top.$.rootUrl + '/LR_CRMModule/Customer/GetPageListJson',
  77. headData: [
  78. { label: '客户编号', name: 'F_EnCode', width: 100, align: 'left' },
  79. { label: '客户名称', name: 'F_FullName', width: 200, align: 'left' },
  80. {
  81. label: '客户级别', name: 'F_CustLevelId', width: 100, align: 'left',
  82. formatterAsync: function (callback, value, row) {
  83. learun.clientdata.getAsync('dataItem', {
  84. key: value,
  85. code: 'Client_Level',
  86. callback: function (_data) {
  87. callback(_data.text);
  88. }
  89. });
  90. }
  91. },
  92. { label: '客户类别', name: 'F_CustTypeId', width: 100, align: 'left' },
  93. { label: '客户程度', name: 'F_CustDegreeId', width: 100, align: 'left' },
  94. { label: '公司行业', name: 'F_CustIndustryId', width: 100, align: 'left' },
  95. { label: '联系人', name: 'F_Contact', width: 100, align: 'left' },
  96. { label: '跟进人员', name: 'F_TraceUserName', width: 100, align: 'left' },
  97. {
  98. label: "最后更新", name: "F_ModifyDate", width: 140, align: "left",
  99. formatter: function (cellvalue) {
  100. return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm');
  101. }
  102. },
  103. { label: '备注', name: 'F_Description', width: 200, align: 'left' },
  104. ],
  105. mainId: 'F_CustomerId',
  106. reloadSelected: true,
  107. isPage: true,
  108. sidx: 'F_CreateDate'
  109. });
  110. page.search();
  111. },
  112. search: function (param) {
  113. $('#gridtable').jfGridSet('reload', param);
  114. }
  115. };
  116. // 保存数据后回调刷新
  117. refreshGirdData = function () {
  118. page.search();
  119. }
  120. page.init();
  121. }