Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

291 řádky
13 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-03-25 12:00
  5. * 描 述:入库申请
  6. */
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var startTime;
  11. var endTime;
  12. var processId = '';
  13. var page = {
  14. init: function () {
  15. page.initGird();
  16. page.bind();
  17. },
  18. bind: function () {
  19. // 时间搜索框
  20. $('#datesearch').lrdate({
  21. dfdata: [
  22. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  23. { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  24. { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  25. { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }
  26. ],
  27. // 月
  28. mShow: false,
  29. premShow: false,
  30. // 季度
  31. jShow: false,
  32. prejShow: false,
  33. // 年
  34. ysShow: false,
  35. yxShow: false,
  36. preyShow: false,
  37. yShow: false,
  38. // 默认
  39. dfvalue: '3',
  40. selectfn: function (begin, end) {
  41. startTime = begin;
  42. endTime = end;
  43. page.search();
  44. }
  45. });
  46. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  47. page.search(queryJson);
  48. }, 220, 400);
  49. $('#AACreateUserId').lrUserSelect(0);
  50. // 刷新
  51. $('#lr_refresh').on('click', function () {
  52. location.reload();
  53. });
  54. // 新增
  55. $('#lr_add').on('click', function () {
  56. learun.layerForm({
  57. id: 'formAss_AssetsInfoApply',
  58. title: '新增',
  59. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoApply/Form',
  60. width: 1000,
  61. height: 700,
  62. callBack: function (id) {
  63. var res = false;
  64. // 验证数据
  65. res = top[id].validForm();
  66. // 保存数据
  67. if (res) {
  68. //processId = learun.newGuid();
  69. //res = top[id].save(processId, refreshGirdData);
  70. res = top[id].save('', function () {
  71. page.search();
  72. });
  73. }
  74. return res;
  75. }
  76. });
  77. });
  78. // 编辑
  79. $('#lr_edit').on('click', function () {
  80. var keyValue = $('#gridtable').jfGridValue('AAId');
  81. if (learun.checkrow(keyValue)) {
  82. var AAStatus = $('#gridtable').jfGridValue('AAStatus');
  83. if (AAStatus !== 0) {
  84. learun.alert.warning("当前项目已提交不能编辑!");
  85. return;
  86. }
  87. var PId = $('#gridtable').jfGridValue('PId');
  88. if (PId != null) {
  89. learun.layerForm({
  90. id: 'formpurchaseAss_AssetsInfoApply',
  91. title: '采购入库编辑',
  92. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoApply/FormPurchase?keyValue=' + keyValue,
  93. width: 1000,
  94. height: 700,
  95. callBack: function (id) {
  96. var res = false;
  97. // 验证数据
  98. res = top[id].validForm();
  99. // 保存数据
  100. if (res) {
  101. res = top[id].save('', function () {
  102. page.search();
  103. });
  104. }
  105. return res;
  106. }
  107. });
  108. } else {
  109. learun.layerForm({
  110. id: 'formAss_AssetsInfoApply',
  111. title: '编辑',
  112. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoApply/Form?keyValue=' + keyValue,
  113. width: 1000,
  114. height: 700,
  115. callBack: function (id) {
  116. var res = false;
  117. // 验证数据
  118. res = top[id].validForm();
  119. // 保存数据
  120. if (res) {
  121. res = top[id].save('', function () {
  122. page.search();
  123. });
  124. }
  125. return res;
  126. }
  127. });
  128. }
  129. }
  130. });
  131. // 查看入库申请
  132. $('#lr_view').on('click', function () {
  133. var keyValue = $('#gridtable').jfGridValue('AAId');
  134. if (learun.checkrow(keyValue)) {
  135. learun.layerForm({
  136. id: 'formAss_AssetsInfoApply',
  137. title: '查看入库申请',
  138. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoApply/FormView?keyValue=' + keyValue,
  139. width: 1000,
  140. height: 600,
  141. btn: null
  142. });
  143. }
  144. });
  145. $('#lr_viewcg').on('click', function () {
  146. var PId = $('#gridtable').jfGridValue('PId');
  147. //if (learun.checkrow(PId)) {
  148. if (PId == null || PId === undefined || PId === "") {
  149. learun.alert.warning("当前项目不含采购单!");
  150. return;
  151. }
  152. learun.layerForm({
  153. id: 'formAss_Purchase',
  154. title: '查看采购单',
  155. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Purchase/FormView?keyValue=' + PId,
  156. width: 1000,
  157. height: 600,
  158. btn: null
  159. });
  160. //}
  161. });
  162. // 删除
  163. $('#lr_delete').on('click', function () {
  164. var keyValue = $('#gridtable').jfGridValue('AAId');
  165. if (learun.checkrow(keyValue)) {
  166. var AAStatus = $('#gridtable').jfGridValue('AAStatus');
  167. if (AAStatus !== 0) {
  168. learun.alert.warning("当前项目已提交不能删除!");
  169. return;
  170. }
  171. var PId = $('#gridtable').jfGridValue('PId');
  172. if (PId != null) {
  173. learun.alert.warning("当前项目为采购入库申请,不能删除!");
  174. return;
  175. }
  176. learun.layerConfirm('是否确认删除该项!', function (res) {
  177. if (res) {
  178. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoApply/DeleteForm', { keyValue: keyValue }, function () {
  179. refreshGirdData();
  180. });
  181. }
  182. });
  183. }
  184. });
  185. //  提交
  186. $('#lr_submit').on('click', function () {
  187. var keyValue = $('#gridtable').jfGridValue('AAId');
  188. if (learun.checkrow(keyValue)) {
  189. var AAStatus = $('#gridtable').jfGridValue('AAStatus');
  190. if (AAStatus !== 0) {
  191. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  192. return;
  193. }
  194. learun.layerConfirm('是否确认提交该项!', function (res) {
  195. if (res) {
  196. processId = learun.newGuid();
  197. learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoApply/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  198. refreshGirdData(res, {});
  199. });
  200. }
  201. });
  202. }
  203. });
  204. },
  205. // 初始化列表
  206. initGird: function () {
  207. $('#gridtable').lrAuthorizeJfGrid({
  208. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoApply/GetPageList',
  209. headData: [
  210. { label: "入库申请单号", name: "AACode", width: 200, align: "left" },
  211. { label: "入库总价", name: "AAPrice", width: 100, align: "left" },
  212. { label: "申请时间", name: "AACreateTime", width: 150, align: "left" },
  213. {
  214. label: "申请人", name: "AACreateUserId", width: 100, align: "left",
  215. formatterAsync: function (callback, value, row, op, $cell) {
  216. learun.clientdata.getAsync('user', {
  217. key: value,
  218. callback: function (_data) {
  219. callback(_data.name);
  220. }
  221. });
  222. }
  223. },
  224. {
  225. label: "资产属性", name: "AAAssType", width: 100, align: "left",
  226. formatterAsync: function (callback, value, row, op, $cell) {
  227. learun.clientdata.getAsync('dataItem', {
  228. key: value,
  229. code: 'AssType',
  230. callback: function (_data) {
  231. callback(_data.text);
  232. }
  233. });
  234. }
  235. },
  236. {
  237. label: "入库类型", name: "PACode", width: 100, align: "center",
  238. formatter: function (cellvalue, row) {
  239. if (cellvalue) {
  240. return '<span class=\"label label-primary\">采购入库</span>';
  241. } else {
  242. return '<span class=\"label label-success\" >申请入库</span>';
  243. }
  244. }
  245. },
  246. {
  247. label: "审批状态", name: "AAStatus", width: 100, align: "left",
  248. formatter: function (cellvalue, row) {
  249. if (cellvalue === 1) {
  250. return '<span class=\"label label-warning\">审批中</span>';
  251. } else if (cellvalue === 2) {
  252. return '<span class=\"label label-success\">审批通过</span>';
  253. } else {
  254. return '<span class=\"label label-default\" >草稿</span>';
  255. }
  256. }
  257. }
  258. ],
  259. mainId: 'AAId',
  260. isPage: true,
  261. sidx: 'AACreateTime',
  262. sord: 'DASC'
  263. });
  264. },
  265. search: function (param) {
  266. param = param || {};
  267. param.StartTime = startTime;
  268. param.EndTime = endTime;
  269. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  270. }
  271. };
  272. refreshGirdData = function (res, postData) {
  273. if (res && res.code && res.code == 200) {
  274. // 发起流程
  275. var postData = {
  276. schemeCode: 'Ass_AssetsInfoApply',// 填写流程对应模板编号
  277. processId: processId,
  278. level: '1',
  279. };
  280. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  281. learun.loading(false);
  282. });
  283. }
  284. page.search();
  285. };
  286. page.init();
  287. }