daily.vue 180 KB

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