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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. page.search({ queryJson: JSON.stringify(queryJson)});
  45. },220);
  46. // 客户选择
  47. $('#customerId').lrselect({
  48. url: top.$.rootUrl + '/LR_CRMModule/Customer/GetList',
  49. text: 'F_FullName',
  50. value: 'F_CustomerId',
  51. allowSearch: true,
  52. maxHeight: 400
  53. });
  54. // 销售人员
  55. $('#sellerId').lrselect({
  56. url: top.$.rootUrl + '/LR_OrganizationModule/User/GetList?departmentId=2f077ff9-5a6b-46b3-ae60-c5acdc9a48f1',
  57. text: 'F_RealName',
  58. value: 'F_UserId',
  59. allowSearch: true,
  60. maxHeight: 400
  61. });
  62. // 收款方式
  63. $('#paymentState').lrDataItemSelect({ code: 'Client_PaymentMode' });
  64. // 查询
  65. $('#btn_Search').on('click', function () {
  66. var keyword = $('#txt_Keyword').val();
  67. page.search({ keyword: keyword });
  68. });
  69. // 刷新
  70. $('#lr_refresh').on('click', function () {
  71. location.reload();
  72. });
  73. // 新增
  74. $('#lr_add').on('click', function () {
  75. learun.frameTab.open({ F_ModuleId: 'order_add', F_Icon: 'fa fa-file-text-o', F_FullName: '新增订单', F_UrlAddress: '/LR_CRMModule/CrmOrder/Form' });
  76. });
  77. // 编辑
  78. $('#lr_edit').on('click', function () {
  79. var keyValue = $('#gridtable').jfGridValue('F_OrderId');
  80. if (learun.checkrow(keyValue)) {
  81. learun.frameTab.open({ F_ModuleId: 'order_add', F_Icon: 'fa fa-file-text-o', F_FullName: '新增订单', F_UrlAddress: '/LR_CRMModule/CrmOrder/Form?keyValue=' + keyValue });
  82. }
  83. });
  84. // 删除
  85. $('#lr_delete').on('click', function () {
  86. var keyValue = $('#gridtable').jfGridValue('F_OrderId');
  87. if (learun.checkrow(keyValue)) {
  88. learun.layerConfirm('是否确认删除该项!', function (res) {
  89. if (res) {
  90. learun.deleteForm(top.$.rootUrl + '/LR_CRMModule/CrmOrder/DeleteForm', { keyValue: keyValue }, function () {
  91. refreshGirdData();
  92. });
  93. }
  94. });
  95. }
  96. });
  97. },
  98. initGrid: function () {
  99. $('#gridtable').lrAuthorizeJfGrid({
  100. url: top.$.rootUrl + '/LR_CRMModule/CrmOrder/GetPageList',
  101. headData: [
  102. {
  103. label: "单据日期", name: "F_OrderDate", width: 100, align: "left",
  104. formatter: function (cellvalue) {
  105. return learun.formatDate(cellvalue, 'yyyy-MM-dd');
  106. }
  107. },
  108. { label: "单据编号", name: "F_OrderCode", width: 130, align: "left" },
  109. {
  110. label: "客户名称", name: "F_CustomerId", width: 250, align: "left",
  111. formatterAsync: function (callback, value, row) {
  112. learun.clientdata.getAsync('custmerData', {
  113. url: '/LR_CRMModule/Customer/GetList',
  114. key: value,
  115. keyId: 'F_CustomerId',
  116. callback: function (item) {
  117. callback(item.F_FullName);
  118. }
  119. });
  120. }
  121. },
  122. {
  123. label: "销售人员", name: "F_SellerId", width: 80, align: "left",
  124. formatterAsync: function (callback, value, row) {
  125. learun.clientdata.getAsync('user', {
  126. key: value,
  127. callback: function (item) {
  128. callback(item.name);
  129. }
  130. });
  131. }
  132. },
  133. { label: "优惠金额", name: "F_DiscountSum", width: 80, align: "left" },
  134. { label: "收款金额", name: "F_Accounts", width: 80, align: "left" },
  135. {
  136. label: "收款方式", name: "F_PaymentMode", width: 80, align: "center",
  137. formatterAsync: function (callback, value, row) {
  138. learun.clientdata.getAsync('dataItem', {
  139. key: value,
  140. code: 'Client_PaymentMode',
  141. callback: function (_data) {
  142. callback(_data.text);
  143. }
  144. });
  145. }
  146. },
  147. {
  148. label: "收款状态", name: "F_PaymentState", width: 80, align: "center",
  149. formatter: function (cellvalue) {
  150. if (cellvalue == 2) {
  151. return "<span style='color:green'>部分收款</span>";
  152. } else if (cellvalue == 3) {
  153. return "<span style='color:blue'>全部收款</span>";
  154. } else {
  155. return "<span style='color:red'>未收款</span>";
  156. }
  157. }
  158. },
  159. { label: "制单人员", name: "F_CreateUserName", width: 80, align: "left" },
  160. { label: "备注", name: "F_Description", width: 200, align: "left" }
  161. ],
  162. mainId: 'F_OrderId',
  163. reloadSelected: true,
  164. isPage: true
  165. });
  166. page.search();
  167. },
  168. search: function (param) {
  169. $('#gridtable').jfGridSet('reload', param);
  170. }
  171. };
  172. // 保存数据后回调刷新
  173. refreshGirdData = function () {
  174. page.search();
  175. }
  176. page.init();
  177. }