'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination', ]); app.controller("indexCtrl", ["$scope", "$http", "$interval", "$timeout", "$sce", function ($scope, $http, $interval, $timeout, $sce) { var self = this; self.userId = $.cookie("GlWorkPlatform-userid"); self.userName = $.cookie("GlWorkPlatform-username"); self.userChineseName = $.cookie("GlWorkPlatform-chineseName") self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken"); var postCfg = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } } self.search = { TITLE: "", DATE1: "", DATE2: "" } self.noDataTip = 1;//没有数据时赋变量为0,先默认为1 self.pageno = 1; self.total_count = 0; self.itemsPerPage = 10; self.pageOptions = [10, 20, 40, 60]; self.getData = function (pageno) { self.list = []; self.loading = true; self.pageno = pageno; $scope.__default__currentPage = self.pageno; //设置页面样式在第几页 var querycondition = []; if (self.search.TITLE != "") { querycondition.push({ "CKIND": "VARCHAR", "TABLEID": "SYS_MSG", "COLID": "CONTENTS", "VALUEA": self.search.TITLE, "VALUEB": "" }) } if (self.search.DATE1 != "" && self.search.DATE2 != "") { querycondition.push({ "CKIND": "DATETIME", "TABLEID": "SYS_MSG", "COLID": "FINISHDATE", "VALUEA": self.search.DATE1, "VALUEB": self.search.DATE2 }) } else if (self.search.DATE1 != "" && self.search.DATE2 == "") { querycondition.push({ "CKIND": "DATETIME", "TABLEID": "SYS_MSG", "COLID": "FINISHDATE", "VALUEA": self.search.DATE1, "VALUEB": "" }) } else if (self.search.DATE1 == "" && self.search.DATE2 != "") { querycondition.push({ "CKIND": "DATETIME", "TABLEID": "SYS_MSG", "COLID": "FINISHDATE", "VALUEA": "", "VALUEB": self.search.DATE2 }) } var data = { userid: self.userId, msgkind: "督办台账", pageno: self.pageno, pagesize: self.itemsPerPage, querycondition: JSON.stringify(querycondition) } $http.post(apiurljs.login + "icenter/notice/queryDataMessageWithPage", 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; } else { self.noDataTip = 1; self.list = res.data; self.total_count = res.totalCount; } }) } self.getData(self.pageno) self.openLayer = function () { sp.layer("#Search") } self.doSearch = function () { self.getData(self.pageno) sp.layerhide() } self.cancal = function () { self.search = { TITLE: "", DATE1: "", DATE2: "" } self.getData(1) sp.layerhide() } self.refresh = function () { self.getData(self.pageno); } self.goUrl = function (item) { var data = { id: item.ID } $http.post(apiurljs.login+ "icenter/notice/updateDataMessageReaded", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); if (res.success) { self.getData(self.pageno) if (self.deviceType == "pad") { //window.location.href = item.FILEN + "&dotype=" + getDoType(self.type) window.location.href = "../../" + item.DURL } else { sp.openNewWindow("../../" + item.DURL) //sp.openNewWindow(item.FILEN + "&dotype=" + getDoType(self.type), item.TITLE) } } }) } }])