daily.vue 306 KB

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