daily.vue 253 KB

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