123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- '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") ? sp.getUrlName("token") : localStorage.getItem("GlWorkPlatform-AccessToken");
- self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
- self.type = sp.getUrlName("type");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- }
- self.search = {
- type: 1,
- ctype: "行政许可"
- }
- 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 = true;
- self.pageno = pageno;
- $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
- var data = {
- tablename: "XQGONGSHI",
- pagesize: self.itemsPerPage,
- pageno: self.pageno,
- colums: "*",
- order: "ID",
- sqlwhere: { CTYPE: self.search.ctype},
- 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));
- 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.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.load()
- self.getInfo = function (item) {
- var set_convertType = 0;
- //if (item.CODE.indexOf("pdf") > -1) {
- // set_convertType = 20;
- //} else if (item.CODE.indexOf("ofd") > -1) {
- // set_convertType = 570;
- //} else if (/(jpg|png|gif|bmp)$/i.test(item.CODE) == true) {
- // set_convertType = 23;
- //} else {
- // set_convertType = 0;
- //}
- //let postData = {
- // convertType: set_convertType,
- // fileUrl: apiurljs.login + "g2work/files2/inline/" + item.CODE
- //};
- let postData = {
- convertType: 20,
- fileUrl: apiurljs.login.split("glwork")[0] + "glworkweb/tpl/deskunit/0e3084aa21ac379410aa07ab29bd9381.pdf"
- };
- var postCfg_transfer = {
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- transformRequest: function (data) {
- return $.param(data);
- }
- };
- $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
- .success(function (res) {
- //console.log(res);
- if (res.errorcode === 0) {
- let rst = res.data;
- if (self.type == "phone") {
- window.location.href = rst.viewUrl
- } else {
- window.open(rst.viewUrl);
- }
- } else {
- sp.dialog(res.message);
- }
- });
- }
- self.changeType = function (n) {
- if (self.search.type == n) {
- return;
- } else {
- self.search.type = n;
- switch(self.search.type){
- case 1:self.search.ctype="行政许可";break;
- case 2:self.search.ctype="行政处罚";break;
- case 3:self.search.ctype="行政强制";break;
- case 4:self.search.ctype="行政检查";break;
- case 5:self.search.ctype="行政奖励";break;
- case 6:self.search.ctype="其他类别";break;
- }
- self.getData(1)
- }
- }
- }])
|