daily.vue 187 KB

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