1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080 |
- 'use strict';
- var app = angular.module('app', [
- ]);
- app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$sce", function ($scope, $http, $timeout, $sce) {
- 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.mbid = sp.getUrlName("mbid");
- self.fjid = sp.getUrlName("fjid");
- self.docmode = sp.getUrlName("docmode");
- self.dotype = sp.getUrlName("dotype");
- self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
- self.get_lastReturnPage = sp.getUrlName("lastReturnPage");
- self.get_type = sp.getUrlName("type");
- self.return = "../list.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
- self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
- //初始化右上角按钮
- self.buttonList = []
- //上层附件、业务参考、共享沟通组件
- self.arrayFile = null;
- self.arrayFile1 = [];
- self.uploading_zw = false;
- self.uploading = false;
- self.upload_zw = function () {
- var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
- return item.CNAME
- })
- $('#fileupload-zw').fileupload({
- url: apiurljs.login + (self.routeinfoid == 0 ? 'g2app/abase/uploadFileWithFormWithSaveRouteinfo' : 'g2app/abase/uploadFileWithFormAndGetPage'),//'g2app/abase/uploadFileWithForm'),
- dataType: 'json',
- beforeSend: function (xhr, data) {
- xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
- if (self.routeinfoid == 0) {
- xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("copyrightid=" + self.copyrightid + ",directionid=" + self.directionid + ",formeditid=" + self.formeditid + ",routeinfoid=" + self.routeinfoid + ",routeid=" + self.routeid + ",tablename=FILE_ATTACH,ATTACHTYPE=领导批示承办单-正文"));
- } else {
- xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=领导批示承办单-正文"));
- }
- },
- add: function (e, data) {
- var num = 0;
- var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
- //文件类型判断
- $.each(data.originalFiles, function (index, item) {
- if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
- sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
- return;
- } else {
- num++
- }
- })
- if (num == data.originalFiles.length) {
- self.uploading_zw = true;
- data.submit();
- $scope.$apply();
- }
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- self.uploading_zw = false;
- if (self.routeinfoid == 0) {
- var res = strToJson(s4.decryptData_CBC(data.result.data));
- self.data.ID = res.data2.ID;
- self.routeid = res.data2.ROUTEID;
- self.routeinfoid = res.data2.ROUTEINFOID;
- self.getSwenList(0)
- } else {
- self.getOther1()
- }
- }
- })
- }
- self.upload = function () {
- var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
- return item.CNAME
- })
- $('#fileupload').fileupload({
- url: apiurljs.login + 'g2app/abase/uploadFileWithFormAndGetPage',//'g2app/abase/uploadFileWithForm',
- dataType: 'json',
- beforeSend: function (xhr, data) {
- xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
- xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=领导批示承办单"));
- },
- add: function (e, data) {
- var num = 0;
- var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
- //文件类型判断
- $.each(data.originalFiles, function (index, item) {
- if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
- sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
- return;
- } else {
- num++
- }
- })
- if (num == data.originalFiles.length) {
- self.uploading = true;
- data.submit();
- $scope.$apply();
- }
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- self.uploading = false;
- self.getOther()
- }
- })
- }
- self.downLoad = function (item) {
- window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
- }
- self.deleteFile = function (file) {
- 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 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 data = {
- tablename: "FILE_ATTACH",
- id: file.ID
- };
- $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.dialoghide();
- if (res.success) {
- self.getOther();
- } else {
- sp.dialog("删除失败,请联系管理员!");
- }
- });
- });
- }
- self.seeFile = function (obj) {
- self.seeFileItem = obj;
- var set_convertType = 0;
- if (obj.FILEEXT == "doc") {
- set_convertType = 0;
- } else if (obj.FILEEXT == "pdf") {
- set_convertType = 20;
- } else if (obj.FILEEXT == "ofd") {
- set_convertType = 570;
- } else {
- set_convertType = 0;
- }
- let postData = {
- convertType: set_convertType,
- isSignature: 1,
- fileUrl: apiurljs.login + "g2work/files2/inline/" + obj.FILEURL.slice(7)
- };
- var postCfg_transfer = {
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
- transformRequest: function (data) {
- return $.param(data);
- }
- };
- $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
- .success(function (res) {
- if (res.errorcode === 0) {
- //$("#iframe_book").css("height", $(".ibox-content").height() - 123)
- $("#iframe_book").attr("src", res.data.viewUrl)
- } else {
- sp.dialog(res.message);
- }
- });
- }
- self.goAttach = function (obj) {
- if (obj) {
- if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
- sp.dialog("文件暂不支持在线预览,请点击下载查看!")
- return
- }
- $("#attachlist")[0].contentWindow.openFile(obj)
- if ($(".fa-chevron-down").is(":hidden") == true) {
- showToggle(document.getElementById("toggleButton"))
- }
- } else {
- $("#attachlist").attr("src", "attachlist.html?routeinfoid=" + self.routeinfoid)
- }
- }
- self.readonly = {
- CPSX: true,
- JJCD: false,
- SWLB: false,
- SWBH: false,
- LWDW: false,
- LWWH: false,
- LWRQ: false,
- PSLD: false,
- BT: false,
- SZFNBYJ: false,
- SLDPS: false,
- BFSNBYJ: false,
- WLDPS: false,
- CBCSCLQK: false,
- ZDDB: false,
- CDCS: false,
- DBSX: false,
- ZBCS: false,
- SFBJ: false,
- BJQK: false,
- FGLDBJQR: false,
- BZ: false,
- NGR: false,
- ZBRQ: false,
- USAGE: false
- }
- self.show = {
- CPSX: false,
- JJCD: false,
- SWLB: false,
- SWBH: false,
- LWDW: false,
- LWWH: false,
- LWRQ: false,
- PSLD: false,
- BT: false,
- SZFNBYJ: false,
- SLDPS: false,
- BFSNBYJ: false,
- WLDPS: false,
- CBCSCLQK: false,
- ZDDB: false,
- CDCS: false,
- DBSX: false,
- ZBCS: false,
- SFBJ: false,
- BJQK: false,
- FGLDBJQR: false,
- BZ: false,
- NGR: false,
- ZBRQ: false,
- USAGE: false
- }
- self.getSwenList = function (n) {
- self.SwenList = [];
- var data = {
- directionid: self.directionid,
- userid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: self.routeid,
- formeditid: ""
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (self.copyrightid == "") {
- self.copyrightid = res.data.LINKS[0].COPYRIGHTID
- }
- $.each(res.data.LINKS, function (index, item) {
- item.TEMPFORM = item.TEMPFORM + "&flowid=" + sp.getUrlName("flowid")
- if (item.TEMPFORM.indexOf("formeditZW.html") > -1) {
- self.Title = item.VNAME;
- }
- if (item.TEMPFORM.indexOf("?docmode") > 0) {
- item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
- } else {
- item.TEMPFORM = "#";
- }
- self.SwenList.push(item)
- })
- self.SwenList.push({
- VNAME: "流程图",
- DIRECTIONID: self.SwenList[0].DIRECTIONID,
- TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
- })
- if (n == 0) {
- self.getFLOW()
- } else {
- self.getData()
- }
- })
- }
- self.getSwenList(0)
- self.getFLOW = function () {
- var data = {
- copyrightid: self.copyrightid
- }
- $http.post(apiurljs.login + "g2work/flow/queryDataByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.flowTitle = res.data.CNAME;
- self.getJJQK()
- })
- }
- self.getJJQK = function () {
- var data = {
- ckey: "CODE_EMERGENCY",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.JJCD = res.data.CODE_EMERGENCY;
- self.getSWLB()
- })
- }
- self.getSWLB = function () {
- var data = {
- ckey: "CODE_SWLB",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.SWLB = res.data.CODE_SWLB;
- self.getZDDB()
- })
- }
-
- self.getZDDB = function () {
- var data = {
- ckey: "CODE_OVERSEE",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.ZDDB = res.data.CODE_OVERSEE;
- self.getSFBJ()
- })
- }
- self.getSFBJ = function () {
- var data = {
- ckey: "CODE_SF",//"CODE_SFBJ",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.SFBJ = res.data.CODE_SF;
- self.getFGLDBJQR()
- })
- }
- self.getFGLDBJQR = function () {
- var data = {
- ckey: "CODE_OPTION",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.FGLDBJQR = res.data.CODE_OPTION;
- self.getDpList()
- })
- }
- self.getDpList = function () {
- var data = {
- unitid: "AA"
- }
- $http.post(apiurljs.login + "g2app/dataabase/querySectByCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.dpList = [];
- res.data.forEach(function (item) {
- if (item.CHILD_DATA.length == 0) {
- self.dpList.push(item)
- } else {
- item.CHILD_DATA.forEach(function (item1) {
- if (item1.CHILD_DATA.length == 0) {
- self.dpList.push(item1)
- } else {
- item1.CHILD_DATA.forEach(function (item2) {
- if (item2.CHILD_DATA.length == 0) {
- self.dpList.push(item2)
- }
- })
- }
- })
- }
- })
- self.dpList.forEach(function (item) {
- item.checked = false;
- })
- self.DpList = {
- ZBCS: JSON.parse(JSON.stringify(self.dpList)),
- CDCS: JSON.parse(JSON.stringify(self.dpList))
- }
- self.AllCheckedDp = {};
- self.DpLength = {};
- self.selectDpList = {};
- self.getUSAGE(0)
- })
- }
- //标签
- self.getUSAGE = function (n) {
- var data = {
- ckey: "CODE_SHOUWENLABEL",
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.USAGE = res.data.CODE_SHOUWENLABEL;
- $.each(self.USAGE, function (index, item) {
- item.checked = false;
- })
- if (n == 0) {
- self.getSWBH()
- }
- if (n == 1) {
- $.each(self.USAGE, function (index, item) {
- if (self.data.USAGE.indexOf(item.CODE) != -1) {
- item.checked = true;
- }
- })
- $timeout(function () {
- $(".sp-checkbox-blue input[name=USAGE]").each(function () {
- if (self.data.USAGE.indexOf($(this).val()) != -1) {
- $(this).attr("checked", true);
- $(this).parent("label").addClass("chb-blue-checked");
- }
- })
- }, 1)
- }
- })
- }
- //管理标签
- self.ManageUSAGE = function (n) {
- self.addUSAGENAME = "";
- var data = {
- tablename: "CODE_SHOUWENLABEL"
- }
- $http.post(apiurljs.login + "g2app/shouwen/queryLabelCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.USAGELIST = res.data;
- $.each(self.USAGELIST, function (index, item) {
- item.change = false;
- item.CNAME1 = item.CNAME;
- item.USAGE = item.USAGE == 0 ? "隐藏" : "显示";
- })
- if (n == 0) {
- $timeout(function () {
- sp.layer("#USAGE");
- }, 1)
- }
- })
- }
- //新增标签
- self.addUSAGE = function () {
- if (self.addUSAGENAME == "") {
- sp.dialog("标签名称不可为空!");
- return;
- }
- var data = {
- tablename: "CODE_SHOUWENLABEL",
- data: {
- CODE: "C0" + (self.USAGELIST.length + 1),
- CNAME: self.addUSAGENAME,
- USERID: self.userId,
- TABLENAME: "SW_LDPSCBD",
- USAGE: "1"
- }
- }
- $http.post(apiurljs.login + "g2app/shouwen/insertCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.ManageUSAGE(1);
- self.getUSAGE(1);
- } else {
- sp.dialog(res.message);
- }
- })
- }
- //标签排序上下移
- self.btnSort = function ($index, tip) {
- var set_id = "";
- var set_sortid = "";
- if (tip == "上移") {
- var set_index = parseInt($index - 1);
- set_id = self.USAGELIST[set_index].ID;
- set_sortid = self.USAGELIST[set_index].SORTID;
- } else {
- var set_index = parseInt($index + 1);
- set_id = self.USAGELIST[set_index].ID;
- set_sortid = self.USAGELIST[set_index].SORTID;
- }
- var data = {
- tablename: "CODE_SHOUWENLABEL",
- id: self.USAGELIST[$index].ID,
- sortid: self.USAGELIST[$index].SORTID,
- id_other: set_id,
- sortid_other: set_sortid
- };
- $http.post(apiurljs.login + "g2app/shouwen/MoveCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.ManageUSAGE(1);
- } else {
- sp.dialog(res.message);
- }
- });
- };
- //更新标签
- self.updataUSAGE = function (item, str) {
- if (str == "CNAME") {
- var data = {
- tablename: "SW_LDPSCBD",
- code: item.CODE,
- }
- $http.post(apiurljs.login + "g2app/shouwen/querynumCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- var data = {
- tablename: "CODE_SHOUWENLABEL",
- id: item.ID,
- data: {
- "cname": item.CNAME1
- }
- }
- $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- item.change = false;
- self.ManageUSAGE(1);
- self.getUSAGE(1);
- } else {
- sp.dialog(res.message);
- }
- });
- } else {
- 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 id='upDataTrue' 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.dialoghide();
- $timeout(function () {
- item.CNAME1 = item.CNAME;
- }, 1)
- //sp.closeCenter(".sp-dialog");
- event.preventDefault(); event.stopPropagation();
- });
- $("#upDataTrue").click(function () {
- var data = {
- tablename: "CODE_SHOUWENLABEL",
- id: item.ID,
- data: {
- "cname": item.CNAME1
- }
- }
- $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- sp.dialoghide();
- item.change = false;
- self.ManageUSAGE(1);
- self.getUSAGE(1);
- } else {
- sp.dialog(res.message);
- }
- });
- });
- }
- })
- } else if (str == "显示") {
- var data = {
- tablename: "CODE_SHOUWENLABEL",
- id: item.ID,
- data: {
- "USAGE": "1"
- }
- }
- $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- item.change = false;
- self.ManageUSAGE(1);
- self.getUSAGE(1);
- } else {
- sp.dialog(res.message);
- }
- });
- } else {
- var data = {
- tablename: "CODE_SHOUWENLABEL",
- id: item.ID,
- data: {
- "USAGE": "0"
- }
- }
- $http.post(apiurljs.login + "g2app/shouwen/upCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- item.change = false;
- self.ManageUSAGE(1);
- self.getUSAGE(1);
- } else {
- sp.dialog(res.message);
- }
- });
- }
- }
- //删除标签
- self.deleteUSAGE = function (item) {
- var data = {
- tablename: "CODE_SHOUWENLABEL",
- tablename_form: "SW_LDPSCBD",
- id: item.ID,
- code: item.CODE
- }
- $http.post(apiurljs.login + "g2app/shouwen/delCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.ManageUSAGE(1);
- self.getUSAGE(1);
- } else {
- sp.dialog("此标签已被使用");
- }
- });
- }
- self.getSWBH = function () {
- var data = {
- flowid: sp.getUrlName("flowid")
- }
- $http.post(apiurljs.login + "g2app/shouwen/querySWCodeByFlowid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.SWBH = res.data;
- self.getData()
- })
- }
- //获取数据
- self.getData = function () {
- var data = {
- ckey: "SW_LDPSCBD",
- id: 0,
- directionid: self.directionid,
- formeditid: self.formeditid,
- routeid: self.routeid,
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/abase/queryData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.data = {
- CPSX: res.data.SW_LDPSCBD.CPSX == "" ? "" : sp.format(res.data.SW_LDPSCBD.CPSX),
- ID: res.data.SW_LDPSCBD.ID,
- APPCODE: res.data.SW_LDPSCBD.APPCODE,
- JJCD: res.data.SW_LDPSCBD.JJCD == "" ? self.JJCD[0].CODE : res.data.SW_LDPSCBD.JJCD,
- SWLB: res.data.SW_LDPSCBD.SWLB == "" ? self.SWLB[0].CODE : res.data.SW_LDPSCBD.SWLB,
- SWBH: res.data.SW_LDPSCBD.SWBH == "" ? self.SWBH.replace("|", "〔 ").replace("|", " 〕") + "号" : res.data.SW_LDPSCBD.SWBH,
- SWBH1: res.data.SW_LDPSCBD.SWBH,
- LWDW: res.data.SW_LDPSCBD.LWDW,
- LWWH: res.data.SW_LDPSCBD.LWWH == "" ? "〔 " + sp.currentYear() + " 〕号" : res.data.SW_LDPSCBD.LWWH,
- LWRQ: res.data.SW_LDPSCBD.LWRQ == "" || res.data.SW_LDPSCBD.LWRQ == null ? sp.format(sp.getLocalDate()) : sp.format(res.data.SW_LDPSCBD.LWRQ),
- PSLD: res.data.SW_LDPSCBD.PSLD,
- BT: res.data.SW_LDPSCBD.BT,
- SZFNBYJ: res.data.SW_LDPSCBD.SZFNBYJ,//1
- SLDPS: res.data.SW_LDPSCBD.SLDPS,//1
- BFSNBYJ: res.data.SW_LDPSCBD.BFSNBYJ,//1
- WLDPS: res.data.SW_LDPSCBD.WLDPS,//1
- CBCSCLQK: res.data.SW_LDPSCBD.CBCSCLQK,//1
- SFDB: "C01",
- ZDDB: res.data.SW_LDPSCBD.ZDDB == "" ? self.ZDDB[1].CODE : res.data.SW_LDPSCBD.ZDDB,
- CDCS: res.data.SW_LDPSCBD.CDCS,
- DBSX: res.data.SW_LDPSCBD.DBSX == "" ? "" : sp.format(res.data.SW_LDPSCBD.DBSX),
- ZBCS: res.data.SW_LDPSCBD.ZBCS,
- ZBCSCODE: res.data.SW_LDPSCBD.ZBCSCODE,
- SFBJ: res.data.SW_LDPSCBD.SFBJ == "" ? self.SFBJ[0].CODE : res.data.SW_LDPSCBD.SFBJ,
- BJQK: res.data.SW_LDPSCBD.BJQK,
- FGLDBJQR: res.data.SW_LDPSCBD.FGLDBJQR,
- BZ: res.data.SW_LDPSCBD.BZ,
- NGR: res.data.SW_LDPSCBD.NGR == "" ? self.userName : res.data.SW_LDPSCBD.NGR,
- ZBRQ: res.data.SW_LDPSCBD.ZBRQ == "" || res.data.SW_LDPSCBD.ZBRQ == null ? sp.format(sp.getLocalDate()) : sp.format(res.data.SW_LDPSCBD.ZBRQ),
- SWQXLX: res.data.SW_LDPSCBD.SWQXLX == "" ? res.data.SW_LDPSCBD.ZDDB != "C01" ? "办理" : "督办" : res.data.SW_LDPSCBD.SWQXLX,
- USAGE: res.data.SW_LDPSCBD.USAGE
- }
- self.readonly = {
- CPSX: res.data.SW_LDPSCBD["CPSX.EREADONLY"] == "true",
- JJCD: res.data.SW_LDPSCBD["JJCD.EREADONLY"] == "true",
- SWLB: res.data.SW_LDPSCBD["SWLB.EREADONLY"] == "true",
- SWBH: res.data.SW_LDPSCBD["SWBH.EREADONLY"] == "true",
- LWDW: res.data.SW_LDPSCBD["LWDW.EREADONLY"] == "true",
- LWWH: res.data.SW_LDPSCBD["LWWH.EREADONLY"] == "true",
- LWRQ: res.data.SW_LDPSCBD["LWRQ.EREADONLY"] == "true",
- PSLD: res.data.SW_LDPSCBD["PSLD.EREADONLY"] == "true",
- BT: res.data.SW_LDPSCBD["BT.EREADONLY"] == "true",
- SZFNBYJ: res.data.SW_LDPSCBD["SZFNBYJ.EREADONLY"] == "true",
- SLDPS: res.data.SW_LDPSCBD["SLDPS.EREADONLY"] == "true",
- BFSNBYJ: res.data.SW_LDPSCBD["BFSNBYJ.EREADONLY"] == "true",
- WLDPS: res.data.SW_LDPSCBD["WLDPS.EREADONLY"] == "true",
- CBCSCLQK: res.data.SW_LDPSCBD["CBCSCLQK.EREADONLY"] == "true",
- ZDDB: res.data.SW_LDPSCBD["ZDDB.EREADONLY"] == "true",
- CDCS: res.data.SW_LDPSCBD["CDCS.EREADONLY"] == "true",
- DBSX: res.data.SW_LDPSCBD["DBSX.EREADONLY"] == "true",
- ZBCS: res.data.SW_LDPSCBD["ZBCS.EREADONLY"] == "true",
- SFBJ: res.data.SW_LDPSCBD["SFBJ.EREADONLY"] == "true",
- BJQK: res.data.SW_LDPSCBD["BJQK.EREADONLY"] == "true",
- FGLDBJQR: res.data.SW_LDPSCBD["FGLDBJQR.EREADONLY"] == "true",
- BZ: res.data.SW_LDPSCBD["BZ.EREADONLY"] == "true",
- NGR: res.data.SW_LDPSCBD["NGR.EREADONLY"] == "true",
- ZBRQ: res.data.SW_LDPSCBD["ZBRQ.EREADONLY"] == "true",
- USAGE: res.data.SW_LDPSCBD["USAGE.EREADONLY"] == "true"
- }
- self.show = {
- CPSX: res.data.SW_LDPSCBD["CPSX.ESHOW"] == "true",
- JJCD: res.data.SW_LDPSCBD["JJCD.ESHOW"] == "true",
- SWLB: res.data.SW_LDPSCBD["SWLB.ESHOW"] == "true",
- SWBH: res.data.SW_LDPSCBD["SWBH.ESHOW"] == "true",
- LWDW: res.data.SW_LDPSCBD["LWDW.ESHOW"] == "true",
- LWWH: res.data.SW_LDPSCBD["LWWH.ESHOW"] == "true",
- LWRQ: res.data.SW_LDPSCBD["LWRQ.ESHOW"] == "true",
- PSLD: res.data.SW_LDPSCBD["PSLD.ESHOW"] == "true",
- BT: res.data.SW_LDPSCBD["BT.ESHOW"] == "true",
- SZFNBYJ: res.data.SW_LDPSCBD["SZFNBYJ.ESHOW"] == "true",
- SLDPS: res.data.SW_LDPSCBD["SLDPS.ESHOW"] == "true",
- BFSNBYJ: res.data.SW_LDPSCBD["BFSNBYJ.ESHOW"] == "true",
- WLDPS: res.data.SW_LDPSCBD["WLDPS.ESHOW"] == "true",
- CBCSCLQK: res.data.SW_LDPSCBD["CBCSCLQK.ESHOW"] == "true",
- ZDDB: res.data.SW_LDPSCBD["ZDDB.ESHOW"] == "true",
- CDCS: res.data.SW_LDPSCBD["CDCS.ESHOW"] == "true",
- DBSX: res.data.SW_LDPSCBD["DBSX.ESHOW"] == "true",
- ZBCS: res.data.SW_LDPSCBD["ZBCS.ESHOW"] == "true",
- SFBJ: res.data.SW_LDPSCBD["SFBJ.ESHOW"] == "true",
- BJQK: res.data.SW_LDPSCBD["BJQK.ESHOW"] == "true",
- FGLDBJQR: res.data.SW_LDPSCBD["FGLDBJQR.ESHOW"] == "true",
- BZ: res.data.SW_LDPSCBD["BZ.ESHOW"] == "true",
- NGR: res.data.SW_LDPSCBD["NGR.ESHOW"] == "true",
- ZBRQ: res.data.SW_LDPSCBD["ZBRQ.ESHOW"] == "true",
- USAGE: res.data.SW_LDPSCBD["USAGE.ESHOW"] == "true"
- }
- self.selectUSAGEs = self.data.USAGE != "" && self.data.USAGE != null ? self.data.USAGE.split(",") : [];
- $.each(self.USAGE, function (index, item) {
- if (self.data.USAGE.indexOf(item.CODE) != -1) {
- item.checked = true;
- }
- })
- $timeout(function () {
- $(".sp-checkbox-blue input[name=USAGE]").each(function () {
- if (self.data.USAGE.indexOf($(this).val()) != -1) {
- $(this).attr("checked", true);
- $(this).parent("label").addClass("chb-blue-checked");
- }
- })
- }, 0)
- self.filedChange = true;
- //if (self.data.ID == 0) {
- // self.filedChange = true;
- //} else {
- // self.filedChange = false;
- //}
- self.buttonList = res.data["SW_LDPSCBD.FUNCLIST"];
- var n = {}, all = {};
- for (var i in self.DpList) {
- self.AllCheckedDp[i] = false;
- self.DpLength[i] = 0;
- self.selectDpList[i] = []
- all[i] = 0;
- $.each(self.DpList[i], function (index, item) {
- self.DpLength[i]++
- if (self.data.ZBCS.indexOf(item.SECTION) != -1 && i == "ZBCS") {
- all[i]++;
- item.checked = true;
- self.selectDpList[i].push(item);
- }
- if (self.data.CDCS.indexOf(item.SECTION) != -1 && i == "CDCS") {
- all[i]++;
- item.checked = true;
- self.selectDpList[i].push(item);
- }
- })
- if (all[i] == self.DpList[i].length) {
- self.AllCheckedDp[i] = true;
- } else {
- self.AllCheckedDp[i] = false;
- }
- }
- self.getOpinion1()
- self.getOther1()
- self.getOther()
- self.opinionList = [{
- name: "办公室拟办意见",
- col: "BFSNBYJ",
- show: !self.hide("show", "BFSNBYJ") && !self.hide("readonly", "BFSNBYJ")
- }, {
- name: "委领导批示",
- col: "WLDPS",
- show: !self.hide("show", "WLDPS") && !self.hide("readonly", "WLDPS")
- }, {
- name: "承办处室处理情况",
- col: "CBCSCLQK",
- show: !self.hide("show", "CBCSCLQK") && !self.hide("readonly", "CBCSCLQK")
- }]
- self.opinionList1 = [];
- self.opinionList.forEach(function (item) {
- if (item.show == true) {
- self.opinionList1.push(item)
- }
- })
- if (self.opinionList1.length > 0) {
- self.opiniontype = self.opinionList1[0].col;
- }
- self.getGLFLOW()
- })
- }
- //转换
- self.Loaling = false;
- self.pdfContent = [];
- self.getContent = function () {
- if (self.Loaling == true) {
- return;
- }
- self.Loaling = true;
- //$("#pdfContent").nextAll("div").addClass("sp-page-loading")
- self.pdfContent = [];
- var data = {
- fileurl: self.seeFileItem.FILEURL
- }
- $http.post(apiurljs.login + "g2app/dataabase/queryPDFContent", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.Loaling = false;
- //$("#pdfContent").nextAll("div").removeClass("sp-page-loading")
- for (var i in res.data) {
- self.pdfContent.push({ id: parseInt(i.slice(i.indexOf("_") + 1)), content: res.data[i] })
- }
- self.pdfContent.sort(function (a, b) {
- return a.id - b.id;
- })
- })
- }
- //获取意见(不上表)
- self.getOpinion1 = function () {
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: "",//self.routeid,
- tableid: "SW_LDPSCBD",
- colid: "",
- opiniontype: "",//self.opiniontype,
- orderbycol: "CDATE desc"
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success == true) {
- self.YJ.nulla = res.data;
- self.YJ.nullaSTATUS = false;
- self.YJ.nulla.forEach(function (item) {
- item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
- if (self.activeOpinion != null) {
- self.activeOpinion.FILEDATA = item.FILEDATA
- }
- })
- } else {
- sp.dialog(res.message)
- }
- })
- }
- //获取正文
- self.getOther1 = function () {
- var data = {
- tablename: "FILE_ATTACH",
- colums: "*",
- order: "ID asc",
- sqlwhere: { ROUTEINFOID: self.routeinfoid },
- sqlinwhere: "",
- sqllikewhere: { ATTACHTYPE: "-正文" }
- }
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.data.length > 0) {
- res.data.forEach(function (item) {
- if (item.ATTACHTYPE.indexOf("-正文") > -1) {
- self.arrayFile = item;
- self.seeFile(self.arrayFile)
- }
- })
- }
- })
- }
- //获取附件
- self.getOther = function () {
- if (self.routeinfoid == 0) { return }
- var data = {
- tablename: "FILE_ATTACH",
- colums: "*",
- order: "ID asc",
- sqlwhere: { ROUTEINFOID: self.routeinfoid },
- sqlinwhere: "",
- sqllikewhere: ""
- }
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.arrayFile1 = [];
- if (res.data.length > 0) {
- res.data.forEach(function (item) {
- if (item.ATTACHTYPE.indexOf("-正文") == -1) {
- self.arrayFile1.push(item)
- }
- })
- self.goAttach()
- }
- })
- }
- self.getGLFLOW = function () {
- var data = {
- userid: self.userId,
- routeinfoid:self.routeinfoid
- }
- $http.post(apiurljs.login + "g2work/routeinfo/queryDataRelatedFlow",{ data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- res.data.FLOWIN.forEach(function (item) {
- item.type = "FLOWIN"
- })
- res.data.FLOWOUT.forEach(function (item) {
- item.type = "FLOWOUT"
- })
- self.glList = res.data.FLOWIN.concat(res.data.FLOWOUT);
- console.log(self.glList)
- })
- }
- self.openGL = function (item) {
- if (item.FLOWID == "AA65") {
- window.top.sp.addTabNav("FZJ12", "签报管理", "tpl/qianbaomgr/" + item.FILEN)
- $timeout(function () {
- window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_FZJ12")
- }, 100)
- } else if (item.FLOWID == "AA95") {
- window.top.sp.addTabNav("FZJ24", "党委会议题呈报", "tpl/DWHYTCB/" + item.FILEN)
- $timeout(function () {
- window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_FZJ24")
- }, 100)
- } else if (item.FLOWID == "AA10") {
- window.top.sp.addTabNav("FZC01", "行政发文", "tpl/fawenbg/" + item.FILEN)
- $timeout(function () {
- window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_FZC01")
- }, 100)
- }
- }
- //判断页面字段是否只读readonly、是否隐藏show;(readonly)true-只读 false-可编辑;(show)true-隐藏 false-可见
- self.hide = function (type, field) {
- if (self.dotype == 0 && type == "readonly") {
- return true;
- } else {
- if (self[type][field] == true) {
- return true;
- } else {
- return false;
- }
- }
- }
- //右上角按钮调用方法
- self.btnEvent = function (item) {
- if (item.CODE == "NEWFLOWQB") {
- var data = {
- flowid: "AA65",
- userid: self.userId,
- routeinfoid: self.routeinfoid,
- directionid: self.directionid,
- copyrightid: self.copyrightid
- }
- $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- console.log(res)
- window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/qianbaomgr/" + res.data.FILEN + "&dotype=1&flowid=AA65")
- $timeout(function () {
- window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_" + item.FUNCID)
- self.getGLFLOW()
- },1000)
- })
- return
- } else if (item.CODE == "NEWFLOWDW") {
- var data = {
- flowid: "AA95",
- userid: self.userId,
- routeinfoid: self.routeinfoid,
- directionid: self.directionid,
- copyrightid: self.copyrightid
- }
- $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- console.log(res)
- window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/DWHYTCB/" + res.data.FILEN + "&dotype=1&flowid=AA95")
- $timeout(function () {
- window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_" + item.FUNCID)
- self.getGLFLOW()
- }, 1000)
- })
- return
- } else if (item.CODE == "NEWFLOWXZ") {
- var data = {
- flowid: "AA10",
- userid: self.userId,
- routeinfoid: self.routeinfoid,
- directionid: self.directionid,
- copyrightid: self.copyrightid
- }
- $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- console.log(res)
- window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/fawenbg/" + res.data.FILEN + "&dotype=1&flowid=AA10")
- $timeout(function () {
- window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_" + item.FUNCID)
- self.getGLFLOW()
- }, 1000)
- })
- return
- }
- if (item.CODE.indexOf("NEWFLOW") > -1) {
- var data = {
- flowid: item.FLOWID,
- userid: self.userId,
- routeinfoid: self.routeinfoid,
- directionid: self.directionid,
- copyrightid: self.copyrightid
- }
- $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- window.top.sp.addTabNav(item.FUNCID, item.CNAME, "tpl/fawenbg/" + res.data.FILEN + "&dotype=1&flowid=" + item.FLOWID)
- $timeout(function () {
- window.top.sp.restoreWorkLayer("#wrapper_tabs_box_col_" + item.FUNCID)
- self.getGLFLOW()
- }, 1000)
- })
- return
- }
- switch (item.CODE) {
- case "SAVEITEM": self.btnSave(0); break;
- case "PRINTITEM": self.btnPrint(); break;
- case "PRINTITEMEXTEND": self.btnPrint1(); break;
- case "MEETITEM": self.Meet(); break;
- case "SENDLOG": self.RouteList(); break;
- default: self.forward(item); break;
- }
- }
- self.openDpList = function (str) {
- if (self.hide("readonly", str) == true) {
- return
- } else {
- self.filed = str;
- //self.AllCheckedDp = false;
- sp.layer("#DpList")
- $("#DpList .sp-page").eq(0).scrollTop(0);
- }
- }
- self.checkAllDp = function () {
- self.AllCheckedDp[self.filed] = !self.AllCheckedDp[self.filed];
- $.each(self.DpList[self.filed], function (index, item) {
- item.checked = self.AllCheckedDp[self.filed];
- })
- self.submitDpList(1)
- }
- self.checkDpItem = function (item) {
- item.checked = !item.checked;
- var n = 0;
- $.each(self.DpList[self.filed], function (index, item) {
- if (item.checked == true) {
- n++
- }
- })
- if (n == self.DpList[self.filed].length) {
- self.AllCheckedDp[self.filed] = true;
- } else {
- self.AllCheckedDp[self.filed] = false;
- }
- self.submitDpList(1)
- }
- self.submitDpList = function (n) {
- var AllCheckedLength1 = 0;
- self.selectDpList[self.filed] = [];
- $.each(self.DpList[self.filed], function (index, item) {
- if (item.checked == true) {
- AllCheckedLength1++;
- self.selectDpList[self.filed].push(item)
- }
- })
- self.data[self.filed] = self.selectDpList[self.filed].map(function (item) {
- return item.SECTION
- }).join(",")
- if (self.filed == "ZBCS") {
- self.data.ZBCSCODE = self.selectDpList[self.filed].map(function (item) {
- return item.CODE
- }).join(",")
- self.data.CDCS = self.data.CDCS == "" ? self.data.ZBCS : self.data.CDCS;
- }
- self.AllCheckedDp[self.filed] = AllCheckedLength1 == self.DpLength[self.filed];
- self.changeFiled(self.filed)
- if (n == 0) {
- sp.layerhide();
- }
- }
- self.openLWDW = function () {
- var data = {
- tablename: "CODE_LWDWLABEL"
- }
- //$http.post(apiurljs.login + "g2app/shouwen/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- $http.post(apiurljs.login + "g2app/shouwen/getTreeListByTablename", data, postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- self.getMenuBtnList(res.data);
- self.LWDW = res.data[0].C_H_I_L_D_DATA;
- self.LWDW.forEach(function (item) {
- item.show = true;
- item.C_H_I_L_D_DATA.forEach(function (item1) {
- item1.checked = false;
- if (item1.CNAME == self.data.LWDW) {
- item1.checked = true;
- }
- })
- })
- sp.layer("#openLWDW")
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- self.treeData = [];
- })
- }
- self.checkItem = function (obj) {
- self.LWDW.forEach(function (item) {
- item.C_H_I_L_D_DATA.forEach(function (item1) {
- item1.checked = false;
- if (item1.ID == obj.ID) {
- item1.checked=true
- }
- })
- })
- }
- self.submitLWDW = function () {
- self.LWDW.forEach(function (item) {
- item.C_H_I_L_D_DATA.forEach(function (item1) {
- if (item1.checked == true) {
- self.data.LWDW = item1.CNAME;
- }
- })
- })
- console.log(self.data.LWDW)
- self.changeFiled('LWDW')
- sp.layerhide();
- }
- self.setLWDW = function (n) {
- var data = {
- tablename: "CODE_LWDWLABEL"
- }
- //$http.post(apiurljs.login + "g2app/shouwen/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- $http.post(apiurljs.login + "g2app/shouwen/getTreeListByTablename", data, postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- self.getMenuBtnList(res.data);
- self.treeData = res.data;
- $timeout(function () {
- self.nowNodeCode = self.treeData[0].CODE;
- self.nowNodeName = self.treeData[0].CNAME;
- self.nowNodeID = self.treeData[0].ID;
- self.treeData[0].checked = true;
- if (n == 0) {
- sp.layer("#setLWDW")
- }
- })
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- self.treeData = [];
- })
- }
- self.getMenuBtnList = function (data) {
- data.forEach(function (item) {
- item.checked = false;
- item.C_H_I_L_D_DATA_L = data.length;
- if (sp.isval(item.C_H_I_L_D_DATA) && item.C_H_I_L_D_DATA.length > 0) {
- self.getMenuBtnList(item.C_H_I_L_D_DATA);
- } else {
- item.C_H_I_L_D_DATA = [];
- }
- })
- }
- self.itemNode = {
- level: "",
- id: "",
- name: "",
- code: "",
- child_title: ""
- }
- self.rightFlag = 0;
- //添加目录树形非一级
- self.itemAdd = function ($item) {
- self.itemNode.level = $item.LEVELS;
- self.itemNode.id = 0;
- self.itemNode.name = $item.CNAME;
- self.itemNode.code = $item.CODE;
- self.itemNode.child_title = "";
- self.rightFlag = 1;
- console.log(self.itemNode)
- };
- //修改目录
- self.itemEdit = function ($item) {
- self.itemNode.level = $item.LEVELS;
- self.itemNode.id = $item.ID;
- self.itemNode.name = $item.CNAME;
- self.itemNode.code = $item.CODE;
- self.itemNode.child_title = $item.CNAME;
- self.rightFlag = 1;
- console.log(self.itemNode)
- };
- //删除底稿
- self.itemDelete = function ($item) {
- var data = {
- "id": $item.ID,
- "tablename": "CODE_LWDWLABEL",
- "parentid": $item.PARENTID,
- "formtablename": ""
- }
- $http.post(apiurljs.login + "g2app/dataabase/delNode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.setLWDW(1);
- self.btnCancal();
- } else {
- sp.dialog(res.message);
- }
- })
- }
- self.btnSetTitle = function () {
- if (self.itemNode.id != 0) {
- if (spngvld.submit("#LWDW")) {
- let postData = {
- id: self.itemNode.id,
- tablename: "CODE_LWDWLABEL",
- data: {
- CNAME: self.itemNode.level == 2 ? self.itemNode.name : self.itemNode.child_title
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/upFormData", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.setLWDW(1);
- self.btnCancal();
- } else {
- sp.dialog(res.message);
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- })
- }
- } else {
- if (spngvld.submit("#LWDW")) {
- let postData = {
- tablename: "CODE_LWDWLABEL",
- code: self.itemNode.code,
- levels: self.itemNode.level,
- cname: self.itemNode.level == 1 ? self.itemNode.name : self.itemNode.child_title,
- userid: self.userId
- }
- $http.post(apiurljs.login + "g2app/shouwen/TreeAdd", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success) {
- self.setLWDW(1);
- self.btnCancal();
- } else {
- sp.dialog(res.message);
- }
- })
- .error(function (XMLHttpRequest, textStatus, errorThrown) {
- })
- }
- }
- }
- self.btnCancal = function () {
- self.itemNode = {
- level: "",
- id: "",
- name: "",
- code: "",
- child_title: ""
- }
- self.rightFlag = 0;
- }
- //保存提交
- self.btnSave = function (n) {
- if (self.repeat == true) {
- return
- }
- if (spngvld.submit(".formedit")) {
- if (self.data.DBSX == "") {
- sp.dialog("督办时限不能为空!已为您设为来文日期后15天!")
- self.data.DBSX = sp.getNextDate(self.data.LWRQ, 15);
- self.data.CPSX = sp.getNextDate(self.data.LWRQ, 13);
- return
- }
- if (self.data.SWBH1 == "") {
- var postData = {
- swcode: self.SWBH,
- cuserid: self.userId,
- flowid: "AA18"
- }
- $http.post(apiurljs.login + "g2app/shouwen/saveSWCodeBySWCode", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
- .success(function (obj1) {
- var res1 = strToJson(s4.decryptData_CBC(obj1.data));
- if (res1.success) {
- if (res1.data == "-1") {
- sp.dialog("保存失败!");
- return;
- }
- var dataArray = [];
- self.data.USAGE = self.selectUSAGEs.join(",")
- dataArray.push(self.data);
- var data = {
- ckey: "SW_LDPSCBD",
- id: self.data.ID,
- routeid: self.routeid,
- routeinfoid: self.routeinfoid,
- routeinfotitle: self.data.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
- directionid: self.directionid,
- formeditid: self.formeditid,
- data: JSON.stringify(dataArray)
- }
- $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.code == 0) {
- self.data.ID = res.data.ID;
- self.routeid = res.data.ROUTEID;
- self.routeinfoid = res.data.ROUTEINFOID;
- self.filedChange = false;
- if (n == 0) {
- if (res1.data != self.SWBH.split("|")[2]) {
- sp.dialog("收文编号已改变!")
- } else {
- sp.dialog("保存成功!");
- }
- $timeout(function () {
- sp.dialoghide()
- }, 1500)
- self.getSwenList(1)
- } else if (n == 1) {
- self.forward(self.btnItem);
- } else if (n == 2) {
- self.sendAll();
- } else if (n == 3) {
- self.btnPrint();
- }
- } else {
- sp.dialog(res.message)
- }
- })
- } else {
- sp.dialog(res1.message)
- }
- })
- } else {
- var dataArray = [];
- self.data.USAGE = self.selectUSAGEs.join(",")
- dataArray.push(self.data);
- var data = {
- ckey: "SW_LDPSCBD",
- id: self.data.ID,
- routeid: self.routeid,
- routeinfoid: self.routeinfoid,
- routeinfotitle: self.data.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
- directionid: self.directionid,
- formeditid: self.formeditid,
- data: JSON.stringify(dataArray)
- }
- $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.code == 0) {
- self.data.ID = res.data.ID;
- self.routeid = res.data.ROUTEID;
- self.routeinfoid = res.data.ROUTEINFOID;
- self.filedChange = false;
- if (n == 0) {
- sp.dialog("保存成功!");
- $timeout(function () {
- sp.dialoghide()
- }, 1500)
- self.getSwenList(1)
- } else if (n == 1) {
- self.forward(self.btnItem);
- } else if (n == 2) {
- self.sendAll();
- } else if (n == 3) {
- self.btnPrint();
- }
- } else {
- sp.dialog(res.message)
- }
- })
- }
- }
- }
- //打印
- self.btnPrint = function () {
- if (self.filedChange == true) {
- self.btnSave(3)
- } else {
- // 创建隐藏的可下载链接
- var eleLink = document.createElement('a');
- eleLink.download = "";
- eleLink.style.display = 'none';
- eleLink.href = apiurljs.login + "g2app/shouwen/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=moban33.ftl&tablename=SW_LDPSCBD&outfilepath=/tmp/行政公文.wps&printdate=LWRQ,DBSX,ZBRQ&routeinfoid=" + self.routeinfoid));
- // 触发点击
- document.body.appendChild(eleLink);
- eleLink.click();
- // 然后移除
- document.body.removeChild(eleLink);
- }
- }
- /*综合打印*/
- self.printFiled = 1;
- self.btnPrint1 = function () {
- if (self.filedChange == true) {
- self.btnSave(3)
- } else {
- sp.layer("#print")
- }
- }
- self.printSubmit = function () {
- if (self.printFiled == 1) {
- var templatefilename = "moban31"
- } else if (self.printFiled == 2) {
- var templatefilename = "mobanoption"
- } else {
- var templatefilename = "moban31_all"
- }
- var data = {
- templatefilename: templatefilename + ".ftl",
- outfilepath: "/tmp/领导批示承办单" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
- routeinfoid: self.routeinfoid,
- tablename: "SW_LDPSCBD",
- printtype: self.printFiled,
- printdate: "LWRQ,DBSX,ZBRQ"
- }
- $http.post(apiurljs.login + "g2app/dataabase/PrintWordExtend", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- //window.open("../../../printPreview.html?url=" + apiurljs.login + "g2work" + res.data[0].url)
- if (self.deviceType == "pad") {
- window.location.href = "../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url
- } else {
- sp.openNewWindow("../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url, '打印预览')
- }
- })
- sp.layerhide()
- }
- //签写意见编辑状态
- self.opinion = {
- BFSNBYJ: false,
- BFSNBYJImg: false,
- WLDPS: false,
- WLDPSImg: false,
- CBCSCLQK: false,
- CBCSCLQKImg: false,
- nulla: false
- }
- self.YJ = {
- BFSNBYJ: [],
- BFSNBYJSTATUS: false,
- WLDPS: [],
- WLDPSSTATUS: false,
- CBCSCLQK: [],
- CBCSCLQKSTATUS: false,
- nulla: [],
- nullaSTATUS: false
- }
- //意见(下表)
- self.openOptionList = function () {
- if (self.routeinfoid == 0 && self.routeid == 0) {
- sp.dialog("请先保存!")
- return;
- }
- if (self.dotype == 0) {
- return
- }
- if (self.opinion.nulla == true) {
- return;
- }
- self.nulla = "";
- self.opinion.nulla = true;
- }
- self.openOptionList1 = function () {
- self.openOptionList()
- self.activeOpinion = null;
- self.showBottom = "opinion";
- self.YJ.nulla.forEach(function (item) {
- if (item.ROUTEID == self.routeid) {
- self.activeOpinion = item;
- self.nulla =item.OPINION;
- }
- })
- $(".toggle").trigger("click")
- }
- self.closeOptionList = function () {
- self.opinion.nulla = false;
- self.activeOpinion = null;
- $(".toggle").trigger("click")
- }
- self.submitOptionList = function () {
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: self.routeid,
- tableid: "SW_LDPSCBD",
- colid: self.opiniontype,
- opiniontype: self.opiniontype == "nulla" ? 99 : 0,
- cresult: "",
- opinion: self.nulla,
- opinionimage: ""
- }
- if (self.opiniontype == "BFSNBYJ") {
- data.cmans = "王勇";
- }
- $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.getOpinion1();
- self.opinion.nulla = false;
- $(".toggle").trigger("click")
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.changeOptionList = function (item) {
- self.showBottom = "opinion";
- self.opinion.nulla = true;
- self.nulla = item.OPINION;
- self.activeOpinion = item;
- $(".toggle").trigger("click")
- }
- //意见附件(下表)
- self.uploading1 = false;
- self.upload1 = function () {
- $('#fileupload1').fileupload({
- url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
- dataType: 'json',
- beforeSend: function (xhr, data) {
- xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
- xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
- + ",routeid=" + self.routeid + ",tableid=SW_LDPSCBD,colid=" + self.opiniontype));
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- self.uploading1 = false;
- self.getOpinion1()
- }
- })
- }
- //意见附件(下表)
- self.uploading2 = false;
- self.upload2 = function (str) {
- $('#fileupload2').fileupload({
- url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
- dataType: 'json',
- beforeSend: function (xhr, data) {
- xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
- xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
- + ",routeid=" + self.routeid + ",tableid=SW_LDPSCBD,colid=" + str));
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- self.uploading1 = false;
- self.getOpinion1()
- }
- })
- }
- //下载意见表附件
- self.downLoadOption = function (item) {
- window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
- }
- //删除意见表附件
- self.deleteOptionFile = function (file) {
- var data = {
- routeid: file.ROUTEID,
- tableid: "SW_LDPSCBD",
- colid: file.COLID,
- fileid: file.FILEID
- };
- $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.dialoghide();
- if (res.success) {
- self.getOpinion1();
- } else {
- sp.dialog("删除失败,请联系管理员!");
- }
- });
- }
- //删除意见
- self.Dopinion = function (item) {
- var data = {
- cmanid: self.userId,
- routeid: self.routeid,
- tableid: "SW_LDPSCBD",
- colid: item.COLID,
- }
- $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success == true) {
- self.getOpinion1();
- self.nulla = "";
- self.activeOpinion = null;
- self.changeFiled(item.COLID)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.phraseText = "";//添加常用语
- self.phraseList = []//常用语列表
- //获取常用语库
- self.phrase = function (colid) {
- sp.layer("#phrase");
- self.colid = colid;
- self.getPhrase();
- }
- //添加常用语到常用语库
- self.Aphrase = function () {
- if (self.phraseText == "") {
- return;
- }
- var data = {
- cmanid: self.userId,
- tableid: "SW_LDPSCBD",
- colid: self.colid,
- contents: self.phraseText
- }
- $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success == true) {
- self.phraseText = "";
- self.getPhrase();
- } else {
- sp.dialog(res.message)
- }
- })
- }
- //获取常用语库
- self.getPhrase = function () {
- var data = {
- cmanid: self.userId,
- tableid: "SW_LDPSCBD",
- colid: self.colid
- }
- $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.phraseList = res.data;
- self.phraseSelect = self.phraseList[0].CONTENTS;
- })
- }
- //从常用语库删除
- self.Dphrase = function () {
- var id = null;
- $.each(self.phraseList, function (index, item) {
- if (item.CONTENTS == self.phraseSelect) {
- id = item.ID;
- }
- })
- var data = {
- id: id
- }
- $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.getPhrase();
- })
- }
- //常用语确认为意见
- self.btnPhrase = function () {
- self.nulla = self.phraseSelect;
- sp.layerhide();
- }
- self.selectUSAGE = function (item) {
- item.checked = !item.checked;
- self.selectUSAGEs = [];
- $.each(self.USAGE, function (index, item) {
- if (item.checked == true) {
- self.selectUSAGEs.push(item.CODE)
- }
- })
- self.changeFiled('USAGE')
- }
- //发生修改
- self.changeFiled = function (str) {
- self.filedChange = true;
- if (self.data.ZDDB != "C01") {
- self.data.SWQXLX = "办理";
- } else {
- self.data.SWQXLX = "督办";
- }
-
- if(str == "DBSX"){
- let objDate = new Date()
- let DBSXDate = new Date(self.data.DBSX)
- let dif_t = DBSXDate.getTime() - objDate.getTime();
- let Day_dif_t = dif_t/(1000*60*60*24)
- if(Day_dif_t>10){
- self.data.CPSX = sp.getNextDate(self.data.DBSX, -2);
- }else{
- self.data.CPSX = sp.getNextDate(self.data.DBSX, -1);
- }
-
- }
- }
- //验证是否重复
- self.repeat = false;
- self.verify = function (str) {
- if (self.data[str] == "") { return; }
- var data = {
- tablename: "SW_LDPSCBD",
- colums: "*",
- order: "ID desc",
- sqlwhere: {},
- sqlinwhere: "",
- sqllikewhere: ""
- }
- data.sqlwhere[str] = self.data[str]
- $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.data.length > 0 && self.data.ID != res.data[0].ID) {
- self.repeat = true;
- sp.dialog("标题已存在,请修改后重试!")
- } else {
- self.repeat = false;
- }
- })
- }
- //获取所有角色
- self.getRole = function () {
- var data = {
- unitid: "AA"
- }
- $http.post(apiurljs.login + "g2work/datazu/queryData",{ data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.roleList = res.data;
- })
- }
- self.getRole()
- //转发
- self.forward = function (obj) {
- self.btnItem = obj;
- if (self.filedChange == true) {
- self.btnSave(1)
- } else {
- $("#forwardWin").attr("src", "../../forward/forward.html?routeid=" + self.routeid + "&routeinfoid=" + self.routeinfoid + "©rightid=" + self.copyrightid + "&directionid=" + self.directionid + "&formeditid=" + self.formeditid + "&codefuncbutton=" + obj.CODE + "&directionidtarget=" + obj.DIRECTIONIDTARGET + "&cookie=shouwenbg")
- sp.layer("#forward")
- }
- }
- //查看流转记录
- self.RouteList = function () {
- if (self.deviceType == "pad") {
- window.location.href = "../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
- } else {
- sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
- }
- //var data = {
- // directionid: self.directionid,
- // userid: self.userId,
- // routeid: self.routeid,
- // routeinfoid: self.routeinfoid,
- //}
- //$http.post(apiurljs.login + "g2app/abase/queryDataRouteList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- //.success(function (obj) {
- // var res = strToJson(s4.decryptData_CBC(obj.data));
- // self.routeList = res.data;
- // $.each(self.routeList, function (index, item) {
- // item.mainUser = [];
- // item.copyUsers = [];
- // $.each(item.USERS, function (index1, item1) {
- // if (item1.KIND == 0) {
- // item.mainUser.push(item1.USERNAME);
- // } else {
- // item.copyUsers.push(item1.USERNAME);
- // }
- // })
- // item.mainUser = item.mainUser.join(",");
- // item.copyUsers = item.copyUsers.join(",");
- // })
- // setTimeout(function (item) {
- // sp.layer("#RouteList");
- // }, 100);
- //})
- }
- self.reSize = function (n) {
- var leftbox = document.getElementsByClassName("page-item")[n - 1];
- var rightbox = document.getElementsByClassName("page-item")[n];
- var line = document.getElementsByClassName("iframe-border-right")[n - 1];
- document.getElementsByClassName("iframe-border-right")[n - 1].addEventListener("mousedown", function (event) {
- $(".mousemove").show()
- var leftboxW = leftbox.clientWidth;//leftbox.style.width.slice(0, leftbox.style.width.length - 2);
- var rightboxW = rightbox.clientWidth;//rightbox.style.width.slice(0, rightbox.style.width.length - 2);
- var x = event.pageX - line.offsetLeft;
- document.addEventListener("mousemove", boxMove)
- function boxMove(event) {
- if (leftboxW * 1 + (event.pageX - x) * 1 <= 200) {
- //$(".leftBox").children().not(".iframe-border-right").hide()
- } else if (rightboxW * 1 - (event.pageX - x) * 1 <= 200) {
- //$(".rightBox").children().not(".iframe-border-right").hide()
- } else {
- leftbox.style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
- leftbox.getElementsByTagName("iframe")[0].style.width = leftboxW * 1 + (event.pageX - x) * 1 - 10 + "px";
- //$(".leftBox").children().not(".iframe-border-right").show()
- rightbox.style.width = rightboxW * 1 - (event.pageX - x) * 1 + "px";
- //rightbox.getElementsByTagName("iframe")[0].style.width = rightboxW * 1 - (event.pageX - x) * 1 - 10 + "px";
- //$(".rightBox").children().not(".iframe-border-right").show()
- }
- }
- document.addEventListener("mouseup", function () {
- $(".mousemove").hide()
- document.removeEventListener("mousemove", boxMove)
- })
- })
- }
- self.reSizeRow = function () {
- var bodybox = document.getElementById("bodyDiv");
- var topbox = document.getElementById("topDiv");
- var bottombox = document.getElementById("bottomDiv");
- var line = document.getElementById("lineDiv");
- document.getElementById("lineDiv").addEventListener("mousedown", function (event) {
- $(".mousemove").show()
- var bodyboxH = bodybox.clientHeight;
- var topboxH = topbox.clientHeight;
- var bottomboxH = bottombox.clientHeight;
- //var y = event.pageY - line.offsetTop;
- var y = event.pageY - line.clientHeight;
- document.addEventListener("mousemove", boxMove)
- function boxMove(event) {
- if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) {
- //
- } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) {
- //
- } else {
- topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px";
- topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px";
- bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 - 45 + "px";
- bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 - 75 + "px";
- }
- }
- document.addEventListener("mouseup", function () {
- $(".mousemove").hide()
- document.removeEventListener("mousemove", boxMove)
- })
- })
- }
- ////头部关键字搜索---20230905
- self.headBtnSearchKeyword = "";
- self.headSearchResult = [];
- self.headSearchResult_view = false;
- self.headBtnSearch = function () {
- if (sp.isval(self.headBtnSearchKeyword)) {
- self.headSearchResult = [];
- var data = {
- "url": "/basic/api/StatSelect/selectCodeList",
- "data": { "keyWord": self.headBtnSearchKeyword }
- }
- //console.log(JSON.stringify(data));
- $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- //console.log(JSON.stringify(res.data));
- self.headSearchResult = res.data.build;
- if (sp.isval(self.headSearchResult)) {
- self.headSearchResult_view = true;
- } else {
- self.headSearchResult_view = false;
- }
- })
- } else {
- self.headSearchResult_view = false;
- }
- };
- self.headKeywordPage = function (itemdata) {
- var get_token = localStorage.getItem("main-token");
- var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
- $('#attachlist')[0].contentWindow.openTool(set_url, '一张图');
- self.headSearchResult_view = false;
- };
- self.onePic = function () {
- $('#attachlist')[0].contentWindow.openTool(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索")
- }
- $scope.closeToggle = function () {
- $timeout(function () {
- self.opinion.nulla = false;
- self.activeOpinion = null;
- })
- }
- //头部下滚冻结
- $(function () {
- //页面高度撑满
- setTimeout(function () {
- $(".formedit").css("height", $(window).height() - 70)
- //$("#iframe_book").css("height", $(window).height() - 135)
- $(".iframe-border-right").css("height", $(window).height() - 34)
- $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
- }, 1)
- })
- }])
- app.directive('treeView', [function () {
- return {
- restrict: 'EA',
- templateUrl: '/treeView.html',
- scope: {
- treeData: '=',///声明数据
- textField: '@',
- itemAdd: '&', ///声明新增变量
- itemEdit: '&',///声明修改变量
- itemCheck: '&',///声明修改变量
- itemDelete: '&',///声明修改变量
- itemUp: '&',
- itemDown: '&'
- },
- controller: ['$scope', function ($scope) {
- $scope.itemExpended = function (item, $event) {
- item.$$isExpend = !item.$$isExpend;
- $event.stopPropagation();
- };
- ///展开折叠图标设置
- $scope.getItemIcon = function (item) {
- var isEnd = $scope.isEnd(item);
- if (isEnd) {
- return 'fa fa-paper-plane-o';
- }
- return item.$$isExpend ? 'fa fa-plus-square-o' : 'fa fa-minus-square-o';
- };
- ///判断是否是最后一级菜单
- $scope.isEnd = function (item) {
- return !item.C_H_I_L_D_DATA || !item.C_H_I_L_D_DATA.length;
- };
- ///事件调用返回
- $scope.warpCallback = function (callback, item, $index, $event) {
- ($scope[callback] || angular.noop)({
- $item: item,
- $index: $index,
- $event: $event
- });
- };
- }]
- };
- }]);
- app.directive("repeatFinish", function () {
- return {
- link: function (scope) {
- if (scope.$last == true) {
- $(".toggle").trigger("click")
- }
- }
- };
- });
- app.directive("spCheckboxBlueItem", function () {
- return {
- restrict: "A",
- link: function (scope, elem, attrs) {
- if (!scope == false) {
- spng.funcheckbox(elem, "chb-blue", "chb-blue-checked"); //蓝色checkbox
- }
- }
- }
- });
- app.filter('trustHtml', function ($sce) {
- return function (input) {
- return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, ' '));
- };
- });
- function showRight(e) {
- if ($(e).children(".fa-angle-left").is(":hidden")) {
- $(".leftBox").css("width", "99.5%");
- $("#iframe_book").css("width", "100%")
- $(".rightBox").css("width", "0%");
- $(".rightBox").hide()
- $(e).children(".fa-angle-left").show()
- $(e).children(".fa-angle-right").hide()
- } else {
- $(".leftBox").css("width", "69.5%");
- $("#iframe_book").css("width", "100%")
- $(".rightBox").css("width", "30%");
- $(".rightBox").show()
- $(e).children(".fa-angle-left").hide()
- $(e).children(".fa-angle-right").show()
- }
- }
- function showToggle(e) {
- document.getElementById("selectDiv").style.top = e.style.top;
- //document.getElementById("selectDiv").toggle();
- $(e).children().toggle()
- $(e).next().toggle()
- }
- function toggleYJL(e) {
- if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
- $(e).parent().css("height", 320)
- } else {
- $(e).parent().css("height", 10)
- angular.element(document.getElementById("app")).scope().closeToggle()
- }
- $(e).children().toggle()
- }
- function toggleForm(e) {
- $(e).children().toggle()
- $(".toggleForm").toggle()
- }
- //文字不可被选中
- //document.body.onselectstart = function () {
- // return true;
- //}
|