123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100 |
- var copyrightid = sp.getUrlName("copyrightid");
- var get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- var bpmnModeler = new BpmnJS({
- container: '#canvas',
- //additionalModules: [customTranslateModule],
- keyboard: {
- bindTo: window
- }
- });
- //流程名称显示在页面上
- var flowName = "【" + decodeURI(sp.getUrlName("flowName")) + "】";
- $("#flowName").html(flowName);
- //import function
- function importXML(xml) {
- // import diagram
- bpmnModeler.importXML(xml, function (err) {
- if (err) {
- return console.error('could not import BPMN 2.0 diagram', err);
- }
- var canvas = bpmnModeler.get('canvas');
- // zoom to fit full viewport
- canvas.zoom('fit-viewport');
- // canvas.addMarker('fifthTask_ANONYMOUS', 'highlight');
- });
- // save diagram on button click
- var saveButton = document.querySelector('#btnSaveFlow');
- saveButton.addEventListener('click', function () {
- // get the diagram contents
- bpmnModeler.saveXML({format: true}, function (err, xml) {
- if (err) {
- //console.error('diagram save failed', err);
- alert('保存流程失败!' + err);
- } else {
- //console.info('diagram saved');
- //console.info(xml);
- //----------------------------
- $.ajax({
- type: "post",
- url: apiurljs.login + "workflow/updateWorkFlowData",
- data: {"copyrightid": s4.encryptData_CBC(copyrightid), "xml": s4.encryptData_CBC(xml)},
- dataType: "json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- //alert('保存流程成功!' + strToJson(response).result);
- },
- error: function (response) {
- alert('保存流程失败!' + strToJson(response));
- }
- });
- //----------------------------
- }
- });
- });
- }
- var diagramXML = "";
- $.ajax({
- type: "post",
- url: apiurljs.login + "workflow/getWorkFlowData",
- data: {"copyrightid": s4.encryptData_CBC(copyrightid)},
- dataType: "text",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(JSON.parse(obj).data))
- diagramXML = response;
- if (diagramXML == "") {
- //美观版,带边框的
- //diagramXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <definitions xmlns=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:omgdc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:omgdi=\"http://www.omg.org/spec/DD/20100524/DI\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" targetNamespace=\"\" xsi:schemaLocation=\"http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd\"> <collaboration id=\"sid-c0e745ff-361e-4afb-8c8d-2a1fc32b1424\"> <participant id=\"sid-87F4C1D6-25E1-4A45-9DA7-AD945993D06F\" name=\"工作流程\" processRef=\"sid-C3803939-0872-457F-8336-EAE484DC4A04\" /> </collaboration> <process id=\"sid-C3803939-0872-457F-8336-EAE484DC4A04\" name=\"Customer\" processType=\"None\" isClosed=\"false\" isExecutable=\"false\"> <extensionElements /> <laneSet id=\"sid-b167d0d7-e761-4636-9200-76b7f0e8e83a\"> <lane id=\"sid-57E4FE0D-18E4-478D-BC5D-B15164E93254\"> <flowNodeRef>sid-D7F237E8-56D0-4283-A3CE-4F0EFE446138</flowNodeRef> <flowNodeRef>sid-52EB1772-F36E-433E-8F5B-D5DFD26E6F26</flowNodeRef> <flowNodeRef>sid-E433566C-2289-4BEB-A19C-1697048900D2</flowNodeRef> </lane> </laneSet> <startEvent id=\"sid-D7F237E8-56D0-4283-A3CE-4F0EFE446138\" name=\"开始\"> <outgoing>sid-7B791A11-2F2E-4D80-AFB3-91A02CF2B4FD</outgoing> </startEvent> <task id=\"sid-52EB1772-F36E-433E-8F5B-D5DFD26E6F26\" name=\"开始工作\"> <incoming>sid-7B791A11-2F2E-4D80-AFB3-91A02CF2B4FD</incoming> <outgoing>sid-EE8A7BA0-5D66-4F8B-80E3-CC2751B3856A</outgoing> </task> <sequenceFlow id=\"sid-7B791A11-2F2E-4D80-AFB3-91A02CF2B4FD\" name=\"填报表单\" sourceRef=\"sid-D7F237E8-56D0-4283-A3CE-4F0EFE446138\" targetRef=\"sid-52EB1772-F36E-433E-8F5B-D5DFD26E6F26\" /> <sequenceFlow id=\"sid-EE8A7BA0-5D66-4F8B-80E3-CC2751B3856A\" name=\"转结束\" sourceRef=\"sid-52EB1772-F36E-433E-8F5B-D5DFD26E6F26\" targetRef=\"sid-E433566C-2289-4BEB-A19C-1697048900D2\" /> <endEvent id=\"sid-E433566C-2289-4BEB-A19C-1697048900D2\" name=\"结束\"> <incoming>sid-EE8A7BA0-5D66-4F8B-80E3-CC2751B3856A</incoming> </endEvent> </process> <bpmndi:BPMNDiagram id=\"sid-74620812-92c4-44e5-949c-aa47393d3830\"> <bpmndi:BPMNPlane id=\"sid-cdcae759-2af7-4a6d-bd02-53f3352a731d\" bpmnElement=\"sid-c0e745ff-361e-4afb-8c8d-2a1fc32b1424\"> <bpmndi:BPMNShape id=\"sid-87F4C1D6-25E1-4A45-9DA7-AD945993D06F_gui\" bpmnElement=\"sid-87F4C1D6-25E1-4A45-9DA7-AD945993D06F\" isHorizontal=\"true\"> <omgdc:Bounds x=\"42.5\" y=\"75\" width=\"933\" height=\"250\" /> <bpmndi:BPMNLabel labelStyle=\"sid-84cb49fd-2f7c-44fb-8950-83c3fa153d3b\"> <omgdc:Bounds x=\"47.49999999999999\" y=\"170.42857360839844\" width=\"12.000000000000014\" height=\"59.142852783203125\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id=\"sid-57E4FE0D-18E4-478D-BC5D-B15164E93254_gui\" bpmnElement=\"sid-57E4FE0D-18E4-478D-BC5D-B15164E93254\" isHorizontal=\"true\"> <omgdc:Bounds x=\"72.5\" y=\"75\" width=\"903\" height=\"250\" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id=\"sid-D7F237E8-56D0-4283-A3CE-4F0EFE446138_gui\" bpmnElement=\"sid-D7F237E8-56D0-4283-A3CE-4F0EFE446138\"> <omgdc:Bounds x=\"150\" y=\"165\" width=\"30\" height=\"30\" /> <bpmndi:BPMNLabel labelStyle=\"sid-e0502d32-f8d1-41cf-9c4a-cbb49fecf581\"> <omgdc:Bounds x=\"152\" y=\"197\" width=\"26\" height=\"14\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id=\"sid-52EB1772-F36E-433E-8F5B-D5DFD26E6F26_gui\" bpmnElement=\"sid-52EB1772-F36E-433E-8F5B-D5DFD26E6F26\"> <omgdc:Bounds x=\"352.5\" y=\"140\" width=\"100\" height=\"80\" /> <bpmndi:BPMNLabel labelStyle=\"sid-84cb49fd-2f7c-44fb-8950-83c3fa153d3b\"> <omgdc:Bounds x=\"360.5\" y=\"172\" width=\"84\" height=\"12\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id=\"sid-E433566C-2289-4BEB-A19C-1697048900D2_gui\" bpmnElement=\"sid-E433566C-2289-4BEB-A19C-1697048900D2\"> <omgdc:Bounds x=\"634\" y=\"166\" width=\"28\" height=\"28\" /> <bpmndi:BPMNLabel labelStyle=\"sid-e0502d32-f8d1-41cf-9c4a-cbb49fecf581\"> <omgdc:Bounds x=\"635\" y=\"196\" width=\"26\" height=\"14\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id=\"sid-EE8A7BA0-5D66-4F8B-80E3-CC2751B3856A_gui\" bpmnElement=\"sid-EE8A7BA0-5D66-4F8B-80E3-CC2751B3856A\"> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"453\" y=\"180\" /> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"635\" y=\"180\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"525\" y=\"155\" width=\"38\" height=\"14\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id=\"sid-7B791A11-2F2E-4D80-AFB3-91A02CF2B4FD_gui\" bpmnElement=\"sid-7B791A11-2F2E-4D80-AFB3-91A02CF2B4FD\"> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"179\" y=\"180\" /> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"353\" y=\"180\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"241\" y=\"155\" width=\"50\" height=\"14\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> <bpmndi:BPMNLabelStyle id=\"sid-e0502d32-f8d1-41cf-9c4a-cbb49fecf581\"> <omgdc:Font name=\"Arial\" size=\"11\" isBold=\"false\" isItalic=\"false\" isUnderline=\"false\" isStrikeThrough=\"false\" /> </bpmndi:BPMNLabelStyle> <bpmndi:BPMNLabelStyle id=\"sid-84cb49fd-2f7c-44fb-8950-83c3fa153d3b\"> <omgdc:Font name=\"Arial\" size=\"12\" isBold=\"false\" isItalic=\"false\" isUnderline=\"false\" isStrikeThrough=\"false\" /> </bpmndi:BPMNLabelStyle> </bpmndi:BPMNDiagram> </definitions>\r\n\r\n";
- //最简版,不带边框
- diagramXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <definitions xmlns=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:omgdc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:omgdi=\"http://www.omg.org/spec/DD/20100524/DI\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" targetNamespace=\"\" xsi:schemaLocation=\"http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd\"> <process id=\"Process_0ou37ig\"> <startEvent id=\"StartEvent_142ym73\" name=\"开始\"> <outgoing>SequenceFlow_0gqlk33</outgoing> </startEvent> <task id=\"Task_020vyoo\" name=\"开始工作\"> <incoming>SequenceFlow_0gqlk33</incoming> <outgoing>SequenceFlow_02bni32</outgoing> </task> <sequenceFlow id=\"SequenceFlow_0gqlk33\" name=\"填报表单\" sourceRef=\"StartEvent_142ym73\" targetRef=\"Task_020vyoo\" /> <endEvent id=\"EndEvent_1wus1l9\" name=\"结束\"> <incoming>SequenceFlow_02bni32</incoming> </endEvent> <sequenceFlow id=\"SequenceFlow_02bni32\" name=\"转结束\" sourceRef=\"Task_020vyoo\" targetRef=\"EndEvent_1wus1l9\" /> </process> <bpmndi:BPMNDiagram id=\"sid-74620812-92c4-44e5-949c-aa47393d3830\"> <bpmndi:BPMNPlane id=\"sid-cdcae759-2af7-4a6d-bd02-53f3352a731d\" bpmnElement=\"Process_0ou37ig\"> <bpmndi:BPMNShape id=\"StartEvent_142ym73_di\" bpmnElement=\"StartEvent_142ym73\"> <omgdc:Bounds x=\"115.14214214214215\" y=\"96.31831831831832\" width=\"36\" height=\"36\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"122\" y=\"135\" width=\"22\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id=\"Task_020vyoo_di\" bpmnElement=\"Task_020vyoo\"> <omgdc:Bounds x=\"281.17217217217216\" y=\"74\" width=\"100\" height=\"80\" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id=\"SequenceFlow_0gqlk33_di\" bpmnElement=\"SequenceFlow_0gqlk33\"> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"151\" y=\"114\" /> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"281\" y=\"114\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"194.74712643678163\" y=\"92\" width=\"44\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id=\"EndEvent_1wus1l9_di\" bpmnElement=\"EndEvent_1wus1l9\"> <omgdc:Bounds x=\"544.1721721721722\" y=\"96\" width=\"36\" height=\"36\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"551\" y=\"135\" width=\"22\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id=\"SequenceFlow_02bni32_di\" bpmnElement=\"SequenceFlow_02bni32\"> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"381\" y=\"114\" /> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"544\" y=\"114\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"446\" y=\"92\" width=\"33\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> <bpmndi:BPMNLabelStyle id=\"sid-e0502d32-f8d1-41cf-9c4a-cbb49fecf581\"> <omgdc:Font name=\"Arial\" size=\"11\" isBold=\"false\" isItalic=\"false\" isUnderline=\"false\" isStrikeThrough=\"false\" /> </bpmndi:BPMNLabelStyle> <bpmndi:BPMNLabelStyle id=\"sid-84cb49fd-2f7c-44fb-8950-83c3fa153d3b\"> <omgdc:Font name=\"Arial\" size=\"12\" isBold=\"false\" isItalic=\"false\" isUnderline=\"false\" isStrikeThrough=\"false\" /> </bpmndi:BPMNLabelStyle> </bpmndi:BPMNDiagram> </definitions> ";
- }
- importXML(diagramXML);
- },
- error: function (response) {
- diagramXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <definitions xmlns=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:omgdc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:omgdi=\"http://www.omg.org/spec/DD/20100524/DI\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" targetNamespace=\"\" xsi:schemaLocation=\"http://www.omg.org/spec/BPMN/20100524/MODEL http://www.omg.org/spec/BPMN/2.0/20100501/BPMN20.xsd\"> <process id=\"Process_0ou37ig\"> <startEvent id=\"StartEvent_142ym73\" name=\"开始\"> <outgoing>SequenceFlow_0gqlk33</outgoing> </startEvent> <task id=\"Task_020vyoo\" name=\"开始工作\"> <incoming>SequenceFlow_0gqlk33</incoming> <outgoing>SequenceFlow_02bni32</outgoing> </task> <sequenceFlow id=\"SequenceFlow_0gqlk33\" name=\"填报表单\" sourceRef=\"StartEvent_142ym73\" targetRef=\"Task_020vyoo\" /> <endEvent id=\"EndEvent_1wus1l9\" name=\"结束\"> <incoming>SequenceFlow_02bni32</incoming> </endEvent> <sequenceFlow id=\"SequenceFlow_02bni32\" name=\"转结束\" sourceRef=\"Task_020vyoo\" targetRef=\"EndEvent_1wus1l9\" /> </process> <bpmndi:BPMNDiagram id=\"sid-74620812-92c4-44e5-949c-aa47393d3830\"> <bpmndi:BPMNPlane id=\"sid-cdcae759-2af7-4a6d-bd02-53f3352a731d\" bpmnElement=\"Process_0ou37ig\"> <bpmndi:BPMNShape id=\"StartEvent_142ym73_di\" bpmnElement=\"StartEvent_142ym73\"> <omgdc:Bounds x=\"115.14214214214215\" y=\"96.31831831831832\" width=\"36\" height=\"36\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"122\" y=\"135\" width=\"22\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id=\"Task_020vyoo_di\" bpmnElement=\"Task_020vyoo\"> <omgdc:Bounds x=\"281.17217217217216\" y=\"74\" width=\"100\" height=\"80\" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id=\"SequenceFlow_0gqlk33_di\" bpmnElement=\"SequenceFlow_0gqlk33\"> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"151\" y=\"114\" /> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"281\" y=\"114\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"194.74712643678163\" y=\"92\" width=\"44\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id=\"EndEvent_1wus1l9_di\" bpmnElement=\"EndEvent_1wus1l9\"> <omgdc:Bounds x=\"544.1721721721722\" y=\"96\" width=\"36\" height=\"36\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"551\" y=\"135\" width=\"22\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id=\"SequenceFlow_02bni32_di\" bpmnElement=\"SequenceFlow_02bni32\"> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"381\" y=\"114\" /> <omgdi:waypoint xsi:type=\"omgdc:Point\" x=\"544\" y=\"114\" /> <bpmndi:BPMNLabel> <omgdc:Bounds x=\"446\" y=\"92\" width=\"33\" height=\"17\" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> <bpmndi:BPMNLabelStyle id=\"sid-e0502d32-f8d1-41cf-9c4a-cbb49fecf581\"> <omgdc:Font name=\"Arial\" size=\"11\" isBold=\"false\" isItalic=\"false\" isUnderline=\"false\" isStrikeThrough=\"false\" /> </bpmndi:BPMNLabelStyle> <bpmndi:BPMNLabelStyle id=\"sid-84cb49fd-2f7c-44fb-8950-83c3fa153d3b\"> <omgdc:Font name=\"Arial\" size=\"12\" isBold=\"false\" isItalic=\"false\" isUnderline=\"false\" isStrikeThrough=\"false\" /> </bpmndi:BPMNLabelStyle> </bpmndi:BPMNDiagram> </definitions> ";
- }
- });
- ////导出流程图
- var svgToImg;
- function btnExportFlow() {
- if (confirm("确认导出流程图吗?")) {
- bpmnModeler.saveSVG({ format: true }, function (err, svg) {
- //console.log(svg.toString());
- svg = "<svg style='background:#ffffff;' xmlns=" + svg.split("<svg xmlns=")[1];
- //svg=changeColor(changeColor,"000000");
- //covertSVG2Image(svg,"11",1000,300,'png')
- $("#div_flow_svg_part").html(svg);
- setTimeout(function () {
- var get_svg = document.querySelector("#div_flow_svg_part svg");
- //// 实例化对象
- svgToImg = new svgToImg(get_svg);
- var filename = decodeURI(sp.getUrlName("flowName"));
- svgToImg.change(filename, 'png');
- //covertSVG2Image(get_svg,"11",1000,200,"png");
- }, 100);
- })
- }
- }
- //获取流程的基本信息并保存
- var flowInfo = "";
- var flowColumn = [];
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flow/queryHashMapByCopyrightid",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify({"copyrightid": copyrightid}))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- flowInfo = response.data;
- if (flowInfo.CODETABLE != "" && flowInfo.CODETABLE != null && flowInfo.CODETABLE != undefined) {
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/billcol/queryDataByParam",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify({"billkey": flowInfo.CODETABLE}))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response2 = strToJson(s4.decryptData_CBC(obj.data));
- flowColumn = response2.data[0].COLS;
- $("#btnTimeFlow").show();
- },
- error: function (response) {
- console.log(response);
- }
- });
- } else {
- flowInfo.CODETABLE = "";
- flowInfo.CODETABLECAPTION = "未配置";
- $("#btnTimeFlow").show();
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- //隐藏节点的div层
- function btnHideRightPart() {
- $("#bpmnSetRightPart").hide();
- }
- //隐藏流向的div层
- function btnHideRightPartFlow() {
- $("#bpmnSetRightPartFlow").hide();
- }
- function btnGoBack() {
- window.location.href = "../tpk/flowchart/flowchart.html?FLOWKND=" + sp.getUrlName("leftActiveType");
- }
- //点击节点调用的函数
- function clickNode(nodeid) {
- $("#bpmnSetRightPartFlow").attr("flowid", "");
- $("#bpmnSetRightPart").attr("nodeid", nodeid);
- var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
- var postData = {nodeid: nodeid};
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flownode/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- //当前节点为空时,隐藏右侧表单信息
- if (Object.keys(response.data).length != 0) {
- $("#bpmnSetRightPart").show();
- $("#bpmnSetRightPartFlow").hide();
- initNodePart(response.data);
- } else {
- $("#bpmnSetRightPart").hide();
- $("#bpmnSetRightPartFlow").hide();
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- function getNodeInfo() {
- var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
- var postData = {nodeid: nodeid};
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flownode/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- initNodePart(response.data);
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //各个节点类型的判断
- var nodeTypeList = [
- {"type": 0, "name": "开始"},
- {"type": 1, "name": "结束"},
- {"type": 2, "name": "任务"},
- {"type": 3, "name": "网关"},
- {"type": 4, "name": "子流程"},
- {"type": 5, "name": "边界事件"}
- ];
- //表单类型列表
- var formType = [
- {"cval": "NORMAL", "cname": "一般表"},
- {"cval": "MDETAIL", "cname": "主细表"},
- {"cval": "CODETBL", "cname": "代码表"},
- {"cval": "TREESTAL", "cname": "树状表"},
- {"cval": "ENTITYTB", "cname": "实体表"},
- {"cval": "FILETBL", "cname": "附件表"},
- ]
- //根据节点信息初始化节点弹出层的函数
- function initNodePart(nodeInfo) {
- //console.log(JSON.stringify(nodeInfo));
- $(".nodeCode").html(nodeInfo.NODEKID);
- $(".nodeBtn").hide();
- nodeTypeList.forEach(function (item) {
- if (item.type == nodeInfo.TYPE) {
- $(".nodeType").html(item.name);
- }
- })
- $(".nodeTypeSelect").val(parseInt(nodeInfo.TYPE));
- if (parseInt(nodeInfo.TYPE) == 2 || parseInt(nodeInfo.TYPE) == 4) {
- $(".nodeBtn").show();
- }
- //如果是子流程则显示子流程设置,不是子流程则是表单设置
- if (parseInt(nodeInfo.TYPE) == 4) {
- $("#itemFlowTitle").show();
- $("#itemFlowBox").show();
- $("#formTitle").hide();
- $("#formBox").hide();
- } else {
- $("#itemFlowTitle").hide();
- $("#itemFlowBox").hide();
- $("#formTitle").show();
- $("#formBox").show();
- }
- $(".nodeName").val(nodeInfo.CNAME);
- $(".nodeTime").val(nodeInfo.TIMELIMIT);
- $(".nodeRemark").val(nodeInfo.EXPLAIN);
- ///为 是否合流 赋值
- if (nodeInfo.MARKMERGE == "" || nodeInfo.MARKMERGE == "false") {
- $("#chb_isMarkmerge").prop("checked", false);
- } else {
- $("#chb_isMarkmerge").prop("checked", true);
- }
- //清空人员层,表单层,子流程层的数据
- $(".itemFlowBox tbody").html("");
- $(".formTableBox tbody").html("");
- $("#nodeUserList").html("");
- if (nodeInfo.TOFLOWID != undefined && nodeInfo.TOFLOWCNAME != undefined) {
- var itemTD =
- "<tr flow-id='" + nodeInfo.TOFLOWID + "'>" +
- "<td class='sp-text-left sp-pl-10'>" + nodeInfo.TOFLOWCNAME + "</td>" +
- "<td class='delFormbtn'><i class='fa fa-edit' onclick='openEditFlowLayer(this)'></i></td>" +
- "</tr>";
- $(".itemFlowBox tbody").append(itemTD);
- } else {
- var itemTD =
- "<tr flow-id='0'>" +
- "<td class='sp-text-left sp-pl-10'>尚未配置子流程</td>" +
- "<td class='delFormbtn'><i class='fa fa-edit' onclick='openEditFlowLayer(this)'></i></td>" +
- "</tr>";
- $(".itemFlowBox tbody").append(itemTD);
- }
- nodeInfo.FORM.forEach(function (item, index) {
- var itemTD =
- "<tr form-id='" + item.FORMID + "'>" +
- "<td class='sp-text-left sp-pl-10'>" + item.FORMNAME + "</td>" +
- "<td class='delFormbtn'><i class='fa fa-close' onclick='deleteNodeForm(\"" + item.FORMID + "\"," + index + ")'></i></td>" +
- "</tr>";
- $(".formTableBox tbody").append(itemTD);
- })
- nodeInfo.USERS.forEach(function (item, index) {
- var itemDiv = "<div class='itemUser'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteNodeUser(\"" + item.UNITID + "\",\"" + item.DID + "\",\"" + item.ZID + "\",\"" + item.GID + "\",\"" + item.RID + "\"," + index + ")'></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>机构:</div><div class='itemVal'>" + item.UNITIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>部门:</div><div class='itemVal'>" + item.DIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>角色:</div><div class='itemVal'>" + item.ZIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>群组:</div><div class='itemVal'>" + item.GIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>人员:</div><div class='itemVal'>" + item.RIDNAME + "</div></div>" +
- "</div>"
- $("#nodeUserList").append(itemDiv);
- })
- }
- //节点增加表单的准备操作
- //获取机构列表
- var unitList = [];
- var typeList = [];
- //获取机构
- function getUnitList() {
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/sect/querySectAdmin",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC("")
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- unitList = response.data;
- unitList.forEach(function (item, index) {
- if (index == 0) {
- var itemOption = "<option selected value='" + item.CODE + "'>" + item.SECTION + "</option>";
- } else {
- var itemOption = "<option value='" + item.CODE + "'>" + item.SECTION + "</option>";
- }
- $("#formUnit").append(itemOption);
- $("#itemUserUnit").append(itemOption);
- $("#userUnit").append(itemOption);
- $("#directionUnit").append(itemOption);
- })
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //获取表单类型
- function getFormType() {
- var nowUnit = $("#formUnit").val();
- $(".formTypeBox").html("");
- var baseType = "<div class=\"typeItem\" data-type='' onclick=\"changeFormType('',this)\"><i class=\"fa fa-list-ul\"></i> <span>全部表单</span></div>";
- $(".formTypeBox").append(baseType);
- var postData = {
- pkid: nowUnit,
- includechildren: true
- };
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/formkinds/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- typeList = response.data;
- typeList.forEach(function (item) {
- var itemType = "<div class='typeItem' data-type='" + item.PKID + "' onclick='changeFormType(\"" + item.PKID + "\",this)'><i class='fa fa-folder'></i> <span>" + item.CNAME + "</span></div>";
- $(".formTypeBox").append(itemType);
- })
- $(".formTypeBox>.typeItem").eq(1).addClass("active");
- getFormList();
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //加载表单
- function getFormList() {
- //根据选中的机构和类型查询表单数据
- var nowUnit = $("#formUnit").val();
- var nowType = $(".formTypeBox .active").attr("data-type");
- var postData = {
- unitid: nowUnit,
- formkinds: nowType
- }
- $("#formList tbody").html("");
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/form/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- if (response.data.length != 0) {
- $(".formPartRight .sp-table-tip").hide();
- response.data.forEach(function (item, index) {
- formType.forEach(function (item2) {
- if (item2.cval == item.CTYPE) {
- item.CTYPENAME = item2.cname;
- }
- })
- var itemTr =
- "<tr form-id='" + item.FORMID + "'>" +
- "<td><input type='checkbox' onclick='selectItemForm()'></td>" +
- "<td>" + (index + 1) + "</td>" +
- "<td>" + item.CKEY + "</td>" +
- "<td>" + item.CNAME + "</td>" +
- "<td>" + item.SHORTNAME + "</td>" +
- "<td>" + item.EXPLAIN + "</td>" +
- "<td>" + item.CTYPENAME + "</td>"
- "</tr>";
- $("#formList tbody").append(itemTr);
- })
- } else {
- $(".formPartRight .sp-table-tip").show();
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //打开设置表单的弹出层
- function openFormLayer() {
- $("#formUnit").val(unitList[0].CODE);
- $("#selectAll").prop('checked', false);
- $(".formTypeBox>.typeItem").removeClass("active");
- getFormType();
- sp.layer('#layer_formset');
- }
- //改变机构函数
- function changeUnit() {
- var nowUnit = $("#formUnit").val();
- getFormType();
- }
- //更改表单类型
- function changeFormType(code, obj) {
- $("#selectAll").prop('checked', false);
- $(".formTypeBox>.typeItem").removeClass("active");
- $(obj).addClass("active");
- getFormList();
- }
- //全选或者取消全选表单
- function selectAllForm() {
- var selectAllFlog = $("#selectAll").is(":checked");
- $("#formList tbody input[type='checkbox']").prop('checked', selectAllFlog);
- }
- //点击单个表单函数
- function selectItemForm() {
- var selectNum = $("#formList tbody input[type='checkbox']:checked").length;
- var totalNum = $("#formList tbody input[type='checkbox']").length;
- if (selectNum == totalNum) {
- $("#selectAll").prop('checked', true);
- } else {
- $("#selectAll").prop('checked', false);
- }
- }
- //保存选择表单
- function saveForm() {
- var formArray = [];
- $("#formList tbody input[type='checkbox']:checked").each(function (e) {
- var formItem = {
- formid: $(this).parents("tr").attr("form-id")
- }
- formArray.push(formItem);
- })
- var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- nodeid: nodeid,
- data: JSON.stringify(formArray)
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flownode/updateNodeForm",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- $(".formTableBox tbody").html("");
- response.data.FORM.forEach(function (item, index) {
- var itemTD =
- "<tr form-id='" + item.FORMID + "'>" +
- "<td class='sp-text-left sp-pl-10'>" + item.FORMNAME + "</td>" +
- "<td class='delFormbtn'><i class='fa fa-close' onclick='deleteNodeForm(\"" + item.FORMID + "\"," + index + ")'></i></td>" +
- "</tr>";
- $(".formTableBox tbody").append(itemTD);
- })
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //打开人员编辑层
- function openUserLayer() {
- $("#userUnit").val(unitList[0].CODE);
- $("#departAll").prop("checked", true);
- $("#roleAll").prop("checked", true);
- $("#groupAll").prop("checked", true);
- $("#userAll").prop("checked", true);
- $("#nowDepart").html("[全部部门]");
- $("#nowRole").html("[全部角色]");
- $("#nowGroup").html("[全部群组]");
- $("#nowUser").html("[全部人员]");
- $("#nowUnit").html(unitList[0].SECTION);
- getUserDepart();
- getUserRole();
- getUserGroup();
- getUserList();
- $("#layer_selectUser .msgContentBox").hide();
- $("#layer_selectUser").attr("data-title", "人员设置");
- $("#layer_selectUser .sp-layer-title").html("人员设置");
- //下面的流向提醒设置中需要置空的数据
- $("#rtxmsgFlag").prop("checked", false);
- $("#smsmsgFlag").prop("checked", false);
- $("#rtxmsgContent").val("");
- $("#smsmsgContent").val("");
- sp.layer('#layer_selectUser');
- }
- //获取人员部门
- function getUserDepart() {
- var postData = {
- code: $("#userUnit").val()
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/sect/querySect",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- $(".treeList").html("");
- response.data.forEach(function (item, index) {
- if (item.C_H_I_L_D.length > 0) {
- var firstLi = "<li>" +
- "<a><i class='fa fa-plus-square-o'></i><i class='fa fa-minus-square-o'></i><span>" + item.SECTION + "</span></a>" +
- "<ul></ul>"
- "</li>";
- } else {
- var firstLi = "<li class='sp-tree-nochild'><a><span>" + item.SECTION + "</span></a></li>";
- }
- $(".treeList").append(firstLi);
- item.C_H_I_L_D.forEach(function (item2, index2) {
- if (item2.C_H_I_L_D.length > 0) {
- var secondLi = "<li>" +
- "<a><i class='fa fa-plus-square-o'></i><i class='fa fa-minus-square-o'></i><span data-code='" + item2.CODE + "' onclick='selectDeprt(this)'>" + item2.SECTION + "</span></a>" +
- "<ul></ul>"
- "</li>";
- } else {
- var secondLi = "<li class='sp-tree-nochild'><a><span data-code='" + item2.CODE + "' onclick='selectDeprt(this)'>" + item2.SECTION + "</span></a></li>"
- }
- $(".treeList>li").eq(index).children("ul").append(secondLi);
- item2.C_H_I_L_D.forEach(function (item3, index3) {
- var thirdLi = "<li class='sp-tree-nochild'><a><span data-code='" + item3.CODE + "' onclick='selectDeprt(this)'>" + item3.SECTION + "</span></a></li>";
- $(".treeList>li").eq(index).children("ul").children("li").eq(index2).children("ul").append(thirdLi);
- })
- })
- })
- //树形的伸缩
- $(".sp-tree").find("a>i").each(function () {
- $(this).on("click", function () {
- if ($(this).parent().hasClass("hasclick")) {
- $(this).parent().removeClass("hasclick");
- if ($(this).parent().parent().find("ul").length > 0) {
- $(this).parent().parent().children("ul").children("li").hide();
- $(this).parent().children(".fa-minus-square-o").hide();
- $(this).parent().children(".fa-plus-square-o").show();
- }
- ;
- } else {
- $(this).parent().addClass("hasclick");
- if ($(this).parent().parent().find("ul").length > 0) {
- $(this).parent().parent().children("ul").children("li").show();
- $(this).parent().children(".fa-minus-square-o").css({"display": "inline-block"});
- $(this).parent().children(".fa-plus-square-o").hide();
- }
- ;
- }
- });
- });
- $(".treeList>li").eq(0).children("a").find(".fa-plus-square-o").click();
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //获取角色
- function getUserRole() {
- var postData = {
- unitid: $("#userUnit").val()
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/datazu/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- $(".roleList").html("");
- response.data.forEach(function (item) {
- var itemRole = "<span data-code='" + item.ZID + "' class='sp-lh-20' onclick='selectRole(this)'>" + item.ZUM + "</span>";
- $(".roleList").append(itemRole);
- })
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //获取群组
- function getUserGroup() {
- var postData = {
- unitid: $("#userUnit").val()
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/datagroup/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- $(".groupList").html("");
- response.data.forEach(function (item) {
- var itemRole = "<span class='sp-lh-20' data-code='" + item.GID + "' onclick='selectGroup(this)'>" + item.GUM + "</span>";
- $(".groupList").append(itemRole);
- })
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //根据函数来检索用户
- function getUserList() {
- var postData = {
- unitid: $("#userUnit").val(),
- departid: "",
- zid: "",
- gid: ""
- }
- if ($("#departAll").is(":checked")) {
- postData.departid = "";
- } else {
- postData.departid = $(".treeList .activeBtn").eq(0).children("span").attr("data-code");
- }
- if ($("#roleAll").is(":checked")) {
- postData.zid = "";
- } else {
- postData.zid = $(".roleList .activeBtn").eq(0).attr("data-code");
- }
- if ($("#groupAll").is(":checked")) {
- postData.gid = "";
- } else {
- postData.gid = $(".groupList .activeBtn").eq(0).attr("data-code");
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/user/queryUserByUnitidDepartidZidGid",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- $(".userList").html("");
- response.data.forEach(function (item) {
- var itemRole = "<span class='sp-lh-20' data-code='" + item.USERID + "' onclick='selectUser(this)'>" + item.USHOWNAME + "</span>";
- $(".userList").append(itemRole);
- })
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //改变机构
- function changeUserUnit() {
- $("#departAll").prop("checked", true);
- $("#roleAll").prop("checked", true);
- $("#groupAll").prop("checked", true);
- $("#userAll").prop("checked", true);
- $("#nowDepart").html("[全部部门]");
- $("#nowRole").html("[全部角色]");
- $("#nowGroup").html("[全部群组]");
- $("#nowUser").html("[全部人员]");
- $("#nowUnit").html($("#userUnit").find("option:selected").text())
- getUserDepart();
- getUserRole();
- getUserGroup();
- getUserList();
- }
- //点击部门
- function selectDeprt(obj) {
- $(".treeList a").removeClass("activeBtn");
- $(obj).parent().addClass("activeBtn");
- $("#departAll").prop("checked", false);
- $("#nowDepart").html($(obj).html());
- $("#userAll").prop("checked", true);
- $("#nowUser").html("[全部人员]");
- getUserList();
- }
- //点击角色
- function selectRole(obj) {
- $(".roleList span").removeClass("activeBtn");
- $(obj).addClass("activeBtn");
- $("#roleAll").prop("checked", false);
- $("#nowRole").html($(obj).html());
- $("#userAll").prop("checked", true);
- $("#nowUser").html("[全部人员]");
- getUserList();
- }
- //点击群组
- function selectGroup(obj) {
- $(".groupList span").removeClass("activeBtn");
- $(obj).addClass("activeBtn");
- $("#groupAll").prop("checked", false);
- $("#nowGroup").html($(obj).html());
- $("#userAll").prop("checked", true);
- $("#nowUser").html("[全部人员]");
- getUserList();
- }
- //点击用户
- function selectUser(obj) {
- $(".userList span").removeClass("activeBtn");
- $(obj).addClass("activeBtn");
- $("#userAll").prop("checked", false);
- $("#nowUser").html($(obj).html());
- }
- //设置为全部部门
- function clickAllDepart() {
- var selectAllFlog = $("#departAll").is(":checked");
- if (selectAllFlog) {
- $(".treeList a").removeClass("activeBtn");
- $("#nowDepart").html("[全部部门]");
- getUserList()
- }
- }
- //设置为全部角色
- function clickAllRole() {
- var selectAllFlog = $("#roleAll").is(":checked");
- if (selectAllFlog) {
- $(".roleList span").removeClass("activeBtn");
- $("#nowRole").html("[全部角色]");
- getUserList()
- }
- }
- //设置为全部群组
- function clickAllGroup() {
- var selectAllFlog = $("#groupAll").is(":checked");
- if (selectAllFlog) {
- $(".groupList span").removeClass("activeBtn");
- $("#nowGroup").html("[全部群组]");
- getUserList()
- }
- }
- //设置为全部用户
- function clickAllUser() {
- var selectAllFlog = $("#userAll").is(":checked");
- if (selectAllFlog) {
- $(".userList span").removeClass("activeBtn");
- $("#nowUser").html("[全部用户]");
- getUserList()
- }
- }
- //节点上配置保存人员
- function saveUser() {
- var userArray = [{
- unitid: "",
- did: "",
- zid: "",
- gid: "",
- rid: ""
- }];
- userArray[0].unitid = $("#userUnit").val();
- if ($("#departAll").is(":checked")) {
- userArray[0].did = "";
- } else {
- userArray[0].did = $(".treeList .activeBtn").eq(0).children("span").attr("data-code");
- }
- if ($("#roleAll").is(":checked")) {
- userArray[0].zid = "";
- } else {
- userArray[0].zid = $(".roleList .activeBtn").eq(0).attr("data-code");
- }
- if ($("#groupAll").is(":checked")) {
- userArray[0].gid = "";
- } else {
- userArray[0].gid = $(".groupList .activeBtn").eq(0).attr("data-code");
- }
- if ($("#userAll").is(":checked")) {
- userArray[0].rid = "";
- } else {
- userArray[0].rid = $(".userList .activeBtn").eq(0).attr("data-code");
- }
- var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- nodeid: nodeid,
- data: JSON.stringify(userArray)
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flownode/updateNodeUsers",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- $("#nodeUserList").html("");
- response.data.USERS.forEach(function (item, index) {
- var itemDiv = "<div class='itemUser'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteNodeUser(\"" + item.UNITID + "\",\"" + item.DID + "\",\"" + item.ZID + "\",\"" + item.GID + "\",\"" + item.RID + "\"," + index + ")'></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>机构:</div><div class='itemVal'>" + item.UNITIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>部门:</div><div class='itemVal'>" + item.DIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>角色:</div><div class='itemVal'>" + item.ZIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>群组:</div><div class='itemVal'>" + item.GIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>人员:</div><div class='itemVal'>" + item.RIDNAME + "</div></div>" +
- "</div>"
- $("#nodeUserList").append(itemDiv);
- })
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //点击流向调用的函数
- function clickFlow(flowid) {
- //流向编辑有三个tab,先控制tab的显示隐藏
- $(".tabItem").removeClass("sp-list-type-active");
- $(".tabItem").eq(0).addClass("sp-list-type-active");
- $(".tabInfo").hide();
- $(".tabInfo").eq(0).show();
- $("#bpmnSetRightPartFlow").attr("flowid", flowid);
- $("#bpmnSetRightPart").attr("nodeid", "");
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {directionid: directionid};
- //选获取选项列表数据生成选项的html再获取选项的值,顺序不能乱,会出问题!!!!
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/queryInfoStatus",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- $("#toinfoStatus").html("");
- response.data.forEach(function (item) {
- var itemOption = "<option value='" + item.CODE + "'>" + item.CNAME + "</option>";
- $("#toinfoStatus").append(itemOption);
- });
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- //当前流向为空时,隐藏右侧表单信息
- if (Object.keys(response.data).length != 0) {
- $("#bpmnSetRightPart").hide();
- $("#bpmnSetRightPartFlow").show();
- initFlowPart(response.data);
- } else {
- $("#bpmnSetRightPart").hide();
- $("#bpmnSetRightPartFlow").hide();
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- function initFlowPart(flowInfo) {
- //初始化的时候先隐藏子流程的配置,当流向的目标节点是子流程时显示当前的配置
- //console.log(flowInfo);
- $(".itemConfig").hide();
- var postData = {
- directionid: flowInfo.DIRECTIONID
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/queryDataFromView",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- $("#directionKid").html(flowInfo.DIRECTIONKID);
- $("#directionCname").val(flowInfo.CNAME);
- $("#directionRunid").val(flowInfo.RUNID);
- $("#directionExplain").val(flowInfo.EXPLAIN);
- if (flowInfo.CANGOBACK == "" || flowInfo.CANGOBACK == "false") {
- $("#canGoBack").prop("checked", false);
- } else {
- $("#canGoBack").prop("checked", true);
- }
- if (flowInfo.CANTESONG == "" || flowInfo.CANTESONG == "false") {
- $("#canTeSong").prop("checked", false);
- } else {
- $("#canTeSong").prop("checked", true);
- }
- if (flowInfo.SENDRULE == "") {
- $("#sendendrule").html("");
- $("#sendrule").val(0);
- $("#sendendruleBox").hide();
- } else {
- if (flowInfo.SENDRULE == 2) {
- $("#sendendrule").html("");
- $("#sendendrule").append("<option value=\"0\">有一个完成就结束</option>").append("<option value=\"1\">全部都完成才结束</option>")
- $("#sendendruleBox").show();
- } else if (flowInfo.SENDRULE == 3) {
- $("#sendendrule").html("");
- $("#sendendrule").append("<option value=\"0\">一个完成后下一个继续</option>").append("<option value=\"1\">一个抢件后其他不可见</option>")
- $("#sendendruleBox").show();
- } else {
- $("#sendendruleBox").hide();
- }
- $("#sendrule").val(flowInfo.SENDRULE);
- }
- if (flowInfo.SENDENDRULE == "") {
- $("#sendendrule").val(0);
- } else {
- $("#sendendrule").val(flowInfo.SENDENDRULE);
- }
- if (flowInfo.TOINFOSTATUS == "") {
- $("#toinfoStatus").val("START");
- } else {
- $("#toinfoStatus").val(flowInfo.TOINFOSTATUS);
- }
- $("#valueSetList").html("");
- flowInfo.VALUESET.forEach(function (item, index) {
- if (item.ANDOR == "0") {
- item.ANDOR_Name = "启动";
- } else {
- item.ANDOR_Name = "关闭";
- }
- if (item.COLVALUE.indexOf("@") == 0) {
- $("#valueSet option").each(function (e) {
- if ($("#valueSet option").eq(e).val() == item.COLVALUE) {
- item.COLVALUE_Name = $("#valueSet option").eq(e).html();
- }
- })
- } else {
- item.COLVALUE_Name = item.COLVALUE;
- }
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteValueset(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>赋值状态:</div><div class='itemVal'>" + item.ANDOR_Name + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>赋值:</div><div class='itemVal'>" + item.COLVALUE_Name + "</div></div>" +
- "</div>"
- $("#valueSetList").append(itemDiv);
- })
- $("#ruleList").html("");
- flowInfo.RULE.forEach(function (item, index) {
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteRuleset(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>判断符号:</div><div class='itemVal'>" + item.COLLOGIC + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>判断值:</div><div class='itemVal'>" + item.COLVALUE + "</div></div>" +
- "</div>"
- $("#ruleList").append(itemDiv);
- })
- //涉及子流程的业务处理
- //如果流向的目标节点是子流程,需要显示子流程的配置功能
- if (parseInt(response.data.ENDNODETYPE) == 4) {
- $(".itemConfig").show();
- if (flowInfo.TZHIRULE == "" || flowInfo.TZHIRULE == undefined || flowInfo.TZHIRULE == null) {
- $("#noticeSelect").val(0);
- } else {
- $("#noticeSelect").val(parseInt(flowInfo.TZHIRULE));
- }
- if (flowInfo.CONTRULE == "" || flowInfo.CONTRULE == undefined || flowInfo.CONTRULE == null) {
- $("#continueSelect").val(0);
- } else {
- $("#continueSelect").val(parseInt(flowInfo.CONTRULE));
- }
- } else {
- $("#noticeSelect").val(0);
- $("#continueSelect").val(0);
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //改变转发规则的函数
- function changesSendrule() {
- $("#sendendrule").html("");
- var nowSendrule = $("#sendrule").val();
- if (nowSendrule == 2) {
- $("#sendendrule").append("<option value=\"0\">有一个完成就结束</option>").append("<option value=\"1\">全部都完成才结束</option>")
- $("#sendendruleBox").show();
- } else if (nowSendrule == 3) {
- $("#sendendrule").append("<option value=\"0\">一个完成后下一个继续</option>").append("<option value=\"1\">一个抢件后其他不可见</option>")
- $("#sendendruleBox").show();
- } else {
- $("#sendendruleBox").hide();
- }
- updateFlowInfo();
- }
- //流向弹窗中切换tab页的
- function changeTab(num) {
- $(".tabItem").removeClass("sp-list-type-active");
- $(".tabInfo").hide();
- $(".tabInfo").eq(num).show();
- $(".tabItem").eq(num).addClass("sp-list-type-active");
- if (num == 0) {
- getBaseInfo();
- } else if (num == 1) {
- getViewInfo();
- } else if (num == 2) {
- getExtraInfo();
- }
- }
- //获取流向的基本信息
- function getBaseInfo() {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {directionid: directionid};
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- initFlowPart(response.data);
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //获取流向的视图信息
- function getViewInfo() {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {directionid: directionid};
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/queryDataVusers",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- //console.log(JSON.stringify(response))
- initViewInfo(response.data);
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //根据流向的视图信息初始化流向面板
- function initViewInfo(viewInfo) {
- //console.log(JSON.stringify(viewInfo));
- $(".viewContentBox").html("");
- $(".viewUserBox tbody").html("");
- $("#userRuleList").html("");
- $("#userRuleListCopy").html("");
- viewInfo.FORMEDIT.forEach(function (item, index) {
- var itemView = "<div class='itemView' form-edit-id='" + item.FORMEDITID + "' >" +
- "<div class='itemViewName' title=\"" + item.FORMEDITID + "\">" + item.FORMEDITCNAME + "</div>" +
- "<div class='itemViewBtn'>" +
- "<i class='fa fa-arrow-up' title='上移视图' onclick='changeDirectionViewIndex(" + index + ",\"up\")'></i>" +
- "<i class='fa fa-arrow-down' title='下移视图' onclick='changeDirectionViewIndex(" + index + ",\"down\")'></i>" +
- "<i class='fa fa-tags' title='视图可见规则' onclick='openViewRuleLayer(\"" + item.FORMEDITID + "\"," + index + ")'></i>" +
- "<i class='fa fa-close' onclick='deleteView(\"" + item.FORMEDITID + "\"," + index + ")' ></i>" +
- "</div>" +
- "</div>"
- var itemList = "<div class='viewRuleList'></div>"
- $(".viewContentBox").append(itemView).append(itemList);
- item.RULE.forEach(function (item2, index2) {
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteViewRule(\"" + item2.FORMEDITID + "\",\"" + item2.BILLKEY + "\",\"" + item2.COLNAME + "\"," + index2 + ")' ></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item2.ANDOR + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item2.BILLKEY + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item2.COLNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>判断符号:</div><div class='itemVal'>" + item2.COLLOGIC + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>判断值:</div><div class='itemVal'>" + item2.COLVALUE + "</div></div>" +
- "</div>"
- $(".viewContentBox .viewRuleList").eq(index).append(itemDiv);
- })
- });
- $("#tabPartTitle_viewUserBox_num").text("");
- var set_viewUserBox_num = "(" + viewInfo.USERS.length + ")";
- $("#tabPartTitle_viewUserBox_num").text(set_viewUserBox_num);
- viewInfo.USERS.forEach(function (item, index) {
- var set_delete_i = "";
- if (item.MARKDELETE == "1") {
- set_delete_i = "<i class='fa fa-close' onclick='deleteDirectionUser(\"" + item.RID + "\"," + index + ")'></i>";
- } else {
- set_delete_i = "";
- }
- var itemTD =
- "<tr user-id='" + item.RID + "'>" +
- //"<td class='sp-text-left sp-pl-10'>" + item.RID + "</td>" +
- "<td class='sp-text-left sp-pl-10'>" + item.RIDCNAME + "</td>" +
- "<td class='delFormbtn' style='width: 40px;'>" + set_delete_i +
- "</td>" +
- "</tr>";
- $(".viewUserBox tbody").append(itemTD);
- })
- viewInfo.USERSRULE.forEach(function (item, index) {
- $("#userCollogic option").each(function (e) {
- if ($("#userCollogic option").eq(e).val() == item.COLLOGIC) {
- item.COLLOGIC_Name = $("#userCollogic option").eq(e).html();
- }
- })
- $("#userColvalue option").each(function (e) {
- if ($("#userColvalue option").eq(e).val() == item.COLVALUE) {
- item.COLVALUE_Name = $("#userColvalue option").eq(e).html();
- }
- })
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteDirectionUserRule(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>表单列存储值:</div><div class='itemVal'>" + item.COLLOGIC_Name + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>人员过滤条件:</div><div class='itemVal'>" + item.COLVALUE_Name + "</div></div>" +
- "</div>"
- $("#userRuleList").append(itemDiv);
- })
- viewInfo.USERSRULECOPY.forEach(function (item, index) {
- $("#userCollogicCopy option").each(function (e) {
- if ($("#userCollogicCopy option").eq(e).val() == item.COLLOGIC) {
- item.COLLOGIC_Name = $("#userCollogicCopy option").eq(e).html();
- }
- })
- $("#userColvalueCopy option").each(function (e) {
- if ($("#userColvalueCopy option").eq(e).val() == item.COLVALUE) {
- item.COLVALUE_Name = $("#userColvalueCopy option").eq(e).html();
- }
- })
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteDirectionUserRuleCopy(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>表单列存储值:</div><div class='itemVal'>" + item.COLLOGIC_Name + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>人员过滤条件:</div><div class='itemVal'>" + item.COLVALUE_Name + "</div></div>" +
- "</div>"
- $("#userRuleListCopy").append(itemDiv);
- })
- }
- //获取流向的高级信息
- function getExtraInfo() {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {directionid: directionid};
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/queryDataMsgconfig",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- //console.log(response);
- initExtraInfo(response.data);
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- function initExtraInfo(extraInfo) {
- if (extraInfo.RTXMSGMARK == "false" || extraInfo.RTXMSGMARK == "") {
- $("#rtxmsgRemark").prop('checked', false);
- } else {
- $("#rtxmsgRemark").prop('checked', true);
- }
- if (extraInfo.SMSMSGMARK == "false" || extraInfo.SMSMSGMARK == "") {
- $("#smsmsgRemark").prop('checked', false);
- } else {
- $("#smsmsgRemark").prop('checked', true);
- }
- $("#rtxmsg").val(extraInfo.RTXMSG);
- $("#smsmsg").val(extraInfo.SMSMSG);
- $("#msgRuleList").html("");
- extraInfo.MSGCONFIG.forEach(function (item, index) {
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteDirectionMsgRule(\"" + item.UNITID + "\",\"" + item.DID + "\",\"" + item.ZID + "\",\"" + item.GID + "\",\"" + item.RID + "\"," + index + ")'></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>机构:</div><div class='itemVal'>" + item.UNITIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>部门:</div><div class='itemVal'>" + item.DIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>角色:</div><div class='itemVal'>" + item.ZIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>群组:</div><div class='itemVal'>" + item.GIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>人员:</div><div class='itemVal'>" + item.RIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>即时消息:</div><div class='itemVal' style='width: 150px;'>" + item.RTXMSG + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>手机短信:</div><div class='itemVal' style='width: 150px;'>" + item.SMSMSG + "</div></div>" +
- "</div>"
- $("#msgRuleList").append(itemDiv);
- })
- }
- //更新节点的基本信息
- function updateNodeInfo() {
- var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- nodeid: nodeid,
- cname: $(".nodeName").val(),
- timelimit: $(".nodeTime").val(),
- explain: $(".nodeRemark").val(),
- type: "",
- toflowid: "",
- toflowcname: "",
- markmerge: ""
- };
- var typeName = $(".nodeType").html();
- nodeTypeList.forEach(function (item) {
- if (item.name == typeName) {
- postData.type = item.type
- }
- })
- var itemFlowNum = $(".itemFlowBox tbody").find("tr").length;
- if (itemFlowNum == 1) {
- postData.toflowid = $(".itemFlowBox tbody").find("tr").eq(0).attr("flow-id");
- postData.toflowcname = $(".itemFlowBox tbody").find("tr>td").eq(0).html();
- } else if (itemFlowNum == 0) {
- }
- ///判断是否合流
- if ($("#chb_isMarkmerge").is(":checked")) {
- postData.markmerge = "true";
- } else {
- postData.markmerge = "false";
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flownode/updateNode",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- ///是否合流
- function updateNodeMarkmerge() {
- updateNodeInfo();
- };
- //更新流向的基本信息
- function updateFlowInfo() {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- cname: $("#directionCname").val(),
- cangoback: false,
- cantesong: false,
- runid: $("#directionRunid").val(),
- sendrule: $("#sendrule").val(),
- sendendrule: ($("#sendrule").val() == 2 || $("#sendrule").val() == 3) ? $("#sendendrule").val() : 0,
- toinfostatus: $("#toinfoStatus").val(),
- explain: $("#directionExplain").val(),
- //下面两个参数是子流程需要的配置,当流向的目标节点是子流程的时候显示在流向配置层
- tzhirule: $("#noticeSelect").val(),
- contrule: $("#continueSelect").val()
- };
- if ($("#canGoBack").is(":checked")) {
- postData.cangoback = true;
- } else {
- postData.cangoback = false;
- }
- if ($("#canTeSong").is(":checked")) {
- postData.cantesong = true;
- } else {
- postData.cantesong = false;
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/updateDirection",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- function changeRtxmsg() {
- if ($("#rtxmsgRemark").is(":checked")) {
- $("#rtxmsg").val("您刚刚收到了@TITLE,请您尽快办理。");
- } else {
- $("#rtxmsg").val("");
- }
- updateFlowExtraInfo();
- }
- function changeSmsmsg() {
- if ($("#smsmsgRemark").is(":checked")) {
- $("#smsmsg").val("您刚刚收到了@TITLE,请您尽快办理。");
- } else {
- $("#smsmsg").val("");
- }
- updateFlowExtraInfo();
- }
- //更新流向的高级信息
- function updateFlowExtraInfo() {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- rtxmsg: $("#rtxmsg").val(),
- smsmsg: $("#smsmsg").val()
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/updateDirectionMsg",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //打开流向赋值功能设置
- function openDirectionValuesetLayer() {
- $("#valueState").val(0);
- $("#valueSet").val("@USERID");
- getDirectionFormData("#valueTable", "#valueColname", "", "");
- sp.layer('#layer_directionValueset');
- }
- //获取指定流程的表单和列
- function getDirectionFormData(a, b, c, d) {
- $(a).html("");
- $(b).html("");
- $(d).html("");
- var postData = {copyrightid: copyrightid};
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/form/queryFormByCopyrightid",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- //console.log(response);
- response.data.forEach(function (item, index) {
- //默认打开设置层初始选中第一张表
- if (index == 0) {
- var itemOption = "<option selected value='" + item.BILLKEY + "'>" + item.CNAME + "</option>"
- } else {
- var itemOption = "<option value='" + item.BILLKEY + "'>" + item.CNAME + "</option>"
- }
- $(a).append(itemOption);
- })
- //默认打开设置层初始选中第一张表的第一个字段
- var sendData = {tablename: response.data[0].BILLKEY};
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/form/queryColnameByTablename",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(sendData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- response.data.forEach(function (item, index) {
- //默认打开设置层初始选中第一张表
- if (index == 0) {
- var itemOption = "<option selected data-tchild='" + item.TCHILD + "' data-tdata='" + item.TDATA + "' data-tshow='" + item.TSHOW + "' value='" + item.CODE + "'>" + item.CNAME + "</option>"
- } else {
- var itemOption = "<option data-tchild='" + item.TCHILD + "' data-tdata='" + item.TDATA + "' data-tshow='" + item.TSHOW + "' value='" + item.CODE + "'>" + item.CNAME + "</option>"
- }
- $(b).append(itemOption);
- })
- //可见性查询表结构时需要继续往下深入查询
- if (c == "") {
- } else {
- if (response.data[0].TCHILD == "") {
- var inputSting = "<input class='sp-input' type='text'>";
- $(d).append(inputSting);
- } else {
- var infoData = {
- tchild: response.data[0].TCHILD,
- tdata: response.data[0].TDATA,
- tshow: response.data[0].TSHOW,
- twhere: ""
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/form/queryTchildByName",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(infoData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- response.data.forEach(function (item) {
- var itemString = "<label class='itemLabel' data-code='" + item.CODE + "'><input type='checkbox'>" + item.CNAME + "</label>";
- $(d).append(itemString);
- })
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //改变表选项的同时去更新列选项
- function changeDirectionForm(a, b) {
- $(b).html("");
- var sendData = {tablename: $(a).val()};
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/form/queryColnameByTablename",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(sendData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- response.data.forEach(function (item, index) {
- //默认打开设置层初始选中第一张表
- if (index == 0) {
- var itemOption = "<option data-tchild='" + item.TCHILD + "' data-tdata='" + item.TDATA + "' data-tshow='" + item.TSHOW + "' selected value='" + item.CODE + "'>" + item.CNAME + "</option>"
- } else {
- var itemOption = "<option data-tchild='" + item.TCHILD + "' data-tdata='" + item.TDATA + "' data-tshow='" + item.TSHOW + "' value='" + item.CODE + "'>" + item.CNAME + "</option>"
- }
- $(b).append(itemOption);
- })
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //改变表选项的同时去更新列选项同时更新判断值
- function changeDirectionForm_code(a, b, c) {
- $(b).html("");
- $(c).html("");
- var sendData = {tablename: $(a).val()};
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/form/queryColnameByTablename",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(sendData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- response.data.forEach(function (item, index) {
- //默认打开设置层初始选中第一张表
- if (index == 0) {
- var itemOption = "<option selected data-tchild='" + item.TCHILD + "' data-tdata='" + item.TDATA + "' data-tshow='" + item.TSHOW + "' value='" + item.CODE + "'>" + item.CNAME + "</option>"
- } else {
- var itemOption = "<option data-tchild='" + item.TCHILD + "' data-tdata='" + item.TDATA + "' data-tshow='" + item.TSHOW + "' value='" + item.CODE + "'>" + item.CNAME + "</option>"
- }
- $(b).append(itemOption);
- })
- if (response.data[0].TCHILD == "") {
- var inputSting = "<input class='sp-input' type='text'>";
- $(c).append(inputSting);
- } else {
- var infoData = {
- tchild: response.data[0].TCHILD,
- tdata: response.data[0].TDATA,
- tshow: response.data[0].TSHOW,
- twhere: ""
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/form/queryTchildByName",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(infoData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- response.data.forEach(function (item) {
- var itemString = "<label class='itemLabel' data-code='" + item.CODE + "'><input type='checkbox'>" + item.CNAME + "</label>";
- $(c).append(itemString);
- })
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //改变列的同时去更新判断值
- function changeColname_code(a, b) {
- $(b).html("");
- var tchild = $(a).find("option:selected").attr("data-tchild");
- var tdata = $(a).find("option:selected").attr("data-tdata");
- var tshow = $(a).find("option:selected").attr("data-tshow");
- if (tchild == "") {
- var inputSting = "<input class='sp-input' type='text'>";
- $(b).append(inputSting);
- } else {
- var infoData = {
- tchild: tchild,
- tdata: tdata,
- tshow: tshow,
- twhere: ""
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/form/queryTchildByName",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(infoData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- response.data.forEach(function (item) {
- var itemString = "<label class='itemLabel' data-code='" + item.CODE + "'><input type='checkbox'>" + item.CNAME + "</label>";
- $(b).append(itemString);
- })
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- }
- //更新流向对应的赋值
- function saveDirectionValueset() {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- data: ""
- }
- var valueArray = [];
- valueArray.push({
- billkey: $("#valueTable").val(),
- colname: $("#valueColname").val(),
- collogic: "=",
- colvalue: $("#valueType").val() == 1 ? $("#valueSet").val() : $("#valueInput").val(),
- andor: $("#valueState").val()
- }
- );
- postData.data = JSON.stringify(valueArray);
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/updateDirectionValueset",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- $("#valueSetList").html("");
- response.data.VALUESET.forEach(function (item, index) {
- if (item.ANDOR == "0") {
- item.ANDOR_Name = "启动";
- } else {
- item.ANDOR_Name = "关闭";
- }
- if (item.COLVALUE.indexOf("@") == 0) {
- $("#valueSet option").each(function (e) {
- if ($("#valueSet option").eq(e).val() == item.COLVALUE) {
- item.COLVALUE_Name = $("#valueSet option").eq(e).html();
- }
- })
- } else {
- item.COLVALUE_Name = item.COLVALUE;
- }
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteValueset(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>赋值状态:</div><div class='itemVal'>" + item.ANDOR_Name + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>赋值:</div><div class='itemVal'>" + item.COLVALUE_Name + "</div></div>" +
- "</div>"
- $("#valueSetList").append(itemDiv);
- })
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //更新流向可见性规则
- function saveDirectionRule() {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- data: ""
- }
- var valueArray = [];
- valueArray.push({
- billkey: $("#ruleTable").val(),
- colname: $("#ruleColname").val(),
- collogic: $("#ruleCollogic").val(),
- colvalue: "",
- andor: $("#ruleAndor").val()
- }
- );
- if ($("#ruleColname").find("option:selected").attr("data-tchild") == "") {
- valueArray[0].colvalue = $("#ruleValueBox input[type='text']").val();
- } else {
- var ruleValue = "";
- $("#ruleValueBox input[type='checkbox']:checked").each(function (e) {
- ruleValue += $(this).parent().attr("data-code") + "|";
- })
- valueArray[0].colvalue = ruleValue.substring(0, ruleValue.length - 1);
- }
- postData.data = JSON.stringify(valueArray);
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/updateDirectionRule",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- $("#ruleList").html("");
- response.data.RULE.forEach(function (item, index) {
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteRuleset(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>判断符号:</div><div class='itemVal'>" + item.COLLOGIC + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>判断值:</div><div class='itemVal'>" + item.COLVALUE + "</div></div>" +
- "</div>"
- $("#ruleList").append(itemDiv);
- })
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //打开流向可见性
- function openDirectionRuleLayer() {
- $("#ruleAndor").val("AND");
- $("#ruleCollogic").val("等于");
- getDirectionFormData("#ruleTable", "#ruleColname", "code", "#ruleValueBox");
- sp.layer('#layer_directionRule');
- }
- //打开增加表单视图功能
- function openViewLayer() {
- $("#selectAllView").prop('checked', false);
- $(".viewTypeBox>.typeItem").removeClass("active");
- $(".viewTypeBox>.typeItem").eq(0).addClass("active");
- getViewType();
- sp.layer('#layer_viewset');
- }
- //获取视图分类
- function getViewType() {
- $(".viewTypeBox").html("");
- var postData = {
- copyrightid: copyrightid
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/form/queryFormByCopyrightid",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- response.data.forEach(function (item, index) {
- if (index == 0) {
- var itemType = "<div class='typeItem active' data-type='" + item.FORMID + "' onclick='changeViewType(\"" + item.FORMID + "\",this)'><i class='fa fa-folder'></i> <span>" + item.CNAME + "</span></div>";
- } else {
- var itemType = "<div class='typeItem' data-type='" + item.FORMID + "' onclick='changeViewType(\"" + item.FORMID + "\",this)'><i class='fa fa-folder'></i> <span>" + item.CNAME + "</span></div>";
- }
- $(".viewTypeBox").append(itemType);
- })
- getViewList();
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //加载视图列表
- function getViewList() {
- //根据选中的机构和类型查询表单数据
- var nowForm = $(".viewTypeBox .active").attr("data-type");
- var postData = {
- formid: nowForm,
- }
- $("#viewList tbody").html("");
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/form/queryFormeditByFormid",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- if (response.data.length != 0) {
- $(".viewPartRight .sp-table-tip").hide();
- response.data.forEach(function (item, index) {
- var itemTr =
- "<tr view-id='" + item.FORMEDITID + "'>" +
- "<td><input type='checkbox' onclick='selectItemView()'></td>" +
- "<td>" + (index + 1) + "</td>" +
- "<td title='" + item.FORMEDITID + "'>" + item.FORMEDITID + "</td>" +
- "<td>" + item.CNAME + "</td>" +
- "</tr>";
- $("#viewList tbody").append(itemTr);
- })
- } else {
- $(".viewPartRight .sp-table-tip").show();
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- function changeViewType(code, obj) {
- $("#selectAllView").prop('checked', false);
- $(".viewTypeBox>.typeItem").removeClass("active");
- $(obj).addClass("active");
- getViewList();
- }
- //全选或者取消全选表单
- function selectAllView() {
- var selectAllFlog = $("#selectAllView").is(":checked");
- $("#viewList tbody input[type='checkbox']").prop('checked', selectAllFlog);
- }
- //点击单个表单函数
- function selectItemView() {
- var selectNum = $("#viewList tbody input[type='checkbox']:checked").length;
- var totalNum = $("#viewList tbody input[type='checkbox']").length;
- if (selectNum == totalNum) {
- $("#selectAllView").prop('checked', true);
- } else {
- $("#selectAllView").prop('checked', false);
- }
- }
- //保存选择视图
- function saveView() {
- var viewArray = [];
- $("#viewList tbody input[type='checkbox']:checked").each(function (e) {
- var viewItem = {
- formeditid: $(this).parents("tr").attr("view-id")
- }
- viewArray.push(viewItem);
- })
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- data: JSON.stringify(viewArray)
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/updateDirectionFormedit",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- $(".viewContentBox").html("");
- response.data.FORMEDIT.forEach(function (item, index) {
- var itemView = "<div class='itemView' form-edit-id='" + item.FORMEDITID + "' >" +
- "<div class='itemViewName' title=\"" + item.FORMEDITID + "\">" + item.FORMEDITCNAME + "</div>" +
- "<div class='itemViewBtn'>" +
- "<i class='fa fa-arrow-up' title='上移视图' onclick='changeDirectionViewIndex(" + index + ",\"up\")'></i>" +
- "<i class='fa fa-arrow-down' title='下移视图' onclick='changeDirectionViewIndex(" + index + ",\"down\")'></i>" +
- "<i class='fa fa-tags' title='视图可见规则' onclick='openViewRuleLayer(\"" + item.FORMEDITID + "\"," + index + ")'></i>" +
- "<i class='fa fa-close' onclick='deleteView(\"" + item.FORMEDITID + "\"," + index + ")' ></i>" +
- "</div>" +
- "</div>"
- var itemList = "<div class='viewRuleList'></div>"
- $(".viewContentBox").append(itemView).append(itemList);
- item.RULE.forEach(function (item2, index2) {
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteViewRule(\"" + item2.FORMEDITID + "\",\"" + item2.BILLKEY + "\",\"" + item2.COLNAME + "\"," + index2 + ")' ></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item2.ANDOR + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item2.BILLKEY + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item2.COLNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>判断符号:</div><div class='itemVal'>" + item2.COLLOGIC + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>判断值:</div><div class='itemVal'>" + item2.COLVALUE + "</div></div>" +
- "</div>"
- $(".viewContentBox .viewRuleList").eq(index).append(itemDiv);
- })
- });
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //打开视图可见性弹窗
- function openViewRuleLayer(formeditid, index) {
- $("#viewAndor").val("AND");
- $("#viewCollogic").val("等于");
- getDirectionFormData("#viewTable", "#viewColname", "code", "#viewValueBox");
- $("#layer_viewRule").attr("form-editid", formeditid);
- $("#layer_viewRule").attr("form-index", index);
- sp.layer('#layer_viewRule');
- }
- //保存视图可见性函数
- function saveDirectionViewRule() {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- formeditid: $("#layer_viewRule").attr("form-editid"),
- data: ""
- }
- var valueArray = [];
- valueArray.push({
- billkey: $("#viewTable").val(),
- colname: $("#viewColname").val(),
- collogic: $("#viewCollogic").val(),
- colvalue: "",
- andor: $("#viewAndor").val()
- }
- );
- if ($("#viewColname").find("option:selected").attr("data-tchild") == "") {
- valueArray[0].colvalue = $("#viewValueBox input[type='text']").val();
- } else {
- var ruleValue = "";
- $("#viewValueBox input[type='checkbox']:checked").each(function (e) {
- ruleValue += $(this).parent().attr("data-code") + "|";
- })
- valueArray[0].colvalue = ruleValue.substring(0, ruleValue.length - 1);
- }
- postData.data = JSON.stringify(valueArray);
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/updateDirectionFormeditRule",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- var index = $("#layer_viewRule").attr("form-index");
- $(".viewContentBox .viewRuleList").eq(index).html("");
- response.data.RULE.forEach(function (item, num) {
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteViewRule(\"" + item.FORMEDITID + "\",\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + num + ")' ></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>判断符号:</div><div class='itemVal'>" + item.COLLOGIC + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>判断值:</div><div class='itemVal'>" + item.COLVALUE + "</div></div>" +
- "</div>"
- $(".viewContentBox .viewRuleList").eq(index).append(itemDiv);
- })
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //打开流程人员设置
- function openDirectionUser() {
- $("#directionUnit").val(unitList[0].CODE);
- $("#directionAllDepart").prop("checked", true);
- $("#directionAllUser").prop("checked", false);
- getDirectionDepart();
- sp.layer('#layer_directionUser');
- }
- //流向配置人员加载部门信息
- function getDirectionDepart() {
- var postData = {
- code: $("#directionUnit").val()
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/sect/querySect",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- $(".treeDirectionList").html("");
- response.data.forEach(function (item, index) {
- if (item.C_H_I_L_D.length > 0) {
- var firstLi = "<li>" +
- "<a><i class='fa fa-plus-square-o'></i><i class='fa fa-minus-square-o'></i><span>" + item.SECTION + "</span></a>" +
- "<ul></ul>"
- "</li>";
- } else {
- var firstLi = "<li class='sp-tree-nochild'><a><span>" + item.SECTION + "</span></a></li>";
- }
- $(".treeDirectionList").append(firstLi);
- item.C_H_I_L_D.forEach(function (item2, index2) {
- if (item2.C_H_I_L_D.length > 0) {
- var secondLi = "<li>" +
- "<a><i class='fa fa-plus-square-o'></i><i class='fa fa-minus-square-o'></i><span data-code='" + item2.CODE + "' onclick='selectDirectionDeprt(this)'>" + item2.SECTION + "</span></a>" +
- "<ul></ul>"
- "</li>";
- } else {
- var secondLi = "<li class='sp-tree-nochild'><a><span data-code='" + item2.CODE + "' onclick='selectDirectionDeprt(this)'>" + item2.SECTION + "</span></a></li>"
- }
- $(".treeDirectionList>li").eq(index).children("ul").append(secondLi);
- item2.C_H_I_L_D.forEach(function (item3, index3) {
- var thirdLi = "<li class='sp-tree-nochild'><a><span data-code='" + item3.CODE + "' onclick='selectDirectionDeprt(this)'>" + item3.SECTION + "</span></a></li>";
- $(".treeDirectionList>li").eq(index).children("ul").children("li").eq(index2).children("ul").append(thirdLi);
- })
- })
- })
- //树形的伸缩
- $(".sp-tree").find("a>i").each(function () {
- $(this).on("click", function () {
- if ($(this).parent().hasClass("hasclick")) {
- $(this).parent().removeClass("hasclick");
- if ($(this).parent().parent().find("ul").length > 0) {
- $(this).parent().parent().children("ul").children("li").hide();
- $(this).parent().children(".fa-minus-square-o").hide();
- $(this).parent().children(".fa-plus-square-o").show();
- }
- ;
- } else {
- $(this).parent().addClass("hasclick");
- if ($(this).parent().parent().find("ul").length > 0) {
- $(this).parent().parent().children("ul").children("li").show();
- $(this).parent().children(".fa-minus-square-o").css({"display": "inline-block"});
- $(this).parent().children(".fa-plus-square-o").hide();
- }
- ;
- }
- });
- });
- $(".treeDirectionList>li").eq(0).children("a").find(".fa-plus-square-o").click();
- getDirectionUserList();
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //流向选择人员改变机构
- function changeDirectionUnit() {
- getDirectionDepart();
- }
- //流向选择人员点击部门
- function selectDirectionDeprt(obj) {
- $("#directionAllDepart").prop("checked", false);
- $(".treeDirectionList a").removeClass("activeBtn");
- $(obj).parent().addClass("activeBtn");
- getDirectionUserList();
- }
- //流向选择人员点击全部部门
- function clickAllDirectionDepart() {
- var selectAllFlog = $("#directionAllDepart").is(":checked");
- if (selectAllFlog) {
- $(".treeDirectionList a").removeClass("activeBtn");
- getDirectionUserList();
- }
- }
- //流向选择人员获取人员列表
- function getDirectionUserList() {
- var postData = {
- unitid: $("#directionUnit").val(),
- departid: "",
- zid: "",
- gid: ""
- }
- var nowDepartNum = $(".treeDirectionList .activeBtn").length;
- if (nowDepartNum == 0) {
- postData.departid = "";
- } else {
- postData.departid = $(".treeDirectionList .activeBtn").eq(0).children("span").attr("data-code");
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/user/queryUserByUnitidDepartidZidGid",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- $(".directionUserList").html("");
- response.data.forEach(function (item) {
- var itemRole = "<label><input onclick='selectItemDirectionUser()' data-code='" + item.USERID + "' type='checkbox'><span>" + item.USHOWNAME + "</span></label>";
- $(".directionUserList").append(itemRole);
- })
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //流向保存人员
- function saveDirectionUser() {
- var directionUserArray = [];
- $(".directionUserList input[type='checkbox']:checked").each(function (e) {
- var userItem = {
- rid: $(this).attr("data-code")
- }
- directionUserArray.push(userItem);
- })
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- data: JSON.stringify(directionUserArray)
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/updateDirectionUsers",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- //console.log(JSON.stringify(response));
- sp.layerhide();
- if (response.success) {
- $(".viewUserBox tbody").html("");
- $("#tabPartTitle_viewUserBox_num").text("");
- var set_viewUserBox_num = "(" + viewInfo.USERS.length + ")";
- $("#tabPartTitle_viewUserBox_num").text(set_viewUserBox_num);
- response.data.USERS.forEach(function (item, index) {
- var set_delete_i = "";
- if (item.MARKDELETE == "1") {
- set_delete_i = "<i class='fa fa-close' onclick='deleteDirectionUser(\"" + item.RID + "\"," + index + ")'></i>";
- } else {
- set_delete_i = "";
- }
- var itemTD =
- "<tr user-id='" + item.RID + "'>" +
- //"<td class='sp-text-left sp-pl-10'>" + item.RID + "</td>" +
- "<td class='sp-text-left sp-pl-10'>" + item.RIDCNAME + "</td>" +
- "<td class='delFormbtn' style='width: 40px;'>" + set_delete_i +
- "</td>" +
- "</tr>";
- $(".viewUserBox tbody").append(itemTD);
- })
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //打开人员可见性
- function openUserRuleLayer() {
- $("#userAndor").val("AND");
- $("#userCollogic").val("USERID");
- $("#userColvalue").val("USERA");
- getDirectionFormData("#userTable", "#userColname", "", "");
- sp.layer('#layer_userRule');
- }
- //打开抄送人员可见性
- function openUserRuleCopyLayer() {
- $("#userAndorCopy").val("AND");
- $("#userCollogicCopy").val("USERID");
- $("#userColvalueCopy").val("USERA");
- getDirectionFormData("#userTableCopy", "#userColnameCopy", "", "");
- sp.layer('#layer_userRuleCopy');
- }
- //保存人员可见规则
- function saveUserRule() {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- data: ""
- }
- var valueArray = [];
- valueArray.push({
- billkey: $("#userTable").val(),
- colname: $("#userColname").val(),
- collogic: $("#userCollogic").val(),
- colvalue: $("#userColvalue").val(),
- andor: $("#userAndor").val()
- }
- );
- postData.data = JSON.stringify(valueArray);
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/updateDirectionUsersRule",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- $("#userRuleList").html("");
- response.data.USERSRULE.forEach(function (item, index) {
- $("#userCollogic option").each(function (e) {
- if ($("#userCollogic option").eq(e).val() == item.COLLOGIC) {
- item.COLLOGIC_Name = $("#userCollogic option").eq(e).html();
- }
- })
- $("#userColvalue option").each(function (e) {
- if ($("#userColvalue option").eq(e).val() == item.COLVALUE) {
- item.COLVALUE_Name = $("#userColvalue option").eq(e).html();
- }
- })
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteDirectionUserRule(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>表单列存储值:</div><div class='itemVal'>" + item.COLLOGIC_Name + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>人员功率条件:</div><div class='itemVal'>" + item.COLVALUE_Name + "</div></div>" +
- "</div>"
- $("#userRuleList").append(itemDiv);
- })
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //保存抄送人员可见规则
- function saveUserRuleCopy() {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- data: ""
- }
- var valueArray = [];
- valueArray.push({
- billkey: $("#userTableCopy").val(),
- colname: $("#userColnameCopy").val(),
- collogic: $("#userCollogicCopy").val(),
- colvalue: $("#userColvalueCopy").val(),
- andor: $("#userAndorCopy").val()
- }
- );
- postData.data = JSON.stringify(valueArray);
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/updateDirectionUsersRuleCopy",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- $("#userRuleListCopy").html("");
- response.data.USERSRULECOPY.forEach(function (item, index) {
- $("#userCollogicCopy option").each(function (e) {
- if ($("#userCollogicCopy option").eq(e).val() == item.COLLOGIC) {
- item.COLLOGIC_Name = $("#userCollogicCopy option").eq(e).html();
- }
- })
- $("#userColvalueCopy option").each(function (e) {
- if ($("#userColvalueCopy option").eq(e).val() == item.COLVALUE) {
- item.COLVALUE_Name = $("#userColvalueCopy option").eq(e).html();
- }
- })
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteDirectionUserRuleCopy(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>表单列存储值:</div><div class='itemVal'>" + item.COLLOGIC_Name + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>人员功率条件:</div><div class='itemVal'>" + item.COLVALUE_Name + "</div></div>" +
- "</div>"
- $("#userRuleListCopy").append(itemDiv);
- })
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //打开额外提醒设置
- function openMsgLayer() {
- $("#userUnit").val(unitList[0].CODE);
- $("#departAll").prop("checked", true);
- $("#roleAll").prop("checked", true);
- $("#groupAll").prop("checked", true);
- $("#userAll").prop("checked", true);
- $("#nowDepart").html("[全部部门]");
- $("#nowRole").html("[全部角色]");
- $("#nowGroup").html("[全部群组]");
- $("#nowUser").html("[全部人员]");
- $("#nowUnit").html(unitList[0].SECTION);
- getUserDepart();
- getUserRole();
- getUserGroup();
- getUserList();
- $("#layer_selectUser").attr("data-title", "提醒设置");
- $("#layer_selectUser .sp-layer-title").html("提醒设置");
- $("#layer_selectUser .msgContentBox").show();
- //下面的流向提醒设置中需要置空的数据
- $("#rtxmsgFlag").prop("checked", false);
- $("#smsmsgFlag").prop("checked", false);
- $("#rtxmsgContent").val("");
- $("#smsmsgContent").val("");
- sp.layer('#layer_selectUser');
- }
- function changeRtxmsgFlag() {
- if ($("#rtxmsgFlag").is(":checked")) {
- $("#rtxmsgContent").val("您刚刚收到了@TITLE,请您尽快办理。");
- } else {
- $("#rtxmsgContent").val("");
- }
- }
- function changeSmsmsgFlag() {
- if ($("#smsmsgFlag").is(":checked")) {
- $("#smsmsgContent").val("您刚刚收到了@TITLE,请您尽快办理。");
- } else {
- $("#smsmsgContent").val("");
- }
- }
- //判断当前执行保存用户方法还是保存提醒方法
- function saveUserOrMsg() {
- var nowType = $("#layer_selectUser").attr("data-title");
- if (nowType == "人员设置") {
- saveUser();
- } else {
- saveMsgConfig();
- }
- }
- //保存提醒
- function saveMsgConfig() {
- var userArray = [{
- unitid: "",
- did: "",
- zid: "",
- gid: "",
- rid: "",
- rtxmsg: "",
- smsmsg: ""
- }];
- userArray[0].unitid = $("#userUnit").val();
- if ($("#departAll").is(":checked")) {
- userArray[0].did = "";
- } else {
- userArray[0].did = $(".treeList .activeBtn").eq(0).children("span").attr("data-code");
- }
- if ($("#roleAll").is(":checked")) {
- userArray[0].zid = "";
- } else {
- userArray[0].zid = $(".roleList .activeBtn").eq(0).attr("data-code");
- }
- if ($("#groupAll").is(":checked")) {
- userArray[0].gid = "";
- } else {
- userArray[0].gid = $(".groupList .activeBtn").eq(0).attr("data-code");
- }
- if ($("#userAll").is(":checked")) {
- userArray[0].rid = "";
- } else {
- userArray[0].rid = $(".userList .activeBtn").eq(0).attr("data-code");
- }
- if ($("#rtxmsgFlag").is(":checked")) {
- userArray[0].rtxmsg = $("#rtxmsgContent").val();
- } else {
- userArray[0].rtxmsg = "";
- }
- if ($("#smsmsgFlag").is(":checked")) {
- userArray[0].smsmsg = $("#smsmsgContent").val();
- } else {
- userArray[0].smsmsg = "";
- }
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- data: JSON.stringify(userArray)
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/updateDirectionMsgconfig",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- $("#msgRuleList").html("");
- response.data.MSGCONFIG.forEach(function (item, index) {
- var itemDiv = "<div class='itemBox'>" +
- "<div class='delUserbtn'>" +
- "<i class='fa fa-close' onclick='deleteDirectionMsgRule(\"" + item.UNITID + "\",\"" + item.DID + "\",\"" + item.ZID + "\",\"" + item.GID + "\",\"" + item.RID + "\"," + index + ")'></i>" +
- "</div>" +
- "<div class='itemLine'><div class='itemTitle'>机构:</div><div class='itemVal'>" + item.UNITIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>部门:</div><div class='itemVal'>" + item.DIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>角色:</div><div class='itemVal'>" + item.ZIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>群组:</div><div class='itemVal'>" + item.GIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>人员:</div><div class='itemVal'>" + item.RIDNAME + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>即时消息:</div><div class='itemVal' style='width: 150px;'>" + item.RTXMSG + "</div></div>" +
- "<div class='itemLine'><div class='itemTitle'>手机短信:</div><div class='itemVal' style='width: 150px;'>" + item.SMSMSG + "</div></div>" +
- "</div>"
- $("#msgRuleList").append(itemDiv);
- })
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //删除流程节点对应的表单
- function deleteNodeForm(formid, index) {
- var getDelID = formid;
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- //取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- $("#delDataTrue").click(function () {
- sp.dialoghide();
- var getid = $(this).attr("data-id");
- var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- nodeid: nodeid,
- formid: getid
- };
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flownode/deleteNodeForm",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- getNodeInfo();
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- });
- }
- //删除流程节点对应的人员
- function deleteNodeUser(unitid, did, zid, gid, rid, index) {
- var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- nodeid: nodeid,
- unitid: unitid,
- did: did,
- zid: zid,
- gid: gid,
- rid: rid
- }
- var getDelID = JSON.stringify(postData);
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- //取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- $("#delDataTrue").click(function () {
- sp.dialoghide();
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flownode/deleteNodeUsers",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC($(this).attr("data-id"))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- getNodeInfo();
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- });
- }
- //删除流程流向对应的赋值设置
- function deleteValueset(billkey, colname, index) {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- billkey: billkey,
- colname: colname
- }
- var getDelID = JSON.stringify(postData);
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- //取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- $("#delDataTrue").click(function () {
- sp.dialoghide();
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/deleteDirectionValueset",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC($(this).attr("data-id"))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- getBaseInfo();
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- });
- }
- //删除流程流向对应的可见性规则设置
- function deleteRuleset(billkey, colname, index) {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- billkey: billkey,
- colname: colname
- }
- var getDelID = JSON.stringify(postData);
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- //取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- $("#delDataTrue").click(function () {
- sp.dialoghide();
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/deleteDirectionRule",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC($(this).attr("data-id"))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- getBaseInfo();
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- });
- }
- //删除流向对应的表单视图
- function deleteView(formeditid, index) {
- var ruleNum = $(".viewContentBox .viewRuleList").eq(index).find(".itemBox").length;
- if (ruleNum > 0) {
- sp.dialog("当前视图下已配置可见规则,无法删除");
- } else {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- formeditid: formeditid
- }
- var getDelID = JSON.stringify(postData);
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- //取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- $("#delDataTrue").click(function () {
- sp.dialoghide();
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/deleteDirectionFormedit",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC($(this).attr("data-id"))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- getViewInfo();
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- });
- }
- }
- //删除流向对应的视图的可见规则
- function deleteViewRule(formeditid, billkey, colname, index) {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- formeditid: formeditid,
- billkey: billkey,
- colname: colname
- }
- var getDelID = JSON.stringify(postData);
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- //取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- $("#delDataTrue").click(function () {
- sp.dialoghide();
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/deleteDirectionFormeditRule",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC($(this).attr("data-id"))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- getViewInfo();
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- });
- }
- //删除流向对应人员
- function deleteDirectionUser(rid, index) {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- rid: rid
- }
- var getDelID = JSON.stringify(postData);
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- //取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- $("#delDataTrue").click(function () {
- sp.dialoghide();
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/deleteDirectionUsers",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC($(this).attr("data-id"))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- getViewInfo();
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- });
- }
- //删除流向对应人员的可见性规则
- function deleteDirectionUserRule(billkey, colname, index) {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- billkey: billkey,
- colname: colname
- }
- var getDelID = JSON.stringify(postData);
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- //取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- $("#delDataTrue").click(function () {
- sp.dialoghide();
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/deleteDirectionUsersRule",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC($(this).attr("data-id"))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- getViewInfo();
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- });
- }
- //删除流向对应抄送人员的可见性规则
- function deleteDirectionUserRuleCopy(billkey, colname, index) {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- billkey: billkey,
- colname: colname
- }
- var getDelID = JSON.stringify(postData);
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- //取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- $("#delDataTrue").click(function () {
- sp.dialoghide();
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/deleteDirectionUsersRuleCopy",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC($(this).attr("data-id"))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- getViewInfo();
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- });
- }
- //删除流向对应的高级规则
- function deleteDirectionMsgRule(unitid, did, zid, gid, rid, index) {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- unitid: unitid,
- did: did,
- zid: zid,
- gid: gid,
- rid: rid
- }
- var getDelID = JSON.stringify(postData);
- var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
- var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
- var dialogFoot = "<div class=\"sp-dialog-foot\"><input data-id=" + getDelID + " id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
- $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
- sp.openCenter(".sp-dialog");
- //取消按钮
- $('.sp-closeDialog').click(function (event) {
- sp.closeCenter(".sp-dialog");
- event.preventDefault();
- event.stopPropagation();
- });
- $("#delDataTrue").click(function () {
- sp.dialoghide();
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/deleteDirectionMsgconfig",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC($(this).attr("data-id"))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- getExtraInfo();
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- });
- }
- function clickAllDirectionUser() {
- var selectAllFlog = $("#directionAllUser").is(":checked");
- $(".directionUserList label input[type='checkbox']").prop("checked", selectAllFlog);
- }
- function selectItemDirectionUser() {
- var selectNum = $(".directionUserList label input[type='checkbox']:checked").length;
- var totalNum = $(".directionUserList label input[type='checkbox']").length;
- if (selectNum == totalNum) {
- $("#directionAllUser").prop("checked", true);
- } else {
- $("#directionAllUser").prop("checked", false);
- }
- }
- //核查流程功能
- function checkFlow() {
- var postData = {
- copyrightid: copyrightid,
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flow/queryWorkflowErrors",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- if (response.data.length == 0) {
- sp.dialog("当前流程配置正确");
- } else {
- var contentSting = "";
- response.data.forEach(function (item) {
- contentSting += item + "</br>";
- })
- sp.dialog(contentSting);
- $(".sp-dialog-body").addClass("maxHeight");
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //更新创建流程用户
- function saveFlowCreate() {
- var postData = {
- copyrightid: copyrightid,
- userid: ""
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/desktop/createWorkflowCandoWithUserID",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- sp.dialog("成功更新创建流程用户!");
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //改变流向视图顺序函数
- function changeDirectionViewIndex(index, direction) {
- var nowViewNum = $(".viewContentBox .itemView").length;
- //排除一些不能操作的情况
- if (direction == "up" && index == 0) {
- sp.dialog("无法上移");
- } else if (direction == "down" && index == nowViewNum - 1) {
- sp.dialog("无法下移");
- } else {
- var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- directionid: directionid,
- formeditid1: "",
- formeditid2: ""
- }
- if (direction == "up") {
- postData.formeditid1 = $(".viewContentBox .itemView").eq(index).attr("form-edit-id");
- postData.formeditid2 = $(".viewContentBox .itemView").eq(index - 1).attr("form-edit-id");
- } else {
- postData.formeditid1 = $(".viewContentBox .itemView").eq(index).attr("form-edit-id");
- postData.formeditid2 = $(".viewContentBox .itemView").eq(index + 1).attr("form-edit-id");
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowdirection/swapSortidByDirectionIdFormeditId",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- getViewInfo();
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- }
- getUnitList();
- /*2020-11-20添加赋值类型*/
- function changeValueType() {
- var valueType = $("#valueType").val();
- if (valueType == 1) {
- $("#valueSet").show();
- $("#valueInput").hide();
- } else {
- $("#valueSet").hide();
- $("#valueInput").show();
- }
- }
- //切换节点类别,点击开发新表单
- function changeNodeType() {
- var index = $(".nodeTypeSelect").val();
- if (index == 4) {
- $("#itemFlowTitle").show();
- $("#itemFlowBox").show();
- $("#formTitle").hide();
- $("#formBox").hide();
- } else {
- $("#itemFlowTitle").hide();
- $("#itemFlowBox").hide();
- $("#formTitle").show();
- $("#formBox").show();
- }
- setNodeColor(index);
- //最后一步需要同步节点数据信息,节点类别添加到通用节点数据中
- }
- //打开子流程设置层
- function openItemFlowLayer() {
- $("#itemUserUnit").val(unitList[0].CODE);
- $(".itemFlowTypeBox>.typeItem").removeClass("active");
- $(".itemFlowTypeBox>.typeItem").eq(0).addClass("active");
- getFlowType();
- sp.layer("#layer_itemFlow");
- }
- //获取流程分类
- function getFlowType() {
- var nowUnit = $("#itemUserUnit").val();
- $(".itemFlowTypeBox").html("");
- var baseType = "<div class=\"typeItem active\" data-type='' onclick=\"changeFlowType('',this)\"><i class=\"fa fa-list-ul\"></i> <span>全部流程</span></div>";
- $(".itemFlowTypeBox").append(baseType);
- var postData = {
- pkid: nowUnit,
- includechildren: true
- };
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowkinds/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- typeList = response.data;
- typeList.forEach(function (item) {
- var itemType = "<div class='typeItem' data-type='" + item.PKID + "' onclick='changeFlowType(\"" + item.PKID + "\",this)'><i class='fa fa-folder'></i> <span>" + item.CNAME + "</span></div>";
- $(".itemFlowTypeBox").append(itemType);
- })
- getFlowList();
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //获取流程列表
- function getFlowList() {
- //根据选中的机构和类型查询表单数据
- var nowUnit = $("#itemUserUnit").val();
- var nowType = $(".itemFlowTypeBox .active").attr("data-type");
- var postData = {
- unitid: nowUnit,
- flowkinds: nowType
- }
- $("#itemFlowList tbody").html("");
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flow/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- var nowflowid = $(".itemFlowBox tbody").find("tr").eq(0).attr("flow-id");
- var nowflowname = $(".itemFlowBox tbody").find("tr>td").eq(0).html();
- //还原当前的选中数值
- if (response.data.length != 0) {
- $(".formPartRight .sp-table-tip").hide();
- response.data.forEach(function (item, index) {
- if (item.FLOWID == nowflowid) {
- var itemTr =
- "<tr flow-id='" + item.FLOWID + "' flow-name='" + item.CNAME + "'>" +
- "<td><input type='checkbox' checked onclick=\"selectItemFlow(this)\"></td>" +
- "<td>" + (index + 1) + "</td>" +
- "<td>" + item.CKEY + "</td>" +
- "<td>" + item.CNAME + "</td>" +
- "<td>" + item.TIMELIMIT + "</td>" +
- "<td>" + item.EXPLAIN + "</td>" +
- "</tr>";
- } else {
- var itemTr =
- "<tr flow-id='" + item.FLOWID + "' flow-name='" + item.CNAME + "'>" +
- "<td><input type='checkbox' onclick=\"selectItemFlow(this)\"></td>" +
- "<td>" + (index + 1) + "</td>" +
- "<td>" + item.CKEY + "</td>" +
- "<td>" + item.CNAME + "</td>" +
- "<td>" + item.TIMELIMIT + "</td>" +
- "<td>" + item.EXPLAIN + "</td>" +
- "</tr>";
- }
- $("#itemFlowList tbody").append(itemTr);
- })
- } else {
- $(".formPartRight .sp-table-tip").show();
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //更改表单类型
- function changeFlowType(code, obj) {
- $(".itemFlowTypeBox>.typeItem").removeClass("active");
- $(obj).addClass("active");
- getFlowList();
- }
- //选择流程I(只能选择一个流程)
- function selectItemFlow(obj) {
- var itemFlag = $(obj).is(':checked');
- if (!itemFlag) {
- $(obj).prop('checked', false);
- } else {
- $("#itemFlowList").find("input[type='checkbox']").prop('checked', false);
- $(obj).prop('checked', true);
- }
- }
- //保存选择流程
- function saveFlow() {
- var resultArray = [];
- $("#itemFlowList tbody input[type='checkbox']:checked").each(function (e) {
- var formItem = {
- flowid: $(this).parents("tr").attr("flow-id"),
- flowName: $(this).parents("tr").attr("flow-name")
- }
- resultArray.push(formItem);
- })
- var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- nodeid: nodeid,
- cname: $(".nodeName").val(),
- timelimit: $(".nodeTime").val(),
- explain: $(".nodeRemark").val(),
- type: "",
- toflowid: "",
- toflowcname: "",
- markmerge: ""
- };
- var typeName = $(".nodeType").html();
- nodeTypeList.forEach(function (item) {
- if (item.name == typeName) {
- postData.type = item.type
- }
- })
- if (resultArray.length == 0) {
- postData.toflowid = 0;
- postData.toflowcname = "尚未配置子流程";
- } else {
- postData.toflowid = resultArray[0].flowid;
- postData.toflowcname = resultArray[0].flowName;
- }
- ///判断是否合流
- if ($("#chb_isMarkmerge").is(":checked")) {
- postData.markmerge = "true";
- } else {
- postData.markmerge = "false";
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flownode/updateNode",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- sp.layerhide();
- if (response.success) {
- $(".itemFlowBox tbody").html("");
- if (postData.toflowid != "" && postData.toflowcname != "") {
- var itemTD =
- "<tr flow-id='" + postData.toflowid + "'>" +
- "<td class='sp-text-left sp-pl-10'>" + postData.toflowcname + "</td>" +
- "<td class='delFormbtn'><i class='fa fa-edit' onclick='openEditFlowLayer(this)'></i></td>" +
- "</tr>";
- $(".itemFlowBox tbody").append(itemTD);
- } else {
- var itemTD =
- "<tr flow-id='0'>" +
- "<td class='sp-text-left sp-pl-10'>尚未配置子流程</td>" +
- "<td class='delFormbtn'><i class='fa fa-edit' onclick='openEditFlowLayer(this)'></i></td>" +
- "</tr>";
- $(".itemFlowBox tbody").append(itemTD);
- }
- } else {
- setTimeout(function () {
- sp.dialog(res.message);
- }, 1000)
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //改变流程节点颜色函数(model参数表示当前需要变色的节点类型)
- function setNodeColor(model) {
- // {"type": 0, "name": "开始"},
- // {"type": 1, "name": "结束"},
- // {"type": 2, "name": "任务"},
- // {"type": 3, "name": "网关"},
- // {"type": 4, "name": "子流程"},
- // {"type": 5, "name": "边界事件"}
- var colorBaseConfig = [{model: 4, strokeColor: "rgb(255,86,60)", fillColor: "rgb(255,86,60,0.4)"}];
- //颜色基本配置函数包括两种一种是填充颜色,一种是边框颜色,需要就在里面自己加,fillColor要用rgba颜色,要有透明度不然看不清
- var itemStrokeColor = "";
- var itemFillColor = "";
- //没有携带传递参数则当前
- colorBaseConfig.forEach(function (item) {
- if (item.model == model) {
- itemStrokeColor = item.strokeColor;
- itemFillColor = item.fillColor;
- }
- })
- var nodeid = $("#bpmnSetRightPart").attr("nodeid");
- var elementRegistry = bpmnModeler.get('elementRegistry');
- var modeling = bpmnModeler.get('modeling');
- var elementToColor = elementRegistry.get(nodeid);
- modeling.setColor([elementToColor], {
- stroke: itemStrokeColor,
- fill: itemFillColor
- });
- $("#btnSaveFlow").click();
- }
- function switchNodeTypeSelect() {
- if ($('.nodeSelect').is(':hidden')) {
- $('.nodeSelect').show();
- } else {
- $('.nodeSelect').hide();
- }
- }
- //更新节点的类型
- function updateNodeType() {
- var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
- var postData = {
- copyrightid: copyrightid,
- nodeid: nodeid,
- cname: $(".nodeName").val(),
- timelimit: $(".nodeTime").val(),
- explain: $(".nodeRemark").val(),
- type: "",
- toflowid: "",
- toflowcname: "",
- markmerge: ""
- };
- postData.type = $(".nodeTypeSelect").val();
- if (postData.type == 4) {
- var itemFlowNum = $(".itemFlowBox tbody").find("tr").length;
- if (itemFlowNum == 1) {
- postData.toflowid = $(".itemFlowBox tbody").find("tr").eq(0).attr("flow-id");
- postData.toflowcname = $(".itemFlowBox tbody").find("tr>td").eq(0).html();
- } else if (itemFlowNum == 0) {
- postData.toflowid = 0;
- postData.toflowcname = "尚未配置子流程";
- }
- } else {
- var itemFlowNum = $(".itemFlowBox tbody").find("tr").length;
- if (itemFlowNum == 1) {
- postData.toflowid = 0;
- postData.toflowcname = "尚未配置子流程";
- } else if (itemFlowNum == 0) {
- postData.toflowid = "";
- postData.toflowcname = "";
- }
- }
- ///判断是否合流
- if ($("#chb_isMarkmerge").is(":checked")) {
- postData.markmerge = "true";
- } else {
- postData.markmerge = "false";
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flownode/updateNode",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- nodeTypeList.forEach(function (item) {
- if (item.type == postData.type) {
- $(".nodeType").html(item.name);
- }
- })
- $(".nodeSelect").hide();
- if (parseInt(postData.type) == 4) {
- $("#itemFlowTitle").show();
- $("#itemFlowBox").show();
- $("#formTitle").hide();
- $("#formBox").hide();
- $(".itemFlowBox tbody").html("");
- if (postData.toflowid != "" && postData.toflowcname != "") {
- var itemTD =
- "<tr flow-id='" + postData.toflowid + "'>" +
- "<td class='sp-text-left sp-pl-10'>" + postData.toflowcname + "</td>" +
- "<td class='delFormbtn'><i class='fa fa-edit' onclick='openEditFlowLayer(this)'></i></td>" +
- "</tr>";
- $(".itemFlowBox tbody").append(itemTD);
- }
- } else {
- $("#itemFlowTitle").hide();
- $("#itemFlowBox").hide();
- $("#formTitle").show();
- $("#formBox").show();
- }
- setNodeColor(postData.type);
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //打开编辑流程函数
- function openEditFlowLayer(obj) {
- var flowid = $(obj).parents("tr").attr("flow-id");
- if (flowid == 0) {
- sp.dialog("请先选择子流程");
- } else {
- getEditFlowType();
- getEditCodeTableOption(flowid);
- $("#layer_editFlow").attr("copyrightid", "");
- sp.layer("#layer_editFlow");
- }
- }
- //获取需要编辑的流程分类(编辑流程的流程分类选项)
- function getEditFlowType() {
- var nowUnit = $("#itemUserUnit").val();
- $("#editFlowType").html("");
- var postData = {
- pkid: nowUnit,
- includechildren: true
- };
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowkinds/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- typeList = response.data;
- typeList.forEach(function (item) {
- var itemType = "<option value='" + item.PKID + "'>" + item.CNAME + "</option>";
- $("#editFlowType").append(itemType);
- })
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //获取需要编辑的流程关联表和关联列
- var codeTableArray = [];
- function getEditCodeTableOption(flowid) {
- $("#editFlowTable").html("");
- $("#editFlowColumn").html("");
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/billcol/queryDataInitval",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify({}))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- codeTableArray = response.data;
- //这个地方需要处理两层选项的函数,先赋值表选项,然后根据表选项选择列选项
- $("#editFlowTable").append("<option value=''>[空]</option>");
- $("#editFlowColumn").append("<option value=''>[空]</option>");
- codeTableArray.forEach(function (item) {
- var itemTable = "<option value='" + item.BILLKEY + "'>" + item.CNAME + "</option>";
- $("#editFlowTable").append(itemTable);
- })
- getEditFlowDetail(flowid);
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //获取需要编辑流程的详情
- function getEditFlowDetail(flowid) {
- var nowUnit = $("#itemUserUnit").val();
- var postData = {
- unitid: nowUnit,
- flowkinds: ""
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flow/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- var flowDetail = ""
- response.data.forEach(function (item) {
- if (item.FLOWID == flowid) {
- flowDetail = item;
- }
- })
- //根据详情对页面进行赋值
- $("#layer_editFlow").attr("copyrightid", flowDetail.COPYRIGHTID);
- $("#editFlowType").val(flowDetail.FLOWKINDS);
- $("#editFlowCkey").val(flowDetail.CKEY);
- $("#editFlowCname").val(flowDetail.CNAME);
- $("#editFlowTime").val(flowDetail.TIMELIMIT);
- $("#editFlowExplain").val(flowDetail.EXPLAIN);
- $("#editFlowTable").val(flowDetail.CODETABLE);
- codeTableArray.forEach(function (item) {
- if (item.BILLKEY == flowDetail.CODETABLE) {
- item.COLS.forEach(function (item2) {
- var itemColumn = "<option value='" + item2.CODE + "'>" + item2.CNAME + "</option>";
- $("#editFlowColumn").append(itemColumn);
- })
- }
- })
- $("#editFlowColumn").val(flowDetail.CODECOLUMN);
- },
- error: function (response) {
- }
- });
- }
- //改变关联表的同时联动改变关联列
- function changeTableToColumn() {
- var nowTableCode = $("#editFlowTable").val();
- $("#editFlowColumn").html("");
- $("#editFlowColumn").append("<option value=''>[空]</option>");
- codeTableArray.forEach(function (item) {
- if (item.BILLKEY == nowTableCode) {
- item.COLS.forEach(function (item2) {
- var itemColumn = "<option value='" + item2.CODE + "'>" + item2.CNAME + "</option>";
- $("#editFlowColumn").append(itemColumn);
- })
- }
- })
- $("#editFlowColumn").val("");
- }
- //更新流程函数
- function updateFlowData() {
- var postData = {
- flowkinds: $("#editFlowType").val(),
- copyrightid: $("#layer_editFlow").attr("copyrightid"),
- ckey: $("#editFlowCkey").val(),
- cname: $("#editFlowCname").val(),
- timelimit: $("#editFlowTime").val(),
- explain: $("#editFlowExplain").val(),
- codetable: $("#editFlowTable").val(),
- codecolumn: $("#editFlowColumn").val()
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flow/updateDataByCopyrightid",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- ///console.log(res);
- if (response.success) {
- sp.layerhide();
- } else {
- sp.layerhide();
- }
- },
- error: function (response) {
- }
- });
- }
- //打开时限设置弹出层
- function openTimeLayer() {
- $("#timeRecordList").html("");
- $("#timeList tbody").html("");
- getFlowOption();
- getTimeSet();
- sp.layer('#layer_timeset');
- }
- //获取流向选择项
- function getFlowOption() {
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowtimelimit/queryDirectionByCopyrightid",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify({"copyrightid": copyrightid}))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- $("#timeList tbody").html("");
- if (response.data.length != 0) {
- $(".timePartRight .sp-table-tip").hide();
- response.data.forEach(function (item, index) {
- var itemTr =
- "<tr direction-id='" + item.DIRECTIONID + "'>" +
- "<td><input direction-name='" + item.CNAME + "' direction-id='" + item.DIRECTIONID + "' class='selectDirection' onmousedown='selectTimeFlow()' type='checkbox'></td>" +
- //"<td><button onmousedown='selectTimeFlow(\"" + item.DIRECTIONID + "\",\"" + item.CNAME + "\")' class='sp-btn-sm sp-btn-gray-outline sp-btn-radius'>选择</button></td>" +
- "<td>" + item.STARTNODENAME + "</td>" +
- "<td>" + item.CNAME + "</td>" +
- "<td>" + item.ENDNODENAME + "</td>"
- "</tr>";
- $("#timeList tbody").append(itemTr);
- })
- } else {
- $(".timePartRight .sp-table-tip").show();
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- function getTimeSet() {
- clearTimeListCheckbox();
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowtimelimit/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify({"copyrightid": copyrightid}))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- //console.log(response);
- $("#timeRecordList").html("");
- if (response.data.length != 0) {
- response.data.forEach(function (item, index) {
- var itemEdit =
- '<div class="timeListItem timeListItemEdit">' +
- '<div class="timeInputBox">' +
- '<div class="timeInputBoxLeft">区间起始流向:</div>' +
- '<div class="timeInputBoxRight"><input disabled class="sp-input flowSelect startFlow" onfocus="startNodeFocus(this)" type="text"></div>' +
- '</div>' +
- '<div class="timeInputBox">' +
- '<div class="timeInputBoxLeft">区间结束流向:</div>' +
- '<div class="timeInputBoxRight"><input disabled class="sp-input flowSelect endFlow" onfocus="endNodeFocus(this)" type="text"></div>' +
- '</div>' +
- '<div class="timeSetBox"><div class="timeSetBoxLeft">区间时限天数:</div>' +
- '<div class="timeSetBoxRight">' +
- '<div>' +
- '<label><input disabled class="timeSetDay" value="0" name=timeSet' + (index + 1) + ' type="radio">天数</label>' +
- '<input disabled class="sp-input timeDayInput" type="number" value="0">' +
- '</div>' +
- '<div>' +
- '<label><input disabled class="timeSetLimit" value="1" name=timeSet' + (index + 1) + ' type="radio">时限日期</label>' +
- '<div class="timeTableName"></div>' +
- '</div>' +
- '<div><select disabled class="sp-select tableColumn"></select></div>' +
- '</div>' +
- '</div>' +
- '<div class="timeColorBox">' +
- '<div class="timeColorBoxTop">红黄绿灯设置:</div>' +
- '<div class="timeColorBoxBottom">' +
- '<div class="timeColorItem"><i class="fa fa-circle sp-color-red"></i>超过时限</div>' +
- '<div class="timeColorItem"><i class="fa fa-circle sp-color-yellow"></i>临近 <input disabled class="colorDay sp-input" value="0" type="number"> 天</div>' +
- '<div class="timeColorItem"><i class="fa fa-circle sp-color-green"></i>其他时间</div>' +
- '</div>' +
- '</div>' +
- '<div class="itmeBtnBox">' +
- '<button onclick="deleteTimeSet(this)" data-flowtimelimitid="' + item.FLOWTIMELIMITID + '" class="sp-btn-sm sp-btn-red-outline sp-btn-radius sp-pull-right">删除</button>' +
- '<button onclick="editTimeItem(this)" data-flowtimelimitid="' + item.FLOWTIMELIMITID + '" class="sp-btn-sm sp-btn-blue-outline sp-btn-radius sp-pull-right sp-hide">保存</button>' +
- '<button onclick="editTimeSet(this)" class="sp-btn-sm sp-btn-green-outline sp-btn-radius sp-pull-right">编辑</button>' +
- '</div>' +
- '</div>';
- $("#timeRecordList").append(itemEdit);
- flowColumn.forEach(function (item2, index2) {
- if (index2 == 0) {
- var itemOption = "<option selected value='" + item2.CODE + "'>" + item2.CNAME + "</option>";
- } else {
- var itemOption = "<option value='" + item2.CODE + "'>" + item2.CNAME + "</option>";
- }
- $(".timeListItemEdit").eq(index).find(".tableColumn").append(itemOption);
- })
- $(".timeListItemEdit").eq(index).find(".timeTableName").html("[" + flowInfo.CODETABLECAPTION + "]");
- $(".timeListItemEdit").eq(index).find(".startFlow").val(item.DSIDCAPTION);
- $(".timeListItemEdit").eq(index).find(".startFlow").attr("direction-id", item.DSID);
- $(".timeListItemEdit").eq(index).find(".endFlow").val(item.DTIDCAPTION);
- $(".timeListItemEdit").eq(index).find(".endFlow").attr("direction-id", item.DTID);
- var radioName = "timeSet" + (index + 1);
- // $(".timeListItemEdit").eq(index).find("input[name = " + radioName + "]").val(item.TIMELIMITKIND);
- // console.log($(".timeListItemEdit").eq(index).find("input[name = " + radioName + "]"))
- $(".timeListItemEdit").eq(index).find("input[name = " + radioName + "][value='" + item.TIMELIMITKIND + "']").prop("checked", "checked")
- $(".timeListItemEdit").eq(index).find(".timeDayInput").val(item.TIMELIMIT);
- if (item.TIMELIMITKIND == "1") {
- $(".timeListItemEdit").eq(index).find(".tableColumn").val(item.TIMELIMITCOLUMN);
- }
- $(".timeListItemEdit").eq(index).find(".colorDay").val(item.YELLOWC);
- })
- } else {
- var tips = ' <div class="timetips"><i class="fa fa-exclamation-circle"></i> 暂无设置记录</div>'
- $("#timeRecordList").append(tips);
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- function selectTimeFlow(did, dname) {
- var selectNum = $('.flowSelect:focus').length;
- if (selectNum > 0) {
- setTimeout(function () {
- var num = $("#timeList tbody input[type='checkbox']:checked").length;
- var stringName = "";
- var stringID = "";
- for (var i = 0; i < num; i++) {
- var itemObj = $("#timeList tbody input[type='checkbox']:checked").eq(i);
- stringName += itemObj.attr("direction-name") + ",";
- stringID += itemObj.attr("direction-id") + ",";
- }
- stringName = stringName.substring(0, stringName.length - 1);
- stringID = stringID.substring(0, stringID.length - 1);
- $('.flowSelect:focus').eq(0).val(stringName);
- $('.flowSelect:focus').eq(0).attr("direction-id", stringID);
- }, 200)
- }
- }
- function timeAdd() {
- var numEdit = $(".nowEdit").length;
- if (numEdit > 0) {
- alert("请先保存未保存的数据");
- return false;
- }
- var numAdd = $(".timeListItemAdd").length;
- if (numAdd == 0) {
- var itemAdd =
- '<div class="timeListItem timeListItemAdd">' +
- '<div class="timeInputBox">' +
- '<div class="timeInputBoxLeft">区间起始流向:</div>' +
- '<div class="timeInputBoxRight"><input class="sp-input flowSelect startFlow" onfocus="startNodeFocus(this)" type="text"></div>' +
- '</div>' +
- '<div class="timeInputBox">' +
- '<div class="timeInputBoxLeft">区间结束流向:</div>' +
- '<div class="timeInputBoxRight"><input class="sp-input flowSelect endFlow" onfocus="endNodeFocus(this)" type="text"></div>' +
- '</div>' +
- '<div class="timeSetBox"><div class="timeSetBoxLeft">区间时限天数:</div>' +
- '<div class="timeSetBoxRight">' +
- '<div>' +
- '<label><input class="timeSetDay" value="0" name="timeSet0" type="radio" checked>天数</label>' +
- '<input class="sp-input timeDayInput" type="number" value="0">' +
- '</div>' +
- '<div>' +
- '<label><input class="timeSetLimit" value="1" name="timeSet0" type="radio">时限日期</label>' +
- '<div class="timeTableName"></div>' +
- '</div>' +
- '<div><select class="sp-select tableColumn"></select></div>' +
- '</div>' +
- '</div>' +
- '<div class="timeColorBox">' +
- '<div class="timeColorBoxTop">红黄绿灯设置:</div>' +
- '<div class="timeColorBoxBottom">' +
- '<div class="timeColorItem"><i class="fa fa-circle sp-color-red"></i>超过时限</div>' +
- '<div class="timeColorItem"><i class="fa fa-circle sp-color-yellow"></i>临近 <input class="colorDay sp-input" value="0" type="number"> 天</div>' +
- '<div class="timeColorItem"><i class="fa fa-circle sp-color-green"></i>其他时间</div>' +
- '</div>' +
- '</div>' +
- '<div class="itmeBtnBox">' +
- '<button class="sp-btn-sm sp-btn-red-outline sp-btn-radius sp-pull-right" onclick="deleteAdd()">删除</button>' +
- '<button onclick="saveTimeItem(this)" class="sp-btn-sm sp-btn-blue-outline sp-btn-radius sp-pull-right">保存</button>' +
- '</div>' +
- '</div>';
- $("#timeRecordList").prepend(itemAdd);
- flowColumn.forEach(function (item, index) {
- if (index == 0) {
- var itemOption = "<option selected value='" + item.CODE + "'>" + item.CNAME + "</option>";
- } else {
- var itemOption = "<option value='" + item.CODE + "'>" + item.CNAME + "</option>";
- }
- $(".timeListItemAdd").eq(0).find(".tableColumn").append(itemOption);
- })
- $(".timeListItemAdd").eq(0).find(".timeTableName").html("[" + flowInfo.CODETABLECAPTION + "]");
- clearTimeListCheckbox();
- } else {
- alert("存在未保存数据,请保存后继续新增下一条");
- }
- var nowDataNum = $(".timeListItem").length;
- if (nowDataNum > 0) {
- $("#timeRecordList .timetips").remove();
- } else {
- var tips = ' <div class="timetips"><i class="fa fa-exclamation-circle"></i> 暂无设置记录</div>'
- $("#timeRecordList").append(tips);
- }
- }
- function saveTimeItem(obj) {
- var item = $(obj).parents().find(".timeListItemAdd").eq(0);
- var start = item.find(".startFlow").attr("direction-id");
- var end = item.find(".endFlow").attr("direction-id");
- var kind = item.find("input[type='radio']:checked").val();
- var days = item.find(".timeDayInput").val();
- var timelimitbillkey = flowInfo.CODETABLE;
- var timelimitcolumn = item.find(".tableColumn").val();
- var yellow = item.find(".colorDay").val();
- if (days == "" || days == undefined || days == null) {
- days = 0;
- }
- if (yellow == "" || yellow == undefined || yellow == null) {
- yellow = 0;
- }
- if (timelimitbillkey == "" || timelimitbillkey == undefined || timelimitbillkey == null) {
- timelimitbillkey = "";
- }
- if (timelimitcolumn == "" || timelimitcolumn == undefined || timelimitcolumn == null) {
- timelimitcolumn = "";
- }
- if (start == "" || start == undefined || start == null || end == "" || end == undefined || end == null) {
- alert("请先选择起始终止流向");
- return false
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowtimelimit/queryData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify({"copyrightid": copyrightid}))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- var canSave = true;
- response.data.forEach(function (item) {
- if (item.DSID == start && item.DTID == end) {
- canSave = false;
- }
- })
- if (canSave) {
- var postData = {
- "copyrightid": copyrightid,
- "dsid": start,
- "dtid": end,
- "timelimit": (kind == "0") ? days : "0",
- "redc": "",
- "yellowc": yellow,
- "greenc": "",
- "remark": "",
- "timelimitkind": kind,
- "timelimitbillkey": (kind == "1") ? timelimitbillkey : "",
- "timelimitcolumn": (kind == "1") ? timelimitcolumn : ""
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowtimelimit/insertData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- if (response.success) {
- getTimeSet();
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- } else {
- alert("当前起始结束流向设置已存在,请使用编辑功能");
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- function deleteAdd() {
- $(".timeListItemAdd").eq(0).remove();
- var nowDataNum = $(".timeListItem").length;
- if (nowDataNum > 0) {
- $("#timeRecordList .timetips").remove();
- } else {
- var tips = ' <div class="timetips"><i class="fa fa-exclamation-circle"></i> 暂无设置记录</div>'
- $("#timeRecordList").append(tips);
- }
- clearTimeListCheckbox();
- }
- function deleteTimeSet(obj) {
- var numAdd = $(".timeListItemAdd").length;
- if (numAdd == 0) {
- var item = $(obj).parent().parent();
- //var start = item.find(".startFlow").attr("direction-id");
- //var end = item.find(".endFlow").attr("direction-id");
- var get_flowtimelimitid = $(obj).attr("data-flowtimelimitid");
- var postData = {
- //"copyrightid": copyrightid,
- //"dsid": start,
- //"dtid": end,
- "flowtimelimitid": get_flowtimelimitid
- }
- //console.log(postData);
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowtimelimit/deleteData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- if (response.success) {
- getTimeSet();
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- } else {
- alert("请先保存未保存的数据");
- }
- }
- function editTimeSet(obj) {
- var numEdit = $(".nowEdit").length;
- if (numEdit > 0) {
- alert("请先保存未保存的数据");
- return false;
- }
- var numAdd = $(".timeListItemAdd").length;
- if (numAdd == 0) {
- $(".timeListItemEdit").find("input").attr("disabled", "disabled");
- $(".timeListItemEdit").find("select").attr("disabled", "disabled");
- $(".timeListItemEdit").removeClass("nowEdit");
- $(".timeListItemEdit").find(".sp-btn-green-outline").show();
- $(".timeListItemEdit").find(".sp-btn-blue-outline").hide();
- $(obj).parent().parent().find(".timeSetDay").removeAttr("disabled");
- $(obj).parent().parent().find(".timeDayInput").removeAttr("disabled");
- $(obj).parent().parent().find(".timeSetLimit").removeAttr("disabled");
- $(obj).parent().parent().find(".colorDay").removeAttr("disabled");
- $(obj).parent().parent().find("select").removeAttr("disabled");
- $(obj).parent().parent().find(".startFlow").removeAttr("disabled");
- $(obj).parent().parent().find(".endFlow").removeAttr("disabled");
- $(obj).parent().parent().find(".sp-btn-green-outline").hide();
- $(obj).parent().parent().find(".sp-btn-blue-outline").show();
- $(obj).parent().parent().addClass("nowEdit");
- } else {
- alert("请先保存未保存数据")
- }
- }
- function editTimeItem(obj) {
- var item = $(obj).parent().parent();
- var start = item.find(".startFlow").attr("direction-id");
- var end = item.find(".endFlow").attr("direction-id");
- var kind = item.find("input[type='radio']:checked").val();
- var days = item.find(".timeDayInput").val();
- var timelimitbillkey = flowInfo.CODETABLE;
- var timelimitcolumn = item.find(".tableColumn").val();
- var yellow = item.find(".colorDay").val();
- if (days == "" || days == undefined || days == null) {
- days = 0;
- }
- if (yellow == "" || yellow == undefined || yellow == null) {
- yellow = 0;
- }
- if (timelimitbillkey == "" || timelimitbillkey == undefined || timelimitbillkey == null) {
- timelimitbillkey = "";
- }
- if (timelimitcolumn == "" || timelimitcolumn == undefined || timelimitcolumn == null) {
- timelimitcolumn = "";
- }
- if (start == "" || start == undefined || start == null || end == "" || end == undefined || end == null) {
- alert("请先选择起始终止流向");
- return false
- }
- var get_flowtimelimitid = $(obj).attr("data-flowtimelimitid");
- var postData = {
- "flowtimelimitid": get_flowtimelimitid,
- "copyrightid": copyrightid,
- "dsid": start,
- "dtid": end,
- "timelimit": (kind == "0") ? days : "0",
- "redc": "",
- "yellowc": yellow,
- "greenc": "",
- "remark": "",
- "timelimitkind": kind,
- "timelimitbillkey": (kind == "1") ? timelimitbillkey : "",
- "timelimitcolumn": (kind == "1") ? timelimitcolumn : ""
- }
- //console.log(postData);
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/flowtimelimit/updateData",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- if (response.success) {
- getTimeSet();
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //打开视图设置弹出层
- function openTableLayer() {
- getBaseTableInfo();
- $("#submitViewBtn").attr("disabled", "disabled");
- $("#cancelViewBtn").removeAttr("disabled");
- $("#cleanViewBtn").removeAttr("disabled");
- sp.layer('#layer_tableset');
- }
- function getBaseTableInfo() {
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/formeditatgroup/queryFormeditByCopyrightid",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify({"copyrightid": copyrightid}))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- var viewTable = response.data;
- $("#viewTableSelect").html("");
- viewTable.forEach(function (item, index) {
- if (index == 0) {
- var itemOption = "<option selected value='" + item.FORMEDITID + "'>" + item.CNAME + "</option>";
- } else {
- var itemOption = "<option value='" + item.FORMEDITID + "'>" + item.CNAME + "</option>";
- }
- $("#viewTableSelect").append(itemOption);
- })
- getColFuncDirection('', '');
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- function getColFuncDirection(atgroup, directionid) {
- var formeditid = $("#viewTableSelect").val();
- var postData = {
- "copyrightid": copyrightid,
- "formeditid": formeditid,
- "atgroup": atgroup,
- "directionid": directionid
- }
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/formeditatgroup/queryDataFormEditColFuncDirection",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- $("#leftTopList tbody").html("");
- $("#leftBottpmList tbody").html("");
- $("#rightList tbody").html("");
- var response = strToJson(s4.decryptData_CBC(obj.data));
- response.data.Cols.forEach(function (item) {
- if (item.ESHOW == "" || item.ESHOW == undefined || item.ESHOW == null) {
- item.ESHOW = "false"
- }
- if (item.GSHOW == "" || item.GSHOW == undefined || item.GSHOW == null) {
- item.GSHOW = "false"
- }
- if (item.EREADONLY == "" || item.EREADONLY == undefined || item.EREADONLY == null) {
- item.EREADONLY = "false"
- }
- })
- response.data.Func.forEach(function (item) {
- if (item.ESHOW == "" || item.ESHOW == undefined || item.ESHOW == null) {
- item.ESHOW = "false"
- }
- })
- response.data.Direction.forEach(function (item) {
- if (item.ESHOW == "" || item.ESHOW == undefined || item.ESHOW == null) {
- item.ESHOW = "false"
- }
- if (item.MSHOW == "" || item.MSHOW == undefined || item.MSHOW == null) {
- item.MSHOW = "false"
- }
- if (item.ATGROUP == "" || item.ATGROUP == undefined || item.ATGROUP == null) {
- item.ATGROUP = ""
- }
- })
- //处理列数据
- if (response.data.Cols.length != 0) {
- $(".viewBoxColumn .sp-table-tip").hide();
- response.data.Cols.forEach(function (item, index) {
- var itemTr =
- "<tr col-id='" + item.COLID + "'>" +
- "<td>" + (index + 1) + "</td>" +
- "<td>" + item.CODE + "</td>" +
- "<td>" + item.CNAME + "</td>";
- if (item.EREADONLY == "true") {
- itemTr = itemTr + "<td><input type='checkbox' class='itemEReadonly' onclick='changeColsEReadonly()' checked></td>";
- } else {
- itemTr = itemTr + "<td><input type='checkbox' class='itemEReadonly' onclick='changeColsEReadonly()'></td>";
- }
- if (item.ESHOW == "true") {
- itemTr = itemTr + "<td><input type='checkbox' class='itemEShow' onclick='changeColsEShow()' checked></td>";
- } else {
- itemTr = itemTr + "<td><input type='checkbox' class='itemEShow' onclick='changeColsEShow()'></td>";
- }
- if (item.GSHOW == "true") {
- itemTr = itemTr + "<td><input type='checkbox' class='itemGShow' onclick='changeColsGShow()' checked></td>";
- } else {
- itemTr = itemTr + "<td><input type='checkbox' class='itemGShow' onclick='changeColsGShow()'></td>";
- }
- itemTr = itemTr + "</tr>";
- $("#leftTopList tbody").append(itemTr);
- })
- sumTotalCheck('#leftTopList', '#columnEReadonlyAll', 'itemEReadonly');
- sumTotalCheck('#leftTopList', '#columnEShowAll', 'itemEShow');
- sumTotalCheck('#leftTopList', '#columnGShowAll', 'itemGShow');
- } else {
- $(".viewBoxColumn .sp-table-tip").show();
- }
- if (response.data.Func.length != 0) {
- $(".viewBoxFunc .sp-table-tip").hide();
- response.data.Func.forEach(function (item, index) {
- if (item.ESHOW == "true") {
- var itemTr =
- "<tr func-id='" + item.FUNCID + "'>" +
- "<td>" + (index + 1) + "</td>" +
- "<td>" + item.CODE + "</td>" +
- "<td>" + item.CNAME + "</td>" +
- "<td><input type='checkbox' class='itemEShow' onclick='changeFuncEShow()' checked></td>"
- "</tr>";
- } else if (item.ESHOW == "false") {
- var itemTr =
- "<tr func-id='" + item.FUNCID + "'>" +
- "<td>" + (index + 1) + "</td>" +
- "<td>" + item.CODE + "</td>" +
- "<td>" + item.CNAME + "</td>" +
- "<td><input type='checkbox' class='itemEShow' onclick='changeFuncEShow()'></td>"
- "</tr>";
- }
- $("#leftBottpmList tbody").append(itemTr);
- })
- sumTotalCheck('#leftBottpmList', '#funcEShowAll', 'itemEShow');
- } else {
- $(".viewBoxFunc .sp-table-tip").show();
- }
- if (response.data.Direction.length != 0) {
- $(".viewBoxDirect .sp-table-tip").hide();
- response.data.Direction.forEach(function (item, index) {
- if (directionid == item.DIRECTIONID) {
- if (item.ESHOW == "true") {
- if (item.MSHOW == "true") {
- var itemTr =
- "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "' class='activeDirect'>" +
- "<td class='chooseBtn' style='display: none'><button onclick='chooseDirect(\"" + item.DIRECTIONID + "\",\"" + item.ATGROUP + "\")' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>选择</button></td>" +
- "<td class='cancelBtn'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
- "<td>" + item.STARTNODENAME + "</td>" +
- "<td class='sp-color-red'>" + item.CNAME + "</td>" +
- "<td>" + item.ENDNODENAME + "</td>" +
- "<td>" + item.ATGROUP + "</td>" +
- "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()' checked></td>"
- "</tr>";
- } else {
- var itemTr =
- "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "' class='activeDirect'>" +
- "<td class='chooseBtn' style='display: none'><button onclick='chooseDirect(\"" + item.DIRECTIONID + "\",\"" + item.ATGROUP + "\")' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>选择</button></td>" +
- "<td class='cancelBtn'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
- "<td>" + item.STARTNODENAME + "</td>" +
- "<td>" + item.CNAME + "</td>" +
- "<td>" + item.ENDNODENAME + "</td>" +
- "<td>" + item.ATGROUP + "</td>" +
- "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()' checked></td>"
- "</tr>";
- }
- } else if (item.ESHOW == "false") {
- if (item.MSHOW == "true") {
- var itemTr =
- "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "' class='activeDirect'>" +
- "<td class='chooseBtn' style='display: none'><button onclick='chooseDirect(\"" + item.DIRECTIONID + "\",\"" + item.ATGROUP + "\")' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>选择</button></td>" +
- "<td class='cancelBtn'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
- "<td>" + item.STARTNODENAME + "</td>" +
- "<td class='sp-color-red'>" + item.CNAME + "</td>" +
- "<td>" + item.ENDNODENAME + "</td>" +
- "<td>" + item.ATGROUP + "</td>" +
- "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()'></td>"
- "</tr>";
- } else {
- var itemTr =
- "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "' class='activeDirect'>" +
- "<td class='chooseBtn' style='display: none'><button onclick='chooseDirect(\"" + item.DIRECTIONID + "\",\"" + item.ATGROUP + "\")' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>选择</button></td>" +
- "<td class='cancelBtn'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
- "<td>" + item.STARTNODENAME + "</td>" +
- "<td>" + item.CNAME + "</td>" +
- "<td>" + item.ENDNODENAME + "</td>" +
- "<td>" + item.ATGROUP + "</td>" +
- "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()'></td>"
- "</tr>";
- }
- }
- } else {
- if (item.ESHOW == "true") {
- if (item.MSHOW == "true") {
- var itemTr =
- "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "'>" +
- "<td class='chooseBtn'><button onclick='chooseDirect(\"" + item.DIRECTIONID + "\",\"" + item.ATGROUP + "\")' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>选择</button></td>" +
- "<td class='cancelBtn' style='display: none'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
- "<td>" + item.STARTNODENAME + "</td>" +
- "<td class='sp-color-red'>" + item.CNAME + "</td>" +
- "<td>" + item.ENDNODENAME + "</td>" +
- "<td>" + item.ATGROUP + "</td>" +
- "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()' checked></td>"
- "</tr>";
- } else {
- var itemTr =
- "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "'>" +
- "<td class='chooseBtn'><button onclick='chooseDirect(\"" + item.DIRECTIONID + "\",\"" + item.ATGROUP + "\")' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>选择</button></td>" +
- "<td class='cancelBtn' style='display: none'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
- "<td>" + item.STARTNODENAME + "</td>" +
- "<td>" + item.CNAME + "</td>" +
- "<td>" + item.ENDNODENAME + "</td>" +
- "<td>" + item.ATGROUP + "</td>" +
- "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()' checked></td>"
- "</tr>";
- }
- } else if (item.ESHOW == "false") {
- if (item.MSHOW == "true") {
- var itemTr =
- "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "'>" +
- "<td class='chooseBtn'><button onclick='chooseDirect(\"" + item.DIRECTIONID + "\",\"" + item.ATGROUP + "\")' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>选择</button></td>" +
- "<td class='cancelBtn' style='display: none'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
- "<td>" + item.STARTNODENAME + "</td>" +
- "<td class='sp-color-red'>" + item.CNAME + "</td>" +
- "<td>" + item.ENDNODENAME + "</td>" +
- "<td>" + item.ATGROUP + "</td>" +
- "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()'></td>"
- "</tr>";
- } else {
- var itemTr =
- "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "'>" +
- "<td class='chooseBtn'><button onclick='chooseDirect(\"" + item.DIRECTIONID + "\",\"" + item.ATGROUP + "\")' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>选择</button></td>" +
- "<td class='cancelBtn' style='display: none'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
- "<td>" + item.STARTNODENAME + "</td>" +
- "<td>" + item.CNAME + "</td>" +
- "<td>" + item.ENDNODENAME + "</td>" +
- "<td>" + item.ATGROUP + "</td>" +
- "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()'></td>"
- "</tr>";
- }
- }
- }
- $("#rightList tbody").append(itemTr);
- })
- sumTotalCheck('#rightList', '#directEShowAll', 'itemEShow');
- } else {
- $(".viewBoxDirect .sp-table-tip").show();
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- //检测tbody的checkbox和thead的checkbox的联动关系函数
- function sumTotalCheck(id1, id2, class1) {
- var selectNum = $(id1 + " tbody input[type='checkbox'][class='" + class1 + "']:checked").length;
- var totalNum = $(id1 + " tbody input[type='checkbox'][class='" + class1 + "']").length;
- if (selectNum == totalNum && totalNum != 0) {
- $(id2).prop('checked', true);
- } else {
- $(id2).prop('checked', false);
- }
- }
- function selectViewTableAll(id1, id2, class1) {
- var selectAllFlog = $(id2).is(":checked");
- $(id1 + " tbody input[type='checkbox'][class='" + class1 + "']").prop("checked", selectAllFlog);
- }
- function changeColsEReadonly() {
- sumTotalCheck('#leftTopList', '#columnEReadonlyAll', 'itemEReadonly');
- }
- function changeColsEShow() {
- sumTotalCheck('#leftTopList', '#columnEShowAll', 'itemEShow');
- }
- function changeColsGShow() {
- sumTotalCheck('#leftTopList', '#columnGShowAll', 'itemGShow');
- }
- function changeFuncEShow() {
- sumTotalCheck('#leftBottpmList', '#funcEShowAll', 'itemEShow');
- }
- function changeDirectEShow() {
- sumTotalCheck('#rightList', '#directEShowAll', 'itemEShow');
- }
- // function chooseDirect(obj) {
- // $("#rightList tbody tr").removeClass("activeDirect");
- // $("#rightList tbody .chooseBtn").show();
- // $("#rightList tbody .cancelBtn").hide();
- // $(obj).parent().hide();
- // $(obj).parent().parent().find(".cancelBtn").show();
- // $(obj).parent().parent().addClass("activeDirect")
- // }
- //
- // function cancelChooseDirect(obj) {
- // $("#rightList tbody tr").removeClass("activeDirect");
- // $(obj).parent().hide();
- // $(obj).parent().parent().find(".chooseBtn").show();
- // }
- function chooseDirect(directionid, atgroup) {
- $("#submitViewBtn").removeAttr("disabled");
- $("#cleanViewBtn").attr("disabled", "disabled");
- $("#cancelViewBtn").attr("disabled", "disabled");
- getColFuncDirection(atgroup, directionid);
- setTimeout(function () {
- if (atgroup == "") {
- var num = $("#rightList tbody tr").length;
- for (var i = 0; i < num; i++) {
- if ($("#rightList tbody tr").eq(i).attr("direction-id") == directionid) {
- $("#rightList tbody tr").eq(i).find("input").prop("checked", true);
- }
- }
- }
- },100)
- }
- function cancelChooseDirect() {
- $("#submitViewBtn").attr("disabled", "disabled");
- $("#cancelViewBtn").removeAttr("disabled");
- $("#cleanViewBtn").removeAttr("disabled");
- getColFuncDirection('', '')
- }
- function changeFormSelect() {
- $("#submitViewBtn").attr("disabled", "disabled");
- $("#cancelViewBtn").removeAttr("disabled");
- $("#cleanViewBtn").removeAttr("disabled");
- getColFuncDirection('', '')
- }
- function updateTableSet() {
- var activeDirectNum = $("#rightList .activeDirect").length;
- if (activeDirectNum == 0) {
- alert("流向选择不能为空");
- return false;
- }
- var formeditid = $("#viewTableSelect").val();
- var posmark = $("#posmark").is(":checked");
- var posvalue = $("#posvalue").val();
- var postData = {
- "copyrightid": copyrightid,
- "formeditid": formeditid,
- "directionid": "",
- "atgroup": "",
- "posmark": "0",
- "posvalue": posvalue,
- "cols": "",
- "func": "",
- "direction": ""
- }
- if (activeDirectNum == 1) {
- postData.directionid = $("#rightList .activeDirect").eq(0).attr("direction-id");
- postData.atgroup = $("#rightList .activeDirect").eq(0).attr("at-group");
- }
- if (posmark) {
- postData.posmark = "1";
- }
- var cols = [];
- var func = [];
- var direction = [];
- var directionNum = $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").length;
- for (var i = 0; i < directionNum; i++) {
- direction.push({
- "DIRECTIONID": $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").eq(i).parent().parent().attr("direction-id")
- })
- }
- postData.direction = JSON.stringify(direction);
- var funcNum = $("#leftBottpmList tbody input[type='checkbox'][class='itemEShow']:checked").length;
- for (var i = 0; i < funcNum; i++) {
- func.push({
- "FUNCID": $("#leftBottpmList tbody input[type='checkbox'][class='itemEShow']:checked").eq(i).parent().parent().attr("func-id")
- })
- }
- postData.func = JSON.stringify(func);
- var colNum = $("#leftTopList tbody tr").length;
- for (var i = 0; i < colNum; i++) {
- var item = $("#leftTopList tbody tr").eq(i);
- var itemEReadonly = $("#leftTopList tbody tr").eq(i).find('input[type=\'checkbox\'][class=\'itemEReadonly\']').is(":checked");
- var itemEShow = $("#leftTopList tbody tr").eq(i).find('input[type=\'checkbox\'][class=\'itemEShow\']').is(":checked");
- var itemGShow = $("#leftTopList tbody tr").eq(i).find('input[type=\'checkbox\'][class=\'itemGShow\']').is(":checked");
- if (!itemEReadonly && !itemEShow && !itemGShow) {
- } else {
- cols.push({
- "COLID": item.attr("col-id"),
- "ESHOW": itemEShow,
- "GSHOW": itemGShow,
- "EREADONLY": itemEReadonly,
- })
- }
- }
- postData.cols = JSON.stringify(cols);
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/formeditatgroup/saveDataFormEditColFuncDirection",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- if (response.success) {
- cancelChooseDirect();
- //alert("更新成功");
- } else {
- alert("更新失败");
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- function cleanTableSet() {
- var directionNum = $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").length;
- if (directionNum == 0) {
- alert("请先勾选流向");
- return false;
- }else{
- if(confirm("确定要进行清空设置吗?"))
- {
- var formeditid = $("#viewTableSelect").val();
- var posmark = $("#posmark").is(":checked");
- var posvalue = $("#posvalue").val();
- var postData = {
- "copyrightid": copyrightid,
- "formeditid": formeditid,
- "directionid": "",
- "direction": ""
- }
- var direction = [];
- var directionNum = $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").length;
- for (var i = 0; i < directionNum; i++) {
- direction.push({
- "DIRECTIONID": $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").eq(i).parent().parent().attr("direction-id")
- })
- }
- postData.direction = JSON.stringify(direction);
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/formeditatgroup/clearDataFormEditColFuncDirection",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- if (response.success) {
- cancelChooseDirect();
- //alert("更新成功");
- } else {
- alert("清空失败");
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- }
- }
- function cancelTableSet() {
- var directionNum = $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").length;
- if (directionNum == 0) {
- alert("请先勾选流向");
- return false;
- }else{
- if(confirm("确定要进行解绑设置吗?"))
- {
- var formeditid = $("#viewTableSelect").val();
- var posmark = $("#posmark").is(":checked");
- var posvalue = $("#posvalue").val();
- var postData = {
- "copyrightid": copyrightid,
- "formeditid": formeditid,
- "directionid": "",
- "direction": ""
- }
- var direction = [];
- var directionNum = $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").length;
- for (var i = 0; i < directionNum; i++) {
- direction.push({
- "DIRECTIONID": $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").eq(i).parent().parent().attr("direction-id")
- })
- }
- postData.direction = JSON.stringify(direction);
- $.ajax({
- type: "post",
- url: apiurljs.login + "g2work/formeditatgroup/deleteDataFormEditDirection",
- headers: {
- Authorization: "Bearer " + get_AccessToken,
- },
- data: JSON.stringify({
- data: s4.encryptData_CBC(JSON.stringify(postData))
- }),
- dataType: "json",
- contentType: "application/json",
- success: function (obj) {
- var response = strToJson(s4.decryptData_CBC(obj.data));
- if (response.success) {
- cancelChooseDirect();
- //alert("更新成功");
- } else {
- alert("清空失败");
- }
- },
- error: function (response) {
- console.log(response);
- }
- });
- }
- }
- }
- function clearTimeListCheckbox() {
- $("#timeList tbody input[type='checkbox']").prop("checked", false);
- }
- document.addEventListener("mousedown", function (e) {
- if (e.target.className == "selectDirection") {
- e.preventDefault();
- }
- })
- function startNodeFocus(obj) {
- var nowValue = $(obj).attr("direction-id");
- clearTimeListCheckbox()
- if (nowValue == "" || nowValue == undefined || nowValue == null) {
- } else {
- var nowDirectionArray = nowValue.split(",");
- var totalDirectionNum = $("#timeList tbody input[type='checkbox']").length;
- nowDirectionArray.forEach(function (item) {
- for (var i = 0; i < totalDirectionNum; i++) {
- var itemObj = $("#timeList tbody input[type='checkbox']").eq(i);
- if (itemObj.attr("direction-id") == item) {
- $("#timeList tbody input[type='checkbox']").eq(i).prop("checked", true);
- }
- }
- })
- }
- }
- function endNodeFocus(obj) {
- var nowValue = $(obj).attr("direction-id");
- clearTimeListCheckbox();
- if (nowValue == "" || nowValue == undefined || nowValue == null) {
- } else {
- var nowDirectionArray = nowValue.split(",");
- var totalDirectionNum = $("#timeList tbody input[type='checkbox']").length;
- nowDirectionArray.forEach(function (item) {
- for (var i = 0; i < totalDirectionNum; i++) {
- var itemObj = $("#timeList tbody input[type='checkbox']").eq(i);
- if (itemObj.attr("direction-id") == item) {
- $("#timeList tbody input[type='checkbox']").eq(i).prop("checked", true);
- }
- }
- })
- }
- }
|