daily.vue 229 KB

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