identifyCondition.js 6.6 KB

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