enterprise_center.js 11 KB

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