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.

IndexInEducation.js 12 KiB

4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. var refreshGirdData;
  2. var bootstrap = function ($, learun) {
  3. var startTime;
  4. var endTime;
  5. var page = {
  6. init: function () {
  7. page.bind();
  8. page.bindSelect();
  9. },
  10. loadData: function (param) {
  11. $.lrSetFormWithParam(top.$.rootUrl + '/PersonnelManagement/TimeTable/GetDataInEducation', param,
  12. function (data) {
  13. // 数据处理
  14. var html = '';
  15. var weekLists = data.weekList;
  16. for (var i = 1; i < 11; i++) {
  17. (function (arg) {
  18. var args = arg - 1;
  19. var datas = flogs(arg, weekLists, 'time');
  20. html += ' <tr><td>' + arg + '节</td>';
  21. if (datas) {
  22. var lists = datas.list;
  23. html += tdHandles(lists);
  24. } else {
  25. html += tdHandle(arg);
  26. }
  27. html += '</tr>';
  28. })(i); //调用时参数
  29. }
  30. $('.personT').text(data.schoolName);
  31. $('.perSemester').text(data.semester);
  32. $('.perFestivalsBox table').html(html);
  33. function flogs(num, data, obj) {
  34. var flog = false;
  35. $.each(data,
  36. function (i, n) {
  37. if (n[obj] == num) {
  38. flog = n;
  39. return;
  40. }
  41. })
  42. return flog;
  43. }
  44. function flogs2(num, data, obj) {
  45. var arr = new Array();
  46. $.each(data,
  47. function (i, n) {
  48. if (n[obj] == num) {
  49. arr.push(n);
  50. }
  51. })
  52. return arr;
  53. }
  54. //某节课空
  55. function tdHandle() {
  56. var html = '';
  57. for (var j = 0; j < 7; j++) {
  58. html += '<td><div></div><div></div><div></div><div></div></td>';
  59. }
  60. return html;
  61. }
  62. //某节课不空
  63. function tdHandles(lists) {
  64. var html = '';
  65. for (var k = 1; k < 8; k++) {
  66. (function (arg) {
  67. var args = arg - 1;
  68. var datas = flogs2(arg, lists, 'day');
  69. if (datas.length > 0) {
  70. html += '<td class="active">';
  71. $.each(datas, function (i, item) {
  72. if (i > 0) {
  73. html += '<hr>';
  74. }
  75. html += '<div>课程:' +
  76. item.curriculum +
  77. '</div>' +
  78. '<div>教师:' +
  79. item.teacher +
  80. '</div>' +
  81. '<div>班级:' +
  82. item.className +
  83. '</div>' +
  84. '<div>教室:' +
  85. item.classRoom +
  86. '</div>';
  87. });
  88. html += '</td>';
  89. } else {
  90. html += '<td><div></div><div></div><div></div><div></div></td>';
  91. }
  92. })(k);
  93. }
  94. return html;
  95. }
  96. });
  97. },
  98. bind: function () {
  99. // 刷新
  100. $('#lr_refresh').on('click', function () {
  101. location.reload();
  102. });
  103. $('#datesearch').lrdate({
  104. dfdata: [
  105. {
  106. name: '上周',
  107. begin: function () { return learun.getTime(7); },
  108. end: function () {
  109. return learun.getTime(1);
  110. }
  111. },
  112. {
  113. name: '本周',
  114. begin: function () { return learun.getTime(0); },
  115. end: function () {
  116. return learun.getTime(-6);
  117. }
  118. },
  119. {
  120. name: '下周',
  121. begin: function () { return learun.getTime(-7); },
  122. end: function () {
  123. return learun.getTime(-13);
  124. }
  125. }],
  126. // 月
  127. mShow: false,
  128. premShow: false,
  129. // 季度
  130. jShow: false,
  131. prejShow: false,
  132. // 年
  133. ysShow: false,
  134. yxShow: false,
  135. preyShow: false,
  136. yShow: false,
  137. // 默认
  138. dfvalue: 'currentWeek',
  139. selectfn: function (begin, end) {
  140. startTime = begin;
  141. endTime = end;
  142. var p = {};
  143. p.schoolId = $('#F_SchoolId').lrselectGet();
  144. p.ClassNo = $('#ClassNo').lrselectGet();
  145. p.EmpNo = $('#EmpNo').lrselectGet();
  146. page.search(p);
  147. }
  148. });
  149. //查询
  150. $('#lr_search').on('click', function () {
  151. var p = {};
  152. p.schoolId = $('#F_SchoolId').lrselectGet();
  153. p.ClassNo = $('#ClassNo').lrselectGet();
  154. p.EmpNo = $('#EmpNo').lrselectGet();
  155. page.search(p);
  156. });
  157. // 按条件清空排课数据
  158. $('#emptyByCondition').on('click', function () {
  159. learun.layerForm({
  160. id: 'EmptyByConditionForm',
  161. title: '按条件清空排课数据',
  162. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/EmptyByConditionForm',
  163. width: 600,
  164. height: 400,
  165. callBack: function (id) {
  166. return top[id].acceptClick(refreshGirdData);
  167. }
  168. });
  169. });
  170. // 按条件同步排课数据
  171. $('#syncByCondition').on('click', function () {
  172. learun.layerForm({
  173. id: 'SyncByConditionForm',
  174. title: '按条件同步排课数据',
  175. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/SyncByConditionForm',
  176. width: 600,
  177. height: 400,
  178. callBack: function (id) {
  179. return top[id].acceptClick(refreshGirdData);
  180. }
  181. });
  182. });
  183. //按条件重置基础数据同步状态
  184. $('#initByCondition').on('click', function () {
  185. learun.layerForm({
  186. id: 'SyncByConditionForm',
  187. title: '按条件重置基础数据同步状态',
  188. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/ClearByConditionForm',
  189. width: 600,
  190. height: 400,
  191. callBack: function (id) {
  192. return top[id].acceptClick();
  193. }
  194. });
  195. });
  196. //打印课程表
  197. $('#perBtn').on('click',
  198. function () {
  199. AddPrintContent();
  200. });
  201. var LODOP, P_ID = "", TaskID1, TaskID2, t, waiting = false, c = 0, loop = 0; //声明为全局变量
  202. function AddPrintContent() {
  203. var myHtml = myHtml = $('.personalBox').html();
  204. var strBodyStyle = "<style>" + document.getElementById("style1").innerHTML + "</style>";
  205. var strFormHtml = strBodyStyle + "<body>" + myHtml + "</body>";
  206. LODOP = getLodop();
  207. LODOP.PRINT_INIT("个人授课表");
  208. LODOP.SET_PRINT_PAGESIZE(2, 0, 0, "A4");
  209. LODOP.SET_PRINT_MODE("PRINT_DUPLEX", 2);
  210. LODOP.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", 7);
  211. LODOP.ADD_PRINT_HTM(10, 10, '284mm', '185mm', strFormHtml);
  212. //打印预览
  213. LODOP.SET_SHOW_MODE("LANDSCAPE_DEFROTATED", 1); //横向时的正向显示
  214. var TaskID1 = LODOP.PREVIEW();
  215. // 直接打印
  216. // var TaskID1=LODOP.PRINT();
  217. }
  218. },
  219. bindSelect: function () {
  220. //校区
  221. $('#F_SchoolId').lrDataSourceSelect({
  222. code: 'company', value: 'f_companyid', text: 'f_fullname', select: function (item) {
  223. if (!!item) {
  224. // 班级
  225. $('#ClassNo').lrselectRefresh({
  226. placeholder: "请选择班级",
  227. allowSearch: true,
  228. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetClassData',
  229. param: { schoolId: item.f_companyid },
  230. value: 'value',
  231. text: 'text'
  232. });
  233. // 教师
  234. $('#EmpNo').lrselectRefresh({
  235. placeholder: "请选择教师",
  236. allowSearch: true,
  237. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData',
  238. param: { schoolId: item.f_companyid },
  239. value: 'value',
  240. text: 'text'
  241. });
  242. } else {
  243. //班级
  244. $('#ClassNo').lrselectRefresh({
  245. placeholder: "请选择班级",
  246. allowSearch: true,
  247. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetClassData',
  248. param: { schoolId: "" },
  249. value: 'value',
  250. text: 'text'
  251. });
  252. //教师
  253. $('#EmpNo').lrselectRefresh({
  254. placeholder: "请选择教师",
  255. allowSearch: true,
  256. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData',
  257. param: { schoolId: "" },
  258. value: 'value',
  259. text: 'text'
  260. });
  261. }
  262. }
  263. });
  264. //班级
  265. $('#ClassNo').lrselect({
  266. placeholder: "请选择班级",
  267. allowSearch: true,
  268. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetClassData',
  269. value: 'value',
  270. text: 'text'
  271. });
  272. //教师
  273. $('#EmpNo').lrselect({
  274. placeholder: "请选择教师",
  275. allowSearch: true,
  276. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData',
  277. value: 'value',
  278. text: 'text'
  279. });
  280. },
  281. search: function (param) {
  282. param = param || {};
  283. param.StartTime = startTime;
  284. param.EndTime = endTime;
  285. page.loadData(param);
  286. }
  287. };
  288. page.init();
  289. };