daily.vue 164 KB

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