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.
 
 
 
 
 
 

260 lines
12 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2022-04-12 15:47
  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. $('#AcademicYearNo').lrselect({
  20. placeholder: "学年",
  21. allowSearch: true,
  22. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  23. value: 'value',
  24. text: 'text'
  25. });
  26. //学期
  27. $('#Semester').lrselect({
  28. placeholder: "学期",
  29. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester',
  30. value: 'value',
  31. text: 'text'
  32. });
  33. // 刷新
  34. $('#lr_refresh').on('click', function () {
  35. location.reload();
  36. });
  37. // 新增
  38. $('#lr_add').on('click', function () {
  39. learun.layerForm({
  40. id: 'form',
  41. title: '新增',
  42. url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/Form',
  43. width: 600,
  44. height: 400,
  45. callBack: function (id) {
  46. return top[id].acceptClick(refreshGirdData);
  47. }
  48. });
  49. });
  50. // 编辑
  51. $('#lr_edit').on('click', function () {
  52. var keyValue = $('#gridtable').jfGridValue('ELId');
  53. if (keyValue.indexOf(',') != -1) {
  54. learun.alert.warning("只能选择一条记录进行编辑!");
  55. return false;
  56. }
  57. if (learun.checkrow(keyValue)) {
  58. var ELEnabled = $('#gridtable').jfGridValue('ELEnabled');
  59. if (ELEnabled.indexOf('true') != -1) {
  60. learun.alert.warning("选中记录已启用!");
  61. return;
  62. }
  63. learun.layerForm({
  64. id: 'form',
  65. title: '编辑',
  66. url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/Form?keyValue=' + keyValue,
  67. width: 600,
  68. height: 400,
  69. callBack: function (id) {
  70. return top[id].acceptClick(refreshGirdData);
  71. }
  72. });
  73. }
  74. });
  75. // 设置考试时长
  76. $('#lr_editExamTime').on('click', function () {
  77. var keyValue = $('#gridtable').jfGridValue('ELId');
  78. //if (keyValue.indexOf(',') != -1) {
  79. // learun.alert.warning("只能选择一条记录进行编辑!");
  80. // return false;
  81. //}
  82. if (learun.checkrow(keyValue)) {
  83. var ELEnabled = $('#gridtable').jfGridValue('ELEnabled');
  84. if (ELEnabled.indexOf('true') != -1) {
  85. learun.alert.warning("选中记录已启用!");
  86. return;
  87. }
  88. learun.layerForm({
  89. id: 'formtime',
  90. title: '设置考试时长',
  91. url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/FormExamTime?keyValue=' + keyValue,
  92. width: 600,
  93. height: 400,
  94. callBack: function (id) {
  95. return top[id].acceptClick(refreshGirdData);
  96. }
  97. });
  98. }
  99. });
  100. // 导入
  101. $('#lr_importByBasic').on('click', function () {
  102. learun.layerForm({
  103. id: 'form_import',
  104. title: '导入',
  105. url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/FormYearSemester?type=1',
  106. width: 500,
  107. height: 300,
  108. btn: ['一键导入', '关闭'],
  109. callBack: function (id) {
  110. return top[id].acceptClick(refreshGirdData);
  111. }
  112. });
  113. });
  114. // 按条件清空数据
  115. $('#lr_emptyWhere').on('click', function () {
  116. learun.layerForm({
  117. id: 'form_empty',
  118. title: '清空数据',
  119. url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/FormYearSemester?type=2',
  120. width: 500,
  121. height: 300,
  122. btn: ['清空', '关闭'],
  123. callBack: function (id) {
  124. return top[id].acceptClick(refreshGirdData);
  125. }
  126. });
  127. });
  128. // 删除
  129. $('#lr_delete').on('click', function () {
  130. var keyValue = $('#gridtable').jfGridValue('ELId');
  131. if (learun.checkrow(keyValue)) {
  132. var ELEnabled = $('#gridtable').jfGridValue('ELEnabled');
  133. if (ELEnabled.indexOf('true') != -1) {
  134. learun.alert.warning("选中记录中包含已启用项目!");
  135. return;
  136. }
  137. learun.layerConfirm('是否确认删除该项!', function (res) {
  138. if (res) {
  139. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/DeleteForm', { keyValue: keyValue }, function () {
  140. refreshGirdData();
  141. });
  142. }
  143. });
  144. }
  145. });
  146. //启用
  147. $('#lr_lock').on('click', function () {
  148. var keyValue = $('#gridtable').jfGridValue('ELId');
  149. if (learun.checkrow(keyValue)) {
  150. var ELEnabled = $('#gridtable').jfGridValue('ELEnabled');
  151. if (ELEnabled.indexOf('true') != -1) {
  152. learun.alert.warning("选中记录中包含已启用项目!");
  153. return;
  154. }
  155. learun.layerConfirm('是否确认启用选中记录!', function (res) {
  156. if (res) {
  157. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/Lock', { keyValue: keyValue, ELEnabled: 1 }, function () {
  158. refreshGirdData();
  159. });
  160. }
  161. });
  162. }
  163. });
  164. //禁用
  165. $('#lr_unlock').on('click', function () {
  166. var keyValue = $('#gridtable').jfGridValue('ELId');
  167. if (learun.checkrow(keyValue)) {
  168. var ELEnabled = $('#gridtable').jfGridValue('ELEnabled');
  169. if (ELEnabled.indexOf('false') != -1) {
  170. learun.alert.warning("选中记录中包含已停用项目!");
  171. return;
  172. }
  173. learun.layerConfirm('是否确认停用选中记录!', function (res) {
  174. if (res) {
  175. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/Lock', { keyValue: keyValue, ELEnabled: 0 }, function () {
  176. refreshGirdData();
  177. });
  178. }
  179. });
  180. }
  181. });
  182. // 打印
  183. $('#lr_print').on('click', function () {
  184. $('#gridtable').jqprintTable();
  185. });
  186. },
  187. // 初始化列表
  188. initGird: function () {
  189. $('#gridtable').jfGrid({
  190. url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/GetPageList',
  191. headData: [
  192. { label: "学年", name: "AcademicYearNo", width: 100, align: "left" },
  193. { label: "学期", name: "Semester", width: 100, align: "left" },
  194. //{
  195. // label: "系部", name: "DeptNo", width: 100, align: "left",
  196. // formatterAsync: function (callback, value, row, op, $cell) {
  197. // learun.clientdata.getAsync('custmerData', {
  198. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  199. // key: value,
  200. // keyId: 'deptno',
  201. // callback: function (_data) {
  202. // callback(_data['deptname']);
  203. // }
  204. // });
  205. // }
  206. //},
  207. //{
  208. // label: "专业", name: "MajorNo", width: 100, align: "left",
  209. // formatterAsync: function (callback, value, row, op, $cell) {
  210. // learun.clientdata.getAsync('custmerData', {
  211. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  212. // key: value,
  213. // keyId: 'majorno',
  214. // callback: function (_data) {
  215. // callback(_data['majorname']);
  216. // }
  217. // });
  218. // }
  219. //},
  220. { label: "年级", name: "Grade", width: 50, align: "left" },
  221. { label: "课程编号", name: "LessonNo", width: 100, align: "left" },
  222. { label: "课程名称", name: "LessonName", width: 200, align: "left" },
  223. {
  224. label: "考试时长", name: "ExamTime", width: 150, align: "left",
  225. formatter: function (cellvalue) {
  226. if (cellvalue) {
  227. return cellvalue + '分钟';
  228. } else {
  229. return "";
  230. }
  231. }
  232. },
  233. //{ label: "排序号", name: "ELOrder", width: 100, align: "left" },
  234. {
  235. label: "是否启用", name: "ELEnabled", width: 100, align: "left",
  236. formatter: function (cellvalue) {
  237. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  238. }
  239. },
  240. ],
  241. mainId: 'ELId',
  242. isMultiselect: true,
  243. isPage: true,
  244. sidx: 'AcademicYearNo desc,Semester desc,ELOrder asc,LessonNo asc'
  245. });
  246. page.search();
  247. },
  248. search: function (param) {
  249. param = param || {};
  250. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  251. }
  252. };
  253. refreshGirdData = function () {
  254. $('#gridtable').jfGridSet('reload');
  255. };
  256. page.init();
  257. }