daily.vue 256 KB

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