integralItemMgr.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /**
  2. * 认定条件管理管理初始化
  3. */
  4. var IntegralItemMgr = {
  5. id: "IntegralItemMgrTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. /**
  11. * 初始化表格的列
  12. */
  13. IntegralItemMgr.initColumn = function () {
  14. return [
  15. {field: 'selectItem', radio: true},
  16. {title: '人才类别', field: 'type', visible: true, align: 'center', valign: 'middle',
  17. formatter: function (value, row, index) {
  18. if (value == 1) {
  19. return "晋江市现代产业体系人才";
  20. }
  21. if (value == 2) {
  22. return "集成电路优秀人才";
  23. }
  24. }
  25. },
  26. {title: '标准名称', field: 'name', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip'},
  27. {title: '所属项目', field: 'projectName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip'},
  28. {title: '项目类别', field: 'projectType', visible: true, align: 'center', valign: 'middle',
  29. formatter: function (value, row, index) {
  30. switch (value) {
  31. case 1:
  32. return "基础分";
  33. case 2:
  34. return "贡献分";
  35. case 3:
  36. return "资历分";
  37. }
  38. }
  39. },
  40. {title: '首次积分规则', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip',
  41. formatter: function (value, row, index) {
  42. return "首次达成" + row.fstNeedAmount + row.unit + "可获得" + row.fstGainPoints + "积分";
  43. }
  44. },
  45. {title: '增量积分规则', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip',
  46. formatter: function (value, row, index) {
  47. if (row.stepNeedAmount > 0) {
  48. return "每新增" + row.stepNeedAmount + row.unit + "可获得" + row.stepGainPoints + "积分";
  49. } else {
  50. return "未设置";
  51. }
  52. }
  53. },
  54. {title: '是否启用', field: 'active', visible: true, align: 'center', valign: 'middle',
  55. formatter: function (value, row, index) {
  56. if (value == 1) {
  57. return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-primary btn-xs\">启用</button>";
  58. }
  59. if (value == 2) {
  60. return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-warning btn-xs\">停用</button>";
  61. }
  62. }
  63. }
  64. ];
  65. };
  66. /**
  67. * 检查是否选中
  68. */
  69. IntegralItemMgr.check = function () {
  70. var selected = $('#' + this.id).bootstrapTable('getSelections');
  71. if (selected.length == 0) {
  72. Feng.info("请先选中表格中的某一记录!");
  73. return false;
  74. } else {
  75. IntegralItemMgr.seItem = selected[0];
  76. return true;
  77. }
  78. };
  79. /**
  80. * 点击添加积分项目
  81. */
  82. IntegralItemMgr.openAddIntegralItem = function () {
  83. var index = layer.open({
  84. type: 2,
  85. title: '添加积分标准',
  86. area: ['1126px', '420px'], //宽高
  87. fix: false, //不固定
  88. maxmin: true,
  89. content: Feng.ctxPath + '/admin/integral_mgr/addItem'
  90. });
  91. this.layerIndex = index;
  92. };
  93. /**
  94. * 打开编辑积分项目
  95. */
  96. IntegralItemMgr.openEditIntegralItem = function () {
  97. if (this.check()) {
  98. var index = layer.open({
  99. type: 2,
  100. title: '编辑积分标准',
  101. area: ['1126px', '420px'], //宽高
  102. fix: false, //不固定
  103. maxmin: true,
  104. content: Feng.ctxPath + '/admin/integral_mgr/editItem/id/' + IntegralItemMgr.seItem.id
  105. });
  106. this.layerIndex = index;
  107. }
  108. };
  109. /**
  110. * 删除积分项目
  111. */
  112. IntegralItemMgr.delete = function () {
  113. if (this.check()) {
  114. var operation = function () {
  115. var ajax = new $ax(Feng.ctxPath + "/admin/integral_mgr/deleteItem/id/", function (data) {
  116. Feng.success("删除成功!");
  117. IntegralItemMgr.table.refresh();
  118. }, function (data) {
  119. Feng.error("删除失败!" + data.responseJSON.message + "!");
  120. });
  121. ajax.set("id", IntegralItemMgr.seItem.id);
  122. ajax.start();
  123. }
  124. Feng.confirm("是否刪除该积分标准?", operation);
  125. }
  126. };
  127. /**
  128. * 查询表单提交参数对象
  129. * @returns {{}}
  130. */
  131. IntegralItemMgr.formParams = function () {
  132. var queryData = {};
  133. queryData['type'] = $("#type").val();
  134. queryData['name'] = $("#name").val();
  135. queryData['projectType'] = $("#projectType").val();
  136. queryData['active'] = $("#active").val();
  137. return queryData;
  138. }
  139. /**
  140. * 查询认定条件管理列表
  141. */
  142. IntegralItemMgr.search = function () {
  143. IntegralItemMgr.table.refresh({query: IntegralItemMgr.formParams()});
  144. };
  145. /**
  146. * 重置
  147. */
  148. IntegralItemMgr.reset = function () {
  149. $("#type").val("");
  150. $("#name").val("");
  151. $("#projectType").val("");
  152. $("#active").val("");
  153. }
  154. //回调
  155. IntegralItemMgr.callBack = function (data) {
  156. Feng.info(data.msg);
  157. if (data.code == 200) {
  158. $("#importModal").modal("hide");
  159. IntegralItemMgr.table.refresh();
  160. }
  161. }
  162. $(function () {
  163. var defaultColunms = IntegralItemMgr.initColumn();
  164. var table = new BSTable(IntegralItemMgr.id, "/admin/integral_mgr/itemList", defaultColunms);
  165. table.setPaginationType("server");
  166. IntegralItemMgr.table = table.init();
  167. });