Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

IndexScrap.js 19 KiB

před 4 roky
před 4 roky
před 4 roky
před 4 roky
před 4 roky
před 4 roky
před 4 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  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 bootstrap = function ($, learun) {
  9. "use strict";
  10. var page = {
  11. init: function () {
  12. page.initGird();
  13. page.bind();
  14. },
  15. bind: function () {
  16. // 初始化左侧树形数据
  17. $('#dataTree').lrtree({
  18. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetTree',
  19. nodeClick: function (item) {
  20. page.search({ AIAssType: item.value });
  21. }
  22. });
  23. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  24. page.search(queryJson);
  25. }, 400, 400);
  26. //$('#AIIStorageId').lrDataSourceSelect({ code: 'Ass_StorageData', value: 'sid', text: 'sname' });
  27. $('#AIIStorageId').lrselect({
  28. type: 'tree',
  29. allowSearch: true,
  30. url: top.$.rootUrl + '/AssetManagementSystem/AssStorageRoom/GetTree',
  31. param: {},
  32. select: function (val) {
  33. var storageId = "";
  34. if (val) {
  35. storageId = val.value;
  36. }
  37. $('#AIIStoragePosition').lrselectRefresh({
  38. url: top.$.rootUrl + '/AssetManagementSystem/AssStorageRoom/GetListForStorageId?storageId=' + storageId,
  39. text: "RCode",
  40. value: "RId", allowSearch: true
  41. });
  42. }
  43. });
  44. //房间
  45. $('#AIIStoragePosition').lrselect({ value: 'RId', text: 'RCode', allowSearch: true });
  46. $('#AIASSState').lrDataItemSelect({ code: 'AssState' });
  47. $('#AIDepartment').lrDepartmentSelect();
  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_AssetsInfoItem/Form',
  58. width: 800,
  59. height: 700,
  60. callBack: function (id) {
  61. return top[id].acceptClick(refreshGirdData);
  62. }
  63. });
  64. });
  65. //标签打印
  66. var qrcode = new QRCode(document.getElementById("qrcode"), {
  67. width: 80,
  68. height: 80
  69. });
  70. $("#lr_printBar").on('click', function () {
  71. var keyValue = $('#gridtable').jfGridValue('AICode');
  72. if (learun.checkrow(keyValue)) {
  73. //todo 打印标签
  74. //$('.qrcodeTxt').html(keyValue);
  75. ////标签打印
  76. //qrcode.makeCode(keyValue);
  77. //setTimeout(function () {
  78. // var html = $('.qrcodeBox').html();
  79. // // console.log(html)
  80. // AddPrintContent(html);
  81. // qrcode.clear();
  82. //}, 300)
  83. //AddPrintContent(html)
  84. learun.layerForm({
  85. id: 'formcardprint',
  86. title: '打印二维码',
  87. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/QRPrint?keyValue=' + keyValue,
  88. width: 700,
  89. height: 300,
  90. btn: null,
  91. end: function () { refreshGirdData(); }
  92. });
  93. }
  94. })
  95. // 编辑
  96. $('#lr_edit').on('click', function () {
  97. var keyValue = $('#gridtable').jfGridValue('AIId');
  98. if (learun.checkrow(keyValue)) {
  99. learun.layerForm({
  100. id: 'forminfoitem',
  101. title: '编辑',
  102. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/Form?keyValue=' + keyValue,
  103. width: 800,
  104. height: 700,
  105. callBack: function (id) {
  106. return top[id].acceptClick(refreshGirdData);
  107. }
  108. });
  109. }
  110. });
  111. //查看
  112. $('#lr_view').on('click', function () {
  113. var keyValue = $('#gridtable').jfGridValue('AIId');
  114. if (learun.checkrow(keyValue)) {
  115. learun.layerForm({
  116. id: 'forminfoitem',
  117. title: '查看',
  118. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/FormView?keyValue=' + keyValue,
  119. width: 800,
  120. height: 700,
  121. btn: '',
  122. callBack: function (id) {
  123. return top[id].acceptClick(refreshGirdData);
  124. }
  125. });
  126. }
  127. });
  128. //出入记录
  129. $('#lr_detail').on('click', function () {
  130. var keyValue = $('#gridtable').jfGridValue('AIId');
  131. if (learun.checkrow(keyValue)) {
  132. learun.layerForm({
  133. id: 'formdetail',
  134. title: '出入库记录',
  135. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsChangeItem/Index?AIId=' + keyValue,
  136. width: 940,
  137. height: 600,
  138. btn: null
  139. });
  140. }
  141. });
  142. // 删除
  143. $('#lr_delete').on('click', function () {
  144. var keyValue = $('#gridtable').jfGridValue('AIId');
  145. if (learun.checkrow(keyValue)) {
  146. learun.layerConfirm('是否恢复使用!', function (res) {
  147. if (res) {
  148. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/UnScrapForm', { keyValue: keyValue }, function () {
  149. refreshGirdData();
  150. });
  151. }
  152. });
  153. }
  154. });
  155. },
  156. // 初始化列表
  157. initGird: function () {
  158. $('#gridtable').lrAuthorizeJfGrid({
  159. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetPageList',
  160. headData: [
  161. { label: "明细编号", name: "AICode", width: 200, align: "left" },
  162. { label: "编号", name: "AICodeNumJY", width: 200, align: "left" },
  163. { label: "名称", name: "AIASSName", width: 200, align: "left" },
  164. {
  165. label: "部门", name: "AIDepartment", width: 100, align: "left",
  166. formatterAsync: function (callback, value, row, op, $cell) {
  167. learun.clientdata.getAsync('department', {
  168. key: value,
  169. callback: function (_data) {
  170. callback(_data.name);
  171. }
  172. });
  173. }
  174. },
  175. {
  176. label: "使用人员", name: "AIUsePeople", width: 100, align: "left",
  177. formatterAsync: function (callback, value, row, op, $cell) {
  178. console.log(value);
  179. learun.clientdata.getAsync('custmerData', {
  180. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
  181. key: value,
  182. keyId: 'f_userid',
  183. callback: function (_data) {
  184. callback(_data['f_realname']);
  185. }
  186. });
  187. }
  188. },
  189. {
  190. label: "楼宇名称", name: "AIIStorageId", width: 100, align: "left",
  191. formatterAsync: function (callback, value, row, op, $cell) {
  192. learun.clientdata.getAsync('custmerData', {
  193. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData',
  194. key: value,
  195. keyId: 'sid',
  196. callback: function (_data) {
  197. callback(_data['sname']);
  198. }
  199. });
  200. }
  201. },
  202. {
  203. label: "房间号", name: "AIIStoragePosition", width: 150, align: "left",
  204. formatterAsync: function (callback, value, row, op, $cell) {
  205. learun.clientdata.getAsync('custmerData', {
  206. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_Storage_Room',
  207. key: value,
  208. keyId: 'rid',
  209. callback: function (_data) {
  210. callback(_data['rcode'] + '(' + _data['rname'] + ')');
  211. }
  212. });
  213. }
  214. },
  215. //{
  216. // label: "报废时间", name: "AIIStoragePosition", width: 100, align: "left", formatter: function (cellvalue, row) {
  217. // if (!!row.AScrapTime && row.ScrapRemindTime > (-1)) {
  218. // var validDate2 = new Date(row.AScrapTime.replace(/-/g, "/"));
  219. // var nowDate = new Date();
  220. // var timerange = datedifference(nowDate, validDate2);
  221. // console.log(timerange);
  222. // if (validDate2 > nowDate && timerange > 0) {
  223. // switch (row.ScrapRemindTime) {
  224. // case 0:
  225. // if (timerange < 30) {
  226. // return '<span class=\"label label-warning\">' + validDate2.Format("yyyy-MM-dd") + '</span>';
  227. // } else {
  228. // return '<span class=\"label label-info\">' + validDate2.Format("yyyy-MM-dd") + '</span>';
  229. // }
  230. // case 1:
  231. // if (timerange >= 30 && timerange < 90) {
  232. // return '<span class=\"label label-warning\">' + row.AScrapTime + '</span>';
  233. // } else {
  234. // return '<span class=\"label label-info\">' + row.AScrapTime + '</span>';
  235. // }
  236. // case 2:
  237. // if (timerange >= 90 && timerange < 180) {
  238. // return '<span class=\"label label-warning\">' + row.AScrapTime + '</span>';
  239. // } else {
  240. // return '<span class=\"label label-info\">' + row.AScrapTime + '</span>';
  241. // }
  242. // case 3:
  243. // if (timerange >= 180 && timerange < 360) {
  244. // return '<span class=\"label label-warning\">' + row.AScrapTime + '</span>';
  245. // } else {
  246. // return '<span class=\"label label-info\">' + row.AScrapTime + '</span>';
  247. // }
  248. // default:
  249. // }
  250. // } else {
  251. // return '<span class=\"label label-danger\">已报废</span>';
  252. // }
  253. // } else {
  254. // return '<span class=\"label label-info\">未设置</span>';
  255. // }
  256. // }
  257. //},
  258. {
  259. label: "规格型号", name: "AISpecificationtype", width: 100, align: "left"
  260. },
  261. {
  262. label: "资产属性", name: "AIAssType", width: 100, align: "left",
  263. formatterAsync: function (callback, value, row, op, $cell) {
  264. learun.clientdata.getAsync('dataItem', {
  265. key: value,
  266. code: 'AssType',
  267. callback: function (_data) {
  268. callback(_data.text);
  269. }
  270. });
  271. }
  272. },
  273. {
  274. label: "计量单位", name: "AIUnits", width: 100, align: "left",
  275. formatterAsync: function (callback, value, row, op, $cell) {
  276. learun.clientdata.getAsync('dataItem',
  277. {
  278. key: value,
  279. code: 'sldw',
  280. callback: function (_data) {
  281. callback(_data.text);
  282. }
  283. })
  284. }
  285. },
  286. { label: "资产价值", name: "AIAssValue", width: 100, align: "left" },
  287. { label: "入账日期", name: "AIAddTime", width: 100, align: "left" },
  288. {
  289. label: "资产分类", name: "AIASSClass", width: 100, align: "left",
  290. formatterAsync: function (callback, value, row, op, $cell) {
  291. learun.clientdata.getAsync('custmerData', {
  292. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_AssetsType',
  293. key: value,
  294. keyId: 'atid',
  295. callback: function (_data) {
  296. callback(_data['aname']);
  297. }
  298. });
  299. }
  300. },
  301. //{
  302. // label: "资产状态", name: "AIASSState", width: 100, align: "left",
  303. // formatterAsync: function (callback, value, row, op, $cell) {
  304. // learun.clientdata.getAsync('dataItem', {
  305. // key: value,
  306. // code: 'AssState',
  307. // callback: function (_data) {
  308. // callback(_data.text);
  309. // }
  310. // });
  311. // }
  312. //},
  313. {
  314. label: "增加方式", name: "AIAddType", width: 100, align: "left",
  315. formatterAsync: function (callback, value, row, op, $cell) {
  316. learun.clientdata.getAsync('dataItem', {
  317. key: value,
  318. code: 'zcly',
  319. callback: function (_data) {
  320. callback(_data.text);
  321. }
  322. });
  323. }
  324. },
  325. { label: "生产厂家", name: "AIManufacturer", width: 100, align: "left" },
  326. { label: "资产品牌", name: "AISpecification", width: 100, align: "left" },
  327. { label: "用途", name: "AIUse", width: 100, align: "left" },
  328. ],
  329. mainId: 'AIId',
  330. isMultiselect: true,
  331. isPage: true,
  332. sidx: 'AICodeNum'
  333. });
  334. page.search();
  335. },
  336. search: function (param) {
  337. param = param || {};
  338. param.AIASSState = "2";
  339. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  340. }
  341. };
  342. refreshGirdData = function () {
  343. page.search();
  344. };
  345. page.init();
  346. }
  347. Date.prototype.Format = function (fmt) { //author: meizz
  348. var o = {
  349. "M+": this.getMonth() + 1, //月份
  350. "d+": this.getDate(), //日
  351. "H+": this.getHours(), //小时
  352. "m+": this.getMinutes(), //分
  353. "s+": this.getSeconds(), //秒
  354. "q+": Math.floor((this.getMonth() + 3) / 3), //季度
  355. "S": this.getMilliseconds() //毫秒
  356. };
  357. if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  358. for (var k in o)
  359. if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  360. return fmt;
  361. }
  362. function datedifference(sDate1, sDate2) { //sDate1和sDate2是2006-12-18格式
  363. var dateSpan,
  364. tempDate,
  365. iDays;
  366. sDate1 = Date.parse(sDate1);
  367. sDate2 = Date.parse(sDate2);
  368. dateSpan = sDate2 - sDate1;
  369. dateSpan = Math.abs(dateSpan);
  370. iDays = Math.floor(dateSpan / (24 * 3600 * 1000));
  371. return iDays;
  372. };
  373. function AddPrintContent(html) {
  374. var myHtml = myHtml = html;
  375. // var strBodyStyle="<style>"+document.getElementById("style1").innerHTML+"</style>";
  376. // var strFormHtml=strBodyStyle+"<body>"+myHtml+"</body>";
  377. var strFormHtml = "<body>" + myHtml + "</body>";
  378. LODOP = getLodop();
  379. LODOP.PRINT_INIT("资产编号");
  380. LODOP.SET_PRINT_PAGESIZE(2, '40mm', '32.3mm', "");
  381. LODOP.SET_PRINT_MODE("PRINT_DUPLEX", 2);
  382. LODOP.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", 7);
  383. LODOP.ADD_PRINT_HTM(10, 8, '40mm', '30mm', strFormHtml);
  384. //打印预览
  385. // LODOP.SET_SHOW_MODE("LANDSCAPE_DEFROTATED",1);
  386. // var TaskID1=LODOP.PREVIEW();
  387. // 直接打印
  388. var TaskID1 = LODOP.PRINT();
  389. };