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.
 
 
 
 
 
 

583 lines
30 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 refreshGirdData;
  8. var selectedRow;
  9. var weekChina = ["一", "二", "三", "四", "五", "六", "日"];
  10. var bootstrap = function ($, learun) {
  11. "use strict";
  12. var processId = '';
  13. var page = {
  14. init: function () {
  15. page.initGird();
  16. page.bind();
  17. },
  18. bind: function () {
  19. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  20. page.search(queryJson);
  21. }, 300, 400);
  22. $('#AttemperType').lrDataItemSelect({ code: 'AttemperType' });
  23. $('#AttemperTimeType').lrDataItemSelect({ code: 'AttemperTimeType' });
  24. //$('#F_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' });
  25. $('#AcademicYearNo').lrselect({
  26. allowSearch: true,
  27. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  28. value: 'value',
  29. text: 'text'
  30. });
  31. $('#Semester').lrselect({
  32. allowSearch: true,
  33. url: top.$.rootUrl + '/EducationalAdministration/StuScore/GetSemesterData',
  34. value: 'value',
  35. text: 'text'
  36. });
  37. $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
  38. $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
  39. $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' });
  40. $('#TeachClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' });
  41. $('#EmpNo').lrDataSourceSelect({ code: 'EmpInfo', value: 'empno', text: 'empname' });
  42. // 刷新
  43. $('#lr_refresh').on('click', function () {
  44. location.reload();
  45. });
  46. // 新增
  47. $('#lr_add').on('click', function () {
  48. learun.layerForm({
  49. id: 'form',
  50. title: '新增',
  51. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/Form',
  52. width: 1000,
  53. height: 600,
  54. callBack: function (id) {
  55. var res = false;
  56. // 验证数据
  57. res = top[id].validForm();
  58. // 保存数据
  59. if (res) {
  60. //processId = learun.newGuid();
  61. //res = top[id].save(processId, refreshGirdData);
  62. res = top[id].save('', function () {
  63. page.search();
  64. });
  65. }
  66. return res;
  67. }
  68. });
  69. });
  70. // 编辑
  71. $('#lr_edit').on('click', function () {
  72. var keyValue = $('#gridtable').jfGridValue('Id');
  73. selectedRow = $('#gridtable').jfGridGet('rowdata');
  74. if (learun.checkrow(keyValue)) {
  75. if (selectedRow.Status == 1) {//提交
  76. learun.alert.warning("当前课程异动记录已提交!");
  77. return false;
  78. }
  79. learun.layerForm({
  80. id: 'form',
  81. title: '编辑',
  82. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/Form?keyValue=' + keyValue,
  83. width: 1000,
  84. height: 600,
  85. callBack: function (id) {
  86. var res = false;
  87. // 验证数据
  88. res = top[id].validForm();
  89. // 保存数据
  90. if (res) {
  91. res = top[id].save('', function () {
  92. page.search();
  93. });
  94. }
  95. return res;
  96. }
  97. });
  98. }
  99. });
  100. // 删除
  101. $('#lr_delete').on('click', function () {
  102. var keyValue = $('#gridtable').jfGridValue('Id');
  103. selectedRow = $('#gridtable').jfGridGet('rowdata');
  104. if (learun.checkrow(keyValue)) {
  105. if (selectedRow.Status !== 0) {
  106. learun.alert.warning("当前课程异动记录已提交,无法删除!");
  107. return false;
  108. }
  109. learun.layerConfirm('是否确认删除该项!', function (res) {
  110. if (res) {
  111. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/DeleteForm', { keyValue: keyValue }, function () {
  112. //refreshGirdData();
  113. page.search();
  114. });
  115. }
  116. });
  117. }
  118. });
  119. // 提交
  120. $('#lr_submit').on('click', function () {
  121. var keyValue = $('#gridtable').jfGridValue('Id');
  122. selectedRow = $('#gridtable').jfGridGet('rowdata');
  123. if (learun.checkrow(keyValue)) {
  124. if (selectedRow.Status !== 0) {
  125. learun.alert.warning("当前课程异动记录已提交!");
  126. return false;
  127. }
  128. learun.layerConfirm('是否确认提交该项!', function (res) {
  129. if (res) {
  130. processId = learun.newGuid();
  131. learun.postForm(top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/ModifyStatus', { keyValue: keyValue, status: 1, processId: processId }, function (res) {
  132. //selectedRow.ProcessId = processId;
  133. refreshGirdData(res, {});
  134. });
  135. }
  136. });
  137. }
  138. });
  139. // 查看
  140. $('#lr_view').on('click', function () {
  141. var keyValue = $('#gridtable').jfGridValue('Id');
  142. selectedRow = $('#gridtable').jfGridGet('rowdata');
  143. if (learun.checkrow(keyValue)) {
  144. if (selectedRow.Status == 0) {
  145. learun.alert.warning("当前课程异动记录未提交,请提交后再查看!");
  146. return false;
  147. }
  148. learun.layerForm({
  149. id: 'formview',
  150. title: '查看',
  151. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/FormView?keyValue=' + keyValue,
  152. width: 1000,
  153. height: 600,
  154. btn: null
  155. });
  156. }
  157. });
  158. },
  159. // 初始化列表
  160. initGird: function () {
  161. $('#gridtable').lrAuthorizeJfGrid({
  162. url: top.$.rootUrl + '/EducationalAdministration/ArrangeLessonTermAttemper/GetPageList',
  163. headData: [
  164. {
  165. label: "调度类型", name: "AttemperType", width: 100, align: "left",
  166. formatterAsync: function (callback, value, row, op, $cell) {
  167. learun.clientdata.getAsync('dataItem', {
  168. key: value,
  169. code: 'AttemperType',
  170. callback: function (_data) {
  171. callback(_data.text);
  172. }
  173. });
  174. }
  175. },
  176. { label: "调度备注", name: "AttemperRemark", width: 100, align: "left" },
  177. { label: "学年", name: "AcademicYearNo", width: 100, align: "left" },
  178. { label: "学期", name: "Semester", width: 100, align: "left" },
  179. {
  180. label: "系部", name: "DeptNo", width: 100, align: "left",
  181. formatterAsync: function (callback, value, row, op, $cell) {
  182. learun.clientdata.getAsync('custmerData', {
  183. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  184. key: value,
  185. keyId: 'deptno',
  186. callback: function (_data) {
  187. callback(_data['deptname']);
  188. }
  189. });
  190. }
  191. },
  192. {
  193. label: "专业", name: "MajorNo", width: 100, align: "left",
  194. formatterAsync: function (callback, value, row, op, $cell) {
  195. learun.clientdata.getAsync('custmerData', {
  196. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  197. key: value,
  198. keyId: 'majorno',
  199. callback: function (_data) {
  200. callback(_data['majorname']);
  201. }
  202. });
  203. }
  204. },
  205. {
  206. label: "课程", name: "LessonNo", width: 100, align: "left",
  207. formatterAsync: function (callback, value, row, op, $cell) {
  208. learun.clientdata.getAsync('custmerData', {
  209. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  210. key: value,
  211. keyId: 'lessonno',
  212. callback: function (_data) {
  213. callback(_data['lessonname']);
  214. }
  215. });
  216. }
  217. },
  218. {
  219. label: "班级", name: "TeachClassNo", width: 100, align: "left",
  220. formatterAsync: function (callback, value, row, op, $cell) {
  221. learun.clientdata.getAsync('custmerData', {
  222. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
  223. key: value,
  224. keyId: 'classno',
  225. callback: function (_data) {
  226. callback(_data['classname']);
  227. }
  228. });
  229. }
  230. },
  231. {
  232. label: "教师", name: "EmpNo", width: 100, align: "left",
  233. formatterAsync: function (callback, value, row, op, $cell) {
  234. learun.clientdata.getAsync('custmerData', {
  235. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  236. key: value,
  237. keyId: 'empno',
  238. callback: function (_data) {
  239. callback(_data['empname']);
  240. }
  241. });
  242. }
  243. },
  244. {
  245. label: "教室", name: "ClassroomNo", width: 100, align: "left",
  246. formatterAsync: function (callback, value, row, op, $cell) {
  247. learun.clientdata.getAsync('custmerData', {
  248. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  249. key: value,
  250. keyId: 'classroomno',
  251. callback: function (_data) {
  252. callback(_data['classroomname']);
  253. }
  254. });
  255. }
  256. },
  257. { label: "日期", name: "AcademicYearNo", width: 100, align: "left",
  258. formatterAsync: function (callback, value, row, op, $cell) {
  259. learun.httpAsyncGet('/EducationalAdministration/ArrangeLessonTermAttemper/GetchildData?code=' + row.Id, function (res) {
  260. if (res.code == learun.httpCode.success) {
  261. var t_data = [];
  262. for (var i = 0; i < res.data.length; i++) {
  263. if (t_data.indexOf(res.data[i].LessonDate.substring(0, 10)) < 0) {
  264. t_data.push(res.data[i].LessonDate.substring(0, 10))
  265. }
  266. }
  267. callback(t_data.join(','));
  268. }
  269. });
  270. }
  271. },
  272. {
  273. label: "星期/节次", name: "AcademicYearNo", width: 100, align: "left",
  274. formatterAsync: function (callback, value, row, op, $cell) {
  275. learun.httpAsyncGet('/EducationalAdministration/ArrangeLessonTermAttemper/GetchildData?code=' + row.Id, function (res) {
  276. if (res.code == learun.httpCode.success) {
  277. var t_data = [];
  278. var t_w=[]
  279. for (var i = 0; i < res.data.length; i++) {
  280. if (t_data.indexOf(res.data[i].LessonTime.substring(1)) < 0) {
  281. t_data.push(res.data[i].LessonTime.substring(1))
  282. }
  283. if (t_w.indexOf(res.data[i].LessonTime.substring(0, 1)) < 0) {
  284. t_w.push(res.data[i].LessonTime.substring(0, 1))
  285. }
  286. }
  287. if (row.AttemperType == '04') {
  288. callback("星期" + weekChina[t_w.join(',') - 1]+'第'+t_data.join(',')+'节');
  289. } else {
  290. callback('');
  291. }
  292. }
  293. });
  294. }
  295. },
  296. //调课属性
  297. {
  298. label: "调课日期", name: "AcademicYearNo", width: 100, align: "left",
  299. formatterAsync: function (callback, value, row, op, $cell) {
  300. learun.httpAsyncGet('/EducationalAdministration/ArrangeLessonTermAttemper/GetchildData?code=' + row.Id, function (res) {
  301. if (res.code == learun.httpCode.success) {
  302. var t_data = [];
  303. for (var i = 0; i < res.data.length; i++) {
  304. if (t_data.indexOf(res.data[i].NewLessonDate.substring(0,10)) < 0) {
  305. t_data.push(res.data[i].NewLessonDate.substring(0, 10))
  306. }
  307. }
  308. if (row.AttemperType == '04') {
  309. callback(t_data.join(','));
  310. } else {
  311. callback('');
  312. }
  313. }
  314. });
  315. }
  316. },
  317. {
  318. label: "调课星期/节次", name: "AcademicYearNo", width: 100, align: "left",
  319. formatterAsync: function (callback, value, row, op, $cell) {
  320. learun.httpAsyncGet( '/EducationalAdministration/ArrangeLessonTermAttemper/GetchildData?code=' + row.Id, function (res) {
  321. if (res.code == learun.httpCode.success) {
  322. var t_data = [];
  323. var t_w = []
  324. for (var i = 0; i < res.data.length; i++) {
  325. if (t_data.indexOf(res.data[i].NewLessonTime.substring(1)) < 0) {
  326. t_data.push(res.data[i].NewLessonTime.substring(1))
  327. }
  328. if (t_w.indexOf(res.data[i].NewLessonTime.substring(0, 1)) < 0) {
  329. t_w.push(res.data[i].NewLessonTime.substring(0, 1))
  330. }
  331. }
  332. if (row.AttemperType == '04') {
  333. callback("星期" + weekChina[t_w.join(',') - 1] + '第' + t_data.join(',') + '节');
  334. } else {
  335. callback('');
  336. }
  337. //var t_data = [];
  338. //for (var i = 0; i < res.data.length; i++) {
  339. // if (t_data.indexOf(res.data[i].NewLessonTime.substring(1)) < 0) {
  340. // t_data.push(res.data[i].NewLessonTime.substring(1))
  341. // }
  342. //}
  343. //if (row.AttemperType == '04') {
  344. // callback(t_data.join(',') + '节');
  345. //} else {
  346. // callback('');
  347. //}
  348. }
  349. });
  350. }
  351. },
  352. //换课属性
  353. {
  354. label: "换课时限", name: "AttemperTimeType", width: 100, align: "left",
  355. formatterAsync: function (callback, value, row, op, $cell) {
  356. learun.clientdata.getAsync('dataItem', {
  357. key: value,
  358. code: 'AttemperTimeType',
  359. callback: function (_data) {
  360. if (row.AttemperType == '01') {
  361. callback(_data.text);
  362. } else {
  363. callback('');
  364. }
  365. }
  366. });
  367. }
  368. },
  369. {
  370. label: "换课教师", name: "NewEmpNo", width: 100, align: "left",
  371. formatterAsync: function (callback, value, row, op, $cell) {
  372. learun.clientdata.getAsync('custmerData', {
  373. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  374. key: value,
  375. keyId: 'empno',
  376. callback: function (_data) {
  377. if (row.AttemperType == '01') {
  378. callback(_data['empname']);
  379. } else {
  380. callback('');
  381. }
  382. }
  383. });
  384. }
  385. },
  386. {
  387. label: "换课教室", name: "NewClassroomNo", width: 100, align: "left",
  388. formatterAsync: function (callback, value, row, op, $cell) {
  389. learun.clientdata.getAsync('custmerData', {
  390. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  391. key: value,
  392. keyId: 'classroomno',
  393. callback: function (_data) {
  394. if (row.AttemperType == '01') {
  395. callback(_data['classroomname']);
  396. } else {
  397. callback('');
  398. }
  399. }
  400. });
  401. }
  402. },
  403. { label: "换课开始时间", name: "AttemperStartTime", width: 100, align: "left" },
  404. { label: "换课结束时间", name: "AttemperEndTime", width: 100, align: "left" },
  405. //对调属性
  406. {
  407. label: "对调系部", name: "NewDeptNo", width: 100, align: "left",
  408. formatterAsync: function (callback, value, row, op, $cell) {
  409. learun.clientdata.getAsync('custmerData', {
  410. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  411. key: value,
  412. keyId: 'deptno',
  413. callback: function (_data) {
  414. callback(_data['deptname']);
  415. }
  416. });
  417. }
  418. },
  419. {
  420. label: "对调专业", name: "NewMajorNo", width: 100, align: "left",
  421. formatterAsync: function (callback, value, row, op, $cell) {
  422. learun.clientdata.getAsync('custmerData', {
  423. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  424. key: value,
  425. keyId: 'majorno',
  426. callback: function (_data) {
  427. callback(_data['majorname']);
  428. }
  429. });
  430. }
  431. },
  432. {
  433. label: "对调课程", name: "NewLessonNo", width: 100, align: "left",
  434. formatterAsync: function (callback, value, row, op, $cell) {
  435. learun.clientdata.getAsync('custmerData', {
  436. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  437. key: value,
  438. keyId: 'lessonno',
  439. callback: function (_data) {
  440. callback(_data['lessonname']);
  441. }
  442. });
  443. }
  444. },
  445. {
  446. label: "对调班级", name: "NewTeachClassNo", width: 100, align: "left",
  447. formatterAsync: function (callback, value, row, op, $cell) {
  448. learun.clientdata.getAsync('custmerData', {
  449. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
  450. key: value,
  451. keyId: 'classno',
  452. callback: function (_data) {
  453. callback(_data['classname']);
  454. }
  455. });
  456. }
  457. },
  458. {
  459. label: "对调教师", name: "NewEmpNo", width: 100, align: "left",
  460. formatterAsync: function (callback, value, row, op, $cell) {
  461. learun.clientdata.getAsync('custmerData', {
  462. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  463. key: value,
  464. keyId: 'empno',
  465. callback: function (_data) {
  466. callback(_data['empname']);
  467. }
  468. });
  469. }
  470. },
  471. {
  472. label: "对调教室", name: "NewClassroomNo", width: 100, align: "left",
  473. formatterAsync: function (callback, value, row, op, $cell) {
  474. learun.clientdata.getAsync('custmerData', {
  475. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  476. key: value,
  477. keyId: 'classroomno',
  478. callback: function (_data) {
  479. callback(_data['classroomname']);
  480. }
  481. });
  482. }
  483. },
  484. //审核相关属性
  485. {
  486. label: "创建用户", name: "CreateUserId", width: 100, align: "left",
  487. formatter: function (cellvalue, row) {
  488. return row.CreateUserName;
  489. }
  490. },
  491. { label: "提交时间", name: "SubmitTime", width: 130, align: "left" },
  492. {
  493. label: "状态", name: "Status", width: 100, align: "left",
  494. formatter: function (cellvalue, row) {
  495. if (cellvalue == 1) {
  496. return '<span class=\"label label-success\" >已提交</span>';
  497. } else {
  498. return '<span class=\"label label-default\" >未提交</span>';
  499. }
  500. }
  501. },
  502. {
  503. label: "审核用户", name: "CheckUserId", width: 100, align: "left",
  504. formatter: function (cellvalue, row) {
  505. return row.CheckUserName;
  506. }
  507. },
  508. { label: "审核时间", name: "CheckTime", width: 130, align: "left" },
  509. {
  510. label: "审核状态", name: "CheckStatus", width: 100, align: "left",
  511. formatter: function (cellvalue, row) {
  512. if (cellvalue == 1) {
  513. return '<span class=\"label label-warning\" >审核中</span>';
  514. } else if (cellvalue == 2) {
  515. return '<span class=\"label label-success\" >审核通过</span>';
  516. } else {
  517. return '<span class=\"label label-default\" >草稿</span>';
  518. }
  519. }
  520. },
  521. //{
  522. // label: "校区", name: "F_SchoolId", width: 100, align: "left",
  523. // formatterAsync: function (callback, value, row, op, $cell) {
  524. // learun.clientdata.getAsync('custmerData', {
  525. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company',
  526. // key: value,
  527. // keyId: 'f_companyid',
  528. // callback: function (_data) {
  529. // callback(_data['f_fullname']);
  530. // }
  531. // });
  532. // }
  533. //},
  534. ],
  535. mainId: 'Id',
  536. isPage: true,
  537. sord: 'desc',
  538. sidx: 'CreateTime'
  539. });
  540. page.search();
  541. },
  542. search: function (param) {
  543. param = param || {};
  544. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  545. }
  546. };
  547. refreshGirdData = function (res, postData) {
  548. //if (res.code == 200) {
  549. // // 发起流程
  550. // learun.workflowapi.create({
  551. // isNew: true,
  552. // schemeCode: 'ArrangeLessonTermAttemper',// 填写流程对应模板编号
  553. // processId: processId,
  554. // processName: '课程异动申请',// 对应流程名称
  555. // processLevel: '1',
  556. // description: '',
  557. // formData: JSON.stringify(postData),
  558. // callback: function (res, data) {
  559. // }
  560. // });
  561. // page.search();
  562. //}
  563. if (res && res.code && res.code == 200) {
  564. // 发起流程
  565. var postData = {
  566. schemeCode: 'ArrangeLessonTermAttemper',// 填写流程对应模板编号
  567. processId: processId,
  568. level: '1',
  569. };
  570. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  571. learun.loading(false);
  572. });
  573. }
  574. page.search();
  575. };
  576. page.init();
  577. }