123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438 |
- /**
- * Created by MyPC on 2019/11/11.
- */
- var mobile2InfoTimeout = null;
- var searchCuringTimeout = null;
- var mobile='';
- var getClentListTimeout = null;
- var clientname='';
- //列表 手机号码检索功能
- function fnMobile2Info(){
- mobile2InfoTimeout = null;
- if((/^1[34578]\d{9}$/.test(mobile))) {
- $.ajax({
- cache :false,
- type: 'GET',
- url: '/cloud/curing/ajax/curingInfo/' + mobile,
- //data: { mobile: mobile },
- dataType: 'json',
- context: $('body'),
- success: function (data) {
- if (data.status == 1) {
- fnStructureCuringUser([data.detail]);
- $('div[page]').hide();
- } else if (data.status == 2) {
- $('div[curingListBox]').hide();
- $('p[upClientBox]').show();
- $('b[curingMobile]').html(mobile);
- } else if (data.status == 3) {
- alert(data.msg);
- }
- },
- error: function (xhr, type) {
- console.log('Ajax error!')
- }
- })
- }
- }
- function fnSearchCuring(){
- searchCuringTimeout = null;
- if((/^1[34578]\d{9}$/.test(mobile))){
- $.ajax({
- cache :false,
- type: 'GET',
- url: '/cloud/curing/ajax/checkMobile/'+mobile,
- //data: { mobile: mobile },
- dataType: 'json',
- context: $('body'),
- success: function(data){
- if(data.status==1||data.status==2){
- fnGetCuringDetail(data.data.id,data.data.client_id);
- }else if(data.status==3){
- $('div[upCuringBox]').hide();
- $('p[upCuringBox]').show();
- }
- },
- error: function(xhr, type){
- console.log('Ajax error!')
- }
- })
- }
- }
- //构建升级用户信息
- function fnGetCuringDetail(ssoid,client_id){
- $('tbody[upMajorBox]').html('');
- $('#curingSsoid').val('');
- $('#curingMobile').val('');
- $('#client_id').val('');
- $('#name').val('');
- $('#_id').val('');
- $.ajax({
- cache :false,
- type: 'GET',
- url: '/cloud/curing/ajax/getCuringBySsoid',
- data: {ssoid: ssoid, client_id: client_id},
- dataType: 'json',
- context: $('body'),
- success: function(data){
- if(data.status==1||data.status==2){
- $('div[upCuringBox]').show();
- $('p[upCuringBox]').hide();
- var objHtml=buildCuringInfo(data.detail.userInfo);
- $('div[curingInfo] curing').html(objHtml);
- var upMajorBoxHtml=buildCuringCompilation(data);
- $('tbody[upMajorBox]').html(upMajorBoxHtml);
- var operateLogHtml=buildCuringOperateLog(data.detail.operateLog);
- $('div[operateLog] curingOperate').html(operateLogHtml);
- }else if(data.status==3){
- $('div[upCuringBox]').hide();
- $('p[upCuringBox]').show();
- }
- },
- error: function(xhr, type){
- console.log('Ajax error!')
- }
- })
- }
- //设置可升级用户信息
- function upCuring(name,_id,username){
- $('#name').val(name);
- $('#_id').val(_id);
- var curingMobile=$('#curingMobile').val();
- var html='为用户 <b>'+curingMobile+','+username+'</b> 升级 <b>'+name+'</b>';
- $('div[upCuring] span').html(html);
- }
- //获得客户list数据
- function getClentList(){
- if(!isExistence(clientname)){
- console.log('参数错误');
- return ;
- }
- $.ajax({
- cache :false,
- type: 'GET',
- url: '/contacts/client/ajax/getClentList',
- data: { clientname: encodeURI(clientname) },
- dataType: 'json',
- success: function(data){
- if(data.status==1){
- var html=buildClientBySearch(data.list);
- $('div[searchClient] curingClient').html(html);
- }else {
- console.log(data.msg);
- }
- },
- error: function(xhr, type){
- console.log('Ajax error!')
- }
- })
- }
- $(function() {
- /**
- * 动态绑定养护用户列表 打开用户详情页面事件
- * ssoid
- * id
- * client_id
- */
- $('tbody[curingUser]').delegate( 'tr','click', function(){
- // 只获取第一个选中的值
- var ssoid = $(this).attr('data');
- var id=$(this).attr('dataId');
- var client_id=$(this).attr('dataCid')
- $(this).attr('data-toggle',' ');
- $.ajax({
- cache :false,
- type: 'GET',
- url: '/cloud/curing/ajax/getCuringBySsoid',
- data: {ssoid: encodeURI(ssoid),client_id:encodeURI(client_id)},
- dataType: 'json',
- context: $('body'),
- success: function(data){
- if(data.status==1||data.status==2){
- //设置 养护用户信息
- var objHtml=buildCuringInfo(data.detail.userInfo);
- $('div[curingInfo] curing').html(objHtml);
- //设置CLD客户信息
- if(data.detail.curingInfo.updateTotal!=0){
- $("#id").val(id);
- var clientHtml=relevanceClient(data.detail.clientInfo);
- $('div[curingInfo] curingClient').html(clientHtml);
- }
-
- //设置养护详情页里产品升级信息
- var upMajorBoxHtml=buildCuringCompilation(data);
- $('tbody[upMajorBox]').html(upMajorBoxHtml);
- //设置养护日志
- var operateLogHtml=buildCuringOperateLog(data.detail.operateLog);
- $('div[operateLog] curingOperate').html(operateLogHtml);
- setTimeout(autoHeight, 400);
- //autoHeight();
- $('#detail').modal('show');
- }else if(data.status==3){
- alert(data.msg);
- }
- },
- error: function(xhr, type){
- console.log('Ajax error!')
- }
- })
- });
-
-
-
- //动态绑定 移除CLD客户事件
- $('button[relieveClientDo]').on('click', function(e){
- //$('div[curinginfo]').delegate( 'a[relieveClientDo]','click', function(){
- // 只获取第一个选中的值
- var cid = $(this).attr('data');
- var id=$('#id').val();
- $('#unlinkcld').modal('hide');
- $.ajax({
- cache :false,
- type: 'POST',
- url: '/cloud/curing/ajax/relieveClientDo',
- data: {cid: encodeURI(cid),id:encodeURI(id)},
- dataType: 'json',
- success: function(data){
- if(data.status==1){
- //设置CLD客户信息
- var clientHtml=relevanceClient();
- $('div[curingInfo] curingClient').html(clientHtml);
- //设置养护日志
- var operateLogHtml=buildCuringOperateLog(data.operateLogList);
- $('div[operateLog] curingOperate').html(operateLogHtml);
- }else{
- alert(data.msg);
- }
- },
- error: function(xhr, type){
- console.log('Ajax error!')
- }
- })
- });
- //动态绑定养护用户列表 数据获得
- $('div[relevanceClientDo]').delegate( 'span','click', function(){
- // 只获取第一个选中的值
- var cidKey = $(this).attr('data');
- var id=$('#id').val();
- $.ajax({
- cache :false,
- type: 'POST',
- url: '/cloud/curing/ajax/relevanceClientDo',
- data: {cidKey: encodeURI(cidKey),id:encodeURI(id)},
- dataType: 'json',
- success: function(data){
- if(data.status==1){
- //设置CLD客户信息
- var clientHtml=relevanceClient(data.detail);
- $('div[curingInfo] curingClient').html(clientHtml);
- //设置养护日志
- var operateLogHtml=buildCuringOperateLog(data.operateLogList);
- $('div[operateLog] curingOperate').html(operateLogHtml);
- $('#linkcld').modal('hide');
- }else{
- alert(data.msg);
- }
- },
- error: function(xhr, type){
- console.log('Ajax error!')
- }
- })
- });
- //检索cld用户
- $('input[getClentList]').on('keyup', function(e){
- if(getClentListTimeout != null){
- clearTimeout(getClentListTimeout);
- }
- clientname = $(this).val();
- if(isExistence(clientname)){
- getClentListTimeout = setTimeout(getClentList, 500);
- }
- });
-
-
- //动态绑定分页事件
- $('div[pageDetail]').delegate( 'a','click', function(){
- // 只获取第一个选中的值
- var parameter = $(this).attr('parameter');
- var currentPage = $(this).attr('currentPage');
- $.ajax({
- cache :false,
- type: 'get',
- url: '/cloud/curing/ajax/getCuringPage/'+currentPage+parameter,
- dataType: 'json',
- success: function(data) {
- if (data.status == 1) {
- fnStructureCuringUser(data.curingList);
- fnPage(data.pageData);
- } else {
- alert(data.msg);
- }
- }
- })
- });
- //升级用户产品信息
- $('button[upCuringDo]').on('click', function(e){
- // 只获取第一个选中的值
- var compilationId = $('#_id').val();
- var name = $('#name').val();
- var curingSsoid = $('#curingSsoid').val();
- var mobile = $('#curingMobile').val();
- var client_id = $('#client_id').val();
- if (curingSsoid != '' && compilationId != '') {
- $.ajax({
- cache :false,
- type: 'post',
- url: '/cloud/curing/ajax/upCuringDo',
- data: {ssoid: curingSsoid, compilationId: compilationId, mobile: mobile, client_id: client_id, name: name},
- dataType: 'json',
- success: function(data) {
- if (data.status == 1) {
- fnGetCuringDetail(curingSsoid,client_id);
- } else {
- alert(data.msg);
- }
- }
- })
- } else {
- alert('请选择需要升级的版本');
- }
- });
- //列表 缓存激活号码检索
- $('input[mobile2Info]').on('keyup', function(e){
- if(mobile2InfoTimeout != null){
- clearTimeout(mobile2InfoTimeout);
- }
- mobile = $(this).val();
- if((/^1[34578]\d{9}$/.test(mobile))) {
- mobile2InfoTimeout = setTimeout(fnMobile2Info, 300);
- }
- });
- //列表 号码检索事件绑定
- $('div[mobile2Info]').on('click', function(e){
- mobile=$('input[mobile2Info]').val();
- if(mobile==''){
- location.reload()
- }
- fnMobile2Info();
- });
- $('input[fnSearchCuring]').on('keyup', function(e){
- if(searchCuringTimeout != null){
- clearTimeout(searchCuringTimeout);
- }
- mobile=$(this).val();
- if((/^1[34578]\d{9}$/.test(mobile))) {
- searchCuringTimeout = setTimeout(fnSearchCuring, 500);
- }
- });
- $('a[upNewClient]').on('click', function(e){
- $('input[fnsearchcuring]').val('');
- $('div[upCuringBox]').hide();
- $('p[upCuringBox]').hide();
- });
- $('a[upClient]').on('click', function(e){
- var mobile=$('b[curingMobile]').html();
- if(mobile==''){
- alert('参数错误');
- }
- $.ajax({
- cache :false,
- type: 'GET',
- url: '/cloud/curing/ajax/checkMobile/'+mobile,
- //data: { mobile: mobile },
- dataType: 'json',
- success: function(data){
- if(data.status==1||data.status==2){
- $('input[fnsearchcuring]').val(mobile);
- fnGetCuringDetail(data.data.id,data.data.client_id);
- }else if(data.status==3){
- $('div[upCuringBox]').hide();
- $('p[upCuringBox]').show();
- }
- },
- error: function(xhr, type){
- console.log('Ajax error!')
- }
- })
- });
- //编办下拉选择
- $('select[curingByCompilation]').on('change', function(e){
- var id=$(this).val();
- $.ajax({
- cache :false,
- type: 'GET',
- url: '/cloud/curing/ajax/getCuringByCompilationId/'+id,
- //data: { mobile: mobile },
- dataType: 'json',
- context: $('body'),
- success: function(data){
- console.log(data);
- if(data.status==1||data.status==2){
- fnStructureCuringUser(data.curingList);
- fnPage(data.pageData);
- }else if(data.status==3){
- //$('div[upCuringBox]').hide();
- //$('p[upCuringBox]').show();
- }
- },
- error: function(xhr, type){
- console.log('Ajax error!')
- }
- })
- });
- })
|