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.
 
 
 
 
 
 

297 lines
12 KiB

  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. page.search();
  143. }
  144. });
  145. //查询
  146. $('#lr_search').on('click', function () {
  147. var p = {};
  148. p.schoolId = $('#F_SchoolId').lrselectGet();
  149. p.ClassNo = $('#ClassNo').lrselectGet();
  150. p.EmpNo = $('#EmpNo').lrselectGet();
  151. page.search(p);
  152. });
  153. // 按条件清空排课数据
  154. $('#emptyByCondition').on('click', function () {
  155. learun.layerForm({
  156. id: 'EmptyByConditionForm',
  157. title: '按条件清空排课数据',
  158. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/EmptyByConditionForm',
  159. width: 600,
  160. height: 400,
  161. callBack: function (id) {
  162. return top[id].acceptClick(refreshGirdData);
  163. }
  164. });
  165. });
  166. // 按条件同步排课数据
  167. $('#syncByCondition').on('click', function () {
  168. learun.layerForm({
  169. id: 'SyncByConditionForm',
  170. title: '按条件同步排课数据',
  171. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/SyncByConditionForm',
  172. width: 600,
  173. height: 400,
  174. callBack: function (id) {
  175. return top[id].acceptClick(refreshGirdData);
  176. }
  177. });
  178. });
  179. //按条件重置基础数据同步状态
  180. $('#initByCondition').on('click', function () {
  181. learun.layerForm({
  182. id: 'SyncByConditionForm',
  183. title: '按条件重置基础数据同步状态',
  184. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/ClearByConditionForm',
  185. width: 600,
  186. height: 400,
  187. callBack: function (id) {
  188. return top[id].acceptClick();
  189. }
  190. });
  191. });
  192. //打印课程表
  193. $('#perBtn').on('click',
  194. function () {
  195. AddPrintContent();
  196. });
  197. var LODOP, P_ID = "", TaskID1, TaskID2, t, waiting = false, c = 0, loop = 0; //声明为全局变量
  198. function AddPrintContent() {
  199. var myHtml = myHtml = $('.personalBox').html();
  200. var strBodyStyle = "<style>" + document.getElementById("style1").innerHTML + "</style>";
  201. var strFormHtml = strBodyStyle + "<body>" + myHtml + "</body>";
  202. LODOP = getLodop();
  203. LODOP.PRINT_INIT("个人授课表");
  204. LODOP.SET_PRINT_PAGESIZE(2, 0, 0, "A4");
  205. LODOP.SET_PRINT_MODE("PRINT_DUPLEX", 2);
  206. LODOP.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", 7);
  207. LODOP.ADD_PRINT_HTM(10, 10, '284mm', '185mm', strFormHtml);
  208. //打印预览
  209. LODOP.SET_SHOW_MODE("LANDSCAPE_DEFROTATED", 1); //横向时的正向显示
  210. var TaskID1 = LODOP.PREVIEW();
  211. // 直接打印
  212. // var TaskID1=LODOP.PRINT();
  213. }
  214. },
  215. bindSelect: function () {
  216. //校区
  217. $('#F_SchoolId').lrDataSourceSelect({
  218. code: 'company', value: 'f_companyid', text: 'f_fullname', select: function (item) {
  219. if (!!item) {
  220. // 班级
  221. $('#ClassNo').lrselectRefresh({
  222. placeholder: "请选择班级",
  223. allowSearch: true,
  224. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetClassData',
  225. param: { schoolId: item.f_companyid },
  226. value: 'value',
  227. text: 'text'
  228. });
  229. // 教师
  230. $('#EmpNo').lrselectRefresh({
  231. placeholder: "请选择教师",
  232. allowSearch: true,
  233. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData',
  234. param: { schoolId: item.f_companyid },
  235. value: 'value',
  236. text: 'text'
  237. });
  238. } else {
  239. //班级
  240. $('#ClassNo').lrselectRefresh({
  241. placeholder: "请选择班级",
  242. allowSearch: true,
  243. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetClassData',
  244. param: { schoolId: "" },
  245. value: 'value',
  246. text: 'text'
  247. });
  248. //教师
  249. $('#EmpNo').lrselectRefresh({
  250. placeholder: "请选择教师",
  251. allowSearch: true,
  252. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData',
  253. param: { schoolId: "" },
  254. value: 'value',
  255. text: 'text'
  256. });
  257. }
  258. }
  259. });
  260. //班级
  261. $('#ClassNo').lrselect({
  262. placeholder: "请选择班级",
  263. allowSearch: true,
  264. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetClassData',
  265. value: 'value',
  266. text: 'text'
  267. });
  268. //教师
  269. $('#EmpNo').lrselect({
  270. placeholder: "请选择教师",
  271. allowSearch: true,
  272. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData',
  273. value: 'value',
  274. text: 'text'
  275. });
  276. },
  277. search: function (param) {
  278. param = param || {};
  279. param.StartTime = startTime;
  280. param.EndTime = endTime;
  281. page.loadData(param);
  282. }
  283. };
  284. page.init();
  285. };