daily.vue 266 KB

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