| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- var areaList=[];
- var officeList=[];
- var areaId="",officeId="";
- $(document).ready(function(){
- $('.Regional').on('tap', function() {
- if ($('.grade-eject').hasClass('grade-w-roll')) {
- $('.grade-eject').removeClass('grade-w-roll');
- $(this).removeClass('current');
- setTimeout(function() {$(".grade-eject_bj").hide()},400)
- ;
- } else {
- $(".grade-eject").addClass("grade-w-roll");
- setTimeout(function() {$(".grade-eject_bj").show()},400)
- }
- cleanList();
- })
- $(".resBtn").click(function(){
- cleanList();
- })
- $('.grade-eject_bj').on('tap', function() {
- $('.grade-eject').removeClass('grade-w-roll');
- setTimeout(function() {$(".grade-eject_bj").hide()},400)
- cleanList();
- })
- // $(document).click(function(event) {
- // var _con = $('.clickArea'); // 设置目标区域
- // if(!_con.is(event.target) && _con.has(event.target).length === 0) { // Mark 1
- // $('.grade-eject').removeClass('grade-w-roll');
- // $(this).removeClass('current');
- // }
- // });
- function cleanList () {
- areaList=[],officeList=[],areaId="",officeId="";
- $(this).removeClass("check_active");
- $(this).children("img").hide();
- $(".grade-w li").removeClass("check_active");
- $(".grade-w li img").hide();
- $(".grade-t li").removeClass("check_active");
- $(".grade-t li img").hide();
- $('#gradet li').remove();
- }
-
- $(".grade-w").on('click', 'li', function() {
- $(".grade-t").css("left","50%");
- if ($(this).hasClass("check_active")) {
- $(this).removeClass("check_active");
- $(this).children("img").hide();
- var areaDataRemove=$(this).attr("data-index");
- Array.prototype.indexOf = function (val) {
- for(var i = 0; i < this.length; i++){
- if(this[i] == val){return i;}
- }
- return -1;
- }
- Array.prototype.remove = function (val) {
- var index = this.indexOf(val);
- if(index > -1){this.splice(index,1);}
- }
- areaList.remove(areaDataRemove);
- } else{
- $(this).addClass("check_active");
- $(this).children("img").show();
- $('#gradet li').remove();
- var areaData=$(this).attr("data-index");
- areaList.push(areaData);
- // 产品代码
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'Department/GetCusAreaList',
- async: false,
- data: {
- pid:$(this).attr("data-index"),
- F_Layer: 2,
- token:localStorage.getItem("token")
- },
- dataType: 'json',
- success: function(res) {
- if(res.state.toLowerCase() === "success") {
- res = res.data;
- if(res && res.length > 0) {
- res.forEach(function(v, i) {
- $('<li data-index="'+v.F_DeptId+'">'+v.F_DeptName+
- '<img src="../img/check_true.png"/></li>').appendTo('#gradet')
- });
- }
- }
- }
- });
- }
-
- })
-
- $(".grade-t").on('click', 'li', function() {
- if ($(this).hasClass("check_active")) {
- $(this).removeClass("check_active")
- $(this).children("img").hide();
- var officeDataRemove=$(this).attr("data-index");
- Array.prototype.indexOf = function (val) {
- for(var i = 0; i < this.length; i++){
- if(this[i] == val){return i;}
- }
- return -1;
- }
- Array.prototype.remove = function (val) {
- var index = this.indexOf(val);
- if(index > -1){this.splice(index,1);}
- }
- officeList.remove(officeDataRemove);
- } else{
- $(this).addClass("check_active");
- $(this).children("img").show();
- var officeData=$(this).attr("data-index");
- officeList.push(officeData);
- }
-
- })
- // 产品代码
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'Department/GetCusAreaList',
- async: false,
- data: {
- pid: 1,
- F_Layer: 1,
- token:localStorage.getItem("token")
- },
- dataType: 'json',
- success: function(res) {
- if(res.state.toLowerCase() === "success") {
- res = res.data;
- if(res && res.length > 0) {
- res.forEach(function(v, i) {
- $('<li data-index="'+v.F_DeptId+'">'+v.F_DeptName+
- '<img src="../img/check_true.png"/></li>').appendTo('#gradew')
- });
- }
- }
- }
- });
- });
- function areaD() {
- for (var i=0, l=areaList.length; i<l; i++) {
- areaId += areaList[i]+ ","
- }
- if (areaList.length > 0 ) {
- areaId = areaId.substring(0, areaId.length-1);
- $('#AreaId').val(areaId);
- }
- }
- function officeD() {
- for (var i=0, l=officeList.length; i<l; i++) {
- officeId += officeList[i]+ ","
- }
- if (officeList.length > 0 ) {
- officeId = officeId.substring(0, officeId.length-1);
- $('#OfficeId').val(officeId);
- }
- }
|