amountStandard.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /**
  2. * 人才津贴配置管理初始化
  3. */
  4. var AmountStandard = {
  5. id: "AmountStandardTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. /**
  11. * 初始化表格的列
  12. */
  13. AmountStandard.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. if (value == 5) {
  25. return "卫健人才";
  26. }
  27. if (value == 6) {
  28. return "高教人才";
  29. }
  30. }
  31. },
  32. {title: '津贴类别', field: 'allowanceType', visible: true, align: 'center', valign: 'middle',
  33. formatter: function (value, row, index) {
  34. if (value == 1) {
  35. return "工作津贴";
  36. }
  37. if (value == 2) {
  38. return "一次性交通津贴";
  39. }
  40. }
  41. },
  42. {title: '人才层次', field: 'talentArrangeName', visible: true, align: 'center', valign: 'middle'},
  43. {title: '金额', field: 'money', visible: true, align: 'center', valign: 'middle'},
  44. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle'}
  45. ];
  46. };
  47. /**
  48. * 检查是否选中
  49. */
  50. AmountStandard.check = function () {
  51. var selected = $('#' + this.id).bootstrapTable('getSelections');
  52. if (selected.length == 0) {
  53. Feng.info("请先选中表格中的某一记录!");
  54. return false;
  55. } else {
  56. AmountStandard.seItem = selected[0];
  57. return true;
  58. }
  59. };
  60. /**
  61. * 点击添加人才津贴配置
  62. */
  63. AmountStandard.openAddAmountStandard = function () {
  64. var index = layer.open({
  65. type: 2,
  66. title: '添加人才津贴配置',
  67. area: ['800px', '420px'], //宽高
  68. fix: false, //不固定
  69. maxmin: true,
  70. content: Feng.ctxPath + '/admin/amountStandard/add'
  71. });
  72. this.layerIndex = index;
  73. };
  74. /**
  75. * 打开查看人才津贴配置详情
  76. */
  77. AmountStandard.openAmountStandardDetail = function () {
  78. if (this.check()) {
  79. var index = layer.open({
  80. type: 2,
  81. title: '人才津贴配置详情',
  82. area: ['800px', '420px'], //宽高
  83. fix: false, //不固定
  84. maxmin: true,
  85. content: Feng.ctxPath + '/admin/amountStandard/edit/id/' + AmountStandard.seItem.id
  86. });
  87. this.layerIndex = index;
  88. }
  89. };
  90. /**
  91. * 删除人才津贴配置
  92. */
  93. AmountStandard.delete = function () {
  94. if (this.check()) {
  95. var operation = function () {
  96. var ajax = new $ax(Feng.ctxPath + "/admin/amountStandard/delete", function (data) {
  97. if (data.code == 200) {
  98. AmountStandard.table.refresh();
  99. Feng.success(data.msg);
  100. } else {
  101. Feng.info(data.msg);
  102. }
  103. }, function (data) {
  104. Feng.error("删除失败!" + data.responseJSON.message + "!");
  105. });
  106. ajax.set("id", AmountStandard.seItem.id);
  107. ajax.start();
  108. };
  109. Feng.confirm("确定要删除吗?", operation);
  110. }
  111. };
  112. /**
  113. * 查询表单提交参数对象
  114. * @returns {{}}
  115. */
  116. AmountStandard.formParams = function () {
  117. var queryData = {};
  118. queryData['type'] = $("#type").val();
  119. queryData['allowanceType'] = $("#allowanceType").val();
  120. return queryData;
  121. }
  122. /**
  123. * 查询批次管理列表
  124. */
  125. AmountStandard.search = function () {
  126. AmountStandard.table.refresh({query: AmountStandard.formParams()});
  127. };
  128. /**
  129. * 重置
  130. */
  131. AmountStandard.reset = function () {
  132. $("#type").val("");
  133. $("#allowanceType").val("");
  134. }
  135. $(function () {
  136. var defaultColunms = AmountStandard.initColumn();
  137. var table = new BSTable(AmountStandard.id, "/admin/amountStandard/list", defaultColunms);
  138. table.setPaginationType("server");
  139. AmountStandard.table = table.init();
  140. });