enterprise_list.js 17 KB

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