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.

Index.js 8.1 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*
  2. * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  3. * Copyright (c) 2013-2018 北京泉江科技有限公司
  4. * 创建人:陈彬彬
  5. * 日 期:2017.04.17
  6. * 描 述:订单添加
  7. */
  8. var refreshGirdData; // 更新数据
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. page.initGrid();
  14. page.bind();
  15. },
  16. bind: function () {
  17. // 时间搜索框
  18. $('#datesearch').lrdate({
  19. dfdata: [
  20. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  21. { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  22. { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  23. { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }
  24. ],
  25. // 月
  26. mShow: false,
  27. premShow: false,
  28. // 季度
  29. jShow: false,
  30. prejShow: false,
  31. // 年
  32. ysShow: false,
  33. yxShow: false,
  34. preyShow: false,
  35. yShow: false,
  36. // 默认
  37. dfvalue: '1',
  38. selectfn: function (begin, end) {
  39. }
  40. });
  41. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  42. // 调用后台查询
  43. // queryJson 查询条件
  44. console.log(queryJson);
  45. page.search({ queryJson: JSON.stringify(queryJson)});
  46. },220);
  47. // 客户选择
  48. $('#customerId').lrselect({
  49. url: top.$.rootUrl + '/LR_CRMModule/Customer/GetList',
  50. text: 'F_FullName',
  51. value: 'F_CustomerId',
  52. allowSearch: true,
  53. maxHeight: 400
  54. });
  55. // 销售人员
  56. $('#sellerId').lrselect({
  57. url: top.$.rootUrl + '/LR_OrganizationModule/User/GetList?departmentId=2f077ff9-5a6b-46b3-ae60-c5acdc9a48f1',
  58. text: 'F_RealName',
  59. value: 'F_UserId',
  60. allowSearch: true,
  61. maxHeight: 400
  62. });
  63. // 收款方式
  64. $('#paymentState').lrDataItemSelect({ code: 'Client_PaymentMode' });
  65. // 查询
  66. $('#btn_Search').on('click', function () {
  67. var keyword = $('#txt_Keyword').val();
  68. page.search({ keyword: keyword });
  69. });
  70. // 刷新
  71. $('#lr_refresh').on('click', function () {
  72. location.reload();
  73. });
  74. // 新增
  75. $('#lr_add').on('click', function () {
  76. learun.frameTab.open({ F_ModuleId: 'order_add', F_Icon: 'fa fa-file-text-o', F_FullName: '新增订单', F_UrlAddress: '/LR_CRMModule/CrmOrder/Form' });
  77. });
  78. // 编辑
  79. $('#lr_edit').on('click', function () {
  80. var keyValue = $('#gridtable').jfGridValue('F_OrderId');
  81. if (learun.checkrow(keyValue)) {
  82. learun.frameTab.open({ F_ModuleId: 'order_add', F_Icon: 'fa fa-file-text-o', F_FullName: '新增订单', F_UrlAddress: '/LR_CRMModule/CrmOrder/Form?keyValue=' + keyValue });
  83. }
  84. });
  85. // 删除
  86. $('#lr_delete').on('click', function () {
  87. var keyValue = $('#gridtable').jfGridValue('F_OrderId');
  88. if (learun.checkrow(keyValue)) {
  89. learun.layerConfirm('是否确认删除该项!', function (res) {
  90. if (res) {
  91. learun.deleteForm(top.$.rootUrl + '/LR_CRMModule/CrmOrder/DeleteForm', { keyValue: keyValue }, function () {
  92. refreshGirdData();
  93. });
  94. }
  95. });
  96. }
  97. });
  98. },
  99. initGrid: function () {
  100. $('#gridtable').lrAuthorizeJfGrid({
  101. url: top.$.rootUrl + '/LR_CRMModule/CrmOrder/GetPageList',
  102. headData: [
  103. {
  104. label: "单据日期", name: "F_OrderDate", width: 100, align: "left",
  105. formatter: function (cellvalue) {
  106. return learun.formatDate(cellvalue, 'yyyy-MM-dd');
  107. }
  108. },
  109. { label: "单据编号", name: "F_OrderCode", width: 130, align: "left" },
  110. {
  111. label: "客户名称", name: "F_CustomerId", width: 250, align: "left",
  112. formatterAsync: function (callback, value, row) {
  113. learun.clientdata.getAsync('custmerData', {
  114. url: '/LR_CRMModule/Customer/GetList',
  115. key: value,
  116. keyId: 'F_CustomerId',
  117. callback: function (item) {
  118. callback(item.F_FullName);
  119. }
  120. });
  121. }
  122. },
  123. {
  124. label: "销售人员", name: "F_SellerId", width: 80, align: "left",
  125. formatterAsync: function (callback, value, row) {
  126. learun.clientdata.getAsync('user', {
  127. key: value,
  128. callback: function (item) {
  129. callback(item.name);
  130. }
  131. });
  132. }
  133. },
  134. { label: "优惠金额", name: "F_DiscountSum", width: 80, align: "left" },
  135. { label: "收款金额", name: "F_Accounts", width: 80, align: "left" },
  136. {
  137. label: "收款方式", name: "F_PaymentMode", width: 80, align: "center",
  138. formatterAsync: function (callback, value, row) {
  139. learun.clientdata.getAsync('dataItem', {
  140. key: value,
  141. code: 'Client_PaymentMode',
  142. callback: function (_data) {
  143. callback(_data.text);
  144. }
  145. });
  146. }
  147. },
  148. {
  149. label: "收款状态", name: "F_PaymentState", width: 80, align: "center",
  150. formatter: function (cellvalue) {
  151. if (cellvalue == 2) {
  152. return "<span style='color:green'>部分收款</span>";
  153. } else if (cellvalue == 3) {
  154. return "<span style='color:blue'>全部收款</span>";
  155. } else {
  156. return "<span style='color:red'>未收款</span>";
  157. }
  158. }
  159. },
  160. { label: "制单人员", name: "F_CreateUserName", width: 80, align: "left" },
  161. { label: "备注", name: "F_Description", width: 200, align: "left" }
  162. ],
  163. mainId: 'F_OrderId',
  164. reloadSelected: true,
  165. isPage: true
  166. });
  167. page.search();
  168. },
  169. search: function (param) {
  170. $('#gridtable').jfGridSet('reload', param);
  171. }
  172. };
  173. // 保存数据后回调刷新
  174. refreshGirdData = function () {
  175. page.search();
  176. }
  177. page.init();
  178. }