'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.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.loading = false; self.loading_del = false; let nowDate = new Date() let y = nowDate.getFullYear() let m = nowDate.getMonth() + 1 let d = nowDate.getDate() self.search = { startdate: sp.dateCount(0),//y + "-01-01", enddate: y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d), startdate_: sp.dateCount(0),//y + "-01-01", enddate_: y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d) } 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: '', userid: '4dd97a30-bce1-4862-a95d-711c25a0bd12',//self.userId, pageno: self.pageno, pagesize: self.itemsPerPage, querycondition: JSON.stringify([{ CKIND: 'VARCHAR', TABLEID: 'SYS_ROUTE_VIEW', COLID: 'TITLE', VALUEA: self.search.title || '', }, { CKIND: 'DATETIME', TABLEID: 'SYS_ROUTE_VIEW', COLID: 'APPDATE', VALUEA: self.search.startdate_, VALUEB: self.search.enddate_, }]) } $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengWithPage", { 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) { item.checked = false; if (item.STATUSINFO == 'DEAL' || item.STATUSINFO == 'START') { item.STATUSINFO_CN = '在办' } else if (item.STATUSINFO == 'STOP') { item.STATUSINFO_CN = '办结' } else { item.STATUSINFO_CN = '' } item.userStr = '' item.TODOLIST.forEach(function (iitem) { iitem.USERS.forEach(function (iiitem) { iiitem.STATUS_CN = '' if (iiitem.STATUS == '0') { iiitem.STATUS_CN = '草稿' } else if (iiitem.STATUS == '1') { iiitem.STATUS_CN = '待办' } else if (iiitem.STATUS == '2') { iiitem.STATUS_CN = '在办' } if (iiitem.USERNAME && iiitem.STATUS_CN) { if (item.userStr) { item.userStr = item.userStr + ',' + iiitem.USERNAME + '-' + iiitem.STATUS_CN } else { item.userStr = iiitem.USERNAME + '-' + iiitem.STATUS_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.cancal = function () { self.search = { keyword: "", startdate: "", enddate: "" } self.getData(1); sp.layerhide() } self.refresh = function () { self.getData(self.pageno); } self.goUrl = function (obj) { let href = window.location.href let hrefArr = href.split('fontOA') if (hrefArr.length > 0) { self.test.forEach(function (item) { if (item.FLOWID.indexOf(obj.FLOWID) > -1) { let FILENArr = item.FILEN.split('/') sp.openNewWindow("../" + FILENArr[1] + '/' + obj.FILEN) } }) } } self.goUrl1 = function (obj) { sp.openNewWindow("opinion.html?" + obj.FILEN.split("?")[1]) } //self.goUrl() //头部下滚冻结 $(function () { //页面高度撑满 setTimeout(function () { if ($(".ibox-content").height() < $(window).height() - 31) { $(".ibox-content").css("height", $(window).height() - 31) } }, 1) }) }]) app.filter('trustHtml', function ($sce) { return function (input) { return $sce.trustAsHtml(input.replace(/\n/g, '
').replace(/\s/g, ' ')); }; });