daily.vue 289 KB

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