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.
 
 
 
 
 
 

307 lines
15 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2021-11-29 11:43
  5. * 描 述:开课计划
  6. */
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var cddeptname = '';
  11. var page = {
  12. init: function () {
  13. page.inittree();
  14. page.initGird();
  15. page.bind();
  16. },
  17. bind: function () {
  18. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  19. page.search(queryJson);
  20. }, 250, 400);
  21. //$('#F_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' });
  22. $('#AcademicYearNo').lrselect({
  23. placeholder: "请选择学年",
  24. allowSearch: true,
  25. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  26. value: 'value',
  27. text: 'text'
  28. });
  29. //年级
  30. $('#Grade').lrselect({
  31. placeholder: "请选择年级",
  32. allowSearch: true,
  33. url: top.$.rootUrl + '/EducationalAdministration/StuInfoFresh/GetGradeData',
  34. value: 'value',
  35. text: 'text'
  36. });
  37. $('#Semester').lrDataItemSelect({ code: 'Semester' });
  38. $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
  39. $('#MajorNo').lrselect({
  40. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo',
  41. param: { strWhere: " 1=1 and CheckMark=1 " },
  42. value: "majorno",
  43. text: "majorname",
  44. maxHeight: 200,
  45. select: function (item) {
  46. if (item) {
  47. $('#LessonNo').lrselectRefresh({
  48. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=LessonInfo',
  49. param: { strWhere: " 1=1 and CheckMark=1 and teachmajorno='" + item.majorno + "'" },
  50. value: "lessonno",
  51. text: "lessonname",
  52. maxHeight: 200
  53. });
  54. }
  55. }
  56. });
  57. $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' });
  58. // 刷新
  59. $('#lr_refresh').on('click', function () {
  60. location.reload();
  61. });
  62. // 新增
  63. $('#lr_add').on('click', function () {
  64. learun.layerForm({
  65. id: 'form',
  66. title: '新增',
  67. url: top.$.rootUrl + '/EducationalAdministration/ClassPlan/Form',
  68. width: 800,
  69. height: 450,
  70. callBack: function (id) {
  71. return top[id].acceptClick(refreshGirdData);
  72. }
  73. });
  74. });
  75. // 编辑
  76. $('#lr_edit').on('click', function () {
  77. var keyValue = $('#gridtable').jfGridValue('ID');
  78. if (learun.checkrow(keyValue)) {
  79. if (keyValue.indexOf(',') != -1) {
  80. learun.alert.warning("只能选择一条记录进行编辑!");
  81. return;
  82. }
  83. var state = $('#gridtable').jfGridValue('State');
  84. if (state == 0) {
  85. learun.layerForm({
  86. id: 'form',
  87. title: '编辑',
  88. url: top.$.rootUrl + '/EducationalAdministration/ClassPlan/Form?keyValue=' + keyValue,
  89. width: 800,
  90. height: 450,
  91. callBack: function (id) {
  92. return top[id].acceptClick(refreshGirdData);
  93. }
  94. });
  95. } else {
  96. learun.layerConfirm('是否确认修改,修改后可能会造成不可弥补的错误!!!', function (res) {
  97. if (res) {
  98. learun.layerForm({
  99. id: 'form',
  100. title: '编辑',
  101. url: top.$.rootUrl + '/EducationalAdministration/ClassPlan/Form?keyValue=' + keyValue,
  102. width: 800,
  103. height: 450,
  104. callBack: function (id) {
  105. return top[id].acceptClick(refreshGirdData);
  106. }
  107. });
  108. }
  109. });
  110. }
  111. }
  112. });
  113. // 删除
  114. $('#lr_delete').on('click', function () {
  115. var keyValue = $('#gridtable').jfGridValue('ID');
  116. if (learun.checkrow(keyValue)) {
  117. var state = $('#gridtable').jfGridValue('State').split(',');
  118. var allEmpty = true;
  119. for (var i = 0; i < state.length; i++) {
  120. if (state[i] != 0) {
  121. allEmpty = false;
  122. }
  123. }
  124. if (allEmpty) {
  125. learun.layerConfirm('是否确认删除该项!',
  126. function (res) {
  127. if (res) {
  128. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/ClassPlan/DeleteForm',
  129. { keyValue: keyValue },
  130. function () {
  131. refreshGirdData();
  132. });
  133. }
  134. });
  135. } else {
  136. learun.layerConfirm('是否确认删除该项,删除数据后不可恢复!!!', function (item) {
  137. if (item) {
  138. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/ClassPlan/DeleteForm', { keyValue: keyValue }, function () {
  139. refreshGirdData();
  140. });
  141. }
  142. });
  143. }
  144. }
  145. });
  146. //排课
  147. $('#lr_courses').on('click', function () {
  148. var keyValue = $('#gridtable').jfGridValue('ID');
  149. if (learun.checkrow(keyValue)) {
  150. var state = $('#gridtable').jfGridValue('State').split(',');
  151. var allEmpty = true;
  152. for (var i = 0; i < state.length; i++) {
  153. if (state[i] != 0) {
  154. allEmpty = false;
  155. }
  156. }
  157. if (allEmpty) {
  158. learun.layerConfirm('确定要进行排课么!',
  159. function (res) {
  160. if (res) {
  161. learun.postForm(
  162. top.$.rootUrl + '/EducationalAdministration/ClassPlan/CourseArranging',
  163. { keyValue: keyValue },
  164. function () {
  165. refreshGirdData();
  166. });
  167. }
  168. });
  169. } else {
  170. learun.alert.warning("不能选择已排课的课程计划");
  171. }
  172. }
  173. });
  174. },
  175. inittree: function () {
  176. $('#cddeptTree').lrtree({
  177. url: top.$.rootUrl + '/EducationalAdministration/CdDept/GetTree',
  178. param: { parentId: '0' },
  179. nodeClick: page.treeNodeClick
  180. });
  181. //$('#cddeptTree').lrtreeSet('setValue', '53298b7a-404c-4337-aa7f-80b2a4ca6681');
  182. },
  183. treeNodeClick: function (item) {
  184. cddeptname = item.id;
  185. $('#titleinfo').text(item.text);
  186. page.search();
  187. var NDeptNo = item.id;
  188. if (NDeptNo != null && NDeptNo != "" && NDeptNo != 'undefined') {
  189. $('#MajorNo').lrselectRefresh({
  190. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo',
  191. param: { strWhere: " 1=1 and CheckMark=1 and deptno in (" + NDeptNo + ")" },
  192. value: "majorno",
  193. text: "majorname",
  194. maxHeight: 200
  195. });
  196. } else {
  197. $('#MajorNo').lrselectRefresh({
  198. url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdMajorInfo',
  199. param: { strWhere: " 1=1 and CheckMark=1 " },
  200. value: "majorno",
  201. text: "majorname",
  202. maxHeight: 200
  203. });
  204. }
  205. },
  206. // 初始化列表
  207. initGird: function () {
  208. $('#gridtable').jfGrid({
  209. url: top.$.rootUrl + '/EducationalAdministration/ClassPlan/GetPageList',
  210. headData: [
  211. { label: "学年", name: "AcademicYearNo", width: 80, align: "left" },
  212. { label: "学期", name: "Semester", width: 50, align: "left" },
  213. { label: "年级", name: "Grade", width: 50, align: "left" },
  214. { label: "专业编码", name: "MajorNo", width: 80, align: "left" },
  215. {
  216. label: "专业名称", name: "MajorNo", width: 200, align: "left",
  217. formatterAsync: function (callback, value, row, op, $cell) {
  218. learun.clientdata.getAsync('custmerData', {
  219. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  220. key: value,
  221. keyId: 'majorno',
  222. callback: function (_data) {
  223. callback(_data['majorname']);
  224. }
  225. });
  226. }
  227. },
  228. { label: "课程编码", name: "LessonNo", width: 100, align: "left" },
  229. { label: "课程名称", name: "LessonName", width: 200, align: "left", },
  230. {
  231. label: "课程类型", name: "LessonTypeId", width: 100, align: "left",
  232. formatterAsync: function (callback, value, row, op, $cell) {
  233. learun.clientdata.getAsync('custmerData', {
  234. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonType',
  235. key: value,
  236. keyId: 'ltid',
  237. callback: function (_data) {
  238. callback(_data['lessontypename']);
  239. }
  240. });
  241. }
  242. },
  243. {
  244. label: "状态", name: "State", width: 80, align: "left",
  245. formatter: function (cellvalue, row) {
  246. if (cellvalue == 0) {
  247. return '<span class=\"label label-warning\">未排课</span>';
  248. } if (cellvalue == 1) {
  249. return '<span class=\"label label-success\">已排课</span>';
  250. }
  251. }
  252. },
  253. {
  254. label: "考试类型", name: "ExamType", width: 80, align: "left",
  255. formatterAsync: function (callback, value, row, op, $cell) {
  256. learun.clientdata.getAsync('dataItem', {
  257. key: value,
  258. code: 'ExamType',
  259. callback: function (_data) {
  260. callback(_data.text);
  261. }
  262. });
  263. }
  264. },
  265. { label: "学分", name: "StudyScore", width: 80, align: "left" },
  266. { label: "拟开教学班数", name: "TeachClassNum", width: 100, align: "left" },
  267. //{ label: "人数", name: "StuNum", width: 80, align: "left" },
  268. { label: "周课时", name: "WeekLessonHour", width: 80, align: "left" },
  269. { label: "理论课时", name: "WeekHourClassroom", width: 80, align: "left" },
  270. { label: "实践课时", name: "PracticeHour", width: 80, align: "left" },
  271. { label: "起始周次", name: "StartWeek", width: 80, align: "left" },
  272. //{ label: "结束周次", name: "EndWeek", width: 80, align: "left" },
  273. //{
  274. // label: "负责开课院系", name: "TeachDeptNo", width: 100, align: "left",
  275. // formatterAsync: function (callback, value, row, op, $cell) {
  276. // learun.clientdata.getAsync('custmerData', {
  277. // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  278. // key: value,
  279. // keyId: 'deptno',
  280. // callback: function (_data) {
  281. // callback(_data['deptname']);
  282. // }
  283. // });
  284. // }
  285. //},
  286. { label: "备注", name: "Remark", width: 100, align: "left" },
  287. ],
  288. mainId: 'ID',
  289. sidx: 'MakeDate desc',
  290. isMultiselect: true,
  291. isPage: true
  292. });
  293. page.search();
  294. },
  295. search: function (param) {
  296. param = param || {};
  297. param.DeptNo = cddeptname;
  298. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  299. }
  300. };
  301. refreshGirdData = function () {
  302. $('#gridtable').jfGridSet('reload');
  303. };
  304. page.init();
  305. }