123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697 |
- 'use strict';
- var app = angular.module('app', [
- ]);
- app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$sce", "$interval", function ($scope, $http, $timeout, $sce, $interval) {
- 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 = []
- var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
- return item.CNAME
- })
- self.readonly = {
- XFFS: false,
- WLD: false,
- BHZL: false,
- WJH: false,
- ZS: false,
- ZS1: false,
- SXFBZ: false,
- SXFBZ1: false,
- SJZ: false,
- SJZ1: false,
- BMZ: false,
- BMZ1: false,
- JJFZCF: false,
- JJFFZCF: false,
- ZJWGW: false,
- WLMT: false,
- QT: false,
- BLFS: false,
- SFHF: false,
- XM: false,
- LXDH: false,
- SFZH: false,
- LXDZ: false,
- RS: false,
- JFR: false,
- JFLXRQ: false,
- //BKLDD: false,
- XFGM: false,
- XFMD: false,
- CFQK: false,
- DJCF: false,
- WTZY: false,
- WTFSD: false,
- WTFL: false,
- FLMX:false,
- YQBJRQ:false,
- CBDWBM: false,
- SFYHJ: false,
- SFSSQK: false,
- FCFH: false,
- SQSFHL: false,
- HLSQSFJJ: false,
- SFNP: false,
- HJFA: false,
- BFJTQK: false,
- SDYFCLQK: false,
- BALDJZW: false,
- NBYJ: false,
- FJ: false,
- JTJBR: false,
- BJRQ: false,
- BLJG: false,
- BLJGYJ: false,
- JGFJ: false,
- SHYJ: false,
- ZSJB: false,
- ZSJBRQ: false,
- BZ: false,
- NGR: false
- }
- //上层附件、业务参考、共享沟通组件
- self.arrayFile2 = null;
- self.arrayFile3 = [];
- self.uploading_zw = false;
- self.uploading = false;
- self.upload_zw = function () {
- $('#fileupload-zw').fileupload({
- url: apiurljs.login + (self.routeinfoid == 0 ? 'g2app/abase/uploadFileWithFormWithSaveRouteinfo' : '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.getOther()
- }
- }
- })
- }
- self.upload4 = function () {
- $('#fileupload4').fileupload({
- url: apiurljs.login + '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.arrayFile = [];
- self.beforeUpload = function () {
- if (self.data.ID == 0) {
- var dataArray = [];
- dataArray.push(self.data);
- var data = {
- ckey: "SX_XF",
- id: self.data.ID,
- routeid: self.routeid,
- routeinfoid: self.routeinfoid,
- routeinfotitle: self.data.WTZY,//self.data.TITLE,
- 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.getSwenList(1)
- self.upload()
- } else {
- sp.dialog(res.message)
- }
- })
- } else {
- self.upload()
- }
- }
- self.upload = function () {
- $('#fileupload').fileupload({
- url: apiurljs.login + 'g2app/abase/saveUploadFileName',
- dataType: 'json',
- beforeSend: function (xhr, data) {
- xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
- xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SX_XF,column=FJ,routeinfoid=" + self.routeinfoid + ",loaded=" + data.loaded + ",total=" + data.total));
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- var arrayFile = strToJson(s4.decryptData_CBC(data.result.data).slice(0, s4.decryptData_CBC(data.result.data).lastIndexOf("}") + 1))
- self.arrayFile = arrayFile.data;
- $scope.$apply();//绑定数据局部刷新
- }
- })
- $timeout(function () {
- $("#fileupload").trigger("click")
- }, 1)
- }
- //上传附件
- self.arrayFile1 = [];
- self.beforeUpload1 = function () {
- if (self.data.ID == 0) {
- var dataArray = [];
- dataArray.push(self.data);
- var data = {
- ckey: "SX_XF",
- id: self.data.ID,
- routeid: self.routeid,
- routeinfoid: self.routeinfoid,
- routeinfotitle: self.data.WTZY,//self.data.TITLE,
- 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.getSwenList(1)
- self.upload1()
- } else {
- sp.dialog(res.message)
- }
- })
- } else {
- self.upload1()
- }
- }
- self.upload1 = function () {
- $('#fileupload1').fileupload({
- url: apiurljs.login + 'g2app/abase/saveUploadFileName',
- dataType: 'json',
- beforeSend: function (xhr, data) {
- xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
- xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SX_XF,column=JGFJ,routeinfoid=" + self.routeinfoid + ",loaded=" + data.loaded + ",total=" + data.total));
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- var arrayFile = strToJson(s4.decryptData_CBC(data.result.data).slice(0, s4.decryptData_CBC(data.result.data).lastIndexOf("}") + 1))
- self.arrayFile1 = arrayFile.data;
- self.arrayFile1.forEach(function (item) {
- item.FILENAMES1 = item.FILENAMES.length > 10 ? item.FILENAMES.slice(0, 10) + "..." : item.FILENAMES
- })
- $scope.$apply();//绑定数据局部刷新
- }
- })
- $timeout(function () {
- $("#fileupload1").trigger("click")
- }, 1)
- }
- //导入
- self.upload3 = function () {
- $('#fileupload3').fileupload({
- url: apiurljs.login + 'g2app/xinfang/impZXBLGongDan',
- dataType: 'json',
- beforeSend: function (xhr, data) {
- xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
- },
- add: function (e, data) {
- var num = 0;
- var acceptFileTypes = /(xls|xlsx)$/i;
- //文件类型判断
- $.each(data.originalFiles, function (index, item) {
- if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
- sp.dialog("您好,请上传xls/xlsx格式的文件!");
- return;
- } else {
- num++
- }
- })
- if (num == data.originalFiles.length) {
- data.submit();
- }
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- var printData = strToJson(s4.decryptData_CBC(data.result.data)).data;
- self.data.CFQK = printData.CFQK;
- self.data.FLMX = printData.FLMX;
- self.data.JFLXRQ = printData.JFLXRQ;
- self.data.LXDH = printData.LXDH;
- self.data.SFZH = printData.SFZH;
- self.data.LXDZ = printData.LXDZ;
- self.data.SFHF = printData.SFHF;
- self.data.WJH = printData.WJH;
- self.data.WTFSD = printData.WTFSD;
- self.data.WTZY = printData.WTZY;
- self.data.XM = printData.XM;
- self.data.ZSJB = printData.ZSJB;
- $scope.$apply();//绑定数据局部刷新
- sp.layerhide()
- }
- })
- }
- 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.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?page=formedit&routeinfoid=" + self.routeinfoid)
- }
- }
- 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) {
- if (item.TEMPFORM.indexOf("formedit.html") > -1) {
- self.Title = item.VNAME;
- }
- if (item.TEMPFORM.indexOf("?docmode") > 0) {
- if (item.TEMPFORM.indexOf("attachlist") > -1 || item.TEMPFORM.indexOf("feedback") > -1) {
- item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
- } else {
- 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.getCode()
- })
- }
- self.getCode = function () {
- var list = ['XFFS', 'BHZL', 'ZS', 'SXFBZ', 'SJZ', 'BMZ', 'LDQD', 'ZS1', 'SJZ1', 'BMZ1', 'JJFZCF', 'JJFFZCF', 'ZJWGW', 'WLMT', 'SXFBZ1', 'QT', 'BLFS', 'XFGM', 'XFMD', 'CFQK', 'WTFSD', 'WTFL', 'SFYHJ', 'SFSSQK', 'FCFH', 'SQSFHL', 'HLSQSFJJ', 'SFNP', 'BLJG', 'ZSJB', 'SFHF'];
- var data = {
- columns: list.join("|"),
- cname: "SX_XF"
- }
- $http.post(apiurljs.login + "g2app/xinfang/getColumnsCodeData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- res.data.forEach(function (item) {
- list.forEach(function (item1) {
- if (Object.keys(item) == item1) {
- self[item1] = Object.values(item)[0];
- }
- })
- })
- self.WTFL.forEach(function (item) {
- item.checked = false;
- })
- self.getFLMX(0)
- })
- }
- self.getFLMX = function (n) {
- if (n == 0) {
- var data = {
- ckey: "CODE_XFFLMX",
- 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.FLMX = res.data.CODE_XFFLMX;
- self.getDpList()
- })
- }
- else {
- if (self.data.WTFL == "") {
- var arr = self.FLMX;
- } else {
- var arr = self.FLMX.filter(function (item) {
- if (self.data.WTFL.indexOf(item.PID) > -1) {
- return item
- }
- })
- }
- var n = 0;
- self.FLMX1 = [[{}, {}, {}, {}]];
- for (var i = 1; i <= arr.length; i++) {
- arr[i - 1].index = arr[i - 1].CODE.slice(1)
- if (n == Math.ceil(i / 4) - 1) {
- self.FLMX1[n][(i - 1) % 4] = arr[i - 1];
- } else {
- n = Math.ceil(i / 4) - 1
- self.FLMX1[n] = [{}, {}, {}, {}];
- self.FLMX1[n][(i - 1) % 4] = arr[i - 1];
- }
- }
- }
- }
- 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 = {
- CBDWBM: JSON.parse(JSON.stringify(self.dpList))
- }
- self.AllCheckedDp = {};
- self.DpLength = {};
- self.selectDpList = {};
- self.getUserList()
- })
- }
- self.UserList = {
- JTJBR: [],
- WLD: []
- };
- self.AllChecked = {};
- self.UserLength = {};
- self.selectList = {};
- self.getUserList = function () {
- var data = {
- dpcode:""
- }
- $http.post(apiurljs.login + "g2app/dataabase/getDpListByCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- var array = [];
- res.data.forEach(function (item) {
- array = array.concat(item)
- })
- array.forEach(function (item) {
- item.checked = false;
- if (item.USER) {
- item.USER.forEach(function (item1) {
- item1.checked = false;
- item1.USHOWNAME1 = item1.USHOWNAME.length > 3 ? item1.USHOWNAME.slice(0, 3) + "..." : item1.USHOWNAME;
- item1.USHOWNAME2 = item1.USHOWNAME.length > 10 ? item1.USHOWNAME.slice(0, 10) + "..." : item1.USHOWNAME
- })
- }
- item.CHILD_DATA.forEach(function (item2) {
- item2.checked = false;
- if (item2.USER) {
- item2.USER.forEach(function (item3) {
- item3.checked = false;
- item3.USHOWNAME1 = item3.USHOWNAME.length > 3 ? item3.USHOWNAME.slice(0, 3) + "..." : item3.USHOWNAME;
- item3.USHOWNAME2 = item3.USHOWNAME.length > 10 ? item3.USHOWNAME.slice(0, 10) + "..." : item3.USHOWNAME
- })
- }
- item2.CHILD_DATA.forEach(function (item4) {
- item4.checked = false;
- if (item4.USER) {
- item4.USER.forEach(function (item5) {
- item5.checked = false;
- item5.USHOWNAME1 = item5.USHOWNAME.length > 3 ? item5.USHOWNAME.slice(0, 3) + "..." : item5.USHOWNAME;
- item5.USHOWNAME2 = item5.USHOWNAME.length > 10 ? item5.USHOWNAME.slice(0, 10) + "..." : item5.USHOWNAME
- })
- }
- })
- })
- })
- self.UserList.JTJBR = JSON.parse(JSON.stringify(array));
- self.getUserList1()
- })
- }
- self.getUserList1 = function () {
- var data = {
- dpcode: 'AA03'
- }
- $http.post(apiurljs.login + "g2app/dataabase/getDpListByCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- var array = [];
- res.data.forEach(function (item) {
- array = array.concat(item)
- })
- array.forEach(function (item) {
- item.checked = false;
- if (item.USER) {
- item.USER.forEach(function (item1) {
- item1.checked = false;
- item1.USHOWNAME1 = item1.USHOWNAME.length > 3 ? item1.USHOWNAME.slice(0, 3) + "..." : item1.USHOWNAME;
- item1.USHOWNAME2 = item1.USHOWNAME.length > 10 ? item1.USHOWNAME.slice(0, 10) + "..." : item1.USHOWNAME
- })
- }
- item.CHILD_DATA.forEach(function (item2) {
- item2.checked = false;
- if (item2.USER) {
- item2.USER.forEach(function (item3) {
- item3.checked = false;
- item3.USHOWNAME1 = item3.USHOWNAME.length > 3 ? item3.USHOWNAME.slice(0, 3) + "..." : item3.USHOWNAME;
- item3.USHOWNAME2 = item3.USHOWNAME.length > 10 ? item3.USHOWNAME.slice(0, 10) + "..." : item3.USHOWNAME
- })
- }
- item2.CHILD_DATA.forEach(function (item4) {
- item4.checked = false;
- if (item4.USER) {
- item4.USER.forEach(function (item5) {
- item5.checked = false;
- item5.USHOWNAME1 = item5.USHOWNAME.length > 3 ? item5.USHOWNAME.slice(0, 3) + "..." : item5.USHOWNAME;
- item5.USHOWNAME2 = item5.USHOWNAME.length > 10 ? item5.USHOWNAME.slice(0, 10) + "..." : item5.USHOWNAME
- })
- }
- })
- })
- })
- self.UserList.WLD = JSON.parse(JSON.stringify(array));
- self.getData()
- })
- }
- //获取数据
- self.getData = function () {
- var data = {
- ckey: "SX_XF",
- 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 = {
- ID: res.data.SX_XF.ID,
- APPCODE: res.data.SX_XF.APPCODE,
- XFFS: res.data.SX_XF.XFFS == "" ? self.XFFS[0].CODE : res.data.SX_XF.XFFS,
- WLD: res.data.SX_XF.WLD,
- BHZL: res.data.SX_XF.BHZL == "" ? self.BHZL[0].CODE : res.data.SX_XF.BHZL,
- WJH: res.data.SX_XF.WJH,
- ZS: res.data.SX_XF.ZS == "" ? self.ZS[0].CODE : res.data.SX_XF.ZS,
- ZS1: res.data.SX_XF.ZS1 == "" ? self.ZS1[0].CODE : res.data.SX_XF.ZS1,
- SXFBZ: res.data.SX_XF.SXFBZ == "" ? self.SXFBZ[0].CODE : res.data.SX_XF.SXFBZ,
- SXFBZ1: res.data.SX_XF.SXFBZ1 == "" ? self.SXFBZ1[0].CODE : res.data.SX_XF.SXFBZ1,
- SJZ: res.data.SX_XF.SJZ == "" ? self.SJZ[0].CODE : res.data.SX_XF.SJZ,
- SJZ1: res.data.SX_XF.SJZ1 == "" ? self.SJZ1[0].CODE : res.data.SX_XF.SJZ1,
- BMZ: res.data.SX_XF.BMZ == "" ? self.BMZ[0].CODE : res.data.SX_XF.BMZ,
- BMZ1: res.data.SX_XF.BMZ1 == "" ? self.BMZ1[0].CODE : res.data.SX_XF.BMZ1,
- JJFZCF: res.data.SX_XF.JJFZCF == "" ? self.JJFZCF[0].CODE : res.data.SX_XF.JJFZCF,
- JJFFZCF: res.data.SX_XF.JJFFZCF == "" ? self.JJFFZCF[0].CODE : res.data.SX_XF.JJFFZCF,
- ZJWGW: res.data.SX_XF.ZJWGW == "" ? self.ZJWGW[0].CODE : res.data.SX_XF.ZJWGW,
- WLMT: res.data.SX_XF.WLMT == "" ? self.WLMT[0].CODE : res.data.SX_XF.WLMT,
- QT: res.data.SX_XF.QT == "" ? self.QT[0].CODE : res.data.SX_XF.QT,
- BLFS: res.data.SX_XF.BLFS == "" ? self.BLFS[0].CODE : res.data.SX_XF.BLFS,
- SFHF: res.data.SX_XF.SFHF == "" ? self.SFHF[0].CODE : res.data.SX_XF.SFHF,
- LDQD: res.data.SX_XF.LDQD == "" ? self.LDQD[0].CODE : res.data.SX_XF.LDQD,
- XM: res.data.SX_XF.XM,
- LXDH: res.data.SX_XF.LXDH,
- SFZH: res.data.SX_XF.SFZH,
- LXDZ: res.data.SX_XF.LXDZ,
- RS: parseInt(res.data.SX_XF.RS),
- JFR: res.data.SX_XF.JFR,
- JFLXRQ: res.data.SX_XF.JFLXRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.SX_XF.JFLXRQ),
- //BKLDD: res.data.SX_XF.BKLDD,
- XFGM: res.data.SX_XF.XFGM == "" ? self.XFGM[0].CODE : res.data.SX_XF.XFGM,
- XFMD: res.data.SX_XF.XFMD == "" ? self.XFMD[0].CODE : res.data.SX_XF.XFMD,
- CFQK: res.data.SX_XF.CFQK == "" ? self.CFQK[0].CODE : res.data.SX_XF.CFQK,
- DJCF: res.data.SX_XF.DJCF,
- WTZY: res.data.SX_XF.WTZY,
- WTFSD: res.data.SX_XF.WTFSD == "" ? self.WTFSD[0].CODE : res.data.SX_XF.WTFSD,
- WTFL: res.data.SX_XF.WTFL == "" ? "" : res.data.SX_XF.WTFL,
- FLMX: res.data.SX_XF.FLMX,
- YQBJRQ: res.data.SX_XF.YQBJRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.SX_XF.YQBJRQ),
- DBSX: res.data.SX_XF.DBSX == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.SX_XF.DBSX),
- CBDWBM: res.data.SX_XF.CBDWBM,
- SFYHJ: res.data.SX_XF.SFYHJ == "" ? self.SFYHJ[0].CODE : res.data.SX_XF.SFYHJ,
- SFSSQK: res.data.SX_XF.SFSSQK == "" ? self.SFSSQK[0].CODE : res.data.SX_XF.SFSSQK,
- FCFH: res.data.SX_XF.FCFH == "" ? self.FCFH[0].CODE : res.data.SX_XF.FCFH,
- SQSFHL: res.data.SX_XF.SQSFHL == "" ? self.SQSFHL[0].CODE : res.data.SX_XF.SQSFHL,
- HLSQSFJJ: res.data.SX_XF.HLSQSFJJ == "" ? self.HLSQSFJJ[0].CODE : res.data.SX_XF.HLSQSFJJ,
- SFNP: res.data.SX_XF.SFNP == "" ? self.SFNP[0].CODE : res.data.SX_XF.SFNP,
- HJFA: res.data.SX_XF.HJFA,
- BFJTQK: res.data.SX_XF.BFJTQK,
- SDYFCLQK: res.data.SX_XF.SDYFCLQK,
- BALDJZW: res.data.SX_XF.BALDJZW,
- JTJBR: res.data.SX_XF.JTJBR,
- BJRQ: res.data.SX_XF.BJRQ == "" ? "" : sp.format(res.data.SX_XF.BJRQ),
- BLJG: res.data.SX_XF.BLJG == "" ? self.BLJG[0].CODE : res.data.SX_XF.BLJG,
- ZSJB: res.data.SX_XF.ZSJB == "" ? self.ZSJB[0].CODE : res.data.SX_XF.ZSJB,
- ZSJBRQ: res.data.SX_XF.ZSJBRQ == "" ? "" : sp.format(res.data.SX_XF.ZSJBRQ),
- BZ: res.data.SX_XF.BZ,
- NGR: res.data.SX_XF.NGR == "" ? self.userName : res.data.SX_XF.NGR,
- NBYJ: res.data.SX_XF.NBYJ,
- SHYJ: res.data.SX_XF.SHYJ,
- BLJGYJ: res.data.SX_XF.BLJGYJ,
- }
- self.readonly = {
- XFFS: res.data.SX_XF["XFFS.EREADONLY"] == "true",
- WLD: res.data.SX_XF["WLD.EREADONLY"] == "true",
- BHZL: res.data.SX_XF["BHZL.EREADONLY"] == "true",
- WJH: res.data.SX_XF["WJH.EREADONLY"] == "true",
- ZS: res.data.SX_XF["ZS.EREADONLY"] == "true",
- ZS1: res.data.SX_XF["ZS1.EREADONLY"] == "true",
- SXFBZ: res.data.SX_XF["SXFBZ.EREADONLY"] == "true",
- SXFBZ1: res.data.SX_XF["SXFBZ1.EREADONLY"] == "true",
- SJZ: res.data.SX_XF["SJZ.EREADONLY"] == "true",
- SJZ1: res.data.SX_XF["SJZ1.EREADONLY"] == "true",
- BMZ: res.data.SX_XF["BMZ.EREADONLY"] == "true",
- BMZ1: res.data.SX_XF["BMZ1.EREADONLY"] == "true",
- JJFZCF: res.data.SX_XF["JJFZCF.EREADONLY"] == "true",
- JJFFZCF: res.data.SX_XF["JJFFZCF.EREADONLY"] == "true",
- ZJWGW: res.data.SX_XF["ZJWGW.EREADONLY"] == "true",
- WLMT: res.data.SX_XF["WLMT.EREADONLY"] == "true",
- QT: res.data.SX_XF["QT.EREADONLY"] == "true",
- BLFS: res.data.SX_XF["BLFS.EREADONLY"] == "true",
- SFHF: res.data.SX_XF["SFHF.EREADONLY"] == "true",
- LDQD: res.data.SX_XF["LDQDZS1.EREADONLY"] == "true",
- XM: res.data.SX_XF["XM.EREADONLY"] == "true",
- LXDH: res.data.SX_XF["LXDH.EREADONLY"] == "true",
- SFZH: res.data.SX_XF["SFZH.EREADONLY"] == "true",
- LXDZ: res.data.SX_XF["LXDZ.EREADONLY"] == "true",
- RS: res.data.SX_XF["RS.EREADONLY"] == "true",
- JFR: res.data.SX_XF["JFR.EREADONLY"] == "true",
- JFLXRQ: res.data.SX_XF["JFLXRQ.EREADONLY"] == "true",
- //BKLDD: res.data.SX_XF["BKLDD.EREADONLY"] == "true",
- XFGM: res.data.SX_XF["XFGM.EREADONLY"] == "true",
- XFMD: res.data.SX_XF["XFMD.EREADONLY"] == "true",
- CFQK: res.data.SX_XF["CFQK.EREADONLY"] == "true",
- DJCF: res.data.SX_XF["DJCF.EREADONLY"] == "true",
- WTZY: res.data.SX_XF["WTZY.EREADONLY"] == "true",
- WTFSD: res.data.SX_XF["WTFSD.EREADONLY"] == "true",
- WTFL: res.data.SX_XF["WTFL.EREADONLY"] == "true",
- FLMX: res.data.SX_XF["FLMX.EREADONLY"] == "true",
- YQBJRQ: res.data.SX_XF["YQBJRQ.EREADONLY"] == "true",
- CBDWBM: res.data.SX_XF["CBDWBM.EREADONLY"] == "true",
- SFYHJ: res.data.SX_XF["SFYHJ.EREADONLY"] == "true",
- SFSSQK: res.data.SX_XF["SFSSQK.EREADONLY"] == "true",
- FCFH: res.data.SX_XF["FCFH.EREADONLY"] == "true",
- SQSFHL: res.data.SX_XF["SQSFHL.EREADONLY"] == "true",
- HLSQSFJJ: res.data.SX_XF["HLSQSFJJ.EREADONLY"] == "true",
- SFNP: res.data.SX_XF["SFNP.EREADONLY"] == "true",
- HJFA: res.data.SX_XF["HJFA.EREADONLY"] == "true",
- BFJTQK: res.data.SX_XF["BFJTQK.EREADONLY"] == "true",
- SDYFCLQK: res.data.SX_XF["SDYFCLQK.EREADONLY"] == "true",
- BALDJZW: res.data.SX_XF["BALDJZW.EREADONLY"] == "true",
- NBYJ: res.data.SX_XF["NBYJ.EREADONLY"] == "true",
- FJ: res.data.SX_XF["FJ.EREADONLY"] == "true",
- JTJBR: res.data.SX_XF["JTJBR.EREADONLY"] == "true",
- BJRQ: res.data.SX_XF["BJRQ.EREADONLY"] == "true",
- BLJG: res.data.SX_XF["BLJG.EREADONLY"] == "true",
- BLJGYJ: res.data.SX_XF["BLJGYJ.EREADONLY"] == "true",
- JGFJ: res.data.SX_XF["JGFJ.EREADONLY"] == "true",
- SHYJ: res.data.SX_XF["SHYJ.EREADONLY"] == "true",
- ZSJB: res.data.SX_XF["ZSJB.EREADONLY"] == "true",
- ZSJBRQ: res.data.SX_XF["ZSJBRQ.EREADONLY"] == "true",
- BZ: res.data.SX_XF["BZ.EREADONLY"] == "true",
- NGR: res.data.SX_XF["NGR.EREADONLY"] == "true"
- }
- self.FLMXlist = self.data.FLMX != "" ? self.data.FLMX.split(",") : [];
- if (self.data.ID == 0) {
- self.filedChange = true;
- } else {
- self.filedChange = false;
- }
- if (res.data.SX_XF.FJ && res.data.SX_XF.FJ != "") {
- self.arrayFile = JSON.parse(res.data.SX_XF.FJ);
- }
- if (res.data.SX_XF.JGFJ && res.data.SX_XF.JGFJ != "") {
- self.arrayFile1 = JSON.parse(res.data.SX_XF.JGFJ);
- self.arrayFile1.forEach(function (item) {
- item.FILENAMES1 = item.FILENAMES.length > 10 ? item.FILENAMES.slice(0, 10) + "..." : item.FILENAMES
- })
- }
- self.WTFL.forEach(function (item) {
- item.checked = false;
- if (self.data.WTFL.indexOf(item.CODE) > -1) {
- item.checked = true;
- }
- })
- self.getFLMX(1)
- self.buttonList = res.data["SX_XF.FUNCLIST"];
- var n = {}, all = {};
- for (var i in self.UserList) {
- self.AllChecked[i] = false;
- self.UserLength[i] = 0;
- self.selectList[i] = []
- n[i] = [];
- all[i] = 0;
- $.each(self.UserList[i], function (index, item) {
- n[i].push({ n: 0, array: [] })
- if (item.USER) {
- $.each(item.USER, function (index1, item1) {
- self.UserLength[i]++
- if (self.data.JTJBR.indexOf(item1.USHOWNAME) != -1 && i == "JTJBR") {
- n[i][index].n++;
- item1.checked = true;
- self.selectList[i].push(item1);
- }
- if (self.data.WLD.indexOf(item1.USHOWNAME) != -1 && i == "WLD") {
- n[i][index].n++;
- item1.checked = true;
- self.selectList[i].push(item1);
- }
- })
- if (n[i][index].n == item.USER.length && n[i][index].n != 0) {
- item.checked = true;
- all[i]++;
- } else {
- item.checked == false;
- }
- }
- $.each(item.CHILD_DATA, function (index2, item2) {
- n[i][index].array.push({ n: 0, array: [] })
- if (item2.USER) {
- $.each(item2.USER, function (index3, item3) {
- self.UserLength[i]++
- if (self.data.JTJBR.indexOf(item3.USHOWNAME) != -1 && i == "JTJBR") {
- n[i][index].array[index2].n++;
- item3.checked = true;
- self.selectList[i].push(item3);
- }
- if (self.data.WLD.indexOf(item3.USHOWNAME) != -1 && i == "WLD") {
- n[i][index].array[index2].n++;
- item3.checked = true;
- self.selectList[i].push(item3);
- }
- })
- if (n[i][index].array[index2].n == item2.USER.length && n[i][index].array[index2] != 0) {
- item.checked = true;
- all[i]++;
- } else {
- item.checked == false;
- }
- }
- $.each(item2.CHILD_DATA, function (index4, item4) {
- n[i][index].array[index2].array.push(0)
- if (item4.USER) {
- $.each(item4.USER, function (index5, item5) {
- self.UserLength[i]++
- if (self.data.JTJBR.indexOf(item5.USHOWNAME) != -1 && i == "JTJBR") {
- n[i][index].array[index2].array[index4]++;
- item5.checked = true;
- self.selectList[i].push(item5);
- }
- if (self.data.WLD.indexOf(item5.USHOWNAME) != -1 && i == "WLD") {
- n[i][index].array[index2].array[index4]++;
- item5.checked = true;
- self.selectList[i].push(item5);
- }
- })
- }
- if (n[i][index].array[index2].array[index4] == item4.USER.length && n[i][index].array[index2].array[index4] != 0) {
- item.checked = true;
- all[i]++;
- } else {
- item.checked == false;
- }
- })
- })
- })
- if (all[i] == self.UserList[i].length) {
- self.AllChecked[i] = true;
- } else {
- self.AllChecked[i] = false;
- }
- }
- 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.CBDWBM.indexOf(item.SECTION) != -1 && i == "CBDWBM") {
- 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.getOpinion('NBYJ')
- self.getOpinion('SHYJ')
- self.getOpinion('BLJGYJ')
- self.getOpinion1()
- self.getOther()
- self.getSFZ()
- //watermark({
- // "watermarl_element": "app",
- // "watermark_txt": "测试水印内容",
- // "watermark_width": 150,
- // "watermark_height": 110,
- // "watermark_angle": 345
- //})
- })
- }
- //获取其他人员身份证
- self.getSFZ = function () {
- var data = {
- tablename: "SX_XF_01",
- colums: "*",
- order: "ID desc",
- sqlwhere: { PID: self.data.ID },
- 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.qtrySFZ = res.data;
- })
- }
- self.delQTSFZ = function (id) {
- var data = {
- tablename: "SX_XF_01",
- id: 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));
- self.getSFZ();
- });
- }
- //获取附件和插件
- self.getOther = function () {
- if (self.routeinfoid == 0) { return }
- var data = {
- tablename: "FILE_ATTACH",
- colums: "*",
- order: "ID desc",
- 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.arrayFile3 = [];
- if (res.data.length > 0) {
- res.data.forEach(function (item) {
- if (item.ATTACHTYPE != null && item.ATTACHTYPE.indexOf("-正文") > -1) {
- self.arrayFile2 = item;
- } else {
- self.arrayFile3.push(item)
- }
- })
- self.goAttach()
- }
- })
- }
- //获取意见(上表)
- self.getOpinion = function (str) {
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: "",//self.routeid,
- tableid: "SX_XF",
- colid: str,
- opiniontype: 0,
- 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[str] = res.data;
- self.YJ[str + "STATUS"] = false;
- self.YJ[str].forEach(function (item) {
- item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
- if (item.ROUTEID == self.routeid) {
- self.YJ[str + "STATUS"] = true;
- }
- })
- } else {
- sp.dialog(res.message)
- }
- })
- }
- //获取意见(不上表)
- self.opiniontype = 99;
- self.getOpinion1 = function () {
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: "",//self.routeid,
- tableid: "SX_XF",
- 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 (item.ROUTEID == self.routeid && item.COLID == "") {
- // self.YJ.nullaSTATUS = true;
- //}
- })
- } else {
- sp.dialog(res.message)
- }
- })
- }
- //判断页面字段是否只读readonly、是否隐藏show
- 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) {
- 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 "PAIZHAO": self.openGP(); break;
- case "SENDLOG": self.RouteList(); break;
- default: self.forward(item); break;
- }
- }
- self.checkWTFL = function (obj) {
- obj.checked = !obj.checked;
- var arr = [];
- self.WTFL.forEach(function (item) {
- if (item.checked == true) {
- arr.push(item.CODE)
- }
- })
- self.data.WTFL = arr.join(",")
- self.changeFiled("WTFL");
- self.getFLMX(1)
- }
- 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(",")
- self.AllCheckedDp[self.filed] = AllCheckedLength1 == self.DpLength[self.filed];
- self.changeFiled(self.filed)
- if (n == 0) {
- sp.layerhide();
- }
- }
- self.openUserList = function (str) {
- if (self.hide("readonly", str) == true) {
- return
- } else {
- self.filed = str;
- //self.AllChecked[self.filed] = false;
- sp.layer("#userList")
- $("#userList .sp-page").eq(0).scrollTop(0);
- }
- }
- self.checkAllUser = function () {
- self.AllChecked[self.filed] = !self.AllChecked[self.filed];
- $.each(self.UserList[self.filed], function (index, item) {
- item.checked = self.AllChecked[self.filed];
- if (item.USER) {
- item.USER.forEach(function (item1) {
- item1.checked = self.AllChecked[self.filed];
- })
- }
- item.CHILD_DATA.forEach(function (item2) {
- item2.checked = self.AllChecked[self.filed];
- if (item2.USER) {
- item2.USER.forEach(function (item3) {
- item3.checked = self.AllChecked[self.filed];
- })
- }
- item2.CHILD_DATA.forEach(function (item4) {
- item4.checked = self.AllChecked[self.filed];
- if (item4.USER) {
- item4.USER.forEach(function (item5) {
- item5.checked = self.AllChecked[self.filed];
- })
- }
- })
- })
- })
- self.submitUserList(1)
- }
- self.checkUserItem = function (item) {
- item.checked = !item.checked;
- $.each(item.USER, function (index, item1) {
- item1.checked = item.checked;
- })
- self.submitUserList(1)
- }
- self.checkUser = function (a,b) {
- a.checked = !a.checked;
- console.log(b)
- var n = 0;
- $.each(b.USER, function (x, y) {
- if (y.checked == true) {
- n++
- }
- if (n == b.USER.length && n != 0) {
- b.checked = true;
- } else {
- b.checked = false;
- }
- })
- self.submitUserList(1)
- }
- self.submitUserList = function (n) {
- var AllCheckedLength = 0;
- self.UserLength[self.filed] = 0;
- self.selectList[self.filed] = [];
- $.each(self.UserList[self.filed], function (index, item) {
- if (item.USER) {
- item.USER.forEach(function (item1) {
- self.UserLength[self.filed]++;
- if (item1.checked == true) {
- AllCheckedLength++;
- self.selectList[self.filed].push(item1)
- }
- })
- }
- item.CHILD_DATA.forEach(function (item2) {
- if (item2.USER) {
- item2.USER.forEach(function (item3) {
- self.UserLength[self.filed]++;
- if (item3.checked == true) {
- AllCheckedLength++;
- self.selectList[self.filed].push(item3)
- }
- })
- }
- item2.CHILD_DATA.forEach(function (item4) {
- if (item4.USER) {
- item4.USER.forEach(function (item5) {
- self.UserLength[self.filed]++;
- if (item5.checked == true) {
- AllCheckedLength++;
- self.selectList[self.filed].push(item5)
- }
- })
- }
- })
- })
- })
- self.data[self.filed] = self.selectList[self.filed].map(function (item) {
- return item.USHOWNAME
- }).join(",")
- if (self.data[self.filed + "ID"] != undefined) {
- self.data[self.filed + "ID"] = self.selectList[self.filed].map(function (item) {
- return item.USERID
- }).join(",")
- }
- self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed];
- self.changeFiled(self.filed)
- if (n == 0) {
- sp.layerhide();
- }
- }
- self.clickFLMX = function (obj) {
- if (self.hide("readonly", "FLMX") == true) {
- return;
- } else {
- if (self.FLMXlist.indexOf(obj.CODE) == -1) {
- self.FLMXlist.push(obj.CODE)
- } else {
- self.FLMXlist.splice(self.FLMXlist.indexOf(obj.CODE), 1)
- }
- console.log(self.FLMXlist)
- self.data.FLMX = self.FLMXlist.join(",");
- }
- }
- //保存提交
- self.btnSave = function (n) {
- if (spngvld.submit(".sp-page-center")) {
- var dataArray = [];
- self.data.NBYJ = "";
- self.data.SHYJ = "";
- self.data.BLJGYJ = "";
- self.data.DBSX = self.data.YQBJRQ;
- dataArray.push(self.data);
- var data = {
- ckey: "SX_XF",
- id: self.data.ID,
- routeid: self.routeid,
- routeinfoid: self.routeinfoid,
- routeinfotitle: self.data.WTZY.replace(/\n/g, '').replace(/\s/g, ''),
- 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 if (n == 4) {
- self.submitSFZ()
- }
- } else {
- sp.dialog(res.message)
- }
- })
- }
- }
- //打印
- self.btnPrint = function () {
- // 创建隐藏的可下载链接
- var eleLink = document.createElement('a');
- eleLink.download = "";
- eleLink.style.display = 'none';
- eleLink.href = apiurljs.login + "g2app/shouwen/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=XZGZDT.ftl&tablename=SX_XF&outfilepath=/tmp/信访表单.wps&prtdate=RIQI&routeinfoid=" + self.routeinfoid));
- // 触发点击
- document.body.appendChild(eleLink);
- eleLink.click();
- // 然后移除
- document.body.removeChild(eleLink);
- //window.open(apiurljs.login + "g2app/shouwen/PrintWord?templatefilename=shouwen.ftl&tablename=SX_XF&outfilepath=" + apiurljs.print + "&routeinfoid=" + self.routeinfoid)
- }
- /*综合打印*/
- 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 = "moban58"
- } else if (self.printFiled == 2) {
- var templatefilename = "mobanoption"
- } else {
- var templatefilename = "moban58_all"
- }
- var data = {
- templatefilename: templatefilename + ".ftl",
- outfilepath: "/tmp/信访表单" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
- routeinfoid: self.routeinfoid,
- tablename: "SX_XF",
- printtype: self.printFiled,
- printdate: "JFLXRQ,YQBJRQ,BJRQ,ZSJBRQ"
- }
- $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));
- 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.download = function (item) {
- window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
- }
- //弹窗查看
- self.seeFile = false;
- self.seeFileItem = {};
- self.seeFiles = function (item) {
- self.seeFile = true;
- if (self.seeFileItem.FILEID == item.FILEID) {
- return;
- } else {
- self.seeFileItem = item
- self.goAttach(self.seeFileItem)
- //var set_convertType = 0;
- //if (item.FILEEXT == "doc") {
- // set_convertType = 0;
- //} else if (item.FILEEXT == "pdf") {
- // set_convertType = 20;
- //} else if (item.FILEEXT == "ofd") {
- // set_convertType = 570;
- //} else {
- // set_convertType = 0;
- //}
- //let postData = {
- // convertType: set_convertType,
- // fileUrl: apiurljs.login + "g2work/files2/inline/" + (item.FILEURL ? item.FILEURL.slice(7) : item.FILEPATH.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) {
- // $("#seeFile").attr("src", res.data.viewUrl);
- // } else {
- // sp.dialog(res.message);
- // }
- //});
- }
- }
- //删除附件
- self.deleteFile1 = function (item, str) {
- var data = {
- tablename: "SX_XF",
- column: str,
- routeinfoid: self.routeinfoid,
- fileid: item.FILEID,
- filenames: item.FILEOLDNAME
- }
- $http.post(apiurljs.login + "g2app/abase/deleteUploadFileName", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success == true) {
- if (str == "FJ") {
- self.arrayFile = res.data;
- } else {
- self.arrayFile1 = res.data;
- self.arrayFile1.forEach(function (item) {
- item.FILENAMES1 = item.FILENAMES.length > 10 ? item.FILENAMES.slice(0, 10) + "..." : item.FILENAMES
- })
- }
- } else {
- sp.dialog(res.message)
- }
- })
- }
- //签写意见编辑状态
- self.opinion = {
- NBYJ: false,
- NBYJImg: false,
- SHYJ: false,
- SHYJImg: false,
- BLJGYJ: false,
- BLJGYJImg:false,
- nulla: false
- }
- self.YJ = {
- NBYJ: [],
- NBYJSTATUS: false,
- SHYJ: [],
- SHYJSTATUS: false,
- BLJGYJ: [],
- BLJGYJSTATUS: false,
- nulla: [],
- nullaSTATUS: false
- }
- //意见(下表)
- self.openOptionList = function () {
- if (self.routeinfoid == 0 && self.routeid == 0) {
- sp.dialog("请先保存!")
- return;
- }
- if (self.opinion.nulla == true) {
- return;
- }
- self.nulla = "";
- $(".optionList").css("height", 149)
- self.opinion.nulla = true;
- }
- self.closeOptionList = function () {
- $(".optionList").css("height", 389)
- self.opinion.nulla = false;
- }
- self.submitOptionList = function () {
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: self.routeid,
- tableid: "SX_XF",
- colid: "",
- opiniontype: 99,
- cresult: "",
- opinion: self.nulla,
- opinionimage: ""
- }
- $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- if (res.success == true) {
- self.getOpinion1();
- self.opinion.nulla = false;
- $(".optionList").css("height", 389)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- self.changeOptionList = function (item) {
- self.nulla = item.OPINION;
- self.opinion.nulla = true;
- }
- //意见附件(下表)
- self.uploading1 = false;
- self.upload_fy = function () {
- $('#fileupload_fy').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=SX_XF"));
- },
- // 上传完成后的执行逻辑
- 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, str) {
- var data = {
- routeid: file.ROUTEID,
- tableid: "SX_XF",
- colid: str,
- 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) {
- if (str != "") {
- self.getOpinion(str);
- } else {
- self.getOpinion1();
- }
- } else {
- sp.dialog("删除失败,请联系管理员!");
- }
- });
- }
- //意见附件(上表)
- self.upload2 = function (str) {
- $('#fileupload-' + str).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=SX_XF,colid=" + str));
- },
- // 上传完成后的执行逻辑
- done: function (e, data) {
- self.uploading1 = false;
- self.getOpinion(str)
- }
- })
- }
- //签写意见
- self.openOpinion = function (str) {
- if (self.routeinfoid == 0 && self.routeid == 0) {
- sp.dialog("请先保存!")
- return;
- }
- self.opinion[str] = true;
- }
- //修改意见
- self.changeOpinion = function (str) {
- self.data[str] = self.YJ[str][0].OPINION;
- self.opinion[str] = true;
- }
- self.changeOpinionItem = function (str, item) {
- if (item.OPINIONIMAGE != "") {
- self.QianZi(str);
- self.opinion[str + "Img"] = true;
- }
- self.data[str] = item.OPINION;
- self.opinion[str] = true;
- }
- //提交意见
- self.Sopinion = function (str) {
- if (self.opinion[str + "Img"] == true) {
- self.data[str] = $("#" + str + "QZ").find("canvas")[0].toDataURL();
- } else {
- self.data[str] = $("#" + str).val();
- }
- //opiniontype:0上表,99不上表
- var data = {
- cmanid: self.userId,
- routeinfoid: self.routeinfoid,
- routeid: self.routeid,
- tableid: "SX_XF",
- colid: str,
- opiniontype: 0,
- cresult: "",
- opinion: self.opinion[str + "Img"] == false ? self.data[str] : "",
- opinionimage: self.opinion[str + "Img"] == true ? self.data[str] : ""
- }
- $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.getOpinion(str);
- self.opinion[str] = false;
- self.opinion[str + "Img"] = false;
- self.data[str] = "";
- self.changeFiled(str)
- } else {
- sp.dialog(res.message)
- }
- })
- }
- //删除意见
- self.Dopinion = function (str, item) {
- var data = {
- cmanid: self.userId,
- routeid: self.routeid,
- tableid: "SX_XF",
- colid: str,
- }
- $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) {
- if (str != "") {
- self.getOpinion(str);
- } else {
- self.getOpinion1();
- }
- self.changeFiled(str)
- } 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: "SX_XF",
- 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: "SX_XF",
- 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 () {
- if (!self.colid) {
- self.nulla = self.phraseSelect;
- } else {
- self.data[self.colid] = self.phraseSelect;
- }
- sp.layerhide();
- }
- //签字—手写
- self.QianZi = function (str) {
- self.opinion[str + "Img"] = true;
- setTimeout(function () {
- new lineCanvas(str + "QZ")
- }, 1)
- }
- //清除手写
- self.canvasClear = function (str) {
- var cxt = $("#" + str + "QZ").find("canvas")[0].getContext("2d");
- cxt.clearRect(0, 0, $("#" + str + "QZ").find("canvas")[0].width, $("#" + str + "QZ").find("canvas")[0].height)
- }
- self.XMLIST = [];
- self.history = null;
- //发生修改
- self.changeFiled = function (str) {
- self.filedChange = true;
- if (str == "XFFS" && self.data.XFFS == "C03") {
- self.data.LDQD = "C02";
- }
- if (str == "XM") {
- var data = {
- xm: self.data.XM
- }
- $http.post(apiurljs.login + "g2app/xinfang/queryXFNameList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.XMLIST = res.data;
- console.log(res.data)
- })
- }
- if (str == "SFZH") {
- self.history = null;
- if (self.data.SFZH == "") { return; }
- var data = {
- tablename: "SX_XF",
- colums: "*",
- order: "ID desc",
- sqlwhere: { SFZH: self.data.SFZH },
- 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.history = {
- XFFS: res.data[0].XFFS == null ? self.XFFS[0].CODE : res.data[0].XFFS,
- WLD: res.data[0].WLD == null ? "" : res.data[0].WLD,
- BHZL: res.data[0].BHZL == null ? self.BHZL[0].CODE : res.data[0].BHZL,
- WJH: res.data[0].WJH == null ? "" : res.data[0].WJH,
- ZS: res.data[0].ZS == null ? self.ZS[0].CODE : res.data[0].ZS,
- ZS1: res.data[0].ZS1 == null ? self.ZS1[0].CODE : res.data[0].ZS1,
- SXFBZ: res.data[0].SXFBZ == null ? self.SXFBZ[0].CODE : res.data[0].SXFBZ,
- SXFBZ1: res.data[0].SXFBZ1 == null ? self.SXFBZ1[0].CODE : res.data[0].SXFBZ1,
- SJZ: res.data[0].SJZ == null ? self.SJZ[0].CODE : res.data[0].SJZ,
- SJZ1: res.data[0].SJZ1 == null ? self.SJZ1[0].CODE : res.data[0].SJZ1,
- BMZ: res.data[0].BMZ == null ? self.BMZ[0].CODE : res.data[0].BMZ,
- BMZ1: res.data[0].BMZ1 == null ? self.BMZ1[0].CODE : res.data[0].BMZ1,
- JJFZCF: res.data[0].JJFZCF == null ? self.JJFZCF[0].CODE : res.data[0].JJFZCF,
- JJFFZCF: res.data[0].JJFFZCF == null ? self.JJFFZCF[0].CODE : res.data[0].JJFFZCF,
- ZJWGW: res.data[0].ZJWGW == null ? self.ZJWGW[0].CODE : res.data[0].ZJWGW,
- WLMT: res.data[0].WLMT == null ? self.WLMT[0].CODE : res.data[0].WLMT,
- QT: res.data[0].QT == null ? self.QT[0].CODE : res.data[0].QT,
- BLFS: res.data[0].BLFS == null ? self.BLFS[0].CODE : res.data[0].BLFS,
- SFHF: res.data[0].SFHF == null ? self.SFHF[0].CODE : res.data[0].SFHF,
- LDQD: res.data[0].LDQD == null ? self.LDQD[0].CODE : res.data[0].LDQD,
- XM: res.data[0].XM,
- LXDH: res.data[0].LXDH == null ? "" : res.data[0].LXDH,
- SFZH: res.data[0].SFZH == null ? "" : res.data[0].SFZH,
- LXDZ: res.data[0].LXDZ == null ? "" : res.data[0].LXDZ,
- RS: res.data[0].RS == "" ? "" : parseInt(res.data[0].RS),
- JFR: res.data[0].JFR == null ? "" : res.data[0].JFR,
- JFLXRQ: res.data[0].JFLXRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data[0].JFLXRQ),
- XFGM: res.data[0].XFGM == null ? self.XFGM[0].CODE : res.data[0].XFGM,
- XFMD: res.data[0].XFMD == null ? self.XFMD[0].CODE : res.data[0].XFMD,
- CFQK: res.data[0].CFQK == null ? self.CFQK[0].CODE : res.data[0].CFQK,
- DJCF: res.data[0].DJCF == null ? "" : res.data[0].DJCF,
- WTZY: res.data[0].WTZY == null ? "" : res.data[0].WTZY,
- WTFSD: res.data[0].WTFSD == null ? self.WTFSD[0].CODE : res.data[0].WTFSD,
- WTFL: res.data[0].WTFL == null ? "" : res.data[0].WTFL,
- FLMX: res.data[0].FLMX == null ? "" : res.data[0].FLMX,
- YQBJRQ: res.data[0].YQBJRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data[0].YQBJRQ),
- DBSX: res.data[0].DBSX == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data[0].DBSX),
- CBDWBM: res.data[0].CBDWBM == null ? "" : res.data[0].CBDWBM,
- SFYHJ: res.data[0].SFYHJ == null ? self.SFYHJ[0].CODE : res.data[0].SFYHJ,
- SFSSQK: res.data[0].SFSSQK == null ? self.SFSSQK[0].CODE : res.data[0].SFSSQK,
- FCFH: res.data[0].FCFH == null ? self.FCFH[0].CODE : res.data[0].FCFH,
- SQSFHL: res.data[0].SQSFHL == null ? self.SQSFHL[0].CODE : res.data[0].SQSFHL,
- HLSQSFJJ: res.data[0].HLSQSFJJ == null ? self.HLSQSFJJ[0].CODE : res.data[0].HLSQSFJJ,
- SFNP: res.data[0].SFNP == null ? self.SFNP[0].CODE : res.data[0].SFNP,
- HJFA: res.data[0].HJFA == null ? "" : res.data[0].HJFA,
- BFJTQK: res.data[0].BFJTQK == null ? "" : res.data[0].BFJTQK,
- SDYFCLQK: res.data[0].SDYFCLQK == null ? "" : res.data[0].SDYFCLQK,
- BALDJZW: res.data[0].BALDJZW == null ? "" : res.data[0].BALDJZW,
- JTJBR: res.data[0].JTJBR == null ? "" : res.data[0].JTJBR,
- BJRQ: res.data[0].BJRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data[0].BJRQ),
- BLJG: res.data[0].BLJG == null ? self.BLJG[0].CODE : res.data[0].BLJG,
- ZSJB: res.data[0].ZSJB == null ? self.ZSJB[0].CODE : res.data[0].ZSJB,
- ZSJBRQ: res.data[0].ZSJBRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data[0].ZSJBRQ),
- BZ: res.data[0].BZ == null ? "" : res.data[0].BZ,
- NGR: res.data[0].NGR == null ? self.userName : res.data[0].NGR
- }
- self.FLMXlist = self.history.FLMX != "" ? self.history.FLMX.split(",") : [];
- if (res.data[0].FJ && res.data[0].FJ != "") {
- self.arrayFile = JSON.parse(res.data[0].FJ);
- }
- if (res.data[0].JGFJ && res.data[0].JGFJ != "") {
- self.arrayFile1 = JSON.parse(res.data[0].JGFJ);
- self.arrayFile1.forEach(function (item) {
- item.FILENAMES1 = item.FILENAMES.length > 10 ? item.FILENAMES.slice(0, 10) + "..." : item.FILENAMES
- })
- }
- self.WTFL1 = JSON.parse(JSON.stringify(self.WTFL))
- self.WTFL1.forEach(function (item) {
- item.checked = false;
- if (self.history.WTFL.indexOf(item.CODE) > -1) {
- item.checked = true;
- }
- })
- if (self.history.WTFL == "") {
- var arr = self.FLMX;
- } else {
- var arr = self.FLMX.filter(function (item) {
- if (self.history.WTFL.indexOf(item.PID) > -1) {
- return item
- }
- })
- }
- var n = 0;
- self.FLMX2 = [[{}, {}, {}, {}]];
- for (var i = 1; i <= arr.length; i++) {
- arr[i - 1].index = arr[i - 1].CODE.slice(1)
- if (n == Math.ceil(i / 4) - 1) {
- self.FLMX2[n][(i - 1) % 4] = arr[i - 1];
- } else {
- n = Math.ceil(i / 4) - 1
- self.FLMX2[n] = [{}, {}, {}, {}];
- self.FLMX2[n][(i - 1) % 4] = arr[i - 1];
- }
- }
- })
- }
- }
- self.checkItem = function (obj) {
- var data = {
- tablename: "SX_XF",
- colums: "*",
- order: "ID desc",
- sqlwhere: { XM: obj.XM, SFZH: obj.SFZH, JFLXRQ: obj.JFLXRQ },
- 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.data = {
- ID: self.data.ID,
- APPCODE: self.data.APPCODE,
- XFFS: res.data[0].XFFS == null ? self.XFFS[0].CODE : res.data[0].XFFS,
- WLD: res.data[0].WLD == null ? "" : res.data[0].WLD,
- BHZL: res.data[0].BHZL == null ? self.BHZL[0].CODE : res.data[0].BHZL,
- WJH: res.data[0].WJH == null ? "" : res.data[0].WJH,
- ZS: res.data[0].ZS == null ? self.ZS[0].CODE : res.data[0].ZS,
- ZS1: res.data[0].ZS1 == null ? self.ZS1[0].CODE : res.data[0].ZS1,
- SXFBZ: res.data[0].SXFBZ == null ? self.SXFBZ[0].CODE : res.data[0].SXFBZ,
- SXFBZ1: res.data[0].SXFBZ1 == null ? self.SXFBZ1[0].CODE : res.data[0].SXFBZ1,
- SJZ: res.data[0].SJZ == null ? self.SJZ[0].CODE : res.data[0].SJZ,
- SJZ1: res.data[0].SJZ1 == null ? self.SJZ1[0].CODE : res.data[0].SJZ1,
- BMZ: res.data[0].BMZ == null ? self.BMZ[0].CODE : res.data[0].BMZ,
- BMZ1: res.data[0].BMZ1 == null ? self.BMZ1[0].CODE : res.data[0].BMZ1,
- JJFZCF: res.data[0].JJFZCF == null ? self.JJFZCF[0].CODE : res.data[0].JJFZCF,
- JJFFZCF: res.data[0].JJFFZCF == null ? self.JJFFZCF[0].CODE : res.data[0].JJFFZCF,
- ZJWGW: res.data[0].ZJWGW == null ? self.ZJWGW[0].CODE : res.data[0].ZJWGW,
- WLMT: res.data[0].WLMT == null ? self.WLMT[0].CODE : res.data[0].WLMT,
- QT: res.data[0].QT == null ? self.QT[0].CODE : res.data[0].QT,
- BLFS: res.data[0].BLFS == null ? self.BLFS[0].CODE : res.data[0].BLFS,
- SFHF: res.data[0].SFHF == null ? self.SFHF[0].CODE : res.data[0].SFHF,
- LDQD: res.data[0].LDQD == null ? self.LDQD[0].CODE : res.data[0].LDQD,
- XM: res.data[0].XM,
- LXDH: res.data[0].LXDH == null ? "" : res.data[0].LXDH,
- SFZH: res.data[0].SFZH == null ? "" : res.data[0].SFZH,
- LXDZ: res.data[0].LXDZ == null ? "" : res.data[0].LXDZ,
- RS: res.data[0].RS == "" ? "" : parseInt(res.data[0].RS),
- JFR: res.data[0].JFR == null ? "" : res.data[0].JFR,
- JFLXRQ: res.data[0].JFLXRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data[0].JFLXRQ),
- XFGM: res.data[0].XFGM == null ? self.XFGM[0].CODE : res.data[0].XFGM,
- XFMD: res.data[0].XFMD == null ? self.XFMD[0].CODE : res.data[0].XFMD,
- CFQK: res.data[0].CFQK == null ? self.CFQK[0].CODE : res.data[0].CFQK,
- DJCF: res.data[0].DJCF == null ? "" : res.data[0].DJCF,
- WTZY: res.data[0].WTZY == null ? "" : res.data[0].WTZY,
- WTFSD: res.data[0].WTFSD == null ? self.WTFSD[0].CODE : res.data[0].WTFSD,
- WTFL: res.data[0].WTFL == null ? "" : res.data[0].WTFL,
- FLMX: res.data[0].FLMX == null ? "" : res.data[0].FLMX,
- YQBJRQ: res.data[0].YQBJRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data[0].YQBJRQ),
- DBSX: res.data[0].DBSX == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data[0].DBSX),
- CBDWBM: res.data[0].CBDWBM == null ? "" : res.data[0].CBDWBM,
- SFYHJ: res.data[0].SFYHJ == null ? self.SFYHJ[0].CODE : res.data[0].SFYHJ,
- SFSSQK: res.data[0].SFSSQK == null ? self.SFSSQK[0].CODE : res.data[0].SFSSQK,
- FCFH: res.data[0].FCFH == null ? self.FCFH[0].CODE : res.data[0].FCFH,
- SQSFHL: res.data[0].SQSFHL == null ? self.SQSFHL[0].CODE : res.data[0].SQSFHL,
- HLSQSFJJ: res.data[0].HLSQSFJJ == null ? self.HLSQSFJJ[0].CODE : res.data[0].HLSQSFJJ,
- SFNP: res.data[0].SFNP == null ? self.SFNP[0].CODE : res.data[0].SFNP,
- HJFA: res.data[0].HJFA == null ? "" : res.data[0].HJFA,
- BFJTQK: res.data[0].BFJTQK == null ? "" : res.data[0].BFJTQK,
- SDYFCLQK: res.data[0].SDYFCLQK == null ? "" : res.data[0].SDYFCLQK,
- BALDJZW: res.data[0].BALDJZW == null ? "" : res.data[0].BALDJZW,
- JTJBR: res.data[0].JTJBR == null ? "" : res.data[0].JTJBR,
- BJRQ: res.data[0].BJRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data[0].BJRQ),
- BLJG: res.data[0].BLJG == null ? self.BLJG[0].CODE : res.data[0].BLJG,
- ZSJB: res.data[0].ZSJB == null ? self.ZSJB[0].CODE : res.data[0].ZSJB,
- ZSJBRQ: res.data[0].ZSJBRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data[0].ZSJBRQ),
- BZ: res.data[0].BZ == null ? "" : res.data[0].BZ,
- NGR: res.data[0].NGR == null ? self.userName : res.data[0].NGR
- }
- self.FLMXlist = self.data.FLMX != "" ? self.data.FLMX.split(",") : [];
- if (self.data.ID == 0) {
- self.filedChange = true;
- } else {
- self.filedChange = false;
- }
- if (res.data[0].FJ && res.data[0].FJ != "") {
- self.arrayFile = JSON.parse(res.data[0].FJ);
- }
- if (res.data[0].JGFJ && res.data[0].JGFJ != "") {
- self.arrayFile1 = JSON.parse(res.data[0].JGFJ);
- self.arrayFile1.forEach(function (item) {
- item.FILENAMES1 = item.FILENAMES.length > 10 ? item.FILENAMES.slice(0, 10) + "..." : item.FILENAMES
- })
- }
- self.WTFL.forEach(function (item) {
- item.checked = false;
- if (self.data.WTFL.indexOf(item.CODE) > -1) {
- item.checked = true;
- }
- })
- self.getFLMX(1)
- var n = {}, all = {};
- for (var i in self.UserList) {
- self.AllChecked[i] = false;
- self.UserLength[i] = 0;
- self.selectList[i] = []
- n[i] = [];
- all[i] = 0;
- $.each(self.UserList[i], function (index, item) {
- n[i].push({ n: 0, array: [] })
- if (item.USER) {
- $.each(item.USER, function (index1, item1) {
- self.UserLength[i]++
- if (self.data.JTJBR.indexOf(item1.USHOWNAME) != -1 && i == "JTJBR") {
- n[i][index].n++;
- item1.checked = true;
- self.selectList[i].push(item1);
- }
- if (self.data.WLD.indexOf(item1.USHOWNAME) != -1 && i == "WLD") {
- n[i][index].n++;
- item1.checked = true;
- self.selectList[i].push(item1);
- }
- })
- if (n[i][index].n == item.USER.length && n[i][index].n != 0) {
- item.checked = true;
- all[i]++;
- } else {
- item.checked == false;
- }
- }
- $.each(item.CHILD_DATA, function (index2, item2) {
- n[i][index].array.push({ n: 0, array: [] })
- if (item2.USER) {
- $.each(item2.USER, function (index3, item3) {
- self.UserLength[i]++
- if (self.data.JTJBR.indexOf(item3.USHOWNAME) != -1 && i == "JTJBR") {
- n[i][index].array[index2].n++;
- item3.checked = true;
- self.selectList[i].push(item3);
- }
- if (self.data.WLD.indexOf(item3.USHOWNAME) != -1 && i == "WLD") {
- n[i][index].array[index2].n++;
- item3.checked = true;
- self.selectList[i].push(item3);
- }
- })
- if (n[i][index].array[index2].n == item2.USER.length && n[i][index].array[index2] != 0) {
- item.checked = true;
- all[i]++;
- } else {
- item.checked == false;
- }
- }
- $.each(item2.CHILD_DATA, function (index4, item4) {
- n[i][index].array[index2].array.push(0)
- if (item4.USER) {
- $.each(item4.USER, function (index5, item5) {
- self.UserLength[i]++
- if (self.data.JTJBR.indexOf(item5.USHOWNAME) != -1 && i == "JTJBR") {
- n[i][index].array[index2].array[index4]++;
- item5.checked = true;
- self.selectList[i].push(item5);
- }
- if (self.data.WLD.indexOf(item5.USHOWNAME) != -1 && i == "WLD") {
- n[i][index].array[index2].array[index4]++;
- item5.checked = true;
- self.selectList[i].push(item5);
- }
- })
- }
- if (n[i][index].array[index2].array[index4] == item4.USER.length && n[i][index].array[index2].array[index4] != 0) {
- item.checked = true;
- all[i]++;
- } else {
- item.checked == false;
- }
- })
- })
- })
- if (all[i] == self.UserList[i].length) {
- self.AllChecked[i] = true;
- } else {
- self.AllChecked[i] = false;
- }
- }
- 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.CBDWBM.indexOf(item.SECTION) != -1 && i == "CBDWBM") {
- 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.getOpinion('NBYJ')
- self.getOpinion('SHYJ')
- self.getOpinion('BLJGYJ')
- self.getOpinion1()
- self.XMLIST = [];
- })
- }
- //转发
- 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=xinfangbg")
- sp.layer("#forward")
- }
- }
- //高拍仪
- var host = "ws://127.0.0.1:27896/";
- var socket;
- var g_index = 0;
- var g_fingerBase64 = "";
- self.openGP = function () {
- socket = new WebSocket(host);
- socket.onopen = function (msg) {
- self.sfzList = [];
- self.getImgList()
- sp.layer("#GPY", 1)
- };
- socket.onmessage = function (msg) {
- if (typeof msg.data == "string") {
- var message = JSON.parse(msg.data);
- if ("VideoStream" == message['FuncName']) {
- //显示视频流不做输出
- $("#myCanvas").attr("src", "data:image/jpeg;base64," + message['ImageBase64'])
- } else {
- if ("OpenCamera" == message['FuncName']) {
- }
- else if ("CloseCamera" == message['FuncName']) {
- $("#myCanvas").attr("src","../img/black.png")
- }
- else if ("ReadIDCard" == message['FuncName']) {
- if (typeof (message.RetInfo) == "object") {
- $timeout(function () {
- self.sfzList.push({
- index: self.sfzList.length,
- CNAME: message.RetInfo.IdCardData.Name,
- SEX: message.RetInfo.IdCardData.Sex,
- SFZH: message.RetInfo.IdCardData.IDCardNo,
- LXDZ: message.RetInfo.IdCardData.Address,
- GRANTDEPT: message.RetInfo.IdCardData.GrantDept,
- VALIDDATE: message.RetInfo.IdCardData.ValidDate,
- BASE64PHOTO: message.RetInfo.IdCardData.Base64Photo,
- NATION: message.RetInfo.IdCardData.Nation,
- BIRTHDAY: message.RetInfo.IdCardData.Birthday
- })
- }, 0)
- }
- } else if ("SaveToPDF" == message['FuncName']) {
- } else if ("SaveToOFD" == message['FuncName']) {
- } else if ("SaveToServer" == message['FuncName']) {
- self.getImgList()
- }
- }
- }
- };
- socket.onclose = function (msg) {
- };
- socket.onerror = function (error) {
- console.log(error)
- sp.dialog("未连接到设备!")
- }
- }
- self.getSFZH = function (n) {
- socket = new WebSocket(host);
- socket.onopen = function (msg) {
- self.OpenMianCamera()
- //1为主要人员,2为其他人员
- self.SFZTYPE = n;
- //2秒调用一次读取身份证,成功读取身份证信息后调用关闭
- $timeout(function () {
- self.SFZSXT = $interval(function () {
- self.ReadIDCard()
- }, 2000)
- }, 1000)
- sp.layer("#SFZ", 1)
- };
- socket.onmessage = function (msg) {
- if (typeof msg.data == "string") {
- var message = JSON.parse(msg.data);
- if ("VideoStream" == message['FuncName']) {
- //显示视频流不做输出
- $("#sfzCanvas").attr("src", "data:image/jpeg;base64," + message['ImageBase64'])
- } else {
- if ("OpenCamera" == message['FuncName']) {
- }
- else if ("CloseCamera" == message['FuncName']) {
- $("#sfzCanvas").attr("src", "../img/black.png")
- }
- else if ("ReadIDCard" == message['FuncName']) {
- if (typeof (message.RetInfo) == "object") {
- if (message.RetCode == 0) {
- $interval.cancel(self.SFZSXT);
- if (self.SFZTYPE == 1) {
- $timeout(function () {
- self.data.XM = message.RetInfo.IdCardData.Name;
- self.data.SFZH = message.RetInfo.IdCardData.IDCardNo;
- self.data.LXDZ = message.RetInfo.IdCardData.Address;
- self.changeFiled("SFZH");
- }, 0)
- } else {
- $timeout(function () {
- var data_sfz = {
- CNAME: message.RetInfo.IdCardData.Name,
- SEX: message.RetInfo.IdCardData.Sex,
- SFZH: message.RetInfo.IdCardData.IDCardNo,
- LXDZ: message.RetInfo.IdCardData.Address,
- GRANTDEPT: message.RetInfo.IdCardData.GrantDept,
- VALIDDATE: message.RetInfo.IdCardData.ValidDate,
- BASE64PHOTO: message.RetInfo.IdCardData.Base64Photo,
- NATION: message.RetInfo.IdCardData.Nation,
- BIRTHDAY: message.RetInfo.IdCardData.Nation,
- PID: self.data.ID
- }
- self.submitSFZ(data_sfz)
- }, 0)
- }
- self.closeGPY("#SFZ")
- }
- }
- } else if ("SaveToPDF" == message['FuncName']) {
- } else if ("SaveToOFD" == message['FuncName']) {
- } else if ("SaveToServer" == message['FuncName']) {
- self.getImgList()
- }
- }
- }
- };
- socket.onclose = function (msg) {
- };
- socket.onerror = function (error) {
- console.log(error)
- sp.dialog("未连接到设备!")
- }
- }
- self.getImgList = function () {
- var data = {
- tablename: "HANVON_FILEATTACH",
- colums: "ID,ROUTEINFOID,FILEURL,FILEID,FILENAMES,FILEOLDNAME",
- order: "SORTID",
- 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.imgList = res.data;
- self.imgList.forEach(function (item) {
- item.FILEURL = apiurljs.login + "g2work" + item.FILEURL;
- })
- })
- }
- self.deleteImg = function (file) {
- var data = {
- tablename: "HANVON_FILEATTACH",
- 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));
- self.getImgList();
- });
- }
- self.deleteSFZ = function (obj) {
- self.sfzList = self.sfzList.filter(function (item) {
- return item.index != obj.index
- })
- $.each(self.sfzList, function (index, item) {
- item.index = index;
- })
- }
- self.closeGPY = function (id) {
- self.CloseCamera()
- $("#myCanvas").attr("src", "../img/black.png")
- $("#sfzCanvas").attr("src", "../img/black.png")
- socket.close();
- socket = null;
- sp.closeCenter(id)
- }
- self.OpenMianCamera = function () {
- if (g_index == 1) {
- self.CloseCamera();//切换镜头前执行关闭预览
- }
- g_index = 0;
- socket.send(JSON.stringify({
- 'FuncName': 'OpenCamera',
- 'CamIndex': g_index
- }));
- }
- self.OpenFaceCamera = function () {
- if (g_index == 0) {
- self.CloseCamera();//切换镜头前执行关闭预览
- }
- g_index = 1;
- socket.send(JSON.stringify({
- 'FuncName': 'OpenCamera',
- 'CamIndex': g_index
- }));
- }
- self.CloseCamera = function () {
- socket.send(JSON.stringify({
- 'FuncName': 'CloseCamera'
- }));
- }
- self.SFZPS = false;
- self.ReadIDCard = function () {
- socket.send(JSON.stringify({
- 'FuncName': 'ReadIDCard'
- }));
- }
- self.SaveToBase64 = function () {
- socket.send(JSON.stringify({
- 'FuncName': 'SaveToServer',
- 'URL': apiurljs.login + 'g2app/abase/uploadFileWithHanvon',
- 'UpParam': s4.encryptData_CBC("tablename=HANVON_FILEATTACH,routeinfoid=" + self.routeinfoid)
- }));
- }
- self.pdfFlag = false;
- self.SaveToPDF = function () {
- self.pdfFlag = true;
- var data = {
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/dataabase/imageMergePDFByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.pdfFlag = false;
- self.getOther();
- });
- }
- self.ofdFlag = false;
- self.SaveToOFD = function () {
- self.ofdFlag = true;
- var data = {
- routeinfoid: self.routeinfoid
- }
- $http.post(apiurljs.login + "g2app/dataabase/imageMergeOFDByRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- self.ofdFlag = false;
- self.getOther();
- });
- }
- self.submitFlag = false;
- self.submitSFZ = function (data_sfz) {
- var data = {
- tablename: "SX_XF_01",
- colums: "ID,PID,SFZH",
- order: "SORTID",
- sqlwhere: {
- PID: data_sfz.PID,
- SFZH: data_sfz.SFZH
- },
- 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));
- if (res.data.length == 0) {
- var data1 = {
- tablename: "SX_XF_01",
- data: "[" + JSON.stringify(data_sfz) + "]"
- }
- $http.post(apiurljs.login + "g2app/Data/insertChildDataList2", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
- .success(function (obj1) {
- var res1 = strToJson(s4.decryptData_CBC(obj1.data));
- if (res1.success) {
- self.getSFZ()
- } else {
- sp.dialog(res1.message)
- }
- })
- } else {
- sp.dialog("人员信息已存在!")
- }
- })
- }
- //查看流转记录
- 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.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 + "px";
- bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 - 25 + "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"), "地图搜索")
- }
- //公开
- self.PUBLICITEM = function () {
- var data = {
- userid: self.userId
- }
- $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- var data1 = {
- tablename: "CODE_LM"
- }
- $http.post(apiurljs.login + "g2app/filepublishing/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
- .success(function (obj1) {
- var res1 = strToJson(s4.decryptData_CBC(obj1.data));
- self.LM = res1.data[0].C_H_I_L_D_DATA;
- self.LM.forEach(function (item) {
- item.show = true;
- if (item.CNAME == "新闻动态" || item.CNAME == "通知公告" || (item.MKUSERID && item.MKUSERID.indexOf(self.userId) == -1)) {
- item.show = false;
- }
- item.C_H_I_L_D_DATA.forEach(function (item1) {
- item1.show = true;
- if (item1.MKUSERID && item1.MKUSERID.indexOf(self.userId) == -1) {
- item1.show = false;
- }
- })
- })
- self.filed = "GKFW";
- self.msgGK = {
- WJLY: "FW",
- FLOWID: "AA88",
- FORMROUTEINFOID: self.routeinfoid,
- FBUSERID: self.userId,
- FBNAME: self.userName,
- GKFW: "",
- LM: "P0103",
- LM1: "委发文件",
- FBRQ: sp.getLocalDate(),
- FBBM: res.data[0].SECTION,
- WJBT: self.data.FWBT
- }
- sp.layer("#PUBLICITEM")
- $("#PUBLICITEM .sp-page").eq(0).scrollTop(0);
- })
- })
- }
- self.showCol = function ($event, ele) {
- $('.detail-col').not(ele).hide();
- $(ele).toggle("slow").autoHide();
- $event.stopPropagation();
- }
- self.selectLM = function (item) {
- self.msgGK.LM = item.CODE
- self.msgGK.LM1 = item.CNAME
- console.log(self.msgGK)
- $(".detail-col").toggle("slow");
- }
- self.showSecond = function (obj, n) {
- self.LM1 = obj.C_H_I_L_D_DATA;
- $(".detail-col").eq(1).css("top", (n + 1) * 30 + n);
- $(".detail-col").eq(1).show().autoHide()
- }
- self.checkAllUser1 = function () {
- self.AllChecked[self.filed] = !self.AllChecked[self.filed];
- $.each(self.UserList[self.filed], function (index, item) {
- item.checked = self.AllChecked[self.filed];
- $.each(item.USER, function (index1, item1) {
- item1.checked = self.AllChecked[self.filed];
- })
- })
- self.submitGK(1)
- }
- self.checkUserItem1 = function (item) {
- item.checked = !item.checked;
- $.each(item.USER, function (index, item1) {
- item1.checked = item.checked;
- })
- var n = 0;
- $.each(self.UserList[self.filed], function (index, item) {
- if (item.checked == true) {
- n++
- }
- })
- if (n == self.UserList[self.filed].length) {
- self.AllChecked[self.filed] = true;
- } else {
- self.AllChecked[self.filed] = false;
- }
- self.submitGK(1)
- }
- self.checkUser1 = function (item) {
- item.checked = !item.checked;
- var n = [], all = 0;
- $.each(self.UserList[self.filed], function (x, y) {
- n.push(0);
- $.each(y.USER, function (x1, y1) {
- if (y1.checked == true) {
- n[x]++
- }
- })
- if (n[x] == y.USER.length && n[x] != 0) {
- y.checked = true;
- all++
- } else {
- y.checked = false;
- }
- })
- if (all == self.UserList[self.filed].length) {
- self.AllChecked[self.filed] = true;
- } else {
- self.AllChecked[self.filed] = false;
- }
- self.submitGK(1)
- }
- self.submitGK = function (n) {
- var AllCheckedLength = 0;
- self.selectList[self.filed] = [];
- $.each(self.UserList[self.filed], function (index, item) {
- $.each(item.USER, function (index1, item1) {
- if (item1.checked == true) {
- AllCheckedLength++;
- self.selectList[self.filed].push(item1)
- }
- })
- })
- self.msgGK[self.filed] = self.selectList[self.filed].map(function (item) {
- return item.USERID
- }).join(",")
- self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed];
- if (n == 0) {
- sp.layerhide();
- var data = {
- tablename: "SX_FBLIST",
- data: {
- WJLY: self.msgGK.WJLY,
- FLOWID: self.msgGK.FLOWID,
- FORMROUTEINFOID: self.msgGK.FORMROUTEINFOID,
- FBUSERID: self.msgGK.FBUSERID,
- FBNAME: self.msgGK.FBNAME,
- GKFW: self.msgGK.GKFW,
- LM: self.msgGK.LM,
- FBRQ: self.msgGK.FBRQ,
- FBBM: self.msgGK.FBBM,
- WJBT: self.msgGK.WJBT
- }
- }
- $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
- .success(function (obj) {
- var res = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (res.success) {
- sp.dialog("操作成功!");
- $timeout(function () {
- sp.dialoghide();
- }, 1000)
- } else {
- sp.dialog(res.message);
- }
- })
- }
- }
-
- //头部下滚冻结
- $(function () {
- $(".sp-page-center").eq(0).css("max-height", $("#topDiv").height()).css("height", $("#topDiv").height())
- $(".formedit center").css("height", $(".formedit center").next("div").height()).css("line-height", $(".formedit center").next("div").height() / 6 + "px")
- //$("body").bind("scroll", function () {
- // var scrollTop = $("body").scrollTop();
- // if (scrollTop == 0) {
- // $(".FixTop").removeClass("FixTop");
- // }
- // if (scrollTop > 35) {
- // $(".sp-page-title").parents(".sp-box").addClass("FixTop");
- // }
- //});
- //页面高度撑满
- setTimeout(function () {
- if ($(".ibox-content").height() < $(window).height() - 31) {
- $(".ibox-content").css("height", $(window).height() - 31)
- }
- $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
- }, 1)
- })
- }])
- app.filter('trustHtml', function ($sce) {
- return function (input) {
- return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, ' '));
- };
- });
- //canvas画布签字
- function lineCanvas(obj) {
- var self = this;
- self.linewidth = 1;
- self.color = "#000000";
- self.background = "#ffffff";
- self.canvas = document.createElement("canvas");
- document.getElementById(obj).appendChild(self.canvas);
- self.cxt = self.canvas.getContext("2d");
- self.canvas.width = document.getElementById(obj).clientWidth;
- self.canvas.height = document.getElementById(obj).scrollHeight;
- self.cxt.fillStyle = self.background;
- self.cxt.fillRect(0, 0, self.canvas.width, self.canvas.width);
- self.cxt.strokeStyle = self.color;
- self.cxt.lineWidth = self.linewidth;
- self.cxt.lineCap = "round";
- //开始绘制
- self.canvas.addEventListener("mousedown", function (e) {
- self.cxt.beginPath();
- self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
- self.canvas.addEventListener("mousemove", move)
- }.bind(self), false);
- //绘制中
- function move() {
- var e = window.event;
- self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
- self.cxt.stroke();
- }
- //结束绘制
- self.canvas.addEventListener("mouseup", up)
- function up() {
- self.cxt.closePath();
- self.canvas.removeEventListener("mousemove", move)
- }
- };
- var parentData = {}
- function getData() {
- parentData = angular.element(document.getElementById("app")).scope().data
- return parentData
- }
- function showToggle(e) {
- $(e).children().toggle()
- $(e).next().toggle()
- }
- function toggleYJL(e) {
- if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
- $("#topDiv").css("height", 160)
- $(e).parent().css("height", 450)
- $("#attachlist").css("height", 200)
- $("#bottomDiv").css("height", "")
- } else {
- $("#topDiv").css("height", 600)
- $(e).parent().css("height", 10)
- }
- $(e).children().toggle()
- }
- function toggleHistory(e) {
- if ($(e).children(".fa-angle-double-right").is(":hidden") == true) {
- $(e).parent().css("width", 900)
- } else {
- $(e).parent().css("width", 10)
- }
- $(e).children().toggle()
- }
|