daily.vue 213 KB

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