'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.zonglan = true; self.noDataTip = 1;//没有数据时赋变量为0,先默认为1 self.getData = function () { self.list1 = []; self.list2 = []; 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: "" } $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; self.gwsl = res.data.GWCOUNT; self.blz = res.data.DEAL; self.ygd = res.data.STOP; self.bys = { total: res.data.SW_MONTH.total, totalids: res.data.SW_MONTH_IDS, banli: res.data.SW_MONTH_BANLI, banliids: res.data.SW_MONTH_BANLI_IDS, guidang: res.data.SW_MONTH_GUIDANG, guidangids: res.data.SW_MONTH_GUIDANG_IDS }; self.byf = { total: res.data.FW_MONTH.total, totalids: res.data.FW_MONTH_IDS, banli: res.data.FW_MONTH_BANLI, banliids: res.data.FW_MONTH_BANLI_IDS, guidang: res.data.FW_MONTH_GUIDANG, guidangids: res.data.FW_MONTH_GUIDANG_IDS }; self.list1 = res.data.DEPARTMENT; self.list2 = res.data.DIRECTUNDER; } }) } self.getData() self.searchIds = function (ids) { if (ids) { self.loading = true; self.routeinfoids = ids.replace(/\|/g, ","); self.getList(1) } else { return } } 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 = [{ "CKIND": "VARLIST", "TABLEID": "SYS_ROUTE_INFO", "COLID": "ROUTEINFOID", "VALUEA": self.routeinfoids, "VALUEB": "" }]; var data = { flowid: '', userid: self.userId, pageno: self.pageno, pagesize: self.itemsPerPage, querycondition: JSON.stringify(array) } $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengWithPage", data, postCfg) .success(function (res) { self.zonglan = false; self.loading = false; if (res.data == null || res.data == undefined || res.data == "") { self.qlcList = [] } else { self.noDataTip = 1; res.data.forEach(function (item) { item.APPDATE = sp.format(item.APPDATE) if (item.STATUSINFO == 'DEAL' || item.STATUSINFO == 'START') { item.STATUSINFO_CN = '在办' } else if (item.STATUSINFO == 'STOP') { item.STATUSINFO_CN = '办结' } else { item.STATUSINFO_CN = '' } item.userStr = '' if (item.TODOLIST) { item.TODOLIST.forEach(function (iitem) { iitem.USERS.forEach(function (iiitem) { iiitem.STATUS_CN = '' if (iiitem.STATUS == '0') { iiitem.STATUS_CN = '草稿' } else if (iiitem.STATUS == '1') { iiitem.STATUS_CN = '待办' } else if (iiitem.STATUS == '2') { iiitem.STATUS_CN = '在办' } if (iiitem.USERNAME && iiitem.STATUS_CN) { if (item.userStr) { item.userStr = item.userStr + ',' + iiitem.USERNAME + '-' + iiitem.STATUS_CN } else { item.userStr = iiitem.USERNAME + '-' + iiitem.STATUS_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) } }) } } }])