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.
 
 
 
 
 
 

576 lines
29 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. {
  258. label: "日期", name: "AcademicYearNo", width: 100, align: "left",
  259. formatterAsync: function (callback, value, row, op, $cell) {
  260. learun.httpAsyncGet('/EducationalAdministration/ArrangeLessonTermAttemper/GetchildData?code=' + row.Id, function (res) {
  261. if (res.code == learun.httpCode.success) {
  262. var t_data = [];
  263. for (var i = 0; i < res.data.length; i++) {
  264. if (t_data.indexOf(res.data[i].LessonDate.substring(0, 10)) < 0) {
  265. t_data.push(res.data[i].LessonDate.substring(0, 10))
  266. }
  267. }
  268. callback(t_data.join(','));
  269. }
  270. });
  271. }
  272. },
  273. {
  274. label: "星期/节次", name: "AcademicYearNo", width: 100, align: "left",
  275. formatterAsync: function (callback, value, row, op, $cell) {
  276. learun.httpAsyncGet('/EducationalAdministration/ArrangeLessonTermAttemper/GetchildData?code=' + row.Id, function (res) {
  277. if (res.code == learun.httpCode.success) {
  278. var t_data = [];
  279. var t_w = []
  280. for (var i = 0; i < res.data.length; i++) {
  281. if (t_data.indexOf(res.data[i].LessonTime.substring(1)) < 0) {
  282. t_data.push(res.data[i].LessonTime.substring(1))
  283. }
  284. if (t_w.indexOf(res.data[i].LessonTime.substring(0, 1)) < 0) {
  285. t_w.push(res.data[i].LessonTime.substring(0, 1))
  286. }
  287. }
  288. if (row.AttemperType == '04') {
  289. callback("星期" + weekChina[t_w.join(',') - 1] + '第' + t_data.sort((a, b) => { return a - b; }).join(',') + '节');
  290. } else {
  291. callback('');
  292. }
  293. }
  294. });
  295. }
  296. },
  297. //调课属性
  298. {
  299. label: "调课日期", name: "AcademicYearNo", width: 100, align: "left",
  300. formatterAsync: function (callback, value, row, op, $cell) {
  301. learun.httpAsyncGet('/EducationalAdministration/ArrangeLessonTermAttemper/GetchildData?code=' + row.Id, function (res) {
  302. if (res.code == learun.httpCode.success) {
  303. var t_data = [];
  304. for (var i = 0; i < res.data.length; i++) {
  305. if (t_data.indexOf(res.data[i].NewLessonDate.substring(0, 10)) < 0) {
  306. t_data.push(res.data[i].NewLessonDate.substring(0, 10))
  307. }
  308. }
  309. if (row.AttemperType == '04') {
  310. callback(t_data.join(','));
  311. } else {
  312. callback('');
  313. }
  314. }
  315. });
  316. }
  317. },
  318. {
  319. label: "调课星期/节次", name: "AcademicYearNo", width: 100, align: "left",
  320. formatterAsync: function (callback, value, row, op, $cell) {
  321. learun.httpAsyncGet('/EducationalAdministration/ArrangeLessonTermAttemper/GetchildData?code=' + row.Id, function (res) {
  322. if (res.code == learun.httpCode.success) {
  323. var t_data = [];
  324. var t_w = []
  325. for (var i = 0; i < res.data.length; i++) {
  326. if (t_data.indexOf(res.data[i].NewLessonTime.substring(1)) < 0) {
  327. t_data.push(res.data[i].NewLessonTime.substring(1))
  328. }
  329. if (t_w.indexOf(res.data[i].NewLessonTime.substring(0, 1)) < 0) {
  330. t_w.push(res.data[i].NewLessonTime.substring(0, 1))
  331. }
  332. }
  333. if (row.AttemperType == '04') {
  334. callback("星期" + weekChina[t_w.join(',') - 1] + '第' + t_data.sort((a, b) => { return a - b; }).join(',') + '节');
  335. } else {
  336. callback('');
  337. }
  338. }
  339. });
  340. }
  341. },
  342. //换课属性
  343. {
  344. label: "换课时限", name: "AttemperTimeType", width: 100, align: "left",
  345. formatterAsync: function (callback, value, row, op, $cell) {
  346. learun.clientdata.getAsync('dataItem', {
  347. key: value,
  348. code: 'AttemperTimeType',
  349. callback: function (_data) {
  350. if (row.AttemperType == '01') {
  351. callback(_data.text);
  352. } else {
  353. callback('');
  354. }
  355. }
  356. });
  357. }
  358. },
  359. {
  360. label: "换课教师", name: "NewEmpNo", width: 100, align: "left",
  361. formatterAsync: function (callback, value, row, op, $cell) {
  362. learun.clientdata.getAsync('custmerData', {
  363. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  364. key: value,
  365. keyId: 'empno',
  366. callback: function (_data) {
  367. if (row.AttemperType == '01') {
  368. callback(_data['empname']);
  369. } else {
  370. callback('');
  371. }
  372. }
  373. });
  374. }
  375. },
  376. {
  377. label: "换课教室", name: "NewClassroomNo", width: 100, align: "left",
  378. formatterAsync: function (callback, value, row, op, $cell) {
  379. learun.clientdata.getAsync('custmerData', {
  380. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  381. key: value,
  382. keyId: 'classroomno',
  383. callback: function (_data) {
  384. if (row.AttemperType == '01') {
  385. callback(_data['classroomname']);
  386. } else {
  387. callback('');
  388. }
  389. }
  390. });
  391. }
  392. },
  393. { label: "换课开始时间", name: "AttemperStartTime", width: 100, align: "left" },
  394. { label: "换课结束时间", name: "AttemperEndTime", width: 100, align: "left" },
  395. //对调属性
  396. {
  397. label: "对调系部", name: "NewDeptNo", width: 100, align: "left",
  398. formatterAsync: function (callback, value, row, op, $cell) {
  399. learun.clientdata.getAsync('custmerData', {
  400. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  401. key: value,
  402. keyId: 'deptno',
  403. callback: function (_data) {
  404. callback(_data['deptname']);
  405. }
  406. });
  407. }
  408. },
  409. {
  410. label: "对调专业", name: "NewMajorNo", width: 100, align: "left",
  411. formatterAsync: function (callback, value, row, op, $cell) {
  412. learun.clientdata.getAsync('custmerData', {
  413. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  414. key: value,
  415. keyId: 'majorno',
  416. callback: function (_data) {
  417. callback(_data['majorname']);
  418. }
  419. });
  420. }
  421. },
  422. {
  423. label: "对调课程", name: "NewLessonNo", width: 100, align: "left",
  424. formatterAsync: function (callback, value, row, op, $cell) {
  425. learun.clientdata.getAsync('custmerData', {
  426. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  427. key: value,
  428. keyId: 'lessonno',
  429. callback: function (_data) {
  430. callback(_data['lessonname']);
  431. }
  432. });
  433. }
  434. },
  435. {
  436. label: "对调班级", name: "NewTeachClassNo", width: 100, align: "left",
  437. formatterAsync: function (callback, value, row, op, $cell) {
  438. learun.clientdata.getAsync('custmerData', {
  439. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
  440. key: value,
  441. keyId: 'classno',
  442. callback: function (_data) {
  443. callback(_data['classname']);
  444. }
  445. });
  446. }
  447. },
  448. {
  449. label: "对调教师", name: "NewEmpNo", width: 100, align: "left",
  450. formatterAsync: function (callback, value, row, op, $cell) {
  451. learun.clientdata.getAsync('custmerData', {
  452. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'EmpInfo',
  453. key: value,
  454. keyId: 'empno',
  455. callback: function (_data) {
  456. callback(_data['empname']);
  457. }
  458. });
  459. }
  460. },
  461. {
  462. label: "对调教室", name: "NewClassroomNo", width: 100, align: "left",
  463. formatterAsync: function (callback, value, row, op, $cell) {
  464. learun.clientdata.getAsync('custmerData', {
  465. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'ClassRoomInfo',
  466. key: value,
  467. keyId: 'classroomno',
  468. callback: function (_data) {
  469. callback(_data['classroomname']);
  470. }
  471. });
  472. }
  473. },
  474. //审核相关属性
  475. {
  476. label: "创建用户", name: "CreateUserId", width: 100, align: "left",
  477. formatter: function (cellvalue, row) {
  478. return row.CreateUserName;
  479. }
  480. },
  481. { label: "提交时间", name: "SubmitTime", width: 130, align: "left" },
  482. {
  483. label: "状态", name: "Status", width: 100, align: "left",
  484. formatter: function (cellvalue, row) {
  485. if (cellvalue == 1) {
  486. return '<span class=\"label label-success\" >已提交</span>';
  487. } else {
  488. return '<span class=\"label label-default\" >未提交</span>';
  489. }
  490. }
  491. },
  492. {
  493. label: "审核用户", name: "CheckUserId", width: 100, align: "left",
  494. formatter: function (cellvalue, row) {
  495. return row.CheckUserName;
  496. }
  497. },
  498. { label: "审核时间", name: "CheckTime", width: 130, align: "left" },
  499. {
  500. label: "审核状态", name: "CheckStatus", width: 100, align: "left",
  501. formatter: function (cellvalue, row) {
  502. if (cellvalue == 1) {
  503. return '<span class=\"label label-warning\" >审核中</span>';
  504. } else if (cellvalue == 2) {
  505. return '<span class=\"label label-success\" >审核通过</span>';
  506. } else {
  507. return '<span class=\"label label-default\" >草稿</span>';
  508. }
  509. }
  510. },
  511. //{
  512. // label: "校区", name: "F_SchoolId", width: 100, align: "left",
  513. // formatterAsync: function (callback, value, row, op, $cell) {
  514. // learun.clientdata.getAsync('custmerData', {
  515. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company',
  516. // key: value,
  517. // keyId: 'f_companyid',
  518. // callback: function (_data) {
  519. // callback(_data['f_fullname']);
  520. // }
  521. // });
  522. // }
  523. //},
  524. ],
  525. mainId: 'Id',
  526. isPage: true,
  527. sord: 'desc',
  528. sidx: 'CreateTime'
  529. });
  530. page.search();
  531. },
  532. search: function (param) {
  533. param = param || {};
  534. if (learun.clientdata.get(['userinfo']).account.toLowerCase() != "system") {
  535. param.CreateUserId = learun.clientdata.get(['userinfo']).userId;
  536. }
  537. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  538. }
  539. };
  540. refreshGirdData = function (res, postData) {
  541. //if (res.code == 200) {
  542. // // 发起流程
  543. // learun.workflowapi.create({
  544. // isNew: true,
  545. // schemeCode: 'ArrangeLessonTermAttemper',// 填写流程对应模板编号
  546. // processId: processId,
  547. // processName: '课程异动申请',// 对应流程名称
  548. // processLevel: '1',
  549. // description: '',
  550. // formData: JSON.stringify(postData),
  551. // callback: function (res, data) {
  552. // }
  553. // });
  554. // page.search();
  555. //}
  556. if (res && res.code && res.code == 200) {
  557. // 发起流程
  558. var postData = {
  559. schemeCode: 'ArrangeLessonTermAttemper',// 填写流程对应模板编号
  560. processId: processId,
  561. level: '1',
  562. };
  563. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  564. learun.loading(false);
  565. });
  566. }
  567. page.search();
  568. };
  569. page.init();
  570. }