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.
 
 
 
 
 
 

282 regels
13 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 (learun.checkrow(keyValue)) {
  79. //var ELEnabled = $('#gridtable').jfGridValue('ELEnabled');
  80. //if (ELEnabled.indexOf('true') != -1) {
  81. // learun.alert.warning("选中记录已启用!");
  82. // return;
  83. //}
  84. learun.layerForm({
  85. id: 'formtime',
  86. title: '设置考试时长',
  87. url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/FormExamTime?keyValue=' + keyValue,
  88. width: 600,
  89. height: 400,
  90. callBack: function (id) {
  91. return top[id].acceptClick(refreshGirdData);
  92. }
  93. });
  94. }
  95. });
  96. // 导入
  97. $('#lr_importByBasic').on('click', function () {
  98. learun.layerForm({
  99. id: 'form_import',
  100. title: '导入',
  101. url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/FormYearSemester?type=1',
  102. width: 500,
  103. height: 300,
  104. btn: ['一键导入', '关闭'],
  105. callBack: function (id) {
  106. return top[id].acceptClick(refreshGirdData);
  107. }
  108. });
  109. });
  110. // 按条件清空数据
  111. $('#lr_emptyWhere').on('click', function () {
  112. learun.layerForm({
  113. id: 'form_empty',
  114. title: '清空数据',
  115. url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/FormYearSemester?type=2',
  116. width: 500,
  117. height: 300,
  118. btn: ['清空', '关闭'],
  119. callBack: function (id) {
  120. return top[id].acceptClick(refreshGirdData);
  121. }
  122. });
  123. });
  124. // 删除
  125. $('#lr_delete').on('click', function () {
  126. var keyValue = $('#gridtable').jfGridValue('ELId');
  127. if (learun.checkrow(keyValue)) {
  128. var ELEnabled = $('#gridtable').jfGridValue('ELEnabled');
  129. if (ELEnabled.indexOf('true') != -1) {
  130. learun.alert.warning("选中记录中包含已启用项目!");
  131. return;
  132. }
  133. learun.layerConfirm('是否确认删除该项!', function (res) {
  134. if (res) {
  135. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/DeleteForm', { keyValue: keyValue }, function () {
  136. refreshGirdData();
  137. });
  138. }
  139. });
  140. }
  141. });
  142. //启用
  143. $('#lr_lock').on('click', function () {
  144. var keyValue = $('#gridtable').jfGridValue('ELId');
  145. if (learun.checkrow(keyValue)) {
  146. var ELEnabled = $('#gridtable').jfGridValue('ELEnabled');
  147. if (ELEnabled.indexOf('true') != -1) {
  148. learun.alert.warning("选中记录中包含已启用项目!");
  149. return;
  150. }
  151. learun.layerConfirm('是否确认启用选中记录!', function (res) {
  152. if (res) {
  153. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/Lock', { keyValue: keyValue, ELEnabled: 1 }, function () {
  154. refreshGirdData();
  155. });
  156. }
  157. });
  158. }
  159. });
  160. //禁用
  161. $('#lr_unlock').on('click', function () {
  162. var keyValue = $('#gridtable').jfGridValue('ELId');
  163. if (learun.checkrow(keyValue)) {
  164. var ELEnabled = $('#gridtable').jfGridValue('ELEnabled');
  165. if (ELEnabled.indexOf('false') != -1) {
  166. learun.alert.warning("选中记录中包含已停用项目!");
  167. return;
  168. }
  169. learun.layerConfirm('是否确认停用选中记录!', function (res) {
  170. if (res) {
  171. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/Lock', { keyValue: keyValue, ELEnabled: 0 }, function () {
  172. refreshGirdData();
  173. });
  174. }
  175. });
  176. }
  177. });
  178. // 打印
  179. $('#lr_print').on('click', function () {
  180. $('#gridtable').jqprintTable();
  181. });
  182. },
  183. // 初始化列表
  184. initGird: function () {
  185. $('#gridtable').jfGrid({
  186. url: top.$.rootUrl + '/EducationalAdministration/Exam_ExamLesson/GetPageList',
  187. headData: [
  188. { label: "学年", name: "AcademicYearNo", width: 100, align: "left" },
  189. { label: "学期", name: "Semester", width: 100, align: "left" },
  190. //{
  191. // label: "系部", name: "DeptNo", width: 100, align: "left",
  192. // formatterAsync: function (callback, value, row, op, $cell) {
  193. // learun.clientdata.getAsync('custmerData', {
  194. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  195. // key: value,
  196. // keyId: 'deptno',
  197. // callback: function (_data) {
  198. // callback(_data['deptname']);
  199. // }
  200. // });
  201. // }
  202. //},
  203. //{
  204. // label: "专业", name: "MajorNo", width: 100, align: "left",
  205. // formatterAsync: function (callback, value, row, op, $cell) {
  206. // learun.clientdata.getAsync('custmerData', {
  207. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  208. // key: value,
  209. // keyId: 'majorno',
  210. // callback: function (_data) {
  211. // callback(_data['majorname']);
  212. // }
  213. // });
  214. // }
  215. //},
  216. { label: "年级", name: "Grade", width: 50, align: "left" },
  217. { label: "课程编号", name: "LessonNo", width: 100, align: "left" },
  218. { label: "课程名称", name: "LessonName", width: 200, align: "left" },
  219. {
  220. label: "考试时长", name: "ExamTime", width: 150, align: "left",
  221. formatter: function (cellvalue) {
  222. if (cellvalue) {
  223. return cellvalue + '分钟';
  224. } else {
  225. return "";
  226. }
  227. }
  228. },
  229. {
  230. label: "课程类型", name: "LessonTypeId", width: 150, align: "left",
  231. formatterAsync: function (callback, value, row, op, $cell) {
  232. learun.clientdata.getAsync('custmerData', {
  233. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonType',
  234. key: value,
  235. keyId: 'ltid',
  236. callback: function (_data) {
  237. callback(_data['lessontypename']);
  238. }
  239. });
  240. }
  241. },
  242. {
  243. label: "专业", name: "MajorNo", width: 150, align: "left",
  244. formatterAsync: function (callback, value, row, op, $cell) {
  245. learun.clientdata.getAsync('custmerData', {
  246. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  247. key: value,
  248. keyId: 'majorno',
  249. callback: function (_data) {
  250. callback(_data['majorname']);
  251. }
  252. });
  253. }
  254. },
  255. //{ label: "排序号", name: "ELOrder", width: 100, align: "left" },
  256. {
  257. label: "是否启用", name: "ELEnabled", width: 100, align: "left",
  258. formatter: function (cellvalue) {
  259. return cellvalue == 1 ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  260. }
  261. },
  262. ],
  263. mainId: 'ELId',
  264. isMultiselect: true,
  265. isPage: true,
  266. sidx: 'AcademicYearNo desc,Semester desc,ELOrder asc,LessonNo asc'
  267. });
  268. page.search();
  269. },
  270. search: function (param) {
  271. param = param || {};
  272. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  273. }
  274. };
  275. refreshGirdData = function () {
  276. $('#gridtable').jfGridSet('reload');
  277. };
  278. page.init();
  279. }