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.
 
 
 
 
 
 

318 lines
14 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2022-11-08 11:05
  5. * 描 述:学生赛事奖励
  6. */
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var processId = '';
  11. var page = {
  12. init: function () {
  13. page.initGird();
  14. page.bind();
  15. },
  16. bind: function () {
  17. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  18. page.search(queryJson);
  19. }, 240, 400);
  20. $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
  21. $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
  22. $('#ClassNo').lrDataSourceSelect({ code: 'bjsj', value: 'classno', text: 'classname' });
  23. $('#SCLevel').lrDataItemSelect({ code: 'Level' });
  24. //学年
  25. $('#AcademicYearNo').lrselect({
  26. placeholder: "请选择学年",
  27. allowSearch: true,
  28. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  29. value: 'value',
  30. text: 'text'
  31. });
  32. //学期
  33. $('#Semester').lrselect({
  34. placeholder: "请选择学期",
  35. allowSearch: true,
  36. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester',
  37. value: 'value',
  38. text: 'text'
  39. });
  40. // 刷新
  41. $('#lr_refresh').on('click', function () {
  42. location.reload();
  43. });
  44. // 新增
  45. $('#lr_add').on('click', function () {
  46. learun.layerForm({
  47. id: 'form',
  48. title: '新增',
  49. url: top.$.rootUrl + '/EducationalAdministration/StudentCompetition/Form',
  50. width: 1000,
  51. height: 800,
  52. callBack: function (id) {
  53. var res = false;
  54. // 验证数据
  55. res = top[id].validForm();
  56. // 保存数据
  57. if (res) {
  58. processId = learun.newGuid();
  59. res = top[id].save(processId, refreshGirdData);
  60. }
  61. return res;
  62. }
  63. });
  64. });
  65. // 编辑
  66. $('#lr_edit').on('click', function () {
  67. var keyValue = $('#gridtable').jfGridValue('Id');
  68. if (learun.checkrow(keyValue)) {
  69. var Status = $('#gridtable').jfGridValue('Status');
  70. if (Status == '2') {
  71. learun.alert.warning("当前项目已审批通过!");
  72. return;
  73. }
  74. if (Status != '0') {
  75. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  76. return;
  77. }
  78. learun.layerForm({
  79. id: 'form',
  80. title: '编辑',
  81. url: top.$.rootUrl + '/EducationalAdministration/StudentCompetition/Form?keyValue=' + keyValue,
  82. width: 1000,
  83. height: 800,
  84. callBack: function (id) {
  85. var res = false;
  86. // 验证数据
  87. res = top[id].validForm();
  88. // 保存数据
  89. if (res) {
  90. res = top[id].save('', function () {
  91. page.search();
  92. });
  93. }
  94. return res;
  95. }
  96. });
  97. }
  98. });
  99. //修改分值
  100. $('#lr_updscore').on('click', function () {
  101. var keyValue = $('#gridtable').jfGridValue('Id');
  102. if (learun.checkrow(keyValue)) {
  103. var Status = $('#gridtable').jfGridValue('Status');
  104. if (Status == '2') {
  105. learun.alert.warning("当前项目已审批通过!");
  106. return;
  107. }
  108. if (Status != '0') {
  109. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  110. return;
  111. }
  112. learun.layerForm({
  113. id: 'form_updscore',
  114. title: '修改分值',
  115. url: top.$.rootUrl + '/EducationalAdministration/StudentCompetition/FormScore?keyValue=' + keyValue,
  116. width: 500,
  117. height: 350,
  118. callBack: function (id) {
  119. var res = false;
  120. // 验证数据
  121. res = top[id].validForm();
  122. // 保存数据
  123. if (res) {
  124. res = top[id].save('', function () {
  125. page.search();
  126. });
  127. }
  128. return res;
  129. }
  130. });
  131. }
  132. });
  133. //复制
  134. $('#lr_copy').on('click', function () {
  135. var keyValue = $('#gridtable').jfGridValue('Id');
  136. if (learun.checkrow(keyValue)) {
  137. learun.layerForm({
  138. id: 'form',
  139. title: '新增',
  140. url: top.$.rootUrl + '/EducationalAdministration/StudentCompetition/Form?keyValue=' + keyValue + '&type=copy',
  141. width: 1000,
  142. height: 800,
  143. callBack: function (id) {
  144. var res = false;
  145. // 验证数据
  146. res = top[id].validForm();
  147. // 保存数据
  148. if (res) {
  149. res = top[id].save('', function () {
  150. page.search();
  151. });
  152. }
  153. return res;
  154. }
  155. });
  156. }
  157. });
  158. // 删除
  159. $('#lr_delete').on('click', function () {
  160. var keyValue = $('#gridtable').jfGridValue('Id');
  161. if (learun.checkrow(keyValue)) {
  162. var Status = $('#gridtable').jfGridValue('Status');
  163. if (Status == '2') {
  164. learun.alert.warning("当前项目已审批通过!");
  165. return;
  166. }
  167. if (Status != '0') {
  168. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  169. return;
  170. }
  171. learun.layerConfirm('是否确认删除该项!', function (res) {
  172. if (res) {
  173. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/StudentCompetition/DeleteForm', { keyValue: keyValue }, function () {
  174. refreshGirdData();
  175. });
  176. }
  177. });
  178. }
  179. });
  180. // 提交
  181. $('#lr_submit').on('click', function () {
  182. var keyValue = $('#gridtable').jfGridValue('Id');
  183. if (learun.checkrow(keyValue)) {
  184. var Status = $('#gridtable').jfGridValue('Status');
  185. if (Status == '2') {
  186. learun.alert.warning("当前项目已审批通过!");
  187. return;
  188. }
  189. if (Status != '0') {
  190. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  191. return;
  192. }
  193. learun.layerConfirm('是否确认提交该项!', function (res) {
  194. if (res) {
  195. processId = learun.newGuid();
  196. learun.postForm(top.$.rootUrl + '/EducationalAdministration/StudentCompetition/ChangeStatusById', { keyValue: keyValue, processId: processId }, function (res) {
  197. refreshGirdData(res, {});
  198. });
  199. }
  200. });
  201. }
  202. });
  203. // 打印
  204. $('#lr_print').on('click', function () {
  205. $('#gridtable').jqprintTable();
  206. });
  207. },
  208. // 初始化列表
  209. initGird: function () {
  210. $('#gridtable').jfGrid({
  211. url: top.$.rootUrl + '/EducationalAdministration/StudentCompetition/GetPageList',
  212. headData: [
  213. { label: "学年", name: "AcademicYearNo", width: 80, align: "left" },
  214. { label: "学期", name: "Semester", width: 80, align: "left" },
  215. { label: "学生学号", name: "StuNo", width: 150, align: "left" },
  216. { label: "学生姓名", name: "StuName", width: 100, align: "left" },
  217. {
  218. label: "专业部", name: "DeptNo", width: 100, align: "left",
  219. formatterAsync: function (callback, value, row, op, $cell) {
  220. learun.clientdata.getAsync('custmerData', {
  221. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  222. key: value,
  223. keyId: 'deptno',
  224. callback: function (_data) {
  225. callback(_data['deptname']);
  226. }
  227. });
  228. }
  229. },
  230. {
  231. label: "专业", name: "MajorNo", width: 100, align: "left",
  232. formatterAsync: function (callback, value, row, op, $cell) {
  233. learun.clientdata.getAsync('custmerData', {
  234. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  235. key: value,
  236. keyId: 'majorno',
  237. callback: function (_data) {
  238. callback(_data['majorname']);
  239. }
  240. });
  241. }
  242. },
  243. {
  244. label: "班级", name: "ClassNo", width: 100, align: "left",
  245. formatterAsync: function (callback, value, row, op, $cell) {
  246. learun.clientdata.getAsync('custmerData', {
  247. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj',
  248. key: value,
  249. keyId: 'classno',
  250. callback: function (_data) {
  251. callback(_data['classname']);
  252. }
  253. });
  254. }
  255. },
  256. { label: "赛事名称", name: "SCName", width: 100, align: "left" },
  257. {
  258. label: "赛事级别", name: "SCLevel", width: 100, align: "left",
  259. formatterAsync: function (callback, value, row, op, $cell) {
  260. learun.clientdata.getAsync('dataItem', {
  261. key: value,
  262. code: 'Level',
  263. callback: function (_data) {
  264. callback(_data.text);
  265. }
  266. });
  267. }
  268. },
  269. { label: "赛事种类", name: "SCType", width: 100, align: "left" },
  270. { label: "颁发单位", name: "Unit", width: 100, align: "left" },
  271. { label: "分值", name: "Score", width: 100, align: "left" },
  272. {
  273. label: "获取时间", name: "SCTime", width: 100, align: "left",
  274. formatter: function (cellvalue, row) {
  275. return learun.formatDate(cellvalue, 'yyyy-MM-dd');
  276. }
  277. },
  278. {
  279. label: "状态", name: "Status", width: 100, align: "left",
  280. formatter: function (cellvalue, row) {
  281. if (cellvalue === 1) {
  282. return '<span class=\"label label-warning\">审批中</span>';
  283. } else if (cellvalue === 2) {
  284. return '<span class=\"label label-success\">审核通过</span>';
  285. } else {
  286. return '<span class=\"label label-default\" >草稿</span>';
  287. }
  288. }
  289. },
  290. ],
  291. mainId: 'Id',
  292. isPage: true
  293. });
  294. page.search();
  295. },
  296. search: function (param) {
  297. param = param || {};
  298. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  299. }
  300. };
  301. refreshGirdData = function (res, postData) {
  302. if (res && res.code && res.code == 200) {
  303. var postData = {
  304. schemeCode: 'StudentCompetition',// 填写流程对应模板编号
  305. processId: processId,
  306. level: '1',
  307. };
  308. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  309. learun.loading(false);
  310. });
  311. }
  312. page.search();
  313. };
  314. page.init();
  315. }