enterprise_center.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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. {title: '更新统一社会信用代码', field: 'newIdCard', align: 'left', width: 120, valign: 'middle', 'class': 'uitd_showTip'},
  48. {title: '更新法人代表', field: 'newLegal', align: 'left', width: 100, valign: 'middle', 'class': 'uitd_showTip'},
  49. {title: '更新学校地址', field: 'newAddress', align: 'left', width: 200, valign: 'middle', 'class': 'uitd_showTip',
  50. formatter: function (value, row, index) {
  51. return row.newProvinceName + row.newCityName + row.newCountyName + " " + value;
  52. }
  53. },
  54. {title: '审核状态', field: 'checkState', align: 'center', width: 120, valign: 'middle', 'class': 'uitd_showTip',
  55. formatter: function (value, row, index) {
  56. if (value == null || value == '') {
  57. return "";
  58. } else if (value == 1) {
  59. return "保存未提交";
  60. } else if (value == 2) {
  61. return "待审核";
  62. } else if (value == 3) {
  63. return "审核驳回";
  64. } else if (value == 4) {
  65. return "审核通过";
  66. } else if (value == 5) {
  67. return "重新提交";
  68. } else if (value == 6) {
  69. return "初审驳回";
  70. } else if (value == 7) {
  71. return "初审通过";
  72. } else {
  73. return "";
  74. }
  75. },
  76. cellStyle: function (value, row, index) {
  77. if (value == null || value == '') {
  78. return {css: {}};
  79. } else if (value == 1) {
  80. return {css: {}};
  81. } else if (value == 2) {
  82. return {css: {"background-color": "LightGrey"}};
  83. } else if (value == 3) {
  84. return {css: {"background-color": "Orange"}};
  85. } else if (value == 4) {
  86. return {css: {'background-color': 'LightGreen'}};
  87. } else if (value == 5) {
  88. return {css: {'background-color': 'LightGrey'}};
  89. } else if (value == 6) {
  90. return {css: {"background-color": "Orange"}};
  91. } else if (value == 7) {
  92. return {css: {'background-color': 'LightBlue'}};
  93. } else {
  94. return {css: {}};
  95. }
  96. }
  97. },
  98. {title: '申请时间', field: 'createTime', align: 'center', width: 170, valign: 'middle', 'class': 'uitd_showTip'},
  99. {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
  100. formatter: function (value, row, index) {
  101. return "<span class='label label-success' onclick=\"EnterpriseCenter.showLog('" + value + "')\" >" +
  102. "<i class=\"fa fa-book\"></i>日志" +
  103. "</span>";
  104. }
  105. }
  106. ];
  107. };
  108. EnterpriseCenter.addEnterprisechangeRecord = function () {
  109. //查询是否存在 未处理完的 变更申请
  110. var ajax = new $ax(Feng.ctxPath + "/enterprise/api/findUnfinishedChangeRecord", function (data) {
  111. if (data == null || data.length == 0) {
  112. var index = layer.open({
  113. type: 2,
  114. title: '申请学校信息变更',
  115. area: ['930px', '600px'], //宽高
  116. fix: false, //不固定
  117. maxmin: true,
  118. content: Feng.ctxPath + '/enterprise/api/toAdd',
  119. 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;取消'],
  120. btnAlign: 'c',
  121. btn1: function (index, layero) {
  122. //按钮【按钮一】的回调
  123. var iframeWin = window[layero.find('iframe')[0]['name']];
  124. iframeWin.EpChangeEdit.addSubmit();
  125. },
  126. btn2: function (index, layero) {
  127. //按钮二的回调
  128. var iframeWin = window[layero.find('iframe')[0]['name']];
  129. iframeWin.EpChangeEdit.submitToCheck();
  130. return false;
  131. }
  132. });
  133. layer.full(index);
  134. EnterpriseCenter.layerIndex = index;
  135. } else {
  136. Feng.info("您还有 " + data.length + " 条变更申请没有处理完毕, 不能重新提交变更申请!");
  137. }
  138. }, function (data) {
  139. Feng.error("操作失败!" + data.responseJSON.message + "!");
  140. });
  141. ajax.set(null);
  142. ajax.start();
  143. };
  144. EnterpriseCenter.updateEnterprisechangeRecord = function () {
  145. if (!EnterpriseCenter.check()) {
  146. return;
  147. }
  148. var item = EnterpriseCenter.seItem;
  149. if (item.checkState != null && item.checkState == 4) { //如果已经审核通过了
  150. Feng.info("该申请已经审核通过,不能再修改!");
  151. return;
  152. }
  153. var index = layer.open({
  154. type: 2,
  155. title: '申请学校信息变更',
  156. area: ['930px', '600px'], //宽高
  157. fix: false, //不固定
  158. maxmin: true,
  159. content: Feng.ctxPath + '/enterprise/api/toUpdate?id=' + item.id,
  160. 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;取消'],
  161. btnAlign: 'c',
  162. btn1: function (index, layero) {
  163. //按钮【按钮一】的回调
  164. var iframeWin = window[layero.find('iframe')[0]['name']];
  165. iframeWin.EpChangeEdit.addSubmit();
  166. },
  167. btn2: function (index, layero) {
  168. //按钮二的回调
  169. var iframeWin = window[layero.find('iframe')[0]['name']];
  170. iframeWin.EpChangeEdit.submitToCheck();
  171. return false;
  172. }
  173. });
  174. layer.full(index);
  175. EnterpriseCenter.layerIndex = index;
  176. };
  177. EnterpriseCenter.check = function () {
  178. var selected = $('#' + EnterpriseCenter.id).bootstrapTable('getSelections');
  179. if (selected.length == 0) {
  180. Feng.info("请先选中表格中的一条变更记录!");
  181. return false;
  182. } else {
  183. EnterpriseCenter.seItem = selected[0];
  184. return true;
  185. }
  186. };
  187. EnterpriseCenter.showEnterprisechangeRecordDetail = function () {
  188. if (!EnterpriseCenter.check()) {
  189. return;
  190. }
  191. var index = layer.open({
  192. type: 2,
  193. title: '学校信息变更详情',
  194. area: ['930px', '600px'], //宽高
  195. fix: false, //不固定
  196. maxmin: true,
  197. content: Feng.ctxPath + '/enterprise/api/toDetail?id=' + EnterpriseCenter.seItem.id,
  198. btn: ['<i class="fa fa-eraser"></i>&nbsp;&nbsp;关闭'],
  199. btn1: function (index, layero) {
  200. layer.close(index);
  201. },
  202. });
  203. layer.full(index);
  204. EnterpriseCenter.layerIndex = index;
  205. };
  206. /**
  207. * 显示日志
  208. * @param id
  209. */
  210. EnterpriseCenter.showLog = function (id) {
  211. layer.open({
  212. type: 1,
  213. title: "日志",
  214. fixed: false,
  215. content: '<table id="' + id + '"></table>',
  216. area: ['80%', '80%'],
  217. maxmin: true,
  218. success: function (layero, index) {
  219. Feng.getCheckLog(id, {"type": 10, "mainId": id, "typeFileId": "", "active": 1})
  220. }
  221. });
  222. }
  223. /**
  224. * 发送验证码
  225. */
  226. EnterpriseCenter.getEnterpriseSms = function () {
  227. var agentPhone = $("#tab-1").find("input[name='agentPhone']").val();
  228. if (agentPhone == null || agentPhone == "") {
  229. Feng.info("人才联络员手机号码为空!");
  230. return;
  231. }
  232. agentPhone = $.trim(agentPhone);
  233. if (!Feng.checkMobilePhoneNum(agentPhone)) {
  234. Feng.info("手机号格式有误,请填写正确的手机号码!");
  235. return;
  236. }
  237. EnterpriseCenter.enterpriseBtnCountDown();
  238. var ajax = new $ax(Feng.ctxPath + "/api/common/verificationCode?phone=" + agentPhone + "&type=1", function (data) {
  239. Feng.info(data.msg);
  240. }, function (data) {
  241. Feng.error("操作失败!" + data.responseJSON.message + "!");
  242. });
  243. ajax.set(null);
  244. ajax.start();
  245. }
  246. var enterpriseCountDown = 0;
  247. EnterpriseCenter.enterpriseBtnCountDown = function () {
  248. if (enterpriseCountDown == 0) {
  249. enterpriseCountDown = 60;
  250. } else if (enterpriseCountDown == 1) {
  251. $("#enterprise_sms_btn").removeAttr("disabled");
  252. $("#enterprise_sms_btn").html("获取验证码");
  253. enterpriseCountDown = 0;
  254. return;
  255. }
  256. $("#enterprise_sms_btn").attr("disabled", true);
  257. $("#enterprise_sms_btn").html(enterpriseCountDown + "秒");
  258. enterpriseCountDown--;
  259. setTimeout("EnterpriseCenter.enterpriseBtnCountDown()", 1000);
  260. }
  261. /**
  262. * 绑定聚才网账号
  263. */
  264. EnterpriseCenter.bindJcAccount = function () {
  265. var username = $("#username").val();
  266. var password = $("#password").val();
  267. var verificationCode = $("#verificationCode").val();
  268. if (username == null || username == '') {
  269. Feng.info("聚才网账号不能为空");
  270. return;
  271. }
  272. if (password == null || password == '') {
  273. Feng.info("聚才网账号密码不能为空");
  274. return;
  275. }
  276. if (verificationCode == null || verificationCode == '') {
  277. Feng.info("验证码不能为空");
  278. return;
  279. }
  280. var ajax = new $ax(Feng.ctxPath + "/api/jucaiInterface/bindAccount", function (data) {
  281. Feng.info(data.msg);
  282. }, function (data) {
  283. Feng.error("操作失败!" + data.responseJSON.message + "!");
  284. });
  285. ajax.setData({"userType": 1, "username": username, "password": password, "verificationCode": verificationCode})
  286. ajax.start();
  287. }
  288. $(function () {
  289. var defaultColunms = EnterpriseCenter.initColumn();
  290. var table = new BSTable(EnterpriseCenter.id, "/enterprise/api/findEnterpriseChangeByPage", defaultColunms);
  291. table.setPaginationType("server");
  292. EnterpriseCenter.table = table.init();
  293. var type = $("#type").val();
  294. if (type == 1) {
  295. $("#talentType,#industryFieldNewName,#industryFieldOldName").parent().parent().attr("style", "display:block");
  296. }
  297. });