IntegralVerify_library.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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: 'totalPoints', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
  49. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: '80px',
  50. formatter: function (value, row, index) {
  51. return "<span class='label label-success' onclick=\"IntegralInfo.showIntegralLog('" + row.card_type + "','" + row.card_number + "')\" >" +
  52. "<i class=\"fa fa-history\"></i> 积分记录" +
  53. "</span>";
  54. }
  55. }
  56. ];
  57. };
  58. IntegralInfo.openIntegralLog = function () {
  59. if (this.check()) {
  60. IntegralInfo.showIntegralLog(IntegralInfo.seItem.card_type, IntegralInfo.seItem.card_number);
  61. }
  62. }
  63. /**
  64. * 显示积分记录
  65. */
  66. IntegralInfo.showIntegralLog = function (card_type, card_number) {
  67. layer.open({
  68. type: 2,
  69. title: "积分记录",
  70. fixed: false,
  71. content: '/admin/integralVerify/integralLog/cardType/' + card_type + '/cardNumber/' + card_number,
  72. area: ['80%', '80%'],
  73. fix: false, //不固定
  74. maxmin: true
  75. });
  76. }
  77. /**
  78. * 检查是否选中
  79. */
  80. IntegralInfo.check = function () {
  81. var selected = $('#' + this.id).bootstrapTable('getSelections');
  82. if (selected.length == 0) {
  83. Feng.info("请先选中表格中的某一记录!");
  84. return false;
  85. } else {
  86. IntegralInfo.seItem = selected[0];
  87. return true;
  88. }
  89. };
  90. /**
  91. * 打开查看积分申报-初级审核详情
  92. */
  93. IntegralInfo.openIntegralInfoDetail = function () {
  94. if (this.check()) {
  95. var index = layer.open({
  96. type: 2,
  97. title: '人才认定审核详情',
  98. area: ['800px', '420px'], //宽高
  99. fix: false, //不固定
  100. maxmin: true,
  101. content: '/admin/integralVerify/detail/id/' + IntegralInfo.seItem.id
  102. });
  103. layer.full(index);
  104. IntegralInfo.layerIndex = index;
  105. }
  106. };
  107. IntegralInfo.openCheckModal = function (type) {
  108. if ((type == 2 && this.check()) || type == 1) {
  109. var selected = $('#' + this.id).bootstrapTable('getSelections');
  110. selected = selected.length > 0 ? selected[0] : [];
  111. var subtitle = type == 2 ? "个人" : "企业";
  112. var enterprise_id = selected.enterprise_id;
  113. var card_type = selected.card_type;
  114. var card_number = selected.card_number;
  115. var ajax = new $ax("/admin/integralVerify/veto", function (data) {
  116. if (data.code == 200) {
  117. layer.open({
  118. type: 1,
  119. id: "newVetoModalForm",
  120. title: '一票否决(' + subtitle + ")",
  121. area: ['800px', '350px'], //宽高
  122. fix: false, //不固定
  123. shade: 0,
  124. maxmin: true,
  125. content: IntegralInfo.createVetoFormModal(),
  126. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  127. btnAlign: 'c',
  128. zIndex: layer.zIndex,
  129. success: function (layero, index) {
  130. $("#vetoForm")[0].reset();
  131. $("#vetoType").html('<option value="' + type + '">' + subtitle + '</option>');
  132. var veto = data.veto;
  133. var list = "";
  134. if (type == 1) {
  135. for (var i in data.enterprises) {
  136. 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>';
  137. }
  138. } else {
  139. list += '<option>' + veto.name + '</option>';
  140. }
  141. $("#vetoObj").html(list);
  142. $("#vetoCheckState").val(veto.active == 1 || typeof veto.active == "undefined" ? 1 : 2);
  143. $("#vetoMsg").html(veto.description);
  144. },
  145. yes: function (index, layero) {
  146. IntegralInfo.submitVeto(index, type);
  147. }
  148. });
  149. } else {
  150. Feng.error(data.msg);
  151. }
  152. }, function (data) {
  153. Feng.error("校验失败!" + data.responseJSON.message + "!");
  154. });
  155. ajax.setData({type: type, card_type: card_type, card_number: card_number, enterprise_id: enterprise_id})
  156. ajax.start();
  157. }
  158. }
  159. var locked = false;
  160. /**
  161. * 提交一票否决
  162. */
  163. IntegralInfo.submitVeto = function (i, type) {
  164. var checkState = $("#vetoCheckState").val();
  165. var checkMsg = $("#vetoMsg").val();
  166. var vetoObj = $("#vetoObj").val();
  167. if (checkState == null || checkState == '') {
  168. Feng.info("请选择否决状态");
  169. return;
  170. }
  171. if (checkMsg == null || checkMsg == '') {
  172. Feng.info("请填写意见");
  173. return;
  174. }
  175. var card_type = "";
  176. var card_number = "";
  177. if (type == 2 && this.check()) {
  178. card_type = IntegralInfo.seItem.card_type;
  179. card_number = IntegralInfo.seItem.card_number;
  180. }
  181. if (type == 1 && !vetoObj) {
  182. Feng.info("请选择企业");
  183. return;
  184. }
  185. if (locked)
  186. return;
  187. locked = true;
  188. var ajax = new $ax(Feng.ctxPath + "/admin/integralVerify/submitVeto", function (data) {
  189. if (data.code == 200) {
  190. Feng.success(data.msg);
  191. window.parent.IntegralInfo.table.refresh();
  192. layer.close(i);
  193. } else {
  194. Feng.error(data.msg);
  195. }
  196. locked = false;
  197. }, function (data) {
  198. Feng.error("提交失败!" + data.responseJSON.message + "!");
  199. locked = false;
  200. });
  201. ajax.setData({"checkState": checkState, "checkMsg": checkMsg, type: type, card_type: card_type, card_number: card_number, enterprise_id: vetoObj});
  202. ajax.start();
  203. }
  204. IntegralInfo.createVetoFormModal = function () {
  205. return '<form id="vetoForm">\n' +
  206. ' <div class="form-group" style="margin: 10px;">\n' +
  207. ' <div class="row" style="margin-bottom: 10px;">\n' +
  208. ' <label class="col-sm-2 control-label">类型</label>\n' +
  209. ' <div class="col-sm-10">\n' +
  210. ' <select id="vetoType" name="vetoType" class="form-control">\n' +
  211. ' </select>\n' +
  212. ' </div>\n' +
  213. ' </div>\n' +
  214. ' <div class="row" style="margin-bottom: 10px;">\n' +
  215. ' <label class="col-sm-2 control-label">名称</label>\n' +
  216. ' <div class="col-sm-10">\n' +
  217. ' <select id="vetoObj" name="vetoObj" class="form-control">\n' +
  218. ' </select>\n' +
  219. ' </div>\n' +
  220. ' </div>\n' +
  221. ' <div class="row" style="margin-bottom: 10px;">\n' +
  222. ' <label class="col-sm-2 control-label">状态</label>\n' +
  223. ' <div class="col-sm-10">\n' +
  224. ' <select id="vetoCheckState" name="vetoCheckState" class="form-control">\n' +
  225. ' <option value="1">一票否决</option>\n' +
  226. ' <option value="2">恢复</option>\n' +
  227. ' </select>\n' +
  228. ' </div>\n' +
  229. ' </div>\n' +
  230. ' <div class="row">\n' +
  231. ' <label class="col-sm-2 control-label">意见</label>\n' +
  232. ' <div class="col-sm-10">\n' +
  233. ' <textarea id="vetoMsg" name="vetoMsg" class="form-control"></textarea>\n' +
  234. ' </div>\n' +
  235. ' </div>\n' +
  236. ' </div>\n' +
  237. '</form>';
  238. }
  239. /**
  240. * 选择导出提交
  241. */
  242. IntegralInfo.checkExport = function () {
  243. var selected = $('#dataTable').bootstrapTable('getSelections');
  244. if (!selected || selected.length < 1) {
  245. Feng.info("请至少选择一行数据!");
  246. return;
  247. }
  248. var ids = "";
  249. for (var i = 0; i < selected.length; i++) {
  250. ids = ids + selected[i].id + ",";
  251. }
  252. window.location.href = Feng.ctxPath + "/admin/integralVerify/prepareHczx?ids=" + ids;
  253. }
  254. //回调
  255. IntegralInfo.callBack = function (data) {
  256. Feng.info(data.msg);
  257. if (data.code == 200) {
  258. $("#hczxModal").modal("hide");
  259. IntegralInfo.table.refresh();
  260. }
  261. }
  262. $(function () {
  263. var defaultColunms = IntegralInfo.initColumn();
  264. var table = new BSTable(IntegralInfo.id, "/admin/integralVerify/list/process/4", defaultColunms);
  265. table.setPaginationType("server");
  266. table.setSingleSelect(false);
  267. table.setOnDblClickRow(function () {
  268. //IntegralInfo.openIntegralInfoDetail();
  269. });
  270. var t = IntegralInfo.table = table.init();
  271. IntegralInfo.init();
  272. $('#checkAll').click(function () {
  273. $("#dataTable").bootstrapTable('togglePagination').bootstrapTable('checkAll').bootstrapTable('togglePagination');
  274. })
  275. $('#uncheckAll').click(function () {
  276. $("#dataTable").bootstrapTable('togglePagination').bootstrapTable('uncheckAll').bootstrapTable('togglePagination')
  277. })
  278. });