1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- '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");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- }
-
- self.search = {
- year: sp.currentYear(),
- month: sp.currentMonth(),
- CSDW: ""
- }
- self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
- 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.pageno = pageno;
- $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
- self.list = [];
- var data = {
- tablename: "SX_XXBSD",
- colums: "*",
- order: "ID desc",
- sqlwhere: "",
- sqlorwhere: "",
- sqlinwhere: "",
- sqllikewhere: { CSDW: self.search.CSDW, RQ: self.search.year + "-" + formate(self.search.month) },
- pageno: self.pageno,
- pagesize: self.itemsPerPage
- }
- $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));
- self.canExportExcel = true;
- 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) {
- item.RQ = sp.format(item.RQ);
- })
- }
- })
- }
- self.getData(self.pageno)
- //头部下滚冻结
- $(function () {
- //页面高度撑满
- setTimeout(function () {
- if ($(".ibox-content").height() < $(window).height() - 31) {
- $(".ibox-content").css("height", $(window).height() - 31)
- }
- }, 1)
- })
- }])
- function formate(d) {
- return d * 1 > 9 ? d * 1 : "0" + d * 1
- }
|