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 12 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2022-01-24 12:19
  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. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  17. page.search(queryJson);
  18. }, 220, 400);
  19. //$('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
  20. $('#TextBookType').lrDataItemSelect({ code: 'TextBookType' });
  21. $('#TextBookNature').lrDataItemSelect({ code: 'TextBookNature' });
  22. // 刷新
  23. $('#lr_refresh').on('click', function () {
  24. location.reload();
  25. });
  26. // 新增
  27. $('#lr_add').on('click', function () {
  28. learun.layerForm({
  29. id: 'form',
  30. title: '新增',
  31. url: top.$.rootUrl + '/EducationalAdministration/TextBookInfo/Form',
  32. width: 800,
  33. height: 500,
  34. callBack: function (id) {
  35. return top[id].acceptClick(refreshGirdData);
  36. }
  37. });
  38. });
  39. // 编辑
  40. $('#lr_edit').on('click', function () {
  41. var keyValue = $('#gridtable').jfGridValue('ID');
  42. if (learun.checkrow(keyValue)) {
  43. if (keyValue.indexOf(',') != -1) {
  44. learun.alert.warning("只能选择一条记录进行编辑!");
  45. return;
  46. }
  47. var IsValid = $('#gridtable').jfGridValue('IsValid');
  48. if (IsValid == "true") {
  49. learun.alert.warning("选中记录中包含已启用项目,已启用项不可编辑!");
  50. return;
  51. }
  52. learun.layerForm({
  53. id: 'form',
  54. title: '编辑',
  55. url: top.$.rootUrl + '/EducationalAdministration/TextBookInfo/Form?keyValue=' + keyValue,
  56. width: 800,
  57. height: 500,
  58. callBack: function (id) {
  59. return top[id].acceptClick(refreshGirdData);
  60. }
  61. });
  62. }
  63. });
  64. // 删除
  65. $('#lr_delete').on('click', function () {
  66. var keyValue = $('#gridtable').jfGridValue('ID');
  67. if (learun.checkrow(keyValue)) {
  68. var IsValid = $('#gridtable').jfGridValue('IsValid');
  69. if (IsValid.indexOf('true') != -1) {
  70. learun.alert.warning("选中记录中包含已启用项目,已启用项不能删除!");
  71. return;
  72. }
  73. learun.layerConfirm('是否确认删除该项!', function (res) {
  74. if (res) {
  75. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/TextBookInfo/DeleteForm', { keyValue: keyValue }, function () {
  76. refreshGirdData();
  77. });
  78. }
  79. });
  80. }
  81. });
  82. // 打印
  83. $('#lr_print').on('click', function () {
  84. $('#gridtable').jqprintTable();
  85. });
  86. //启用
  87. $('#lr_enabled').on('click', function () {
  88. var keyValue = $('#gridtable').jfGridValue('ID');
  89. if (learun.checkrow(keyValue)) {
  90. var IsValid = $('#gridtable').jfGridValue('IsValid');
  91. if (IsValid.indexOf('true') != -1) {
  92. learun.alert.warning("选中记录中包含已启用项!");
  93. return;
  94. }
  95. learun.layerConfirm('是否确认启用选中项?', function (res) {
  96. if (res) {
  97. learun.postForm(top.$.rootUrl + '/EducationalAdministration/TextBookInfo/EnableEntity', { keyValue: keyValue, IsValid: '1' }, function () {
  98. refreshGirdData();
  99. });
  100. }
  101. });
  102. }
  103. });
  104. //禁用
  105. $('#lr_disabled').on('click', function () {
  106. var keyValue = $('#gridtable').jfGridValue('ID');
  107. if (learun.checkrow(keyValue)) {
  108. var IsValid = $('#gridtable').jfGridValue('IsValid');
  109. if (IsValid.indexOf('false') != -1) {
  110. learun.alert.warning("选中记录中包含已启用项!");
  111. return;
  112. }
  113. learun.layerConfirm('是否确认禁用选中项?', function (res) {
  114. if (res) {
  115. learun.postForm(top.$.rootUrl + '/EducationalAdministration/TextBookInfo/DisableEntity', { keyValue: keyValue, IsValid: '0' }, function () {
  116. refreshGirdData();
  117. });
  118. }
  119. });
  120. }
  121. });
  122. },
  123. // 初始化列表
  124. initGird: function () {
  125. $('#gridtable').lrAuthorizeJfGrid({
  126. url: top.$.rootUrl + '/EducationalAdministration/TextBookInfo/GetPageList',
  127. headData: [
  128. { label: "教材号", name: "TextBookNo", width: 150, align: "left" },
  129. { label: "教材名称", name: "TextBookName", width: 150, align: "left" },
  130. { label: "出版号", name: "PublishNo", width: 100, align: "left" },
  131. {
  132. label: "专业部", name: "DeptNo", width: 100, align: "left",
  133. formatterAsync: function (callback, value, row, op, $cell) {
  134. learun.clientdata.getAsync('custmerData', {
  135. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  136. key: value,
  137. keyId: 'deptno',
  138. callback: function (_data) {
  139. callback(_data['deptname']);
  140. }
  141. });
  142. }
  143. },
  144. { label: "第一作者", name: "FirstAuthor", width: 100, align: "left" },
  145. { label: "其他作者", name: "OtherAuthor", width: 100, align: "left" },
  146. {
  147. label: "出版日期", name: "Pubdate", width: 80, align: "left",
  148. formatter: function (value) {
  149. return learun.formatDate(value, 'yyyy-MM-dd');
  150. }
  151. },
  152. { label: "出版社", name: "Publisher", width: 100, align: "left" },
  153. {
  154. label: "教材类型", name: "TextBookType", width: 100, align: "left",
  155. formatterAsync: function (callback, value, row, op, $cell) {
  156. learun.clientdata.getAsync('dataItem', {
  157. key: value,
  158. code: 'TextBookType',
  159. callback: function (_data) {
  160. callback(_data.text);
  161. }
  162. });
  163. }
  164. },
  165. {
  166. label: "教材性质", name: "TextBookNature", width: 100, align: "left",
  167. formatterAsync: function (callback, value, row, op, $cell) {
  168. learun.clientdata.getAsync('dataItem', {
  169. key: value,
  170. code: 'TextBookNature',
  171. callback: function (_data) {
  172. callback(_data.text);
  173. }
  174. });
  175. }
  176. },
  177. { label: "价格", name: "Price", width: 60, align: "left" },
  178. { label: "版次", name: "Edition", width: 100, align: "left" },
  179. { label: "印次", name: "Impression", width: 100, align: "left" },
  180. {
  181. label: "是否有练习册", name: "IsWorkBook", width: 100, align: "left",
  182. formatter: function (cellvalue) {
  183. return cellvalue == true ? "<span class=\"label label-success\">是</span>" :
  184. "<span class=\"label label-danger\">否</span>";
  185. }
  186. },
  187. {
  188. label: "是否有教参教辅", name: "IsTeachConsult", width: 100, align: "left",
  189. formatter: function (cellvalue) {
  190. return cellvalue == true ? "<span class=\"label label-success\">是</span>" :
  191. "<span class=\"label label-danger\">否</span>";
  192. }
  193. },
  194. { label: "内容简介", name: "Description", width: 100, align: "left" },
  195. {
  196. label: "录入用户", name: "CreateUserID", width: 100, align: "left",
  197. formatterAsync: function (callback, value, row, op, $cell) {
  198. learun.clientdata.getAsync('user', {
  199. key: value,
  200. callback: function (_data) {
  201. callback(_data.name);
  202. }
  203. });
  204. }
  205. },
  206. { label: "录入时间", name: "Createdate", width: 100, align: "left" },
  207. {
  208. label: "修改用户", name: "UpdateUserID", width: 100, align: "left",
  209. formatterAsync: function (callback, value, row, op, $cell) {
  210. learun.clientdata.getAsync('user', {
  211. key: value,
  212. callback: function (_data) {
  213. callback(_data.name);
  214. }
  215. });
  216. }
  217. },
  218. { label: "修改时间", name: "Updatetime", width: 100, align: "left" },
  219. {
  220. label: "是否有效", name: "IsValid", width: 80, align: "center",
  221. formatter: function (cellvalue) {
  222. return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  223. }
  224. }
  225. ],
  226. mainId: 'ID',
  227. isPage: true,
  228. isMultiselect: true,
  229. sidx: 'Createdate asc'
  230. });
  231. page.search();
  232. },
  233. search: function (param) {
  234. param = param || {};
  235. param.SqlParameter = " and Isdel = '0' ";
  236. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  237. }
  238. };
  239. refreshGirdData = function () {
  240. $('#gridtable').jfGridSet('reload');
  241. };
  242. page.init();
  243. }