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.
 
 
 
 
 
 

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