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.
 
 
 
 
 
 

206 lines
9.2 KiB

  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. // 初始化列表
  103. initGird: function () {
  104. $('#gridtable').lrAuthorizeJfGrid({
  105. url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetPageList',
  106. headData: [
  107. { label: "资产编号", name: "ACode", width: 200, align: "left" },
  108. { label: "资产名称", name: "AName", width: 200, align: "left" },
  109. {
  110. label: "资产分类", name: "ATId", width: 100, align: "left",
  111. formatterAsync: function (callback, value, row, op, $cell) {
  112. learun.clientdata.getAsync('custmerData', {
  113. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_AssetsType',
  114. key: value,
  115. keyId: 'atid',
  116. callback: function (_data) {
  117. callback(_data['aname']);
  118. }
  119. });
  120. }
  121. },
  122. {
  123. label: "资产属性", name: "AAssType", 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. { label: "英文名称", name: "AEName", width: 150, align: "left" },
  135. { label: "单价", name: "APrice", width: 100, align: "left" },
  136. { label: "库存", name: "AStock", width: 100, align: "left" },
  137. {
  138. label: "数量单位", name: "AUnit", width: 80, align: "left",
  139. formatterAsync: function (callback, value, row, op, $cell) {
  140. learun.clientdata.getAsync('dataItem', {
  141. key: value,
  142. code: 'sldw',
  143. callback: function (_data) {
  144. callback(_data.text);
  145. }
  146. });
  147. }
  148. },
  149. {
  150. label: "生成明细", name: "HasDetail", width: 100, align: "left",
  151. formatter: function (cellvalue) {
  152. return (cellvalue === true || cellvalue === "true") ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  153. }
  154. },
  155. { label: "资产型号", name: "AModel", width: 150, align: "left" },
  156. { label: "生产厂家", name: "AManufacturer", width: 150, align: "left" },
  157. {
  158. label: "资产来源", name: "ASource", width: 100, align: "left",
  159. formatterAsync: function (callback, value, row, op, $cell) {
  160. learun.clientdata.getAsync('dataItem', {
  161. key: value,
  162. code: 'zcly',
  163. callback: function (_data) {
  164. callback(_data.text);
  165. }
  166. });
  167. }
  168. },
  169. {
  170. label: '供应商', name: 'ASupplierId', width: 100, align: 'left', formatterAsync: function (callback, value, row, op, $cell) {
  171. learun.clientdata.getAsync('custmerData', {
  172. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_SupplierData',
  173. key: value,
  174. keyId: 'sid',
  175. callback: function (_data) {
  176. callback(_data['sname']);
  177. }
  178. });
  179. }
  180. },
  181. { label: "资产排序", name: "AOrder", width: 100, align: "left" },
  182. { label: "资产规格", name: "ASpecification", width: 100, align: "left" },
  183. { label: "用途", name: "AUse", width: 100, align: "left" },
  184. ],
  185. mainId: 'AId',
  186. isPage: true,
  187. sidx: 'AOrder'
  188. });
  189. page.search();
  190. },
  191. search: function (param) {
  192. param = param || {};
  193. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  194. }
  195. };
  196. refreshGirdData = function () {
  197. page.search();
  198. };
  199. page.init();
  200. }