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.
 
 
 
 
 
 

288 lines
12 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-03-29 11:27
  5. * 描 述:在册登记明细
  6. */
  7. var refreshGirdData;
  8. var acceptClick;
  9. var AId = request("AId");
  10. var currentUser = request("currentUser");//我的资产需要用到
  11. var IsDelete = request("IsDelete");//报废资产需要使用
  12. var bootstrap = function ($, learun) {
  13. "use strict";
  14. var page = {
  15. init: function () {
  16. page.initGird();
  17. page.bind();
  18. if (currentUser) {
  19. setTimeout("hiddenButton()", 300);
  20. }
  21. },
  22. bind: function () {
  23. // 初始化左侧树形数据lr_printBar
  24. $('#dataTree').lrtree({
  25. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetTypeTree',
  26. nodeClick: function (item) {
  27. page.search({ AIASSClass: item.value });
  28. }
  29. });
  30. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  31. page.search(queryJson);
  32. }, 400, 400);
  33. //$('#AIIStorageId').lrDataSourceSelect({ code: 'Ass_StorageData', value: 'sid', text: 'sname' });
  34. $('#AIIStorageId').lrselect({
  35. type: 'tree',
  36. allowSearch: true,
  37. url: top.$.rootUrl + '/AssetManagementSystem/AssStorageRoom/GetTree',
  38. param: {},
  39. select: function (val) {
  40. var storageId = "";
  41. if (val) {
  42. storageId = val.value;
  43. }
  44. $('#AIIStoragePosition').lrselectRefresh({
  45. url: top.$.rootUrl + '/AssetManagementSystem/AssStorageRoom/GetListForStorageId?storageId=' + storageId,
  46. text: "RCode",
  47. value: "RId"
  48. });
  49. }
  50. });
  51. //房间
  52. $('#AIIStoragePosition').lrselect({ value: 'RId', text: 'RCode' });
  53. $('#AIASSState').lrDataItemSelect({ code: 'AssState' });
  54. $('#AIAssType').lrDataItemSelect({ code: 'AssType' });
  55. $('#AIDepartment').lrDepartmentSelect();
  56. // 刷新
  57. $('#lr_refresh').on('click', function () {
  58. location.reload();
  59. });
  60. },
  61. // 初始化列表
  62. initGird: function () {
  63. $('#gridtable').jfGrid({
  64. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetPageList',
  65. headData: [
  66. { label: "明细编号", name: "AICode", width: 200, align: "left" },
  67. { label: "金隅编号", name: "AICodeNumJY", width: 200, align: "left" },
  68. { label: "名称", name: "AIASSName", width: 200, align: "left" },
  69. {
  70. label: "部门", name: "AIDepartment", width: 100, align: "left",
  71. formatterAsync: function (callback, value, row, op, $cell) {
  72. learun.clientdata.getAsync('department', {
  73. key: value,
  74. callback: function (_data) {
  75. callback(_data.name);
  76. }
  77. });
  78. }
  79. },
  80. {
  81. label: "使用人员", name: "AIUsePeople", width: 100, align: "left",
  82. formatterAsync: function (callback, value, row, op, $cell) {
  83. learun.clientdata.getAsync('custmerData', {
  84. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
  85. key: value,
  86. keyId: 'f_userid',
  87. callback: function (_data) {
  88. callback(_data['f_realname']);
  89. }
  90. });
  91. }
  92. },
  93. {
  94. label: "楼宇名称", name: "AIIStorageId", width: 100, align: "left",
  95. formatterAsync: function (callback, value, row, op, $cell) {
  96. learun.clientdata.getAsync('custmerData', {
  97. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData',
  98. key: value,
  99. keyId: 'sid',
  100. callback: function (_data) {
  101. callback(_data['sname']);
  102. }
  103. });
  104. }
  105. },
  106. {
  107. label: "房间号", name: "AIIStoragePosition", width: 100, align: "left",
  108. formatterAsync: function (callback, value, row, op, $cell) {
  109. learun.clientdata.getAsync('custmerData', {
  110. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_Storage_Room',
  111. key: value,
  112. keyId: 'rid',
  113. callback: function (_data) {
  114. callback(_data['rcode']);
  115. }
  116. });
  117. }
  118. },
  119. {
  120. label: "资产型号", name: "AISpecificationtype", width: 100, align: "left"
  121. },
  122. {
  123. label: "资产属性", name: "AIAssType", width: 100, align: "left",
  124. formatterAsync: function (callback, value, row, op, $cell) {
  125. learun.clientdata.getAsync('dataItem', {
  126. key: value,
  127. code: 'AssType',
  128. callback: function (_data) {
  129. callback(_data.text);
  130. }
  131. });
  132. }
  133. },
  134. {
  135. label: "计量单位", name: "AIUnits", width: 100, align: "left",
  136. formatterAsync: function (callback, value, row, op, $cell) {
  137. learun.clientdata.getAsync('dataItem',
  138. {
  139. key: value,
  140. code: 'sldw',
  141. callback: function (_data) {
  142. callback(_data.text);
  143. }
  144. })
  145. }
  146. },
  147. { label: "资产价值", name: "AIAssValue", width: 100, align: "left" },
  148. { label: "购置日期", name: "AIAddTime", width: 100, align: "left" },
  149. {
  150. label: "资产分类", name: "AIASSClass", width: 100, align: "left",
  151. formatterAsync: function (callback, value, row, op, $cell) {
  152. learun.clientdata.getAsync('custmerData', {
  153. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_AssetsType',
  154. key: value,
  155. keyId: 'atid',
  156. callback: function (_data) {
  157. callback(_data['aname']);
  158. }
  159. });
  160. }
  161. },
  162. {
  163. label: "资产状态", name: "AIASSState", width: 100, align: "left",
  164. formatterAsync: function (callback, value, row, op, $cell) {
  165. learun.clientdata.getAsync('dataItem', {
  166. key: value,
  167. code: 'AssState',
  168. callback: function (_data) {
  169. callback(_data.text);
  170. }
  171. });
  172. }
  173. },
  174. {
  175. label: "增加方式", name: "AIAddType", width: 100, align: "left",
  176. formatterAsync: function (callback, value, row, op, $cell) {
  177. learun.clientdata.getAsync('dataItem', {
  178. key: value,
  179. code: 'zcly',
  180. callback: function (_data) {
  181. callback(_data.text);
  182. }
  183. });
  184. }
  185. },
  186. { label: "生产厂家", name: "AIManufacturer", width: 100, align: "left" },
  187. { label: "资产规格", name: "AISpecification", width: 100, align: "left" },
  188. { label: "用途", name: "AIUse", width: 100, align: "left" },
  189. ],
  190. mainId: 'AIId',
  191. isMultiselect: true,
  192. isPage: true,
  193. sidx: 'AICodeNum'
  194. });
  195. page.search();
  196. },
  197. search: function (param) {
  198. param = param || {};
  199. param.AId = AId;
  200. if (currentUser) {
  201. var userInfo = top.learun.clientdata.get(['userinfo']);
  202. param.userId = userInfo.userId;
  203. }
  204. param.AIIsScrap = false;
  205. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  206. }
  207. };
  208. refreshGirdData = function () {
  209. page.search();
  210. };
  211. // 保存数据
  212. acceptClick = function (callBack) {
  213. var selectedRow = $('#gridtable').jfGridGet('rowdata');
  214. callBack(selectedRow);
  215. };
  216. page.init();
  217. }
  218. Date.prototype.Format = function (fmt) { //author: meizz
  219. var o = {
  220. "M+": this.getMonth() + 1, //月份
  221. "d+": this.getDate(), //日
  222. "H+": this.getHours(), //小时
  223. "m+": this.getMinutes(), //分
  224. "s+": this.getSeconds(), //秒
  225. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  226. "S": this.getMilliseconds() //毫秒
  227. };
  228. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  229. for (var k in o)
  230. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  231. return fmt;
  232. }
  233. function datedifference(sDate1, sDate2) { //sDate1和sDate2是2006-12-18格式
  234. var dateSpan,
  235. tempDate,
  236. iDays;
  237. sDate1 = Date.parse(sDate1);
  238. sDate2 = Date.parse(sDate2);
  239. dateSpan = sDate2 - sDate1;
  240. dateSpan = Math.abs(dateSpan);
  241. iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
  242. return iDays;
  243. };
  244. function AddPrintContent(html) {
  245. var myHtml = myHtml = html;
  246. // var strBodyStyle="<style>"+document.getElementById("style1").innerHTML+"</style>";
  247. // var strFormHtml=strBodyStyle+"<body>"+myHtml+"</body>";
  248. var strFormHtml = "<body>" + myHtml + "</body>";
  249. LODOP = getLodop();
  250. LODOP.PRINT_INIT("资产编号");
  251. LODOP.SET_PRINT_PAGESIZE(2, '40mm', '32.3mm', "");
  252. LODOP.SET_PRINT_MODE("PRINT_DUPLEX", 2);
  253. LODOP.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", 7);
  254. LODOP.ADD_PRINT_HTM(10, 8, '40mm', '30mm', strFormHtml);
  255. //打印预览
  256. // LODOP.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1);
  257. // var TaskID1=LODOP.PREVIEW();
  258. // 直接打印
  259. var TaskID1 = LODOP.PRINT();
  260. };
  261. function hiddenButton() {
  262. $("#lr_add").hide();
  263. $("#lr_printBar").hide();
  264. $("#lr_edit").hide();
  265. $("#lr_delete").hide();
  266. $("#lr_detail").hide();
  267. $("#lr_import").hide();
  268. }