'use strict'; var app = angular.module('app', [ 'angularUtils.directives.dirPagination' ]); app.controller("listCtrl", ["$scope", "$http", "$timeout", "$sce", function ($scope, $http, $interval, $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"); var postCfg = { headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + self.get_AccessToken } } self.loading = false; self.loading_del = false; let nowDate = new Date() let y = nowDate.getFullYear() let m = nowDate.getMonth() + 1 let d = nowDate.getDate() self.search = { startdate: sp.dateCount(0),//y + "-01-01", enddate: y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d), startdate_: sp.dateCount(0),//y + "-01-01", enddate_: y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d) } self.flows = []; self.test = []; 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.flows.push(item.FLOWID) self.test.push({ FLOWID: item.FLOWID, FLOWCODE: item.FLOWCODE, CNAME: item.CNAME, FILEN: item.FILEN }) } }) }) } self.getFlow() self.noDataTip = 1; //没有数据时赋变量为0,先默认为1 self.noDataTip_del = 1; //没有数据时赋变量为0,先默认为1 self.pageno = 1; self.total_count = 0; self.total_count_del = 0; self.itemsPerPage = 10; self.itemsPerPage_del = 100; self.pageOptions = [10, 20, 30, 40]; self.getData = function (pageno) { self.loading = true; self.pageno = pageno; $scope.__default__currentPage = self.pageno; //设置页面样式在第几页 var data = { flowid: '', userid: self.userId, pageno: self.pageno, pagesize: self.itemsPerPage, querycondition: JSON.stringify([{ CKIND: 'VARCHAR', TABLEID: 'SYS_ROUTE_VIEW', COLID: 'TITLE', VALUEA: self.search.title || '', }, { CKIND: 'DATETIME', TABLEID: 'SYS_ROUTE_VIEW', COLID: 'APPDATE', VALUEA: self.search.startdate_, VALUEB: self.search.enddate_, }]) } $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.loading = false; if (res.data == null || res.data == undefined || res.data == "") { self.noDataTip = 0; self.list = [] } else { self.noDataTip = 1; res.data.forEach(function (item) { item.checked = false; if (item.STATUSINFO == 'DEAL' || item.STATUSINFO == 'START') { item.STATUSINFO_CN = '在办' } else if (item.STATUSINFO == 'STOP') { item.STATUSINFO_CN = '办结' } else { item.STATUSINFO_CN = '' } item.userStr = '' 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.list = res.data; self.total_count = res.meta.totalCount; } }) } self.getData_del = function (pageno) { self.loading_del = true; var data = { userid: self.userId } $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengDeleted", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) // var data = { // flowid: '', // userid: self.userId, // pageno: 1, // pagesize: 20, // querycondition: [{ // CKIND: 'VARCHAR', // TABLEID: 'SYS_ROUTE_VIEW', // COLID: 'TITLE', // VALUEA: self.search.title || '', // }, { // CKIND: 'DATETIME', // TABLEID: 'SYS_ROUTE_VIEW', // COLID: 'APPDATE', // VALUEA: self.search.startdate_, // VALUEB: self.search.enddate_, // }] // } // $http.post(apiurljs.login + "g2work/routeinfo/queryDataQuanLiuChengWithPage", { // data: s4.encryptData_CBC(JSON.stringify(data)) // }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); self.loading_del = false; if (res.data == null || res.data == undefined || res.data == "") { self.noDataTip_del = 0; self.list_del = [] } else { self.noDataTip_del = 1; res.data.forEach(function (item) { item.checked = false; if (item.STATUS == 'DEAL' || item.STATUS == 'START') { item.STATUSINFO_CN = '在办' } else if (item.STATUS == 'STOP') { item.STATUSINFO_CN = '办结' } else { item.STATUSINFO_CN = '' } }) self.list_del = res.data; self.total_count_del = res.meta.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.getData_del(); } self.load(); self.openSearch = function () { sp.layer("#Search") } self.doSearch = function () { self.getData(1); sp.layerhide() } self.cancal = function () { self.search = { keyword: "", startdate: "", enddate: "" } self.getData(1); sp.layerhide() } self.refresh = function () { self.getData(self.pageno); } self.checkAll = false; self.checkAllItem = function () { self.checkAll = !self.checkAll; self.list.forEach(function (item) { item.checked = self.checkAll; }) } self.checkAll_del = false; self.checkAllItem_del = function () { self.checkAll_del = !self.checkAll_del; self.list_del.forEach(function (item) { item.checked = self.checkAll_del; }) } self.btnDel = function () { var routeinfoids = []; self.list.forEach(function (item) { if (item.checked == true) { routeinfoids.push(item.ROUTEINFOID) } }) var dialogHead = "温馨提示×"; var dialogBody = "