123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984 |
- var app = angular.module('app', ["angularUtils.directives.dirPagination"]);
- app.controller("flowchartCtrl", ["$scope", "$http", "$compile", "$timeout", function ($scope, $http, $compile, $timeout) {
- var self = this;
- var s4 = new SM4Util();
- sp.fitHeight("#flowTypePart", 150);
- self.userId = $.cookie("GlWorkPlatform-userid");
- self.userName = $.cookie("GlWorkPlatform-username");
- self.userCName = $.cookie("GlWorkPlatform-chineseName");
- self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- self.flowid = sp.getUrlName("FLOWKND");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.CrossPage = window.parent.CrossPage;
- self.loading = false;
- self.sortClose = 0;
- self.active = {
- STATUS: 0,
- TYPE: "",
- CNAME:""
- };
- ///激活状态的设置,考虑上来就加载和从详情页面返回的两种情况
- self.setMsgActive = function () {
- $(".sp-msg-left-bottom .sp-msg-left-lh").removeClass("sp-msg-left-active");
- $(".sp-msg-left-bottom .sp-msg-left-lh:eq(" + self.active.STATUS + ")").addClass("sp-msg-left-active");
- };
- setTimeout(function () {
- self.setMsgActive();
- }, 800);
- self.getMsgData = function (str, PKID, CNAME) {
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "查询", "查询日志", "/g2work/flow/queryData")
- if (str == 0) {
- self.active = {
- STATUS: str,
- TYPE: "",
- CNAME: CNAME
- };
- } else {
- self.active = {
- STATUS: str,
- TYPE: PKID,
- CNAME: CNAME
- };
- }
- $(".sp-msg-left-bottom .sp-msg-left-lh").removeClass("sp-msg-left-active");
- $(".sp-msg-left-bottom .sp-msg-left-lh:eq(" + str + ")").addClass("sp-msg-left-active");
- self.getFlowData();///加载流程
- };
- ///加载机构
- self.unitList = []; ///数组
- self.unit = ""; ///机构名称
- self.getUnit = function () {
- self.loading = true;
- $http.post(apiurljs.login + "g2work/sect/querySectAdmin", { data: s4.encryptData_CBC("") }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- ///console.log(res);
- if (res.success) {
- if (sp.isval(res.data)) {
- self.unitList = res.data;
- self.unit = res.data[0].CODE;
- self.getFlowType();///加载流程类别
- } else {
- self.unitList = [];
- self.loading = false;
- }
- } else {
- sp.dialog(res.message);
- self.unitList = [];
- self.loading = false;
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- };
- self.getUnit();
- ///加载流程类别数组
- self.flowType = [];
- self.flowType_left = [];
- self.getFlowType = function () {
- var postData = {
- pkid: self.unit,
- includechildren: true
- }
- $http.post(apiurljs.login + "g2work/flowkinds/queryData", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- ///console.log(res);
- if (res.success) {
- if (sp.isval(res.data)) {
- self.flowType = res.data;
- //console.log(JSON.stringify(self.flowType));
- angular.forEach(self.flowType,function(item){
- self.flowType_left.push(item);
- });
- var set_json={"PKID":"withDelete", "CNAME":"流程回收站" }
- self.flowType_left.push(set_json);
- //console.log(JSON.stringify(self.flowType_left));
- if (self.flowid) {
- $.each(self.flowType_left, function (index, item) {
- if (item.PKID == self.flowid) {
- self.active = {
- STATUS: index + 1,
- TYPE: item.PKID,
- CNAME: item.CNAME
- }
- }
- })
- } else {
- self.active = {
- STATUS: parseInt(sp.getUrlName("leftActive")) || 1,
- TYPE: sp.getUrlName("leftActiveType") || self.flowType_left[0].PKID,
- CNAME: sp.getUrlName("leftActiveName") || self.flowType_left[0].CNAME
- }
- };
- self.getCodeTableOption(); //加载关联表的来源
- self.getFlowData();///加载流程
- } else {
- self.flowType = [];
- self.flowType_left=[];
- self.loading = false;
- }
- } else {
- sp.dialog(res.message);
- self.flowType = [];
- self.loading = false;
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- };
- //加载关联表和列的数据
- self.codeTableOption = [];
- self.codeColumnOption = [];
- self.getCodeTableOption = function () {
- $http.post(apiurljs.login + "g2work/billcol/queryDataInitvalT", { data: s4.encryptData_CBC("") }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- if (sp.isval(res.data)) {
- self.codeTableOption = res.data;
- self.codeColumnOption = [];
- } else {
- self.codeTableOption = [];
- self.codeColumnOption = [];
- }
- } else {
- sp.dialog(res.message);
- }
- //self.getFlowData();///加载流程
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- }
- self.changeCodeTable = function () {
- if (self.info.codetable == "") {
- self.codeColumnOption = [];
- self.info.codecolumn = "";
- } else {
- var data = {
- billkey: self.info.codetable
- }
- $http.post(apiurljs.login + "g2work/billcol/queryDataByParam", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.info.codecolumn = "";
- self.codeColumnOption = res.data[0].COLS;
- })
- //self.codeTableOption.forEach(function (item) {
- // if (item.BILLKEY == self.info.codetable) {
- // self.codeColumnOption = item.COLS;
- // self.info.codecolumn = "";
- // }
- //})
- }
- }
- ///新增流程类别--声明变量
- self.addflow = {
- pkid: 0,
- cname: "",
- ctype: "NORMAL"
- };
- ///打开新增类别
- self.openLayerFlowType = function () {
- self.addflow = {
- pkid: 0,
- cname: "",
- ctype: "WITHNO"
- };
- sp.layer("#layer_addFlowType");
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "新增类别", "修改日志", window.location.pathname)
- };
- ///更新流程类别
- self.editFlowType = function ($item) {
- event.preventDefault();
- event.stopPropagation();
- self.addflow = {
- pkid: $item.PKID,
- cname: $item.CNAME,
- ctype: $item.CTYPE
- }
- sp.layer("#layer_addFlowType");
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "编辑类别", "修改日志", window.location.pathname)
- };
- ///点击确认提交新增流程类别
- self.btnSubmitFlowType = function () {
- if (spngvld.submit("#layer_addFlowType")) {
- if (self.addflow.pkid == 0) {
- var postData = {
- "cname": self.addflow.cname,
- "ctype": self.addflow.ctype,
- "parentid": self.unit
- };
- $http.post(apiurljs.login + "g2work/flowkinds/insertData", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- ///console.log(res);
- if (res.success) {
- sp.layerhide();
- sp.dialog("流程新增成功!");
- $timeout(function () {
- sp.dialoghide();
- self.getFlowType();
- }, 600)
- } else {
- sp.layerhide();
- sp.dialog(res.message);
- }
- });
- } else {
- var postData = {
- "pkid": self.addflow.pkid,
- "cname": self.addflow.cname,
- "ctype": self.addflow.ctype
- };
- $http.post(apiurljs.login + "g2work/flowkinds/updateDataByPkid", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- ///console.log(res);
- if (res.success) {
- sp.layerhide();
- sp.dialog("更新成功!");
- $timeout(function () {
- sp.dialoghide();
- self.getFlowType();
- }, 600)
- } else {
- sp.layerhide();
- sp.dialog(res.message);
- }
- });
- }
- }
- };
- ///取消操作类别
- self.btnCancelFlowType = function () {
- self.addflow = {
- pkid: 0,
- cname: "",
- ctype: "WITHNO"
- };
- spngvld.clear("#layer_addFlowType")
- sp.layerhide();
- };
- ///删除类别
- self.delFlowType = function ($item) {
- event.preventDefault();
- event.stopPropagation();
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "删除类别", "修改日志", window.location.pathname)
- var getDelID = $item.PKID;
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- ///取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- //post消息的id
- $("#delDataTrue").click(function () {
- var getid = $(this).attr("data-id");
- sp.dialoghide();
- var data = {
- pkid: getDelID///角色编码
- };
- $http.post(apiurljs.login + "g2work/flowkinds/deleteByPkid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.getFlowType();
- sp.dialoghide();
- } else {
- sp.dialog(res.message);
- }
- });
- });
- };
- ///类别排序
- self.openSortType = function () {
- self.sortClose = 1;
- sp.layer("#layer_sortFlowType");
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "类别排序", "修改日志", window.location.pathname)
- };
- self.itemSortup = function ($item, $index) {
- var set_index = parseInt($index - 1);
- var get_pkid1 = self.flowType[set_index].PKID;
- self.postSortData(get_pkid1, $item.PKID);
- }
- self.itemSortdown = function ($item, $index) {
- var set_index = parseInt($index + 1);
- var get_pkid1 = self.flowType[set_index].PKID;
- self.postSortData(get_pkid1, $item.PKID);
- }
- self.postSortData = function (pkid1, pkid2) {
- var postData = {
- "pkid1": pkid1,
- "pkid2": pkid2
- }
- $http.post(apiurljs.login + "g2work/flowkinds/swapSortidByPkid", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- ///console.log(res);
- if (res.success) {
- self.getFlowType();
- } else {
- sp.layerhide();
- sp.dialog(res.message);
- }
- });
- };
- ///处理流程--开始--start//////////////////////////////////////////////////////////////////////////////////////////////////////
- var colors = [
- "#093", "#5151cb", "#67379a", "#0e39de", "#cd435c", "#f1a73a",
- "#b0cb26", "#4fb2e3", "#95a5a6", "#66cc80", "#ee4444", "#f39c12",
- "#60bf78", "#30bfbf", "#bf3995", "#4d6240", "#995e2e", "#323159",
- "#666666", "#4a90e2", "#d94141", "#ed8824", "#ff8080", "#906edb",
- "#d3a269", "#008be6", "#5c1446", "#88b876", "#a50872", "#4b90e2"
- ];
- self.flowData = [];
- self.flowData_search = [];
- self.getFlowData = function () {
- self.loading = true;
- var postData ={};
- var postUrl="";
- if(self.active.TYPE=="withDelete"){
- postData = {
- unitid: "AA",
- flowkinds: ""
- }
- postUrl=apiurljs.login + "g2work/flow/queryDataWithDelete";
- }else{
- postData = {
- unitid: self.unit,
- flowkinds: self.active.TYPE
- }
- postUrl=apiurljs.login + "g2work/flow/queryData";
- }
-
- //console.log(postData);
- $http.post(postUrl, { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.loading = false;
- ///console.log(res);
- if (res.success) {
- if (sp.isval(res.data)) {
- self.flowData = res.data;
- //console.log(JSON.stringify(self.flowData));
- self.flowData.forEach(function (item, index) {
- item.color = colors[index];
- item.firstname = item.CNAME.substr(0, 1);
- //if (item.CODETABLE != "") {
- // self.codeTableOption.forEach(function (item2) {
- // if (item2.BILLKEY == item.CODETABLE) {
- // item.CODETABLENAME = item2.CNAME;
- // item.CODECOLUMNNAME = item2.CODECNAME;
- // //item2.COLS.forEach(function (item3) {
- // // if (item3.CODE == item.CODECOLUMN) {
- // // item.CODECOLUMNNAME = item3.CNAME;
- // // }
- // //})
- // }
- // })
- //}
- });
- //如果流程列表有数据,判断全部流程的正确的性
- self.checkFlowList();
- self.flowData_search = self.flowData;
- } else {
- self.flowData = [];
- self.flowData_search=[];
- }
- } else {
- sp.dialog(res.message);
- self.flowData = [];
- self.flowData_search=[];
- }
- if (self.CrossPage.type == 0) {
- self.journalRecord(self.CrossPage.ctime, sp.getLocalDate1(), "", "接入日志", window.location.pathname)
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- if (textStatus != 200) {
- self.loading = false;
- }
- })
- };
- ////前端检索关键字--start
- self.searchByKeywords=function (keywords, searchArr) {
- var search_array=[];
- if(sp.isval(keywords)){
- angular.forEach(searchArr,function(item){
- if(item.CNAME.indexOf(keywords)!=-1 || item.FLOWID.indexOf(keywords)!=-1){
- search_array.push(item);
- }
- });
- }else{
- search_array=searchArr;
- }
- return search_array;
- }
- self.search_keyword="";
- self.btnSearch = function () {
- //console.log(JSON.stringify(self.searchByKeywords("党委", self.flowData)));
- self.flowData_search=self.searchByKeywords(self.search_keyword, self.flowData);
- };
- ////前端检索关键字--end
- self.info = {
- add: true,
- layertitle: "新建流程",
- type: "",
- copyrightid: 0,
- ckey: "",
- cname: "",
- timelimit: "",
- explain: "",
- codetable: "",
- codecolumn: ""
- };
- self.openFlowLayer = function () {
- self.SubmitFlowFlag = false;
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "新建流程", "修改日志", window.location.pathname)
- //打开添加流程layer层--新建
- // self.info = {
- // "add": true,
- // "layertitle": "新建流程",
- // "copyrightid": 0,
- // "ckey": "",
- // "cname": "",
- // "timelimit": "",
- // "explain": "",
- // "codetable":"",
- // "codecolumn":""
- // };
- self.info.add = true;
- self.info.layertitle = "新建流程";
- self.info.copyrightid = 0;
- self.info.type = self.active.TYPE == "" ? self.flowType[0].PKID : self.active.TYPE;
- self.info.ckey = "";
- self.info.cname = "";
- self.info.timelimit = "";
- self.info.explain = "";
- self.info.codetable = "";
- self.info.codecolumn = "";
- self.codeColumnOption = [];
- sp.layer("#layer_addFlow");
- };
- self.editFlow = function ($item) {
- self.SubmitFlowFlag = false;
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "编辑流程", "修改日志", window.location.pathname)
- self.info.add = false;
- self.info.layertitle = "编辑流程";
- self.info.type = $item.FLOWKINDS
- self.info.copyrightid = $item.COPYRIGHTID;
- self.info.ckey = $item.CKEY;
- self.info.cname = $item.CNAME;
- self.info.timelimit = $item.TIMELIMIT;
- self.info.explain = $item.EXPLAIN;
- self.info.codetable = $item.CODETABLE;
- if ($item.CODETABLE != "") {
- var data = {
- billkey: self.info.codetable
- }
- $http.post(apiurljs.login + "g2work/billcol/queryDataByParam", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.codeColumnOption = res.data[0].COLS;
- $timeout(function () {
- self.info.codecolumn = $item.CODECOLUMN;
- sp.layer("#layer_addFlow");
- }, 1)
- })
- } else {
- self.codeColumnOption = [];
- self.info.codecolumn = $item.CODECOLUMN;
- sp.layer("#layer_addFlow");
- }
- };
- self.SubmitFlowFlag = false;
- self.btnSubmitFlow = function () {
- ////新建流程-提交按钮
- if (spngvld.submit("#layer_addFlow")) {
- self.SubmitFlowFlag = true;
- if (self.info.copyrightid == 0) {
- var data = {
- tablename: "SYS_FLOW",
- colums: "*",
- order: "CKEY",
- sqlwhere: { CKEY: self.info.ckey },
- sqlinwhere: "",
- sqllikewhere: ""
- }
- $http.post(apiurljs.login + "g2app/DangJian/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) {
- sp.layerhide();
- sp.dialog("流程已存在!");
- return
- } else {
- // if (self.active.TYPE == "") {
- // sp.layerhide();
- // sp.dialog("流程类别不能为空!");
- // return false;
- // }
- var postData = {
- "flowkinds": self.info.type,
- "ckey": self.info.ckey,
- "cname": self.info.cname,
- "timelimit": self.info.timelimit,
- "explain": self.info.explain,
- "parentid": self.unit,
- "codetable": self.info.codetable,
- "codecolumn": self.info.codecolumn
- };
- $http.post(apiurljs.login + "g2work/flow/insertData", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.SubmitFlowFlag = false;
- ///console.log(res);
- if (res.success) {
- sp.layerhide();
- sp.dialog(res.message);
- $timeout(function () {
- sp.dialoghide();
- self.getMsgData(self.active.STATUS, self.active.TYPE, self.active.CNAME);
- }, 600)
- } else {
- sp.layerhide();
- sp.dialog(res.message);
- }
- });
- }
- })
- } else {
- var data = {
- tablename: "SYS_FLOW",
- colums: "*",
- order: "CKEY",
- sqlwhere: { CKEY: self.info.ckey },
- sqlinwhere: "",
- sqllikewhere: ""
- }
- $http.post(apiurljs.login + "g2app/DangJian/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.data.length > 1) {
- sp.layerhide();
- sp.dialog("流程已存在!");
- return
- } else {
- var postData = {
- "copyrightid": self.info.copyrightid,
- "ckey": self.info.ckey,
- "cname": self.info.cname,
- "timelimit": self.info.timelimit,
- "explain": self.info.explain,
- "codetable": self.info.codetable,
- "codecolumn": self.info.codecolumn,
- "flowkinds": self.info.type
- };
- $http.post(apiurljs.login + "g2work/flow/updateDataByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.SubmitFlowFlag = false;
- ///console.log(res);
- if (res.success) {
- sp.layerhide();
- sp.dialog(res.message);
- $timeout(function () {
- sp.dialoghide();
- //self.getCodeTableOption();
- self.getFlowData();///加载流程
- }, 600)
- } else {
- sp.layerhide();
- sp.dialog(res.message);
- }
- });
- }
- })
- }
- }
- };
- self.btnCancelFlow = function () {
- ///取消新建流程按钮事件
- spngvld.clear("#layer_addFlow");
- self.info = {
- "layertitle": "新建流程",
- "copyrightid": 0,
- "ckey": "",
- "cname": "",
- "timelimit": "",
- "explain": "",
- };
- sp.layerhide();
- };
- self.delFlow = function ($item) {
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "删除流程--移入流程回收站", "修改日志", window.location.pathname)
- // console.log($item);
- var getDelID = $item.COPYRIGHTID;
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后将移入“流程回收站”,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- ///取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- //post消息的id
- $("#delDataTrue").click(function () {
- var getid = $(this).attr("data-id");
- sp.dialoghide();
- var data = {
- copyrightid: getDelID///角色编码
- };
- $http.post(apiurljs.login + "g2work/flow/deleteByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- //self.getCodeTableOption();
- self.getFlowData();///加载流程
- sp.dialoghide();
- } else {
- sp.dialog(res.message);
- }
- });
- });
- };
- self.delFlowWithDelete = function ($item) {
- ////删除流程---流程回收站中的
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "删除流程", "修改日志", window.location.pathname)
- // console.log($item);
- var getDelID = $item.COPYRIGHTID;
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- ///取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- //post消息的id
- $("#delDataTrue").click(function () {
- var getid = $(this).attr("data-id");
- sp.dialoghide();
- var data = {
- copyrightid: getDelID///角色编码
- };
- $http.post(apiurljs.login + "g2work/flow/deleteByCopyrightidWithDelete", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- //self.getCodeTableOption();
- self.getFlowData();///加载流程
- sp.dialoghide();
- } else {
- sp.dialog(res.message);
- }
- });
- });
- };
- self.restoreFlowWithDelete = function ($item) {
- ////还原流程---流程回收中的
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "还原流程", "修改日志", window.location.pathname)
- // console.log($item);
- var getDelID = $item.COPYRIGHTID;
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">您确认要还原吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- ///取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- //post消息的id
- $("#delDataTrue").click(function () {
- var getid = $(this).attr("data-id");
- sp.dialoghide();
- var data = {
- copyrightid: getDelID///角色编码
- };
- $http.post(apiurljs.login + "g2work/flow/restoreByCopyrightidWithDelete", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- //self.getCodeTableOption();
- self.getFlowData();///加载流程
- sp.dialoghide();
- } else {
- sp.dialog(res.message);
- }
- });
- });
- };
- self.openSortFlow = function () {
- ///流程排序打开div层
- self.sortClose = 2;
- sp.layer("#layer_sortFlow");
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "流程排序", "修改日志", window.location.pathname)
- };
- self.flowSortup = function ($item, $index) {
- var set_index = parseInt($index - 1);
- var get_copyrightid1 = self.flowData[set_index].COPYRIGHTID;
- self.postSortFlowData(get_copyrightid1, $item.COPYRIGHTID);
- }
- self.flowSortdown = function ($item, $index) {
- var set_index = parseInt($index + 1);
- var get_copyrightid1 = self.flowData[set_index].COPYRIGHTID;
- self.postSortFlowData(get_copyrightid1, $item.COPYRIGHTID);
- }
- self.postSortFlowData = function (copyrightid1, copyrightid2) {
- var postData = {
- "copyrightid1": copyrightid1,
- "copyrightid2": copyrightid2
- }
- $http.post(apiurljs.login + "g2work/flow/swapSortidByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- ///console.log(res);
- if (res.success) {
- self.getMsgData(self.active.STATUS, self.active.TYPE, self.active.CNAME);
- } else {
- sp.layerhide();
- sp.dialog(res.message);
- }
- });
- };
- self.goTableFormDesign = function ($item, type) {
- var time1 = sp.getLocalDate1();
- self.recordCtime()
- ///跳转表单设计
- // console.log($item);
- // window.location.href="../flowchart_formbuilder/list.html";
- if (type == "add") {
- // alert($item.COPYRIGHTID);
- self.journalRecord(time1, sp.getLocalDate1(), "新建视图", "修改日志", window.location.pathname)
- window.location.href = "../flowchart_formbuilder/formbuilder.html?copyrightid=" + $item.COPYRIGHTID;
- } else {
- self.journalRecord(time1, sp.getLocalDate1(), "编辑视图", "修改日志", window.location.pathname)
- $timeout(function () {
- window.parent.CrossPage = {
- cname: "系统管理/流程管理",
- ctime: sp.getLocalDate1(),
- type: 0
- }
- window.location.href = $item.URL;
- }, 1)
- }
- };
- self.goFlowChartDesign = function ($item, type) {
- var time1 = sp.getLocalDate1();
- self.recordCtime()
- if (type == "add") {
- self.journalRecord(time1, sp.getLocalDate1(), "新建流程", "修改日志", window.location.pathname)
- $timeout(function () {
- window.location.href = "../../bpmn/modeler.html?copyrightid=" + $item.COPYRIGHTID + "&flowName=" + $item.CNAME + "&leftActive=" + self.active.STATUS + "&leftActiveType=" + self.active.TYPE + "&leftActiveName=" + self.active.CNAME;
- }, 1)
- } else {
- self.journalRecord(time1, sp.getLocalDate1(), "编辑流程", "修改日志", window.location.pathname)
- $item.URL = $item.URL + "&flowName=" + $item.CNAME + "&leftActive=" + self.active.STATUS + "&leftActiveType=" + self.active.TYPE + "&leftActiveName=" + self.active.CNAME;
- $timeout(function () {
- window.parent.CrossPage = {
- cname: "系统管理/流程管理",
- ctime: sp.getLocalDate1(),
- type: 0
- }
- window.location.href = $item.URL;
- }, 1)
- }
- };
- //检查整个流程列表的问题
- self.checkFlowList = function () {
- if (self.sortClose != 0) {
- return;
- }
- self.flowData.forEach(function (item, index) {
- var postData = {
- copyrightid: item.COPYRIGHTID,
- }
- $http.post(apiurljs.login + "g2work/flow/queryWorkflowErrors", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg).success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.flowData[index].errorData = res.data;
- });
- })
- }
- //复制流程
- self.copy = {
- layertitle: "流程另存为",
- flowkinds: "",
- copyrightid: "",
- ckey: "",
- cname: ""
- }
- self.openCopyFlow = function (obj) {
- spngvld.clear("#layer_copyFlow");
- self.copy.flowkinds = obj.FLOWKINDS;
- self.copy.copyrightid = obj.COPYRIGHTID;
- self.copy.ckey = obj.CKEY + "1";
- self.copy.cname = obj.CNAME + "1";
- sp.layer("#layer_copyFlow");
- var time1 = sp.getLocalDate1();
- self.ctime = sp.getLocalDate1();
- self.journalRecord(time1, sp.getLocalDate1(), "另存流程", "修改日志", window.location.pathname)
- }
- self.btnCopyFlow = function () {
- if (spngvld.submit("#layer_copyFlow")) {
- var data = {
- flowkinds: self.copy.flowkinds,
- copyrightid: self.copy.copyrightid,
- ckey: self.copy.ckey,
- cname: self.copy.cname
- }
- $http.post(apiurljs.login + "g2work/flow/saveasByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (res.success) {
- //self.getCodeTableOption();
- self.getFlowData();///加载流程
- } else {
- sp.dialog(res.message);
- }
- });
- };
- };
- $(function () {
- $("body").bind("click", function () {
- setTimeout(function () {
- if ($("#layer_sortFlowType").css("display") == "none" && self.sortClose == 1) {
- self.sortClose = 0;
- self.getFlowType();
- }
- if ($("#layer_sortFlow").css("display") == "none" && self.sortClose == 2) {
- self.sortClose = 0;
- self.getMsgData(self.active.STATUS, self.active.TYPE, self.active.CNAME);
- }
- },500)
- });
- })
- self.recordCtime = function () {
- $.cookie("CrossPage-ctime", sp.getLocalDate1(), { path: '/', expires: 1 });
- $.cookie("CrossPage-title", self.CrossPage.cname, { path: '/', expires: 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.userCName
- }
- }
- $http.post(apiurljs.login + "g2app/DangJian/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (res) {
- self.CrossPage.type = 1;
- })
- }
-
- }]);
|