daily.vue 294 KB

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