daily.vue 193 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849
  1. <template>
  2. <section v-loading="zhoLoading">
  3. <!--列表-->
  4. <div>
  5. <el-card class="box-card daily" shadow="never">
  6. <div slot="header" class="clearfix" id="clearfix" style="padding-left: 255px;">
  7. <div class="jjk" style="display:inline-block;position:fixed;top:70px;background:#fff;left:250px;">
  8. <el-date-picker size="small" v-model="date" :editable="false" format="yyyy-MM" value-format="yyyy-MM"
  9. style="width:190px;"
  10. @change="changeMonthOut" :clearable="false" type="month" placeholder="选择月份"></el-date-picker>
  11. <el-button style="margin-left:10px;" icon="iconfont firerock-icongongshitongji" size="mini" @click="showMonthWorkTime"></el-button>
  12. </div>
  13. <span v-for="(item,index) in allDate" :id="'day'+index" :class="index==choseDay?'chooseDate date_item':'date_item'"
  14. @click="choseDate(index, item)" :key="index" >
  15. <div :style="'display:inline-block;'+(item.state == null?'padding:0px 6px;':'')" >
  16. <div><span>{{item.showDate}}</span>
  17. <span style="font-size:10px;text-align:center;color:#999;">{{item.weekDay}}</span>
  18. </div>
  19. </div>
  20. <i v-if="item.state != null" class="iconfont firerock-icondot" :class="statusStyle[item.state]"></i>
  21. </span>
  22. </div>
  23. <div style="display:flex;">
  24. <div v-if="user.role > 0 || user.manageDeptId != 0" >
  25. <div style="width:190px;">
  26. <el-select v-model="selectState" size="small" @change="stateChange" >
  27. <el-option value="-1" label="全部状态" >全部状态</el-option>
  28. <el-option value="-2" label="未填报">未填报</el-option>
  29. <el-option value="1" label="已通过">已通过</el-option>
  30. <el-option value="0" label="待审核">待审核</el-option>
  31. <el-option value="2" label="不通过">不通过</el-option>
  32. <el-option value="3" label="待提交">待提交</el-option>
  33. </el-select></div>
  34. <div>
  35. <el-tree :data="data" @node-click="handleNodeClick" >
  36. <span class="custom-tree-node" slot-scope="{ node, data}">
  37. <span>{{ node.label }}</span>
  38. <span v-if="data.membCount != null && data.isUser == null">({{data.membCount}})</span>
  39. <div style="width:0%;float:right;">
  40. <span v-if="data.isUser == 1 && data.state == null" style="color:red;">
  41. 未填报
  42. </span>
  43. <span v-if="data.isUser == 1 && data.state == 0" style="color:orange;">
  44. 待审核
  45. </span>
  46. <span v-if="data.isUser == 1 && data.state == 1" style="color:green;">
  47. 已通过
  48. </span>
  49. <span v-if="data.isUser == 1 && data.state == 2" style="color:red;">
  50. 未通过
  51. </span>
  52. <span v-if="data.isUser == 1 && data.state == 3" style="color:red;">
  53. 待提交
  54. </span>
  55. </div>
  56. </span>
  57. </el-tree>
  58. </div>
  59. </div>
  60. <div :style="'height:'+tableHeight+'px;width:0.5px;background:#eee;margin-right:10px;margin-left:10px;'" ></div>
  61. <div class="allDaily" style="float:left;flex-grow:1">
  62. <!--系统管理员和部门负责人 -->
  63. <div class="report_title" >
  64. <span>工作日报 </span>
  65. <span v-if="user.role==1||user.role==2||user.role==6||user.manageDeptId != 0">| {{depData != null ?depData.label:""}}
  66. <span v-if="targetUid == null">
  67. - 已填写
  68. <el-link :underline="false" @click="showMembList(1)"><span style="margin-left:5px;margin-right:5px;color:green;">{{reportList.length}}</span></el-link>人,
  69. 未填写<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>人
  70. </span>
  71. </span>
  72. <span style="float:right;">
  73. <el-link type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReport(-1,0)">填写日报</el-link>
  74. <el-link v-if="reportTimeType.type != 0" type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReportss()">按周填报</el-link>
  75. <el-link type="primary" v-if="user.role==1||user.role==2||user.leader==1||user.manageDeptId != 0" style="margin-right:10px;" :underline="false" @click="isSubstitude=true; fillInReport(-1,0)">代填日报</el-link>
  76. <el-link type="primary" style="margin-right:10px;" :underline="false" @click="isSubstitude=false;fillInReport(-1,1)">批量填报</el-link>
  77. <el-link type="primary" v-if="user.role==1||user.role==2||user.role==6||user.manageDeptId != 0" style="margin-right:10px;" :underline="false" @click="imports()">工时导入</el-link>
  78. <el-link type="primary" style="margin-right:10px;" :underline="false" @click="showExportDialog">导出日报</el-link>
  79. </span>
  80. </div>
  81. <!--普通员工,含项目经理 -->
  82. <!-- <div class="report_title" v-if="(user.role==0||user.role==3||user.role==5) && user.manageDeptId == 0"><span>日报列表</span>
  83. <span style="float:right;" v-if="(user.role==0||user.role==3||user.role==5) && user.manageDeptId == 0">
  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="user.leader" 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. </span> -->
  89. <!-- </div> -->
  90. <div :style="'height:'+(tableHeight-50)+'px;overflow:scroll;padding-top:10px;'">
  91. <div class="one_daily" v-for="(item1,index1) in reportList" :key="index1">
  92. <i class="fa fa-circle"></i>{{item1.name}}
  93. <span style="margin-left:30px;">
  94. <span style="margin-right:20px;">
  95. <!-- <i v-if="parseFloat(item1.reportTime)>parseFloat(item1.calculateTime)+0.5" style="color:red;margin-right:8px;" class="fa fa-exclamation-triangle"></i> -->
  96. 工作总时长:
  97. <!-- <span :style="parseFloat(item1.reportTime)>parseFloat(item1.calculateTime)+0.5?'color:red':''">{{item1.reportTime}}h</span> -->
  98. <span >{{item1.reportTime}}</span>h
  99. <span v-if="user.role ==1 || user.role == 2 ||user.role == 6"><span style="margin-left:10px;">成本:</span>
  100. <span >{{item1.cost}}</span>元</span>
  101. </span>
  102. </span>
  103. <div class="checkbtn" style="padding-right:20px;">
  104. <el-button v-if="item1.state >= 2 && user.id == item1.id" type="primary" size="small" @click="isSubstitude=false; fillInReport(index1,0)">编辑日报</el-button>
  105. <el-button v-if="(user.role == 1 || user.role == 2 || user.manageDeptId != 0) && item1.state != 1" size="small" @click="guanli(item1)" style="float: right;">删除</el-button>
  106. </div>
  107. <div class="one_daily_body">
  108. <el-timeline>
  109. <el-timeline-item v-for="(item2,index2) in item1.data" :key="index2">
  110. <el-card shadow="never">
  111. <p>项目:<b>{{item2.project}}</b><span v-if="item2.subProjectName != null"> / {{item2.subProjectName}}</span>
  112. <span v-if="user.company.packageEngineering == 0">
  113. <span style="margin-left:15px;color:#DAA520;" v-if="item2.state == 0">[
  114. <span v-if="item2.isDeptAudit==0">
  115. <span v-if="item2.projectAuditState==0">
  116. 待项目负责人审核
  117. </span>
  118. <span style="color:#32CD32;" v-else-if="item2.projectAuditState==1">
  119. 项目负责人审核通过
  120. </span>
  121. <!-- {{item2.isDeptAudit==0?(item2.projectAuditState==0?'待项目负责人审核':'项目负责人审核通过'):('待'+item2.auditDeptName+'审核')}} -->
  122. </span>
  123. <span v-else-if="item2.isDeptAudit==1">
  124. {{('待'+item2.auditDeptName+'审核')}}
  125. </span>
  126. ]</span>
  127. <span style="margin-left:15px;color:#DAA520;" v-else-if="item2.state == -1">[ 导入待审核 ]</span>
  128. <span style="margin-left:15px;color:#32CD32;" v-else-if="item2.state == 1">[ 已通过 ]</span>
  129. <span style="margin-left:15px;color:#FF0000;" v-else-if="item2.state == 2">[ 已驳回 ] 原因:{{item2.rejectReason}}</span>
  130. <span style="margin-left:15px;color:#FF0000;" v-else-if="item2.state == 3">[ 待提交 ]</span>
  131. </span>
  132. <!-- <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> -->
  133. <span v-if="user.company.packageEngineering == 1">
  134. <span style="margin-left:15px;color:#DAA520;" v-if="item2.state == -1">[ 导入待审核 ]</span>
  135. <span style="margin-left:15px;color:#DAA520;" v-if="item2.state == 0 && item2.departmentAuditState == -1">[ 待专业审核 ]</span>
  136. <span style="margin-left:15px;color:#DAA520;" v-if="item2.state == 0 && item2.departmentAuditState == 0">[ 待部门审核 ]</span>
  137. <span style="margin-left:15px;color:#DAA520;" v-if="item2.state == 0 && item2.departmentAuditState == 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. <!--每个项目上单独审核 -->
  143. <span style="float:right;">
  144. <el-button v-if="(user.role == 1 || user.role == 2 || user.id == item2.inchargerId) && item2.state == 0 && item2.isDeptAudit==0 && item2.projectAuditState==0" type="primary" :loading="logining"
  145. size="small" @click="approve(item1.id, item2)">通过</el-button>
  146. <el-button v-if="(user.role == 1 || user.role == 2 || user.id == item2.inchargerId) && item2.state == 0 && item2.isDeptAudit==0 && item2.projectAuditState==0" type="danger" :loading="logining"
  147. size="small" @click="showDenyDialog(item1.id,0, item2)">驳回</el-button>
  148. <el-button v-if="(user.role == 1 || user.role == 2 || user.id == item2.inchargerId) && item2.state == 1" type="normal" :loading="logining" size="small"
  149. @click="showDenyDialog(item1.id,1, item2)">撤销</el-button>
  150. <!--自己可以撤回待审核状态的报告 -->
  151. <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>
  152. </span>
  153. </p>
  154. <!--任务分组和阶段 -->
  155. <p v-if="item2.groupId != 0">任务分组:{{item2.groupName}} <span v-if="item2.stage != null && item2.stage != '-'" style="margin-left:10px;">投入阶段:{{item2.stage}}</span></p>
  156. <p v-if="user.timeType.customDegreeActive==1 && item2.degree_id != null && item2.degree_id != -1">{{user.timeType.customDegreeName}}:{{item2.degreeName}}</p>
  157. <p v-if="user.company.packageEngineering == 1">
  158. 专业进度:
  159. <span style="margin-right:10px;" v-for="progressItem in item2.professionProgress" :key="progressItem.id">{{progressItem.professionName}}({{progressItem.progress}}%)
  160. <el-tooltip v-if="progressItem.auditState == 0" content="待审核" effect="light" placement="top">
  161. <i class="iconfont firerock-icondaibandengdaishenhe"></i>
  162. </el-tooltip>
  163. <el-tooltip v-if="progressItem.auditState == 1" content="已通过" effect="light" placement="top">
  164. <i class="iconfont firerock-iconshenhetongguo"></i>
  165. </el-tooltip>
  166. <el-tooltip v-if="progressItem.auditState == 2" content="不通过" effect="light" placement="top">
  167. <i class="iconfont firerock-iconshenhebohui"></i>
  168. </el-tooltip>
  169. </span>
  170. </p>
  171. <p v-if="item2.taskId != null">任务:{{item2.taskName}}
  172. </p>
  173. <div v-if="item2.multiWorktime==0">
  174. <p style="display: inline-block;">时长:
  175. <span v-if="item2.reportTimeType == 0" style="margin-right:10px;">{{typeList[item2.timeType]}}</span>
  176. <span v-if="item2.reportTimeType == 2" style="margin-right:10px;">{{item2.startTime+'-'+item2.endTime}}</span>
  177. {{item2.time.toFixed(1)}}h
  178. <el-tag type="danger" size="mini" style="margin-left: 65px" v-if="item2.isOvertime === 1">加班</el-tag>
  179. </p>
  180. <p>事项:<span v-html="item2.content"></span></p>
  181. </div>
  182. <div v-if="item2.multiWorktime==1" >
  183. <div v-for="(timeItem, tIndex) in item2.worktimeList" :key="tIndex"
  184. style="border: 0.5px #ddd solid;margin-bottom:5px;padding:5px;">
  185. <p style="display: inline-block;">时长:
  186. <span v-if="item2.reportTimeType == 2" style="margin-right:10px;">{{timeItem.startTime+'-'+timeItem.endTime}}</span>
  187. {{timeItem.time.toFixed(2)}}h
  188. <el-tag type="danger" size="mini" style="margin-left: 65px" v-if="item2.isOvertime === 1">加班</el-tag>
  189. </p>
  190. <p>事项:<span v-html="timeItem.content"></span></p>
  191. </div>
  192. </div>
  193. <!--照片的显示 -->
  194. <p v-if="item2.pics != null && item2.pics.length > 0">
  195. <el-image v-for="(pic, index) in item2.pics" :key="index"
  196. style="width: 100px; height: 100px; margin-right:10px;"
  197. :src="pic"
  198. :preview-src-list="item2.pics">
  199. </el-image>
  200. </p>
  201. </el-card>
  202. </el-timeline-item>
  203. </el-timeline>
  204. </div>
  205. </div>
  206. <!-- 简陋的无报告提示 -->
  207. <div v-if="reportList.length==0" style="width:100%;font-size:17px;text-align:center;color:#aaa;">{{curDate}}暂无报告</div>
  208. </div>
  209. </div>
  210. </div>
  211. </el-card>
  212. </div>
  213. <!-- 填写日报的dialog -->
  214. <el-dialog :title="isBatch==0?'填写日报':'批量填报'" :visible.sync="dialogVisible" width="60%" :close-on-click-modal="false" @closed="guanbi()">
  215. <el-form ref="workForm" :model="workForm" :rules="workRules" label-width="100px">
  216. <el-form-item label="选择人员" v-if="isSubstitude">
  217. <el-input @focus="showChooseMembTree" v-model="workForm.userNames"
  218. placeholder="请选择代填人员" ></el-input>
  219. </el-form-item>
  220. <el-form-item label="工作日期" prop="createDate">
  221. <el-date-picker v-model="workForm.createDate" :editable="false" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  222. :style="'width:'+(isBatch==0?'200':'280')+'px;'" :type="isBatch==0?'date':'daterange'"
  223. @change="changeMonth()" @blur="iptBlur(reportTimeType.type)" :clearable="false" placeholder="选择工作日期" :disabled="isDisable"></el-date-picker>
  224. <div v-if="falsss" style="display: inline-block;">总{{jsDay}} 天, 共{{jsTime}} 小时</div>
  225. <div v-if="isBatch!=0" style="display: inline-block;">总{{jsDay}} 天, 共{{jsTime}} 小时</div>
  226. <span v-if="reportTimeType.type == 3" style="margin-left:30px;">{{isBatch==0?'总':'每日'}}时长:</span>
  227. <el-input-number :disabled="!canEdit" v-if="reportTimeType.type == 3" style="margin-left:10px;" @change="changeAllTime"
  228. v-model="reportTimeType.allday" :precision="1" :step="0.5" :max="12" :min="0.5"></el-input-number>
  229. <span v-if="reportTimeType.type == 3">小时</span>
  230. </el-form-item>
  231. <div v-for="(domain, index) in workForm.domains" :key="domain.id">
  232. <div v-if="reportTimeType.multiWorktime==0">
  233. <el-form-item v-if="reportTimeType.type != 3" :label="reportTimeType.type ==2?'工作时间':'工作时长'" :prop="'domains.' + index + '.'+timeFields[reportTimeType.type]"
  234. :rules="{ required: true, message: '请选择工作时长', trigger: 'blur' }">
  235. <el-select v-model="domain.timeType" style="width:200px;"
  236. v-if="reportTimeType.type == 0"
  237. placeholder="请选择工作时长"
  238. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  239. @change="onTimeTypeChange(domain.timeType)">
  240. <el-option
  241. v-for="item in timeType"
  242. :key="item.value"
  243. :label="item.label"
  244. :value="item.value">
  245. </el-option>
  246. </el-select>
  247. <!-- 数字时长选择 -->
  248. <el-select v-model="domain.workingTime" style="width:200px;"
  249. v-if="reportTimeType.type == 1"
  250. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  251. placeholder="请选择工作时长"
  252. @change="seleChn(0)">
  253. <el-option v-for="item in timeRange" :key="item" :value="item.toFixed(1)">{{item.toFixed(1)}}</el-option>
  254. </el-select>
  255. <span v-if="reportTimeType.type == 1">小时</span>
  256. <span v-if="reportTimeType.type == 2">
  257. <!--时间范围选择 -->
  258. <el-time-picker
  259. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  260. v-model="domain.startTime"
  261. placeholder="起始时间"
  262. style="width:120px;"
  263. format="HH:mm"
  264. value-format="HH:mm"
  265. :picker-options="{
  266. start: '08:00',
  267. end: '23:30'
  268. }"
  269. @change="iptChang()">
  270. </el-time-picker> - <el-time-picker
  271. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  272. v-model="domain.endTime"
  273. placeholder="结束时间"
  274. style="width:120px;"
  275. format="HH:mm"
  276. value-format="HH:mm"
  277. :picker-options="{
  278. start: '08:00',
  279. end: '23:30',
  280. minTime: domain.startTime
  281. }"
  282. @change="iptChang()">
  283. </el-time-picker>
  284. </span>
  285. <div class="overtime"><el-checkbox :disabled="!canEdit" v-model="domain.isOvertime">加班</el-checkbox></div>
  286. </el-form-item>
  287. <el-form-item label="投入项目" :prop="'domains.' + index + '.projectId'"
  288. :rules="{ required: true, message: '请选择投入项目', trigger: ['change','blur'] }">
  289. <el-select v-model="domain.projectId" placeholder="请选择项目" style="width:200px;" clearable="true" filterable="true"
  290. @change="selectProject(domain, index)"
  291. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  292. <el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id"></el-option>
  293. </el-select>
  294. <span v-if="domain.subProjectList != null && domain.subProjectList.length> 0"
  295. style="margin-left:45px;">子项目</span>
  296. <!--子项目 -->
  297. <el-select v-model="domain.subProjectId" placeholder="请选择子项目" style="width:200px;margin-left:10px;" clearable="true"
  298. v-if="domain.subProjectList != null && domain.subProjectList.length> 0"
  299. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)" @change="updateSubProject">
  300. <el-option v-for="item in domain.subProjectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  301. </el-select>
  302. <el-link v-if="index >= 1" type="primary" :underline="false" @click="delDomain(index)" style="float:right;margin-right:10px;"
  303. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  304. <i class="fa fa-trash" style="color: red;;font-size:18px;"></i>
  305. </el-link>
  306. <el-link type="primary" v-if="workForm.domains[index].state == 0 || workForm.domains[index].state == 2"
  307. :underline="false" style="margin-left:10px;" @click="copyProject(index)">复制</el-link>
  308. </el-form-item>
  309. <el-form-item label="任务分组" v-if="user.company.packageProject == 1">
  310. <!-- 任务分组 -->
  311. <el-select v-model="domain.groupId" placeholder="请选择任务分组" style="width:200px;" clearable="true"
  312. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)" @change="getGroupStages(domain, index)">
  313. <el-option v-for="item in domain.taskGroups" :key="item.id" :label="item.name" :value="item.id"></el-option>
  314. </el-select>
  315. <!-- 项目的阶段 -->
  316. <span v-if="domain.stages != null && domain.stages.length> 0"
  317. style="margin-left:30px;">投入阶段</span>
  318. <el-select v-model="domain.stage" placeholder="请选择" style="width:200px;margin-left:10px;"
  319. clearable="true" v-if="domain.stages != null && domain.stages.length> 0"
  320. @change="changeStages(domain, index)"
  321. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  322. <el-option v-for="item in domain.stages" :key="item.id" :label="item.stagesName" :value="item.stagesName"></el-option>
  323. </el-select>
  324. </el-form-item>
  325. <!-- 相关维度 -->
  326. <el-form-item :label="yonghuUser.customDegreeName" v-if="domain.projectId && yonghuUser.customDegreeActive == 1">
  327. <el-select v-model="domain.degreeId" clearable placeholder="请选择">
  328. <el-option v-for="item in domain.wuduList" :key="item.value" :label="item.name" :value="item.id">
  329. </el-option>
  330. </el-select>
  331. </el-form-item>
  332. <el-form-item v-if="reportTimeType.type == 3" label="用时占比" :prop="'domains.' + index + '.'+timeFields[reportTimeType.type]"
  333. :rules="{ required: true, message: '请设置用时占比', trigger: 'blur' }">
  334. <div style="width:300px;">
  335. <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>
  336. <el-col span="10"><span style="margin-left:10px;float:right;"><span style="margin-right:10px;">{{domain.progress}}%</span>{{domain.workingTime}}小时</span></el-col>
  337. </div>
  338. <div class="overtime"><el-checkbox :disabled="!canEdit" v-model="domain.isOvertime">加班</el-checkbox></div>
  339. </el-form-item>
  340. <!--工程专业版本模式下, 各个专业的进度填报 -->
  341. <el-form-item label="专业进度" :prop="'domains.' + index + '.professionProgress'" v-if="user.company.packageEngineering==1">
  342. <span v-for="item in domain.professionProgress" :key="item.professionId" style="margin-right:10px;">
  343. <span>{{item.professionName}}</span> / 进度:
  344. <el-input size="mini" style="width:60px;" v-model="item.progress"
  345. @keyup.native="onProgressChange"
  346. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"></el-input>%
  347. </span>
  348. </el-form-item>
  349. <!--项目管理专业版模式下,项目下的近期执行的任务 -->
  350. <el-form-item label="相关任务" :prop="'domains.' + index + '.taskId'" v-if="user.company.packageProject==1" >
  351. <el-select v-model="domain.taskId" placeholder="请选择" style="width:100%;" filterable="true"
  352. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  353. <el-option v-for="item in domain.taskList" :key="item.taskId" :label="item.taskName" :value="item.taskId"></el-option>
  354. </el-select>
  355. </el-form-item>
  356. <el-form-item label="工作事项" :prop="'domains.' + index + '.content'" >
  357. <el-input v-model="domain.content" type="textarea" :rows="4" placeholder="请填写工作事项" clearable
  358. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"></el-input>
  359. </el-form-item>
  360. </div>
  361. <!--多个工作事项填报的情况 -->
  362. <div v-if="reportTimeType.multiWorktime==1">
  363. <el-form-item label="投入项目" :prop="'domains.' + index + '.projectId'"
  364. :rules="{ required: true, message: '请选择投入项目', trigger: ['change','blur'] }">
  365. <el-select v-model="domain.projectId" placeholder="请选择项目" style="width:200px;" clearable="true" filterable="true"
  366. @change="selectProject(domain, index)"
  367. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  368. <el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id"></el-option>
  369. </el-select>
  370. <span v-if="domain.subProjectList != null && domain.subProjectList.length> 0"
  371. style="margin-left:45px;">子项目</span>
  372. <!--子项目 -->
  373. <el-select v-model="domain.subProjectId" placeholder="请选择子项目" style="width:200px;margin-left:10px;" clearable="true"
  374. v-if="domain.subProjectList != null && domain.subProjectList.length> 0"
  375. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)" @change="updateSubProject">
  376. <el-option v-for="item in domain.subProjectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  377. </el-select>
  378. <el-link v-if="index >= 1" type="primary" :underline="false" @click="delDomain(index)" style="float:right;margin-right:10px;"
  379. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  380. <i class="fa fa-trash" style="color: red;;font-size:18px;"></i>
  381. </el-link>
  382. <el-link type="primary" v-if="workForm.domains[index].state == 0 || workForm.domains[index].state == 2"
  383. :underline="false" style="margin-left:10px;" @click="copyProject(index)">复制</el-link>
  384. </el-form-item>
  385. <el-form-item label="任务分组" v-if="user.company.packageProject == 1">
  386. <!-- 任务分组 -->
  387. <el-select v-model="domain.groupId" placeholder="请选择任务分组" style="width:200px;" clearable="true"
  388. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)" @change="getGroupStages(domain, index)">
  389. <el-option v-for="item in domain.taskGroups" :key="item.id" :label="item.name" :value="item.id"></el-option>
  390. </el-select>
  391. <!-- 项目的阶段 -->
  392. <span v-if="domain.stages != null && domain.stages.length> 0"
  393. style="margin-left:30px;">投入阶段</span>
  394. <el-select v-model="domain.stage" placeholder="请选择" style="width:200px;margin-left:10px;"
  395. clearable="true" v-if="domain.stages != null && domain.stages.length> 0"
  396. @change="changeStages(domain, index)"
  397. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  398. <el-option v-for="item in domain.stages" :key="item.id" :label="item.stagesName" :value="item.stagesName"></el-option>
  399. </el-select>
  400. </el-form-item>
  401. <!--工程专业版本模式下, 各个专业的进度填报 -->
  402. <el-form-item label="专业进度" :prop="'domains.' + index + '.professionProgress'" v-if="user.company.packageEngineering==1">
  403. <span v-for="item in domain.professionProgress" :key="item.professionId" style="margin-right:10px;">
  404. <span>{{item.professionName}}</span> / 进度:
  405. <el-input size="mini" style="width:60px;" v-model="item.progress"
  406. @keyup.native="onProgressChange"
  407. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"></el-input>%
  408. </span>
  409. </el-form-item>
  410. <!-- 相关维度 -->
  411. <el-form-item :label="yonghuUser.customDegreeName" v-if="domain.projectId && yonghuUser.customDegreeActive == 1">
  412. <el-select v-model="domain.degreeId" clearable placeholder="请选择">
  413. <el-option v-for="item in domain.wuduList" :key="item.value" :label="item.name" :value="item.id">
  414. </el-option>
  415. </el-select>
  416. </el-form-item>
  417. <!--项目管理专业版模式下,项目下的近期执行的任务 -->
  418. <el-form-item label="相关任务" :prop="'domains.' + index + '.taskId'" v-if="user.company.packageProject==1" >
  419. <el-select v-model="domain.taskId" placeholder="请选择" style="width:100%;" filterable="true"
  420. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)">
  421. <el-option v-for="item in domain.taskList" :key="item.taskId" :label="item.taskName" :value="item.taskId"></el-option>
  422. </el-select>
  423. </el-form-item>
  424. <div v-for="(timeItem,tIndex) in domain.worktimeList" :key="tIndex"
  425. style="border: 0.5px #ddd solid;padding:5px;margin-bottom:15px;position:relative;">
  426. <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>
  427. <el-form-item label="工作时间" :prop="'domains.' + index + '.worktimeList.'+tIndex+'.'+timeFields[reportTimeType.type]"
  428. :rules="{ required: true, message: '请选择工作时间', trigger: 'blur' }">
  429. <span v-if="reportTimeType.type == 2">
  430. <!-- <span> -->
  431. <!--时间范围选择 -->
  432. <el-time-picker
  433. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  434. v-model="timeItem.startTime"
  435. placeholder="起始时间"
  436. style="width:120px;"
  437. format="HH:mm"
  438. value-format="HH:mm"
  439. :picker-options="{
  440. start: '00:00',
  441. end: '23:59',
  442. }"
  443. @change="iptChangs()">
  444. </el-time-picker> - <el-time-picker
  445. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  446. v-model="timeItem.endTime"
  447. placeholder="结束时间"
  448. style="width:120px;"
  449. format="HH:mm"
  450. value-format="HH:mm"
  451. :picker-options="{
  452. start: '00:00',
  453. end: '23:59',
  454. minTime: timeItem.startTime
  455. }"
  456. @change="iptChangs()">
  457. </el-time-picker>
  458. </span>
  459. </el-form-item>
  460. <el-form-item label="工作事项" :prop="'domains.' + index + '.worktimeList.'+tIndex+'.content'"
  461. :rules="{ required: true, message: '填写工作事项', trigger: 'blur' }">
  462. <el-input v-model="timeItem.content" type="textarea" :rows="2" placeholder="请填写工作事项" clearable
  463. :disabled="workForm.domains.length==0?true:(workForm.domains[index].state>=2?false:true)"
  464. ></el-input>
  465. </el-form-item>
  466. </div>
  467. <el-link size="small" @click="addNewWorktime(index, domain)" style="margin-left:15px;margin-top:5px;margin-bottom:5px;">添加工时</el-link>
  468. </div>
  469. <!--照片的显示 -->
  470. <p v-if="domain.pics != null && domain.pics.length > 0" style="text-align:center;">
  471. <el-image v-for="(pic, index) in domain.pics" :key="index"
  472. style="width: 100px; height: 100px; margin-right:10px;"
  473. :src="pic"
  474. :preview-src-list="domain.pics">
  475. </el-image>
  476. </p>
  477. <el-divider v-if="workForm.domains.length>1" style="margin-bottom:10px;"></el-divider>
  478. </div>
  479. <el-link v-if="showAddMore" :disabled="!canEdit" type="primary" :underline="false" @click="addDomain(reportTimeType.type)" style="margin-left:40px">添加更多</el-link>
  480. </el-form>
  481. <span slot="footer" class="dialog-footer">
  482. <el-button @click="deleteReport" v-if="workForm.domains[0].id != null">删除</el-button>
  483. <el-button @click="dialogVisible = false">取消</el-button>
  484. <el-button v-if="!isSubstitude" @click="submitReport(1)" :disabled="workForm.domains.length==0?true:(canEdit?false:true)">暂存</el-button>
  485. <el-button type="primary" @click="submitReport(0)"
  486. :disabled="workForm.domains.length==0?true:(canEdit?false:true)" >提交</el-button>
  487. </span>
  488. </el-dialog>
  489. <!-- 按周填报 -->
  490. <el-dialog title="按周填报" :visible.sync="diasZho" width="60%" :close-on-click-modal="false" @closed="guanbi()">
  491. <el-form ref="workForm" :model="workForm" :rules="workRules" label-width="100px">
  492. <el-form-item label="工作日期" prop="createDate">
  493. <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>
  494. <el-button @click="handleGetPrevWeek()">上周</el-button>
  495. <el-button @click="getCurrentWeek()">本周</el-button>
  496. <el-button @click="handleGetNextvWeek()">下周</el-button>
  497. <el-button @click="newDates()">新增日期</el-button>
  498. </el-form-item>
  499. <el-table :data="zhoData" style="width: 100%" v-loading="zhoLoading">
  500. <el-table-column fixed="left" prop="zhoDataTime" label="日期" width="160">
  501. <template slot-scope="scope">
  502. {{scope.row.zhoDataTime}}({{scope.row.zhoDataTime | zhoData}})
  503. </template>
  504. </el-table-column>
  505. <!-- <el-table-column align="center" v-for="(item, index) in projectList" :key="item.id" :label="item.projectName" width="200"> -->
  506. <el-table-column align="center" v-for="item in projectList" :key="item.id" :label="item.projectName" width="200">
  507. <template slot-scope="scope">
  508. <div v-if="reportTimeType.multiWorktime == 0" slot="reference" @click="tianxies(scope.row[item.projectName], scope.$index, item.projectName, workForm.domains)">
  509. <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>
  510. <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>
  511. <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>
  512. <el-button v-else type="text" >请填写</el-button>
  513. </div>
  514. <div v-if="reportTimeType.multiWorktime == 1" slot="reference" @click="tianxies(scope.row[item.projectName], scope.$index, item.projectName, workForm.domains)">
  515. <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>
  516. <el-button v-else type="text" >请填写</el-button>
  517. </div>
  518. </template>
  519. </el-table-column>
  520. <el-table-column fixed="right" prop="he" label="合计(h)" width="120">
  521. <template slot-scope="scope">
  522. <div class="zhiss">
  523. <p>{{scope.row.he}}</p>
  524. <el-button size="mini" icon="el-icon-delete" circle @click="zhoBtn(scope.$index)"></el-button>
  525. </div>
  526. </template>
  527. </el-table-column>
  528. </el-table>
  529. </el-form>
  530. <span slot="footer" class="dialog-footer">
  531. <el-button @click="diasZho = false">取 消</el-button>
  532. <el-button type="primary" @click="zhoAdd()">提 交</el-button>
  533. </span>
  534. </el-dialog>
  535. <!-- 选择时间 -->
  536. <el-dialog title="时间选择" :visible.sync="btnZho" width="30%" :before-close="handleClose">
  537. <span>这是一段信息</span>
  538. <span slot="footer" class="dialog-footer">
  539. <el-button @click="btnZho = false">取 消</el-button>
  540. <el-button type="primary" @click="btnZho = false">确 定</el-button>
  541. </span>
  542. </el-dialog>
  543. <!-- 按周填报弹窗 -->
  544. <el-dialog title="请填写" :visible.sync="tianxieDialogVisible" width="30%" :before-close="handleClose">
  545. <div>
  546. <div class="zhoFel" v-if="zhoBao.subProjectList != null && zhoBao.subProjectList.length > 0">
  547. <p>子项目</p>
  548. <el-select v-model="zhoBao.subProjectId" placeholder="请选择" clearable="true" style="width: 355px">
  549. <el-option v-for="item in zhoBao.subProjectList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  550. </el-select>
  551. </div>
  552. <div class="zhoFel" v-if="user.company.packageProject == 1 && zhoBao.stages != null && zhoBao.stages.length> 0">
  553. <p>投入阶段</p>
  554. <el-select v-model="zhoBao.stage" placeholder="请选择" style="width: 355px" clearable="true">
  555. <el-option v-for="item in zhoBao.stages" :key="item" :label="item" :value="item"></el-option>
  556. </el-select>
  557. </div>
  558. <div class="zhoFel" v-if="reportTimeType.type == 2">
  559. <p>选择时间</p>
  560. <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>
  561. </div>
  562. <div class="zhoFel" v-if="reportTimeType.type == 1">
  563. <p>选择时长</p>
  564. <el-select clearable v-model="zhoBao.workingTime" style="width: 355px;" placeholder="请选择工作时长">
  565. <el-option v-for="item in timeRange" :key="item" :value="item.toFixed(1)">{{item.toFixed(1)}}</el-option>
  566. </el-select>
  567. </div>
  568. <div class="zhoFel" v-if="reportTimeType.type == 3">
  569. <p>用时占比</p>
  570. <div style="width:355px;display: flex;align-items: center;">
  571. <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>
  572. <el-col span="10"><span style="float:right;"><span style="margin-right:10px;">{{zhoBao.progress || 0}}%</span>{{zhoBao.workingTime | amounts}}小时</span></el-col>
  573. </div>
  574. </div>
  575. <div class="zhoFel">
  576. <p>工作事项</p>
  577. <el-input type="textarea" v-model="zhoBao.con" placeholder="请输入工作事项" style="width: 355px" clearable></el-input>
  578. </div>
  579. </div>
  580. <span slot="footer" class="dialog-footer">
  581. <el-button @click="tianxieDialogVisible = false">取 消</el-button>
  582. <el-button type="primary" @click="btnTianxiaes()">确 定</el-button>
  583. </span>
  584. </el-dialog>
  585. <!-- 批量日报审核 -->
  586. <el-dialog title="批量项目报告审核" :visible.sync="approveDialogVisible" width="500px" >
  587. <el-checkbox v-model="isAllSelect" label="全选" style="margin-left:24px;" @change="selectAll" v-if="reportNames.length > 0"></el-checkbox>
  588. <el-tree ref="approveTree" node-key="id" :data="reportNames" show-checkbox="true" @check-change="handleCheckChange" >
  589. </el-tree>
  590. <div style="margin-left:30px;color:#999;" v-if="user.company.packageEngineering==1">仅能看到自己负责的待项目审核的日报填写人员</div>
  591. <span slot="footer" class="dialog-footer">
  592. <el-button @click="approveDialogVisible = false">取消</el-button>
  593. <el-button type="primary" @click="submitBatchApprove" :disabled="batchShowData.length == 0">审核通过</el-button>
  594. </span>
  595. </el-dialog>
  596. <!--导出报表条件选择 -->
  597. <el-dialog title="日报导出" v-if="exportDialog" :visible.sync="exportDialog" customClass="customWidth" width="500px">
  598. <el-form ref="form3" :model="exportParam" >
  599. <el-form-item prop="projectId" label="选择项目">
  600. <el-select v-model="exportParam.projectId" placeholder="全部项目" clearable style="width:350px;">
  601. <el-option v-for="item in projectList" :key="item.id" :label="item.projectName" :value="item.id"></el-option>
  602. </el-select>
  603. </el-form-item>
  604. <el-form-item prop="projectId" label="日期范围">
  605. <el-date-picker
  606. v-model="exportParam.dateRange" :editable="false"
  607. format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  608. :clearable="true"
  609. range-separator="至"
  610. type="daterange"
  611. start-placeholder="开始日期"
  612. end-placeholder="结束日期"
  613. ></el-date-picker>
  614. </el-form-item>
  615. </el-form>
  616. <div slot="footer" class="dialog-footer">
  617. <el-button type="primary" @click="exportReport" style="width:100%;" >导出</el-button>
  618. </div>
  619. </el-dialog>
  620. <!--人员列表 -->
  621. <el-dialog :title="(isFill?'已填':'未填')+'人员列表'" v-if="membListVisible" :visible.sync="membListVisible" width="500px">
  622. <el-table :show-header="false" :data="fillMembList" highlight-current-row :height="400" style="width: 100%;">
  623. <el-table-column type="index" width="60">
  624. <template slot-scope="scope" >
  625. {{scope.$index+1}}
  626. </template>
  627. </el-table-column>
  628. <el-table-column prop="label" label="姓名" ></el-table-column>
  629. <el-table-column prop="deptName" label="部门" >
  630. </el-table-column>
  631. </el-table>
  632. <div slot="footer" class="dialog-footer">
  633. <el-button type="primary" @click="weixinNotify" v-if="!isFill" :disabled="fillMembList == 0">微信催填</el-button>
  634. <el-button type="default" @click="exportMemb" :disabled="fillMembList == 0">导出</el-button>
  635. </div>
  636. </el-dialog>
  637. <!-- 按部门选择人员 -->
  638. <el-dialog title="选择需要代填报的人员" v-if="chooseParticipVisible" :visible.sync="chooseParticipVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
  639. <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
  640. <div class="tree" style="height:400px">
  641. <el-scrollbar style="height:100%">
  642. <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
  643. ref="chooseMembTree" @check-change="onTreeItemChange" :default-checked-keys="workForm.userId"
  644. highlight-current ></el-tree>
  645. </el-scrollbar>
  646. </div>
  647. <div>已选中&nbsp;{{chosenMembCount}}&nbsp;人</div>
  648. <div slot="footer" class="dialog-footer">
  649. <el-button @click="chooseParticipVisible = false" >取消</el-button>
  650. <el-button type="primary" @click="chooseParticip()" >确定</el-button>
  651. </div>
  652. </el-dialog>
  653. <el-dialog title="员工每日填报工时数" v-if="monthWorkTimeDialog" :visible.sync="monthWorkTimeDialog" :close-on-click-modal="false" customClass="customWidth" width="90%">
  654. <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
  655. <el-table :data="monthWorkData" border :height="500" highlight-current-row style="width: 100%;">
  656. <el-table-column width="60" type="index" fixed="left" label="序号">
  657. <template slot-scope="scope" >
  658. {{scope.$index+1}}
  659. </template>
  660. </el-table-column>
  661. <el-table-column width="100" prop="name" fixed="left" label="姓名">
  662. </el-table-column>
  663. <el-table-column width="90" v-for="(item,index) in allDate" :key="index" :label="item.showDate+'/'+item.weekDay" align="center">
  664. <template slot-scope="scope">
  665. <div style="color:red;"
  666. v-if="scope.row.worktimeList.filter(w=>w.createDate.split('-')[2] == item.date.split('月')[1].replace('日','')
  667. || w.createDate.split('-')[2] == '0'+item.date.split('月')[1].replace('日','') ).length > 0 && scope.row.worktimeList.filter(w=>w.createDate.split('-')[2] == item.date.split('月')[1].replace('日','')
  668. || w.createDate.split('-')[2] == '0'+item.date.split('月')[1].replace('日','') )[0].workingTime < reportTimeType.allday">
  669. {{scope.row.worktimeList.filter(w=>w.createDate.split('-')[2] == item.date.split('月')[1].replace('日','')
  670. || w.createDate.split('-')[2] == '0'+item.date.split('月')[1].replace('日','') )[0].workingTime
  671. }}</div>
  672. <div style="color:#20a0ff;"
  673. v-if="scope.row.worktimeList.filter(w=>w.createDate.split('-')[2] == item.date.split('月')[1].replace('日','')
  674. || w.createDate.split('-')[2] == '0'+item.date.split('月')[1].replace('日','') ).length > 0 && scope.row.worktimeList.filter(w=>w.createDate.split('-')[2] == item.date.split('月')[1].replace('日','')
  675. || w.createDate.split('-')[2] == '0'+item.date.split('月')[1].replace('日','') )[0].workingTime > reportTimeType.allday">
  676. {{scope.row.worktimeList.filter(w=>w.createDate.split('-')[2] == item.date.split('月')[1].replace('日','')
  677. || w.createDate.split('-')[2] == '0'+item.date.split('月')[1].replace('日','') )[0].workingTime
  678. }}</div>
  679. <div v-if="scope.row.worktimeList.filter(w=>w.createDate.split('-')[2] == item.date.split('月')[1].replace('日','')
  680. || w.createDate.split('-')[2] == '0'+item.date.split('月')[1].replace('日','') ).length > 0 && scope.row.worktimeList.filter(w=>w.createDate.split('-')[2] == item.date.split('月')[1].replace('日','')
  681. || w.createDate.split('-')[2] == '0'+item.date.split('月')[1].replace('日','') )[0].workingTime == reportTimeType.allday">
  682. {{scope.row.worktimeList.filter(w=>w.createDate.split('-')[2] == item.date.split('月')[1].replace('日','')
  683. || w.createDate.split('-')[2] == '0'+item.date.split('月')[1].replace('日','') )[0].workingTime
  684. }}</div>
  685. <div v-if="scope.row.worktimeList.filter(w=>w.createDate.split('-')[2] == item.date.split('月')[1].replace('日','')
  686. || w.createDate.split('-')[2] == '0'+item.date.split('月')[1].replace('日','') ).length == 0">
  687. 0
  688. </div>
  689. </template>
  690. </el-table-column>
  691. </el-table>
  692. <div slot="title" class="dialog-title">
  693. <label style="font-size:16px;">员工每日填报工时数</label>
  694. <el-link type="primary" style="float:right;margin-right:60px;" @click="exportMembWorkHours()" >导出数据</el-link>
  695. <!-- <el-button >导出</el-button> -->
  696. </div>
  697. </el-dialog>
  698. <!--驳回弹出框 -->
  699. <el-dialog title="请输入原因" v-if="denyReasonDialog" :visible.sync="denyReasonDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  700. <div>
  701. <el-input type="textarea" v-model="denyForm.reason" rows="2" :placeholder="'请输入您决定'+(denyForm.i==0?'驳回':'撤销')+'的原因'" />
  702. </div>
  703. <div slot="footer" class="dialog-footer">
  704. <el-button @click="denyReasonDialog = false" >取消</el-button>
  705. <el-button type="primary" @click="deny()" >确定</el-button>
  706. </div>
  707. </el-dialog>
  708. <!--批量导入日报 -->
  709. <el-dialog title="工时批量导入" v-if="importDialog" :visible.sync="importDialog" customClass="customWidth" width="500px">
  710. <p>1. 下载
  711. <el-link type="primary" style="margin-left:5px;" :underline="false" href="./upload/员工工时统计模板2.xlsx" download="员工工时导入模板.xlsx">员工工时统计模板.xlsx</el-link>
  712. </p>
  713. <p>2. 填写excel模板,请确保模板中的项目和人员已添加到系统中。</p>
  714. <p style="display: flex;justify-content: center;">
  715. <el-upload ref="upload" action="#" :limit="1" :http-request="batchImportData" :show-file-list="false">
  716. <el-button type="primary" :underline="false" :loading="importingData">开始导入</el-button>
  717. </el-upload>
  718. </p>
  719. </el-dialog>
  720. <!--基于企业微信考勤数据的工时导入 -->
  721. <el-dialog title="工时批量导入" v-if="importWxDialog" :visible.sync="importWxDialog" customClass="customWidth" width="1100px">
  722. <el-steps :active="active" finish-status="success">
  723. <el-step title="选择要导入工时的日期范围">
  724. </el-step>
  725. <el-step title="下载带考勤数据的模板"></el-step>
  726. <el-step title="填写模板,上传数据"></el-step>
  727. </el-steps>
  728. <div v-if="active==0" style="padding:30px;height:360px;">
  729. <div style="margin-top:50px;margin-left:280px;">
  730. <el-date-picker
  731. v-model="importWxParam.date" :editable="false"
  732. format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  733. :clearable="true"
  734. range-separator="至"
  735. type="daterange"
  736. start-placeholder="开始日期"
  737. end-placeholder="结束日期"
  738. @change="loadCheckInData"
  739. ></el-date-picker>
  740. </div>
  741. </div>
  742. <div v-if="active==1" style="padding:10px;">
  743. <el-table border :data="checkinList" highlight-current-row v-loading="checkinLoading" :height="395"
  744. style="width: 100%;margin-top:5px;" >
  745. <el-table-column prop="createDate" label="工作日期" ></el-table-column>
  746. <el-table-column prop="weekDayTxt" label="星期" ></el-table-column>
  747. <el-table-column prop="username" label="员工姓名" ></el-table-column>
  748. <el-table-column prop="startTime" label="上班时间" ></el-table-column>
  749. <el-table-column prop="endTime" label="下班时间" ></el-table-column>
  750. <el-table-column prop="workHours" label="实际工作时长" align="right">
  751. <template slot-scope="scope">
  752. {{scope.row.workHours.toFixed(1)}}h
  753. </template>
  754. </el-table-column>
  755. </el-table>
  756. </div>
  757. <div v-if="active==2" >
  758. <p style="display: flex;justify-content: center;height:390px;">
  759. <el-upload style="margin-top:100px;" ref="upload" action="#" :limit="1" :http-request="batchImportWxData" :show-file-list="false">
  760. <el-button type="primary" :underline="false" :loading="importingData">选择文件并上传</el-button>
  761. </el-upload>
  762. </p>
  763. </div>
  764. <el-button style="margin: 0 auto;" @click="pre">上一步</el-button>
  765. <el-button style="float:right;" @click="next" :disabled="importWxParam.date==null" v-if="active<2">下一步</el-button>
  766. <el-link v-if="active==1" style="float:right;margin-right:350px;margin-top:10px;"
  767. type="primary" @click="downloadCheckInExcel">下载员工工时统计模板.xlsx</el-link>
  768. </el-dialog>
  769. <!--基于企业微信考勤数据的工时导入 -->
  770. <el-dialog title="工时批量代填" v-if="batchSubFillDialog" :visible.sync="batchSubFillDialog" customClass="customWidth" width="90%">
  771. <div>
  772. <span>选择日期范围:</span><el-date-picker
  773. v-model="importWxParam.date" :editable="false"
  774. format="yyyy-MM-dd" value-format="yyyy-MM-dd"
  775. :clearable="true"
  776. range-separator="至"
  777. type="daterange"
  778. start-placeholder="开始日期"
  779. end-placeholder="结束日期"
  780. @change="loadCheckInData"
  781. ></el-date-picker>
  782. <el-button style="float:right;" type="primary" @click="submitBatchSubFillData">提交</el-button>
  783. </div>
  784. <el-table border :data="checkinList" highlight-current-row v-loading="checkinLoading" :height="520"
  785. :key="timeStamp"
  786. style="width: 100%;margin-top:5px;" ref="tab">
  787. <el-table-column prop="createDate" label="工作日期" width="100px" fixed="left"></el-table-column>
  788. <el-table-column prop="username" label="员工姓名" width="80px" fixed="left"></el-table-column>
  789. <el-table-column prop="startTime" label="上班时间" width="80px" fixed="left"></el-table-column>
  790. <el-table-column prop="endTime" label="下班时间" width="80px" fixed="left"></el-table-column>
  791. <el-table-column prop="workHours" label="工作时长" width="80px" align="right" fixed="left">
  792. <template slot-scope="scope">
  793. {{scope.row.workHours.toFixed(1)}}h
  794. </template>
  795. </el-table-column>
  796. <!--项目名称列表 -->
  797. <el-table-column v-for="(item, index) in projectColumns" :key="index" :label="item" min-width="150px">
  798. <template slot-scope="scope">
  799. <el-input v-model="scope.row[item]" style="width:60px;" @input="triggerTotalTime(scope.$index)"></el-input>&nbsp;h
  800. </template>
  801. </el-table-column>
  802. <el-table-column prop="totalFillTime" label="总工时" fixed="right">
  803. <template slot-scope="scope">
  804. {{scope.row.totalFillTime==null?0.0:scope.row.totalFillTime}}&nbsp;h
  805. </template>
  806. </el-table-column>
  807. </el-table>
  808. </el-dialog>
  809. <!--基于企业微信考勤数据的工时导入 -->
  810. <el-dialog title="工时导入结果" v-if="showImportResult" :visible.sync="showImportResult" customClass="customWidth" width="500px">
  811. <div>
  812. <span>{{importResultMsg}}</span>
  813. </div>
  814. <span slot="footer" class="dialog-footer">
  815. <el-button type="primary" @click="showImportResult=false">确定</el-button>
  816. </span>
  817. </el-dialog>
  818. </section>
  819. </template>
  820. <script>
  821. import util from "../../common/js/util";
  822. export default {
  823. data() {
  824. return {
  825. importResultMsg:null,
  826. showImportResult:false,
  827. importingData: false,
  828. isDraft: 0,
  829. timeStamp: 0,
  830. projectColumns:[],
  831. checkinLoading:false,
  832. importWxParam:{date:null,},
  833. active:0,
  834. importWxDialog:false,
  835. importDialog:false,
  836. denyForm:null,
  837. denyReasonDialog:false,
  838. monthWorkTimeDialog: false,
  839. isSubstitude:false,
  840. isFill:false,
  841. unFillList:[],
  842. fillList:[],
  843. fillMembList:[],
  844. membListVisible: false,
  845. isBatch:0,//是否是批量填报
  846. weekDay : ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
  847. statusStyle:["waiting", "filledReportStyle", "RejectStyle", ""],
  848. fillStatusList: [],
  849. exportParam:{projectId: null, dateRange:[]},
  850. exportDialog:false,
  851. timeFields:['timeType', 'workingTime', 'startTime', 'progress'],
  852. subProjectList:[],
  853. canEdit: true,
  854. 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],
  855. selectTime:null,
  856. reportTimeType:{},
  857. curDate:'',
  858. isAllSelect: false,
  859. approveDialogVisible:false,
  860. deptId:null,
  861. targetUid: null,
  862. membCount:0,
  863. selectState:"-1",
  864. user: JSON.parse(sessionStorage.getItem("user")),
  865. showAddMore:false,
  866. allDate: [],
  867. typeList:['全天','上午','下午'],
  868. date: sessionStorage.msg?sessionStorage.msg.split('-')[0]+"-"+sessionStorage.msg.split('-')[1]:util.formatDate.format(new Date(new Date()), "yyyy-MM"),
  869. choseDay: 0,
  870. tableHeight: 0,
  871. listLoading: false,
  872. projectList: [], //项目列表
  873. reportList: [], //日报列表
  874. reportNames:[], //批量审批列表
  875. dialogVisible: false, //项目弹窗
  876. report: '',
  877. workForm: {
  878. createDate: sessionStorage.msg?sessionStorage.msg:util.formatDate.format(new Date(new Date()), "yyyy-MM-dd"),
  879. domains: [{
  880. id: null,
  881. projectId: "",
  882. workingTime: "",
  883. timeType:0,
  884. content: "",
  885. state: 2,
  886. multiWorktime:0,
  887. worktimeList:[],
  888. degreeId: null
  889. }],
  890. },
  891. workRules: {
  892. createDate: [{ required: true, message: "请选择工作日期", trigger: "change" }],
  893. },
  894. chooseParticipVisible: false,
  895. logining: false,
  896. isDisable: false,
  897. timeType:[],
  898. deptMembData: [
  899. ],
  900. //部门人员树状结构
  901. data: [
  902. {
  903. id: -1,
  904. label: '全部人员',
  905. membCount:0
  906. },
  907. {
  908. id: 0,
  909. label: '未分配',
  910. }
  911. ],
  912. allData:{},
  913. batchShowData:{},
  914. option: [],
  915. depData: {
  916. id: -1,
  917. label: '全部人员',
  918. },
  919. defaultProps: {
  920. children: 'children',
  921. label: 'label'
  922. },
  923. isNew: false,
  924. selected: false,
  925. valuet: new Date(),
  926. domObj: null,
  927. participator:[],
  928. chosenMembCount:0,
  929. jsDay: 0,
  930. jsTime: 0,
  931. falsss: false,
  932. weidu: [],
  933. weiduList: [],
  934. yonghuUser: [],
  935. dateAr: [],
  936. batchSubFillDialog: false,
  937. isSubstiS: false,
  938. diasZho: false,
  939. zhoData: [],
  940. zhoRqi: [],
  941. btnZho: false,
  942. zhoLoading: false,
  943. changdu: 6,
  944. tianxieDialogVisible: false,
  945. scopess: {},
  946. zhoBao: {
  947. time: '',
  948. workingTime: '',
  949. progress: '',
  950. con: '',
  951. subProjectId: '',
  952. stage: '',
  953. subProjectList: [],
  954. stages: [],
  955. },
  956. zhoBaoIdx: '',
  957. zhoBaoName: '',
  958. zhis: {},
  959. dealList: []
  960. };
  961. },
  962. filters: {
  963. // 过滤
  964. amounts(value) {
  965. if(value == NaN || value == undefined || value == 'undefined' || value == null || value == 'null') {
  966. return 0
  967. }
  968. var zhi = +value + 0
  969. return zhi.toFixed(1)
  970. },
  971. // zhoData
  972. zhoData(value) {
  973. var dateArray = value.split("-");
  974. var date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]);
  975. return "周" + "日一二三四五六".charAt(date.getDay());
  976. },
  977. // 过滤数字
  978. numbers(value) {
  979. if(value == NaN || value == undefined || value == 'undefined' || value == null || value == 'null' || value <= 0) {
  980. return 0
  981. }
  982. return value
  983. }
  984. },
  985. methods: {
  986. //获取项目下的任务分组
  987. getTaskGroups(domain, index) {
  988. this.workForm.domains[index].groupId=null;
  989. this.http.post('/task-group/list',{
  990. projectId: domain.projectId
  991. },
  992. res => {
  993. if (res.code == "ok") {
  994. this.workForm.domains[index].taskGroups = res.data;
  995. this.$forceUpdate();
  996. }
  997. },
  998. error => {
  999. this.$message({
  1000. message: error,
  1001. type: "error"
  1002. });
  1003. }
  1004. );
  1005. },
  1006. //下载带企业微信考勤数据的工时统计模板
  1007. downloadCheckInExcel() {
  1008. this.http.post('/user-corpwx-time/exportCheckInExcel',{
  1009. startDate: this.importWxParam.date[0],
  1010. endDate: this.importWxParam.date[1],
  1011. },
  1012. res => {
  1013. if (res.code == "ok") {
  1014. var filePath = res.data;
  1015. const a = document.createElement('a'); // 创建a标签
  1016. var data = filePath.split("/");
  1017. a.setAttribute('download', data[data.length-1]);// download属性
  1018. a.setAttribute('href', filePath);// href链接
  1019. a.click(); //自执行点击事件
  1020. a.remove();
  1021. } else {
  1022. this.$message({
  1023. message: res.msg,
  1024. type: "error"
  1025. });
  1026. }
  1027. },
  1028. error => {
  1029. this.checkinLoading = false;
  1030. this.$message({
  1031. message: error,
  1032. type: "error"
  1033. });
  1034. }
  1035. );
  1036. },
  1037. pre() {
  1038. if (this.active == 0) return;
  1039. this.active--;
  1040. },
  1041. next() {
  1042. this.active++;
  1043. },
  1044. triggerTotalTime(index) {
  1045. var item = this.checkinList[index];
  1046. var total = 0.0;
  1047. for (var i=0;i<this.projectColumns.length; i++) {
  1048. var key = this.projectColumns[i];
  1049. if (item[key] != null && item[key] != '') {
  1050. total += parseFloat(item[key]);
  1051. }
  1052. }
  1053. item.totalFillTime = total;
  1054. },
  1055. //提交批量代填的数据
  1056. submitBatchSubFillData() {
  1057. var data = JSON.stringify(this.checkinList);
  1058. this.http.post('/user-corpwx-time/submitProjectTime',{
  1059. json: data,
  1060. projectColumns: JSON.stringify(this.projectColumns)
  1061. },
  1062. res => {
  1063. if (res.code == "ok") {
  1064. this.$message({message:'提交成功', type:'success'});
  1065. this.importWxDialog = false;
  1066. }
  1067. },
  1068. error => {
  1069. this.checkinLoading = false;
  1070. this.$message({
  1071. message: error,
  1072. type: "error"
  1073. });
  1074. }
  1075. );
  1076. },
  1077. loadCheckInData() {
  1078. if (this.importWxParam.date == null) {
  1079. this.checkinList = [];
  1080. return;
  1081. }
  1082. this.checkinLoading = true;
  1083. this.http.post('/user-corpwx-time/getMyDeptMembsData',{
  1084. startDate: this.importWxParam.date[0],
  1085. endDate: this.importWxParam.date[1],
  1086. },
  1087. res => {
  1088. if (res.code == "ok") {
  1089. this.checkinLoading = false;
  1090. this.checkinList = res.data.list;
  1091. this.projectColumns = res.data.projects;
  1092. // 自定义表格会导致表格错乱,需重新计算表格
  1093. this.$nextTick(()=>{
  1094. this.$refs.tab.doLayout()
  1095. })
  1096. }
  1097. },
  1098. error => {
  1099. this.checkinLoading = false;
  1100. this.$message({
  1101. message: error,
  1102. type: "error"
  1103. });
  1104. }
  1105. );
  1106. },
  1107. batchImportWxData(item) {
  1108. //首先判断文件类型
  1109. let str = item.file.name.split(".");
  1110. let format = str[str.length - 1];
  1111. if (format != "xls" && format != "xlsx") {
  1112. this.$message({
  1113. message: "请选择.xls或.xlsx文件",
  1114. type: "error"
  1115. });
  1116. } else {
  1117. this.importingData = true;
  1118. let formData = new FormData();
  1119. formData.append("file", item.file);
  1120. formData.append("companyId", this.user.companyId);
  1121. formData.append("withCheckIn", 1);
  1122. this.http.uploadFile('/report/importData', formData,
  1123. res => {
  1124. this.$refs.upload.clearFiles();
  1125. this.showImportResult = true;
  1126. this.importingData = false;
  1127. if (res.code == "ok") {
  1128. //换成弹出框,以免有人等了半天回来啥也没看到
  1129. this.importResultMsg = "导入成功:成功导入"+res.data+"条工时数据";
  1130. this.getReportList();
  1131. this.importWxDialog = false;
  1132. } else {
  1133. this.importResultMsg = "导入失败:"+res.msg;
  1134. }
  1135. },
  1136. error => {
  1137. this.$refs.upload.clearFiles();
  1138. this.listLoading = false;
  1139. this.$message({
  1140. message: error,
  1141. type: "error"
  1142. });
  1143. });
  1144. }
  1145. },
  1146. batchImportData(item) {
  1147. //首先判断文件类型
  1148. let str = item.file.name.split(".");
  1149. let format = str[str.length - 1];
  1150. if (format != "xls" && format != "xlsx") {
  1151. this.$message({
  1152. message: "请选择.xls或.xlsx文件",
  1153. type: "error"
  1154. });
  1155. } else {
  1156. this.importingData = true;
  1157. let formData = new FormData();
  1158. formData.append("file", item.file);
  1159. formData.append("companyId", this.user.companyId);
  1160. this.http.uploadFile('/report/importData', formData,
  1161. res => {
  1162. this.$refs.upload.clearFiles();
  1163. this.importingData = false;
  1164. this.showImportResult = true;
  1165. if (res.code == "ok") {
  1166. //换成弹出框,以免有人等了半天回来啥也没看到
  1167. this.importResultMsg = "成功导入"+res.data+"条工时数据";
  1168. this.getReportList();
  1169. this.importWXDialog = false;
  1170. } else {
  1171. this.importResultMsg = "导入失败:"+res.msg;
  1172. }
  1173. },
  1174. error => {
  1175. this.$refs.upload.clearFiles();
  1176. this.importingData = false;
  1177. this.$message({
  1178. message: error,
  1179. type: "error"
  1180. });
  1181. });
  1182. }
  1183. },
  1184. userssHu() {
  1185. this.http.post('/time-type/getCompanyTimeSetting',{
  1186. companyId: this.user.companyId
  1187. },
  1188. res => {
  1189. if (res.code == "ok") {
  1190. this.yonghuUser = res.data
  1191. }
  1192. },
  1193. error => {
  1194. this.$message({
  1195. message: error,
  1196. type: "error"
  1197. });
  1198. }
  1199. );
  1200. },
  1201. iptBlur(i) {
  1202. if(this.isBatch == 0) {
  1203. return
  1204. }
  1205. var stat = this.workForm.createDate[0]
  1206. var end = this.workForm.createDate[1]
  1207. // this.jsDay = 10
  1208. this.http.post('/report/getWorkDays',{
  1209. startDate: stat,
  1210. endDate: end
  1211. },
  1212. res => {
  1213. if (res.code == "ok") {
  1214. this.jsDay = res.data
  1215. this.chuji(i)
  1216. }
  1217. },
  1218. error => {
  1219. this.$message({
  1220. message: error,
  1221. type: "error"
  1222. });
  1223. }
  1224. );
  1225. var sl = this.workForm.domains
  1226. this.chuji(i)
  1227. },
  1228. chuji(i) {
  1229. if(i == 0) {
  1230. this.seleChn(1)
  1231. } else if(i == 1) {
  1232. this.seleChn(0)
  1233. } else if(i == 2) {
  1234. if(this.workForm.domains[0].multiWorktime > 0) {
  1235. this.iptChangs()
  1236. } else {
  1237. this.iptChang()
  1238. }
  1239. } else if(i == 3) {
  1240. this.seleChn(0)
  1241. }
  1242. },
  1243. seleChn(e) {
  1244. if(e == 1) {
  1245. for(var i in this.workForm.domains) {
  1246. if(this.workForm.domains[i].timeType == 0) {
  1247. this.workForm.domains[i].workingTime = 8
  1248. } else {
  1249. this.workForm.domains[i].workingTime = 4
  1250. }
  1251. }
  1252. }
  1253. var quanbu = 0
  1254. var spl = this.workForm.domains
  1255. var zhi = ''
  1256. for(var i in spl) {
  1257. var sp = +spl[i].workingTime + 0
  1258. zhi = this.jsDay * sp
  1259. quanbu = +quanbu + zhi
  1260. }
  1261. this.jsTime = quanbu
  1262. },
  1263. iptChang() {
  1264. var sl = this.workForm.domains
  1265. var quanbu = 0
  1266. var zhi = ''
  1267. for(var i in sl) {
  1268. if(sl[i].startTime && sl[i].endTime) {
  1269. var date2 = '2021/12/12 ' + sl[i].endTime +':00'
  1270. var date1 = '2021/12/12 ' + sl[i].startTime +':00'
  1271. var date3 = new Date(date2).getTime() - new Date(date1).getTime();
  1272. var leave1=date3%(24*3600*1000)
  1273. var hours=Math.floor(leave1/(3600*1000))
  1274. var leave2=leave1%(3600*1000)
  1275. var minutes=Math.floor(leave2/(60*1000))
  1276. var shi = hours+'.'+ minutes
  1277. var sll = +shi + 0
  1278. zhi = this.jsDay * sll
  1279. quanbu = +quanbu + zhi
  1280. }
  1281. }
  1282. this.jsTime = quanbu
  1283. },
  1284. iptChangs() {
  1285. var sl = this.workForm.domains
  1286. var quanbu = 0
  1287. var zhi = ''
  1288. for(var i in sl) {
  1289. for(var j in sl[i].worktimeList){
  1290. if(sl[i].worktimeList[j].startTime && sl[i].worktimeList[j].endTime) {
  1291. var date2 = '2021/12/12 ' + sl[i].worktimeList[j].endTime +':00'
  1292. var date1 = '2021/12/12 ' + sl[i].worktimeList[j].startTime +':00'
  1293. var date3 = new Date(date2).getTime() - new Date(date1).getTime();
  1294. var leave1=date3%(24*3600*1000)
  1295. var hours=Math.floor(leave1/(3600*1000))
  1296. var leave2=leave1%(3600*1000)
  1297. var minutes=Math.floor(leave2/(60*1000))
  1298. var shi = hours+'.'+ minutes
  1299. var sll = +shi + 0
  1300. zhi = this.jsDay * sll
  1301. quanbu = +quanbu + zhi
  1302. }
  1303. }
  1304. }
  1305. this.jsTime = quanbu
  1306. },
  1307. removeTimeItem(item, index) {
  1308. item.worktimeList.splice(index, 1);
  1309. this.iptChangs()
  1310. },
  1311. //添加工时
  1312. addNewWorktime(index, item) {
  1313. if(item.worktimeList == null ) {
  1314. item.worktimeList = []
  1315. }
  1316. item.worktimeList.push({});
  1317. },
  1318. //复制项目
  1319. copyProject(index) {
  1320. var leftProgress = 10;
  1321. if (this.reportTimeType.type == 3) {
  1322. //计算已经待分配工时比例
  1323. let array = this.workForm.domains;
  1324. let totalProgress = 0;
  1325. for (var i=0;i<array.length; i++) {
  1326. totalProgress += array[i].progress;
  1327. }
  1328. if (totalProgress < 100) {
  1329. leftProgress = 100 - totalProgress;
  1330. }
  1331. }
  1332. var newIndex = index+1;
  1333. var itemDomain = {
  1334. projectId: this.workForm.domains[index].projectId,
  1335. workingTime: this.reportTimeType.type == 3?(leftProgress*this.reportTimeType.allday/100).toFixed(1):"",
  1336. content: "",
  1337. progress:leftProgress,
  1338. state:2,//2-表示待提交
  1339. };
  1340. this.workForm.domains.splice(newIndex, 0,itemDomain);
  1341. if (this.reportTimeType.type == 0) {
  1342. //全天上下午模式下,检测时间段数量,达到2个,不能再加了
  1343. var length = this.workForm.domains.length;
  1344. if (length == 2) {
  1345. this.showAddMore = false;
  1346. }
  1347. }
  1348. this.selectProject(itemDomain, newIndex);
  1349. },
  1350. //导出员工每日填报工时数
  1351. exportMembWorkHours() {
  1352. this.http.post('/report/exportUserDailyWorkTime',{
  1353. month: this.date
  1354. },
  1355. res => {
  1356. if (res.code == "ok") {
  1357. var url = res.data;
  1358. this.downloadByA("人员每日工时统计.xls", url);
  1359. }
  1360. },
  1361. error => {
  1362. this.$message({
  1363. message: error,
  1364. type: "error"
  1365. });
  1366. }
  1367. );
  1368. },
  1369. downloadByA(name, url) {
  1370. const a = document.createElement('a'); // 创建a标签
  1371. a.setAttribute('download', name);// download属性
  1372. a.setAttribute('href', url);// href链接
  1373. a.click();// 自执行点击事件
  1374. a.remove();
  1375. },
  1376. showMonthWorkTime() {
  1377. this.monthWorkTimeDialog = true;
  1378. this.http.post('/report/getUserDailyWorkTime',{
  1379. month: this.date
  1380. },
  1381. res => {
  1382. if (res.code == "ok") {
  1383. this.monthWorkData = res.data.list;
  1384. this.$forceUpdate();
  1385. }
  1386. },
  1387. error => {
  1388. this.$message({
  1389. message: error,
  1390. type: "error"
  1391. });
  1392. }
  1393. );
  1394. },
  1395. onProgressChange() {
  1396. this.$forceUpdate();
  1397. },
  1398. showChooseMembTree() {
  1399. this.chosenMembCount = this.participator.length;
  1400. this.chooseParticipVisible = true;
  1401. },
  1402. onTreeItemChange() {
  1403. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  1404. var list = chosenList.filter(item=>item.isUser == 1);
  1405. this.chosenMembCount = list.length;
  1406. },
  1407. findUserInTree() {
  1408. if (this.filterName == '') {
  1409. this.deptMembData = this.allMembData;
  1410. } else {
  1411. var list = this.findRecursively(this.filterName, this.allMembData);
  1412. this.deptMembData = list;
  1413. }
  1414. },
  1415. findRecursively(username, list) {
  1416. var filterList = [];
  1417. for (var i=0;i<list.length; i++) {
  1418. if (list[i].isUser == 1) {
  1419. if (list[i].label.indexOf(username) >= 0) {
  1420. //匹配上了
  1421. filterList.push(list[i]);
  1422. }
  1423. } else if (list[i].children != null && list[i].children.length > 0) {
  1424. var subList = this.findRecursively(username, list[i].children);
  1425. if (subList.length > 0) {
  1426. subList.forEach(s=>filterList.push(s));
  1427. }
  1428. }
  1429. }
  1430. return filterList;
  1431. },
  1432. //确定选择参与人
  1433. chooseParticip() {
  1434. this.chooseParticipVisible = false;
  1435. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  1436. this.chosenMembList = chosenList.filter(item=>item.isUser == 1);
  1437. this.workForm.userNames = '';
  1438. this.workForm.userId = [];
  1439. this.participator = [];
  1440. for (var i=0;i<this.chosenMembList.length; i++) {
  1441. this.workForm.userId.push(this.chosenMembList[i].id);
  1442. this.workForm.userNames += this.chosenMembList[i].label+',';
  1443. var item = {id:this.chosenMembList[i].id, name:this.chosenMembList[i].label};
  1444. this.participator.push(item);
  1445. }
  1446. if (this.workForm.userNames.length > 0) {
  1447. this.workForm.userNames = this.workForm.userNames.substring(0, this.workForm.userNames.length-1);
  1448. }
  1449. },
  1450. //微信通知人员填写
  1451. weixinNotify() {
  1452. if (this.fillMembList.length == 0) return;
  1453. var ids = '';
  1454. this.fillMembList.forEach(f=>{
  1455. ids += f.id+',';
  1456. })
  1457. this.http.post('/user/pushFillReport',{
  1458. ids: ids, date: this.curDate
  1459. },
  1460. res => {
  1461. if (res.code == "ok") {
  1462. this.$message({
  1463. message: '已发送成功',
  1464. type: "success"
  1465. });
  1466. }
  1467. },
  1468. error => {
  1469. this.$message({
  1470. message: error,
  1471. type: "error"
  1472. });
  1473. }
  1474. );
  1475. },
  1476. //导出人员列表
  1477. exportMemb() {
  1478. if (this.fillMembList.length == 0) return;
  1479. var ids = '';
  1480. this.fillMembList.forEach(f=>{
  1481. ids += f.id+',';
  1482. })
  1483. this.http.post('/user/exportMembList',{
  1484. ids: ids,isFill: this.isFill, date: this.curDate
  1485. },
  1486. res => {
  1487. if (res.code == "ok") {
  1488. var aTag = document.createElement('a');
  1489. aTag.download = this.curDate+(this.isFill?"已填":"未填")+"人员列表.xls";
  1490. aTag.href = res.data;
  1491. aTag.click();
  1492. }
  1493. },
  1494. error => {
  1495. this.$message({
  1496. message: error,
  1497. type: "error"
  1498. });
  1499. }
  1500. );
  1501. },
  1502. showMembList(fill) {
  1503. this.membListVisible = true;
  1504. if (fill == 0) {
  1505. this.fillMembList = this.unFillList;
  1506. this.isFill = false;
  1507. } else {
  1508. this.fillMembList = this.fillList;
  1509. this.isFill = true;
  1510. }
  1511. },
  1512. //获取自己填写的日报状态
  1513. getReportFillStatus() {
  1514. this.http.post('/report/getReportFillStatus',{
  1515. startDate: this.date+"-01", endDate: this.date+"-31", userId: this.user.id
  1516. },
  1517. res => {
  1518. if (res.code == "ok") {
  1519. this.fillStatusList = res.data;
  1520. this.allDate.forEach(d=>{
  1521. var fillInfo = null;
  1522. d.state = null;
  1523. this.fillStatusList.forEach(s=>{
  1524. var d1 = s.createDate.split('-')[2];
  1525. var d2 = d.date.split('月')[1].split('日')[0];
  1526. if (d1.indexOf('0') == 0) {
  1527. d1 = d1.substring(1,d1.length);
  1528. }
  1529. if (d1 == d2) {
  1530. d.state = s.state;
  1531. }
  1532. })
  1533. })
  1534. this.$forceUpdate();
  1535. }
  1536. },
  1537. error => {
  1538. this.$message({
  1539. message: error,
  1540. type: "error"
  1541. });
  1542. }
  1543. );
  1544. },
  1545. scrollFunction () {
  1546. this.domObj = document.getElementById('clearfix') // 通过id获取要设置的div
  1547. if (this.domObj.attachEvent) { // IE
  1548. this.domObj.attachEvent('onmousewheel', this.mouseScroll)
  1549. } else if (this.domObj.addEventListener) {
  1550. this.domObj.addEventListener('DOMMouseScroll', this.mouseScroll, false)
  1551. }
  1552. this.domObj.onmousewheel = this.domObj.onmousewheel = this.mouseScroll
  1553. },
  1554. mouseScroll(event) { // google 浏览器下
  1555. let detail = event.wheelDelta || event.detail
  1556. let moveForwardStep = -1
  1557. let moveBackStep = 1
  1558. let step = 0
  1559. step = detail > 0 ? moveForwardStep * 100 : moveBackStep * 100
  1560. event.preventDefault() // 阻止浏览器默认事件
  1561. this.domObj.scrollLeft = this.domObj.scrollLeft + step
  1562. },
  1563. // //左右滚动
  1564. // wheel(e){
  1565. // var a = document.getElementById("dateScroll");
  1566. // var scroll_width = 80; //滚动一下的距离
  1567. // var e = e || window.event, v;
  1568. // e.wheelDelta ? v=e.wheelDelta : v=e.detail;
  1569. // if(v>3||-v>3) v=-v;
  1570. // v>0 ? a.scrollLeft+=scroll_width : a.scrollLeft-=scroll_width;
  1571. // e.preventDefault(); //阻止浏览器的默认滚动
  1572. // },
  1573. showExportDialog() {
  1574. this.exportDialog = true;
  1575. },
  1576. changeAllTime() {
  1577. //总时长发生改变,自动按比例计算
  1578. this.workForm.domains.forEach(d=>{
  1579. d.workingTime = (d.progress*this.reportTimeType.allday/100).toFixed(1);
  1580. });
  1581. },
  1582. // 是否加班的单机事件
  1583. check() {
  1584. this.selected = !this.selected
  1585. this.isNew = this.selected
  1586. },
  1587. updateSubProject() {
  1588. this.$forceUpdate();
  1589. },
  1590. //项目选中了, 加载子项目
  1591. selectProject(domain, index) {
  1592. console.log(domain, index, '加载')
  1593. this.http.post('/sub-project/list',{
  1594. projectId: domain.projectId
  1595. },
  1596. res => {
  1597. //清空之前选中的子项目
  1598. // this.workForm.domains[index].subProjectId = 0;
  1599. if (res.code == "ok") {
  1600. this.workForm.domains[index].subProjectList = res.data;
  1601. this.workForm.domains[index].subProjectId = null;
  1602. this.$forceUpdate();
  1603. }
  1604. },
  1605. error => {
  1606. this.$message({
  1607. message: error,
  1608. type: "error"
  1609. });
  1610. }
  1611. );
  1612. //项目相关的近期任务
  1613. if (this.user.company.packageProject == 1) {
  1614. this.http.post('/task/getRecentTask',{
  1615. projectId: domain.projectId,
  1616. isSubstitude:this.isSubstitude?1:0
  1617. },
  1618. res => {
  1619. if (res.code == "ok") {
  1620. this.workForm.domains[index].allTaskList = res.data;
  1621. this.workForm.domains[index].taskList = res.data;
  1622. this.$forceUpdate();
  1623. }
  1624. },
  1625. error => {
  1626. this.$message({
  1627. message: error,
  1628. type: "error"
  1629. });
  1630. }
  1631. );
  1632. }
  1633. //获取项目相关专业
  1634. if (this.user.company.packageEngineering == 1) {
  1635. this.getProjectProfessions(domain, index);
  1636. }
  1637. // 获取项目相关的维度
  1638. this.dimension(domain, index);
  1639. //获取项目下的任务分组
  1640. this.getTaskGroups(domain, index);
  1641. },
  1642. // 获取维度数据
  1643. dimension(domain, index) {
  1644. if(domain.projectId == '') {
  1645. return
  1646. }
  1647. this.http.post('/project/getDegreeList',{
  1648. projectId: domain.projectId,
  1649. },
  1650. res => {
  1651. if (res.code == "ok") {
  1652. this.workForm.domains[index].wuduList = res.data
  1653. // this.workForm = this.workForm
  1654. this.$forceUpdate()
  1655. }
  1656. },
  1657. error => {
  1658. this.$message({
  1659. message: error,
  1660. type: "error"
  1661. });
  1662. }
  1663. );
  1664. },
  1665. //切换任务阶段
  1666. changeStages(domain, index) {
  1667. if (domain.stage == null || domain.stage == '') {
  1668. this.workForm.domains[index].taskList = this.workForm.domains[index].allTaskList;
  1669. } else {
  1670. this.workForm.domains[index].taskList = this.workForm.domains[index].allTaskList.filter(t=>t.stagesName == domain.stage);
  1671. }
  1672. this.$forceUpdate();
  1673. },
  1674. getGroupStages(domain, index) {
  1675. this.http.post("/stages/getProjectStagesByGroup", {groupId: domain.groupId},
  1676. res => {
  1677. if (res.code == "ok") {
  1678. this.workForm.domains[index].stage = '';
  1679. this.workForm.domains[index].stages = res.data;
  1680. this.$forceUpdate();
  1681. }
  1682. },
  1683. error => {
  1684. this.$message({
  1685. message: error,
  1686. type: "error"
  1687. });
  1688. });
  1689. },
  1690. getProjectProfessions(domain, index) {
  1691. this.http.post("/project-profession/getMyProfession", {projectId: domain.projectId},
  1692. res => {
  1693. if (res.code == "ok") {
  1694. this.workForm.domains[index].professionProgress = res.data;
  1695. this.$forceUpdate();
  1696. }
  1697. },
  1698. error => {
  1699. this.$message({
  1700. message: error,
  1701. type: "error"
  1702. });
  1703. });
  1704. },
  1705. //删除自己的日报
  1706. deleteReport() {
  1707. this.$confirm("确定要删除该日报吗?","提示", {
  1708. confirmButtonText: "确定",
  1709. cancelButtonText: "取消",
  1710. type: "warning"
  1711. })
  1712. .then(() => {
  1713. this.listLoading = true;
  1714. this.http.post('/report/delete',{
  1715. userId: this.user.id,
  1716. date: this.workForm.createDate
  1717. },
  1718. res => {
  1719. this.listLoading = false;
  1720. if (res.code == "ok") {
  1721. this.$message({
  1722. message: "删除成功",
  1723. type: "success"
  1724. });
  1725. this.getReportList();
  1726. this.getDepartment();
  1727. this.dialogVisible = false;
  1728. } else {
  1729. this.$message({
  1730. message: res.msg,
  1731. type: "error"
  1732. });
  1733. }
  1734. },
  1735. error => {
  1736. this.listLoading = false;
  1737. this.$message({
  1738. message: error,
  1739. type: "error"
  1740. });
  1741. }
  1742. );
  1743. })
  1744. .catch(() => {});
  1745. },
  1746. // 管理员删除日报
  1747. guanli(item) {
  1748. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  1749. let param = {date: this.date + day, userId: item.id};
  1750. this.$confirm("确定要删除该日报吗?","提示", {
  1751. confirmButtonText: "确定",
  1752. cancelButtonText: "取消",
  1753. type: "warning"
  1754. })
  1755. .then(() => {
  1756. this.listLoading = true;
  1757. this.http.post('/report/delete',param,
  1758. res => {
  1759. this.listLoading = false;
  1760. if (res.code == "ok") {
  1761. this.$message({
  1762. message: "删除成功",
  1763. type: "success"
  1764. });
  1765. this.getReportList();
  1766. this.getDepartment();
  1767. this.dialogVisible = false;
  1768. } else {
  1769. this.$message({
  1770. message: res.msg,
  1771. type: "error"
  1772. });
  1773. }
  1774. },
  1775. error => {
  1776. this.listLoading = false;
  1777. this.$message({
  1778. message: error,
  1779. type: "error"
  1780. });
  1781. }
  1782. );
  1783. })
  1784. .catch(() => {});
  1785. },
  1786. //提交批量审核数据
  1787. submitBatchApprove() {
  1788. var data = this.$refs.approveTree.getCheckedNodes();
  1789. var ids = '';
  1790. if (data.length == 0) {
  1791. this.$message({
  1792. message: '请选择要审核的人员',
  1793. type: "error"
  1794. });
  1795. return;
  1796. }
  1797. for (var i=0;i<data.length; i++) {
  1798. ids += data[i].id;
  1799. if (i < data.length-1) {
  1800. ids += ',';
  1801. }
  1802. }
  1803. let day = (this.choseDay+1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  1804. this.http.post("/report/batchApproveReport", {ids:ids, date:this.date + day},
  1805. res => {
  1806. if (res.code == "ok") {
  1807. this.$message({
  1808. message: '审核成功',
  1809. type: "success"
  1810. });
  1811. this.getReportList();
  1812. this.getDepartment();
  1813. this.approveDialogVisible = false;
  1814. } else {
  1815. this.$message({
  1816. message: res.msg,
  1817. type: "error"
  1818. });
  1819. }
  1820. },
  1821. error => {
  1822. this.$message({
  1823. message: error,
  1824. type: "error"
  1825. });
  1826. });
  1827. },
  1828. selectAll() {
  1829. if (this.isAllSelect) {
  1830. var keys = [];
  1831. this.reportNames.forEach(b=>{
  1832. keys.push(b.id);
  1833. })
  1834. this.$refs.approveTree.setCheckedKeys(keys);
  1835. } else {
  1836. this.$refs.approveTree.setCheckedKeys([]);
  1837. }
  1838. },
  1839. //批量审核
  1840. batchApprove() {
  1841. this.approveDialogVisible = true;
  1842. this.reportNames = [];
  1843. for (var i=0;i<this.reportList.length; i++) {
  1844. var report = this.reportList[i];
  1845. var hasUnChecked =false;
  1846. var id = '';
  1847. for (var j=0;j<report.data.length; j++) {
  1848. if (report.data[j].state == 0
  1849. && (this.user.company.packageEngineering==0 || (this.user.company.packageEngineering==1 && report.data[j].departmentAuditState == 1))
  1850. && (this.user.role == 1 || this.user.role == 2 || report.data[j].inchargerId == this.user.id)) {
  1851. hasUnChecked = true;
  1852. id += report.data[j].id+',';
  1853. }
  1854. }
  1855. if (hasUnChecked) {
  1856. this.reportNames.push({id:id, label: report.name});
  1857. }
  1858. }
  1859. },
  1860. removeEmptyNode(list) {
  1861. for (var i=0;i<list.length;i++) {
  1862. var cnt = 0;
  1863. if (list[i].membCount == 0) {
  1864. list.splice(i, 1);
  1865. i--;
  1866. } else if (list[i].children != null) {
  1867. this.removeEmptyNode(list[i].children);
  1868. }
  1869. }
  1870. },
  1871. calculateMembCount(list) {
  1872. for (var i in list) {
  1873. var cnt = 0;
  1874. if (list[i].children != null) {
  1875. this.calculateMembCount(list[i].children);
  1876. for (var m in list[i].children) {
  1877. cnt += list[i].children[m].membCount;
  1878. }
  1879. }
  1880. if (list[i].isUser == 1) {
  1881. cnt++;
  1882. this.membCount++;
  1883. }
  1884. list[i].membCount = cnt;
  1885. }
  1886. },
  1887. stateChange() {
  1888. this.membCount = 0;
  1889. if (this.selectState == -1) {
  1890. //全部状态
  1891. this.data = this.allData;
  1892. } else {
  1893. //未填报
  1894. var newData = JSON.parse(JSON.stringify(this.allData));
  1895. this.filterState(this.selectState, newData);
  1896. this.data = newData;
  1897. }
  1898. this.calculateMembCount(this.data);
  1899. this.data[0].membCount = this.membCount;//总人数
  1900. },
  1901. //按状态过滤部门人员
  1902. filterState(state, list) {
  1903. for (var i =0;i<list.length; i++) {
  1904. var obj = list[i];
  1905. if (obj.isUser == 1) {
  1906. var match = false;
  1907. if (state == -2) {
  1908. if (obj.state == null) {
  1909. match = true;
  1910. }
  1911. } else {
  1912. if (obj.state == state) {
  1913. match = true;
  1914. }
  1915. }
  1916. if (!match) {
  1917. list.splice(i, 1);
  1918. i--;
  1919. } else {
  1920. }
  1921. } else {
  1922. if (obj.children != null) {
  1923. this.filterState(state, obj.children);
  1924. }
  1925. }
  1926. }
  1927. },
  1928. // 部门列表点击
  1929. handleNodeClick(data) {
  1930. // this.dealList = data
  1931. this.theValues(data.id, this.allData)
  1932. // this.depData = data;
  1933. var list = [];
  1934. if (data.id == -1) {
  1935. this.deptId = null;
  1936. this.targetUid = null;
  1937. list = this.data;
  1938. } else if (data.isUser == 1) {
  1939. this.deptId = null;
  1940. this.targetUid = data.id;
  1941. } else {
  1942. this.deptId = data.id;
  1943. this.targetUid = null;
  1944. list.push(data);
  1945. }
  1946. this.getReportList();
  1947. if (list.length > 0) {
  1948. this.unFillList = this.getUserMembListFromDeptList(list, 0);
  1949. this.fillList = this.getUserMembListFromDeptList(list, 1)
  1950. }
  1951. console.log(this.depData.isUser)
  1952. console.log(this.depData.membCount)
  1953. console.log(this.depData)
  1954. },
  1955. theValues(id, item) {
  1956. for(var i in item) {
  1957. if(item[i].id == id) {
  1958. this.depData = item[i]
  1959. return
  1960. } else {
  1961. if(item[i].children) {
  1962. this.theValues(id, item[i].children)
  1963. }
  1964. }
  1965. }
  1966. },
  1967. //获取可以选择的代填的人员列表
  1968. getSubstitudeUserDeptList() {
  1969. if (this.deptMembData.length == 0) {
  1970. this.http.post("/department/listMyMembs", {},
  1971. res => {
  1972. if (res.code == "ok") {
  1973. let noAllData = JSON.parse(JSON.stringify(res.data));
  1974. if (noAllData.length > 0) {
  1975. if (noAllData[0].label == '全部人员') {
  1976. noAllData.splice(0,1);
  1977. }
  1978. }
  1979. this.setUserToDept(noAllData);
  1980. this.deptMembData = noAllData;
  1981. } else {
  1982. this.$message({
  1983. message: res.msg,
  1984. type: "error"
  1985. });
  1986. }
  1987. },
  1988. error => {
  1989. this.$message({
  1990. message: error,
  1991. type: "error"
  1992. });
  1993. });
  1994. }
  1995. },
  1996. // 获取部门列表
  1997. getDepartment() {
  1998. let day = (this.choseDay+1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  1999. var param = {date:this.date + day};
  2000. if (this.user.manageDeptId != 0 && this.user.role < 2) {
  2001. param.manageDeptId = this.user.manageDeptId;
  2002. }
  2003. this.http.post("/report/getMembList", param,
  2004. res => {
  2005. if (res.code == "ok") {
  2006. var list = res.data , list1 = JSON.parse(JSON.stringify(res.data));
  2007. // let noAllData = JSON.parse(JSON.stringify(res.data));
  2008. // if (this.user.role > 0) {
  2009. // }
  2010. list.splice(0,0,{
  2011. id: -1,
  2012. label: '全部人员',
  2013. })
  2014. this.membCount = 0;
  2015. //设置员工到部门下面
  2016. this.setUserToDept(list);
  2017. this.data = list;
  2018. this.allData = list;
  2019. // if (noAllData.length > 0) {
  2020. // if (noAllData[0].label == '全部人员') {
  2021. // noAllData.splice(0,1);
  2022. // }
  2023. // }
  2024. // this.setUserToDept(noAllData);
  2025. // this.deptMembData = noAllData;
  2026. this.option = this.changeArr(list1);
  2027. list[0].membCount = this.membCount;
  2028. if (this.depData.id == -1) {
  2029. this.depData.membCount = this.membCount;
  2030. this.unFillList = this.getUserMembListFromDeptList(this.data, 0);
  2031. this.fillList = this.getUserMembListFromDeptList(this.data, 1);
  2032. } else {
  2033. if (this.depData.isUser == null) {
  2034. var dep = this.findTargetDept(this.data, this.depData.id);
  2035. var membDeptList = [];
  2036. membDeptList.push(dep);
  2037. this.unFillList = this.getUserMembListFromDeptList(membDeptList, 0);
  2038. this.fillList = this.getUserMembListFromDeptList(membDeptList, 1);
  2039. }
  2040. }
  2041. if (this.depData.isUser == null) {
  2042. if (this.isFill) {
  2043. this.fillMembList = this.fillList;
  2044. } else {
  2045. this.fillMembList = this.unFillList;
  2046. }
  2047. }
  2048. this.stateChange()
  2049. } else {
  2050. this.$message({
  2051. message: res.msg,
  2052. type: "error"
  2053. });
  2054. }
  2055. },
  2056. error => {
  2057. this.$message({
  2058. message: error,
  2059. type: "error"
  2060. });
  2061. });
  2062. this.getReportFillStatus();
  2063. },
  2064. findTargetDept(list, deptId) {
  2065. var t = null;
  2066. for (var i=0;i<list.length; i++) {
  2067. if (list[i].isUser == null && list[i].id == deptId) {
  2068. t = list[i];
  2069. break;
  2070. }
  2071. }
  2072. if (t == null) {
  2073. for (var i=0;i<list.length; i++) {
  2074. if (list[i].children != null && list[i].children.length > 0) {
  2075. t = this.findTargetDept(list[i].children, deptId);
  2076. if (t != null) {
  2077. break;
  2078. }
  2079. }
  2080. }
  2081. }
  2082. return t;
  2083. },
  2084. getUserMembListFromDeptList(list, isFill) {
  2085. var membList = [];
  2086. for (var i in list) {
  2087. var deptName = list[i].label;
  2088. if (list[i].userList != null) {
  2089. list[i].userList.forEach(element => {
  2090. if (isFill == 0) {
  2091. //获取未填的
  2092. if (element.state == null) {
  2093. var obj = {id: element.id, label:element.name, deptId:element.departmentId, deptName: deptName};
  2094. membList.push(obj);
  2095. }
  2096. } else {
  2097. if (element.state != null) {
  2098. var obj = {id: element.id, label:element.name, deptId:element.departmentId, deptName: deptName};
  2099. membList.push(obj);
  2100. }
  2101. }
  2102. });
  2103. }
  2104. if (list[i].children != null) {
  2105. membList = membList.concat(this.getUserMembListFromDeptList(list[i].children, isFill));
  2106. }
  2107. }
  2108. return membList;
  2109. },
  2110. setUserToDept(list) {
  2111. for (var i in list) {
  2112. var cnt = 0;
  2113. if (list[i].children != null) {
  2114. this.setUserToDept(list[i].children);
  2115. for (var m in list[i].children) {
  2116. cnt += list[i].children[m].membCount;
  2117. }
  2118. }
  2119. if (list[i].userList != null) {
  2120. if (list[i].children == null) {
  2121. list[i].children = [];
  2122. }
  2123. list[i].userList.forEach(element => {
  2124. var obj = {id: element.id, label:element.name, state:element.state, parentId:element.departmentId, isUser:1};
  2125. list[i].children.push(obj);
  2126. this.membCount++;
  2127. cnt++;
  2128. });
  2129. }
  2130. list[i].membCount = cnt;
  2131. }
  2132. },
  2133. // 修改数组
  2134. changeArr(arr) {
  2135. for (var i = 0; i < arr.length; i++) {
  2136. if(arr[i].id != -1 && arr[i].id != 0) {
  2137. if (arr[i].children != null && arr[i].children.length>0) {
  2138. arr[i].children = this.changeArr(arr[i].children);
  2139. }
  2140. arr[i].id && (arr[i].value = arr[i].id);
  2141. delete arr[i].id;
  2142. }
  2143. }
  2144. for(var i in arr) {
  2145. if(arr[i].id == -1 || arr[i].id == 0) {
  2146. arr.splice(i,1)
  2147. }
  2148. }
  2149. return arr;
  2150. },
  2151. //时间段范围设置改动,监听
  2152. onTimeTypeChange(timeType) {
  2153. this.seleChn(1)
  2154. this.showAddMore = true;
  2155. for(var i in this.workForm.domains) {
  2156. if (this.workForm.domains[i].timeType == 0) {
  2157. this.showAddMore = false;
  2158. break;
  2159. }
  2160. }
  2161. if (this.showAddMore) {
  2162. //检测数量
  2163. if (this.workForm.domains.length == 2) {
  2164. this.showAddMore = false;
  2165. } else {
  2166. this.showAddMore = true;
  2167. }
  2168. }
  2169. },
  2170. getTimeType() {
  2171. this.http.post('/time-type/getCompanyTimeSetting', { companyId: this.user.companyId},
  2172. res => {
  2173. if (res.code == "ok") {
  2174. var t = res.data;
  2175. this.reportTimeType = t;
  2176. if (this.reportTimeType.type > 0) {
  2177. this.showAddMore = true;
  2178. }
  2179. //转化时间格式
  2180. if (t.allday != null) {
  2181. this.timeType.push({value:0, label:'全天 - '+t.allday+'小时', hours:t.allday});
  2182. }
  2183. if (t.am != null) {
  2184. this.timeType.push({value:1, label:'上午 - '+t.am+'小时', hours: t.am});
  2185. }
  2186. if (t.pm != null) {
  2187. this.timeType.push({value:2, label:'下午 - '+t.pm+'小时', hours: t.pm});
  2188. }
  2189. } else {
  2190. this.$message({
  2191. message: res.msg,
  2192. type: "error"
  2193. });
  2194. }
  2195. },
  2196. error => {
  2197. this.listLoading = false;
  2198. this.$message({
  2199. message: error,
  2200. type: "error"
  2201. });
  2202. });
  2203. },
  2204. // 改变月份
  2205. changeMonthOut() {
  2206. this.getAllDate();
  2207. this.getReportList();
  2208. this.getDepartment();
  2209. },
  2210. // 选择日期
  2211. choseDate(i, item) {
  2212. this.choseDay = i;
  2213. let day = (this.choseDay +1)> 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  2214. sessionStorage.msg = this.date + day,
  2215. this.getReportList();
  2216. this.getDepartment();
  2217. this.curDate = item.date;
  2218. },
  2219. // 获取日期列表
  2220. getAllDate() {
  2221. var dayArry = [];
  2222. var day = this.getCountDays();
  2223. let curMonthDay = null;
  2224. for (var k = 1; k <= day; k++) {
  2225. var str = new Date(this.date.replace(/-/g, "/")+'/01').getMonth() + 1 + "月" + k+'日';
  2226. var showStr = new Date(this.date.replace(/-/g, "/")+'/01').getMonth() + 1+'.'+k;
  2227. if ( new Date(this.date.replace(/-/g, "/")+'/01').getFullYear() == new Date(new Date()).getFullYear() &&
  2228. new Date(this.date.replace(/-/g, "/")+'/01').getMonth() == new Date(new Date()).getMonth()) {
  2229. if(sessionStorage.msg) {
  2230. if(parseInt(sessionStorage.msg.split("-")[2]) == k) {
  2231. this.choseDay = k - 1;
  2232. curMonthDay = str;
  2233. }
  2234. } else {
  2235. if (new Date().getDate() == k) {
  2236. this.choseDay = k - 1;
  2237. }
  2238. }
  2239. } else {
  2240. this.choseDay = 0;
  2241. }
  2242. var curDateStr = (this.date +'-'+ (k<10?('0'+k):k));
  2243. var curDateTime = util.formatDate.parse(curDateStr, 'yyyy-MM-dd');
  2244. dayArry.push({date:str, weekDay:this.weekDay[curDateTime.getDay()], showDate:showStr});
  2245. }
  2246. this.allDate = dayArry;
  2247. //不能超过最大日期
  2248. if (this.choseDay > day-1) {
  2249. this.choseDay = day-1;
  2250. }
  2251. //从消息点击跳转过来的,直接加载指定日期
  2252. if (sessionStorage.from == 1 && sessionStorage.msg) {
  2253. this.curDate = sessionStorage.msg;
  2254. sessionStorage.from = 0;
  2255. } else {
  2256. if (curMonthDay != null) {
  2257. this.curDate = curMonthDay;
  2258. } else {
  2259. var d = new Date(this.date.replace(/-/g, "/")+'/01')
  2260. this.curDate = (d.getMonth()+1)+'月'+d.getDate()+'日';
  2261. }
  2262. }
  2263. this.getReportFillStatus();
  2264. },
  2265. getCountDays() {
  2266. var newstr = this.date.replace(/-/g, "/");
  2267. var curDate = new Date(newstr+'/01');
  2268. var curMonth = curDate.getMonth();
  2269. curDate.setMonth(curMonth + 1);
  2270. curDate.setDate(0);
  2271. return curDate.getDate();
  2272. },
  2273. //获取日报列表
  2274. getReportList() {
  2275. this.listLoading = true;
  2276. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  2277. let param = {date: this.date + day};
  2278. if (this.deptId != null) {
  2279. param.deptId = this.deptId;
  2280. }
  2281. if (this.targetUid != null) {
  2282. param.userId = this.targetUid;
  2283. }
  2284. this.http.post( this.port.report.list, param,
  2285. res => {
  2286. this.listLoading = false;
  2287. if (res.code == "ok") {
  2288. this.reportList = res.data;
  2289. document.querySelector("#day"+this.choseDay).scrollIntoView(true);
  2290. // this.dealWith()
  2291. } else {
  2292. this.$message({
  2293. message: res.msg,
  2294. type: "error"
  2295. });
  2296. }
  2297. },
  2298. error => {
  2299. this.listLoading = false;
  2300. this.$message({
  2301. message: error,
  2302. type: "error"
  2303. });
  2304. });
  2305. },
  2306. // 处理数据
  2307. // dealWith() {
  2308. // var tianxie = 0
  2309. // var weixtianxie = 0
  2310. // if(this.selectState == -1) {
  2311. // } else {
  2312. // var arr = []
  2313. // for (var i in this.reportList) {
  2314. // arr.push(this.reportList[i].id)
  2315. // }
  2316. // this.getDealWith(this.dealList.children, tianxie, weixtianxie, arr)
  2317. // }
  2318. // },
  2319. // getDealWith(item, tx, wtx, arr) {
  2320. // // console.log(item,12345)
  2321. // for(var i in item) {
  2322. // if(item[i].children) {
  2323. // this.getDealWith(item[i].children, tx, wtx, arr)
  2324. // } else {
  2325. // console.log(arr.indexOf(item[i].id))
  2326. // console.log(arr)
  2327. // console.log(item[i].id)
  2328. // if(arr.indexOf(item[i].id) != '-1') {
  2329. // tx = +tx + 1
  2330. // }
  2331. // }
  2332. // }
  2333. // console.log(tx, '看看值')
  2334. // },
  2335. //导出日报
  2336. exportReport() {
  2337. this.listLoading = true;
  2338. var param = {};
  2339. if (this.exportParam.dateRange != null) {
  2340. param = {startDate:this.exportParam.dateRange[0], endDate: this.exportParam.dateRange[1]};
  2341. }
  2342. if (this.exportParam.projectId != null) {
  2343. param.projectId = this.exportParam.projectId;
  2344. }
  2345. this.http.post( this.port.report.export, param,
  2346. res => {
  2347. this.listLoading = false;
  2348. if (res.code == "ok") {
  2349. location.href = res.data;
  2350. this.exportDialog = false;
  2351. } else {
  2352. this.$message({
  2353. message: res.msg,
  2354. type: "error"
  2355. });
  2356. }
  2357. },
  2358. error => {
  2359. this.listLoading = false;
  2360. this.$message({
  2361. message: error,
  2362. type: "error"
  2363. });
  2364. });
  2365. },
  2366. //获取项目列表
  2367. getProjectList() {
  2368. this.listLoading = true;
  2369. this.http.post( this.port.project.list, {},
  2370. res => {
  2371. this.listLoading = false;
  2372. if (res.code == "ok") {
  2373. this.projectList = res.data;
  2374. } else {
  2375. this.$message({
  2376. message: res.msg,
  2377. type: "error"
  2378. });
  2379. }
  2380. },
  2381. error => {
  2382. this.listLoading = false;
  2383. this.$message({
  2384. message: error,
  2385. type: "error"
  2386. });
  2387. });
  2388. },
  2389. // 获取个人某天的日报
  2390. getReport() {
  2391. this.http.post( this.port.report.getPort, {
  2392. date: this.workForm.createDate
  2393. },
  2394. res => {
  2395. if (res.code == "ok") {
  2396. var quanbu = 0
  2397. this.jsDay = 1
  2398. var zhi = ''
  2399. var slp = res.data.report
  2400. for(var i in slp) {
  2401. var sp = +slp[i].workingTime + 0
  2402. zhi = this.jsDay * sp
  2403. quanbu = +quanbu + zhi
  2404. }
  2405. this.jsTime = quanbu
  2406. var list = res.data;
  2407. this.report = list;
  2408. if(list.report.length != 0) {
  2409. var arr = [];
  2410. this.canEdit = false;
  2411. for(var i in list.report) {
  2412. var flg = null
  2413. list.report[i].isOvertime == 1 ? flg = true : flg = false
  2414. arr.push({
  2415. id: list.report[i].id,
  2416. projectId: list.report[i].projectId,
  2417. workingTime: list.report[i].workingTime,
  2418. content: list.report[i].content,
  2419. state: list.report[i].state,
  2420. timeType: list.report[i].timeType,
  2421. subProjectList: list.report[i].subProjectList,
  2422. taskList: list.report[i].taskList,
  2423. subProjectId: list.report[i].subProjectId == 0?null:list.report[i].subProjectId,
  2424. groupId: list.report[i].groupId == 0?null:list.report[i].groupId,
  2425. taskId: list.report[i].taskId,
  2426. // startTime: `Fri May 16 2021 ${list.report[i].startTime}:12 GMT+0800 (中国标准时间)`,
  2427. startTime: list.report[i].startTime,
  2428. // endTime: `Fri May 16 2021 ${list.report[i].endTime}:12 GMT+0800 (中国标准时间)`,
  2429. endTime: list.report[i].endTime,
  2430. isOvertime: flg,
  2431. progress:list.report[i].progress,
  2432. professionProgress: list.report[i].professionProgressList,
  2433. stages:list.report[i].stages,
  2434. stage:list.report[i].stage == '-'?null:list.report[i].stage,
  2435. pics: list.report[i].pics,
  2436. multiWorktime: list.report[i].multiWorktime,
  2437. worktimeList: list.report[i].worktimeList,
  2438. degreeId: list.report[i].degreeId==-1?null:list.report[i].degreeId,
  2439. wuduList: list.report[i].degreeList,
  2440. taskGroups:list.report[i].taskGroups
  2441. })
  2442. if (list.report[i].state >= 2) {
  2443. this.canEdit = true;
  2444. }
  2445. }
  2446. this.workForm = {
  2447. createDate: this.workForm.createDate,
  2448. domains: arr,
  2449. userNames:null,
  2450. userId:null,
  2451. }
  2452. } else {
  2453. this.workForm = {
  2454. createDate: this.workForm.createDate,
  2455. domains: [{
  2456. id: null,
  2457. projectId: "",
  2458. workingTime: this.reportTimeType.type==3?(this.reportTimeType.allday).toFixed(1):"",
  2459. content: "",
  2460. progress:100,
  2461. state: 2,
  2462. timeType:0,
  2463. multiWorktime: this.reportTimeType.multiWorktime,
  2464. worktimeList:[{}],
  2465. }],
  2466. userId:null,
  2467. userNames:null,
  2468. }
  2469. this.canEdit = true;
  2470. }
  2471. } else {
  2472. this.$message({
  2473. message: res.msg,
  2474. type: "error"
  2475. });
  2476. }
  2477. },
  2478. error => {
  2479. this.$message({
  2480. message: error,
  2481. type: "error"
  2482. });
  2483. });
  2484. },
  2485. guanbi() {
  2486. this.falsss = false
  2487. },
  2488. // wuduLists(id) {
  2489. // this.http.post('/project/getDegreeList',{
  2490. // projectId: id,
  2491. // },
  2492. // res => {
  2493. // if (res.code == "ok") {
  2494. // return res.data
  2495. // }
  2496. // },
  2497. // error => {
  2498. // this.$message({
  2499. // message: error,
  2500. // type: "error"
  2501. // });
  2502. // }
  2503. // );
  2504. // },
  2505. // 打开日报填写
  2506. fillInReport(i, isBatch) {
  2507. if(i != 1) {
  2508. this.falsss = false
  2509. } else {
  2510. this.falsss = true
  2511. }
  2512. if (this.isSubstitude) {
  2513. this.getSubstitudeUserDeptList();
  2514. }
  2515. if(i == -1 || this.isSubstitude) {
  2516. this.isDisable = false;
  2517. } else {
  2518. this.isDisable = true;
  2519. }
  2520. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  2521. this.isBatch = isBatch;
  2522. if (this.isBatch == 0 && !this.isSubstitude) {
  2523. this.workForm.createDate = this.date + day; // 获取个人某天的日报
  2524. this.getReport(i);
  2525. } else {
  2526. this.workForm = {
  2527. createDate: null,//批量填报没有日期
  2528. domains: [{
  2529. id: null,
  2530. projectId: "",
  2531. workingTime: this.reportTimeType.type==3?(this.reportTimeType.allday).toFixed(1):"",
  2532. content: "",
  2533. progress:100,
  2534. state: 2,
  2535. timeType:0,
  2536. multiWorktime: this.reportTimeType.multiWorktime,
  2537. worktimeList:[{}],
  2538. }],
  2539. }
  2540. this.canEdit = true;
  2541. }
  2542. this.dialogVisible = true;
  2543. },
  2544. // 按周填报里内容的填写
  2545. tianxies(item, i, names, row) {
  2546. console.log(item, i, names, row[0], '你好')
  2547. var idd = ''
  2548. var obj = {}
  2549. for(var l in this.projectList) {
  2550. if(this.projectList[l].projectName == names) idd = this.projectList[l].id
  2551. }
  2552. obj.projectId = idd
  2553. this.selectProject(obj, 0)
  2554. console.log(this.workForm.domains[0], '打印出来的')
  2555. this.tianxieDialogVisible = true
  2556. this.scopess = item
  2557. var sss = {}
  2558. sss.con = item.con
  2559. sss.progress = item.progress
  2560. sss.time = item.time
  2561. sss.workingTime = item.workingTime
  2562. var that = this
  2563. setTimeout(() =>{
  2564. if(Object.keys(item).length < 5) {
  2565. console.log(456)
  2566. sss.subProjectId = that.workForm.domains[0].subProjectId
  2567. sss.stage = that.workForm.domains[0].stage
  2568. sss.subProjectList = that.workForm.domains[0].subProjectList
  2569. sss.stages = that.workForm.domains[0].stages
  2570. } else {
  2571. console.log(123)
  2572. sss.subProjectId = item.subProjectId
  2573. sss.stage = item.stage
  2574. sss.subProjectList = item.subProjectList
  2575. sss.stages = item.stages
  2576. }
  2577. console.log(sss, '数据')
  2578. that.zhoBaoIdx = i
  2579. that.zhoBaoName = names
  2580. that.zhoBao = sss
  2581. that.zhis = row
  2582. },200);
  2583. // if(Object.keys(sss).length <= 4) {
  2584. // sss.subProjectId = this.workForm.domains[0].subProjectId
  2585. // sss.stage = this.workForm.domains[0].stage
  2586. // sss.subProjectList = this.workForm.domains[0].subProjectList
  2587. // sss.stages = this.workForm.domains[0].stages
  2588. // } else {
  2589. // sss.subProjectId = item.subProjectId
  2590. // sss.stage = item.stage
  2591. // sss.subProjectList = item.subProjectList
  2592. // sss.stages = item.stages
  2593. // }
  2594. // console.log(sss, '数据')
  2595. // this.zhoBaoIdx = i
  2596. // this.zhoBaoName = names
  2597. // this.zhoBao = sss
  2598. // this.zhis = row
  2599. // this.selectProject(row[0], i)
  2600. },
  2601. // 按周填报里内容的填写点击确定
  2602. btnTianxiaes() {
  2603. this.tianxieDialogVisible = false
  2604. var zhong = this.zhoData
  2605. zhong[this.zhoBaoIdx][this.zhoBaoName] = this.zhoBao
  2606. this.zhoData = zhong
  2607. if(this.reportTimeType.type == 1) this.zhoXuan(this.zhoBao, this.zhoBaoIdx)
  2608. if(this.reportTimeType.type == 2) this.zhoTimes(this.zhoBao, this.zhoBaoIdx)
  2609. if(this.reportTimeType.type == 3) this.addBli(this.zhoBao, this.zhoBaoIdx)
  2610. },
  2611. // 获取本周
  2612. getCurrentWeek() {
  2613. const currentDate = new Date()
  2614. const week = currentDate.getDay()
  2615. const millisecond = 1000 * 60 * 60 * 24
  2616. const minusDay = week != 0 ? week - 1 : 4
  2617. const monday = new Date(currentDate.getTime() - minusDay * millisecond)
  2618. const sunday = new Date(monday.getTime() + 4 * millisecond)
  2619. var stat = this.dealdate(monday)
  2620. var end = this.dealdate(sunday)
  2621. this.zhoRqi = [stat, end]
  2622. this.zhoRqis()
  2623. this.jiazai()
  2624. },
  2625. // 获取上周
  2626. handleGetPrevWeek() {
  2627. const Time = new Date(this.zhoRqi[0])
  2628. let weekNum = Time.getDay()
  2629. weekNum = weekNum == 0 ? 7 : weekNum
  2630. let lastDate = new Date(Time.getTime() - weekNum * 24 * 60 * 60 * 1000)
  2631. let fitstDate = new Date(
  2632. Time.getTime() - (weekNum + 6) * 24 * 60 * 60 * 1000
  2633. )
  2634. let startDate = `${fitstDate.getFullYear()}-${
  2635. fitstDate.getMonth() + 1 < 10
  2636. ? '0' + (fitstDate.getMonth() + 1)
  2637. : fitstDate.getMonth() + 1
  2638. }-${
  2639. fitstDate.getDate() < 10
  2640. ? '0' + fitstDate.getDate()
  2641. : fitstDate.getDate()
  2642. }`
  2643. let endDate = `${lastDate.getFullYear()}-${
  2644. lastDate.getMonth() + 1 < 10
  2645. ? '0' + (lastDate.getMonth() + 1)
  2646. : lastDate.getMonth() + 1
  2647. }-${
  2648. lastDate.getDate() < 10 ? '0' + lastDate.getDate() : lastDate.getDate()
  2649. }`
  2650. var stat = this.dealdate(startDate)
  2651. var ends = this.dealdate(endDate)
  2652. var end = this.dateChange(-2, ends)
  2653. this.zhoRqi = [stat, end]
  2654. this.zhoRqis()
  2655. this.jiazai()
  2656. },
  2657. // 获取下周
  2658. handleGetNextvWeek() {
  2659. const Time = new Date(this.zhoRqi[1])
  2660. let weekNum = Time.getDay()
  2661. weekNum = weekNum == 0 ? 7 : weekNum
  2662. let fitstDate = new Date(
  2663. Time.getTime() + (7 - weekNum + 1) * 24 * 60 * 60 * 1000
  2664. )
  2665. let lastDate = new Date(
  2666. Time.getTime() + (7 - weekNum + 7) * 24 * 60 * 60 * 1000
  2667. )
  2668. let startDate = `${fitstDate.getFullYear()}-${
  2669. fitstDate.getMonth() + 1 < 10
  2670. ? '0' + (fitstDate.getMonth() + 1)
  2671. : fitstDate.getMonth() + 1
  2672. }-${
  2673. fitstDate.getDate() < 10
  2674. ? '0' + fitstDate.getDate()
  2675. : fitstDate.getDate()
  2676. }`
  2677. let endDate = `${lastDate.getFullYear()}-${
  2678. lastDate.getMonth() + 1 < 10
  2679. ? '0' + (lastDate.getMonth() + 1)
  2680. : lastDate.getMonth() + 1
  2681. }-${
  2682. lastDate.getDate() < 10 ? '0' + lastDate.getDate() : lastDate.getDate()
  2683. }`
  2684. var stat = this.dealdate(startDate)
  2685. var ends = this.dealdate(endDate)
  2686. var end = this.dateChange(-2, ends)
  2687. this.zhoRqi = [stat, end]
  2688. this.zhoRqis()
  2689. this.jiazai()
  2690. },
  2691. // 新增日期
  2692. newDates() {
  2693. console.log(this.zhoRqi, '看卡')
  2694. this.zhoRqi[1] = this.dateChange(1, this.zhoRqi[1])
  2695. console.log(this.zhoRqi[1])
  2696. var obj = {}
  2697. obj.zhoDataTime = this.zhoRqi[1]
  2698. obj.he = 0
  2699. for(var j in this.projectList) {
  2700. var xinzhi = this.projectList[j].projectName
  2701. obj[xinzhi] = {}
  2702. obj[xinzhi].time = ''
  2703. obj[xinzhi].con = ''
  2704. obj[xinzhi].progress = 0
  2705. obj[xinzhi].workingTime = 0
  2706. }
  2707. this.zhoData.push(obj)
  2708. },
  2709. // 减去时间
  2710. dateChange(num = 1,date = false) {
  2711.   if (!date) {
  2712.     date = new Date();//没有传入值时,默认是当前日期
  2713.     date = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
  2714.   }
  2715.   date += " 00:00:00";//设置为当天凌晨12点
  2716.   date = Date.parse(new Date(date))/1000;//转换为时间戳
  2717.   date += (86400) * num;//修改后的时间戳
  2718.   var newDate = new Date(parseInt(date) * 1000);//转换为时间
  2719. var nian = newDate.getFullYear()
  2720. var yue = ''
  2721. var ri = ''
  2722. var yues = (newDate.getMonth() + 1)
  2723. var ris = newDate.getDate()
  2724. yues > 9 ? yue = yues : yue = '0' + yues
  2725. ris > 9 ? ri = ris : ri = '0' + ris
  2726. return nian +'-'+yue+'-'+ri
  2727. },
  2728. // 加载动画
  2729. jiazai() {
  2730. this.zhoLoading = true
  2731. var that = this
  2732. setTimeout(() =>{
  2733. that.zhoLoading = false
  2734. },1000);
  2735. },
  2736. // 转时间格式
  2737. dealdate(date) {
  2738. const dt = new Date(date)
  2739. const y = dt.getFullYear()
  2740. const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  2741. const d = (dt.getDate() + '').padStart(2, '0')
  2742. return `${y}-${m}-${d}`
  2743. },
  2744. // 按周填报
  2745. fillInReportss() {
  2746. window.addEventListener('scroll', this.handleScroll, true)
  2747. this.jiazai()
  2748. this.diasZho = true
  2749. this.getCurrentWeek()
  2750. },
  2751. handleScroll() {
  2752. this.changdu = this.projectList.length + 1
  2753. },
  2754. // 自动选择时间点的事件
  2755. zhoTimes(item, i, ims, event) {
  2756. var iss = i
  2757. if(item.time == null) {
  2758. return
  2759. } else {
  2760. var zhi = this.zhoData[iss]
  2761. var he = 0
  2762. for(var i in zhi) {
  2763. if(zhi[i].time && zhi[i].time.length > 0 && i != 'zhoDataTime' && i != 'he') {
  2764. var date2 = '2021/12/12 ' + zhi[i].time[1] +':00'
  2765. var date1 = '2021/12/12 ' + zhi[i].time[0] +':00'
  2766. var date3 = new Date(date2).getTime() - new Date(date1).getTime();
  2767. var leave1=date3%(24*3600*1000)
  2768. var hours=Math.floor(leave1/(3600*1000))
  2769. var leave2=leave1%(3600*1000)
  2770. var minutes=Math.floor(leave2/(60*1000))
  2771. var shi = hours+'.'+ minutes
  2772. he += +shi
  2773. }
  2774. }
  2775. zhi.he = he + 'h'
  2776. }
  2777. },
  2778. // 自动选择事件长度的事件
  2779. zhoXuan(item, i) {
  2780. var iss = i
  2781. if(item.time == null) {
  2782. return
  2783. } else {
  2784. var zhi = this.zhoData[iss]
  2785. var he = 0
  2786. for(var i in zhi) {
  2787. if(i != 'zhoDataTime' && i != 'he' && zhi[i].workingTime && zhi[i].workingTime.length > 0) {
  2788. he += +zhi[i].workingTime
  2789. }
  2790. }
  2791. zhi.he = he + 'h'
  2792. }
  2793. },
  2794. // 按时间比例
  2795. addBli(item, i) {
  2796. var iss = i
  2797. if(item.time == null) {
  2798. return
  2799. } else {
  2800. var zhi = this.zhoData[iss]
  2801. var he = 0
  2802. for(var i in zhi) {
  2803. if(i != 'zhoDataTime' && i != 'he' && zhi[i].workingTime && zhi[i].workingTime.length > 0) {
  2804. he += +zhi[i].workingTime
  2805. }
  2806. }
  2807. zhi.he = he.toFixed(1) + 'h'
  2808. }
  2809. },
  2810. zhoRqis() {
  2811. this.zhoData = []
  2812. if(this.zhoRqi) {
  2813. var stime = this.zhoRqi[0]
  2814. var etime = this.zhoRqi[1]
  2815. var zhi = this.getdiffdate(stime, etime)
  2816. var arrst = []
  2817. for(var i in zhi) {
  2818. var obj = {}
  2819. obj.zhoDataTime = zhi[i]
  2820. obj.he = 0
  2821. for(var j in this.projectList) {
  2822. var xinzhi = this.projectList[j].projectName
  2823. obj[xinzhi] = {}
  2824. obj[xinzhi].time = ''
  2825. obj[xinzhi].con = ''
  2826. obj[xinzhi].progress = 0
  2827. obj[xinzhi].workingTime = 0
  2828. }
  2829. arrst.push(obj)
  2830. }
  2831. this.zhoData = arrst
  2832. }
  2833. },
  2834. zhoZhi(res, i) {
  2835. var zhi = 0
  2836. for(var i in res) {
  2837. if(i != 'zhoDataTime' && i != 'he') {
  2838. zhi += +res[i]
  2839. }
  2840. }
  2841. res.he = zhi
  2842. },
  2843. zhoBtn(i) {
  2844. // this.zhoData.split(i, 1)
  2845. var arr = this.zhoData
  2846. arr.splice(i, 1)
  2847. },
  2848. // 提交按周填报
  2849. zhoAdd() {
  2850. var zhi = this.zhoData
  2851. var ll = 0
  2852. console.log(this.reportTimeType.type)
  2853. console.log(this.reportTimeType.multiWorktime)
  2854. if(this.reportTimeType.type == 2) {
  2855. for(var i in zhi) {
  2856. this.dateAr = []
  2857. var alp = []
  2858. var zhis = zhi[i]
  2859. for(var j in zhis) {
  2860. if(j != 'zhoDataTime' && j != 'he' && zhis[j].time != null && zhis[j].time != 'null' && zhis[j].time != '') {
  2861. let objs = {}
  2862. objs.s = zhis[j].time[0]
  2863. objs.e = zhis[j].time[1]
  2864. alp.push(objs)
  2865. }
  2866. }
  2867. this.dateAr = alp
  2868. if(this.dateAr.length > 0) {
  2869. let trus = this.fns()
  2870. ll += 1
  2871. if(!trus) {
  2872. this.$message({
  2873. message: '填写的时间段重叠',
  2874. type: 'error'
  2875. })
  2876. return false
  2877. }
  2878. }
  2879. }
  2880. if(ll == 0) {
  2881. this.$message({
  2882. message: '请填写时间',
  2883. type: 'error'
  2884. })
  2885. return false
  2886. }
  2887. } else if(this.reportTimeType.type == 1){
  2888. for(var i in zhi) {
  2889. var zhis = zhi[i]
  2890. for(var j in zhis) {
  2891. if(j != 'zhoDataTime' && j != 'he' && zhis[j].workingTime != null && zhis[j].workingTime != 'null' && zhis[j].workingTime != '') {
  2892. ll += 1
  2893. }
  2894. }
  2895. }
  2896. if(ll == 0) {
  2897. this.$message({
  2898. message: '请选择时间',
  2899. type: 'error'
  2900. })
  2901. return false
  2902. }
  2903. }
  2904. var submits = []
  2905. let formData = new FormData();
  2906. if(this.reportTimeType.multiWorktime == 1){
  2907. for (var i in this.zhoData) {
  2908. var zhoD = this.zhoData[i]
  2909. var flgs = false
  2910. for(var j in zhoD) {
  2911. if(j != 'zhoDataTime' && j != 'he' && zhoD[j].time && zhoD[j].time.length > 0 && zhoD[j].time != null && zhoD[j].time != 'null') {
  2912. flgs = true
  2913. formData.append("degreeId", "-1");
  2914. formData.append("id", '-1');
  2915. for(var s in this.projectList) {
  2916. if(j == this.projectList[s].projectName) {
  2917. formData.append("projectId", this.projectList[s].id);
  2918. }
  2919. }
  2920. zhoD[j].subProjectId ? formData.append("subProjectId", zhoD[j].subProjectId) : formData.append("subProjectId", '0');
  2921. formData.append("taskId", 0);
  2922. formData.append("reportTimeType", this.reportTimeType.type);
  2923. formData.append("endTime", '');
  2924. formData.append("startTime", '');
  2925. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  2926. var lix = []
  2927. var objjs = {}
  2928. objjs.startTime = zhoD[j].time[0]
  2929. objjs.endTime = zhoD[j].time[1]
  2930. if (zhoD[j].con == null || zhoD[j].con == '') {
  2931. zhoD[j].con == '-'
  2932. }
  2933. objjs.content = zhoD[j].con
  2934. lix.push(objjs)
  2935. var zhiZhi = JSON.stringify(lix)
  2936. zhiZhi = zhiZhi.replace(/,/g,"@");
  2937. formData.append("content", zhiZhi)
  2938. formData.append("isOvertime", 0)
  2939. formData.append("professionProgress", "[]")
  2940. zhoD[j].stage ? formData.append("stage", zhoD[j].stage) : formData.append("stage", '');
  2941. formData.append("createDate",zhoD.zhoDataTime)
  2942. }
  2943. }
  2944. }
  2945. } else {
  2946. for (var i in this.zhoData) {
  2947. var zhoD = this.zhoData[i]
  2948. var flgs = false
  2949. if(this.reportTimeType.type == 2) {
  2950. for(var j in zhoD) {
  2951. if(j != 'zhoDataTime' && j != 'he' && zhoD[j].time && zhoD[j].time.length > 0 && zhoD[j].time != null && zhoD[j].time != 'null') {
  2952. flgs = true
  2953. formData.append("degreeId", "-1");
  2954. formData.append("id", '-1');
  2955. for(var s in this.projectList) {
  2956. if(j == this.projectList[s].projectName) {
  2957. formData.append("projectId", this.projectList[s].id);
  2958. }
  2959. }
  2960. zhoD[j].subProjectId ? formData.append("subProjectId", zhoD[j].subProjectId) : formData.append("subProjectId", '0');
  2961. formData.append("taskId", 0);
  2962. formData.append("reportTimeType", this.reportTimeType.type);
  2963. formData.append("endTime", zhoD[j].time[1]);
  2964. formData.append("startTime", zhoD[j].time[0]);
  2965. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  2966. zhoD[j].con == '' || zhoD[j].con == null ? formData.append("content", '-') : formData.append("content", zhoD[j].con)
  2967. formData.append("isOvertime", 0)
  2968. formData.append("professionProgress", "[]")
  2969. zhoD[j].stage ? formData.append("stage", zhoD[j].stage) : formData.append("stage", '');
  2970. formData.append("createDate",zhoD.zhoDataTime)
  2971. }
  2972. }
  2973. } else {
  2974. for(var j in zhoD) {
  2975. 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') {
  2976. flgs = true
  2977. formData.append("degreeId", "-1");
  2978. formData.append("id", '-1');
  2979. for(var s in this.projectList) {
  2980. if(j == this.projectList[s].projectName) {
  2981. formData.append("projectId", this.projectList[s].id);
  2982. }
  2983. }
  2984. zhoD[j].subProjectId ? formData.append("subProjectId", zhoD[j].subProjectId) : formData.append("subProjectId", '0')
  2985. // formData.append("subProjectId", zhoD[j].subProjectId);
  2986. formData.append("taskId", 0);
  2987. formData.append("reportTimeType", this.reportTimeType.type);
  2988. if(this.reportTimeType.type == 1) {
  2989. formData.append("workingTime", zhoD[j].workingTime);
  2990. } else if(this.reportTimeType.type == 2) {
  2991. formData.append("endTime", zhoD[j].time[1]);
  2992. formData.append("startTime", zhoD[j].time[0]);
  2993. } else if(this.reportTimeType.type == 3) {
  2994. formData.append("progress", zhoD[j].progress);
  2995. formData.append("workingTime", zhoD[j].workingTime);
  2996. }
  2997. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  2998. zhoD[j].con == '' || zhoD[j].con == null ? formData.append("content", '-') : formData.append("content", zhoD[j].con)
  2999. formData.append("isOvertime", 0)
  3000. formData.append("professionProgress", "[]")
  3001. zhoD[j].stage ? formData.append("stage", zhoD[j].stage) : formData.append("stage", '');
  3002. formData.append("createDate",zhoD.zhoDataTime)
  3003. }
  3004. }
  3005. }
  3006. }
  3007. }
  3008. // else {
  3009. // for (var i in this.zhoData) {
  3010. // var zhoD = this.zhoData[i]
  3011. // var flgs = false
  3012. // for(var j in zhoD) {
  3013. // 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') {
  3014. // flgs = true
  3015. // formData.append("degreeId", "-1");
  3016. // formData.append("id", '-1');
  3017. // for(var s in this.projectList) {
  3018. // if(j == this.projectList[s].projectName) {
  3019. // formData.append("projectId", this.projectList[s].id);
  3020. // }
  3021. // }
  3022. // formData.append("subProjectId", '0');
  3023. // formData.append("taskId", 0);
  3024. // formData.append("reportTimeType", this.reportTimeType.type);
  3025. // formData.append("progress", zhoD[j].progress);
  3026. // formData.append("workingTime", zhoD[j].workingTime);
  3027. // formData.append("content", zhoD[j].con);
  3028. // formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  3029. // formData.append("isOvertime", 0)
  3030. // formData.append("professionProgress", "[]")
  3031. // formData.append("stage", "");
  3032. // formData.append("createDate",zhoD.zhoDataTime)
  3033. // }
  3034. // }
  3035. // }
  3036. // }
  3037. this.http.uploadFile( this.port.report.editPort, formData,
  3038. res => {
  3039. this.listLoading = false;
  3040. if (res.code == "ok") {
  3041. this.$message({
  3042. message: "填报成功",
  3043. type: "success"
  3044. });
  3045. this.diasZho = false
  3046. this.zhoData = []
  3047. this.zhoRqi = ''
  3048. this.getReportList();
  3049. this.getDepartment();
  3050. } else {
  3051. this.$message({
  3052. message: res.msg,
  3053. type: "error"
  3054. });
  3055. }
  3056. },
  3057. error => {
  3058. this.listLoading = false;
  3059. this.$message({
  3060. message: error,
  3061. type: "error"
  3062. });
  3063. });
  3064. // 关闭弹窗 并 清空
  3065. // this.diasZho = false
  3066. // this.zhoData = []
  3067. // this.zhoRqi = ''
  3068. },
  3069. ChangeHourMinutestr (str) {
  3070. if (str !== "0" && str !== "" && str !== null) {
  3071. return ((Math.floor(str / 60)).toString().length < 2 ? "0" + (Math.floor(str / 60)).toString() :
  3072. (Math.floor(str / 60)).toString()) + ":" + ((str % 60).toString().length < 2 ? "0" + (str % 60).toString() : (str % 60).toString());
  3073. } else {
  3074. return "";
  3075. }
  3076. },
  3077. // 得到两个日期中间的日期
  3078. getdiffdate(stime,etime){
  3079. //初始化日期列表,数组
  3080. var diffdate = new Array();
  3081. var i=0;
  3082. //开始日期小于等于结束日期,并循环
  3083. while(stime<=etime){
  3084. diffdate[i] = stime;
  3085. //获取开始日期时间戳
  3086. var stime_ts = new Date(stime).getTime();
  3087. //增加一天时间戳后的日期
  3088. var next_date = stime_ts + (24*60*60*1000);
  3089. //拼接年月日,这里的月份会返回(0-11),所以要+1
  3090. var next_dates_y = new Date(next_date).getFullYear()+'-';
  3091. var next_dates_m = (new Date(next_date).getMonth()+1 < 10)?'0'+(new Date(next_date).getMonth()+1)+'-':(new Date(next_date).getMonth()+1)+'-';
  3092. var next_dates_d = (new Date(next_date).getDate() < 10)?'0'+new Date(next_date).getDate():new Date(next_date).getDate();
  3093. stime = next_dates_y+next_dates_m+next_dates_d;
  3094. //增加数组key
  3095. i++;
  3096. }
  3097. return diffdate;
  3098. },
  3099. // 添加模块
  3100. addDomain(i) {
  3101. var leftProgress = 10;
  3102. if (this.reportTimeType.type == 3) {
  3103. //计算已经待分配工时比例
  3104. let array = this.workForm.domains;
  3105. let totalProgress = 0;
  3106. for (var i=0;i<array.length; i++) {
  3107. totalProgress += array[i].progress;
  3108. }
  3109. if (totalProgress < 100) {
  3110. leftProgress = 100 - totalProgress;
  3111. }
  3112. }
  3113. this.workForm.domains.push({
  3114. projectId: "",
  3115. workingTime: this.reportTimeType.type == 3?(leftProgress*this.reportTimeType.allday/100).toFixed(1):"",
  3116. content: "",
  3117. progress:leftProgress,
  3118. state:2,//2-表示待提交
  3119. multiWorktime: this.reportTimeType.multiWorktime,
  3120. worktimeList:[{}],
  3121. // degreeId: '',
  3122. });
  3123. if (this.reportTimeType.type == 0) {
  3124. //全天上下午模式下,检测时间段数量,达到2个,不能再加了
  3125. var length = this.workForm.domains.length;
  3126. if (length == 2) {
  3127. this.showAddMore = false;
  3128. }
  3129. }
  3130. this.chuji()
  3131. },
  3132. // 移除模块
  3133. delDomain(i) {
  3134. this.workForm.domains.splice(i,1)
  3135. //检测当前剩下的一个,时间类型是否是全天
  3136. if (this.reportTimeType.type == 0) {
  3137. if (this.workForm.domains[0].timeType == 0) {
  3138. this.showAddMore = false;
  3139. } else {
  3140. this.showAddMore = true;
  3141. }
  3142. }
  3143. if(this.user.timeType.multiWorktime == 1) {
  3144. this.iptChangs()
  3145. } else {
  3146. this.seleChn(0)
  3147. }
  3148. },
  3149. // 改变月份
  3150. changeMonth() {
  3151. if (this.isBatch == 0 && !this.isSubstitude) {
  3152. //只有按天填报才能获取当天的日报
  3153. this.getReport()
  3154. }
  3155. },
  3156. // 判断时间段
  3157. fns() {
  3158. for (let k in this.dateAr) {
  3159. if (!this.judege(k)) {
  3160. return false
  3161. }
  3162. }
  3163. return true
  3164. },
  3165. judege(idx){
  3166. for (let k in this.dateAr) {
  3167. if (idx !== k) {
  3168. if (this.dateAr[k].s <= this.dateAr[idx].s && this.dateAr[k].e > this.dateAr[idx].s) {
  3169. return false
  3170. }
  3171. if (this.dateAr[k].s < this.dateAr[idx].e && this.dateAr[k].e >= this.dateAr[idx].e) {
  3172. return false
  3173. }
  3174. }
  3175. }
  3176. return true
  3177. },
  3178. // 保存日报
  3179. submitReport(isDraft) {
  3180. this.isDraft = isDraft;
  3181. this.$refs.workForm.validate(valid => {
  3182. if (valid) {
  3183. this.dateAr = []
  3184. let alp = []
  3185. if(this.user.timeType.multiWorktime != 1) {
  3186. for(var p in this.workForm.domains) {
  3187. if(this.workForm.domains[p].startTime || this.workForm.domains[p].endTime) {
  3188. let objs = {}
  3189. objs.s = this.workForm.domains[p].startTime
  3190. objs.e = this.workForm.domains[p].endTime
  3191. alp.push(objs)
  3192. }
  3193. }
  3194. this.dateAr = alp
  3195. if(this.dateAr.length > 0) {
  3196. let trus = this.fns()
  3197. if(!trus) {
  3198. this.$message({
  3199. message: '填写的时间段重叠',
  3200. type: "error"
  3201. });
  3202. return
  3203. }
  3204. }
  3205. } else {
  3206. for(var p in this.workForm.domains) {
  3207. var slll = this.workForm.domains[p]
  3208. for(var o in slll.worktimeList) {
  3209. if(slll.worktimeList[o].startTime || slll.worktimeList[o].endTime) {
  3210. let objs = {}
  3211. objs.s = slll.worktimeList[o].startTime
  3212. objs.e = slll.worktimeList[o].endTime
  3213. alp.push(objs)
  3214. }
  3215. }
  3216. }
  3217. this.dateAr = alp
  3218. if(this.dateAr.length > 0) {
  3219. let trus = this.fns()
  3220. if(!trus) {
  3221. this.$message({
  3222. message: '填写的时间段重叠',
  3223. type: "error"
  3224. });
  3225. return
  3226. }
  3227. }
  3228. }
  3229. // return
  3230. //代填的情况,检查人员是否已经选择
  3231. if (this.isSubstitude) {
  3232. if (this.workForm.userNames == null || this.workForm.userNames.length == 0) {
  3233. this.$message({
  3234. message: "请选择代填的人员",
  3235. type: "error"
  3236. });
  3237. return;
  3238. }
  3239. }
  3240. //检查时间,全天和上下午不能同时存在
  3241. if (this.reportTimeType.type == 0) {
  3242. var alldayNum = 0;
  3243. var amNum = 0;
  3244. var pmNum = 0;
  3245. for(var i in this.workForm.domains) {
  3246. if (this.workForm.domains[i].timeType == 0) {
  3247. alldayNum ++;
  3248. } else if (this.workForm.domains[i].timeType == 1) {
  3249. amNum++;
  3250. } else if (this.workForm.domains[i].timeType == 2) {
  3251. pmNum++;
  3252. }
  3253. }
  3254. if (alldayNum > 1) {
  3255. this.$message({
  3256. message: "工作时间-全天,只能选择一次",
  3257. type: "error"
  3258. });
  3259. return;
  3260. }
  3261. if (amNum > 1) {
  3262. this.$message({
  3263. message: "工作时间-上午,只能选择一次",
  3264. type: "error"
  3265. });
  3266. return;
  3267. }
  3268. if (pmNum > 1) {
  3269. this.$message({
  3270. message: "工作时间-下午,只能选择一次",
  3271. type: "error"
  3272. });
  3273. return;
  3274. }
  3275. if (alldayNum == 1 && (amNum > 0 || pmNum > 0)) {
  3276. this.$message({
  3277. message: "工作时间-全天,不能和上下午同时存在",
  3278. type: "error"
  3279. });
  3280. return;
  3281. }
  3282. } else if (this.reportTimeType.type == 3) {
  3283. //总百分比不能超过100%
  3284. let total = 0;
  3285. this.workForm.domains.forEach(w=>{total += w.progress});
  3286. if (total > 100) {
  3287. this.$message({
  3288. message: "用时比例之和不能超过100%",
  3289. type: "error"
  3290. });
  3291. return;
  3292. } else if (total < 100) {
  3293. this.$message({
  3294. message: "工时尚未完全分配,无法提交",
  3295. type: "error"
  3296. });
  3297. return;
  3298. }
  3299. }
  3300. this.listLoading = true;
  3301. let formData = new FormData();
  3302. formData.append("draft", this.isDraft);
  3303. for(var i in this.workForm.domains) {
  3304. if(this.workForm.domains[i].degreeId) {
  3305. // var sss = this.workForm.domains[i].degreeId.toString()
  3306. formData.append("degreeId", this.workForm.domains[i].degreeId);
  3307. } else {
  3308. formData.append("degreeId", -1);
  3309. }
  3310. if (this.workForm.domains[i].id) {
  3311. formData.append("id", this.workForm.domains[i].id);
  3312. } else {
  3313. formData.append("id", -1);
  3314. }
  3315. formData.append("projectId", this.workForm.domains[i].projectId);
  3316. if (this.workForm.domains[i].subProjectId) {
  3317. formData.append("subProjectId", this.workForm.domains[i].subProjectId);
  3318. } else {
  3319. formData.append("subProjectId", 0);
  3320. }
  3321. if (this.workForm.domains[i].groupId) {
  3322. formData.append("groupId", this.workForm.domains[i].groupId);
  3323. } else {
  3324. formData.append("groupId", 0);
  3325. }
  3326. if (this.workForm.domains[i].taskId) {
  3327. formData.append("taskId", this.workForm.domains[i].taskId);
  3328. } else {
  3329. formData.append("taskId", 0);
  3330. }
  3331. formData.append("reportTimeType", this.reportTimeType.type);
  3332. if (this.reportTimeType.type == 0) {
  3333. formData.append("timeType", this.workForm.domains[i].timeType);
  3334. var workingTime = this.timeType.filter(t=>t.value == this.workForm.domains[i].timeType)[0].hours;
  3335. formData.append("workingTime", workingTime);
  3336. } else if (this.reportTimeType.type == 1){
  3337. formData.append("workingTime", this.workForm.domains[i].workingTime);
  3338. } else if (this.reportTimeType.type == 2) {
  3339. formData.append("endTime", this.workForm.domains[i].endTime);
  3340. formData.append("startTime", this.workForm.domains[i].startTime);
  3341. } else if (this.reportTimeType.type == 3) {
  3342. //按比例分配
  3343. formData.append("progress", this.workForm.domains[i].progress);
  3344. formData.append("workingTime", this.workForm.domains[i].workingTime);
  3345. }
  3346. //处理多个时间事项
  3347. formData.append("multiWorktime", this.workForm.domains[i].multiWorktime);
  3348. if (this.reportTimeType.multiWorktime == 1) {
  3349. //检查时间是否有重叠
  3350. var workList = this.workForm.domains[i].worktimeList;
  3351. for (var j=0;j<workList.length; j++) {
  3352. var curItem = workList[j];
  3353. //检查开始时间是否大于结束时间
  3354. if (curItem.startTime >= curItem.endTime) {
  3355. this.$message({
  3356. message: "时间段"+curItem.startTime+'-'+curItem.endTime+"有误:"+
  3357. "结束时间必须大于开始时间",
  3358. type: "error"
  3359. });
  3360. return;
  3361. }
  3362. for (var p = j+1;p<workList.length; p++) {
  3363. var jItem = workList[p];
  3364. if ((jItem.startTime>=curItem.startTime&&jItem.startTime < curItem.endTime)
  3365. || (jItem.endTime>curItem.startTime&&jItem.endTime <= curItem.endTime)) {
  3366. this.$message({
  3367. message: "时间段"+curItem.startTime+'-'+curItem.endTime+"与"+
  3368. jItem.startTime+'-'+jItem.endTime+ "存在重叠,请修改。",
  3369. type: "error"
  3370. });
  3371. return;
  3372. }
  3373. }
  3374. }
  3375. let m = JSON.stringify(this.workForm.domains[i].worktimeList);
  3376. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  3377. formData.append("content", m);
  3378. } else {
  3379. if (this.workForm.domains[i].content) {
  3380. formData.append("content", '-');
  3381. } else {
  3382. formData.append("content", this.workForm.domains[i].content);
  3383. }
  3384. }
  3385. if (this.isBatch == 0) {
  3386. formData.append("createDate", this.workForm.createDate);
  3387. } else {
  3388. //批量填报,时间范围
  3389. formData.append("createDate", this.workForm.createDate[0]+'@'+this.workForm.createDate[1]);
  3390. }
  3391. if(this.workForm.domains[i].isOvertime) {
  3392. this.workForm.domains[i].isOvertime = '1'
  3393. formData.append("isOvertime", this.workForm.domains[i].isOvertime);
  3394. } else {
  3395. this.workForm.domains[i].isOvertime = '0'
  3396. formData.append("isOvertime", this.workForm.domains[i].isOvertime);
  3397. }
  3398. if (this.workForm.userId != null) {
  3399. var targetUids = '';
  3400. this.workForm.userId.forEach(u=>{
  3401. targetUids += u + '@';
  3402. });
  3403. if (targetUids.length > 0) {
  3404. targetUids = targetUids.substring(0, targetUids.length -1);
  3405. formData.append("targetUids", targetUids);
  3406. }
  3407. }
  3408. //项目专业进度
  3409. if (this.workForm.domains[i].professionProgress) {
  3410. var m = JSON.stringify(this.workForm.domains[i].professionProgress);
  3411. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  3412. formData.append("professionProgress", m);
  3413. } else {
  3414. formData.append("professionProgress", "[]");
  3415. }
  3416. if (this.workForm.domains[i].stage) {
  3417. formData.append("stage", this.workForm.domains[i].stage);
  3418. } else {
  3419. formData.append("stage", "-");
  3420. }
  3421. }
  3422. this.http.uploadFile( this.port.report.editPort, formData,
  3423. res => {
  3424. this.listLoading = false;
  3425. if (res.code == "ok") {
  3426. this.$message({
  3427. message: this.isDraft==0?"提交成功":"暂存成功",
  3428. type: "success"
  3429. });
  3430. this.dialogVisible = false;
  3431. this.jsDay = 0
  3432. this.jsTime = 0
  3433. this.getReportList();
  3434. this.getDepartment();
  3435. } else {
  3436. this.$message({
  3437. message: res.msg,
  3438. type: "error"
  3439. });
  3440. }
  3441. },
  3442. error => {
  3443. this.listLoading = false;
  3444. this.$message({
  3445. message: error,
  3446. type: "error"
  3447. });
  3448. });
  3449. }
  3450. });
  3451. },
  3452. cli() {
  3453. },
  3454. // 判断是展示那个工时导入
  3455. imports() {
  3456. if(this.user.timeType.syncCorpwxTime == 0) {
  3457. this.importDialog = true
  3458. } else {
  3459. this.importWxDialog = true
  3460. }
  3461. },
  3462. // 跳转
  3463. junpToDeskTop(id) {
  3464. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  3465. this.$router.push("/desktop/" + id + "/" + this.date +day);
  3466. },
  3467. // 通过日报
  3468. approve(id, item) {
  3469. this.logining = true;
  3470. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  3471. var ids = item.id;
  3472. // var data = item.data;
  3473. // data.forEach(element => {
  3474. // ids +=(element.id+',');
  3475. // });
  3476. this.http.post( this.port.report.approve, {id: id , date: this.date +day, reportIds: ids},
  3477. res => {
  3478. this.logining = false;
  3479. if (res.code == "ok") {
  3480. this.$message({
  3481. message: "审核成功",
  3482. type: "success"
  3483. });
  3484. this.getReportList();
  3485. this.getDepartment();
  3486. } else {
  3487. this.$message({
  3488. message: res.msg,
  3489. type: "error"
  3490. });
  3491. }
  3492. },
  3493. error => {
  3494. this.logining = false;
  3495. this.$message({
  3496. message: error,
  3497. type: "error"
  3498. });
  3499. });
  3500. },
  3501. //撤回日报
  3502. cancel(item) {
  3503. this.logining = true;
  3504. var ids = '';
  3505. var data = item.data;
  3506. data.forEach(element => {
  3507. ids +=(element.id+',');
  3508. });
  3509. this.http.post(this.port.report.cancelReport, {userId: this.user.id, reportIds: ids},
  3510. res => {
  3511. this.logining = false;
  3512. if (res.code == "ok") {
  3513. this.$message({
  3514. message:"撤回成功",
  3515. type: "success"
  3516. });
  3517. this.getReportList();
  3518. this.getDepartment();
  3519. } else {
  3520. this.$message({
  3521. message: res.msg,
  3522. type: "error"
  3523. });
  3524. }
  3525. },
  3526. error => {
  3527. this.logining = false;
  3528. this.$message({
  3529. message: error,
  3530. type: "error"
  3531. });
  3532. });
  3533. },
  3534. showDenyDialog(id,i, item) {
  3535. this.denyReasonDialog = true;
  3536. let day = (this.choseDay+1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  3537. var ids = item.id;
  3538. // var data = item.data;
  3539. // data.forEach(element => {
  3540. // ids +=(element.id+',');
  3541. // });
  3542. this.denyForm = {id: id ,i:i, date: this.date +day, reportIds: ids, reason:null};
  3543. },
  3544. // 未通过日报
  3545. deny() {
  3546. this.logining = true;
  3547. this.http.post( this.port.report.deny, this.denyForm,
  3548. res => {
  3549. this.logining = false;
  3550. if (res.code == "ok") {
  3551. this.$message({
  3552. message: this.denyForm.i==0?"驳回成功":"撤销成功",
  3553. type: "success"
  3554. });
  3555. this.getReportList();
  3556. this.getDepartment();
  3557. this.denyReasonDialog = false;
  3558. } else {
  3559. this.$message({
  3560. message: res.msg,
  3561. type: "error"
  3562. });
  3563. }
  3564. },
  3565. error => {
  3566. this.logining = false;
  3567. this.$message({
  3568. message: error,
  3569. type: "error"
  3570. });
  3571. });
  3572. }
  3573. },
  3574. created() {
  3575. let height = window.innerHeight;
  3576. this.tableHeight = height - 178;
  3577. const that = this;
  3578. window.onresize = function temp() {
  3579. that.tableHeight = window.innerHeight - 178;
  3580. };
  3581. },
  3582. mounted() {
  3583. var now = new Date();
  3584. var t = util.formatDate.format(now, 'yyyy-MM-dd');
  3585. var startStr = util.formatDate.format(new Date(), 'yyyy-MM') + "-01";
  3586. this.exportParam.dateRange = [startStr,t];
  3587. this.getAllDate();
  3588. this.getReportList();
  3589. this.getProjectList();
  3590. this.getTimeType();
  3591. this.getDepartment();
  3592. this.scrollFunction()
  3593. this.userssHu()
  3594. }
  3595. };
  3596. </script>
  3597. <style lang="scss" scoped>
  3598. .waiting {
  3599. color:orange;
  3600. }
  3601. .filledReportStyle {
  3602. color:#32CD32;
  3603. }
  3604. .RejectStyle {
  3605. color:red;
  3606. }
  3607. .allDaily {
  3608. width:82%;
  3609. }
  3610. .report_title {
  3611. padding:10px 0;
  3612. color:#666;
  3613. }
  3614. .clearfix {
  3615. overflow-x: auto;
  3616. white-space: nowrap;
  3617. padding: 15px 0;
  3618. // overflow-y: hidden;
  3619. .date_item {
  3620. padding: 0 3px;
  3621. cursor: pointer;
  3622. }
  3623. .chooseDate {
  3624. color: #20a0ff;
  3625. }
  3626. }
  3627. .one_daily {
  3628. i {
  3629. color: #9ed0ff;
  3630. margin-right: 5px;
  3631. }
  3632. .one_daily_body {
  3633. padding: 15px 0px;
  3634. p {
  3635. margin: 0;
  3636. line-height: 30px;
  3637. }
  3638. }
  3639. ul {
  3640. padding: 0;
  3641. }
  3642. }
  3643. .checkbtn {
  3644. float: right;
  3645. margin-top: -10px;
  3646. }
  3647. </style>
  3648. <style lang="scss">
  3649. .daily {
  3650. .el-card__body {
  3651. height: 80%;
  3652. overflow-y: auto;
  3653. }
  3654. .el-card__header {
  3655. padding: 0 20px;
  3656. }
  3657. }
  3658. </style>
  3659. <style scoped>
  3660. /* 项目标签的样式 */
  3661. .el-tag + .el-tag {
  3662. margin-left: 10px;
  3663. }
  3664. .button-new-tag {
  3665. margin-left: 10px;
  3666. height: 32px;
  3667. line-height: 30px;
  3668. padding-top: 0;
  3669. padding-bottom: 0;
  3670. }
  3671. .input-new-tag {
  3672. width: 90px;
  3673. margin-left: 10px;
  3674. vertical-align: bottom;
  3675. }
  3676. </style>
  3677. <style lang="scss" scoped>
  3678. // 加班样式
  3679. .overtime {
  3680. display: inline-block;
  3681. margin-left: 20px;
  3682. input {
  3683. display: inline-block;
  3684. margin-top: 5px;
  3685. }
  3686. }
  3687. .plus {
  3688. display: inline-block;
  3689. }
  3690. // .tages {
  3691. // float: right;
  3692. // }
  3693. .overtime {
  3694. display: inline-block;
  3695. margin-left: 30px;
  3696. }
  3697. .bloks {
  3698. display: inline-block;
  3699. width: 380px;
  3700. }
  3701. .zhiss {
  3702. display: flex;
  3703. justify-content: space-around;
  3704. align-items: center;
  3705. }
  3706. .zhoFel {
  3707. display: flex;
  3708. justify-content: space-between;
  3709. align-items: center;
  3710. }
  3711. </style>