daily.vue 261 KB

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