enterprise_center.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. var EnterpriseCenter = {
  2. id: "table", //表格id
  3. seItem: null, //选中的条目
  4. table: null,
  5. layerIndex: -1
  6. };
  7. EnterpriseCenter.changePwd = function () {
  8. var password = $("#tab-3").find("input[name='password']").val();
  9. var newPassword = $("#tab-3").find("input[name='newPassword']").val();
  10. var newRePassword = $("#tab-3").find("input[name='newRePassword']").val();
  11. if (password == null || password == '') {
  12. Feng.info("请填写原密码!");
  13. return;
  14. }
  15. if (newPassword == null || newPassword == '') {
  16. Feng.info("请填写新密码!");
  17. return;
  18. }
  19. if (newRePassword == null || newRePassword == '') {
  20. Feng.info("请填写重复新密码!");
  21. return;
  22. }
  23. if (newPassword != newRePassword) {
  24. console.log(newPassword, newRePassword)
  25. Feng.info("两次新密码填写不一致!");
  26. return;
  27. }
  28. var da = {"password": password, "newPassword": newPassword};
  29. var ajax = new $ax(Feng.ctxPath + "/common/api/changePwd", function (data) {
  30. Feng.info(data.msg);
  31. if (data.code == 200) {
  32. $("#tab-3").find("input[name='password']").val('');
  33. $("#tab-3").find("input[name='newPassword']").val('');
  34. $("#tab-3").find("input[name='newRePassword']").val('');
  35. }
  36. }, function (data) {
  37. Feng.error("操作失败!" + data.responseJSON.message + "!");
  38. });
  39. ajax.set(da);
  40. ajax.start();
  41. };
  42. EnterpriseCenter.initColumn = function () {
  43. return [
  44. {field: 'selectItem', radio: true},
  45. {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
  46. {title: '更新医院名称', field: 'newName', align: 'left', width: 120, valign: 'middle', 'class': 'uitd_showTip',
  47. formatter: function (value, row, index) {
  48. return value + (row.newIsGeneral == 1 ? "(总院)" : "");
  49. }
  50. },
  51. {title: '更新登记号', field: 'newIdCard', align: 'center', width: 160, valign: 'middle', 'class': 'uitd_showTip'},
  52. {title: '更新法人代表', field: 'newLegal', align: 'left', width: 100, valign: 'middle', 'class': 'uitd_showTip'},
  53. {title: '更新医共体', field: 'newMedicalCommunityName', align: 'left', width: 100, valign: 'middle', 'class': 'uitd_showTip'},
  54. {title: '更新医院地址', field: 'newAddress', align: 'left', width: 200, valign: 'middle', 'class': 'uitd_showTip',
  55. formatter: function (value, row, index) {
  56. return row.newProvinceName + row.newCityName + row.newCountyName + " " + value;
  57. }
  58. },
  59. {title: '审核状态', field: 'checkState', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip',
  60. formatter: function (value, row, index) {
  61. if (value == null || value == '') {
  62. return "";
  63. } else if (value == 1) {
  64. return "保存未提交";
  65. } else if (value == 2) {
  66. return "待审核";
  67. } else if (value == 3) {
  68. return "审核驳回";
  69. } else if (value == 4) {
  70. return "审核通过";
  71. } else if (value == 5) {
  72. return "重新提交";
  73. } else if (value == 6) {
  74. return "初审驳回";
  75. } else if (value == 7) {
  76. return "初审通过";
  77. } else {
  78. return "";
  79. }
  80. },
  81. cellStyle: function (value, row, index) {
  82. if (value == null || value == '') {
  83. return {css: {}};
  84. } else if (value == 1) {
  85. return {css: {}};
  86. } else if (value == 2) {
  87. return {css: {"background-color": "LightGrey"}};
  88. } else if (value == 3) {
  89. return {css: {"background-color": "Orange"}};
  90. } else if (value == 4) {
  91. return {css: {'background-color': 'LightGreen'}};
  92. } else if (value == 5) {
  93. return {css: {'background-color': 'LightGrey'}};
  94. } else if (value == 6) {
  95. return {css: {"background-color": "Orange"}};
  96. } else if (value == 7) {
  97. return {css: {'background-color': 'LightBlue'}};
  98. } else {
  99. return {css: {}};
  100. }
  101. }
  102. },
  103. {title: '申请时间', field: 'createTime', align: 'center', width: 170, valign: 'middle', 'class': 'uitd_showTip'},
  104. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
  105. formatter: function (value, row, index) {
  106. return "<span class='label label-success' onclick=\"EnterpriseCenter.showLog('" + value + "')\" >" +
  107. "<i class=\"fa fa-book\"></i>日志" +
  108. "</span>";
  109. }
  110. }
  111. ];
  112. };
  113. EnterpriseCenter.addEnterprisechangeRecord = function () {
  114. //查询是否存在 未处理完的 变更申请
  115. var ajax = new $ax(Feng.ctxPath + "/enterprise/api/findUnfinishedChangeRecord", function (data) {
  116. if (data == null || data.length == 0) {
  117. var index = layer.open({
  118. type: 2,
  119. title: '申请医院信息变更',
  120. area: ['930px', '600px'], //宽高
  121. fix: false, //不固定
  122. maxmin: true,
  123. content: Feng.ctxPath + '/enterprise/api/toAdd',
  124. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;保存未提交', '<i class="fa fa-check"></i>&nbsp;&nbsp;提交审核', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  125. btnAlign: 'c',
  126. btn1: function (index, layero) {
  127. //按钮【按钮一】的回调
  128. var iframeWin = window[layero.find('iframe')[0]['name']];
  129. iframeWin.EpChangeEdit.addSubmit();
  130. },
  131. btn2: function (index, layero) {
  132. //按钮二的回调
  133. var iframeWin = window[layero.find('iframe')[0]['name']];
  134. iframeWin.EpChangeEdit.submitToCheck();
  135. return false;
  136. }
  137. });
  138. layer.full(index);
  139. EnterpriseCenter.layerIndex = index;
  140. } else {
  141. Feng.info("您还有 " + data.length + " 条变更申请没有处理完毕, 不能重新提交变更申请!");
  142. }
  143. }, function (data) {
  144. Feng.error("操作失败!" + data.responseJSON.message + "!");
  145. });
  146. ajax.set(null);
  147. ajax.start();
  148. };
  149. EnterpriseCenter.updateEnterprisechangeRecord = function () {
  150. if (!EnterpriseCenter.check()) {
  151. return;
  152. }
  153. var item = EnterpriseCenter.seItem;
  154. if (item.checkState != null && item.checkState == 4) { //如果已经审核通过了
  155. Feng.info("该申请已经审核通过,不能再修改!");
  156. return;
  157. }
  158. var index = layer.open({
  159. type: 2,
  160. title: '申请医院信息变更',
  161. area: ['930px', '600px'], //宽高
  162. fix: false, //不固定
  163. maxmin: true,
  164. content: Feng.ctxPath + '/enterprise/api/toUpdate?id=' + item.id,
  165. btn: ['<i class="fa fa-save"></i>&nbsp;&nbsp;保存未提交', '<i class="fa fa-check"></i>&nbsp;&nbsp;提交审核', '<i class="fa fa-eraser"></i>&nbsp;&nbsp;取消'],
  166. btnAlign: 'c',
  167. btn1: function (index, layero) {
  168. //按钮【按钮一】的回调
  169. var iframeWin = window[layero.find('iframe')[0]['name']];
  170. iframeWin.EpChangeEdit.addSubmit();
  171. },
  172. btn2: function (index, layero) {
  173. //按钮二的回调
  174. var iframeWin = window[layero.find('iframe')[0]['name']];
  175. iframeWin.EpChangeEdit.submitToCheck();
  176. return false;
  177. }
  178. });
  179. layer.full(index);
  180. EnterpriseCenter.layerIndex = index;
  181. };
  182. EnterpriseCenter.check = function () {
  183. var selected = $('#' + EnterpriseCenter.id).bootstrapTable('getSelections');
  184. if (selected.length == 0) {
  185. Feng.info("请先选中表格中的一条变更记录!");
  186. return false;
  187. } else {
  188. EnterpriseCenter.seItem = selected[0];
  189. return true;
  190. }
  191. };
  192. EnterpriseCenter.showEnterprisechangeRecordDetail = function () {
  193. if (!EnterpriseCenter.check()) {
  194. return;
  195. }
  196. var index = layer.open({
  197. type: 2,
  198. title: '医院信息变更详情',
  199. area: ['930px', '600px'], //宽高
  200. fix: false, //不固定
  201. maxmin: true,
  202. content: Feng.ctxPath + '/enterprise/api/toDetail?id=' + EnterpriseCenter.seItem.id,
  203. btn: ['<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  204. btn1: function (index, layero) {
  205. layer.close(index);
  206. },
  207. });
  208. layer.full(index);
  209. EnterpriseCenter.layerIndex = index;
  210. };
  211. /**
  212. * 显示日志
  213. * @param id
  214. */
  215. EnterpriseCenter.showLog = function (id) {
  216. layer.open({
  217. type: 1,
  218. title: "日志",
  219. fixed: false,
  220. content: '<table id="' + id + '"></table>',
  221. area: ['80%', '80%'],
  222. maxmin: true,
  223. success: function (layero, index) {
  224. Feng.getCheckLog(id, {"type": 10, "mainId": id, "typeFileId": "", "active": 1})
  225. }
  226. });
  227. }
  228. /**
  229. * 发送验证码
  230. */
  231. EnterpriseCenter.getEnterpriseSms = function () {
  232. var agentPhone = $("#tab-1").find("input[name='agentPhone']").val();
  233. if (agentPhone == null || agentPhone == "") {
  234. Feng.info("人才联络员手机号码为空!");
  235. return;
  236. }
  237. agentPhone = $.trim(agentPhone);
  238. if (!Feng.checkMobilePhoneNum(agentPhone)) {
  239. Feng.info("手机号格式有误,请填写正确的手机号码!");
  240. return;
  241. }
  242. EnterpriseCenter.enterpriseBtnCountDown();
  243. var ajax = new $ax(Feng.ctxPath + "/api/common/verificationCode?phone=" + agentPhone + "&type=1", function (data) {
  244. Feng.info(data.msg);
  245. }, function (data) {
  246. Feng.error("操作失败!" + data.responseJSON.message + "!");
  247. });
  248. ajax.set(null);
  249. ajax.start();
  250. }
  251. var enterpriseCountDown = 0;
  252. EnterpriseCenter.enterpriseBtnCountDown = function () {
  253. if (enterpriseCountDown == 0) {
  254. enterpriseCountDown = 60;
  255. } else if (enterpriseCountDown == 1) {
  256. $("#enterprise_sms_btn").removeAttr("disabled");
  257. $("#enterprise_sms_btn").html("获取验证码");
  258. enterpriseCountDown = 0;
  259. return;
  260. }
  261. $("#enterprise_sms_btn").attr("disabled", true);
  262. $("#enterprise_sms_btn").html(enterpriseCountDown + "秒");
  263. enterpriseCountDown--;
  264. setTimeout("EnterpriseCenter.enterpriseBtnCountDown()", 1000);
  265. }
  266. /**
  267. * 绑定聚才网账号
  268. */
  269. EnterpriseCenter.bindJcAccount = function () {
  270. var username = $("#username").val();
  271. var password = $("#password").val();
  272. var verificationCode = $("#verificationCode").val();
  273. if (username == null || username == '') {
  274. Feng.info("聚才网账号不能为空");
  275. return;
  276. }
  277. if (password == null || password == '') {
  278. Feng.info("聚才网账号密码不能为空");
  279. return;
  280. }
  281. if (verificationCode == null || verificationCode == '') {
  282. Feng.info("验证码不能为空");
  283. return;
  284. }
  285. var ajax = new $ax(Feng.ctxPath + "/api/jucaiInterface/bindAccount", function (data) {
  286. Feng.info(data.msg);
  287. }, function (data) {
  288. Feng.error("操作失败!" + data.responseJSON.message + "!");
  289. });
  290. ajax.setData({"userType": 1, "username": username, "password": password, "verificationCode": verificationCode})
  291. ajax.start();
  292. }
  293. var lock = false;
  294. EnterpriseCenter.closeAccount = function () {
  295. Feng.confirm("是否确定提交注销申请?", function () {
  296. var reason = $("#reason").val().trim();
  297. if (reason == "") {
  298. Feng.info("注销原因不能为空");
  299. return;
  300. }
  301. if (typeof $("#fileList ul li") == "undefined" && document.getElementById("close-uploader").files.length == 0) {
  302. Feng.info("请上传附件");
  303. return;
  304. }
  305. if (!lock) {
  306. lock = true;
  307. $("#close-uploader-btn").prop("disabled", true);
  308. } else {
  309. Feng.info("不能重复点击");
  310. return;
  311. }
  312. $("#EpCloseForm")[0].submit();
  313. })
  314. }
  315. EnterpriseCenter.setDisabled = function () {
  316. $("#reason").prop("readonly", true);
  317. $("#close-uploader-btn").prop("disabled", true);
  318. $("#closeAccountBtn").prop("disabled", true).text("审核中");
  319. }
  320. EnterpriseCenter.callback = function (data) {
  321. lock = false;
  322. if (data.code == 200) {
  323. Feng.success(data.msg);
  324. EnterpriseCenter.setDisabled();
  325. $("#closeAccountState").val(data.checkState);
  326. } else {
  327. Feng.error(data.msg);
  328. $("#close-uploader-btn").removeAttr("disabled");
  329. }
  330. }
  331. $("#close-uploader").change(function (e) {
  332. var that = this;
  333. var files = that.files;
  334. var totalSize = 0;
  335. for (var i = 0; i < files.length; i++) {
  336. if (!Feng.chkFileInvalid(files[i], 5, 10)) {
  337. return;
  338. }
  339. totalSize += files[i].size;
  340. }
  341. if (totalSize > 10 * 1024 * 1024) {
  342. Feng.error("所有附件大小不能超过10MB");
  343. return;
  344. }
  345. $("#fileList ul").html("");
  346. for (var i = 0; i < files.length; i++) {
  347. var file = files[i];
  348. var imgSrc;
  349. var reader = new FileReader();
  350. reader.readAsDataURL(file);
  351. reader.onload = function () {
  352. if (Feng.isImg(file.type)) {
  353. imgSrc = this.result;
  354. var li = '<li><img src="' + imgSrc + '"/></li>';
  355. $("#fileList ul").append(li);
  356. } else {
  357. var li = '<li><img src="/static/img/Pdf.png"/></li>';
  358. $("#fileList ul").append(li);
  359. }
  360. };
  361. }
  362. });
  363. $(function () {
  364. var defaultColunms = EnterpriseCenter.initColumn();
  365. var table = new BSTable(EnterpriseCenter.id, "/enterprise/api/findEnterpriseChangeByPage", defaultColunms);
  366. table.setPaginationType("server");
  367. EnterpriseCenter.table = table.init();
  368. var type = $("#type").val();
  369. if (type == 1) {
  370. $("#talentType,#industryFieldNewName,#industryFieldOldName").parent().parent().attr("style", "display:block");
  371. }
  372. });