daily.vue 275 KB

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