daily.vue 286 KB

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