enterprise_list.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  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. return [
  10. {field: 'selectItem', radio: true},
  11. {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
  12. {title: '账号', field: 'username', visible: true, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  13. {title: '医院名称', field: 'name', visible: true, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  14. {title: '医共体', field: 'medicalCommunityName', visible: true, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  15. {title: '是否总院', field: 'isGeneral', visible: true, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip',
  16. formatter: function (value, row, index) {
  17. if (value == 1) {
  18. return "是";
  19. }
  20. return "否";
  21. }},
  22. {title: '登记号', field: 'idCard', visible: true, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  23. {title: '法人代表', field: 'legal', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  24. {title: '医院电话', field: 'ephone', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  25. {title: '人才联络员', field: 'agentName', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  26. {title: '人才联络员电话', field: 'agentPhone', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  27. {title: '审核状态', field: 'checkState', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip',
  28. formatter: function (value, row, index) {
  29. if (value == null || value == '') {
  30. return "";
  31. } else if (value == 1) {
  32. return "未审核";
  33. } else if (value == 2) {
  34. return "审核驳回";
  35. } else if (value == 3) {
  36. return "审核通过";
  37. } else if (value == 4) {
  38. return "重新提交";
  39. } else if (value == 5) {
  40. return "初审驳回";
  41. } else if (value == 6) {
  42. return "初审通过";
  43. }
  44. },
  45. cellStyle: function (value, row, index) {
  46. if (value == null || value === '') {
  47. return {css: {}};
  48. } else if (value === 1) {
  49. return {css: {"background-color": "LightGrey"}};
  50. } else if (value === 3) {
  51. return {css: {'background-color': 'LightGreen'}};
  52. } else if (value === 2) {
  53. return {css: {"background-color": "Orange"}};
  54. } else if (value === 4) {
  55. return {css: {'background-color': 'LightGrey'}};
  56. } else if (value === 5) {
  57. return {css: {'background-color': 'Orange'}};
  58. } else if (value === 6) {
  59. return {css: {"background-color": "LightBlue"}};
  60. } else {
  61. return {css: {}};
  62. }
  63. }
  64. },
  65. {title: '账号状态', field: 'active', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip',
  66. formatter: function (value, row, index) {
  67. if (value == null || value == '') {
  68. return "";
  69. } else if (value == 1) {
  70. return "账号有效";
  71. } else if (value == 2) {
  72. return "拉黑/冻结";
  73. }
  74. },
  75. cellStyle: function (value, row, index) {
  76. if (value == null || value === '') {
  77. return {css: {}};
  78. } else if (value === 1) {
  79. return {css: {'background-color': 'LightGreen'}};
  80. } else if (value === 2) {
  81. return {css: {"background-color": "Orange"}};
  82. } else {
  83. return {css: {}};
  84. }
  85. }
  86. },
  87. {title: '注册时间', field: 'createTime', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  88. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
  89. formatter: function (value, row, index) {
  90. return "<span class='label label-success' onclick=\"Enterprise.showLog('" + value + "')\" >" +
  91. "<i class=\"fa fa-book\"></i>日志" +
  92. "</span>";
  93. }
  94. }
  95. ];
  96. };
  97. Enterprise.formParam = function () {
  98. var queryData = {};
  99. queryData['name'] = $("#name").val();
  100. queryData['idCard'] = $("#idCard").val();
  101. queryData['medicalCommunityId'] = $("#medicalCommunityId").val();
  102. queryData['isGeneral'] = $("#isGeneral").val();
  103. queryData['legal'] = $("#legal").val();
  104. queryData['ephone'] = $("#ephone").val();
  105. queryData['agentName'] = $("#agentName").val();
  106. queryData['agentPhone'] = $("#agentPhone").val();
  107. queryData['checkState'] = $("#checkState").val();
  108. queryData['active'] = $("#active").val();
  109. return queryData;
  110. }
  111. Enterprise.search = function () {
  112. Enterprise.table.refresh({"query": Enterprise.formParam()});
  113. };
  114. Enterprise.reset = function () {
  115. $("#name").val("");
  116. $("#idCard").val("");
  117. $("#medicalCommunityId").val("");
  118. $("#isGeneral").val("");
  119. $("#legal").val("");
  120. $("#ephone").val("");
  121. $("#agentName").val("");
  122. $("#agentPhone").val("");
  123. $("#checkState").val("");
  124. $("#active").val("");
  125. };
  126. Enterprise.gotoEnterpriseDetailPage = function () {
  127. if (!Enterprise.check()) {
  128. return;
  129. }
  130. var index = layer.open({
  131. type: 2,
  132. title: '查看详情',
  133. area: ['830px', '450px'], //宽高
  134. fix: false, //不固定
  135. maxmin: true,
  136. content: Feng.ctxPath + '/admin/enterprise/gotoEnterpriseDetailPage?id=' + Enterprise.seItem.id,
  137. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;审核', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  138. btnAlign: 'c',
  139. yes: function (index, layero) {
  140. Enterprise.doExamine();
  141. }
  142. });
  143. layer.full(index);
  144. Enterprise.layerIndex = index;
  145. };
  146. Enterprise.delEnterprise = function () {
  147. if (!Enterprise.check()) {
  148. return;
  149. }
  150. Feng.confirm(
  151. "确定删除吗?",
  152. function () {
  153. var ajax = new $ax(Feng.ctxPath + "/admin/enterprise/delEnterprise?id=" + Enterprise.seItem.id, function (data) {
  154. Feng.info(data.msg);
  155. if (data.code == 200) {
  156. Enterprise.table.refresh();
  157. }
  158. }, function (data) {
  159. Feng.error("操作失败!");
  160. });
  161. ajax.set(null);
  162. ajax.start();
  163. }
  164. );
  165. };
  166. Enterprise.setActive = function () {
  167. if (!Enterprise.check()) {
  168. return;
  169. }
  170. var index = layer.open({
  171. type: 2,
  172. title: '设置冻结',
  173. area: ['830px', '500px'], //宽高
  174. fix: false, //不固定
  175. maxmin: true,
  176. content: Feng.ctxPath + '/admin/enterprise/gotoActivePage?id=' + Enterprise.seItem.id,
  177. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  178. btnAlign: 'c',
  179. yes: function (index, layero) {
  180. //按钮【按钮一】的回调
  181. var iframeWin = window[layero.find('iframe')[0]['name']];
  182. iframeWin.EpActive.addSubmit();
  183. }
  184. });
  185. // layer.full(index);
  186. Enterprise.layerIndex = index;
  187. };
  188. Enterprise.doExamine = function () {
  189. if (!Enterprise.check()) {
  190. return;
  191. }
  192. var inCheckList = [1, 4, 6];
  193. if (Enterprise.seItem.checkState == null || inCheckList.indexOf(Enterprise.seItem.checkState) == -1) {
  194. Feng.info("不在审核范围内!");
  195. return;
  196. }
  197. var index = layer.open({
  198. type: 2,
  199. title: '审核',
  200. area: ['830px', '500px'], //宽高
  201. fix: false, //不固定
  202. maxmin: true,
  203. shade: 0,
  204. content: Feng.ctxPath + '/admin/enterprise/gotoExaminePage?id=' + Enterprise.seItem.id,
  205. 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;取消'],
  206. btnAlign: 'c',
  207. yes: function (index, layero) {
  208. //按钮【按钮一】的回调
  209. layer.confirm("确认提交审核结果?", function () {
  210. var iframeWin = window[layero.find('iframe')[0]['name']];
  211. iframeWin.EpExam.submitToCheck();
  212. })
  213. },
  214. btn2: function (index, layero) {
  215. var iframeWin = window[layero.find('iframe')[0]['name']];
  216. iframeWin.EpExam.addSubmit();
  217. return false;
  218. }
  219. });
  220. // layer.full(index);
  221. };
  222. /**
  223. * 修改驳回的字段及附件
  224. */
  225. Enterprise.updateFieldsAndFiles = function () {
  226. if (this.check()) {
  227. var id = Enterprise.seItem.id;
  228. var ajax = new $ax("/admin/enterprise/findFieldsAndFiles?id=" + id, function (data) {
  229. if (data.code == 200) {
  230. layer.open({
  231. type: 1,
  232. id: "fieldCheckModalForm",
  233. title: '修改',
  234. area: ['800px', '450px'], //宽高
  235. fix: false, //不固定
  236. shade: 0,
  237. maxmin: true,
  238. content: Enterprise.creatFieldCheckModal(),
  239. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  240. btnAlign: 'c',
  241. zIndex: layer.zIndex,
  242. success: function (layero, index) {
  243. var fileList = data.files;
  244. var fieldList = data.fields;
  245. var html_field = '';
  246. var html_file = '';
  247. for (var key in fieldList) {
  248. html_field = html_field + '<li><input type="checkbox" ' + (fieldList[key].checked ? "checked" : "") + ' value="' + fieldList[key].field + '"><span>' + fieldList[key].name + '</span></li>';
  249. }
  250. for (var key in fileList) {
  251. 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>';
  252. }
  253. $("#field_info").empty().append("<ul>" + html_field + "</ul>");
  254. $("#field_file").empty().append("<ul>" + html_file + "</ul>");
  255. },
  256. yes: function (index, layero) {
  257. Enterprise.submitFieldsAndFiles(index, id);
  258. }
  259. });
  260. } else {
  261. Feng.error(data.msg);
  262. }
  263. }, function (data) {
  264. Feng.error("查询失败!" + data.responseJSON.message + "!");
  265. });
  266. ajax.start();
  267. }
  268. };
  269. /**
  270. * 已通过再驳回
  271. */
  272. Enterprise.forceReject = function () {
  273. if (this.check()) {
  274. if (Enterprise.seItem.checkState != 3) {
  275. Feng.info("该操作只能对已通过医院进行驳回!");
  276. return;
  277. }
  278. var index = layer.open({
  279. type: 2,
  280. title: '驳回已通过医院',
  281. area: ['830px', '500px'], //宽高
  282. fix: false, //不固定
  283. maxmin: true,
  284. shade: 0,
  285. content: Feng.ctxPath + '/admin/enterprise/gotoRejectPage?id=' + Enterprise.seItem.id,
  286. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  287. btnAlign: 'c',
  288. yes: function (index, layero) {
  289. //按钮【按钮一】的回调
  290. layer.confirm("确认驳回该医院?", function () {
  291. var iframeWin = window[layero.find('iframe')[0]['name']];
  292. iframeWin.EpExam.submitToReject();
  293. })
  294. }
  295. });
  296. // layer.full(index);
  297. }
  298. }
  299. /**
  300. * 修改提交
  301. * @param index
  302. * @param id
  303. */
  304. Enterprise.submitFieldsAndFiles = function (index, id) {
  305. var fields = '';
  306. var files = '';
  307. $("#field_info li input").each(function (index) {
  308. if ($(this).is(":checked")) {
  309. fields = fields + $(this).val() + ",";
  310. }
  311. });
  312. $("#field_file li input").each(function (index) {
  313. if ($(this).is(":checked")) {
  314. files = files + $(this).val() + ",";
  315. }
  316. });
  317. if (fields == '' && files == '') {
  318. Feng.info("请选择可修改的字段或附件!");
  319. return;
  320. }
  321. var ajax = new $ax("/admin/enterprise/updateFieldsAndFiles", function (data) {
  322. if (data.code == 200) {
  323. layer.close(index);
  324. Feng.success(data.msg);
  325. } else {
  326. Feng.error(data.msg);
  327. }
  328. }, function (data) {
  329. Feng.error("修改失败!" + data.responseJSON.message + "!");
  330. });
  331. ajax.setData({"id": id, "fields": fields, "files": files})
  332. ajax.start();
  333. };
  334. Enterprise.creatFieldCheckModal = function () {
  335. return '<form id="fieldCheckModalForm">\n' +
  336. ' <div class="form-group" style="margin: 10px;">\n' +
  337. ' <div >\n' +
  338. ' <label for="checkMsg" class="control-label">可修改字段</label>\n' +
  339. ' <div id="field_info">\n' +
  340. ' </div>\n' +
  341. ' <label for="checkMsg" class="control-label">可修改附件</label>\n' +
  342. ' <div id="field_file">\n' +
  343. ' </div>\n' +
  344. ' <div class="form-group" style="text-align: center">\n' +
  345. ' <button type="button" class="btn btn-primary" onclick="Enterprise.checkAll()">全选</button>\n' +
  346. ' <button type="button" class="btn btn-success" onclick="Enterprise.unCheckAll()">反选</button>\n' +
  347. ' </div>\n' +
  348. ' </div>\n' +
  349. ' </div>\n' +
  350. ' </form>';
  351. };
  352. Enterprise.checkAll = function () {
  353. $("#fieldCheckModalForm input[type=checkbox]").prop("checked", true);
  354. };
  355. Enterprise.unCheckAll = function () {
  356. $("#fieldCheckModalForm input[type=checkbox]").removeAttr("checked");
  357. };
  358. Enterprise.resetPassword = function () {
  359. if (!Enterprise.check()) {
  360. return;
  361. }
  362. Feng.confirm(
  363. "确定要重置密码吗?",
  364. function () {
  365. var ajax = new $ax(Feng.ctxPath + "/admin/enterprise/resetPassword?id=" + Enterprise.seItem.id, function (data) {
  366. Feng.info(data.msg);
  367. // if(data.code == 200){
  368. // Enterprise.table.refresh();
  369. // }
  370. }, function (data) {
  371. Feng.error("操作失败!");
  372. });
  373. ajax.set(null);
  374. ajax.start();
  375. }
  376. );
  377. };
  378. Enterprise.doExport = function () {
  379. var name = $("#name").val();
  380. var idCard = $("#idCard").val();
  381. var medicalCommunityId = $("#medicalCommunityId").val();
  382. var isGeneral = $("#isGeneral").val();
  383. var legal = $("#legal").val();
  384. var ephone = $("#ephone").val();
  385. var agentName = $("#agentName").val();
  386. var agentPhone = $("#agentPhone").val();
  387. var checkState = $("#checkState").val();
  388. var active = $("#active").val();
  389. var arr = {"name": name, "idCard": idCard, "medicalCommunityId": medicalCommunityId, "isGeneral": isGeneral, "legal": legal, "ephone": ephone, "agentName": agentName,
  390. "agentPhone": agentPhone, "checkState": checkState, "active": active};
  391. window.location.href = Feng.setUrlParam(Feng.ctxPath + "/admin/enterprise/export", arr);
  392. }
  393. /**
  394. * 批量获取人才联络员手机号码
  395. */
  396. Enterprise.getPhones = function () {
  397. var ajax = new $ax(Feng.ctxPath + "/enterprise/getPhones", function (data) {
  398. if (data.code == 200) {
  399. layer.open({
  400. type: 1,
  401. title: "手机号码",
  402. area: ['830px', '500px'], //宽高
  403. fix: false, //不固定
  404. maxmin: true,
  405. content: "<span style='word-break:break-all'>" + data.obj + "</span>"
  406. });
  407. } else {
  408. Feng.info(data.msg);
  409. }
  410. }, function (data) {
  411. Feng.error("操作失败!");
  412. });
  413. ajax.setData(Enterprise.formParam());
  414. ajax.start();
  415. }
  416. Enterprise.check = function () {
  417. var selected = $('#' + Enterprise.id).bootstrapTable('getSelections');
  418. if (selected.length == 0) {
  419. Feng.info("请先选中表格中的某一记录!");
  420. return false;
  421. } else {
  422. Enterprise.seItem = selected[0];
  423. return true;
  424. }
  425. };
  426. Enterprise.showLog = function (id) {
  427. layer.open({
  428. type: 1,
  429. title: "日志",
  430. fixed: false,
  431. content: '<table id="' + id + '"></table>',
  432. area: ['80%', '80%'],
  433. maxmin: true,
  434. success: function (layero, index) {
  435. Feng.getCheckLog(id, {"type": 10, "enterpriseId": id, "typeFileId": "", "active": 1})
  436. }
  437. });
  438. };
  439. $(function () {
  440. var defaultColunms = Enterprise.initColumn();
  441. var table = new BSTable(Enterprise.id, "/admin/enterprise/findEnterpriseByPage", defaultColunms);
  442. table.setPaginationType("server");
  443. Enterprise.table = table.init();
  444. });