enterprise_center.js 14 KB

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