list.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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: 'idCard', visible: true, align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  15. {title: '法人代表', field: 'legal', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  16. {title: '医院电话', field: 'ephone', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  17. {title: '人才联络员', field: 'agentName', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  18. {title: '人才联络员电话', field: 'agentPhone', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  19. {title: '审核状态', field: 'checkState', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip',
  20. formatter: function (value, row, index) {
  21. if (value == null || value == '') {
  22. return "";
  23. } else if (value == 1) {
  24. return "未审核";
  25. } else if (value == 2) {
  26. return "审核驳回";
  27. } else if (value == 3) {
  28. return "审核通过";
  29. } else if (value == 4) {
  30. return "重新提交";
  31. } else if (value == 5) {
  32. return "初审驳回";
  33. } else if (value == 6) {
  34. return "初审通过";
  35. }
  36. },
  37. cellStyle: function (value, row, index) {
  38. if (value == null || value === '') {
  39. return {css: {}};
  40. } else if (value === 1) {
  41. return {css: {"background-color": "LightGrey"}};
  42. } else if (value === 3) {
  43. return {css: {'background-color': 'LightGreen'}};
  44. } else if (value === 2) {
  45. return {css: {"background-color": "Orange"}};
  46. } else if (value === 4) {
  47. return {css: {'background-color': 'LightGrey'}};
  48. } else if (value === 5) {
  49. return {css: {'background-color': 'Orange'}};
  50. } else if (value === 6) {
  51. return {css: {"background-color": "LightBlue"}};
  52. } else {
  53. return {css: {}};
  54. }
  55. }
  56. },
  57. {title: '账号状态', field: 'active', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip',
  58. formatter: function (value, row, index) {
  59. if (value == null || value == '') {
  60. return "";
  61. } else if (value == 1) {
  62. return "账号有效";
  63. } else if (value == 2) {
  64. return "拉黑/冻结";
  65. }
  66. },
  67. cellStyle: function (value, row, index) {
  68. if (value == null || value === '') {
  69. return {css: {}};
  70. } else if (value === 1) {
  71. return {css: {'background-color': 'LightGreen'}};
  72. } else if (value === 2) {
  73. return {css: {"background-color": "Orange"}};
  74. } else {
  75. return {css: {}};
  76. }
  77. }
  78. },
  79. {title: '注册时间', field: 'createTime', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  80. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
  81. formatter: function (value, row, index) {
  82. return "<span class='label label-success' onclick=\"Enterprise.showLog('" + value + "')\" >" +
  83. "<i class=\"fa fa-book\"></i>日志" +
  84. "</span>";
  85. }
  86. }
  87. ];
  88. };
  89. Enterprise.formParam = function () {
  90. var queryData = {};
  91. queryData['name'] = $("#name").val();
  92. queryData['idCard'] = $("#idCard").val();
  93. queryData['medicalCommunityId'] = $("#medicalCommunityId").val();
  94. queryData['isGeneral'] = $("#isGeneral").val();
  95. queryData['legal'] = $("#legal").val();
  96. queryData['ephone'] = $("#ephone").val();
  97. queryData['agentName'] = $("#agentName").val();
  98. queryData['agentPhone'] = $("#agentPhone").val();
  99. queryData['checkState'] = $("#checkState").val();
  100. queryData['active'] = $("#active").val();
  101. return queryData;
  102. }
  103. Enterprise.search = function () {
  104. Enterprise.table.refresh({"query": Enterprise.formParam()});
  105. };
  106. Enterprise.reset = function () {
  107. $("#name").val("");
  108. $("#idCard").val("");
  109. $("#medicalCommunityId").val("");
  110. $("#isGeneral").val("");
  111. $("#legal").val("");
  112. $("#ephone").val("");
  113. $("#agentName").val("");
  114. $("#agentPhone").val("");
  115. $("#checkState").val("");
  116. $("#active").val("");
  117. };
  118. Enterprise.gotoEnterpriseDetailPage = function () {
  119. if (!Enterprise.check()) {
  120. return;
  121. }
  122. var index = layer.open({
  123. type: 2,
  124. title: '查看详情',
  125. area: ['830px', '450px'], //宽高
  126. fix: false, //不固定
  127. maxmin: true,
  128. content: Feng.ctxPath + '/enterprise/hospital/detail?id=' + Enterprise.seItem.id,
  129. btn: ['<i class="fa fa-check"></i>&nbsp;&nbsp;审核', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  130. btnAlign: 'c',
  131. yes: function (index, layero) {
  132. Enterprise.doExamine();
  133. }
  134. });
  135. layer.full(index);
  136. Enterprise.layerIndex = index;
  137. };
  138. Enterprise.doExamine = function () {
  139. if (!Enterprise.check()) {
  140. return;
  141. }
  142. var inCheckList = [1, 2, 4, 5];
  143. if (Enterprise.seItem.checkState == null || inCheckList.indexOf(Enterprise.seItem.checkState) == -1) {
  144. Feng.info("不在审核范围内!");
  145. return;
  146. }
  147. var index = layer.open({
  148. type: 2,
  149. title: '审核',
  150. area: ['830px', '500px'], //宽高
  151. fix: false, //不固定
  152. maxmin: true,
  153. shade: 0,
  154. content: Feng.ctxPath + '/enterprise/hospital/examine?id=' + Enterprise.seItem.id,
  155. 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;取消'],
  156. btnAlign: 'c',
  157. yes: function (index, layero) {
  158. //按钮【按钮一】的回调
  159. layer.confirm("确认提交审核结果?", function () {
  160. var iframeWin = window[layero.find('iframe')[0]['name']];
  161. iframeWin.EpExam.submitToCheck();
  162. })
  163. },
  164. btn2: function (index, layero) {
  165. var iframeWin = window[layero.find('iframe')[0]['name']];
  166. iframeWin.EpExam.addSubmit();
  167. return false;
  168. }
  169. });
  170. // layer.full(index);
  171. };
  172. /**
  173. * 修改驳回的字段及附件
  174. */
  175. Enterprise.updateFieldsAndFiles = function () {
  176. if (this.check()) {
  177. var id = Enterprise.seItem.id;
  178. var ajax = new $ax("/enterprise/hospital/findFieldsAndFiles?id=" + id, function (data) {
  179. if (data.code == 200) {
  180. layer.open({
  181. type: 1,
  182. id: "fieldCheckModalForm",
  183. title: '修改',
  184. area: ['800px', '450px'], //宽高
  185. fix: false, //不固定
  186. shade: 0,
  187. maxmin: true,
  188. content: Enterprise.creatFieldCheckModal(),
  189. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;提交', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  190. btnAlign: 'c',
  191. zIndex: layer.zIndex,
  192. success: function (layero, index) {
  193. var fileList = data.files;
  194. var fieldList = data.fields;
  195. var html_field = '';
  196. var html_file = '';
  197. for (var key in fieldList) {
  198. html_field = html_field + '<li><input type="checkbox" ' + (fieldList[key].checked ? "checked" : "") + ' value="' + fieldList[key].field + '"><span>' + fieldList[key].name + '</span></li>';
  199. }
  200. for (var key in fileList) {
  201. 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>';
  202. }
  203. $("#field_info").empty().append("<ul>" + html_field + "</ul>");
  204. $("#field_file").empty().append("<ul>" + html_file + "</ul>");
  205. },
  206. yes: function (index, layero) {
  207. Enterprise.submitFieldsAndFiles(index, id);
  208. }
  209. });
  210. } else {
  211. Feng.error(data.msg);
  212. }
  213. }, function (data) {
  214. Feng.error("查询失败!" + data.responseJSON.message + "!");
  215. });
  216. ajax.start();
  217. }
  218. };
  219. /**
  220. * 修改提交
  221. * @param index
  222. * @param id
  223. */
  224. Enterprise.submitFieldsAndFiles = function (index, id) {
  225. var fields = '';
  226. var files = '';
  227. $("#field_info li input").each(function (index) {
  228. if ($(this).is(":checked")) {
  229. fields = fields + $(this).val() + ",";
  230. }
  231. });
  232. $("#field_file li input").each(function (index) {
  233. if ($(this).is(":checked")) {
  234. files = files + $(this).val() + ",";
  235. }
  236. });
  237. if (fields == '' && files == '') {
  238. Feng.info("请选择可修改的字段或附件!");
  239. return;
  240. }
  241. var ajax = new $ax("/enterprise/hospital/updateFieldsAndFiles", function (data) {
  242. if (data.code == 200) {
  243. layer.close(index);
  244. Feng.success(data.msg);
  245. } else {
  246. Feng.error(data.msg);
  247. }
  248. }, function (data) {
  249. Feng.error("修改失败!" + data.responseJSON.message + "!");
  250. });
  251. ajax.setData({"id": id, "fields": fields, "files": files})
  252. ajax.start();
  253. };
  254. Enterprise.creatFieldCheckModal = function () {
  255. return '<form id="fieldCheckModalForm">\n' +
  256. ' <div class="form-group" style="margin: 10px;">\n' +
  257. ' <div >\n' +
  258. ' <label for="checkMsg" class="control-label">可修改字段</label>\n' +
  259. ' <div id="field_info">\n' +
  260. ' </div>\n' +
  261. ' <label for="checkMsg" class="control-label">可修改附件</label>\n' +
  262. ' <div id="field_file">\n' +
  263. ' </div>\n' +
  264. ' <div class="form-group" style="text-align: center">\n' +
  265. ' <button type="button" class="btn btn-primary" onclick="Enterprise.checkAll()">全选</button>\n' +
  266. ' <button type="button" class="btn btn-success" onclick="Enterprise.unCheckAll()">反选</button>\n' +
  267. ' </div>\n' +
  268. ' </div>\n' +
  269. ' </div>\n' +
  270. ' </form>';
  271. };
  272. Enterprise.checkAll = function () {
  273. $("#fieldCheckModalForm input[type=checkbox]").prop("checked", true);
  274. };
  275. Enterprise.unCheckAll = function () {
  276. $("#fieldCheckModalForm input[type=checkbox]").removeAttr("checked");
  277. };
  278. Enterprise.check = function () {
  279. var selected = $('#' + Enterprise.id).bootstrapTable('getSelections');
  280. if (selected.length == 0) {
  281. Feng.info("请先选中表格中的某一记录!");
  282. return false;
  283. } else {
  284. Enterprise.seItem = selected[0];
  285. return true;
  286. }
  287. };
  288. Enterprise.showLog = function (id) {
  289. layer.open({
  290. type: 1,
  291. title: "日志",
  292. fixed: false,
  293. content: '<table id="' + id + '"></table>',
  294. area: ['80%', '80%'],
  295. maxmin: true,
  296. success: function (layero, index) {
  297. Feng.getCheckLog(id, {"type": 10, "enterpriseId": id, "typeFileId": "", "active": 1})
  298. }
  299. });
  300. };
  301. $(function () {
  302. var defaultColunms = Enterprise.initColumn();
  303. var table = new BSTable(Enterprise.id, "/enterprise/hospital/getList", defaultColunms);
  304. table.setPaginationType("server");
  305. Enterprise.table = table.init();
  306. });