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.
 
 
 
 
 
 

245 lines
11 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-04-10 15:12
  5. * 描 述:资产报修
  6. */
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var startTime;
  11. var endTime;
  12. var page = {
  13. init: function () {
  14. page.initGird();
  15. page.bind();
  16. },
  17. bind: function () {
  18. // 时间搜索框
  19. $('#datesearch').lrdate({
  20. dfdata: [
  21. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  22. { 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') } },
  23. { 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') } },
  24. { 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') } }
  25. ],
  26. // 月
  27. mShow: false,
  28. premShow: false,
  29. // 季度
  30. jShow: false,
  31. prejShow: false,
  32. // 年
  33. ysShow: false,
  34. yxShow: false,
  35. preyShow: false,
  36. yShow: false,
  37. // 默认
  38. dfvalue: '1',
  39. selectfn: function (begin, end) {
  40. startTime = begin;
  41. endTime = end;
  42. page.search();
  43. }
  44. });
  45. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  46. page.search(queryJson);
  47. }, 220, 400);
  48. // 刷新
  49. $('#lr_refresh').on('click', function () {
  50. location.reload();
  51. });
  52. // 新增
  53. $('#lr_add').on('click', function () {
  54. learun.layerForm({
  55. id: 'form',
  56. title: '新增',
  57. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/Form',
  58. width: 600,
  59. height: 400,
  60. callBack: function (id) {
  61. return top[id].acceptClick(refreshGirdData);
  62. }
  63. });
  64. });
  65. // 编辑
  66. $('#lr_edit').on('click', function () {
  67. var keyValue = $('#gridtable').jfGridValue('RId');
  68. if (learun.checkrow(keyValue)) {
  69. var RStatus = $('#gridtable').jfGridValue('RStatus');
  70. if (RStatus == 1) {
  71. learun.alert.warning("已提交!");
  72. return false;
  73. }
  74. learun.layerForm({
  75. id: 'form',
  76. title: '编辑',
  77. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/Form?keyValue=' + keyValue,
  78. width: 600,
  79. height: 400,
  80. callBack: function (id) {
  81. return top[id].acceptClick(refreshGirdData);
  82. }
  83. });
  84. }
  85. });
  86. // 删除
  87. $('#lr_delete').on('click', function () {
  88. var keyValue = $('#gridtable').jfGridValue('RId');
  89. if (learun.checkrow(keyValue)) {
  90. var RStatus = $('#gridtable').jfGridValue('RStatus');
  91. if (RStatus == 1) {
  92. learun.alert.warning("已提交!");
  93. return false;
  94. }
  95. learun.layerConfirm('是否确认删除该项!', function (res) {
  96. if (res) {
  97. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/DeleteForm', { keyValue: keyValue }, function () {
  98. refreshGirdData();
  99. });
  100. }
  101. });
  102. }
  103. });
  104. //  提交
  105. $('#lr_submit').on('click', function () {
  106. var keyValue = $('#gridtable').jfGridValue('RId');
  107. if (learun.checkrow(keyValue)) {
  108. var RStatus = $('#gridtable').jfGridValue('RStatus');
  109. if (RStatus == 1) {
  110. learun.alert.warning("已提交!");
  111. return false;
  112. }
  113. learun.layerConfirm('是否确认提交该项!', function (res) {
  114. if (res) {
  115. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/DoSubmit', { keyValue: keyValue }, function () {
  116. refreshGirdData();
  117. });
  118. }
  119. });
  120. }
  121. });
  122. //  查看
  123. $('#lr_view').on('click', function () {
  124. var keyValue = $('#gridtable').jfGridValue('RId');
  125. if (learun.checkrow(keyValue)) {
  126. var RStatus = $('#gridtable').jfGridValue('RStatus');
  127. if (RStatus == 1) {
  128. learun.alert.warning("已提交!");
  129. return false;
  130. }
  131. learun.layerForm({
  132. id: 'form',
  133. title: '编辑',
  134. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/FormView?keyValue=' + keyValue,
  135. width: 600,
  136. height: 400,
  137. btn: null,
  138. callBack: function (id) {
  139. return top[id].acceptClick(refreshGirdData);
  140. }
  141. });
  142. }
  143. });
  144. //  开始维修
  145. $('#lr_start').on('click', function () {
  146. var keyValue = $('#gridtable').jfGridValue('RId');
  147. if (learun.checkrow(keyValue)) {
  148. var RStatus = $('#gridtable').jfGridValue('RStatus');
  149. if (RStatus != 1) {
  150. learun.alert.warning("未提交!");
  151. return false;
  152. }
  153. learun.layerConfirm('是否确认开始维修该项!', function (res) {
  154. if (res) {
  155. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/DoStart', { keyValue: keyValue }, function () {
  156. refreshGirdData();
  157. });
  158. }
  159. });
  160. }
  161. });
  162. //  维修完成
  163. $('#lr_end').on('click', function () {
  164. var keyValue = $('#gridtable').jfGridValue('RId');
  165. if (learun.checkrow(keyValue)) {
  166. var RStatus = $('#gridtable').jfGridValue('RStatus');
  167. if (RStatus != 1) {
  168. learun.alert.warning("未提交!");
  169. return false;
  170. }
  171. learun.layerConfirm('是否确认维修完成该项!', function (res) {
  172. if (res) {
  173. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/DoEnd', { keyValue: keyValue }, function () {
  174. refreshGirdData();
  175. });
  176. }
  177. });
  178. }
  179. });
  180. //  确认维修
  181. $('#lr_confirm').on('click', function () {
  182. var keyValue = $('#gridtable').jfGridValue('RId');
  183. if (learun.checkrow(keyValue)) {
  184. var RStatus = $('#gridtable').jfGridValue('RStatus');
  185. if (RStatus != 1) {
  186. learun.alert.warning("未提交!");
  187. return false;
  188. }
  189. learun.layerConfirm('是否确认维修该项!', function (res) {
  190. if (res) {
  191. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/DoConfirm', { keyValue: keyValue }, function () {
  192. refreshGirdData();
  193. });
  194. }
  195. });
  196. }
  197. });
  198. },
  199. // 初始化列表
  200. initGird: function () {
  201. $('#gridtable').lrAuthorizeJfGrid({
  202. url: top.$.rootUrl + '/AssetManagementSystem/Ass_Repair/GetPageList',
  203. headData: [
  204. { label: "报修申请单号", name: "RCode", width: 200, align: "left" },
  205. { label: "报修总量", name: "RPrice", width: 100, align: "left" },
  206. { label: "报修时间", name: "RCreateTime", width: 100, align: "left" },
  207. {
  208. label: "报修人", name: "RCreateUserId", width: 100, align: "left",
  209. formatterAsync: function (callback, value, row, op, $cell) {
  210. learun.clientdata.getAsync('user', {
  211. key: value,
  212. callback: function (_data) {
  213. callback(_data.name);
  214. }
  215. });
  216. }
  217. },
  218. { label: "开始维修时间", name: "RStartTime", width: 100, align: "left" },
  219. { label: "维修人", name: "RRepairUserId", width: 100, align: "left" },
  220. { label: "维修完成时间", name: "REndTime", width: 100, align: "left" },
  221. { label: "维修确认时间", name: "RConfirmTime", width: 100, align: "left" },
  222. {
  223. label: "审核状态", name: "RStatus", width: 100, align: "left", formatter: function (cellvalue) {
  224. return cellvalue == 1 ? "已提交" : "未提交";
  225. }
  226. },
  227. { label: "报修备注", name: "RReason", width: 100, align: "left" },
  228. ],
  229. mainId: 'RId',
  230. isPage: true
  231. });
  232. },
  233. search: function (param) {
  234. param = param || {};
  235. param.StartTime = startTime;
  236. param.EndTime = endTime;
  237. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  238. }
  239. };
  240. refreshGirdData = function () {
  241. page.search();
  242. };
  243. page.init();
  244. }