1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102 |
- 'use strict';
- var app = angular.module('app', []);
- app.controller("forwardCtrl", ["$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.routeid = sp.getUrlName("routeid");
- self.routeinfoid = sp.getUrlName("routeinfoid");
- self.copyrightid = sp.getUrlName("copyrightid");
- self.directionid = sp.getUrlName("directionid");
- self.formeditid = sp.getUrlName("formeditid");
- self.directionFlag = false;
- self.directionList1 = [];
- self.setZDY = false;
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.getDirectionFlag = function () {
- var data = {
- copyrightid: self.copyrightid
- }
- $http.post(apiurljs.login + "g2work/abase/queryFormeditSignByCopyrightid", { 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.directionList1 = res.data;
- }
- var data1 = {
- directionid: self.directionid
- }
- $http.post(apiurljs.login + "g2work/flowdirection/queryData", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
- .success(function (obj1) {
- var res1 = strToJson(s4.decryptData_CBC(obj1.data));
- self.directionFlag = res1.data.TOINFOSTATUS != "START" && self.directionList1.length > 0;
- })
- self.forward()
- })
- }
- self.getDirectionFlag()
- //转发
- self.forward = function () {
- self.activeGroup = "部门";
- self.searchName = "";
- self.searchRole = "";
- self.saveZB = false;
- self.jiaqian = false;
- self.opinionYY = false;
- var data = {
- codefuncbutton: sp.getUrlName("codefuncbutton"),
- directionid: self.directionid,
- directionidtarget: sp.getUrlName("directionidtarget"),
- userid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: self.routeid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataSendByTarget", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.showContent = true;
- self.directions = res.data; //所有可选流向
- self.direction = self.directions[0]; //所选流向
- if (self.direction.SENDERRORS && self.direction.SENDERRORS.MESSAGE != "") {
- self.showContent = false;
- if (self.direction.CODEFUNCBUTTON == "SENDCOMMIT" && self.direction.SENDERRORS.ERRORLIST.length == 2 && self.direction.SENDERRORS.ERRORLIST[1].TABLEID != "" && self.direction.SENDERRORS.ERRORLIST[1].COLID != "") {
- window.parent.document.getElementById("forwardWin").style.height = "100px";
- self.opinionYY = true;
- $("#forward").show();
- } else {
- self.direction.CODEFUNCTITLE = self.direction.SENDERRORS.MESSAGE;
- window.parent.document.getElementById("forwardWin").style.height = "100px";
- window.parent.sp.setCenter("#forward")
- self.forward1(0)
- return
- }
- }else if (self.direction.ENDNODETYPE == 1 || self.direction.CODEFUNCBUTTON == "SENDCOPYEND" || self.direction.CODEFUNCBUTTON == "SENDPERUSAL" || self.direction.CODEFUNCBUTTON == "SENDCOMMIT") {
- self.showContent = false;
- self.direction.CODEFUNCTITLE = self.direction.CODEFUNCTITLE;
- self.direction.CODEMARK = self.direction.CODEMARK;
- window.parent.document.getElementById("forwardWin").style.height = "100px";
- window.parent.sp.setCenter("#forward")
- self.forward1(0)
- } else if (self.direction.ENDNODETYPE == 3) {
- self.showContent = true;
- self.forwardUser = [];
- self.directionList = self.direction["DIRECTION.CHILD"];
- $.each(self.directionList, function (index, item) {
- item.forwardUser = index;
- self.forwardUser.push([])
- item.people1 = item.SENDUSERS.USERS.USERS; //人员
- item.people1.forEach(function (item) {
- item.show = item.USERS.length > 0;
- item.childshow = false;
- item.USERS.forEach(function (item1) {
- item1.show = true;
- })
- })
- item.people2 = item.SENDUSERS.USERSALL.USERS; //人员
- item.people2.forEach(function (item) {
- item.show = true;
- item.childshow = false;
- item.USERS.forEach(function (item1) {
- item1.show = true;
- })
- })
- item.people = JSON.parse(JSON.stringify(item.people1));
- })
- self.activeDirection = self.directionList[0]
- self.roleList = self.activeDirection.SENDUSERS.USERS.ROLES;
- //if (self.directionid == "Flow_1rc0ejj_e4096a15-696a-4924-bfc1-50602b70dd1f") {
- //非收文并发节点,默认勾选人员
- if (Concurrency(self.directionList) == true && sp.getUrlName("cookie") != "shouwenbg" && sp.getUrlName("cookie") != "PH") {
- var n = [], x = 0;
- self.directionList.forEach(function (item, index) {
- n.push(0)
- item.people1.forEach(function (item1, index1) {
- n[index] = n[index] + item1.USERS.length;
- })
- })
- n.forEach(function (item) {
- if (item > 1) {
- x = x + 1;
- }
- })
- if (x == 0) { //如果推荐人员唯一时,缺省直接赋值转发,可以重新选择
- self.showContent = false;
- var usernameStr = [];
- self.directionList.forEach(function (item, index) {
- item.people1.forEach(function (item1, index1) {
- if (item1.USERS.length == 1) {
- usernameStr.push(item1.USERS[0].USERNAME)
- self.forwardUser[index].push(item1.USERS[0]);
- }
- })
- })
- self.forwardUser.forEach(function (x, y) {
- x[0].type = 1;
- })
- self.direction.CODEFUNCTITLE = "确认后将转发【" + usernameStr.join(",") + "】";
- window.parent.document.getElementById("forwardWin").style.height = "110px";
- window.parent.sp.setCenter("#forward")
- self.forward1(0)
- } else {
- self.showContent = true;
- window.parent.document.getElementById("forwardWin").style.height = "740px";
- window.parent.sp.setCenter("#forward")
- self.forward1(0)
- }
- } else {
- window.parent.document.getElementById("forwardWin").style.height = "740px";
- window.parent.sp.setCenter("#forward")
- self.forward1(0)
- }
- } else {
- self.forwardUser = [];
- self.directionList = [];
- self.directionList.push(self.direction)
- $.each(self.directionList, function (index, item) {
- item.forwardUser = index;
- self.forwardUser.push([])
- item.people1 = item.SENDUSERS.USERS.USERS; //人员
- item.people1.forEach(function (item) {
- item.show = item.USERS.length > 0;
- item.childshow = false;
- item.USERS.forEach(function (item1) {
- item1.show = true;
- })
- })
- item.people2 = item.SENDUSERS.USERSALL.USERS; //人员
- item.people2.forEach(function (item) {
- item.show = true;
- item.childshow = false;
- item.USERS.forEach(function (item1) {
- item1.show = true;
- })
- })
- item.people = JSON.parse(JSON.stringify(item.people1));
- })
- self.activeDirection = self.directionList[0]
- self.roleList = self.direction.SENDUSERS.USERS.ROLES;
- var n = 0;
- self.directionList[0].people1.forEach(function (item) {
- n = n + item.USERS.length;
- })
- if (n == 1) { //如果推荐人员唯一时,缺省直接赋值转发,可以重新选择
- self.showContent = false;
- self.adduserAll(2);
- var usernameStr = "";
- self.directionList[0].people1.forEach(function (item) {
- if (item.USERS.length == 1) {
- usernameStr = item.USERS[0].USERNAME
- }
- })
- //var usernameStr = self.direction.SENDUSERS.USERS.USERS[0].USERS[0].USERNAME;
- self.direction.CODEFUNCTITLE = "确认后将转发【" + usernameStr + "】";
- window.parent.document.getElementById("forwardWin").style.height = "110px";
- window.parent.sp.setCenter("#forward")
- self.forward1(0)
- } else {
- self.showContent = true;
- window.parent.document.getElementById("forwardWin").style.height = "740px";
- window.parent.sp.setCenter("#forward")
- self.forward1(0)
- }
- }
- })
- }
- self.resetup = function () {
- self.showContent = true;
- window.parent.document.getElementById("forwardWin").style.height = "740px";
- window.parent.sp.setCenter("#forward")
- }
- //转发(新)
- self.forward1 = function (n) {
- if (n == 0) {
- $("#forward").show();
- } else {
- if (self.activeGroup == "部门") {
- if (self.jiaqian == true) {
- //self.directionList = self.direction["DIRECTION.CHILD"];
- $.each(self.directionList, function (index, item) {
- item.people2.forEach(function (item) {
- item.show = true;
- item.childshow = false;
- item.USERS.forEach(function (item1) {
- item1.show = true;
- self.forwardUser[self.activeDirection
- .forwardUser].forEach(function (item2) {
- if (item1.USERID == item2.USERID) {
- item1.show = false;
- }
- })
- })
- })
- item.people = JSON.parse(JSON.stringify(item.people2));
- })
- self.roleList = self.activeDirection.SENDUSERS.USERSALL.ROLES;
- } else {
- //self.directionList = self.direction["DIRECTION.CHILD"];
- $.each(self.directionList, function (index, item) {
- item.people1.forEach(function (item) {
- item.show = true;
- item.childshow = false;
- item.USERS.forEach(function (item1) {
- item1.show = true;
- self.forwardUser[self.activeDirection
- .forwardUser].forEach(function (item2) {
- if (item1.USERID == item2.USERID) {
- item1.show = false;
- }
- })
- })
- })
- item.people = JSON.parse(JSON.stringify(item.people1));
- })
- self.roleList = self.activeDirection.SENDUSERS.USERS.ROLES;
- }
- } else if (self.activeGroup == "自定义分组") {
- self.getZbList(2)
- } else if (self.activeGroup == "常用分组") {
- self.getZbList2(2)
- }
- }
- if (self.direction.ENDNODETYPE != 1 && self.direction.CODEFUNCBUTTON != "SENDCOPYEND" && self.direction.CODEFUNCBUTTON != "SENDPERUSAL" && self.direction.CODEFUNCBUTTON != "SENDCOMMIT") {
- self.itemShow()
- self.activeUser = null;
- self.moveFlag1 = false;
- self.moveFlag2 = false;
- }
- }
- //网关切换流向
- self.changeType = function (n) {
- self.type = n;
- self.activeDirection = self.directionList[n];
- if (self.activeDirection.jiaqian == true) {
- self.activeGroup = '常用分组'
- } else {
- self.activeGroup = '部门'
- }
- self.forward1(1)
- }
- //流程加签
- self.addDirection = function (obj) {
- var n = 0;
- self.directionList.forEach(function (item) {
- if (item.CNAME == obj.CNAME) {
- n = n + 1;
- }
- })
- if (n == 0) {
- self.directionList.push({
- forwardUser: self.directionList.length,
- CNAME: "加签:" + obj.CNAME,
- DIRECTIONID: obj.FORMEDITID,
- jiaqian: true,
- people: [],
- people1: [],
- people2: [],
- })
- self.forwardUser.push([])
- self.changeType(self.directionList.length - 1)
- }
- }
- //加签流程移除
- self.delDirection = function (n) {
- self.changeType(n - 1);
- self.directionList.splice(n, 1)
- self.forwardUser.splice(n, 1)
- }
- self.jiaqianCheck = function () {
- if (self.jiaqian == true) {
- $.each(self.directionList, function (index, item) {
- item.people = JSON.parse(JSON.stringify(item.people2));
- })
- self.roleList = self.activeDirection.SENDUSERS.USERSALL.ROLES;
- } else {
- $.each(self.directionList, function (index, item) {
- item.people = JSON.parse(JSON.stringify(item.people1));
- })
- self.roleList = self.activeDirection.SENDUSERS.USERS.ROLES;
- }
- }
- //n==1全选;n==2全清;n==3反选
- self.ForwardCheck = function (n) {
- if (n == 1) {
- self.activeDirection.people.forEach(function (item) {
- item.USERS.forEach(function (item1) {
- item1.checked = true;
- })
- })
- } else if (n == 2) {
- self.activeDirection.people.forEach(function (item) {
- item.USERS.forEach(function (item1) {
- item1.checked = false;
- })
- })
- } else if (n == 3) {
- self.activeDirection.people.forEach(function (item) {
- item.USERS.forEach(function (item1) {
- item1.checked = !item1.checked;;
- })
- })
- }
- }
- self.searchPerson = function () {
- self.activeDirection.people.forEach(function (item) {
- item.show = false;
- var n = 0;
- item.USERS.forEach(function (item1) {
- item1.show = false;
- if (self.activeGroup == "部门") {
- if (item1.ROLECODE.indexOf(self.searchRole) > -1 && item1.USERNAME.indexOf(self.searchName) > -1) {
- item1.show = true;
- n++
- self.forwardUser.forEach(function (item2) {
- if (item1.USERID == item2.USERID) {
- item1.show = false;
- }
- })
- } else {
- item1.show = false;
- }
- } else {
- if (item1.USERNAME.indexOf(self.searchName) > -1) {
- item1.show = true;
- n++
- self.forwardUser.forEach(function (item2) {
- if (item1.USERID == item2.USERID) {
- item1.show = false;
- }
- })
- } else {
- item1.show = false;
- }
- }
- })
- if (n > 0) {
- item.show = true;
- item.childshow = false;
- }
- })
- }
- self.searchPerson2 = function () {
- if (self.activeGroup == "自定义分组") {
- self.getZbMsList()
- } else {
- self.getZbMsList2()
- }
- }
- self.chekcDP = function (obj) {
- obj.USERS.forEach(function (item) {
- item.checked = !item.checked;
- })
- self.adduser()
- }
- self.checkAddUser = function (obj) {
- obj.checked = true;
- self.activeDirection.people.forEach(function (item, index) {
- item.USERS.forEach(function (item1, index1) {
- var useridhas = false;
- if (item1.checked == true && item1.show == true) {
- self.forwardUser[self.activeDirection.forwardUser].forEach(function (x) {
- if (x.USERID == item1.USERID) {
- useridhas = true;
- }
- })
- if (useridhas == false) {
- self.forwardUser[self.activeDirection.forwardUser].push(item1);
- }
- item1.checked = false;
- item1.show = false;
- }
- })
- })
- self.forwardUser[self.activeDirection.forwardUser].forEach(function (x, y) {
- x.type = y == 0 ? 1 : 2
- })
- self.getmoveFlag()
- if (self.forwardUser[self.activeDirection.forwardUser].length == 1) {
- self.moveFlag1 = false;
- self.moveFlag2 = false;
- return;
- }
- }
- self.adduser = function () {
- self.activeDirection.people.forEach(function (item, index) {
- item.USERS.forEach(function (item1, index1) {
- var useridhas = false;
- if (item1.checked == true && item1.show == true) {
- self.forwardUser[self.activeDirection.forwardUser].forEach(function (x) {
- if (x.USERID == item1.USERID) {
- useridhas = true;
- }
- })
- if (useridhas == false) {
- self.forwardUser[self.activeDirection.forwardUser].push(item1);
- }
- item1.checked = false;
- item1.show = false;
- }
- })
- })
- self.forwardUser[self.activeDirection.forwardUser].forEach(function (x, y) {
- x.type = y == 0 ? 1 : 2
- })
- self.getmoveFlag()
- if (self.forwardUser[self.activeDirection.forwardUser].length == 1) {
- self.moveFlag1 = false;
- self.moveFlag2 = false;
- return;
- }
- }
- self.deluser = function () {
- self.forwardUser[self.activeDirection.forwardUser].forEach(function (item) {
- if (item.checked == true) {
- item.checked = false;
- item.show = true;
- item.childshow = false;
- self.activeDirection.people.forEach(function (x) {
- x.USERS.forEach(function (y) {
- if (item.USERID == y.USERID) {
- y.checked = false;
- y.show = true;
- }
- })
- })
- }
- })
- self.forwardUser[self.activeDirection.forwardUser] = self.forwardUser[self.activeDirection.forwardUser].filter(function (item) {
- return item.show == false;
- })
- self.getmoveFlag()
- if (self.forwardUser[self.activeDirection.forwardUser].length == 1) {
- self.moveFlag1 = false;
- self.moveFlag2 = false;
- return;
- }
- }
- self.adduserAll = function () {
- self.activeDirection.people.forEach(function (item, index) {
- item.USERS.forEach(function (item1, index1) {
- var useridhas = false;
- if (item1.show == true) {
- self.forwardUser[self.activeDirection.forwardUser].forEach(function (x) {
- if (x.USERID == item1.USERID) {
- useridhas = true;
- }
- })
- if (useridhas == false) {
- self.forwardUser[self.activeDirection.forwardUser].push(item1);
- }
- item1.checked = false;
- item1.show = false;
- }
- })
- })
- self.forwardUser[self.activeDirection.forwardUser].forEach(function (x, y) {
- x.type = y == 0 ? 1 : 2
- })
- self.getmoveFlag()
- if (self.forwardUser[self.activeDirection.forwardUser].length == 1) {
- self.moveFlag1 = false;
- self.moveFlag2 = false;
- return;
- }
- }
- self.deluserAll = function () {
- self.forwardUser[self.activeDirection.forwardUser].forEach(function (item) {
- item.checked = false;
- item.show = true;
- item.childshow = false;
- self.activeDirection.people.forEach(function (x) {
- x.USERS.forEach(function (y) {
- if (item.USERID == y.USERID) {
- y.checked = false;
- y.show = true;
- }
- })
- })
- })
- self.forwardUser[self.activeDirection.forwardUser] = [];
- self.getmoveFlag()
- self.moveFlag1 = false;
- self.moveFlag2 = false;
- }
- self.checkForwardUser = function (n) {
- if (self.activeUser != n) {
- self.activeUser = n;
- } else {
- self.activeUser = null;
- }
- if (self.forwardUser.length == 1) {
- self.moveFlag1 = false;
- self.moveFlag2 = false;
- return;
- }
- if (self.activeUser == null) {
- self.moveFlag1 = false;
- self.moveFlag2 = false;
- } else {
- self.getmoveFlag()
- }
- }
- self.getmoveFlag = function () {
- if (self.activeUser == 0) {
- self.moveFlag1 = false;
- self.moveFlag2 = true;
- } else if (self.activeUser == self.forwardUser[self.activeDirection.forwardUser].length -
- 1) {
- self.moveFlag1 = true;
- self.moveFlag2 = false;
- } else {
- self.moveFlag1 = true;
- self.moveFlag2 = true;
- }
- self.itemShow()
- }
- self.itemShow = function () {
- if (self.direction.SENDERRORS.MESSAGE == "") {
- self.activeDirection.people.forEach(function (item) {
- item.show = false;
- if (item.USERS.USERS) {
- item.USERS.USERS.forEach(function (item1) {
- if (item1.show == true) {
- item.show = true
- //item.childshow = false;
- }
- })
- } else {
- item.USERS.forEach(function (item1) {
- if (item1.show == true) {
- item.show = true
- //item.childshow = false;
- }
- })
- }
- })
- }
- }
- self.moveUp = function () {
- var a = self.forwardUser[self.activeDirection.forwardUser][self.activeUser],
- b = self.forwardUser[self.activeDirection.forwardUser][self.activeUser - 1];
- self.forwardUser[self.activeDirection.forwardUser][self.activeUser] = b;
- self.forwardUser[self.activeDirection.forwardUser][self.activeUser - 1] = a;
- self.activeUser = self.activeUser - 1;
- self.getmoveFlag()
- }
- self.moveDown = function () {
- var a = self.forwardUser[self.activeDirection.forwardUser][self.activeUser],
- b = self.forwardUser[self.activeDirection.forwardUser][self.activeUser + 1];
- self.forwardUser[self.activeDirection.forwardUser][self.activeUser] = b;
- self.forwardUser[self.activeDirection.forwardUser][self.activeUser + 1] = a;
- self.activeUser = self.activeUser + 1;
- self.getmoveFlag(n)
- }
- self.getZbList = function () {
- var data = {
- userid: self.userId
- }
- $http.post(apiurljs.login + "g2app/usercustom/queryCustomDataList", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.zdyfzList = []
- if (res.data.length > 0) {
- for (let i = 0; i < res.data.length; i++) {
- self.zdyfzList.push({
- ZID: res.data[i].CODE,
- ZUM: res.data[i].CNAME
- })
- }
- self.searchRole = self.zdyfzList[self.zdyfzList.length-1].ZID
- self.getZbMsList()
- } else {
- self.activeDirection.people = [];
- }
- })
- }
- self.getZbList3 = function () {
- var data = {
- userid: self.userId
- }
- $http.post(apiurljs.login + "g2app/usercustom/queryCustomDataList", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.zdyfzList = []
- if (res.data.length > 0) {
- for (let i = 0; i < res.data.length; i++) {
- self.zdyfzList.push({
- ZID: res.data[i].CODE,
- ZUM: res.data[i].CNAME
- })
- }
- self.searchRole = self.zdyfzList[self.zdyfzList.length - 1].ZID
- self.getZbMsList()
- } else {
- self.activeDirection.people = [];
- }
- })
- }
- //常用分组
- self.getZbList2 = function () {
- var data = {
- userid: self.userId
- }
- $http.post(apiurljs.login + "g2app/usercustom/queryGeneralDataList", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.zdyfzList = []
- if (res.data.length > 0) {
- for (let i = 0; i < res.data.length; i++) {
- self.zdyfzList.push({
- ZID: res.data[i].CODE,
- ZUM: res.data[i].CNAME
- })
- }
- self.searchRole = self.zdyfzList[self.zdyfzList.length - 1].ZID
- self.getZbMsList2()
- } else {
- self.activeDirection.people = [];
- }
- })
- }
- self.getZbMsList = function () {
- var data = {
- userid: self.userId,
- code: self.searchRole
- }
- $http.post(apiurljs.login + "g2app/usercustom/queryCustomData", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- $.each(self.directionList, function (index, item) {
- item.people = res.data
- })
- self.activeDirection.people = self.directionList[0].people[0].USERS.USERS
- self.activeDirection.people.forEach(function (item) {
- var n = 0;
- item.USERS.forEach(function (item1) {
- item1.show = true;
- self.forwardUser[self.activeDirection.forwardUser]
- .forEach(function (obj) {
- if (obj.USERID == item1.USERID) {
- n = n + 1;
- item1.show = false;
- }
- })
- })
- item.show = item.USERS.length != n;
- item.childshow = false;
- })
- })
- }
- self.getZbMsList2 = function () {
- var data = {
- userid: self.userId,
- code: self.searchRole
- }
- $http.post(apiurljs.login + "g2app/usercustom/queryGeneralData", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- $.each(self.directionList, function (index, item) {
- item.people = res.data
- })
- self.activeDirection.people = self.directionList[0].people[0].USERS.USERS
- self.activeDirection.people.forEach(function (item) {
- var n = 0;
- item.USERS.forEach(function (item1) {
- item1.show = true;
- self.forwardUser[self.activeDirection.forwardUser]
- .forEach(function (obj) {
- if (obj.USERID == item1.USERID) {
- n = n + 1;
- item1.show = false;
- }
- })
- })
- item.show = item.USERS.length != n;
- item.childshow = false;
- })
- })
- }
- self.checkZB = function (item1) {
- self.zbCode = item1.CODE;
- self.activeDirection.people.forEach(function (item) {
- item.show = false;
- item.checked = false;
- item1.USERS.forEach(function (item2) {
- if (item.USERID == item2.USERID) {
- item.show = true;
- item.childshow = false;
- item.set = self.zbCode;
- }
- })
- })
- self.forwardUser[self.activeDirection.forwardUser].forEach(function (obj) {
- item1.USERS.forEach(function (item2) {
- if (obj.USERID == item2.USERID) {
- obj.show = false;
- obj.set = self.zbCode;
- }
- })
- })
- }
- self.delZB = function (item) {
- var data = {
- code: item.ZID,
- userid: self.userId
- }
- $http.post(apiurljs.login + "g2app/usercustom/delCustomData", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success == true) {
- self.getZbList()
- }
- })
- }
- self.btnSaveZB = function () {
- if (self.forwardUser[self.activeDirection.forwardUser].length == 0) {
- return
- }
- var data = {
- userid: self.userId,
- cname: self.cnameZB,
- userids: JSON.stringify(self.forwardUser[self.activeDirection.forwardUser].map(
- function (item) {
- return {
- userid: item.USERID,
- username: item.USERNAME
- }
- }))
- }
- $http.post(apiurljs.login + "g2app/usercustom/saveCustomData", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success == true) {
- self.searchName = "";
- self.searchRole = "";
- self.saveZB = false;
- self.activeGroup = '自定义分组'
- self.forwardUser[self.activeDirection.forwardUser] = []
- //self.getZbList3()
- self.getZbList()
- }
- })
- }
-
- self.sendFlag = false;
- self.sendAll = function () {
- self.sendFlag = true;
- if (self.direction.ENDNODETYPE == 1) {
- var sendUser = [{
- DIRECTIONID: self.direction.DIRECTIONID,
- MAINUSERID: "STOP",
- COPYUSERID: ""
- }]
- } else if (self.direction.CODEFUNCBUTTON == "SENDCOPYEND" || self.direction.CODEFUNCBUTTON ==
- "SENDPERUSAL" || self.direction.CODEFUNCBUTTON == "SENDCOMMIT") {
- var sendUser = [{
- DIRECTIONID: self.direction.DIRECTIONID,
- MAINUSERID: "",
- COPYUSERID: ""
- }]
- } else {
- var sendUser = [];
- var n = 0, text = [];
- self.directionList.forEach(function (item) {
- if (self.forwardUser[item.forwardUser].length > 0) {
- n++
- sendUser.push({
- DIRECTIONID: item.DIRECTIONID,
- MAINUSERID: self.forwardUser[item.forwardUser].filter(function (item1) {
- return item1.type == 1
- }).map(function (item1) {
- return item1.USERID
- }).join("|"),
- COPYUSERID: self.forwardUser[item.forwardUser].filter(function (item1) {
- return item1.type == 2
- }).map(function (item1) {
- return item1.USERID
- }).join("|")
- })
- } else {
- text.push(item.CNAME)
- }
- })
- //非收文并发节点,每条流向人员不许为空
- if (Concurrency(self.directionList) == true && sp.getUrlName("cookie") != "shouwenbg" && sp.getUrlName("cookie") != "PH") {
- if (text.length > 0) {
- window.top.sp.layerhide()
- window.top.sp.dialog(text.join(",") + "<br/>未选择人员,请选择人员!");
- self.sendFlag = false;
- return
- }
- } else {
- if (n == 0) {
- window.top.sp.layerhide()
- window.top.sp.dialog(text.join(",") + "<br/>未选择人员,请选择至少一项人员!");
- self.sendFlag = false;
- return
- }
- }
- }
- var data = {
- codefuncbutton: self.direction.CODEFUNCBUTTON,
- directionid: self.directionid,
- userid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: self.routeid,
- data: JSON.stringify(sendUser)
- }
- $http.post(apiurljs.login + "g2app/abase/saveDataSend", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.goFunc(sp.getUrlName("directionidtarget"))
- self.sendFlag = false;
- window.parent.sp.layerhide()
- var href = window.parent.location.href.slice(window.parent.location.href
- .indexOf("tpl")).split("/")
- if (res.success == true) {
- window.parent.sp.dialog("发送成功!");
- setTimeout(function () {
- if (localStorage.getItem("tjJxtGoldenlinkWork-deviceType") != "pad") {
- if (window.top.location.href.indexOf("/index.html") == -1) {
- window.top.close()
- localStorage.setItem('GlWorkPlatform-' + sp.getUrlName(
- "cookie") + '-refresh', 1)
- } else {
- window.parent.location.href = "../../" + href[0] + "/" +
- href[1] + "/list.html"
- }
- } else {
- window.parent.location.href = "../../" + href[0] + "/" +
- href[1] + "/list.html"
- }
- }, 2000)
- } else {
- window.top.sp.dialog(res.message)
- }
- })
- .error(function () {
- self.sendFlag = false;
- })
- }
- self.goFunc = function (str) {
- switch (str) {
- case "SequenceFlow_02bni32_c2c3da8e-be69-47f5-9e7e-522923444b67":
- self.GUIDANG();
- break;
- case "Flow_1q1jyh7_bbd06bd0-1ca2-409b-9f1e-35de93d46a27":
- self.SXDBYS();
- break;
- case "Flow_1k5r8tm_094430ce-e841-4a09-83f0-ccbb59f1cce1":
- self.GWDBYQ();
- break;
- case "Flow_1rbo1mh_094430ce-e841-4a09-83f0-ccbb59f1cce1":
- self.GWDBYQ();
- break;
- case "SequenceFlow_02bni32_af78f780-9140-42c4-81c5-34fd14fcf9b3":
- self.WJFBB();
- break;
- }
- }
- self.GUIDANG = function () {
- var data = {
- routeinfoid: [self.data.DAROUTEINFOID],
- userid: self.userId,
- username: self.userName,
- updata: [],
- columns: "ID,DOCUMENTID,DOCUMENTTYPE,SERIALNUM,MAINDPT,ATTACHMENT,ISSUINGAGENCY,DOCISSUEDDATE,ANNOTATION,CCDPT,PRINTSENDDPT,PRINTDATE,RELEASELEVEL,ARCHCODE,ARCHYEAR,RETENTPERIOD,ORGANIZATIONMA,ITEMNUM,ELECTRONICID,ENVIRONINFO,SOFTWENVIRON,HARDWENVIRON,DISTYPE,DISACTOR,DISDPT,DISTIME,DISLRESULT,MIJIQIXIAN,EMERGENCYDEGREE,DOCISSUERID,DOCISSUEDNUM,SIGNER,DOCTITLE,FINISHEDDATE,FLOWID,SENDSTATUS,CREATDATE,CREATUSERID,CREATNAME,SENDNAME,SENDUSERID,SENDDATE,MODELMARK,MERGEID,MOBANNAME,TABLENAME,WENHAO,DANGANML,ZRZ,JIANHAO,YESHU,BEIZHU,DPCODE,DPNAME,DAROUTEINFOID AS ROUTEINFOID"
- }
- $http.post(apiurljs.login + "g2app/DangAn/YJYGDSendDataZL", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj1) { })
- }
- self.SXDBYS = function () {
- var data1 = {
- tablename: self.data.YTABLENAME,
- id: self.data.YID,
- data: {
- SQYQRQ: self.data.SQYQSJ,
- ZZYQWCQX: getNextDate(self.data.YYQBJSJ, parseInt(self.data.YQTS)),
- DBSX: getNextDate(self.data.YYQBJSJ, parseInt(self.data.YQTS))
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/upFormData", {
- data: s4.encryptData_CBC(JSON.stringify(data1))
- }, postCfg)
- .success(function (obj1) {
- var res1 = strToJson(s4.decryptData_CBC(obj1.data));
- if (res1.success) {
- var data2 = {
- routeinfoid: self.routeinfoid,
- userid: self.userId,
- edate: getNextDate(self.data.YYQBJSJ, parseInt(self.data.YQTS)),
- linkrouteinfoid: self.data.YROUTEINFOID
- }
- $http.post(apiurljs.login +
- "g2work/routeinfo/addRouteinfoTimelimitDelayedate", {
- data: s4.encryptData_CBC(JSON.stringify(data2))
- }, postCfg)
- .success(function (obj2) {
- var res2 = strToJson(s4.decryptData_CBC(obj2.data));
- })
- } else {
- sp.dialog(res1.message)
- return false
- }
- })
- }
- self.GWDBYQ = function () {
- var data1 = {
- tablename: self.data.YTABLENAME,
- id: self.data.YID,
- data: {
- DBSX: self.data.SQYQSJ
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/upFormData", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj1) {
- var res1 = strToJson(s4.decryptData_CBC(obj1.data));
- if (res1.success) {
- var data2 = {
- routeinfoid: self.routeinfoid,
- userid: self.userId,
- edate: self.data.SQYQSJ,
- linkrouteinfoid: self.data.YROUTEINFOID
- }
- $http.post(apiurljs.login +
- "g2work/routeinfo/addRouteinfoTimelimitDelayedate", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj2) {
- var res2 = strToJson(s4.decryptData_CBC(obj2.data));
- })
- } else {
- sp.dialog(res1.message)
- return false
- }
- })
- }
- self.WJFBB = function () {
- var data = {
- tablename: "SX_FBLIST",
- data: {
- WJLY: "WJ",
- FLOWID: "AA50",
- FORMROUTEINFOID: self.routeinfoid,
- FBUSERID: self.userId,
- FBNAME: self.userName,
- LM: window.parent.getData().LX,
- FBRQ: sp.getLocalDate(),
- FBBM: window.parent.getData().FBBM,
- WJBT: window.parent.getData().WJBT
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/insertFormData", {
- data: s4.encryptData_CBC(JSON.stringify(data))
- }, postCfg)
- .success(function (obj1) { })
- }
- self.submitYJ = function () {
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: self.routeid,
- tableid: self.direction.SENDERRORS.ERRORLIST[1].TABLEID,
- colid: self.direction.SENDERRORS.ERRORLIST[1].COLID,
- opiniontype: 0,
- cresult: "",
- opinion: "已阅",
- opinionimage: ""
- }
- $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success == true) {
- self.sendAll()
- } else {
- window.parent.sp.layerhide()
- window.top.sp.dialog(res.message)
- setTimeout(function () {
- window.top.sp.dialoghide()
- window.top.sp.layer("#forward")
- },2000)
- }
- })
- }
- }])
- //返回n天后日期
- function getNextDate(time, n) {
- var date = "";
- $.ajax({
- url: apiurljs.login + "g2app/dataabase/getTheoryDate",
- type: 'post',
- async: false,
- contentType: "application/json",
- beforeSend: function (request) {
- request.setRequestHeader("Authorization", "Bearer " + localStorage.getItem("GlWorkPlatform-AccessToken"));
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify({
- startdate: time + " 00:00:00",
- yqday: n
- }))
- }),
- dataType: "json",
- success: function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- date = sp.format(res.data);
- }
- })
- return date
- }
- //并发流程
- function Concurrency(array) {
- var n = array.length;
- array.forEach(function (item) {
- if (item.jiaqian == true) {
- n = n - 1;
- }
- })
- return n > 1
- }
|