daily.vue 268 KB

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