daily.vue 226 KB

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