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

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