123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- '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.loading = false;
- self.getGKSXLB = function () {
- var data = {
- ckey: "CODE_GKSXLB",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.GKSXLB = res.data.CODE_GKSXLB;
- self.getLAIYUAN()
- })
- }
- self.getGKSXLB()
- self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
- self.getLAIYUAN = function () {
- var data = {
- ckey: "CODE_LAIYUAN",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.LAIYUAN = res.data.CODE_LAIYUAN;
- self.search = {
- LAIYUAN: self.LAIYUAN[0].CODE,
- BIANHAO: "",
- GKSXLB: "",
- GMFRHQYMC: "",
- DATE1: "",
- DATE2: ""
- }
- self.getData(1)
- })
- }
- self.openLayer = function () {
- if (self.search == null) {
- self.search = {
- LAIYUAN: self.LAIYUAN[0].CODE,
- BIANHAO: "",
- GKSXLB: "",
- GMFRHQYMC: "",
- DATE1: "",
- DATE2: ""
- }
- }
- sp.layer("#Search")
- }
- self.doSearch = function () {
- if (self.search.DATE1 != "" && self.search.DATE2 == "") {
- self.search.DATE2 = self.search.DATE1
- }
- if (self.search.DATE2 != "" && self.search.DATE1 == "") {
- self.search.DATE1 = self.search.DATE2
- }
- self.getData(1)
- sp.layerhide()
- }
- self.cancal = function () {
- self.search = {
- LAIYUAN: self.LAIYUAN[0].CODE,
- BIANHAO: "",
- GKSXLB: "",
- GMFRHQYMC: "",
- DATE1: "",
- DATE2: ""
- }
- self.getData(1)
- sp.layerhide()
- }
- 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 = [];
- self.loading = false;
- var sqlwhere = []
- if (self.search.LAIYUAN != "C14") {
- sqlwhere.push(" and LAIYUAN='" + self.search.LAIYUAN + "'")
- }
- if (self.search.BIANHAO != "") {
- sqlwhere.push(" and BIANHAO like'%" + self.search.BIANHAO + "%'")
- }
- if (self.search.GKSXLB != "") {
- sqlwhere.push(" and GKSXLB='" + self.search.GKSXLB + "'")
- }
- if (self.search.GMFRHQYMC != "") {
- sqlwhere.push(" and GMFRHQYMC like'%" + self.search.GMFRHQYMC + "%'")
- }
- if (self.search.DATE1 != "" && self.search.DATE1 != "") {
- sqlwhere.push(" and SQRQ between'" + self.search.DATE1 + " 00:00:00' and '" + self.search.DATE2 + " 23:59:59'")
- }
- var data = {
- tablename: "SX_SZJWYSQGKXXCBD",
- colums: "*",
- order: "SJRQ",
- sqlwhere: sqlwhere.join(" "),
- pageno: self.pageno,
- pagesize: self.itemsPerPage
- }
- $http.post(apiurljs.login + "g2app/xinxigongkai/queryFormDataByColStrWithPage", { 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;
- } else {
- self.noDataTip = 1;
- self.list = res.data;
- self.total_count = res.totalCount;
- $.each(self.list, function (index, item) {
- item.SQRQ1 = sp.format(item.SQRQ)
- item.SJBJRQ1 = sp.format(item.SJBJRQ)
- self.LAIYUAN.forEach(function (item1) {
- if (item.LAIYUAN == item1.CODE)
- item.LAIYUAN1 = item1.CNAME
- })
- self.GKSXLB.forEach(function (item1) {
- if (item.GKSXLB == item1.CODE)
- item.GKSXLB1 = item1.CNAME
- })
- })
- }
- })
- }
- self.goUrl = function (obj) {
- sp.openNewWindow("../../tpl/gongkaizhu/" + obj.FILEN, obj.BIANHAO)
- }
- //头部下滚冻结
- $(function () {
- //页面高度撑满
- setTimeout(function () {
- if ($(".ibox-content").height() < $(window).height() - 31) {
- $(".ibox-content").css("height", $(window).height() - 31)
- }
- }, 1)
- })
- }])
|