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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2022-11-07 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. //学年
  24. $('#AcademicYearNo').lrselect({
  25. placeholder: "请选择学年",
  26. allowSearch: true,
  27. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo',
  28. value: 'value',
  29. text: 'text'
  30. });
  31. //学期
  32. $('#Semester').lrselect({
  33. placeholder: "请选择学期",
  34. allowSearch: true,
  35. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester',
  36. value: 'value',
  37. text: 'text'
  38. });
  39. // 刷新
  40. $('#lr_refresh').on('click', function () {
  41. location.reload();
  42. });
  43. // 新增
  44. $('#lr_add').on('click', function () {
  45. learun.layerForm({
  46. id: 'form',
  47. title: '新增',
  48. url: top.$.rootUrl + '/EducationalAdministration/StudentHonor/Form',
  49. width: 1000,
  50. height: 800,
  51. callBack: function (id) {
  52. var res = false;
  53. // 验证数据
  54. res = top[id].validForm();
  55. // 保存数据
  56. if (res) {
  57. res = top[id].save('', function () {
  58. page.search();
  59. });
  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/StudentHonor/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/StudentHonor/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/StudentHonor/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/StudentHonor/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/StudentHonor/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/StudentHonor/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: "SHName", width: 100, align: "left" },
  257. { label: "荣誉级别", name: "SHLevel", width: 100, align: "left" },
  258. { label: "荣誉种类", name: "SHType", width: 100, align: "left" },
  259. { label: "颁发单位", name: "Unit", width: 100, align: "left" },
  260. { label: "分值", name: "Score", width: 100, align: "left" },
  261. {
  262. label: "获取时间", name: "SHTime", width: 100, align: "left",
  263. formatter: function (cellvalue, row) {
  264. return learun.formatDate(cellvalue, 'yyyy-MM-dd');
  265. }
  266. },
  267. {
  268. label: "状态", name: "Status", width: 100, align: "left",
  269. formatter: function (cellvalue, row) {
  270. if (cellvalue === 1) {
  271. return '<span class=\"label label-warning\">审批中</span>';
  272. } else if (cellvalue === 2) {
  273. return '<span class=\"label label-success\">审核通过</span>';
  274. } else {
  275. return '<span class=\"label label-default\" >草稿</span>';
  276. }
  277. }
  278. },
  279. ],
  280. mainId: 'Id',
  281. isPage: true
  282. });
  283. page.search();
  284. },
  285. search: function (param) {
  286. param = param || {};
  287. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  288. }
  289. };
  290. refreshGirdData = function (res, postData) {
  291. if (res && res.code && res.code == 200) {
  292. var postData = {
  293. schemeCode: 'StudentHonor',// 填写流程对应模板编号
  294. processId: processId,
  295. level: '1',
  296. };
  297. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  298. learun.loading(false);
  299. });
  300. }
  301. page.search();
  302. };
  303. page.init();
  304. }