'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination' ]); app.controller("listCtrl", ["$scope", "$http", "$timeout", '$sce', function ($scope, $http, $timeout, $sce) { 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"); self.get_type = sp.getUrlName("type"); var postCfg = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } } self.CrossPage = window.parent.CrossPage; self.getDataImg = function () { var data = { tablename: "WJFB_TPXW", pagesize: 10, pageno: 1, colums: "*", order: "ID", 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.listImg = res.data; $.each(self.listImg, function (index, item) { if (item.IMAGEDATA != "[]" && item.IMAGEDATA != "") { item.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + JSON.parse(item.IMAGEDATA)[0].FILEURL) } else { item.FILEURL1 = $sce.trustAsResourceUrl(apiurljs.login + "g2work" + JSON.parse(item.IMAGESDATA)[0].FILEURL) } }) if (self.listImg.length > 1) { $timeout(function () { var swiper = new Swiper('.swiper-container', { loop: true, autoplay: { delay: 2000, disableOnInteraction: false, }, slidesPerView: 1, centeredSlides: true, pagination: { el: '.swiper-pagination', clickable: true, } }) }, 1) } }) } self.getDataImg() self.getZRBM = function () { var data = { ckey: "CODE_ZRBM", 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.ZRBM = res.data.CODE_ZRBM; self.getData1() self.getData2() self.getData3() self.getData4() self.getData5() }) } self.getZRBM() self.check1 = 1; self.check2 = 1; self.check3 = 1; self.check4 = 1; self.check5 = 1; self.getData1 = function () { self.sqlwhere1 = ""; self.TABLENAME1 = ""; switch (self.check1) { case 1: self.sqlwhere1 = { GGBK: "C02", FBZT: "1" }; self.TABLENAME1 = "SX_TZGG"; break; case 2: self.sqlwhere1 = { LX: "C01", FBZT: "1" }; self.TABLENAME1 = "WJFB_CB"; break; case 3: self.sqlwhere1 = { LX: "C02", FBZT: "1" }; self.TABLENAME1 = "WJFB_CB"; break; case 4: self.sqlwhere1 = { LX: "C03", FBZT: "1" }; self.TABLENAME1 = "WJFB_CB"; break; } var data = { tablename: self.TABLENAME1, pagesize: 10, pageno: 1, colums: "*", order: "ID", sqlwhere: self.sqlwhere1, 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.list1 = res.data; self.list1.forEach(function (item) { item.BT = item.WJBT ? item.WJBT : item.GGBT; self.ZRBM.forEach(function (item1) { if (item.FBBM == item1.CODE) { item.BM = item1.CNAME; } }) }) }) } self.getData2 = function () { self.sqlwhere2 = ""; self.TABLENAME2 = ""; switch (self.check2) { case 1: self.sqlwhere2 = { LX: "C08", FBZT: "1" }; self.TABLENAME2 = "WJFB_CB"; break; case 2: self.sqlwhere2 = { GGBK: "C06", FBZT: "1" }; self.TABLENAME2 = "SX_TZGG"; break; } var data = { tablename: self.TABLENAME2, pagesize: 10, pageno: 1, colums: "*", order: "ID", sqlwhere: self.sqlwhere2, 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.list2 = res.data; self.list2.forEach(function (item) { item.BT = item.WJBT ? item.WJBT : item.GGBT; self.ZRBM.forEach(function (item1) { if (item.FBBM == item1.CODE) { item.BM = item1.CNAME; } }) }) }) } self.getData3 = function () { self.sqlwhere3 = ""; self.TABLENAME3 = ""; switch (self.check3) { case 1: self.sqlwhere3 = { GGBK: "C01", FBZT: "1" }; self.TABLENAME3 = "SX_TZGG"; break; case 2: self.sqlwhere3 = { LX: "C09", FBZT: "1" }; self.TABLENAME3 = "WJFB_CB"; break; case 3: self.sqlwhere3 = { GGBK: "C05", FBZT: "1" }; self.TABLENAME3 = "SX_TZGG"; break; case 4: self.sqlwhere3 = { GGBK: "C08", FBZT: "1" }; self.TABLENAME3 = "SX_TZGG"; break; case 5: self.sqlwhere3 = { LX: "C06", FBZT: "1" }; self.TABLENAME3 = "WJFB_CB"; break; } var data = { tablename: self.TABLENAME3, pagesize: 10, pageno: 1, colums: "*", order: "ID", sqlwhere: self.sqlwhere3, 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.list3 = res.data; self.list3.forEach(function (item) { item.BT = item.WJBT ? item.WJBT : item.GGBT; item.FBRQ = item.FBRQ ? item.FBRQ : item.FBSJ; self.ZRBM.forEach(function (item1) { if (item.FBBM == item1.CODE) { item.BM = item1.CNAME; } }) }) }) } self.getData4 = function () { self.sqlwhere4 = ""; self.TABLENAME4 = ""; switch (self.check4) { case 1: self.sqlwhere4 = { LX: "C04", FBZT: "1" }; self.TABLENAME4 = "WJFB_CB"; break; case 2: self.sqlwhere4 = { LX: "C05", FBZT: "1" }; self.TABLENAME4 = "WJFB_CB"; break; case 3: self.sqlwhere4 = { GGBK: "C03", FBZT: "1" }; self.TABLENAME4 = "SX_TZGG"; break; case 4: self.sqlwhere4 = { GGBK: "C04", FBZT: "1" }; self.TABLENAME4 = "SX_TZGG"; break; case 5: self.sqlwhere4 = { GGBK: "C07", FBZT: "1" }; self.TABLENAME4 = "SX_TZGG"; break; } var data = { tablename: self.TABLENAME4, pagesize: 10, pageno: 1, colums: "*", order: "ID", sqlwhere: self.sqlwhere4, 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.list4 = res.data; self.list4.forEach(function (item) { item.BT = item.WJBT ? item.WJBT : item.GGBT; self.ZRBM.forEach(function (item1) { if (item.FBBM == item1.CODE) { item.BM = item1.CNAME; } }) }) }) } self.getData5 = function () { self.sqlwhere5 = ""; self.TABLENAME5 = "WJFB_CB"; switch (self.check5) { case 1: self.sqlwhere5 = { LX: "C10", FBZT: "1" }; break; case 2: self.sqlwhere5 = { LX: "C11", FBZT: "1" }; break; case 3: self.sqlwhere5 = { LX: "C12", FBZT: "1" }; break; } var data = { tablename: self.TABLENAME5, pagesize: 10, pageno: 1, colums: "*", order: "ID", sqlwhere: self.sqlwhere5, 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.list5 = res.data; self.list5.forEach(function (item) { item.BT = item.WJBT ? item.WJBT : item.GGBT; self.ZRBM.forEach(function (item1) { if (item.FBBM == item1.CODE) { item.BM = item1.CNAME; } }) }) }) } self.changeType = function (str, n) { if (self[str] == n) { return } else { self[str] = n; switch (str.slice(5)) { case '1': self.getData1(); break; case '2': self.getData2(); break; case '3': self.getData3(); break; case '4': self.getData4(); break; case '5': self.getData5(); break; } } } self.goUrl = function (obj, n) { var code = []; for (var i in self["sqlwhere" + n]) { code.push(i) } console.log(obj); if (n == 0) { window.location.href = "../../tpl/wenjianbg/WJFBB1/detail.html?id=" + obj.ID + "&formPage=wenjianshow"; } else { if (self["TABLENAME" + n] == "WJFB_CB") { window.location.href = "../../tpl/wenjianbg/WJFBB/detail.html?id=" + obj.ID + "&formPage=wenjianshow&tablename=" + self["TABLENAME" + n] + "&code=" + code[0] + "&val=" + self["sqlwhere" + n][code[0]] } else { window.location.href = "../../tpl/tongzhibg/TZGG/detail.html?id=" + obj.ID + "&formPage=wenjianshow&tablename=" + self["TABLENAME" + n] + "&code=" + code[0] + "&val=" + self["sqlwhere" + n][code[0]] } } } self.goMore = function (n) { var code = []; for (var i in self["sqlwhere" + n]) { code.push(i) } window.location.href = "list1.html?tablename=" + self["TABLENAME" + n] + "&code=" + code[0] + "&val=" + self["sqlwhere" + n][code[0]] } //记录日志 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; }) } }])