daily.vue 257 KB

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