identifyCondition.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /**
  2. * 认定条件管理管理初始化
  3. */
  4. var IdentifyCondition = {
  5. id: "IdentifyConditionTable", //表格id
  6. seItem: null, //选中的条目
  7. table: null,
  8. layerIndex: -1
  9. };
  10. var isShow = false;
  11. /**
  12. * 初始化表格的列
  13. */
  14. IdentifyCondition.initColumn = function () {
  15. return [
  16. {field: 'selectItem', radio: true},
  17. {title: '人才层次', field: 'talentLevel', visible: true, align: 'center', valign: 'middle'},
  18. {title: '人才类别', field: 'type', visible: true, align: 'center', valign: 'middle',
  19. formatter: function (value, row, index) {
  20. if (value == 1) {
  21. return "晋江市现代产业体系人才";
  22. }
  23. if (value == 2) {
  24. return "集成电路优秀人才";
  25. }
  26. }
  27. },
  28. {title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip'},
  29. {title: '有效期', field: 'activeYear', visible: true, align: 'center', valign: 'middle'},
  30. {title: '是否启用', field: 'active', visible: true, align: 'center', valign: 'middle',
  31. formatter: function (value, row, index) {
  32. if (value == 1) {
  33. return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-primary btn-xs\">启用</button>";
  34. }
  35. if (value == 2) {
  36. return "<button type=\"button\" style=\"line-height: 1.3\" class=\"btn btn-warning btn-xs\">停用</button>";
  37. }
  38. }
  39. },
  40. {title: '审核单位', field: 'companyNames', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip'},
  41. {title: '备注', field: 'description', visible: true, align: 'center', valign: 'middle'},
  42. ];
  43. };
  44. /**
  45. * 检查是否选中
  46. */
  47. IdentifyCondition.check = function () {
  48. var selected = $('#' + this.id).bootstrapTable('getSelections');
  49. if (selected.length == 0) {
  50. Feng.info("请先选中表格中的某一记录!");
  51. return false;
  52. } else {
  53. IdentifyCondition.seItem = selected[0];
  54. return true;
  55. }
  56. };
  57. /**
  58. * 点击添加认定条件管理
  59. */
  60. IdentifyCondition.openAddIdentifyCondition = function () {
  61. var index = layer.open({
  62. type: 2,
  63. title: '添加认定条件',
  64. area: ['1126px', '420px'], //宽高
  65. fix: false, //不固定
  66. maxmin: true,
  67. content: Feng.ctxPath + '/admin/talent_condition/add'
  68. });
  69. this.layerIndex = index;
  70. };
  71. /**
  72. * 打开查看认定条件管理详情
  73. */
  74. IdentifyCondition.openIdentifyConditionDetail = function () {
  75. if (this.check()) {
  76. var index = layer.open({
  77. type: 2,
  78. title: '认定条件管理详情',
  79. area: ['1126px', '420px'], //宽高
  80. fix: false, //不固定
  81. maxmin: true,
  82. content: Feng.ctxPath + '/admin/talent_condition/edit/id/' + IdentifyCondition.seItem.id
  83. });
  84. this.layerIndex = index;
  85. }
  86. };
  87. /**
  88. * 删除认定条件管理
  89. */
  90. IdentifyCondition.delete = function () {
  91. if (this.check()) {
  92. var operation = function () {
  93. var ajax = new $ax(Feng.ctxPath + "/admin/talent_condition/delete/id/", function (data) {
  94. Feng.success("删除成功!");
  95. IdentifyCondition.table.refresh();
  96. }, function (data) {
  97. Feng.error("删除失败!" + data.responseJSON.message + "!");
  98. });
  99. ajax.set("id", IdentifyCondition.seItem.id);
  100. ajax.start();
  101. }
  102. Feng.confirm("是否刪除该认定条件?", operation);
  103. }
  104. };
  105. /**
  106. * 查询表单提交参数对象
  107. * @returns {{}}
  108. */
  109. IdentifyCondition.formParams = function () {
  110. var queryData = {};
  111. queryData['talentLevel'] = $("#talentLevel").val();
  112. queryData['type'] = $("#type").val();
  113. queryData['name'] = $("#name").val();
  114. queryData['active'] = $("#active").val();
  115. return queryData;
  116. }
  117. /**
  118. * 查询认定条件管理列表
  119. */
  120. IdentifyCondition.search = function () {
  121. IdentifyCondition.table.refresh({query: IdentifyCondition.formParams()});
  122. };
  123. /**
  124. * 重置
  125. */
  126. IdentifyCondition.reset = function () {
  127. $("#talentLevel").val("");
  128. $("#type").val("");
  129. $("#name").val("");
  130. $("#active").val("");
  131. }
  132. IdentifyCondition.import = function () {
  133. $("#import-form")[0].reset();
  134. $("#importModal").modal("show");
  135. }
  136. IdentifyCondition.importSubmit = function () {
  137. $("#import-form")[0].submit();
  138. }
  139. //回调
  140. IdentifyCondition.callBack = function (data) {
  141. Feng.info(data.msg);
  142. if (data.code == 200) {
  143. $("#importModal").modal("hide");
  144. IdentifyCondition.table.refresh();
  145. }
  146. }
  147. //模板下载
  148. IdentifyCondition.download = function () {
  149. window.location.href = Feng.ctxPath + "/static/downloadFile/identifyConditiontemplate.xlsx";
  150. }
  151. $(function () {
  152. var userTYpe = $("#userType").val();
  153. if (userTYpe == 1) {
  154. isShow = true;
  155. } else {
  156. isShow = false;
  157. }
  158. var defaultColunms = IdentifyCondition.initColumn();
  159. var table = new BSTable(IdentifyCondition.id, "/admin/talent_condition/list", defaultColunms);
  160. table.setPaginationType("server");
  161. IdentifyCondition.table = table.init();
  162. //下拉框数据动态加载
  163. Feng.addAjaxSelect({
  164. "id": "talentLevel",
  165. "displayCode": "code",
  166. "displayName": "name",
  167. "type": "GET",
  168. "url": "/admin/dict/findChildDictByCode?code=talent_arrange"
  169. });
  170. });