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.
 
 
 
 
 
 

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