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.
 
 
 
 
 
 

273 lines
12 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2023-05-05 14:52
  5. * 描 述:Ass_FixAssetsApply
  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: '1',
  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. $('#CreateUser').lrUserSelect(0);
  50. $('#UsePeople').lrDataItemSelect({ code: '' });
  51. $('#StorageIdNew').lrDataItemSelect({ code: '' });
  52. $('#StorageId').lrDataItemSelect({ code: '' });
  53. // 刷新
  54. $('#lr_refresh').on('click', function () {
  55. location.reload();
  56. });
  57. // 新增
  58. $('#lr_add').on('click', function () {
  59. learun.layerForm({
  60. id: 'form',
  61. title: '新增',
  62. url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssetsApply/Form',
  63. width: 600,
  64. height: 400,
  65. callBack: function (id) {
  66. var res = false;
  67. // 验证数据
  68. res = top[id].validForm();
  69. // 保存数据
  70. if (res) {
  71. processId = learun.newGuid();
  72. res = top[id].save(processId, refreshGirdData);
  73. }
  74. return res;
  75. }
  76. });
  77. });
  78. // 编辑
  79. $('#lr_edit').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_FixAssetsApply/Form?keyValue=' + keyValue,
  86. width: 600,
  87. height: 400,
  88. callBack: function (id) {
  89. var res = false;
  90. // 验证数据
  91. res = top[id].validForm();
  92. // 保存数据
  93. if (res) {
  94. res = top[id].save('', function () {
  95. page.search();
  96. });
  97. }
  98. return res;
  99. }
  100. });
  101. }
  102. });
  103. // 删除
  104. $('#lr_delete').on('click', function () {
  105. var keyValue = $('#gridtable').jfGridValue('ID');
  106. if (learun.checkrow(keyValue)) {
  107. learun.layerConfirm('是否确认删除该项!', function (res) {
  108. if (res) {
  109. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssetsApply/DeleteForm', { keyValue: keyValue }, function () {
  110. refreshGirdData();
  111. });
  112. }
  113. });
  114. }
  115. });
  116. //提交
  117. $('#lr_submit').on('click', function () {
  118. var keyValue = $('#gridtable').jfGridValue('Id');
  119. if (learun.checkrow(keyValue)) {
  120. var FlowNo = $('#gridtable').jfGridValue('FlowNo');
  121. if (FlowNo != 0) {
  122. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  123. return;
  124. }
  125. learun.layerConfirm('是否确认提交该项!', function (res) {
  126. if (res) {
  127. processId = learun.newGuid();
  128. learun.postForm(top.$.rootUrl + '/EducationalAdministration/ModifyStatus/ModifyStatus', { keyValue: keyValue, pastatus: 1, processId: processId }, function (res) {
  129. refreshGirdData(res, {});
  130. });
  131. }
  132. });
  133. }
  134. });
  135. //  查看
  136. $('#lr_view').on('click', function () {
  137. });
  138. },
  139. // 初始化列表
  140. initGird: function () {
  141. $('#gridtable').lrAuthorizeJfGrid({
  142. url: top.$.rootUrl + '/AssetManagementSystem/Ass_FixAssetsApply/GetPageList',
  143. headData: [
  144. {
  145. label: "申请人", name: "CreateUser", width: 100, align: "left",
  146. formatterAsync: function (callback, value, row, op, $cell) {
  147. learun.clientdata.getAsync('user', {
  148. key: value,
  149. callback: function (_data) {
  150. callback(_data.name);
  151. }
  152. });
  153. }
  154. },
  155. { label: "联系方式", name: "ContactWay", width: 100, align: "left" },
  156. {
  157. label: "接收人", name: "UsePeople", width: 100, align: "left",
  158. formatterAsync: function (callback, value, row, op, $cell) {
  159. learun.clientdata.getAsync('dataItem', {
  160. key: value,
  161. code: '',
  162. callback: function (_data) {
  163. callback(_data.text);
  164. }
  165. });
  166. }
  167. },
  168. { label: "联系方式", name: "ContactWayNew", width: 100, align: "left" },
  169. { label: "卡片编号", name: "CardNumber", width: 200, align: "left" },
  170. { label: "资产名称", name: "FAName", width: 200, align: "left" },
  171. {
  172. label: "现存放地点", name: "StorageId", width: 200, align: "left",
  173. formatterAsync: function (callback, value, row, op, $cell) {
  174. learun.clientdata.getAsync('dataItem', {
  175. key: value,
  176. code: '',
  177. callback: function (_data) {
  178. callback(_data.text);
  179. }
  180. });
  181. }
  182. },
  183. {
  184. label: "存放地点新", name: "StorageIdNew", width: 200, align: "left",
  185. formatterAsync: function (callback, value, row, op, $cell) {
  186. learun.clientdata.getAsync('dataItem', {
  187. key: value,
  188. code: '',
  189. callback: function (_data) {
  190. callback(_data.text);
  191. }
  192. });
  193. }
  194. },
  195. { label: "申请事由", name: "ApplyReasons", width: 240, align: "left" },
  196. {
  197. label: "附件说明", name: "Files", width: 200, align: "left",
  198. formatterAsync: function (callback, value, row, op, $cell) {
  199. $.ajax({
  200. url: '/LR_SystemModule/Annexes/GetAnnexesFileList',
  201. data: { folderId: value },
  202. type: 'GET',
  203. dataType: "json",
  204. async: false,
  205. cache: false,
  206. success: function (res) {
  207. var bb = '';
  208. $.each(res.data, function (i, item) {
  209. bb += item.F_FileName.substring(0, item.F_FileName.indexOf(".")) + ','
  210. })
  211. //$.each(res.data, function(i, item) {
  212. // bb += '<span onclick="downLoad(\'' +
  213. // item.F_Id +
  214. // '\')" style="color:blue">' +
  215. // item.F_FileName.substring(0,item.F_FileName.indexOf(".")) +
  216. // '</span>,&nbsp;&nbsp;&nbsp;';
  217. //})
  218. callback(bb);
  219. }
  220. });
  221. }
  222. },
  223. {
  224. label: "审批状态", name: "Status", width: 100, align: "center",
  225. formatter: function (cellvalue, row) {
  226. if (cellvalue == 0) {
  227. return '<span class=\"label label-warning\">草稿</span>';
  228. } if (cellvalue == 1) {
  229. return '<span class=\"label label-warning\">审批中</span>';
  230. } else if (cellvalue == 2) {
  231. return '<span class=\"label label-success\">审批通过</span>';
  232. }
  233. }
  234. }
  235. ],
  236. mainId: 'ID',
  237. isPage: true
  238. });
  239. },
  240. search: function (param) {
  241. param = param || {};
  242. param.StartTime = startTime;
  243. param.EndTime = endTime;
  244. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  245. }
  246. };
  247. refreshGirdData = function (res, postData) {
  248. if (!!res) {
  249. if (res.code == 200) {
  250. // 发起流程
  251. var postData = {
  252. schemeCode: '',// 填写流程对应模板编号
  253. processId: processId,
  254. level: '1',
  255. };
  256. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  257. learun.loading(false);
  258. });
  259. }
  260. page.search();
  261. }
  262. };
  263. page.init();
  264. }
  265. function downLoad(fileId, fileTwo) {
  266. if (fileTwo) {
  267. top.learun.postFormSilence(top.$.rootUrl + '/PersonnelManagement/MP_QualityObjectives/AddRecord', { fileId: fileTwo }, function () {
  268. });
  269. }
  270. top.learun.download({ url: top.$.rootUrl + '/LR_SystemModule/Annexes/DownAnnexesFile', param: { fileId: fileId, __RequestVerificationToken: $.lrToken }, method: 'POST' });
  271. }