123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341 |
- '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.selectOa = 'New';
- self.loading = false;
- self.searchFlag = false;
- let nowDate = new Date()
- let y = nowDate.getFullYear()
- let m = nowDate.getMonth() + 1
- let d = nowDate.getDate()
- self.search = {
- keyword: "",
- startdate: "2023-09-01",//y + "-01-01",
- enddate: y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d),
- title: "",
- lwdw: "",
- cbr: "",
- startdate_: "2023-09-01",//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.indexOf("无") == -1) {
- self.flows.push(item.FLOWID)
- self.test.push({ FLOWID: item.FLOWID, FLOWCODE: item.FLOWCODE, CNAME: item.CNAME, FILEN: item.FILEN })
- }
- })
- })
- }
- self.getOldUser = function () {
- var data = {
- tablename: "OLDOAUSER",
- colums: "*",
- order: "ID asc",
- sqlwhere: { USERNAME: self.userName },
- sqlinwhere: "",
- sqllikewhere: ""
- }
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.data.length > 0) {
- self.olduserId = res.data[0].USERID;
- } else {
- self.olduserId = self.userId;
- }
- })
- }
- self.getOldUser()
- self.getFlow()
- self.noDataTip = 1; //没有数据时赋变量为0,先默认为1
- self.pageno = 1;
- self.total_count = 0;
- self.itemsPerPage = 10;
- self.pageOptions = [10, 20, 30, 40];
- self.getDataOld = function (pageno) {
- if (self.search.keyword == "") {
- self.search.keyword = self.search.title
- }
- if (self.search.startdate == "") {
- self.search.startdate = self.search.startdate_
- }
- if (self.search.enddate == "") {
- self.search.enddate = self.search.enddate_
- }
- self.searchFlag = true;
- self.loading = true;
- self.pageno = pageno;
- $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
- var data = {
- keyword: self.search.keyword,
- startdate: self.search.startdate,
- enddate: self.search.enddate,
- page: self.pageno.toString(),
- pagesize: self.itemsPerPage.toString(),
- userid: self.olduserId,//当前人userid
- author: "",//起始人名称
- title: "",
- accessoryname: "",//附件名
- libStr:""//类别
- }
- $http.post(apiurljs.login + "g2app/OAQuery/QueryDataList", {
- 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.list=[]
- self.noDataTip = 0;
- } else {
- self.noDataTip = 1;
- res.data.searchResults.forEach(function (item) {
- if (item.appType == '2') {
- item.appType_cn = '表单'
- } else if (item.appType == '4') {
- item.appType_cn = '公文'
- } else {
- item.appType_cn = ''
- }
- })
- self.list = res.data.searchResults;
- self.total_count = res.data.totalCount;
- }
- })
- }
- self.getDataNew = function (pageno) {
- if (self.search.title == "") {
- self.search.title = self.search.keyword
- }
- if (self.search.startdate_ == "") {
- self.search.startdate_ = self.search.startdate
- }
- if (self.search.enddate_ == "") {
- self.search.enddate_ = self.search.enddate
- }
- self.searchFlag = true;
- self.loading = true;
- self.pageno = pageno;
- $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
- var array = [{
- 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_,
- }];
- if (self.search.lwdw != "") {
- array.push( {
- CKIND: 'VARCHAR',
- TABLEID: 'SYS_ROUTE_VIEW',
- COLID: 'LWDW',
- VALUEA: self.search.lwdw,
- })
- }
- if (self.search.cbr != "") {
- array.push({
- CKIND: 'VARCHAR',
- TABLEID: 'SYS_ROUTE_VIEW',
- COLID: 'USERNAME',
- VALUEA: self.search.cbr,
- })
- }
- var flows = [];
- self.test.forEach(function (item) {
- if (item.checked == true) {
- flows.push(item)
- }
- })
- var data = {
- flowid: flows.map(function (item) { return item.FLOWID }).join("|") != "" ? flows.map(function (item) { return item.FLOWID }).join("|") : '',
- userid: self.userId,
- pageno: self.pageno,
- pagesize: self.itemsPerPage,
- querycondition: JSON.stringify(array)
- }
- $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));
- console.log(res)
- 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) {
- 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.list = res.data;
- self.total_count = res.meta.totalCount;
- }
- })
- }
- self.toNew = function(){
- if(self.selectOa != 'New'){
- self.pageno = 1
- self.selectOa = 'New';
- self.load('New')
- }
- }
- self.toOld = function(){
- if(self.selectOa != 'Old'){
- self.pageno = 1
- self.selectOa = 'Old';
- self.load('Old')
- }
- }
- self.load = function (type) {
- if (self.search.keyword == "" && self.search.title == "" && self.selectOa == "Old") {
- sp.dialog("请输入关键字!");
- self.searchFlag = false;
- return
- }
- if (self.get_lastReturnPageno == undefined || self.get_lastReturnPageno == null || self.get_lastReturnPageno == "") {
- self['getData'+type](self.pageno);
- } else {
- $timeout(function () {
- self.getData(self.get_lastReturnPageno);
- }, 1)
- }
- }
-
- self.openSearch = function () {
- if(self.selectOa=='New'){
- sp.layer("#SearchNew")
- }else if(self.selectOa=='Old'){
- sp.layer("#SearchOld")
- }
- }
- self.doSearch = function () {
- if (self.search.keyword == "" && self.search.title == "" && self.selectOa == "Old") {
- sp.dialog("请输入关键字!");
- self.searchFlag = false;
- return
- }
- self['getData' + self.selectOa](1)
- // self.load(self.selectOa);
- sp.layerhide()
- }
- self.cancal = function () {
- self.searchFlag = false;
- self.search = {
- keyword: "",
- startdate: "",
- enddate: ""
- }
- self.list = [];
- sp.layerhide()
- }
- self.refresh = function () {
- self['getData'+ self.selectOa](self.pageno);
- }
- self.goUrl = function (obj) {
- if(self.selectOa=='New'){
- 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('/')
- sp.openNewWindow(hrefArr[0]+FILENArr[1]+'/'+obj.FILEN)
- }
- })
- //sp.openNewWindow(hrefArr[0]+obj.FILEN)
- }
-
- }else if(self.selectOa=='Old'){
- sp.openNewWindow(apiurljs.seeyon + "/detailt.html?url=" + obj.url, obj.accessoryName)
- }
-
- }
- self.keyLogin = function () {
- if (event.keyCode == 13) { //回车键的键值为13
- if ($(".sp-dialog").is(":hidden") == true) {
- self.doSearch()
- } else {
- sp.dialoghide()
- }
- }
- }
- //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, '<br/>').replace(/\s/g, ' '));
- };
- });
|