daily.vue 276 KB

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