daily.vue 257 KB

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