daily.vue 239 KB

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