integralItemMgr.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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: 'projectName', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip'},
  27. {title: '项目类别', field: 'projectType', visible: true, align: 'center', valign: 'middle',
  28. formatter: function (value, row, index) {
  29. switch (value) {
  30. case 1:
  31. return "基础分";
  32. case 2:
  33. return "贡献分";
  34. case 3:
  35. return "资历分";
  36. }
  37. }
  38. },
  39. {title: '标准名称', field: 'name', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip'},
  40. {title: '是否启用', field: 'active', visible: true, align: 'center', valign: 'middle',
  41. formatter: function (value, row, index) {
  42. if (value == 1) {
  43. return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-primary btn-xs\">启用</button>";
  44. }
  45. if (value == 2) {
  46. return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-warning btn-xs\">停用</button>";
  47. }
  48. }
  49. }
  50. ];
  51. };
  52. /**
  53. * 检查是否选中
  54. */
  55. IntegralItemMgr.check = function () {
  56. var selected = $('#' + this.id).bootstrapTable('getSelections');
  57. if (selected.length == 0) {
  58. Feng.info("请先选中表格中的某一记录!");
  59. return false;
  60. } else {
  61. IntegralItemMgr.seItem = selected[0];
  62. return true;
  63. }
  64. };
  65. /**
  66. * 点击添加积分项目
  67. */
  68. IntegralItemMgr.openAddIntegralProject = function () {
  69. var index = layer.open({
  70. type: 2,
  71. title: '添加积分项目',
  72. area: ['1126px', '420px'], //宽高
  73. fix: false, //不固定
  74. maxmin: true,
  75. content: Feng.ctxPath + '/admin/integral_mgr/addItem'
  76. });
  77. this.layerIndex = index;
  78. };
  79. /**
  80. * 打开编辑积分项目
  81. */
  82. IntegralItemMgr.openEditIntegralProject = function () {
  83. if (this.check()) {
  84. var index = layer.open({
  85. type: 2,
  86. title: '编辑积分项目',
  87. area: ['1126px', '420px'], //宽高
  88. fix: false, //不固定
  89. maxmin: true,
  90. content: Feng.ctxPath + '/admin/integral_mgr/editItem/id/' + IntegralItemMgr.seItem.id
  91. });
  92. this.layerIndex = index;
  93. }
  94. };
  95. /**
  96. * 删除积分项目
  97. */
  98. IntegralItemMgr.delete = function () {
  99. if (this.check()) {
  100. var operation = function () {
  101. var ajax = new $ax(Feng.ctxPath + "/admin/integral_mgr/deleteItem/id/", function (data) {
  102. Feng.success("删除成功!");
  103. IntegralItemMgr.table.refresh();
  104. }, function (data) {
  105. Feng.error("删除失败!" + data.responseJSON.message + "!");
  106. });
  107. ajax.set("id", IntegralItemMgr.seItem.id);
  108. ajax.start();
  109. }
  110. Feng.confirm("是否刪除该积分标准?", operation);
  111. }
  112. };
  113. /**
  114. * 查询表单提交参数对象
  115. * @returns {{}}
  116. */
  117. IntegralItemMgr.formParams = function () {
  118. var queryData = {};
  119. queryData['type'] = $("#type").val();
  120. queryData['name'] = $("#name").val();
  121. queryData['projectType'] = $("#projectType").val();
  122. queryData['active'] = $("#active").val();
  123. return queryData;
  124. }
  125. /**
  126. * 查询认定条件管理列表
  127. */
  128. IntegralItemMgr.search = function () {
  129. IntegralItemMgr.table.refresh({query: IntegralItemMgr.formParams()});
  130. };
  131. /**
  132. * 重置
  133. */
  134. IntegralItemMgr.reset = function () {
  135. $("#type").val("");
  136. $("#name").val("");
  137. $("#projectType").val("");
  138. $("#active").val("");
  139. }
  140. //回调
  141. IntegralItemMgr.callBack = function (data) {
  142. Feng.info(data.msg);
  143. if (data.code == 200) {
  144. $("#importModal").modal("hide");
  145. IntegralItemMgr.table.refresh();
  146. }
  147. }
  148. $(function () {
  149. var defaultColunms = IntegralItemMgr.initColumn();
  150. var table = new BSTable(IntegralItemMgr.id, "/admin/integral_mgr/itemList", defaultColunms);
  151. table.setPaginationType("server");
  152. IntegralItemMgr.table = table.init();
  153. });