daily.vue 212 KB

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