enterprise_list.js 22 KB

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