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.
 
 
 
 
 
 

289 lines
14 KiB

  1. /* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2022-02-18 14:27
  5. * 描 述:教材订单管理
  6. */
  7. var refreshGirdData;
  8. var bootstrap = function ($, learun) {
  9. "use strict";
  10. var startTime;
  11. var endTime;
  12. var processId = '';
  13. var page = {
  14. init: function () {
  15. page.initGird();
  16. page.bind();
  17. },
  18. bind: function () {
  19. // 时间搜索框
  20. $('#datesearch').lrdate({
  21. dfdata: [
  22. { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  23. { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  24. { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } },
  25. { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }
  26. ],
  27. // 月
  28. mShow: false,
  29. premShow: false,
  30. // 季度
  31. jShow: false,
  32. prejShow: false,
  33. // 年
  34. ysShow: false,
  35. yxShow: false,
  36. preyShow: false,
  37. yShow: false,
  38. // 默认
  39. dfvalue: '1',
  40. selectfn: function (begin, end) {
  41. startTime = begin;
  42. endTime = end;
  43. page.search();
  44. }
  45. });
  46. $('#multiple_condition_query').lrMultipleQuery(function (queryJson) {
  47. page.search(queryJson);
  48. }, 250, 400);
  49. $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' });
  50. $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorname', text: 'majorname' });
  51. $('#LessonNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' });
  52. $('#ClassNo').lrDataSourceSelect({ code: 'LessonInfo', value: 'lessonno', text: 'lessonname' });
  53. $('#AcademicYearNo').lrselect({
  54. placeholder: "请选择学年",
  55. allowSearch: true,
  56. url: top.$.rootUrl + '/EducationalAdministration/TextBookIndent/GetAcademicYear',
  57. value: 'value',
  58. text: 'text'
  59. });
  60. //学期
  61. $('#Semester').lrselect({
  62. placeholder: "请选择学年",
  63. allowSearch: true,
  64. url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester',
  65. value: 'value',
  66. text: 'text'
  67. });
  68. // 刷新
  69. $('#lr_refresh').on('click', function () {
  70. location.reload();
  71. });
  72. // 新增
  73. $('#lr_add').on('click', function () {
  74. learun.layerForm({
  75. id: 'formTextBookIndent',
  76. title: '新增',
  77. url: top.$.rootUrl + '/EducationalAdministration/TextBookIndent/Form',
  78. width: 1000,
  79. height: 700,
  80. callBack: function (id) {
  81. var res = false;
  82. // 验证数据
  83. res = top[id].validForm();
  84. // 保存数据
  85. if (res) {
  86. //processId = learun.newGuid();
  87. //res = top[id].save(processId, refreshGirdData);
  88. res = top[id].save('', function () {
  89. page.search();
  90. });
  91. }
  92. return res;
  93. }
  94. });
  95. });
  96. // 编辑
  97. $('#lr_edit').on('click', function () {
  98. var keyValue = $('#gridtable').jfGridValue('ID');
  99. if (learun.checkrow(keyValue)) {
  100. var Status = $('#gridtable').jfGridValue('Status');
  101. if (Status != 0) {
  102. learun.alert.warning("当前项目已提交,不可编辑!");
  103. return;
  104. }
  105. learun.layerForm({
  106. id: 'formTextBookIndent',
  107. title: '编辑',
  108. url: top.$.rootUrl + '/EducationalAdministration/TextBookIndent/Form?keyValue=' + keyValue,
  109. width: 1000,
  110. height: 700,
  111. callBack: function (id) {
  112. var res = false;
  113. // 验证数据
  114. res = top[id].validForm();
  115. // 保存数据
  116. if (res) {
  117. res = top[id].save('', function () {
  118. page.search();
  119. });
  120. }
  121. return res;
  122. }
  123. });
  124. }
  125. });
  126. // 删除
  127. $('#lr_delete').on('click', function () {
  128. var keyValue = $('#gridtable').jfGridValue('ID');
  129. var Status = $('#gridtable').jfGridValue('Status');
  130. if (Status != 0) {
  131. learun.alert.warning("当前项目已提交,不可删除!");
  132. return;
  133. }
  134. if (learun.checkrow(keyValue)) {
  135. learun.layerConfirm('是否确认删除该项!', function (res) {
  136. if (res) {
  137. learun.deleteForm(top.$.rootUrl + '/EducationalAdministration/TextBookIndent/DeleteForm', { keyValue: keyValue }, function () {
  138. refreshGirdData();
  139. });
  140. }
  141. });
  142. }
  143. });
  144. //  提交
  145. $('#lr_submit').on('click', function () {
  146. var keyValue = $('#gridtable').jfGridValue('ID');
  147. if (learun.checkrow(keyValue)) {
  148. var Status = $('#gridtable').jfGridValue('Status');
  149. if (Status != 0) {
  150. learun.alert.warning("当前项目已提交,请耐心等待审批!");
  151. return;
  152. }
  153. learun.layerConfirm('是否确认提交该项!', function (res) {
  154. if (res) {
  155. processId = learun.newGuid();
  156. learun.postForm(top.$.rootUrl + '/EducationalAdministration/TextBookIndent/ModifyStatus', { keyValue: keyValue, processId: processId }, function (res) {
  157. if (res.code == '200') {
  158. // 发起流程
  159. var postData = {
  160. schemeCode: 'TextBookIndent',// 填写流程对应模板编号
  161. processId: processId,
  162. level: '1',
  163. };
  164. learun.httpAsync('Post', top.$.rootUrl + '/LR_NewWorkFlow/NWFProcess/CreateFlow', postData, function (data) {
  165. learun.loading(false);
  166. });
  167. }
  168. refreshGirdData();
  169. });
  170. }
  171. });
  172. }
  173. });
  174. // 查看
  175. $('#lr_look').on('click', function () {
  176. var keyValue = $('#gridtable').jfGridValue('ID');
  177. if (learun.checkrow(keyValue)) {
  178. learun.layerForm({
  179. id: 'formview',
  180. title: '查看',
  181. url: top.$.rootUrl + '/EducationalAdministration/TextBookIndent/FormView?keyValue=' + keyValue,
  182. width: 1000,
  183. height: 700,
  184. btn: null,
  185. });
  186. }
  187. });
  188. },
  189. // 初始化列表
  190. initGird: function () {
  191. $('#gridtable').jfGrid({
  192. url: top.$.rootUrl + '/EducationalAdministration/TextBookIndent/GetPageList',
  193. headData: [
  194. //{ label: "主键", name: "ID", width: 200, align: "left" },
  195. {
  196. label: "专业部", name: "DeptNo", width: 100, align: "left",
  197. formatterAsync: function (callback, value, row, op, $cell) {
  198. learun.clientdata.getAsync('custmerData', {
  199. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo',
  200. key: value,
  201. keyId: 'deptno',
  202. callback: function (_data) {
  203. callback(_data['deptname']);
  204. }
  205. });
  206. }
  207. },
  208. {
  209. label: "专业", name: "MajorNo", width: 120, align: "left",
  210. formatterAsync: function (callback, value, row, op, $cell) {
  211. learun.clientdata.getAsync('custmerData', {
  212. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo',
  213. key: value,
  214. keyId: 'majorname',
  215. callback: function (_data) {
  216. callback(_data['majorname']);
  217. }
  218. });
  219. }
  220. },
  221. {
  222. label: "课程", name: "LessonNo", width: 150, align: "left",
  223. formatterAsync: function (callback, value, row, op, $cell) {
  224. learun.clientdata.getAsync('custmerData', {
  225. url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'LessonInfo',
  226. key: value,
  227. keyId: 'lessonno',
  228. callback: function (_data) {
  229. callback(_data['lessonname']);
  230. }
  231. });
  232. }
  233. },
  234. { label: "学年", name: "AcademicYearNo", width: 100, align: "left" },
  235. { label: "学期", name: "Semester", width: 100, align: "left" },
  236. { label: "教材名称", name: "TextBookName", width: 200, align: "left" },
  237. { label: "书号(物料号)", name: "PublishNo", width: 150, align: "left" },
  238. { label: "作者", name: "FirstAuthor", width: 100, align: "left" },
  239. { label: "其他作者", name: "OtherAuthor", width: 150, align: "left" },
  240. { label: "出版社", name: "Publisher", width: 100, align: "left" },
  241. { label: "版次", name: "Edition", width: 100, align: "left" },
  242. { label: "单价", name: "Price", width: 100, align: "left" },
  243. { label: "订购数量", name: "OrderNum", width: 100, align: "left" },
  244. { label: "备注", name: "Remark", width: 200, align: "left" },
  245. {
  246. label: "状态", name: "Status", width: 100, align: "left",
  247. formatter: function (cellvalue) {
  248. if (cellvalue == '0') {
  249. return '<span class=\"label label-success\">草稿</span>';
  250. } else if (cellvalue == '1') {
  251. return '<span class=\"label label-danger\">审批中</span>';
  252. } else if (cellvalue == '2') {
  253. return '<span class=\"label label-info\">审批通过</span>';
  254. }
  255. }
  256. },
  257. { label: "录入时间", name: "CreateTime", width: 100, align: "left" },
  258. {
  259. label: "创建用户", name: "CreateUserID", width: 100, align: "left",
  260. formatterAsync: function (callback, value, row, op, $cell) {
  261. learun.clientdata.getAsync('user', {
  262. key: value,
  263. callback: function (_data) {
  264. callback(_data.name);
  265. }
  266. });
  267. }
  268. },
  269. ],
  270. mainId: 'ID',
  271. sidx: 'CreateTime desc,Status desc',
  272. isPage: true
  273. });
  274. },
  275. search: function (param) {
  276. param = param || {};
  277. param.StartTime = startTime;
  278. param.EndTime = endTime;
  279. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  280. }
  281. };
  282. refreshGirdData = function () {
  283. page.search();
  284. };
  285. page.init();
  286. }