'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination' ]); app.controller("listCtrl", ["$scope", "$http", "$timeout", "$sce", function ($scope, $http, $interval, $sce) { var self = this; var s4 = new SM4Util(); self.userId = $.cookie("GlWorkPlatform-userid"); self.userName = $.cookie("GlWorkPlatform-chineseName"); self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken"); var postCfg = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } } self.loading = false; self.search = { title: "", startdate: sp.getWeekNumber(new Date()).begin, enddate: sp.getWeekNumber(new Date()).end } self.flows = []; self.test = []; self.getFlow = function () { var data = { userid: self.userId, ntops: 0//6 } $http.post(apiurljs.login + "g2work/routeinfo/queryDataToDoFlowRouteCountDesktopByUserid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); res.data.forEach(function (item) { if (item.FLOWID != "无") { self.flows.push(item.FLOWID) self.test.push({ FLOWID: item.FLOWID, FLOWCODE: item.FLOWCODE, CNAME: item.CNAME, FILEN: item.FILEN }) } }) }) } self.getFlow() self.noDataTip = 1; //没有数据时赋变量为0,先默认为1 self.pageno = 1; self.total_count = 0; self.itemsPerPage = 10; self.pageOptions = [10, 20, 30, 40]; self.getData = function (pageno) { self.loading = true; self.pageno = pageno; $scope.__default__currentPage = self.pageno; //设置页面样式在第几页 var data = { flowid: "A20,AA03,AA10,AA55,AA56,AA57,AA08,AA23,AA77,AA06,AA88,AA89,AA46,AA22,AA54,AA65", sx_order: "flowid", order: "routeid", pageno: self.pageno, pagesize: self.itemsPerPage, sqlwhere: "returndate between '" + self.search.startdate + " 00:00:00' and '" + self.search.enddate + " 23:59:59'" + (self.search.title == "" ? "" : " and title like '%" + self.search.title + "%'") } $http.post(apiurljs.login + "g2app/dataabase/queryDataByReturnManageWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.loading = false; if (res.data == null || res.data == undefined || res.data == "") { self.noDataTip = 0; self.list = [] } else { self.noDataTip = 1; res.data.forEach(function (item) { if (item.STATUSINFO == 'DEAL' || item.STATUSINFO == 'START') { item.STATUSINFO_CN = '在办' } else if (item.STATUSINFO == 'STOP') { item.STATUSINFO_CN = '办结' } else { item.STATUSINFO_CN = '' } }) self.list = res.data; self.total_count = res.meta.totalCount; } }) } self.load = function () { if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") { self.getData(self.pageno); } else { $timeout(function () { self.getData(self.get_lastReturnPageno); }, 1) } } self.load(); self.openSearch = function () { sp.layer("#Search") } self.doSearch = function () { self.getData(1); sp.layerhide() } self.refresh = function () { self.getData(self.pageno); } self.goUrl = function (obj) { if (!obj.COUNTS) { let href = window.location.href let hrefArr = href.split('tool') self.test.forEach(function (item) { if (item.FLOWID.indexOf(self.returnFlowid) > -1) { let FILENArr = item.FILEN.split('/') sp.openNewWindow(hrefArr[0] + FILENArr[1] + '/' + obj.FILEN) } }) }else if (obj.COUNTS == 1) { let href = window.location.href let hrefArr = href.split('tool') self.test.forEach(function (item) { if (item.FLOWID.indexOf(obj.FLOWID) > -1) { let FILENArr = item.FILEN.split('/') sp.openNewWindow(hrefArr[0] + FILENArr[1] + '/' + obj.FILEN) } }) } else { self.returnTitle = obj.TITLE; self.returnFlowid = obj.FLOWID; self.returnList = obj.RETURNLIST; sp.layer("#returnlist") } } //头部下滚冻结 $(function () { //页面高度撑满 setTimeout(function () { if ($(".ibox-content").height() < $(window).height() - 31) { $(".ibox-content").css("height", $(window).height() - 31) } }, 1) }) }])