enterprise_list.js 21 KB

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