portal html css js resource

cmp-staffListNew.js 8.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. $(document).ready(function() {
  2. $(".onlogin .headnavbtn li").eq(0).addClass("navcurrent");
  3. $(".workmenu>ul>li.staffIcon").addClass("nowLi");
  4. var orgId = $.cookie('orgId');
  5. if(orgId == "" || orgId == null || orgId == "null"){
  6. location.href = "cmp-settled-log.html";
  7. }
  8. var pageSize = 10;
  9. resMgr(orgId);
  10. companyAuthStatus();
  11. getDefaultUser();
  12. authorizedUser(1,1,true);
  13. authorizedUser(1,0,true);
  14. /*判断企业是否认证*/
  15. function companyAuthStatus() {
  16. $.ajax({
  17. url: "/ajax/org/authStatus",
  18. type: "GET",
  19. timeout: 10000,
  20. dataType: "json",
  21. data: {
  22. "id": orgId
  23. },
  24. success: function(data) {
  25. if(data.success) {
  26. if(data.data == 3) {
  27. $("#companyDemandList").show();
  28. } else {
  29. $("#identityState").show();
  30. }
  31. }
  32. }
  33. })
  34. }
  35. /*获取企业认证/待认证的用户*/
  36. function authorizedUser(pageNo,orgAuth,isbind) {
  37. var strId='',strPage='';
  38. if(orgAuth === 1){
  39. strId = "#authorizedUserList",
  40. strPage = "#authtcdPageCode"
  41. }else{
  42. strId = "#UnauthorizedUserList",
  43. strPage = "#UnauthtcdPageCode"
  44. }
  45. $.ajax({
  46. url: "/ajax/professor/pqOrgAuth",
  47. type: "GET",
  48. dataType: "json",
  49. data: {
  50. "orgId": orgId,
  51. "orgAuth": orgAuth,
  52. "pageSize":pageSize,
  53. "pageNo":pageNo
  54. },
  55. success: function(data) {
  56. if(data.success && data.data.data != "") {
  57. console.log(data);
  58. var $data = data.data.data;
  59. $(strPage).show();
  60. $(strId).html('');
  61. $(strId).parents('.list-wrapper').show();
  62. $("#authStaffs").html(data.data.total)
  63. for(var i = 0; i < $data.length; i++) {
  64. $.ajax({
  65. url: "/ajax/professor/baseInfo/" + $data[i].id,
  66. type: "GET",
  67. dataType: "json",
  68. success: function(res) {
  69. if(res.success) {
  70. authorizedUserHtml(orgAuth, res.data, strId);
  71. }
  72. }
  73. })
  74. }
  75. //分页
  76. if(isbind) {
  77. $(strPage).createPage({
  78. pageCount: Math.ceil(data.data.total / pageSize),
  79. current: data.data.pageNo,
  80. backFn: function(p) {
  81. $(strId).html("");
  82. authorizedUser(p,orgAuth,false);
  83. }
  84. });
  85. }
  86. }else{
  87. if(orgAuth === 1){
  88. var str = '<div class="default-text default-text-2"><div>您还没有认证员工</div>'+
  89. '<a class="goYaoqing" href="javascript:void(0)">点击邀请您的员工</a></div>';
  90. $(strId).html(str);
  91. $(strPage).hide();
  92. }else{
  93. $(strId).parents('.list-wrapper').hide();
  94. }
  95. }
  96. }
  97. })
  98. }
  99. /*获取默认联系人列表*/
  100. function getDefaultUser() {
  101. var strId = "#defaultUserList"
  102. $.ajax({
  103. url: "/ajax/org/linkman/queryAll",
  104. type: "GET",
  105. dataType: "json",
  106. data: {
  107. "oid": orgId
  108. },
  109. success: function(data) {
  110. if(data.success && data.data != "") {
  111. $(strId).html('');
  112. var $data = data.data
  113. for(var i = 0; i < $data.length; i++){
  114. $.ajax({
  115. url: "/ajax/professor/baseInfo/" + $data[i].pid,
  116. type: "GET",
  117. dataType: "json",
  118. success: function(res) {
  119. if(res.success) {
  120. authorizedUserHtml(2, res.data, strId);
  121. }
  122. }
  123. })
  124. }
  125. }else{
  126. var str = '<div class="default-text default-text-3">您还没有设置默认联系人<br>用户可以通过他与您的企业取得联系</div>';
  127. $(strId).html(str);
  128. }
  129. }
  130. })
  131. }
  132. /*企业认证用户html*/
  133. function authorizedUserHtml(flag, $res, toHtm) {
  134. var img, tiof, deor, offt;
  135. if($res.hasHeadImage) {
  136. img = "/images/head/" + $res.id + "_l.jpg";
  137. } else {
  138. img = "../images/default-photo.jpg"
  139. }
  140. var userType = autho($res.authType, $res.orgAuth, $res.authStatus);
  141. if($res.title) {
  142. tiof = $res.title
  143. } else {
  144. if($res.office) {
  145. tiof = $res.office;
  146. } else {
  147. tiof = "";
  148. }
  149. }
  150. if($res.department) {
  151. if($res.orgName) {
  152. deor = $res.department + " ," + $res.orgName;
  153. } else {
  154. deor = $res.department;
  155. }
  156. } else {
  157. if($res.orgName) {
  158. deor = $res.orgName;
  159. } else {
  160. deor = "";
  161. }
  162. }
  163. if(tiof == ''){
  164. if(deor == ''){
  165. offt=''
  166. }else{
  167. offt = deor
  168. }
  169. }else{
  170. if(deor == ''){
  171. offt = tiof
  172. }else{
  173. offt = tiof + ',' + deor
  174. }
  175. }
  176. var btnStr='';
  177. if(flag===1){
  178. btnStr='<div class="block-btn" data-id="'+ $res.id +'">'+
  179. '<span class="block-btn-1 setDefault">设为默认联系人</span>'+
  180. '<span class="cancelAuth">取消认证</span>'+
  181. '</div>'
  182. }else if(flag===0){
  183. btnStr='<div class="block-btn block-btnT" data-id="'+ $res.id +'">'+
  184. '<span class="block-btn-1 setAuth">认证</span>'+
  185. '</div>'
  186. }
  187. var oString = '<div class="block-item">'+
  188. '<a class="block-item-child" href="../userInforShow.html?professorId='+ $res.id +'">'+
  189. '<div class="show-head" style="background-image:url('+img+')"></div>'+
  190. '<div class="show-info">'+
  191. '<div class="info-tit ellipsisSty">' + $res.name + '<em class="authicon '+ userType.sty +'" title="'+userType.title+'"></em></div>'+
  192. '<div class="info-tag ellipsisSty">' + offt + '</div>'+
  193. '</div>'+
  194. '</a>'+ btnStr +
  195. '</div>'
  196. $(toHtm).append(oString);
  197. }
  198. /*设置默认联系人*/
  199. $("#authorizedUserList").on("click", ".setDefault", function() {
  200. var oDataId = $(this).parent().attr("data-id");
  201. var oDa = $(this);
  202. $.ajax({
  203. url: '/ajax/org/linkman/save',
  204. type: "POST",
  205. dataType: "json",
  206. data: {
  207. "oid": orgId,
  208. "pid": '1,'+oDataId
  209. },
  210. success: function(data) {
  211. if(data.success) {
  212. getDefaultUser()
  213. }
  214. }
  215. })
  216. })
  217. /*setAuth员工认证*/
  218. $("#UnauthorizedUserList").on("click", ".setAuth", function() {
  219. var oDataId = $(this).parent().attr("data-id");
  220. $.ajax({
  221. url: '/ajax/professor/passOrgAuth',
  222. type: "POST",
  223. dataType: "json",
  224. data: {
  225. "id": oDataId
  226. },
  227. success: function(data) {
  228. if(data.success) {
  229. authorizedUser(1,1,true);
  230. authorizedUser(1,0,true);
  231. }
  232. }
  233. })
  234. })
  235. /*取消认证员工*/
  236. $("#authorizedUserList").on("click", ".cancelAuth", function() {
  237. var oDataId = $(this).parent().attr("data-id");
  238. $.MsgBox.Confirm ('提示', '确认取消该员工的认证?<br><span style="color:#999;line-height:28px;font-size:13px;">确认后会同时取消该员工的所有联系人身份</span>', function(){
  239. $.ajax({
  240. url: "/ajax/professor/removeOrgAuth",
  241. type: "POST",
  242. dataType: "json",
  243. data: {
  244. "id": oDataId
  245. },
  246. success: function(data) {
  247. if(data.success) {
  248. authorizedUser(1,1,true);
  249. authorizedUser(1,0,true);
  250. getDefaultUser();
  251. }
  252. }
  253. })
  254. })
  255. })
  256. $('#staffContent').on("click", ".goSpan,.goYaoqing", function() {
  257. $("#mailVal").val('');
  258. $('.mb_success').html('');
  259. $(".blackcover2").fadeIn();
  260. $(".modelContain").show();
  261. $("body").addClass("modelOpen");
  262. })
  263. $(".mb_close").click(function() {
  264. $(".modelContain").hide();
  265. $(".blackcover2").fadeOut();
  266. $("body").removeClass("modelOpen");
  267. })
  268. /*检验邮箱*/
  269. $("#mailVal").on({
  270. keyup: function() {
  271. if($(this).val().length > 50) {
  272. $(this).val($(this).val().substr(0, 50));
  273. }
  274. }
  275. })
  276. $("#mailPub").on("click", function() {
  277. var oMail = $("#mailVal").val();
  278. var gunf = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
  279. if(oMail.trim().length == 0) {
  280. $.MsgBox.Alert('提示', '请输入您企业员工的邮箱地址');
  281. return;
  282. }
  283. if(!gunf.test(oMail.trim())) {
  284. $.MsgBox.Alert('提示', '请输入正确的邮箱地址');
  285. return;
  286. } else {
  287. $.ajax({
  288. url: "/ajax/sendMailWithInviteOrg",
  289. type: "POST",
  290. dataType: "json",
  291. data: {
  292. "oid": orgId,
  293. "mail": oMail
  294. },
  295. success: function(data) {
  296. if(data.success) {
  297. $('.mb_success').html('已发送邀请邮件!');
  298. $("#mailVal").val("");
  299. $(".blackcover2").fadeOut();
  300. $(".modelContain").hide();
  301. } else {
  302. $.MsgBox.Alert('提示', data.msg);
  303. }
  304. }
  305. })
  306. }
  307. })
  308. })