daily.vue 284 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721
  1. <template>
  2. <section >
  3. <!--列表-->
  4. <div>
  5. <el-card class="box-card daily" shadow="never">
  6. <div style="position: relative;margin-top: -20px;margin-bottom: 20px">
  7. <div class="jjk" style="display:inline-block;position:absolute;top:15px;background:#fff;left:0px;z-index: 10;margin-top: -10px;padding-top: 10px;height: 42px;">
  8. <el-date-picker size="small" v-model="date" :editable="false" format="yyyy-MM" value-format="yyyy-MM"
  9. style="width:190px;"
  10. @change="changeMonthOut" :clearable="false" type="month" placeholder="选择月份" :picker-options="getPickerOptions"></el-date-picker>
  11. <el-button style="margin-left:10px;" icon="iconfont firerock-icongongshitongji" size="mini" @click="showWorkTime"></el-button>
  12. </div>
  13. <div slot="header" class="clearfix" id="clearfix" style="padding-left: 255px;">
  14. <span v-for="(item,index) in allDate" :id="'day'+index" class="date_item"
  15. @click="choseDate(index, item)" :key="index" :style="'padding:0 6px;display: inline-block;width: 46px;text-align: center;' + (canClick(index,item) == false && user.timeType.fillAhead == 0 ? 'color:#c0c0c0;cursor:not-allowed;' : '') ">
  16. <div :style="'display:inline-block;text-align: center;'+(item.state == null?'':'')" >
  17. <div style="text-align:center;"><span :class="statusStyle[item.state]">{{item.showDate}}</span>
  18. <br>
  19. <span style="font-size:10px;text-align:center;color:#999;">{{item.weekDay}}</span>
  20. <span class="chooseDate" v-if="index == choseDay"></span>
  21. </div>
  22. </div>
  23. </span>
  24. </div>
  25. </div>
  26. <div style="display:flex;">
  27. <div class="grand flex">
  28. <div class="left-laowang" style="flex: 0 0 210px;overflow: hidden;">
  29. <div v-if="permissions.reportsCompany || user.manageDeptId != 0 || permissions.reportsDept" :style="'overflow-x:hidden;overflow-y:auto;height:' + tableHeight + 'px;'">
  30. <div style="width: 100%;box-sizing: border-box;padding-right: 10px;">
  31. <el-select v-model="selectState" size="small" @change="stateChange" style="100%">
  32. <el-option value="-1" label="全部状态" >全部状态</el-option>
  33. <el-option value="-2" label="未填报">未填报</el-option>
  34. <el-option value="1" label="已通过">已通过</el-option>
  35. <el-option value="0" label="待审核">待审核</el-option>
  36. <el-option value="2" label="不通过">不通过</el-option>
  37. <el-option value="3" label="待提交">待提交</el-option>
  38. </el-select></div>
  39. <div>
  40. <el-tree :data="data" @node-click="handleNodeClick" node-key="id" :default-expanded-keys="expandDate">
  41. <span class="custom-tree-node" style="position: relative;box-sizing: border-box;width: 10%;" slot-scope="{ node, data}">
  42. <!-- <span>{{ node.label }}</span> -->
  43. <span style="padding-right: 50px;box-sizing: border-box;overflow:hidden;text-overflow:ellipsis;line-height: 36px; display: inline-block;">
  44. {{ node.label }}<span v-if="data.membCount != null && data.isUser == null">({{data.membCount}})</span>
  45. </span>
  46. <div style="position: absolute;right: 6px;">
  47. <span v-if="data.isUser == 1 && data.state == null && !data.leaveDays && !data.leaveTimes" style="color:red;font-size:13px">
  48. 未填报
  49. </span>
  50. <span v-if="data.isUser == 1 && data.state == null && (data.leaveDays || data.leaveTimes)" :style="(data.leaveDays < 1 || data.leaveTimes < user.timeType.allday) ? 'color:red;font-size:13px' : 'color:#32cd32;font-size:13px'">
  51. {{data.leaveDays ? (data.leaveDays >= 1 ? '当日请假' : '未填报(请假' + data.leaveDays + '天)') : (data.leaveTimes >= user.timeType.allday ? '当日请假' : '未填报(请假' + data.leaveTimes + 'h)')}}
  52. </span>
  53. <span v-if="data.isUser == 1 && data.state == 0" style="color:orange;font-size:13px">
  54. 待审核({{data.workingTime.toFixed(1) + 'h'}})
  55. </span>
  56. <span v-if="data.isUser == 1 && data.state == 1" style="color:#32cd32;font-size:13px">
  57. 已通过({{data.workingTime.toFixed(1) + 'h'}})
  58. </span>
  59. <span v-if="data.isUser == 1 && data.state == 2" style="color:red;font-size:13px">
  60. 未通过({{data.workingTime.toFixed(1) + 'h'}})
  61. </span>
  62. <span v-if="data.isUser == 1 && data.state == 3" style="color:#409eff;font-size:13px">
  63. 待提交({{data.workingTime.toFixed(1) + 'h'}})
  64. </span>
  65. </div>
  66. </span>
  67. </el-tree>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="line line-second" style="display:flex;justify-content: center;align-items: center;position: relative;left: -9px;">
  72. <div style="line-height: 5px;text-align: center;color: rgb(151 151 151);">
  73. -
  74. -
  75. -
  76. </div>
  77. </div>
  78. <div style="width: 200px; flex: 1;padding: 0 10px;" class="box-second-father">
  79. <!-- <div :style="'height:'+tableHeight+'px;width:1px;background:#eee;margin-right:10px;margin-left:10px;'" ></div> -->
  80. <div class="allDaily" style="float:left;flex-grow:1">
  81. <!--系统管理员和部门负责人 -->
  82. <div class="report_title" style="display:flex;justify-content: space-between;">
  83. <span>
  84. <span>工作日报 ({{curDate}})</span>
  85. <span v-if="permissions.reportsCompany||user.manageDeptId != 0 || permissions.reportsDept">| {{depData != null ?depData.label:""}}
  86. <span v-if="targetUid == null">
  87. - 已提交
  88. <el-link :underline="false" @click="showMembList(1)"><span style="margin-left:5px;margin-right:5px;color:green;">{{reportList.filter(item => item.state != 3).length}}</span></el-link>人,
  89. 待提交
  90. <el-link :underline="false" @click="showMembList(2)"><span style="margin-left:5px;margin-right:5px;color:green;">{{reportList.filter(item => item.state == 3).length}}</span></el-link>人,
  91. 未填写<el-link :underline="false" @click="showMembList(0)"><span style="margin-left:5px;margin-right:5px;color:red;">{{(depData == null?data[0].membCount:(depData.isUser == 1?1:depData.membCount))-reportList.length | numbers}}</span></el-link>人
  92. </span>
  93. </span>
  94. </span>
  95. <span style="float:right;">
  96. <el-link type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReport(-1,0)">填写日报</el-link>
  97. <el-link v-if="reportTimeType.type != 0" type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReportss()">按周填报</el-link>
  98. <el-link type="primary" v-if="permissions.reportsFillOut" style="margin-right:10px;" :underline="false" @click="isSubstitude=true; fillInReport(-1,2)">代填日报</el-link>
  99. <el-link type="primary" v-if="permissions.reportBatch" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReport(-1,1)">批量填报</el-link>
  100. <el-link type="primary" v-if="permissions.importReport || user.manageDeptId != 0" style="margin-right:10px;" :underline="false" @click="imports()">工时导入</el-link>
  101. <el-link type="primary" style="margin-right:10px;" :underline="false" @click="showExportDialog">导出日报</el-link>
  102. <!--部门负责人给个导出工时的功能 -->
  103. <el-link type="primary" v-if="user.manageDeptId != 0" style="margin-right:10px;" :underline="false" @click="showExportTimeDialog">导出工时统计</el-link>
  104. </span>
  105. </div>
  106. <div :style="'height:'+(tableHeight-50)+'px;overflow:scroll;padding-top:10px;'">
  107. <div class="one_daily" v-for="(item1,index1) in reportList" :key="index1">
  108. <i class="fa fa-circle"></i>{{item1.name}}
  109. <span style="margin-left:30px;">
  110. <span style="margin-right:20px;">
  111. <!-- <i v-if="parseFloat(item1.reportTime)>parseFloat(item1.calculateTime)+0.5" style="color:red;margin-right:8px;" class="fa fa-exclamation-triangle"></i> -->
  112. 工作总时长:
  113. <!-- <span :style="parseFloat(item1.reportTime)>parseFloat(item1.calculateTime)+0.5?'color:red':''">{{item1.reportTime}}h</span> -->
  114. <span >{{item1.reportTime | amounts}}</span>h
  115. </span>
  116. <span class="approvalProcessBox" v-if="user.timeType.showFillauditTime == 1">
  117. <i class="iconfont firerock-iconliucheng1"></i>
  118. <span class="approvalProcessClick" @click="getApprovalProcess(item1)">审批流程</span>
  119. </span>
  120. </span>
  121. <div class="checkbtn" style="padding-right:20px;">
  122. <el-button v-if="item1.state >= 2 && user.id == item1.id" type="primary" size="small" @click="isSubstitude=false; fillInReport(index1,0)">编辑日报</el-button>
  123. <el-button v-if="permissions.reportsDeleteAll && item1.state != 1" size="small" @click="guanli(item1)" style="float: right;">删除</el-button>
  124. </div>
  125. <div class="one_daily_body">
  126. <el-timeline>
  127. <el-timeline-item v-for="(item2,index2) in item1.data" :key="index2">
  128. <el-card shadow="never">
  129. <p>项目:<b>{{item2.project}}</b><span v-if="item2.subProjectName != null"> / {{item2.subProjectName}}</span>
  130. <span v-if="user.company.packageEngineering == 0">
  131. <span style="margin-left:15px;color:#DAA520;" v-if="item2.state == 0">[
  132. <span v-if="item2.isDeptAudit==0">
  133. <span v-if="item2.projectAuditState==0">
  134. 待项目审核人<span v-if="item2.projectAuditorName != null">({{item2.projectAuditorName}})</span>审核
  135. </span>
  136. <span style="color:#32CD32;" v-else-if="item2.projectAuditState==1">
  137. 项目审核人<span v-if="item2.projectAuditorName != null">({{item2.projectAuditorName}})</span>审核通过
  138. </span>
  139. </span>
  140. <span v-else-if="item2.isDeptAudit==1">
  141. {{('待'+item2.auditDeptName+'审核')}}
  142. </span>
  143. ]</span>
  144. <span style="margin-left:15px;color:#DAA520;" v-else-if="item2.state == -1">[ 导入待审核 ]</span>
  145. <span style="margin-left:15px;color:#32CD32;" v-else-if="item2.state == 1">[ 已通过 ]</span>
  146. <span style="margin-left:15px;color:#FF0000;" v-else-if="item2.state == 2">[ 已驳回 ] 原因:{{item2.rejectReason}}</span>
  147. <span style="margin-left:15px;color:#FF0000;" v-else-if="item2.state == 3">[ 待提交 ]</span>
  148. </span>
  149. <!-- <el-button v-if="(user.role == 1 || user.role == 2) && item2.state != 1 && user.manageDeptId != 0" size="mini" @click="guanli(item2, item1)" style="float: right;">删除</el-button> -->
  150. <span v-if="user.company.packageEngineering == 1">
  151. <span style="margin-left:15px;color:#DAA520;" v-if="item2.state == -1">[ 导入待审核 ]</span>
  152. <span style="margin-left:15px;color:#DAA520;" v-if="item2.state == 0 && item2.departmentAuditState == -1">[ 待专业审核 ]</span>
  153. <span style="margin-left:15px;color:#DAA520;" v-if="item2.state == 0 && item2.departmentAuditState == 0">[ 待部门审核 ]</span>
  154. <span style="margin-left:15px;color:#DAA520;" v-if="item2.state == 0 && item2.departmentAuditState == 1">[ 待项目审核人<span v-if="item2.projectAuditorName != null">({{item2.projectAuditorName}})</span>审核 ]</span>
  155. <span style="margin-left:15px;color:#32CD32;" v-else-if="item2.state == 1">[ 已通过 ]</span>
  156. <span style="margin-left:15px;color:#FF0000;" v-else-if="item2.state == 2">[ 已驳回 ] 原因:{{item2.rejectReason}}</span>
  157. <span style="margin-left:15px;color:#FF0000;" v-else-if="item2.state == 3">[ 待提交 ]</span>
  158. </span>
  159. <!--每个项目上单独审核 -->
  160. <span style="float:right;">
  161. <el-button v-if="(permissions.projectReportReview || user.id == item2.projectAuditorId) && item2.state == 0 && item2.isDeptAudit==0 && item2.projectAuditState==0" type="primary" :loading="logining"
  162. size="small" @click="approve(item1.id, item2)">通过</el-button>
  163. <el-button v-if="(permissions.projectReportReview ||user.id == item2.projectAuditorId) && item2.state == 0 && item2.isDeptAudit==0 && item2.projectAuditState==0" type="danger" :loading="logining"
  164. size="small" @click="showDenyDialog(item1.id,0, item2)">驳回</el-button>
  165. <el-button v-if="(permissions.projectReportReview ||user.id == item2.projectAuditorId) && item2.state == 1" type="normal" :loading="logining" size="small"
  166. @click="showDenyDialog(item1.id,1, item2)">撤销</el-button>
  167. <!--自己可以撤回待审核状态的报告 -->
  168. <el-button v-if="user.id == item1.id && (item2.state == 0 || item2.state == -1)" type="normal" :loading="logining" size="small" @click="cancel(item1)">撤回</el-button>
  169. </span>
  170. </p>
  171. <!--任务分组和阶段 -->
  172. <p v-if="item2.groupId != 0">任务分组:{{item2.groupName}} <span v-if="item2.stage != null && item2.stage != '-'" style="margin-left:10px;">投入阶段:{{item2.stage}}</span></p>
  173. <p v-if="user.timeType.customDegreeActive==1 && item2.degree_id != null && item2.degree_id != -1">{{user.timeType.customDegreeName}}:{{item2.degreeName}}</p>
  174. <p v-if="user.timeType.customDataActive==1">{{user.timeType.customDataName}}:{{item2.customData}}</p>
  175. <!-- 自定义日报文本 -->
  176. <p v-if="user.timeType.customTextActive==1">{{user.timeType.customTextName}}:{{item2.customText}}</p>
  177. <p v-if="user.company.packageEngineering == 1">
  178. 专业进度:
  179. <span style="margin-right:10px;" v-for="progressItem in item2.professionProgress" :key="progressItem.id">{{progressItem.professionName}}({{progressItem.progress}}%)
  180. <el-tooltip v-if="progressItem.auditState == 0" content="待审核" effect="light" placement="top">
  181. <i class="iconfont firerock-icondaibandengdaishenhe"></i>
  182. </el-tooltip>
  183. <el-tooltip v-if="progressItem.auditState == 1" content="已通过" effect="light" placement="top">
  184. <i class="iconfont firerock-iconshenhetongguo"></i>
  185. </el-tooltip>
  186. <el-tooltip v-if="progressItem.auditState == 2" content="不通过" effect="light" placement="top">
  187. <i class="iconfont firerock-iconshenhebohui"></i>
  188. </el-tooltip>
  189. </span>
  190. </p>
  191. <p v-if="item2.taskId != null">任务:{{item2.taskName}}
  192. </p>
  193. <div v-if="item2.multiWorktime==0">
  194. <p style="display: inline-block;">时长:
  195. <span v-if="item2.reportTimeType == 0" style="margin-right:10px;">{{typeList[item2.timeType]}}</span>
  196. <span v-if="item2.reportTimeType == 2" style="margin-right:10px;">{{item2.startTime+'-'+item2.endTime}}</span>
  197. {{item2.time.toFixed(1)}}h
  198. <el-tag type="danger" size="mini" style="margin-left: 65px" v-if="item2.isOvertime === 1">加班<span v-if="item2.overtimeHours">{{item2.overtimeHours.toFixed(1)}}h</span></el-tag>
  199. </p>
  200. <p>事项:<span v-html="item2.content"></span></p>
  201. </div>
  202. <div v-if="item2.multiWorktime==1" >
  203. <p>项目时长:{{item2.time.toFixed(1)}}h <el-tag type="danger" size="mini" style="margin-left: 65px" v-if="item2.isOvertime === 1">加班<span v-if="item2.overtimeHours">{{item2.overtimeHours.toFixed(1)}}h</span></el-tag></p>
  204. <div v-for="(timeItem, tIndex) in item2.worktimeList" :key="tIndex"
  205. style="border: 0.5px #ddd solid;margin-bottom:5px;padding:5px;">
  206. <p style="display: inline-block;">时长:
  207. <span v-if="item2.reportTimeType == 2" style="margin-right:10px;">{{timeItem.startTime+'-'+timeItem.endTime}}</span>
  208. {{timeItem.time.toFixed(1)}}h
  209. </p>
  210. <p>事项:<span v-html="timeItem.content"></span></p>
  211. </div>
  212. </div>
  213. <!--照片的显示 -->
  214. <p v-if="item2.pics != null && item2.pics.length > 0">
  215. <el-image v-for="(pic, index) in item2.pics" :key="index"
  216. style="width: 100px; height: 100px; margin-right:10px;"
  217. :src="pic"
  218. :preview-src-list="item2.pics">
  219. </el-image>
  220. </p>
  221. </el-card>
  222. </el-timeline-item>
  223. </el-timeline>
  224. </div>
  225. </div>
  226. <!-- 简陋的无报告提示 -->
  227. <div v-if="reportList.length==0" style="width:100%;font-size:17px;text-align:center;color:#aaa;">{{curDate}}暂无报告</div>
  228. </div>
  229. </div>
  230. </div>
  231. </div>
  232. </div>
  233. </el-card>
  234. </div>
  235. <!-- 填写日报的dialog -->
  236. <el-dialog :title="editTitle[isBatch]" :visible.sync="dialogVisible" width="60%" :close-on-click-modal="false" @closed="guanbi()">
  237. <el-form ref="workForm" :model="workForm" :rules="workRules" label-width="120px">
  238. <el-form-item label="选择人员" v-if="isSubstitude">
  239. <el-input @focus="showChooseMembTree" v-model="workForm.userNames"
  240. placeholder="请选择代填人员" ></el-input>
  241. </el-form-item>
  242. <el-form-item label="工作日期" prop="createDate">
  243. <el-date-picker v-model="workForm.createDate" :editable="false" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  244. :style="'width:'+(isBatch==0?'200':'280')+'px;'" :type="isBatch==0?'date':'daterange'"
  245. @change="changeMonth()" @blur="iptBlur(reportTimeType.type)" :clearable="false" placeholder="选择工作日期" :disabled="isDisable"></el-date-picker>
  246. <div v-if="falsss" style="display: inline-block;">共{{jsDay}} 天, {{jsTime}} 小时</div>
  247. <div v-if="isBatch!=0" style="display: inline-block;">共{{jsDay}} 天, 合计填报 {{jsTime}} 小时</div>
  248. <span v-if="reportTimeType.type == 3" style="margin-left:30px;">{{isBatch==0?'总':'每日'}}时长:</span>
  249. <el-input-number :disabled="(!canEdit || user.timeType.lockWorktime) && !isWeekend" v-if="reportTimeType.type == 3" style="margin-left:10px;" @change="changeAllTime"
  250. v-model="reportTimeType.allday" :precision="1" :step="0.5" :max="12" :min="0.5"></el-input-number>
  251. <span v-if="reportTimeType.type == 3">小时</span>
  252. <span v-if="workForm.time">考勤打卡: {{workForm.time.startTime}}-{{workForm.time.endTime}}, {{workForm.time.workHours}}小时</span>
  253. <span v-if="user.timeType.syncDingding==1&&!workForm.time">暂无考勤记录</span>
  254. </el-form-item>
  255. <!-- 000000 -->
  256. <div v-for="(domain, index) in workForm.domains" :key="domain.id" :style="index>0?'margin-top:10px;':''">
  257. <div v-if="reportTimeType.multiWorktime==0">
  258. <el-form-item v-if="reportTimeType.type != 3" :label="reportTimeType.type ==2?'工作时间':'工作时长'" :prop="'domains.' + index + '.'+timeFields[reportTimeType.type]"
  259. :rules="{ required: true, message: '请选择工作时长', trigger: 'blur' }">
  260. <el-select v-model="domain.timeType" style="width:200px;"
  261. v-if="reportTimeType.type == 0"
  262. placeholder="请选择工作时长"
  263. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  264. @change="onTimeTypeChange(domain.timeType)">
  265. <el-option
  266. v-for="item in timeType"
  267. :key="item.value"
  268. :label="item.label"
  269. :value="item.value">
  270. </el-option>
  271. </el-select>
  272. <!-- 数字时长选择 -->
  273. <el-select v-model="domain.workingTime" style="width:200px;"
  274. v-if="reportTimeType.type == 1"
  275. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  276. :placeholder="'请选择工作时长' + domain.workingTime"
  277. @change="seleChn(0,domain)">
  278. <el-option v-for="item in timeRange" :key="item" :value="item.toFixed(1)">{{item.toFixed(1)}}</el-option>
  279. </el-select>
  280. <span v-if="reportTimeType.type == 1">小时</span>
  281. <span v-if="reportTimeType.type == 2">
  282. <!--时间范围选择 -->
  283. <el-time-picker
  284. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  285. v-model="domain.startTime"
  286. placeholder="起始时间"
  287. style="width:120px;"
  288. format="HH:mm"
  289. value-format="HH:mm"
  290. :picker-options="{
  291. start: '08:00',
  292. end: '23:30'
  293. }"
  294. @change="iptChang()">
  295. </el-time-picker> - <el-time-picker
  296. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  297. v-model="domain.endTime"
  298. placeholder="结束时间"
  299. style="width:120px;"
  300. format="HH:mm"
  301. value-format="HH:mm"
  302. :picker-options="{
  303. start: '08:00',
  304. end: '23:30',
  305. minTime: domain.startTime
  306. }"
  307. @change="iptChang()">
  308. </el-time-picker>
  309. </span>
  310. <div class="overtime" v-if="user.timeType.fillOvertime || isWeekend">
  311. <el-checkbox :disabled="!domain.canEdit" v-model="domain.isOvertime">含加班</el-checkbox>
  312. <el-input :disabled="!domain.canEdit || domain.isOvertime==null || domain.isOvertime==0 || !domain.isOvertime" v-model="domain.overtimeHours" @blur="triggerCalculateOT(index)" @input="domain.overtimeHours=domain.overtimeHours.replace(/[^\d.]/g,'')" style="width: 100px;"></el-input><span style="margin-left:5px">小时</span>
  313. </div>
  314. </el-form-item>
  315. <el-form-item :label="user.companyId==781?'工作任务':'投入项目'" :prop="'domains.' + index + '.projectId'"
  316. :rules="{ required: true, message: user.companyId==781?'请选择工作任务':'请选择投入项目', trigger: ['change','blur'] }">
  317. <el-select v-model="domain.projectId" :placeholder="user.companyId==781?'请选择工作任务':'请选择项目'" style="width:200px;" clearable="true" filterable="true" value-key="id"
  318. @change="selectProject(domain, index)"
  319. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  320. <!-- <el-option v-for="item in projectList" :disabled="item.status>=2" :key="item.id" :label="item.projectName" :value="item.id"></el-option> -->
  321. <el-option v-for="item in fillProjectList" :disabled="item.status!=1 && item.status!=4" :key="item.id" :label="item.projectName + '\u3000' + item.projectCode" :value="item.id">
  322. <span style="float: left; color: #8492a6; font-size: 13px;">{{ item.projectCode }}</span>
  323. <span style="float: right;margin-left: 20px">{{ item.projectName }}</span>
  324. </el-option>
  325. </el-select>
  326. <template v-if="user.timeType.mainProjectState != 1">
  327. <span v-if="domain.subProjectList != null && domain.subProjectList.length> 0 && domain.projectId != ''"
  328. style="margin-left:45px;">子项目</span>
  329. <!--子项目 -->
  330. <el-select v-model="domain.subProjectId" placeholder="请选择子项目" style="width:200px;margin-left:10px;" clearable="true"
  331. v-if="domain.subProjectList != null && domain.subProjectList.length> 0 && domain.projectId != ''"
  332. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)" @change="updateSubProject">
  333. <el-option v-for="item in domain.subProjectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  334. </el-select>
  335. </template>
  336. <el-link v-if="index >= 1&&domain.canEdit" type="primary" :underline="false" @click="delDomain(index)" style="float:right;margin-right:10px;"
  337. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  338. <i class="fa fa-trash" style="color: red;;font-size:18px;"></i>
  339. </el-link>
  340. <!-- <el-link type="primary" v-if="canEdit"
  341. :underline="false" style="margin-left:10px;" @click="copyProject(index)">复制</el-link> -->
  342. </el-form-item>
  343. <el-form-item :label="user.companyId==781?'描述':'项目描述'" v-if="user.company.packageProject==0&&domain.projectId&&projectList.filter(p=>p.id == domain.projectId)[0].projectDesc">
  344. <span>{{projectList.filter(p=>p.id == domain.projectId)[0].projectDesc}}</span>
  345. </el-form-item>
  346. <!--如果设置了工时成本预警的预算成本项-->
  347. <el-form-item label="预算来源" v-if="user.company.packageProject==1&&timeBasecostList &&timeBasecostList.length>0">
  348. <el-select v-model="domain.basecostId" :disabled="!domain.canEdit" @change="$forceUpdate()">
  349. <el-option v-for="item in timeBasecostList" :label="item.name" :value="item.id" :key="item.id"></el-option>
  350. </el-select>
  351. </el-form-item>
  352. <el-form-item label="任务分组" v-if="user.company.packageProject == 1">
  353. <!-- 任务分组 -->
  354. <el-select v-model="domain.groupId" placeholder="请选择任务分组" style="width:200px;" clearable="true"
  355. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)" @change="getGroupStages(domain, index)">
  356. <el-option v-for="item in domain.taskGroups" :key="item.id" :label="item.name" :value="item.id"></el-option>
  357. </el-select>
  358. <!-- 项目的阶段 -->
  359. <span v-if="domain.stages != null && domain.stages.length> 0"
  360. style="margin-left:30px;">投入阶段</span>
  361. <el-select v-model="domain.stage" placeholder="请选择" style="width:200px;margin-left:10px;"
  362. clearable="true" v-if="domain.stages != null && domain.stages.length> 0"
  363. @change="changeStages(domain, index)"
  364. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  365. <el-option v-for="item in domain.stages" :key="item.id" :label="item.stagesName" :value="item.stagesName"></el-option>
  366. </el-select>
  367. </el-form-item>
  368. <el-form-item :label="user.companyId==781?'审核人':'项目审核人'">
  369. <el-select v-model="domain.projectAuditorId" :disabled="!domain.canEdit" @change="$forceUpdate()">
  370. <el-option v-for="item in domain.auditUserList" :label="item.auditorName" :value="item.auditorId" :key="item.id"></el-option>
  371. </el-select>
  372. </el-form-item>
  373. <!-- 相关维度/自定义维度 -->
  374. <el-form-item :label="yonghuUser.customDegreeName" v-if="domain.projectId && yonghuUser.customDegreeActive == 1" :rules="user.timeType.customDegreeStatus == 1 && domain.wuduList != undefined && domain.wuduList.length != 0 ? { required: true, message: '请选择' + yonghuUser.customDegreeName, trigger: ['change','blur'] } : null" :prop="'domains.' + index + '.degreeId'">
  375. <el-select v-model="domain.degreeId" clearable placeholder="请选择" :disabled="!domain.canEdit">
  376. <el-option v-for="item in domain.wuduList" :key="item.value" :label="item.name" :value="item.id">
  377. </el-option>
  378. </el-select>
  379. </el-form-item>
  380. <!-- 相关数值 -->
  381. <el-form-item :label="yonghuUser.customDataName" v-if="yonghuUser.customDataActive == 1" :prop="'domains.' + index + '.customData'" :rules="user.timeType.customDataStatus == 1 ? { type: 'number', required: true, message: '请填写' + yonghuUser.customDataName, trigger: ['change','blur'] } : null">
  382. <el-input-number :id="'numberData_'+index" :disabled="!domain.canEdit" v-model="domain.customData" style="width:200px;" @keyup.native="restrictNumber('numberData_'+index)" :max="user.timeType.customDataMaxStatus == 1 ? user.timeType.customDataMaxValue : 'infinity'"></el-input-number>
  383. </el-form-item>
  384. <!-- 自定义文本 -->
  385. <el-form-item :label="yonghuUser.customTextName" v-if="yonghuUser.customTextActive == 1" :prop="'domains.' + index + '.customText'" :rules="user.timeType.customTextStatus == 1 ? { required: true, message: '请填写' + yonghuUser.customTextName, trigger: ['change','blur'] } : null">
  386. <el-input :disabled="!domain.canEdit" v-model="domain.customText" type="textarea" :rows="1" style="width:75%;margin-right:7%" maxlength="1000" show-word-limit></el-input>
  387. </el-form-item>
  388. <el-form-item v-if="reportTimeType.type == 3" label="用时占比" :prop="'domains.' + index + '.'+timeFields[reportTimeType.type]"
  389. :rules="{ required: true, message: '请设置用时占比', trigger: 'blur' }">
  390. <div style="width:300px;">
  391. <el-col span="14"><el-slider :disabled="!domain.canEdit" v-model="domain.progress" :min="5" :show-tooltip="false" :step="5" style="width:180px;" @input="domain.workingTime = (reportTimeType.allday*domain.progress/100).toFixed(1)" @change="seleChn(0)"></el-slider></el-col>
  392. <el-col span="10"><span style="margin-left:10px;float:right;"><span style="margin-right:10px;">{{domain.progress}}%</span>{{domain.workingTime}}小时</span></el-col>
  393. </div>
  394. <div class="overtime" v-if="user.timeType.fillOvertime || isWeekend"><el-checkbox :disabled="!domain.canEdit" v-model="domain.isOvertime">加班</el-checkbox>
  395. <el-input :disabled="!domain.canEdit || domain.isOvertime==null || domain.isOvertime==0 || !domain.isOvertime" v-model="domain.overtimeHours" @blur="triggerCalculateOT(index)" @input="domain.overtimeHours=domain.overtimeHours.replace(/[^\d.]/g,'')" style="width: 100px;"></el-input><span style="margin-left:5px">小时</span>
  396. </div>
  397. </el-form-item>
  398. <!--工程专业版本模式下, 各个专业的进度填报 -->
  399. <el-form-item label="专业进度" :prop="'domains.' + index + '.professionProgress'" v-if="user.company.packageEngineering==1">
  400. <span v-for="item in domain.professionProgress" :key="item.professionId" style="margin-right:10px;">
  401. <span>{{item.professionName}}</span> / 进度:
  402. <el-input size="mini" style="width:60px;" v-model="item.progress"
  403. @keyup.native="onProgressChange"
  404. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"></el-input>%
  405. </span>
  406. </el-form-item>
  407. <!--项目管理专业版模式下,项目下的近期执行的任务 -->
  408. <el-form-item label="任务/里程碑" :prop="'domains.' + index + '.taskId'" v-if="user.company.packageProject==1" >
  409. <el-select v-model="domain.taskId" placeholder="请选择" style="width:75%;margin-right:7%" filterable="true"
  410. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  411. <el-option v-for="item in domain.taskList" :key="item.taskId" :label="item.taskName" :value="item.taskId"></el-option>
  412. </el-select>
  413. <el-checkbox v-model="domain.taskFinish" v-if="domain.taskId != undefined">已完成</el-checkbox>
  414. </el-form-item>
  415. <el-form-item :label="user.companyId==781?'具体内容与结果':'工作事项'" :prop="'domains.' + index + '.content'"
  416. :rules="user.timeType.workContentState == 1 ? { required: true, message: user.companyId==781?'填写具体内容与结果':'填写工作事项', trigger: 'blur' } : null">
  417. <el-input v-model="domain.content" type="textarea" :rows="4" placeholder="请填写" clearable
  418. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"></el-input>
  419. </el-form-item>
  420. </div>
  421. <!--多个工作事项填报的情况 -->
  422. <div v-if="reportTimeType.multiWorktime==1">
  423. <el-form-item label="投入项目" :prop="'domains.' + index + '.projectId'"
  424. :rules="{ required: true, message: '请选择投入项目', trigger: ['change','blur'] }">
  425. <el-select v-model="domain.projectId" placeholder="请选择项目" style="width:200px;" clearable="true" filterable="true" value-key="id"
  426. @change="selectProject(domain, index)"
  427. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  428. <el-option v-for="item in fillProjectList" :disabled="item.status!=1 && item.status!=4" :key="item.id" :label="item.projectName + '\u3000' + item.projectCode" :value="item.id">
  429. <span style="float: left; color: #8492a6; font-size: 13px;">{{ item.projectCode }}</span>
  430. <span style="float: right;margin-left: 20px">{{ item.projectName }}</span>
  431. </el-option>
  432. </el-select>
  433. <template v-if="user.timeType.mainProjectState != 1">
  434. <span v-if="domain.subProjectList != null && domain.subProjectList.length> 0 && domain.projectId != ''"
  435. style="margin-left:45px;">子项目</span>
  436. <!--子项目 -->
  437. <el-select v-model="domain.subProjectId" placeholder="请选择子项目" style="width:200px;margin-left:10px;" clearable="true"
  438. v-if="domain.subProjectList != null && domain.subProjectList.length> 0 && domain.projectId != ''"
  439. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)" @change="updateSubProject">
  440. <el-option v-for="item in domain.subProjectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  441. </el-select>
  442. </template>
  443. <el-link v-if="index >= 1&&domain.canEdit" type="primary" :underline="false" @click="delDomain(index)" style="float:right;margin-right:10px;"
  444. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  445. <i class="fa fa-trash" style="color: red;;font-size:18px;"></i>
  446. </el-link>
  447. <div class="overtime" v-if="user.timeType.fillOvertime || isWeekend"><el-checkbox :disabled="!domain.canEdit" v-model="domain.isOvertime">含加班</el-checkbox>
  448. <el-input :disabled="!domain.canEdit || domain.isOvertime==null || domain.isOvertime==0 || !domain.isOvertime" v-model="domain.overtimeHours" @blur="triggerCalculateOT(index)" @input="domain.overtimeHours=domain.overtimeHours.replace(/[^\d.]/g,'')" style="width: 100px;"></el-input><span style="margin-left:5px">小时</span>
  449. </div>
  450. <!-- <el-link type="primary" v-if="canEdit"
  451. :underline="false" style="margin-left:10px;" @click="copyProject(index)">复制</el-link> -->
  452. </el-form-item>
  453. <el-form-item :label="user.companyId==781?'描述':'项目描述'" v-if="user.company.packageProject==0&&domain.projectId&&projectList.filter(p=>p.id == domain.projectId)[0].projectDesc">
  454. <span>{{projectList.filter(p=>p.id == domain.projectId)[0].projectDesc}}</span>
  455. </el-form-item>
  456. <!--如果设置了工时成本预警的预算成本项-->
  457. <el-form-item label="预算来源" v-if="user.company.packageProject==1&&timeBasecostList &&timeBasecostList.length>0">
  458. <el-select v-model="domain.basecostId" :disabled="!domain.canEdit" @change="$forceUpdate()">
  459. <el-option v-for="item in timeBasecostList" :label="item.name" :value="item.id" :key="item.id"></el-option>
  460. </el-select>
  461. </el-form-item>
  462. <el-form-item label="任务分组" v-if="user.company.packageProject == 1">
  463. <!-- 任务分组 -->
  464. <el-select v-model="domain.groupId" placeholder="请选择任务分组" style="width:200px;" clearable="true"
  465. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)" @change="getGroupStages(domain, index)">
  466. <el-option v-for="item in domain.taskGroups" :key="item.id" :label="item.name" :value="item.id"></el-option>
  467. </el-select>
  468. <!-- 项目的阶段 -->
  469. <span v-if="domain.stages != null && domain.stages.length> 0"
  470. style="margin-left:30px;">投入阶段</span>
  471. <el-select v-model="domain.stage" placeholder="请选择" style="width:200px;margin-left:10px;"
  472. clearable="true" v-if="domain.stages != null && domain.stages.length> 0"
  473. @change="changeStages(domain, index)"
  474. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  475. <el-option v-for="item in domain.stages" :key="item.id" :label="item.stagesName" :value="item.stagesName"></el-option>
  476. </el-select>
  477. </el-form-item>
  478. <el-form-item label="项目审核人" >
  479. <el-select v-model="domain.projectAuditorId" :disabled="!domain.canEdit" @change="$forceUpdate()">
  480. <el-option v-for="item in domain.auditUserList" :label="item.auditorName" :value="item.auditorId" :key="item.id"></el-option>
  481. </el-select>
  482. </el-form-item>
  483. <!--工程专业版本模式下, 各个专业的进度填报 -->
  484. <el-form-item label="专业进度" :prop="'domains.' + index + '.professionProgress'" v-if="user.company.packageEngineering==1">
  485. <span v-for="item in domain.professionProgress" :key="item.professionId" style="margin-right:10px;">
  486. <span>{{item.professionName}}</span> / 进度:
  487. <el-input size="mini" style="width:60px;" v-model="item.progress"
  488. @keyup.native="onProgressChange"
  489. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"></el-input>%
  490. </span>
  491. </el-form-item>
  492. <!-- 相关维度 -->
  493. <el-form-item :label="yonghuUser.customDegreeName" v-if="domain.projectId && yonghuUser.customDegreeActive == 1" :rules="user.timeType.customDegreeStatus == 1 && domain.wuduList.length != 0 ? { required: true, message: '请选择' + yonghuUser.customDegreeName, trigger: ['change','blur'] } : null" :prop="'domains.' + index + '.degreeId'">
  494. <el-select v-model="domain.degreeId" :disabled="!domain.canEdit" clearable placeholder="请选择">
  495. <el-option v-for="item in domain.wuduList" :key="item.value" :label="item.name" :value="item.id">
  496. </el-option>
  497. </el-select>
  498. </el-form-item>
  499. <!-- 相关数值 -->
  500. <el-form-item :label="yonghuUser.customDataName" v-if="domain.projectId && yonghuUser.customDataActive == 1" :prop="'domains.' + index + '.customData'" :rules="user.timeType.customDataStatus == 1 ? { type: 'number', required: true, message: '请填写' + yonghuUser.customDataName, trigger: ['change','blur'] } : null">
  501. <el-input-number :id="'numberData_'+index" :disabled="!domain.canEdit" v-model="domain.customData" style="width:200px;" @keyup.native="restrictNumber('numberData_'+index)" :max="user.timeType.customDataMaxStatus == 1 ? user.timeType.customDataMaxValue : 'infinity'"></el-input-number>
  502. </el-form-item>
  503. <!-- 自定义文本 -->
  504. <el-form-item :label="yonghuUser.customTextName" v-if="yonghuUser.customTextActive == 1" :prop="'domains.' + index + '.customText'" :rules="user.timeType.customTextStatus == 1 ? { required: true, message: '请填写' + yonghuUser.customTextName, trigger: ['change','blur'] } : null">
  505. <el-input :disabled="!domain.canEdit" v-model="domain.customText" style="width:75%;margin-right:7%" type="textarea" :rows="1" maxlength="1000"></el-input>
  506. </el-form-item>
  507. <!--项目管理专业版模式下,项目下的近期执行的任务 -->
  508. <el-form-item label="任务/里程碑" :prop="'domains.' + index + '.taskId'" v-if="user.company.packageProject==1" >
  509. <el-select v-model="domain.taskId" placeholder="请选择" style="width:75%;margin-right:7%" filterable="true"
  510. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  511. <el-option v-for="item in domain.taskList" :key="item.taskId" :label="item.taskName" :value="item.taskId"></el-option>
  512. </el-select>
  513. <el-checkbox v-model="domain.taskFinish" v-if="domain.taskId != undefined">已完成</el-checkbox>
  514. </el-form-item>
  515. <div v-for="(timeItem,tIndex) in domain.worktimeList" :key="tIndex"
  516. style="border: 0.5px #ddd solid;padding:5px;margin-bottom:15px;position:relative;">
  517. <i v-if="tIndex>0&&workForm.domains[index].state>=2" @click="removeTimeItem(domain,tIndex)" class="el-icon-delete" style="position:absolute;right:-7px;top:-7px;font-size:16px;"></i>
  518. <el-form-item label="工作时间" :prop="'domains.' + index + '.worktimeList.'+tIndex+'.'+timeFields[reportTimeType.type]"
  519. :rules="{ required: true, message: '请选择工作时间', trigger: 'blur' }">
  520. <span v-if="reportTimeType.type == 2">
  521. <!-- <span> -->
  522. <!--时间范围选择 -->
  523. <el-time-picker
  524. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  525. v-model="timeItem.startTime"
  526. placeholder="起始时间"
  527. style="width:120px;"
  528. format="HH:mm"
  529. value-format="HH:mm"
  530. :picker-options="{
  531. start: '00:00',
  532. end: '23:59',
  533. }"
  534. @change="iptChangs()">
  535. </el-time-picker> - <el-time-picker
  536. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  537. v-model="timeItem.endTime"
  538. placeholder="结束时间"
  539. style="width:120px;"
  540. format="HH:mm"
  541. value-format="HH:mm"
  542. :picker-options="{
  543. start: '00:00',
  544. end: '23:59',
  545. minTime: timeItem.startTime
  546. }"
  547. @change="iptChangs()">
  548. </el-time-picker>
  549. </span>
  550. </el-form-item>
  551. <el-form-item label="工作事项" :prop="'domains.' + index + '.worktimeList.'+tIndex+'.content'"
  552. :rules="user.timeType.workContentState == 1 ? { required: true, message: '填写工作事项', trigger: 'blur' } : null">
  553. <el-input v-model="timeItem.content" type="textarea" :rows="2" placeholder="请填写工作事项" clearable
  554. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  555. ></el-input>
  556. </el-form-item>
  557. </div>
  558. <el-link size="small" @click="addNewWorktime(index, domain)" style="margin-left:15px;margin-top:5px;margin-bottom:5px;">添加工时</el-link>
  559. </div>
  560. <!--照片的显示 -->
  561. <p v-if="domain.pics != null && domain.pics.length > 0" style="text-align:center;">
  562. <el-image v-for="(pic, index) in domain.pics" :key="index"
  563. style="width: 100px; height: 100px; margin-right:10px;"
  564. :src="pic"
  565. :preview-src-list="domain.pics">
  566. </el-image>
  567. </p>
  568. <el-divider v-if="workForm.domains.length>1" style="margin-bottom:10px;"></el-divider>
  569. </div>
  570. <el-link v-if="showAddMore" type="primary" :underline="false" @click="addDomain(reportTimeType.type)" style="margin-left:40px">添加更多</el-link>
  571. </el-form>
  572. <span slot="footer" class="dialog-footer">
  573. <el-button @click="cancel(workForm.domains,true)" v-if="canCancelInDialog" style="float:left;">撤回</el-button>
  574. <el-button @click="deleteReport" v-if="workForm.domains[0].id != null && canEdit">删除</el-button>
  575. <el-button @click="dialogVisible = false">取消</el-button>
  576. <el-button v-if="!isSubstitude" @click="submitReport(1)" :loading="submitingReport" :disabled="workForm.domains.length==0?true:(canEdit?false:true)">暂存</el-button>
  577. <el-button type="primary" @click="submitReport(0)" :loading="submitingReport"
  578. :disabled="workForm.domains.length==0?true:(canEdit?false:true)" >提交</el-button>
  579. </span>
  580. </el-dialog>
  581. <!-- 按周填报 -->
  582. <el-dialog title="按周填报" :visible.sync="diasZho" width="60%" :close-on-click-modal="false" @closed="guanbi(),zhoAddqx()">
  583. <el-form ref="WeekWorkForm" :model="workForm" :rules="workRules" label-width="100px" v-if="!selConShow">
  584. <el-form-item label="工作日期" prop="createDate">
  585. <el-date-picker v-model="zhoRqi" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="zhoRqis()" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" style="margin-right: 18px" :clearable="false"></el-date-picker>
  586. <el-button @click="handleGetPrevWeek()">上一周</el-button>
  587. <el-button @click="handleGetNextvWeek()">下一周</el-button>
  588. <el-button @click="getCurrentWeek()">本周</el-button>
  589. <el-button @click="newDates()">新增日期</el-button>
  590. </el-form-item>
  591. <el-table :data="zhoData" style="width: 100%" v-loading="zhoLoading">
  592. <el-table-column fixed="left" prop="zhoDataTime" label="日期" width="160">
  593. <template slot-scope="scope">
  594. {{scope.row.zhoDataTime}}({{scope.row.zhoDataTime | zhoData}})
  595. </template>
  596. </el-table-column>
  597. <!-- <el-table-column align="center" v-for="(item, index) in projectList" :key="item.id" :label="item.projectName" width="200"> -->
  598. <el-table-column align="center" v-for="item in selProjectList" :key="item.id" :label="item.projectName" min-width="200">
  599. <template slot-scope="scope">
  600. <div v-if="reportTimeType.multiWorktime == 0" slot="reference" @click="tianxies(scope.row[item.projectName], scope.$index, item.projectName, workForm.domains)">
  601. <el-button v-if="scope.row[item.projectName].workingTime != null && scope.row[item.projectName].workingTime != '' && reportTimeType.type == 3 && scope.row[item.projectName].workingTime > 0" type="text" slot="reference">{{scope.row[item.projectName].workingTime}} h</el-button>
  602. <el-button v-else-if="scope.row[item.projectName].workingTime != null && scope.row[item.projectName].workingTime != '' && reportTimeType.type == 1 && scope.row[item.projectName].workingTime > 0" type="text" slot="reference">{{scope.row[item.projectName].workingTime}} h</el-button>
  603. <el-button v-else-if="scope.row[item.projectName].time != null && scope.row[item.projectName].time != '' && reportTimeType.type == 2" type="text" slot="reference">{{scope.row[item.projectName].time[0]}} - {{scope.row[item.projectName].time[1]}}</el-button>
  604. <el-button v-else type="text" >请填写</el-button>
  605. </div>
  606. <div v-if="reportTimeType.multiWorktime == 1" slot="reference" @click="tianxies(scope.row[item.projectName], scope.$index, item.projectName, workForm.domains)">
  607. <el-button v-if="scope.row[item.projectName].time != null && scope.row[item.projectName].time != '' && reportTimeType.type == 2" type="text" slot="reference">{{scope.row[item.projectName].time[0]}} - {{scope.row[item.projectName].time[1]}}</el-button>
  608. <el-button v-else type="text" >请填写</el-button>
  609. </div>
  610. </template>
  611. </el-table-column>
  612. <el-table-column fixed="right" label="考勤打卡" width="150" v-if="user.timeType.showDdCardtime == 1 || user.timeType.showCorpwxCardtime == 1">
  613. <template slot-scope="scope">
  614. <span v-if="scope.row.corpTime">{{scope.row.corpTime.startTime + '-' + scope.row.corpTime.endTime + ',' + scope.row.corpTime.workHours + 'h'}}</span>
  615. <span v-else>暂无考勤记录</span>
  616. </template>
  617. </el-table-column>
  618. <el-table-column fixed="right" prop="he" label="合计(h)" width="120">
  619. <template slot-scope="scope">
  620. <div class="zhiss">
  621. <p>{{scope.row.he}}</p>
  622. <el-button size="mini" icon="el-icon-delete" circle @click="zhoBtn(scope.$index)"></el-button>
  623. </div>
  624. </template>
  625. </el-table-column>
  626. </el-table>
  627. </el-form>
  628. <!-- 按周填报项目筛选 -->
  629. <div v-if="selConShow" class="selConStyle">
  630. <div class="selConStyle_title">请选择要填报的项目</div>
  631. <el-select v-model="selCon" multiple placeholder="请选择" filterable>
  632. <el-option
  633. v-for="item in fillProjectList"
  634. :disabled="item.status!=1 && item.status!=4"
  635. :key="item.id"
  636. :label="item.projectName"
  637. :value="item.id">
  638. </el-option>
  639. </el-select>
  640. </div>
  641. <span slot="footer" class="dialog-footer" v-if="selConShow">
  642. <el-button @click="selListqx()">取 消</el-button>
  643. <el-button type="primary" @click="selListFun()">下一步</el-button>
  644. <!-- :loading="submitingReport" -->
  645. </span>
  646. <span slot="footer" class="dialog-footer" v-if="!selConShow">
  647. <el-button @click="zhoAddlast()" style="float:left;" class="el-icon-back">选择项目</el-button>
  648. <el-button @click="zhoAddqx()">取 消</el-button>
  649. <el-button type="primary" @click="zhoAdd()" :loading="submitingReport">提 交</el-button>
  650. </span>
  651. </el-dialog>
  652. <!-- 选择时间 -->
  653. <el-dialog title="时间选择" :visible.sync="btnZho" width="30%" :before-close="handleClose">
  654. <span>这是一段信息</span>
  655. <span slot="footer" class="dialog-footer">
  656. <el-button @click="btnZho = false">取 消</el-button>
  657. <el-button type="primary" @click="btnZho = false">确 定</el-button>
  658. </span>
  659. </el-dialog>
  660. <!-- 按周填报弹窗 -->
  661. <el-dialog title="请填写" :visible.sync="tianxieDialogVisible" width="30%" :before-close="handleClose">
  662. <div>
  663. <div class="zhoFel" v-if="zhoBao.subProjectList != null && zhoBao.subProjectList.length > 0 && user.timeType.mainProjectState != 1">
  664. <p>子项目</p>
  665. <el-select v-model="zhoBao.subProjectId" placeholder="请选择" clearable="true" style="width: 355px">
  666. <el-option v-for="item in zhoBao.subProjectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  667. </el-select>
  668. </div>
  669. <!--如果设置了工时成本预警的预算成本项-->
  670. <div class="zhoFel" v-if="timeBasecostList &&timeBasecostList.length>0">
  671. <p>预算来源</p>
  672. <el-select v-model="zhoBao.basecostId" style="width: 355px">
  673. <el-option v-for="item in timeBasecostList" :label="item.name" :value="item.id" :key="item.id"></el-option>
  674. </el-select>
  675. </div>
  676. <!-- 任务分组 -->
  677. <div class="zhoFel" v-if="user.company.packageProject == 1">
  678. <p>任务分组</p>
  679. <el-select v-model="zhoBao.groupId" placeholder="请选择任务分组" clearable="true" style="width: 355px"
  680. @change="getGroupStages(zhoBao, 0)">
  681. <el-option v-for="item in zhoBao.taskGroups" :key="item.id" :label="item.name" :value="item.id"></el-option>
  682. </el-select>
  683. </div>
  684. <div class="zhoFel" v-if="user.company.packageProject == 1 && zhoBao.stages != null && zhoBao.stages.length> 0">
  685. <p>投入阶段</p>
  686. <el-select v-model="zhoBao.stage" placeholder="请选择" style="width: 355px" clearable="true" >
  687. <el-option v-for="item in zhoBao.stages" :key="item.id" :label="item.stagesName" :value="item.stagesName"></el-option>
  688. </el-select>
  689. </div>
  690. <div class="zhoFel" >
  691. <p>审核人</p>
  692. <el-select v-model="zhoBao.projectAuditorId" placeholder="请选择" clearable="true" style="width: 355px">
  693. <el-option v-for="item in zhoBao.auditUserList" :key="item.id" :label="item.auditorName" :value="item.auditorId"></el-option>
  694. </el-select>
  695. </div>
  696. <!-- 自定义维度 -->
  697. <div class="zhoFel" v-if="user.timeType.customDegreeActive">
  698. <p>{{user.timeType.customDegreeName}}</p>
  699. <el-select v-model="zhoBao.degreeId" placeholder="请选择" clearable="true" style="width: 355px">
  700. <el-option v-for="item in zhoBao.wuduList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  701. </el-select>
  702. </div>
  703. <!-- 自定义数值 -->
  704. <div class="zhoFel" v-if="user.timeType.customDataActive">
  705. <p>{{user.timeType.customDataName}}</p>
  706. <el-input-number :id="'weekData_num'" v-model="zhoBao.customData" style="width:200px;margin-right:155px;" @keyup.native="restrictNumber('weekData_num')" :max="user.timeType.customDataMaxStatus == 1 ? user.timeType.customDataMaxValue : 'infinity'"></el-input-number>
  707. </div>
  708. <!-- 自定义文本 -->
  709. <div class="zhoFel" v-if="user.timeType.customTextActive == 1">
  710. <p>{{user.timeType.customTextName}}</p>
  711. <el-input v-model="zhoBao.customText" type="textarea" :rows="1" style="width:355px;" maxlength="1000" show-word-limit></el-input>
  712. </div>
  713. <div class="zhoFel" v-if="reportTimeType.type == 2">
  714. <p>选择时间</p>
  715. <el-time-picker style="width: 355px" is-range v-model="zhoBao.time" format="HH:mm" value-format="HH:mm" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围"></el-time-picker>
  716. </div>
  717. <div class="zhoFel" v-if="reportTimeType.type == 1">
  718. <p>选择时长</p>
  719. <el-select clearable v-model="zhoBao.workingTime" style="width: 355px;" placeholder="请选择工作时长">
  720. <el-option v-for="item in timeRange" :key="item" :value="item.toFixed(1)">{{item.toFixed(1)}}</el-option>
  721. </el-select>
  722. </div>
  723. <div class="zhoFel" v-if="reportTimeType.type == 3">
  724. <p>用时占比</p>
  725. <div style="width:355px;display: flex;align-items: center;">
  726. <el-col span="23"><el-slider style="margin-left: 5px;width:249px;" v-model="zhoBao.progress" :min="0" :show-tooltip="false" :step="10" @input="zhoBao.workingTime = (reportTimeType.allday*zhoBao.progress/100).toFixed(1)"></el-slider></el-col>
  727. <el-col span="10"><span style="float:right;"><span style="margin-right:10px;">{{zhoBao.progress || 0}}%</span>{{zhoBao.workingTime | amounts}}小时</span></el-col>
  728. </div>
  729. </div>
  730. <div class="zhoFel">
  731. <p>工作事项</p>
  732. <el-input type="textarea" v-model="zhoBao.con" placeholder="请输入工作事项" style="width: 355px" clearable></el-input>
  733. </div>
  734. </div>
  735. <span slot="footer" class="dialog-footer">
  736. <el-button @click="tianxieDialogVisible = false">取 消</el-button>
  737. <el-button type="primary" @click="btnTianxiaes()">确 定</el-button>
  738. </span>
  739. </el-dialog>
  740. <!-- 批量日报审核 -->
  741. <el-dialog title="批量项目报告审核" :visible.sync="approveDialogVisible" width="500px" >
  742. <el-checkbox v-model="isAllSelect" label="全选" style="margin-left:24px;" @change="selectAll" v-if="reportNames.length > 0"></el-checkbox>
  743. <el-tree ref="approveTree" node-key="id" :data="reportNames" show-checkbox="true" @check-change="handleCheckChange" >
  744. </el-tree>
  745. <div style="margin-left:30px;color:#999;" v-if="user.company.packageEngineering==1">仅能看到自己负责的待项目审核的日报填写人员</div>
  746. <span slot="footer" class="dialog-footer">
  747. <el-button @click="approveDialogVisible = false">取消</el-button>
  748. <el-button type="primary" @click="submitBatchApprove" :disabled="batchShowData.length == 0">审核通过</el-button>
  749. </span>
  750. </el-dialog>
  751. <!--导出报表条件选择 -->
  752. <el-dialog title="日报导出" v-if="exportDialog" :visible.sync="exportDialog" customClass="customWidth" width="500px">
  753. <el-form ref="form3" :model="exportParam" >
  754. <el-form-item prop="projectId" label="选择项目">
  755. <el-select v-model="exportParam.projectId" placeholder="全部项目" clearable filterable style="width:350px;">
  756. <el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id"></el-option>
  757. </el-select>
  758. </el-form-item>
  759. <el-form-item prop="departmentId" label="选择部门" v-if="permissions.reportsCompany">
  760. <el-cascader v-model="exportParam.departmentId" placeholder="全部部门" :options="departmentList" :props="{ checkStrictly: true, value: 'id' }" clearable style="width: 350px;"></el-cascader>
  761. </el-form-item>
  762. <el-form-item prop="projectId" label="日期范围">
  763. <el-date-picker
  764. v-model="exportParam.dateRange" :editable="false"
  765. format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  766. :clearable="true"
  767. range-separator="至"
  768. type="daterange"
  769. start-placeholder="开始日期"
  770. end-placeholder="结束日期"
  771. ></el-date-picker>
  772. </el-form-item>
  773. <el-form-item prop="stateKey" label="是否包含">
  774. <el-select v-model="stateKey" placeholder="请选择" filterable style="width:350px;">
  775. <el-option label="不包含未审核" value="0"></el-option>
  776. <el-option label="包含未审核" value="1"></el-option>
  777. </el-select>
  778. </el-form-item>
  779. </el-form>
  780. <div slot="footer" class="dialog-footer">
  781. <el-button type="primary" @click="exportReport" style="width:100%;" :loading="listLoading">导出</el-button>
  782. </div>
  783. </el-dialog>
  784. <!--导出报表条件选择 -->
  785. <el-dialog title="工时统计导出" v-if="exportTimeDialog" :visible.sync="exportTimeDialog" customClass="customWidth" width="500px">
  786. <el-form ref="form3" :model="exportParam" >
  787. <el-form-item prop="range" label="日期范围">
  788. <el-date-picker
  789. v-model="exportParam.dateRange" :editable="false"
  790. format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  791. :clearable="true"
  792. range-separator="至"
  793. type="daterange"
  794. start-placeholder="开始日期"
  795. end-placeholder="结束日期"
  796. ></el-date-picker>
  797. </el-form-item>
  798. </el-form>
  799. <div slot="footer" class="dialog-footer">
  800. <el-button type="primary" @click="exportUserTime" style="width:100%;" >导出</el-button>
  801. </div>
  802. </el-dialog>
  803. <!--人员列表 -->
  804. <el-dialog :title="(isFill?'已填':'未填')+'人员列表'" v-if="membListVisible" :visible.sync="membListVisible" width="500px" class="membListClass">
  805. <el-tabs v-model="isLeave" v-if="!isFill && (user.timeType.syncCorpwxTime == 1 || user.timeType.syncDingding == 1 || user.company.packageOa == 1)" type="card">
  806. <el-tab-pane :label="'当日未填(' + fillMembList.length +'人)'" :name="0">
  807. <el-table :show-header="true" :data="fillMembList" highlight-current-row :height="400" style="width: 100%;" @selection-change="notifySel">
  808. <el-table-column type="selection"></el-table-column>
  809. <el-table-column prop="label" label="姓名" >
  810. <template slot-scope="scope">
  811. <span>{{(scope.row.leaveDays || scope.row.leaveTimes) ? scope.row.label + (scope.row.leaveDays ? '(请假' + scope.row.leaveDays + '天)' : '(请假' + scope.row.leaveTimes + 'h)') : scope.row.label}}</span>
  812. </template>
  813. </el-table-column>
  814. <el-table-column prop="deptName" label="部门" >
  815. </el-table-column>
  816. </el-table>
  817. </el-tab-pane>
  818. <el-tab-pane :label="'全天请假(' + fillMembList_leave.length + '人)'" :name="1">
  819. <el-table :show-header="true" :data="fillMembList_leave" highlight-current-row :height="400" style="width: 100%;">
  820. <el-table-column prop="label" label="姓名" >
  821. <template slot-scope="scope">
  822. <!-- <span>{{(scope.row.leaveDays || scope.row.leaveTimes) ? scope.row.label + (scope.row.leaveDays ? '(请假' + scope.row.leaveDays + '天 - ' + leaveTypeName[scope.row.leaveType] + ')' : '(请假' + scope.row.leaveTimes + 'h - ' + leaveTypeName[scope.row.leaveType] + ')') : scope.row.label}}</span> -->
  823. <span>{{(scope.row.leaveDays || scope.row.leaveTimes) ? scope.row.label + (scope.row.leaveDays ? '(' + leaveTypeName[scope.row.leaveType] + ')' : '(' + leaveTypeName[scope.row.leaveType] + ')') : scope.row.label}}</span>
  824. </template>
  825. </el-table-column>
  826. <el-table-column prop="deptName" label="部门" >
  827. </el-table-column>
  828. </el-table>
  829. </el-tab-pane>
  830. </el-tabs>
  831. <el-table :show-header="true" :data="fillMembList" highlight-current-row :height="400" style="width: 100%;" @selection-change="notifySel" v-else>
  832. <el-table-column type="selection"></el-table-column>
  833. <el-table-column prop="label" label="姓名" ></el-table-column>
  834. <el-table-column prop="deptName" label="部门" >
  835. </el-table-column>
  836. </el-table>
  837. <div slot="footer" class="dialog-footer" v-if="!(isLeave == 1 && !isFill)">
  838. <el-button type="primary" @click="Notify(0)" v-if="!isFill && this.user.corpwxUserid" :disabled="fillMembList == 0">企业微信催填</el-button>
  839. <el-button type="primary" @click="Notify(1)" v-if="!isFill && !this.user.corpwxUserid && this.user.dingdingUserid" :disabled="fillMembList == 0">钉钉催填</el-button>
  840. <el-button type="primary" @click="Notify(2)" v-if="!isFill && !this.user.corpwxUserid && !this.user.dingdingUserid" :disabled="fillMembList == 0">微信催填</el-button>
  841. <el-button type="default" @click="exportMemb" :disabled="fillMembList == 0">导出</el-button>
  842. </div>
  843. </el-dialog>
  844. <!-- 按部门选择人员 -->
  845. <el-dialog title="选择需要代填报的人员" v-if="chooseParticipVisible" :visible.sync="chooseParticipVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  846. <el-input style="width:100%" v-model="deptMembDataText" placeholder="请输入姓名搜索"></el-input>
  847. <div class="tree" style="height:400px">
  848. <el-scrollbar style="height:100%">
  849. <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
  850. ref="chooseMembTree" @check-change="onTreeItemChange" :default-checked-keys="workForm.userId"
  851. highlight-current :filter-node-method="filterNode"></el-tree>
  852. </el-scrollbar>
  853. </div>
  854. <div>已选中&nbsp;{{chosenMembCount}}&nbsp;人</div>
  855. <div slot="footer" class="dialog-footer">
  856. <el-button @click="chooseParticipVisible = false" >取消</el-button>
  857. <el-button type="primary" @click="chooseParticip()" >确定</el-button>
  858. </div>
  859. </el-dialog>
  860. <el-dialog
  861. v-if="monthWorkTimeDialog"
  862. :visible.sync="monthWorkTimeDialog"
  863. :close-on-click-modal="false"
  864. customClass="customWidth selectworktime"
  865. width="63%"
  866. title=""
  867. >
  868. <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
  869. <el-tabs v-model="activeName" @tab-click="handleClick">
  870. <el-tab-pane label="已填工时情况" name="first">
  871. <div class="selectworktime_export" style="margin-top:10px;">
  872. <div class="selectworktime_export_l">
  873. <el-date-picker
  874. class="selecteworktime_datapick"
  875. v-model="WorktimeDatepickValue"
  876. value-format="yyyy-MM-dd"
  877. type="daterange"
  878. align="right"
  879. unlink-panels
  880. range-separator="至"
  881. start-placeholder="开始日期"
  882. end-placeholder="结束日期"
  883. :default-time="['12:00:00', '12:00:00']"
  884. size="small"
  885. popper-class="selecteorktime_datapick_popper"
  886. @change="showMonthWorkTime()"
  887. >
  888. </el-date-picker>
  889. <el-button size="small" @click="getDoubleLastWeek(1)">上上周</el-button>
  890. <el-button size="small" @click="getLastWeek(1)">上周</el-button>
  891. <el-button size="small" @click="getThisWeek(1)">本周</el-button>
  892. <!-- 222 -->
  893. </div>
  894. <div>
  895. <el-input style="float:left;width:22%" v-model="searchKeyword" class="input-with-select" placeholder="请输入人员搜索" clearable="true" size="small">
  896. <el-button slot="append" @click="searchScreen(0)" icon="el-icon-search"></el-button>
  897. </el-input>
  898. </div>
  899. <el-link
  900. type="primary"
  901. style="float: right; vertical-align: middle;height:32px"
  902. @click="exportMembWorkHours()"
  903. >导出数据</el-link
  904. >
  905. </div>
  906. <el-table ref="hasworkTbl"
  907. :data="monthWorkDataS"
  908. v-el-table-infinite-scroll="listScroll"
  909. border
  910. :height="500"
  911. highlight-current-row
  912. style="width: 100%"
  913. v-loading="tbload"
  914. :lazy="true"
  915. >
  916. <el-table-column width="75" type="index" fixed="left" label="序号">
  917. <template slot-scope="scope">
  918. {{ scope.$index + 1 }}
  919. </template>
  920. </el-table-column>
  921. <el-table-column width="105" prop="name" fixed="left" label="姓名">
  922. <template slot-scope="scope">
  923. <span :style="scope.row.worktimeList.length==0?'color:red':''">{{scope.row.name}}</span>
  924. </template>
  925. </el-table-column>
  926. <el-table-column prop="departmentName" fixed="left" label="部门">
  927. </el-table-column>
  928. <el-table-column
  929. min-width="105"
  930. v-for="(item, index) in pickDateArray"
  931. :key="index"
  932. :label="item.label"
  933. align="center"
  934. >
  935. <template slot-scope="scope">
  936. <div
  937. style="color: red"
  938. v-if="
  939. scope.row.worktimeList.filter(
  940. (w) =>
  941. w.createDate==item.date
  942. ).length > 0 &&
  943. scope.row.worktimeList.filter(
  944. (w) =>w.createDate==item.date
  945. )[0].workingTime < reportTimeType.allday
  946. "
  947. >
  948. {{
  949. scope.row.worktimeList.filter(
  950. (w) =>w.createDate==item.date
  951. )[0].workingTime.toFixed(1)
  952. }}
  953. </div>
  954. <div
  955. style="color: #20a0ff"
  956. v-if="
  957. scope.row.worktimeList.filter(
  958. (w) =>w.createDate==item.date
  959. ).length > 0 &&
  960. scope.row.worktimeList.filter(
  961. (w) =>w.createDate==item.date
  962. )[0].workingTime > reportTimeType.allday
  963. "
  964. >
  965. {{
  966. scope.row.worktimeList.filter(
  967. (w) =>w.createDate==item.date
  968. )[0].workingTime.toFixed(1)
  969. }}
  970. </div>
  971. <div
  972. v-if="
  973. scope.row.worktimeList.filter(
  974. (w) =>w.createDate==item.date
  975. ).length > 0 &&
  976. scope.row.worktimeList.filter(
  977. (w) =>w.createDate==item.date
  978. )[0].workingTime == reportTimeType.allday
  979. "
  980. >
  981. {{
  982. scope.row.worktimeList.filter(
  983. (w) =>w.createDate==item.date
  984. )[0].workingTime
  985. }}
  986. </div>
  987. <div
  988. v-if="
  989. scope.row.worktimeList.filter(
  990. (w) =>w.createDate==item.date
  991. ).length == 0
  992. "
  993. >
  994. 0
  995. </div>
  996. <div
  997. v-if="
  998. scope.row.worktimeList.filter(
  999. (w) =>w.createDate==item.date
  1000. ).length > 0 &&
  1001. typeof scope.row.worktimeList.filter(
  1002. (w) =>w.createDate==item.date
  1003. )[0].workingTime == 'string'
  1004. "
  1005. >
  1006. {{
  1007. scope.row.worktimeList.filter(
  1008. (w) =>w.createDate==item.date
  1009. )[0].workingTime
  1010. }}
  1011. </div>
  1012. </template>
  1013. </el-table-column>
  1014. </el-table>
  1015. <el-alert style="position:absolute;bottom:0;z-index:10;" v-if="isFlag" title="加载中..." type="success" center :closable="false" show-icon></el-alert>
  1016. <el-alert style="position:absolute;bottom:0;z-index:10;" v-if="isMore" title="无更多数据" type="warning" center show-icon></el-alert>
  1017. <!-- <div slot="title" class="dialog-title selectworktime_title">
  1018. <label style="font-size: 16px">员工每日已填报工时数</label>
  1019. <el-link
  1020. type="primary"
  1021. style="float: right; margin-right: 60px"
  1022. @click="exportMembWorkHours()"
  1023. >导出已填报数据</el-link
  1024. > -->
  1025. <!-- <el-button >导出</el-button> -->
  1026. <!-- </div> -->
  1027. </el-tab-pane>
  1028. <el-tab-pane label="未填人员列表" name="second" >
  1029. <div class="selectworktime_export" style="margin-top:10px">
  1030. <div class="selectworktime_export_l">
  1031. <el-date-picker
  1032. class="selecteworktime_datapick"
  1033. v-model="WorktimeDatepickValue"
  1034. value-format="yyyy-MM-dd"
  1035. type="daterange"
  1036. align="right"
  1037. unlink-panels
  1038. range-separator="至"
  1039. start-placeholder="开始日期"
  1040. end-placeholder="结束日期"
  1041. :default-time="['12:00:00', '12:00:00']"
  1042. size="small"
  1043. popper-class="selecteorktime_datapick_popper"
  1044. @change="showMonthNotWorkTime()"
  1045. >
  1046. </el-date-picker>
  1047. <el-button size="small" @click="getDoubleLastWeek()">上上周</el-button>
  1048. <el-button size="small" @click="getLastWeek()">上周</el-button>
  1049. <el-button size="small" @click="getThisWeek()">本周</el-button>
  1050. </div>
  1051. <div>
  1052. <el-input style="float:left;width:22%" v-model="searchKeyword" class="input-with-select" placeholder="请输入人员搜索" clearable="true" size="small">
  1053. <el-button slot="append" @click="searchScreen(1)" icon="el-icon-search"></el-button>
  1054. </el-input>
  1055. </div>
  1056. <el-link
  1057. type="primary"
  1058. style="float: right; vertical-align: middle;height:32px"
  1059. @click="exportMembNotWorkHours()"
  1060. >导出数据</el-link
  1061. >
  1062. </div>
  1063. <el-table
  1064. ref="hasworkTbl2"
  1065. :data="monthNotWorkDateS"
  1066. v-el-table-infinite-scroll="notListScroll"
  1067. border
  1068. :height="500"
  1069. highlight-current-row
  1070. style="width: 100%"
  1071. v-loading="tbload"
  1072. lazy
  1073. >
  1074. <el-table-column min-width="150" label="部门" prop="department">
  1075. </el-table-column>
  1076. <el-table-column min-width="150" prop="name" label="姓名" >
  1077. </el-table-column>
  1078. <el-table-column
  1079. min-width="200"
  1080. label="未填日期"
  1081. align="center"
  1082. prop="createDate"
  1083. >
  1084. </el-table-column>
  1085. <el-table-column
  1086. min-width="200"
  1087. label="考勤数据"
  1088. prop="cardTime"
  1089. align="center"
  1090. v-if="user.timeType.syncCorpwxTime == 1"></el-table-column>
  1091. </el-table>
  1092. <el-alert style="position:absolute;bottom:0;z-index:10;" v-if="isFlag" title="加载中..." type="success" center :closable="false" show-icon></el-alert>
  1093. <el-alert style="position:absolute;bottom:0;z-index:10;" v-if="isMore" title="无更多数据" type="success" center show-icon></el-alert>
  1094. </el-tab-pane>
  1095. </el-tabs>
  1096. </el-dialog>
  1097. <!--驳回弹出框 -->
  1098. <el-dialog title="请输入原因" v-if="denyReasonDialog" :visible.sync="denyReasonDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  1099. <div>
  1100. <el-input type="textarea" v-model="denyForm.reason" rows="2" :placeholder="'请输入您决定'+(denyForm.i==0?'驳回':'撤销')+'的原因'" />
  1101. </div>
  1102. <div slot="footer" class="dialog-footer">
  1103. <el-button @click="denyReasonDialog = false" >取消</el-button>
  1104. <el-button type="primary" @click="deny()" >确定</el-button>
  1105. </div>
  1106. </el-dialog>
  1107. <!--批量导入日报 -->
  1108. <el-dialog title="工时批量导入" v-if="importDialog" :visible.sync="importDialog" customClass="customWidth" width="500px">
  1109. <p>1. 下载
  1110. <el-link type="primary" style="margin-left:5px;" :underline="false" href="./upload/员工工时统计模板2.xlsx" download="员工工时导入模板.xlsx">员工工时统计模板.xlsx</el-link>
  1111. </p>
  1112. <p>2. 填写excel模板,请确保模板中的项目和人员已添加到系统中。</p>
  1113. <p style="display: flex;justify-content: center;">
  1114. <el-upload ref="upload" action="#" :limit="1" :http-request="batchImportData" :show-file-list="false">
  1115. <el-button type="primary" :underline="false" :loading="importingData">开始导入</el-button>
  1116. </el-upload>
  1117. </p>
  1118. <div style="display: flex;justify-content: end;padding-bottom: 1em;">
  1119. <el-link type="primary" @click="toView()">查看工时导入记录</el-link>
  1120. </div>
  1121. </el-dialog>
  1122. <!-- 工时导入记录弹窗 -->
  1123. <el-dialog title="工时导入记录" v-loading="toViewloading" :visible.sync="toViewDialogVisible" width="400" :before-close="handleClose">
  1124. <div style="height: 452px">
  1125. <el-table :data="toViewList" stripe style="width: 100%;" height="400" :loading="toViewLoading">
  1126. <el-table-column prop="indate" label="导入时间"> </el-table-column>
  1127. <el-table-column prop="userName" label="操作人"> </el-table-column>
  1128. <el-table-column prop="datel" label="文件">
  1129. <template slot-scope="scope">
  1130. <div>
  1131. <el-link type="primary" @click="addUpload(scope.row)">{{scope.row.fileName}}</el-link>
  1132. <!-- <el-link type="primary" :href="'http://localhost:10086/upload/'+ scope.row.serverName">{{scope.row.fileName}}</el-link> -->
  1133. </div>
  1134. </template>
  1135. </el-table-column>
  1136. </el-table>
  1137. <el-col :span="24" class="paginatis">
  1138. <el-pagination
  1139. @size-change="handleSizeChange"
  1140. @current-change="handleCurrentChange"
  1141. :page-sizes="[20 , 50 , 80 , 100]"
  1142. :page-size="20"
  1143. layout="total, sizes, prev, pager, next"
  1144. :total="toViewForm.total"
  1145. style="float:right;"
  1146. ></el-pagination>
  1147. </el-col>
  1148. </div>
  1149. </el-dialog>
  1150. <!--基于企业微信考勤数据的工时导入 -->
  1151. <el-dialog title="工时批量导入" v-if="importWxDialog" :visible.sync="importWxDialog" customClass="customWidth" width="1100px">
  1152. <el-steps :active="active" finish-status="success" style="margin-left:50px;">
  1153. <el-step title="选择要导入工时的日期范围">
  1154. </el-step>
  1155. <el-step title="下载带考勤数据的模板"></el-step>
  1156. <el-step title="填写模板,上传数据"></el-step>
  1157. </el-steps>
  1158. <div v-if="active==0" style="padding:30px;height:360px;">
  1159. <div style="margin-top:50px;margin-left:280px;">
  1160. <el-date-picker
  1161. v-model="importWxParam.date" :editable="false"
  1162. format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  1163. :clearable="true"
  1164. range-separator="至"
  1165. type="daterange"
  1166. start-placeholder="开始日期"
  1167. end-placeholder="结束日期"
  1168. @change="loadCheckInData"
  1169. ></el-date-picker>
  1170. </div>
  1171. </div>
  1172. <div v-if="active==1" style="padding:10px;">
  1173. <el-table border :data="checkinList" highlight-current-row v-loading="checkinLoading" :height="395"
  1174. style="width: 100%;margin-top:5px;" >
  1175. <el-table-column prop="hasPassed" label="审核状态" width="100px">
  1176. <template slot-scope="scope">
  1177. <span v-if="scope.row.hasPassed" style="color:green; margin-left:10px;">已审</span>
  1178. <span v-if="!scope.row.hasPassed" style="color:red; margin-left:10px;">未审</span>
  1179. </template>
  1180. </el-table-column>
  1181. <el-table-column prop="createDate" label="工作日期" >
  1182. </el-table-column>
  1183. <el-table-column prop="weekDayTxt" label="星期" ></el-table-column>
  1184. <el-table-column prop="username" label="员工姓名" ></el-table-column>
  1185. <el-table-column prop="startTime" label="上班时间" ></el-table-column>
  1186. <el-table-column prop="endTime" label="下班时间" ></el-table-column>
  1187. <el-table-column prop="workHours" label="实际工作时长" align="right">
  1188. <template slot-scope="scope">
  1189. {{scope.row.workHours.toFixed(1)}}h
  1190. </template>
  1191. </el-table-column>
  1192. </el-table>
  1193. </div>
  1194. <div v-if="active==2" >
  1195. <p style="display: flex;justify-content: center;height:390px;">
  1196. <el-upload style="margin-top:100px;" ref="upload" action="#" :limit="1" :http-request="batchImportWxData" :show-file-list="false">
  1197. <el-button type="primary" :underline="false" :loading="importingData">选择文件并上传</el-button>
  1198. </el-upload>
  1199. </p>
  1200. </div>
  1201. <div slot="title">
  1202. <span style="font-size:16px;">工时批量导入</span>
  1203. <el-link v-if="active==0" style="float:right;margin-right:100px;" type="primary" @click="toView()">查看工时导入记录</el-link>
  1204. </div>
  1205. <span slot="footer">
  1206. <el-link v-show="active==1" style="margin-right:300px;margin-top:10px;"
  1207. type="primary" @click="downloadCheckInExcel">下载员工工时统计模板.xlsx</el-link>
  1208. <el-button @click="pre" v-if="active!=0">上一步</el-button>
  1209. <el-button @click="next" :disabled="importWxParam.date==null" v-if="active<2">下一步</el-button>
  1210. </span>
  1211. </el-dialog>
  1212. <!--基于企业微信考勤数据的工时导入 -->
  1213. <el-dialog title="工时批量代填" v-if="batchSubFillDialog" :visible.sync="batchSubFillDialog" customClass="customWidth" width="90%">
  1214. <div>
  1215. <span>选择日期范围:</span><el-date-picker
  1216. v-model="importWxParam.date" :editable="false"
  1217. format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  1218. :clearable="true"
  1219. range-separator="至"
  1220. type="daterange"
  1221. start-placeholder="开始日期"
  1222. end-placeholder="结束日期"
  1223. @change="loadCheckInData"
  1224. ></el-date-picker>
  1225. <el-button style="float:right;" type="primary" @click="submitBatchSubFillData">提交</el-button>
  1226. </div>
  1227. <el-table border :data="checkinList" highlight-current-row v-loading="checkinLoading" :height="520"
  1228. :key="timeStamp"
  1229. style="width: 100%;margin-top:5px;" ref="tab">
  1230. <el-table-column prop="createDate" label="工作日期" width="100px" fixed="left"></el-table-column>
  1231. <el-table-column prop="username" label="员工姓名" width="80px" fixed="left"></el-table-column>
  1232. <el-table-column prop="startTime" label="上班时间" width="80px" fixed="left"></el-table-column>
  1233. <el-table-column prop="endTime" label="下班时间" width="80px" fixed="left"></el-table-column>
  1234. <el-table-column prop="workHours" label="工作时长" width="80px" align="right" fixed="left">
  1235. <template slot-scope="scope">
  1236. {{scope.row.workHours.toFixed(1)}}h
  1237. </template>
  1238. </el-table-column>
  1239. <!--项目名称列表 -->
  1240. <el-table-column v-for="(item, index) in projectColumns" :key="index" :label="item" min-width="150px">
  1241. <template slot-scope="scope">
  1242. <el-input v-model="scope.row[item]" style="width:60px;" @input="triggerTotalTime(scope.$index)"></el-input>&nbsp;h
  1243. </template>
  1244. </el-table-column>
  1245. <el-table-column prop="totalFillTime" label="总工时" fixed="right">
  1246. <template slot-scope="scope">
  1247. {{scope.row.totalFillTime==null?0.0:scope.row.totalFillTime}}&nbsp;h
  1248. </template>
  1249. </el-table-column>
  1250. </el-table>
  1251. </el-dialog>
  1252. <!--基于企业微信考勤数据的工时导入 -->
  1253. <el-dialog title="工时导入结果" v-if="showImportResult" :visible.sync="showImportResult" customClass="customWidth" width="500px">
  1254. <div>
  1255. <span>{{importResultMsg}}</span>
  1256. </div>
  1257. <span slot="footer" class="dialog-footer">
  1258. <el-button type="primary" @click="showImportResult=false">确定</el-button>
  1259. </span>
  1260. </el-dialog>
  1261. <!-- 审核流程展示 -->
  1262. <el-dialog title="审核流程" v-if="approvalProcessDialog" :visible.sync="approvalProcessDialog" customClass="customWidth" width="400px">
  1263. <div style="padding:20px 40px 20px 0">
  1264. <el-timeline :reverse="false">
  1265. <el-timeline-item v-for="item in approvalProcessData" :key="item.id" :timestamp="item.operateDate">{{item.msg}}</el-timeline-item>
  1266. </el-timeline>
  1267. </div>
  1268. </el-dialog>
  1269. </section>
  1270. </template>
  1271. <script>
  1272. // 左右滑动
  1273. import dragMixin from "@/common/js/tensile.js";
  1274. import util from "../../common/js/util";
  1275. export default {
  1276. mixins: [dragMixin],
  1277. data() {
  1278. return {
  1279. exportLoad: false,
  1280. getPickerOptions: {
  1281. disabledDate: (time) => {
  1282. var date = new Date();
  1283. var year = date.getFullYear();
  1284. var month = date.getMonth() + 1;
  1285. if (month >= 1 && month <= 9) {
  1286. month = "0" + month;
  1287. }
  1288. var currentdate = year.toString() + month.toString();
  1289. var timeyear = time.getFullYear();
  1290. var timemonth = time.getMonth() + 1;
  1291. if (timemonth >= 1 && timemonth <= 9) {
  1292. timemonth = "0" + timemonth;
  1293. }
  1294. var timedate = timeyear.toString() + timemonth.toString();
  1295. if(this.user.timeType.fillAhead == 0){
  1296. return currentdate < timedate;
  1297. }else{
  1298. return false
  1299. }
  1300. }
  1301. },
  1302. alalal: '8.0',
  1303. timeBasecostList:null,
  1304. tbload: false,
  1305. exportTimeDialog: false,
  1306. searchKeyword: '',
  1307. monthWorkDataS: [],
  1308. monthNotWorkDateS: [],
  1309. pickDateArray:[],
  1310. WorktimeDatepickValue: [],
  1311. activeName:"first",
  1312. isLeave: 0,
  1313. submitingReport: false,
  1314. importResultMsg:null,
  1315. showImportResult:false,
  1316. importingData: false,
  1317. isDraft: 0,
  1318. timeStamp: 0,
  1319. projectColumns:[],
  1320. checkinLoading:false,
  1321. importWxParam:{date:null,},
  1322. active:0,
  1323. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  1324. importWxDialog:false,
  1325. importDialog:false,
  1326. denyForm:null,
  1327. denyReasonDialog:false,
  1328. monthWorkTimeDialog: false,
  1329. isSubstitude:false,
  1330. isFill:false,
  1331. unFillList:[],
  1332. fillList:[],
  1333. fillMembList:[],
  1334. fillMembList_leave: [],
  1335. membListVisible: false,
  1336. isBatch:0,//是否是批量填报
  1337. editTitle: ['填写日报','批量填报','代填日报'],
  1338. weekDay : ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
  1339. statusStyle:["waiting", "filledReportStyle", "RejectStyle", "waitSubmitStyle"],
  1340. fillStatusList: [],
  1341. exportParam:{projectId: null, dateRange:[], departmentId: null},
  1342. exportDialog:false,
  1343. timeFields:['timeType', 'workingTime', 'startTime', 'progress'],
  1344. subProjectList:[],
  1345. canEdit: true,
  1346. timeRange:[0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0],
  1347. selectTime:null,
  1348. reportTimeType:{},
  1349. curDate:'',
  1350. isAllSelect: false,
  1351. approveDialogVisible:false,
  1352. deptId:null,
  1353. targetUid: null,
  1354. membCount:0,
  1355. selectState:"-1",
  1356. user: JSON.parse(sessionStorage.getItem("user")),
  1357. showAddMore:false,
  1358. allDate: [],
  1359. typeList:['全天','上午','下午'],
  1360. date: sessionStorage.msg?sessionStorage.msg.split('-')[0]+"-"+sessionStorage.msg.split('-')[1]:util.formatDate.format(new Date(new Date()), "yyyy-MM"),
  1361. choseDay: 0,
  1362. tableHeight: 0,
  1363. listLoading: false,
  1364. projectList: [], //项目列表
  1365. fillProjectList: [],
  1366. reportList: [], //日报列表
  1367. reportNames:[], //批量审批列表
  1368. selCon:[], //筛选条件
  1369. selProjectList:[], //筛选后项目列表
  1370. selConShow: true,
  1371. dialogVisible: false, //项目弹窗
  1372. report: '',
  1373. workForm: {
  1374. createDate: sessionStorage.msg?sessionStorage.msg:util.formatDate.format(new Date(new Date()), "yyyy-MM-dd"),
  1375. domains: [{
  1376. id: null,
  1377. projectId: "",
  1378. workingTime: "",
  1379. timeType:0,
  1380. content: "",
  1381. state: 2,
  1382. multiWorktime:0,
  1383. worktimeList:[],
  1384. degreeId: null,
  1385. }],
  1386. },
  1387. workRules: {
  1388. createDate: [{ required: true, message: "请选择工作日期", trigger: "change" }],
  1389. },
  1390. chooseParticipVisible: false,
  1391. logining: false,
  1392. isDisable: false,
  1393. timeType:[],
  1394. deptMembData: [
  1395. ],
  1396. //部门人员树状结构
  1397. data: [
  1398. {
  1399. id: -1,
  1400. label: '全部人员',
  1401. membCount:0
  1402. },
  1403. {
  1404. id: 0,
  1405. label: '未分配',
  1406. }
  1407. ],
  1408. allData:{},
  1409. batchShowData:{},
  1410. option: [],
  1411. depData: {
  1412. id: -1,
  1413. label: '全部人员',
  1414. },
  1415. defaultProps: {
  1416. children: 'children',
  1417. label: 'label'
  1418. },
  1419. isNew: false,
  1420. selected: false,
  1421. valuet: new Date(),
  1422. domObj: null,
  1423. participator:[],
  1424. chosenMembCount:0,
  1425. jsDay: 0,
  1426. jsTime: 0,
  1427. falsss: false,
  1428. weidu: [],
  1429. weiduList: [],
  1430. yonghuUser: [],
  1431. dateAr: [],
  1432. batchSubFillDialog: false,
  1433. isSubstiS: false,
  1434. diasZho: false,
  1435. zhoData: [],
  1436. zhoRqi: [],
  1437. btnZho: false,
  1438. zhoLoading: false,
  1439. changdu: 6,
  1440. tianxieDialogVisible: false,
  1441. scopess: {},
  1442. zhoBao: {
  1443. time: '',
  1444. workingTime: '',
  1445. progress: '',
  1446. con: '',
  1447. subProjectId: '',
  1448. stage: '',
  1449. subProjectList: [],
  1450. stages: [],
  1451. },
  1452. zhoBaoIdx: '',
  1453. zhoBaoName: '',
  1454. zhis: {},
  1455. dealList: [],
  1456. toViewDialogVisible: false,
  1457. toViewList: [],
  1458. toViewloading: true,
  1459. toViewForm: {
  1460. pageIndex: '1',
  1461. pageSize: '20',
  1462. total: 0,
  1463. },
  1464. toViewloadings: false,
  1465. tabPositionss: 'top',
  1466. monthTotal: 0,
  1467. monthTotalPage: 0,
  1468. monthTotalLages: 20,
  1469. monthWorkData: [],
  1470. monthNotWorkDate: [],
  1471. monthWorkDataS1: [],
  1472. monthnotTotal: 0,
  1473. monthnotTotalPage: 0,
  1474. monthnotTotalLages: 20,
  1475. monthNotWorkDateS1: [],
  1476. deptMembDataText: '',
  1477. isFlag: false,
  1478. isMore: false,
  1479. stateKey: '0',
  1480. expandDate: [],
  1481. notifySelList:[],
  1482. departmentList: [],
  1483. approvalProcessDialog: false,
  1484. approvalProcessData: [],
  1485. leaveTypeName: ['事假','病假','年假','产假','婚假','丧假','调休假','陪产假','其他',],
  1486. isWeekend: false,
  1487. canCancelInDialog: false
  1488. };
  1489. },
  1490. watch: {
  1491. deptMembDataText(val) {
  1492. this.$refs.chooseMembTree.filter(val);
  1493. }
  1494. },
  1495. filters: {
  1496. // 过滤
  1497. amounts(value) {
  1498. if(value == NaN || value == undefined || value == 'undefined' || value == null || value == 'null') {
  1499. return 0
  1500. }
  1501. var zhi = +value + 0
  1502. return zhi.toFixed(1)
  1503. },
  1504. // zhoData
  1505. zhoData(value) {
  1506. var dateArray = value.split("-");
  1507. var date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]);
  1508. return "周" + "日一二三四五六".charAt(date.getDay());
  1509. },
  1510. // 过滤数字
  1511. numbers(value) {
  1512. if(value == NaN || value == undefined || value == 'undefined' || value == null || value == 'null' || value <= 0) {
  1513. return 0
  1514. }
  1515. return value
  1516. },
  1517. },
  1518. methods: {
  1519. getApprovalProcess(item){
  1520. // console.log('this.date',this.choseDate);
  1521. this.http.post('/report-log/get',{
  1522. creatorId: item.id,
  1523. createDate: sessionStorage.msg
  1524. },res => {
  1525. if(res.code == 'ok'){
  1526. this.approvalProcessDialog = true
  1527. this.approvalProcessData = res.data
  1528. }else{
  1529. this.$message({
  1530. message: res.msg,
  1531. type: 'error'
  1532. })
  1533. }
  1534. },err => {
  1535. this.$message({
  1536. message: err,
  1537. type: 'error'
  1538. })
  1539. })
  1540. },
  1541. filterNode(value, data) {
  1542. if (!value) return true;
  1543. return data.label.indexOf(value) !== -1;
  1544. },
  1545. triggerCalculateOT(index) {
  1546. var str = this.workForm.domains[index].overtimeHours + ''
  1547. if(str.indexOf('.') != '-1') {
  1548. var s = str.split('.')[0]
  1549. var st = str.split('.')[1]
  1550. var sts = st.split('')
  1551. this.workForm.domains[index].overtimeHours = s + '.' + sts[0]
  1552. }
  1553. },
  1554. searchScreen(e){
  1555. if(e){
  1556. this.monthNotWorkDateS1 = []
  1557. for (let i = 0; i < this.monthNotWorkDate.length; i++) {
  1558. if(this.monthNotWorkDate[i].name.indexOf(this.searchKeyword) != -1){
  1559. this.monthNotWorkDateS1.push(this.monthNotWorkDate[i])
  1560. }
  1561. }
  1562. if (this.monthNotWorkDateS1.length > 50) {
  1563. this.monthNotWorkDateS = this.monthNotWorkDateS1.slice(0,50);
  1564. }else{
  1565. this.monthNotWorkDateS = this.monthNotWorkDateS1
  1566. }
  1567. // if (this.monthNotWorkDateS1.length > 0) {
  1568. // setTimeout(() => {
  1569. // this.tableListenernot()
  1570. // }, 1000);
  1571. // }
  1572. }else{
  1573. this.monthWorkDataS1 = []
  1574. for (let i = 0; i < this.monthWorkData.length; i++) {
  1575. if(this.monthWorkData[i].name.indexOf(this.searchKeyword) != -1){
  1576. this.monthWorkDataS1.push(this.monthWorkData[i])
  1577. }
  1578. }
  1579. if (this.monthWorkDataS1.length > 50) {
  1580. this.monthWorkDataS = this.monthWorkDataS1.slice(0,50);
  1581. }else{
  1582. this.monthWorkDataS = this.monthWorkDataS1
  1583. }
  1584. // if (this.monthWorkDataS1.length > 0) {
  1585. // setTimeout(() => {
  1586. // this.tableListener()
  1587. // }, 1000);
  1588. // }
  1589. }
  1590. },
  1591. addUpload(data) {
  1592. // var zhi = data.fileName.split('.')[0]
  1593. // var sss = zhi + '.xlsx'
  1594. // return
  1595. var filePath = '/upload/' + data.serverName;
  1596. const a = document.createElement('a'); // 创建a标签
  1597. a.setAttribute('download', data.fileName);// download属性
  1598. a.setAttribute('href', filePath);// href链接
  1599. a.click(); //自执行点击事件
  1600. a.remove();
  1601. },
  1602. restrictNumber(targetId) {
  1603. let inpu = document.getElementById(targetId).getElementsByTagName('input')[0];
  1604. inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
  1605. inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
  1606. inpu.value = inpu.value.replace(".", "$#*").replace(/\./g,'').replace('$#*','.');//去除其他"."
  1607. inpu.value = inpu.value.replace(/^(\d+)\.(\d\d).*$/, '$1.$2');;//限制只能输入两个小数
  1608. if (inpu.value.indexOf(".") < 0 && inpu.value != "") { //首位是0的话去掉
  1609. inpu.value = parseFloat(inpu.value);
  1610. }
  1611. },
  1612. //获取项目下的任务分组
  1613. getTaskGroups(domain, index) {
  1614. domain.groupId=null;
  1615. this.http.post('/task-group/listMyJoinGroup',{
  1616. projectId: domain.projectId
  1617. },
  1618. res => {
  1619. if (res.code == "ok") {
  1620. this.workForm.domains[index].taskGroups = res.data;
  1621. this.$forceUpdate();
  1622. }
  1623. },
  1624. error => {
  1625. this.$message({
  1626. message: error,
  1627. type: "error"
  1628. });
  1629. }
  1630. );
  1631. },
  1632. //下载带企业微信考勤数据的工时统计模板
  1633. downloadCheckInExcel() {
  1634. this.http.post('/user-corpwx-time/exportCheckInExcel',{
  1635. startDate: this.importWxParam.date[0],
  1636. endDate: this.importWxParam.date[1],
  1637. },
  1638. res => {
  1639. if (res.code == "ok") {
  1640. var filePath = res.data;
  1641. const a = document.createElement('a'); // 创建a标签
  1642. var data = filePath.split("/");
  1643. a.setAttribute('download', data[data.length-1]);// download属性
  1644. a.setAttribute('href', filePath);// href链接
  1645. a.click(); //自执行点击事件
  1646. a.remove();
  1647. } else {
  1648. this.$message({
  1649. message: res.msg,
  1650. type: "error"
  1651. });
  1652. }
  1653. },
  1654. error => {
  1655. this.checkinLoading = false;
  1656. this.$message({
  1657. message: error,
  1658. type: "error"
  1659. });
  1660. }
  1661. );
  1662. },
  1663. pre() {
  1664. if (this.active == 0) return;
  1665. this.active--;
  1666. },
  1667. next() {
  1668. this.active++;
  1669. },
  1670. triggerTotalTime(index) {
  1671. var item = this.checkinList[index];
  1672. var total = 0.0;
  1673. for (var i=0;i<this.projectColumns.length; i++) {
  1674. var key = this.projectColumns[i];
  1675. if (item[key] != null && item[key] != '') {
  1676. total += parseFloat(item[key]);
  1677. }
  1678. }
  1679. item.totalFillTime = total;
  1680. },
  1681. //提交批量代填的数据
  1682. submitBatchSubFillData() {
  1683. var data = JSON.stringify(this.checkinList);
  1684. this.http.post('/user-corpwx-time/submitProjectTime',{
  1685. json: data,
  1686. projectColumns: JSON.stringify(this.projectColumns)
  1687. },
  1688. res => {
  1689. if (res.code == "ok") {
  1690. this.$message({message:'提交成功', type:'success'});
  1691. this.importWxDialog = false;
  1692. }
  1693. },
  1694. error => {
  1695. this.checkinLoading = false;
  1696. this.$message({
  1697. message: error,
  1698. type: "error"
  1699. });
  1700. }
  1701. );
  1702. },
  1703. loadCheckInData() {
  1704. if (this.importWxParam.date == null) {
  1705. this.checkinList = [];
  1706. return;
  1707. }
  1708. this.checkinLoading = true;
  1709. this.http.post('/user-corpwx-time/getMyDeptMembsData',{
  1710. startDate: this.importWxParam.date[0],
  1711. endDate: this.importWxParam.date[1],
  1712. },
  1713. res => {
  1714. if (res.code == "ok") {
  1715. this.checkinLoading = false;
  1716. this.checkinList = res.data.list;
  1717. this.projectColumns = res.data.projects;
  1718. // 自定义表格会导致表格错乱,需重新计算表格
  1719. this.$nextTick(()=>{
  1720. this.$refs.tab.doLayout()
  1721. })
  1722. }
  1723. },
  1724. error => {
  1725. this.checkinLoading = false;
  1726. this.$message({
  1727. message: error,
  1728. type: "error"
  1729. });
  1730. }
  1731. );
  1732. },
  1733. batchImportWxData(item) {
  1734. //首先判断文件类型
  1735. let str = item.file.name.split(".");
  1736. let format = str[str.length - 1];
  1737. if (format != "xls" && format != "xlsx") {
  1738. this.$message({
  1739. message: "请选择.xls或.xlsx文件",
  1740. type: "error"
  1741. });
  1742. } else {
  1743. this.importingData = true;
  1744. let formData = new FormData();
  1745. formData.append("file", item.file);
  1746. formData.append("companyId", this.user.companyId);
  1747. formData.append("withCheckIn", 1);
  1748. this.http.uploadFile('/report/importData', formData,
  1749. res => {
  1750. this.$refs.upload.clearFiles();
  1751. this.showImportResult = true;
  1752. this.importingData = false;
  1753. if (res.code == "ok") {
  1754. //换成弹出框,以免有人等了半天回来啥也没看到
  1755. this.importResultMsg = "导入成功:成功导入"+res.data+"条工时数据。"+(res.msg?res.msg:"");
  1756. this.getReportList();
  1757. this.importWxDialog = false;
  1758. } else {
  1759. this.importResultMsg = "导入失败:"+res.msg;
  1760. }
  1761. },
  1762. error => {
  1763. this.$refs.upload.clearFiles();
  1764. this.listLoading = false;
  1765. this.$message({
  1766. message: error,
  1767. type: "error"
  1768. });
  1769. });
  1770. }
  1771. },
  1772. batchImportData(item) {
  1773. //首先判断文件类型
  1774. let str = item.file.name.split(".");
  1775. let format = str[str.length - 1];
  1776. if (format != "xls" && format != "xlsx") {
  1777. this.$message({
  1778. message: "请选择.xls或.xlsx文件",
  1779. type: "error"
  1780. });
  1781. } else {
  1782. this.importingData = true;
  1783. let formData = new FormData();
  1784. formData.append("file", item.file);
  1785. formData.append("companyId", this.user.companyId);
  1786. this.http.uploadFile('/report/importData', formData,
  1787. res => {
  1788. this.$refs.upload.clearFiles();
  1789. this.importingData = false;
  1790. this.showImportResult = true;
  1791. if (res.code == "ok") {
  1792. //换成弹出框,以免有人等了半天回来啥也没看到
  1793. this.importResultMsg = "成功导入"+res.data+"条工时数据。"+(res.msg?res.msg:"");;
  1794. this.getReportList();
  1795. this.importWXDialog = false;
  1796. } else {
  1797. this.importResultMsg = "导入失败:"+res.msg;
  1798. }
  1799. },
  1800. error => {
  1801. this.$refs.upload.clearFiles();
  1802. this.importingData = false;
  1803. this.$message({
  1804. message: error,
  1805. type: "error"
  1806. });
  1807. });
  1808. }
  1809. },
  1810. userssHu() {
  1811. this.http.post('/time-type/getCompanyTimeSetting',{
  1812. companyId: this.user.companyId
  1813. },
  1814. res => {
  1815. if (res.code == "ok") {
  1816. this.yonghuUser = res.data
  1817. }
  1818. },
  1819. error => {
  1820. this.$message({
  1821. message: error,
  1822. type: "error"
  1823. });
  1824. }
  1825. );
  1826. },
  1827. iptBlur(i) {
  1828. if(this.isBatch == 0) {
  1829. return
  1830. }
  1831. this.http.post('/report/getWorkDays',{
  1832. startDate: this.workForm.createDate[0],
  1833. endDate: this.workForm.createDate[1]
  1834. },
  1835. res => {
  1836. if (res.code == "ok") {
  1837. this.jsDay = res.data
  1838. this.chuji(i)
  1839. } else {
  1840. this.$message({
  1841. message: res.msg,
  1842. type: "error"
  1843. });
  1844. this.workForm.createDate = [];
  1845. }
  1846. },
  1847. error => {
  1848. this.$message({
  1849. message: error,
  1850. type: "error"
  1851. });
  1852. }
  1853. );
  1854. var sl = this.workForm.domains
  1855. this.chuji(i)
  1856. },
  1857. chuji(i) {
  1858. if(i == 0) {
  1859. this.seleChn(1)
  1860. } else if(i == 1) {
  1861. this.seleChn(0)
  1862. } else if(i == 2) {
  1863. if(this.workForm.domains[0].multiWorktime > 0) {
  1864. this.iptChangs()
  1865. } else {
  1866. this.iptChang()
  1867. }
  1868. } else if(i == 3) {
  1869. this.seleChn(0)
  1870. }
  1871. },
  1872. seleChn(e,domain) {
  1873. if(e == 1) {
  1874. for(var i in this.workForm.domains) {
  1875. if(this.workForm.domains[i].timeType == 0) {
  1876. this.workForm.domains[i].workingTime = 8
  1877. } else {
  1878. this.workForm.domains[i].workingTime = 4
  1879. }
  1880. }
  1881. }
  1882. var quanbu = 0
  1883. var spl = this.workForm.domains
  1884. var zhi = ''
  1885. for(var i in spl) {
  1886. var sp = +spl[i].workingTime + 0
  1887. zhi = this.jsDay * sp
  1888. quanbu = +quanbu + zhi
  1889. }
  1890. this.jsTime = quanbu
  1891. let worktime = this.jsTime
  1892. // 自动计算加班时长
  1893. if(this.isBatch != 0){
  1894. worktime = this.jsTime / this.jsDay
  1895. }
  1896. if(this.user.timeType.fillOvertime && domain){
  1897. let isover = false
  1898. let alltime = 0
  1899. let allover = 0 //此处alltime同上面的worktime
  1900. for(let d in spl){
  1901. if(spl[d].isOvertime){
  1902. isover = true
  1903. allover += spl[d].overtimeHours*1
  1904. }
  1905. alltime += spl[d].workingTime*1
  1906. }
  1907. if(domain.overtimeHours){
  1908. allover = allover - domain.overtimeHours
  1909. }
  1910. if(worktime*1 > this.user.timeType.allday){
  1911. if(isover){
  1912. if(alltime > (allover + this.user.timeType.allday)){
  1913. this.$set(domain,'isOvertime',true)
  1914. this.$set(domain,'overtimeHours',worktime - this.user.timeType.allday - allover)
  1915. }else{
  1916. this.$set(domain,'isOvertime',false)
  1917. this.$set(domain,'overtimeHours',null)
  1918. if(alltime < (allover + this.user.timeType.allday)){
  1919. let overtime = allover + this.user.timeType.allday - alltime
  1920. for(let pi in spl){
  1921. if(spl[pi].overtimeHours){
  1922. if((overtime - spl[pi].overtimeHours*1) > 0){
  1923. overtime = overtime - spl[pi].overtimeHours*1
  1924. this.$set(spl[pi],'isOvertime',false)
  1925. this.$set(spl[pi],'overtimeHours',null)
  1926. }else if((overtime - spl[pi].overtimeHours*1) < 0){
  1927. this.$set(spl[pi],'overtimeHours',spl[pi].overtimeHours*1 - overtime)
  1928. break
  1929. }else{
  1930. this.$set(spl[pi],'isOvertime',false)
  1931. this.$set(spl[pi],'overtimeHours',null)
  1932. break
  1933. }
  1934. }
  1935. }
  1936. }
  1937. }
  1938. }else{
  1939. this.$set(domain,'isOvertime',true)
  1940. this.$set(domain,'overtimeHours',worktime - this.user.timeType.allday)
  1941. }
  1942. }else{
  1943. for(let di in spl){
  1944. this.$set(spl[di],'isOvertime',false)
  1945. this.$set(spl[di],'overtimeHours',null)
  1946. }
  1947. }
  1948. }
  1949. },
  1950. iptChang() {
  1951. var sl = this.workForm.domains
  1952. var quanbu = 0
  1953. var zhi = ''
  1954. for(var i in sl) {
  1955. if(sl[i].startTime && sl[i].endTime) {
  1956. var date2 = '2021/12/12 ' + sl[i].endTime +':00'
  1957. var date1 = '2021/12/12 ' + sl[i].startTime +':00'
  1958. var date3 = new Date(date2).getTime() - new Date(date1).getTime();
  1959. var leave1=date3%(24*3600*1000)
  1960. var hours=Math.floor(leave1/(3600*1000))
  1961. var leave2=leave1%(3600*1000)
  1962. var minutes=Math.floor(leave2/(60*1000))
  1963. var shi = hours+'.'+ minutes
  1964. var sll = +shi + 0
  1965. zhi = this.jsDay * sll
  1966. quanbu = +quanbu + zhi
  1967. }
  1968. }
  1969. this.jsTime = quanbu
  1970. },
  1971. iptChangs() {
  1972. var sl = this.workForm.domains
  1973. var quanbu = 0
  1974. var zhi = ''
  1975. for(var i in sl) {
  1976. for(var j in sl[i].worktimeList){
  1977. if(sl[i].worktimeList[j].startTime && sl[i].worktimeList[j].endTime) {
  1978. var date2 = '2021/12/12 ' + sl[i].worktimeList[j].endTime +':00'
  1979. var date1 = '2021/12/12 ' + sl[i].worktimeList[j].startTime +':00'
  1980. var date3 = new Date(date2).getTime() - new Date(date1).getTime();
  1981. var leave1=date3%(24*3600*1000)
  1982. var hours=Math.floor(leave1/(3600*1000))
  1983. var leave2=leave1%(3600*1000)
  1984. var minutes=Math.floor(leave2/(60*1000))
  1985. var shi = hours+'.'+ minutes
  1986. var sll = +shi + 0
  1987. zhi = this.jsDay * sll
  1988. quanbu = +quanbu + zhi
  1989. }
  1990. }
  1991. }
  1992. this.jsTime = quanbu
  1993. },
  1994. removeTimeItem(item, index) {
  1995. item.worktimeList.splice(index, 1);
  1996. this.iptChangs()
  1997. },
  1998. //添加工时
  1999. addNewWorktime(index, item) {
  2000. if(item.worktimeList == null ) {
  2001. item.worktimeList = []
  2002. }
  2003. item.worktimeList.push({});
  2004. },
  2005. //复制项目
  2006. copyProject(index) {
  2007. var leftProgress = 10;
  2008. if (this.reportTimeType.type == 3) {
  2009. //计算已经待分配工时比例
  2010. let array = this.workForm.domains;
  2011. let totalProgress = 0;
  2012. for (var i=0;i<array.length; i++) {
  2013. totalProgress += array[i].progress;
  2014. }
  2015. if (totalProgress < 100) {
  2016. leftProgress = 100 - totalProgress;
  2017. }
  2018. }
  2019. var newIndex = index+1;
  2020. var itemDomain = {
  2021. projectId: this.workForm.domains[index].projectId,
  2022. workingTime: this.reportTimeType.type == 3?(leftProgress*this.reportTimeType.allday/100).toFixed(1):"",
  2023. content: "",
  2024. progress:leftProgress,
  2025. state:2,//2-表示待提交
  2026. };
  2027. this.workForm.domains.splice(newIndex, 0,itemDomain);
  2028. if (this.reportTimeType.type == 0) {
  2029. //全天上下午模式下,检测时间段数量,达到2个,不能再加了
  2030. var length = this.workForm.domains.length;
  2031. if (length == 2) {
  2032. this.showAddMore = false;
  2033. }
  2034. }
  2035. this.selectProject(itemDomain, newIndex);
  2036. },
  2037. showWorkTime(){
  2038. this.monthWorkTimeDialog = true;
  2039. this.searchKeyword = ''
  2040. this.WorktimeDatepickValue = this.istoMonth()
  2041. if(this.WorktimeDatepickValue.length == 0){
  2042. let newdate = new Date();
  2043. let nowdate = newdate.toLocaleDateString();
  2044. let getauto = this.getAutoWeekDate(nowdate)
  2045. let nowwd = [getauto[0],getauto[6]]
  2046. this.WorktimeDatepickValue = nowwd
  2047. }
  2048. this.showMonthWorkTime()
  2049. },
  2050. handleClick(t,e){
  2051. if (t.name == "first") {
  2052. this.showMonthWorkTime()
  2053. }else{
  2054. this.showMonthNotWorkTime()
  2055. }
  2056. },
  2057. //导出员工每日填报工时数
  2058. exportMembWorkHours() {
  2059. this.http.post(
  2060. "/report/exportUserDailyWorkTime",
  2061. {
  2062. // month: this.date,
  2063. startDate: this.WorktimeDatepickValue[0],
  2064. endDate: this.WorktimeDatepickValue[1],
  2065. },
  2066. (res) => {
  2067. if (res.code == "ok") {
  2068. let url = res.data;
  2069. this.downloadByA("人员每日工时统计.xls", url);
  2070. }
  2071. },
  2072. (error) => {
  2073. this.$message({
  2074. message: error,
  2075. type: "error",
  2076. });
  2077. }
  2078. );
  2079. },
  2080. exportMembNotWorkHours() {
  2081. this.http.post(
  2082. "/report/exportNoReportUserList",
  2083. {
  2084. // month: this.date,
  2085. startDate: this.WorktimeDatepickValue[0],
  2086. endDate: this.WorktimeDatepickValue[1],
  2087. },
  2088. (res) => {
  2089. if (res.code == "ok") {
  2090. let url = res.data;
  2091. this.downloadByA("人员每日工时统计.xls", url);
  2092. }
  2093. },
  2094. (error) => {
  2095. this.$message({
  2096. message: error,
  2097. type: "error",
  2098. });
  2099. }
  2100. );
  2101. },
  2102. downloadByA(name, url) {
  2103. const a = document.createElement("a"); // 创建a标签
  2104. a.setAttribute("download", name); // download属性
  2105. a.setAttribute("href", url); // href链接
  2106. a.click(); // 自执行点击事件
  2107. a.remove();
  2108. },
  2109. // 是否本月判断
  2110. istoMonth(){
  2111. let todate = new Date()
  2112. let tomonth = todate.getMonth() + 1
  2113. let adate = todate.getFullYear() + '-' + (tomonth < 10 ? '0' + tomonth : tomonth)
  2114. if(this.date == adate){
  2115. return []
  2116. }else{
  2117. let sedate = new Date(this.date)
  2118. let semonth = sedate.getMonth() + 1
  2119. let seday = new Date(sedate.getFullYear(), semonth, 0).getDate()
  2120. let sedates1 = sedate.getFullYear() + '-' + (semonth < 10 ? '0' + semonth : semonth) + '-01'
  2121. let sedates2 = sedate.getFullYear() + '-' + (semonth < 10 ? '0' + semonth : semonth) + '-' + seday
  2122. return [sedates1, sedates2]
  2123. }
  2124. },
  2125. showMonthWorkTime() {
  2126. this.monthTotalPage = 0,
  2127. this.tbload = true
  2128. this.http.post(
  2129. "/report/getUserDailyWorkTime",
  2130. // "/report/getNoReportUserList",
  2131. {
  2132. // month: this.date,
  2133. startDate: this.WorktimeDatepickValue[0],
  2134. endDate: this.WorktimeDatepickValue[1],
  2135. },
  2136. (res) => {
  2137. if (res.code == "ok") {
  2138. this.tbload = false;
  2139. this.pickDateArray = res.data.days;
  2140. // console.log('dataarray',res.data.days);
  2141. this.monthWorkData = res.data.list;
  2142. // this.monthWorkDataS = this.monthWorkData
  2143. // this.monthWorkDataS1 = res.data.list
  2144. this.monthTotal = res.data.list.length
  2145. if (this.monthWorkData.length > 50) {
  2146. this.monthWorkDataS = this.monthWorkData.slice(0,50);
  2147. }else{
  2148. this.monthWorkDataS = this.monthWorkData
  2149. }
  2150. this.searchScreen(0)
  2151. // this.monthWorkDataS = infoList
  2152. // 判断
  2153. // if (this.monthWorkDataS1.length > 0) {
  2154. // setTimeout(() => {
  2155. // this.tableListener()
  2156. // }, 1000);
  2157. // }
  2158. this.$nextTick(function(){
  2159. this.$refs.hasworkTbl.doLayout();
  2160. });
  2161. // this.$forceUpdate()
  2162. }
  2163. },
  2164. (error) => {
  2165. this.tbload = false
  2166. this.$message({
  2167. message: error,
  2168. type: "error",
  2169. });
  2170. }
  2171. );
  2172. },
  2173. // tableListener(){
  2174. // let that = this;
  2175. // let dom = that.$refs.hasworkTbl.bodyWrapper;
  2176. // // 添加scroll监听事件
  2177. // dom.addEventListener("scroll", function () {
  2178. // const scrollDistance = dom.scrollHeight - dom.scrollTop - dom.clientHeight;
  2179. // if (scrollDistance < 2) {
  2180. // if (that.monthWorkDataS.length < that.monthWorkDataS1.length) {
  2181. // that.monthTotalPage++; //当前页数自增
  2182. // console.log(that.monthWorkDataS1.length, that.monthWorkDataS.length, that.monthTotalPage, that.monthTotalLages, that.monthTotalPage * that.monthTotalLages)
  2183. // var arrList = JSON.parse(JSON.stringify(that.monthWorkDataS1))
  2184. // var infoList = arrList.splice(
  2185. // that.monthTotalPage * that.monthTotalLages,
  2186. // that.monthTotalLages
  2187. // );
  2188. // // 数据添加
  2189. // that.monthWorkDataS = that.monthWorkDataS.concat(infoList);
  2190. // }
  2191. // }
  2192. // })
  2193. // },
  2194. showMonthNotWorkTime() {
  2195. this.monthTotalPage = 0,
  2196. this.tbload = true
  2197. this.http.post(
  2198. "/report/getNoReportUserList",
  2199. {
  2200. startDate: this.WorktimeDatepickValue[0],
  2201. endDate: this.WorktimeDatepickValue[1],
  2202. },
  2203. (res) => {
  2204. if (res.code == "ok") {
  2205. this.tbload = false
  2206. this.monthNotWorkDate = res.data;
  2207. // this.monthNotWorkDateS1 = res.data
  2208. this.monthnotTotal = res.data.length
  2209. // 2222111
  2210. if (this.monthNotWorkDate.length > 50) {
  2211. this.monthNotWorkDateS = this.monthNotWorkDate.slice(0,50);
  2212. } else {
  2213. this.monthNotWorkDateS = this.monthNotWorkDate
  2214. }
  2215. this.searchScreen(1)
  2216. // 判断
  2217. // if (this.monthnotworkDateS1.length > 0) {
  2218. // setTimeout(() => {
  2219. // this.tableListenernot()
  2220. // }, 1000);
  2221. // }
  2222. this.$nextTick(function(){
  2223. this.$refs.hasworkTbl2.doLayout();
  2224. });
  2225. }
  2226. },
  2227. (error) => {
  2228. this.tbload = false
  2229. this.$message({
  2230. message: error,
  2231. type: "error",
  2232. });
  2233. }
  2234. );
  2235. },
  2236. // tableListenernot(){
  2237. // let that = this;
  2238. // let dom = that.$refs.hasworkTbl2.bodyWrapper;
  2239. // dom.addEventListener("scroll", function () {
  2240. // // scrollHeight-scrollTop-clientHeight=0 用来判断滚动条到底部
  2241. // const scrollDistance2 = dom.scrollHeight - dom.scrollTop - dom.clientHeight;
  2242. // if (scrollDistance2 < 2) {
  2243. // if (that.monthNotWorkDateS.length < that.monthNotWorkDateS1.length) {
  2244. // that.monthnotTotalPage++; //当前页数自增
  2245. // var arrList = JSON.parse(JSON.stringify(that.monthNotWorkDateS1))
  2246. // var infoList = arrList.splice(
  2247. // that.monthnotTotalPage * that.monthnotTotalLages,
  2248. // that.monthnotTotalLages
  2249. // );
  2250. // that.monthNotWorkDateS = that.monthNotWorkDateS.concat(infoList);
  2251. // }
  2252. // }
  2253. // })
  2254. // },
  2255. listScroll(){
  2256. if(this.monthWorkDataS.length == this.monthWorkDataS1.length){
  2257. this.isMore = true
  2258. setTimeout(()=>{
  2259. this.isMore = false
  2260. },1000)
  2261. }else {
  2262. this.isFlag = true
  2263. let datalist = this.monthWorkDataS1.slice(0,this.monthWorkDataS.length + 50)
  2264. this.monthWorkDataS = datalist
  2265. setTimeout(()=>{
  2266. this.isFlag = false
  2267. },300)
  2268. }
  2269. },
  2270. notListScroll(){
  2271. if(this.monthNotWorkDateS.length == this.monthNotWorkDateS1.length){
  2272. this.isMore = true
  2273. setTimeout(()=>{
  2274. this.isMore = false
  2275. },1000)
  2276. }else {
  2277. this.isFlag = true
  2278. let datalist = this.monthNotWorkDateS1.slice(0,this.monthNotWorkDateS.length + 50)
  2279. this.monthNotWorkDateS = datalist
  2280. // console.log('length',this.monthNotWorkDateS.length)
  2281. setTimeout(()=>{
  2282. this.isFlag = false
  2283. },300)
  2284. }
  2285. },
  2286. // 获取默认这zhou日期参数 222
  2287. getLastWeek(e){
  2288. let newdate = new Date()
  2289. let lastdate = newdate.toLocaleDateString(newdate.setDate(newdate.getDate() - 7))
  2290. let lastwd = [this.getAutoWeekDate(lastdate)[0],this.getAutoWeekDate(lastdate)[6]]
  2291. if(e){
  2292. this.WorktimeDatepickValue = lastwd
  2293. this.showMonthWorkTime()
  2294. }else{
  2295. this.WorktimeDatepickValue = lastwd
  2296. this.showMonthNotWorkTime()
  2297. }
  2298. },
  2299. getThisWeek(e){
  2300. let newdate = new Date();
  2301. let nowdate = newdate.toLocaleDateString();
  2302. let nowwd = [this.getAutoWeekDate(nowdate)[0],this.getAutoWeekDate(nowdate)[6]]
  2303. if(e){
  2304. this.WorktimeDatepickValue = nowwd
  2305. this.showMonthWorkTime()
  2306. }else{
  2307. this.WorktimeDatepickValue = nowwd
  2308. this.showMonthNotWorkTime()
  2309. }
  2310. },
  2311. getDoubleLastWeek(e){
  2312. let newdate = new Date()
  2313. let nextdate = newdate.toLocaleDateString(newdate.setDate(newdate.getDate() - 14))
  2314. let nextwd = [this.getAutoWeekDate(nextdate)[0],this.getAutoWeekDate(nextdate)[6]]
  2315. if(e){
  2316. this.WorktimeDatepickValue = nextwd
  2317. this.showMonthWorkTime()
  2318. }else{
  2319. this.WorktimeDatepickValue = nextwd
  2320. this.showMonthNotWorkTime()
  2321. }
  2322. },
  2323. alreadyAllDate(stime,etime){
  2324. let diffdate = new Array();
  2325. let i=0;
  2326. while(stime<=etime){
  2327. let dateArray = stime.split("-");
  2328. let date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]);
  2329. let stimewk = "周" + "日一二三四五六".charAt(date.getDay());
  2330. let timedate = (stime.split("-")[1].charAt(0) == 0 ? stime.split("-")[1].charAt(1) : stime.split("-")[1]) + "月" + (stime.split("-")[2].charAt(0) == 0 ? stime.split("-")[2].charAt(1) : stime.split("-")[2]) + "日"
  2331. let timeshowdate = (stime.split("-")[1].charAt(0) == 0 ? stime.split("-")[1].charAt(1) : stime.split("-")[1]) + "." + (stime.split("-")[2].charAt(0) == 0 ? stime.split("-")[2].charAt(1) : stime.split("-")[2])
  2332. diffdate[i] = {date:timedate,showDate:timeshowdate,weekDay:stimewk};
  2333. let stime_ts = new Date(stime).getTime();
  2334. let next_date = stime_ts + (24*60*60*1000);
  2335. let next_dates_y = new Date(next_date).getFullYear()+'-';
  2336. let next_dates_m = (new Date(next_date).getMonth()+1 < 10)?'0'+(new Date(next_date).getMonth()+1)+'-':(new Date(next_date).getMonth()+1)+'-';
  2337. let next_dates_d = (new Date(next_date).getDate() < 10)?'0'+new Date(next_date).getDate():new Date(next_date).getDate();
  2338. stime = next_dates_y+next_dates_m+next_dates_d;
  2339. i++;
  2340. }
  2341. return diffdate
  2342. },
  2343. getAutoWeekDate(e) {
  2344. let dateString = e;
  2345. let dateStringReg = /^\d{4}[/-]\d{1,2}[/-]\d{1,2}$/;
  2346. if (dateString.match(dateStringReg)) {
  2347. let presentDate = new Date(dateString),
  2348. today = presentDate.getDay() !== 0 ? presentDate.getDay() : 7;
  2349. return Array.from(new Array(7), function (val, index) {
  2350. let formatDate = new Date(
  2351. presentDate.getTime() - (today - index - 1) * 24 * 60 * 60 * 1000
  2352. );
  2353. return (
  2354. formatDate.getFullYear() +
  2355. "-" +
  2356. ((formatDate.getMonth() + 1) < 10 ? "0" + (formatDate.getMonth() + 1) : (formatDate.getMonth() + 1)) +
  2357. "-" +
  2358. (formatDate.getDate() < 10 ? "0" + formatDate.getDate() : formatDate.getDate())
  2359. );
  2360. });
  2361. } else {
  2362. throw new Error(
  2363. 'dateString should be like "yyyy-mm-dd" or "yyyy/mm/dd"'
  2364. );
  2365. }
  2366. },
  2367. onProgressChange() {
  2368. this.$forceUpdate();
  2369. },
  2370. showChooseMembTree() {
  2371. this.chosenMembCount = this.participator.length;
  2372. this.chooseParticipVisible = true;
  2373. },
  2374. onTreeItemChange() {
  2375. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  2376. var list = chosenList.filter(item=>item.isUser == 1);
  2377. this.chosenMembCount = list.length;
  2378. },
  2379. findUserInTree() {
  2380. if (this.filterName == '') {
  2381. this.deptMembData = this.allMembData;
  2382. } else {
  2383. var list = this.findRecursively(this.filterName, this.allMembData);
  2384. this.deptMembData = list;
  2385. }
  2386. },
  2387. findRecursively(username, list) {
  2388. var filterList = [];
  2389. for (var i=0;i<list.length; i++) {
  2390. if (list[i].isUser == 1) {
  2391. if (list[i].label.indexOf(username) >= 0) {
  2392. //匹配上了
  2393. filterList.push(list[i]);
  2394. }
  2395. } else if (list[i].children != null && list[i].children.length > 0) {
  2396. var subList = this.findRecursively(username, list[i].children);
  2397. if (subList.length > 0) {
  2398. subList.forEach(s=>filterList.push(s));
  2399. }
  2400. }
  2401. }
  2402. return filterList;
  2403. },
  2404. //确定选择参与人
  2405. chooseParticip() {
  2406. this.chooseParticipVisible = false;
  2407. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  2408. this.chosenMembList = chosenList.filter(item=>item.isUser == 1);
  2409. this.workForm.userNames = '';
  2410. this.workForm.userId = [];
  2411. this.participator = [];
  2412. for (var i=0;i<this.chosenMembList.length; i++) {
  2413. this.workForm.userId.push(this.chosenMembList[i].id);
  2414. this.workForm.userNames += this.chosenMembList[i].label+',';
  2415. var item = {id:this.chosenMembList[i].id, name:this.chosenMembList[i].label};
  2416. this.participator.push(item);
  2417. }
  2418. if (this.workForm.userNames.length > 0) {
  2419. this.workForm.userNames = this.workForm.userNames.substring(0, this.workForm.userNames.length-1);
  2420. }
  2421. },
  2422. notifySel(sel){
  2423. // console.log(sel);
  2424. this.notifySelList = sel
  2425. },
  2426. //微信通知人员填写
  2427. Notify(code) {
  2428. if (this.notifySelList.length == 0) return;
  2429. var ids = '';
  2430. this.notifySelList.forEach(f=>{
  2431. ids += f.id+',';
  2432. })
  2433. this.http.post('/user/pushFillReport',{
  2434. ids: ids, date: this.curDate,
  2435. code: code
  2436. },
  2437. res => {
  2438. if (res.code == "ok") {
  2439. this.$message({
  2440. message: '已发送成功',
  2441. type: "success"
  2442. });
  2443. }
  2444. },
  2445. error => {
  2446. this.$message({
  2447. message: error,
  2448. type: "error"
  2449. });
  2450. }
  2451. );
  2452. },
  2453. //导出人员列表
  2454. exportMemb() {
  2455. if (this.fillMembList.length == 0) return;
  2456. var ids = '';
  2457. this.fillMembList.forEach(f=>{
  2458. ids += f.id+',';
  2459. })
  2460. this.http.post('/user/exportMembList',{
  2461. ids: ids,isFill: this.isFill, date: this.curDate
  2462. },
  2463. res => {
  2464. if (res.code == "ok") {
  2465. var aTag = document.createElement('a');
  2466. aTag.download = this.curDate+(this.isFill?"已填":"未填")+"人员列表.xls";
  2467. aTag.href = res.data;
  2468. aTag.click();
  2469. }
  2470. },
  2471. error => {
  2472. this.$message({
  2473. message: error,
  2474. type: "error"
  2475. });
  2476. }
  2477. );
  2478. },
  2479. showMembList(fill) {
  2480. this.membListVisible = true;
  2481. if (fill == 0) {
  2482. this.fillMembList = this.unFillList;
  2483. this.isFill = false;
  2484. let leaveList = []
  2485. let unleaveList = []
  2486. for(let i in this.fillMembList){
  2487. if(this.fillMembList[i].leaveDays >= 1 || this.fillMembList[i].leaveTimes >= this.user.timeType.allday){
  2488. leaveList.push(this.fillMembList[i])
  2489. }else{
  2490. unleaveList.push(this.fillMembList[i])
  2491. }
  2492. }
  2493. this.fillMembList = unleaveList
  2494. this.fillMembList_leave = leaveList
  2495. } else if(fill == 1){
  2496. this.fillMembList = this.fillList.filter(item => item.state != 3);
  2497. this.isFill = true;
  2498. }else{
  2499. this.fillMembList = this.fillList.filter(item => item.state == 3);
  2500. this.isFill = true;
  2501. }
  2502. },
  2503. //获取自己填写的日报状态
  2504. getReportFillStatus() {
  2505. this.http.post('/report/getReportFillStatus',{
  2506. startDate: this.date+"-01", endDate: this.date+"-31", userId: this.user.id
  2507. },
  2508. res => {
  2509. if (res.code == "ok") {
  2510. this.fillStatusList = res.data;
  2511. this.allDate.forEach(d=>{
  2512. var fillInfo = null;
  2513. d.state = null;
  2514. this.fillStatusList.forEach(s=>{
  2515. var d1 = s.createDate.split('-')[2];
  2516. var d2 = d.date.split('月')[1].split('日')[0];
  2517. if (d1.indexOf('0') == 0) {
  2518. d1 = d1.substring(1,d1.length);
  2519. }
  2520. if (d1 == d2) {
  2521. d.state = s.state;
  2522. }
  2523. })
  2524. })
  2525. this.$forceUpdate();
  2526. }
  2527. },
  2528. error => {
  2529. this.$message({
  2530. message: error,
  2531. type: "error"
  2532. });
  2533. }
  2534. );
  2535. },
  2536. scrollFunction () {
  2537. this.domObj = document.getElementById('clearfix') // 通过id获取要设置的div
  2538. if (this.domObj.attachEvent) { // IE
  2539. this.domObj.attachEvent('onmousewheel', this.mouseScroll)
  2540. } else if (this.domObj.addEventListener) {
  2541. this.domObj.addEventListener('DOMMouseScroll', this.mouseScroll, false)
  2542. }
  2543. this.domObj.onmousewheel = this.domObj.onmousewheel = this.mouseScroll
  2544. },
  2545. mouseScroll(event) { // google 浏览器下
  2546. let detail = event.wheelDelta || event.detail
  2547. let moveForwardStep = -1
  2548. let moveBackStep = 1
  2549. let step = 0
  2550. step = detail > 0 ? moveForwardStep * 100 : moveBackStep * 100
  2551. event.preventDefault() // 阻止浏览器默认事件
  2552. this.domObj.scrollLeft = this.domObj.scrollLeft + step
  2553. },
  2554. // //左右滚动
  2555. // wheel(e){
  2556. // var a = document.getElementById("dateScroll");
  2557. // var scroll_width = 80; //滚动一下的距离
  2558. // var e = e || window.event, v;
  2559. // e.wheelDelta ? v=e.wheelDelta : v=e.detail;
  2560. // if(v>3||-v>3) v=-v;
  2561. // v>0 ? a.scrollLeft+=scroll_width : a.scrollLeft-=scroll_width;
  2562. // e.preventDefault(); //阻止浏览器的默认滚动
  2563. // },
  2564. showExportDialog() {
  2565. this.exportDialog = true;
  2566. },
  2567. showExportTimeDialog() {
  2568. this.exportTimeDialog = true;
  2569. },
  2570. changeAllTime() {
  2571. //总时长发生改变,自动按比例计算
  2572. this.workForm.domains.forEach(d=>{
  2573. d.workingTime = (d.progress*this.reportTimeType.allday/100).toFixed(1);
  2574. });
  2575. },
  2576. // 是否加班的单机事件
  2577. check() {
  2578. this.selected = !this.selected
  2579. this.isNew = this.selected
  2580. },
  2581. updateSubProject() {
  2582. this.$forceUpdate();
  2583. },
  2584. //项目选中了, 加载子项目
  2585. selectProject(domain, index) {
  2586. if(!domain.projectId){
  2587. return;
  2588. }
  2589. // console.log('projectId===',domain.projectId);
  2590. domain.projectName = this.fillProjectList.filter(p=>p.id == domain.projectId)[0].projectName;
  2591. this.http.post('/sub-project/list',{
  2592. projectId: domain.projectId
  2593. },
  2594. res => {
  2595. //清空之前选中的子项目
  2596. // this.workForm.domains[index].subProjectId = 0;
  2597. if (res.code == "ok") {
  2598. this.workForm.domains[index].subProjectList = res.data;
  2599. this.workForm.domains[index].subProjectId = null;
  2600. this.$forceUpdate();
  2601. }
  2602. },
  2603. error => {
  2604. this.$message({
  2605. message: error,
  2606. type: "error"
  2607. });
  2608. }
  2609. );
  2610. //项目相关的近期任务
  2611. if (this.user.company.packageProject == 1) {
  2612. this.http.post('/task/getRecentTask',{
  2613. projectId: domain.projectId,
  2614. isSubstitude:this.isSubstitude?1:0
  2615. },
  2616. res => {
  2617. if (res.code == "ok") {
  2618. this.workForm.domains[index].allTaskList = res.data;
  2619. this.workForm.domains[index].taskList = res.data;
  2620. this.$forceUpdate();
  2621. }
  2622. },
  2623. error => {
  2624. this.$message({
  2625. message: error,
  2626. type: "error"
  2627. });
  2628. }
  2629. );
  2630. }
  2631. //获取项目相关专业
  2632. if (this.user.company.packageEngineering == 1) {
  2633. this.getProjectProfessions(domain, index);
  2634. }
  2635. // 获取项目相关的维度
  2636. // domain.degreeId = null
  2637. this.$set(domain,'degreeId',null)
  2638. this.dimension(domain, index);
  2639. //获取项目下的任务分组
  2640. this.getTaskGroups(domain, index);
  2641. //获取项目审核人
  2642. if (this.user.timeType.reportAuditType == 0) {
  2643. this.getProjectAuditorList(domain, index);
  2644. } else {
  2645. //按分组的负责人来审核
  2646. domain.projectAuditorId = null;
  2647. domain.projectAuditorName = null;
  2648. domain.auditUserList = null;
  2649. }
  2650. },
  2651. //获取项目审核人
  2652. getProjectAuditorList(domainItem, index) {
  2653. if(domainItem.projectId == '') {
  2654. return
  2655. }
  2656. domainItem.projectAuditorId = null;
  2657. domainItem.projectAuditorName = null;
  2658. this.http.post('/project-auditor/getList',{
  2659. projectId: domainItem.projectId,
  2660. },
  2661. res => {
  2662. if (res.code == "ok") {
  2663. domainItem.auditUserList = res.data;
  2664. if (res.data.length==0) {
  2665. this.$message({
  2666. message: '日报审核人尚未设置,请联系该项目管理人员',
  2667. type: "error"
  2668. });
  2669. } else if (res.data.length==1) {
  2670. domainItem.projectAuditorId = domainItem.auditUserList[0].auditorId;
  2671. domainItem.projectAuditorName = domainItem.auditUserList[0].auditorName;
  2672. }
  2673. this.$forceUpdate();
  2674. }
  2675. },
  2676. error => {
  2677. this.$message({
  2678. message: error,
  2679. type: "error"
  2680. });
  2681. }
  2682. );
  2683. },
  2684. // 获取维度数据
  2685. dimension(domain, index) {
  2686. if(domain.projectId == '') {
  2687. return
  2688. }
  2689. this.http.post('/project/getDegreeList',{
  2690. projectId: domain.projectId,
  2691. },
  2692. res => {
  2693. if (res.code == "ok") {
  2694. // console.log("维度数据",res.data);
  2695. this.workForm.domains[index].wuduList = res.data
  2696. // this.workForm = this.workForm
  2697. this.$forceUpdate()
  2698. }
  2699. },
  2700. error => {
  2701. this.$message({
  2702. message: error,
  2703. type: "error"
  2704. });
  2705. }
  2706. );
  2707. },
  2708. //切换任务阶段
  2709. changeStages(domain, index) {
  2710. if (domain.stage == null || domain.stage == '') {
  2711. this.workForm.domains[index].taskList = this.workForm.domains[index].allTaskList;
  2712. } else {
  2713. this.workForm.domains[index].taskList = this.workForm.domains[index].allTaskList.filter(t=>t.stagesName == domain.stage);
  2714. }
  2715. this.$forceUpdate();
  2716. },
  2717. getGroupStages(domain, index) {
  2718. // console.log(domain);
  2719. if(!domain.groupId){
  2720. domain.projectAuditorId = ''
  2721. domain.stages = []
  2722. if(this.user.timeType.reportAuditType >= 1){
  2723. domain.auditUserList = []
  2724. }
  2725. this.$forceUpdate();
  2726. return
  2727. }
  2728. this.http.post("/stages/getProjectStagesByGroup", {groupId: domain.groupId},
  2729. res => {
  2730. if (res.code == "ok") {
  2731. domain.stage = '';
  2732. domain.stages = res.data;
  2733. this.$forceUpdate();
  2734. }
  2735. },
  2736. error => {
  2737. this.$message({
  2738. message: error,
  2739. type: "error"
  2740. });
  2741. });
  2742. //检查当前的项目是否需要获取分组的负责人
  2743. if (this.user.timeType.reportAuditType >= 1) {
  2744. this.http.post("/task-group/getGroupIncharger", {groupId: domain.groupId},
  2745. res => {
  2746. if (res.code == "ok") {
  2747. domain.getProjectAuditorList = res.data;
  2748. domain.auditUserList = res.data;
  2749. if (res.data.length==1) {
  2750. domain.projectAuditorId = domain.auditUserList[0].auditorId;
  2751. domain.projectAuditorName = domain.auditUserList[0].auditorName;
  2752. } else if (res.data.length==0) {
  2753. domain.projectAuditorId = null;
  2754. domain.projectAuditorName = null;
  2755. }
  2756. this.$forceUpdate();
  2757. }
  2758. },
  2759. error => {
  2760. this.$message({
  2761. message: error,
  2762. type: "error"
  2763. });
  2764. });
  2765. }
  2766. },
  2767. getProjectProfessions(domain, index) {
  2768. this.http.post("/project-profession/getMyProfession", {projectId: domain.projectId},
  2769. res => {
  2770. if (res.code == "ok") {
  2771. this.workForm.domains[index].professionProgress = res.data;
  2772. this.$forceUpdate();
  2773. }
  2774. },
  2775. error => {
  2776. this.$message({
  2777. message: error,
  2778. type: "error"
  2779. });
  2780. });
  2781. },
  2782. //删除自己的日报
  2783. deleteReport() {
  2784. this.$confirm("确定要删除该日报吗?","提示", {
  2785. confirmButtonText: "确定",
  2786. cancelButtonText: "取消",
  2787. type: "warning"
  2788. })
  2789. .then(() => {
  2790. this.listLoading = true;
  2791. this.http.post('/report/delete',{
  2792. userId: this.user.id,
  2793. date: this.workForm.createDate
  2794. },
  2795. res => {
  2796. this.listLoading = false;
  2797. if (res.code == "ok") {
  2798. this.$message({
  2799. message: "删除成功",
  2800. type: "success"
  2801. });
  2802. this.getReportList();
  2803. this.getDepartment();
  2804. this.dialogVisible = false;
  2805. } else {
  2806. this.$message({
  2807. message: res.msg,
  2808. type: "error"
  2809. });
  2810. }
  2811. },
  2812. error => {
  2813. this.listLoading = false;
  2814. this.$message({
  2815. message: error,
  2816. type: "error"
  2817. });
  2818. }
  2819. );
  2820. })
  2821. .catch(() => {});
  2822. },
  2823. // 管理员删除日报
  2824. guanli(item) {
  2825. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  2826. let param = {date: this.date + day, userId: item.id};
  2827. this.$confirm("确定要删除该日报吗?","提示", {
  2828. confirmButtonText: "确定",
  2829. cancelButtonText: "取消",
  2830. type: "warning"
  2831. })
  2832. .then(() => {
  2833. this.listLoading = true;
  2834. this.http.post('/report/delete',param,
  2835. res => {
  2836. this.listLoading = false;
  2837. if (res.code == "ok") {
  2838. this.$message({
  2839. message: "删除成功",
  2840. type: "success"
  2841. });
  2842. this.getReportList();
  2843. this.getDepartment();
  2844. this.dialogVisible = false;
  2845. } else {
  2846. this.$message({
  2847. message: res.msg,
  2848. type: "error"
  2849. });
  2850. }
  2851. },
  2852. error => {
  2853. this.listLoading = false;
  2854. this.$message({
  2855. message: error,
  2856. type: "error"
  2857. });
  2858. }
  2859. );
  2860. })
  2861. .catch(() => {});
  2862. },
  2863. //提交批量审核数据
  2864. submitBatchApprove() {
  2865. var data = this.$refs.approveTree.getCheckedNodes();
  2866. var ids = '';
  2867. if (data.length == 0) {
  2868. this.$message({
  2869. message: '请选择要审核的人员',
  2870. type: "error"
  2871. });
  2872. return;
  2873. }
  2874. for (var i=0;i<data.length; i++) {
  2875. ids += data[i].id;
  2876. if (i < data.length-1) {
  2877. ids += ',';
  2878. }
  2879. }
  2880. let day = (this.choseDay+1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  2881. this.http.post("/report/batchApproveReport", {ids:ids, date:this.date + day},
  2882. res => {
  2883. if (res.code == "ok") {
  2884. this.$message({
  2885. message: '审核成功',
  2886. type: "success"
  2887. });
  2888. this.getReportList();
  2889. this.getDepartment();
  2890. this.approveDialogVisible = false;
  2891. } else {
  2892. this.$message({
  2893. message: res.msg,
  2894. type: "error"
  2895. });
  2896. }
  2897. },
  2898. error => {
  2899. this.$message({
  2900. message: error,
  2901. type: "error"
  2902. });
  2903. });
  2904. },
  2905. selectAll() {
  2906. if (this.isAllSelect) {
  2907. var keys = [];
  2908. this.reportNames.forEach(b=>{
  2909. keys.push(b.id);
  2910. })
  2911. this.$refs.approveTree.setCheckedKeys(keys);
  2912. } else {
  2913. this.$refs.approveTree.setCheckedKeys([]);
  2914. }
  2915. },
  2916. //批量审核
  2917. batchApprove() {
  2918. this.approveDialogVisible = true;
  2919. this.reportNames = [];
  2920. for (var i=0;i<this.reportList.length; i++) {
  2921. var report = this.reportList[i];
  2922. var hasUnChecked =false;
  2923. var id = '';
  2924. for (var j=0;j<report.data.length; j++) {
  2925. if (report.data[j].state == 0
  2926. && (this.user.company.packageEngineering==0 || (this.user.company.packageEngineering==1 && report.data[j].departmentAuditState == 1))
  2927. && (permissions.projectReportReview || report.data[j].projectAuditorId == this.user.id)) {
  2928. hasUnChecked = true;
  2929. id += report.data[j].id+',';
  2930. }
  2931. }
  2932. if (hasUnChecked) {
  2933. this.reportNames.push({id:id, label: report.name});
  2934. }
  2935. }
  2936. },
  2937. removeEmptyNode(list) {
  2938. for (var i=0;i<list.length;i++) {
  2939. var cnt = 0;
  2940. if (list[i].membCount == 0) {
  2941. list.splice(i, 1);
  2942. i--;
  2943. } else if (list[i].children != null) {
  2944. this.removeEmptyNode(list[i].children);
  2945. }
  2946. }
  2947. },
  2948. calculateMembCount(list) {
  2949. for (var i in list) {
  2950. var cnt = 0;
  2951. if (list[i].children != null) {
  2952. this.calculateMembCount(list[i].children);
  2953. for (var m in list[i].children) {
  2954. cnt += list[i].children[m].membCount;
  2955. }
  2956. }
  2957. if (list[i].isUser == 1) {
  2958. cnt++;
  2959. this.membCount++;
  2960. }
  2961. list[i].membCount = cnt;
  2962. }
  2963. },
  2964. stateChange() {
  2965. this.membCount = 0;
  2966. if (this.selectState == -1) {
  2967. //全部状态
  2968. this.data = this.allData;
  2969. } else {
  2970. //未填报
  2971. var newData = JSON.parse(JSON.stringify(this.allData));
  2972. this.filterState(this.selectState, newData);
  2973. this.data = newData;
  2974. }
  2975. this.calculateMembCount(this.data);
  2976. this.data[0].membCount = this.membCount;//总人数
  2977. },
  2978. //按状态过滤部门人员
  2979. filterState(state, list) {
  2980. for (var i =0;i<list.length; i++) {
  2981. var obj = list[i];
  2982. if (obj.isUser == 1) {
  2983. var match = false;
  2984. if (state == -2) {
  2985. if (obj.state == null) {
  2986. match = true;
  2987. }
  2988. } else {
  2989. if (obj.state == state) {
  2990. match = true;
  2991. }
  2992. }
  2993. if (!match) {
  2994. list.splice(i, 1);
  2995. i--;
  2996. } else {
  2997. }
  2998. } else {
  2999. if (obj.children != null) {
  3000. this.filterState(state, obj.children);
  3001. }
  3002. }
  3003. }
  3004. },
  3005. // 部门列表点击
  3006. handleNodeClick(data) {
  3007. // this.dealList = data
  3008. this.theValues(data.id, this.allData)
  3009. // this.depData = data;
  3010. var list = [];
  3011. if (data.id == -1) {
  3012. this.deptId = null;
  3013. this.targetUid = null;
  3014. list = this.data;
  3015. } else if (data.isUser == 1) {
  3016. this.deptId = null;
  3017. this.targetUid = data.id;
  3018. } else {
  3019. this.deptId = data.id;
  3020. this.targetUid = null;
  3021. list.push(data);
  3022. }
  3023. this.getReportList();
  3024. if (list.length > 0) {
  3025. this.unFillList = this.getUserMembListFromDeptList(list, 0);
  3026. this.fillList = this.getUserMembListFromDeptList(list, 1)
  3027. }
  3028. },
  3029. theValues(id, item) {
  3030. for(var i in item) {
  3031. if(item[i].id == id) {
  3032. this.depData = item[i]
  3033. return
  3034. } else {
  3035. if(item[i].children) {
  3036. this.theValues(id, item[i].children)
  3037. }
  3038. }
  3039. }
  3040. },
  3041. //获取可以选择的代填的人员列表
  3042. getSubstitudeUserDeptList() {
  3043. if (this.deptMembData.length == 0) {
  3044. this.http.post("/department/listMyMembs", {},
  3045. res => {
  3046. if (res.code == "ok") {
  3047. let noAllData = JSON.parse(JSON.stringify(res.data));
  3048. if (noAllData.length > 0) {
  3049. if (noAllData[0].label == '全部人员') {
  3050. noAllData.splice(0,1);
  3051. }
  3052. }
  3053. this.setUserToDept(noAllData);
  3054. this.deptMembData = noAllData;
  3055. } else {
  3056. this.$message({
  3057. message: res.msg,
  3058. type: "error"
  3059. });
  3060. }
  3061. },
  3062. error => {
  3063. this.$message({
  3064. message: error,
  3065. type: "error"
  3066. });
  3067. });
  3068. }
  3069. },
  3070. // 获取部门列表
  3071. getDepartment() {
  3072. let day = (this.choseDay+1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  3073. var param = {date:this.date + day};
  3074. this.http.post("/report/getMembList", param,
  3075. res => {
  3076. if (res.code == "ok") {
  3077. if(res.data.length == 0){
  3078. // this.$message({
  3079. // message: '请联系管理员设置负责部门',
  3080. // type: 'error'
  3081. // })
  3082. return
  3083. }
  3084. this.departmentList = JSON.parse(JSON.stringify(res.data))
  3085. var list = res.data , list1 = JSON.parse(JSON.stringify(res.data));
  3086. // let noAllData = JSON.parse(JSON.stringify(res.data));
  3087. // if (this.user.role > 0) {
  3088. // }
  3089. list.splice(0,0,{
  3090. id: -1,
  3091. label: '全部人员',
  3092. })
  3093. this.membCount = 0;
  3094. //设置员工到部门下面
  3095. this.setUserToDept(list);
  3096. this.data = list;
  3097. // console.log('data',this.data);
  3098. this.expandDate = [this.data[1].id]
  3099. this.allData = list;
  3100. // if (noAllData.length > 0) {
  3101. // if (noAllData[0].label == '全部人员') {
  3102. // noAllData.splice(0,1);
  3103. // }
  3104. // }
  3105. // this.setUserToDept(noAllData);
  3106. // this.deptMembData = noAllData;
  3107. this.option = this.changeArr(list1);
  3108. list[0].membCount = this.membCount;
  3109. if (this.depData.id == -1) {
  3110. this.depData.membCount = this.membCount;
  3111. this.unFillList = this.getUserMembListFromDeptList(this.data, 0);
  3112. this.fillList = this.getUserMembListFromDeptList(this.data, 1);
  3113. } else {
  3114. if (this.depData.isUser == null) {
  3115. var dep = this.findTargetDept(this.data, this.depData.id);
  3116. var membDeptList = [];
  3117. membDeptList.push(dep);
  3118. this.unFillList = this.getUserMembListFromDeptList(membDeptList, 0);
  3119. this.fillList = this.getUserMembListFromDeptList(membDeptList, 1);
  3120. }
  3121. }
  3122. if (this.depData.isUser == null) {
  3123. if (this.isFill) {
  3124. this.fillMembList = this.fillList;
  3125. } else {
  3126. this.fillMembList = this.unFillList;
  3127. }
  3128. }
  3129. this.stateChange()
  3130. } else {
  3131. this.$message({
  3132. message: res.msg,
  3133. type: "error"
  3134. });
  3135. }
  3136. },
  3137. error => {
  3138. this.$message({
  3139. message: error,
  3140. type: "error"
  3141. });
  3142. });
  3143. this.getReportFillStatus();
  3144. },
  3145. findTargetDept(list, deptId) {
  3146. var t = null;
  3147. for (var i=0;i<list.length; i++) {
  3148. if (list[i].isUser == null && list[i].id == deptId) {
  3149. t = list[i];
  3150. break;
  3151. }
  3152. }
  3153. if (t == null) {
  3154. for (var i=0;i<list.length; i++) {
  3155. if (list[i].children != null && list[i].children.length > 0) {
  3156. t = this.findTargetDept(list[i].children, deptId);
  3157. if (t != null) {
  3158. break;
  3159. }
  3160. }
  3161. }
  3162. }
  3163. return t;
  3164. },
  3165. getUserMembListFromDeptList(list, isFill) {
  3166. var membList = [];
  3167. for (var i in list) {
  3168. var deptName = list[i].label;
  3169. if (list[i].userList != null) {
  3170. list[i].userList.forEach(element => {
  3171. if (isFill == 0) {
  3172. //获取未填的
  3173. if (element.state == null) {
  3174. var obj = {id: element.id, label:element.name, deptId:element.departmentId, deptName: deptName,leaveDays: element.leaveDays, leaveTimes: element.leaveTimes, leaveType: element.leaveType};
  3175. membList.push(obj);
  3176. }
  3177. } else {
  3178. if (element.state != null) {
  3179. var obj = {id: element.id, label:element.name, deptId:element.departmentId, deptName: deptName,state: element.state};
  3180. membList.push(obj);
  3181. }
  3182. }
  3183. });
  3184. }
  3185. if (list[i].children != null) {
  3186. membList = membList.concat(this.getUserMembListFromDeptList(list[i].children, isFill));
  3187. }
  3188. }
  3189. return membList;
  3190. },
  3191. setUserToDept(list) {
  3192. for (var i in list) {
  3193. var cnt = 0;
  3194. if (list[i].children != null) {
  3195. this.setUserToDept(list[i].children);
  3196. for (var m in list[i].children) {
  3197. cnt += list[i].children[m].membCount;
  3198. }
  3199. }
  3200. if (list[i].userList != null) {
  3201. if (list[i].children == null) {
  3202. list[i].children = [];
  3203. }
  3204. list[i].userList.forEach(element => {
  3205. var obj = {
  3206. id: element.id,
  3207. label:element.name,
  3208. state:element.state,
  3209. parentId:element.departmentId,
  3210. isUser:1,
  3211. workingTime: element.workingTime,
  3212. leaveDays: element.leaveDays,
  3213. leaveTimes: element.leaveTimes
  3214. };
  3215. list[i].children.push(obj);
  3216. this.membCount++;
  3217. cnt++;
  3218. });
  3219. }
  3220. list[i].membCount = cnt;
  3221. }
  3222. },
  3223. // 修改数组
  3224. changeArr(arr) {
  3225. for (var i = 0; i < arr.length; i++) {
  3226. if(arr[i].id != -1 && arr[i].id != 0) {
  3227. if (arr[i].children != null && arr[i].children.length>0) {
  3228. arr[i].children = this.changeArr(arr[i].children);
  3229. }
  3230. arr[i].id && (arr[i].value = arr[i].id);
  3231. delete arr[i].id;
  3232. }
  3233. }
  3234. for(var i in arr) {
  3235. if(arr[i].id == -1 || arr[i].id == 0) {
  3236. arr.splice(i,1)
  3237. }
  3238. }
  3239. return arr;
  3240. },
  3241. //时间段范围设置改动,监听
  3242. onTimeTypeChange(timeType) {
  3243. this.seleChn(1)
  3244. this.showAddMore = true;
  3245. for(var i in this.workForm.domains) {
  3246. if (this.workForm.domains[i].timeType == 0) {
  3247. this.showAddMore = false;
  3248. break;
  3249. }
  3250. }
  3251. if (this.showAddMore) {
  3252. //检测数量
  3253. if (this.workForm.domains.length == 2) {
  3254. this.showAddMore = false;
  3255. } else {
  3256. this.showAddMore = true;
  3257. }
  3258. }
  3259. },
  3260. getTimeType() {
  3261. this.http.post('/time-type/getCompanyTimeSetting', { companyId: this.user.companyId},
  3262. res => {
  3263. if (res.code == "ok") {
  3264. var t = res.data;
  3265. this.reportTimeType = t;
  3266. if (this.reportTimeType.type > 0) {
  3267. this.showAddMore = true;
  3268. }
  3269. //转化时间格式
  3270. if (t.allday != null) {
  3271. this.timeType.push({value:0, label:'全天 - '+t.allday+'小时', hours:t.allday});
  3272. }
  3273. if (t.am != null) {
  3274. this.timeType.push({value:1, label:'上午 - '+t.am+'小时', hours: t.am});
  3275. }
  3276. if (t.pm != null) {
  3277. this.timeType.push({value:2, label:'下午 - '+t.pm+'小时', hours: t.pm});
  3278. }
  3279. } else {
  3280. this.$message({
  3281. message: res.msg,
  3282. type: "error"
  3283. });
  3284. }
  3285. },
  3286. error => {
  3287. this.listLoading = false;
  3288. this.$message({
  3289. message: error,
  3290. type: "error"
  3291. });
  3292. });
  3293. },
  3294. // 改变月份 -------
  3295. changeMonthOut() {
  3296. this.getAllDate();
  3297. this.getReportList();
  3298. this.getDepartment();
  3299. },
  3300. // 选择日期
  3301. choseDate(i, item) {
  3302. if(this.canClick(i,item) == false && this.user.timeType.fillAhead == 0){
  3303. return
  3304. }
  3305. // console.log(nowDateYear,nowDateMonth,nowDateDay,'..',itemYear,itemMonth,itemDay);
  3306. this.choseDay = i;
  3307. let day = (this.choseDay +1)> 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  3308. sessionStorage.msg = this.date + day,
  3309. this.getReportList();
  3310. this.getDepartment();
  3311. this.curDate = item.date;
  3312. },
  3313. canClick(i, item){
  3314. let nowDate = new Date()
  3315. let nowDateYear = nowDate.getFullYear()
  3316. let itemYear = parseInt(this.date.split('-')[0])
  3317. let nowDateMonth = nowDate.getMonth() + 1
  3318. let itemMonth = parseInt(this.date.split('-')[1])
  3319. let nowDateDay = nowDate.getDate()
  3320. let itemDay = parseInt(item.showDate.split('.')[1])
  3321. if(nowDateYear < itemYear){
  3322. return false
  3323. }else if(nowDateYear == itemYear){
  3324. if(nowDateMonth < itemMonth){
  3325. return false
  3326. }else if(nowDateMonth == itemMonth){
  3327. if(nowDateDay < itemDay){
  3328. return false
  3329. }
  3330. }
  3331. }
  3332. },
  3333. // 获取日期列表
  3334. getAllDate(e) {
  3335. var dayArry = [];
  3336. var day = this.getCountDays();
  3337. let curMonthDay = null;
  3338. for (var k = 1; k <= day; k++) {
  3339. var str = new Date(this.date.replace(/-/g, "/")+'/01').getMonth() + 1 + "月" + k+'日';
  3340. var showStr = new Date(this.date.replace(/-/g, "/")+'/01').getMonth() + 1+'.'+k;
  3341. if ( new Date(this.date.replace(/-/g, "/")+'/01').getFullYear() == new Date(new Date()).getFullYear() &&
  3342. new Date(this.date.replace(/-/g, "/")+'/01').getMonth() == new Date(new Date()).getMonth()) {
  3343. if(sessionStorage.msg) {
  3344. if(parseInt(sessionStorage.msg.split("-")[2]) == k) {
  3345. this.choseDay = k - 1;
  3346. curMonthDay = str;
  3347. }
  3348. } else {
  3349. if (new Date().getDate() == k) {
  3350. this.choseDay = k - 1;
  3351. }
  3352. }
  3353. } else {
  3354. this.choseDay = 0;
  3355. }
  3356. var curDateStr = (this.date +'-'+ (k<10?('0'+k):k));
  3357. var curDateTime = util.formatDate.parse(curDateStr, 'yyyy-MM-dd');
  3358. dayArry.push({date:str, weekDay:this.weekDay[curDateTime.getDay()], showDate:showStr});
  3359. }
  3360. this.allDate = dayArry;
  3361. //不能超过最大日期
  3362. if (this.choseDay > day-1) {
  3363. this.choseDay = day-1;
  3364. }
  3365. if(sessionStorage.from != 1){
  3366. let nowmonth = new Date().getMonth() + 1
  3367. let nowd = new Date().getFullYear() + '-' + (nowmonth < 10 ? '0' + nowmonth : nowmonth)
  3368. let nowdate = new Date().getDate()
  3369. if(nowd == this.date){
  3370. if(e && sessionStorage.msg){
  3371. }else{
  3372. sessionStorage.msg = this.date + '-' + (nowdate < 10 ? '0' + nowdate : nowdate)
  3373. }
  3374. let nowday = new Date(sessionStorage.msg).getDate()
  3375. this.choseDay = nowday - 1
  3376. let monthdate = new Date(sessionStorage.msg)
  3377. this.curDate = (monthdate.getMonth() + 1) + '月' + monthdate.getDate() + '日'
  3378. }else{
  3379. if(e && sessionStorage.msg){
  3380. }else{
  3381. sessionStorage.msg = this.date + '-01'
  3382. }
  3383. let monthdate = new Date(sessionStorage.msg)
  3384. this.choseDay = monthdate.getDate() - 1
  3385. this.curDate = (monthdate.getMonth() + 1) + '月' + monthdate.getDate() + '日'
  3386. console.log('choseday',sessionStorage.msg,this.choseDay,monthdate.getDate());
  3387. }
  3388. }else{
  3389. this.choseDay = parseInt(sessionStorage.msg.split('-')[2]) - 1
  3390. }
  3391. //从消息点击跳转过来的,直接加载指定日期
  3392. if (sessionStorage.from == 1 && sessionStorage.msg) {
  3393. this.curDate = sessionStorage.msg;
  3394. sessionStorage.from = 0;
  3395. } else {
  3396. // if (curMonthDay != null) {
  3397. // // this.curDate = curMonthDay;
  3398. // let d = new Date(sessionStorage.msg)
  3399. // this.curDate = (d.getMonth()+1)+'月'+d.getDate()+'日';
  3400. // } else {
  3401. // let d = new Date(this.date.replace(/-/g, "/")+'/01')
  3402. // this.curDate = (d.getMonth()+1)+'月'+d.getDate()+'日';
  3403. // }
  3404. }
  3405. // this.curDate = this.curDate.split('月')[0] + '月' + (this.choseDay + 1) + '日'
  3406. // if(!sessionStorage.msg){
  3407. // let msgday = this.choseDay + 1
  3408. // sessionStorage.msg = this.date + '-' + (msgday < 10 ? '0' + msgday : msgday)
  3409. // }
  3410. this.getReportFillStatus();
  3411. },
  3412. getCountDays() {
  3413. var newstr = this.date.replace(/-/g, "/");
  3414. var curDate = new Date(newstr+'/01');
  3415. var curMonth = curDate.getMonth();
  3416. curDate.setMonth(curMonth + 1);
  3417. curDate.setDate(0);
  3418. return curDate.getDate();
  3419. },
  3420. //获取日报列表
  3421. getReportList() {
  3422. this.listLoading = true;
  3423. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  3424. let param = {date: this.date + day};
  3425. if (this.deptId) {
  3426. param.deptId = this.deptId;
  3427. }
  3428. if (this.targetUid) {
  3429. param.userId = this.targetUid;
  3430. }
  3431. this.http.post( this.port.report.list, param,
  3432. res => {
  3433. this.listLoading = false;
  3434. if (res.code == "ok") {
  3435. this.reportList = res.data;
  3436. if(document.querySelector("#day"+this.choseDay)){
  3437. document.querySelector("#day"+this.choseDay).scrollIntoView(true);
  3438. }
  3439. } else {
  3440. this.$message({
  3441. message: res.msg,
  3442. type: "error"
  3443. });
  3444. }
  3445. },
  3446. error => {
  3447. this.listLoading = false;
  3448. this.$message({
  3449. message: error,
  3450. type: "error"
  3451. });
  3452. });
  3453. },
  3454. // 处理数据
  3455. // dealWith() {
  3456. // var tianxie = 0
  3457. // var weixtianxie = 0
  3458. // if(this.selectState == -1) {
  3459. // } else {
  3460. // var arr = []
  3461. // for (var i in this.reportList) {
  3462. // arr.push(this.reportList[i].id)
  3463. // }
  3464. // this.getDealWith(this.dealList.children, tianxie, weixtianxie, arr)
  3465. // }
  3466. // },
  3467. // getDealWith(item, tx, wtx, arr) {
  3468. // for(var i in item) {
  3469. // if(item[i].children) {
  3470. // this.getDealWith(item[i].children, tx, wtx, arr)
  3471. // } else {
  3472. // if(arr.indexOf(item[i].id) != '-1') {
  3473. // tx = +tx + 1
  3474. // }
  3475. // }
  3476. // }
  3477. // },
  3478. //导出员工工时统计
  3479. exportUserTime() {
  3480. this.listLoading = true;
  3481. var param = {};
  3482. if (this.exportParam.dateRange != null) {
  3483. param = {startDate:this.exportParam.dateRange[0], endDate: this.exportParam.dateRange[1]};
  3484. }
  3485. this.http.post('/department/exportDeptStatistic', param,
  3486. res => {
  3487. this.listLoading = false;
  3488. if (res.code == "ok") {
  3489. location.href = res.data;
  3490. this.exportTimeDialog = false;
  3491. } else {
  3492. this.$message({
  3493. message: res.msg,
  3494. type: "error"
  3495. });
  3496. }
  3497. },
  3498. error => {
  3499. this.listLoading = false;
  3500. this.$message({
  3501. message: error,
  3502. type: "error"
  3503. });
  3504. });
  3505. },
  3506. //导出日报
  3507. exportReport() {
  3508. this.listLoading = true;
  3509. var param = {};
  3510. if (this.exportParam.dateRange != null) {
  3511. param = {startDate:this.exportParam.dateRange[0], endDate: this.exportParam.dateRange[1]};
  3512. }
  3513. if (this.exportParam.projectId != null) {
  3514. param.projectId = this.exportParam.projectId;
  3515. }
  3516. if (this.exportParam.departmentId != null) {
  3517. param.departmentId = this.exportParam.departmentId[this.exportParam.departmentId.length - 1]
  3518. }
  3519. param.stateKey = this.stateKey
  3520. // param.departmentId = this.user.departmentId
  3521. this.http.post( this.port.report.export, param,
  3522. res => {
  3523. this.listLoading = false;
  3524. if (res.code == "ok") {
  3525. location.href = res.data;
  3526. this.exportDialog = false;
  3527. } else {
  3528. this.$message({
  3529. message: res.msg,
  3530. type: "error"
  3531. });
  3532. }
  3533. },
  3534. error => {
  3535. this.listLoading = false;
  3536. this.$message({
  3537. message: error,
  3538. type: "error"
  3539. });
  3540. });
  3541. },
  3542. //获取项目列表
  3543. getProjectList() {
  3544. this.listLoading = true;
  3545. this.http.post( this.port.project.list, {},
  3546. res => {
  3547. this.listLoading = false;
  3548. if (res.code == "ok") {
  3549. for(var i in res.data) {
  3550. if(res.data[i].projectCode == null || res.data[i].projectCode == 'null') {
  3551. res.data[i].projectCode = ''
  3552. }
  3553. }
  3554. this.projectList = res.data;
  3555. // console.log("项目列表",this.projectList);
  3556. } else {
  3557. this.$message({
  3558. message: res.msg,
  3559. type: "error"
  3560. });
  3561. }
  3562. },
  3563. error => {
  3564. this.listLoading = false;
  3565. this.$message({
  3566. message: error,
  3567. type: "error"
  3568. });
  3569. });
  3570. },
  3571. // 获取填报日报的项目下拉列表
  3572. getFillProjectList() {
  3573. this.http.post( this.port.project.list, {
  3574. forReport: 1
  3575. },res => {
  3576. if (res.code == "ok") {
  3577. for(var i in res.data) {
  3578. if(res.data[i].projectCode == null || res.data[i].projectCode == 'null') {
  3579. res.data[i].projectCode = ''
  3580. }
  3581. }
  3582. this.fillProjectList = res.data;
  3583. } else {
  3584. this.$message({
  3585. message: res.msg,
  3586. type: "error"
  3587. });
  3588. }
  3589. },
  3590. error => {
  3591. this.$message({
  3592. message: error,
  3593. type: "error"
  3594. });
  3595. });
  3596. },
  3597. getBasecostItemList() {
  3598. this.http.post('/project-basecost-setting/getReportBasecostList', {
  3599. companyId: this.user.companyId
  3600. },
  3601. res => {
  3602. if (res.code == "ok") {
  3603. this.timeBasecostList = res.data;
  3604. }
  3605. });
  3606. },
  3607. // 获取个人某天的日报 000000
  3608. getReport() {
  3609. this.http.post( this.port.report.getPort, {
  3610. date: this.workForm.createDate
  3611. },
  3612. res => {
  3613. if (res.code == "ok") {
  3614. var quanbu = 0
  3615. this.jsDay = 1
  3616. var zhi = ''
  3617. var slp = res.data.report
  3618. for(var i in slp) {
  3619. var sp = +slp[i].workingTime + 0
  3620. zhi = this.jsDay * sp
  3621. quanbu = +quanbu + zhi
  3622. }
  3623. this.jsTime = quanbu
  3624. var list = res.data;
  3625. this.report = list;
  3626. this.canCancelInDialog = false
  3627. if(list.report.length != 0) {
  3628. var arr = [];
  3629. this.canEdit = false;
  3630. for(var i in list.report) {
  3631. var flg = null
  3632. list.report[i].isOvertime == 1 ? flg = true : flg = false
  3633. arr.push({
  3634. id: list.report[i].id,
  3635. projectId: list.report[i].projectId,
  3636. workingTime: list.report[i].workingTime,
  3637. content: list.report[i].content,
  3638. state: list.report[i].state,
  3639. timeType: list.report[i].timeType,
  3640. subProjectList: list.report[i].subProjectList,
  3641. taskList: list.report[i].taskList,
  3642. subProjectId: list.report[i].subProjectId == 0?null:list.report[i].subProjectId,
  3643. groupId: list.report[i].groupId == 0?null:list.report[i].groupId,
  3644. taskId: list.report[i].taskId,
  3645. // startTime: `Fri May 16 2021 ${list.report[i].startTime}:12 GMT+0800 (中国标准时间)`,
  3646. startTime: list.report[i].startTime,
  3647. // endTime: `Fri May 16 2021 ${list.report[i].endTime}:12 GMT+0800 (中国标准时间)`,
  3648. endTime: list.report[i].endTime,
  3649. isOvertime: flg,
  3650. progress:list.report[i].progress,
  3651. professionProgress: list.report[i].professionProgressList,
  3652. stages:list.report[i].stages,
  3653. stage:list.report[i].stage == '-'?null:list.report[i].stage,
  3654. pics: list.report[i].pics,
  3655. multiWorktime: list.report[i].multiWorktime,
  3656. worktimeList: list.report[i].worktimeList,
  3657. degreeId: list.report[i].degreeId==-1?null:list.report[i].degreeId,
  3658. wuduList: list.report[i].degreeList,
  3659. taskGroups:list.report[i].taskGroups,
  3660. customData: list.report[i].customData,//自定义的数值
  3661. auditUserList: list.report[i].auditUserList,
  3662. projectAuditorId: list.report[i].projectAuditorId,
  3663. projectAuditorName: list.report[i].projectAuditorName,
  3664. overtimeHours: list.report[i].overtimeHours,
  3665. customText: list.report[i].customText,
  3666. basecostId: list.report[i].basecostId,
  3667. canEdit: list.report[i].state >= 2 ? true : false
  3668. })
  3669. if (list.report[i].state >= 2) {
  3670. this.canEdit = true;
  3671. }
  3672. if (list.report[i].state == 0){
  3673. this.canCancelInDialog = true
  3674. }
  3675. }
  3676. this.workForm = {
  3677. createDate: this.workForm.createDate,
  3678. domains: arr,
  3679. userNames:null,
  3680. userId:null,
  3681. time: list.time
  3682. }
  3683. } else {
  3684. this.workForm = {
  3685. createDate: this.workForm.createDate,
  3686. domains: [{
  3687. id: null,
  3688. projectId: "",
  3689. workingTime: this.reportTimeType.type==3?(this.reportTimeType.allday).toFixed(1):"",
  3690. content: "",
  3691. progress:100,
  3692. state: 2,
  3693. timeType:0,
  3694. multiWorktime: this.reportTimeType.multiWorktime,
  3695. worktimeList:[{}],
  3696. canEdit: true
  3697. }],
  3698. userId:null,
  3699. userNames:null,
  3700. time: this.report.time
  3701. }
  3702. if(this.isWeekend){
  3703. this.$set(this.workForm.domains[0],'isOvertime',true)
  3704. if(this.reportTimeType.type != 2){
  3705. this.$set(this.workForm.domains[0],'overtimeHours',this.reportTimeType.allday.toFixed(0))
  3706. }
  3707. }
  3708. if(this.user.timeType.type == 1) {
  3709. var shuzhi = this.user.timeType.allday + ''
  3710. // console.log('执行一次', shuzhi.indexOf('.'))
  3711. this.workForm.domains[0].workingTime = shuzhi.indexOf('.') == '-1' ? shuzhi + '.0' : shuzhi
  3712. }
  3713. if (this.timeBasecostList && this.timeBasecostList.length > 0) {
  3714. //默认给第一个,必填字段
  3715. this.workForm.domains[0].basecostId = this.timeBasecostList[0].id;
  3716. }
  3717. this.canEdit = true;
  3718. }
  3719. } else {
  3720. this.$message({
  3721. message: res.msg,
  3722. type: "error"
  3723. });
  3724. }
  3725. },
  3726. error => {
  3727. this.$message({
  3728. message: error,
  3729. type: "error"
  3730. });
  3731. });
  3732. },
  3733. guanbi() {
  3734. this.falsss = false
  3735. },
  3736. // 打开日报填写
  3737. fillInReport(i, isBatch) {
  3738. this.isWeekend = false
  3739. // console.log(this.user.timeType.type, '选择时长')
  3740. if(i != 1) {
  3741. this.falsss = false
  3742. } else {
  3743. this.falsss = true
  3744. }
  3745. if (this.isSubstitude) {
  3746. this.getSubstitudeUserDeptList();
  3747. }
  3748. if(i == -1 || this.isSubstitude) {
  3749. this.isDisable = false;
  3750. } else {
  3751. this.isDisable = true;
  3752. }
  3753. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  3754. this.isBatch = isBatch;
  3755. if (this.isBatch == 0 && !this.isSubstitude) {
  3756. this.workForm.createDate = this.date + day; // 获取个人某天的日报
  3757. let weekday = new Date(this.workForm.createDate).getDay()
  3758. if(this.user.companyId == 817){
  3759. if(weekday == 0){
  3760. this.isWeekend = true
  3761. }
  3762. }else{
  3763. if(weekday == 0 || weekday == 6){
  3764. this.isWeekend = true
  3765. }
  3766. }
  3767. this.getReport(i);
  3768. } else {
  3769. // console.log('执行到了这里')
  3770. this.jsTime = 0
  3771. this.jsDay = 0
  3772. this.workForm = {
  3773. createDate: null,//批量填报没有日期
  3774. domains: [{
  3775. id: null,
  3776. projectId: "",
  3777. workingTime: this.reportTimeType.type==3?(this.reportTimeType.allday).toFixed(1):"",
  3778. content: "",
  3779. progress:100,
  3780. state: 2,
  3781. timeType:0,
  3782. multiWorktime: this.reportTimeType.multiWorktime,
  3783. worktimeList:[{}],
  3784. canEdit: true
  3785. }],
  3786. }
  3787. if(this.user.timeType.type == 1) {
  3788. var shuzhi = this.user.timeType.allday + ''
  3789. // console.log('执行二次')
  3790. this.workForm.domains[0].workingTime = shuzhi.indexOf('.') == '-1' ? shuzhi + '.0' : shuzhi
  3791. }
  3792. // console.log(this.workForm)
  3793. if (this.timeBasecostList&&this.timeBasecostList.length>0) {
  3794. this.workForm.domains[0].basecostId = this.timeBasecostList[0].id;
  3795. }
  3796. this.canEdit = true;
  3797. }
  3798. this.dialogVisible = true;
  3799. },
  3800. // 按周填报里内容的填写
  3801. tianxies(item, i, names, row) {
  3802. var idd = ''
  3803. var obj = {}
  3804. for(var l in this.projectList) {
  3805. if(this.projectList[l].projectName == names) idd = this.projectList[l].id
  3806. }
  3807. obj.projectId = idd
  3808. this.selectProject(obj, 0)
  3809. // console.log(this.workForm.domains[0], '打印出来的')
  3810. this.tianxieDialogVisible = true
  3811. this.scopess = item
  3812. var sss = {}
  3813. sss.projectId = idd;
  3814. sss.con = item.con
  3815. sss.progress = item.progress
  3816. sss.time = item.time
  3817. sss.workingTime = item.workingTime
  3818. sss.projectAuditorId = item.projectAuditorId;
  3819. if (this.timeBasecostList && this.timeBasecostList.length > 0) {
  3820. //默认选中第一个
  3821. sss.basecostId = this.timeBasecostList[0].id;
  3822. }
  3823. var that = this
  3824. setTimeout(() =>{
  3825. if(Object.keys(item).length < 5) {
  3826. // console.log(456)
  3827. sss.subProjectId = that.workForm.domains[0].subProjectId
  3828. sss.stage = that.workForm.domains[0].stage
  3829. sss.subProjectList = that.workForm.domains[0].subProjectList
  3830. sss.stages = that.workForm.domains[0].stages
  3831. sss.taskGroups = that.workForm.domains[0].taskGroups;
  3832. sss.auditUserList = obj.auditUserList;
  3833. } else {
  3834. sss.subProjectId = item.subProjectId
  3835. sss.stage = item.stage
  3836. sss.subProjectList = item.subProjectList
  3837. sss.stages = item.stages
  3838. sss.taskGroups = item.taskGroups;
  3839. sss.auditUserList = obj.auditUserList;
  3840. }
  3841. if (sss.auditUserList != null && sss.auditUserList.length==1) {
  3842. //只有一个审核人,自动设置上去
  3843. sss.projectAuditorId = sss.auditUserList[0].auditorId;
  3844. }
  3845. sss.wuduList = row[0].wuduList
  3846. // console.log(sss, '数据')
  3847. that.zhoBaoIdx = i
  3848. that.zhoBaoName = names
  3849. that.zhoBao = sss
  3850. that.zhis = row
  3851. that.$forceUpdate();
  3852. },500);
  3853. // if(Object.keys(sss).length <= 4) {
  3854. // sss.subProjectId = this.workForm.domains[0].subProjectId
  3855. // sss.stage = this.workForm.domains[0].stage
  3856. // sss.subProjectList = this.workForm.domains[0].subProjectList
  3857. // sss.stages = this.workForm.domains[0].stages
  3858. // } else {
  3859. // sss.subProjectId = item.subProjectId
  3860. // sss.stage = item.stage
  3861. // sss.subProjectList = item.subProjectList
  3862. // sss.stages = item.stages
  3863. // }
  3864. // console.log(sss, '数据')
  3865. // this.zhoBaoIdx = i
  3866. // this.zhoBaoName = names
  3867. // this.zhoBao = sss
  3868. // this.zhis = row
  3869. // this.selectProject(row[0], i)
  3870. },
  3871. // 按周填报里内容的填写点击确定
  3872. btnTianxiaes() {
  3873. if (this.zhoBao.projectAuditorId) {
  3874. let errtips = ''
  3875. if(this.user.timeType.customDegreeStatus == 1 && this.zhoBao.wuduList.length != 0 && !this.zhoBao.degreeId) {
  3876. errtips += this.user.timeType.customDegreeName + '、'
  3877. }
  3878. if(this.user.timeType.customDataStatus == 1 && !this.zhoBao.customData){
  3879. errtips += this.user.timeType.customDataName + '、'
  3880. }
  3881. if(this.user.timeType.customTextStatus == 1 && !this.zhoBao.customText){
  3882. errtips += this.user.timeType.customTextName + '、'
  3883. }
  3884. if(this.user.timeType.workContentState == 1 && !this.zhoBao.con){
  3885. errtips += this.user.companyId==781?'具体内容与结果、':'工作事项、'
  3886. }
  3887. if(errtips){
  3888. errtips = errtips.substring(0,errtips.length - 1)
  3889. this.$message({
  3890. message: '请对' + errtips + '进行填写',
  3891. type: 'warning'
  3892. })
  3893. }else {
  3894. this.tianxieDialogVisible = false
  3895. var zhong = this.zhoData
  3896. zhong[this.zhoBaoIdx][this.zhoBaoName] = this.zhoBao
  3897. this.zhoData = zhong
  3898. if(this.reportTimeType.type == 1) this.zhoXuan(this.zhoBao, this.zhoBaoIdx)
  3899. if(this.reportTimeType.type == 2) this.zhoTimes(this.zhoBao, this.zhoBaoIdx)
  3900. if(this.reportTimeType.type == 3) this.addBli(this.zhoBao, this.zhoBaoIdx)
  3901. }
  3902. } else {
  3903. this.$message({
  3904. message: '请选择审核人',
  3905. type: "error"
  3906. });
  3907. }
  3908. },
  3909. // 获取本周
  3910. getCurrentWeek() {
  3911. const currentDate = new Date()
  3912. const week = currentDate.getDay()
  3913. const millisecond = 1000 * 60 * 60 * 24
  3914. const minusDay = week != 0 ? week - 1 : 4
  3915. const monday = new Date(currentDate.getTime() - minusDay * millisecond)
  3916. var stat = this.dealdate(monday)
  3917. var end
  3918. if(this.user.timeType.fillAhead == 1){
  3919. const endDay = week == 0 || week == 6 ? 0 : 5 - week
  3920. const endDate = new Date(currentDate.getTime() + endDay * millisecond)
  3921. end = this.dealdate(endDate)
  3922. }else{
  3923. end = this.dealdate(currentDate)
  3924. }
  3925. this.zhoRqi = [stat, end]
  3926. // console.log('date',currentDate,this.zhoRqi);
  3927. this.zhoRqis()
  3928. // this.jiazai()
  3929. },
  3930. // 获取上周
  3931. handleGetPrevWeek() {
  3932. const Time = new Date(this.zhoRqi[0])
  3933. let weekNum = Time.getDay()
  3934. weekNum = weekNum == 0 ? 7 : weekNum
  3935. let lastDate = new Date(Time.getTime() - weekNum * 24 * 60 * 60 * 1000)
  3936. let fitstDate = new Date(
  3937. Time.getTime() - (weekNum + 6) * 24 * 60 * 60 * 1000
  3938. )
  3939. let startDate = `${fitstDate.getFullYear()}-${
  3940. fitstDate.getMonth() + 1 < 10
  3941. ? '0' + (fitstDate.getMonth() + 1)
  3942. : fitstDate.getMonth() + 1
  3943. }-${
  3944. fitstDate.getDate() < 10
  3945. ? '0' + fitstDate.getDate()
  3946. : fitstDate.getDate()
  3947. }`
  3948. let endDate = `${lastDate.getFullYear()}-${
  3949. lastDate.getMonth() + 1 < 10
  3950. ? '0' + (lastDate.getMonth() + 1)
  3951. : lastDate.getMonth() + 1
  3952. }-${
  3953. lastDate.getDate() < 10 ? '0' + lastDate.getDate() : lastDate.getDate()
  3954. }`
  3955. var stat = this.dealdate(startDate)
  3956. var ends = this.dealdate(endDate)
  3957. var end = this.dateChange(-2, ends)
  3958. this.zhoRqi = [stat, end]
  3959. this.zhoRqis()
  3960. // this.jiazai()
  3961. },
  3962. // 获取下周
  3963. handleGetNextvWeek() {
  3964. const Time = new Date(this.zhoRqi[1])
  3965. let weekNum = Time.getDay()
  3966. weekNum = weekNum == 0 ? 7 : weekNum
  3967. let fitstDate = new Date(
  3968. Time.getTime() + (7 - weekNum + 1) * 24 * 60 * 60 * 1000
  3969. )
  3970. let lastDate = new Date(
  3971. Time.getTime() + (7 - weekNum + 7) * 24 * 60 * 60 * 1000
  3972. )
  3973. let startDate = `${fitstDate.getFullYear()}-${
  3974. fitstDate.getMonth() + 1 < 10
  3975. ? '0' + (fitstDate.getMonth() + 1)
  3976. : fitstDate.getMonth() + 1
  3977. }-${
  3978. fitstDate.getDate() < 10
  3979. ? '0' + fitstDate.getDate()
  3980. : fitstDate.getDate()
  3981. }`
  3982. let endDate = `${lastDate.getFullYear()}-${
  3983. lastDate.getMonth() + 1 < 10
  3984. ? '0' + (lastDate.getMonth() + 1)
  3985. : lastDate.getMonth() + 1
  3986. }-${
  3987. lastDate.getDate() < 10 ? '0' + lastDate.getDate() : lastDate.getDate()
  3988. }`
  3989. var stat = this.dealdate(startDate)
  3990. var ends = this.dealdate(endDate)
  3991. var end = this.dateChange(-2, ends)
  3992. this.zhoRqi = [stat, end]
  3993. this.zhoRqis()
  3994. // this.jiazai()
  3995. },
  3996. // 新增日期
  3997. newDates() {
  3998. // console.log(this.zhoRqi, '看卡')
  3999. let edate = new Date(this.zhoRqi[1])
  4000. let nowdate = new Date()
  4001. let nowdate2
  4002. if(this.user.timeType.fillAhead == 1){
  4003. let week = nowdate.getDay()
  4004. const endDay = week > 5 ? 0 : 5 - week
  4005. const endDate = new Date(nowdate.getTime() + endDay * millisecond)
  4006. nowdate2 = this.dealdate(endDate)
  4007. }else{
  4008. nowdate2 = new Date(nowdate.getFullYear(),nowdate.getMonth(),nowdate.getDate())
  4009. }
  4010. if(edate >= nowdate2){
  4011. return
  4012. }
  4013. this.zhoRqi[1] = this.dateChange(1, this.zhoRqi[1])
  4014. var obj = {}
  4015. obj.zhoDataTime = this.zhoRqi[1]
  4016. obj.he = 0
  4017. for(var j in this.projectList) {
  4018. var xinzhi = this.projectList[j].projectName
  4019. obj[xinzhi] = {}
  4020. obj[xinzhi].time = ''
  4021. obj[xinzhi].con = ''
  4022. obj[xinzhi].progress = 0
  4023. obj[xinzhi].workingTime = 0
  4024. }
  4025. this.zhoData.push(obj)
  4026. this.getWeeklyCardTime()
  4027. },
  4028. // 减去时间
  4029. dateChange(num = 1,date = false) {
  4030.   if (!date) {
  4031.     date = new Date();//没有传入值时,默认是当前日期
  4032.     date = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
  4033.   }
  4034.   date += " 00:00:00";//设置为当天凌晨12点
  4035.   date = Date.parse(new Date(date))/1000;//转换为时间戳
  4036.   date += (86400) * num;//修改后的时间戳
  4037.   var newDate = new Date(parseInt(date) * 1000);//转换为时间
  4038. var nian = newDate.getFullYear()
  4039. var yue = ''
  4040. var ri = ''
  4041. var yues = (newDate.getMonth() + 1)
  4042. var ris = newDate.getDate()
  4043. yues > 9 ? yue = yues : yue = '0' + yues
  4044. ris > 9 ? ri = ris : ri = '0' + ris
  4045. return nian +'-'+yue+'-'+ri
  4046. },
  4047. // 加载动画
  4048. jiazai() {
  4049. this.zhoLoading = true
  4050. var that = this
  4051. setTimeout(() =>{
  4052. that.zhoLoading = false
  4053. },1000);
  4054. },
  4055. // 转时间格式
  4056. dealdate(date) {
  4057. const dt = new Date(date)
  4058. const y = dt.getFullYear()
  4059. const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  4060. const d = (dt.getDate() + '').padStart(2, '0')
  4061. return `${y}-${m}-${d}`
  4062. },
  4063. // 按周填报
  4064. fillInReportss() {
  4065. window.addEventListener('scroll', this.handleScroll, true)
  4066. // this.jiazai()
  4067. this.diasZho = true
  4068. this.getCurrentWeek()
  4069. // 项目数量判断 <=5
  4070. if(this.projectList.length < 5){
  4071. this.selProjectList = this.projectList
  4072. this.selConShow = false
  4073. }
  4074. if (!this.timeBasecostList || this.timeBasecostList.length == 0) {
  4075. //重新获取工时预警类型的预算项
  4076. this.http.post('/project-basecost-setting/getReportBasecostList', {
  4077. companyId: this.user.companyId
  4078. },
  4079. res => {
  4080. if (res.code == "ok") {
  4081. this.timeBasecostList = res.data;
  4082. }
  4083. });
  4084. }
  4085. },
  4086. // 按周填报的项目筛选
  4087. selListFun(){
  4088. this.selProjectList = []
  4089. if(this.selCon.length){
  4090. for (let i = 0; i < this.selCon.length; i++) {
  4091. this.selProjectList.push(this.projectList.find(item => item.id == this.selCon[i]))
  4092. }
  4093. this.selConShow = false
  4094. }else{
  4095. this.$message({
  4096. message:'请选择要填报的项目',
  4097. type:'error'
  4098. })
  4099. }
  4100. },
  4101. getWeeklyCardTime(){
  4102. let dateStr = []
  4103. for(let i in this.zhoData){
  4104. dateStr.push(this.zhoData[i].zhoDataTime)
  4105. }
  4106. this.http.post('/report/getWeeklyCardTime',{
  4107. dateStr: JSON.stringify(dateStr)
  4108. },res => {
  4109. if(res.code == 'ok'){
  4110. for(let i in res.data){
  4111. let datei = '';
  4112. if (this.user.timeType.showDdCardtime == 1) {
  4113. datei = res.data[i].workDate.split('-');
  4114. } else if (this.user.timeType.showCorpwxCardtime == 1) {
  4115. datei = res.data[i].createDate.split('-');
  4116. }
  4117. for(let m in this.zhoData){
  4118. let datem = new Date(this.zhoData[m].zhoDataTime)
  4119. if(datei[0] == datem.getFullYear() && datei[1] == (datem.getMonth() + 1) && datei[2] == datem.getDate()){
  4120. let item = {
  4121. startTime: res.data[i].startTime,
  4122. endTime: res.data[i].endTime,
  4123. workHours: res.data[i].workHours
  4124. }
  4125. this.$set(this.zhoData[m],'corpTime',item)
  4126. }
  4127. }
  4128. }
  4129. console.log('can can need',this.zhoData);
  4130. }else{
  4131. this.$message({
  4132. message: res.msg,
  4133. type: 'error'
  4134. })
  4135. }
  4136. },err => {
  4137. this.$message({
  4138. message: err,
  4139. type: 'error'
  4140. })
  4141. })
  4142. },
  4143. selListqx(){
  4144. this.diasZho = false
  4145. this.selProjectList = []
  4146. this.selCon = []
  4147. },
  4148. handleScroll() {
  4149. this.changdu = this.projectList.length + 1
  4150. },
  4151. // 自动选择时间点的事件
  4152. zhoTimes(item, i, ims, event) {
  4153. var iss = i
  4154. if(item.time == null) {
  4155. return
  4156. } else {
  4157. var zhi = this.zhoData[iss]
  4158. var he = 0
  4159. for(var i in zhi) {
  4160. if(zhi[i].time && zhi[i].time.length > 0 && i != 'zhoDataTime' && i != 'he') {
  4161. var date2 = '2021/12/12 ' + zhi[i].time[1] +':00'
  4162. var date1 = '2021/12/12 ' + zhi[i].time[0] +':00'
  4163. var date3 = new Date(date2).getTime() - new Date(date1).getTime();
  4164. var leave1=date3%(24*3600*1000)
  4165. var hours=Math.floor(leave1/(3600*1000))
  4166. var leave2=leave1%(3600*1000)
  4167. var minutes=Math.floor(leave2/(60*1000))
  4168. var shi = hours+'.'+ minutes
  4169. he += +shi
  4170. }
  4171. }
  4172. zhi.he = he + 'h'
  4173. }
  4174. },
  4175. // 自动选择事件长度的事件
  4176. zhoXuan(item, i) {
  4177. var iss = i
  4178. if(item.time == null) {
  4179. return
  4180. } else {
  4181. var zhi = this.zhoData[iss]
  4182. var he = 0
  4183. for(var i in zhi) {
  4184. if(i != 'zhoDataTime' && i != 'he' && zhi[i].workingTime && zhi[i].workingTime.length > 0) {
  4185. he += +zhi[i].workingTime
  4186. }
  4187. }
  4188. zhi.he = he + 'h'
  4189. }
  4190. },
  4191. // 按时间比例
  4192. addBli(item, i) {
  4193. var iss = i
  4194. if(item.time == null) {
  4195. return
  4196. } else {
  4197. var zhi = this.zhoData[iss]
  4198. var he = 0
  4199. for(var i in zhi) {
  4200. if(i != 'zhoDataTime' && i != 'he' && zhi[i].workingTime && zhi[i].workingTime.length > 0) {
  4201. he += +zhi[i].workingTime
  4202. }
  4203. }
  4204. zhi.he = he.toFixed(1) + 'h'
  4205. }
  4206. },
  4207. zhoRqis() {
  4208. let nowdate = new Date()
  4209. let nowdate2
  4210. if(this.user.timeType.fillAhead == 1){
  4211. const millisecond = 1000 * 60 * 60 * 24
  4212. let week = nowdate.getDay()
  4213. const endDay = week == 0 || week == 6 ? 0 : 5 - week
  4214. const endDate = new Date(nowdate.getTime() + endDay * millisecond)
  4215. nowdate2 = this.dealdate(endDate)
  4216. }else{
  4217. nowdate2 = new Date(nowdate.getFullYear(),nowdate.getMonth(),nowdate.getDate())
  4218. }
  4219. let edate = new Date(this.zhoRqi[1])
  4220. if(edate >= nowdate2){
  4221. let emon = nowdate2.getMonth() + 1
  4222. let eday = nowdate2.getDate()
  4223. let edate2 = nowdate2.getFullYear() + '-' + (emon < 10 ? '0' + emon : emon) + '-' + (eday < 10 ? '0' + eday : eday)
  4224. this.zhoRqi[1] = edate2
  4225. }
  4226. this.zhoData = []
  4227. if(this.zhoRqi) {
  4228. var stime = this.zhoRqi[0]
  4229. var etime = this.zhoRqi[1]
  4230. var zhi = this.getdiffdate(stime, etime)
  4231. var arrst = []
  4232. for(var i in zhi) {
  4233. var obj = {}
  4234. obj.zhoDataTime = zhi[i]
  4235. obj.he = 0
  4236. for(var j in this.projectList) {
  4237. var xinzhi = this.projectList[j].projectName
  4238. obj[xinzhi] = {}
  4239. obj[xinzhi].time = ''
  4240. obj[xinzhi].con = ''
  4241. obj[xinzhi].progress = 0
  4242. obj[xinzhi].workingTime = 0
  4243. }
  4244. arrst.push(obj)
  4245. }
  4246. this.zhoData = arrst
  4247. }
  4248. if(this.zhoData.length && (this.user.timeType.showDdCardtime == 1 || this.user.timeType.showCorpwxCardtime == 1)){
  4249. this.getWeeklyCardTime()
  4250. }
  4251. },
  4252. zhoZhi(res, i) {
  4253. var zhi = 0
  4254. for(var i in res) {
  4255. if(i != 'zhoDataTime' && i != 'he') {
  4256. zhi += +res[i]
  4257. }
  4258. }
  4259. res.he = zhi
  4260. },
  4261. zhoBtn(i) {
  4262. // this.zhoData.split(i, 1)
  4263. var arr = this.zhoData
  4264. arr.splice(i, 1)
  4265. },
  4266. zhoAddlast(){
  4267. this.selConShow = true
  4268. },
  4269. zhoAddqx(){
  4270. this.diasZho = false
  4271. this.selConShow = true
  4272. this.selProjectList = []
  4273. this.selCon = []
  4274. },
  4275. // 提交按周填报
  4276. zhoAdd() {
  4277. var zhi = this.zhoData
  4278. var ll = 0
  4279. if(this.reportTimeType.type == 2) {
  4280. for(var i in zhi) {
  4281. this.dateAr = []
  4282. var alp = []
  4283. var zhis = zhi[i]
  4284. for(var j in zhis) {
  4285. if(j != 'zhoDataTime' && j != 'he' && zhis[j].time != null && zhis[j].time != 'null' && zhis[j].time != '') {
  4286. let objs = {}
  4287. objs.s = zhis[j].time[0]
  4288. objs.e = zhis[j].time[1]
  4289. alp.push(objs)
  4290. }
  4291. }
  4292. this.dateAr = alp
  4293. if(this.dateAr.length > 0) {
  4294. let trus = this.fns()
  4295. ll += 1
  4296. if(!trus) {
  4297. this.$message({
  4298. message: '填写的时间段重叠',
  4299. type: 'error'
  4300. })
  4301. return false
  4302. }
  4303. }
  4304. }
  4305. if(ll == 0) {
  4306. this.$message({
  4307. message: '请填写时间',
  4308. type: 'error'
  4309. })
  4310. return false
  4311. }
  4312. } else if(this.reportTimeType.type == 1){
  4313. for(var i in zhi) {
  4314. var zhis = zhi[i]
  4315. for(var j in zhis) {
  4316. if(j != 'zhoDataTime' && j != 'he' && zhis[j].workingTime != null && zhis[j].workingTime != 'null' && zhis[j].workingTime != '') {
  4317. ll += 1
  4318. }
  4319. }
  4320. }
  4321. if(ll == 0) {
  4322. this.$message({
  4323. message: '请选择时间',
  4324. type: 'error'
  4325. })
  4326. return false
  4327. }
  4328. let overcorp = ''
  4329. for(let n in zhi){
  4330. if(zhi[n].corpTime && parseInt(zhi[n].he) > zhi[n].corpTime.workHours){
  4331. overcorp += zhi[n].zhoDataTime + ','
  4332. }
  4333. }
  4334. if(overcorp != ''){
  4335. overcorp = overcorp.substring(0,overcorp.length - 1)
  4336. this.$message({
  4337. message: '日期[' + overcorp + ']填报工时之和不能超过考勤总工时',
  4338. type: 'error'
  4339. })
  4340. return
  4341. }
  4342. }
  4343. var submits = []
  4344. let formData = new FormData();
  4345. if(this.reportTimeType.multiWorktime == 1){
  4346. for (var i in this.zhoData) {
  4347. var zhoD = this.zhoData[i]
  4348. var flgs = false
  4349. for(var j in zhoD) {
  4350. if(j != 'zhoDataTime' && j != 'he' && zhoD[j].time && zhoD[j].time.length > 0 && zhoD[j].time != null && zhoD[j].time != 'null') {
  4351. flgs = true
  4352. // formData.append("degreeId", "-1");
  4353. formData.append("id", '-1');
  4354. for(var s in this.projectList) {
  4355. if(j == this.projectList[s].projectName) {
  4356. formData.append("projectId", this.projectList[s].id);
  4357. }
  4358. }
  4359. zhoD[j].subProjectId ? formData.append("subProjectId", zhoD[j].subProjectId) : formData.append("subProjectId", '0');
  4360. formData.append("taskId", 0);
  4361. formData.append("reportTimeType", this.reportTimeType.type);
  4362. formData.append("endTime", '');
  4363. formData.append("startTime", '');
  4364. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  4365. var lix = []
  4366. var objjs = {}
  4367. objjs.startTime = zhoD[j].time[0]
  4368. objjs.endTime = zhoD[j].time[1]
  4369. if (zhoD[j].con == null || zhoD[j].con == '') {
  4370. zhoD[j].con == '-'
  4371. }
  4372. objjs.content = zhoD[j].con
  4373. lix.push(objjs)
  4374. var zhiZhi = JSON.stringify(lix)
  4375. zhiZhi = zhiZhi.replace(/,/g,"@");
  4376. formData.append("content", zhiZhi)
  4377. formData.append("isOvertime", 0)
  4378. formData.append("professionProgress", "[]")
  4379. zhoD[j].stage ? formData.append("stage", zhoD[j].stage) : formData.append("stage", '');
  4380. formData.append("createDate",zhoD.zhoDataTime)
  4381. if (zhoD[j].projectAuditorId) {
  4382. formData.append("projectAuditorId",zhoD[j].projectAuditorId)
  4383. }
  4384. if(zhoD[j].basecostId) {
  4385. formData.append("basecostId", zhoD[j].basecostId);
  4386. } else {
  4387. formData.append("basecostId", 0);
  4388. }
  4389. if(this.user.timeType.customDegreeActive && zhoD[j].degreeId){
  4390. formData.append('degreeId',zhoD[j].degreeId)
  4391. }else{
  4392. formData.append("degreeId", "-1");
  4393. }
  4394. if(this.user.timeType.customDataActive && zhoD[j].customData){
  4395. formData.append('customData',zhoD[j].customData)
  4396. }else if(this.user.timeType.customDataActive){
  4397. formData.append('customData',0)
  4398. }
  4399. if(this.user.timeType.customTextActive && zhoD[j].customText){
  4400. formData.append('customText',zhoD[j].customText)
  4401. }else if(this.user.timeType.customTextActive){
  4402. formData.append('customText','-')
  4403. }
  4404. }
  4405. }
  4406. }
  4407. } else {
  4408. for (var i in this.zhoData) {
  4409. var zhoD = this.zhoData[i]
  4410. var flgs = false
  4411. if(this.reportTimeType.type == 2) {
  4412. for(var j in zhoD) {
  4413. if(j != 'zhoDataTime' && j != 'he' && zhoD[j].time && zhoD[j].time.length > 0 && zhoD[j].time != null && zhoD[j].time != 'null') {
  4414. flgs = true
  4415. // formData.append("degreeId", "-1");
  4416. formData.append("id", '-1');
  4417. for(var s in this.projectList) {
  4418. if(j == this.projectList[s].projectName) {
  4419. formData.append("projectId", this.projectList[s].id);
  4420. }
  4421. }
  4422. zhoD[j].subProjectId ? formData.append("subProjectId", zhoD[j].subProjectId) : formData.append("subProjectId", '0');
  4423. formData.append("taskId", 0);
  4424. formData.append("reportTimeType", this.reportTimeType.type);
  4425. formData.append("endTime", zhoD[j].time[1]);
  4426. formData.append("startTime", zhoD[j].time[0]);
  4427. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  4428. zhoD[j].con == '' || zhoD[j].con == null ? formData.append("content", '-') : formData.append("content", zhoD[j].con)
  4429. formData.append("isOvertime", 0)
  4430. formData.append("professionProgress", "[]")
  4431. zhoD[j].stage ? formData.append("stage", zhoD[j].stage) : formData.append("stage", '');
  4432. formData.append("createDate",zhoD.zhoDataTime)
  4433. if (zhoD[j].projectAuditorId) {
  4434. formData.append("projectAuditorId",zhoD[j].projectAuditorId)
  4435. }
  4436. if(zhoD[j].basecostId) {
  4437. formData.append("basecostId", zhoD[j].basecostId);
  4438. } else {
  4439. formData.append("basecostId", 0);
  4440. }
  4441. if(this.user.timeType.customDegreeActive && zhoD[j].degreeId){
  4442. formData.append('degreeId',zhoD[j].degreeId)
  4443. }else{
  4444. formData.append("degreeId", "-1");
  4445. }
  4446. if(this.user.timeType.customDataActive && zhoD[j].customData){
  4447. formData.append('customData',zhoD[j].customData)
  4448. }else if(this.user.timeType.customDataActive){
  4449. formData.append('customData',0)
  4450. }
  4451. if(this.user.timeType.customTextActive && zhoD[j].customText){
  4452. formData.append('customText',zhoD[j].customText)
  4453. }else if(this.user.timeType.customTextActive){
  4454. formData.append('customText','-')
  4455. }
  4456. }
  4457. }
  4458. } else {
  4459. for(var j in zhoD) {
  4460. if(j != 'zhoDataTime' && j != 'he' && zhoD[j].workingTime && zhoD[j].workingTime.length > 0 && zhoD[j].workingTime > 0 && zhoD[j].workingTime != null && zhoD[j].workingTime != 'null') {
  4461. flgs = true
  4462. // formData.append("degreeId", "-1");
  4463. formData.append("id", '-1');
  4464. for(var s in this.projectList) {
  4465. if(j == this.projectList[s].projectName) {
  4466. formData.append("projectId", this.projectList[s].id);
  4467. }
  4468. }
  4469. zhoD[j].subProjectId ? formData.append("subProjectId", zhoD[j].subProjectId) : formData.append("subProjectId", '0')
  4470. // formData.append("subProjectId", zhoD[j].subProjectId);
  4471. formData.append("taskId", 0);
  4472. formData.append("reportTimeType", this.reportTimeType.type);
  4473. if(this.reportTimeType.type == 1) {
  4474. formData.append("workingTime", zhoD[j].workingTime);
  4475. } else if(this.reportTimeType.type == 2) {
  4476. formData.append("endTime", zhoD[j].time[1]);
  4477. formData.append("startTime", zhoD[j].time[0]);
  4478. } else if(this.reportTimeType.type == 3) {
  4479. formData.append("progress", zhoD[j].progress);
  4480. formData.append("workingTime", zhoD[j].workingTime);
  4481. }
  4482. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  4483. zhoD[j].con == '' || zhoD[j].con == null ? formData.append("content", '-') : formData.append("content", zhoD[j].con)
  4484. formData.append("isOvertime", 0)
  4485. formData.append("professionProgress", "[]")
  4486. zhoD[j].stage ? formData.append("stage", zhoD[j].stage) : formData.append("stage", '');
  4487. formData.append("createDate",zhoD.zhoDataTime)
  4488. if (zhoD[j].projectAuditorId) {
  4489. formData.append("projectAuditorId",zhoD[j].projectAuditorId)
  4490. }
  4491. if(zhoD[j].basecostId) {
  4492. formData.append("basecostId", zhoD[j].basecostId);
  4493. } else {
  4494. formData.append("basecostId", 0);
  4495. }
  4496. if(this.user.timeType.customDegreeActive && zhoD[j].degreeId){
  4497. formData.append('degreeId',zhoD[j].degreeId)
  4498. }else{
  4499. formData.append("degreeId", "-1");
  4500. }
  4501. if(this.user.timeType.customDataActive && zhoD[j].customData){
  4502. formData.append('customData',zhoD[j].customData)
  4503. }else if(this.user.timeType.customDataActive){
  4504. formData.append('customData',0)
  4505. }
  4506. if(this.user.timeType.customTextActive && zhoD[j].customText){
  4507. formData.append('customText',zhoD[j].customText)
  4508. }else if(this.user.timeType.customTextActive){
  4509. formData.append('customText','-')
  4510. }
  4511. }
  4512. }
  4513. }
  4514. }
  4515. }
  4516. // 自定义维度
  4517. this.submitingReport = true;
  4518. this.http.uploadFile( this.port.report.editPort, formData,
  4519. res => {
  4520. // this.listLoading = false;
  4521. this.submitingReport = false;
  4522. if (res.code == "ok") {
  4523. this.$message({
  4524. message: "填报成功",
  4525. type: "success"
  4526. });
  4527. this.diasZho = false
  4528. this.selConShow = true
  4529. this.zhoData = []
  4530. this.zhoRqi = ''
  4531. this.getReportList();
  4532. this.getDepartment();
  4533. // 关闭弹窗 并 清空
  4534. this.selProjectList = []
  4535. this.selCon = []
  4536. } else {
  4537. this.$message({
  4538. message: res.msg,
  4539. type: "error"
  4540. });
  4541. }
  4542. },
  4543. error => {
  4544. this.submitingReport = false;
  4545. this.$message({
  4546. message: error,
  4547. type: "error"
  4548. });
  4549. });
  4550. },
  4551. ChangeHourMinutestr (str) {
  4552. if (str !== "0" && str !== "" && str !== null) {
  4553. return ((Math.floor(str / 60)).toString().length < 2 ? "0" + (Math.floor(str / 60)).toString() :
  4554. (Math.floor(str / 60)).toString()) + ":" + ((str % 60).toString().length < 2 ? "0" + (str % 60).toString() : (str % 60).toString());
  4555. } else {
  4556. return "";
  4557. }
  4558. },
  4559. // 得到两个日期中间的日期
  4560. getdiffdate(stime,etime){
  4561. //初始化日期列表,数组
  4562. var diffdate = new Array();
  4563. var i=0;
  4564. //开始日期小于等于结束日期,并循环
  4565. while(stime<=etime){
  4566. diffdate[i] = stime;
  4567. //获取开始日期时间戳
  4568. var stime_ts = new Date(stime).getTime();
  4569. //增加一天时间戳后的日期
  4570. var next_date = stime_ts + (24*60*60*1000);
  4571. //拼接年月日,这里的月份会返回(0-11),所以要+1
  4572. var next_dates_y = new Date(next_date).getFullYear()+'-';
  4573. var next_dates_m = (new Date(next_date).getMonth()+1 < 10)?'0'+(new Date(next_date).getMonth()+1)+'-':(new Date(next_date).getMonth()+1)+'-';
  4574. var next_dates_d = (new Date(next_date).getDate() < 10)?'0'+new Date(next_date).getDate():new Date(next_date).getDate();
  4575. stime = next_dates_y+next_dates_m+next_dates_d;
  4576. //增加数组key
  4577. i++;
  4578. }
  4579. return diffdate;
  4580. },
  4581. // 添加模块
  4582. addDomain(i) {
  4583. var leftProgress = 10;
  4584. if (this.reportTimeType.type == 3) {
  4585. //计算已经待分配工时比例
  4586. let array = this.workForm.domains;
  4587. let totalProgress = 0;
  4588. for (var i=0;i<array.length; i++) {
  4589. totalProgress += array[i].progress;
  4590. }
  4591. if (totalProgress < 100) {
  4592. leftProgress = 100 - totalProgress;
  4593. }
  4594. }
  4595. var addItem = {
  4596. projectId: "",
  4597. workingTime: this.reportTimeType.type == 3?(leftProgress*this.reportTimeType.allday/100).toFixed(1):"",
  4598. content: "",
  4599. progress:leftProgress,
  4600. state:2,//2-表示待提交
  4601. multiWorktime: this.reportTimeType.multiWorktime,
  4602. worktimeList:[{}],
  4603. canEdit: true
  4604. // degreeId: '',
  4605. };
  4606. if(this.isWeekend){
  4607. this.$set(addItem,'isOvertime',true)
  4608. if(this.reportTimeType.type == 3){
  4609. this.$set(addItem,'overtimeHours',(leftProgress*this.reportTimeType.allday/100).toFixed(0))
  4610. }
  4611. }
  4612. if (this.timeBasecostList && this.timeBasecostList.length > 0) {
  4613. //默认给第一个,必填字段
  4614. addItem.basecostId = this.timeBasecostList[0].id;
  4615. }
  4616. this.workForm.domains.push(addItem);
  4617. this.canEdit = true
  4618. if (this.reportTimeType.type == 0) {
  4619. //全天上下午模式下,检测时间段数量,达到2个,不能再加了
  4620. var length = this.workForm.domains.length;
  4621. if (length == 2) {
  4622. this.showAddMore = false;
  4623. }
  4624. }
  4625. this.chuji()
  4626. },
  4627. // 移除模块
  4628. delDomain(i) {
  4629. this.workForm.domains.splice(i,1)
  4630. let iscan = false
  4631. for(let i in this.workForm.domains){
  4632. if(this.workForm.domains[i].canEdit){
  4633. iscan = true
  4634. }
  4635. }
  4636. this.canEdit = iscan
  4637. //检测当前剩下的一个,时间类型是否是全天
  4638. if (this.reportTimeType.type == 0) {
  4639. if (this.workForm.domains[0].timeType == 0) {
  4640. this.showAddMore = false;
  4641. } else {
  4642. this.showAddMore = true;
  4643. }
  4644. }
  4645. if(this.user.timeType.multiWorktime == 1) {
  4646. this.iptChangs()
  4647. } else {
  4648. this.seleChn(0)
  4649. }
  4650. },
  4651. // 改变月份
  4652. changeMonth() {
  4653. this.isWeekend = false
  4654. let date = new Date()
  4655. let nowmon = date.getMonth() + 1
  4656. let nowday = date.getDate()
  4657. let nowdate = date.getFullYear() + '-' + (nowmon < 10 ? '0' + nowmon : nowmon) + '-' + (nowday < 10 ? '0' + nowday : nowday)
  4658. if (this.isBatch == 0) {
  4659. if(this.user.timeType.fillAhead == 0){
  4660. let date_a = new Date(this.workForm.createDate)
  4661. if(date_a.getTime() > date.getTime()){
  4662. this.workForm.createDate = nowdate
  4663. }
  4664. }
  4665. //只有按天填报才能获取当天的日报
  4666. if(!this.isSubstitude){
  4667. let weekday = new Date(this.workForm.createDate).getDay()
  4668. if(this.user.companyId == 817){
  4669. if(weekday == 0){
  4670. this.isWeekend = true
  4671. }
  4672. }else{
  4673. if(weekday == 0 || weekday == 6){
  4674. this.isWeekend = true
  4675. }
  4676. }
  4677. this.getReport()
  4678. }
  4679. }else {
  4680. if(this.user.timeType.fillAhead == 0){
  4681. let date_a = new Date(this.workForm.createDate[1])
  4682. if(date_a.getTime() > date.getTime()){
  4683. this.workForm.createDate[1] = nowdate
  4684. let sdate = new Date(this.workForm.createDate[0])
  4685. let edate = new Date(this.workForm.createDate[1])
  4686. if(sdate > edate){
  4687. this.workForm.createDate[0] = this.workForm.createDate[1]
  4688. }
  4689. }
  4690. }
  4691. }
  4692. },
  4693. // 判断时间段
  4694. fns() {
  4695. for (let k in this.dateAr) {
  4696. if (!this.judege(k)) {
  4697. return false
  4698. }
  4699. }
  4700. return true
  4701. },
  4702. judege(idx){
  4703. for (let k in this.dateAr) {
  4704. if (idx !== k) {
  4705. if (this.dateAr[k].s <= this.dateAr[idx].s && this.dateAr[k].e > this.dateAr[idx].s) {
  4706. return false
  4707. }
  4708. if (this.dateAr[k].s < this.dateAr[idx].e && this.dateAr[k].e >= this.dateAr[idx].e) {
  4709. return false
  4710. }
  4711. }
  4712. }
  4713. return true
  4714. },
  4715. // 保存日报
  4716. submitReport(isDraft) {
  4717. this.isDraft = isDraft;
  4718. this.$refs.workForm.validate(valid => {
  4719. if (valid) {
  4720. this.dateAr = []
  4721. let alp = []
  4722. if(this.user.timeType.multiWorktime != 1) {
  4723. for(var p in this.workForm.domains) {
  4724. if(this.workForm.domains[p].startTime || this.workForm.domains[p].endTime) {
  4725. let objs = {}
  4726. objs.s = this.workForm.domains[p].startTime
  4727. objs.e = this.workForm.domains[p].endTime
  4728. alp.push(objs)
  4729. }
  4730. }
  4731. this.dateAr = alp
  4732. if(this.dateAr.length > 0) {
  4733. let trus = this.fns()
  4734. if(!trus) {
  4735. this.$message({
  4736. message: '填写的时间段重叠',
  4737. type: "error"
  4738. });
  4739. return
  4740. }
  4741. }
  4742. } else {
  4743. for(var p in this.workForm.domains) {
  4744. var slll = this.workForm.domains[p]
  4745. for(var o in slll.worktimeList) {
  4746. if(slll.worktimeList[o].startTime || slll.worktimeList[o].endTime) {
  4747. let objs = {}
  4748. objs.s = slll.worktimeList[o].startTime
  4749. objs.e = slll.worktimeList[o].endTime
  4750. alp.push(objs)
  4751. }
  4752. }
  4753. }
  4754. this.dateAr = alp
  4755. if(this.dateAr.length > 0) {
  4756. let trus = this.fns()
  4757. if(!trus) {
  4758. this.$message({
  4759. message: '填写的时间段重叠',
  4760. type: "error"
  4761. });
  4762. return
  4763. }
  4764. }
  4765. }
  4766. // return
  4767. //代填的情况,检查人员是否已经选择
  4768. if (this.isSubstitude) {
  4769. if (this.workForm.userNames == null || this.workForm.userNames.length == 0) {
  4770. this.$message({
  4771. message: "请选择代填的人员",
  4772. type: "error"
  4773. });
  4774. return;
  4775. }
  4776. }
  4777. //检查时间,全天和上下午不能同时存在
  4778. if (this.reportTimeType.type == 0) {
  4779. var alldayNum = 0;
  4780. var amNum = 0;
  4781. var pmNum = 0;
  4782. for(var i in this.workForm.domains) {
  4783. if (this.workForm.domains[i].timeType == 0) {
  4784. alldayNum ++;
  4785. } else if (this.workForm.domains[i].timeType == 1) {
  4786. amNum++;
  4787. } else if (this.workForm.domains[i].timeType == 2) {
  4788. pmNum++;
  4789. }
  4790. }
  4791. if (alldayNum > 1) {
  4792. this.$message({
  4793. message: "工作时间-全天,只能选择一次",
  4794. type: "error"
  4795. });
  4796. return;
  4797. }
  4798. if (amNum > 1) {
  4799. this.$message({
  4800. message: "工作时间-上午,只能选择一次",
  4801. type: "error"
  4802. });
  4803. return;
  4804. }
  4805. if (pmNum > 1) {
  4806. this.$message({
  4807. message: "工作时间-下午,只能选择一次",
  4808. type: "error"
  4809. });
  4810. return;
  4811. }
  4812. if (alldayNum == 1 && (amNum > 0 || pmNum > 0)) {
  4813. this.$message({
  4814. message: "工作时间-全天,不能和上下午同时存在",
  4815. type: "error"
  4816. });
  4817. return;
  4818. }
  4819. } else if (this.reportTimeType.type == 3) {
  4820. //总百分比不能超过100%
  4821. let total = 0;
  4822. this.workForm.domains.forEach(w=>{total += w.progress});
  4823. if (total > 100) {
  4824. this.$message({
  4825. message: "用时比例之和不能超过100%",
  4826. type: "error"
  4827. });
  4828. return;
  4829. } else if (total < 100) {
  4830. this.$message({
  4831. message: "工时尚未完全分配,无法提交",
  4832. type: "error"
  4833. });
  4834. return;
  4835. }
  4836. }
  4837. this.listLoading = true;
  4838. let formData = new FormData();
  4839. formData.append("draft", this.isDraft);
  4840. //检查workingTime合计
  4841. if (this.reportTimeType.type == 1 && this.workForm.time) {
  4842. var totalTime = 0;
  4843. for (var t=0;t<this.workForm.domains.length; t++) {
  4844. totalTime += parseFloat(this.workForm.domains[t].workingTime);
  4845. }
  4846. if (this.workForm.time.workHours && totalTime > parseFloat(this.workForm.time.workHours)) {
  4847. this.$message({
  4848. message: "填报工时之和"+(totalTime)+"h不能超过考勤总工时("+this.workForm.time.workHours.toFixed(1)+"h)",
  4849. type: "error"
  4850. });
  4851. return;
  4852. }
  4853. }
  4854. for(var i in this.workForm.domains) {
  4855. if(this.workForm.domains[i].degreeId) {
  4856. // var sss = this.workForm.domains[i].degreeId.toString()
  4857. formData.append("degreeId", this.workForm.domains[i].degreeId);
  4858. } else {
  4859. formData.append("degreeId", -1);
  4860. }
  4861. if(this.workForm.domains[i].customData) {
  4862. // var sss = this.workForm.domains[i].degreeId.toString()
  4863. formData.append("customData", this.workForm.domains[i].customData);
  4864. } else {
  4865. formData.append("customData", 0);
  4866. }
  4867. if(this.workForm.domains[i].customText) {
  4868. formData.append("customText", this.workForm.domains[i].customText);
  4869. } else {
  4870. formData.append("customText", '-');
  4871. }
  4872. if (this.workForm.domains[i].id) {
  4873. formData.append("id", this.workForm.domains[i].id);
  4874. } else {
  4875. formData.append("id", -1);
  4876. }
  4877. formData.append("projectId", this.workForm.domains[i].projectId);
  4878. if (this.workForm.domains[i].subProjectId) {
  4879. formData.append("subProjectId", this.workForm.domains[i].subProjectId);
  4880. } else {
  4881. formData.append("subProjectId", 0);
  4882. }
  4883. if (this.workForm.domains[i].groupId) {
  4884. formData.append("groupId", this.workForm.domains[i].groupId);
  4885. } else {
  4886. formData.append("groupId", 0);
  4887. }
  4888. if (this.workForm.domains[i].taskId) {
  4889. formData.append("taskId", this.workForm.domains[i].taskId);
  4890. } else {
  4891. formData.append("taskId", 0);
  4892. }
  4893. if (this.workForm.domains[i].taskFinish == true) {
  4894. formData.append("taskFinish", 1);
  4895. } else {
  4896. formData.append("taskFinish", 0);
  4897. }
  4898. formData.append("reportTimeType", this.reportTimeType.type);
  4899. if (this.reportTimeType.type == 0) {
  4900. formData.append("timeType", this.workForm.domains[i].timeType);
  4901. var workingTime = this.timeType.filter(t=>t.value == this.workForm.domains[i].timeType)[0].hours;
  4902. formData.append("workingTime", workingTime);
  4903. } else if (this.reportTimeType.type == 1){
  4904. formData.append("workingTime", this.workForm.domains[i].workingTime);
  4905. } else if (this.reportTimeType.type == 2) {
  4906. formData.append("endTime", this.workForm.domains[i].endTime);
  4907. formData.append("startTime", this.workForm.domains[i].startTime);
  4908. } else if (this.reportTimeType.type == 3) {
  4909. //按比例分配
  4910. formData.append("progress", this.workForm.domains[i].progress);
  4911. formData.append("workingTime", this.workForm.domains[i].workingTime);
  4912. }
  4913. //处理多个时间事项
  4914. formData.append("multiWorktime", this.workForm.domains[i].multiWorktime);
  4915. if (this.reportTimeType.multiWorktime == 1) {
  4916. //检查时间是否有重叠
  4917. var workList = this.workForm.domains[i].worktimeList;
  4918. for (var j=0;j<workList.length; j++) {
  4919. var curItem = workList[j];
  4920. //检查开始时间是否大于结束时间
  4921. if (curItem.startTime >= curItem.endTime) {
  4922. this.$message({
  4923. message: "时间段"+curItem.startTime+'-'+curItem.endTime+"有误:"+
  4924. "结束时间必须大于开始时间",
  4925. type: "error"
  4926. });
  4927. return;
  4928. }
  4929. for (var p = j+1;p<workList.length; p++) {
  4930. var jItem = workList[p];
  4931. if ((jItem.startTime>=curItem.startTime&&jItem.startTime < curItem.endTime)
  4932. || (jItem.endTime>curItem.startTime&&jItem.endTime <= curItem.endTime)) {
  4933. this.$message({
  4934. message: "时间段"+curItem.startTime+'-'+curItem.endTime+"与"+
  4935. jItem.startTime+'-'+jItem.endTime+ "存在重叠,请修改。",
  4936. type: "error"
  4937. });
  4938. return;
  4939. }
  4940. }
  4941. }
  4942. let m = JSON.stringify(this.workForm.domains[i].worktimeList);
  4943. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  4944. formData.append("content", m);
  4945. } else {
  4946. if (this.workForm.domains[i].content) {
  4947. formData.append("content", this.workForm.domains[i].content);
  4948. } else {
  4949. formData.append("content", '-');
  4950. }
  4951. }
  4952. if (this.isBatch == 0) {
  4953. formData.append("createDate", this.workForm.createDate);
  4954. } else {
  4955. //批量填报,时间范围
  4956. formData.append("createDate", this.workForm.createDate[0]+'@'+this.workForm.createDate[1]);
  4957. }
  4958. if(this.workForm.domains[i].isOvertime) {
  4959. formData.append("isOvertime", 1);
  4960. } else {
  4961. formData.append("isOvertime", 0);
  4962. }
  4963. if(this.workForm.domains[i].overtimeHours && this.workForm.domains[i].isOvertime == 1) {
  4964. formData.append("overtimeHours", this.workForm.domains[i].overtimeHours);
  4965. } else {
  4966. formData.append("overtimeHours", 0);
  4967. }
  4968. if(this.workForm.domains[i].basecostId) {
  4969. formData.append("basecostId", this.workForm.domains[i].basecostId);
  4970. } else {
  4971. formData.append("basecostId", 0);
  4972. }
  4973. if (this.workForm.userId != null) {
  4974. var targetUids = '';
  4975. this.workForm.userId.forEach(u=>{
  4976. targetUids += u + '@';
  4977. });
  4978. if (targetUids.length > 0) {
  4979. targetUids = targetUids.substring(0, targetUids.length -1);
  4980. formData.append("targetUids", targetUids);
  4981. }
  4982. }
  4983. //项目专业进度
  4984. if (this.workForm.domains[i].professionProgress) {
  4985. var m = JSON.stringify(this.workForm.domains[i].professionProgress);
  4986. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  4987. formData.append("professionProgress", m);
  4988. } else {
  4989. formData.append("professionProgress", "[]");
  4990. }
  4991. if (this.workForm.domains[i].stage) {
  4992. formData.append("stage", this.workForm.domains[i].stage);
  4993. } else {
  4994. formData.append("stage", "-");
  4995. }
  4996. if (this.workForm.domains[i].projectAuditorId) {
  4997. formData.append("projectAuditorId", this.workForm.domains[i].projectAuditorId);
  4998. } else {
  4999. if (this.user.timeType.reportAuditType == 0) {
  5000. this.$message({
  5001. message: "请指定项目审核人",
  5002. type: "error"
  5003. });
  5004. } else {
  5005. //分组负责人先审核, 确定是选择了任务分组
  5006. if (this.workForm.domains[i].taskGroups.length == 0) {
  5007. this.$message({
  5008. message: "您在["+this.workForm.domains[i].projectName+"]项目上尚无参与的任务分组",
  5009. type: "error"
  5010. });
  5011. } else if (!this.workForm.domains[i].groupId) {
  5012. // console.log(this.workForm.domains[i]);
  5013. this.$message({
  5014. message: "请选择["+this.workForm.domains[i].projectName+"]项目的任务分组",
  5015. type: "error"
  5016. });
  5017. } else {
  5018. this.$message({
  5019. message: "请设置["+this.workForm.domains[i].projectName+"]项目的分组负责人",
  5020. type: "error"
  5021. });
  5022. }
  5023. }
  5024. return;
  5025. }
  5026. }
  5027. this.submitingReport = true;
  5028. this.http.uploadFile( this.port.report.editPort, formData,
  5029. res => {
  5030. this.listLoading = false;
  5031. this.submitingReport = false;
  5032. if (res.code == "ok") {
  5033. this.$message({
  5034. message: this.isDraft==0?"提交成功":"暂存成功",
  5035. type: "success"
  5036. });
  5037. this.dialogVisible = false;
  5038. this.jsDay = 0
  5039. this.jsTime = 0
  5040. this.getReportList();
  5041. this.getDepartment();
  5042. } else {
  5043. this.$message({
  5044. message: (this.isDraft==0?'提交失败:':'暂存失败:')+res.msg,
  5045. type: "error"
  5046. });
  5047. }
  5048. },
  5049. error => {
  5050. this.listLoading = false;
  5051. this.submitingReport = false;
  5052. this.$message({
  5053. message: error,
  5054. type: "error"
  5055. });
  5056. });
  5057. }
  5058. });
  5059. },
  5060. cli() {
  5061. },
  5062. // 判断是展示那个工时导入
  5063. imports() {
  5064. if(this.user.timeType.syncCorpwxTime == 0) {
  5065. this.importDialog = true
  5066. } else {
  5067. this.importWxDialog = true
  5068. }
  5069. },
  5070. // 跳转
  5071. junpToDeskTop(id) {
  5072. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  5073. this.$router.push("/desktop/" + id + "/" + this.date +day);
  5074. },
  5075. // 通过日报
  5076. approve(id, item) {
  5077. this.logining = true;
  5078. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  5079. var ids = item.id;
  5080. // var data = item.data;
  5081. // data.forEach(element => {
  5082. // ids +=(element.id+',');
  5083. // });
  5084. this.http.post( this.port.report.approve, {id: id , date: this.date +day, reportIds: ids},
  5085. res => {
  5086. this.logining = false;
  5087. if (res.code == "ok") {
  5088. this.$message({
  5089. message: "审核成功",
  5090. type: "success"
  5091. });
  5092. this.getReportList();
  5093. this.getDepartment();
  5094. } else {
  5095. this.$message({
  5096. message: res.msg,
  5097. type: "error"
  5098. });
  5099. }
  5100. },
  5101. error => {
  5102. this.logining = false;
  5103. this.$message({
  5104. message: error,
  5105. type: "error"
  5106. });
  5107. });
  5108. },
  5109. //撤回日报
  5110. cancel(item,e) {
  5111. console.log('can can need',item);
  5112. this.logining = true;
  5113. var ids = '';
  5114. var data = e ? item : item.data;
  5115. data.forEach(element => {
  5116. if(element.id){
  5117. ids +=(element.id+',');
  5118. }
  5119. });
  5120. this.http.post(this.port.report.cancelReport, {userId: this.user.id, reportIds: ids},
  5121. res => {
  5122. this.logining = false;
  5123. if (res.code == "ok") {
  5124. this.$message({
  5125. message:"撤回成功",
  5126. type: "success"
  5127. });
  5128. this.getReportList();
  5129. if(e){this.getReport()}
  5130. this.getDepartment();
  5131. } else {
  5132. this.$message({
  5133. message: res.msg,
  5134. type: "error"
  5135. });
  5136. }
  5137. },
  5138. error => {
  5139. this.logining = false;
  5140. this.$message({
  5141. message: error,
  5142. type: "error"
  5143. });
  5144. });
  5145. },
  5146. showDenyDialog(id,i, item) {
  5147. this.denyReasonDialog = true;
  5148. let day = (this.choseDay+1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  5149. var ids = item.id;
  5150. // var data = item.data;
  5151. // data.forEach(element => {
  5152. // ids +=(element.id+',');
  5153. // });
  5154. this.denyForm = {id: id ,i:i, date: this.date +day, reportIds: ids, reason:null};
  5155. },
  5156. // 未通过日报
  5157. deny() {
  5158. this.logining = true;
  5159. this.http.post( this.port.report.deny, this.denyForm,
  5160. res => {
  5161. this.logining = false;
  5162. if (res.code == "ok") {
  5163. this.$message({
  5164. message: this.denyForm.i==0?"驳回成功":"撤销成功",
  5165. type: "success"
  5166. });
  5167. this.getReportList();
  5168. this.getDepartment();
  5169. this.denyReasonDialog = false;
  5170. } else {
  5171. this.$message({
  5172. message: res.msg,
  5173. type: "error"
  5174. });
  5175. }
  5176. },
  5177. error => {
  5178. this.logining = false;
  5179. this.$message({
  5180. message: error,
  5181. type: "error"
  5182. });
  5183. });
  5184. },
  5185. // 查看工时记录弹窗
  5186. toView() {
  5187. this.toViewDialogVisible = true
  5188. this.toViewloading = true
  5189. this.getToView()
  5190. },
  5191. getToView() {
  5192. this.http.post( '/report-import-log/getList', this.toViewForm,
  5193. res => {
  5194. this.toViewloading = false;
  5195. if (res.code == "ok") {
  5196. // console.log(res.data, '数据数据')
  5197. this.toViewList = res.data.records
  5198. this.toViewForm.total = res.data.total
  5199. } else {
  5200. this.toViewloading = false;
  5201. this.$message({
  5202. message: res.msg,
  5203. type: "error"
  5204. });
  5205. }
  5206. })
  5207. },
  5208. //分页
  5209. handleCurrentChange(val) {
  5210. this.toViewForm.pageIndex = val;
  5211. this.getToView();
  5212. },
  5213. handleSizeChange(val) {
  5214. this.toViewForm.pageSize = val;
  5215. this.getToView();
  5216. },
  5217. },
  5218. created() {
  5219. let height = window.innerHeight;
  5220. this.tableHeight = height - 178;
  5221. const that = this;
  5222. window.onresize = function temp() {
  5223. that.tableHeight = window.innerHeight - 178;
  5224. };
  5225. this.toViewForm.companyId = this.user.companyId
  5226. this.initDrag([{
  5227. type: "LR",
  5228. domClass: {
  5229. // 中间分割线的名字
  5230. resize: "line-line",
  5231. // 左侧盒子的名字
  5232. left: "box-left",
  5233. // 右侧盒子的名字
  5234. right: "box-right",
  5235. // 父级的名字
  5236. box: "box-father",
  5237. },
  5238. otherInfo: {
  5239. // 限制左边栏最低宽度
  5240. leftWidth: 120,
  5241. },
  5242. },
  5243. {
  5244. type: "LR",
  5245. domClass: {
  5246. // 中间分割线的名字
  5247. resize: "line-second",
  5248. // 左侧盒子的名字
  5249. left: "left-laowang",
  5250. // 右侧盒子的名字
  5251. right: "box-second-father",
  5252. // 父级的名字
  5253. box: "grand",
  5254. },
  5255. otherInfo: {
  5256. // 限制左边栏最低宽度
  5257. leftWidth: 120,
  5258. },
  5259. },
  5260. ]);
  5261. },
  5262. mounted() {
  5263. var now = new Date();
  5264. var t = util.formatDate.format(now, 'yyyy-MM-dd');
  5265. var startStr = util.formatDate.format(new Date(), 'yyyy-MM') + "-01";
  5266. this.exportParam.dateRange = [startStr,t];
  5267. this.getAllDate(1);
  5268. this.getReportList();
  5269. this.getProjectList();
  5270. this.getFillProjectList();
  5271. this.getTimeType();
  5272. this.getDepartment();
  5273. this.scrollFunction()
  5274. this.userssHu();
  5275. if (this.user.company.packageProject == 1) {
  5276. this.getBasecostItemList();
  5277. }
  5278. if(this.user.timeType.lockWorktime){
  5279. this.timeRange = this.timeRange.filter(item => {return item <= this.user.timeType.allday})
  5280. }
  5281. }
  5282. };
  5283. </script>
  5284. <style lang="scss" scoped>
  5285. .paginatis {
  5286. padding: 10px 10px;
  5287. background: #f2f2f2;
  5288. }
  5289. .waiting {
  5290. color:orange;
  5291. }
  5292. .filledReportStyle {
  5293. color:#32CD32;
  5294. }
  5295. .RejectStyle {
  5296. color:red;
  5297. }
  5298. .waitSubmitStyle{
  5299. color: #409eff;
  5300. }
  5301. .chooseDate {
  5302. .waiting {
  5303. color: #20a0ff;
  5304. }
  5305. .filledReportStyle {
  5306. color:#20a0ff;
  5307. }
  5308. .RejectStyle {
  5309. color: #20a0ff;
  5310. }
  5311. .waitSubmitStyle{
  5312. color: #20a0ff;
  5313. }
  5314. }
  5315. .allDaily {
  5316. width:100%;
  5317. }
  5318. .report_title {
  5319. padding:10px 0;
  5320. color:#666;
  5321. }
  5322. .clearfix {
  5323. overflow-x: auto;
  5324. white-space: nowrap;
  5325. padding: 15px 0 10px 0;
  5326. // overflow-y: hidden;
  5327. .date_item {
  5328. padding: 0 3px;
  5329. cursor: pointer;
  5330. position: relative;
  5331. }
  5332. .chooseDate {
  5333. position: absolute;
  5334. bottom: -3px;
  5335. width: 34px;
  5336. height: 2px;
  5337. left: 12px;
  5338. background: #20a0ff;
  5339. }
  5340. }
  5341. .one_daily {
  5342. i {
  5343. color: #9ed0ff;
  5344. margin-right: 5px;
  5345. }
  5346. .one_daily_body {
  5347. padding: 10px 0px;
  5348. p {
  5349. margin: 0;
  5350. line-height: 30px;
  5351. }
  5352. }
  5353. ul {
  5354. padding: 0;
  5355. }
  5356. }
  5357. .checkbtn {
  5358. float: right;
  5359. margin-top: -10px;
  5360. }
  5361. .selConStyle{
  5362. margin-top:9rem;
  5363. margin-bottom:11rem;
  5364. .selConStyle_title{
  5365. height: 3rem;
  5366. text-align: center;
  5367. font-size: 17px;
  5368. }
  5369. .el-select{
  5370. margin: 0 15%;
  5371. width: 70%;
  5372. }
  5373. }
  5374. </style>
  5375. <style lang="scss">
  5376. .daily {
  5377. .el-card__body {
  5378. height: 80%;
  5379. overflow-y: auto;
  5380. }
  5381. .el-card__header {
  5382. padding: 0 20px;
  5383. }
  5384. }
  5385. .membListClass{
  5386. .el-dialog__body{
  5387. padding-top: 10px;
  5388. }
  5389. }
  5390. </style>
  5391. <style scoped>
  5392. /* 项目标签的样式 */
  5393. .el-tag + .el-tag {
  5394. margin-left: 10px;
  5395. }
  5396. .button-new-tag {
  5397. margin-left: 10px;
  5398. height: 32px;
  5399. line-height: 30px;
  5400. padding-top: 0;
  5401. padding-bottom: 0;
  5402. }
  5403. .input-new-tag {
  5404. width: 90px;
  5405. margin-left: 10px;
  5406. vertical-align: bottom;
  5407. }
  5408. .selectworktime .el-table__fixed-body-wrapper{
  5409. top: 48px !important;
  5410. }
  5411. .selectworktime_export .selectworktime_export_l{
  5412. width: 65%;
  5413. float: left;
  5414. height: 42px;
  5415. }
  5416. .approvalProcessBox{
  5417. margin-left: 30px;
  5418. font-size: 14px;
  5419. line-height: 16px;
  5420. cursor: pointer;
  5421. }
  5422. .approvalProcessBox i {
  5423. margin-right: 0;
  5424. height: 16px;
  5425. width: 16px;
  5426. display: inline-block;
  5427. transform: scale(1.2);
  5428. position: relative;
  5429. top: 0.5px;
  5430. color: #409eff;
  5431. }
  5432. .approvalProcessBox .approvalProcessClick{
  5433. cursor: pointer;
  5434. color: #409eff;
  5435. font-size: 14px;
  5436. }
  5437. .approvalProcessBox:hover .approvalProcessClick{
  5438. color: #3485fb;
  5439. }
  5440. </style>
  5441. <style lang="scss" scoped>
  5442. // 加班样式
  5443. .overtime {
  5444. display: inline-block;
  5445. margin-left: 20px;
  5446. input {
  5447. display: inline-block;
  5448. margin-top: 5px;
  5449. }
  5450. }
  5451. .plus {
  5452. display: inline-block;
  5453. }
  5454. // .tages {
  5455. // float: right;
  5456. // }
  5457. .overtime {
  5458. display: inline-block;
  5459. margin-left: 30px;
  5460. }
  5461. .bloks {
  5462. display: inline-block;
  5463. width: 380px;
  5464. }
  5465. .zhiss {
  5466. display: flex;
  5467. justify-content: space-around;
  5468. align-items: center;
  5469. }
  5470. .zhoFel {
  5471. display: flex;
  5472. justify-content: space-between;
  5473. align-items: center;
  5474. }
  5475. // 左右滑动样式
  5476. .line {
  5477. width: 30px;
  5478. /* height: 500px; */
  5479. background: #f2f2f2;
  5480. cursor: w-resize;
  5481. }
  5482. .box-father {
  5483. border: 8px solid #000;
  5484. }
  5485. .line-second {
  5486. width: 10px;
  5487. /* background: red; */
  5488. }
  5489. .flex {
  5490. display: flex;
  5491. width: 100%;
  5492. }
  5493. .box-left {
  5494. flex: 0 0 400px;
  5495. /* height: 600px; */
  5496. /* background: blue; */
  5497. }
  5498. .box-right {
  5499. /* height: 600px; */
  5500. /* background: green; */
  5501. flex: 1;
  5502. }
  5503. .box-postion {
  5504. width: 200px;
  5505. /* height: 400px; */
  5506. background: #ccc;
  5507. }
  5508. .custom-tree-node {
  5509. flex: 1;
  5510. display: flex;
  5511. align-items: center;
  5512. justify-content: space-between;
  5513. font-size: 14px;
  5514. padding-right: 8px;
  5515. }
  5516. </style>