enterprise_list.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. var Enterprise = {
  2. id: "table", //表格id
  3. seItem: null, //选中的条目
  4. table: null,
  5. layerIndex: -1
  6. };
  7. Enterprise.initColumn = function () {
  8. var type = $("#type").val();
  9. return [
  10. {field: 'selectItem', radio: true},
  11. {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
  12. {title: '账号', field: 'username', visible: true, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  13. {title: '学校名称', field: 'name', visible: true, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  14. {title: '法人代表', field: 'legal', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  15. {title: '学校电话', field: 'ephone', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  16. {title: '人才联络员', field: 'agentName', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  17. {title: '人才联络员电话', field: 'agentPhone', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  18. {title: '审核状态', field: 'checkState', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip',
  19. formatter: function (value, row, index) {
  20. if (value == null || value == '') {
  21. return "";
  22. } else if (value == 1) {
  23. return "未审核";
  24. } else if (value == 2) {
  25. return "审核驳回";
  26. } else if (value == 3) {
  27. return "审核通过";
  28. } else if (value == 4) {
  29. return "重新提交";
  30. } else if (value == 5) {
  31. return "初审驳回";
  32. } else if (value == 6) {
  33. return "初审通过";
  34. }
  35. },
  36. cellStyle: function (value, row, index) {
  37. if (value == null || value === '') {
  38. return {css: {}};
  39. } else if (value === 1) {
  40. return {css: {"background-color": "LightGrey"}};
  41. } else if (value === 3) {
  42. return {css: {'background-color': 'LightGreen'}};
  43. } else if (value === 2) {
  44. return {css: {"background-color": "Orange"}};
  45. } else if (value === 4) {
  46. return {css: {'background-color': 'LightGrey'}};
  47. } else if (value === 5) {
  48. return {css: {'background-color': 'Orange'}};
  49. } else if (value === 6) {
  50. return {css: {"background-color": "LightBlue"}};
  51. } else {
  52. return {css: {}};
  53. }
  54. }
  55. },
  56. {title: '账号状态', field: 'active', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip',
  57. formatter: function (value, row, index) {
  58. if (value == null || value == '') {
  59. return "";
  60. } else if (value == 1) {
  61. return "账号有效";
  62. } else if (value == 2) {
  63. return "拉黑/冻结";
  64. }
  65. },
  66. cellStyle: function (value, row, index) {
  67. if (value == null || value === '') {
  68. return {css: {}};
  69. } else if (value === 1) {
  70. return {css: {'background-color': 'LightGreen'}};
  71. } else if (value === 2) {
  72. return {css: {"background-color": "Orange"}};
  73. } else {
  74. return {css: {}};
  75. }
  76. }
  77. },
  78. {title: '注册时间', field: 'createTime', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  79. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
  80. formatter: function (value, row, index) {
  81. return "<span class='label label-success' onclick=\"Enterprise.showLog('" + value + "')\" >" +
  82. "<i class=\"fa fa-book\"></i>日志" +
  83. "</span>";
  84. }
  85. }
  86. ];
  87. };
  88. Enterprise.formParam = function () {
  89. var queryData = {};
  90. queryData['name'] = $("#name").val();
  91. queryData['idCard'] = $("#idCard").val();
  92. queryData['legal'] = $("#legal").val();
  93. queryData['ephone'] = $("#ephone").val();
  94. queryData['agentName'] = $("#agentName").val();
  95. queryData['agentPhone'] = $("#agentPhone").val();
  96. queryData['checkState'] = $("#checkState").val();
  97. queryData['active'] = $("#active").val();
  98. queryData['street'] = $("#street").val();
  99. queryData['special'] = $("#special").val();
  100. queryData['agencyType'] = $("#agencyType").val();
  101. queryData['industryFieldNew'] = $("#industryFieldNew").val();
  102. queryData['industryFieldOld'] = $("#industryFieldOld").val();
  103. queryData['enterpriseTag'] = $("#enterpriseTag").val();
  104. queryData['enterpriseType'] = $("#enterpriseType").val();
  105. return queryData;
  106. }
  107. Enterprise.search = function () {
  108. Enterprise.table.refresh({"query": Enterprise.formParam()});
  109. };
  110. Enterprise.reset = function () {
  111. $("#name").val("");
  112. $("#legal").val("");
  113. $("#ephone").val("");
  114. $("#agentName").val("");
  115. $("#agentPhone").val("");
  116. $("#checkState").val("");
  117. $("#active").val("");
  118. };
  119. Enterprise.gotoEnterpriseDetailPage = function () {
  120. if (!Enterprise.check()) {
  121. return;
  122. }
  123. var index = layer.open({
  124. type: 2,
  125. title: '查看详情',
  126. area: ['830px', '450px'], //宽高
  127. fix: false, //不固定
  128. maxmin: true,
  129. content: Feng.ctxPath + '/admin/enterprise/gotoEnterpriseDetailPage?id=' + Enterprise.seItem.id,
  130. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;审核', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  131. btnAlign: 'c',
  132. yes: function (index, layero) {
  133. Enterprise.doExamine();
  134. }
  135. });
  136. layer.full(index);
  137. Enterprise.layerIndex = index;
  138. };
  139. Enterprise.delEnterprise = function () {
  140. if (!Enterprise.check()) {
  141. return;
  142. }
  143. Feng.confirm(
  144. "确定删除吗?",
  145. function () {
  146. var ajax = new $ax(Feng.ctxPath + "/admin/enterprise/delEnterprise?id=" + Enterprise.seItem.id, function (data) {
  147. Feng.info(data.msg);
  148. if (data.code == 200) {
  149. Enterprise.table.refresh();
  150. }
  151. }, function (data) {
  152. Feng.error("操作失败!");
  153. });
  154. ajax.set(null);
  155. ajax.start();
  156. }
  157. );
  158. };
  159. Enterprise.setActive = function () {
  160. if (!Enterprise.check()) {
  161. return;
  162. }
  163. var index = layer.open({
  164. type: 2,
  165. title: '设置冻结',
  166. area: ['830px', '500px'], //宽高
  167. fix: false, //不固定
  168. maxmin: true,
  169. content: Feng.ctxPath + '/admin/enterprise/gotoActivePage?id=' + Enterprise.seItem.id,
  170. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  171. btnAlign: 'c',
  172. yes: function (index, layero) {
  173. //按钮【按钮一】的回调
  174. var iframeWin = window[layero.find('iframe')[0]['name']];
  175. iframeWin.EpActive.addSubmit();
  176. }
  177. });
  178. // layer.full(index);
  179. Enterprise.layerIndex = index;
  180. };
  181. Enterprise.doExamine = function () {
  182. if (!Enterprise.check()) {
  183. return;
  184. }
  185. var inCheckList = [1, 4, 6];
  186. if (Enterprise.seItem.checkState == null || inCheckList.indexOf(Enterprise.seItem.checkState) == -1) {
  187. Feng.info("不在审核范围内!");
  188. return;
  189. }
  190. var index = layer.open({
  191. type: 2,
  192. title: '审核',
  193. area: ['830px', '500px'], //宽高
  194. fix: false, //不固定
  195. maxmin: true,
  196. shade: 0,
  197. content: Feng.ctxPath + '/admin/enterprise/gotoExaminePage?id=' + Enterprise.seItem.id,
  198. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;提交', '<i class="fa fa-save"></i>&nbsp;&nbsp;保存', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  199. btnAlign: 'c',
  200. yes: function (index, layero) {
  201. //按钮【按钮一】的回调
  202. layer.confirm("确认提交审核结果?", function () {
  203. var iframeWin = window[layero.find('iframe')[0]['name']];
  204. iframeWin.EpExam.submitToCheck();
  205. })
  206. },
  207. btn2: function (index, layero) {
  208. var iframeWin = window[layero.find('iframe')[0]['name']];
  209. iframeWin.EpExam.addSubmit();
  210. return false;
  211. }
  212. });
  213. // layer.full(index);
  214. };
  215. /**
  216. * 修改驳回的字段及附件
  217. */
  218. Enterprise.updateFieldsAndFiles = function () {
  219. if (this.check()) {
  220. var id = Enterprise.seItem.id;
  221. var ajax = new $ax("/admin/enterprise/findFieldsAndFiles?id=" + id, function (data) {
  222. if (data.code == 200) {
  223. layer.open({
  224. type: 1,
  225. id: "fieldCheckModalForm",
  226. title: '修改',
  227. area: ['800px', '450px'], //宽高
  228. fix: false, //不固定
  229. shade: 0,
  230. maxmin: true,
  231. content: Enterprise.creatFieldCheckModal(),
  232. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  233. btnAlign: 'c',
  234. zIndex: layer.zIndex,
  235. success: function (layero, index) {
  236. var fileList = data.files;
  237. var fieldList = data.fields;
  238. var html_field = '';
  239. var html_file = '';
  240. for (var key in fieldList) {
  241. html_field = html_field + '<li><input type="checkbox" ' + (fieldList[key].checked ? "checked" : "") + ' value="' + fieldList[key].field + '"><span>' + fieldList[key].name + '</span></li>';
  242. }
  243. for (var key in fileList) {
  244. html_file = html_file + '<li style="width: 100%"><input type="checkbox" ' + (fileList[key].checked ? "checked" : "") + ' value="' + fileList[key].field + '"><span>' + fileList[key].name + '</span></li>';
  245. }
  246. $("#field_info").empty().append("<ul>" + html_field + "</ul>");
  247. $("#field_file").empty().append("<ul>" + html_file + "</ul>");
  248. },
  249. yes: function (index, layero) {
  250. Enterprise.submitFieldsAndFiles(index, id);
  251. }
  252. });
  253. } else {
  254. Feng.error(data.msg);
  255. }
  256. }, function (data) {
  257. Feng.error("查询失败!" + data.responseJSON.message + "!");
  258. });
  259. ajax.start();
  260. }
  261. };
  262. /**
  263. * 已通过再驳回
  264. */
  265. Enterprise.forceReject = function () {
  266. if (this.check()) {
  267. if (Enterprise.seItem.checkState != 3) {
  268. Feng.info("该操作只能对已通过学校进行驳回!");
  269. return;
  270. }
  271. var index = layer.open({
  272. type: 2,
  273. title: '驳回已通过学校',
  274. area: ['830px', '500px'], //宽高
  275. fix: false, //不固定
  276. maxmin: true,
  277. shade: 0,
  278. content: Feng.ctxPath + '/admin/enterprise/gotoRejectPage?id=' + Enterprise.seItem.id,
  279. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  280. btnAlign: 'c',
  281. yes: function (index, layero) {
  282. //按钮【按钮一】的回调
  283. layer.confirm("确认驳回该学校?", function () {
  284. var iframeWin = window[layero.find('iframe')[0]['name']];
  285. iframeWin.EpExam.submitToReject();
  286. })
  287. }
  288. });
  289. // layer.full(index);
  290. }
  291. }
  292. /**
  293. * 修改提交
  294. * @param index
  295. * @param id
  296. */
  297. Enterprise.submitFieldsAndFiles = function (index, id) {
  298. var fields = '';
  299. var files = '';
  300. $("#field_info li input").each(function (index) {
  301. if ($(this).is(":checked")) {
  302. fields = fields + $(this).val() + ",";
  303. }
  304. });
  305. $("#field_file li input").each(function (index) {
  306. if ($(this).is(":checked")) {
  307. files = files + $(this).val() + ",";
  308. }
  309. });
  310. if (fields == '' && files == '') {
  311. Feng.info("请选择可修改的字段或附件!");
  312. return;
  313. }
  314. var ajax = new $ax("/admin/enterprise/updateFieldsAndFiles", function (data) {
  315. if (data.code == 200) {
  316. layer.close(index);
  317. Feng.success(data.msg);
  318. } else {
  319. Feng.error(data.msg);
  320. }
  321. }, function (data) {
  322. Feng.error("修改失败!" + data.responseJSON.message + "!");
  323. });
  324. ajax.setData({"id": id, "fields": fields, "files": files})
  325. ajax.start();
  326. };
  327. Enterprise.creatFieldCheckModal = function () {
  328. return '<form id="fieldCheckModalForm">\n' +
  329. ' <div class="form-group" style="margin: 10px;">\n' +
  330. ' <div >\n' +
  331. ' <label for="checkMsg" class="control-label">可修改字段</label>\n' +
  332. ' <div id="field_info">\n' +
  333. ' </div>\n' +
  334. ' <label for="checkMsg" class="control-label">可修改附件</label>\n' +
  335. ' <div id="field_file">\n' +
  336. ' </div>\n' +
  337. ' <div class="form-group" style="text-align: center">\n' +
  338. ' <button type="button" class="btn btn-primary" onclick="Enterprise.checkAll()">全选</button>\n' +
  339. ' <button type="button" class="btn btn-success" onclick="Enterprise.unCheckAll()">反选</button>\n' +
  340. ' </div>\n' +
  341. ' </div>\n' +
  342. ' </div>\n' +
  343. ' </form>';
  344. };
  345. Enterprise.checkAll = function () {
  346. $("#fieldCheckModalForm input[type=checkbox]").prop("checked", true);
  347. };
  348. Enterprise.unCheckAll = function () {
  349. $("#fieldCheckModalForm input[type=checkbox]").removeAttr("checked");
  350. };
  351. Enterprise.resetPassword = function () {
  352. if (!Enterprise.check()) {
  353. return;
  354. }
  355. Feng.confirm(
  356. "确定要重置密码吗?",
  357. function () {
  358. var ajax = new $ax(Feng.ctxPath + "/admin/enterprise/resetPassword?id=" + Enterprise.seItem.id, function (data) {
  359. Feng.info(data.msg);
  360. // if(data.code == 200){
  361. // Enterprise.table.refresh();
  362. // }
  363. }, function (data) {
  364. Feng.error("操作失败!");
  365. });
  366. ajax.set(null);
  367. ajax.start();
  368. }
  369. );
  370. };
  371. Enterprise.doExport = function () {
  372. var name = $("#name").val();
  373. var legal = $("#legal").val();
  374. var ephone = $("#ephone").val();
  375. var agentName = $("#agentName").val();
  376. var agentPhone = $("#agentPhone").val();
  377. var checkState = $("#checkState").val();
  378. var active = $("#active").val();
  379. var arr = {"name": name, "idCard": idCard, "legal": legal, "ephone": ephone, "agentName": agentName,
  380. "agentPhone": agentPhone, "checkState": checkState, "active": active};
  381. window.location.href = Feng.setUrlParam(Feng.ctxPath + "/admin/enterprise/export", arr);
  382. }
  383. /**
  384. * 批量获取人才联络员手机号码
  385. */
  386. Enterprise.getPhones = function () {
  387. var ajax = new $ax(Feng.ctxPath + "/enterprise/getPhones", function (data) {
  388. if (data.code == 200) {
  389. layer.open({
  390. type: 1,
  391. title: "手机号码",
  392. area: ['830px', '500px'], //宽高
  393. fix: false, //不固定
  394. maxmin: true,
  395. content: "<span style='word-break:break-all'>" + data.obj + "</span>"
  396. });
  397. } else {
  398. Feng.info(data.msg);
  399. }
  400. }, function (data) {
  401. Feng.error("操作失败!");
  402. });
  403. ajax.setData(Enterprise.formParam());
  404. ajax.start();
  405. }
  406. Enterprise.check = function () {
  407. var selected = $('#' + Enterprise.id).bootstrapTable('getSelections');
  408. if (selected.length == 0) {
  409. Feng.info("请先选中表格中的某一记录!");
  410. return false;
  411. } else {
  412. Enterprise.seItem = selected[0];
  413. return true;
  414. }
  415. };
  416. Enterprise.showLog = function (id) {
  417. layer.open({
  418. type: 1,
  419. title: "日志",
  420. fixed: false,
  421. content: '<table id="' + id + '"></table>',
  422. area: ['80%', '80%'],
  423. maxmin: true,
  424. success: function (layero, index) {
  425. Feng.getCheckLog(id, {"type": 10, "enterpriseId": id, "typeFileId": "", "active": 1})
  426. }
  427. });
  428. };
  429. $(function () {
  430. var defaultColunms = Enterprise.initColumn();
  431. var table = new BSTable(Enterprise.id, "/admin/enterprise/findEnterpriseByPage", defaultColunms);
  432. table.setPaginationType("server");
  433. Enterprise.table = table.init();
  434. });