123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- 'use strict';
- var app = angular.module('app', [
- 'angularUtils.directives.dirPagination',
- ]);
- app.controller("indexCtrl", ["$scope", "$http", "$interval", "$timeout", function ($scope, $http, $interval, $timeout) {
- var self = this;
- self.userId = $.cookie("GlWorkPlatform-userid");
- self.userName = $.cookie("GlWorkPlatform-username");
- self.userChineseName = $.cookie("GlWorkPlatform-chineseName")
- self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- 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));
- console.log(res.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.getToTal(0)
- })
- }
- self.active = {
- str: "",
- size: 0
- }
- self.getToTal = function (n) {
- var data = {
- userid: self.userId,
- ntops: 0
- };
- $http.post(apiurljs.login + "g2work/routeinfo/queryDataToDoFlowRouteRecordDesktopByUserid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.totalObj = res.data;
- //self.getdbList(self.totalObj.OTHERCOUNT, self.totalObj.OTHERROUTEIDVARLIST)
- if (n == 0) {
- self.totalObj.NEWCOUNT > 0 ?
- self.getdbList(self.totalObj.NEWCOUNT, self.totalObj.NEWROUTEIDVARLIST):
- self.totalObj.LW01COUNT>0?
- self.getdbList(self.totalObj.LW01COUNT, self.totalObj.LW01ROUTEIDVARLIST) :
- self.totalObj.LW02COUNT > 0 ?
- self.getdbList(self.totalObj.LW02COUNT, self.totalObj.LW02ROUTEIDVARLIST) :
- self.totalObj.LW03COUNT > 0 ?
- self.getdbList(self.totalObj.LW03COUNT, self.totalObj.LW03ROUTEIDVARLIST) :
- self.totalObj.LW04COUNT > 0 ?
- self.getdbList(self.totalObj.LW04COUNT, self.totalObj.LW04ROUTEIDVARLIST) :
- self.totalObj.LB01COUNT > 0 ?
- self.getdbList(self.totalObj.LB01COUNT, self.totalObj.LB01ROUTEIDVARLIST) :
- self.totalObj.LB02COUNT > 0 ?
- self.getdbList(self.totalObj.LB02COUNT, self.totalObj.LB02ROUTEIDVARLIST) :
- self.totalObj.LB03COUNT > 0 ?
- self.getdbList(self.totalObj.LB03COUNT, self.totalObj.LB03ROUTEIDVARLIST) :
- self.totalObj.BLACKCOUNT > 0 ?
- self.getdbList(self.totalObj.BLACKCOUNT, self.totalObj.BLACKROUTEIDVARLIST) :
- self.totalObj.REDCOUNT > 0 ?
- self.getdbList(self.totalObj.REDCOUNT, self.totalObj.REDROUTEIDVARLIST) :
- self.totalObj.YELLOWCOUNT > 0 ?
- self.getdbList(self.totalObj.YELLOWCOUNT, self.totalObj.YELLOWROUTEIDVARLIST) :
- self.totalObj.GREENCOUNT > 0 ?
- self.getdbList(self.totalObj.GREENCOUNT, self.totalObj.GREENROUTEIDVARLIST):
- self.getdbList(self.totalObj.OTHERCOUNT, self.totalObj.OTHERROUTEIDVARLIST)
- } else {
- self.getdbList()
- }
- })
- }
- self.getFlow()
- $interval(function () {
- //self.getToTal(1)
- },5000)
- self.getdbList = function (size, str) {
- if (str) {
- self.active = {
- str: str,
- size: size
- }
- }
- console.log(self.active)
- var querycondition = [];
- querycondition.push({ "CKIND": "VARLIST", "TABLEID": "SYS_ROUTE", "COLID": "ROUTEID", "VALUEA": self.active.str, "VALUEB": "" })
- var data = {
- flowid: self.flows.join("|"),
- userid: self.userId,
- pageno: 1,
- pagesize: self.active.size,
- querycondition: JSON.stringify(querycondition)
- }
- console.log(data)
- $http.post(apiurljs.login + "g2work/routeinfo/queryDataTodoWithPage", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.dbList = res.data;
- self.dbItemList = {
- "width": ($(".dbItem1").width() / 3) * self.dbList.length,
- "height": "140px",
- "transition": "margin-left 1s ease 0s"
- }
- $.each(self.dbList, function (index, item) {
- item.DATE = sp.datefmt("MM-dd HH:mm", item.RECEIVEDATE);
- item.MIJI = item[item.CODETABLE + ".MJ"] || item[item.CODETABLE + ".MIJI"];
- item.JINJI = item[item.CODETABLE + ".JJCD"] || item[item.CODETABLE + ".JJLB"] || item[item.CODETABLE + ".JJQK"];
- item.DP1 = "来自:" + item.DP;
- item.USERNAMEFROM1 = "转自:" + item.USERNAMEFROM;
- item.width = { "width": $(".dbItem1").width() / 3 - 11, "height": "140px" };
- item.FILEN = item.FILEN + "&dotype=1";
- })
- })
- }
- self.getDay = function (str) {
- var a = getDate(new Date());
- var b = getDate(new Date(str));
- var c = parseInt((a - b) / 86400000);
- return c < 0 || c > 2 ? 3 : c;
- }
- self.dbItemNo = 0;//待办事项向左平移n个按钮
- self.dbpageWidth = 0;//待办事项向左平移距离
- self.dbpageLeft = function () {
- if (self.dbItemNo > 0 && self.dbList.length > 3) {
- self.dbItemNo = self.dbItemNo - 3;
- self.dbpageWidth = $(".dbItem1").outerWidth(true) * (self.dbItemNo / 3);
- $(".dbItem1").children().first().css("margin-left", self.dbpageWidth * -1);
- } else {
- return;
- }
- }
- self.dbpageRight = function () {
- if (self.dbItemNo < $(".dbItem").length - 3 && self.dbList.length > 3) {
- self.dbItemNo = self.dbItemNo + 3;
- self.dbpageWidth = $(".dbItem1").outerWidth(true) * (self.dbItemNo / 3);
- $(".dbItem1").children().first().css("margin-left", self.dbpageWidth * -1);
- } else {
- return;
- }
- }
- self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
- self.openSwen = function (obj) {
- self.test.forEach(function (item) {
- if (item.FLOWID.indexOf(obj.FLOWID) > -1) {
- obj.FLOWCODE = item.FLOWCODE;
- obj.CNAME = item.CNAME;
- if (obj.FILEN.indexOf("tpl") == -1) {
- obj.FILEN = item.FILEN.replace(item.FILEN.split("/")[2], obj.FILEN)
- }
- }
- })
- if (self.deviceType == "pad") {
- window.top.jumpPageParent(obj.FLOWCODE, obj.CNAME, obj.FILEN);
- } else {
- console.log(obj)
- //window.top.sp.addTabNav(obj.FLOWCODE, obj.CNAME, obj.FILEN);
- sp.openNewWindow("../../" + obj.FILEN + "&flowid=" + obj.FLOWID, obj.TITLE)
- }
- self.getToTal(1)
- event.stopPropagation()
- }
- self.goParams = function (params) {
- if (self.deviceType == "pad") {
- window.top.jumpPageParent("FZB01", "收文办理", "tpl/shouwenbg/list.html?params=" + params);
- } else {
- window.top.sp.addTabNav("FZB01", "收文办理", "tpl/shouwenbg/list.html?params=" + params);
- }
- }
- }])
- function formate(num) {
- return num > 9 ? num : "0" + num;
- }
- function getWeek(date) {
- switch (new Date(date).getDay()) {
- case 0: return "星期日"; break;
- case 1: return "星期一"; break;
- case 2: return "星期二"; break;
- case 3: return "星期三"; break;
- case 4: return "星期四"; break;
- case 5: return "星期五"; break;
- case 6: return "星期六"; break;
- }
- }
- function getDate(str) {
- var year = str.getFullYear();
- var month = str.getMonth();
- var day = str.getDate();
- return new Date(year, month, day).getTime()
- }
|