daily.vue 241 KB

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