123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- //'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.type = self.get_type != "" ? self.get_type : "todo";
- self.Url = getUrl(self.type);
- self.CrossPage = window.parent.CrossPage;
- self.loading = false;
- self.noDataTip = 1;//没有数据时赋变量为0,先默认为1
- self.pageno = 1;
- self.total_count = 0;
- self.itemsPerPage = 10;
- self.pageOptions = [10, 20, 30, 40];
- self.getGWZL = function () {
- var data = {
- tablename: "CODE_GWTYPE",
- colums: "ID,CODE,CNAME,FLOWID",
- order: "ID desc",
- sqlwhere: {
- USEMARK: 1
- },
- 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));
- console.log(res.data)
- self.GWZL = res.data;
- self.getJJQK()
- })
- }
- self.getJJQK = function () {
- var data = {
- ckey: "CODE_EMERGENCY",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.JJQK = res.data.CODE_EMERGENCY;
- self.load()
- })
- }
- self.getData = function (pageno) {
- self.list = [];
- self.loading = true;
- self.pageno = pageno;
- $scope.__default__currentPage = self.pageno; //设置页面样式在第几页
- var data = {
- //flowid: "AA00|AA00",
- flowid: "$JS-FLOWID$",
- userid: self.userId,
- pageno: self.pageno,
- pagesize: self.itemsPerPage
- }
- console.log(JSON.stringify(data));
- $http.post(apiurljs.login + "g2work/routeinfo/" + self.Url, { 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;
- } else {
- self.noDataTip = 1;
- self.list = res.data;
- //console.log(JSON.stringify(self.list));
- self.total_count = res.totalCount;
- $.each(self.list, function (index, item) {
- item.TITLE_set = item.FLOWNAME + " - " + item.APPCODE;
- item.LWWH = item[item.CODETABLE + ".WH"] ? item[item.CODETABLE + ".WH"] : item[item.CODETABLE + ".LWWH"];
- self.JJQK.forEach(function (item1) {
- if (item[item.CODETABLE + ".JJCD"]) {
- if (item[item.CODETABLE + ".JJCD"] == item1.CODE)
- item.JJCD = item1.CNAME
- } else {
- if (item[item.CODETABLE + ".JJQK"] == item1.CODE)
- item.JJCD = item1.CNAME
- }
- })
- self.GWZL.forEach(function (item1) {
- if (item[item.CODETABLE + ".GWZL"] == item1.CODE)
- item.GWZL = item1.CNAME
- })
- //console.log(item.FILEN);
- if (item.FILEN != "") {
- item.FILEN = item.FILEN.indexOf("dotype") > -1 ? item.FILEN.replace("dotype=1", "dotype=" + getDoType(self.type)) + "&type=" + self.type + "&lastReturnPageno=" + self.pageno : item.FILEN + "&dotype=" + getDoType(self.type) + "&type=" + self.type + "&lastReturnPageno=" + self.pageno;
- var get_canshu = item.FILEN.split("?")[1];
- item.FILEN = "formedit.html?" + get_canshu;
- } else {
- item.FILEN = "#";
- }
- if (self.type == "finish") {
- item.RECEIVEDATE = item.FINISHEDDATE;
- }
- })
- }
- //if (self.CrossPage.type == 0) {
- // self.journalRecord(self.CrossPage.ctime, sp.getLocalDate1(), "", "接入日志", window.location.pathname)
- //}
- }).error(function (err) {
- //错误代码
- self.list = [];
- self.noDataTip = 0;
- self.loading = false;
- console.log(err);
- });
- }
- 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.getGWZL();
- self.refresh = function () {
- self.CrossPage.type = null;
- self.getData(self.pageno);
- }
- self.goUrl = function (item) {
- window.location.href = item.FILEN + "&dotype=" + getDoType(self.type)
- }
- self.btnDel = function (item) {
- var data = {
- routeinfoid: item.ROUTEINFOID,
- 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));
- if (res.success == true) {
- self.getData(self.pageno)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.btnRecall = function (routeid) {
- var data = {
- routeid: routeid,
- userid: self.userId
- }
- $http.post(apiurljs.login + "g2work/routeinfo/recallDoneByRouteid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success == true) {
- self.getData(self.pageno)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.changeType = function (str) {
- if (self.type == str) {
- return;
- } else {
- var time1 = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "查询", "查询日志", "/g2work/routeinfo/" + self.Url)
- self.type = str;
- self.Url = getUrl(self.type);
- self.getData(1)
- }
- }
- self.getAddFlag = function () {
- var data = {
- userid: self.userId,
- ntops: 0
- }
- $http.post(apiurljs.login + "g2work/desktop/queryWorkflowCando", data, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.lcList = [];
- self.activeLC = {};
- res.data.forEach(function (item) {
- if ("$JS-FLOWID$".indexOf(item.FLOWID) > -1) {
- self.lcList.push(item);
- }
- })
- })
- }
- self.getAddFlag()
- self.addLC = function () {
- if (self.lcList.length == 1) {
- window.location.href = self.lcList[0].FILEN + "&dotype=1"
- } else {
- sp.layer("#addLC");
- }
- }
- self.seeLCT = function (item, event) {
- event.preventDefault();
- event.stopPropagation();
- }
- self.goAddUrl = function () {
- if (!self.activeLC.FILEN) {
- return
- }
- window.location.href = self.activeLC.FILEN + "&dotype=1"
- }
- //记录日志
- self.journalRecord = function (time1, time2, title, func, url) {
- if (!self.CrossPage.cname) { return; }
- var data = {
- tablename: "SYS_CLICKLOG",
- data: {
- CTIME: time1 == null ? sp.getLocalDate1() : time1,
- TITLE: (title != "" ? self.CrossPage.cname + "/" + title : self.CrossPage.cname),
- REQUESTURL: url,
- REQUESTHEADERURL: window.location.origin,
- LOGTYPE: func,
- USERTYPE: $.cookie("GlWorkPlatform-userType"),
- ADMIN: $.cookie("GlWorkPlatform-userTypeEng"),
- CLIENTIP: sp.myIP(),
- PCNAME: sp.detectOS(),
- BROWSERNAME: sp.browser(),
- RESPONSETIME: time2 == null ? sp.getLocalDate1() : time2,
- USERID: self.userId,
- USERNAME: self.userName
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (res) {
- self.CrossPage.type = 1;
- })
- }
- //头部下滚冻结
- $(function () {
- //页面高度撑满
- setTimeout(function () {
- if ($(".ibox-content").height() < $(window).height() - 31) {
- $(".ibox-content").css("height", $(window).height() - 31)
- }
- }, 1)
- })
- }])
- function getUrl(str) {
- switch (str) {
- case "todo":
- return "queryDataTodoWithPage";
- break;
- case "done":
- return "queryDataDoneWithPage";
- break;
- case "finish":
- return "queryDataFinishWithPage";
- break;
- }
- }
- function getDoType(str) {
- switch (str) {
- case "todo":
- return 1;
- break;
- default:
- return 0;
- break;
- }
- }
|