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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2022-04-14 09:50
  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. },
  19. 220,
  20. 400);
  21. $('#AcademicYearNo').lrselect({
  22. placeholder: "学年",
  23. allowSearch: true,
  24. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  25. value: 'value',
  26. text: 'text'
  27. });
  28. //学期
  29. $('#Semester').lrselect({
  30. placeholder: "学期",
  31. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester',
  32. value: 'value',
  33. text: 'text'
  34. });
  35. $.get('/Home/GetYearAndSemesteResult', function (ref) {
  36. if (ref.code == "200") {
  37. $('#AcademicYearNo').lrselectSet(ref.data.Item1);
  38. $('#Semester').lrselectSet(ref.data.Item3);
  39. }
  40. }.bind(this), "json");
  41. $('#ITEnabled').lrDataItemSelect({
  42. code: "YesOrNoBit"
  43. });
  44. // 刷新
  45. $('#lr_refresh').on('click',
  46. function () {
  47. location.reload();
  48. });
  49. // 新增
  50. $('#lr_add').on('click',
  51. function () {
  52. learun.layerForm({
  53. id: 'form',
  54. title: '新增',
  55. url: top.$.rootUrl + '/EducationalAdministration/Exam_InvigilateTeacher/Form',
  56. width: 600,
  57. height: 400,
  58. callBack: function (id) {
  59. return top[id].acceptClick(refreshGirdData);
  60. }
  61. });
  62. });
  63. // 编辑
  64. $('#lr_edit').on('click',
  65. function () {
  66. var keyValue = $('#gridtable').jfGridValue('ITId');
  67. if (learun.checkrow(keyValue)) {
  68. var ITEnabled = $('#gridtable').jfGridValue('ITEnabled');
  69. if (ITEnabled.indexOf('true') != -1) {
  70. learun.alert.warning("选中记录已启用!");
  71. return;
  72. }
  73. learun.layerForm({
  74. id: 'form',
  75. title: '编辑',
  76. url: top.$.rootUrl +
  77. '/EducationalAdministration/Exam_InvigilateTeacher/Form?keyValue=' +
  78. keyValue,
  79. width: 600,
  80. height: 400,
  81. callBack: function (id) {
  82. return top[id].acceptClick(refreshGirdData);
  83. }
  84. });
  85. }
  86. });
  87. // 删除
  88. $('#lr_delete').on('click',
  89. function () {
  90. var keyValue = $('#gridtable').jfGridValue('ITId');
  91. if (learun.checkrow(keyValue)) {
  92. var ITEnabled = $('#gridtable').jfGridValue('ITEnabled');
  93. if (ITEnabled.indexOf('true') != -1) {
  94. learun.alert.warning("选中记录已启用!");
  95. return;
  96. }
  97. learun.layerConfirm('是否确认删除该项!',
  98. function (res) {
  99. if (res) {
  100. learun.deleteForm(
  101. top.$.rootUrl + '/EducationalAdministration/Exam_InvigilateTeacher/DeleteForm',
  102. { keyValue: keyValue },
  103. function () {
  104. refreshGirdData();
  105. });
  106. }
  107. });
  108. }
  109. });
  110. // 打印
  111. $('#lr_print').on('click',
  112. function () {
  113. $('#gridtable').jqprintTable();
  114. });
  115. //启用
  116. $('#lr_lock').on('click',
  117. function () {
  118. var keyValue = $('#gridtable').jfGridValue('ITId');
  119. if (learun.checkrow(keyValue)) {
  120. var ITEnabled = $('#gridtable').jfGridValue('ITEnabled');
  121. if (ITEnabled.indexOf('true') != -1) {
  122. learun.alert.warning("选中记录中包含已启用项目!");
  123. return;
  124. }
  125. learun.layerConfirm('是否确认启用选中记录!',
  126. function (res) {
  127. if (res) {
  128. learun.deleteForm(
  129. top.$.rootUrl + '/EducationalAdministration/Exam_InvigilateTeacher/Lock',
  130. { keyValue: keyValue, ITEnabled: 1 },
  131. function () {
  132. refreshGirdData();
  133. });
  134. }
  135. });
  136. }
  137. });
  138. //禁用
  139. $('#lr_unlock').on('click',
  140. function () {
  141. var keyValue = $('#gridtable').jfGridValue('ITId');
  142. if (learun.checkrow(keyValue)) {
  143. var ELEnabled = $('#gridtable').jfGridValue('ITEnabled');
  144. if (ELEnabled.indexOf('false') != -1) {
  145. learun.alert.warning("选中记录中包含已停用项目!");
  146. return;
  147. }
  148. learun.layerConfirm('是否确认停用选中记录!',
  149. function (res) {
  150. if (res) {
  151. learun.deleteForm(
  152. top.$.rootUrl + '/EducationalAdministration/Exam_InvigilateTeacher/Lock',
  153. { keyValue: keyValue, ITEnabled: 0 },
  154. function () {
  155. refreshGirdData();
  156. });
  157. }
  158. });
  159. }
  160. });
  161. // 导入
  162. $('#lr_importByBasic').on('click',
  163. function () {
  164. learun.layerForm({
  165. id: 'form_import',
  166. title: '导入',
  167. url: top.$.rootUrl +
  168. '/EducationalAdministration/Exam_InvigilateTeacher/FormYearSemester?type=1',
  169. width: 500,
  170. height: 300,
  171. btn: ['一键导入', '关闭'],
  172. callBack: function (id) {
  173. return top[id].acceptClick(refreshGirdData);
  174. }
  175. });
  176. });
  177. // 按条件清空数据
  178. $('#lr_emptyWhere').on('click',
  179. function () {
  180. learun.layerForm({
  181. id: 'form_empty',
  182. title: '清空数据',
  183. url: top.$.rootUrl +
  184. '/EducationalAdministration/Exam_InvigilateTeacher/FormYearSemester?type=2',
  185. width: 500,
  186. height: 300,
  187. btn: ['清空', '关闭'],
  188. callBack: function (id) {
  189. return top[id].acceptClick(refreshGirdData);
  190. }
  191. });
  192. });
  193. },
  194. // 初始化列表
  195. initGird: function () {
  196. $('#gridtable').jfGrid({
  197. url: top.$.rootUrl + '/EducationalAdministration/Exam_InvigilateTeacher/GetPageList',
  198. headData: [
  199. { label: "学年", name: "AcademicYearNo", width: 100, align: "left" },
  200. { label: "学期", name: "Semester", width: 100, align: "left" },
  201. { label: "教师编号", name: "EmpNo", width: 100, align: "left" },
  202. { label: "教师姓名", name: "EmpName", width: 100, align: "left" },
  203. {
  204. label: "是否启用", name: "ITEnabled", width: 100, align: "left",
  205. formatter: function (cellvalue) {
  206. return cellvalue == 1 ? "<span class=\"label label-success\">是</span>" : "<span class=\"label label-default\" >否</span>";
  207. }
  208. },
  209. ],
  210. mainId: 'ITId',
  211. isMultiselect: true,
  212. isPage: true,
  213. sidx: 'AcademicYearNo desc,Semester desc,ITOrder asc'
  214. });
  215. page.search();
  216. },
  217. search: function (param) {
  218. param = param || {};
  219. if (IsTwoDept)
  220. param.ImportDeptNo = CurrentDeptNo;
  221. else
  222. param.ImportDeptNo = "0";
  223. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  224. }
  225. };
  226. refreshGirdData = function () {
  227. $('#gridtable').jfGridSet('reload');
  228. };
  229. page.init();
  230. }