daily.vue 280 KB

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