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.
 
 
 
 
 
 

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