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.

FormView.js 35 KiB

4 years ago
8 months ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
8 months ago
4 years ago
8 months ago
4 years ago
4 years ago
4 years ago
8 months ago
4 years ago
4 years ago
4 years ago
8 months ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  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. page.initGird();
  33. },
  34. query: function () {
  35. var p = {};
  36. //p.F_SchoolId = $('#F_SchoolId').lrselectGet();
  37. p.AcademicYearNo = $('#AcademicYearNo').lrselectGet();
  38. p.Semester = $('#Semester').lrselectGet();
  39. p.DeptNo = $('#DeptNo').lrselectGet();
  40. p.MajorNo = $('#MajorNo').lrselectGet();
  41. p.LessonNo = $('#LessonNo').lrselectGet();
  42. p.TeachClassNo = $('#TeachClassNo').lrselectGet();
  43. p.EmpNo = $('#EmpNo').lrselectGet();
  44. p.ClassroomNo = $('#ClassroomNo').lrselectGet();
  45. //console.log(p);
  46. //if (!!p.F_SchoolId && !!p.AcademicYearNo && !!p.Semester && !!p.DeptNo && !!p.MajorNo && !!p.LessonNo && !!p.TeachClassNo && !!p.EmpNo && !!p.ClassroomNo) {
  47. if (!!p.AcademicYearNo && !!p.Semester && !!p.DeptNo && !!p.MajorNo && !!p.LessonNo && !!p.TeachClassNo && !!p.EmpNo && !!p.ClassroomNo) {
  48. //调度开始时间
  49. $('#AttemperStartTime').lrselectRefresh({
  50. allowSearch: true,
  51. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/GetLessonDateList?queryJson=' + JSON.stringify(p),
  52. value: 'value',
  53. text: 'text'
  54. });
  55. //调度结束时间
  56. $('#AttemperEndTime').lrselectRefresh({
  57. allowSearch: true,
  58. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTerm/GetLessonDateList?queryJson=' + JSON.stringify(p),
  59. value: 'value',
  60. text: 'text'
  61. });
  62. }
  63. },
  64. bind: function () {
  65. $('#CreateTime')[0].lrvalue = learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss');
  66. $('#CreateTime').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss'));
  67. $('#CreateUserId')[0].lrvalue = learun.clientdata.get(['userinfo']).userId;
  68. $('#CreateUserId').val(learun.clientdata.get(['userinfo']).realName);
  69. $('#CreateUserName')[0].lrvalue = learun.clientdata.get(['userinfo']).realName;
  70. //选择课程安排
  71. //$("#btn1").on('click', function () {
  72. // learun.layerForm({
  73. // id: 'IndexInEducationSelect',
  74. // title: '课程表',
  75. // url: top.$.rootUrl + '/PersonnelManagement/TimeTable/IndexInEducationSelect',
  76. // width: 1200,
  77. // height: 800,
  78. // callBack: function (id) {
  79. // return top[id].acceptClick(bindData);
  80. // }
  81. // });
  82. //});
  83. //$("#btn2").on('click', function () {
  84. // learun.layerForm({
  85. // id: 'IndexInEducationSelect',
  86. // title: '课程表',
  87. // url: top.$.rootUrl + '/PersonnelManagement/TimeTable/IndexInEducationSelect',
  88. // width: 1200,
  89. // height: 800,
  90. // callBack: function (id) {
  91. // return top[id].acceptClick(bindDataNew);
  92. // }
  93. // });
  94. //});
  95. },
  96. bindSelect: function () {
  97. $('#AttemperType').lrDataItemSelect({
  98. code: 'AttemperType', select: function (item) {
  99. $('.AttemperType').hide();
  100. $("#AttemperTimeType").removeAttr("isvalid");
  101. $("#AttemperTimeType").removeAttr("checkexpession");
  102. $("#AttemperStartTime").removeAttr("isvalid");
  103. $("#AttemperStartTime").removeAttr("checkexpession");
  104. $("#AttemperEndTime").removeAttr("isvalid");
  105. $("#AttemperEndTime").removeAttr("checkexpession");
  106. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("isvalid");
  107. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("checkexpession");
  108. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr('readonly');
  109. $('#NewEmpNo').siblings('div').html('教师');
  110. $('#NewClassroomNo').siblings('div').html('教室');
  111. if (item != null && item != undefined) {
  112. if (item.id === "01") { //换课
  113. $('.AttemperTypeTiao').show();
  114. $("#AttemperTimeType").attr("isvalid", "yes");
  115. $("#AttemperTimeType").attr("checkexpession", "NotNull");
  116. $("#AttemperStartTime").attr("isvalid", "yes");
  117. $("#AttemperStartTime").attr("checkexpession", "NotNull");
  118. $("#AttemperEndTime").attr("isvalid", "yes");
  119. $("#AttemperEndTime").attr("checkexpession", "NotNull");
  120. } else if (item.id === "02") { //停课
  121. } else if (item.id === "03") { //对调
  122. $('.AttemperTypeDuiDiao').show();
  123. $(".AttemperTypeDuiDiao").find('.contentDiv').attr("isvalid", "yes");
  124. $(".AttemperTypeDuiDiao").find('.contentDiv').attr("checkexpession", "NotNull");
  125. $(".AttemperTypeDuiDiao").find('.contentDiv').attr('readonly', 'readonly');
  126. $('#NewEmpNo').siblings('div').html('教师<font face="宋体">*</font>');
  127. $('#NewClassroomNo').siblings('div').html('教室<font face="宋体">*</font>');
  128. }
  129. else if (item.id === "04") { //调课
  130. $("#sourcedata").hide();
  131. $("#oldgridtable").show();
  132. $("#targetdata").hide();
  133. $("#targetgridtable").show();
  134. $(".olddata").removeAttr("isvalid");
  135. $(".olddata").removeAttr("checkexpession");
  136. $(".olddata").removeAttr('readonly');
  137. }
  138. }
  139. }
  140. });
  141. $('#AttemperTimeType').lrDataItemSelect({ code: 'AttemperTimeType' });
  142. //$('#F_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' });
  143. //$('#NewF_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' });
  144. //学年
  145. $('#AcademicYearNo').lrselect({
  146. allowSearch: true,
  147. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  148. value: 'value',
  149. text: 'text'
  150. });
  151. $('#NewAcademicYearNo').lrselect({
  152. allowSearch: true,
  153. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  154. value: 'value',
  155. text: 'text'
  156. });
  157. //学期
  158. $('#Semester').lrselect({
  159. allowSearch: true,
  160. url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetSemesterData',
  161. value: 'value',
  162. text: 'text'
  163. });
  164. $('#NewSemester').lrselect({
  165. allowSearch: true,
  166. url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetSemesterData',
  167. value: 'value',
  168. text: 'text'
  169. });
  170. $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
  171. $('#NewDeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
  172. $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
  173. $('#NewMajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
  174. $('#LessonNo').lrselect({
  175. allowSearch: true,
  176. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetLessonDataInTerm',
  177. value: 'value',
  178. text: 'text',
  179. });
  180. $('#NewLessonNo').lrselect({
  181. allowSearch: true,
  182. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetLessonDataInTerm',
  183. value: 'value',
  184. text: 'text',
  185. });
  186. $('#TeachClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' });
  187. $('#NewTeachClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' }); $('#EmpNo').lrselect({
  188. allowSearch: true,
  189. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData',
  190. value: 'value',
  191. text: 'text'
  192. });
  193. //$('#EmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname' });
  194. //$('#NewEmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname' });
  195. $('#NewEmpNo').lrselect({
  196. allowSearch: true,
  197. url: top.$.rootUrl + '/PersonnelManagement/TimeTable/GetTeacherData',
  198. value: 'value',
  199. text: 'text'
  200. });
  201. //$('#ClassroomNo').lrDataSourceSelect({ code: 'ClassRoomInfo', value: 'classroomno', text: 'classroomname' });
  202. $('#ClassroomNo').lrselect({
  203. allowSearch: true,
  204. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  205. value: 'classroomno',
  206. text: 'classroomname'
  207. });
  208. //$('#NewClassroomNo').lrDataSourceSelect({ code: 'ClassRoomInfo', value: 'classroomno', text: 'classroomname' });
  209. $('#NewClassroomNo').lrselect({
  210. allowSearch: true,
  211. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  212. value: 'classroomno',
  213. text: 'classroomname'
  214. });
  215. },
  216. initData: function () {
  217. if (!!keyValue) {
  218. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetFormData?keyValue=' + keyValue, function (data) {
  219. for (var id in data) {
  220. if (!!data[id].length && data[id].length > 0) {
  221. $('#' + id).jfGridSet('refreshdata', data[id]);
  222. }
  223. else {
  224. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  225. $('.AttemperType').hide();
  226. $("#AttemperTimeType").removeAttr("isvalid");
  227. $("#AttemperTimeType").removeAttr("checkexpession");
  228. $("#AttemperStartTime").removeAttr("isvalid");
  229. $("#AttemperStartTime").removeAttr("checkexpession");
  230. $("#AttemperEndTime").removeAttr("isvalid");
  231. $("#AttemperEndTime").removeAttr("checkexpession");
  232. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("isvalid");
  233. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("checkexpession");
  234. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr('readonly');
  235. $('#NewEmpNo').siblings('div').html('教师');
  236. $('#NewClassroomNo').siblings('div').html('教室');
  237. $('#NewEmpNo').attr('readonly', 'readonly');
  238. $('#NewClassroomNo').attr('readonly', 'readonly');
  239. //
  240. var tabledata = [{
  241. Id: data[id].Id,
  242. Academicyear: data[id].AcademicYearNo,
  243. Semester: data[id].Semester,
  244. DeptNo: data[id].DeptNo,
  245. MajorNo: data[id].MajorNo,
  246. LessonNo: data[id].LessonNo,
  247. TeachClassNo: data[id].TeachClassNo,
  248. Empno: data[id].EmpNo,
  249. ClassRoomNo: data[id].ClassroomNo
  250. }]
  251. $('#gridtable2').jfGridSet('refreshdata', tabledata);//.attr("data-val", temprow)
  252. if (data[id].AttemperType == "01") {
  253. $('.AttemperTypeTiao').show();
  254. $("#AttemperTimeType").attr("isvalid", "yes");
  255. $("#AttemperTimeType").attr("checkexpession", "NotNull");
  256. $("#AttemperStartTime").attr("isvalid", "yes");
  257. $("#AttemperStartTime").attr("checkexpession", "NotNull");
  258. $("#AttemperEndTime").attr("isvalid", "yes");
  259. $("#AttemperEndTime").attr("checkexpession", "NotNull");
  260. } else if (data[id].AttemperType == "02") {
  261. } else if (data[id].AttemperType == "03") {
  262. $('.AttemperTypeDuiDiao').show();
  263. $(".AttemperTypeDuiDiao").find('.contentDiv').attr("isvalid", "yes");
  264. $(".AttemperTypeDuiDiao").find('.contentDiv').attr("checkexpession", "NotNull");
  265. $(".AttemperTypeDuiDiao").find('.contentDiv').attr('readonly', 'readonly');
  266. $('#NewEmpNo').siblings('div').html('教师<font face="宋体">*</font>');
  267. $('#NewClassroomNo').siblings('div').html('教室<font face="宋体">*</font>');
  268. } else if (data[id].AttemperType == "04") {
  269. $("#sourcedata").hide();
  270. $("#oldgridtable").show();
  271. $("#targetdata").hide();
  272. $("#targetgridtable").show();
  273. $(".olddata").removeAttr("isvalid");
  274. $(".olddata").removeAttr("checkexpession");
  275. $(".olddata").removeAttr('readonly');
  276. $("#gridtable").attr("data-val", JSON.stringify(data[id].query));
  277. var html1 = "";
  278. var html2 = "";
  279. var oldtime = "";
  280. var oldjieci = [];
  281. var course = '';
  282. var teacher = '';
  283. var class_ = [];
  284. var classroom = '';
  285. var newtime = '';
  286. var newjieci = [];
  287. for (var i = 0; i < data[id].query.length; i++) {
  288. var item = data[id].query[i];
  289. var jieci1 = item.LessonTime.substring(1, item.LessonTime.length) + '节';
  290. var jieci2 = item.NewLessonTime.substring(1, item.NewLessonTime.length) + '节';
  291. if (i == 0) {
  292. oldtime = item.LessonDate.substring(0, 10);
  293. course = item.LessonName;
  294. teacher = item.EmpName;
  295. classroom = item.ClassroomName;
  296. newtime = item.NewLessonDate.substring(0, 10)
  297. }
  298. if (oldjieci.indexOf(jieci1) < 0) {
  299. oldjieci.push(jieci1)
  300. }
  301. if (class_.indexOf(item.Classname) < 0) {
  302. class_.push(item.Classname)
  303. }
  304. if (newjieci.indexOf(jieci2) < 0) {
  305. newjieci.push(jieci2)
  306. }
  307. }
  308. html1 += '日期:' + oldtime + ' <br>节次:' + oldjieci.join(';') + ' <br>课程:' + course + ' <br>教师:' + teacher + '; <br>班级:' + class_.join(';') + '<br>教室:' + classroom;
  309. html2 += '调整到:' + newtime + '的' + newjieci.join(';');
  310. //console.log(html1)
  311. $("#gridtable").html(html1);
  312. //{"targettime":"2023-6-24","targetjieci":"1节;2节;"}
  313. var target_json = { "targettime": newtime, "targetjieci": newjieci.join(';') }
  314. $('#gridtable1').attr("data-val", JSON.stringify(target_json));
  315. $("#gridtable1").html(html2)
  316. }
  317. }
  318. }
  319. });
  320. }
  321. },
  322. initGird: function () {
  323. //{"AltId":"c7c2e0dc-12c5-4742-ba27-f8084fa712eb","day":"2","lessonTime":"21","lessonDate":"2024-06-11","schooldId":"207fa1a9-160c-4943-a89b-8fa4db0547ce","academicyear":"23-24","semester":"2","deptNo":"06","deptname":"","majorNo":"GZ02","lessonNo":"GZ0202999","curriculum":"音乐表演(民族乐器演奏方向)专业主课","teachClassNo":"G2306010301","className":"2301班(器乐系)","empno":"1132","teacher":"吴权喜","classRoomNo":"1012","classRoom":"音乐楼012","lessonSortNo":"1"}
  324. $('#gridtable2').jfGrid({
  325. headData: [
  326. { label: "学年", name: "Academicyear", width: 100, align: "left" },
  327. { label: "学期", name: "Semester", width: 100, align: "left" },
  328. {
  329. label: "系部", name: "DeptNo", width: 100, align: "left",
  330. formatterAsync: function (callback, value, row, op, $cell) {
  331. learun.clientdata.getAsync('custmerData', {
  332. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  333. key: value,
  334. keyId: 'deptno',
  335. callback: function (_data) {
  336. callback(_data['deptname']);
  337. }
  338. });
  339. }
  340. },
  341. {
  342. label: "专业", name: "MajorNo", width: 100, align: "left",
  343. formatterAsync: function (callback, value, row, op, $cell) {
  344. learun.clientdata.getAsync('custmerData', {
  345. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  346. key: value,
  347. keyId: 'majorno',
  348. callback: function (_data) {
  349. callback(_data['majorname']);
  350. }
  351. });
  352. }
  353. },
  354. {
  355. label: "课程", name: "LessonNo", width: 100, align: "left",
  356. formatterAsync: function (callback, value, row, op, $cell) {
  357. learun.clientdata.getAsync('custmerData', {
  358. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  359. key: value,
  360. keyId: 'lessonno',
  361. callback: function (_data) {
  362. callback(_data['lessonname']);
  363. }
  364. });
  365. }
  366. },
  367. {
  368. label: "班级", name: "TeachClassNo", width: 100, align: "left",
  369. formatterAsync: function (callback, value, row, op, $cell) {
  370. learun.clientdata.getAsync('custmerData', {
  371. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
  372. key: value,
  373. keyId: 'classno',
  374. callback: function (_data) {
  375. callback(_data['classname']);
  376. }
  377. });
  378. }
  379. },
  380. {
  381. label: "教师", name: "Empno", width: 100, align: "left",
  382. formatterAsync: function (callback, value, row, op, $cell) {
  383. learun.clientdata.getAsync('custmerData', {
  384. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  385. key: value,
  386. keyId: 'empno',
  387. callback: function (_data) {
  388. callback(_data['empname']);
  389. }
  390. });
  391. }
  392. },
  393. {
  394. label: "教室", name: "ClassRoomNo", width: 100, align: "left",
  395. formatterAsync: function (callback, value, row, op, $cell) {
  396. learun.clientdata.getAsync('custmerData', {
  397. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  398. key: value,
  399. keyId: 'classroomno',
  400. callback: function (_data) {
  401. callback(_data['classroomname']);
  402. }
  403. });
  404. }
  405. },
  406. ],
  407. mainId: 'Id',
  408. isPage: false,
  409. //sord: 'desc',
  410. //sidx: 'CreateTime'
  411. });
  412. //$('#gridtable').jfGrid({
  413. // headData: [
  414. // { label: "日期", name: "time", width: 100, align: "left" },
  415. // { label: "节次", name: "jieci", width: 100, align: "left" },
  416. // { label: "课程", name: "curriculum", width: 100, align: "left" },
  417. // { label: "班级", name: "ClassName", width: 100, align: "left" },
  418. // { label: "教师", name: "EmpName", width: 100, align: "left" },
  419. // { label: "教室", name: "classRoom", width: 100, align: "left" },
  420. // ],
  421. // mainId: 'Id',
  422. // isPage: true,
  423. // sord: 'desc',
  424. // sidx: 'CreateTime'
  425. //});
  426. //$('#gridtable1').jfGrid({
  427. // headData: [
  428. // { label: "日期", name: "time", width: 100, align: "left" },
  429. // { label: "节次", name: "jieci", width: 100, align: "left" },
  430. // { label: "课程", name: "curriculum", width: 100, align: "left" },
  431. // { label: "班级", name: "ClassName", width: 100, align: "left" },
  432. // { label: "教师", name: "EmpName", width: 100, align: "left" },
  433. // { label: "教室", name: "classRoom", width: 100, align: "left" },
  434. // ],
  435. // mainId: 'Id',
  436. // isPage: true,
  437. // sord: 'desc',
  438. // sidx: 'CreateTime'
  439. //});
  440. },
  441. };
  442. bindData = function (temprow) {
  443. if (!!temprow) {
  444. if ($("#AttemperType").lrselectGet() == "04") {
  445. //console.log(temprow)
  446. var dataparams = temprow.predata;
  447. //$('#gridtable').jfGridSet('refreshdata', temprow.predata);
  448. var datahtml = temprow.predatastr;//tardata.targettime + '的' + tardata.targetjieci;
  449. $('#gridtable').html(datahtml);
  450. $('#gridtable').attr("data-val", JSON.stringify(dataparams))
  451. var tardata = (temprow.tardata);
  452. var html = '调整到:' + tardata.targettime + '的' + tardata.targetjieci;
  453. $('#gridtable1').html(html);
  454. $('#gridtable1').attr("data-val", JSON.stringify(tardata))
  455. //$('#gridtable1').jfGridSet('refreshdata', temprow.predata);
  456. //$('#gridtable').
  457. } else {
  458. //$('#F_SchoolId').lrselectSet(temprow.schooldId);
  459. $('#AcademicYearNo').lrselectSet(temprow.academicyear);
  460. $('#Semester').lrselectSet(temprow.semester);
  461. $('#DeptNo').lrselectSet(temprow.deptNo);
  462. $('#MajorNo').lrselectSet(temprow.majorNo);
  463. $('#LessonNo').lrselectSet(temprow.lessonNo);
  464. $('#TeachClassNo').lrselectSet(temprow.teachClassNo);
  465. $('#EmpNo').lrselectSet(temprow.empno);
  466. $('#ClassroomNo').lrselectSet(temprow.classRoomNo);
  467. }
  468. page.query();
  469. }
  470. };
  471. bindDataNew = function (temprow) {
  472. if (!!temprow) {
  473. //$('#NewF_SchoolId').lrselectSet(temprow.schooldId);
  474. $('#NewAcademicYearNo').lrselectSet(temprow.academicyear);
  475. $('#NewSemester').lrselectSet(temprow.semester);
  476. $('#NewDeptNo').lrselectSet(temprow.deptNo);
  477. $('#NewMajorNo').lrselectSet(temprow.majorNo);
  478. $('#NewLessonNo').lrselectSet(temprow.lessonNo);
  479. $('#NewTeachClassNo').lrselectSet(temprow.teachClassNo);
  480. $('#NewEmpNo').lrselectSet(temprow.empno);
  481. $('#NewClassroomNo').lrselectSet(temprow.classRoomNo);
  482. }
  483. };
  484. // 设置表单数据
  485. setFormData = function (processId, param, callback) {
  486. if (!!processId) {
  487. $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetFormDataByProcessId?processId=' + processId, function (data) {
  488. for (var id in data) {
  489. if (!!data[id] && data[id].length > 0) {
  490. $('#' + id).jfGridSet('refreshdata', data[id]);
  491. }
  492. else {
  493. if (id == 'ArrangeLessonTermAttemper') {
  494. keyValue = data[id].Id;
  495. }
  496. $('[data-table="' + id + '"]').lrSetFormData(data[id]);
  497. $('.AttemperType').hide();
  498. $("#AttemperTimeType").removeAttr("isvalid");
  499. $("#AttemperTimeType").removeAttr("checkexpession");
  500. $("#AttemperStartTime").removeAttr("isvalid");
  501. $("#AttemperStartTime").removeAttr("checkexpession");
  502. $("#AttemperEndTime").removeAttr("isvalid");
  503. $("#AttemperEndTime").removeAttr("checkexpession");
  504. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("isvalid");
  505. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr("checkexpession");
  506. $(".AttemperTypeDuiDiao").find('.contentDiv').removeAttr('readonly');
  507. $('#NewEmpNo').siblings('div').html('教师');
  508. $('#NewClassroomNo').siblings('div').html('教室');
  509. $('#NewEmpNo').attr('readonly', 'readonly');
  510. $('#NewClassroomNo').attr('readonly', 'readonly');
  511. var tabledata = [{
  512. Id: data[id].Id,
  513. Academicyear: data[id].AcademicYearNo,
  514. Semester: data[id].Semester,
  515. DeptNo: data[id].DeptNo,
  516. MajorNo: data[id].MajorNo,
  517. LessonNo: data[id].LessonNo,
  518. TeachClassNo: data[id].TeachClassNo,
  519. Empno: data[id].EmpNo,
  520. ClassRoomNo: data[id].ClassroomNo
  521. }]
  522. $('#gridtable2').jfGridSet('refreshdata', tabledata);//.attr("data-val", temprow)
  523. if (data[id].AttemperType == "01") {
  524. $('.AttemperTypeTiao').show();
  525. $("#AttemperTimeType").attr("isvalid", "yes");
  526. $("#AttemperTimeType").attr("checkexpession", "NotNull");
  527. $("#AttemperStartTime").attr("isvalid", "yes");
  528. $("#AttemperStartTime").attr("checkexpession", "NotNull");
  529. $("#AttemperEndTime").attr("isvalid", "yes");
  530. $("#AttemperEndTime").attr("checkexpession", "NotNull");
  531. } else if (data[id].AttemperType == "02") {
  532. } else if (data[id].AttemperType == "03") {
  533. $('.AttemperTypeDuiDiao').show();
  534. $(".AttemperTypeDuiDiao").find('.contentDiv').attr("isvalid", "yes");
  535. $(".AttemperTypeDuiDiao").find('.contentDiv').attr("checkexpession", "NotNull");
  536. $(".AttemperTypeDuiDiao").find('.contentDiv').attr('readonly', 'readonly');
  537. $('#NewEmpNo').siblings('div').html('教师<font face="宋体">*</font>');
  538. $('#NewClassroomNo').siblings('div').html('教室<font face="宋体">*</font>');
  539. } else if (data[id].AttemperType == "04") {
  540. $("#sourcedata").hide();
  541. $("#oldgridtable").show();
  542. $("#targetdata").hide();
  543. $("#targetgridtable").show();
  544. $(".olddata").removeAttr("isvalid");
  545. $(".olddata").removeAttr("checkexpession");
  546. $(".olddata").removeAttr('readonly');
  547. $("#gridtable").attr("data-val", JSON.stringify(data[id].query));
  548. var html1 = "";
  549. var html2 = "";
  550. var oldtime = "";
  551. var oldjieci = [];
  552. var course = '';
  553. var teacher = '';
  554. var class_ = [];
  555. var classroom = '';
  556. var newtime = '';
  557. var newjieci = [];
  558. for (var i = 0; i < data[id].query.length; i++) {
  559. var item = data[id].query[i];
  560. var jieci1 = item.LessonTime.substring(1, item.LessonTime.length) + '节';
  561. var jieci2 = item.NewLessonTime.substring(1, item.NewLessonTime.length) + '节';
  562. if (i == 0) {
  563. oldtime = item.LessonDate.substring(0, 10);
  564. course = item.LessonName;
  565. teacher = item.EmpName;
  566. classroom = item.ClassroomName;
  567. newtime = item.NewLessonDate.substring(0, 10)
  568. }
  569. if (oldjieci.indexOf(jieci1) < 0) {
  570. oldjieci.push(jieci1)
  571. }
  572. if (class_.indexOf(item.Classname) < 0) {
  573. class_.push(item.Classname)
  574. }
  575. if (newjieci.indexOf(jieci2) < 0) {
  576. newjieci.push(jieci2)
  577. }
  578. }
  579. html1 += '日期:' + oldtime + ' <br>节次:' + oldjieci.join(';') + ' <br>课程:' + course + ' <br>教师:' + teacher + '; <br>班级:' + class_.join(';') + '<br>教室:' + classroom;
  580. html2 += '调整到:' + newtime + '的' + newjieci.join(';');
  581. //console.log(html1)
  582. $("#gridtable").html(html1);
  583. //{"targettime":"2023-6-24","targetjieci":"1节;2节;"}
  584. var target_json = { "targettime": newtime, "targetjieci": newjieci.join(';') }
  585. $('#gridtable1').attr("data-val", JSON.stringify(target_json));
  586. $("#gridtable1").html(html2)
  587. }
  588. }
  589. }
  590. });
  591. }
  592. callback && callback();
  593. }
  594. // 验证数据是否填写完整
  595. validForm = function () {
  596. if (!$('#form').lrValidform()) {
  597. return false;
  598. }
  599. return true;
  600. };
  601. // 保存数据
  602. save = function (processId, callBack, i) {
  603. //if (data[id].AttemperType != "04") {
  604. // var formData = $('body').lrGetFormData();
  605. // if (formData.AttemperType == "03") { //对调:校区、学年、学期需要一致
  606. // //if (formData.F_SchoolId !== formData.NewF_SchoolId || formData.AcademicYearNo !== formData.NewAcademicYearNo || formData.Semester !== formData.NewSemester) {
  607. // if (formData.AcademicYearNo !== formData.NewAcademicYearNo || formData.Semester !== formData.NewSemester) {
  608. // learun.alert.warning("校区、学年、学期不一致!");
  609. // return false;
  610. // }
  611. // } else if (formData.AttemperType == "01") { //调课:调度时间比较
  612. // if (formData.AttemperEndTime < formData.AttemperStartTime) {
  613. // learun.alert.warning("调度结束时间不能小于调度开始时间!");
  614. // return false;
  615. // }
  616. // }
  617. // if (!!processId) {
  618. // formData.ProcessId = processId;
  619. // }
  620. // var postData = {
  621. // strEntity: JSON.stringify(formData)
  622. // };
  623. // $.lrSaveForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/SaveForm?keyValue=' + keyValue, postData, function (res) {
  624. // // 保存成功后才回调
  625. // if (!!callBack) {
  626. // callBack(res, i);
  627. // }
  628. // });
  629. //}
  630. callBack({code:200}, i);
  631. };
  632. page.init();
  633. }