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.
 
 
 
 
 
 

464 lines
22 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 AId = request("AId");
  9. var currentUser = request("currentUser");//我的资产需要用到
  10. var IsDelete = request("IsDelete");//报废资产需要使用
  11. var bootstrap = function ($, learun) {
  12. "use strict";
  13. var page = {
  14. init: function () {
  15. page.initGird();
  16. page.bind();
  17. if (currentUser) {
  18. setTimeout("hiddenButton()", 300);
  19. }
  20. },
  21. bind: function () {
  22. // 初始化左侧树形数据lr_printBar
  23. //$('#dataTree').lrtree({
  24. // url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetTree',
  25. // nodeClick: function (item) {
  26. // page.search({ AIAssType: item.value });
  27. // }
  28. //});
  29. $('#dataTree').lrtree({
  30. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetTree',
  31. nodeClick: function (item) {
  32. page.search({ AIASSClass: item.value });
  33. }
  34. });
  35. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  36. page.search(queryJson);
  37. }, 400, 400);
  38. $('#AIIStorageId').lrDataSourceSelect({ code: 'Ass_StorageData', value: 'sid', text: 'sname' });
  39. $('#AIASSState').lrDataItemSelect({ code: 'AssState' });
  40. $('#AIDepartment').lrDepartmentSelect();
  41. // 刷新
  42. $('#lr_refresh').on('click', function () {
  43. location.reload();
  44. });
  45. // 新增
  46. $('#lr_add').on('click', function () {
  47. learun.layerForm({
  48. id: 'form',
  49. title: '新增',
  50. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/Form',
  51. width: 800,
  52. height: 700,
  53. callBack: function (id) {
  54. return top[id].acceptClick(refreshGirdData);
  55. }
  56. });
  57. });
  58. //标签打印
  59. var qrcode = new QRCode(document.getElementById("qrcode"), {
  60. width: 80,
  61. height: 80
  62. });
  63. $("#lr_printBar").on('click', function () {
  64. var keyValue = $('#gridtable').jfGridValue('AICode');
  65. var AName = $('#gridtable').jfGridValue('AIASSName');
  66. if (learun.checkrow(keyValue)) {
  67. //todo 打印标签
  68. //$('.qrcodeTxt').html(keyValue);
  69. ////标签打印
  70. //qrcode.makeCode(keyValue);
  71. //setTimeout(function () {
  72. // var html = $('.qrcodeBox').html();
  73. // // console.log(html)
  74. // AddPrintContent(html);
  75. // qrcode.clear();
  76. //}, 300)
  77. //AddPrintContent(html)
  78. learun.layerForm({
  79. id: 'formcardprint',
  80. title: '打印二维码',
  81. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/QRPrint?keyValue=' + keyValue+'&aName='+escape(AName),
  82. width: 700,
  83. height: 300,
  84. btn: null,
  85. end: function () { refreshGirdData(); }
  86. });
  87. }
  88. })
  89. // 编辑
  90. $('#lr_edit').on('click', function () {
  91. var keyValue = $('#gridtable').jfGridValue('AIId');
  92. if (learun.checkrow(keyValue)) {
  93. learun.layerForm({
  94. id: 'forminfoitem',
  95. title: '编辑',
  96. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/Form?keyValue=' + keyValue,
  97. width: 800,
  98. height: 700,
  99. callBack: function (id) {
  100. return top[id].acceptClick(refreshGirdData);
  101. }
  102. });
  103. }
  104. });
  105. //查看
  106. $('#lr_view').on('click', function () {
  107. var keyValue = $('#gridtable').jfGridValue('AIId');
  108. if (learun.checkrow(keyValue)) {
  109. learun.layerForm({
  110. id: 'forminfoitem',
  111. title: '查看',
  112. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/FormView?keyValue=' + keyValue,
  113. width: 800,
  114. height: 700,
  115. btn: '',
  116. callBack: function (id) {
  117. return top[id].acceptClick(refreshGirdData);
  118. }
  119. });
  120. }
  121. });
  122. //出入记录
  123. $('#lr_detail').on('click', function () {
  124. var keyValue = $('#gridtable').jfGridValue('AIId');
  125. if (learun.checkrow(keyValue)) {
  126. learun.layerForm({
  127. id: 'formdetail',
  128. title: '出入库记录',
  129. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsChangeItem/Index?AIId=' + keyValue,
  130. width: 940,
  131. height: 600,
  132. btn: null
  133. });
  134. }
  135. });
  136. //查看使用人员变动记录
  137. $('#lr_usedetail').on('click', function () {
  138. var keyValue = $('#gridtable').jfGridValue('AIId');
  139. if (learun.checkrow(keyValue)) {
  140. learun.layerForm({
  141. id: 'formusedetail',
  142. title: '使用人员变动记录',
  143. url: top.$.rootUrl + '/AssetManagementSystem/Ass_UserChangeInfo/Index?AIId=' + keyValue,
  144. width: 940,
  145. height: 600,
  146. btn: null
  147. });
  148. }
  149. });
  150. // 删除
  151. $('#lr_delete').on('click', function () {
  152. var keyValue = $('#gridtable').jfGridValue('AIId');
  153. if (learun.checkrow(keyValue)) {
  154. learun.layerConfirm('是否确认删除该项!', function (res) {
  155. if (res) {
  156. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/DeleteForm', { keyValue: keyValue }, function () {
  157. refreshGirdData();
  158. });
  159. }
  160. });
  161. }
  162. });
  163. // 报废
  164. $('#lr_scrap').on('click', function () {
  165. var keyValue = $('#gridtable').jfGridValue('AIId');
  166. if (learun.checkrow(keyValue)) {
  167. learun.layerConfirm('是否确认报废!', function (res) {
  168. if (res) {
  169. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/ScrapForm', { keyValue: keyValue }, function () {
  170. refreshGirdData();
  171. });
  172. }
  173. });
  174. }
  175. });
  176. },
  177. // 初始化列表
  178. initGird: function () {
  179. $('#gridtable').jfGrid({
  180. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetPageList',
  181. headData: [
  182. { label: "明细编号", name: "AICode", width: 200, align: "left" },
  183. { label: "资产编号", name: "AICodeNumJY", width: 200, align: "left" },
  184. { label: "名称", name: "AIASSName", width: 200, align: "left" },
  185. {
  186. label: "部门", name: "AIDepartment", 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: "AIUsePeople", width: 100, align: "left",
  198. formatterAsync: function (callback, value, row, op, $cell) {
  199. learun.clientdata.getAsync('custmerData', {
  200. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
  201. key: value,
  202. keyId: 'f_userid',
  203. callback: function (_data) {
  204. callback(_data['f_realname']);
  205. }
  206. });
  207. }
  208. },
  209. {
  210. label: "所在库房", name: "AIIStorageId", width: 100, align: "left",
  211. formatterAsync: function (callback, value, row, op, $cell) {
  212. learun.clientdata.getAsync('custmerData', {
  213. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData',
  214. key: value,
  215. keyId: 'sid',
  216. callback: function (_data) {
  217. callback(_data['sname']);
  218. }
  219. });
  220. }
  221. },
  222. { label: "所在库位", name: "AIIStoragePosition", width: 100, align: "left" },
  223. //{
  224. // label: "报废时间", name: "AIIStoragePosition", width: 100, align: "left", formatter: function (cellvalue, row) {
  225. // if (!!row.AScrapTime && row.ScrapRemindTime > (-1)) {
  226. // var validDate2 = new Date(row.AScrapTime.replace(/-/g, "/"));
  227. // var nowDate = new Date();
  228. // var timerange = datedifference(nowDate, validDate2);
  229. // console.log(timerange);
  230. // if (validDate2 > nowDate && timerange > 0) {
  231. // switch (row.ScrapRemindTime) {
  232. // case 0:
  233. // if (timerange < 30) {
  234. // return '<span class=\"label label-warning\">' + validDate2.Format("yyyy-MM-dd") + '</span>';
  235. // } else {
  236. // return '<span class=\"label label-info\">' + validDate2.Format("yyyy-MM-dd") + '</span>';
  237. // }
  238. // case 1:
  239. // if (timerange >= 30 && timerange < 90) {
  240. // return '<span class=\"label label-warning\">' + row.AScrapTime + '</span>';
  241. // } else {
  242. // return '<span class=\"label label-info\">' + row.AScrapTime + '</span>';
  243. // }
  244. // case 2:
  245. // if (timerange >= 90 && timerange < 180) {
  246. // return '<span class=\"label label-warning\">' + row.AScrapTime + '</span>';
  247. // } else {
  248. // return '<span class=\"label label-info\">' + row.AScrapTime + '</span>';
  249. // }
  250. // case 3:
  251. // if (timerange >= 180 && timerange < 360) {
  252. // return '<span class=\"label label-warning\">' + row.AScrapTime + '</span>';
  253. // } else {
  254. // return '<span class=\"label label-info\">' + row.AScrapTime + '</span>';
  255. // }
  256. // default:
  257. // }
  258. // } else {
  259. // return '<span class=\"label label-danger\">已报废</span>';
  260. // }
  261. // } else {
  262. // return '<span class=\"label label-info\">未设置</span>';
  263. // }
  264. // }
  265. //},
  266. {
  267. label: "资产型号", name: "AISpecificationtype", width: 100, align: "left"
  268. },
  269. {
  270. label: "资产属性", name: "AIAssType", width: 100, align: "left",
  271. formatterAsync: function (callback, value, row, op, $cell) {
  272. learun.clientdata.getAsync('dataItem', {
  273. key: value,
  274. code: 'AssType',
  275. callback: function (_data) {
  276. callback(_data.text);
  277. }
  278. });
  279. }
  280. },
  281. {
  282. label: "计量单位", name: "AIUnits", width: 100, align: "left",
  283. formatterAsync: function (callback, value, row, op, $cell) {
  284. learun.clientdata.getAsync('dataItem',
  285. {
  286. key: value,
  287. code: 'sldw',
  288. callback: function (_data) {
  289. callback(_data.text);
  290. }
  291. })
  292. }
  293. },
  294. { label: "资产价值", name: "AIAssValue", width: 100, align: "left" },
  295. { label: "购置日期", name: "AIAddTime", width: 100, align: "left" },
  296. {
  297. label: "资产分类", name: "AIASSClass", width: 100, align: "left",
  298. formatterAsync: function (callback, value, row, op, $cell) {
  299. learun.clientdata.getAsync('custmerData', {
  300. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_AssetsType',
  301. key: value,
  302. keyId: 'atid',
  303. callback: function (_data) {
  304. callback(_data['aname']);
  305. }
  306. });
  307. }
  308. },
  309. {
  310. label: "资产状态", name: "AIASSState", width: 100, align: "left",
  311. formatterAsync: function (callback, value, row, op, $cell) {
  312. learun.clientdata.getAsync('dataItem', {
  313. key: value,
  314. code: 'AssState',
  315. callback: function (_data) {
  316. callback(_data.text);
  317. }
  318. });
  319. }
  320. },
  321. {
  322. label: "增加方式", name: "AIAddType", width: 100, align: "left",
  323. formatterAsync: function (callback, value, row, op, $cell) {
  324. learun.clientdata.getAsync('dataItem', {
  325. key: value,
  326. code: 'zcly',
  327. callback: function (_data) {
  328. callback(_data.text);
  329. }
  330. });
  331. }
  332. },
  333. { label: "生产厂家", name: "AIManufacturer", width: 100, align: "left" },
  334. { label: "资产规格", name: "AISpecification", width: 100, align: "left" },
  335. { label: "用途", name: "AIUse", width: 100, align: "left" },
  336. { label: "采购组织形式", name: "ProcurementOrganizationForm", width: 100, align: "left" },
  337. { label: "预算项目编号", name: "BudgetItemNo", width: 100, align: "left" },
  338. { label: "取得方式", name: "MethodOfAcquisition", width: 100, align: "left" },
  339. { label: "取得日期", name: "TimeOfAcquisition", width: 100, align: "left" },
  340. { label: "产品序列号", name: "ProjectID", width: 100, align: "left" },
  341. { label: "销售商", name: "Seller", width: 100, align: "left" },
  342. { label: "合同编号", name: "ContractNo", width: 100, align: "left" },
  343. { label: "发票号", name: "InvoiceNumber", width: 100, align: "left" },
  344. { label: "配置标准分类名称", name: "ConfigurationName", width: 100, align: "left" },
  345. { label: "保修截止日期", name: "GuaranteeEndTime", width: 100, align: "left" },
  346. { label: "入账形式", name: "EntryForm", width: 100, align: "left" },
  347. { label: "价值类型", name: "ValueType", width: 100, align: "left" },
  348. { label: "财政拨款", name: "FinancialAllocation", width: 100, align: "left" },
  349. { label: "非财政拨款", name: "NonFinancialAppropriation", width: 100, align: "left" },
  350. { label: "使用状况", name: "Usage", width: 100, align: "left" },
  351. { label: "投入使用日期", name: "DateOfCommissioning", width: 100, align: "left" },
  352. { label: "管理部门", name: "AdministrativeDepartment", width: 100, align: "left" },
  353. { label: "折旧状态", name: "DepreciationStatus", width: 100, align: "left" },
  354. { label: "折旧方法", name: "DepreciationMethod", width: 100, align: "left" },
  355. { label: "已提折旧月数", name: "MonthsOfDepreciation", width: 100, align: "left" },
  356. { label: "累计折旧", name: "AccumulatedDepreciation", width: 100, align: "left" },
  357. { label: "折旧年限(月)", name: "UsefulLife", width: 100, align: "left" },
  358. { label: "月折旧额", name: "MonthlyDepreciation", width: 100, align: "left" },
  359. { label: "残值率", name: "ResidualValueRate", width: 100, align: "left" },
  360. ],
  361. mainId: 'AIId',
  362. isMultiselect: true,
  363. isPage: true,
  364. sidx: 'AICodeNum'
  365. });
  366. page.search();
  367. },
  368. search: function (param) {
  369. param = param || {};
  370. param.AId = AId;
  371. if (currentUser) {
  372. var userInfo = top.learun.clientdata.get(['userinfo']);
  373. param.userId = userInfo.userId;
  374. }
  375. param.AIIsScrap = false;
  376. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  377. }
  378. };
  379. refreshGirdData = function () {
  380. page.search();
  381. };
  382. page.init();
  383. }
  384. Date.prototype.Format = function (fmt) { //author: meizz
  385. var o = {
  386. "M+": this.getMonth() + 1, //月份
  387. "d+": this.getDate(), //日
  388. "H+": this.getHours(), //小时
  389. "m+": this.getMinutes(), //分
  390. "s+": this.getSeconds(), //秒
  391. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  392. "S": this.getMilliseconds() //毫秒
  393. };
  394. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  395. for (var k in o)
  396. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  397. return fmt;
  398. }
  399. function datedifference(sDate1, sDate2) { //sDate1和sDate2是2006-12-18格式
  400. var dateSpan,
  401. tempDate,
  402. iDays;
  403. sDate1 = Date.parse(sDate1);
  404. sDate2 = Date.parse(sDate2);
  405. dateSpan = sDate2 - sDate1;
  406. dateSpan = Math.abs(dateSpan);
  407. iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
  408. return iDays;
  409. };
  410. function AddPrintContent(html) {
  411. var myHtml = myHtml = html;
  412. // var strBodyStyle="<style>"+document.getElementById("style1").innerHTML+"</style>";
  413. // var strFormHtml=strBodyStyle+"<body>"+myHtml+"</body>";
  414. var strFormHtml = "<body>" + myHtml + "</body>";
  415. LODOP = getLodop();
  416. LODOP.PRINT_INIT("资产编号");
  417. LODOP.SET_PRINT_PAGESIZE(2, '40mm', '32.3mm', "");
  418. LODOP.SET_PRINT_MODE("PRINT_DUPLEX", 2);
  419. LODOP.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", 7);
  420. LODOP.ADD_PRINT_HTM(10, 8, '40mm', '30mm', strFormHtml);
  421. //打印预览
  422. // LODOP.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1);
  423. // var TaskID1=LODOP.PREVIEW();
  424. // 直接打印
  425. var TaskID1 = LODOP.PRINT();
  426. };
  427. function hiddenButton() {
  428. $("#lr_add").hide();
  429. $("#lr_printBar").hide();
  430. $("#lr_edit").hide();
  431. $("#lr_delete").hide();
  432. $("#lr_detail").hide();
  433. $("#lr_import").hide();
  434. }