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.
 
 
 
 
 
 

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