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.
 
 
 
 
 
 

232 lines
10 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2020-08-07 16:34
  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: '1',
  40. selectfn: function (begin, end) {
  41. startTime = begin;
  42. endTime = end;
  43. page.search();
  44. }
  45. });
  46. // 刷新
  47. $('#lr_refresh').on('click', function () {
  48. location.reload();
  49. });
  50. // 新增
  51. $('#lr_add').on('click', function () {
  52. learun.layerForm({
  53. id: 'form',
  54. title: '新增',
  55. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/Form',
  56. width: 1000,
  57. height: 600,
  58. callBack: function (id) {
  59. var res = false;
  60. // 验证数据
  61. res = top[id].validForm();
  62. // 保存数据
  63. if (res) {
  64. //processId = learun.newGuid();
  65. //res = top[id].save(processId, refreshGirdData);
  66. res = top[id].save('', function () {
  67. page.search();
  68. });
  69. }
  70. return res;
  71. }
  72. });
  73. });
  74. // 编辑
  75. $('#lr_edit').on('click', function () {
  76. var keyValue = $('#gridtable').jfGridValue('RID');
  77. if (learun.checkrow(keyValue)) {
  78. var PStatus = $('#gridtable').jfGridValue('PStatus');
  79. if (PStatus != 0) {
  80. learun.alert.warning("当前项目已提交不能编辑!");
  81. return;
  82. }
  83. learun.layerForm({
  84. id: 'form',
  85. title: '编辑',
  86. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/Form?keyValue=' + keyValue,
  87. width: 800,
  88. height: 700,
  89. callBack: function (id) {
  90. var res = false;
  91. // 验证数据
  92. res = top[id].validForm();
  93. // 保存数据
  94. if (res) {
  95. res = top[id].save('', function () {
  96. page.search();
  97. });
  98. }
  99. return res;
  100. }
  101. });
  102. }
  103. });
  104. //查看
  105. $('#lr_view').on('click', function () {
  106. var keyValue = $('#gridtable').jfGridValue('RID');
  107. if (learun.checkrow(keyValue)) {
  108. learun.layerForm({
  109. id: 'forminfoitem',
  110. title: '查看',
  111. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/FormView?keyValue=' + keyValue,
  112. width: 800,
  113. height: 700,
  114. btn: '',
  115. callBack: function (id) {
  116. return top[id].acceptClick(refreshGirdData);
  117. }
  118. });
  119. }
  120. });
  121. // 删除
  122. $('#lr_delete').on('click', function () {
  123. var keyValue = $('#gridtable').jfGridValue('RID');
  124. if (learun.checkrow(keyValue)) {
  125. var PStatus = $('#gridtable').jfGridValue('PStatus');
  126. if (PStatus != 0) {
  127. learun.alert.warning("当前项目已提交不能编辑!");
  128. return;
  129. }
  130. learun.layerConfirm('是否确认删除该项!', function (res) {
  131. if (res) {
  132. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/DeleteForm', { keyValue: keyValue }, function () {
  133. refreshGirdData();
  134. });
  135. }
  136. });
  137. }
  138. });
  139. //  提交
  140. $('#lr_submit').on('click', function () {
  141. var keyValue = $('#gridtable').jfGridValue('RID');
  142. if (learun.checkrow(keyValue)) {
  143. var AAStatus = $('#gridtable').jfGridValue('PStatus');
  144. if (AAStatus != 0) {
  145. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  146. return;
  147. }
  148. learun.layerConfirm('是否确认提交该项!', function (res) {
  149. if (res) {
  150. processId = learun.newGuid();
  151. learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  152. refreshGirdData(res, {});
  153. });
  154. }
  155. });
  156. }
  157. });
  158. },
  159. // 初始化列表
  160. initGird: function () {
  161. $('#gridtable').lrAuthorizeJfGrid({
  162. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/GetPageList',
  163. headData: [
  164. {
  165. label: "申请人", name: "ReceiveUser", width: 100, align: "left",
  166. formatterAsync: function (callback, value, row, op, $cell) {
  167. learun.clientdata.getAsync('custmerData', {
  168. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'teacheruserdata',
  169. key: value,
  170. keyId: 'f_userid',
  171. callback: function (_data) {
  172. callback(_data['f_realname']);
  173. }
  174. });
  175. }
  176. },
  177. {
  178. label: "申请人部门", name: "PDepartment", width: 100, align: "left",
  179. formatterAsync: function (callback, value, row, op, $cell) {
  180. learun.clientdata.getAsync('custmerData', {
  181. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata',
  182. key: value,
  183. keyId: 'id',
  184. callback: function (_data) {
  185. callback(_data['name']);
  186. }
  187. });
  188. }
  189. },
  190. { label: "申请时间", name: "RTime", width: 100, align: "left" },
  191. {
  192. label: "申请状态", name: "PStatus", width: 100, align: "left", formatter: function (cellvalue, row) {
  193. if (cellvalue == 1) {
  194. return '<span class=\"label label-warning\">审批中</span>';
  195. } else if (cellvalue == 2) {
  196. return '<span class=\"label label-success\">审批通过</span>';
  197. } else {
  198. return '<span class=\"label label-default\" >草稿</span>';
  199. }
  200. } },
  201. ],
  202. mainId: 'RID',
  203. isPage: true
  204. });
  205. },
  206. search: function (param) {
  207. param = param || {};
  208. param.StartTime = startTime;
  209. param.EndTime = endTime;
  210. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  211. }
  212. };
  213. refreshGirdData = function (res, postData) {
  214. if (res && res.code && res.code == 200) {
  215. // 发起流程
  216. var postData = {
  217. schemeCode: 'Ass_ReceiveMethod',// 填写流程对应模板编号
  218. processId: processId,
  219. level: '1',
  220. };
  221. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  222. learun.loading(false);
  223. });
  224. }
  225. page.search();
  226. };
  227. page.init();
  228. }