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 11 KiB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2022-11-07 14:25
  5. * 描 述:经费开支申报
  6. */
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var startTime;
  11. var endTime;
  12. var processId = '';
  13. var page = {
  14. init: function () {
  15. page.initGird();
  16. page.bind();
  17. },
  18. bind: function () {
  19. // 时间搜索框
  20. $('#datesearch').lrdate({
  21. dfdata: [
  22. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  23. { 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') } },
  24. { 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') } },
  25. { 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') } }
  26. ],
  27. // 月
  28. mShow: false,
  29. premShow: false,
  30. // 季度
  31. jShow: false,
  32. prejShow: false,
  33. // 年
  34. ysShow: false,
  35. yxShow: false,
  36. preyShow: false,
  37. yShow: false,
  38. // 默认
  39. dfvalue: '3',
  40. selectfn: function (begin, end) {
  41. startTime = begin;
  42. endTime = end;
  43. page.search();
  44. }
  45. });
  46. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  47. page.search(queryJson);
  48. }, 220, 400);
  49. $('#ApplyUser').lrDataSourceSelect({ code: 'teacheruserdata', value: 'f_userid', text: 'f_realname' });
  50. // 刷新
  51. $('#lr_refresh').on('click', function () {
  52. location.reload();
  53. });
  54. // 新增
  55. $('#lr_add').on('click', function () {
  56. learun.layerForm({
  57. id: 'formFundsApply',
  58. title: '申请',
  59. url: top.$.rootUrl + '/AssetManagementSystem/FundsApply/Form',
  60. width: 860,
  61. height: 780,
  62. callBack: function (id) {
  63. var res = false;
  64. // 验证数据
  65. res = top[id].validForm();
  66. // 保存数据
  67. if (res) {
  68. res = top[id].save('', function () {
  69. page.search();
  70. });
  71. //processId = learun.newGuid();
  72. //res = top[id].save(processId, refreshGirdData);
  73. }
  74. return res;
  75. }
  76. });
  77. });
  78. // 编辑
  79. $('#lr_edit').on('click', function () {
  80. var keyValue = $('#gridtable').jfGridValue('Id');
  81. if (learun.checkrow(keyValue)) {
  82. var Status = $('#gridtable').jfGridValue('Status');
  83. if (Status !== 0) {
  84. learun.alert.warning("当前项目已提交不能编辑!");
  85. return;
  86. }
  87. learun.layerForm({
  88. id: 'formFundsApply',
  89. title: '编辑',
  90. url: top.$.rootUrl + '/AssetManagementSystem/FundsApply/Form?keyValue=' + keyValue,
  91. width: 860,
  92. height: 780,
  93. callBack: function (id) {
  94. var res = false;
  95. // 验证数据
  96. res = top[id].validForm();
  97. // 保存数据
  98. if (res) {
  99. res = top[id].save('', function () {
  100. page.search();
  101. });
  102. }
  103. return res;
  104. }
  105. });
  106. }
  107. });
  108. // 删除
  109. $('#lr_delete').on('click', function () {
  110. var keyValue = $('#gridtable').jfGridValue('Id');
  111. if (learun.checkrow(keyValue)) {
  112. var Status = $('#gridtable').jfGridValue('Status');
  113. if (Status !== 0) {
  114. learun.alert.warning("当前项目已提交不能编辑!");
  115. return;
  116. }
  117. learun.layerConfirm('是否确认删除该项!', function (res) {
  118. if (res) {
  119. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/FundsApply/DeleteForm', { keyValue: keyValue }, function () {
  120. page.search();
  121. });
  122. }
  123. });
  124. }
  125. });
  126. // 打印
  127. $('#lr_print').on('click', function () {
  128. $('#gridtable').jqprintTable();
  129. });
  130. // 提交
  131. $('#lr_submit').on('click', function () {
  132. var keyValue = $('#gridtable').jfGridValue('Id');
  133. if (learun.checkrow(keyValue)) {
  134. var Status = $('#gridtable').jfGridValue('Status');
  135. if (Status !== 0) {
  136. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  137. return;
  138. }
  139. learun.layerConfirm('是否确认提交该项!', function (res) {
  140. if (res) {
  141. processId = learun.newGuid();
  142. learun.postForm(top.$.rootUrl + '/AssetManagementSystem/FundsApply/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  143. refreshGirdData(res, {});
  144. });
  145. }
  146. });
  147. }
  148. });
  149. //查看
  150. $('#lr_look').on('click', function () {
  151. var keyValue = $('#gridtable').jfGridValue('Id');
  152. if (learun.checkrow(keyValue)) {
  153. learun.layerForm({
  154. id: 'formFundsApply',
  155. title: '查看',
  156. url: top.$.rootUrl + '/AssetManagementSystem/FundsApply/FormView?keyValue=' + keyValue,
  157. width: 860,
  158. height: 730,
  159. btn: null
  160. });
  161. }
  162. });
  163. },
  164. // 初始化列表
  165. initGird: function () {
  166. $('#gridtable').jfGrid({
  167. url: top.$.rootUrl + '/AssetManagementSystem/FundsApply/GetPageList',
  168. headData: [
  169. { label: "申报单号", name: "EnCode", width: 200, align: "left" },
  170. {
  171. label: "申报部门", name: "ApplyDept", width: 100, align: "left",
  172. formatterAsync: function (callback, value, row, op, $cell) {
  173. learun.clientdata.getAsync('department', {
  174. key: value,
  175. callback: function (_data) {
  176. callback(_data.name);
  177. }
  178. });
  179. }
  180. },
  181. { label: "填报时间", name: "ApplyTime", width: 150, align: "left" },
  182. {
  183. label: "填报人", name: "ApplyUser", width: 100, align: "left",
  184. formatterAsync: function (callback, value, row, op, $cell) {
  185. learun.clientdata.getAsync('user', {
  186. key: value,
  187. callback: function (_data) {
  188. callback(_data.name);
  189. }
  190. });
  191. }
  192. },
  193. { label: "备注", name: "Remark", width: 100, align: "left" },
  194. {
  195. label: "总金额", name: "SumAmount", width: 100, align: "left", formatter: function (cellvalue) {
  196. return cellvalue != null && cellvalue != "" && cellvalue != undefined ? cellvalue.toFixed(2):"0.00" ;
  197. }
  198. },
  199. { label: "人民币(大写)", name: "UpperAmount", width: 200, align: "left" },
  200. {
  201. label: "审批状态", name: "Status", width: 100, align: "left",
  202. formatter: function (cellvalue, row) {
  203. if (cellvalue === 1) {
  204. return '<span class=\"label label-warning\">审批中</span>';
  205. } else if (cellvalue === 2) {
  206. return '<span class=\"label label-success\">审批通过</span>';
  207. } else if (cellvalue === 0){
  208. return '<span class=\"label label-default\" >草稿</span>';
  209. } else {
  210. return "<span class=\"label label-danger\">作废</span>";
  211. }
  212. }
  213. }
  214. ],
  215. mainId: 'Id',
  216. isPage: true,
  217. sidx: 'ApplyTime desc, Status desc'
  218. });
  219. //page.search();
  220. },
  221. search: function (param) {
  222. param = param || {};
  223. param.StartTime = startTime;
  224. param.EndTime = endTime;
  225. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  226. }
  227. };
  228. refreshGirdData = function (res, postData) {
  229. if (!!res) {
  230. if (res.code == 200) {
  231. // 发起流程
  232. var postData = {
  233. schemeCode: 'LC_FundsApply',// 填写流程对应模板编号
  234. processId: processId,
  235. level: '1',
  236. };
  237. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  238. learun.loading(false);
  239. });
  240. }
  241. page.search();
  242. }
  243. };
  244. page.init();
  245. }