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.

Index.js 14 KiB

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