enterprise_list.js 20 KB

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