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.
 
 
 
 
 
 

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