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.
 
 
 
 
 
 

363 lines
18 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-01-24 17:03
  5. * 描 述:课程信息管理
  6. */
  7. var refreshGirdData;
  8. var companyId;
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. page.inittree();
  14. page.initGird();
  15. page.bind();
  16. page.search();
  17. },
  18. bind: function () {
  19. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  20. page.search(queryJson);
  21. }, 220, 400);
  22. $('#F_SchoolId').lrDataSourceSelect({ code: 'company', value: 'f_companyid', text: 'f_fullname' });
  23. $('#TeachDeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
  24. $('#TeachMajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
  25. // 刷新
  26. $('#lr_refresh').on('click', function () {
  27. location.reload();
  28. });
  29. // 新增
  30. $('#lr_add').on('click', function () {
  31. learun.layerForm({
  32. id: 'form',
  33. title: '新增',
  34. url: top.$.rootUrl + '/EducationalAdministration/LessonInfo/Form',
  35. width: 1000,
  36. height: 800,
  37. callBack: function (id) {
  38. return top[id].acceptClick(refreshGirdData);
  39. }
  40. });
  41. });
  42. // 编辑
  43. $('#lr_edit').on('click', function () {
  44. var keyValue = $('#gridtable').jfGridValue('LessonId');
  45. if (learun.checkrow(keyValue)) {
  46. if (keyValue.indexOf(',') != -1) {
  47. learun.alert.warning("只能选择一条记录进行编辑!");
  48. return;
  49. }
  50. var CheckMark = $('#gridtable').jfGridValue('CheckMark');
  51. if (CheckMark === "true") {
  52. learun.alert.warning("当前项目已审核不能编辑!");
  53. return;
  54. }
  55. learun.layerForm({
  56. id: 'form',
  57. title: '编辑',
  58. url: top.$.rootUrl + '/EducationalAdministration/LessonInfo/Form?keyValue=' + keyValue,
  59. width: 1000,
  60. height: 800,
  61. callBack: function (id) {
  62. return top[id].acceptClick(refreshGirdData);
  63. }
  64. });
  65. }
  66. });
  67. // 删除
  68. $('#lr_delete').on('click', function () {
  69. var keyValue = $('#gridtable').jfGridValue('LessonId');
  70. if (learun.checkrow(keyValue)) {
  71. var CheckMark = $('#gridtable').jfGridValue('CheckMark');
  72. if (CheckMark.indexOf('true') != -1) {
  73. learun.alert.warning("选中记录中包含已启用项目,已启用不能删除!");
  74. return;
  75. }
  76. //if (CheckMark === true) {
  77. // learun.alert.warning("当前项目已审核不能删除!");
  78. // return;
  79. //}
  80. learun.layerConfirm('是否确认删除该项!', function (res) {
  81. if (res) {
  82. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/LessonInfo/DeleteForm', { keyValue: keyValue }, function () {
  83. refreshGirdData();
  84. });
  85. }
  86. });
  87. }
  88. });
  89. //审核
  90. $('#lr_lock').on('click', function () {
  91. var keyValue = $('#gridtable').jfGridValue('LessonId');
  92. if (learun.checkrow(keyValue)) {
  93. var CheckMark = $('#gridtable').jfGridValue('CheckMark');
  94. if (CheckMark.indexOf('true') != -1) {
  95. learun.alert.warning("选中记录中包含已启用项目!");
  96. return;
  97. }
  98. //if (CheckMark === true) {
  99. // learun.alert.warning("当前项目已审核无需再审!");
  100. // return;
  101. //}
  102. learun.layerConfirm('是否确认启用该项!', function (res) {
  103. if (res) {
  104. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/LessonInfo/Lock', { keyValue: keyValue }, function () {
  105. refreshGirdData();
  106. });
  107. }
  108. });
  109. }
  110. });
  111. //去审核
  112. $('#lr_unlock').on('click', function () {
  113. var keyValue = $('#gridtable').jfGridValue('LessonId');
  114. if (learun.checkrow(keyValue)) {
  115. var CheckMark = $('#gridtable').jfGridValue('CheckMark');
  116. if (CheckMark.indexOf('false') != -1) {
  117. learun.alert.warning("选中记录中包含已停用项目!");
  118. return;
  119. }
  120. //if (CheckMark === false) {
  121. // learun.alert.warning("当前项目还未审核不需要去审核!");
  122. // return;
  123. //}
  124. learun.layerConfirm('是否确认停用该项!', function (res) {
  125. if (res) {
  126. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/LessonInfo/UnLock', { keyValue: keyValue }, function () {
  127. refreshGirdData();
  128. });
  129. }
  130. });
  131. }
  132. });
  133. },
  134. inittree: function () {
  135. $('#companyTree').lrtree({
  136. url: top.$.rootUrl + '/EducationalAdministration/CdLessonType/GetTree',
  137. param: {},
  138. nodeClick: page.treeNodeClick
  139. });
  140. },
  141. treeNodeClick: function (item) {
  142. companyId = item.id;
  143. $('#titleinfo').text(item.text);
  144. if (companyId == "dee7bcfe-dab7-49df-8efc-406860bf2c4f") {
  145. page.initGirdNoMajor();
  146. } else {
  147. page.initGird();
  148. page.search();
  149. }
  150. },
  151. // 初始化列表
  152. initGird: function () {
  153. //$("#gridtable")[0].dfop = undefined;
  154. $('#gridtable').lrAuthorizeJfGrid({
  155. url: top.$.rootUrl + '/EducationalAdministration/LessonInfo/GetPageList',
  156. headData: [
  157. { label: "课程编号", name: "LessonNo", width: 100, align: "left" },
  158. { label: "课程名称", name: "LessonName", width: 200, align: "left" },
  159. {
  160. label: "系部", name: "TeachDeptNo", width: 200, align: "left",
  161. formatterAsync: function (callback, value, row, op, $cell) {
  162. learun.clientdata.getAsync('custmerData', {
  163. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  164. key: value,
  165. keyId: 'deptno',
  166. callback: function (_data) {
  167. callback(_data['deptname']);
  168. }
  169. });
  170. }
  171. },
  172. {
  173. label: "专业", name: "TeachMajorNo", width: 200, align: "left",
  174. formatterAsync: function (callback, value, row, op, $cell) {
  175. learun.clientdata.getAsync('custmerData', {
  176. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  177. key: value,
  178. keyId: 'majorno',
  179. callback: function (_data) {
  180. callback(_data['majorname']);
  181. }
  182. });
  183. }
  184. },
  185. { label: "课程简称", name: "EnName", width: 100, align: "left" },
  186. { label: "学分", name: "StudyScore", width: 50, align: "left" },
  187. { label: "周理论学时", name: "WeekStudyHour", width: 80, align: "left" },
  188. { label: "周实验学时", name: "WeekPracticeHour", width: 80, align: "left" },
  189. { label: "每周课时", name: "TotalStudyHour", width: 80, align: "left" },
  190. { label: "总课时", name: "TotalHours", width: 80, align: "left" },
  191. {
  192. label: "是否先修", name: "HaveBeforeLesson", width: 80, align: "left",
  193. formatter: function (cellvalue) {
  194. return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  195. }
  196. },
  197. {
  198. label: "先修课程", name: "BeforeLesson", width: 100, align: "left",
  199. formatterAsync: function (callback, value, row, op, $cell) {
  200. learun.clientdata.getAsync('custmerData', {
  201. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  202. key: value,
  203. keyId: 'lessonname',
  204. callback: function (_data) {
  205. callback(_data['lessonno']);
  206. }
  207. });
  208. }
  209. },
  210. {
  211. label: "修读对象", name: "WhoStudy", width: 120, 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: "LessonSortNo", width: 150, align: "left",
  225. formatterAsync: function (callback, value, row, op, $cell) {
  226. learun.clientdata.getAsync('custmerData', {
  227. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonSort',
  228. key: value,
  229. keyId: 'lessonsortno',
  230. callback: function (_data) {
  231. callback(_data['lessonsortname']);
  232. }
  233. });
  234. }
  235. },
  236. {
  237. label: "课程分类明细", name: "LessonSortDetailNo", width: 150, align: "left",
  238. formatterAsync: function (callback, value, row, op, $cell) {
  239. learun.clientdata.getAsync('custmerData', {
  240. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonSortDetail',
  241. key: value,
  242. keyId: 'lessonsortdetailno',
  243. callback: function (_data) {
  244. callback(_data['lessonsortdetailname']);
  245. }
  246. });
  247. }
  248. },
  249. {
  250. label: "是否启用", name: "CheckMark", width: 80, align: "center",
  251. formatter: function (cellvalue) {
  252. return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  253. }
  254. }
  255. ],
  256. mainId: 'LessonId',
  257. isPage: true,
  258. isMultiselect: true,
  259. sidx: 'LessonNo',
  260. sord: 'ASC'
  261. });
  262. },
  263. initGirdNoMajor: function () {
  264. //$("#gridtable")[0].dfop = undefined;
  265. $('#gridtable').jfGrid({
  266. url: top.$.rootUrl + '/EducationalAdministration/LessonInfo/GetPageList',
  267. headData: [
  268. { label: "课程编号", name: "LessonNo", width: 100, align: "left" },
  269. { label: "课程名称", name: "LessonName", width: 200, align: "left" },
  270. { label: "课程简称", name: "EnName", width: 100, align: "left" },
  271. { label: "学分", name: "StudyScore", width: 50, align: "left" },
  272. { label: "周理论学时", name: "WeekStudyHour", width: 80, align: "left" },
  273. { label: "周实验学时", name: "WeekPracticeHour", width: 80, align: "left" },
  274. { label: "每周课时", name: "TotalStudyHour", width: 80, align: "left" },
  275. { label: "总学时", name: "TotalHours", width: 80, align: "left" },
  276. {
  277. label: "是否先修", name: "HaveBeforeLesson", width: 80, align: "left",
  278. formatter: function (cellvalue) {
  279. return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  280. }
  281. },
  282. {
  283. label: "先修课程", name: "BeforeLesson", width: 100, align: "left",
  284. formatterAsync: function (callback, value, row, op, $cell) {
  285. learun.clientdata.getAsync('custmerData', {
  286. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  287. key: value,
  288. keyId: 'lessonname',
  289. callback: function (_data) {
  290. callback(_data['lessonno']);
  291. }
  292. });
  293. }
  294. },
  295. {
  296. label: "修读对象", name: "WhoStudy", width: 120, align: "left",
  297. formatterAsync: function (callback, value, row, op, $cell) {
  298. learun.clientdata.getAsync('custmerData', {
  299. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  300. key: value,
  301. keyId: 'lessonno',
  302. callback: function (_data) {
  303. callback(_data['lessonname']);
  304. }
  305. });
  306. }
  307. },
  308. {
  309. label: "课程分类", name: "LessonSortNo", width: 150, align: "left",
  310. formatterAsync: function (callback, value, row, op, $cell) {
  311. learun.clientdata.getAsync('custmerData', {
  312. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonSort',
  313. key: value,
  314. keyId: 'lessonsortno',
  315. callback: function (_data) {
  316. callback(_data['lessonsortname']);
  317. }
  318. });
  319. }
  320. },
  321. {
  322. label: "课程分类明细", name: "LessonSortDetailNo", width: 150, align: "left",
  323. formatterAsync: function (callback, value, row, op, $cell) {
  324. learun.clientdata.getAsync('custmerData', {
  325. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonSortDetail',
  326. key: value,
  327. keyId: 'lessonsortdetailno',
  328. callback: function (_data) {
  329. callback(_data['lessonsortdetailname']);
  330. }
  331. });
  332. }
  333. },
  334. {
  335. label: "审核标志", name: "CheckMark", width: 80, align: "center",
  336. formatter: function (cellvalue) {
  337. return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  338. }
  339. }
  340. ],
  341. mainId: 'LessonId',
  342. isPage: true,
  343. isMultiselect: true,
  344. sidx: 'LessonNo',
  345. sord: 'ASC'
  346. });
  347. page.search();
  348. },
  349. search: function (param) {
  350. param = param || {};
  351. param.LessonTypeId = companyId;
  352. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  353. }
  354. };
  355. refreshGirdData = function () {
  356. page.search();
  357. };
  358. page.init();
  359. }