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.
 
 
 
 
 
 

306 lines
14 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2021-05-28 14:18
  5. * 描 述:支出预算管理
  6. */
  7. var refreshGirdData;
  8. var processId = '';
  9. var ptype = '';
  10. var url = '';
  11. var bootstrap = function ($, learun) {
  12. "use strict";
  13. var page = {
  14. init: function () {
  15. page.initGird();
  16. page.bind();
  17. page.initTree();
  18. },
  19. bind: function () {
  20. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  21. page.search(queryJson);
  22. }, 220, 400);
  23. $('#PType').lrDataItemSelect({ code: 'payReimburseType' });
  24. $('#PPayType').lrDataItemSelect({ code: 'fdPayType' });
  25. $('#PTopSource').lrDataItemSelect({ code: 'fdPaySource' });
  26. // 刷新
  27. $('#lr_refresh').on('click', function () {
  28. refreshGirdData();
  29. });
  30. // 查看
  31. $('#lr_eye').on('click', function () {
  32. page.eye();
  33. });
  34. // 新增
  35. $('#lr_add').on('click', function () {
  36. if (!ptype) {
  37. learun.alert.warning("请选择类型!");
  38. return;
  39. }
  40. learun.layerForm({
  41. id: 'form',
  42. title: '新增',
  43. url: top.$.rootUrl + url + '?ptype=' + ptype,
  44. width: 800,
  45. height: 600,
  46. callBack: function (id) {
  47. return top[id].save('', refreshGirdData());
  48. }
  49. });
  50. });
  51. // 编辑
  52. $('#lr_edit').on('click', function () {
  53. var keyValue = $('#gridtable').jfGridValue('PId');
  54. var status = $('#gridtable').jfGridValue('PStatus');
  55. if (status != 0) {
  56. learun.alert.warning("当前项目已提交,不可编辑!");
  57. return;
  58. }
  59. if (learun.checkrow(keyValue)) {
  60. learun.layerForm({
  61. id: 'form',
  62. title: '编辑',
  63. url: top.$.rootUrl + url + '?keyValue=' + keyValue + '&ptype=' + ptype,
  64. width: 800,
  65. height: 600,
  66. callBack: function (id) {
  67. return top[id].save('', refreshGirdData());
  68. }
  69. });
  70. }
  71. });
  72. // 删除
  73. $('#lr_delete').on('click', function () {
  74. var keyValue = $('#gridtable').jfGridValue('PId');
  75. var status = $('#gridtable').jfGridValue('PStatus');
  76. if (status != 0) {
  77. learun.alert.warning("当前项目已提交,不可删除!");
  78. return;
  79. }
  80. if (learun.checkrow(keyValue)) {
  81. learun.layerConfirm('是否确认删除该项!', function (res) {
  82. if (res) {
  83. learun.deleteForm(top.$.rootUrl + '/ReceiveSendFeeManagement/FD_PayManage/DeleteForm', { keyValue: keyValue }, function () {
  84. refreshGirdData();
  85. });
  86. }
  87. });
  88. }
  89. });
  90. // 打印
  91. $('#lr_print').on('click', function () {
  92. //$('#gridtable').jqprintTable();
  93. var keyValue = $('#gridtable').jfGridValue('PId');
  94. var processId = $('#gridtable').jfGridValue('PProcessId');
  95. var status = $('#gridtable').jfGridValue('PStatus');
  96. if (status == '0') {
  97. learun.alert.warning("请先提交当前项目!");
  98. return;
  99. }
  100. if (learun.checkrow(keyValue)) {
  101. var type = $('#gridtable').jfGridValue('PType');
  102. //PType 1:基本承包经费外支出--专用经费报销流程; 2:基本承包经费支出--公用经费报销流程
  103. if (type == '1') {
  104. //基本承包经费外支出
  105. learun.frameTab.open({ F_ModuleId: keyValue, F_Icon: 'fa magic', F_FullName: '打印【基本承包经费外支出】', F_UrlAddress: '/ReceiveSendFeeManagement/FD_PayManage/PrintSpecial?keyValue=' + keyValue + "&processId=" + processId });
  106. }
  107. else {
  108. learun.frameTab.open({ F_ModuleId: keyValue, F_Icon: 'fa magic', F_FullName: '打印【基本承包经费支出】', F_UrlAddress: '/ReceiveSendFeeManagement/FD_PayManage/PrintPublic?keyValue=' + keyValue + "&processId=" + processId });
  109. }
  110. }
  111. });
  112. //  提交
  113. $('#lr_submit').on('click', function () {
  114. var keyValue = $('#gridtable').jfGridValue('PId');
  115. if (learun.checkrow(keyValue)) {
  116. var status = $('#gridtable').jfGridValue('PStatus');
  117. if (status != 0) {
  118. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  119. return;
  120. }
  121. var PType = $('#gridtable').jfGridValue('PType');
  122. learun.layerConfirm('是否确认提交该项!', function (res) {
  123. if (res) {
  124. processId = learun.newGuid();
  125. learun.postForm(top.$.rootUrl + '/ReceiveSendFeeManagement/FD_PayManage/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  126. refreshGirdData(res, {}, PType);
  127. });
  128. }
  129. });
  130. }
  131. });
  132. },
  133. initTree: function () {
  134. $('#dataTree').lrtree({
  135. url: top.$.rootUrl + '/ReceiveSendFeeManagement/FD_PayManage/GetPTypeTree',
  136. nodeClick: function (item) {
  137. ptype = item.value;
  138. url = '/ReceiveSendFeeManagement/FD_PayManage/Form';
  139. if (ptype == '2') {
  140. //基本承包经费外支出
  141. url = '/ReceiveSendFeeManagement/FD_PayManage/FormPublic';
  142. }
  143. page.search({ PType: ptype });
  144. }
  145. });
  146. },
  147. // 初始化列表
  148. initGird: function () {
  149. $('#gridtable').jfGrid({
  150. url: top.$.rootUrl + '/ReceiveSendFeeManagement/FD_PayManage/GetPageList',
  151. headData: [
  152. {
  153. label: "报销类型",
  154. name: "PType",
  155. width: 160,
  156. align: "left",
  157. formatterAsync: function (callback, value, row, op, $cell) {
  158. learun.clientdata.getAsync('dataItem',
  159. {
  160. key: value,
  161. code: 'payReimburseType',
  162. callback: function (_data) {
  163. callback(_data.text);
  164. }
  165. });
  166. }
  167. },
  168. {
  169. label: "报销部门",
  170. name: "PDept",
  171. width: 100,
  172. align: "left",
  173. formatterAsync: function (callback, value, row, op, $cell) {
  174. learun.clientdata.getAsync('custmerData', {
  175. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata',
  176. key: value,
  177. keyId: 'id',
  178. callback: function (_data) {
  179. callback(_data['name']);
  180. }
  181. });
  182. }
  183. },
  184. { label: '报销时间', name: 'PTime', width: 200, align: "left" },
  185. {
  186. label: "付款方式",
  187. name: "PPayType",
  188. width: 100,
  189. align: "left",
  190. formatterAsync: function (callback, value, row, op, $cell) {
  191. learun.clientdata.getAsync('dataItem',
  192. {
  193. key: value,
  194. code: 'fdPayType',
  195. callback: function (_data) {
  196. callback(_data.text);
  197. }
  198. });
  199. }
  200. },
  201. { label: "发起人", name: "PUserName", width: 100, align: "left" },
  202. { label: "收款单位", name: "PPayee", width: 100, align: "left" },
  203. { label: "开户银行", name: "PPayeeBank", width: 100, align: "left" },
  204. { label: "银行账号", name: "PPayeeBankAccount", width: 100, align: "left" },
  205. { label: "收款人", name: "PCollectionUser", width: 100, align: "left" },
  206. { label: "开卡银行", name: "PCollectionBank1", width: 100, align: "left" },
  207. { label: "卡号", name: "PCollectionBankAccount1", width: 100, align: "left" },
  208. { label: "开卡银行", name: "PCollectionBank2", width: 100, align: "left" },
  209. { label: "卡号", name: "PCollectionBankAccount2", width: 100, align: "left" },
  210. { label: "资金支出用途", name: "PPurpose", width: 100, align: "left" },
  211. {
  212. label: "资金支出来源",
  213. name: "PTopSource",
  214. width: 100,
  215. align: "left",
  216. formatterAsync: function (callback, value, row, op, $cell) {
  217. learun.clientdata.getAsync('dataItem',
  218. {
  219. key: value,
  220. code: 'fdPaySource',
  221. callback: function (_data) {
  222. callback(_data.text);
  223. }
  224. });
  225. }
  226. },
  227. {
  228. label: "财政专项名称",
  229. name: "PIncomeId",
  230. width: 100,
  231. align: "left",
  232. formatterAsync: function (callback, value, row, op, $cell) {
  233. learun.clientdata.getAsync('custmerData', {
  234. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'incomeList',
  235. key: value,
  236. keyId: 'iid',
  237. callback: function (_data) {
  238. callback(_data['iname']);
  239. }
  240. });
  241. }
  242. },
  243. { label: "支出金额", name: "PAmount", width: 100, align: "left" },
  244. {
  245. label: "状态", name: "PStatus", width: 100, align: "left",
  246. formatter: function (cellvalue) {
  247. if (cellvalue == '0') {
  248. return '<span class=\"label label-default\" style=\"cursor: pointer;\">草稿</span>';
  249. } else if (cellvalue == '1') {
  250. return '<span class=\"label label-warning\" style=\"cursor: pointer;\">进行中</span>';
  251. } else if (cellvalue == '2') {
  252. return '<span class=\"label label-success\" style=\"cursor: pointer;\">已审批</span>';
  253. }
  254. }
  255. }
  256. ],
  257. mainId: 'PId',
  258. isPage: true
  259. });
  260. page.search();
  261. },
  262. search: function (param) {
  263. param = param || {};
  264. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  265. },
  266. eye: function () {
  267. var processId = $('#gridtable').jfGridValue('PProcessId') || '';
  268. if (learun.checkrow(processId)) {
  269. learun.frameTab.open({ F_ModuleId: 'monitor' + processId, F_FullName: '查看【支出预算】', F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/MonitorDetailsIndex?processId=' + processId });
  270. }
  271. }
  272. };
  273. //refreshGirdData = function () {
  274. // $('#gridtable').jfGridSet('reload');
  275. //};
  276. refreshGirdData = function (res, postData, PType) {
  277. if (res && res.code && res.code == 200) {
  278. // 发起流程
  279. var schemeCode = '';
  280. //PType 1:基本承包经费外支出--专用经费报销流程; 2:基本承包经费支出--公用经费报销流程
  281. if (PType == '1')
  282. schemeCode = 'specialUseFunds';
  283. else
  284. schemeCode = 'publicFunds';
  285. if (schemeCode) {
  286. var postData = {
  287. schemeCode: schemeCode,// 填写流程对应模板编号
  288. processId: processId,
  289. level: '1',
  290. };
  291. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  292. learun.loading(false);
  293. });
  294. }
  295. }
  296. page.search();
  297. };
  298. page.init();
  299. }