'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination' ]); app.controller("listCtrl", ["$scope", "$http", "$timeout", function ($scope, $http, $timeout) { var self = this; var s4 = new SM4Util(); self.userId = $.cookie("GlWorkPlatform-userid"); self.userName = $.cookie("GlWorkPlatform-chineseName"); self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken"); self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno"); var postCfg = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } } self.loading = false; self.search = JSON.parse($.cookie("GlWorkPlatform-sjps")) || { WJMC: "", LWDW: "" }; 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.list = []; self.loading = false; self.pageno = pageno; $scope.__default__currentPage = self.pageno; //设置页面样式在第几页 var data = { tablename: "SX_SJPSWJTZ", pagesize: self.itemsPerPage, pageno: self.pageno, colums: "*,TO_CHAR(QPSJ,'yyyy-mm-dd')as QPSJ1,TO_CHAR(DBTXTIME,'yyyy-mm-dd')as DBTXTIME1", order: "ID", sqlwhere: "", sqlorwhere: "", sqlinwhere: "", sqllikewhere: { WJMC: self.search.WJMC, LWDW: self.search.LWDW } } $http.post(apiurljs.login + "g2app/dataabase/queryDataByColWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); console.log(res.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.list.forEach(function (item) { if (item.SJPS != null && item.SJPS.slice(0, 1) == "[") { var text = []; JSON.parse(item.SJPS).forEach(function (item1) { text.push(item1.opinion + " — " + item1.username + "," + item1.cdate) }) item.SJPS=text.join(";") } }) self.total_count = res.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.getDP = function () { var data = { userid: self.userId } $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION; self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE; self.load(); }) } self.getDP(); self.openLayer = function () { sp.layer("#Search") } self.doSearch = function () { $.cookie("GlWorkPlatform-sjps", JSON.stringify(self.search), { path: '/', expires: 1 }); self.getData(self.pageno) sp.layerhide() } self.cancal = function () { self.search = { WJMC: "", LWDW: "" } $.cookie("GlWorkPlatform-sjps", null, { path: '/', expires: 1 }); self.getData(1) sp.layerhide() } self.refresh = function () { self.getData(self.pageno); } self.goUrl = function (item) { window.location.href = "detail.html?id=" + item.ID + "&lastReturnPageno=" + self.pageno; } self.btnDel = function (item) { var dialogHead = "温馨提示×"; var dialogBody = "