daily.vue 260 KB

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