enterprise_list.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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. Enterprise.delEnterprise = function () {
  200. if (!Enterprise.check()) {
  201. return;
  202. }
  203. if (!Enterprise.check()) {
  204. return;
  205. }
  206. Feng.confirm(
  207. "确定删除吗?",
  208. function () {
  209. var ajax = new $ax(Feng.ctxPath + "/enterprise/delEnterprise?id=" + Enterprise.seItem.id, function (data) {
  210. Feng.info(data.msg);
  211. if (data.code == 200) {
  212. Enterprise.table.refresh();
  213. }
  214. }, function (data) {
  215. Feng.error("操作失败!");
  216. });
  217. ajax.set(null);
  218. ajax.start();
  219. }
  220. );
  221. };
  222. Enterprise.resetPassword = function () {
  223. if (!Enterprise.check()) {
  224. return;
  225. }
  226. Feng.confirm(
  227. "确定要重置密码吗?",
  228. function () {
  229. var ajax = new $ax(Feng.ctxPath + "/admin/enterprise/resetPassword?id=" + Enterprise.seItem.id, function (data) {
  230. Feng.info(data.msg);
  231. // if(data.code == 200){
  232. // Enterprise.table.refresh();
  233. // }
  234. }, function (data) {
  235. Feng.error("操作失败!");
  236. });
  237. ajax.set(null);
  238. ajax.start();
  239. }
  240. );
  241. };
  242. Enterprise.doExport = function () {
  243. var name = $("#name").val();
  244. var idCard = $("#idCard").val();
  245. var legal = $("#legal").val();
  246. var ephone = $("#ephone").val();
  247. var agentName = $("#agentName").val();
  248. var agentPhone = $("#agentPhone").val();
  249. var checkState = $("#checkState").val();
  250. var active = $("#active").val();
  251. var street = $("#street").val();
  252. var special = $("#special").val();
  253. var agencyType = $("#agencyType").val();
  254. var industryFieldNew = $("#industryFieldNew").val();
  255. var industryFieldOld = $("#industryFieldOld").val();
  256. var enterpriseTag = $("#enterpriseTag").val();
  257. var enterpriseType = $("#enterpriseType").val();
  258. var arr = {"name": name, "idCard": idCard, "legal": legal, "ephone": ephone, "agentName": agentName,
  259. "agentPhone": agentPhone, "checkState": checkState, "active": active, "street": street,
  260. "special": special, "agencyType": agencyType, "industryFieldNew": industryFieldNew, "industryFieldOld": industryFieldOld, "enterpriseTag": enterpriseTag, "enterpriseType": enterpriseType};
  261. window.location.href = Feng.setUrlParam(Feng.ctxPath + "/admin/enterprise/export", arr);
  262. }
  263. /**
  264. * 批量获取人才联络员手机号码
  265. */
  266. Enterprise.getPhones = function () {
  267. var ajax = new $ax(Feng.ctxPath + "/enterprise/getPhones", function (data) {
  268. if (data.code == 200) {
  269. layer.open({
  270. type: 1,
  271. title: "手机号码",
  272. area: ['830px', '500px'], //宽高
  273. fix: false, //不固定
  274. maxmin: true,
  275. content: "<span style='word-break:break-all'>" + data.obj + "</span>"
  276. });
  277. } else {
  278. Feng.info(data.msg);
  279. }
  280. }, function (data) {
  281. Feng.error("操作失败!");
  282. });
  283. ajax.setData(Enterprise.formParam());
  284. ajax.start();
  285. }
  286. Enterprise.check = function () {
  287. var selected = $('#' + Enterprise.id).bootstrapTable('getSelections');
  288. if (selected.length == 0) {
  289. Feng.info("请先选中表格中的某一记录!");
  290. return false;
  291. } else {
  292. Enterprise.seItem = selected[0];
  293. return true;
  294. }
  295. };
  296. Enterprise.showLog = function (id) {
  297. layer.open({
  298. type: 1,
  299. title: "日志",
  300. fixed: false,
  301. content: '<table id="' + id + '"></table>',
  302. area: ['80%', '80%'],
  303. maxmin: true,
  304. success: function (layero, index) {
  305. Feng.getCheckLog(id, {"type": 10, "enterpriseId": id, "typeFileId": "", "active": 1})
  306. }
  307. });
  308. };
  309. Enterprise.onSpecialChange = function () {
  310. var special = $("#special").val();
  311. var arr = [];
  312. $("#enterpriseTag").html("");
  313. switch (special) {
  314. case "0":
  315. $("#agencyType").parents(".hiddenElement").css("display", "block");
  316. $("#industryFieldNew").parents(".hiddenElement").css("display", "block");
  317. $("#industryFieldOld").parents(".hiddenElement").css("display", "block");
  318. $("#enterpriseType").parents(".hiddenElement").css("display", "block");
  319. var arr = [
  320. {"name": "agencyType", "code": "agency_type"},
  321. {"name": "industryFieldNew", "code": "industry_field"},
  322. ];
  323. Feng.findChildDictBatch(JSON.stringify(arr));
  324. break;
  325. case "1":
  326. $("#agencyType").val("").parents(".hiddenElement").css("display", "none");
  327. $("#industryFieldNew").val("").parents(".hiddenElement").css("display", "none");
  328. $("#industryFieldOld").val("").parents(".hiddenElement").css("display", "none");
  329. $("#enterpriseType").val("").parents(".hiddenElement").css("display", "none");
  330. var arr = [
  331. {"name": "enterpriseTag", "code": "institution_tag"}
  332. ];
  333. Feng.findChildDictBatch(JSON.stringify(arr));
  334. break;
  335. case "3":
  336. $("#agencyType").val("").parents(".hiddenElement").css("display", "none");
  337. $("#industryFieldNew").val("").parents(".hiddenElement").css("display", "none");
  338. $("#industryFieldOld").val("").parents(".hiddenElement").css("display", "none");
  339. $("#enterpriseType").val("").parents(".hiddenElement").css("display", "none");
  340. var arr = [
  341. {"name": "enterpriseTag", "code": "organization_tag"}
  342. ];
  343. Feng.findChildDictBatch(JSON.stringify(arr));
  344. break;
  345. }
  346. };
  347. Enterprise.onAgencyTypeChange = function () {
  348. var agencyType = $("#agencyType").val();
  349. if (agencyType == 1) {
  350. var arr = [
  351. {"name": "enterpriseTag", "code": "enterprise_tag"},
  352. {"name": "enterpriseType", "code": "enterprise_type"}
  353. ];
  354. Feng.findChildDictBatch(JSON.stringify(arr));
  355. } else {
  356. $("#enterpriseTag").val("");
  357. $("#enterpriseType").val("");
  358. $("#enterpriseTag").html("");
  359. $("#enterpriseType").html("");
  360. }
  361. }
  362. Enterprise.onIndustryFieldNewChange = function () {
  363. var industryNew = $("#industryFieldNew").val();
  364. var arr = [
  365. {"name": "industryFieldOld", "code": industryNew + "_field"}
  366. ];
  367. Feng.findChildDictBatch(JSON.stringify(arr));
  368. }
  369. $(function () {
  370. var defaultColunms = Enterprise.initColumn();
  371. var table = new BSTable(Enterprise.id, "/admin/enterprise/findEnterpriseByPage", defaultColunms);
  372. table.setPaginationType("server");
  373. Enterprise.table = table.init();
  374. var arr = [
  375. {"name": "street", "code": "street"}
  376. ];
  377. if ($("#special").val() != "") {
  378. Enterprise.onSpecialChange();
  379. if ($("#agencyType").val() != "") {
  380. Enterprise.onAgencyTypeChange();
  381. }
  382. if ($("#industryFieldNew").val() != "") {
  383. Enterprise.onIndustryFieldNewChange();
  384. }
  385. }
  386. Feng.findChildDictBatch(JSON.stringify(arr));
  387. // Feng.addAjaxSelect({
  388. // "id": "street",
  389. // "displayCode": "code",
  390. // "displayName": "name",
  391. // "type": "GET",
  392. // "url": Feng.ctxPath + "/dict/findChildDictByCode?code=un_street"
  393. // });
  394. });