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.
 
 
 
 
 
 

248 lines
11 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. $('#lr_inventory').on('click',
  160. function() {
  161. var keyValue = $('#gridtable').jfGridValue('RID');
  162. if (learun.checkrow(keyValue)) {
  163. learun.layerForm({
  164. id: 'formAss_AssetsOutApply',
  165. title: '清单',
  166. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/Inventory?keyValue=' + keyValue,
  167. width: 1000,
  168. height: 700,
  169. callBack: function(id) {
  170. }
  171. });
  172. }
  173. });
  174. },
  175. // 初始化列表
  176. initGird: function () {
  177. $('#gridtable').lrAuthorizeJfGrid({
  178. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Receive/GetPageList',
  179. headData: [
  180. {
  181. label: "申请人", name: "ReceiveUser", width: 100, align: "left",
  182. formatterAsync: function (callback, value, row, op, $cell) {
  183. learun.clientdata.getAsync('custmerData', {
  184. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'teacheruserdata',
  185. key: value,
  186. keyId: 'f_userid',
  187. callback: function (_data) {
  188. callback(_data['f_realname']);
  189. }
  190. });
  191. }
  192. },
  193. {
  194. label: "申请人部门", name: "PDepartment", width: 100, align: "left",
  195. formatterAsync: function (callback, value, row, op, $cell) {
  196. learun.clientdata.getAsync('custmerData', {
  197. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata',
  198. key: value,
  199. keyId: 'id',
  200. callback: function (_data) {
  201. callback(_data['name']);
  202. }
  203. });
  204. }
  205. },
  206. { label: "申请时间", name: "RTime", width: 100, align: "left" },
  207. {
  208. label: "申请状态", name: "PStatus", width: 100, align: "left", formatter: function (cellvalue, row) {
  209. if (cellvalue == 1) {
  210. return '<span class=\"label label-warning\">审批中</span>';
  211. } else if (cellvalue == 2) {
  212. return '<span class=\"label label-success\">审批通过</span>';
  213. } else {
  214. return '<span class=\"label label-default\" >草稿</span>';
  215. }
  216. } },
  217. ],
  218. mainId: 'RID',
  219. isPage: true
  220. });
  221. },
  222. search: function (param) {
  223. param = param || {};
  224. param.StartTime = startTime;
  225. param.EndTime = endTime;
  226. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  227. }
  228. };
  229. refreshGirdData = function (res, postData) {
  230. if (res && res.code && res.code == 200) {
  231. // 发起流程
  232. var postData = {
  233. schemeCode: 'Ass_ReceiveMethod',// 填写流程对应模板编号
  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. page.init();
  244. }