bpmn-set.js 214 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100
  1. var copyrightid = sp.getUrlName("copyrightid");
  2. var get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  3. var bpmnModeler = new BpmnJS({
  4. container: '#canvas',
  5. //additionalModules: [customTranslateModule],
  6. keyboard: {
  7. bindTo: window
  8. }
  9. });
  10. //流程名称显示在页面上
  11. var flowName = "【" + decodeURI(sp.getUrlName("flowName")) + "】";
  12. $("#flowName").html(flowName);
  13. //import function
  14. function importXML(xml) {
  15. // import diagram
  16. bpmnModeler.importXML(xml, function (err) {
  17. if (err) {
  18. return console.error('could not import BPMN 2.0 diagram', err);
  19. }
  20. var canvas = bpmnModeler.get('canvas');
  21. // zoom to fit full viewport
  22. canvas.zoom('fit-viewport');
  23. // canvas.addMarker('fifthTask_ANONYMOUS', 'highlight');
  24. });
  25. // save diagram on button click
  26. var saveButton = document.querySelector('#btnSaveFlow');
  27. saveButton.addEventListener('click', function () {
  28. // get the diagram contents
  29. bpmnModeler.saveXML({format: true}, function (err, xml) {
  30. if (err) {
  31. //console.error('diagram save failed', err);
  32. alert('保存流程失败!' + err);
  33. } else {
  34. //console.info('diagram saved');
  35. //console.info(xml);
  36. //----------------------------
  37. $.ajax({
  38. type: "post",
  39. url: apiurljs.login + "workflow/updateWorkFlowData",
  40. data: {"copyrightid": s4.encryptData_CBC(copyrightid), "xml": s4.encryptData_CBC(xml)},
  41. dataType: "json",
  42. success: function (obj) {
  43. var response = strToJson(s4.decryptData_CBC(obj.data));
  44. //alert('保存流程成功!' + strToJson(response).result);
  45. },
  46. error: function (response) {
  47. alert('保存流程失败!' + strToJson(response));
  48. }
  49. });
  50. //----------------------------
  51. }
  52. });
  53. });
  54. }
  55. var diagramXML = "";
  56. $.ajax({
  57. type: "post",
  58. url: apiurljs.login + "workflow/getWorkFlowData",
  59. data: {"copyrightid": s4.encryptData_CBC(copyrightid)},
  60. dataType: "text",
  61. success: function (obj) {
  62. var response = strToJson(s4.decryptData_CBC(JSON.parse(obj).data))
  63. diagramXML = response;
  64. if (diagramXML == "") {
  65. //美观版,带边框的
  66. //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";
  67. //最简版,不带边框
  68. 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> ";
  69. }
  70. importXML(diagramXML);
  71. },
  72. error: function (response) {
  73. 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> ";
  74. }
  75. });
  76. ////导出流程图
  77. var svgToImg;
  78. function btnExportFlow() {
  79. if (confirm("确认导出流程图吗?")) {
  80. bpmnModeler.saveSVG({ format: true }, function (err, svg) {
  81. //console.log(svg.toString());
  82. svg = "<svg style='background:#ffffff;' xmlns=" + svg.split("<svg xmlns=")[1];
  83. //svg=changeColor(changeColor,"000000");
  84. //covertSVG2Image(svg,"11",1000,300,'png')
  85. $("#div_flow_svg_part").html(svg);
  86. setTimeout(function () {
  87. var get_svg = document.querySelector("#div_flow_svg_part svg");
  88. //// 实例化对象
  89. svgToImg = new svgToImg(get_svg);
  90. var filename = decodeURI(sp.getUrlName("flowName"));
  91. svgToImg.change(filename, 'png');
  92. //covertSVG2Image(get_svg,"11",1000,200,"png");
  93. }, 100);
  94. })
  95. }
  96. }
  97. //获取流程的基本信息并保存
  98. var flowInfo = "";
  99. var flowColumn = [];
  100. $.ajax({
  101. type: "post",
  102. url: apiurljs.login + "g2work/flow/queryHashMapByCopyrightid",
  103. headers: {
  104. Authorization: "Bearer " + get_AccessToken,
  105. },
  106. data: JSON.stringify({
  107. data: s4.encryptData_CBC(JSON.stringify({"copyrightid": copyrightid}))
  108. }),
  109. dataType: "json",
  110. contentType: "application/json",
  111. success: function (obj) {
  112. var response = strToJson(s4.decryptData_CBC(obj.data));
  113. flowInfo = response.data;
  114. if (flowInfo.CODETABLE != "" && flowInfo.CODETABLE != null && flowInfo.CODETABLE != undefined) {
  115. $.ajax({
  116. type: "post",
  117. url: apiurljs.login + "g2work/billcol/queryDataByParam",
  118. headers: {
  119. Authorization: "Bearer " + get_AccessToken,
  120. },
  121. data: JSON.stringify({
  122. data: s4.encryptData_CBC(JSON.stringify({"billkey": flowInfo.CODETABLE}))
  123. }),
  124. dataType: "json",
  125. contentType: "application/json",
  126. success: function (obj) {
  127. var response2 = strToJson(s4.decryptData_CBC(obj.data));
  128. flowColumn = response2.data[0].COLS;
  129. $("#btnTimeFlow").show();
  130. },
  131. error: function (response) {
  132. console.log(response);
  133. }
  134. });
  135. } else {
  136. flowInfo.CODETABLE = "";
  137. flowInfo.CODETABLECAPTION = "未配置";
  138. $("#btnTimeFlow").show();
  139. }
  140. },
  141. error: function (response) {
  142. console.log(response);
  143. }
  144. });
  145. //隐藏节点的div层
  146. function btnHideRightPart() {
  147. $("#bpmnSetRightPart").hide();
  148. }
  149. //隐藏流向的div层
  150. function btnHideRightPartFlow() {
  151. $("#bpmnSetRightPartFlow").hide();
  152. }
  153. function btnGoBack() {
  154. window.location.href = "../tpk/flowchart/flowchart.html?FLOWKND=" + sp.getUrlName("leftActiveType");
  155. }
  156. //点击节点调用的函数
  157. function clickNode(nodeid) {
  158. $("#bpmnSetRightPartFlow").attr("flowid", "");
  159. $("#bpmnSetRightPart").attr("nodeid", nodeid);
  160. var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
  161. var postData = {nodeid: nodeid};
  162. $.ajax({
  163. type: "post",
  164. url: apiurljs.login + "g2work/flownode/queryData",
  165. headers: {
  166. Authorization: "Bearer " + get_AccessToken,
  167. },
  168. data: JSON.stringify({
  169. data: s4.encryptData_CBC(JSON.stringify(postData))
  170. }),
  171. dataType: "json",
  172. contentType: "application/json",
  173. success: function (obj) {
  174. var response = strToJson(s4.decryptData_CBC(obj.data));
  175. //当前节点为空时,隐藏右侧表单信息
  176. if (Object.keys(response.data).length != 0) {
  177. $("#bpmnSetRightPart").show();
  178. $("#bpmnSetRightPartFlow").hide();
  179. initNodePart(response.data);
  180. } else {
  181. $("#bpmnSetRightPart").hide();
  182. $("#bpmnSetRightPartFlow").hide();
  183. }
  184. },
  185. error: function (response) {
  186. console.log(response);
  187. }
  188. });
  189. }
  190. function getNodeInfo() {
  191. var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
  192. var postData = {nodeid: nodeid};
  193. $.ajax({
  194. type: "post",
  195. url: apiurljs.login + "g2work/flownode/queryData",
  196. headers: {
  197. Authorization: "Bearer " + get_AccessToken,
  198. },
  199. data: JSON.stringify({
  200. data: s4.encryptData_CBC(JSON.stringify(postData))
  201. }),
  202. dataType: "json",
  203. contentType: "application/json",
  204. success: function (obj) {
  205. var response = strToJson(s4.decryptData_CBC(obj.data));
  206. initNodePart(response.data);
  207. },
  208. error: function (response) {
  209. console.log(response);
  210. }
  211. });
  212. }
  213. //各个节点类型的判断
  214. var nodeTypeList = [
  215. {"type": 0, "name": "开始"},
  216. {"type": 1, "name": "结束"},
  217. {"type": 2, "name": "任务"},
  218. {"type": 3, "name": "网关"},
  219. {"type": 4, "name": "子流程"},
  220. {"type": 5, "name": "边界事件"}
  221. ];
  222. //表单类型列表
  223. var formType = [
  224. {"cval": "NORMAL", "cname": "一般表"},
  225. {"cval": "MDETAIL", "cname": "主细表"},
  226. {"cval": "CODETBL", "cname": "代码表"},
  227. {"cval": "TREESTAL", "cname": "树状表"},
  228. {"cval": "ENTITYTB", "cname": "实体表"},
  229. {"cval": "FILETBL", "cname": "附件表"},
  230. ]
  231. //根据节点信息初始化节点弹出层的函数
  232. function initNodePart(nodeInfo) {
  233. //console.log(JSON.stringify(nodeInfo));
  234. $(".nodeCode").html(nodeInfo.NODEKID);
  235. $(".nodeBtn").hide();
  236. nodeTypeList.forEach(function (item) {
  237. if (item.type == nodeInfo.TYPE) {
  238. $(".nodeType").html(item.name);
  239. }
  240. })
  241. $(".nodeTypeSelect").val(parseInt(nodeInfo.TYPE));
  242. if (parseInt(nodeInfo.TYPE) == 2 || parseInt(nodeInfo.TYPE) == 4) {
  243. $(".nodeBtn").show();
  244. }
  245. //如果是子流程则显示子流程设置,不是子流程则是表单设置
  246. if (parseInt(nodeInfo.TYPE) == 4) {
  247. $("#itemFlowTitle").show();
  248. $("#itemFlowBox").show();
  249. $("#formTitle").hide();
  250. $("#formBox").hide();
  251. } else {
  252. $("#itemFlowTitle").hide();
  253. $("#itemFlowBox").hide();
  254. $("#formTitle").show();
  255. $("#formBox").show();
  256. }
  257. $(".nodeName").val(nodeInfo.CNAME);
  258. $(".nodeTime").val(nodeInfo.TIMELIMIT);
  259. $(".nodeRemark").val(nodeInfo.EXPLAIN);
  260. ///为 是否合流 赋值
  261. if (nodeInfo.MARKMERGE == "" || nodeInfo.MARKMERGE == "false") {
  262. $("#chb_isMarkmerge").prop("checked", false);
  263. } else {
  264. $("#chb_isMarkmerge").prop("checked", true);
  265. }
  266. //清空人员层,表单层,子流程层的数据
  267. $(".itemFlowBox tbody").html("");
  268. $(".formTableBox tbody").html("");
  269. $("#nodeUserList").html("");
  270. if (nodeInfo.TOFLOWID != undefined && nodeInfo.TOFLOWCNAME != undefined) {
  271. var itemTD =
  272. "<tr flow-id='" + nodeInfo.TOFLOWID + "'>" +
  273. "<td class='sp-text-left sp-pl-10'>" + nodeInfo.TOFLOWCNAME + "</td>" +
  274. "<td class='delFormbtn'><i class='fa fa-edit' onclick='openEditFlowLayer(this)'></i></td>" +
  275. "</tr>";
  276. $(".itemFlowBox tbody").append(itemTD);
  277. } else {
  278. var itemTD =
  279. "<tr flow-id='0'>" +
  280. "<td class='sp-text-left sp-pl-10'>尚未配置子流程</td>" +
  281. "<td class='delFormbtn'><i class='fa fa-edit' onclick='openEditFlowLayer(this)'></i></td>" +
  282. "</tr>";
  283. $(".itemFlowBox tbody").append(itemTD);
  284. }
  285. nodeInfo.FORM.forEach(function (item, index) {
  286. var itemTD =
  287. "<tr form-id='" + item.FORMID + "'>" +
  288. "<td class='sp-text-left sp-pl-10'>" + item.FORMNAME + "</td>" +
  289. "<td class='delFormbtn'><i class='fa fa-close' onclick='deleteNodeForm(\"" + item.FORMID + "\"," + index + ")'></i></td>" +
  290. "</tr>";
  291. $(".formTableBox tbody").append(itemTD);
  292. })
  293. nodeInfo.USERS.forEach(function (item, index) {
  294. var itemDiv = "<div class='itemUser'>" +
  295. "<div class='delUserbtn'>" +
  296. "<i class='fa fa-close' onclick='deleteNodeUser(\"" + item.UNITID + "\",\"" + item.DID + "\",\"" + item.ZID + "\",\"" + item.GID + "\",\"" + item.RID + "\"," + index + ")'></i>" +
  297. "</div>" +
  298. "<div class='itemLine'><div class='itemTitle'>机构:</div><div class='itemVal'>" + item.UNITIDNAME + "</div></div>" +
  299. "<div class='itemLine'><div class='itemTitle'>部门:</div><div class='itemVal'>" + item.DIDNAME + "</div></div>" +
  300. "<div class='itemLine'><div class='itemTitle'>角色:</div><div class='itemVal'>" + item.ZIDNAME + "</div></div>" +
  301. "<div class='itemLine'><div class='itemTitle'>群组:</div><div class='itemVal'>" + item.GIDNAME + "</div></div>" +
  302. "<div class='itemLine'><div class='itemTitle'>人员:</div><div class='itemVal'>" + item.RIDNAME + "</div></div>" +
  303. "</div>"
  304. $("#nodeUserList").append(itemDiv);
  305. })
  306. }
  307. //节点增加表单的准备操作
  308. //获取机构列表
  309. var unitList = [];
  310. var typeList = [];
  311. //获取机构
  312. function getUnitList() {
  313. $.ajax({
  314. type: "post",
  315. url: apiurljs.login + "g2work/sect/querySectAdmin",
  316. headers: {
  317. Authorization: "Bearer " + get_AccessToken,
  318. },
  319. data: JSON.stringify({
  320. data: s4.encryptData_CBC("")
  321. }),
  322. dataType: "json",
  323. contentType: "application/json",
  324. success: function (obj) {
  325. var response = strToJson(s4.decryptData_CBC(obj.data));
  326. unitList = response.data;
  327. unitList.forEach(function (item, index) {
  328. if (index == 0) {
  329. var itemOption = "<option selected value='" + item.CODE + "'>" + item.SECTION + "</option>";
  330. } else {
  331. var itemOption = "<option value='" + item.CODE + "'>" + item.SECTION + "</option>";
  332. }
  333. $("#formUnit").append(itemOption);
  334. $("#itemUserUnit").append(itemOption);
  335. $("#userUnit").append(itemOption);
  336. $("#directionUnit").append(itemOption);
  337. })
  338. },
  339. error: function (response) {
  340. console.log(response);
  341. }
  342. });
  343. }
  344. //获取表单类型
  345. function getFormType() {
  346. var nowUnit = $("#formUnit").val();
  347. $(".formTypeBox").html("");
  348. var baseType = "<div class=\"typeItem\" data-type='' onclick=\"changeFormType('',this)\"><i class=\"fa fa-list-ul\"></i> <span>全部表单</span></div>";
  349. $(".formTypeBox").append(baseType);
  350. var postData = {
  351. pkid: nowUnit,
  352. includechildren: true
  353. };
  354. $.ajax({
  355. type: "post",
  356. url: apiurljs.login + "g2work/formkinds/queryData",
  357. headers: {
  358. Authorization: "Bearer " + get_AccessToken,
  359. },
  360. data: JSON.stringify({
  361. data: s4.encryptData_CBC(JSON.stringify(postData))
  362. }),
  363. dataType: "json",
  364. contentType: "application/json",
  365. success: function (obj) {
  366. var response = strToJson(s4.decryptData_CBC(obj.data));
  367. typeList = response.data;
  368. typeList.forEach(function (item) {
  369. 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>";
  370. $(".formTypeBox").append(itemType);
  371. })
  372. $(".formTypeBox>.typeItem").eq(1).addClass("active");
  373. getFormList();
  374. },
  375. error: function (response) {
  376. console.log(response);
  377. }
  378. });
  379. }
  380. //加载表单
  381. function getFormList() {
  382. //根据选中的机构和类型查询表单数据
  383. var nowUnit = $("#formUnit").val();
  384. var nowType = $(".formTypeBox .active").attr("data-type");
  385. var postData = {
  386. unitid: nowUnit,
  387. formkinds: nowType
  388. }
  389. $("#formList tbody").html("");
  390. $.ajax({
  391. type: "post",
  392. url: apiurljs.login + "g2work/form/queryData",
  393. headers: {
  394. Authorization: "Bearer " + get_AccessToken,
  395. },
  396. data: JSON.stringify({
  397. data: s4.encryptData_CBC(JSON.stringify(postData))
  398. }),
  399. dataType: "json",
  400. contentType: "application/json",
  401. success: function (obj) {
  402. var response = strToJson(s4.decryptData_CBC(obj.data));
  403. if (response.data.length != 0) {
  404. $(".formPartRight .sp-table-tip").hide();
  405. response.data.forEach(function (item, index) {
  406. formType.forEach(function (item2) {
  407. if (item2.cval == item.CTYPE) {
  408. item.CTYPENAME = item2.cname;
  409. }
  410. })
  411. var itemTr =
  412. "<tr form-id='" + item.FORMID + "'>" +
  413. "<td><input type='checkbox' onclick='selectItemForm()'></td>" +
  414. "<td>" + (index + 1) + "</td>" +
  415. "<td>" + item.CKEY + "</td>" +
  416. "<td>" + item.CNAME + "</td>" +
  417. "<td>" + item.SHORTNAME + "</td>" +
  418. "<td>" + item.EXPLAIN + "</td>" +
  419. "<td>" + item.CTYPENAME + "</td>"
  420. "</tr>";
  421. $("#formList tbody").append(itemTr);
  422. })
  423. } else {
  424. $(".formPartRight .sp-table-tip").show();
  425. }
  426. },
  427. error: function (response) {
  428. console.log(response);
  429. }
  430. });
  431. }
  432. //打开设置表单的弹出层
  433. function openFormLayer() {
  434. $("#formUnit").val(unitList[0].CODE);
  435. $("#selectAll").prop('checked', false);
  436. $(".formTypeBox>.typeItem").removeClass("active");
  437. getFormType();
  438. sp.layer('#layer_formset');
  439. }
  440. //改变机构函数
  441. function changeUnit() {
  442. var nowUnit = $("#formUnit").val();
  443. getFormType();
  444. }
  445. //更改表单类型
  446. function changeFormType(code, obj) {
  447. $("#selectAll").prop('checked', false);
  448. $(".formTypeBox>.typeItem").removeClass("active");
  449. $(obj).addClass("active");
  450. getFormList();
  451. }
  452. //全选或者取消全选表单
  453. function selectAllForm() {
  454. var selectAllFlog = $("#selectAll").is(":checked");
  455. $("#formList tbody input[type='checkbox']").prop('checked', selectAllFlog);
  456. }
  457. //点击单个表单函数
  458. function selectItemForm() {
  459. var selectNum = $("#formList tbody input[type='checkbox']:checked").length;
  460. var totalNum = $("#formList tbody input[type='checkbox']").length;
  461. if (selectNum == totalNum) {
  462. $("#selectAll").prop('checked', true);
  463. } else {
  464. $("#selectAll").prop('checked', false);
  465. }
  466. }
  467. //保存选择表单
  468. function saveForm() {
  469. var formArray = [];
  470. $("#formList tbody input[type='checkbox']:checked").each(function (e) {
  471. var formItem = {
  472. formid: $(this).parents("tr").attr("form-id")
  473. }
  474. formArray.push(formItem);
  475. })
  476. var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
  477. var postData = {
  478. copyrightid: copyrightid,
  479. nodeid: nodeid,
  480. data: JSON.stringify(formArray)
  481. }
  482. $.ajax({
  483. type: "post",
  484. url: apiurljs.login + "g2work/flownode/updateNodeForm",
  485. headers: {
  486. Authorization: "Bearer " + get_AccessToken,
  487. },
  488. data: JSON.stringify({
  489. data: s4.encryptData_CBC(JSON.stringify(postData))
  490. }),
  491. dataType: "json",
  492. contentType: "application/json",
  493. success: function (obj) {
  494. var response = strToJson(s4.decryptData_CBC(obj.data));
  495. sp.layerhide();
  496. if (response.success) {
  497. $(".formTableBox tbody").html("");
  498. response.data.FORM.forEach(function (item, index) {
  499. var itemTD =
  500. "<tr form-id='" + item.FORMID + "'>" +
  501. "<td class='sp-text-left sp-pl-10'>" + item.FORMNAME + "</td>" +
  502. "<td class='delFormbtn'><i class='fa fa-close' onclick='deleteNodeForm(\"" + item.FORMID + "\"," + index + ")'></i></td>" +
  503. "</tr>";
  504. $(".formTableBox tbody").append(itemTD);
  505. })
  506. } else {
  507. setTimeout(function () {
  508. sp.dialog(res.message);
  509. }, 1000)
  510. }
  511. },
  512. error: function (response) {
  513. console.log(response);
  514. }
  515. });
  516. }
  517. //打开人员编辑层
  518. function openUserLayer() {
  519. $("#userUnit").val(unitList[0].CODE);
  520. $("#departAll").prop("checked", true);
  521. $("#roleAll").prop("checked", true);
  522. $("#groupAll").prop("checked", true);
  523. $("#userAll").prop("checked", true);
  524. $("#nowDepart").html("[全部部门]");
  525. $("#nowRole").html("[全部角色]");
  526. $("#nowGroup").html("[全部群组]");
  527. $("#nowUser").html("[全部人员]");
  528. $("#nowUnit").html(unitList[0].SECTION);
  529. getUserDepart();
  530. getUserRole();
  531. getUserGroup();
  532. getUserList();
  533. $("#layer_selectUser .msgContentBox").hide();
  534. $("#layer_selectUser").attr("data-title", "人员设置");
  535. $("#layer_selectUser .sp-layer-title").html("人员设置");
  536. //下面的流向提醒设置中需要置空的数据
  537. $("#rtxmsgFlag").prop("checked", false);
  538. $("#smsmsgFlag").prop("checked", false);
  539. $("#rtxmsgContent").val("");
  540. $("#smsmsgContent").val("");
  541. sp.layer('#layer_selectUser');
  542. }
  543. //获取人员部门
  544. function getUserDepart() {
  545. var postData = {
  546. code: $("#userUnit").val()
  547. }
  548. $.ajax({
  549. type: "post",
  550. url: apiurljs.login + "g2work/sect/querySect",
  551. headers: {
  552. Authorization: "Bearer " + get_AccessToken,
  553. },
  554. data: JSON.stringify({
  555. data: s4.encryptData_CBC(JSON.stringify(postData))
  556. }),
  557. dataType: "json",
  558. contentType: "application/json",
  559. success: function (obj) {
  560. var response = strToJson(s4.decryptData_CBC(obj.data));
  561. $(".treeList").html("");
  562. response.data.forEach(function (item, index) {
  563. if (item.C_H_I_L_D.length > 0) {
  564. var firstLi = "<li>" +
  565. "<a><i class='fa fa-plus-square-o'></i><i class='fa fa-minus-square-o'></i><span>" + item.SECTION + "</span></a>" +
  566. "<ul></ul>"
  567. "</li>";
  568. } else {
  569. var firstLi = "<li class='sp-tree-nochild'><a><span>" + item.SECTION + "</span></a></li>";
  570. }
  571. $(".treeList").append(firstLi);
  572. item.C_H_I_L_D.forEach(function (item2, index2) {
  573. if (item2.C_H_I_L_D.length > 0) {
  574. var secondLi = "<li>" +
  575. "<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>" +
  576. "<ul></ul>"
  577. "</li>";
  578. } else {
  579. var secondLi = "<li class='sp-tree-nochild'><a><span data-code='" + item2.CODE + "' onclick='selectDeprt(this)'>" + item2.SECTION + "</span></a></li>"
  580. }
  581. $(".treeList>li").eq(index).children("ul").append(secondLi);
  582. item2.C_H_I_L_D.forEach(function (item3, index3) {
  583. var thirdLi = "<li class='sp-tree-nochild'><a><span data-code='" + item3.CODE + "' onclick='selectDeprt(this)'>" + item3.SECTION + "</span></a></li>";
  584. $(".treeList>li").eq(index).children("ul").children("li").eq(index2).children("ul").append(thirdLi);
  585. })
  586. })
  587. })
  588. //树形的伸缩
  589. $(".sp-tree").find("a>i").each(function () {
  590. $(this).on("click", function () {
  591. if ($(this).parent().hasClass("hasclick")) {
  592. $(this).parent().removeClass("hasclick");
  593. if ($(this).parent().parent().find("ul").length > 0) {
  594. $(this).parent().parent().children("ul").children("li").hide();
  595. $(this).parent().children(".fa-minus-square-o").hide();
  596. $(this).parent().children(".fa-plus-square-o").show();
  597. }
  598. ;
  599. } else {
  600. $(this).parent().addClass("hasclick");
  601. if ($(this).parent().parent().find("ul").length > 0) {
  602. $(this).parent().parent().children("ul").children("li").show();
  603. $(this).parent().children(".fa-minus-square-o").css({"display": "inline-block"});
  604. $(this).parent().children(".fa-plus-square-o").hide();
  605. }
  606. ;
  607. }
  608. });
  609. });
  610. $(".treeList>li").eq(0).children("a").find(".fa-plus-square-o").click();
  611. },
  612. error: function (response) {
  613. console.log(response);
  614. }
  615. });
  616. }
  617. //获取角色
  618. function getUserRole() {
  619. var postData = {
  620. unitid: $("#userUnit").val()
  621. }
  622. $.ajax({
  623. type: "post",
  624. url: apiurljs.login + "g2work/datazu/queryData",
  625. headers: {
  626. Authorization: "Bearer " + get_AccessToken,
  627. },
  628. data: JSON.stringify({
  629. data: s4.encryptData_CBC(JSON.stringify(postData))
  630. }),
  631. dataType: "json",
  632. contentType: "application/json",
  633. success: function (obj) {
  634. var response = strToJson(s4.decryptData_CBC(obj.data));
  635. $(".roleList").html("");
  636. response.data.forEach(function (item) {
  637. var itemRole = "<span data-code='" + item.ZID + "' class='sp-lh-20' onclick='selectRole(this)'>" + item.ZUM + "</span>";
  638. $(".roleList").append(itemRole);
  639. })
  640. },
  641. error: function (response) {
  642. console.log(response);
  643. }
  644. });
  645. }
  646. //获取群组
  647. function getUserGroup() {
  648. var postData = {
  649. unitid: $("#userUnit").val()
  650. }
  651. $.ajax({
  652. type: "post",
  653. url: apiurljs.login + "g2work/datagroup/queryData",
  654. headers: {
  655. Authorization: "Bearer " + get_AccessToken,
  656. },
  657. data: JSON.stringify({
  658. data: s4.encryptData_CBC(JSON.stringify(postData))
  659. }),
  660. dataType: "json",
  661. contentType: "application/json",
  662. success: function (obj) {
  663. var response = strToJson(s4.decryptData_CBC(obj.data));
  664. $(".groupList").html("");
  665. response.data.forEach(function (item) {
  666. var itemRole = "<span class='sp-lh-20' data-code='" + item.GID + "' onclick='selectGroup(this)'>" + item.GUM + "</span>";
  667. $(".groupList").append(itemRole);
  668. })
  669. },
  670. error: function (response) {
  671. console.log(response);
  672. }
  673. });
  674. }
  675. //根据函数来检索用户
  676. function getUserList() {
  677. var postData = {
  678. unitid: $("#userUnit").val(),
  679. departid: "",
  680. zid: "",
  681. gid: ""
  682. }
  683. if ($("#departAll").is(":checked")) {
  684. postData.departid = "";
  685. } else {
  686. postData.departid = $(".treeList .activeBtn").eq(0).children("span").attr("data-code");
  687. }
  688. if ($("#roleAll").is(":checked")) {
  689. postData.zid = "";
  690. } else {
  691. postData.zid = $(".roleList .activeBtn").eq(0).attr("data-code");
  692. }
  693. if ($("#groupAll").is(":checked")) {
  694. postData.gid = "";
  695. } else {
  696. postData.gid = $(".groupList .activeBtn").eq(0).attr("data-code");
  697. }
  698. $.ajax({
  699. type: "post",
  700. url: apiurljs.login + "g2work/user/queryUserByUnitidDepartidZidGid",
  701. headers: {
  702. Authorization: "Bearer " + get_AccessToken,
  703. },
  704. data: JSON.stringify({
  705. data: s4.encryptData_CBC(JSON.stringify(postData))
  706. }),
  707. dataType: "json",
  708. contentType: "application/json",
  709. success: function (obj) {
  710. var response = strToJson(s4.decryptData_CBC(obj.data));
  711. $(".userList").html("");
  712. response.data.forEach(function (item) {
  713. var itemRole = "<span class='sp-lh-20' data-code='" + item.USERID + "' onclick='selectUser(this)'>" + item.USHOWNAME + "</span>";
  714. $(".userList").append(itemRole);
  715. })
  716. },
  717. error: function (response) {
  718. console.log(response);
  719. }
  720. });
  721. }
  722. //改变机构
  723. function changeUserUnit() {
  724. $("#departAll").prop("checked", true);
  725. $("#roleAll").prop("checked", true);
  726. $("#groupAll").prop("checked", true);
  727. $("#userAll").prop("checked", true);
  728. $("#nowDepart").html("[全部部门]");
  729. $("#nowRole").html("[全部角色]");
  730. $("#nowGroup").html("[全部群组]");
  731. $("#nowUser").html("[全部人员]");
  732. $("#nowUnit").html($("#userUnit").find("option:selected").text())
  733. getUserDepart();
  734. getUserRole();
  735. getUserGroup();
  736. getUserList();
  737. }
  738. //点击部门
  739. function selectDeprt(obj) {
  740. $(".treeList a").removeClass("activeBtn");
  741. $(obj).parent().addClass("activeBtn");
  742. $("#departAll").prop("checked", false);
  743. $("#nowDepart").html($(obj).html());
  744. $("#userAll").prop("checked", true);
  745. $("#nowUser").html("[全部人员]");
  746. getUserList();
  747. }
  748. //点击角色
  749. function selectRole(obj) {
  750. $(".roleList span").removeClass("activeBtn");
  751. $(obj).addClass("activeBtn");
  752. $("#roleAll").prop("checked", false);
  753. $("#nowRole").html($(obj).html());
  754. $("#userAll").prop("checked", true);
  755. $("#nowUser").html("[全部人员]");
  756. getUserList();
  757. }
  758. //点击群组
  759. function selectGroup(obj) {
  760. $(".groupList span").removeClass("activeBtn");
  761. $(obj).addClass("activeBtn");
  762. $("#groupAll").prop("checked", false);
  763. $("#nowGroup").html($(obj).html());
  764. $("#userAll").prop("checked", true);
  765. $("#nowUser").html("[全部人员]");
  766. getUserList();
  767. }
  768. //点击用户
  769. function selectUser(obj) {
  770. $(".userList span").removeClass("activeBtn");
  771. $(obj).addClass("activeBtn");
  772. $("#userAll").prop("checked", false);
  773. $("#nowUser").html($(obj).html());
  774. }
  775. //设置为全部部门
  776. function clickAllDepart() {
  777. var selectAllFlog = $("#departAll").is(":checked");
  778. if (selectAllFlog) {
  779. $(".treeList a").removeClass("activeBtn");
  780. $("#nowDepart").html("[全部部门]");
  781. getUserList()
  782. }
  783. }
  784. //设置为全部角色
  785. function clickAllRole() {
  786. var selectAllFlog = $("#roleAll").is(":checked");
  787. if (selectAllFlog) {
  788. $(".roleList span").removeClass("activeBtn");
  789. $("#nowRole").html("[全部角色]");
  790. getUserList()
  791. }
  792. }
  793. //设置为全部群组
  794. function clickAllGroup() {
  795. var selectAllFlog = $("#groupAll").is(":checked");
  796. if (selectAllFlog) {
  797. $(".groupList span").removeClass("activeBtn");
  798. $("#nowGroup").html("[全部群组]");
  799. getUserList()
  800. }
  801. }
  802. //设置为全部用户
  803. function clickAllUser() {
  804. var selectAllFlog = $("#userAll").is(":checked");
  805. if (selectAllFlog) {
  806. $(".userList span").removeClass("activeBtn");
  807. $("#nowUser").html("[全部用户]");
  808. getUserList()
  809. }
  810. }
  811. //节点上配置保存人员
  812. function saveUser() {
  813. var userArray = [{
  814. unitid: "",
  815. did: "",
  816. zid: "",
  817. gid: "",
  818. rid: ""
  819. }];
  820. userArray[0].unitid = $("#userUnit").val();
  821. if ($("#departAll").is(":checked")) {
  822. userArray[0].did = "";
  823. } else {
  824. userArray[0].did = $(".treeList .activeBtn").eq(0).children("span").attr("data-code");
  825. }
  826. if ($("#roleAll").is(":checked")) {
  827. userArray[0].zid = "";
  828. } else {
  829. userArray[0].zid = $(".roleList .activeBtn").eq(0).attr("data-code");
  830. }
  831. if ($("#groupAll").is(":checked")) {
  832. userArray[0].gid = "";
  833. } else {
  834. userArray[0].gid = $(".groupList .activeBtn").eq(0).attr("data-code");
  835. }
  836. if ($("#userAll").is(":checked")) {
  837. userArray[0].rid = "";
  838. } else {
  839. userArray[0].rid = $(".userList .activeBtn").eq(0).attr("data-code");
  840. }
  841. var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
  842. var postData = {
  843. copyrightid: copyrightid,
  844. nodeid: nodeid,
  845. data: JSON.stringify(userArray)
  846. }
  847. $.ajax({
  848. type: "post",
  849. url: apiurljs.login + "g2work/flownode/updateNodeUsers",
  850. headers: {
  851. Authorization: "Bearer " + get_AccessToken,
  852. },
  853. data: JSON.stringify({
  854. data: s4.encryptData_CBC(JSON.stringify(postData))
  855. }),
  856. dataType: "json",
  857. contentType: "application/json",
  858. success: function (obj) {
  859. var response = strToJson(s4.decryptData_CBC(obj.data));
  860. sp.layerhide();
  861. if (response.success) {
  862. $("#nodeUserList").html("");
  863. response.data.USERS.forEach(function (item, index) {
  864. var itemDiv = "<div class='itemUser'>" +
  865. "<div class='delUserbtn'>" +
  866. "<i class='fa fa-close' onclick='deleteNodeUser(\"" + item.UNITID + "\",\"" + item.DID + "\",\"" + item.ZID + "\",\"" + item.GID + "\",\"" + item.RID + "\"," + index + ")'></i>" +
  867. "</div>" +
  868. "<div class='itemLine'><div class='itemTitle'>机构:</div><div class='itemVal'>" + item.UNITIDNAME + "</div></div>" +
  869. "<div class='itemLine'><div class='itemTitle'>部门:</div><div class='itemVal'>" + item.DIDNAME + "</div></div>" +
  870. "<div class='itemLine'><div class='itemTitle'>角色:</div><div class='itemVal'>" + item.ZIDNAME + "</div></div>" +
  871. "<div class='itemLine'><div class='itemTitle'>群组:</div><div class='itemVal'>" + item.GIDNAME + "</div></div>" +
  872. "<div class='itemLine'><div class='itemTitle'>人员:</div><div class='itemVal'>" + item.RIDNAME + "</div></div>" +
  873. "</div>"
  874. $("#nodeUserList").append(itemDiv);
  875. })
  876. } else {
  877. setTimeout(function () {
  878. sp.dialog(res.message);
  879. }, 1000)
  880. }
  881. },
  882. error: function (response) {
  883. console.log(response);
  884. }
  885. });
  886. }
  887. //点击流向调用的函数
  888. function clickFlow(flowid) {
  889. //流向编辑有三个tab,先控制tab的显示隐藏
  890. $(".tabItem").removeClass("sp-list-type-active");
  891. $(".tabItem").eq(0).addClass("sp-list-type-active");
  892. $(".tabInfo").hide();
  893. $(".tabInfo").eq(0).show();
  894. $("#bpmnSetRightPartFlow").attr("flowid", flowid);
  895. $("#bpmnSetRightPart").attr("nodeid", "");
  896. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  897. var postData = {directionid: directionid};
  898. //选获取选项列表数据生成选项的html再获取选项的值,顺序不能乱,会出问题!!!!
  899. $.ajax({
  900. type: "post",
  901. url: apiurljs.login + "g2work/flowdirection/queryInfoStatus",
  902. headers: {
  903. Authorization: "Bearer " + get_AccessToken,
  904. },
  905. data: JSON.stringify({
  906. data: s4.encryptData_CBC(JSON.stringify(postData))
  907. }),
  908. dataType: "json",
  909. contentType: "application/json",
  910. success: function (obj) {
  911. var response = strToJson(s4.decryptData_CBC(obj.data));
  912. $("#toinfoStatus").html("");
  913. response.data.forEach(function (item) {
  914. var itemOption = "<option value='" + item.CODE + "'>" + item.CNAME + "</option>";
  915. $("#toinfoStatus").append(itemOption);
  916. });
  917. $.ajax({
  918. type: "post",
  919. url: apiurljs.login + "g2work/flowdirection/queryData",
  920. headers: {
  921. Authorization: "Bearer " + get_AccessToken,
  922. },
  923. data: JSON.stringify({
  924. data: s4.encryptData_CBC(JSON.stringify(postData))
  925. }),
  926. dataType: "json",
  927. contentType: "application/json",
  928. success: function (obj) {
  929. var response = strToJson(s4.decryptData_CBC(obj.data));
  930. //当前流向为空时,隐藏右侧表单信息
  931. if (Object.keys(response.data).length != 0) {
  932. $("#bpmnSetRightPart").hide();
  933. $("#bpmnSetRightPartFlow").show();
  934. initFlowPart(response.data);
  935. } else {
  936. $("#bpmnSetRightPart").hide();
  937. $("#bpmnSetRightPartFlow").hide();
  938. }
  939. },
  940. error: function (response) {
  941. console.log(response);
  942. }
  943. });
  944. },
  945. error: function (response) {
  946. console.log(response);
  947. }
  948. });
  949. }
  950. function initFlowPart(flowInfo) {
  951. //初始化的时候先隐藏子流程的配置,当流向的目标节点是子流程时显示当前的配置
  952. //console.log(flowInfo);
  953. $(".itemConfig").hide();
  954. var postData = {
  955. directionid: flowInfo.DIRECTIONID
  956. }
  957. $.ajax({
  958. type: "post",
  959. url: apiurljs.login + "g2work/flowdirection/queryDataFromView",
  960. headers: {
  961. Authorization: "Bearer " + get_AccessToken,
  962. },
  963. data: JSON.stringify({
  964. data: s4.encryptData_CBC(JSON.stringify(postData))
  965. }),
  966. dataType: "json",
  967. contentType: "application/json",
  968. success: function (obj) {
  969. var response = strToJson(s4.decryptData_CBC(obj.data));
  970. $("#directionKid").html(flowInfo.DIRECTIONKID);
  971. $("#directionCname").val(flowInfo.CNAME);
  972. $("#directionRunid").val(flowInfo.RUNID);
  973. $("#directionExplain").val(flowInfo.EXPLAIN);
  974. if (flowInfo.CANGOBACK == "" || flowInfo.CANGOBACK == "false") {
  975. $("#canGoBack").prop("checked", false);
  976. } else {
  977. $("#canGoBack").prop("checked", true);
  978. }
  979. if (flowInfo.CANTESONG == "" || flowInfo.CANTESONG == "false") {
  980. $("#canTeSong").prop("checked", false);
  981. } else {
  982. $("#canTeSong").prop("checked", true);
  983. }
  984. if (flowInfo.SENDRULE == "") {
  985. $("#sendendrule").html("");
  986. $("#sendrule").val(0);
  987. $("#sendendruleBox").hide();
  988. } else {
  989. if (flowInfo.SENDRULE == 2) {
  990. $("#sendendrule").html("");
  991. $("#sendendrule").append("<option value=\"0\">有一个完成就结束</option>").append("<option value=\"1\">全部都完成才结束</option>")
  992. $("#sendendruleBox").show();
  993. } else if (flowInfo.SENDRULE == 3) {
  994. $("#sendendrule").html("");
  995. $("#sendendrule").append("<option value=\"0\">一个完成后下一个继续</option>").append("<option value=\"1\">一个抢件后其他不可见</option>")
  996. $("#sendendruleBox").show();
  997. } else {
  998. $("#sendendruleBox").hide();
  999. }
  1000. $("#sendrule").val(flowInfo.SENDRULE);
  1001. }
  1002. if (flowInfo.SENDENDRULE == "") {
  1003. $("#sendendrule").val(0);
  1004. } else {
  1005. $("#sendendrule").val(flowInfo.SENDENDRULE);
  1006. }
  1007. if (flowInfo.TOINFOSTATUS == "") {
  1008. $("#toinfoStatus").val("START");
  1009. } else {
  1010. $("#toinfoStatus").val(flowInfo.TOINFOSTATUS);
  1011. }
  1012. $("#valueSetList").html("");
  1013. flowInfo.VALUESET.forEach(function (item, index) {
  1014. if (item.ANDOR == "0") {
  1015. item.ANDOR_Name = "启动";
  1016. } else {
  1017. item.ANDOR_Name = "关闭";
  1018. }
  1019. if (item.COLVALUE.indexOf("@") == 0) {
  1020. $("#valueSet option").each(function (e) {
  1021. if ($("#valueSet option").eq(e).val() == item.COLVALUE) {
  1022. item.COLVALUE_Name = $("#valueSet option").eq(e).html();
  1023. }
  1024. })
  1025. } else {
  1026. item.COLVALUE_Name = item.COLVALUE;
  1027. }
  1028. var itemDiv = "<div class='itemBox'>" +
  1029. "<div class='delUserbtn'>" +
  1030. "<i class='fa fa-close' onclick='deleteValueset(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
  1031. "</div>" +
  1032. "<div class='itemLine'><div class='itemTitle'>赋值状态:</div><div class='itemVal'>" + item.ANDOR_Name + "</div></div>" +
  1033. "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
  1034. "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
  1035. "<div class='itemLine'><div class='itemTitle'>赋值:</div><div class='itemVal'>" + item.COLVALUE_Name + "</div></div>" +
  1036. "</div>"
  1037. $("#valueSetList").append(itemDiv);
  1038. })
  1039. $("#ruleList").html("");
  1040. flowInfo.RULE.forEach(function (item, index) {
  1041. var itemDiv = "<div class='itemBox'>" +
  1042. "<div class='delUserbtn'>" +
  1043. "<i class='fa fa-close' onclick='deleteRuleset(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
  1044. "</div>" +
  1045. "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
  1046. "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
  1047. "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
  1048. "<div class='itemLine'><div class='itemTitle'>判断符号:</div><div class='itemVal'>" + item.COLLOGIC + "</div></div>" +
  1049. "<div class='itemLine'><div class='itemTitle'>判断值:</div><div class='itemVal'>" + item.COLVALUE + "</div></div>" +
  1050. "</div>"
  1051. $("#ruleList").append(itemDiv);
  1052. })
  1053. //涉及子流程的业务处理
  1054. //如果流向的目标节点是子流程,需要显示子流程的配置功能
  1055. if (parseInt(response.data.ENDNODETYPE) == 4) {
  1056. $(".itemConfig").show();
  1057. if (flowInfo.TZHIRULE == "" || flowInfo.TZHIRULE == undefined || flowInfo.TZHIRULE == null) {
  1058. $("#noticeSelect").val(0);
  1059. } else {
  1060. $("#noticeSelect").val(parseInt(flowInfo.TZHIRULE));
  1061. }
  1062. if (flowInfo.CONTRULE == "" || flowInfo.CONTRULE == undefined || flowInfo.CONTRULE == null) {
  1063. $("#continueSelect").val(0);
  1064. } else {
  1065. $("#continueSelect").val(parseInt(flowInfo.CONTRULE));
  1066. }
  1067. } else {
  1068. $("#noticeSelect").val(0);
  1069. $("#continueSelect").val(0);
  1070. }
  1071. },
  1072. error: function (response) {
  1073. console.log(response);
  1074. }
  1075. });
  1076. }
  1077. //改变转发规则的函数
  1078. function changesSendrule() {
  1079. $("#sendendrule").html("");
  1080. var nowSendrule = $("#sendrule").val();
  1081. if (nowSendrule == 2) {
  1082. $("#sendendrule").append("<option value=\"0\">有一个完成就结束</option>").append("<option value=\"1\">全部都完成才结束</option>")
  1083. $("#sendendruleBox").show();
  1084. } else if (nowSendrule == 3) {
  1085. $("#sendendrule").append("<option value=\"0\">一个完成后下一个继续</option>").append("<option value=\"1\">一个抢件后其他不可见</option>")
  1086. $("#sendendruleBox").show();
  1087. } else {
  1088. $("#sendendruleBox").hide();
  1089. }
  1090. updateFlowInfo();
  1091. }
  1092. //流向弹窗中切换tab页的
  1093. function changeTab(num) {
  1094. $(".tabItem").removeClass("sp-list-type-active");
  1095. $(".tabInfo").hide();
  1096. $(".tabInfo").eq(num).show();
  1097. $(".tabItem").eq(num).addClass("sp-list-type-active");
  1098. if (num == 0) {
  1099. getBaseInfo();
  1100. } else if (num == 1) {
  1101. getViewInfo();
  1102. } else if (num == 2) {
  1103. getExtraInfo();
  1104. }
  1105. }
  1106. //获取流向的基本信息
  1107. function getBaseInfo() {
  1108. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  1109. var postData = {directionid: directionid};
  1110. $.ajax({
  1111. type: "post",
  1112. url: apiurljs.login + "g2work/flowdirection/queryData",
  1113. headers: {
  1114. Authorization: "Bearer " + get_AccessToken,
  1115. },
  1116. data: JSON.stringify({
  1117. data: s4.encryptData_CBC(JSON.stringify(postData))
  1118. }),
  1119. dataType: "json",
  1120. contentType: "application/json",
  1121. success: function (obj) {
  1122. var response = strToJson(s4.decryptData_CBC(obj.data));
  1123. initFlowPart(response.data);
  1124. },
  1125. error: function (response) {
  1126. console.log(response);
  1127. }
  1128. });
  1129. }
  1130. //获取流向的视图信息
  1131. function getViewInfo() {
  1132. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  1133. var postData = {directionid: directionid};
  1134. $.ajax({
  1135. type: "post",
  1136. url: apiurljs.login + "g2work/flowdirection/queryDataVusers",
  1137. headers: {
  1138. Authorization: "Bearer " + get_AccessToken,
  1139. },
  1140. data: JSON.stringify({
  1141. data: s4.encryptData_CBC(JSON.stringify(postData))
  1142. }),
  1143. dataType: "json",
  1144. contentType: "application/json",
  1145. success: function (obj) {
  1146. var response = strToJson(s4.decryptData_CBC(obj.data));
  1147. //console.log(JSON.stringify(response))
  1148. initViewInfo(response.data);
  1149. },
  1150. error: function (response) {
  1151. console.log(response);
  1152. }
  1153. });
  1154. }
  1155. //根据流向的视图信息初始化流向面板
  1156. function initViewInfo(viewInfo) {
  1157. //console.log(JSON.stringify(viewInfo));
  1158. $(".viewContentBox").html("");
  1159. $(".viewUserBox tbody").html("");
  1160. $("#userRuleList").html("");
  1161. $("#userRuleListCopy").html("");
  1162. viewInfo.FORMEDIT.forEach(function (item, index) {
  1163. var itemView = "<div class='itemView' form-edit-id='" + item.FORMEDITID + "' >" +
  1164. "<div class='itemViewName' title=\"" + item.FORMEDITID + "\">" + item.FORMEDITCNAME + "</div>" +
  1165. "<div class='itemViewBtn'>" +
  1166. "<i class='fa fa-arrow-up' title='上移视图' onclick='changeDirectionViewIndex(" + index + ",\"up\")'></i>" +
  1167. "<i class='fa fa-arrow-down' title='下移视图' onclick='changeDirectionViewIndex(" + index + ",\"down\")'></i>" +
  1168. "<i class='fa fa-tags' title='视图可见规则' onclick='openViewRuleLayer(\"" + item.FORMEDITID + "\"," + index + ")'></i>" +
  1169. "<i class='fa fa-close' onclick='deleteView(\"" + item.FORMEDITID + "\"," + index + ")' ></i>" +
  1170. "</div>" +
  1171. "</div>"
  1172. var itemList = "<div class='viewRuleList'></div>"
  1173. $(".viewContentBox").append(itemView).append(itemList);
  1174. item.RULE.forEach(function (item2, index2) {
  1175. var itemDiv = "<div class='itemBox'>" +
  1176. "<div class='delUserbtn'>" +
  1177. "<i class='fa fa-close' onclick='deleteViewRule(\"" + item2.FORMEDITID + "\",\"" + item2.BILLKEY + "\",\"" + item2.COLNAME + "\"," + index2 + ")' ></i>" +
  1178. "</div>" +
  1179. "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item2.ANDOR + "</div></div>" +
  1180. "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item2.BILLKEY + "</div></div>" +
  1181. "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item2.COLNAME + "</div></div>" +
  1182. "<div class='itemLine'><div class='itemTitle'>判断符号:</div><div class='itemVal'>" + item2.COLLOGIC + "</div></div>" +
  1183. "<div class='itemLine'><div class='itemTitle'>判断值:</div><div class='itemVal'>" + item2.COLVALUE + "</div></div>" +
  1184. "</div>"
  1185. $(".viewContentBox .viewRuleList").eq(index).append(itemDiv);
  1186. })
  1187. });
  1188. $("#tabPartTitle_viewUserBox_num").text("");
  1189. var set_viewUserBox_num = "(" + viewInfo.USERS.length + ")";
  1190. $("#tabPartTitle_viewUserBox_num").text(set_viewUserBox_num);
  1191. viewInfo.USERS.forEach(function (item, index) {
  1192. var set_delete_i = "";
  1193. if (item.MARKDELETE == "1") {
  1194. set_delete_i = "<i class='fa fa-close' onclick='deleteDirectionUser(\"" + item.RID + "\"," + index + ")'></i>";
  1195. } else {
  1196. set_delete_i = "";
  1197. }
  1198. var itemTD =
  1199. "<tr user-id='" + item.RID + "'>" +
  1200. //"<td class='sp-text-left sp-pl-10'>" + item.RID + "</td>" +
  1201. "<td class='sp-text-left sp-pl-10'>" + item.RIDCNAME + "</td>" +
  1202. "<td class='delFormbtn' style='width: 40px;'>" + set_delete_i +
  1203. "</td>" +
  1204. "</tr>";
  1205. $(".viewUserBox tbody").append(itemTD);
  1206. })
  1207. viewInfo.USERSRULE.forEach(function (item, index) {
  1208. $("#userCollogic option").each(function (e) {
  1209. if ($("#userCollogic option").eq(e).val() == item.COLLOGIC) {
  1210. item.COLLOGIC_Name = $("#userCollogic option").eq(e).html();
  1211. }
  1212. })
  1213. $("#userColvalue option").each(function (e) {
  1214. if ($("#userColvalue option").eq(e).val() == item.COLVALUE) {
  1215. item.COLVALUE_Name = $("#userColvalue option").eq(e).html();
  1216. }
  1217. })
  1218. var itemDiv = "<div class='itemBox'>" +
  1219. "<div class='delUserbtn'>" +
  1220. "<i class='fa fa-close' onclick='deleteDirectionUserRule(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
  1221. "</div>" +
  1222. "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
  1223. "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
  1224. "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
  1225. "<div class='itemLine'><div class='itemTitle'>表单列存储值:</div><div class='itemVal'>" + item.COLLOGIC_Name + "</div></div>" +
  1226. "<div class='itemLine'><div class='itemTitle'>人员过滤条件:</div><div class='itemVal'>" + item.COLVALUE_Name + "</div></div>" +
  1227. "</div>"
  1228. $("#userRuleList").append(itemDiv);
  1229. })
  1230. viewInfo.USERSRULECOPY.forEach(function (item, index) {
  1231. $("#userCollogicCopy option").each(function (e) {
  1232. if ($("#userCollogicCopy option").eq(e).val() == item.COLLOGIC) {
  1233. item.COLLOGIC_Name = $("#userCollogicCopy option").eq(e).html();
  1234. }
  1235. })
  1236. $("#userColvalueCopy option").each(function (e) {
  1237. if ($("#userColvalueCopy option").eq(e).val() == item.COLVALUE) {
  1238. item.COLVALUE_Name = $("#userColvalueCopy option").eq(e).html();
  1239. }
  1240. })
  1241. var itemDiv = "<div class='itemBox'>" +
  1242. "<div class='delUserbtn'>" +
  1243. "<i class='fa fa-close' onclick='deleteDirectionUserRuleCopy(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
  1244. "</div>" +
  1245. "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
  1246. "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
  1247. "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
  1248. "<div class='itemLine'><div class='itemTitle'>表单列存储值:</div><div class='itemVal'>" + item.COLLOGIC_Name + "</div></div>" +
  1249. "<div class='itemLine'><div class='itemTitle'>人员过滤条件:</div><div class='itemVal'>" + item.COLVALUE_Name + "</div></div>" +
  1250. "</div>"
  1251. $("#userRuleListCopy").append(itemDiv);
  1252. })
  1253. }
  1254. //获取流向的高级信息
  1255. function getExtraInfo() {
  1256. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  1257. var postData = {directionid: directionid};
  1258. $.ajax({
  1259. type: "post",
  1260. url: apiurljs.login + "g2work/flowdirection/queryDataMsgconfig",
  1261. headers: {
  1262. Authorization: "Bearer " + get_AccessToken,
  1263. },
  1264. data: JSON.stringify({
  1265. data: s4.encryptData_CBC(JSON.stringify(postData))
  1266. }),
  1267. dataType: "json",
  1268. contentType: "application/json",
  1269. success: function (obj) {
  1270. var response = strToJson(s4.decryptData_CBC(obj.data));
  1271. //console.log(response);
  1272. initExtraInfo(response.data);
  1273. },
  1274. error: function (response) {
  1275. console.log(response);
  1276. }
  1277. });
  1278. }
  1279. function initExtraInfo(extraInfo) {
  1280. if (extraInfo.RTXMSGMARK == "false" || extraInfo.RTXMSGMARK == "") {
  1281. $("#rtxmsgRemark").prop('checked', false);
  1282. } else {
  1283. $("#rtxmsgRemark").prop('checked', true);
  1284. }
  1285. if (extraInfo.SMSMSGMARK == "false" || extraInfo.SMSMSGMARK == "") {
  1286. $("#smsmsgRemark").prop('checked', false);
  1287. } else {
  1288. $("#smsmsgRemark").prop('checked', true);
  1289. }
  1290. $("#rtxmsg").val(extraInfo.RTXMSG);
  1291. $("#smsmsg").val(extraInfo.SMSMSG);
  1292. $("#msgRuleList").html("");
  1293. extraInfo.MSGCONFIG.forEach(function (item, index) {
  1294. var itemDiv = "<div class='itemBox'>" +
  1295. "<div class='delUserbtn'>" +
  1296. "<i class='fa fa-close' onclick='deleteDirectionMsgRule(\"" + item.UNITID + "\",\"" + item.DID + "\",\"" + item.ZID + "\",\"" + item.GID + "\",\"" + item.RID + "\"," + index + ")'></i>" +
  1297. "</div>" +
  1298. "<div class='itemLine'><div class='itemTitle'>机构:</div><div class='itemVal'>" + item.UNITIDNAME + "</div></div>" +
  1299. "<div class='itemLine'><div class='itemTitle'>部门:</div><div class='itemVal'>" + item.DIDNAME + "</div></div>" +
  1300. "<div class='itemLine'><div class='itemTitle'>角色:</div><div class='itemVal'>" + item.ZIDNAME + "</div></div>" +
  1301. "<div class='itemLine'><div class='itemTitle'>群组:</div><div class='itemVal'>" + item.GIDNAME + "</div></div>" +
  1302. "<div class='itemLine'><div class='itemTitle'>人员:</div><div class='itemVal'>" + item.RIDNAME + "</div></div>" +
  1303. "<div class='itemLine'><div class='itemTitle'>即时消息:</div><div class='itemVal' style='width: 150px;'>" + item.RTXMSG + "</div></div>" +
  1304. "<div class='itemLine'><div class='itemTitle'>手机短信:</div><div class='itemVal' style='width: 150px;'>" + item.SMSMSG + "</div></div>" +
  1305. "</div>"
  1306. $("#msgRuleList").append(itemDiv);
  1307. })
  1308. }
  1309. //更新节点的基本信息
  1310. function updateNodeInfo() {
  1311. var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
  1312. var postData = {
  1313. copyrightid: copyrightid,
  1314. nodeid: nodeid,
  1315. cname: $(".nodeName").val(),
  1316. timelimit: $(".nodeTime").val(),
  1317. explain: $(".nodeRemark").val(),
  1318. type: "",
  1319. toflowid: "",
  1320. toflowcname: "",
  1321. markmerge: ""
  1322. };
  1323. var typeName = $(".nodeType").html();
  1324. nodeTypeList.forEach(function (item) {
  1325. if (item.name == typeName) {
  1326. postData.type = item.type
  1327. }
  1328. })
  1329. var itemFlowNum = $(".itemFlowBox tbody").find("tr").length;
  1330. if (itemFlowNum == 1) {
  1331. postData.toflowid = $(".itemFlowBox tbody").find("tr").eq(0).attr("flow-id");
  1332. postData.toflowcname = $(".itemFlowBox tbody").find("tr>td").eq(0).html();
  1333. } else if (itemFlowNum == 0) {
  1334. }
  1335. ///判断是否合流
  1336. if ($("#chb_isMarkmerge").is(":checked")) {
  1337. postData.markmerge = "true";
  1338. } else {
  1339. postData.markmerge = "false";
  1340. }
  1341. $.ajax({
  1342. type: "post",
  1343. url: apiurljs.login + "g2work/flownode/updateNode",
  1344. headers: {
  1345. Authorization: "Bearer " + get_AccessToken,
  1346. },
  1347. data: JSON.stringify({
  1348. data: s4.encryptData_CBC(JSON.stringify(postData))
  1349. }),
  1350. dataType: "json",
  1351. contentType: "application/json",
  1352. success: function (obj) {
  1353. var response = strToJson(s4.decryptData_CBC(obj.data));
  1354. },
  1355. error: function (response) {
  1356. console.log(response);
  1357. }
  1358. });
  1359. }
  1360. ///是否合流
  1361. function updateNodeMarkmerge() {
  1362. updateNodeInfo();
  1363. };
  1364. //更新流向的基本信息
  1365. function updateFlowInfo() {
  1366. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  1367. var postData = {
  1368. copyrightid: copyrightid,
  1369. directionid: directionid,
  1370. cname: $("#directionCname").val(),
  1371. cangoback: false,
  1372. cantesong: false,
  1373. runid: $("#directionRunid").val(),
  1374. sendrule: $("#sendrule").val(),
  1375. sendendrule: ($("#sendrule").val() == 2 || $("#sendrule").val() == 3) ? $("#sendendrule").val() : 0,
  1376. toinfostatus: $("#toinfoStatus").val(),
  1377. explain: $("#directionExplain").val(),
  1378. //下面两个参数是子流程需要的配置,当流向的目标节点是子流程的时候显示在流向配置层
  1379. tzhirule: $("#noticeSelect").val(),
  1380. contrule: $("#continueSelect").val()
  1381. };
  1382. if ($("#canGoBack").is(":checked")) {
  1383. postData.cangoback = true;
  1384. } else {
  1385. postData.cangoback = false;
  1386. }
  1387. if ($("#canTeSong").is(":checked")) {
  1388. postData.cantesong = true;
  1389. } else {
  1390. postData.cantesong = false;
  1391. }
  1392. $.ajax({
  1393. type: "post",
  1394. url: apiurljs.login + "g2work/flowdirection/updateDirection",
  1395. headers: {
  1396. Authorization: "Bearer " + get_AccessToken,
  1397. },
  1398. data: JSON.stringify({
  1399. data: s4.encryptData_CBC(JSON.stringify(postData))
  1400. }),
  1401. dataType: "json",
  1402. contentType: "application/json",
  1403. success: function (obj) {
  1404. var response = strToJson(s4.decryptData_CBC(obj.data));
  1405. },
  1406. error: function (response) {
  1407. console.log(response);
  1408. }
  1409. });
  1410. }
  1411. function changeRtxmsg() {
  1412. if ($("#rtxmsgRemark").is(":checked")) {
  1413. $("#rtxmsg").val("您刚刚收到了@TITLE,请您尽快办理。");
  1414. } else {
  1415. $("#rtxmsg").val("");
  1416. }
  1417. updateFlowExtraInfo();
  1418. }
  1419. function changeSmsmsg() {
  1420. if ($("#smsmsgRemark").is(":checked")) {
  1421. $("#smsmsg").val("您刚刚收到了@TITLE,请您尽快办理。");
  1422. } else {
  1423. $("#smsmsg").val("");
  1424. }
  1425. updateFlowExtraInfo();
  1426. }
  1427. //更新流向的高级信息
  1428. function updateFlowExtraInfo() {
  1429. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  1430. var postData = {
  1431. copyrightid: copyrightid,
  1432. directionid: directionid,
  1433. rtxmsg: $("#rtxmsg").val(),
  1434. smsmsg: $("#smsmsg").val()
  1435. }
  1436. $.ajax({
  1437. type: "post",
  1438. url: apiurljs.login + "g2work/flowdirection/updateDirectionMsg",
  1439. headers: {
  1440. Authorization: "Bearer " + get_AccessToken,
  1441. },
  1442. data: JSON.stringify({
  1443. data: s4.encryptData_CBC(JSON.stringify(postData))
  1444. }),
  1445. dataType: "json",
  1446. contentType: "application/json",
  1447. success: function (obj) {
  1448. var response = strToJson(s4.decryptData_CBC(obj.data));
  1449. },
  1450. error: function (response) {
  1451. console.log(response);
  1452. }
  1453. });
  1454. }
  1455. //打开流向赋值功能设置
  1456. function openDirectionValuesetLayer() {
  1457. $("#valueState").val(0);
  1458. $("#valueSet").val("@USERID");
  1459. getDirectionFormData("#valueTable", "#valueColname", "", "");
  1460. sp.layer('#layer_directionValueset');
  1461. }
  1462. //获取指定流程的表单和列
  1463. function getDirectionFormData(a, b, c, d) {
  1464. $(a).html("");
  1465. $(b).html("");
  1466. $(d).html("");
  1467. var postData = {copyrightid: copyrightid};
  1468. $.ajax({
  1469. type: "post",
  1470. url: apiurljs.login + "g2work/form/queryFormByCopyrightid",
  1471. headers: {
  1472. Authorization: "Bearer " + get_AccessToken,
  1473. },
  1474. data: JSON.stringify({
  1475. data: s4.encryptData_CBC(JSON.stringify(postData))
  1476. }),
  1477. dataType: "json",
  1478. contentType: "application/json",
  1479. success: function (obj) {
  1480. var response = strToJson(s4.decryptData_CBC(obj.data));
  1481. //console.log(response);
  1482. response.data.forEach(function (item, index) {
  1483. //默认打开设置层初始选中第一张表
  1484. if (index == 0) {
  1485. var itemOption = "<option selected value='" + item.BILLKEY + "'>" + item.CNAME + "</option>"
  1486. } else {
  1487. var itemOption = "<option value='" + item.BILLKEY + "'>" + item.CNAME + "</option>"
  1488. }
  1489. $(a).append(itemOption);
  1490. })
  1491. //默认打开设置层初始选中第一张表的第一个字段
  1492. var sendData = {tablename: response.data[0].BILLKEY};
  1493. $.ajax({
  1494. type: "post",
  1495. url: apiurljs.login + "g2work/form/queryColnameByTablename",
  1496. headers: {
  1497. Authorization: "Bearer " + get_AccessToken,
  1498. },
  1499. data: JSON.stringify({
  1500. data: s4.encryptData_CBC(JSON.stringify(sendData))
  1501. }),
  1502. dataType: "json",
  1503. contentType: "application/json",
  1504. success: function (obj) {
  1505. var response = strToJson(s4.decryptData_CBC(obj.data));
  1506. response.data.forEach(function (item, index) {
  1507. //默认打开设置层初始选中第一张表
  1508. if (index == 0) {
  1509. var itemOption = "<option selected data-tchild='" + item.TCHILD + "' data-tdata='" + item.TDATA + "' data-tshow='" + item.TSHOW + "' value='" + item.CODE + "'>" + item.CNAME + "</option>"
  1510. } else {
  1511. var itemOption = "<option data-tchild='" + item.TCHILD + "' data-tdata='" + item.TDATA + "' data-tshow='" + item.TSHOW + "' value='" + item.CODE + "'>" + item.CNAME + "</option>"
  1512. }
  1513. $(b).append(itemOption);
  1514. })
  1515. //可见性查询表结构时需要继续往下深入查询
  1516. if (c == "") {
  1517. } else {
  1518. if (response.data[0].TCHILD == "") {
  1519. var inputSting = "<input class='sp-input' type='text'>";
  1520. $(d).append(inputSting);
  1521. } else {
  1522. var infoData = {
  1523. tchild: response.data[0].TCHILD,
  1524. tdata: response.data[0].TDATA,
  1525. tshow: response.data[0].TSHOW,
  1526. twhere: ""
  1527. }
  1528. $.ajax({
  1529. type: "post",
  1530. url: apiurljs.login + "g2work/form/queryTchildByName",
  1531. headers: {
  1532. Authorization: "Bearer " + get_AccessToken,
  1533. },
  1534. data: JSON.stringify({
  1535. data: s4.encryptData_CBC(JSON.stringify(infoData))
  1536. }),
  1537. dataType: "json",
  1538. contentType: "application/json",
  1539. success: function (obj) {
  1540. var response = strToJson(s4.decryptData_CBC(obj.data));
  1541. response.data.forEach(function (item) {
  1542. var itemString = "<label class='itemLabel' data-code='" + item.CODE + "'><input type='checkbox'>" + item.CNAME + "</label>";
  1543. $(d).append(itemString);
  1544. })
  1545. },
  1546. error: function (response) {
  1547. console.log(response);
  1548. }
  1549. });
  1550. }
  1551. }
  1552. },
  1553. error: function (response) {
  1554. console.log(response);
  1555. }
  1556. });
  1557. },
  1558. error: function (response) {
  1559. console.log(response);
  1560. }
  1561. });
  1562. }
  1563. //改变表选项的同时去更新列选项
  1564. function changeDirectionForm(a, b) {
  1565. $(b).html("");
  1566. var sendData = {tablename: $(a).val()};
  1567. $.ajax({
  1568. type: "post",
  1569. url: apiurljs.login + "g2work/form/queryColnameByTablename",
  1570. headers: {
  1571. Authorization: "Bearer " + get_AccessToken,
  1572. },
  1573. data: JSON.stringify({
  1574. data: s4.encryptData_CBC(JSON.stringify(sendData))
  1575. }),
  1576. dataType: "json",
  1577. contentType: "application/json",
  1578. success: function (obj) {
  1579. var response = strToJson(s4.decryptData_CBC(obj.data));
  1580. response.data.forEach(function (item, index) {
  1581. //默认打开设置层初始选中第一张表
  1582. if (index == 0) {
  1583. var itemOption = "<option data-tchild='" + item.TCHILD + "' data-tdata='" + item.TDATA + "' data-tshow='" + item.TSHOW + "' selected value='" + item.CODE + "'>" + item.CNAME + "</option>"
  1584. } else {
  1585. var itemOption = "<option data-tchild='" + item.TCHILD + "' data-tdata='" + item.TDATA + "' data-tshow='" + item.TSHOW + "' value='" + item.CODE + "'>" + item.CNAME + "</option>"
  1586. }
  1587. $(b).append(itemOption);
  1588. })
  1589. },
  1590. error: function (response) {
  1591. console.log(response);
  1592. }
  1593. });
  1594. }
  1595. //改变表选项的同时去更新列选项同时更新判断值
  1596. function changeDirectionForm_code(a, b, c) {
  1597. $(b).html("");
  1598. $(c).html("");
  1599. var sendData = {tablename: $(a).val()};
  1600. $.ajax({
  1601. type: "post",
  1602. url: apiurljs.login + "g2work/form/queryColnameByTablename",
  1603. headers: {
  1604. Authorization: "Bearer " + get_AccessToken,
  1605. },
  1606. data: JSON.stringify({
  1607. data: s4.encryptData_CBC(JSON.stringify(sendData))
  1608. }),
  1609. dataType: "json",
  1610. contentType: "application/json",
  1611. success: function (obj) {
  1612. var response = strToJson(s4.decryptData_CBC(obj.data));
  1613. response.data.forEach(function (item, index) {
  1614. //默认打开设置层初始选中第一张表
  1615. if (index == 0) {
  1616. var itemOption = "<option selected data-tchild='" + item.TCHILD + "' data-tdata='" + item.TDATA + "' data-tshow='" + item.TSHOW + "' value='" + item.CODE + "'>" + item.CNAME + "</option>"
  1617. } else {
  1618. var itemOption = "<option data-tchild='" + item.TCHILD + "' data-tdata='" + item.TDATA + "' data-tshow='" + item.TSHOW + "' value='" + item.CODE + "'>" + item.CNAME + "</option>"
  1619. }
  1620. $(b).append(itemOption);
  1621. })
  1622. if (response.data[0].TCHILD == "") {
  1623. var inputSting = "<input class='sp-input' type='text'>";
  1624. $(c).append(inputSting);
  1625. } else {
  1626. var infoData = {
  1627. tchild: response.data[0].TCHILD,
  1628. tdata: response.data[0].TDATA,
  1629. tshow: response.data[0].TSHOW,
  1630. twhere: ""
  1631. }
  1632. $.ajax({
  1633. type: "post",
  1634. url: apiurljs.login + "g2work/form/queryTchildByName",
  1635. headers: {
  1636. Authorization: "Bearer " + get_AccessToken,
  1637. },
  1638. data: JSON.stringify({
  1639. data: s4.encryptData_CBC(JSON.stringify(infoData))
  1640. }),
  1641. dataType: "json",
  1642. contentType: "application/json",
  1643. success: function (obj) {
  1644. var response = strToJson(s4.decryptData_CBC(obj.data));
  1645. response.data.forEach(function (item) {
  1646. var itemString = "<label class='itemLabel' data-code='" + item.CODE + "'><input type='checkbox'>" + item.CNAME + "</label>";
  1647. $(c).append(itemString);
  1648. })
  1649. },
  1650. error: function (response) {
  1651. console.log(response);
  1652. }
  1653. });
  1654. }
  1655. },
  1656. error: function (response) {
  1657. console.log(response);
  1658. }
  1659. });
  1660. }
  1661. //改变列的同时去更新判断值
  1662. function changeColname_code(a, b) {
  1663. $(b).html("");
  1664. var tchild = $(a).find("option:selected").attr("data-tchild");
  1665. var tdata = $(a).find("option:selected").attr("data-tdata");
  1666. var tshow = $(a).find("option:selected").attr("data-tshow");
  1667. if (tchild == "") {
  1668. var inputSting = "<input class='sp-input' type='text'>";
  1669. $(b).append(inputSting);
  1670. } else {
  1671. var infoData = {
  1672. tchild: tchild,
  1673. tdata: tdata,
  1674. tshow: tshow,
  1675. twhere: ""
  1676. }
  1677. $.ajax({
  1678. type: "post",
  1679. url: apiurljs.login + "g2work/form/queryTchildByName",
  1680. headers: {
  1681. Authorization: "Bearer " + get_AccessToken,
  1682. },
  1683. data: JSON.stringify({
  1684. data: s4.encryptData_CBC(JSON.stringify(infoData))
  1685. }),
  1686. dataType: "json",
  1687. contentType: "application/json",
  1688. success: function (obj) {
  1689. var response = strToJson(s4.decryptData_CBC(obj.data));
  1690. response.data.forEach(function (item) {
  1691. var itemString = "<label class='itemLabel' data-code='" + item.CODE + "'><input type='checkbox'>" + item.CNAME + "</label>";
  1692. $(b).append(itemString);
  1693. })
  1694. },
  1695. error: function (response) {
  1696. console.log(response);
  1697. }
  1698. });
  1699. }
  1700. }
  1701. //更新流向对应的赋值
  1702. function saveDirectionValueset() {
  1703. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  1704. var postData = {
  1705. copyrightid: copyrightid,
  1706. directionid: directionid,
  1707. data: ""
  1708. }
  1709. var valueArray = [];
  1710. valueArray.push({
  1711. billkey: $("#valueTable").val(),
  1712. colname: $("#valueColname").val(),
  1713. collogic: "=",
  1714. colvalue: $("#valueType").val() == 1 ? $("#valueSet").val() : $("#valueInput").val(),
  1715. andor: $("#valueState").val()
  1716. }
  1717. );
  1718. postData.data = JSON.stringify(valueArray);
  1719. $.ajax({
  1720. type: "post",
  1721. url: apiurljs.login + "g2work/flowdirection/updateDirectionValueset",
  1722. headers: {
  1723. Authorization: "Bearer " + get_AccessToken,
  1724. },
  1725. data: JSON.stringify({
  1726. data: s4.encryptData_CBC(JSON.stringify(postData))
  1727. }),
  1728. dataType: "json",
  1729. contentType: "application/json",
  1730. success: function (obj) {
  1731. var response = strToJson(s4.decryptData_CBC(obj.data));
  1732. sp.layerhide();
  1733. if (response.success) {
  1734. $("#valueSetList").html("");
  1735. response.data.VALUESET.forEach(function (item, index) {
  1736. if (item.ANDOR == "0") {
  1737. item.ANDOR_Name = "启动";
  1738. } else {
  1739. item.ANDOR_Name = "关闭";
  1740. }
  1741. if (item.COLVALUE.indexOf("@") == 0) {
  1742. $("#valueSet option").each(function (e) {
  1743. if ($("#valueSet option").eq(e).val() == item.COLVALUE) {
  1744. item.COLVALUE_Name = $("#valueSet option").eq(e).html();
  1745. }
  1746. })
  1747. } else {
  1748. item.COLVALUE_Name = item.COLVALUE;
  1749. }
  1750. var itemDiv = "<div class='itemBox'>" +
  1751. "<div class='delUserbtn'>" +
  1752. "<i class='fa fa-close' onclick='deleteValueset(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
  1753. "</div>" +
  1754. "<div class='itemLine'><div class='itemTitle'>赋值状态:</div><div class='itemVal'>" + item.ANDOR_Name + "</div></div>" +
  1755. "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
  1756. "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
  1757. "<div class='itemLine'><div class='itemTitle'>赋值:</div><div class='itemVal'>" + item.COLVALUE_Name + "</div></div>" +
  1758. "</div>"
  1759. $("#valueSetList").append(itemDiv);
  1760. })
  1761. } else {
  1762. setTimeout(function () {
  1763. sp.dialog(res.message);
  1764. }, 1000)
  1765. }
  1766. },
  1767. error: function (response) {
  1768. console.log(response);
  1769. }
  1770. });
  1771. }
  1772. //更新流向可见性规则
  1773. function saveDirectionRule() {
  1774. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  1775. var postData = {
  1776. copyrightid: copyrightid,
  1777. directionid: directionid,
  1778. data: ""
  1779. }
  1780. var valueArray = [];
  1781. valueArray.push({
  1782. billkey: $("#ruleTable").val(),
  1783. colname: $("#ruleColname").val(),
  1784. collogic: $("#ruleCollogic").val(),
  1785. colvalue: "",
  1786. andor: $("#ruleAndor").val()
  1787. }
  1788. );
  1789. if ($("#ruleColname").find("option:selected").attr("data-tchild") == "") {
  1790. valueArray[0].colvalue = $("#ruleValueBox input[type='text']").val();
  1791. } else {
  1792. var ruleValue = "";
  1793. $("#ruleValueBox input[type='checkbox']:checked").each(function (e) {
  1794. ruleValue += $(this).parent().attr("data-code") + "|";
  1795. })
  1796. valueArray[0].colvalue = ruleValue.substring(0, ruleValue.length - 1);
  1797. }
  1798. postData.data = JSON.stringify(valueArray);
  1799. $.ajax({
  1800. type: "post",
  1801. url: apiurljs.login + "g2work/flowdirection/updateDirectionRule",
  1802. headers: {
  1803. Authorization: "Bearer " + get_AccessToken,
  1804. },
  1805. data: JSON.stringify({
  1806. data: s4.encryptData_CBC(JSON.stringify(postData))
  1807. }),
  1808. dataType: "json",
  1809. contentType: "application/json",
  1810. success: function (obj) {
  1811. var response = strToJson(s4.decryptData_CBC(obj.data));
  1812. sp.layerhide();
  1813. if (response.success) {
  1814. $("#ruleList").html("");
  1815. response.data.RULE.forEach(function (item, index) {
  1816. var itemDiv = "<div class='itemBox'>" +
  1817. "<div class='delUserbtn'>" +
  1818. "<i class='fa fa-close' onclick='deleteRuleset(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
  1819. "</div>" +
  1820. "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
  1821. "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
  1822. "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
  1823. "<div class='itemLine'><div class='itemTitle'>判断符号:</div><div class='itemVal'>" + item.COLLOGIC + "</div></div>" +
  1824. "<div class='itemLine'><div class='itemTitle'>判断值:</div><div class='itemVal'>" + item.COLVALUE + "</div></div>" +
  1825. "</div>"
  1826. $("#ruleList").append(itemDiv);
  1827. })
  1828. } else {
  1829. setTimeout(function () {
  1830. sp.dialog(res.message);
  1831. }, 1000)
  1832. }
  1833. },
  1834. error: function (response) {
  1835. console.log(response);
  1836. }
  1837. });
  1838. }
  1839. //打开流向可见性
  1840. function openDirectionRuleLayer() {
  1841. $("#ruleAndor").val("AND");
  1842. $("#ruleCollogic").val("等于");
  1843. getDirectionFormData("#ruleTable", "#ruleColname", "code", "#ruleValueBox");
  1844. sp.layer('#layer_directionRule');
  1845. }
  1846. //打开增加表单视图功能
  1847. function openViewLayer() {
  1848. $("#selectAllView").prop('checked', false);
  1849. $(".viewTypeBox>.typeItem").removeClass("active");
  1850. $(".viewTypeBox>.typeItem").eq(0).addClass("active");
  1851. getViewType();
  1852. sp.layer('#layer_viewset');
  1853. }
  1854. //获取视图分类
  1855. function getViewType() {
  1856. $(".viewTypeBox").html("");
  1857. var postData = {
  1858. copyrightid: copyrightid
  1859. }
  1860. $.ajax({
  1861. type: "post",
  1862. url: apiurljs.login + "g2work/form/queryFormByCopyrightid",
  1863. headers: {
  1864. Authorization: "Bearer " + get_AccessToken,
  1865. },
  1866. data: JSON.stringify({
  1867. data: s4.encryptData_CBC(JSON.stringify(postData))
  1868. }),
  1869. dataType: "json",
  1870. contentType: "application/json",
  1871. success: function (obj) {
  1872. var response = strToJson(s4.decryptData_CBC(obj.data));
  1873. response.data.forEach(function (item, index) {
  1874. if (index == 0) {
  1875. 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>";
  1876. } else {
  1877. 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>";
  1878. }
  1879. $(".viewTypeBox").append(itemType);
  1880. })
  1881. getViewList();
  1882. },
  1883. error: function (response) {
  1884. console.log(response);
  1885. }
  1886. });
  1887. }
  1888. //加载视图列表
  1889. function getViewList() {
  1890. //根据选中的机构和类型查询表单数据
  1891. var nowForm = $(".viewTypeBox .active").attr("data-type");
  1892. var postData = {
  1893. formid: nowForm,
  1894. }
  1895. $("#viewList tbody").html("");
  1896. $.ajax({
  1897. type: "post",
  1898. url: apiurljs.login + "g2work/form/queryFormeditByFormid",
  1899. headers: {
  1900. Authorization: "Bearer " + get_AccessToken,
  1901. },
  1902. data: JSON.stringify({
  1903. data: s4.encryptData_CBC(JSON.stringify(postData))
  1904. }),
  1905. dataType: "json",
  1906. contentType: "application/json",
  1907. success: function (obj) {
  1908. var response = strToJson(s4.decryptData_CBC(obj.data));
  1909. if (response.data.length != 0) {
  1910. $(".viewPartRight .sp-table-tip").hide();
  1911. response.data.forEach(function (item, index) {
  1912. var itemTr =
  1913. "<tr view-id='" + item.FORMEDITID + "'>" +
  1914. "<td><input type='checkbox' onclick='selectItemView()'></td>" +
  1915. "<td>" + (index + 1) + "</td>" +
  1916. "<td title='" + item.FORMEDITID + "'>" + item.FORMEDITID + "</td>" +
  1917. "<td>" + item.CNAME + "</td>" +
  1918. "</tr>";
  1919. $("#viewList tbody").append(itemTr);
  1920. })
  1921. } else {
  1922. $(".viewPartRight .sp-table-tip").show();
  1923. }
  1924. },
  1925. error: function (response) {
  1926. console.log(response);
  1927. }
  1928. });
  1929. }
  1930. function changeViewType(code, obj) {
  1931. $("#selectAllView").prop('checked', false);
  1932. $(".viewTypeBox>.typeItem").removeClass("active");
  1933. $(obj).addClass("active");
  1934. getViewList();
  1935. }
  1936. //全选或者取消全选表单
  1937. function selectAllView() {
  1938. var selectAllFlog = $("#selectAllView").is(":checked");
  1939. $("#viewList tbody input[type='checkbox']").prop('checked', selectAllFlog);
  1940. }
  1941. //点击单个表单函数
  1942. function selectItemView() {
  1943. var selectNum = $("#viewList tbody input[type='checkbox']:checked").length;
  1944. var totalNum = $("#viewList tbody input[type='checkbox']").length;
  1945. if (selectNum == totalNum) {
  1946. $("#selectAllView").prop('checked', true);
  1947. } else {
  1948. $("#selectAllView").prop('checked', false);
  1949. }
  1950. }
  1951. //保存选择视图
  1952. function saveView() {
  1953. var viewArray = [];
  1954. $("#viewList tbody input[type='checkbox']:checked").each(function (e) {
  1955. var viewItem = {
  1956. formeditid: $(this).parents("tr").attr("view-id")
  1957. }
  1958. viewArray.push(viewItem);
  1959. })
  1960. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  1961. var postData = {
  1962. copyrightid: copyrightid,
  1963. directionid: directionid,
  1964. data: JSON.stringify(viewArray)
  1965. }
  1966. $.ajax({
  1967. type: "post",
  1968. url: apiurljs.login + "g2work/flowdirection/updateDirectionFormedit",
  1969. headers: {
  1970. Authorization: "Bearer " + get_AccessToken,
  1971. },
  1972. data: JSON.stringify({
  1973. data: s4.encryptData_CBC(JSON.stringify(postData))
  1974. }),
  1975. dataType: "json",
  1976. contentType: "application/json",
  1977. success: function (obj) {
  1978. var response = strToJson(s4.decryptData_CBC(obj.data));
  1979. sp.layerhide();
  1980. if (response.success) {
  1981. $(".viewContentBox").html("");
  1982. response.data.FORMEDIT.forEach(function (item, index) {
  1983. var itemView = "<div class='itemView' form-edit-id='" + item.FORMEDITID + "' >" +
  1984. "<div class='itemViewName' title=\"" + item.FORMEDITID + "\">" + item.FORMEDITCNAME + "</div>" +
  1985. "<div class='itemViewBtn'>" +
  1986. "<i class='fa fa-arrow-up' title='上移视图' onclick='changeDirectionViewIndex(" + index + ",\"up\")'></i>" +
  1987. "<i class='fa fa-arrow-down' title='下移视图' onclick='changeDirectionViewIndex(" + index + ",\"down\")'></i>" +
  1988. "<i class='fa fa-tags' title='视图可见规则' onclick='openViewRuleLayer(\"" + item.FORMEDITID + "\"," + index + ")'></i>" +
  1989. "<i class='fa fa-close' onclick='deleteView(\"" + item.FORMEDITID + "\"," + index + ")' ></i>" +
  1990. "</div>" +
  1991. "</div>"
  1992. var itemList = "<div class='viewRuleList'></div>"
  1993. $(".viewContentBox").append(itemView).append(itemList);
  1994. item.RULE.forEach(function (item2, index2) {
  1995. var itemDiv = "<div class='itemBox'>" +
  1996. "<div class='delUserbtn'>" +
  1997. "<i class='fa fa-close' onclick='deleteViewRule(\"" + item2.FORMEDITID + "\",\"" + item2.BILLKEY + "\",\"" + item2.COLNAME + "\"," + index2 + ")' ></i>" +
  1998. "</div>" +
  1999. "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item2.ANDOR + "</div></div>" +
  2000. "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item2.BILLKEY + "</div></div>" +
  2001. "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item2.COLNAME + "</div></div>" +
  2002. "<div class='itemLine'><div class='itemTitle'>判断符号:</div><div class='itemVal'>" + item2.COLLOGIC + "</div></div>" +
  2003. "<div class='itemLine'><div class='itemTitle'>判断值:</div><div class='itemVal'>" + item2.COLVALUE + "</div></div>" +
  2004. "</div>"
  2005. $(".viewContentBox .viewRuleList").eq(index).append(itemDiv);
  2006. })
  2007. });
  2008. } else {
  2009. setTimeout(function () {
  2010. sp.dialog(res.message);
  2011. }, 1000)
  2012. }
  2013. },
  2014. error: function (response) {
  2015. console.log(response);
  2016. }
  2017. });
  2018. }
  2019. //打开视图可见性弹窗
  2020. function openViewRuleLayer(formeditid, index) {
  2021. $("#viewAndor").val("AND");
  2022. $("#viewCollogic").val("等于");
  2023. getDirectionFormData("#viewTable", "#viewColname", "code", "#viewValueBox");
  2024. $("#layer_viewRule").attr("form-editid", formeditid);
  2025. $("#layer_viewRule").attr("form-index", index);
  2026. sp.layer('#layer_viewRule');
  2027. }
  2028. //保存视图可见性函数
  2029. function saveDirectionViewRule() {
  2030. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  2031. var postData = {
  2032. copyrightid: copyrightid,
  2033. directionid: directionid,
  2034. formeditid: $("#layer_viewRule").attr("form-editid"),
  2035. data: ""
  2036. }
  2037. var valueArray = [];
  2038. valueArray.push({
  2039. billkey: $("#viewTable").val(),
  2040. colname: $("#viewColname").val(),
  2041. collogic: $("#viewCollogic").val(),
  2042. colvalue: "",
  2043. andor: $("#viewAndor").val()
  2044. }
  2045. );
  2046. if ($("#viewColname").find("option:selected").attr("data-tchild") == "") {
  2047. valueArray[0].colvalue = $("#viewValueBox input[type='text']").val();
  2048. } else {
  2049. var ruleValue = "";
  2050. $("#viewValueBox input[type='checkbox']:checked").each(function (e) {
  2051. ruleValue += $(this).parent().attr("data-code") + "|";
  2052. })
  2053. valueArray[0].colvalue = ruleValue.substring(0, ruleValue.length - 1);
  2054. }
  2055. postData.data = JSON.stringify(valueArray);
  2056. $.ajax({
  2057. type: "post",
  2058. url: apiurljs.login + "g2work/flowdirection/updateDirectionFormeditRule",
  2059. headers: {
  2060. Authorization: "Bearer " + get_AccessToken,
  2061. },
  2062. data: JSON.stringify({
  2063. data: s4.encryptData_CBC(JSON.stringify(postData))
  2064. }),
  2065. dataType: "json",
  2066. contentType: "application/json",
  2067. success: function (obj) {
  2068. var response = strToJson(s4.decryptData_CBC(obj.data));
  2069. sp.layerhide();
  2070. if (response.success) {
  2071. var index = $("#layer_viewRule").attr("form-index");
  2072. $(".viewContentBox .viewRuleList").eq(index).html("");
  2073. response.data.RULE.forEach(function (item, num) {
  2074. var itemDiv = "<div class='itemBox'>" +
  2075. "<div class='delUserbtn'>" +
  2076. "<i class='fa fa-close' onclick='deleteViewRule(\"" + item.FORMEDITID + "\",\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + num + ")' ></i>" +
  2077. "</div>" +
  2078. "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
  2079. "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
  2080. "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
  2081. "<div class='itemLine'><div class='itemTitle'>判断符号:</div><div class='itemVal'>" + item.COLLOGIC + "</div></div>" +
  2082. "<div class='itemLine'><div class='itemTitle'>判断值:</div><div class='itemVal'>" + item.COLVALUE + "</div></div>" +
  2083. "</div>"
  2084. $(".viewContentBox .viewRuleList").eq(index).append(itemDiv);
  2085. })
  2086. } else {
  2087. setTimeout(function () {
  2088. sp.dialog(res.message);
  2089. }, 1000)
  2090. }
  2091. },
  2092. error: function (response) {
  2093. console.log(response);
  2094. }
  2095. });
  2096. }
  2097. //打开流程人员设置
  2098. function openDirectionUser() {
  2099. $("#directionUnit").val(unitList[0].CODE);
  2100. $("#directionAllDepart").prop("checked", true);
  2101. $("#directionAllUser").prop("checked", false);
  2102. getDirectionDepart();
  2103. sp.layer('#layer_directionUser');
  2104. }
  2105. //流向配置人员加载部门信息
  2106. function getDirectionDepart() {
  2107. var postData = {
  2108. code: $("#directionUnit").val()
  2109. }
  2110. $.ajax({
  2111. type: "post",
  2112. url: apiurljs.login + "g2work/sect/querySect",
  2113. headers: {
  2114. Authorization: "Bearer " + get_AccessToken,
  2115. },
  2116. data: JSON.stringify({
  2117. data: s4.encryptData_CBC(JSON.stringify(postData))
  2118. }),
  2119. dataType: "json",
  2120. contentType: "application/json",
  2121. success: function (obj) {
  2122. var response = strToJson(s4.decryptData_CBC(obj.data));
  2123. $(".treeDirectionList").html("");
  2124. response.data.forEach(function (item, index) {
  2125. if (item.C_H_I_L_D.length > 0) {
  2126. var firstLi = "<li>" +
  2127. "<a><i class='fa fa-plus-square-o'></i><i class='fa fa-minus-square-o'></i><span>" + item.SECTION + "</span></a>" +
  2128. "<ul></ul>"
  2129. "</li>";
  2130. } else {
  2131. var firstLi = "<li class='sp-tree-nochild'><a><span>" + item.SECTION + "</span></a></li>";
  2132. }
  2133. $(".treeDirectionList").append(firstLi);
  2134. item.C_H_I_L_D.forEach(function (item2, index2) {
  2135. if (item2.C_H_I_L_D.length > 0) {
  2136. var secondLi = "<li>" +
  2137. "<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>" +
  2138. "<ul></ul>"
  2139. "</li>";
  2140. } else {
  2141. var secondLi = "<li class='sp-tree-nochild'><a><span data-code='" + item2.CODE + "' onclick='selectDirectionDeprt(this)'>" + item2.SECTION + "</span></a></li>"
  2142. }
  2143. $(".treeDirectionList>li").eq(index).children("ul").append(secondLi);
  2144. item2.C_H_I_L_D.forEach(function (item3, index3) {
  2145. var thirdLi = "<li class='sp-tree-nochild'><a><span data-code='" + item3.CODE + "' onclick='selectDirectionDeprt(this)'>" + item3.SECTION + "</span></a></li>";
  2146. $(".treeDirectionList>li").eq(index).children("ul").children("li").eq(index2).children("ul").append(thirdLi);
  2147. })
  2148. })
  2149. })
  2150. //树形的伸缩
  2151. $(".sp-tree").find("a>i").each(function () {
  2152. $(this).on("click", function () {
  2153. if ($(this).parent().hasClass("hasclick")) {
  2154. $(this).parent().removeClass("hasclick");
  2155. if ($(this).parent().parent().find("ul").length > 0) {
  2156. $(this).parent().parent().children("ul").children("li").hide();
  2157. $(this).parent().children(".fa-minus-square-o").hide();
  2158. $(this).parent().children(".fa-plus-square-o").show();
  2159. }
  2160. ;
  2161. } else {
  2162. $(this).parent().addClass("hasclick");
  2163. if ($(this).parent().parent().find("ul").length > 0) {
  2164. $(this).parent().parent().children("ul").children("li").show();
  2165. $(this).parent().children(".fa-minus-square-o").css({"display": "inline-block"});
  2166. $(this).parent().children(".fa-plus-square-o").hide();
  2167. }
  2168. ;
  2169. }
  2170. });
  2171. });
  2172. $(".treeDirectionList>li").eq(0).children("a").find(".fa-plus-square-o").click();
  2173. getDirectionUserList();
  2174. },
  2175. error: function (response) {
  2176. console.log(response);
  2177. }
  2178. });
  2179. }
  2180. //流向选择人员改变机构
  2181. function changeDirectionUnit() {
  2182. getDirectionDepart();
  2183. }
  2184. //流向选择人员点击部门
  2185. function selectDirectionDeprt(obj) {
  2186. $("#directionAllDepart").prop("checked", false);
  2187. $(".treeDirectionList a").removeClass("activeBtn");
  2188. $(obj).parent().addClass("activeBtn");
  2189. getDirectionUserList();
  2190. }
  2191. //流向选择人员点击全部部门
  2192. function clickAllDirectionDepart() {
  2193. var selectAllFlog = $("#directionAllDepart").is(":checked");
  2194. if (selectAllFlog) {
  2195. $(".treeDirectionList a").removeClass("activeBtn");
  2196. getDirectionUserList();
  2197. }
  2198. }
  2199. //流向选择人员获取人员列表
  2200. function getDirectionUserList() {
  2201. var postData = {
  2202. unitid: $("#directionUnit").val(),
  2203. departid: "",
  2204. zid: "",
  2205. gid: ""
  2206. }
  2207. var nowDepartNum = $(".treeDirectionList .activeBtn").length;
  2208. if (nowDepartNum == 0) {
  2209. postData.departid = "";
  2210. } else {
  2211. postData.departid = $(".treeDirectionList .activeBtn").eq(0).children("span").attr("data-code");
  2212. }
  2213. $.ajax({
  2214. type: "post",
  2215. url: apiurljs.login + "g2work/user/queryUserByUnitidDepartidZidGid",
  2216. headers: {
  2217. Authorization: "Bearer " + get_AccessToken,
  2218. },
  2219. data: JSON.stringify({
  2220. data: s4.encryptData_CBC(JSON.stringify(postData))
  2221. }),
  2222. dataType: "json",
  2223. contentType: "application/json",
  2224. success: function (obj) {
  2225. var response = strToJson(s4.decryptData_CBC(obj.data));
  2226. $(".directionUserList").html("");
  2227. response.data.forEach(function (item) {
  2228. var itemRole = "<label><input onclick='selectItemDirectionUser()' data-code='" + item.USERID + "' type='checkbox'><span>" + item.USHOWNAME + "</span></label>";
  2229. $(".directionUserList").append(itemRole);
  2230. })
  2231. },
  2232. error: function (response) {
  2233. console.log(response);
  2234. }
  2235. });
  2236. }
  2237. //流向保存人员
  2238. function saveDirectionUser() {
  2239. var directionUserArray = [];
  2240. $(".directionUserList input[type='checkbox']:checked").each(function (e) {
  2241. var userItem = {
  2242. rid: $(this).attr("data-code")
  2243. }
  2244. directionUserArray.push(userItem);
  2245. })
  2246. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  2247. var postData = {
  2248. copyrightid: copyrightid,
  2249. directionid: directionid,
  2250. data: JSON.stringify(directionUserArray)
  2251. }
  2252. $.ajax({
  2253. type: "post",
  2254. url: apiurljs.login + "g2work/flowdirection/updateDirectionUsers",
  2255. headers: {
  2256. Authorization: "Bearer " + get_AccessToken,
  2257. },
  2258. data: JSON.stringify({
  2259. data: s4.encryptData_CBC(JSON.stringify(postData))
  2260. }),
  2261. dataType: "json",
  2262. contentType: "application/json",
  2263. success: function (obj) {
  2264. var response = strToJson(s4.decryptData_CBC(obj.data));
  2265. //console.log(JSON.stringify(response));
  2266. sp.layerhide();
  2267. if (response.success) {
  2268. $(".viewUserBox tbody").html("");
  2269. $("#tabPartTitle_viewUserBox_num").text("");
  2270. var set_viewUserBox_num = "(" + viewInfo.USERS.length + ")";
  2271. $("#tabPartTitle_viewUserBox_num").text(set_viewUserBox_num);
  2272. response.data.USERS.forEach(function (item, index) {
  2273. var set_delete_i = "";
  2274. if (item.MARKDELETE == "1") {
  2275. set_delete_i = "<i class='fa fa-close' onclick='deleteDirectionUser(\"" + item.RID + "\"," + index + ")'></i>";
  2276. } else {
  2277. set_delete_i = "";
  2278. }
  2279. var itemTD =
  2280. "<tr user-id='" + item.RID + "'>" +
  2281. //"<td class='sp-text-left sp-pl-10'>" + item.RID + "</td>" +
  2282. "<td class='sp-text-left sp-pl-10'>" + item.RIDCNAME + "</td>" +
  2283. "<td class='delFormbtn' style='width: 40px;'>" + set_delete_i +
  2284. "</td>" +
  2285. "</tr>";
  2286. $(".viewUserBox tbody").append(itemTD);
  2287. })
  2288. } else {
  2289. setTimeout(function () {
  2290. sp.dialog(res.message);
  2291. }, 1000)
  2292. }
  2293. },
  2294. error: function (response) {
  2295. console.log(response);
  2296. }
  2297. });
  2298. }
  2299. //打开人员可见性
  2300. function openUserRuleLayer() {
  2301. $("#userAndor").val("AND");
  2302. $("#userCollogic").val("USERID");
  2303. $("#userColvalue").val("USERA");
  2304. getDirectionFormData("#userTable", "#userColname", "", "");
  2305. sp.layer('#layer_userRule');
  2306. }
  2307. //打开抄送人员可见性
  2308. function openUserRuleCopyLayer() {
  2309. $("#userAndorCopy").val("AND");
  2310. $("#userCollogicCopy").val("USERID");
  2311. $("#userColvalueCopy").val("USERA");
  2312. getDirectionFormData("#userTableCopy", "#userColnameCopy", "", "");
  2313. sp.layer('#layer_userRuleCopy');
  2314. }
  2315. //保存人员可见规则
  2316. function saveUserRule() {
  2317. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  2318. var postData = {
  2319. copyrightid: copyrightid,
  2320. directionid: directionid,
  2321. data: ""
  2322. }
  2323. var valueArray = [];
  2324. valueArray.push({
  2325. billkey: $("#userTable").val(),
  2326. colname: $("#userColname").val(),
  2327. collogic: $("#userCollogic").val(),
  2328. colvalue: $("#userColvalue").val(),
  2329. andor: $("#userAndor").val()
  2330. }
  2331. );
  2332. postData.data = JSON.stringify(valueArray);
  2333. $.ajax({
  2334. type: "post",
  2335. url: apiurljs.login + "g2work/flowdirection/updateDirectionUsersRule",
  2336. headers: {
  2337. Authorization: "Bearer " + get_AccessToken,
  2338. },
  2339. data: JSON.stringify({
  2340. data: s4.encryptData_CBC(JSON.stringify(postData))
  2341. }),
  2342. dataType: "json",
  2343. contentType: "application/json",
  2344. success: function (obj) {
  2345. var response = strToJson(s4.decryptData_CBC(obj.data));
  2346. sp.layerhide();
  2347. if (response.success) {
  2348. $("#userRuleList").html("");
  2349. response.data.USERSRULE.forEach(function (item, index) {
  2350. $("#userCollogic option").each(function (e) {
  2351. if ($("#userCollogic option").eq(e).val() == item.COLLOGIC) {
  2352. item.COLLOGIC_Name = $("#userCollogic option").eq(e).html();
  2353. }
  2354. })
  2355. $("#userColvalue option").each(function (e) {
  2356. if ($("#userColvalue option").eq(e).val() == item.COLVALUE) {
  2357. item.COLVALUE_Name = $("#userColvalue option").eq(e).html();
  2358. }
  2359. })
  2360. var itemDiv = "<div class='itemBox'>" +
  2361. "<div class='delUserbtn'>" +
  2362. "<i class='fa fa-close' onclick='deleteDirectionUserRule(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
  2363. "</div>" +
  2364. "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
  2365. "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
  2366. "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
  2367. "<div class='itemLine'><div class='itemTitle'>表单列存储值:</div><div class='itemVal'>" + item.COLLOGIC_Name + "</div></div>" +
  2368. "<div class='itemLine'><div class='itemTitle'>人员功率条件:</div><div class='itemVal'>" + item.COLVALUE_Name + "</div></div>" +
  2369. "</div>"
  2370. $("#userRuleList").append(itemDiv);
  2371. })
  2372. } else {
  2373. setTimeout(function () {
  2374. sp.dialog(res.message);
  2375. }, 1000)
  2376. }
  2377. },
  2378. error: function (response) {
  2379. console.log(response);
  2380. }
  2381. });
  2382. }
  2383. //保存抄送人员可见规则
  2384. function saveUserRuleCopy() {
  2385. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  2386. var postData = {
  2387. copyrightid: copyrightid,
  2388. directionid: directionid,
  2389. data: ""
  2390. }
  2391. var valueArray = [];
  2392. valueArray.push({
  2393. billkey: $("#userTableCopy").val(),
  2394. colname: $("#userColnameCopy").val(),
  2395. collogic: $("#userCollogicCopy").val(),
  2396. colvalue: $("#userColvalueCopy").val(),
  2397. andor: $("#userAndorCopy").val()
  2398. }
  2399. );
  2400. postData.data = JSON.stringify(valueArray);
  2401. $.ajax({
  2402. type: "post",
  2403. url: apiurljs.login + "g2work/flowdirection/updateDirectionUsersRuleCopy",
  2404. headers: {
  2405. Authorization: "Bearer " + get_AccessToken,
  2406. },
  2407. data: JSON.stringify({
  2408. data: s4.encryptData_CBC(JSON.stringify(postData))
  2409. }),
  2410. dataType: "json",
  2411. contentType: "application/json",
  2412. success: function (obj) {
  2413. var response = strToJson(s4.decryptData_CBC(obj.data));
  2414. sp.layerhide();
  2415. if (response.success) {
  2416. $("#userRuleListCopy").html("");
  2417. response.data.USERSRULECOPY.forEach(function (item, index) {
  2418. $("#userCollogicCopy option").each(function (e) {
  2419. if ($("#userCollogicCopy option").eq(e).val() == item.COLLOGIC) {
  2420. item.COLLOGIC_Name = $("#userCollogicCopy option").eq(e).html();
  2421. }
  2422. })
  2423. $("#userColvalueCopy option").each(function (e) {
  2424. if ($("#userColvalueCopy option").eq(e).val() == item.COLVALUE) {
  2425. item.COLVALUE_Name = $("#userColvalueCopy option").eq(e).html();
  2426. }
  2427. })
  2428. var itemDiv = "<div class='itemBox'>" +
  2429. "<div class='delUserbtn'>" +
  2430. "<i class='fa fa-close' onclick='deleteDirectionUserRuleCopy(\"" + item.BILLKEY + "\",\"" + item.COLNAME + "\"," + index + ")'></i>" +
  2431. "</div>" +
  2432. "<div class='itemLine'><div class='itemTitle'>逻辑符:</div><div class='itemVal'>" + item.ANDOR + "</div></div>" +
  2433. "<div class='itemLine'><div class='itemTitle'>数据表单:</div><div class='itemVal'>" + item.BILLKEY + "</div></div>" +
  2434. "<div class='itemLine'><div class='itemTitle'>数据字段:</div><div class='itemVal'>" + item.COLNAME + "</div></div>" +
  2435. "<div class='itemLine'><div class='itemTitle'>表单列存储值:</div><div class='itemVal'>" + item.COLLOGIC_Name + "</div></div>" +
  2436. "<div class='itemLine'><div class='itemTitle'>人员功率条件:</div><div class='itemVal'>" + item.COLVALUE_Name + "</div></div>" +
  2437. "</div>"
  2438. $("#userRuleListCopy").append(itemDiv);
  2439. })
  2440. } else {
  2441. setTimeout(function () {
  2442. sp.dialog(res.message);
  2443. }, 1000)
  2444. }
  2445. },
  2446. error: function (response) {
  2447. console.log(response);
  2448. }
  2449. });
  2450. }
  2451. //打开额外提醒设置
  2452. function openMsgLayer() {
  2453. $("#userUnit").val(unitList[0].CODE);
  2454. $("#departAll").prop("checked", true);
  2455. $("#roleAll").prop("checked", true);
  2456. $("#groupAll").prop("checked", true);
  2457. $("#userAll").prop("checked", true);
  2458. $("#nowDepart").html("[全部部门]");
  2459. $("#nowRole").html("[全部角色]");
  2460. $("#nowGroup").html("[全部群组]");
  2461. $("#nowUser").html("[全部人员]");
  2462. $("#nowUnit").html(unitList[0].SECTION);
  2463. getUserDepart();
  2464. getUserRole();
  2465. getUserGroup();
  2466. getUserList();
  2467. $("#layer_selectUser").attr("data-title", "提醒设置");
  2468. $("#layer_selectUser .sp-layer-title").html("提醒设置");
  2469. $("#layer_selectUser .msgContentBox").show();
  2470. //下面的流向提醒设置中需要置空的数据
  2471. $("#rtxmsgFlag").prop("checked", false);
  2472. $("#smsmsgFlag").prop("checked", false);
  2473. $("#rtxmsgContent").val("");
  2474. $("#smsmsgContent").val("");
  2475. sp.layer('#layer_selectUser');
  2476. }
  2477. function changeRtxmsgFlag() {
  2478. if ($("#rtxmsgFlag").is(":checked")) {
  2479. $("#rtxmsgContent").val("您刚刚收到了@TITLE,请您尽快办理。");
  2480. } else {
  2481. $("#rtxmsgContent").val("");
  2482. }
  2483. }
  2484. function changeSmsmsgFlag() {
  2485. if ($("#smsmsgFlag").is(":checked")) {
  2486. $("#smsmsgContent").val("您刚刚收到了@TITLE,请您尽快办理。");
  2487. } else {
  2488. $("#smsmsgContent").val("");
  2489. }
  2490. }
  2491. //判断当前执行保存用户方法还是保存提醒方法
  2492. function saveUserOrMsg() {
  2493. var nowType = $("#layer_selectUser").attr("data-title");
  2494. if (nowType == "人员设置") {
  2495. saveUser();
  2496. } else {
  2497. saveMsgConfig();
  2498. }
  2499. }
  2500. //保存提醒
  2501. function saveMsgConfig() {
  2502. var userArray = [{
  2503. unitid: "",
  2504. did: "",
  2505. zid: "",
  2506. gid: "",
  2507. rid: "",
  2508. rtxmsg: "",
  2509. smsmsg: ""
  2510. }];
  2511. userArray[0].unitid = $("#userUnit").val();
  2512. if ($("#departAll").is(":checked")) {
  2513. userArray[0].did = "";
  2514. } else {
  2515. userArray[0].did = $(".treeList .activeBtn").eq(0).children("span").attr("data-code");
  2516. }
  2517. if ($("#roleAll").is(":checked")) {
  2518. userArray[0].zid = "";
  2519. } else {
  2520. userArray[0].zid = $(".roleList .activeBtn").eq(0).attr("data-code");
  2521. }
  2522. if ($("#groupAll").is(":checked")) {
  2523. userArray[0].gid = "";
  2524. } else {
  2525. userArray[0].gid = $(".groupList .activeBtn").eq(0).attr("data-code");
  2526. }
  2527. if ($("#userAll").is(":checked")) {
  2528. userArray[0].rid = "";
  2529. } else {
  2530. userArray[0].rid = $(".userList .activeBtn").eq(0).attr("data-code");
  2531. }
  2532. if ($("#rtxmsgFlag").is(":checked")) {
  2533. userArray[0].rtxmsg = $("#rtxmsgContent").val();
  2534. } else {
  2535. userArray[0].rtxmsg = "";
  2536. }
  2537. if ($("#smsmsgFlag").is(":checked")) {
  2538. userArray[0].smsmsg = $("#smsmsgContent").val();
  2539. } else {
  2540. userArray[0].smsmsg = "";
  2541. }
  2542. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  2543. var postData = {
  2544. copyrightid: copyrightid,
  2545. directionid: directionid,
  2546. data: JSON.stringify(userArray)
  2547. }
  2548. $.ajax({
  2549. type: "post",
  2550. url: apiurljs.login + "g2work/flowdirection/updateDirectionMsgconfig",
  2551. headers: {
  2552. Authorization: "Bearer " + get_AccessToken,
  2553. },
  2554. data: JSON.stringify({
  2555. data: s4.encryptData_CBC(JSON.stringify(postData))
  2556. }),
  2557. dataType: "json",
  2558. contentType: "application/json",
  2559. success: function (obj) {
  2560. var response = strToJson(s4.decryptData_CBC(obj.data));
  2561. sp.layerhide();
  2562. if (response.success) {
  2563. $("#msgRuleList").html("");
  2564. response.data.MSGCONFIG.forEach(function (item, index) {
  2565. var itemDiv = "<div class='itemBox'>" +
  2566. "<div class='delUserbtn'>" +
  2567. "<i class='fa fa-close' onclick='deleteDirectionMsgRule(\"" + item.UNITID + "\",\"" + item.DID + "\",\"" + item.ZID + "\",\"" + item.GID + "\",\"" + item.RID + "\"," + index + ")'></i>" +
  2568. "</div>" +
  2569. "<div class='itemLine'><div class='itemTitle'>机构:</div><div class='itemVal'>" + item.UNITIDNAME + "</div></div>" +
  2570. "<div class='itemLine'><div class='itemTitle'>部门:</div><div class='itemVal'>" + item.DIDNAME + "</div></div>" +
  2571. "<div class='itemLine'><div class='itemTitle'>角色:</div><div class='itemVal'>" + item.ZIDNAME + "</div></div>" +
  2572. "<div class='itemLine'><div class='itemTitle'>群组:</div><div class='itemVal'>" + item.GIDNAME + "</div></div>" +
  2573. "<div class='itemLine'><div class='itemTitle'>人员:</div><div class='itemVal'>" + item.RIDNAME + "</div></div>" +
  2574. "<div class='itemLine'><div class='itemTitle'>即时消息:</div><div class='itemVal' style='width: 150px;'>" + item.RTXMSG + "</div></div>" +
  2575. "<div class='itemLine'><div class='itemTitle'>手机短信:</div><div class='itemVal' style='width: 150px;'>" + item.SMSMSG + "</div></div>" +
  2576. "</div>"
  2577. $("#msgRuleList").append(itemDiv);
  2578. })
  2579. } else {
  2580. setTimeout(function () {
  2581. sp.dialog(res.message);
  2582. }, 1000)
  2583. }
  2584. },
  2585. error: function (response) {
  2586. console.log(response);
  2587. }
  2588. });
  2589. }
  2590. //删除流程节点对应的表单
  2591. function deleteNodeForm(formid, index) {
  2592. var getDelID = formid;
  2593. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  2594. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  2595. 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>";
  2596. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  2597. sp.openCenter(".sp-dialog");
  2598. //取消按钮
  2599. $('.sp-closeDialog').click(function (event) {
  2600. sp.closeCenter(".sp-dialog");
  2601. event.preventDefault();
  2602. event.stopPropagation();
  2603. });
  2604. $("#delDataTrue").click(function () {
  2605. sp.dialoghide();
  2606. var getid = $(this).attr("data-id");
  2607. var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
  2608. var postData = {
  2609. copyrightid: copyrightid,
  2610. nodeid: nodeid,
  2611. formid: getid
  2612. };
  2613. $.ajax({
  2614. type: "post",
  2615. url: apiurljs.login + "g2work/flownode/deleteNodeForm",
  2616. headers: {
  2617. Authorization: "Bearer " + get_AccessToken,
  2618. },
  2619. data: JSON.stringify({
  2620. data: s4.encryptData_CBC(JSON.stringify(postData))
  2621. }),
  2622. dataType: "json",
  2623. contentType: "application/json",
  2624. success: function (obj) {
  2625. var response = strToJson(s4.decryptData_CBC(obj.data));
  2626. sp.layerhide();
  2627. if (response.success) {
  2628. getNodeInfo();
  2629. } else {
  2630. setTimeout(function () {
  2631. sp.dialog(res.message);
  2632. }, 1000)
  2633. }
  2634. },
  2635. error: function (response) {
  2636. console.log(response);
  2637. }
  2638. });
  2639. });
  2640. }
  2641. //删除流程节点对应的人员
  2642. function deleteNodeUser(unitid, did, zid, gid, rid, index) {
  2643. var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
  2644. var postData = {
  2645. copyrightid: copyrightid,
  2646. nodeid: nodeid,
  2647. unitid: unitid,
  2648. did: did,
  2649. zid: zid,
  2650. gid: gid,
  2651. rid: rid
  2652. }
  2653. var getDelID = JSON.stringify(postData);
  2654. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  2655. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  2656. 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>";
  2657. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  2658. sp.openCenter(".sp-dialog");
  2659. //取消按钮
  2660. $('.sp-closeDialog').click(function (event) {
  2661. sp.closeCenter(".sp-dialog");
  2662. event.preventDefault();
  2663. event.stopPropagation();
  2664. });
  2665. $("#delDataTrue").click(function () {
  2666. sp.dialoghide();
  2667. $.ajax({
  2668. type: "post",
  2669. url: apiurljs.login + "g2work/flownode/deleteNodeUsers",
  2670. headers: {
  2671. Authorization: "Bearer " + get_AccessToken,
  2672. },
  2673. data: JSON.stringify({
  2674. data: s4.encryptData_CBC($(this).attr("data-id"))
  2675. }),
  2676. dataType: "json",
  2677. contentType: "application/json",
  2678. success: function (obj) {
  2679. var response = strToJson(s4.decryptData_CBC(obj.data));
  2680. sp.layerhide();
  2681. if (response.success) {
  2682. getNodeInfo();
  2683. } else {
  2684. setTimeout(function () {
  2685. sp.dialog(res.message);
  2686. }, 1000)
  2687. }
  2688. },
  2689. error: function (response) {
  2690. console.log(response);
  2691. }
  2692. });
  2693. });
  2694. }
  2695. //删除流程流向对应的赋值设置
  2696. function deleteValueset(billkey, colname, index) {
  2697. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  2698. var postData = {
  2699. copyrightid: copyrightid,
  2700. directionid: directionid,
  2701. billkey: billkey,
  2702. colname: colname
  2703. }
  2704. var getDelID = JSON.stringify(postData);
  2705. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  2706. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  2707. 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>";
  2708. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  2709. sp.openCenter(".sp-dialog");
  2710. //取消按钮
  2711. $('.sp-closeDialog').click(function (event) {
  2712. sp.closeCenter(".sp-dialog");
  2713. event.preventDefault();
  2714. event.stopPropagation();
  2715. });
  2716. $("#delDataTrue").click(function () {
  2717. sp.dialoghide();
  2718. $.ajax({
  2719. type: "post",
  2720. url: apiurljs.login + "g2work/flowdirection/deleteDirectionValueset",
  2721. headers: {
  2722. Authorization: "Bearer " + get_AccessToken,
  2723. },
  2724. data: JSON.stringify({
  2725. data: s4.encryptData_CBC($(this).attr("data-id"))
  2726. }),
  2727. dataType: "json",
  2728. contentType: "application/json",
  2729. success: function (obj) {
  2730. var response = strToJson(s4.decryptData_CBC(obj.data));
  2731. sp.layerhide();
  2732. if (response.success) {
  2733. getBaseInfo();
  2734. } else {
  2735. setTimeout(function () {
  2736. sp.dialog(res.message);
  2737. }, 1000)
  2738. }
  2739. },
  2740. error: function (response) {
  2741. console.log(response);
  2742. }
  2743. });
  2744. });
  2745. }
  2746. //删除流程流向对应的可见性规则设置
  2747. function deleteRuleset(billkey, colname, index) {
  2748. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  2749. var postData = {
  2750. copyrightid: copyrightid,
  2751. directionid: directionid,
  2752. billkey: billkey,
  2753. colname: colname
  2754. }
  2755. var getDelID = JSON.stringify(postData);
  2756. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  2757. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  2758. 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>";
  2759. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  2760. sp.openCenter(".sp-dialog");
  2761. //取消按钮
  2762. $('.sp-closeDialog').click(function (event) {
  2763. sp.closeCenter(".sp-dialog");
  2764. event.preventDefault();
  2765. event.stopPropagation();
  2766. });
  2767. $("#delDataTrue").click(function () {
  2768. sp.dialoghide();
  2769. $.ajax({
  2770. type: "post",
  2771. url: apiurljs.login + "g2work/flowdirection/deleteDirectionRule",
  2772. headers: {
  2773. Authorization: "Bearer " + get_AccessToken,
  2774. },
  2775. data: JSON.stringify({
  2776. data: s4.encryptData_CBC($(this).attr("data-id"))
  2777. }),
  2778. dataType: "json",
  2779. contentType: "application/json",
  2780. success: function (obj) {
  2781. var response = strToJson(s4.decryptData_CBC(obj.data));
  2782. sp.layerhide();
  2783. if (response.success) {
  2784. getBaseInfo();
  2785. } else {
  2786. setTimeout(function () {
  2787. sp.dialog(res.message);
  2788. }, 1000)
  2789. }
  2790. },
  2791. error: function (response) {
  2792. console.log(response);
  2793. }
  2794. });
  2795. });
  2796. }
  2797. //删除流向对应的表单视图
  2798. function deleteView(formeditid, index) {
  2799. var ruleNum = $(".viewContentBox .viewRuleList").eq(index).find(".itemBox").length;
  2800. if (ruleNum > 0) {
  2801. sp.dialog("当前视图下已配置可见规则,无法删除");
  2802. } else {
  2803. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  2804. var postData = {
  2805. copyrightid: copyrightid,
  2806. directionid: directionid,
  2807. formeditid: formeditid
  2808. }
  2809. var getDelID = JSON.stringify(postData);
  2810. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  2811. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  2812. 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>";
  2813. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  2814. sp.openCenter(".sp-dialog");
  2815. //取消按钮
  2816. $('.sp-closeDialog').click(function (event) {
  2817. sp.closeCenter(".sp-dialog");
  2818. event.preventDefault();
  2819. event.stopPropagation();
  2820. });
  2821. $("#delDataTrue").click(function () {
  2822. sp.dialoghide();
  2823. $.ajax({
  2824. type: "post",
  2825. url: apiurljs.login + "g2work/flowdirection/deleteDirectionFormedit",
  2826. headers: {
  2827. Authorization: "Bearer " + get_AccessToken,
  2828. },
  2829. data: JSON.stringify({
  2830. data: s4.encryptData_CBC($(this).attr("data-id"))
  2831. }),
  2832. dataType: "json",
  2833. contentType: "application/json",
  2834. success: function (obj) {
  2835. var response = strToJson(s4.decryptData_CBC(obj.data));
  2836. sp.layerhide();
  2837. if (response.success) {
  2838. getViewInfo();
  2839. } else {
  2840. setTimeout(function () {
  2841. sp.dialog(res.message);
  2842. }, 1000)
  2843. }
  2844. },
  2845. error: function (response) {
  2846. console.log(response);
  2847. }
  2848. });
  2849. });
  2850. }
  2851. }
  2852. //删除流向对应的视图的可见规则
  2853. function deleteViewRule(formeditid, billkey, colname, index) {
  2854. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  2855. var postData = {
  2856. copyrightid: copyrightid,
  2857. directionid: directionid,
  2858. formeditid: formeditid,
  2859. billkey: billkey,
  2860. colname: colname
  2861. }
  2862. var getDelID = JSON.stringify(postData);
  2863. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  2864. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  2865. 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>";
  2866. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  2867. sp.openCenter(".sp-dialog");
  2868. //取消按钮
  2869. $('.sp-closeDialog').click(function (event) {
  2870. sp.closeCenter(".sp-dialog");
  2871. event.preventDefault();
  2872. event.stopPropagation();
  2873. });
  2874. $("#delDataTrue").click(function () {
  2875. sp.dialoghide();
  2876. $.ajax({
  2877. type: "post",
  2878. url: apiurljs.login + "g2work/flowdirection/deleteDirectionFormeditRule",
  2879. headers: {
  2880. Authorization: "Bearer " + get_AccessToken,
  2881. },
  2882. data: JSON.stringify({
  2883. data: s4.encryptData_CBC($(this).attr("data-id"))
  2884. }),
  2885. dataType: "json",
  2886. contentType: "application/json",
  2887. success: function (obj) {
  2888. var response = strToJson(s4.decryptData_CBC(obj.data));
  2889. sp.layerhide();
  2890. if (response.success) {
  2891. getViewInfo();
  2892. } else {
  2893. setTimeout(function () {
  2894. sp.dialog(res.message);
  2895. }, 1000)
  2896. }
  2897. },
  2898. error: function (response) {
  2899. console.log(response);
  2900. }
  2901. });
  2902. });
  2903. }
  2904. //删除流向对应人员
  2905. function deleteDirectionUser(rid, index) {
  2906. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  2907. var postData = {
  2908. copyrightid: copyrightid,
  2909. directionid: directionid,
  2910. rid: rid
  2911. }
  2912. var getDelID = JSON.stringify(postData);
  2913. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  2914. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  2915. 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>";
  2916. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  2917. sp.openCenter(".sp-dialog");
  2918. //取消按钮
  2919. $('.sp-closeDialog').click(function (event) {
  2920. sp.closeCenter(".sp-dialog");
  2921. event.preventDefault();
  2922. event.stopPropagation();
  2923. });
  2924. $("#delDataTrue").click(function () {
  2925. sp.dialoghide();
  2926. $.ajax({
  2927. type: "post",
  2928. url: apiurljs.login + "g2work/flowdirection/deleteDirectionUsers",
  2929. headers: {
  2930. Authorization: "Bearer " + get_AccessToken,
  2931. },
  2932. data: JSON.stringify({
  2933. data: s4.encryptData_CBC($(this).attr("data-id"))
  2934. }),
  2935. dataType: "json",
  2936. contentType: "application/json",
  2937. success: function (obj) {
  2938. var response = strToJson(s4.decryptData_CBC(obj.data));
  2939. sp.layerhide();
  2940. if (response.success) {
  2941. getViewInfo();
  2942. } else {
  2943. setTimeout(function () {
  2944. sp.dialog(res.message);
  2945. }, 1000)
  2946. }
  2947. },
  2948. error: function (response) {
  2949. console.log(response);
  2950. }
  2951. });
  2952. });
  2953. }
  2954. //删除流向对应人员的可见性规则
  2955. function deleteDirectionUserRule(billkey, colname, index) {
  2956. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  2957. var postData = {
  2958. copyrightid: copyrightid,
  2959. directionid: directionid,
  2960. billkey: billkey,
  2961. colname: colname
  2962. }
  2963. var getDelID = JSON.stringify(postData);
  2964. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  2965. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  2966. 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>";
  2967. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  2968. sp.openCenter(".sp-dialog");
  2969. //取消按钮
  2970. $('.sp-closeDialog').click(function (event) {
  2971. sp.closeCenter(".sp-dialog");
  2972. event.preventDefault();
  2973. event.stopPropagation();
  2974. });
  2975. $("#delDataTrue").click(function () {
  2976. sp.dialoghide();
  2977. $.ajax({
  2978. type: "post",
  2979. url: apiurljs.login + "g2work/flowdirection/deleteDirectionUsersRule",
  2980. headers: {
  2981. Authorization: "Bearer " + get_AccessToken,
  2982. },
  2983. data: JSON.stringify({
  2984. data: s4.encryptData_CBC($(this).attr("data-id"))
  2985. }),
  2986. dataType: "json",
  2987. contentType: "application/json",
  2988. success: function (obj) {
  2989. var response = strToJson(s4.decryptData_CBC(obj.data));
  2990. sp.layerhide();
  2991. if (response.success) {
  2992. getViewInfo();
  2993. } else {
  2994. setTimeout(function () {
  2995. sp.dialog(res.message);
  2996. }, 1000)
  2997. }
  2998. },
  2999. error: function (response) {
  3000. console.log(response);
  3001. }
  3002. });
  3003. });
  3004. }
  3005. //删除流向对应抄送人员的可见性规则
  3006. function deleteDirectionUserRuleCopy(billkey, colname, index) {
  3007. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  3008. var postData = {
  3009. copyrightid: copyrightid,
  3010. directionid: directionid,
  3011. billkey: billkey,
  3012. colname: colname
  3013. }
  3014. var getDelID = JSON.stringify(postData);
  3015. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  3016. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  3017. 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>";
  3018. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  3019. sp.openCenter(".sp-dialog");
  3020. //取消按钮
  3021. $('.sp-closeDialog').click(function (event) {
  3022. sp.closeCenter(".sp-dialog");
  3023. event.preventDefault();
  3024. event.stopPropagation();
  3025. });
  3026. $("#delDataTrue").click(function () {
  3027. sp.dialoghide();
  3028. $.ajax({
  3029. type: "post",
  3030. url: apiurljs.login + "g2work/flowdirection/deleteDirectionUsersRuleCopy",
  3031. headers: {
  3032. Authorization: "Bearer " + get_AccessToken,
  3033. },
  3034. data: JSON.stringify({
  3035. data: s4.encryptData_CBC($(this).attr("data-id"))
  3036. }),
  3037. dataType: "json",
  3038. contentType: "application/json",
  3039. success: function (obj) {
  3040. var response = strToJson(s4.decryptData_CBC(obj.data));
  3041. sp.layerhide();
  3042. if (response.success) {
  3043. getViewInfo();
  3044. } else {
  3045. setTimeout(function () {
  3046. sp.dialog(res.message);
  3047. }, 1000)
  3048. }
  3049. },
  3050. error: function (response) {
  3051. console.log(response);
  3052. }
  3053. });
  3054. });
  3055. }
  3056. //删除流向对应的高级规则
  3057. function deleteDirectionMsgRule(unitid, did, zid, gid, rid, index) {
  3058. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  3059. var postData = {
  3060. copyrightid: copyrightid,
  3061. directionid: directionid,
  3062. unitid: unitid,
  3063. did: did,
  3064. zid: zid,
  3065. gid: gid,
  3066. rid: rid
  3067. }
  3068. var getDelID = JSON.stringify(postData);
  3069. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  3070. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  3071. 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>";
  3072. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  3073. sp.openCenter(".sp-dialog");
  3074. //取消按钮
  3075. $('.sp-closeDialog').click(function (event) {
  3076. sp.closeCenter(".sp-dialog");
  3077. event.preventDefault();
  3078. event.stopPropagation();
  3079. });
  3080. $("#delDataTrue").click(function () {
  3081. sp.dialoghide();
  3082. $.ajax({
  3083. type: "post",
  3084. url: apiurljs.login + "g2work/flowdirection/deleteDirectionMsgconfig",
  3085. headers: {
  3086. Authorization: "Bearer " + get_AccessToken,
  3087. },
  3088. data: JSON.stringify({
  3089. data: s4.encryptData_CBC($(this).attr("data-id"))
  3090. }),
  3091. dataType: "json",
  3092. contentType: "application/json",
  3093. success: function (obj) {
  3094. var response = strToJson(s4.decryptData_CBC(obj.data));
  3095. sp.layerhide();
  3096. if (response.success) {
  3097. getExtraInfo();
  3098. } else {
  3099. setTimeout(function () {
  3100. sp.dialog(res.message);
  3101. }, 1000)
  3102. }
  3103. },
  3104. error: function (response) {
  3105. console.log(response);
  3106. }
  3107. });
  3108. });
  3109. }
  3110. function clickAllDirectionUser() {
  3111. var selectAllFlog = $("#directionAllUser").is(":checked");
  3112. $(".directionUserList label input[type='checkbox']").prop("checked", selectAllFlog);
  3113. }
  3114. function selectItemDirectionUser() {
  3115. var selectNum = $(".directionUserList label input[type='checkbox']:checked").length;
  3116. var totalNum = $(".directionUserList label input[type='checkbox']").length;
  3117. if (selectNum == totalNum) {
  3118. $("#directionAllUser").prop("checked", true);
  3119. } else {
  3120. $("#directionAllUser").prop("checked", false);
  3121. }
  3122. }
  3123. //核查流程功能
  3124. function checkFlow() {
  3125. var postData = {
  3126. copyrightid: copyrightid,
  3127. }
  3128. $.ajax({
  3129. type: "post",
  3130. url: apiurljs.login + "g2work/flow/queryWorkflowErrors",
  3131. headers: {
  3132. Authorization: "Bearer " + get_AccessToken,
  3133. },
  3134. data: JSON.stringify({
  3135. data: s4.encryptData_CBC(JSON.stringify(postData))
  3136. }),
  3137. dataType: "json",
  3138. contentType: "application/json",
  3139. success: function (obj) {
  3140. var response = strToJson(s4.decryptData_CBC(obj.data));
  3141. if (response.data.length == 0) {
  3142. sp.dialog("当前流程配置正确");
  3143. } else {
  3144. var contentSting = "";
  3145. response.data.forEach(function (item) {
  3146. contentSting += item + "</br>";
  3147. })
  3148. sp.dialog(contentSting);
  3149. $(".sp-dialog-body").addClass("maxHeight");
  3150. }
  3151. },
  3152. error: function (response) {
  3153. console.log(response);
  3154. }
  3155. });
  3156. }
  3157. //更新创建流程用户
  3158. function saveFlowCreate() {
  3159. var postData = {
  3160. copyrightid: copyrightid,
  3161. userid: ""
  3162. }
  3163. $.ajax({
  3164. type: "post",
  3165. url: apiurljs.login + "g2work/desktop/createWorkflowCandoWithUserID",
  3166. headers: {
  3167. Authorization: "Bearer " + get_AccessToken,
  3168. },
  3169. data: JSON.stringify({
  3170. data: s4.encryptData_CBC(JSON.stringify(postData))
  3171. }),
  3172. dataType: "json",
  3173. contentType: "application/json",
  3174. success: function (obj) {
  3175. sp.dialog("成功更新创建流程用户!");
  3176. },
  3177. error: function (response) {
  3178. console.log(response);
  3179. }
  3180. });
  3181. }
  3182. //改变流向视图顺序函数
  3183. function changeDirectionViewIndex(index, direction) {
  3184. var nowViewNum = $(".viewContentBox .itemView").length;
  3185. //排除一些不能操作的情况
  3186. if (direction == "up" && index == 0) {
  3187. sp.dialog("无法上移");
  3188. } else if (direction == "down" && index == nowViewNum - 1) {
  3189. sp.dialog("无法下移");
  3190. } else {
  3191. var directionid = $("#bpmnSetRightPartFlow").attr("flowid") + "_" + copyrightid;
  3192. var postData = {
  3193. copyrightid: copyrightid,
  3194. directionid: directionid,
  3195. formeditid1: "",
  3196. formeditid2: ""
  3197. }
  3198. if (direction == "up") {
  3199. postData.formeditid1 = $(".viewContentBox .itemView").eq(index).attr("form-edit-id");
  3200. postData.formeditid2 = $(".viewContentBox .itemView").eq(index - 1).attr("form-edit-id");
  3201. } else {
  3202. postData.formeditid1 = $(".viewContentBox .itemView").eq(index).attr("form-edit-id");
  3203. postData.formeditid2 = $(".viewContentBox .itemView").eq(index + 1).attr("form-edit-id");
  3204. }
  3205. $.ajax({
  3206. type: "post",
  3207. url: apiurljs.login + "g2work/flowdirection/swapSortidByDirectionIdFormeditId",
  3208. headers: {
  3209. Authorization: "Bearer " + get_AccessToken,
  3210. },
  3211. data: JSON.stringify({
  3212. data: s4.encryptData_CBC(JSON.stringify(postData))
  3213. }),
  3214. dataType: "json",
  3215. contentType: "application/json",
  3216. success: function (obj) {
  3217. var response = strToJson(s4.decryptData_CBC(obj.data));
  3218. sp.layerhide();
  3219. if (response.success) {
  3220. getViewInfo();
  3221. } else {
  3222. setTimeout(function () {
  3223. sp.dialog(res.message);
  3224. }, 1000)
  3225. }
  3226. },
  3227. error: function (response) {
  3228. console.log(response);
  3229. }
  3230. });
  3231. }
  3232. }
  3233. getUnitList();
  3234. /*2020-11-20添加赋值类型*/
  3235. function changeValueType() {
  3236. var valueType = $("#valueType").val();
  3237. if (valueType == 1) {
  3238. $("#valueSet").show();
  3239. $("#valueInput").hide();
  3240. } else {
  3241. $("#valueSet").hide();
  3242. $("#valueInput").show();
  3243. }
  3244. }
  3245. //切换节点类别,点击开发新表单
  3246. function changeNodeType() {
  3247. var index = $(".nodeTypeSelect").val();
  3248. if (index == 4) {
  3249. $("#itemFlowTitle").show();
  3250. $("#itemFlowBox").show();
  3251. $("#formTitle").hide();
  3252. $("#formBox").hide();
  3253. } else {
  3254. $("#itemFlowTitle").hide();
  3255. $("#itemFlowBox").hide();
  3256. $("#formTitle").show();
  3257. $("#formBox").show();
  3258. }
  3259. setNodeColor(index);
  3260. //最后一步需要同步节点数据信息,节点类别添加到通用节点数据中
  3261. }
  3262. //打开子流程设置层
  3263. function openItemFlowLayer() {
  3264. $("#itemUserUnit").val(unitList[0].CODE);
  3265. $(".itemFlowTypeBox>.typeItem").removeClass("active");
  3266. $(".itemFlowTypeBox>.typeItem").eq(0).addClass("active");
  3267. getFlowType();
  3268. sp.layer("#layer_itemFlow");
  3269. }
  3270. //获取流程分类
  3271. function getFlowType() {
  3272. var nowUnit = $("#itemUserUnit").val();
  3273. $(".itemFlowTypeBox").html("");
  3274. var baseType = "<div class=\"typeItem active\" data-type='' onclick=\"changeFlowType('',this)\"><i class=\"fa fa-list-ul\"></i> <span>全部流程</span></div>";
  3275. $(".itemFlowTypeBox").append(baseType);
  3276. var postData = {
  3277. pkid: nowUnit,
  3278. includechildren: true
  3279. };
  3280. $.ajax({
  3281. type: "post",
  3282. url: apiurljs.login + "g2work/flowkinds/queryData",
  3283. headers: {
  3284. Authorization: "Bearer " + get_AccessToken,
  3285. },
  3286. data: JSON.stringify({
  3287. data: s4.encryptData_CBC(JSON.stringify(postData))
  3288. }),
  3289. dataType: "json",
  3290. contentType: "application/json",
  3291. success: function (obj) {
  3292. var response = strToJson(s4.decryptData_CBC(obj.data));
  3293. typeList = response.data;
  3294. typeList.forEach(function (item) {
  3295. 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>";
  3296. $(".itemFlowTypeBox").append(itemType);
  3297. })
  3298. getFlowList();
  3299. },
  3300. error: function (response) {
  3301. console.log(response);
  3302. }
  3303. });
  3304. }
  3305. //获取流程列表
  3306. function getFlowList() {
  3307. //根据选中的机构和类型查询表单数据
  3308. var nowUnit = $("#itemUserUnit").val();
  3309. var nowType = $(".itemFlowTypeBox .active").attr("data-type");
  3310. var postData = {
  3311. unitid: nowUnit,
  3312. flowkinds: nowType
  3313. }
  3314. $("#itemFlowList tbody").html("");
  3315. $.ajax({
  3316. type: "post",
  3317. url: apiurljs.login + "g2work/flow/queryData",
  3318. headers: {
  3319. Authorization: "Bearer " + get_AccessToken,
  3320. },
  3321. data: JSON.stringify({
  3322. data: s4.encryptData_CBC(JSON.stringify(postData))
  3323. }),
  3324. dataType: "json",
  3325. contentType: "application/json",
  3326. success: function (obj) {
  3327. var response = strToJson(s4.decryptData_CBC(obj.data));
  3328. var nowflowid = $(".itemFlowBox tbody").find("tr").eq(0).attr("flow-id");
  3329. var nowflowname = $(".itemFlowBox tbody").find("tr>td").eq(0).html();
  3330. //还原当前的选中数值
  3331. if (response.data.length != 0) {
  3332. $(".formPartRight .sp-table-tip").hide();
  3333. response.data.forEach(function (item, index) {
  3334. if (item.FLOWID == nowflowid) {
  3335. var itemTr =
  3336. "<tr flow-id='" + item.FLOWID + "' flow-name='" + item.CNAME + "'>" +
  3337. "<td><input type='checkbox' checked onclick=\"selectItemFlow(this)\"></td>" +
  3338. "<td>" + (index + 1) + "</td>" +
  3339. "<td>" + item.CKEY + "</td>" +
  3340. "<td>" + item.CNAME + "</td>" +
  3341. "<td>" + item.TIMELIMIT + "</td>" +
  3342. "<td>" + item.EXPLAIN + "</td>" +
  3343. "</tr>";
  3344. } else {
  3345. var itemTr =
  3346. "<tr flow-id='" + item.FLOWID + "' flow-name='" + item.CNAME + "'>" +
  3347. "<td><input type='checkbox' onclick=\"selectItemFlow(this)\"></td>" +
  3348. "<td>" + (index + 1) + "</td>" +
  3349. "<td>" + item.CKEY + "</td>" +
  3350. "<td>" + item.CNAME + "</td>" +
  3351. "<td>" + item.TIMELIMIT + "</td>" +
  3352. "<td>" + item.EXPLAIN + "</td>" +
  3353. "</tr>";
  3354. }
  3355. $("#itemFlowList tbody").append(itemTr);
  3356. })
  3357. } else {
  3358. $(".formPartRight .sp-table-tip").show();
  3359. }
  3360. },
  3361. error: function (response) {
  3362. console.log(response);
  3363. }
  3364. });
  3365. }
  3366. //更改表单类型
  3367. function changeFlowType(code, obj) {
  3368. $(".itemFlowTypeBox>.typeItem").removeClass("active");
  3369. $(obj).addClass("active");
  3370. getFlowList();
  3371. }
  3372. //选择流程I(只能选择一个流程)
  3373. function selectItemFlow(obj) {
  3374. var itemFlag = $(obj).is(':checked');
  3375. if (!itemFlag) {
  3376. $(obj).prop('checked', false);
  3377. } else {
  3378. $("#itemFlowList").find("input[type='checkbox']").prop('checked', false);
  3379. $(obj).prop('checked', true);
  3380. }
  3381. }
  3382. //保存选择流程
  3383. function saveFlow() {
  3384. var resultArray = [];
  3385. $("#itemFlowList tbody input[type='checkbox']:checked").each(function (e) {
  3386. var formItem = {
  3387. flowid: $(this).parents("tr").attr("flow-id"),
  3388. flowName: $(this).parents("tr").attr("flow-name")
  3389. }
  3390. resultArray.push(formItem);
  3391. })
  3392. var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
  3393. var postData = {
  3394. copyrightid: copyrightid,
  3395. nodeid: nodeid,
  3396. cname: $(".nodeName").val(),
  3397. timelimit: $(".nodeTime").val(),
  3398. explain: $(".nodeRemark").val(),
  3399. type: "",
  3400. toflowid: "",
  3401. toflowcname: "",
  3402. markmerge: ""
  3403. };
  3404. var typeName = $(".nodeType").html();
  3405. nodeTypeList.forEach(function (item) {
  3406. if (item.name == typeName) {
  3407. postData.type = item.type
  3408. }
  3409. })
  3410. if (resultArray.length == 0) {
  3411. postData.toflowid = 0;
  3412. postData.toflowcname = "尚未配置子流程";
  3413. } else {
  3414. postData.toflowid = resultArray[0].flowid;
  3415. postData.toflowcname = resultArray[0].flowName;
  3416. }
  3417. ///判断是否合流
  3418. if ($("#chb_isMarkmerge").is(":checked")) {
  3419. postData.markmerge = "true";
  3420. } else {
  3421. postData.markmerge = "false";
  3422. }
  3423. $.ajax({
  3424. type: "post",
  3425. url: apiurljs.login + "g2work/flownode/updateNode",
  3426. headers: {
  3427. Authorization: "Bearer " + get_AccessToken,
  3428. },
  3429. data: JSON.stringify({
  3430. data: s4.encryptData_CBC(JSON.stringify(postData))
  3431. }),
  3432. dataType: "json",
  3433. contentType: "application/json",
  3434. success: function (obj) {
  3435. var response = strToJson(s4.decryptData_CBC(obj.data));
  3436. sp.layerhide();
  3437. if (response.success) {
  3438. $(".itemFlowBox tbody").html("");
  3439. if (postData.toflowid != "" && postData.toflowcname != "") {
  3440. var itemTD =
  3441. "<tr flow-id='" + postData.toflowid + "'>" +
  3442. "<td class='sp-text-left sp-pl-10'>" + postData.toflowcname + "</td>" +
  3443. "<td class='delFormbtn'><i class='fa fa-edit' onclick='openEditFlowLayer(this)'></i></td>" +
  3444. "</tr>";
  3445. $(".itemFlowBox tbody").append(itemTD);
  3446. } else {
  3447. var itemTD =
  3448. "<tr flow-id='0'>" +
  3449. "<td class='sp-text-left sp-pl-10'>尚未配置子流程</td>" +
  3450. "<td class='delFormbtn'><i class='fa fa-edit' onclick='openEditFlowLayer(this)'></i></td>" +
  3451. "</tr>";
  3452. $(".itemFlowBox tbody").append(itemTD);
  3453. }
  3454. } else {
  3455. setTimeout(function () {
  3456. sp.dialog(res.message);
  3457. }, 1000)
  3458. }
  3459. },
  3460. error: function (response) {
  3461. console.log(response);
  3462. }
  3463. });
  3464. }
  3465. //改变流程节点颜色函数(model参数表示当前需要变色的节点类型)
  3466. function setNodeColor(model) {
  3467. // {"type": 0, "name": "开始"},
  3468. // {"type": 1, "name": "结束"},
  3469. // {"type": 2, "name": "任务"},
  3470. // {"type": 3, "name": "网关"},
  3471. // {"type": 4, "name": "子流程"},
  3472. // {"type": 5, "name": "边界事件"}
  3473. var colorBaseConfig = [{model: 4, strokeColor: "rgb(255,86,60)", fillColor: "rgb(255,86,60,0.4)"}];
  3474. //颜色基本配置函数包括两种一种是填充颜色,一种是边框颜色,需要就在里面自己加,fillColor要用rgba颜色,要有透明度不然看不清
  3475. var itemStrokeColor = "";
  3476. var itemFillColor = "";
  3477. //没有携带传递参数则当前
  3478. colorBaseConfig.forEach(function (item) {
  3479. if (item.model == model) {
  3480. itemStrokeColor = item.strokeColor;
  3481. itemFillColor = item.fillColor;
  3482. }
  3483. })
  3484. var nodeid = $("#bpmnSetRightPart").attr("nodeid");
  3485. var elementRegistry = bpmnModeler.get('elementRegistry');
  3486. var modeling = bpmnModeler.get('modeling');
  3487. var elementToColor = elementRegistry.get(nodeid);
  3488. modeling.setColor([elementToColor], {
  3489. stroke: itemStrokeColor,
  3490. fill: itemFillColor
  3491. });
  3492. $("#btnSaveFlow").click();
  3493. }
  3494. function switchNodeTypeSelect() {
  3495. if ($('.nodeSelect').is(':hidden')) {
  3496. $('.nodeSelect').show();
  3497. } else {
  3498. $('.nodeSelect').hide();
  3499. }
  3500. }
  3501. //更新节点的类型
  3502. function updateNodeType() {
  3503. var nodeid = $("#bpmnSetRightPart").attr("nodeid") + "_" + copyrightid;
  3504. var postData = {
  3505. copyrightid: copyrightid,
  3506. nodeid: nodeid,
  3507. cname: $(".nodeName").val(),
  3508. timelimit: $(".nodeTime").val(),
  3509. explain: $(".nodeRemark").val(),
  3510. type: "",
  3511. toflowid: "",
  3512. toflowcname: "",
  3513. markmerge: ""
  3514. };
  3515. postData.type = $(".nodeTypeSelect").val();
  3516. if (postData.type == 4) {
  3517. var itemFlowNum = $(".itemFlowBox tbody").find("tr").length;
  3518. if (itemFlowNum == 1) {
  3519. postData.toflowid = $(".itemFlowBox tbody").find("tr").eq(0).attr("flow-id");
  3520. postData.toflowcname = $(".itemFlowBox tbody").find("tr>td").eq(0).html();
  3521. } else if (itemFlowNum == 0) {
  3522. postData.toflowid = 0;
  3523. postData.toflowcname = "尚未配置子流程";
  3524. }
  3525. } else {
  3526. var itemFlowNum = $(".itemFlowBox tbody").find("tr").length;
  3527. if (itemFlowNum == 1) {
  3528. postData.toflowid = 0;
  3529. postData.toflowcname = "尚未配置子流程";
  3530. } else if (itemFlowNum == 0) {
  3531. postData.toflowid = "";
  3532. postData.toflowcname = "";
  3533. }
  3534. }
  3535. ///判断是否合流
  3536. if ($("#chb_isMarkmerge").is(":checked")) {
  3537. postData.markmerge = "true";
  3538. } else {
  3539. postData.markmerge = "false";
  3540. }
  3541. $.ajax({
  3542. type: "post",
  3543. url: apiurljs.login + "g2work/flownode/updateNode",
  3544. headers: {
  3545. Authorization: "Bearer " + get_AccessToken,
  3546. },
  3547. data: JSON.stringify({
  3548. data: s4.encryptData_CBC(JSON.stringify(postData))
  3549. }),
  3550. dataType: "json",
  3551. contentType: "application/json",
  3552. success: function (obj) {
  3553. var response = strToJson(s4.decryptData_CBC(obj.data));
  3554. nodeTypeList.forEach(function (item) {
  3555. if (item.type == postData.type) {
  3556. $(".nodeType").html(item.name);
  3557. }
  3558. })
  3559. $(".nodeSelect").hide();
  3560. if (parseInt(postData.type) == 4) {
  3561. $("#itemFlowTitle").show();
  3562. $("#itemFlowBox").show();
  3563. $("#formTitle").hide();
  3564. $("#formBox").hide();
  3565. $(".itemFlowBox tbody").html("");
  3566. if (postData.toflowid != "" && postData.toflowcname != "") {
  3567. var itemTD =
  3568. "<tr flow-id='" + postData.toflowid + "'>" +
  3569. "<td class='sp-text-left sp-pl-10'>" + postData.toflowcname + "</td>" +
  3570. "<td class='delFormbtn'><i class='fa fa-edit' onclick='openEditFlowLayer(this)'></i></td>" +
  3571. "</tr>";
  3572. $(".itemFlowBox tbody").append(itemTD);
  3573. }
  3574. } else {
  3575. $("#itemFlowTitle").hide();
  3576. $("#itemFlowBox").hide();
  3577. $("#formTitle").show();
  3578. $("#formBox").show();
  3579. }
  3580. setNodeColor(postData.type);
  3581. },
  3582. error: function (response) {
  3583. console.log(response);
  3584. }
  3585. });
  3586. }
  3587. //打开编辑流程函数
  3588. function openEditFlowLayer(obj) {
  3589. var flowid = $(obj).parents("tr").attr("flow-id");
  3590. if (flowid == 0) {
  3591. sp.dialog("请先选择子流程");
  3592. } else {
  3593. getEditFlowType();
  3594. getEditCodeTableOption(flowid);
  3595. $("#layer_editFlow").attr("copyrightid", "");
  3596. sp.layer("#layer_editFlow");
  3597. }
  3598. }
  3599. //获取需要编辑的流程分类(编辑流程的流程分类选项)
  3600. function getEditFlowType() {
  3601. var nowUnit = $("#itemUserUnit").val();
  3602. $("#editFlowType").html("");
  3603. var postData = {
  3604. pkid: nowUnit,
  3605. includechildren: true
  3606. };
  3607. $.ajax({
  3608. type: "post",
  3609. url: apiurljs.login + "g2work/flowkinds/queryData",
  3610. headers: {
  3611. Authorization: "Bearer " + get_AccessToken,
  3612. },
  3613. data: JSON.stringify({
  3614. data: s4.encryptData_CBC(JSON.stringify(postData))
  3615. }),
  3616. dataType: "json",
  3617. contentType: "application/json",
  3618. success: function (obj) {
  3619. var response = strToJson(s4.decryptData_CBC(obj.data));
  3620. typeList = response.data;
  3621. typeList.forEach(function (item) {
  3622. var itemType = "<option value='" + item.PKID + "'>" + item.CNAME + "</option>";
  3623. $("#editFlowType").append(itemType);
  3624. })
  3625. },
  3626. error: function (response) {
  3627. console.log(response);
  3628. }
  3629. });
  3630. }
  3631. //获取需要编辑的流程关联表和关联列
  3632. var codeTableArray = [];
  3633. function getEditCodeTableOption(flowid) {
  3634. $("#editFlowTable").html("");
  3635. $("#editFlowColumn").html("");
  3636. $.ajax({
  3637. type: "post",
  3638. url: apiurljs.login + "g2work/billcol/queryDataInitval",
  3639. headers: {
  3640. Authorization: "Bearer " + get_AccessToken,
  3641. },
  3642. data: JSON.stringify({
  3643. data: s4.encryptData_CBC(JSON.stringify({}))
  3644. }),
  3645. dataType: "json",
  3646. contentType: "application/json",
  3647. success: function (obj) {
  3648. var response = strToJson(s4.decryptData_CBC(obj.data));
  3649. codeTableArray = response.data;
  3650. //这个地方需要处理两层选项的函数,先赋值表选项,然后根据表选项选择列选项
  3651. $("#editFlowTable").append("<option value=''>[空]</option>");
  3652. $("#editFlowColumn").append("<option value=''>[空]</option>");
  3653. codeTableArray.forEach(function (item) {
  3654. var itemTable = "<option value='" + item.BILLKEY + "'>" + item.CNAME + "</option>";
  3655. $("#editFlowTable").append(itemTable);
  3656. })
  3657. getEditFlowDetail(flowid);
  3658. },
  3659. error: function (response) {
  3660. console.log(response);
  3661. }
  3662. });
  3663. }
  3664. //获取需要编辑流程的详情
  3665. function getEditFlowDetail(flowid) {
  3666. var nowUnit = $("#itemUserUnit").val();
  3667. var postData = {
  3668. unitid: nowUnit,
  3669. flowkinds: ""
  3670. }
  3671. $.ajax({
  3672. type: "post",
  3673. url: apiurljs.login + "g2work/flow/queryData",
  3674. headers: {
  3675. Authorization: "Bearer " + get_AccessToken,
  3676. },
  3677. data: JSON.stringify({
  3678. data: s4.encryptData_CBC(JSON.stringify(postData))
  3679. }),
  3680. dataType: "json",
  3681. contentType: "application/json",
  3682. success: function (obj) {
  3683. var response = strToJson(s4.decryptData_CBC(obj.data));
  3684. var flowDetail = ""
  3685. response.data.forEach(function (item) {
  3686. if (item.FLOWID == flowid) {
  3687. flowDetail = item;
  3688. }
  3689. })
  3690. //根据详情对页面进行赋值
  3691. $("#layer_editFlow").attr("copyrightid", flowDetail.COPYRIGHTID);
  3692. $("#editFlowType").val(flowDetail.FLOWKINDS);
  3693. $("#editFlowCkey").val(flowDetail.CKEY);
  3694. $("#editFlowCname").val(flowDetail.CNAME);
  3695. $("#editFlowTime").val(flowDetail.TIMELIMIT);
  3696. $("#editFlowExplain").val(flowDetail.EXPLAIN);
  3697. $("#editFlowTable").val(flowDetail.CODETABLE);
  3698. codeTableArray.forEach(function (item) {
  3699. if (item.BILLKEY == flowDetail.CODETABLE) {
  3700. item.COLS.forEach(function (item2) {
  3701. var itemColumn = "<option value='" + item2.CODE + "'>" + item2.CNAME + "</option>";
  3702. $("#editFlowColumn").append(itemColumn);
  3703. })
  3704. }
  3705. })
  3706. $("#editFlowColumn").val(flowDetail.CODECOLUMN);
  3707. },
  3708. error: function (response) {
  3709. }
  3710. });
  3711. }
  3712. //改变关联表的同时联动改变关联列
  3713. function changeTableToColumn() {
  3714. var nowTableCode = $("#editFlowTable").val();
  3715. $("#editFlowColumn").html("");
  3716. $("#editFlowColumn").append("<option value=''>[空]</option>");
  3717. codeTableArray.forEach(function (item) {
  3718. if (item.BILLKEY == nowTableCode) {
  3719. item.COLS.forEach(function (item2) {
  3720. var itemColumn = "<option value='" + item2.CODE + "'>" + item2.CNAME + "</option>";
  3721. $("#editFlowColumn").append(itemColumn);
  3722. })
  3723. }
  3724. })
  3725. $("#editFlowColumn").val("");
  3726. }
  3727. //更新流程函数
  3728. function updateFlowData() {
  3729. var postData = {
  3730. flowkinds: $("#editFlowType").val(),
  3731. copyrightid: $("#layer_editFlow").attr("copyrightid"),
  3732. ckey: $("#editFlowCkey").val(),
  3733. cname: $("#editFlowCname").val(),
  3734. timelimit: $("#editFlowTime").val(),
  3735. explain: $("#editFlowExplain").val(),
  3736. codetable: $("#editFlowTable").val(),
  3737. codecolumn: $("#editFlowColumn").val()
  3738. }
  3739. $.ajax({
  3740. type: "post",
  3741. url: apiurljs.login + "g2work/flow/updateDataByCopyrightid",
  3742. headers: {
  3743. Authorization: "Bearer " + get_AccessToken,
  3744. },
  3745. data: JSON.stringify({
  3746. data: s4.encryptData_CBC(JSON.stringify(postData))
  3747. }),
  3748. dataType: "json",
  3749. contentType: "application/json",
  3750. success: function (obj) {
  3751. var response = strToJson(s4.decryptData_CBC(obj.data));
  3752. ///console.log(res);
  3753. if (response.success) {
  3754. sp.layerhide();
  3755. } else {
  3756. sp.layerhide();
  3757. }
  3758. },
  3759. error: function (response) {
  3760. }
  3761. });
  3762. }
  3763. //打开时限设置弹出层
  3764. function openTimeLayer() {
  3765. $("#timeRecordList").html("");
  3766. $("#timeList tbody").html("");
  3767. getFlowOption();
  3768. getTimeSet();
  3769. sp.layer('#layer_timeset');
  3770. }
  3771. //获取流向选择项
  3772. function getFlowOption() {
  3773. $.ajax({
  3774. type: "post",
  3775. url: apiurljs.login + "g2work/flowtimelimit/queryDirectionByCopyrightid",
  3776. headers: {
  3777. Authorization: "Bearer " + get_AccessToken,
  3778. },
  3779. data: JSON.stringify({
  3780. data: s4.encryptData_CBC(JSON.stringify({"copyrightid": copyrightid}))
  3781. }),
  3782. dataType: "json",
  3783. contentType: "application/json",
  3784. success: function (obj) {
  3785. var response = strToJson(s4.decryptData_CBC(obj.data));
  3786. $("#timeList tbody").html("");
  3787. if (response.data.length != 0) {
  3788. $(".timePartRight .sp-table-tip").hide();
  3789. response.data.forEach(function (item, index) {
  3790. var itemTr =
  3791. "<tr direction-id='" + item.DIRECTIONID + "'>" +
  3792. "<td><input direction-name='" + item.CNAME + "' direction-id='" + item.DIRECTIONID + "' class='selectDirection' onmousedown='selectTimeFlow()' type='checkbox'></td>" +
  3793. //"<td><button onmousedown='selectTimeFlow(\"" + item.DIRECTIONID + "\",\"" + item.CNAME + "\")' class='sp-btn-sm sp-btn-gray-outline sp-btn-radius'>选择</button></td>" +
  3794. "<td>" + item.STARTNODENAME + "</td>" +
  3795. "<td>" + item.CNAME + "</td>" +
  3796. "<td>" + item.ENDNODENAME + "</td>"
  3797. "</tr>";
  3798. $("#timeList tbody").append(itemTr);
  3799. })
  3800. } else {
  3801. $(".timePartRight .sp-table-tip").show();
  3802. }
  3803. },
  3804. error: function (response) {
  3805. console.log(response);
  3806. }
  3807. });
  3808. }
  3809. function getTimeSet() {
  3810. clearTimeListCheckbox();
  3811. $.ajax({
  3812. type: "post",
  3813. url: apiurljs.login + "g2work/flowtimelimit/queryData",
  3814. headers: {
  3815. Authorization: "Bearer " + get_AccessToken,
  3816. },
  3817. data: JSON.stringify({
  3818. data: s4.encryptData_CBC(JSON.stringify({"copyrightid": copyrightid}))
  3819. }),
  3820. dataType: "json",
  3821. contentType: "application/json",
  3822. success: function (obj) {
  3823. var response = strToJson(s4.decryptData_CBC(obj.data));
  3824. //console.log(response);
  3825. $("#timeRecordList").html("");
  3826. if (response.data.length != 0) {
  3827. response.data.forEach(function (item, index) {
  3828. var itemEdit =
  3829. '<div class="timeListItem timeListItemEdit">' +
  3830. '<div class="timeInputBox">' +
  3831. '<div class="timeInputBoxLeft">区间起始流向:</div>' +
  3832. '<div class="timeInputBoxRight"><input disabled class="sp-input flowSelect startFlow" onfocus="startNodeFocus(this)" type="text"></div>' +
  3833. '</div>' +
  3834. '<div class="timeInputBox">' +
  3835. '<div class="timeInputBoxLeft">区间结束流向:</div>' +
  3836. '<div class="timeInputBoxRight"><input disabled class="sp-input flowSelect endFlow" onfocus="endNodeFocus(this)" type="text"></div>' +
  3837. '</div>' +
  3838. '<div class="timeSetBox"><div class="timeSetBoxLeft">区间时限天数:</div>' +
  3839. '<div class="timeSetBoxRight">' +
  3840. '<div>' +
  3841. '<label><input disabled class="timeSetDay" value="0" name=timeSet' + (index + 1) + ' type="radio">天数</label>' +
  3842. '<input disabled class="sp-input timeDayInput" type="number" value="0">' +
  3843. '</div>' +
  3844. '<div>' +
  3845. '<label><input disabled class="timeSetLimit" value="1" name=timeSet' + (index + 1) + ' type="radio">时限日期</label>' +
  3846. '<div class="timeTableName"></div>' +
  3847. '</div>' +
  3848. '<div><select disabled class="sp-select tableColumn"></select></div>' +
  3849. '</div>' +
  3850. '</div>' +
  3851. '<div class="timeColorBox">' +
  3852. '<div class="timeColorBoxTop">红黄绿灯设置:</div>' +
  3853. '<div class="timeColorBoxBottom">' +
  3854. '<div class="timeColorItem"><i class="fa fa-circle sp-color-red"></i>超过时限</div>' +
  3855. '<div class="timeColorItem"><i class="fa fa-circle sp-color-yellow"></i>临近 <input disabled class="colorDay sp-input" value="0" type="number"> 天</div>' +
  3856. '<div class="timeColorItem"><i class="fa fa-circle sp-color-green"></i>其他时间</div>' +
  3857. '</div>' +
  3858. '</div>' +
  3859. '<div class="itmeBtnBox">' +
  3860. '<button onclick="deleteTimeSet(this)" data-flowtimelimitid="' + item.FLOWTIMELIMITID + '" class="sp-btn-sm sp-btn-red-outline sp-btn-radius sp-pull-right">删除</button>' +
  3861. '<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>' +
  3862. '<button onclick="editTimeSet(this)" class="sp-btn-sm sp-btn-green-outline sp-btn-radius sp-pull-right">编辑</button>' +
  3863. '</div>' +
  3864. '</div>';
  3865. $("#timeRecordList").append(itemEdit);
  3866. flowColumn.forEach(function (item2, index2) {
  3867. if (index2 == 0) {
  3868. var itemOption = "<option selected value='" + item2.CODE + "'>" + item2.CNAME + "</option>";
  3869. } else {
  3870. var itemOption = "<option value='" + item2.CODE + "'>" + item2.CNAME + "</option>";
  3871. }
  3872. $(".timeListItemEdit").eq(index).find(".tableColumn").append(itemOption);
  3873. })
  3874. $(".timeListItemEdit").eq(index).find(".timeTableName").html("[" + flowInfo.CODETABLECAPTION + "]");
  3875. $(".timeListItemEdit").eq(index).find(".startFlow").val(item.DSIDCAPTION);
  3876. $(".timeListItemEdit").eq(index).find(".startFlow").attr("direction-id", item.DSID);
  3877. $(".timeListItemEdit").eq(index).find(".endFlow").val(item.DTIDCAPTION);
  3878. $(".timeListItemEdit").eq(index).find(".endFlow").attr("direction-id", item.DTID);
  3879. var radioName = "timeSet" + (index + 1);
  3880. // $(".timeListItemEdit").eq(index).find("input[name = " + radioName + "]").val(item.TIMELIMITKIND);
  3881. // console.log($(".timeListItemEdit").eq(index).find("input[name = " + radioName + "]"))
  3882. $(".timeListItemEdit").eq(index).find("input[name = " + radioName + "][value='" + item.TIMELIMITKIND + "']").prop("checked", "checked")
  3883. $(".timeListItemEdit").eq(index).find(".timeDayInput").val(item.TIMELIMIT);
  3884. if (item.TIMELIMITKIND == "1") {
  3885. $(".timeListItemEdit").eq(index).find(".tableColumn").val(item.TIMELIMITCOLUMN);
  3886. }
  3887. $(".timeListItemEdit").eq(index).find(".colorDay").val(item.YELLOWC);
  3888. })
  3889. } else {
  3890. var tips = ' <div class="timetips"><i class="fa fa-exclamation-circle"></i> 暂无设置记录</div>'
  3891. $("#timeRecordList").append(tips);
  3892. }
  3893. },
  3894. error: function (response) {
  3895. console.log(response);
  3896. }
  3897. });
  3898. }
  3899. function selectTimeFlow(did, dname) {
  3900. var selectNum = $('.flowSelect:focus').length;
  3901. if (selectNum > 0) {
  3902. setTimeout(function () {
  3903. var num = $("#timeList tbody input[type='checkbox']:checked").length;
  3904. var stringName = "";
  3905. var stringID = "";
  3906. for (var i = 0; i < num; i++) {
  3907. var itemObj = $("#timeList tbody input[type='checkbox']:checked").eq(i);
  3908. stringName += itemObj.attr("direction-name") + ",";
  3909. stringID += itemObj.attr("direction-id") + ",";
  3910. }
  3911. stringName = stringName.substring(0, stringName.length - 1);
  3912. stringID = stringID.substring(0, stringID.length - 1);
  3913. $('.flowSelect:focus').eq(0).val(stringName);
  3914. $('.flowSelect:focus').eq(0).attr("direction-id", stringID);
  3915. }, 200)
  3916. }
  3917. }
  3918. function timeAdd() {
  3919. var numEdit = $(".nowEdit").length;
  3920. if (numEdit > 0) {
  3921. alert("请先保存未保存的数据");
  3922. return false;
  3923. }
  3924. var numAdd = $(".timeListItemAdd").length;
  3925. if (numAdd == 0) {
  3926. var itemAdd =
  3927. '<div class="timeListItem timeListItemAdd">' +
  3928. '<div class="timeInputBox">' +
  3929. '<div class="timeInputBoxLeft">区间起始流向:</div>' +
  3930. '<div class="timeInputBoxRight"><input class="sp-input flowSelect startFlow" onfocus="startNodeFocus(this)" type="text"></div>' +
  3931. '</div>' +
  3932. '<div class="timeInputBox">' +
  3933. '<div class="timeInputBoxLeft">区间结束流向:</div>' +
  3934. '<div class="timeInputBoxRight"><input class="sp-input flowSelect endFlow" onfocus="endNodeFocus(this)" type="text"></div>' +
  3935. '</div>' +
  3936. '<div class="timeSetBox"><div class="timeSetBoxLeft">区间时限天数:</div>' +
  3937. '<div class="timeSetBoxRight">' +
  3938. '<div>' +
  3939. '<label><input class="timeSetDay" value="0" name="timeSet0" type="radio" checked>天数</label>' +
  3940. '<input class="sp-input timeDayInput" type="number" value="0">' +
  3941. '</div>' +
  3942. '<div>' +
  3943. '<label><input class="timeSetLimit" value="1" name="timeSet0" type="radio">时限日期</label>' +
  3944. '<div class="timeTableName"></div>' +
  3945. '</div>' +
  3946. '<div><select class="sp-select tableColumn"></select></div>' +
  3947. '</div>' +
  3948. '</div>' +
  3949. '<div class="timeColorBox">' +
  3950. '<div class="timeColorBoxTop">红黄绿灯设置:</div>' +
  3951. '<div class="timeColorBoxBottom">' +
  3952. '<div class="timeColorItem"><i class="fa fa-circle sp-color-red"></i>超过时限</div>' +
  3953. '<div class="timeColorItem"><i class="fa fa-circle sp-color-yellow"></i>临近 <input class="colorDay sp-input" value="0" type="number"> 天</div>' +
  3954. '<div class="timeColorItem"><i class="fa fa-circle sp-color-green"></i>其他时间</div>' +
  3955. '</div>' +
  3956. '</div>' +
  3957. '<div class="itmeBtnBox">' +
  3958. '<button class="sp-btn-sm sp-btn-red-outline sp-btn-radius sp-pull-right" onclick="deleteAdd()">删除</button>' +
  3959. '<button onclick="saveTimeItem(this)" class="sp-btn-sm sp-btn-blue-outline sp-btn-radius sp-pull-right">保存</button>' +
  3960. '</div>' +
  3961. '</div>';
  3962. $("#timeRecordList").prepend(itemAdd);
  3963. flowColumn.forEach(function (item, index) {
  3964. if (index == 0) {
  3965. var itemOption = "<option selected value='" + item.CODE + "'>" + item.CNAME + "</option>";
  3966. } else {
  3967. var itemOption = "<option value='" + item.CODE + "'>" + item.CNAME + "</option>";
  3968. }
  3969. $(".timeListItemAdd").eq(0).find(".tableColumn").append(itemOption);
  3970. })
  3971. $(".timeListItemAdd").eq(0).find(".timeTableName").html("[" + flowInfo.CODETABLECAPTION + "]");
  3972. clearTimeListCheckbox();
  3973. } else {
  3974. alert("存在未保存数据,请保存后继续新增下一条");
  3975. }
  3976. var nowDataNum = $(".timeListItem").length;
  3977. if (nowDataNum > 0) {
  3978. $("#timeRecordList .timetips").remove();
  3979. } else {
  3980. var tips = ' <div class="timetips"><i class="fa fa-exclamation-circle"></i> 暂无设置记录</div>'
  3981. $("#timeRecordList").append(tips);
  3982. }
  3983. }
  3984. function saveTimeItem(obj) {
  3985. var item = $(obj).parents().find(".timeListItemAdd").eq(0);
  3986. var start = item.find(".startFlow").attr("direction-id");
  3987. var end = item.find(".endFlow").attr("direction-id");
  3988. var kind = item.find("input[type='radio']:checked").val();
  3989. var days = item.find(".timeDayInput").val();
  3990. var timelimitbillkey = flowInfo.CODETABLE;
  3991. var timelimitcolumn = item.find(".tableColumn").val();
  3992. var yellow = item.find(".colorDay").val();
  3993. if (days == "" || days == undefined || days == null) {
  3994. days = 0;
  3995. }
  3996. if (yellow == "" || yellow == undefined || yellow == null) {
  3997. yellow = 0;
  3998. }
  3999. if (timelimitbillkey == "" || timelimitbillkey == undefined || timelimitbillkey == null) {
  4000. timelimitbillkey = "";
  4001. }
  4002. if (timelimitcolumn == "" || timelimitcolumn == undefined || timelimitcolumn == null) {
  4003. timelimitcolumn = "";
  4004. }
  4005. if (start == "" || start == undefined || start == null || end == "" || end == undefined || end == null) {
  4006. alert("请先选择起始终止流向");
  4007. return false
  4008. }
  4009. $.ajax({
  4010. type: "post",
  4011. url: apiurljs.login + "g2work/flowtimelimit/queryData",
  4012. headers: {
  4013. Authorization: "Bearer " + get_AccessToken,
  4014. },
  4015. data: JSON.stringify({
  4016. data: s4.encryptData_CBC(JSON.stringify({"copyrightid": copyrightid}))
  4017. }),
  4018. dataType: "json",
  4019. contentType: "application/json",
  4020. success: function (obj) {
  4021. var response = strToJson(s4.decryptData_CBC(obj.data));
  4022. var canSave = true;
  4023. response.data.forEach(function (item) {
  4024. if (item.DSID == start && item.DTID == end) {
  4025. canSave = false;
  4026. }
  4027. })
  4028. if (canSave) {
  4029. var postData = {
  4030. "copyrightid": copyrightid,
  4031. "dsid": start,
  4032. "dtid": end,
  4033. "timelimit": (kind == "0") ? days : "0",
  4034. "redc": "",
  4035. "yellowc": yellow,
  4036. "greenc": "",
  4037. "remark": "",
  4038. "timelimitkind": kind,
  4039. "timelimitbillkey": (kind == "1") ? timelimitbillkey : "",
  4040. "timelimitcolumn": (kind == "1") ? timelimitcolumn : ""
  4041. }
  4042. $.ajax({
  4043. type: "post",
  4044. url: apiurljs.login + "g2work/flowtimelimit/insertData",
  4045. headers: {
  4046. Authorization: "Bearer " + get_AccessToken,
  4047. },
  4048. data: JSON.stringify({
  4049. data: s4.encryptData_CBC(JSON.stringify(postData))
  4050. }),
  4051. dataType: "json",
  4052. contentType: "application/json",
  4053. success: function (obj) {
  4054. var response = strToJson(s4.decryptData_CBC(obj.data));
  4055. if (response.success) {
  4056. getTimeSet();
  4057. }
  4058. },
  4059. error: function (response) {
  4060. console.log(response);
  4061. }
  4062. });
  4063. } else {
  4064. alert("当前起始结束流向设置已存在,请使用编辑功能");
  4065. }
  4066. },
  4067. error: function (response) {
  4068. console.log(response);
  4069. }
  4070. });
  4071. }
  4072. function deleteAdd() {
  4073. $(".timeListItemAdd").eq(0).remove();
  4074. var nowDataNum = $(".timeListItem").length;
  4075. if (nowDataNum > 0) {
  4076. $("#timeRecordList .timetips").remove();
  4077. } else {
  4078. var tips = ' <div class="timetips"><i class="fa fa-exclamation-circle"></i> 暂无设置记录</div>'
  4079. $("#timeRecordList").append(tips);
  4080. }
  4081. clearTimeListCheckbox();
  4082. }
  4083. function deleteTimeSet(obj) {
  4084. var numAdd = $(".timeListItemAdd").length;
  4085. if (numAdd == 0) {
  4086. var item = $(obj).parent().parent();
  4087. //var start = item.find(".startFlow").attr("direction-id");
  4088. //var end = item.find(".endFlow").attr("direction-id");
  4089. var get_flowtimelimitid = $(obj).attr("data-flowtimelimitid");
  4090. var postData = {
  4091. //"copyrightid": copyrightid,
  4092. //"dsid": start,
  4093. //"dtid": end,
  4094. "flowtimelimitid": get_flowtimelimitid
  4095. }
  4096. //console.log(postData);
  4097. $.ajax({
  4098. type: "post",
  4099. url: apiurljs.login + "g2work/flowtimelimit/deleteData",
  4100. headers: {
  4101. Authorization: "Bearer " + get_AccessToken,
  4102. },
  4103. data: JSON.stringify({
  4104. data: s4.encryptData_CBC(JSON.stringify(postData))
  4105. }),
  4106. dataType: "json",
  4107. contentType: "application/json",
  4108. success: function (obj) {
  4109. var response = strToJson(s4.decryptData_CBC(obj.data));
  4110. if (response.success) {
  4111. getTimeSet();
  4112. }
  4113. },
  4114. error: function (response) {
  4115. console.log(response);
  4116. }
  4117. });
  4118. } else {
  4119. alert("请先保存未保存的数据");
  4120. }
  4121. }
  4122. function editTimeSet(obj) {
  4123. var numEdit = $(".nowEdit").length;
  4124. if (numEdit > 0) {
  4125. alert("请先保存未保存的数据");
  4126. return false;
  4127. }
  4128. var numAdd = $(".timeListItemAdd").length;
  4129. if (numAdd == 0) {
  4130. $(".timeListItemEdit").find("input").attr("disabled", "disabled");
  4131. $(".timeListItemEdit").find("select").attr("disabled", "disabled");
  4132. $(".timeListItemEdit").removeClass("nowEdit");
  4133. $(".timeListItemEdit").find(".sp-btn-green-outline").show();
  4134. $(".timeListItemEdit").find(".sp-btn-blue-outline").hide();
  4135. $(obj).parent().parent().find(".timeSetDay").removeAttr("disabled");
  4136. $(obj).parent().parent().find(".timeDayInput").removeAttr("disabled");
  4137. $(obj).parent().parent().find(".timeSetLimit").removeAttr("disabled");
  4138. $(obj).parent().parent().find(".colorDay").removeAttr("disabled");
  4139. $(obj).parent().parent().find("select").removeAttr("disabled");
  4140. $(obj).parent().parent().find(".startFlow").removeAttr("disabled");
  4141. $(obj).parent().parent().find(".endFlow").removeAttr("disabled");
  4142. $(obj).parent().parent().find(".sp-btn-green-outline").hide();
  4143. $(obj).parent().parent().find(".sp-btn-blue-outline").show();
  4144. $(obj).parent().parent().addClass("nowEdit");
  4145. } else {
  4146. alert("请先保存未保存数据")
  4147. }
  4148. }
  4149. function editTimeItem(obj) {
  4150. var item = $(obj).parent().parent();
  4151. var start = item.find(".startFlow").attr("direction-id");
  4152. var end = item.find(".endFlow").attr("direction-id");
  4153. var kind = item.find("input[type='radio']:checked").val();
  4154. var days = item.find(".timeDayInput").val();
  4155. var timelimitbillkey = flowInfo.CODETABLE;
  4156. var timelimitcolumn = item.find(".tableColumn").val();
  4157. var yellow = item.find(".colorDay").val();
  4158. if (days == "" || days == undefined || days == null) {
  4159. days = 0;
  4160. }
  4161. if (yellow == "" || yellow == undefined || yellow == null) {
  4162. yellow = 0;
  4163. }
  4164. if (timelimitbillkey == "" || timelimitbillkey == undefined || timelimitbillkey == null) {
  4165. timelimitbillkey = "";
  4166. }
  4167. if (timelimitcolumn == "" || timelimitcolumn == undefined || timelimitcolumn == null) {
  4168. timelimitcolumn = "";
  4169. }
  4170. if (start == "" || start == undefined || start == null || end == "" || end == undefined || end == null) {
  4171. alert("请先选择起始终止流向");
  4172. return false
  4173. }
  4174. var get_flowtimelimitid = $(obj).attr("data-flowtimelimitid");
  4175. var postData = {
  4176. "flowtimelimitid": get_flowtimelimitid,
  4177. "copyrightid": copyrightid,
  4178. "dsid": start,
  4179. "dtid": end,
  4180. "timelimit": (kind == "0") ? days : "0",
  4181. "redc": "",
  4182. "yellowc": yellow,
  4183. "greenc": "",
  4184. "remark": "",
  4185. "timelimitkind": kind,
  4186. "timelimitbillkey": (kind == "1") ? timelimitbillkey : "",
  4187. "timelimitcolumn": (kind == "1") ? timelimitcolumn : ""
  4188. }
  4189. //console.log(postData);
  4190. $.ajax({
  4191. type: "post",
  4192. url: apiurljs.login + "g2work/flowtimelimit/updateData",
  4193. headers: {
  4194. Authorization: "Bearer " + get_AccessToken,
  4195. },
  4196. data: JSON.stringify({
  4197. data: s4.encryptData_CBC(JSON.stringify(postData))
  4198. }),
  4199. dataType: "json",
  4200. contentType: "application/json",
  4201. success: function (obj) {
  4202. var response = strToJson(s4.decryptData_CBC(obj.data));
  4203. if (response.success) {
  4204. getTimeSet();
  4205. }
  4206. },
  4207. error: function (response) {
  4208. console.log(response);
  4209. }
  4210. });
  4211. }
  4212. //打开视图设置弹出层
  4213. function openTableLayer() {
  4214. getBaseTableInfo();
  4215. $("#submitViewBtn").attr("disabled", "disabled");
  4216. $("#cancelViewBtn").removeAttr("disabled");
  4217. $("#cleanViewBtn").removeAttr("disabled");
  4218. sp.layer('#layer_tableset');
  4219. }
  4220. function getBaseTableInfo() {
  4221. $.ajax({
  4222. type: "post",
  4223. url: apiurljs.login + "g2work/formeditatgroup/queryFormeditByCopyrightid",
  4224. headers: {
  4225. Authorization: "Bearer " + get_AccessToken,
  4226. },
  4227. data: JSON.stringify({
  4228. data: s4.encryptData_CBC(JSON.stringify({"copyrightid": copyrightid}))
  4229. }),
  4230. dataType: "json",
  4231. contentType: "application/json",
  4232. success: function (obj) {
  4233. var response = strToJson(s4.decryptData_CBC(obj.data));
  4234. var viewTable = response.data;
  4235. $("#viewTableSelect").html("");
  4236. viewTable.forEach(function (item, index) {
  4237. if (index == 0) {
  4238. var itemOption = "<option selected value='" + item.FORMEDITID + "'>" + item.CNAME + "</option>";
  4239. } else {
  4240. var itemOption = "<option value='" + item.FORMEDITID + "'>" + item.CNAME + "</option>";
  4241. }
  4242. $("#viewTableSelect").append(itemOption);
  4243. })
  4244. getColFuncDirection('', '');
  4245. },
  4246. error: function (response) {
  4247. console.log(response);
  4248. }
  4249. });
  4250. }
  4251. function getColFuncDirection(atgroup, directionid) {
  4252. var formeditid = $("#viewTableSelect").val();
  4253. var postData = {
  4254. "copyrightid": copyrightid,
  4255. "formeditid": formeditid,
  4256. "atgroup": atgroup,
  4257. "directionid": directionid
  4258. }
  4259. $.ajax({
  4260. type: "post",
  4261. url: apiurljs.login + "g2work/formeditatgroup/queryDataFormEditColFuncDirection",
  4262. headers: {
  4263. Authorization: "Bearer " + get_AccessToken,
  4264. },
  4265. data: JSON.stringify({
  4266. data: s4.encryptData_CBC(JSON.stringify(postData))
  4267. }),
  4268. dataType: "json",
  4269. contentType: "application/json",
  4270. success: function (obj) {
  4271. $("#leftTopList tbody").html("");
  4272. $("#leftBottpmList tbody").html("");
  4273. $("#rightList tbody").html("");
  4274. var response = strToJson(s4.decryptData_CBC(obj.data));
  4275. response.data.Cols.forEach(function (item) {
  4276. if (item.ESHOW == "" || item.ESHOW == undefined || item.ESHOW == null) {
  4277. item.ESHOW = "false"
  4278. }
  4279. if (item.GSHOW == "" || item.GSHOW == undefined || item.GSHOW == null) {
  4280. item.GSHOW = "false"
  4281. }
  4282. if (item.EREADONLY == "" || item.EREADONLY == undefined || item.EREADONLY == null) {
  4283. item.EREADONLY = "false"
  4284. }
  4285. })
  4286. response.data.Func.forEach(function (item) {
  4287. if (item.ESHOW == "" || item.ESHOW == undefined || item.ESHOW == null) {
  4288. item.ESHOW = "false"
  4289. }
  4290. })
  4291. response.data.Direction.forEach(function (item) {
  4292. if (item.ESHOW == "" || item.ESHOW == undefined || item.ESHOW == null) {
  4293. item.ESHOW = "false"
  4294. }
  4295. if (item.MSHOW == "" || item.MSHOW == undefined || item.MSHOW == null) {
  4296. item.MSHOW = "false"
  4297. }
  4298. if (item.ATGROUP == "" || item.ATGROUP == undefined || item.ATGROUP == null) {
  4299. item.ATGROUP = ""
  4300. }
  4301. })
  4302. //处理列数据
  4303. if (response.data.Cols.length != 0) {
  4304. $(".viewBoxColumn .sp-table-tip").hide();
  4305. response.data.Cols.forEach(function (item, index) {
  4306. var itemTr =
  4307. "<tr col-id='" + item.COLID + "'>" +
  4308. "<td>" + (index + 1) + "</td>" +
  4309. "<td>" + item.CODE + "</td>" +
  4310. "<td>" + item.CNAME + "</td>";
  4311. if (item.EREADONLY == "true") {
  4312. itemTr = itemTr + "<td><input type='checkbox' class='itemEReadonly' onclick='changeColsEReadonly()' checked></td>";
  4313. } else {
  4314. itemTr = itemTr + "<td><input type='checkbox' class='itemEReadonly' onclick='changeColsEReadonly()'></td>";
  4315. }
  4316. if (item.ESHOW == "true") {
  4317. itemTr = itemTr + "<td><input type='checkbox' class='itemEShow' onclick='changeColsEShow()' checked></td>";
  4318. } else {
  4319. itemTr = itemTr + "<td><input type='checkbox' class='itemEShow' onclick='changeColsEShow()'></td>";
  4320. }
  4321. if (item.GSHOW == "true") {
  4322. itemTr = itemTr + "<td><input type='checkbox' class='itemGShow' onclick='changeColsGShow()' checked></td>";
  4323. } else {
  4324. itemTr = itemTr + "<td><input type='checkbox' class='itemGShow' onclick='changeColsGShow()'></td>";
  4325. }
  4326. itemTr = itemTr + "</tr>";
  4327. $("#leftTopList tbody").append(itemTr);
  4328. })
  4329. sumTotalCheck('#leftTopList', '#columnEReadonlyAll', 'itemEReadonly');
  4330. sumTotalCheck('#leftTopList', '#columnEShowAll', 'itemEShow');
  4331. sumTotalCheck('#leftTopList', '#columnGShowAll', 'itemGShow');
  4332. } else {
  4333. $(".viewBoxColumn .sp-table-tip").show();
  4334. }
  4335. if (response.data.Func.length != 0) {
  4336. $(".viewBoxFunc .sp-table-tip").hide();
  4337. response.data.Func.forEach(function (item, index) {
  4338. if (item.ESHOW == "true") {
  4339. var itemTr =
  4340. "<tr func-id='" + item.FUNCID + "'>" +
  4341. "<td>" + (index + 1) + "</td>" +
  4342. "<td>" + item.CODE + "</td>" +
  4343. "<td>" + item.CNAME + "</td>" +
  4344. "<td><input type='checkbox' class='itemEShow' onclick='changeFuncEShow()' checked></td>"
  4345. "</tr>";
  4346. } else if (item.ESHOW == "false") {
  4347. var itemTr =
  4348. "<tr func-id='" + item.FUNCID + "'>" +
  4349. "<td>" + (index + 1) + "</td>" +
  4350. "<td>" + item.CODE + "</td>" +
  4351. "<td>" + item.CNAME + "</td>" +
  4352. "<td><input type='checkbox' class='itemEShow' onclick='changeFuncEShow()'></td>"
  4353. "</tr>";
  4354. }
  4355. $("#leftBottpmList tbody").append(itemTr);
  4356. })
  4357. sumTotalCheck('#leftBottpmList', '#funcEShowAll', 'itemEShow');
  4358. } else {
  4359. $(".viewBoxFunc .sp-table-tip").show();
  4360. }
  4361. if (response.data.Direction.length != 0) {
  4362. $(".viewBoxDirect .sp-table-tip").hide();
  4363. response.data.Direction.forEach(function (item, index) {
  4364. if (directionid == item.DIRECTIONID) {
  4365. if (item.ESHOW == "true") {
  4366. if (item.MSHOW == "true") {
  4367. var itemTr =
  4368. "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "' class='activeDirect'>" +
  4369. "<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>" +
  4370. "<td class='cancelBtn'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
  4371. "<td>" + item.STARTNODENAME + "</td>" +
  4372. "<td class='sp-color-red'>" + item.CNAME + "</td>" +
  4373. "<td>" + item.ENDNODENAME + "</td>" +
  4374. "<td>" + item.ATGROUP + "</td>" +
  4375. "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()' checked></td>"
  4376. "</tr>";
  4377. } else {
  4378. var itemTr =
  4379. "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "' class='activeDirect'>" +
  4380. "<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>" +
  4381. "<td class='cancelBtn'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
  4382. "<td>" + item.STARTNODENAME + "</td>" +
  4383. "<td>" + item.CNAME + "</td>" +
  4384. "<td>" + item.ENDNODENAME + "</td>" +
  4385. "<td>" + item.ATGROUP + "</td>" +
  4386. "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()' checked></td>"
  4387. "</tr>";
  4388. }
  4389. } else if (item.ESHOW == "false") {
  4390. if (item.MSHOW == "true") {
  4391. var itemTr =
  4392. "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "' class='activeDirect'>" +
  4393. "<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>" +
  4394. "<td class='cancelBtn'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
  4395. "<td>" + item.STARTNODENAME + "</td>" +
  4396. "<td class='sp-color-red'>" + item.CNAME + "</td>" +
  4397. "<td>" + item.ENDNODENAME + "</td>" +
  4398. "<td>" + item.ATGROUP + "</td>" +
  4399. "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()'></td>"
  4400. "</tr>";
  4401. } else {
  4402. var itemTr =
  4403. "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "' class='activeDirect'>" +
  4404. "<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>" +
  4405. "<td class='cancelBtn'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
  4406. "<td>" + item.STARTNODENAME + "</td>" +
  4407. "<td>" + item.CNAME + "</td>" +
  4408. "<td>" + item.ENDNODENAME + "</td>" +
  4409. "<td>" + item.ATGROUP + "</td>" +
  4410. "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()'></td>"
  4411. "</tr>";
  4412. }
  4413. }
  4414. } else {
  4415. if (item.ESHOW == "true") {
  4416. if (item.MSHOW == "true") {
  4417. var itemTr =
  4418. "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "'>" +
  4419. "<td class='chooseBtn'><button onclick='chooseDirect(\"" + item.DIRECTIONID + "\",\"" + item.ATGROUP + "\")' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>选择</button></td>" +
  4420. "<td class='cancelBtn' style='display: none'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
  4421. "<td>" + item.STARTNODENAME + "</td>" +
  4422. "<td class='sp-color-red'>" + item.CNAME + "</td>" +
  4423. "<td>" + item.ENDNODENAME + "</td>" +
  4424. "<td>" + item.ATGROUP + "</td>" +
  4425. "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()' checked></td>"
  4426. "</tr>";
  4427. } else {
  4428. var itemTr =
  4429. "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "'>" +
  4430. "<td class='chooseBtn'><button onclick='chooseDirect(\"" + item.DIRECTIONID + "\",\"" + item.ATGROUP + "\")' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>选择</button></td>" +
  4431. "<td class='cancelBtn' style='display: none'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
  4432. "<td>" + item.STARTNODENAME + "</td>" +
  4433. "<td>" + item.CNAME + "</td>" +
  4434. "<td>" + item.ENDNODENAME + "</td>" +
  4435. "<td>" + item.ATGROUP + "</td>" +
  4436. "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()' checked></td>"
  4437. "</tr>";
  4438. }
  4439. } else if (item.ESHOW == "false") {
  4440. if (item.MSHOW == "true") {
  4441. var itemTr =
  4442. "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "'>" +
  4443. "<td class='chooseBtn'><button onclick='chooseDirect(\"" + item.DIRECTIONID + "\",\"" + item.ATGROUP + "\")' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>选择</button></td>" +
  4444. "<td class='cancelBtn' style='display: none'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
  4445. "<td>" + item.STARTNODENAME + "</td>" +
  4446. "<td class='sp-color-red'>" + item.CNAME + "</td>" +
  4447. "<td>" + item.ENDNODENAME + "</td>" +
  4448. "<td>" + item.ATGROUP + "</td>" +
  4449. "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()'></td>"
  4450. "</tr>";
  4451. } else {
  4452. var itemTr =
  4453. "<tr at-group='" + item.ATGROUP + "' direction-id='" + item.DIRECTIONID + "'>" +
  4454. "<td class='chooseBtn'><button onclick='chooseDirect(\"" + item.DIRECTIONID + "\",\"" + item.ATGROUP + "\")' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>选择</button></td>" +
  4455. "<td class='cancelBtn' style='display: none'><button onclick='cancelChooseDirect(this)' class='sp-btn-radius sp-btn-sm sp-btn-gray-outline'>取消</button></td>" +
  4456. "<td>" + item.STARTNODENAME + "</td>" +
  4457. "<td>" + item.CNAME + "</td>" +
  4458. "<td>" + item.ENDNODENAME + "</td>" +
  4459. "<td>" + item.ATGROUP + "</td>" +
  4460. "<td><input type='checkbox' class='itemEShow' onclick='changeDirectEShow()'></td>"
  4461. "</tr>";
  4462. }
  4463. }
  4464. }
  4465. $("#rightList tbody").append(itemTr);
  4466. })
  4467. sumTotalCheck('#rightList', '#directEShowAll', 'itemEShow');
  4468. } else {
  4469. $(".viewBoxDirect .sp-table-tip").show();
  4470. }
  4471. },
  4472. error: function (response) {
  4473. console.log(response);
  4474. }
  4475. });
  4476. }
  4477. //检测tbody的checkbox和thead的checkbox的联动关系函数
  4478. function sumTotalCheck(id1, id2, class1) {
  4479. var selectNum = $(id1 + " tbody input[type='checkbox'][class='" + class1 + "']:checked").length;
  4480. var totalNum = $(id1 + " tbody input[type='checkbox'][class='" + class1 + "']").length;
  4481. if (selectNum == totalNum && totalNum != 0) {
  4482. $(id2).prop('checked', true);
  4483. } else {
  4484. $(id2).prop('checked', false);
  4485. }
  4486. }
  4487. function selectViewTableAll(id1, id2, class1) {
  4488. var selectAllFlog = $(id2).is(":checked");
  4489. $(id1 + " tbody input[type='checkbox'][class='" + class1 + "']").prop("checked", selectAllFlog);
  4490. }
  4491. function changeColsEReadonly() {
  4492. sumTotalCheck('#leftTopList', '#columnEReadonlyAll', 'itemEReadonly');
  4493. }
  4494. function changeColsEShow() {
  4495. sumTotalCheck('#leftTopList', '#columnEShowAll', 'itemEShow');
  4496. }
  4497. function changeColsGShow() {
  4498. sumTotalCheck('#leftTopList', '#columnGShowAll', 'itemGShow');
  4499. }
  4500. function changeFuncEShow() {
  4501. sumTotalCheck('#leftBottpmList', '#funcEShowAll', 'itemEShow');
  4502. }
  4503. function changeDirectEShow() {
  4504. sumTotalCheck('#rightList', '#directEShowAll', 'itemEShow');
  4505. }
  4506. // function chooseDirect(obj) {
  4507. // $("#rightList tbody tr").removeClass("activeDirect");
  4508. // $("#rightList tbody .chooseBtn").show();
  4509. // $("#rightList tbody .cancelBtn").hide();
  4510. // $(obj).parent().hide();
  4511. // $(obj).parent().parent().find(".cancelBtn").show();
  4512. // $(obj).parent().parent().addClass("activeDirect")
  4513. // }
  4514. //
  4515. // function cancelChooseDirect(obj) {
  4516. // $("#rightList tbody tr").removeClass("activeDirect");
  4517. // $(obj).parent().hide();
  4518. // $(obj).parent().parent().find(".chooseBtn").show();
  4519. // }
  4520. function chooseDirect(directionid, atgroup) {
  4521. $("#submitViewBtn").removeAttr("disabled");
  4522. $("#cleanViewBtn").attr("disabled", "disabled");
  4523. $("#cancelViewBtn").attr("disabled", "disabled");
  4524. getColFuncDirection(atgroup, directionid);
  4525. setTimeout(function () {
  4526. if (atgroup == "") {
  4527. var num = $("#rightList tbody tr").length;
  4528. for (var i = 0; i < num; i++) {
  4529. if ($("#rightList tbody tr").eq(i).attr("direction-id") == directionid) {
  4530. $("#rightList tbody tr").eq(i).find("input").prop("checked", true);
  4531. }
  4532. }
  4533. }
  4534. },100)
  4535. }
  4536. function cancelChooseDirect() {
  4537. $("#submitViewBtn").attr("disabled", "disabled");
  4538. $("#cancelViewBtn").removeAttr("disabled");
  4539. $("#cleanViewBtn").removeAttr("disabled");
  4540. getColFuncDirection('', '')
  4541. }
  4542. function changeFormSelect() {
  4543. $("#submitViewBtn").attr("disabled", "disabled");
  4544. $("#cancelViewBtn").removeAttr("disabled");
  4545. $("#cleanViewBtn").removeAttr("disabled");
  4546. getColFuncDirection('', '')
  4547. }
  4548. function updateTableSet() {
  4549. var activeDirectNum = $("#rightList .activeDirect").length;
  4550. if (activeDirectNum == 0) {
  4551. alert("流向选择不能为空");
  4552. return false;
  4553. }
  4554. var formeditid = $("#viewTableSelect").val();
  4555. var posmark = $("#posmark").is(":checked");
  4556. var posvalue = $("#posvalue").val();
  4557. var postData = {
  4558. "copyrightid": copyrightid,
  4559. "formeditid": formeditid,
  4560. "directionid": "",
  4561. "atgroup": "",
  4562. "posmark": "0",
  4563. "posvalue": posvalue,
  4564. "cols": "",
  4565. "func": "",
  4566. "direction": ""
  4567. }
  4568. if (activeDirectNum == 1) {
  4569. postData.directionid = $("#rightList .activeDirect").eq(0).attr("direction-id");
  4570. postData.atgroup = $("#rightList .activeDirect").eq(0).attr("at-group");
  4571. }
  4572. if (posmark) {
  4573. postData.posmark = "1";
  4574. }
  4575. var cols = [];
  4576. var func = [];
  4577. var direction = [];
  4578. var directionNum = $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").length;
  4579. for (var i = 0; i < directionNum; i++) {
  4580. direction.push({
  4581. "DIRECTIONID": $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").eq(i).parent().parent().attr("direction-id")
  4582. })
  4583. }
  4584. postData.direction = JSON.stringify(direction);
  4585. var funcNum = $("#leftBottpmList tbody input[type='checkbox'][class='itemEShow']:checked").length;
  4586. for (var i = 0; i < funcNum; i++) {
  4587. func.push({
  4588. "FUNCID": $("#leftBottpmList tbody input[type='checkbox'][class='itemEShow']:checked").eq(i).parent().parent().attr("func-id")
  4589. })
  4590. }
  4591. postData.func = JSON.stringify(func);
  4592. var colNum = $("#leftTopList tbody tr").length;
  4593. for (var i = 0; i < colNum; i++) {
  4594. var item = $("#leftTopList tbody tr").eq(i);
  4595. var itemEReadonly = $("#leftTopList tbody tr").eq(i).find('input[type=\'checkbox\'][class=\'itemEReadonly\']').is(":checked");
  4596. var itemEShow = $("#leftTopList tbody tr").eq(i).find('input[type=\'checkbox\'][class=\'itemEShow\']').is(":checked");
  4597. var itemGShow = $("#leftTopList tbody tr").eq(i).find('input[type=\'checkbox\'][class=\'itemGShow\']').is(":checked");
  4598. if (!itemEReadonly && !itemEShow && !itemGShow) {
  4599. } else {
  4600. cols.push({
  4601. "COLID": item.attr("col-id"),
  4602. "ESHOW": itemEShow,
  4603. "GSHOW": itemGShow,
  4604. "EREADONLY": itemEReadonly,
  4605. })
  4606. }
  4607. }
  4608. postData.cols = JSON.stringify(cols);
  4609. $.ajax({
  4610. type: "post",
  4611. url: apiurljs.login + "g2work/formeditatgroup/saveDataFormEditColFuncDirection",
  4612. headers: {
  4613. Authorization: "Bearer " + get_AccessToken,
  4614. },
  4615. data: JSON.stringify({
  4616. data: s4.encryptData_CBC(JSON.stringify(postData))
  4617. }),
  4618. dataType: "json",
  4619. contentType: "application/json",
  4620. success: function (obj) {
  4621. var response = strToJson(s4.decryptData_CBC(obj.data));
  4622. if (response.success) {
  4623. cancelChooseDirect();
  4624. //alert("更新成功");
  4625. } else {
  4626. alert("更新失败");
  4627. }
  4628. },
  4629. error: function (response) {
  4630. console.log(response);
  4631. }
  4632. });
  4633. }
  4634. function cleanTableSet() {
  4635. var directionNum = $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").length;
  4636. if (directionNum == 0) {
  4637. alert("请先勾选流向");
  4638. return false;
  4639. }else{
  4640. if(confirm("确定要进行清空设置吗?"))
  4641. {
  4642. var formeditid = $("#viewTableSelect").val();
  4643. var posmark = $("#posmark").is(":checked");
  4644. var posvalue = $("#posvalue").val();
  4645. var postData = {
  4646. "copyrightid": copyrightid,
  4647. "formeditid": formeditid,
  4648. "directionid": "",
  4649. "direction": ""
  4650. }
  4651. var direction = [];
  4652. var directionNum = $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").length;
  4653. for (var i = 0; i < directionNum; i++) {
  4654. direction.push({
  4655. "DIRECTIONID": $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").eq(i).parent().parent().attr("direction-id")
  4656. })
  4657. }
  4658. postData.direction = JSON.stringify(direction);
  4659. $.ajax({
  4660. type: "post",
  4661. url: apiurljs.login + "g2work/formeditatgroup/clearDataFormEditColFuncDirection",
  4662. headers: {
  4663. Authorization: "Bearer " + get_AccessToken,
  4664. },
  4665. data: JSON.stringify({
  4666. data: s4.encryptData_CBC(JSON.stringify(postData))
  4667. }),
  4668. dataType: "json",
  4669. contentType: "application/json",
  4670. success: function (obj) {
  4671. var response = strToJson(s4.decryptData_CBC(obj.data));
  4672. if (response.success) {
  4673. cancelChooseDirect();
  4674. //alert("更新成功");
  4675. } else {
  4676. alert("清空失败");
  4677. }
  4678. },
  4679. error: function (response) {
  4680. console.log(response);
  4681. }
  4682. });
  4683. }
  4684. }
  4685. }
  4686. function cancelTableSet() {
  4687. var directionNum = $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").length;
  4688. if (directionNum == 0) {
  4689. alert("请先勾选流向");
  4690. return false;
  4691. }else{
  4692. if(confirm("确定要进行解绑设置吗?"))
  4693. {
  4694. var formeditid = $("#viewTableSelect").val();
  4695. var posmark = $("#posmark").is(":checked");
  4696. var posvalue = $("#posvalue").val();
  4697. var postData = {
  4698. "copyrightid": copyrightid,
  4699. "formeditid": formeditid,
  4700. "directionid": "",
  4701. "direction": ""
  4702. }
  4703. var direction = [];
  4704. var directionNum = $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").length;
  4705. for (var i = 0; i < directionNum; i++) {
  4706. direction.push({
  4707. "DIRECTIONID": $("#rightList tbody input[type='checkbox'][class='itemEShow']:checked").eq(i).parent().parent().attr("direction-id")
  4708. })
  4709. }
  4710. postData.direction = JSON.stringify(direction);
  4711. $.ajax({
  4712. type: "post",
  4713. url: apiurljs.login + "g2work/formeditatgroup/deleteDataFormEditDirection",
  4714. headers: {
  4715. Authorization: "Bearer " + get_AccessToken,
  4716. },
  4717. data: JSON.stringify({
  4718. data: s4.encryptData_CBC(JSON.stringify(postData))
  4719. }),
  4720. dataType: "json",
  4721. contentType: "application/json",
  4722. success: function (obj) {
  4723. var response = strToJson(s4.decryptData_CBC(obj.data));
  4724. if (response.success) {
  4725. cancelChooseDirect();
  4726. //alert("更新成功");
  4727. } else {
  4728. alert("清空失败");
  4729. }
  4730. },
  4731. error: function (response) {
  4732. console.log(response);
  4733. }
  4734. });
  4735. }
  4736. }
  4737. }
  4738. function clearTimeListCheckbox() {
  4739. $("#timeList tbody input[type='checkbox']").prop("checked", false);
  4740. }
  4741. document.addEventListener("mousedown", function (e) {
  4742. if (e.target.className == "selectDirection") {
  4743. e.preventDefault();
  4744. }
  4745. })
  4746. function startNodeFocus(obj) {
  4747. var nowValue = $(obj).attr("direction-id");
  4748. clearTimeListCheckbox()
  4749. if (nowValue == "" || nowValue == undefined || nowValue == null) {
  4750. } else {
  4751. var nowDirectionArray = nowValue.split(",");
  4752. var totalDirectionNum = $("#timeList tbody input[type='checkbox']").length;
  4753. nowDirectionArray.forEach(function (item) {
  4754. for (var i = 0; i < totalDirectionNum; i++) {
  4755. var itemObj = $("#timeList tbody input[type='checkbox']").eq(i);
  4756. if (itemObj.attr("direction-id") == item) {
  4757. $("#timeList tbody input[type='checkbox']").eq(i).prop("checked", true);
  4758. }
  4759. }
  4760. })
  4761. }
  4762. }
  4763. function endNodeFocus(obj) {
  4764. var nowValue = $(obj).attr("direction-id");
  4765. clearTimeListCheckbox();
  4766. if (nowValue == "" || nowValue == undefined || nowValue == null) {
  4767. } else {
  4768. var nowDirectionArray = nowValue.split(",");
  4769. var totalDirectionNum = $("#timeList tbody input[type='checkbox']").length;
  4770. nowDirectionArray.forEach(function (item) {
  4771. for (var i = 0; i < totalDirectionNum; i++) {
  4772. var itemObj = $("#timeList tbody input[type='checkbox']").eq(i);
  4773. if (itemObj.attr("direction-id") == item) {
  4774. $("#timeList tbody input[type='checkbox']").eq(i).prop("checked", true);
  4775. }
  4776. }
  4777. })
  4778. }
  4779. }