daily.vue 316 KB

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