'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 = "
您确认要删除吗?删除的数据将暂存回收站中
"; var dialogFoot = "
"; $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot); sp.openCenter(".sp-dialog"); ///取消按钮 $('.sp-closeDialog').click(function (event) { sp.closeCenter(".sp-dialog"); event.preventDefault(); event.stopPropagation(); }); //post消息的id $("#delDataTrue").click(function () { var data = { routeinfoid: routeinfoids.join("|"), userid: self.userId } $http.post(apiurljs.login + "g2work/routeinfo/removeDraftToCacheByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); sp.dialoghide(); if (res.success == true) { self.getData(self.pageno) self.getData_del() } else { sp.dialog(res.message) } }) }); } self.btnDel_del = function () { var routeinfoids = []; self.list_del.forEach(function (item) { if (item.checked == true) { routeinfoids.push(item.ROUTEINFOID) } }) var dialogHead = "温馨提示×"; var dialogBody = "
删除后不可恢复,您确认要删除吗?
"; var dialogFoot = "
"; $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot); sp.openCenter(".sp-dialog"); ///取消按钮 $('.sp-closeDialog').click(function (event) { sp.closeCenter(".sp-dialog"); event.preventDefault(); event.stopPropagation(); }); //post消息的id $("#delDataTrue").click(function () { var data = { routeinfoid: routeinfoids.join("|"), userid: self.userId } $http.post(apiurljs.login + "g2work/routeinfo/deleteDraftByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); sp.dialoghide(); if (res.success == true) { self.getData(self.pageno) } else { sp.dialog(res.message) } }) }); } self.refresh_del = function () { var routeinfoids = []; self.list_del.forEach(function (item) { if (item.checked == true) { routeinfoids.push(item.ROUTEINFOID) } }) var dialogHead = "温馨提示×"; var dialogBody = "
确认恢复选中的数据吗?
"; var dialogFoot = "
"; $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot); sp.openCenter(".sp-dialog"); ///取消按钮 $('.sp-closeDialog').click(function (event) { sp.closeCenter(".sp-dialog"); event.preventDefault(); event.stopPropagation(); }); //post消息的id $("#delDataTrue").click(function () { var data = { routeinfoid: routeinfoids.join("|"), userid: self.userId } $http.post(apiurljs.login + "g2work/routeinfo/resumeDraftFromCacheByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg) .success(function (obj) { var res = strToJson(s4.decryptData_CBC(obj.data)); sp.dialoghide(); if (res.success == true) { self.getData(self.pageno) self.getData_del() } else { sp.dialog(res.message) } }) }); } self.goUrl = function (obj) { let href = window.location.href let hrefArr = href.split('fontOA') if (hrefArr.length > 0) { self.test.forEach(function (item) { if (item.FLOWID.indexOf(obj.FLOWID) > -1) { let FILENArr = item.FILEN.split('/') //AA18,AA16收文 //A20,AA03,AA10,AA55,AA56,AA57,AA08,AA23,AA77,AA06行政发文 //AA88,AA89,AA46,AA22,AA54党委发文 //AA98,AA0A,AA99,AA0E,AA0P机关党委 //AA65签报 //AA95党委会议题呈报 //AA0F党委会议方案 //AA93委主任办公会议题呈报 //AA97一般会议方案 //AA0O因私出国申请 //AA0S因私出国审批 //AA0V报销凭证 //AA0W公务接待清单 //AA0X差旅费报销凭证 //AA0Y环外出行报销凭证 //AA1B常务会议题呈报 //AA1C常务会会议纪要 //AA1D巡察人才库审批 //AA1E纪检组、纪委审核 if ("AA18,AA16,AA20,AA03,AA10,AA55,AA56,AA57,AA08,AA23,AA77,AA06,AA88,AA89,AA46,AA22,AA54,AA98,AA0A,AA99,AA0E,AA0P,AA65,AA95,AA0F,AA93,AA97,AA0O,AA0S,AA1B,AA1C,AA1D,AA1E,AA0V,AA0W,AA0X,AA0Y".indexOf(obj.FLOWID) > -1) { sp.openNewWindow(hrefArr[0].replace("tpk", "tpl") + FILENArr[1] + '/' + obj.FILEN + "&dotype=1&gkbutton=1") } else { sp.openNewWindow(hrefArr[0].replace("tpk", "tpl") + FILENArr[1] + '/' + obj.FILEN) } } }) } } //self.goUrl() //头部下滚冻结 $(function () { //页面高度撑满 setTimeout(function () { if ($(".ibox-content").height() < $(window).height() - 31) { $(".ibox-content").css("height", $(window).height() - 31) } }, 1) }) }]) app.filter('trustHtml', function ($sce) { return function (input) { return $sce.trustAsHtml(input.replace(/\n/g, '
').replace(/\s/g, ' ')); }; });