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.
 
 
 
 
 
 

255 lines
11 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2020-11-18 10:46
  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. $('#DepartmentId').lrDepartmentSelect();
  21. $('#User').lrDataItemSelect({ code: '' });
  22. // 刷新
  23. $('#lr_refresh').on('click', function () {
  24. location.reload();
  25. });
  26. // 新增
  27. $('#lr_add').on('click', function () {
  28. learun.layerForm({
  29. id: 'form',
  30. title: '新增',
  31. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/Form',
  32. width: 600,
  33. height: 400,
  34. callBack: function (id) {
  35. var res = false;
  36. // 验证数据
  37. res = top[id].validForm();
  38. // 保存数据
  39. if (res) {
  40. res = top[id].save('', function () {
  41. page.search();
  42. });
  43. }
  44. return res;
  45. }
  46. });
  47. });
  48. // 编辑
  49. $('#lr_edit').on('click', function () {
  50. var keyValue = $('#gridtable').jfGridValue('ID');
  51. if (learun.checkrow(keyValue)) {
  52. var SendFlag = $('#gridtable').jfGridValue('Status');
  53. if (SendFlag) {
  54. learun.alert.warning("当前项目已提交不能编辑!");
  55. return;
  56. }
  57. learun.layerForm({
  58. id: 'form',
  59. title: '编辑',
  60. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/Form?keyValue=' + keyValue,
  61. width: 600,
  62. height: 400,
  63. callBack: function (id) {
  64. var res = false;
  65. // 验证数据
  66. res = top[id].validForm();
  67. // 保存数据
  68. if (res) {
  69. res = top[id].save('', function () {
  70. page.search();
  71. });
  72. }
  73. return res;
  74. }
  75. });
  76. }
  77. });
  78. // 查看
  79. $('#lr_view').on('click', function () {
  80. var keyValue = $('#gridtable').jfGridValue('ID');
  81. if (learun.checkrow(keyValue)) {
  82. learun.layerForm({
  83. id: 'form',
  84. title: '查看',
  85. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/ViewForm?keyValue=' + keyValue,
  86. width: 600,
  87. height: 400,
  88. btn: null
  89. });
  90. }
  91. });
  92. // 删除
  93. $('#lr_delete').on('click', function () {
  94. var keyValue = $('#gridtable').jfGridValue('ID');
  95. if (learun.checkrow(keyValue)) {
  96. var SendFlag = $('#gridtable').jfGridValue('Status');
  97. if (SendFlag) {
  98. learun.alert.warning("当前项目已提交不能不能删除!");
  99. return;
  100. }
  101. learun.layerConfirm('是否确认删除该项!', function (res) {
  102. if (res) {
  103. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/DeleteForm', { keyValue: keyValue }, function () {
  104. refreshGirdData();
  105. });
  106. }
  107. });
  108. }
  109. });
  110. // 打印
  111. $('#lr_print').on('click', function () {
  112. $('#gridtable').jqprintTable();
  113. });
  114. //审核
  115. $('#check').on('click', function () {
  116. var keyValue = $('#gridtable').jfGridValue('ID');
  117. if (learun.checkrow(keyValue)) {
  118. var Status = $('#gridtable').jfGridValue('Status');
  119. if (Status != 0) {
  120. learun.alert.warning("当前项无需验收!");
  121. return;
  122. }
  123. learun.layerConfirm('是否确认审核该项?', function (res) {
  124. if (res) {
  125. learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/Check', { keyValue: keyValue }, function () {
  126. refreshGirdData();
  127. });
  128. }
  129. });
  130. }
  131. });
  132. //去审
  133. $('#uncheck').on('click', function () {
  134. var keyValue = $('#gridtable').jfGridValue('ID');
  135. if (learun.checkrow(keyValue)) {
  136. var Status = $('#gridtable').jfGridValue('Status');
  137. //var Status = Status.split(',');
  138. if (Status != 0) {
  139. learun.alert.warning("当前项无需验收!");
  140. return;
  141. }
  142. learun.layerConfirm('是否确认取消审核该项?', function (res) {
  143. if (res) {
  144. learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/UnCheck', { keyValue: keyValue }, function () {
  145. refreshGirdData();
  146. });
  147. }
  148. });
  149. }
  150. });
  151. //  提交
  152. $('#lr_submit').on('click', function () {
  153. var keyValue = $('#gridtable').jfGridValue('ID');
  154. if (learun.checkrow(keyValue)) {
  155. var SendFlag = $('#gridtable').jfGridValue('Status');
  156. if (SendFlag) {
  157. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  158. return;
  159. }
  160. learun.layerConfirm('是否确认提交该项!', function (res) {
  161. if (res) {
  162. processId = learun.newGuid();
  163. learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  164. refreshGirdData(res, {});
  165. });
  166. }
  167. });
  168. }
  169. });
  170. },
  171. // 初始化列表
  172. initGird: function () {
  173. $('#gridtable').lrAuthorizeJfGrid({
  174. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/GetPageList',
  175. headData: [
  176. { label: "设备名称", name: "Name", width: 100, align: "left" },
  177. { label: "品牌", name: "Manufacturer", width: 100, align: "left" },
  178. { label: "规格型号", name: "Model", width: 100, align: "left" },
  179. { label: "单位", name: "Unit", width: 100, align: "left" },
  180. { label: "数量", name: "Stock", width: 100, align: "left" },
  181. { label: "单价", name: "Price", width: 100, align: "left" },
  182. { label: "总价", name: "TotalPrice", width: 100, align: "left" },
  183. {
  184. label: "使用部门", name: "DepartmentId", width: 100, align: "left",
  185. formatterAsync: function (callback, value, row, op, $cell) {
  186. learun.clientdata.getAsync('department', {
  187. key: value,
  188. callback: function (_data) {
  189. callback(_data.name);
  190. }
  191. });
  192. }
  193. },
  194. {
  195. label: "使用人", name: "UserID", width: 100, align: "left",
  196. formatterAsync: function (callback, value, row, op, $cell) {
  197. learun.clientdata.getAsyncReal('user', {
  198. key: value,
  199. callback: function (_data) {
  200. callback(_data.name);
  201. }
  202. });
  203. }
  204. },
  205. { label: "放置地点", name: "Place", width: 100, align: "left" },
  206. {
  207. label: "状态", name: "Status", width: 100, align: "left",
  208. formatter: function (cellvalue, row) {
  209. if (cellvalue === '0') {
  210. return '<span class=\"label label-warning\">审批中</span>';
  211. } else if (cellvalue === '1') {
  212. return '<span class=\"label label-success\">验收成功</span>';
  213. } else {
  214. return '<span class=\"label label-default\" >验收不合规</span>';
  215. }
  216. }
  217. },
  218. { label: "备注", name: "Remark", width: 100, align: "left" },
  219. ],
  220. mainId: 'ID',
  221. isPage: true
  222. });
  223. page.search();
  224. },
  225. search: function (param) {
  226. param = param || {};
  227. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  228. }
  229. };
  230. //refreshGirdData = function (res, postData) {
  231. // if (!!res)
  232. // {
  233. // if (res.code == 200)
  234. // {
  235. // // 发起流程
  236. // var postData = {
  237. // schemeCode:'ASS_zcys',// 填写流程对应模板编号
  238. // processId:processId,
  239. // level:'1',
  240. // };
  241. // learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function(data) {
  242. // learun.loading(false);
  243. // });
  244. // }
  245. // page.search();
  246. // }
  247. //};
  248. refreshGirdData = function () {
  249. page.search();
  250. };
  251. page.init();
  252. }