12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136 |
- '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"];
- if (self.directionid == "Flow_1gwmrl0_000d6cb9-9634-4fb7-baad-4b5fe107293f") {
- self.directionList = self.directionList.filter(function (item) {
- return item.CNAME != "转财务审计"
- })
- }
- $.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 if (self.directionid == "Flow_0e81qyj_cbcff29c-af66-4616-8c5d-6d28dc942b95") {
- //} else if (self.directionid == "Flow_1gnr3io_cbcff29c-af66-4616-8c5d-6d28dc942b95") {
- } else if (sp.getUrlName("directionidtarget") == "Flow_0e81qyj_cbcff29c-af66-4616-8c5d-6d28dc942b95" || sp.getUrlName("directionidtarget") == "Flow_1dm0u5o_e4096a15-696a-4924-bfc1-50602b70dd1f") {
- self.showContent = false;
- self.adduserAll(2);
- var usernameStr = [];
- self.directionList[0].people1.forEach(function (item) {
- usernameStr.push(item.USERS.map(function (item1) {
- return item1.USERNAME
- }))
- })
- //var usernameStr = self.direction.SENDUSERS.USERS.USERS[0].USERS[0].USERNAME;
- self.direction.CODEFUNCTITLE = "确认后将转发【" + usernameStr.join(",") + "】";
- window.parent.document.getElementById("forwardWin").style.height = "150px";
- 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
- }
- }
- }
- if (sp.getUrlName("directionidtarget") == "Flow_0bied09_bc0d7ea3-8336-4b9d-835e-b553a3dbaa1c" || sp.getUrlName("directionidtarget") == "Flow_1n9fspw_bc0d7ea3-8336-4b9d-835e-b553a3dbaa1c") {
- if (window.parent.getData().XYCC == "C01") {
- sendUser.forEach(function (item) {
- if (item.MAINUSERID.indexOf("f4bed41a-79b8-409e-a46c-ba29a89adbe0") == -1) {
- item.MAINUSERID = item.MAINUSERID + "|f4bed41a-79b8-409e-a46c-ba29a89adbe0"
- }
- })
- }
- }
- 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: [window.parent.getData().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: window.parent.getData().YTABLENAME,
- id: window.parent.getData().YID,
- data: {
- SQYQRQ: window.parent.getData().SQYQSJ,
- ZZYQWCQX: getNextDate(window.parent.getData().YYQBJSJ, parseInt(window.parent.getData().YQTS)),
- DBSX: getNextDate(window.parent.getData().YYQBJSJ, parseInt(window.parent.getData().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(window.parent.getData().YYQBJSJ, parseInt(window.parent.getData().YQTS)),
- linkrouteinfoid: window.parent.getData().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: window.parent.getData().YTABLENAME,
- id: window.parent.getData().YID,
- data: {
- DBSX: window.parent.getData().SQYQSJ
- }
- }
- $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: window.parent.getData().SQYQSJ,
- linkrouteinfoid: window.parent.getData().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.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
- },
- dpcode: "AA",
- childtablename: "SX_FBLIST_02",
- childdata: {}
- }
- console.log(data)
- $http.post(apiurljs.login + "g2app/filepublishing/addFormAndChildUserRecoder", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj1) {
- var res1 = strToJson(s4.decryptData_CBC(obj1.data));
- })
- }
- 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
- }
|