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.
 
 
 
 
 
 

256 lines
12 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 refreshGirdData2;
  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. $('#CreateUserId').lrDataSourceSelect({ code: 'teacheruserdata', value: 'f_userid', text: 'f_realname' });
  22. // 刷新
  23. $('#lr_refresh').on('click', function () {
  24. location.reload();
  25. });
  26. // 新增
  27. $('#lr_add').on('click', function () {
  28. learun.layerForm({
  29. id: 'formAss_Acceptance',
  30. title: '新增',
  31. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/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. 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 != 0) {
  54. learun.alert.warning("当前项目已提交不能编辑!");
  55. return;
  56. }
  57. learun.layerForm({
  58. id: 'formAss_Acceptance',
  59. title: '编辑',
  60. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/Form?keyValue=' + keyValue,
  61. width: 1000,
  62. height: 700,
  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. var ProcessId = $('#gridtable').jfGridValue('ProcessId');
  82. if (learun.checkrow(keyValue)) {
  83. learun.layerForm({
  84. id: 'formAss_Acceptance',
  85. title: '查看',
  86. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/FormView?keyValue=' + keyValue + '&ProcessId=' + ProcessId,
  87. width: 1000,
  88. height: 700,
  89. btn: null
  90. });
  91. }
  92. });
  93. // 删除
  94. $('#lr_delete').on('click', function () {
  95. var keyValue = $('#gridtable').jfGridValue('Id');
  96. if (learun.checkrow(keyValue)) {
  97. var SendFlag = $('#gridtable').jfGridValue('Status');
  98. if (SendFlag != 0) {
  99. learun.alert.warning("当前项目已提交不能不能删除!");
  100. return;
  101. }
  102. learun.layerConfirm('是否确认删除该项!', function (res) {
  103. if (res) {
  104. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/DeleteForm', { keyValue: keyValue }, function () {
  105. refreshGirdData2();
  106. });
  107. }
  108. });
  109. }
  110. });
  111. // 打印
  112. $('#lr_print').on('click', function () {
  113. $('#gridtable').jqprintTable();
  114. });
  115. //  提交
  116. $('#lr_submit').on('click', function () {
  117. var keyValue = $('#gridtable').jfGridValue('Id');
  118. if (learun.checkrow(keyValue)) {
  119. var SendFlag = $('#gridtable').jfGridValue('Status');
  120. if (SendFlag != 0) {
  121. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  122. return;
  123. }
  124. learun.layerConfirm('是否确认提交该项!', function (res) {
  125. if (res) {
  126. processId = learun.newGuid();
  127. learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  128. refreshGirdData(res, {});
  129. });
  130. }
  131. });
  132. }
  133. });
  134. },
  135. // 初始化列表
  136. initGird: function () {
  137. $('#gridtable').jfGrid({
  138. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/GetPageList',
  139. headData: [
  140. { label: "申请单号", name: "Code", width: 200, align: "left" },
  141. //{ label: "申请名称", name: "Name", width: 200, align: "left" },
  142. { label: "总价", name: "TotalPrice", width: 100, align: "left" },
  143. { label: "申请时间", name: "CreateTime", width: 150, align: "left" },
  144. {
  145. label: "申请人", name: "CreateUserId", width: 100, align: "left",
  146. formatterAsync: function (callback, value, row, op, $cell) {
  147. learun.clientdata.getAsync('custmerData', {
  148. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
  149. key: value,
  150. keyId: 'f_userid',
  151. callback: function (_data) {
  152. callback(_data['f_realname']);
  153. }
  154. });
  155. }
  156. },
  157. {
  158. label: "审批状态", name: "Status", width: 100, align: "left",
  159. formatter: function (cellvalue, row) {
  160. if (cellvalue === 1) {
  161. return '<span class=\"label label-warning\">审批中</span>';
  162. } else if (cellvalue === 2) {
  163. return '<span class=\"label label-success\">审批通过</span>';
  164. } else {
  165. return '<span class=\"label label-default\" >草稿</span>';
  166. }
  167. }
  168. }
  169. ],
  170. mainId: 'Id',
  171. isPage: true,
  172. sidx: 'CreateTime',
  173. sord: 'DASC'
  174. });
  175. //$('#gridtable').lrAuthorizeJfGrid({
  176. // url: top.$.rootUrl + '/AssetManagementSystem/Ass_Acceptance/GetPageList',
  177. // headData: [
  178. // { label: "设备名称", name: "Name", width: 100, align: "left" },
  179. // { label: "品牌", name: "Manufacturer", width: 100, align: "left" },
  180. // { label: "规格型号", name: "Model", width: 100, align: "left" },
  181. // { label: "单位", name: "Unit", width: 100, align: "left" },
  182. // { label: "数量", name: "Stock", width: 100, align: "left" },
  183. // { label: "单价", name: "Price", width: 100, align: "left" },
  184. // { label: "总价", name: "TotalPrice", width: 100, align: "left" },
  185. // {
  186. // label: "使用部门", name: "DepartmentId", width: 100, align: "left",
  187. // formatterAsync: function (callback, value, row, op, $cell) {
  188. // learun.clientdata.getAsync('department', {
  189. // key: value,
  190. // callback: function (_data) {
  191. // callback(_data.name);
  192. // }
  193. // });
  194. // }
  195. // },
  196. // {
  197. // label: "使用人", name: "UserID", width: 100, align: "left",
  198. // formatterAsync: function (callback, value, row, op, $cell) {
  199. // learun.clientdata.getAsyncReal('user', {
  200. // key: value,
  201. // callback: function (_data) {
  202. // callback(_data.name);
  203. // }
  204. // });
  205. // }
  206. // },
  207. // { label: "放置地点", name: "Place", width: 100, align: "left" },
  208. // {
  209. // label: "状态", name: "Status", width: 100, align: "left",
  210. // formatter: function (cellvalue, row) {
  211. // if (cellvalue === '1') {
  212. // return '<span class=\"label label-warning\">审批中</span>';
  213. // } else if (cellvalue === '2') {
  214. // return '<span class=\"label label-success\">已审核</span>';
  215. // } else {
  216. // return '<span class=\"label label-default\" >草稿</span>';
  217. // }
  218. // }
  219. // },
  220. // { label: "备注", name: "Remark", width: 100, align: "left" },
  221. // ],
  222. // mainId: 'ID',
  223. // isPage: true
  224. //});
  225. page.search();
  226. },
  227. search: function (param) {
  228. param = param || {};
  229. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  230. }
  231. };
  232. refreshGirdData = function (res, postData) {
  233. if (!!res) {
  234. if (res.code == 200) {
  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. refreshGirdData2 = function () {
  249. page.search();
  250. };
  251. page.init();
  252. }