daily.vue 259 KB

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