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.
 
 
 
 
 
 

361 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. {
  191. label: "是否先修", name: "HaveBeforeLesson", width: 80, align: "left",
  192. formatter: function (cellvalue) {
  193. return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  194. }
  195. },
  196. {
  197. label: "先修课程", name: "BeforeLesson", width: 100, align: "left",
  198. formatterAsync: function (callback, value, row, op, $cell) {
  199. learun.clientdata.getAsync('custmerData', {
  200. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  201. key: value,
  202. keyId: 'lessonname',
  203. callback: function (_data) {
  204. callback(_data['lessonno']);
  205. }
  206. });
  207. }
  208. },
  209. {
  210. label: "修读对象", name: "WhoStudy", width: 120, align: "left",
  211. formatterAsync: function (callback, value, row, op, $cell) {
  212. learun.clientdata.getAsync('custmerData', {
  213. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  214. key: value,
  215. keyId: 'lessonno',
  216. callback: function (_data) {
  217. callback(_data['lessonname']);
  218. }
  219. });
  220. }
  221. },
  222. {
  223. label: "课程分类", name: "LessonSortNo", width: 150, align: "left",
  224. formatterAsync: function (callback, value, row, op, $cell) {
  225. learun.clientdata.getAsync('custmerData', {
  226. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonSort',
  227. key: value,
  228. keyId: 'lessonsortno',
  229. callback: function (_data) {
  230. callback(_data['lessonsortname']);
  231. }
  232. });
  233. }
  234. },
  235. {
  236. label: "课程分类明细", name: "LessonSortDetailNo", width: 150, align: "left",
  237. formatterAsync: function (callback, value, row, op, $cell) {
  238. learun.clientdata.getAsync('custmerData', {
  239. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonSortDetail',
  240. key: value,
  241. keyId: 'lessonsortdetailno',
  242. callback: function (_data) {
  243. callback(_data['lessonsortdetailname']);
  244. }
  245. });
  246. }
  247. },
  248. {
  249. label: "是否启用", name: "CheckMark", width: 80, align: "center",
  250. formatter: function (cellvalue) {
  251. return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  252. }
  253. }
  254. ],
  255. mainId: 'LessonId',
  256. isPage: true,
  257. isMultiselect: true,
  258. sidx: 'LessonNo',
  259. sord: 'ASC'
  260. });
  261. },
  262. initGirdNoMajor: function () {
  263. //$("#gridtable")[0].dfop = undefined;
  264. $('#gridtable').jfGrid({
  265. url: top.$.rootUrl + '/EducationalAdministration/LessonInfo/GetPageList',
  266. headData: [
  267. { label: "课程编号", name: "LessonNo", width: 100, align: "left" },
  268. { label: "课程名称", name: "LessonName", width: 200, align: "left" },
  269. { label: "课程简称", name: "EnName", width: 100, align: "left" },
  270. { label: "学分", name: "StudyScore", width: 50, align: "left" },
  271. { label: "周理论学时", name: "WeekStudyHour", width: 80, align: "left" },
  272. { label: "周实验学时", name: "WeekPracticeHour", width: 80, align: "left" },
  273. { label: "每周课时", name: "TotalStudyHour", width: 80, align: "left" },
  274. {
  275. label: "是否先修", name: "HaveBeforeLesson", width: 80, align: "left",
  276. formatter: function (cellvalue) {
  277. return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  278. }
  279. },
  280. {
  281. label: "先修课程", name: "BeforeLesson", width: 100, align: "left",
  282. formatterAsync: function (callback, value, row, op, $cell) {
  283. learun.clientdata.getAsync('custmerData', {
  284. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  285. key: value,
  286. keyId: 'lessonname',
  287. callback: function (_data) {
  288. callback(_data['lessonno']);
  289. }
  290. });
  291. }
  292. },
  293. {
  294. label: "修读对象", name: "WhoStudy", width: 120, align: "left",
  295. formatterAsync: function (callback, value, row, op, $cell) {
  296. learun.clientdata.getAsync('custmerData', {
  297. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  298. key: value,
  299. keyId: 'lessonno',
  300. callback: function (_data) {
  301. callback(_data['lessonname']);
  302. }
  303. });
  304. }
  305. },
  306. {
  307. label: "课程分类", name: "LessonSortNo", width: 150, align: "left",
  308. formatterAsync: function (callback, value, row, op, $cell) {
  309. learun.clientdata.getAsync('custmerData', {
  310. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonSort',
  311. key: value,
  312. keyId: 'lessonsortno',
  313. callback: function (_data) {
  314. callback(_data['lessonsortname']);
  315. }
  316. });
  317. }
  318. },
  319. {
  320. label: "课程分类明细", name: "LessonSortDetailNo", width: 150, align: "left",
  321. formatterAsync: function (callback, value, row, op, $cell) {
  322. learun.clientdata.getAsync('custmerData', {
  323. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdLessonSortDetail',
  324. key: value,
  325. keyId: 'lessonsortdetailno',
  326. callback: function (_data) {
  327. callback(_data['lessonsortdetailname']);
  328. }
  329. });
  330. }
  331. },
  332. {
  333. label: "审核标志", name: "CheckMark", width: 80, align: "center",
  334. formatter: function (cellvalue) {
  335. return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  336. }
  337. }
  338. ],
  339. mainId: 'LessonId',
  340. isPage: true,
  341. isMultiselect: true,
  342. sidx: 'LessonNo',
  343. sord: 'ASC'
  344. });
  345. page.search();
  346. },
  347. search: function (param) {
  348. param = param || {};
  349. param.LessonTypeId = companyId;
  350. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  351. }
  352. };
  353. refreshGirdData = function () {
  354. page.search();
  355. };
  356. page.init();
  357. }