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.
 
 
 
 
 
 

128 lines
5.1 KiB

  1. /* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 北京泉江科技有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2019-04-23 15:59
  5. * 描 述:问卷题目管理
  6. */
  7. var refreshGirdData;
  8. var VID = request("VID");
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  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. }, 220, 400);
  20. // 刷新
  21. $('#lr_refresh').on('click', function () {
  22. location.reload();
  23. });
  24. // 新增
  25. $('#lr_add').on('click', function () {
  26. learun.layerForm({
  27. id: 'form',
  28. title: '新增',
  29. url: top.$.rootUrl + '/Ask/Ask_Question/Form?VID=' + VID,
  30. width: 600,
  31. height: 450,
  32. callBack: function (id) {
  33. return top[id].acceptClick(refreshGirdData);
  34. }
  35. });
  36. });
  37. // 编辑
  38. $('#lr_edit').on('click', function () {
  39. var keyValue = $('#gridtable').jfGridValue('QID');
  40. if (learun.checkrow(keyValue)) {
  41. learun.layerForm({
  42. id: 'form',
  43. title: '编辑',
  44. url: top.$.rootUrl + '/Ask/Ask_Question/Form?keyValue=' + keyValue,
  45. width: 600,
  46. height: 450,
  47. callBack: function (id) {
  48. return top[id].acceptClick(refreshGirdData);
  49. }
  50. });
  51. }
  52. });
  53. // 管理答案
  54. $('#lr_item').on('click', function () {
  55. var keyValue = $('#gridtable').jfGridValue('QID');
  56. if (learun.checkrow(keyValue)) {
  57. learun.layerForm({
  58. id: 'formitem',
  59. title: '管理答案',
  60. url: top.$.rootUrl + '/Ask/Ask_QuestionItems/Index?QID=' + keyValue,
  61. width: 880,
  62. height: 750,
  63. btn:null
  64. });
  65. }
  66. });
  67. // 删除
  68. $('#lr_delete').on('click', function () {
  69. var keyValue = $('#gridtable').jfGridValue('QID');
  70. if (learun.checkrow(keyValue)) {
  71. learun.layerConfirm('是否确认删除该项!', function (res) {
  72. if (res) {
  73. learun.deleteForm(top.$.rootUrl + '/Ask/Ask_Question/DeleteForm', { keyValue: keyValue }, function () {
  74. refreshGirdData();
  75. });
  76. }
  77. });
  78. }
  79. });
  80. },
  81. // 初始化列表
  82. initGird: function () {
  83. $('#gridtable').lrAuthorizeJfGrid({
  84. url: top.$.rootUrl + '/Ask/Ask_Question/GetPageList',
  85. headData: [
  86. { label: "题目编号", name: "QSerial", width: 180, align: "left" },
  87. { label: "标题", name: "QTitle", width: 200, align: "left" },
  88. {
  89. label: "题目类型", name: "QType", width: 100, align: "left",
  90. formatterAsync: function (callback, value, row, op, $cell) {
  91. learun.clientdata.getAsync('dataItem', {
  92. key: value,
  93. code: 'QType',
  94. callback: function (_data) {
  95. callback(_data.text);
  96. }
  97. });
  98. }
  99. },
  100. {
  101. label: "是否必填", name: "QMust", width: 100, align: "left",
  102. formatter: function (cellvalue) {
  103. return cellvalue == true ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>";
  104. }
  105. },
  106. { label: "最低选择", name: "QMin", width: 80, align: "left" },
  107. { label: "最多选择", name: "QMax", width: 80, align: "left" },
  108. { label: "排序", name: "QOrder", width: 80, align: "left" },
  109. { label: "备注说明", name: "QContent", width: 100, align: "left" },
  110. ],
  111. mainId: 'QID',
  112. isPage: true,
  113. sidx: 'QOrder'
  114. });
  115. page.search();
  116. },
  117. search: function (param) {
  118. param = param || {};
  119. param.VID = VID;
  120. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  121. }
  122. };
  123. refreshGirdData = function () {
  124. page.search();
  125. };
  126. page.init();
  127. }