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.

Index.js 10 KiB

4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-03-29 11:22
  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_AssetsInfo/GetTree',
  19. nodeClick: function (item) {
  20. page.search({ ATId: item.value });
  21. }
  22. });
  23. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  24. page.search(queryJson);
  25. }, 220, 400);
  26. $('#ATId').lrDataSourceSelect({ code: 'Ass_AssetsType', value: 'atid', text: 'aname' });
  27. // 刷新
  28. $('#lr_refresh').on('click', function () {
  29. location.reload();
  30. });
  31. // 新增
  32. $('#lr_add').on('click', function () {
  33. learun.layerForm({
  34. id: 'form',
  35. title: '新增',
  36. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/Form',
  37. width: 860,
  38. height: 600,
  39. callBack: function (id) {
  40. return top[id].acceptClick(refreshGirdData);
  41. }
  42. });
  43. });
  44. // 编辑
  45. $('#lr_edit').on('click', function () {
  46. var keyValue = $('#gridtable').jfGridValue('AId');
  47. if (learun.checkrow(keyValue)) {
  48. learun.layerConfirm('警告!编辑资产信息将导致资产出入记录被清空请确认!', function (res) {
  49. if (res) {
  50. learun.layerForm({
  51. id: 'form',
  52. title: '编辑',
  53. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/Form?keyValue=' + keyValue,
  54. width: 860,
  55. height: 600,
  56. callBack: function (id) {
  57. return top[id].acceptClick(refreshGirdData);
  58. }
  59. });
  60. }
  61. });
  62. }
  63. });
  64. //资产明细
  65. $('#lr_detail').on('click', function () {
  66. var keyValue = $('#gridtable').jfGridValue('AId');
  67. if (learun.checkrow(keyValue)) {
  68. learun.layerForm({
  69. id: 'form',
  70. title: '资产明细',
  71. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/Index?AId=' + keyValue,
  72. width: 1000,
  73. height: 700,
  74. btn: null,
  75. end: function () {
  76. refreshGirdData();
  77. }
  78. });
  79. }
  80. });
  81. //整理资产数据
  82. $("#lr_arrangement").on('click', function () {
  83. learun.postForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/ArrangementAss',
  84. {}, function (res) {
  85. refreshGirdData();
  86. });
  87. })
  88. // 删除
  89. $('#lr_delete').on('click', function () {
  90. var keyValue = $('#gridtable').jfGridValue('AId');
  91. if (learun.checkrow(keyValue)) {
  92. learun.layerConfirm('是否确认删除该项!', function (res) {
  93. if (res) {
  94. learun.deleteForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/DeleteForm', { keyValue: keyValue }, function () {
  95. refreshGirdData();
  96. });
  97. }
  98. });
  99. }
  100. });
  101. //打印清单
  102. $('#lr_inventory').on('click',
  103. function () {
  104. var keyValue = $('#gridtable').jfGridValue('AId');
  105. console.log(keyValue);
  106. if (learun.checkrow(keyValue)) {
  107. learun.layerForm({
  108. id: 'formAss_AssetsOutApply',
  109. title: '清单',
  110. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/Inventory?keyValue=' + keyValue,
  111. width: 1000,
  112. height: 700,
  113. callBack: function (id) {
  114. }
  115. });
  116. }
  117. });
  118. },
  119. // 初始化列表
  120. initGird: function () {
  121. $('#gridtable').lrAuthorizeJfGrid({
  122. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetPageList',
  123. headData: [
  124. { label: "资产编号", name: "ACode", width: 200, align: "left" },
  125. { label: "资产名称", name: "AName", width: 200, align: "left" },
  126. {
  127. label: "资产分类", name: "ATId", width: 100, align: "left",
  128. formatterAsync: function (callback, value, row, op, $cell) {
  129. learun.clientdata.getAsync('custmerData', {
  130. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_AssetsType',
  131. key: value,
  132. keyId: 'atid',
  133. callback: function (_data) {
  134. callback(_data['aname']);
  135. }
  136. });
  137. }
  138. },
  139. {
  140. label: "资产属性", name: "AAssType", width: 100, align: "left",
  141. formatterAsync: function (callback, value, row, op, $cell) {
  142. learun.clientdata.getAsync('dataItem', {
  143. key: value,
  144. code: 'AssType',
  145. callback: function (_data) {
  146. callback(_data.text);
  147. }
  148. });
  149. }
  150. },
  151. { label: "英文名称", name: "AEName", width: 150, align: "left" },
  152. { label: "单价", name: "APrice", width: 100, align: "left" },
  153. { label: "库存", name: "AStock", width: 100, align: "left" },
  154. {
  155. label: "数量单位", name: "AUnit", width: 80, align: "left",
  156. formatterAsync: function (callback, value, row, op, $cell) {
  157. learun.clientdata.getAsync('dataItem', {
  158. key: value,
  159. code: 'sldw',
  160. callback: function (_data) {
  161. callback(_data.text);
  162. }
  163. });
  164. }
  165. },
  166. {
  167. label: "生成明细", name: "HasDetail", width: 100, align: "left",
  168. formatter: function (cellvalue) {
  169. return (cellvalue === true || cellvalue === "true") ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  170. }
  171. },
  172. { label: "资产型号", name: "AModel", width: 150, align: "left" },
  173. { label: "生产厂家", name: "AManufacturer", width: 150, align: "left" },
  174. {
  175. label: "资产来源", name: "ASource", 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. {
  187. label: '供应商', name: 'ASupplierId', width: 100, align: 'left', formatterAsync: function (callback, value, row, op, $cell) {
  188. learun.clientdata.getAsync('custmerData', {
  189. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_SupplierData',
  190. key: value,
  191. keyId: 'sid',
  192. callback: function (_data) {
  193. callback(_data['sname']);
  194. }
  195. });
  196. }
  197. },
  198. { label: "资产排序", name: "AOrder", width: 100, align: "left" },
  199. { label: "资产规格", name: "ASpecification", width: 100, align: "left" },
  200. { label: "用途", name: "AUse", width: 100, align: "left" },
  201. ],
  202. mainId: 'AId',
  203. isPage: true,
  204. isMultiselect: true,
  205. sidx: 'AOrder'
  206. });
  207. page.search();
  208. },
  209. search: function (param) {
  210. param = param || {};
  211. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  212. }
  213. };
  214. refreshGirdData = function () {
  215. page.search();
  216. };
  217. page.init();
  218. }