daily.vue 277 KB

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