Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

212 linhas
9.0 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. $('#lr_submit').on('click', function () {
  116. var keyValue = $('#gridtable').jfGridValue('ID');
  117. if (learun.checkrow(keyValue)) {
  118. var SendFlag = $('#gridtable').jfGridValue('Status');
  119. if (SendFlag) {
  120. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  121. return;
  122. }
  123. learun.layerConfirm('是否确认提交该项!', function (res) {
  124. if (res) {
  125. processId = learun.newGuid();
  126. learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  127. refreshGirdData(res, {});
  128. });
  129. }
  130. });
  131. }
  132. });
  133. },
  134. // 初始化列表
  135. initGird: function () {
  136. $('#gridtable').lrAuthorizeJfGrid({
  137. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/GetPageList',
  138. headData: [
  139. { label: "设备名称", name: "Name", width: 100, align: "left"},
  140. { label: "品牌", name: "Manufacturer", width: 100, align: "left"},
  141. { label: "规格型号", name: "Model", width: 100, align: "left"},
  142. { label: "单位", name: "Unit", width: 100, align: "left"},
  143. { label: "数量", name: "Stock", width: 100, align: "left"},
  144. { label: "单价", name: "Price", width: 100, align: "left"},
  145. { label: "总价", name: "TotalPrice", width: 100, align: "left"},
  146. { label: "使用部门", name: "DepartmentId", width: 100, align: "left",
  147. formatterAsync: function (callback, value, row, op,$cell) {
  148. learun.clientdata.getAsync('department', {
  149. key: value,
  150. callback: function (_data) {
  151. callback(_data.name);
  152. }
  153. });
  154. }},
  155. { label: "使用人", name: "UserID", width: 100, align: "left",
  156. formatterAsync: function (callback, value, row, op,$cell) {
  157. learun.clientdata.getAsyncReal('user', {
  158. key: value,
  159. callback: function (_data) {
  160. callback(_data.name);
  161. }
  162. });
  163. }},
  164. { label: "放置地点", name: "Place", width: 100, align: "left" },
  165. {
  166. label: "状态", name: "Status", width: 100, align: "left",
  167. formatter: function (cellvalue, row) {
  168. if (cellvalue === '1') {
  169. return '<span class=\"label label-warning\">审批中</span>';
  170. } else if (cellvalue === '2') {
  171. return '<span class=\"label label-success\">已审核</span>';
  172. } else {
  173. return '<span class=\"label label-default\" >草稿</span>';
  174. }
  175. }
  176. },
  177. { label: "备注", name: "Remark", width: 100, align: "left"},
  178. ],
  179. mainId:'ID',
  180. isPage: true
  181. });
  182. page.search();
  183. },
  184. search: function (param) {
  185. param = param || {};
  186. $('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) });
  187. }
  188. };
  189. refreshGirdData = function (res, postData) {
  190. if (!!res)
  191. {
  192. if (res.code == 200)
  193. {
  194. // 发起流程
  195. var postData = {
  196. schemeCode:'ASS_zcys',// 填写流程对应模板编号
  197. processId:processId,
  198. level:'1',
  199. };
  200. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function(data) {
  201. learun.loading(false);
  202. });
  203. }
  204. page.search();
  205. }
  206. };
  207. page.init();
  208. }