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.
 
 
 
 
 
 

268 lines
12 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-03-29 11:49
  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. // 刷新
  50. $('#lr_refresh').on('click', function () {
  51. location.reload();
  52. });
  53. // 新增
  54. $('#lr_add').on('click', function () {
  55. learun.layerForm({
  56. id: 'formAss_AssetsOutApply',
  57. title: '新增',
  58. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsOutApply/Form',
  59. width: 1000,
  60. height: 700,
  61. callBack: function (id) {
  62. var res = false;
  63. // 验证数据
  64. res = top[id].validForm();
  65. // 保存数据
  66. if (res) {
  67. //processId = learun.newGuid();
  68. //res = top[id].save(processId, refreshGirdData);
  69. res = top[id].save('', function () {
  70. page.search();
  71. });
  72. }
  73. return res;
  74. }
  75. });
  76. });
  77. // 编辑
  78. $('#lr_edit').on('click', function () {
  79. var keyValue = $('#gridtable').jfGridValue('AOId');
  80. if (learun.checkrow(keyValue)) {
  81. var AAStatus = $('#gridtable').jfGridValue('AOStatus');
  82. if (AAStatus !== 0) {
  83. learun.alert.warning("当前项目已提交不能编辑!");
  84. return;
  85. }
  86. learun.layerForm({
  87. id: 'formAss_AssetsOutApply',
  88. title: '编辑',
  89. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsOutApply/Form?keyValue=' + keyValue,
  90. width: 1000,
  91. height: 700,
  92. callBack: function (id) {
  93. var res = false;
  94. // 验证数据
  95. res = top[id].validForm();
  96. // 保存数据
  97. if (res) {
  98. res = top[id].save('', function () {
  99. page.search();
  100. });
  101. }
  102. return res;
  103. }
  104. });
  105. }
  106. });
  107. // 查看申请
  108. $('#lr_view').on('click', function () {
  109. var keyValue = $('#gridtable').jfGridValue('AOId');
  110. var AOProcessId = $('#gridtable').jfGridValue('AOProcessId');
  111. if (learun.checkrow(keyValue)) {
  112. learun.layerForm({
  113. id: 'formAss_AssetsOutApply',
  114. title: '查看调拨申请',
  115. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsOutApply/FormView?keyValue=' + keyValue + '&AOProcessId=' + AOProcessId,
  116. width: 1000,
  117. height: 700,
  118. btn: null
  119. });
  120. }
  121. });
  122. // 删除
  123. $('#lr_delete').on('click', function () {
  124. var keyValue = $('#gridtable').jfGridValue('AOId');
  125. if (learun.checkrow(keyValue)) {
  126. var AAStatus = $('#gridtable').jfGridValue('AOStatus');
  127. if (AAStatus !== 0) {
  128. learun.alert.warning("当前项目已提交不能删除!");
  129. return;
  130. }
  131. learun.layerConfirm('是否确认删除该项!', function (res) {
  132. if (res) {
  133. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsOutApply/DeleteForm', { keyValue: keyValue }, function () {
  134. refreshGirdData();
  135. });
  136. }
  137. });
  138. }
  139. });
  140. //  提交
  141. $('#lr_submit').on('click', function () {
  142. var keyValue = $('#gridtable').jfGridValue('AOId');
  143. if (learun.checkrow(keyValue)) {
  144. var AAStatus = $('#gridtable').jfGridValue('AOStatus');
  145. if (AAStatus !== 0) {
  146. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  147. return;
  148. }
  149. learun.layerConfirm('是否确认提交该项!', function (res) {
  150. if (res) {
  151. processId = learun.newGuid();
  152. learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsOutApply/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  153. refreshGirdData(res, {});
  154. });
  155. }
  156. });
  157. }
  158. });
  159. //缺货单
  160. $('#lr_incom').on('click', function () {
  161. var keyValue = $('#gridtable').jfGridValue('AOId');
  162. if (learun.checkrow(keyValue)) {
  163. var AOAIId = $('#gridtable').jfGridValue('AOAIId');
  164. if (AOAIId == null || AOAIId === undefined || AOAIId === "") {
  165. learun.alert.warning("当前项目不含缺货单!");
  166. return;
  167. }
  168. learun.layerForm({
  169. id: 'formAss_AssetsOutApplyIncomplete',
  170. title: '查看缺货单',
  171. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsOutApplyIncomplete/Form?keyValue=' + keyValue,
  172. width: 1000,
  173. height: 700,
  174. btn: ["调拨", "关闭"],
  175. callBack: function (id) {
  176. return top[id].acceptClick(refreshGirdData);
  177. }
  178. });
  179. }
  180. });
  181. },
  182. // 初始化列表
  183. initGird: function () {
  184. $('#gridtable').lrAuthorizeJfGrid({
  185. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsOutApply/GetPageList',
  186. headData: [
  187. { label: "调拨单流水号", name: "AOCode", width: 200, align: "left" },
  188. { label: "调拨总价", name: "AOPrice", width: 100, align: "left" },
  189. //{
  190. // label: "出库原因", name: "AOReasonType", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) {
  191. // learun.clientdata.getAsync('dataItem', {
  192. // key: value,
  193. // code: 'ReasonType',
  194. // callback: function (_data) {
  195. // callback(_data.text);
  196. // }
  197. // });
  198. // }
  199. //},
  200. { label: "调拨名称", name: "AOProjectName", width: 150, align: "left" },
  201. { label: "申请时间", name: "AOCreateTime", width: 150, align: "left" },
  202. {
  203. label: "申请人", name: "AOCreateUserId", width: 100, align: "left",
  204. formatterAsync: function (callback, value, row, op, $cell) {
  205. learun.clientdata.getAsync('user', {
  206. key: value,
  207. callback: function (_data) {
  208. callback(_data.name);
  209. }
  210. });
  211. }
  212. },
  213. {
  214. label: "审批状态", name: "AOStatus", width: 100, align: "left",
  215. formatter: function (cellvalue, row) {
  216. if (cellvalue === 1) {
  217. return '<span class=\"label label-warning\">审批中</span>';
  218. } else if (cellvalue === 2) {
  219. return '<span class=\"label label-success\">审批通过</span>';
  220. } else {
  221. return '<span class=\"label label-default\" >草稿</span>';
  222. }
  223. }
  224. },
  225. {
  226. label: "调拨状态", name: "AOOutStatus", width: 100, align: "left",
  227. formatter: function (cellvalue, row) {
  228. if (cellvalue === 0) {
  229. return '<span class=\"label label-warning\">待调拨</span>';
  230. } else if (cellvalue === 2) {
  231. return '<span class=\"label label-success\">调拨完成</span>';
  232. } else {
  233. return '<span class=\"label label-default\" >部分调拨</span>';
  234. }
  235. }
  236. }
  237. ],
  238. mainId: 'AOId',
  239. isPage: true,
  240. sidx: 'AOCreateTime',
  241. sord: 'DASC'
  242. });
  243. },
  244. search: function (param) {
  245. param = param || {};
  246. param.StartTime = startTime;
  247. param.EndTime = endTime;
  248. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  249. }
  250. };
  251. refreshGirdData = function (res, postData) {
  252. if (res && res.code && res.code == 200) {
  253. // 发起流程
  254. var postData = {
  255. schemeCode: 'Ass_AssetsOutApply',// 填写流程对应模板编号
  256. processId: processId,
  257. level: '1',
  258. };
  259. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  260. learun.loading(false);
  261. });
  262. }
  263. page.search();
  264. };
  265. page.init();
  266. }