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.
 
 
 
 
 
 

207 lines
8.3 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-09-11 10:35
  5. * 描 述:资产报废
  6. */
  7. var refreshGirdData;
  8. var refreshGirdData1;
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var processId = '';
  12. var page = {
  13. init: function () {
  14. page.initGird();
  15. page.bind();
  16. },
  17. bind: function () {
  18. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  19. page.search(queryJson);
  20. }, 220, 400);
  21. $('#SPType').lrDataItemSelect({ code: 'AssScrap' });
  22. // 刷新
  23. $('#lr_refresh').on('click', function () {
  24. location.reload();
  25. });
  26. // 新增
  27. $('#lr_add').on('click', function () {
  28. learun.layerForm({
  29. id: 'formAss_ScrapItemApply',
  30. title: '新增',
  31. url: top.$.rootUrl + '/AssetManagementSystem/AssScrap/Form',
  32. width: 1000,
  33. height: 700,
  34. callBack: function (id) {
  35. var res = false;
  36. // 验证数据
  37. res = top[id].validForm();
  38. // 保存数据
  39. if (res) {
  40. //processId = learun.newGuid();
  41. //res = top[id].save(processId, refreshGirdData);
  42. res = top[id].save('', function () {
  43. page.search();
  44. });
  45. }
  46. return res;
  47. }
  48. });
  49. });
  50. // 编辑
  51. $('#lr_edit').on('click', function () {
  52. var keyValue = $('#gridtable').jfGridValue('SPID');
  53. if (learun.checkrow(keyValue)) {
  54. var AAStatus = $('#gridtable').jfGridValue('SPStatus');
  55. if (AAStatus !== 0) {
  56. learun.alert.warning("当前项目已提交不能编辑!");
  57. return;
  58. }
  59. learun.layerForm({
  60. id: 'formAss_ScrapItemApply',
  61. title: '编辑',
  62. url: top.$.rootUrl + '/AssetManagementSystem/AssScrap/Form?keyValue=' + keyValue,
  63. width: 1000,
  64. height: 700,
  65. callBack: function (id) {
  66. var res = false;
  67. // 验证数据
  68. res = top[id].validForm();
  69. // 保存数据
  70. if (res) {
  71. res = top[id].save('', function () {
  72. page.search();
  73. });
  74. }
  75. return res;
  76. }
  77. });
  78. }
  79. });
  80. // 删除
  81. $('#lr_delete').on('click', function () {
  82. var keyValue = $('#gridtable').jfGridValue('SPID');
  83. if (learun.checkrow(keyValue)) {
  84. var AAStatus = $('#gridtable').jfGridValue('SPStatus');
  85. if (AAStatus !== 0) {
  86. learun.alert.warning("当前项目已提交不能删除!");
  87. return;
  88. }
  89. learun.layerConfirm('是否确认删除该项!', function (res) {
  90. if (res) {
  91. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/AssScrap/DeleteForm', { keyValue: keyValue }, function () {
  92. refreshGirdData1();
  93. });
  94. }
  95. });
  96. }
  97. });
  98. // 查看申请
  99. $('#lr_view').on('click', function () {
  100. var keyValue = $('#gridtable').jfGridValue('SPID');
  101. if (learun.checkrow(keyValue)) {
  102. learun.layerForm({
  103. id: 'formAss_ScrapApply',
  104. title: '查看盘点申请',
  105. url: top.$.rootUrl + '/AssetManagementSystem/AssScrap/FormView?keyValue=' + keyValue,
  106. width: 1000,
  107. height: 600,
  108. btn: null
  109. });
  110. }
  111. });
  112. //  提交
  113. $('#lr_refer').on('click', function () {
  114. var keyValue = $('#gridtable').jfGridValue('SPID');
  115. if (learun.checkrow(keyValue)) {
  116. var AAStatus = $('#gridtable').jfGridValue('SPStatus');
  117. if (AAStatus !== 0) {
  118. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  119. return;
  120. }
  121. learun.layerConfirm('是否确认提交该项!', function (res) {
  122. if (res) {
  123. processId = learun.newGuid();
  124. learun.postForm(top.$.rootUrl + '/AssetManagementSystem/AssScrap/ModifyStatus', { keyValue: keyValue, pastatus: 1, processId: processId }, function (res) {
  125. refreshGirdData(res, {});
  126. });
  127. }
  128. });
  129. }
  130. });
  131. // 打印
  132. $('#lr_print').on('click', function () {
  133. $('#gridtable').jqprintTable();
  134. });
  135. },
  136. // 初始化列表
  137. initGird: function () {
  138. $('#gridtable').lrAuthorizeJfGrid({
  139. url: top.$.rootUrl + '/AssetManagementSystem/AssScrap/GetPageList',
  140. headData: [
  141. { label: "报废单号", name: "SPNo", width: 150, align: "left" },
  142. {
  143. label: "报废方式", name: "SPType", width: 100, align: "left",
  144. formatterAsync: function (callback, value, row, op, $cell) {
  145. learun.clientdata.getAsync('dataItem', {
  146. key: value,
  147. code: 'AssScrap',
  148. callback: function (_data) {
  149. callback(_data.text);
  150. }
  151. });
  152. }
  153. },
  154. { label: "申请日期", name: "SPEntryDate", width: 150, align: "left" },
  155. {
  156. label: "状态", name: "SPStatus", width: 100, align: "left",
  157. formatter: function (cellvalue, row) {
  158. if (cellvalue === 1) {
  159. return '<span class=\"label label-warning\">审批中</span>';
  160. } else if (cellvalue === 2) {
  161. return '<span class=\"label label-success\">审批通过</span>';
  162. } else {
  163. return '<span class=\"label label-default\" >草稿</span>';
  164. }
  165. }
  166. },
  167. { label: "说明", name: "SPRemark", width: 200, align: "left" },
  168. ],
  169. mainId: 'F_CompanyId',
  170. isPage: true
  171. });
  172. page.search();
  173. },
  174. search: function (param) {
  175. param = param || {};
  176. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  177. }
  178. };
  179. refreshGirdData = function (res, postData) {
  180. if (res && res.code == 200) {
  181. // 发起流程
  182. var postData = {
  183. schemeCode: 'Ass_Scrap',// 填写流程对应模板编号
  184. processId: processId,
  185. level: '1',
  186. };
  187. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  188. learun.loading(false);
  189. });
  190. page.search();
  191. }
  192. };
  193. refreshGirdData1 = function () {
  194. page.search();
  195. };
  196. page.init();
  197. }