daily.vue 286 KB

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