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.
 
 
 
 
 
 

355 lines
19 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-09-26 10:47
  5. * 描 述:教学调度
  6. */
  7. var acceptClick;
  8. var keyValue = request('keyValue');
  9. // 设置权限
  10. var setAuthorize;
  11. // 设置表单数据
  12. var setFormData;
  13. // 验证数据是否填写完整
  14. var validForm;
  15. // 保存数据
  16. var save;
  17. //绑定原课程安排
  18. var bindData;
  19. //绑定新课程安排
  20. var bindDataNew;
  21. var bootstrap = function ($, learun) {
  22. "use strict";
  23. // 设置权限
  24. setAuthorize = function (data) {
  25. };
  26. var page = {
  27. init: function () {
  28. $('.lr-form-wrap').lrscroll();
  29. page.bindSelect();
  30. page.bind();
  31. page.initData();
  32. },
  33. query: function () {
  34. var p = {};
  35. //p.F_SchoolId = $('#F_SchoolId').lrselectGet();
  36. p.AcademicYearNo = $('#AcademicYearNo').lrselectGet();
  37. p.Semester = $('#Semester').lrselectGet();
  38. p.DeptNo = $('#DeptNo').lrselectGet();
  39. p.MajorNo = $('#MajorNo').lrselectGet();
  40. p.LessonNo = $('#LessonNo').lrselectGet();
  41. p.TeachClassNo = $('#TeachClassNo').lrselectGet();
  42. p.EmpNo = $('#EmpNo').lrselectGet();
  43. p.ClassroomNo = $('#ClassroomNo').lrselectGet();
  44. //if (!!p.F_SchoolId && !!p.AcademicYearNo && !!p.Semester && !!p.DeptNo && !!p.MajorNo && !!p.LessonNo && !!p.TeachClassNo && !!p.EmpNo && !!p.ClassroomNo) {
  45. if (!!p.AcademicYearNo && !!p.Semester && !!p.DeptNo && !!p.MajorNo && !!p.LessonNo && !!p.TeachClassNo && !!p.EmpNo && !!p.ClassroomNo) {
  46. //调度开始时间
  47. $('#AttemperStartTime').lrselectRefresh({
  48. allowSearch: true,
  49. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/GetLessonDateList?queryJson=' + JSON.stringify(p),
  50. value: 'value',
  51. text: 'text'
  52. });
  53. //调度结束时间
  54. $('#AttemperEndTime').lrselectRefresh({
  55. allowSearch: true,
  56. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/GetLessonDateList?queryJson=' + JSON.stringify(p),
  57. value: 'value',
  58. text: 'text'
  59. });
  60. }
  61. },
  62. bind: function () {
  63. $('#CreateTime')[0].lrvalue = learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss');
  64. $('#CreateTime').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss'));
  65. $('#CreateUserId')[0].lrvalue = learun.clientdata.get(['userinfo']).userId;
  66. $('#CreateUserId').val(learun.clientdata.get(['userinfo']).realName);
  67. $('#CreateUserName')[0].lrvalue = learun.clientdata.get(['userinfo']).realName;
  68. //选择课程安排
  69. $("#btn1").on('click', function () {
  70. learun.layerForm({
  71. id: 'IndexInEducationSelect',
  72. title: '课程表',
  73. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/IndexInEducationSelect',
  74. width: 1200,
  75. height: 800,
  76. callBack: function (id) {
  77. return top[id].acceptClick(bindData);
  78. }
  79. });
  80. });
  81. $("#btn2").on('click', function () {
  82. learun.layerForm({
  83. id: 'IndexInEducationSelect',
  84. title: '课程表',
  85. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/IndexInEducationSelect',
  86. width: 1200,
  87. height: 800,
  88. callBack: function (id) {
  89. return top[id].acceptClick(bindDataNew);
  90. }
  91. });
  92. });
  93. },
  94. bindSelect: function () {
  95. $('#AttemperType').lrDataItemSelect({
  96. code: 'AttemperType', select: function (item) {
  97. $('.AttemperType').hide();
  98. $("#AttemperTimeType").removeAttr("isvalid");
  99. $("#AttemperTimeType").removeAttr("checkexpession");
  100. $("#AttemperStartTime").removeAttr("isvalid");
  101. $("#AttemperStartTime").removeAttr("checkexpession");
  102. $("#AttemperEndTime").removeAttr("isvalid");
  103. $("#AttemperEndTime").removeAttr("checkexpession");
  104. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("isvalid");
  105. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("checkexpession");
  106. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr('readonly');
  107. $('#NewEmpNo').siblings('div').html('教师');
  108. $('#NewClassroomNo').siblings('div').html('教室');
  109. if (item != null && item != undefined) {
  110. if (item.id === "01") { //调课
  111. $('.AttemperTypeTiao').show();
  112. $("#AttemperTimeType").attr("isvalid", "yes");
  113. $("#AttemperTimeType").attr("checkexpession", "NotNull");
  114. $("#AttemperStartTime").attr("isvalid", "yes");
  115. $("#AttemperStartTime").attr("checkexpession", "NotNull");
  116. $("#AttemperEndTime").attr("isvalid", "yes");
  117. $("#AttemperEndTime").attr("checkexpession", "NotNull");
  118. } else if (item.id === "02") { //停课
  119. } else if (item.id === "03") { //对调
  120. $('.AttemperTypeDuiDiao').show();
  121. $(".AttemperTypeDuiDiao").find('.contentDiv').attr("isvalid", "yes");
  122. $(".AttemperTypeDuiDiao").find('.contentDiv').attr("checkexpession", "NotNull");
  123. $(".AttemperTypeDuiDiao").find('.contentDiv').attr('readonly', 'readonly');
  124. $('#NewEmpNo').siblings('div').html('教师<font face="宋体">*</font>');
  125. $('#NewClassroomNo').siblings('div').html('教室<font face="宋体">*</font>');
  126. }
  127. }
  128. }
  129. });
  130. $('#AttemperTimeType').lrDataItemSelect({ code: 'AttemperTimeType' });
  131. //$('#F_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' });
  132. //$('#NewF_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' });
  133. //学年
  134. $('#AcademicYearNo').lrselect({
  135. allowSearch: true,
  136. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  137. value: 'value',
  138. text: 'text'
  139. });
  140. $('#NewAcademicYearNo').lrselect({
  141. allowSearch: true,
  142. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  143. value: 'value',
  144. text: 'text'
  145. });
  146. //学期
  147. $('#Semester').lrselect({
  148. allowSearch: true,
  149. url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetSemesterData',
  150. value: 'value',
  151. text: 'text'
  152. });
  153. $('#NewSemester').lrselect({
  154. allowSearch: true,
  155. url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetSemesterData',
  156. value: 'value',
  157. text: 'text'
  158. });
  159. $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
  160. $('#NewDeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
  161. $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
  162. $('#NewMajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
  163. $('#LessonNo').lrselect({
  164. allowSearch: true,
  165. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetLessonDataInTerm',
  166. value: 'value',
  167. text: 'text',
  168. });
  169. $('#NewLessonNo').lrselect({
  170. allowSearch: true,
  171. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetLessonDataInTerm',
  172. value: 'value',
  173. text: 'text',
  174. });
  175. $('#TeachClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' });
  176. $('#NewTeachClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' });
  177. $('#EmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname' });
  178. $('#NewEmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname' });
  179. $('#ClassroomNo').lrDataSourceSelect({ code: 'ClassRoomInfo', value: 'classroomno', text: 'classroomname' });
  180. $('#NewClassroomNo').lrDataSourceSelect({ code: 'ClassRoomInfo', value: 'classroomno', text: 'classroomname' });
  181. //调度开始时间
  182. $('#AttemperStartTime').lrselect({ allowSearch: true });
  183. //调度结束时间
  184. $('#AttemperEndTime').lrselect({ allowSearch: true });
  185. },
  186. initData: function () {
  187. if (!!keyValue) {
  188. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetFormData?keyValue=' + keyValue, function (data) {
  189. for (var id in data) {
  190. if (!!data[id].length && data[id].length > 0) {
  191. $('#' + id).jfGridSet('refreshdata', data[id]);
  192. }
  193. else {
  194. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  195. $('.AttemperType').hide();
  196. $("#AttemperTimeType").removeAttr("isvalid");
  197. $("#AttemperTimeType").removeAttr("checkexpession");
  198. $("#AttemperStartTime").removeAttr("isvalid");
  199. $("#AttemperStartTime").removeAttr("checkexpession");
  200. $("#AttemperEndTime").removeAttr("isvalid");
  201. $("#AttemperEndTime").removeAttr("checkexpession");
  202. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("isvalid");
  203. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("checkexpession");
  204. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr('readonly');
  205. $('#NewEmpNo').siblings('div').html('教师');
  206. $('#NewClassroomNo').siblings('div').html('教室');
  207. if (data[id].AttemperType == "01") {
  208. $('.AttemperTypeTiao').show();
  209. $("#AttemperTimeType").attr("isvalid", "yes");
  210. $("#AttemperTimeType").attr("checkexpession", "NotNull");
  211. $("#AttemperStartTime").attr("isvalid", "yes");
  212. $("#AttemperStartTime").attr("checkexpession", "NotNull");
  213. $("#AttemperEndTime").attr("isvalid", "yes");
  214. $("#AttemperEndTime").attr("checkexpession", "NotNull");
  215. } else if (data[id].AttemperType == "02") {
  216. } else if (data[id].AttemperType == "03") {
  217. $('.AttemperTypeDuiDiao').show();
  218. $(".AttemperTypeDuiDiao").find('.contentDiv').attr("isvalid", "yes");
  219. $(".AttemperTypeDuiDiao").find('.contentDiv').attr("checkexpession", "NotNull");
  220. $(".AttemperTypeDuiDiao").find('.contentDiv').attr('readonly', 'readonly');
  221. $('#NewEmpNo').siblings('div').html('教师<font face="宋体">*</font>');
  222. $('#NewClassroomNo').siblings('div').html('教室<font face="宋体">*</font>');
  223. }
  224. }
  225. var timer = setTimeout(function () {
  226. page.query();
  227. clearTimeout(timer);
  228. }, 3000)
  229. }
  230. });
  231. }
  232. }
  233. };
  234. bindData = function (temprow) {
  235. if (!!temprow) {
  236. //$('#F_SchoolId').lrselectSet(temprow.schooldId);
  237. $('#AcademicYearNo').lrselectSet(temprow.academicyear);
  238. $('#Semester').lrselectSet(temprow.semester);
  239. $('#DeptNo').lrselectSet(temprow.deptNo);
  240. $('#MajorNo').lrselectSet(temprow.majorNo);
  241. $('#LessonNo').lrselectSet(temprow.lessonNo);
  242. $('#TeachClassNo').lrselectSet(temprow.teachClassNo);
  243. $('#EmpNo').lrselectSet(temprow.empno);
  244. $('#ClassroomNo').lrselectSet(temprow.classRoomNo);
  245. page.query();
  246. }
  247. };
  248. bindDataNew = function (temprow) {
  249. if (!!temprow) {
  250. //$('#NewF_SchoolId').lrselectSet(temprow.schooldId);
  251. $('#NewAcademicYearNo').lrselectSet(temprow.academicyear);
  252. $('#NewSemester').lrselectSet(temprow.semester);
  253. $('#NewDeptNo').lrselectSet(temprow.deptNo);
  254. $('#NewMajorNo').lrselectSet(temprow.majorNo);
  255. $('#NewLessonNo').lrselectSet(temprow.lessonNo);
  256. $('#NewTeachClassNo').lrselectSet(temprow.teachClassNo);
  257. $('#NewEmpNo').lrselectSet(temprow.empno);
  258. $('#NewClassroomNo').lrselectSet(temprow.classRoomNo);
  259. }
  260. };
  261. // 设置表单数据
  262. setFormData = function (processId, param, callback) {
  263. if (!!processId) {
  264. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetFormDataByProcessId?processId=' + processId, function (data) {
  265. for (var id in data) {
  266. if (!!data[id] && data[id].length > 0) {
  267. $('#' + id).jfGridSet('refreshdata', data[id]);
  268. }
  269. else {
  270. if (id == 'ArrangeLessonTermAttemper') {
  271. keyValue = data[id].Id;
  272. }
  273. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  274. $('.AttemperType').hide();
  275. $("#AttemperTimeType").removeAttr("isvalid");
  276. $("#AttemperTimeType").removeAttr("checkexpession");
  277. $("#AttemperStartTime").removeAttr("isvalid");
  278. $("#AttemperStartTime").removeAttr("checkexpession");
  279. $("#AttemperEndTime").removeAttr("isvalid");
  280. $("#AttemperEndTime").removeAttr("checkexpession");
  281. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("isvalid");
  282. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("checkexpession");
  283. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr('readonly');
  284. $('#NewEmpNo').siblings('div').html('教师');
  285. $('#NewClassroomNo').siblings('div').html('教室');
  286. if (data[id].AttemperType == "01") {
  287. $('.AttemperTypeTiao').show();
  288. $("#AttemperTimeType").attr("isvalid", "yes");
  289. $("#AttemperTimeType").attr("checkexpession", "NotNull");
  290. $("#AttemperStartTime").attr("isvalid", "yes");
  291. $("#AttemperStartTime").attr("checkexpession", "NotNull");
  292. $("#AttemperEndTime").attr("isvalid", "yes");
  293. $("#AttemperEndTime").attr("checkexpession", "NotNull");
  294. } else if (data[id].AttemperType == "02") {
  295. } else if (data[id].AttemperType == "03") {
  296. $('.AttemperTypeDuiDiao').show();
  297. $(".AttemperTypeDuiDiao").find('.contentDiv').attr("isvalid", "yes");
  298. $(".AttemperTypeDuiDiao").find('.contentDiv').attr("checkexpession", "NotNull");
  299. $(".AttemperTypeDuiDiao").find('.contentDiv').attr('readonly', 'readonly');
  300. $('#NewEmpNo').siblings('div').html('教师<font face="宋体">*</font>');
  301. $('#NewClassroomNo').siblings('div').html('教室<font face="宋体">*</font>');
  302. }
  303. }
  304. var timer = setTimeout(function () {
  305. page.query();
  306. clearTimeout(timer);
  307. }, 3000)
  308. }
  309. });
  310. }
  311. callback && callback();
  312. }
  313. // 验证数据是否填写完整
  314. validForm = function () {
  315. if (!$('#form').lrValidform()) {
  316. return false;
  317. }
  318. return true;
  319. };
  320. // 保存数据
  321. save = function (processId, callBack, i) {
  322. var formData = $('body').lrGetFormData();
  323. if (formData.AttemperType == "03") { //对调:校区、学年、学期需要一致
  324. //if (formData.F_SchoolId !== formData.NewF_SchoolId || formData.AcademicYearNo !== formData.NewAcademicYearNo || formData.Semester !== formData.NewSemester) {
  325. if (formData.AcademicYearNo !== formData.NewAcademicYearNo || formData.Semester !== formData.NewSemester) {
  326. learun.alert.warning("校区、学年、学期不一致!");
  327. return false;
  328. }
  329. } else if (formData.AttemperType == "01") { //调课:调度时间比较;教师或教室必填一个;
  330. if ((formData.NewEmpNo == null || formData.NewEmpNo == "") && (formData.NewClassroomNo == null || formData.NewClassroomNo == "")) {
  331. learun.alert.warning("课程新安排中教师或教室不能为空!");
  332. return false;
  333. }
  334. if (formData.AttemperEndTime < formData.AttemperStartTime) {
  335. learun.alert.warning("调度结束时间不能小于调度开始时间!");
  336. return false;
  337. }
  338. }
  339. if (!!processId) {
  340. formData.ProcessId = processId;
  341. }
  342. var postData = {
  343. strEntity: JSON.stringify(formData)
  344. };
  345. $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/SaveForm?keyValue=' + keyValue, postData, function (res) {
  346. // 保存成功后才回调
  347. if (!!callBack) {
  348. callBack(res, i);
  349. }
  350. });
  351. };
  352. page.init();
  353. }