daily.vue 277 KB

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