enterprise_list.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  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. * @param index
  291. * @param id
  292. */
  293. Enterprise.submitFieldsAndFiles = function (index, id) {
  294. var fields = '';
  295. var files = '';
  296. $("#field_info li input").each(function (index) {
  297. if ($(this).is(":checked")) {
  298. fields = fields + $(this).val() + ",";
  299. }
  300. });
  301. $("#field_file li input").each(function (index) {
  302. if ($(this).is(":checked")) {
  303. files = files + $(this).val() + ",";
  304. }
  305. });
  306. if (fields == '' && files == '') {
  307. Feng.info("请选择可修改的字段或附件!");
  308. return;
  309. }
  310. var ajax = new $ax("/admin/enterprise/updateFieldsAndFiles", function (data) {
  311. if (data.code == 200) {
  312. layer.close(index);
  313. Feng.success(data.msg);
  314. } else {
  315. Feng.error(data.msg);
  316. }
  317. }, function (data) {
  318. Feng.error("修改失败!" + data.responseJSON.message + "!");
  319. });
  320. ajax.setData({"id": id, "fields": fields, "files": files})
  321. ajax.start();
  322. };
  323. Enterprise.creatFieldCheckModal = function () {
  324. return '<form id="fieldCheckModalForm">\n' +
  325. ' <div class="form-group" style="margin: 10px;">\n' +
  326. ' <div >\n' +
  327. ' <label for="checkMsg" class="control-label">可修改字段</label>\n' +
  328. ' <div id="field_info">\n' +
  329. ' </div>\n' +
  330. ' <label for="checkMsg" class="control-label">可修改附件</label>\n' +
  331. ' <div id="field_file">\n' +
  332. ' </div>\n' +
  333. ' <div class="form-group" style="text-align: center">\n' +
  334. ' <button type="button" class="btn btn-primary" onclick="Enterprise.checkAll()">全选</button>\n' +
  335. ' <button type="button" class="btn btn-success" onclick="Enterprise.unCheckAll()">反选</button>\n' +
  336. ' </div>\n' +
  337. ' </div>\n' +
  338. ' </div>\n' +
  339. ' </form>';
  340. };
  341. Enterprise.checkAll = function () {
  342. $("#fieldCheckModalForm input[type=checkbox]").prop("checked", true);
  343. };
  344. Enterprise.unCheckAll = function () {
  345. $("#fieldCheckModalForm input[type=checkbox]").removeAttr("checked");
  346. };
  347. Enterprise.resetPassword = function () {
  348. if (!Enterprise.check()) {
  349. return;
  350. }
  351. Feng.confirm(
  352. "确定要重置密码吗?",
  353. function () {
  354. var ajax = new $ax(Feng.ctxPath + "/admin/enterprise/resetPassword?id=" + Enterprise.seItem.id, function (data) {
  355. Feng.info(data.msg);
  356. // if(data.code == 200){
  357. // Enterprise.table.refresh();
  358. // }
  359. }, function (data) {
  360. Feng.error("操作失败!");
  361. });
  362. ajax.set(null);
  363. ajax.start();
  364. }
  365. );
  366. };
  367. Enterprise.doExport = function () {
  368. var name = $("#name").val();
  369. var idCard = $("#idCard").val();
  370. var legal = $("#legal").val();
  371. var ephone = $("#ephone").val();
  372. var agentName = $("#agentName").val();
  373. var agentPhone = $("#agentPhone").val();
  374. var checkState = $("#checkState").val();
  375. var active = $("#active").val();
  376. var street = $("#street").val();
  377. var special = $("#special").val();
  378. var agencyType = $("#agencyType").val();
  379. var industryFieldNew = $("#industryFieldNew").val();
  380. var industryFieldOld = $("#industryFieldOld").val();
  381. var enterpriseTag = $("#enterpriseTag").val();
  382. var enterpriseType = $("#enterpriseType").val();
  383. var arr = {"name": name, "idCard": idCard, "legal": legal, "ephone": ephone, "agentName": agentName,
  384. "agentPhone": agentPhone, "checkState": checkState, "active": active, "street": street,
  385. "special": special, "agencyType": agencyType, "industryFieldNew": industryFieldNew, "industryFieldOld": industryFieldOld, "enterpriseTag": enterpriseTag, "enterpriseType": enterpriseType};
  386. window.location.href = Feng.setUrlParam(Feng.ctxPath + "/admin/enterprise/export", arr);
  387. }
  388. /**
  389. * 批量获取人才联络员手机号码
  390. */
  391. Enterprise.getPhones = function () {
  392. var ajax = new $ax(Feng.ctxPath + "/enterprise/getPhones", function (data) {
  393. if (data.code == 200) {
  394. layer.open({
  395. type: 1,
  396. title: "手机号码",
  397. area: ['830px', '500px'], //宽高
  398. fix: false, //不固定
  399. maxmin: true,
  400. content: "<span style='word-break:break-all'>" + data.obj + "</span>"
  401. });
  402. } else {
  403. Feng.info(data.msg);
  404. }
  405. }, function (data) {
  406. Feng.error("操作失败!");
  407. });
  408. ajax.setData(Enterprise.formParam());
  409. ajax.start();
  410. }
  411. Enterprise.check = function () {
  412. var selected = $('#' + Enterprise.id).bootstrapTable('getSelections');
  413. if (selected.length == 0) {
  414. Feng.info("请先选中表格中的某一记录!");
  415. return false;
  416. } else {
  417. Enterprise.seItem = selected[0];
  418. return true;
  419. }
  420. };
  421. Enterprise.showLog = function (id) {
  422. layer.open({
  423. type: 1,
  424. title: "日志",
  425. fixed: false,
  426. content: '<table id="' + id + '"></table>',
  427. area: ['80%', '80%'],
  428. maxmin: true,
  429. success: function (layero, index) {
  430. Feng.getCheckLog(id, {"type": 10, "enterpriseId": id, "typeFileId": "", "active": 1})
  431. }
  432. });
  433. };
  434. Enterprise.onSpecialChange = function () {
  435. var special = $("#special").val();
  436. var arr = [];
  437. $("#enterpriseTag").html("");
  438. switch (special) {
  439. case "0":
  440. $("#agencyType").parents(".hiddenElement").css("display", "block");
  441. $("#industryFieldNew").parents(".hiddenElement").css("display", "block");
  442. $("#industryFieldOld").parents(".hiddenElement").css("display", "block");
  443. $("#enterpriseType").parents(".hiddenElement").css("display", "block");
  444. var arr = [
  445. {"name": "agencyType", "code": "agency_type"},
  446. {"name": "industryFieldNew", "code": "industry_field"},
  447. ];
  448. Feng.findChildDictBatch(JSON.stringify(arr));
  449. break;
  450. case "1":
  451. $("#agencyType").val("").parents(".hiddenElement").css("display", "none");
  452. $("#industryFieldNew").val("").parents(".hiddenElement").css("display", "none");
  453. $("#industryFieldOld").val("").parents(".hiddenElement").css("display", "none");
  454. $("#enterpriseType").val("").parents(".hiddenElement").css("display", "none");
  455. var arr = [
  456. {"name": "enterpriseTag", "code": "institution_tag"}
  457. ];
  458. Feng.findChildDictBatch(JSON.stringify(arr));
  459. break;
  460. case "3":
  461. $("#agencyType").val("").parents(".hiddenElement").css("display", "none");
  462. $("#industryFieldNew").val("").parents(".hiddenElement").css("display", "none");
  463. $("#industryFieldOld").val("").parents(".hiddenElement").css("display", "none");
  464. $("#enterpriseType").val("").parents(".hiddenElement").css("display", "none");
  465. var arr = [
  466. {"name": "enterpriseTag", "code": "organization_tag"}
  467. ];
  468. Feng.findChildDictBatch(JSON.stringify(arr));
  469. break;
  470. }
  471. };
  472. Enterprise.onAgencyTypeChange = function () {
  473. var agencyType = $("#agencyType").val();
  474. if (agencyType == 1) {
  475. var arr = [
  476. {"name": "enterpriseTag", "code": "enterprise_tag"},
  477. {"name": "enterpriseType", "code": "enterprise_type"}
  478. ];
  479. Feng.findChildDictBatch(JSON.stringify(arr));
  480. } else {
  481. $("#enterpriseTag").val("");
  482. $("#enterpriseType").val("");
  483. $("#enterpriseTag").html("");
  484. $("#enterpriseType").html("");
  485. }
  486. }
  487. Enterprise.onIndustryFieldNewChange = function () {
  488. var industryNew = $("#industryFieldNew").val();
  489. var arr = [
  490. {"name": "industryFieldOld", "code": industryNew + "_field"}
  491. ];
  492. Feng.findChildDictBatch(JSON.stringify(arr));
  493. }
  494. $(function () {
  495. var defaultColunms = Enterprise.initColumn();
  496. var table = new BSTable(Enterprise.id, "/admin/enterprise/findEnterpriseByPage", defaultColunms);
  497. table.setPaginationType("server");
  498. Enterprise.table = table.init();
  499. var arr = [
  500. {"name": "street", "code": "street"}
  501. ];
  502. if ($("#special").val() != "") {
  503. Enterprise.onSpecialChange();
  504. if ($("#agencyType").val() != "") {
  505. Enterprise.onAgencyTypeChange();
  506. }
  507. if ($("#industryFieldNew").val() != "") {
  508. Enterprise.onIndustryFieldNewChange();
  509. }
  510. }
  511. Feng.findChildDictBatch(JSON.stringify(arr));
  512. // Feng.addAjaxSelect({
  513. // "id": "street",
  514. // "displayCode": "code",
  515. // "displayName": "name",
  516. // "type": "GET",
  517. // "url": Feng.ctxPath + "/dict/findChildDictByCode?code=un_street"
  518. // });
  519. });