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.
 
 
 
 
 
 

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