IntegralVerify_library.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. /**
  2. * 人才认定申报管理初始化
  3. */
  4. var IntegralInfo = {
  5. id: "IntegralInfoTable", //表格id
  6. checkAll: false,
  7. seItem: null, //选中的条目
  8. table: null,
  9. layerIndex: -1
  10. };
  11. /**
  12. * 初始化表格的列
  13. */
  14. IntegralInfo.initColumn = function () {
  15. var type = $("#usertype").val();
  16. var isShow = true;
  17. if (type == 2) {
  18. isShow = false;
  19. }
  20. ;
  21. return [
  22. {field: 'selectItem', radio: true},
  23. {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle', width: "100px",
  24. formatter: function (value, row, index) {
  25. if (row.sex == 1) {
  26. return value + '<span style="color:#6495ED">【男】</span>';
  27. } else if (row.sex == 2) {
  28. return value + '<span style="color:#FF82AB">【女】</span>';
  29. } else {
  30. return value;
  31. }
  32. }
  33. },
  34. {title: '所属单位', field: 'enterpriseName', visible: true, align: 'center', valign: 'middle', width: "100px"},
  35. {title: '证件类型', field: 'card_type', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px",
  36. formatter: function (value, row, index) {
  37. switch (value) {
  38. case 1:
  39. return "身份证";
  40. case 2:
  41. return "港澳通行证";
  42. case 3:
  43. return "护照";
  44. }
  45. }
  46. },
  47. {title: '证件号码', field: 'card_number', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
  48. {title: '人才层次', field: 'talentLevel', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px",
  49. formatter: function (value, row, index) {
  50. var talentLevel = parseInt(value);
  51. switch (talentLevel) {
  52. case 1:
  53. return "第一层次";
  54. case 2:
  55. return "第二层次";
  56. case 3:
  57. return "第三层次";
  58. case 4:
  59. return "第四层次";
  60. case 5:
  61. return "第五层次";
  62. case 6:
  63. return "第六层次";
  64. case 7:
  65. return "第七层次";
  66. default:
  67. return "非优秀人才";
  68. }
  69. }},
  70. {title: '基础分', field: 'basePoints', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
  71. {title: '总积分', field: 'totalPoints', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
  72. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: '80px',
  73. formatter: function (value, row, index) {
  74. return "<span class='label label-success' onclick=\"IntegralInfo.showIntegralLog('" + row.card_type + "','" + row.card_number + "')\" >" +
  75. "<i class=\"fa fa-history\"></i> 积分记录" +
  76. "</span>";
  77. }
  78. }
  79. ];
  80. };
  81. IntegralInfo.openIntegralLog = function () {
  82. if (this.check()) {
  83. IntegralInfo.showIntegralLog(IntegralInfo.seItem.card_type, IntegralInfo.seItem.card_number);
  84. }
  85. }
  86. /**
  87. * 显示积分记录
  88. */
  89. IntegralInfo.showIntegralLog = function (card_type, card_number) {
  90. layer.open({
  91. type: 2,
  92. title: "积分记录",
  93. fixed: false,
  94. content: '/admin/integralVerify/integralLog/cardType/' + card_type + '/cardNumber/' + card_number,
  95. area: ['80%', '80%'],
  96. fix: false, //不固定
  97. maxmin: true
  98. });
  99. }
  100. /**
  101. * 检查是否选中
  102. */
  103. IntegralInfo.check = function () {
  104. var selected = $('#' + this.id).bootstrapTable('getSelections');
  105. if (selected.length == 0) {
  106. Feng.info("请先选中表格中的某一记录!");
  107. return false;
  108. } else {
  109. IntegralInfo.seItem = selected[0];
  110. return true;
  111. }
  112. };
  113. /**
  114. * 打开查看积分申报-初级审核详情
  115. */
  116. IntegralInfo.openIntegralInfoDetail = function () {
  117. if (this.check()) {
  118. var index = layer.open({
  119. type: 2,
  120. title: '人才认定审核详情',
  121. area: ['800px', '420px'], //宽高
  122. fix: false, //不固定
  123. maxmin: true,
  124. content: '/admin/integralVerify/detail/id/' + IntegralInfo.seItem.id
  125. });
  126. layer.full(index);
  127. IntegralInfo.layerIndex = index;
  128. }
  129. };
  130. IntegralInfo.openCheckModal = function (type) {
  131. if ((type == 2 && this.check()) || type == 1) {
  132. var selected = $('#' + this.id).bootstrapTable('getSelections');
  133. selected = selected.length > 0 ? selected[0] : [];
  134. var subtitle = type == 2 ? "个人" : "企业";
  135. var enterprise_id = selected.enterprise_id;
  136. var card_type = selected.card_type;
  137. var card_number = selected.card_number;
  138. var ajax = new $ax("/admin/integralVerify/veto", function (data) {
  139. if (data.code == 200) {
  140. layer.open({
  141. type: 1,
  142. id: "newVetoModalForm",
  143. title: '一票否决(' + subtitle + ")",
  144. area: ['800px', '350px'], //宽高
  145. fix: false, //不固定
  146. shade: 0,
  147. maxmin: true,
  148. content: IntegralInfo.createVetoFormModal(),
  149. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  150. btnAlign: 'c',
  151. zIndex: layer.zIndex,
  152. success: function (layero, index) {
  153. $("#vetoForm")[0].reset();
  154. $("#vetoType").html('<option value="' + type + '">' + subtitle + '</option>');
  155. var veto = data.veto;
  156. var list = "";
  157. if (type == 1) {
  158. for (var i in data.enterprises) {
  159. list += '<option value="' + data.enterprises[i].id + '" ' + (typeof veto.enterprise_id != "undefined" && veto.enterprise_id == data.enterprises[i].id ? "selected" : "") + '>' + data.enterprises[i].name + '</option>';
  160. }
  161. } else {
  162. list += '<option>' + veto.name + '</option>';
  163. }
  164. $("#vetoObj").html(list);
  165. $("#vetoCheckState").val(veto.active == 1 || typeof veto.active == "undefined" ? 1 : 2);
  166. $("#vetoMsg").html(veto.description);
  167. },
  168. yes: function (index, layero) {
  169. IntegralInfo.submitVeto(index, type);
  170. }
  171. });
  172. } else {
  173. Feng.error(data.msg);
  174. }
  175. }, function (data) {
  176. Feng.error("校验失败!" + data.responseJSON.message + "!");
  177. });
  178. ajax.setData({type: type, card_type: card_type, card_number: card_number, enterprise_id: enterprise_id})
  179. ajax.start();
  180. }
  181. }
  182. var locked = false;
  183. /**
  184. * 提交一票否决
  185. */
  186. IntegralInfo.submitVeto = function (i, type) {
  187. var checkState = $("#vetoCheckState").val();
  188. var checkMsg = $("#vetoMsg").val();
  189. var vetoObj = $("#vetoObj").val();
  190. if (checkState == null || checkState == '') {
  191. Feng.info("请选择否决状态");
  192. return;
  193. }
  194. if (checkMsg == null || checkMsg == '') {
  195. Feng.info("请填写意见");
  196. return;
  197. }
  198. var card_type = "";
  199. var card_number = "";
  200. if (type == 2 && this.check()) {
  201. card_type = IntegralInfo.seItem.card_type;
  202. card_number = IntegralInfo.seItem.card_number;
  203. }
  204. if (type == 1 && !vetoObj) {
  205. Feng.info("请选择企业");
  206. return;
  207. }
  208. if (locked)
  209. return;
  210. locked = true;
  211. var ajax = new $ax(Feng.ctxPath + "/admin/integralVerify/submitVeto", function (data) {
  212. if (data.code == 200) {
  213. Feng.success(data.msg);
  214. window.parent.IntegralInfo.table.refresh();
  215. layer.close(i);
  216. } else {
  217. Feng.error(data.msg);
  218. }
  219. locked = false;
  220. }, function (data) {
  221. Feng.error("提交失败!" + data.responseJSON.message + "!");
  222. locked = false;
  223. });
  224. ajax.setData({"checkState": checkState, "checkMsg": checkMsg, type: type, card_type: card_type, card_number: card_number, enterprise_id: vetoObj});
  225. ajax.start();
  226. }
  227. IntegralInfo.createVetoFormModal = function () {
  228. return '<form id="vetoForm">\n' +
  229. ' <div class="form-group" style="margin: 10px;">\n' +
  230. ' <div class="row" style="margin-bottom: 10px;">\n' +
  231. ' <label class="col-sm-2 control-label">类型</label>\n' +
  232. ' <div class="col-sm-10">\n' +
  233. ' <select id="vetoType" name="vetoType" class="form-control">\n' +
  234. ' </select>\n' +
  235. ' </div>\n' +
  236. ' </div>\n' +
  237. ' <div class="row" style="margin-bottom: 10px;">\n' +
  238. ' <label class="col-sm-2 control-label">名称</label>\n' +
  239. ' <div class="col-sm-10">\n' +
  240. ' <select id="vetoObj" name="vetoObj" class="form-control">\n' +
  241. ' </select>\n' +
  242. ' </div>\n' +
  243. ' </div>\n' +
  244. ' <div class="row" style="margin-bottom: 10px;">\n' +
  245. ' <label class="col-sm-2 control-label">状态</label>\n' +
  246. ' <div class="col-sm-10">\n' +
  247. ' <select id="vetoCheckState" name="vetoCheckState" class="form-control">\n' +
  248. ' <option value="1">一票否决</option>\n' +
  249. ' <option value="2">恢复</option>\n' +
  250. ' </select>\n' +
  251. ' </div>\n' +
  252. ' </div>\n' +
  253. ' <div class="row">\n' +
  254. ' <label class="col-sm-2 control-label">意见</label>\n' +
  255. ' <div class="col-sm-10">\n' +
  256. ' <textarea id="vetoMsg" name="vetoMsg" class="form-control"></textarea>\n' +
  257. ' </div>\n' +
  258. ' </div>\n' +
  259. ' </div>\n' +
  260. '</form>';
  261. }
  262. /**
  263. * 选择导出提交
  264. */
  265. IntegralInfo.checkExport = function () {
  266. var selected = $('#dataTable').bootstrapTable('getSelections');
  267. if (!selected || selected.length < 1) {
  268. Feng.info("请至少选择一行数据!");
  269. return;
  270. }
  271. var ids = "";
  272. for (var i = 0; i < selected.length; i++) {
  273. ids = ids + selected[i].id + ",";
  274. }
  275. window.location.href = Feng.ctxPath + "/admin/integralVerify/prepareHczx?ids=" + ids;
  276. }
  277. //回调
  278. IntegralInfo.callBack = function (data) {
  279. Feng.info(data.msg);
  280. if (data.code == 200) {
  281. $("#hczxModal").modal("hide");
  282. IntegralInfo.table.refresh();
  283. }
  284. }
  285. $(function () {
  286. var defaultColunms = IntegralInfo.initColumn();
  287. var table = new BSTable(IntegralInfo.id, "/admin/integralVerify/list/process/4", defaultColunms);
  288. table.setPaginationType("server");
  289. table.setSingleSelect(false);
  290. table.setOnDblClickRow(function () {
  291. //IntegralInfo.openIntegralInfoDetail();
  292. });
  293. var t = IntegralInfo.table = table.init();
  294. IntegralInfo.init();
  295. $('#checkAll').click(function () {
  296. $("#dataTable").bootstrapTable('togglePagination').bootstrapTable('checkAll').bootstrapTable('togglePagination');
  297. })
  298. $('#uncheckAll').click(function () {
  299. $("#dataTable").bootstrapTable('togglePagination').bootstrapTable('uncheckAll').bootstrapTable('togglePagination')
  300. })
  301. });