123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- '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");
- 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.getUserRole = function () {
- var data = {
- userid: self.userId
- };
- $http.post(apiurljs.login + "g2work/datazu/queryDataUserAuth", data, postCfg)
- .success(function (res) {
- for (var i = 0; i < res.data[0].auths.length; i++) {
- if ((res.data[0].auths[i].ZID == "AA08" || res.data[0].auths[i].ZID == "AA85" || res.data[0].auths[i].ZID == "AA21" || res.data[0].auths[i].ZID == "AA71" || res.data[0].auths[i].ZID == "0") && res.data[0].auths[i].AUTH == "1") {
- self.userRole = 1;
- break
- } else if ((res.data[0].auths[i].ZID == "AA28" || res.data[0].auths[i].ZID == "AA30") && res.data[0].auths[i].AUTH == "1") {
- self.userRole = 2;
- break
- }
- }
- console.log(self.userRole)
- if (self.userRole == 1) {
- self.getData1()
- } else {
- self.getDP()
- }
- });
- }
- self.getDP = function () {
- var data = {
- userid: self.userId
- }
- $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
- self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE;
- self.getData1();
- })
- }
- self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
- self.getData1 = function () {
- self.list1 = [];
- var data = {
- fwflow: "AA20|AA03|AA10|AA57|AA08|AA23|AA77|AA06|AA88|AA89|AA46|AA22|AA54|AA55|AA56|AA98|AA99|AA0A|AA0P",
- swflow: "AA18|AA16",
- yzflow: "",
- begindate: "",
- enddate: "",
- rediskey: "MMMMMMMMM"
- }
- $http.post(apiurljs.login + "g2app/richang/GongWenStatistics", data, postCfg)
- .success(function (res) {
- if (res.data == null || res.data == undefined || res.data == "") {
- self.noDataTip = 0;
- } else {
- self.noDataTip = 1;
- if (self.userRole == 1) {
- self.list1 = res.data.DEPARTMENT;
- } else {
- self.list1 = res.data.DEPARTMENT.filter(function (item) {
- return item.SECTCODE == self.userDpCode;
- })
- }
- }
- })
- }
- self.getUserRole()
- self.searchIds = function (ids, obj) {
- self.activeObj = obj;
- if (ids) {
- self.loading = true;
- self.routeinfoids = ids.replace(/\|/g, ",");
- self.searchType = [];
- self.search = {
- title: ""
- }
- $(".sp-checkbox-blue input").each(function () {
- $(this).attr("checked", false);
- $(this).parent("label").removeClass("chb-blue-checked");
- })
- self.getList(1)
- } else {
- return
- }
- }
- self.searchType = [];
- self.selectType = function (str) {
- if (self.searchType.indexOf(str) == -1) {
- self.searchType.push(str)
- } else {
- self.searchType.splice(self.searchType.indexOf(str), 1)
- }
- self.loading = true;
- self.routeinfoids = "";
- self.activeObj = null;
- self.getList(1)
- }
- self.search = {
- title: ""
- }
- self.getData2 = function () {
- self.loading = true;
- self.routeinfoids = "";
- self.activeObj = null;
- self.getList(1)
- }
- self.pageno = 1;
- self.total_count = 0;
- self.itemsPerPage = 10;
- self.pageOptions = [10, 20, 30, 40];
- self.getList = function (pageno) {
- self.pageno = pageno;
- $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
- var array = [];
- if (self.routeinfoids != "") {
- array.push({ "CKIND": "VARLIST", "TABLEID": "SYS_ROUTE_INFO", "COLID": "ROUTEINFOID", "VALUEA": self.routeinfoids, "VALUEB": "" })
- }
- var data = {
- flowid: "AA16|AA18",
- sectcode: self.userRole == 1 ? "" : self.userDpCode,
- lwdw: self.searchType.join("|"),
- title: self.search.title,
- userid: self.userId,
- pageno: self.pageno,
- pagesize: self.itemsPerPage,
- querycondition: JSON.stringify(array),
- columnscondition: ""
- }
- $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengBumenDubanWithPage", data, postCfg)
- .success(function (res) {
- self.loading = false;
- if (res.data == null || res.data == undefined || res.data == "") {
- self.noDataTip = 0;
- self.qlcList = []
- self.total_count = 0;
- } else {
- self.noDataTip = 1;
- res.data.forEach(function (item) {
- item.APPDATE = sp.format(item.APPDATE)
- item.ARCHIVESDATE = sp.format(item.ARCHIVESDATE)
- if (item.MARKARCHIVES == '1' || item.MARKARCHIVES == '2') {
- item.STATUSINFO_CN = '办结'
- } else{
- item.STATUSINFO_CN = '在办'
- }
- if (item.RELATELIST) {
- item.RELATELIST.forEach(function (iitem) {
- iitem.APPDATE = sp.format(iitem.APPDATE)
- if (iitem.STATUS == 'DEAL' || iitem.STATUS == 'START') {
- iitem.STATUSINFO_CN = '在办'
- } else if (iitem.STATUS == 'STOP') {
- iitem.STATUSINFO_CN = '办结'
- } else {
- iitem.STATUSINFO_CN = ''
- }
- })
- }
- })
- self.qlcList = res.data;
- self.total_count = res.meta.totalCount;
- }
- })
- }
- self.flowList = [];
- self.getFlow = function () {
- var data = {
- userid: self.userId,
- ntops: 0//6
- }
- $http.post(apiurljs.login + "g2work/routeinfo/queryDataToDoFlowRouteCountDesktopByUserid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- res.data.forEach(function (item) {
- if (item.FLOWID != "无") {
- self.flowList.push({ FLOWID: item.FLOWID, FLOWCODE: item.FLOWCODE, CNAME: item.CNAME, FILEN: item.FILEN })
- }
- })
- })
- }
- self.getFlow()
- self.goUrl = function (obj) {
- let href = window.location.href
- let hrefArr = href.split('totalshouwen')
- if (hrefArr.length > 0) {
- self.flowList.forEach(function (item) {
- if (item.FLOWID.indexOf(obj.FLOWID) > -1) {
- let FILENArr = item.FILEN.split('/')
- sp.openNewWindow(hrefArr[0] + FILENArr[1] + '/' + obj.FILEN)
- }
- })
- }
- }
- self.ywblMove = function (n) {
- var marginLeft = parseInt($(".List").css("margin-left").slice(0, $(".List").css("margin-left").indexOf("px"))) + n * $(".Item").outerWidth(true);
- if (marginLeft > 0) {
- $(".List").css("margin-left", 0)
- } else if (marginLeft < ($(".List").outerWidth(true) - $(".Item").outerWidth(true) * 5) * -1) {
- $(".List").css("margin-left", ($(".List").outerWidth(true) - $(".Item").outerWidth(true) * 5) * -1)
- } else {
- $(".List").css("margin-left", marginLeft)
- }
- }
- }])
- app.directive("repeatFinish", function () {
- return {
- link: function (scope) {
- $(".Item").eq(scope.$index).css("width", $(".List").parent().width() / 5 - 20)
- if (scope.$last == true) {
- $(".List").css("width", scope.$parent.ctl.list1.length * ($(".List").parent().width() / 5 + 20))
- }
- }
- };
- });
- app.directive("spCheckboxBlueItem", function () {
- return {
- restrict: "A",
- link: function (scope, elem, attrs) {
- if (!scope == false) {
- spng.funcheckbox(elem, "chb-blue", "chb-blue-checked"); //蓝色checkbox
- }
- }
- }
- });
|