new Vue({ el: '#childApp', data:function(){ return { ss:'sas', dateTime: '', cityList:[], countryList:[], teamList: [], seatList: [], isscrollTop: false, country_show: false, team_show: true, seat_show: false, cityvalue: '', scrollTop: 0, countryvalue: '', teamvalue: '', seatvalue: '', dateRange:[new Date(), new Date()], start_date: '', sortObj:{ name:'', sort:'avg_score_bus', }, end_date:'', takeList:[], BASEURL: window_url, takevalue: '', loading: true, allData: [], basearr: [ { createdAt: '质检考核项目编号', fwyy:'1', kcb:'2', jsy:'3', fwtd:'4', yssb:'5', jysb:'6', yycl:'7', ywcc:'8', yyjlz:'9', fwjs:'10', wtgbj:'11', cgjxxhs:'12', wgzlf:'13', mgc:'14', }, { createdAt: '质检考核权重', fwyy:'15%', kcb:'5%', jsy:'3%', fwtd:'5%', yssb:'5%', jysb:'5%', yycl:'10%', ywcc:'10%', yyjlz:'10%', fwjs:'10%', wtgbj:'2%', cgjxxhs:'20%', wgzlf:'100%', mgc:'100%', }], tableData: [], currentPage:1, pagesize: 15, total: 10, isHidePage: true, sel_is_show: true, } }, mounted () { window.addEventListener('scroll', this.scrollToTop) }, destroyed () { window.removeEventListener('scroll', this.scrollToTop) }, methods: { loadData(){ this.$refs.loadModal.submit(); this.$message('文件下载中请稍后...'); }, changeRange(dateRange) { console.log(dateRange); this.start_date = dateRange[0]; this.end_date = dateRange[1]; this.seatvalue = null; this.currentPage = 1; this.getTake(); this.getRule(this.cityvalue, this.countryvalue, this.teamvalue, this.start_date, this.end_date, this.seatvalue); // 获取统计数据 }, changeCity(msg) { console.log(msg); this.currentPage = 1; this.cityvalue = msg; this.countryvalue = ''; this.teamvalue = ''; this.seatvalue = null; this.getCountry(); this.getTeam(); this.getTake(); this.getRule(this.cityvalue, this.countryvalue, this.teamvalue, this.start_date, this.end_date, this.seatvalue); // 获取统计数据 }, changeCountry(msg) { this.countryvalue = msg; this.teamvalue = ''; this.seatvalue = null; this.getTeam(); this.getTake(); this.currentPage = 1; this.getRule(this.cityvalue, this.countryvalue, this.teamvalue, this.start_date, this.end_date, this.seatvalue); // 获取统计数据 }, changeTeam(msg) { this.currentPage = 1; this.teamvalue = msg; this.seatvalue = null; this.getTake(); this.getRule(this.cityvalue, this.countryvalue, this.teamvalue, this.start_date, this.end_date, this.seatvalue); // 获取统计数据 console.log(msg); }, changeSeat(msg) { this.currentPage = 1; this.seatvalue = msg; this.getRule(this.cityvalue, this.countryvalue, this.teamvalue,this.start_date,this.end_date,this.seatvalue); // 获取统计数据 console.log(msg); }, getCountry() { let that = this; RquestsGet('api/v1/agency/country/?city_id=' + this.cityvalue).then(data => { //console.log(data); if (data.code != 0) { that.$message('服务器错误') } else { that.countryList = data.data.country_list; if (that.countryList.length > 0) { that.country_show = true; } else { that.country_show = false; }; } }) }, getTeam() { let that = this; RquestsGet('api/v1/agency/team/?country_id=' + this.countryvalue + '&city_id=' + this.cityvalue).then(data => { //console.log(data); if (data.code != 0) { that.$message('服务器错误') } else { that.teamList = data.data.team_list; if (that.teamList.length > 0) { that.team_show = true; } else { that.team_show = false; }; } }) }, getCity(){ let that = this; var request = new XMLHttpRequest(); let uri = window_url + 'api/v1/agency/city/'; request.open('GET', uri, false); request.send(null); if (request.status === 200) { data = JSON.parse(request.response); console.log(data.code); if(data.code != 0){ that.$message('服务器错误'); } else { that.cityList = data.data.city_list; that.countryList = data.data.country_list; if (that.countryList.length > 0) { that.country_show = true; } else { that.country_show = false; }; that.cityvalue = data.data.city_id; console.log(that.cityvalue); that.init_simple = true; } } else { that.$message('服务器错误'); } }, getRule(city, country, team, start_date,end_date,agentName){ let that = this; let page = this.currentPage; let page_size = this.pagesize; this.$loading({text:'数据加载中...'}); RquestsPost('api/v1/tasks/seat_check/',{city, country, team,start_date,end_date,agentName,page,page_size}).then(data => { that.$loading().close(); if(data.code != 0){ }else{ //that.tableData = this.basearr.concat(data.data.slice((this.currentPage-1)*this.pagesize,this.currentPage*this.pagesize)); that.tableData = this.basearr.concat(data.data); that.allData = data.data; this.total = data.count; this.isHidePage = !(data.data.length > 0); //that.takeList = data.data; } }) }, getTake() { let that = this; RquestsGet('api/v1/tasks/seat/?city=' + that.cityvalue + '&country=' + that.countryvalue + '&team=' + that.teamvalue + '&start_date=' + this.start_date + '&end_date=' + this.end_date).then(data => { //console.log(data); if (data.code != 0) { //that.takeList = [{agentName:'全部坐席'}] } else { that.seatList = data.data; if (that.seatList.length > 0) { that.seat_show = true; } else { that.seat_show = false; }; } }) }, arraySpanMethod({ row, column, rowIndex, columnIndex }) { if (rowIndex === 0 || rowIndex === 1) { // 在这里多加一个行的判断就行 // 合并第二行 if (columnIndex === 0) { // 从第二列开始 return [1, 3] } else if (columnIndex === 2 || columnIndex === 3 ) { return [0, 0] } } }, dateFormat(date){ return date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate(); }, backTop () { const that = this let timer = setInterval(() => { let ispeed = Math.floor(-that.scrollTop / 5) document.documentElement.scrollTop = document.body.scrollTop = that.scrollTop + ispeed if (that.scrollTop === 0) { clearInterval(timer) } }, 16) }, // 为了计算距离顶部的高度,当高度大于60显示回顶部图标,小于60则隐藏 scrollToTop () { const that = this let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop that.scrollTop = scrollTop if (that.scrollTop > 60) { that.isscrollTop = true } else { that.isscrollTop = false } }, CurrentChange(page){ this.currentPage = page; //this.tableData = this.basearr.concat(this.allData.slice((page-1)*this.pagesize,page*this.pagesize)); this.getRule(this.cityvalue, this.countryvalue, this.teamvalue,this.start_date,this.end_date,this.seatvalue); // 获取统计数据 //that.allData = data.data; }, rowClick(row, column, event){ console.log(row) ; let url = "/quality/audio/check-detail/"+row.sessionCollectionId+"/"+row.taskId+"?from=checkTask&sessionId=" + row.sessionId; let autoMessage = { jumplink: url }; console.log(autoMessage); window.parent.postMessage(autoMessage,'*'); }, init(){ this.dateRange = [new Date(new Date()-24*60*60*1000), new Date()]; this.start_date = this.dateFormat(new Date(new Date()-24*60*60*1000)); this.end_date = this.dateFormat(new Date()); this.getCity(); // 获取任务 this.getTeam(); this.getTake(); // 获取坐席 this.getRule(this.cityvalue, this.countryvalue, this.teamvalue,this.start_date,this.end_date,this.seatvalue); // 获取统计数据 } }, created(){ this.init() }, })