enterprise_list.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  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.setActive = function () {
  166. if (!Enterprise.check()) {
  167. return;
  168. }
  169. var index = layer.open({
  170. type: 2,
  171. title: '设置冻结',
  172. area: ['830px', '500px'], //宽高
  173. fix: false, //不固定
  174. maxmin: true,
  175. content: Feng.ctxPath + '/admin/enterprise/gotoActivePage?id=' + Enterprise.seItem.id,
  176. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  177. btnAlign: 'c',
  178. yes: function (index, layero) {
  179. //按钮【按钮一】的回调
  180. var iframeWin = window[layero.find('iframe')[0]['name']];
  181. iframeWin.EpActive.addSubmit();
  182. }
  183. });
  184. // layer.full(index);
  185. Enterprise.layerIndex = index;
  186. };
  187. Enterprise.doExamine = function () {
  188. if (!Enterprise.check()) {
  189. return;
  190. }
  191. var inCheckList = [1, 4, 6];
  192. if (Enterprise.seItem.checkState == null || inCheckList.indexOf(Enterprise.seItem.checkState) == -1) {
  193. Feng.info("不在审核范围内!");
  194. return;
  195. }
  196. var index = layer.open({
  197. type: 2,
  198. title: '审核',
  199. area: ['830px', '500px'], //宽高
  200. fix: false, //不固定
  201. maxmin: true,
  202. shade: 0,
  203. content: Feng.ctxPath + '/admin/enterprise/gotoExaminePage?id=' + Enterprise.seItem.id,
  204. 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;取消'],
  205. btnAlign: 'c',
  206. yes: function (index, layero) {
  207. //按钮【按钮一】的回调
  208. layer.confirm("确认提交审核结果?", function () {
  209. var iframeWin = window[layero.find('iframe')[0]['name']];
  210. iframeWin.EpExam.submitToCheck();
  211. })
  212. },
  213. btn2: function (index, layero) {
  214. var iframeWin = window[layero.find('iframe')[0]['name']];
  215. iframeWin.EpExam.addSubmit();
  216. return false;
  217. }
  218. });
  219. // layer.full(index);
  220. };
  221. /**
  222. * 修改驳回的字段及附件
  223. */
  224. Enterprise.updateFieldsAndFiles = function () {
  225. if (this.check()) {
  226. var id = Enterprise.seItem.id;
  227. var ajax = new $ax("/admin/enterprise/findFieldsAndFiles?id=" + id, function (data) {
  228. if (data.code == 200) {
  229. layer.open({
  230. type: 1,
  231. id: "fieldCheckModalForm",
  232. title: '修改',
  233. area: ['800px', '450px'], //宽高
  234. fix: false, //不固定
  235. shade: 0,
  236. maxmin: true,
  237. content: Enterprise.creatFieldCheckModal(),
  238. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  239. btnAlign: 'c',
  240. zIndex: layer.zIndex,
  241. success: function (layero, index) {
  242. var fileList = data.files;
  243. var fieldList = data.fields;
  244. var html_field = '';
  245. var html_file = '';
  246. for (var key in fieldList) {
  247. html_field = html_field + '<li><input type="checkbox" ' + (fieldList[key].checked ? "checked" : "") + ' value="' + fieldList[key].field + '"><span>' + fieldList[key].name + '</span></li>';
  248. }
  249. for (var key in fileList) {
  250. 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>';
  251. }
  252. $("#field_info").empty().append("<ul>" + html_field + "</ul>");
  253. $("#field_file").empty().append("<ul>" + html_file + "</ul>");
  254. },
  255. yes: function (index, layero) {
  256. Enterprise.submitFieldsAndFiles(index, id);
  257. }
  258. });
  259. } else {
  260. Feng.error(data.msg);
  261. }
  262. }, function (data) {
  263. Feng.error("查询失败!" + data.responseJSON.message + "!");
  264. });
  265. ajax.start();
  266. }
  267. };
  268. /**
  269. * 修改提交
  270. * @param index
  271. * @param id
  272. */
  273. Enterprise.submitFieldsAndFiles = function (index, id) {
  274. var fields = '';
  275. var files = '';
  276. $("#field_info li input").each(function (index) {
  277. if ($(this).is(":checked")) {
  278. fields = fields + $(this).val() + ",";
  279. }
  280. });
  281. $("#field_file li input").each(function (index) {
  282. if ($(this).is(":checked")) {
  283. files = files + $(this).val() + ",";
  284. }
  285. });
  286. if (fields == '' && files == '') {
  287. Feng.info("请选择可修改的字段或附件!");
  288. return;
  289. }
  290. var ajax = new $ax("/admin/enterprise/updateFieldsAndFiles", function (data) {
  291. if (data.code == 200) {
  292. layer.close(index);
  293. Feng.success(data.msg);
  294. } else {
  295. Feng.error(data.msg);
  296. }
  297. }, function (data) {
  298. Feng.error("修改失败!" + data.responseJSON.message + "!");
  299. });
  300. ajax.setData({"id": id, "fields": fields, "files": files})
  301. ajax.start();
  302. };
  303. Enterprise.creatFieldCheckModal = function () {
  304. return '<form id="fieldCheckModalForm">\n' +
  305. ' <div class="form-group" style="margin: 10px;">\n' +
  306. ' <div >\n' +
  307. ' <label for="checkMsg" class="control-label">可修改字段</label>\n' +
  308. ' <div id="field_info">\n' +
  309. ' </div>\n' +
  310. ' <label for="checkMsg" class="control-label">可修改附件</label>\n' +
  311. ' <div id="field_file">\n' +
  312. ' </div>\n' +
  313. ' <div class="form-group" style="text-align: center">\n' +
  314. ' <button type="button" class="btn btn-primary" onclick="Enterprise.checkAll()">全选</button>\n' +
  315. ' <button type="button" class="btn btn-success" onclick="Enterprise.unCheckAll()">反选</button>\n' +
  316. ' </div>\n' +
  317. ' </div>\n' +
  318. ' </div>\n' +
  319. ' </form>';
  320. };
  321. Enterprise.checkAll = function () {
  322. $("#fieldCheckModalForm input[type=checkbox]").prop("checked", true);
  323. };
  324. Enterprise.unCheckAll = function () {
  325. $("#fieldCheckModalForm input[type=checkbox]").removeAttr("checked");
  326. };
  327. Enterprise.delEnterprise = function () {
  328. if (!Enterprise.check()) {
  329. return;
  330. }
  331. if (!Enterprise.check()) {
  332. return;
  333. }
  334. Feng.confirm(
  335. "确定删除吗?",
  336. function () {
  337. var ajax = new $ax(Feng.ctxPath + "/enterprise/delEnterprise?id=" + Enterprise.seItem.id, function (data) {
  338. Feng.info(data.msg);
  339. if (data.code == 200) {
  340. Enterprise.table.refresh();
  341. }
  342. }, function (data) {
  343. Feng.error("操作失败!");
  344. });
  345. ajax.set(null);
  346. ajax.start();
  347. }
  348. );
  349. };
  350. Enterprise.resetPassword = function () {
  351. if (!Enterprise.check()) {
  352. return;
  353. }
  354. Feng.confirm(
  355. "确定要重置密码吗?",
  356. function () {
  357. var ajax = new $ax(Feng.ctxPath + "/admin/enterprise/resetPassword?id=" + Enterprise.seItem.id, function (data) {
  358. Feng.info(data.msg);
  359. // if(data.code == 200){
  360. // Enterprise.table.refresh();
  361. // }
  362. }, function (data) {
  363. Feng.error("操作失败!");
  364. });
  365. ajax.set(null);
  366. ajax.start();
  367. }
  368. );
  369. };
  370. Enterprise.doExport = function () {
  371. var name = $("#name").val();
  372. var idCard = $("#idCard").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 street = $("#street").val();
  380. var special = $("#special").val();
  381. var agencyType = $("#agencyType").val();
  382. var industryFieldNew = $("#industryFieldNew").val();
  383. var industryFieldOld = $("#industryFieldOld").val();
  384. var enterpriseTag = $("#enterpriseTag").val();
  385. var enterpriseType = $("#enterpriseType").val();
  386. var arr = {"name": name, "idCard": idCard, "legal": legal, "ephone": ephone, "agentName": agentName,
  387. "agentPhone": agentPhone, "checkState": checkState, "active": active, "street": street,
  388. "special": special, "agencyType": agencyType, "industryFieldNew": industryFieldNew, "industryFieldOld": industryFieldOld, "enterpriseTag": enterpriseTag, "enterpriseType": enterpriseType};
  389. window.location.href = Feng.setUrlParam(Feng.ctxPath + "/admin/enterprise/export", arr);
  390. }
  391. /**
  392. * 批量获取人才联络员手机号码
  393. */
  394. Enterprise.getPhones = function () {
  395. var ajax = new $ax(Feng.ctxPath + "/enterprise/getPhones", function (data) {
  396. if (data.code == 200) {
  397. layer.open({
  398. type: 1,
  399. title: "手机号码",
  400. area: ['830px', '500px'], //宽高
  401. fix: false, //不固定
  402. maxmin: true,
  403. content: "<span style='word-break:break-all'>" + data.obj + "</span>"
  404. });
  405. } else {
  406. Feng.info(data.msg);
  407. }
  408. }, function (data) {
  409. Feng.error("操作失败!");
  410. });
  411. ajax.setData(Enterprise.formParam());
  412. ajax.start();
  413. }
  414. Enterprise.check = function () {
  415. var selected = $('#' + Enterprise.id).bootstrapTable('getSelections');
  416. if (selected.length == 0) {
  417. Feng.info("请先选中表格中的某一记录!");
  418. return false;
  419. } else {
  420. Enterprise.seItem = selected[0];
  421. return true;
  422. }
  423. };
  424. Enterprise.showLog = function (id) {
  425. layer.open({
  426. type: 1,
  427. title: "日志",
  428. fixed: false,
  429. content: '<table id="' + id + '"></table>',
  430. area: ['80%', '80%'],
  431. maxmin: true,
  432. success: function (layero, index) {
  433. Feng.getCheckLog(id, {"type": 10, "enterpriseId": id, "typeFileId": "", "active": 1})
  434. }
  435. });
  436. };
  437. Enterprise.onSpecialChange = function () {
  438. var special = $("#special").val();
  439. var arr = [];
  440. $("#enterpriseTag").html("");
  441. switch (special) {
  442. case "0":
  443. $("#agencyType").parents(".hiddenElement").css("display", "block");
  444. $("#industryFieldNew").parents(".hiddenElement").css("display", "block");
  445. $("#industryFieldOld").parents(".hiddenElement").css("display", "block");
  446. $("#enterpriseType").parents(".hiddenElement").css("display", "block");
  447. var arr = [
  448. {"name": "agencyType", "code": "agency_type"},
  449. {"name": "industryFieldNew", "code": "industry_field"},
  450. ];
  451. Feng.findChildDictBatch(JSON.stringify(arr));
  452. break;
  453. case "1":
  454. $("#agencyType").val("").parents(".hiddenElement").css("display", "none");
  455. $("#industryFieldNew").val("").parents(".hiddenElement").css("display", "none");
  456. $("#industryFieldOld").val("").parents(".hiddenElement").css("display", "none");
  457. $("#enterpriseType").val("").parents(".hiddenElement").css("display", "none");
  458. var arr = [
  459. {"name": "enterpriseTag", "code": "institution_tag"}
  460. ];
  461. Feng.findChildDictBatch(JSON.stringify(arr));
  462. break;
  463. case "3":
  464. $("#agencyType").val("").parents(".hiddenElement").css("display", "none");
  465. $("#industryFieldNew").val("").parents(".hiddenElement").css("display", "none");
  466. $("#industryFieldOld").val("").parents(".hiddenElement").css("display", "none");
  467. $("#enterpriseType").val("").parents(".hiddenElement").css("display", "none");
  468. var arr = [
  469. {"name": "enterpriseTag", "code": "organization_tag"}
  470. ];
  471. Feng.findChildDictBatch(JSON.stringify(arr));
  472. break;
  473. }
  474. };
  475. Enterprise.onAgencyTypeChange = function () {
  476. var agencyType = $("#agencyType").val();
  477. if (agencyType == 1) {
  478. var arr = [
  479. {"name": "enterpriseTag", "code": "enterprise_tag"},
  480. {"name": "enterpriseType", "code": "enterprise_type"}
  481. ];
  482. Feng.findChildDictBatch(JSON.stringify(arr));
  483. } else {
  484. $("#enterpriseTag").val("");
  485. $("#enterpriseType").val("");
  486. $("#enterpriseTag").html("");
  487. $("#enterpriseType").html("");
  488. }
  489. }
  490. Enterprise.onIndustryFieldNewChange = function () {
  491. var industryNew = $("#industryFieldNew").val();
  492. var arr = [
  493. {"name": "industryFieldOld", "code": industryNew + "_field"}
  494. ];
  495. Feng.findChildDictBatch(JSON.stringify(arr));
  496. }
  497. $(function () {
  498. var defaultColunms = Enterprise.initColumn();
  499. var table = new BSTable(Enterprise.id, "/admin/enterprise/findEnterpriseByPage", defaultColunms);
  500. table.setPaginationType("server");
  501. Enterprise.table = table.init();
  502. var arr = [
  503. {"name": "street", "code": "street"}
  504. ];
  505. if ($("#special").val() != "") {
  506. Enterprise.onSpecialChange();
  507. if ($("#agencyType").val() != "") {
  508. Enterprise.onAgencyTypeChange();
  509. }
  510. if ($("#industryFieldNew").val() != "") {
  511. Enterprise.onIndustryFieldNewChange();
  512. }
  513. }
  514. Feng.findChildDictBatch(JSON.stringify(arr));
  515. // Feng.addAjaxSelect({
  516. // "id": "street",
  517. // "displayCode": "code",
  518. // "displayName": "name",
  519. // "type": "GET",
  520. // "url": Feng.ctxPath + "/dict/findChildDictByCode?code=un_street"
  521. // });
  522. });