123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- '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.CrossPage = window.parent.CrossPage;
- self.loading = false;
- self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
- self.pageno = 1;
- self.total_count = 0;
- self.getData = function (pageno) {
- self.list = [];
- self.loading = false;
- self.pageno = pageno;
- $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
- var data = {
- tablename: "WJFB_TPXW",
- pagesize: 30,
- pageno: self.pageno,
- colums: "*",
- order: "FBRQ desc",
- sqlwhere: { FBZT: "1" },
- sqlorwhere: "",
- sqlinwhere: "",
- sqllikewhere: ""
- };
- $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.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.list.forEach(function (item) {
- item.FBRQ1 = item.FBRQ.slice(0, 10);
- self.getImg(item)
- //if (item.IMAGEDATA && item.IMAGEDATA != "") {
- // item.IMAGEDATA1 = apiurljs.login + "g2work/" + JSON.parse(item.IMAGEDATA)[0].FILEURL
- //} else if (item.IMAGESDATA && item.IMAGESDATA != "") {
- // item.IMAGEDATA1 = apiurljs.login + "g2work/" + JSON.parse(item.IMAGESDATA)[0].FILEURL
- //} else {
- //}
- })
- }
- })
- }
- self.getImg = function (parent) {
- var data = {
- tablename: "FILE_ATTACH",
- colums: "*",
- order: "ID",
- sqlwhere: { ROUTEINFOID: parent.ROUTEINFOID },
- sqlorwhere: "",
- sqlinwhere: "",
- sqllikewhere: ""
- };
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- for (var i = 0; i < res.data.length; i++) {
- if (res.data[i].ATTACHTYPE == "IMAGEDATA") {
- parent.IMAGEDATA1 = apiurljs.login + "g2work" + res.data[i].FILEURL
- break
- } else if (res.data[i].ATTACHTYPE == "IMAGESDATA") {
- parent.IMAGEDATA1 = apiurljs.login + "g2work" + res.data[i].FILEURL
- }
- }
- })
- }
- 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.goUrl = function (item) {
- sp.openNewWindow("../../tpl/wenjianbg/WJFBB1/detail.html?id=" + item.ID + "&formPage=wenjianshow", item.BT)
- }
- self.load();
- //记录日志
- self.journalRecord = function (time1, time2, title, func, url) {
- if (!self.CrossPage || !self.CrossPage.cname) { return; }
- var data = {
- tablename: "SYS_CLICKLOG",
- data: {
- CTIME: time1 == null ? sp.getLocalDate1() : time1,
- TITLE: (title != "" ? self.CrossPage.cname + "/" + title : self.CrossPage.cname),
- REQUESTURL: url,
- REQUESTHEADERURL: window.location.origin,
- LOGTYPE: func,
- USERTYPE: $.cookie("GlWorkPlatform-userType"),
- ADMIN: $.cookie("GlWorkPlatform-userTypeEng"),
- CLIENTIP: sp.myIP(),
- PCNAME: sp.detectOS(),
- BROWSERNAME: sp.browser(),
- RESPONSETIME: time2 == null ? sp.getLocalDate1() : time2,
- USERID: self.userId,
- USERNAME: self.userName
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (res) {
- self.CrossPage.type = 1;
- })
- }
- //头部下滚冻结
- $(function () {
- //页面高度撑满
- setTimeout(function () {
- if ($(".ibox-content").height() < $(window).height() - 31) {
- $(".ibox-content").css("height", $(window).height() - 31)
- }
- }, 1)
- })
- }])
|