123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- 'use strict';
- var app = angular.module('app', [
- 'angularUtils.directives.dirPagination'
- ]);
- app.controller("listCtrl", ["$scope", "$http", "$timeout", "$interval", function ($scope, $http, $timeout, $interval) {
- 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.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
- self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- }
- var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
- self.role = false;
- self.getROLE = function () {
- var data = {
- userid: self.userId
- };
- $http.post(apiurljs.login + "g2work/datazu/queryDataUserAuth", { 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[0].auths.length; i++) {
- if (res.data[0].auths[i].ZID == "AA82" && res.data[0].auths[i].AUTH == 1) {
- self.role = true;
- }
- }
- self.getJJQK();
- });
- }
- self.getROLE()
- self.search = {
- HYZZDW: "",
- HYMC: "",
- HYRQ: "",//sp.format(sp.getLocalDate())
- CHLD: "",
- CHWLD: ""
- }
- self.getJJQK = function () {
- var data = {
- ckey: "CODE_EMERGENCY",
- 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.JJQK = res.data.CODE_EMERGENCY;
- self.load()
- })
- }
- 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 sqlwhere = "";
- if (self.search.HYZZDW != "") {
- sqlwhere += " and HYZZDW like'%" + self.search.HYZZDW + "%'"
- }
- if (self.search.HYMC != "") {
- sqlwhere += " and HYMC like'%" + self.search.HYMC + "%'"
- }
- if (self.search.HYRQ != "") {
- sqlwhere += " and HYRQ BETWEEN '" + self.search.HYRQ + " 00:00:00' AND '" + self.search.HYRQ + " 23:59:59'"
- }
- if (self.search.CHLD != "") {
- sqlwhere += " and CHLD like'%" + self.search.CHLD + "%'"
- }
- if (self.search.CHWLD != "") {
- sqlwhere += " and CHWLD like'%" + self.search.CHWLD + "%'"
- }
- var data = {
- tablename: "SX_PHD",
- colums: "*",
- order: "HYRQ desc",
- sqlwhere: sqlwhere,
- pageno: self.pageno,
- pagesize: self.itemsPerPage
- };
- console.log(data)
- $http.post(apiurljs.login + "g2app/dataabase/queryFormFlowWithPage", { 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.total_count = res.totalCount;
- self.list.forEach(function (item) {
- item.WEEK = weeks[new Date(item.HYRQ).getDay()]
- item.HYRQ = sp.datefmt("yyyy-MM-dd HH:mm", item.HYRQ)
- self.JJQK.forEach(function (item1) {
- if (item.JJCD) {
- if (item.JJCD == item1.CODE)
- item.JJCD = item1.CNAME
- }
- })
- })
- }
- })
- }
- 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.openLayer = function () {
- self.search = {
- HYZZDW: "",
- HYMC: "",
- HYRQ: "",//sp.format(sp.getLocalDate())
- CHLD: "",
- CHWLD: ""
- }
- sp.layer("#Search")
- }
- self.doSearch = function () {
- self.getData(self.pageno)
- sp.layerhide()
- }
- self.cancal = function () {
- self.search = {
- HYZZDW: "",
- HYMC: "",
- HYRQ: "",//sp.format(sp.getLocalDate())
- CHLD: "",
- CHWLD: ""
- }
- self.getData(1)
- sp.layerhide()
- }
- self.refresh = function () {
- self.getData(self.pageno);
- }
- self.goUrl = function (item) {
- if (self.deviceType == "pad") {
- window.location.href = "detail.html?routeinfoid=" + item.ROUTEINFOID
- } else {
- sp.openNewWindow("detail.html?routeinfoid=" + item.ROUTEINFOID, item.HYMC)
- }
- }
- self.editBZ = function (item) {
- self.edit = {
- ID: item.ID,
- HYMC: item.HYMC,
- BZ: item.BZ
- }
- sp.layer("#editBZ")
- }
- self.btnSave = function () {
- var data = {
- tablename: "SX_PHD",
- id: self.edit.ID,
- data: JSON.stringify({
- BZ: self.edit.BZ
- })
- }
- $http.post(apiurljs.login + "g2app/dataabase/upFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide()
- if (res.success) {
- self.getData(self.pageno)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- $interval(function () {
- if (localStorage.getItem("GlWorkPlatform-PH1-refresh") == 1) {
- localStorage.removeItem("GlWorkPlatform-PH1-refresh")
- self.refresh()
- }
- }, 1000)
- //头部下滚冻结
- $(function () {
- //页面高度撑满
- setTimeout(function () {
- if ($(".ibox-content").height() < $(window).height() - 31) {
- $(".ibox-content").css("height", $(window).height() - 31)
- }
- }, 1)
- })
- }])
|