daily.vue 265 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350
  1. <template>
  2. <section v-loading="zhoLoading">
  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="选择月份"></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,0)">代填日报</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="isBatch==0?'填写日报':'批量填报'" :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"
  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>=2" :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 != [] ? { 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"
  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="25" show-word-limit></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" v-if="zhoBao.auditUserList != null && zhoBao.auditUserList.length > 0">
  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">
  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. alalal: '8.0',
  1238. timeBasecostList:null,
  1239. tbload: false,
  1240. exportTimeDialog: false,
  1241. searchKeyword: '',
  1242. monthWorkDataS: [],
  1243. monthNotWorkDateS: [],
  1244. pickDateArray:[],
  1245. WorktimeDatepickValue: [],
  1246. activeName:"first",
  1247. submitingReport: false,
  1248. importResultMsg:null,
  1249. showImportResult:false,
  1250. importingData: false,
  1251. isDraft: 0,
  1252. timeStamp: 0,
  1253. projectColumns:[],
  1254. checkinLoading:false,
  1255. importWxParam:{date:null,},
  1256. active:0,
  1257. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  1258. importWxDialog:false,
  1259. importDialog:false,
  1260. denyForm:null,
  1261. denyReasonDialog:false,
  1262. monthWorkTimeDialog: false,
  1263. isSubstitude:false,
  1264. isFill:false,
  1265. unFillList:[],
  1266. fillList:[],
  1267. fillMembList:[],
  1268. membListVisible: false,
  1269. isBatch:0,//是否是批量填报
  1270. weekDay : ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
  1271. statusStyle:["waiting", "filledReportStyle", "RejectStyle", "waitSubmitStyle"],
  1272. fillStatusList: [],
  1273. exportParam:{projectId: null, dateRange:[], departmentId: null},
  1274. exportDialog:false,
  1275. timeFields:['timeType', 'workingTime', 'startTime', 'progress'],
  1276. subProjectList:[],
  1277. canEdit: true,
  1278. 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],
  1279. selectTime:null,
  1280. reportTimeType:{},
  1281. curDate:'',
  1282. isAllSelect: false,
  1283. approveDialogVisible:false,
  1284. deptId:null,
  1285. targetUid: null,
  1286. membCount:0,
  1287. selectState:"-1",
  1288. user: JSON.parse(sessionStorage.getItem("user")),
  1289. showAddMore:false,
  1290. allDate: [],
  1291. typeList:['全天','上午','下午'],
  1292. date: sessionStorage.msg?sessionStorage.msg.split('-')[0]+"-"+sessionStorage.msg.split('-')[1]:util.formatDate.format(new Date(new Date()), "yyyy-MM"),
  1293. choseDay: 0,
  1294. tableHeight: 0,
  1295. listLoading: false,
  1296. projectList: [], //项目列表
  1297. fillProjectList: [],
  1298. reportList: [], //日报列表
  1299. reportNames:[], //批量审批列表
  1300. selCon:[], //筛选条件
  1301. selProjectList:[], //筛选后项目列表
  1302. selConShow: true,
  1303. dialogVisible: false, //项目弹窗
  1304. report: '',
  1305. workForm: {
  1306. createDate: sessionStorage.msg?sessionStorage.msg:util.formatDate.format(new Date(new Date()), "yyyy-MM-dd"),
  1307. domains: [{
  1308. id: null,
  1309. projectId: "",
  1310. workingTime: "",
  1311. timeType:0,
  1312. content: "",
  1313. state: 2,
  1314. multiWorktime:0,
  1315. worktimeList:[],
  1316. degreeId: null,
  1317. }],
  1318. },
  1319. workRules: {
  1320. createDate: [{ required: true, message: "请选择工作日期", trigger: "change" }],
  1321. },
  1322. chooseParticipVisible: false,
  1323. logining: false,
  1324. isDisable: false,
  1325. timeType:[],
  1326. deptMembData: [
  1327. ],
  1328. //部门人员树状结构
  1329. data: [
  1330. {
  1331. id: -1,
  1332. label: '全部人员',
  1333. membCount:0
  1334. },
  1335. {
  1336. id: 0,
  1337. label: '未分配',
  1338. }
  1339. ],
  1340. allData:{},
  1341. batchShowData:{},
  1342. option: [],
  1343. depData: {
  1344. id: -1,
  1345. label: '全部人员',
  1346. },
  1347. defaultProps: {
  1348. children: 'children',
  1349. label: 'label'
  1350. },
  1351. isNew: false,
  1352. selected: false,
  1353. valuet: new Date(),
  1354. domObj: null,
  1355. participator:[],
  1356. chosenMembCount:0,
  1357. jsDay: 0,
  1358. jsTime: 0,
  1359. falsss: false,
  1360. weidu: [],
  1361. weiduList: [],
  1362. yonghuUser: [],
  1363. dateAr: [],
  1364. batchSubFillDialog: false,
  1365. isSubstiS: false,
  1366. diasZho: false,
  1367. zhoData: [],
  1368. zhoRqi: [],
  1369. btnZho: false,
  1370. zhoLoading: false,
  1371. changdu: 6,
  1372. tianxieDialogVisible: false,
  1373. scopess: {},
  1374. zhoBao: {
  1375. time: '',
  1376. workingTime: '',
  1377. progress: '',
  1378. con: '',
  1379. subProjectId: '',
  1380. stage: '',
  1381. subProjectList: [],
  1382. stages: [],
  1383. },
  1384. zhoBaoIdx: '',
  1385. zhoBaoName: '',
  1386. zhis: {},
  1387. dealList: [],
  1388. toViewDialogVisible: false,
  1389. toViewList: [],
  1390. toViewloading: true,
  1391. toViewForm: {
  1392. pageIndex: '1',
  1393. pageSize: '20',
  1394. total: 0,
  1395. },
  1396. toViewloadings: false,
  1397. tabPositionss: 'top',
  1398. monthTotal: 0,
  1399. monthTotalPage: 0,
  1400. monthTotalLages: 20,
  1401. monthWorkData: [],
  1402. monthNotWorkDate: [],
  1403. monthWorkDataS1: [],
  1404. monthnotTotal: 0,
  1405. monthnotTotalPage: 0,
  1406. monthnotTotalLages: 20,
  1407. monthNotWorkDateS1: [],
  1408. deptMembDataText: '',
  1409. isFlag: false,
  1410. isMore: false,
  1411. stateKey: '0',
  1412. expandDate: [],
  1413. notifySelList:[],
  1414. departmentList: [],
  1415. approvalProcessDialog: false,
  1416. approvalProcessData: []
  1417. };
  1418. },
  1419. watch: {
  1420. deptMembDataText(val) {
  1421. this.$refs.chooseMembTree.filter(val);
  1422. }
  1423. },
  1424. filters: {
  1425. // 过滤
  1426. amounts(value) {
  1427. if(value == NaN || value == undefined || value == 'undefined' || value == null || value == 'null') {
  1428. return 0
  1429. }
  1430. var zhi = +value + 0
  1431. return zhi.toFixed(1)
  1432. },
  1433. // zhoData
  1434. zhoData(value) {
  1435. var dateArray = value.split("-");
  1436. var date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]);
  1437. return "周" + "日一二三四五六".charAt(date.getDay());
  1438. },
  1439. // 过滤数字
  1440. numbers(value) {
  1441. if(value == NaN || value == undefined || value == 'undefined' || value == null || value == 'null' || value <= 0) {
  1442. return 0
  1443. }
  1444. return value
  1445. },
  1446. },
  1447. methods: {
  1448. getApprovalProcess(item){
  1449. this.http.post('/report-log/get',{
  1450. creatorId: item.id,
  1451. createDate: sessionStorage.msg
  1452. },res => {
  1453. if(res.code == 'ok'){
  1454. this.approvalProcessDialog = true
  1455. this.approvalProcessData = res.data
  1456. }else{
  1457. this.$message({
  1458. message: res.msg,
  1459. type: 'error'
  1460. })
  1461. }
  1462. },err => {
  1463. this.$message({
  1464. message: err,
  1465. type: 'error'
  1466. })
  1467. })
  1468. },
  1469. filterNode(value, data) {
  1470. // console.log(value, data, '搜索')
  1471. if (!value) return true;
  1472. return data.label.indexOf(value) !== -1;
  1473. },
  1474. triggerCalculateOT(index) {
  1475. var str = this.workForm.domains[index].overtimeHours + ''
  1476. if(str.indexOf('.') != '-1') {
  1477. var s = str.split('.')[0]
  1478. var st = str.split('.')[1]
  1479. var sts = st.split('')
  1480. this.workForm.domains[index].overtimeHours = s + '.' + sts[0]
  1481. }
  1482. },
  1483. searchScreen(e){
  1484. if(e){
  1485. this.monthNotWorkDateS1 = []
  1486. for (let i = 0; i < this.monthNotWorkDate.length; i++) {
  1487. if(this.monthNotWorkDate[i].name.indexOf(this.searchKeyword) != -1){
  1488. this.monthNotWorkDateS1.push(this.monthNotWorkDate[i])
  1489. }
  1490. }
  1491. if (this.monthNotWorkDateS1.length > 50) {
  1492. this.monthNotWorkDateS = this.monthNotWorkDateS1.slice(0,50);
  1493. }else{
  1494. this.monthNotWorkDateS = this.monthNotWorkDateS1
  1495. }
  1496. // if (this.monthNotWorkDateS1.length > 0) {
  1497. // setTimeout(() => {
  1498. // this.tableListenernot()
  1499. // }, 1000);
  1500. // }
  1501. }else{
  1502. this.monthWorkDataS1 = []
  1503. for (let i = 0; i < this.monthWorkData.length; i++) {
  1504. if(this.monthWorkData[i].name.indexOf(this.searchKeyword) != -1){
  1505. this.monthWorkDataS1.push(this.monthWorkData[i])
  1506. }
  1507. }
  1508. if (this.monthWorkDataS1.length > 50) {
  1509. this.monthWorkDataS = this.monthWorkDataS1.slice(0,50);
  1510. }else{
  1511. this.monthWorkDataS = this.monthWorkDataS1
  1512. }
  1513. // if (this.monthWorkDataS1.length > 0) {
  1514. // setTimeout(() => {
  1515. // this.tableListener()
  1516. // }, 1000);
  1517. // }
  1518. }
  1519. },
  1520. addUpload(data) {
  1521. // var zhi = data.fileName.split('.')[0]
  1522. // var sss = zhi + '.xlsx'
  1523. // console.log(sss, data)
  1524. // return
  1525. var filePath = '/upload/' + data.serverName;
  1526. const a = document.createElement('a'); // 创建a标签
  1527. a.setAttribute('download', data.fileName);// download属性
  1528. a.setAttribute('href', filePath);// href链接
  1529. a.click(); //自执行点击事件
  1530. a.remove();
  1531. },
  1532. restrictNumber(targetId) {
  1533. let inpu = document.getElementById(targetId).getElementsByTagName('input')[0];
  1534. inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
  1535. inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
  1536. inpu.value = inpu.value.replace(".", "$#*").replace(/\./g,'').replace('$#*','.');//去除其他"."
  1537. inpu.value = inpu.value.replace(/^(\d+)\.(\d\d).*$/, '$1.$2');;//限制只能输入两个小数
  1538. if (inpu.value.indexOf(".") < 0 && inpu.value != "") { //首位是0的话去掉
  1539. inpu.value = parseFloat(inpu.value);
  1540. }
  1541. },
  1542. //获取项目下的任务分组
  1543. getTaskGroups(domain, index) {
  1544. domain.groupId=null;
  1545. this.http.post('/task-group/listMyJoinGroup',{
  1546. projectId: domain.projectId
  1547. },
  1548. res => {
  1549. if (res.code == "ok") {
  1550. this.workForm.domains[index].taskGroups = res.data;
  1551. this.$forceUpdate();
  1552. }
  1553. },
  1554. error => {
  1555. this.$message({
  1556. message: error,
  1557. type: "error"
  1558. });
  1559. }
  1560. );
  1561. },
  1562. //下载带企业微信考勤数据的工时统计模板
  1563. downloadCheckInExcel() {
  1564. this.http.post('/user-corpwx-time/exportCheckInExcel',{
  1565. startDate: this.importWxParam.date[0],
  1566. endDate: this.importWxParam.date[1],
  1567. },
  1568. res => {
  1569. if (res.code == "ok") {
  1570. var filePath = res.data;
  1571. const a = document.createElement('a'); // 创建a标签
  1572. var data = filePath.split("/");
  1573. a.setAttribute('download', data[data.length-1]);// download属性
  1574. a.setAttribute('href', filePath);// href链接
  1575. a.click(); //自执行点击事件
  1576. a.remove();
  1577. } else {
  1578. this.$message({
  1579. message: res.msg,
  1580. type: "error"
  1581. });
  1582. }
  1583. },
  1584. error => {
  1585. this.checkinLoading = false;
  1586. this.$message({
  1587. message: error,
  1588. type: "error"
  1589. });
  1590. }
  1591. );
  1592. },
  1593. pre() {
  1594. if (this.active == 0) return;
  1595. this.active--;
  1596. },
  1597. next() {
  1598. this.active++;
  1599. },
  1600. triggerTotalTime(index) {
  1601. var item = this.checkinList[index];
  1602. var total = 0.0;
  1603. for (var i=0;i<this.projectColumns.length; i++) {
  1604. var key = this.projectColumns[i];
  1605. if (item[key] != null && item[key] != '') {
  1606. total += parseFloat(item[key]);
  1607. }
  1608. }
  1609. item.totalFillTime = total;
  1610. },
  1611. //提交批量代填的数据
  1612. submitBatchSubFillData() {
  1613. var data = JSON.stringify(this.checkinList);
  1614. this.http.post('/user-corpwx-time/submitProjectTime',{
  1615. json: data,
  1616. projectColumns: JSON.stringify(this.projectColumns)
  1617. },
  1618. res => {
  1619. if (res.code == "ok") {
  1620. this.$message({message:'提交成功', type:'success'});
  1621. this.importWxDialog = false;
  1622. }
  1623. },
  1624. error => {
  1625. this.checkinLoading = false;
  1626. this.$message({
  1627. message: error,
  1628. type: "error"
  1629. });
  1630. }
  1631. );
  1632. },
  1633. loadCheckInData() {
  1634. if (this.importWxParam.date == null) {
  1635. this.checkinList = [];
  1636. return;
  1637. }
  1638. this.checkinLoading = true;
  1639. this.http.post('/user-corpwx-time/getMyDeptMembsData',{
  1640. startDate: this.importWxParam.date[0],
  1641. endDate: this.importWxParam.date[1],
  1642. },
  1643. res => {
  1644. if (res.code == "ok") {
  1645. this.checkinLoading = false;
  1646. this.checkinList = res.data.list;
  1647. this.projectColumns = res.data.projects;
  1648. // 自定义表格会导致表格错乱,需重新计算表格
  1649. this.$nextTick(()=>{
  1650. this.$refs.tab.doLayout()
  1651. })
  1652. }
  1653. },
  1654. error => {
  1655. this.checkinLoading = false;
  1656. this.$message({
  1657. message: error,
  1658. type: "error"
  1659. });
  1660. }
  1661. );
  1662. },
  1663. batchImportWxData(item) {
  1664. //首先判断文件类型
  1665. let str = item.file.name.split(".");
  1666. let format = str[str.length - 1];
  1667. if (format != "xls" && format != "xlsx") {
  1668. this.$message({
  1669. message: "请选择.xls或.xlsx文件",
  1670. type: "error"
  1671. });
  1672. } else {
  1673. this.importingData = true;
  1674. let formData = new FormData();
  1675. formData.append("file", item.file);
  1676. formData.append("companyId", this.user.companyId);
  1677. formData.append("withCheckIn", 1);
  1678. this.http.uploadFile('/report/importData', formData,
  1679. res => {
  1680. this.$refs.upload.clearFiles();
  1681. this.showImportResult = true;
  1682. this.importingData = false;
  1683. if (res.code == "ok") {
  1684. //换成弹出框,以免有人等了半天回来啥也没看到
  1685. this.importResultMsg = "导入成功:成功导入"+res.data+"条工时数据。"+(res.msg?res.msg:"");
  1686. this.getReportList();
  1687. this.importWxDialog = false;
  1688. } else {
  1689. this.importResultMsg = "导入失败:"+res.msg;
  1690. }
  1691. },
  1692. error => {
  1693. this.$refs.upload.clearFiles();
  1694. this.listLoading = false;
  1695. this.$message({
  1696. message: error,
  1697. type: "error"
  1698. });
  1699. });
  1700. }
  1701. },
  1702. batchImportData(item) {
  1703. //首先判断文件类型
  1704. let str = item.file.name.split(".");
  1705. let format = str[str.length - 1];
  1706. if (format != "xls" && format != "xlsx") {
  1707. this.$message({
  1708. message: "请选择.xls或.xlsx文件",
  1709. type: "error"
  1710. });
  1711. } else {
  1712. this.importingData = true;
  1713. let formData = new FormData();
  1714. formData.append("file", item.file);
  1715. formData.append("companyId", this.user.companyId);
  1716. this.http.uploadFile('/report/importData', formData,
  1717. res => {
  1718. this.$refs.upload.clearFiles();
  1719. this.importingData = false;
  1720. this.showImportResult = true;
  1721. if (res.code == "ok") {
  1722. //换成弹出框,以免有人等了半天回来啥也没看到
  1723. this.importResultMsg = "成功导入"+res.data+"条工时数据。"+(res.msg?res.msg:"");;
  1724. this.getReportList();
  1725. this.importWXDialog = false;
  1726. } else {
  1727. this.importResultMsg = "导入失败:"+res.msg;
  1728. }
  1729. },
  1730. error => {
  1731. this.$refs.upload.clearFiles();
  1732. this.importingData = false;
  1733. this.$message({
  1734. message: error,
  1735. type: "error"
  1736. });
  1737. });
  1738. }
  1739. },
  1740. userssHu() {
  1741. this.http.post('/time-type/getCompanyTimeSetting',{
  1742. companyId: this.user.companyId
  1743. },
  1744. res => {
  1745. if (res.code == "ok") {
  1746. // console.log("维度",res.data);
  1747. this.yonghuUser = res.data
  1748. }
  1749. },
  1750. error => {
  1751. this.$message({
  1752. message: error,
  1753. type: "error"
  1754. });
  1755. }
  1756. );
  1757. },
  1758. iptBlur(i) {
  1759. if(this.isBatch == 0) {
  1760. return
  1761. }
  1762. var stat = this.workForm.createDate[0]
  1763. var end = this.workForm.createDate[1]
  1764. // this.jsDay = 10
  1765. this.http.post('/report/getWorkDays',{
  1766. startDate: stat,
  1767. endDate: end
  1768. },
  1769. res => {
  1770. if (res.code == "ok") {
  1771. this.jsDay = res.data
  1772. this.chuji(i)
  1773. }
  1774. },
  1775. error => {
  1776. this.$message({
  1777. message: error,
  1778. type: "error"
  1779. });
  1780. }
  1781. );
  1782. var sl = this.workForm.domains
  1783. this.chuji(i)
  1784. },
  1785. chuji(i) {
  1786. if(i == 0) {
  1787. this.seleChn(1)
  1788. } else if(i == 1) {
  1789. this.seleChn(0)
  1790. } else if(i == 2) {
  1791. if(this.workForm.domains[0].multiWorktime > 0) {
  1792. this.iptChangs()
  1793. } else {
  1794. this.iptChang()
  1795. }
  1796. } else if(i == 3) {
  1797. this.seleChn(0)
  1798. }
  1799. },
  1800. seleChn(e,domain) {
  1801. if(e == 1) {
  1802. for(var i in this.workForm.domains) {
  1803. if(this.workForm.domains[i].timeType == 0) {
  1804. this.workForm.domains[i].workingTime = 8
  1805. } else {
  1806. this.workForm.domains[i].workingTime = 4
  1807. }
  1808. }
  1809. }
  1810. var quanbu = 0
  1811. var spl = this.workForm.domains
  1812. var zhi = ''
  1813. for(var i in spl) {
  1814. var sp = +spl[i].workingTime + 0
  1815. zhi = this.jsDay * sp
  1816. quanbu = +quanbu + zhi
  1817. }
  1818. this.jsTime = quanbu
  1819. let worktime = this.jsTime
  1820. // 自动计算加班时长
  1821. if(this.isBatch != 0){
  1822. worktime = this.jsTime / this.jsDay
  1823. }
  1824. if(this.user.timeType.fillOvertime && domain){
  1825. let isover = false
  1826. let alltime = 0
  1827. let allover = 0 //此处alltime同上面的worktime
  1828. for(let d in spl){
  1829. if(spl[d].isOvertime){
  1830. isover = true
  1831. allover += spl[d].overtimeHours*1
  1832. }
  1833. alltime += spl[d].workingTime*1
  1834. }
  1835. if(domain.overtimeHours){
  1836. allover = allover - domain.overtimeHours
  1837. }
  1838. if(worktime*1 > this.user.timeType.allday){
  1839. if(isover){
  1840. if(alltime > (allover + this.user.timeType.allday)){
  1841. this.$set(domain,'isOvertime',true)
  1842. this.$set(domain,'overtimeHours',worktime - this.user.timeType.allday - allover)
  1843. }else{
  1844. this.$set(domain,'isOvertime',false)
  1845. this.$set(domain,'overtimeHours',null)
  1846. if(alltime < (allover + this.user.timeType.allday)){
  1847. let overtime = allover + this.user.timeType.allday - alltime
  1848. for(let pi in spl){
  1849. if(spl[pi].overtimeHours){
  1850. if((overtime - spl[pi].overtimeHours*1) > 0){
  1851. overtime = overtime - spl[pi].overtimeHours*1
  1852. this.$set(spl[pi],'isOvertime',false)
  1853. this.$set(spl[pi],'overtimeHours',null)
  1854. }else if((overtime - spl[pi].overtimeHours*1) < 0){
  1855. this.$set(spl[pi],'overtimeHours',spl[pi].overtimeHours*1 - overtime)
  1856. break
  1857. }else{
  1858. this.$set(spl[pi],'isOvertime',false)
  1859. this.$set(spl[pi],'overtimeHours',null)
  1860. break
  1861. }
  1862. }
  1863. }
  1864. }
  1865. }
  1866. }else{
  1867. this.$set(domain,'isOvertime',true)
  1868. this.$set(domain,'overtimeHours',worktime - this.user.timeType.allday)
  1869. }
  1870. }else{
  1871. for(let di in spl){
  1872. this.$set(spl[di],'isOvertime',false)
  1873. this.$set(spl[di],'overtimeHours',null)
  1874. }
  1875. }
  1876. }
  1877. // console.log('domain',quanbu);
  1878. },
  1879. iptChang() {
  1880. var sl = this.workForm.domains
  1881. var quanbu = 0
  1882. var zhi = ''
  1883. for(var i in sl) {
  1884. if(sl[i].startTime && sl[i].endTime) {
  1885. var date2 = '2021/12/12 ' + sl[i].endTime +':00'
  1886. var date1 = '2021/12/12 ' + sl[i].startTime +':00'
  1887. var date3 = new Date(date2).getTime() - new Date(date1).getTime();
  1888. var leave1=date3%(24*3600*1000)
  1889. var hours=Math.floor(leave1/(3600*1000))
  1890. var leave2=leave1%(3600*1000)
  1891. var minutes=Math.floor(leave2/(60*1000))
  1892. var shi = hours+'.'+ minutes
  1893. var sll = +shi + 0
  1894. zhi = this.jsDay * sll
  1895. quanbu = +quanbu + zhi
  1896. }
  1897. }
  1898. this.jsTime = quanbu
  1899. },
  1900. iptChangs() {
  1901. var sl = this.workForm.domains
  1902. var quanbu = 0
  1903. var zhi = ''
  1904. for(var i in sl) {
  1905. for(var j in sl[i].worktimeList){
  1906. if(sl[i].worktimeList[j].startTime && sl[i].worktimeList[j].endTime) {
  1907. var date2 = '2021/12/12 ' + sl[i].worktimeList[j].endTime +':00'
  1908. var date1 = '2021/12/12 ' + sl[i].worktimeList[j].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. }
  1921. this.jsTime = quanbu
  1922. },
  1923. removeTimeItem(item, index) {
  1924. item.worktimeList.splice(index, 1);
  1925. this.iptChangs()
  1926. },
  1927. //添加工时
  1928. addNewWorktime(index, item) {
  1929. if(item.worktimeList == null ) {
  1930. item.worktimeList = []
  1931. }
  1932. item.worktimeList.push({});
  1933. },
  1934. //复制项目
  1935. copyProject(index) {
  1936. var leftProgress = 10;
  1937. if (this.reportTimeType.type == 3) {
  1938. //计算已经待分配工时比例
  1939. let array = this.workForm.domains;
  1940. let totalProgress = 0;
  1941. for (var i=0;i<array.length; i++) {
  1942. totalProgress += array[i].progress;
  1943. }
  1944. if (totalProgress < 100) {
  1945. leftProgress = 100 - totalProgress;
  1946. }
  1947. }
  1948. var newIndex = index+1;
  1949. var itemDomain = {
  1950. projectId: this.workForm.domains[index].projectId,
  1951. workingTime: this.reportTimeType.type == 3?(leftProgress*this.reportTimeType.allday/100).toFixed(1):"",
  1952. content: "",
  1953. progress:leftProgress,
  1954. state:2,//2-表示待提交
  1955. };
  1956. this.workForm.domains.splice(newIndex, 0,itemDomain);
  1957. if (this.reportTimeType.type == 0) {
  1958. //全天上下午模式下,检测时间段数量,达到2个,不能再加了
  1959. var length = this.workForm.domains.length;
  1960. if (length == 2) {
  1961. this.showAddMore = false;
  1962. }
  1963. }
  1964. this.selectProject(itemDomain, newIndex);
  1965. },
  1966. showWorkTime(){
  1967. this.monthWorkTimeDialog = true;
  1968. this.searchKeyword = ''
  1969. this.WorktimeDatepickValue = this.istoMonth()
  1970. if(this.WorktimeDatepickValue.length == 0){
  1971. let newdate = new Date();
  1972. let nowdate = newdate.toLocaleDateString();
  1973. let getauto = this.getAutoWeekDate(nowdate)
  1974. let nowwd = [getauto[0],getauto[6]]
  1975. this.WorktimeDatepickValue = nowwd
  1976. }
  1977. this.showMonthWorkTime()
  1978. },
  1979. handleClick(t,e){
  1980. // console.log("tabname",t.name);
  1981. if (t.name == "first") {
  1982. this.showMonthWorkTime()
  1983. }else{
  1984. this.showMonthNotWorkTime()
  1985. }
  1986. },
  1987. //导出员工每日填报工时数
  1988. exportMembWorkHours() {
  1989. // console.log("exportMembWorkHours",this.WorktimeDatepickValue);
  1990. this.http.post(
  1991. "/report/exportUserDailyWorkTime",
  1992. {
  1993. // month: this.date,
  1994. startDate: this.WorktimeDatepickValue[0],
  1995. endDate: this.WorktimeDatepickValue[1],
  1996. },
  1997. (res) => {
  1998. if (res.code == "ok") {
  1999. let url = res.data;
  2000. // console.log(res);
  2001. this.downloadByA("人员每日工时统计.xls", url);
  2002. }
  2003. },
  2004. (error) => {
  2005. this.$message({
  2006. message: error,
  2007. type: "error",
  2008. });
  2009. }
  2010. );
  2011. },
  2012. exportMembNotWorkHours() {
  2013. this.http.post(
  2014. "/report/exportNoReportUserList",
  2015. {
  2016. // month: this.date,
  2017. startDate: this.WorktimeDatepickValue[0],
  2018. endDate: this.WorktimeDatepickValue[1],
  2019. },
  2020. (res) => {
  2021. if (res.code == "ok") {
  2022. let url = res.data;
  2023. // console.log(res.data);
  2024. this.downloadByA("人员每日工时统计.xls", url);
  2025. // console.log(url);
  2026. }
  2027. },
  2028. (error) => {
  2029. this.$message({
  2030. message: error,
  2031. type: "error",
  2032. });
  2033. }
  2034. );
  2035. },
  2036. downloadByA(name, url) {
  2037. // console.log(name,url);
  2038. const a = document.createElement("a"); // 创建a标签
  2039. a.setAttribute("download", name); // download属性
  2040. a.setAttribute("href", url); // href链接
  2041. a.click(); // 自执行点击事件
  2042. a.remove();
  2043. },
  2044. // 是否本月判断
  2045. istoMonth(){
  2046. let todate = new Date()
  2047. let tomonth = todate.getMonth() + 1
  2048. let adate = todate.getFullYear() + '-' + (tomonth < 10 ? '0' + tomonth : tomonth)
  2049. if(this.date == adate){
  2050. return []
  2051. }else{
  2052. let sedate = new Date(this.date)
  2053. let semonth = sedate.getMonth() + 1
  2054. let seday = new Date(sedate.getFullYear(), semonth, 0).getDate()
  2055. let sedates1 = sedate.getFullYear() + '-' + (semonth < 10 ? '0' + semonth : semonth) + '-01'
  2056. let sedates2 = sedate.getFullYear() + '-' + (semonth < 10 ? '0' + semonth : semonth) + '-' + seday
  2057. return [sedates1, sedates2]
  2058. }
  2059. },
  2060. showMonthWorkTime() {
  2061. this.monthTotalPage = 0,
  2062. this.tbload = true
  2063. this.http.post(
  2064. "/report/getUserDailyWorkTime",
  2065. // "/report/getNoReportUserList",
  2066. {
  2067. // month: this.date,
  2068. startDate: this.WorktimeDatepickValue[0],
  2069. endDate: this.WorktimeDatepickValue[1],
  2070. },
  2071. (res) => {
  2072. if (res.code == "ok") {
  2073. this.tbload = false;
  2074. this.pickDateArray = res.data.days;
  2075. // console.log('dataarray',res.data.days);
  2076. this.monthWorkData = res.data.list;
  2077. // this.monthWorkDataS = this.monthWorkData
  2078. // this.monthWorkDataS1 = res.data.list
  2079. this.monthTotal = res.data.list.length
  2080. if (this.monthWorkData.length > 50) {
  2081. this.monthWorkDataS = this.monthWorkData.slice(0,50);
  2082. }else{
  2083. this.monthWorkDataS = this.monthWorkData
  2084. }
  2085. this.searchScreen(0)
  2086. // this.monthWorkDataS = infoList
  2087. // 判断
  2088. // if (this.monthWorkDataS1.length > 0) {
  2089. // setTimeout(() => {
  2090. // this.tableListener()
  2091. // }, 1000);
  2092. // }
  2093. this.$nextTick(function(){
  2094. this.$refs.hasworkTbl.doLayout();
  2095. });
  2096. // this.$forceUpdate()
  2097. }
  2098. },
  2099. (error) => {
  2100. this.tbload = false
  2101. this.$message({
  2102. message: error,
  2103. type: "error",
  2104. });
  2105. }
  2106. );
  2107. },
  2108. // tableListener(){
  2109. // let that = this;
  2110. // let dom = that.$refs.hasworkTbl.bodyWrapper;
  2111. // // 添加scroll监听事件
  2112. // dom.addEventListener("scroll", function () {
  2113. // const scrollDistance = dom.scrollHeight - dom.scrollTop - dom.clientHeight;
  2114. // if (scrollDistance < 2) {
  2115. // if (that.monthWorkDataS.length < that.monthWorkDataS1.length) {
  2116. // that.monthTotalPage++; //当前页数自增
  2117. // console.log(that.monthWorkDataS1.length, that.monthWorkDataS.length, that.monthTotalPage, that.monthTotalLages, that.monthTotalPage * that.monthTotalLages)
  2118. // var arrList = JSON.parse(JSON.stringify(that.monthWorkDataS1))
  2119. // var infoList = arrList.splice(
  2120. // that.monthTotalPage * that.monthTotalLages,
  2121. // that.monthTotalLages
  2122. // );
  2123. // // 数据添加
  2124. // that.monthWorkDataS = that.monthWorkDataS.concat(infoList);
  2125. // }
  2126. // }
  2127. // })
  2128. // },
  2129. showMonthNotWorkTime() {
  2130. this.monthTotalPage = 0,
  2131. this.tbload = true
  2132. this.http.post(
  2133. "/report/getNoReportUserList",
  2134. {
  2135. startDate: this.WorktimeDatepickValue[0],
  2136. endDate: this.WorktimeDatepickValue[1],
  2137. },
  2138. (res) => {
  2139. if (res.code == "ok") {
  2140. this.tbload = false
  2141. this.monthNotWorkDate = res.data;
  2142. // this.monthNotWorkDateS1 = res.data
  2143. this.monthnotTotal = res.data.length
  2144. // 2222111
  2145. if (this.monthNotWorkDate.length > 50) {
  2146. this.monthNotWorkDateS = this.monthNotWorkDate.slice(0,50);
  2147. } else {
  2148. this.monthNotWorkDateS = this.monthNotWorkDate
  2149. }
  2150. this.searchScreen(1)
  2151. // 判断
  2152. // if (this.monthnotworkDateS1.length > 0) {
  2153. // setTimeout(() => {
  2154. // this.tableListenernot()
  2155. // }, 1000);
  2156. // }
  2157. this.$nextTick(function(){
  2158. this.$refs.hasworkTbl2.doLayout();
  2159. });
  2160. }
  2161. },
  2162. (error) => {
  2163. this.tbload = false
  2164. this.$message({
  2165. message: error,
  2166. type: "error",
  2167. });
  2168. }
  2169. );
  2170. },
  2171. // tableListenernot(){
  2172. // let that = this;
  2173. // let dom = that.$refs.hasworkTbl2.bodyWrapper;
  2174. // dom.addEventListener("scroll", function () {
  2175. // // scrollHeight-scrollTop-clientHeight=0 用来判断滚动条到底部
  2176. // const scrollDistance2 = dom.scrollHeight - dom.scrollTop - dom.clientHeight;
  2177. // if (scrollDistance2 < 2) {
  2178. // if (that.monthNotWorkDateS.length < that.monthNotWorkDateS1.length) {
  2179. // that.monthnotTotalPage++; //当前页数自增
  2180. // var arrList = JSON.parse(JSON.stringify(that.monthNotWorkDateS1))
  2181. // var infoList = arrList.splice(
  2182. // that.monthnotTotalPage * that.monthnotTotalLages,
  2183. // that.monthnotTotalLages
  2184. // );
  2185. // that.monthNotWorkDateS = that.monthNotWorkDateS.concat(infoList);
  2186. // }
  2187. // }
  2188. // })
  2189. // },
  2190. listScroll(){
  2191. if(this.monthWorkDataS.length == this.monthWorkDataS1.length){
  2192. this.isMore = true
  2193. setTimeout(()=>{
  2194. this.isMore = false
  2195. },1000)
  2196. }else {
  2197. this.isFlag = true
  2198. let datalist = this.monthWorkDataS1.slice(0,this.monthWorkDataS.length + 50)
  2199. this.monthWorkDataS = datalist
  2200. setTimeout(()=>{
  2201. this.isFlag = false
  2202. },300)
  2203. }
  2204. },
  2205. notListScroll(){
  2206. if(this.monthNotWorkDateS.length == this.monthNotWorkDateS1.length){
  2207. this.isMore = true
  2208. setTimeout(()=>{
  2209. this.isMore = false
  2210. },1000)
  2211. }else {
  2212. this.isFlag = true
  2213. let datalist = this.monthNotWorkDateS1.slice(0,this.monthNotWorkDateS.length + 50)
  2214. this.monthNotWorkDateS = datalist
  2215. // console.log('length',this.monthNotWorkDateS.length)
  2216. setTimeout(()=>{
  2217. this.isFlag = false
  2218. },300)
  2219. }
  2220. },
  2221. // 获取默认这zhou日期参数 222
  2222. getLastWeek(e){
  2223. let newdate = new Date()
  2224. let lastdate = newdate.toLocaleDateString(newdate.setDate(newdate.getDate() - 7))
  2225. let lastwd = [this.getAutoWeekDate(lastdate)[0],this.getAutoWeekDate(lastdate)[6]]
  2226. if(e){
  2227. this.WorktimeDatepickValue = lastwd
  2228. this.showMonthWorkTime()
  2229. }else{
  2230. this.WorktimeDatepickValue = lastwd
  2231. this.showMonthNotWorkTime()
  2232. }
  2233. },
  2234. getThisWeek(e){
  2235. let newdate = new Date();
  2236. let nowdate = newdate.toLocaleDateString();
  2237. let nowwd = [this.getAutoWeekDate(nowdate)[0],this.getAutoWeekDate(nowdate)[6]]
  2238. if(e){
  2239. this.WorktimeDatepickValue = nowwd
  2240. this.showMonthWorkTime()
  2241. }else{
  2242. this.WorktimeDatepickValue = nowwd
  2243. this.showMonthNotWorkTime()
  2244. }
  2245. },
  2246. getDoubleLastWeek(e){
  2247. let newdate = new Date()
  2248. let nextdate = newdate.toLocaleDateString(newdate.setDate(newdate.getDate() - 14))
  2249. let nextwd = [this.getAutoWeekDate(nextdate)[0],this.getAutoWeekDate(nextdate)[6]]
  2250. if(e){
  2251. this.WorktimeDatepickValue = nextwd
  2252. this.showMonthWorkTime()
  2253. }else{
  2254. this.WorktimeDatepickValue = nextwd
  2255. this.showMonthNotWorkTime()
  2256. }
  2257. },
  2258. alreadyAllDate(stime,etime){
  2259. let diffdate = new Array();
  2260. let i=0;
  2261. while(stime<=etime){
  2262. let dateArray = stime.split("-");
  2263. let date = new Date(dateArray[0], parseInt(dateArray[1] - 1), dateArray[2]);
  2264. let stimewk = "周" + "日一二三四五六".charAt(date.getDay());
  2265. 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]) + "日"
  2266. 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])
  2267. diffdate[i] = {date:timedate,showDate:timeshowdate,weekDay:stimewk};
  2268. let stime_ts = new Date(stime).getTime();
  2269. let next_date = stime_ts + (24*60*60*1000);
  2270. let next_dates_y = new Date(next_date).getFullYear()+'-';
  2271. let next_dates_m = (new Date(next_date).getMonth()+1 < 10)?'0'+(new Date(next_date).getMonth()+1)+'-':(new Date(next_date).getMonth()+1)+'-';
  2272. let next_dates_d = (new Date(next_date).getDate() < 10)?'0'+new Date(next_date).getDate():new Date(next_date).getDate();
  2273. stime = next_dates_y+next_dates_m+next_dates_d;
  2274. i++;
  2275. }
  2276. return diffdate
  2277. },
  2278. getAutoWeekDate(e) {
  2279. let dateString = e;
  2280. let dateStringReg = /^\d{4}[/-]\d{1,2}[/-]\d{1,2}$/;
  2281. if (dateString.match(dateStringReg)) {
  2282. let presentDate = new Date(dateString),
  2283. today = presentDate.getDay() !== 0 ? presentDate.getDay() : 7;
  2284. return Array.from(new Array(7), function (val, index) {
  2285. let formatDate = new Date(
  2286. presentDate.getTime() - (today - index - 1) * 24 * 60 * 60 * 1000
  2287. );
  2288. return (
  2289. formatDate.getFullYear() +
  2290. "-" +
  2291. ((formatDate.getMonth() + 1) < 10 ? "0" + (formatDate.getMonth() + 1) : (formatDate.getMonth() + 1)) +
  2292. "-" +
  2293. (formatDate.getDate() < 10 ? "0" + formatDate.getDate() : formatDate.getDate())
  2294. );
  2295. });
  2296. } else {
  2297. throw new Error(
  2298. 'dateString should be like "yyyy-mm-dd" or "yyyy/mm/dd"'
  2299. );
  2300. }
  2301. },
  2302. onProgressChange() {
  2303. this.$forceUpdate();
  2304. },
  2305. showChooseMembTree() {
  2306. this.chosenMembCount = this.participator.length;
  2307. this.chooseParticipVisible = true;
  2308. },
  2309. onTreeItemChange() {
  2310. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  2311. var list = chosenList.filter(item=>item.isUser == 1);
  2312. this.chosenMembCount = list.length;
  2313. },
  2314. findUserInTree() {
  2315. if (this.filterName == '') {
  2316. this.deptMembData = this.allMembData;
  2317. } else {
  2318. var list = this.findRecursively(this.filterName, this.allMembData);
  2319. this.deptMembData = list;
  2320. }
  2321. },
  2322. findRecursively(username, list) {
  2323. var filterList = [];
  2324. for (var i=0;i<list.length; i++) {
  2325. if (list[i].isUser == 1) {
  2326. if (list[i].label.indexOf(username) >= 0) {
  2327. //匹配上了
  2328. filterList.push(list[i]);
  2329. }
  2330. } else if (list[i].children != null && list[i].children.length > 0) {
  2331. var subList = this.findRecursively(username, list[i].children);
  2332. if (subList.length > 0) {
  2333. subList.forEach(s=>filterList.push(s));
  2334. }
  2335. }
  2336. }
  2337. return filterList;
  2338. },
  2339. //确定选择参与人
  2340. chooseParticip() {
  2341. this.chooseParticipVisible = false;
  2342. var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
  2343. this.chosenMembList = chosenList.filter(item=>item.isUser == 1);
  2344. this.workForm.userNames = '';
  2345. this.workForm.userId = [];
  2346. this.participator = [];
  2347. for (var i=0;i<this.chosenMembList.length; i++) {
  2348. this.workForm.userId.push(this.chosenMembList[i].id);
  2349. this.workForm.userNames += this.chosenMembList[i].label+',';
  2350. var item = {id:this.chosenMembList[i].id, name:this.chosenMembList[i].label};
  2351. this.participator.push(item);
  2352. }
  2353. if (this.workForm.userNames.length > 0) {
  2354. this.workForm.userNames = this.workForm.userNames.substring(0, this.workForm.userNames.length-1);
  2355. }
  2356. },
  2357. notifySel(sel){
  2358. // console.log(sel);
  2359. this.notifySelList = sel
  2360. },
  2361. //微信通知人员填写
  2362. Notify(code) {
  2363. if (this.notifySelList.length == 0) return;
  2364. var ids = '';
  2365. this.notifySelList.forEach(f=>{
  2366. ids += f.id+',';
  2367. })
  2368. this.http.post('/user/pushFillReport',{
  2369. ids: ids, date: this.curDate,
  2370. code: code
  2371. },
  2372. res => {
  2373. if (res.code == "ok") {
  2374. this.$message({
  2375. message: '已发送成功',
  2376. type: "success"
  2377. });
  2378. }
  2379. },
  2380. error => {
  2381. this.$message({
  2382. message: error,
  2383. type: "error"
  2384. });
  2385. }
  2386. );
  2387. },
  2388. //导出人员列表
  2389. exportMemb() {
  2390. if (this.fillMembList.length == 0) return;
  2391. var ids = '';
  2392. this.fillMembList.forEach(f=>{
  2393. ids += f.id+',';
  2394. })
  2395. this.http.post('/user/exportMembList',{
  2396. ids: ids,isFill: this.isFill, date: this.curDate
  2397. },
  2398. res => {
  2399. if (res.code == "ok") {
  2400. var aTag = document.createElement('a');
  2401. aTag.download = this.curDate+(this.isFill?"已填":"未填")+"人员列表.xls";
  2402. aTag.href = res.data;
  2403. aTag.click();
  2404. }
  2405. },
  2406. error => {
  2407. this.$message({
  2408. message: error,
  2409. type: "error"
  2410. });
  2411. }
  2412. );
  2413. },
  2414. showMembList(fill) {
  2415. this.membListVisible = true;
  2416. if (fill == 0) {
  2417. this.fillMembList = this.unFillList;
  2418. this.isFill = false;
  2419. } else {
  2420. this.fillMembList = this.fillList;
  2421. this.isFill = true;
  2422. }
  2423. },
  2424. //获取自己填写的日报状态
  2425. getReportFillStatus() {
  2426. this.http.post('/report/getReportFillStatus',{
  2427. startDate: this.date+"-01", endDate: this.date+"-31", userId: this.user.id
  2428. },
  2429. res => {
  2430. if (res.code == "ok") {
  2431. this.fillStatusList = res.data;
  2432. this.allDate.forEach(d=>{
  2433. var fillInfo = null;
  2434. d.state = null;
  2435. this.fillStatusList.forEach(s=>{
  2436. var d1 = s.createDate.split('-')[2];
  2437. var d2 = d.date.split('月')[1].split('日')[0];
  2438. if (d1.indexOf('0') == 0) {
  2439. d1 = d1.substring(1,d1.length);
  2440. }
  2441. if (d1 == d2) {
  2442. d.state = s.state;
  2443. }
  2444. })
  2445. })
  2446. this.$forceUpdate();
  2447. }
  2448. },
  2449. error => {
  2450. this.$message({
  2451. message: error,
  2452. type: "error"
  2453. });
  2454. }
  2455. );
  2456. },
  2457. scrollFunction () {
  2458. this.domObj = document.getElementById('clearfix') // 通过id获取要设置的div
  2459. if (this.domObj.attachEvent) { // IE
  2460. this.domObj.attachEvent('onmousewheel', this.mouseScroll)
  2461. } else if (this.domObj.addEventListener) {
  2462. this.domObj.addEventListener('DOMMouseScroll', this.mouseScroll, false)
  2463. }
  2464. this.domObj.onmousewheel = this.domObj.onmousewheel = this.mouseScroll
  2465. },
  2466. mouseScroll(event) { // google 浏览器下
  2467. let detail = event.wheelDelta || event.detail
  2468. let moveForwardStep = -1
  2469. let moveBackStep = 1
  2470. let step = 0
  2471. step = detail > 0 ? moveForwardStep * 100 : moveBackStep * 100
  2472. event.preventDefault() // 阻止浏览器默认事件
  2473. this.domObj.scrollLeft = this.domObj.scrollLeft + step
  2474. },
  2475. // //左右滚动
  2476. // wheel(e){
  2477. // var a = document.getElementById("dateScroll");
  2478. // var scroll_width = 80; //滚动一下的距离
  2479. // var e = e || window.event, v;
  2480. // e.wheelDelta ? v=e.wheelDelta : v=e.detail;
  2481. // if(v>3||-v>3) v=-v;
  2482. // v>0 ? a.scrollLeft+=scroll_width : a.scrollLeft-=scroll_width;
  2483. // e.preventDefault(); //阻止浏览器的默认滚动
  2484. // },
  2485. showExportDialog() {
  2486. this.exportDialog = true;
  2487. },
  2488. showExportTimeDialog() {
  2489. this.exportTimeDialog = true;
  2490. },
  2491. changeAllTime() {
  2492. //总时长发生改变,自动按比例计算
  2493. this.workForm.domains.forEach(d=>{
  2494. d.workingTime = (d.progress*this.reportTimeType.allday/100).toFixed(1);
  2495. });
  2496. },
  2497. // 是否加班的单机事件
  2498. check() {
  2499. this.selected = !this.selected
  2500. this.isNew = this.selected
  2501. },
  2502. updateSubProject() {
  2503. this.$forceUpdate();
  2504. },
  2505. //项目选中了, 加载子项目
  2506. selectProject(domain, index) {
  2507. if(domain.projectId == ""){
  2508. return
  2509. }
  2510. this.http.post('/sub-project/list',{
  2511. projectId: domain.projectId
  2512. },
  2513. res => {
  2514. //清空之前选中的子项目
  2515. // this.workForm.domains[index].subProjectId = 0;
  2516. if (res.code == "ok") {
  2517. this.workForm.domains[index].subProjectList = res.data;
  2518. this.workForm.domains[index].subProjectId = null;
  2519. this.$forceUpdate();
  2520. }
  2521. },
  2522. error => {
  2523. this.$message({
  2524. message: error,
  2525. type: "error"
  2526. });
  2527. }
  2528. );
  2529. //项目相关的近期任务
  2530. if (this.user.company.packageProject == 1) {
  2531. this.http.post('/task/getRecentTask',{
  2532. projectId: domain.projectId,
  2533. isSubstitude:this.isSubstitude?1:0
  2534. },
  2535. res => {
  2536. if (res.code == "ok") {
  2537. this.workForm.domains[index].allTaskList = res.data;
  2538. this.workForm.domains[index].taskList = res.data;
  2539. this.$forceUpdate();
  2540. }
  2541. },
  2542. error => {
  2543. this.$message({
  2544. message: error,
  2545. type: "error"
  2546. });
  2547. }
  2548. );
  2549. }
  2550. //获取项目相关专业
  2551. if (this.user.company.packageEngineering == 1) {
  2552. this.getProjectProfessions(domain, index);
  2553. }
  2554. // 获取项目相关的维度
  2555. // domain.degreeId = null
  2556. this.$set(domain,'degreeId',null)
  2557. this.dimension(domain, index);
  2558. //获取项目下的任务分组
  2559. this.getTaskGroups(domain, index);
  2560. //获取项目审核人
  2561. var curProject = this.projectList.filter(p=>p.id == domain.projectId)[0];
  2562. if (curProject.taskGpIncharge == 0) {
  2563. this.getProjectAuditorList(domain, index);
  2564. } else {
  2565. //按分组的负责人来审核
  2566. domain.projectAuditorId = null;
  2567. domain.projectAuditorName = null;
  2568. domain.auditUserList = null;
  2569. }
  2570. // // this.$set(this.workForm.domains[index], "taskGpIncharge", curProject.taskGpIncharge);
  2571. domain.taskGpIncharge = curProject.taskGpIncharge;
  2572. // this.$forceUpdate();
  2573. },
  2574. //获取项目审核人
  2575. getProjectAuditorList(domainItem, index) {
  2576. if(domainItem.projectId == '') {
  2577. return
  2578. }
  2579. domainItem.projectAuditorId = null;
  2580. domainItem.projectAuditorName = null;
  2581. this.http.post('/project-auditor/getList',{
  2582. projectId: domainItem.projectId,
  2583. },
  2584. res => {
  2585. if (res.code == "ok") {
  2586. domainItem.auditUserList = res.data;
  2587. if (res.data.length==1) {
  2588. domainItem.projectAuditorId = domainItem.auditUserList[0].auditorId;
  2589. domainItem.projectAuditorName = domainItem.auditUserList[0].auditorName;
  2590. }
  2591. this.$forceUpdate();
  2592. }
  2593. },
  2594. error => {
  2595. this.$message({
  2596. message: error,
  2597. type: "error"
  2598. });
  2599. }
  2600. );
  2601. },
  2602. // 获取维度数据
  2603. dimension(domain, index) {
  2604. if(domain.projectId == '') {
  2605. return
  2606. }
  2607. this.http.post('/project/getDegreeList',{
  2608. projectId: domain.projectId,
  2609. },
  2610. res => {
  2611. if (res.code == "ok") {
  2612. // console.log("维度数据",res.data);
  2613. this.workForm.domains[index].wuduList = res.data
  2614. // this.workForm = this.workForm
  2615. this.$forceUpdate()
  2616. }
  2617. },
  2618. error => {
  2619. this.$message({
  2620. message: error,
  2621. type: "error"
  2622. });
  2623. }
  2624. );
  2625. },
  2626. //切换任务阶段
  2627. changeStages(domain, index) {
  2628. if (domain.stage == null || domain.stage == '') {
  2629. this.workForm.domains[index].taskList = this.workForm.domains[index].allTaskList;
  2630. } else {
  2631. this.workForm.domains[index].taskList = this.workForm.domains[index].allTaskList.filter(t=>t.stagesName == domain.stage);
  2632. }
  2633. this.$forceUpdate();
  2634. },
  2635. getGroupStages(domain, index) {
  2636. this.http.post("/stages/getProjectStagesByGroup", {groupId: domain.groupId},
  2637. res => {
  2638. if (res.code == "ok") {
  2639. domain.stage = '';
  2640. domain.stages = res.data;
  2641. this.$forceUpdate();
  2642. }
  2643. },
  2644. error => {
  2645. this.$message({
  2646. message: error,
  2647. type: "error"
  2648. });
  2649. });
  2650. //检查当前的项目是否需要获取分组的负责人
  2651. var curProject = this.projectList.filter(p=>p.id == domain.projectId)[0];
  2652. if (curProject.taskGpIncharge == 1) {
  2653. this.http.post("/task-group/getGroupIncharger", {groupId: domain.groupId},
  2654. res => {
  2655. if (res.code == "ok") {
  2656. domain.getProjectAuditorList = res.data;
  2657. domain.auditUserList = res.data;
  2658. if (res.data.length==1) {
  2659. domain.projectAuditorId = domain.auditUserList[0].auditorId;
  2660. domain.projectAuditorName = domain.auditUserList[0].auditorName;
  2661. }
  2662. this.$forceUpdate();
  2663. }
  2664. },
  2665. error => {
  2666. this.$message({
  2667. message: error,
  2668. type: "error"
  2669. });
  2670. });
  2671. }
  2672. },
  2673. getProjectProfessions(domain, index) {
  2674. this.http.post("/project-profession/getMyProfession", {projectId: domain.projectId},
  2675. res => {
  2676. if (res.code == "ok") {
  2677. this.workForm.domains[index].professionProgress = res.data;
  2678. this.$forceUpdate();
  2679. }
  2680. },
  2681. error => {
  2682. this.$message({
  2683. message: error,
  2684. type: "error"
  2685. });
  2686. });
  2687. },
  2688. //删除自己的日报
  2689. deleteReport() {
  2690. this.$confirm("确定要删除该日报吗?","提示", {
  2691. confirmButtonText: "确定",
  2692. cancelButtonText: "取消",
  2693. type: "warning"
  2694. })
  2695. .then(() => {
  2696. this.listLoading = true;
  2697. this.http.post('/report/delete',{
  2698. userId: this.user.id,
  2699. date: this.workForm.createDate
  2700. },
  2701. res => {
  2702. this.listLoading = false;
  2703. if (res.code == "ok") {
  2704. this.$message({
  2705. message: "删除成功",
  2706. type: "success"
  2707. });
  2708. this.getReportList();
  2709. this.getDepartment();
  2710. this.dialogVisible = false;
  2711. } else {
  2712. this.$message({
  2713. message: res.msg,
  2714. type: "error"
  2715. });
  2716. }
  2717. },
  2718. error => {
  2719. this.listLoading = false;
  2720. this.$message({
  2721. message: error,
  2722. type: "error"
  2723. });
  2724. }
  2725. );
  2726. })
  2727. .catch(() => {});
  2728. },
  2729. // 管理员删除日报
  2730. guanli(item) {
  2731. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  2732. let param = {date: this.date + day, userId: item.id};
  2733. this.$confirm("确定要删除该日报吗?","提示", {
  2734. confirmButtonText: "确定",
  2735. cancelButtonText: "取消",
  2736. type: "warning"
  2737. })
  2738. .then(() => {
  2739. this.listLoading = true;
  2740. this.http.post('/report/delete',param,
  2741. res => {
  2742. this.listLoading = false;
  2743. if (res.code == "ok") {
  2744. this.$message({
  2745. message: "删除成功",
  2746. type: "success"
  2747. });
  2748. this.getReportList();
  2749. this.getDepartment();
  2750. this.dialogVisible = false;
  2751. } else {
  2752. this.$message({
  2753. message: res.msg,
  2754. type: "error"
  2755. });
  2756. }
  2757. },
  2758. error => {
  2759. this.listLoading = false;
  2760. this.$message({
  2761. message: error,
  2762. type: "error"
  2763. });
  2764. }
  2765. );
  2766. })
  2767. .catch(() => {});
  2768. },
  2769. //提交批量审核数据
  2770. submitBatchApprove() {
  2771. var data = this.$refs.approveTree.getCheckedNodes();
  2772. var ids = '';
  2773. if (data.length == 0) {
  2774. this.$message({
  2775. message: '请选择要审核的人员',
  2776. type: "error"
  2777. });
  2778. return;
  2779. }
  2780. for (var i=0;i<data.length; i++) {
  2781. ids += data[i].id;
  2782. if (i < data.length-1) {
  2783. ids += ',';
  2784. }
  2785. }
  2786. let day = (this.choseDay+1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  2787. this.http.post("/report/batchApproveReport", {ids:ids, date:this.date + day},
  2788. res => {
  2789. if (res.code == "ok") {
  2790. this.$message({
  2791. message: '审核成功',
  2792. type: "success"
  2793. });
  2794. this.getReportList();
  2795. this.getDepartment();
  2796. this.approveDialogVisible = false;
  2797. } else {
  2798. this.$message({
  2799. message: res.msg,
  2800. type: "error"
  2801. });
  2802. }
  2803. },
  2804. error => {
  2805. this.$message({
  2806. message: error,
  2807. type: "error"
  2808. });
  2809. });
  2810. },
  2811. selectAll() {
  2812. if (this.isAllSelect) {
  2813. var keys = [];
  2814. this.reportNames.forEach(b=>{
  2815. keys.push(b.id);
  2816. })
  2817. this.$refs.approveTree.setCheckedKeys(keys);
  2818. } else {
  2819. this.$refs.approveTree.setCheckedKeys([]);
  2820. }
  2821. },
  2822. //批量审核
  2823. batchApprove() {
  2824. this.approveDialogVisible = true;
  2825. this.reportNames = [];
  2826. for (var i=0;i<this.reportList.length; i++) {
  2827. var report = this.reportList[i];
  2828. var hasUnChecked =false;
  2829. var id = '';
  2830. for (var j=0;j<report.data.length; j++) {
  2831. if (report.data[j].state == 0
  2832. && (this.user.company.packageEngineering==0 || (this.user.company.packageEngineering==1 && report.data[j].departmentAuditState == 1))
  2833. && (permissions.projectReportReview || report.data[j].projectAuditorId == this.user.id)) {
  2834. hasUnChecked = true;
  2835. id += report.data[j].id+',';
  2836. }
  2837. }
  2838. if (hasUnChecked) {
  2839. this.reportNames.push({id:id, label: report.name});
  2840. }
  2841. }
  2842. },
  2843. removeEmptyNode(list) {
  2844. for (var i=0;i<list.length;i++) {
  2845. var cnt = 0;
  2846. if (list[i].membCount == 0) {
  2847. list.splice(i, 1);
  2848. i--;
  2849. } else if (list[i].children != null) {
  2850. this.removeEmptyNode(list[i].children);
  2851. }
  2852. }
  2853. },
  2854. calculateMembCount(list) {
  2855. for (var i in list) {
  2856. var cnt = 0;
  2857. if (list[i].children != null) {
  2858. this.calculateMembCount(list[i].children);
  2859. for (var m in list[i].children) {
  2860. cnt += list[i].children[m].membCount;
  2861. }
  2862. }
  2863. if (list[i].isUser == 1) {
  2864. cnt++;
  2865. this.membCount++;
  2866. }
  2867. list[i].membCount = cnt;
  2868. }
  2869. },
  2870. stateChange() {
  2871. this.membCount = 0;
  2872. if (this.selectState == -1) {
  2873. //全部状态
  2874. this.data = this.allData;
  2875. } else {
  2876. //未填报
  2877. var newData = JSON.parse(JSON.stringify(this.allData));
  2878. this.filterState(this.selectState, newData);
  2879. this.data = newData;
  2880. }
  2881. this.calculateMembCount(this.data);
  2882. this.data[0].membCount = this.membCount;//总人数
  2883. },
  2884. //按状态过滤部门人员
  2885. filterState(state, list) {
  2886. for (var i =0;i<list.length; i++) {
  2887. var obj = list[i];
  2888. if (obj.isUser == 1) {
  2889. var match = false;
  2890. if (state == -2) {
  2891. if (obj.state == null) {
  2892. match = true;
  2893. }
  2894. } else {
  2895. if (obj.state == state) {
  2896. match = true;
  2897. }
  2898. }
  2899. if (!match) {
  2900. list.splice(i, 1);
  2901. i--;
  2902. } else {
  2903. }
  2904. } else {
  2905. if (obj.children != null) {
  2906. this.filterState(state, obj.children);
  2907. }
  2908. }
  2909. }
  2910. },
  2911. // 部门列表点击
  2912. handleNodeClick(data) {
  2913. // this.dealList = data
  2914. this.theValues(data.id, this.allData)
  2915. // this.depData = data;
  2916. var list = [];
  2917. if (data.id == -1) {
  2918. this.deptId = null;
  2919. this.targetUid = null;
  2920. list = this.data;
  2921. } else if (data.isUser == 1) {
  2922. this.deptId = null;
  2923. this.targetUid = data.id;
  2924. } else {
  2925. this.deptId = data.id;
  2926. this.targetUid = null;
  2927. list.push(data);
  2928. }
  2929. this.getReportList();
  2930. if (list.length > 0) {
  2931. this.unFillList = this.getUserMembListFromDeptList(list, 0);
  2932. this.fillList = this.getUserMembListFromDeptList(list, 1)
  2933. }
  2934. // console.log(this.depData.isUser)
  2935. // console.log(this.depData.membCount)
  2936. // console.log(this.depData)
  2937. },
  2938. theValues(id, item) {
  2939. for(var i in item) {
  2940. if(item[i].id == id) {
  2941. this.depData = item[i]
  2942. return
  2943. } else {
  2944. if(item[i].children) {
  2945. this.theValues(id, item[i].children)
  2946. }
  2947. }
  2948. }
  2949. },
  2950. //获取可以选择的代填的人员列表
  2951. getSubstitudeUserDeptList() {
  2952. if (this.deptMembData.length == 0) {
  2953. this.http.post("/department/listMyMembs", {},
  2954. res => {
  2955. if (res.code == "ok") {
  2956. let noAllData = JSON.parse(JSON.stringify(res.data));
  2957. if (noAllData.length > 0) {
  2958. if (noAllData[0].label == '全部人员') {
  2959. noAllData.splice(0,1);
  2960. }
  2961. }
  2962. this.setUserToDept(noAllData);
  2963. this.deptMembData = noAllData;
  2964. } else {
  2965. this.$message({
  2966. message: res.msg,
  2967. type: "error"
  2968. });
  2969. }
  2970. },
  2971. error => {
  2972. this.$message({
  2973. message: error,
  2974. type: "error"
  2975. });
  2976. });
  2977. }
  2978. },
  2979. // 获取部门列表
  2980. getDepartment() {
  2981. let day = (this.choseDay+1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  2982. var param = {date:this.date + day};
  2983. if (this.user.manageDeptId != 0 && !this.permissions.reportsCompany && !this.permissions.reportsDept) {
  2984. param.manageDeptId = this.user.manageDeptId;
  2985. }
  2986. this.http.post("/report/getMembList", param,
  2987. res => {
  2988. if (res.code == "ok") {
  2989. this.departmentList = JSON.parse(JSON.stringify(res.data))
  2990. var list = res.data , list1 = JSON.parse(JSON.stringify(res.data));
  2991. // let noAllData = JSON.parse(JSON.stringify(res.data));
  2992. // if (this.user.role > 0) {
  2993. // }
  2994. list.splice(0,0,{
  2995. id: -1,
  2996. label: '全部人员',
  2997. })
  2998. this.membCount = 0;
  2999. //设置员工到部门下面
  3000. this.setUserToDept(list);
  3001. this.data = list;
  3002. console.log('data',this.data);
  3003. this.expandDate = [this.data[1].id]
  3004. this.allData = list;
  3005. // if (noAllData.length > 0) {
  3006. // if (noAllData[0].label == '全部人员') {
  3007. // noAllData.splice(0,1);
  3008. // }
  3009. // }
  3010. // this.setUserToDept(noAllData);
  3011. // this.deptMembData = noAllData;
  3012. this.option = this.changeArr(list1);
  3013. list[0].membCount = this.membCount;
  3014. if (this.depData.id == -1) {
  3015. this.depData.membCount = this.membCount;
  3016. this.unFillList = this.getUserMembListFromDeptList(this.data, 0);
  3017. this.fillList = this.getUserMembListFromDeptList(this.data, 1);
  3018. } else {
  3019. if (this.depData.isUser == null) {
  3020. var dep = this.findTargetDept(this.data, this.depData.id);
  3021. var membDeptList = [];
  3022. membDeptList.push(dep);
  3023. this.unFillList = this.getUserMembListFromDeptList(membDeptList, 0);
  3024. this.fillList = this.getUserMembListFromDeptList(membDeptList, 1);
  3025. }
  3026. }
  3027. if (this.depData.isUser == null) {
  3028. if (this.isFill) {
  3029. this.fillMembList = this.fillList;
  3030. } else {
  3031. this.fillMembList = this.unFillList;
  3032. }
  3033. }
  3034. this.stateChange()
  3035. } else {
  3036. this.$message({
  3037. message: res.msg,
  3038. type: "error"
  3039. });
  3040. }
  3041. },
  3042. error => {
  3043. this.$message({
  3044. message: error,
  3045. type: "error"
  3046. });
  3047. });
  3048. this.getReportFillStatus();
  3049. },
  3050. findTargetDept(list, deptId) {
  3051. var t = null;
  3052. for (var i=0;i<list.length; i++) {
  3053. if (list[i].isUser == null && list[i].id == deptId) {
  3054. t = list[i];
  3055. break;
  3056. }
  3057. }
  3058. if (t == null) {
  3059. for (var i=0;i<list.length; i++) {
  3060. if (list[i].children != null && list[i].children.length > 0) {
  3061. t = this.findTargetDept(list[i].children, deptId);
  3062. if (t != null) {
  3063. break;
  3064. }
  3065. }
  3066. }
  3067. }
  3068. return t;
  3069. },
  3070. getUserMembListFromDeptList(list, isFill) {
  3071. var membList = [];
  3072. for (var i in list) {
  3073. var deptName = list[i].label;
  3074. if (list[i].userList != null) {
  3075. list[i].userList.forEach(element => {
  3076. if (isFill == 0) {
  3077. //获取未填的
  3078. if (element.state == null) {
  3079. var obj = {id: element.id, label:element.name, deptId:element.departmentId, deptName: deptName};
  3080. membList.push(obj);
  3081. }
  3082. } else {
  3083. if (element.state != null) {
  3084. var obj = {id: element.id, label:element.name, deptId:element.departmentId, deptName: deptName};
  3085. membList.push(obj);
  3086. }
  3087. }
  3088. });
  3089. }
  3090. if (list[i].children != null) {
  3091. membList = membList.concat(this.getUserMembListFromDeptList(list[i].children, isFill));
  3092. }
  3093. }
  3094. return membList;
  3095. },
  3096. setUserToDept(list) {
  3097. for (var i in list) {
  3098. var cnt = 0;
  3099. if (list[i].children != null) {
  3100. this.setUserToDept(list[i].children);
  3101. for (var m in list[i].children) {
  3102. cnt += list[i].children[m].membCount;
  3103. }
  3104. }
  3105. if (list[i].userList != null) {
  3106. if (list[i].children == null) {
  3107. list[i].children = [];
  3108. }
  3109. list[i].userList.forEach(element => {
  3110. var obj = {id: element.id, label:element.name, state:element.state, parentId:element.departmentId, isUser:1,workingTime: element.workingTime};
  3111. list[i].children.push(obj);
  3112. this.membCount++;
  3113. cnt++;
  3114. });
  3115. }
  3116. list[i].membCount = cnt;
  3117. }
  3118. },
  3119. // 修改数组
  3120. changeArr(arr) {
  3121. for (var i = 0; i < arr.length; i++) {
  3122. if(arr[i].id != -1 && arr[i].id != 0) {
  3123. if (arr[i].children != null && arr[i].children.length>0) {
  3124. arr[i].children = this.changeArr(arr[i].children);
  3125. }
  3126. arr[i].id && (arr[i].value = arr[i].id);
  3127. delete arr[i].id;
  3128. }
  3129. }
  3130. for(var i in arr) {
  3131. if(arr[i].id == -1 || arr[i].id == 0) {
  3132. arr.splice(i,1)
  3133. }
  3134. }
  3135. return arr;
  3136. },
  3137. //时间段范围设置改动,监听
  3138. onTimeTypeChange(timeType) {
  3139. this.seleChn(1)
  3140. this.showAddMore = true;
  3141. for(var i in this.workForm.domains) {
  3142. if (this.workForm.domains[i].timeType == 0) {
  3143. this.showAddMore = false;
  3144. break;
  3145. }
  3146. }
  3147. if (this.showAddMore) {
  3148. //检测数量
  3149. if (this.workForm.domains.length == 2) {
  3150. this.showAddMore = false;
  3151. } else {
  3152. this.showAddMore = true;
  3153. }
  3154. }
  3155. },
  3156. getTimeType() {
  3157. this.http.post('/time-type/getCompanyTimeSetting', { companyId: this.user.companyId},
  3158. res => {
  3159. if (res.code == "ok") {
  3160. var t = res.data;
  3161. this.reportTimeType = t;
  3162. if (this.reportTimeType.type > 0) {
  3163. this.showAddMore = true;
  3164. }
  3165. //转化时间格式
  3166. if (t.allday != null) {
  3167. this.timeType.push({value:0, label:'全天 - '+t.allday+'小时', hours:t.allday});
  3168. }
  3169. if (t.am != null) {
  3170. this.timeType.push({value:1, label:'上午 - '+t.am+'小时', hours: t.am});
  3171. }
  3172. if (t.pm != null) {
  3173. this.timeType.push({value:2, label:'下午 - '+t.pm+'小时', hours: t.pm});
  3174. }
  3175. } else {
  3176. this.$message({
  3177. message: res.msg,
  3178. type: "error"
  3179. });
  3180. }
  3181. },
  3182. error => {
  3183. this.listLoading = false;
  3184. this.$message({
  3185. message: error,
  3186. type: "error"
  3187. });
  3188. });
  3189. },
  3190. // 改变月份 -------
  3191. changeMonthOut() {
  3192. this.getAllDate();
  3193. this.getReportList();
  3194. this.getDepartment();
  3195. },
  3196. // 选择日期
  3197. choseDate(i, item) {
  3198. if(this.canClick(i,item) == false && this.user.timeType.fillAhead == 0){
  3199. return
  3200. }
  3201. // console.log(nowDateYear,nowDateMonth,nowDateDay,'..',itemYear,itemMonth,itemDay);
  3202. this.choseDay = i;
  3203. let day = (this.choseDay +1)> 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  3204. sessionStorage.msg = this.date + day,
  3205. this.getReportList();
  3206. this.getDepartment();
  3207. this.curDate = item.date;
  3208. },
  3209. canClick(i, item){
  3210. let nowDate = new Date()
  3211. let nowDateYear = nowDate.getFullYear()
  3212. let itemYear = parseInt(this.date.split('-')[0])
  3213. let nowDateMonth = nowDate.getMonth() + 1
  3214. let itemMonth = parseInt(this.date.split('-')[1])
  3215. let nowDateDay = nowDate.getDate()
  3216. let itemDay = parseInt(item.showDate.split('.')[1])
  3217. if(nowDateYear < itemYear){
  3218. return false
  3219. }else if(nowDateYear == itemYear){
  3220. if(nowDateMonth < itemMonth){
  3221. return false
  3222. }else if(nowDateMonth == itemMonth){
  3223. if(nowDateDay < itemDay){
  3224. return false
  3225. }
  3226. }
  3227. }
  3228. },
  3229. // 获取日期列表
  3230. getAllDate() {
  3231. var dayArry = [];
  3232. var day = this.getCountDays();
  3233. let curMonthDay = null;
  3234. for (var k = 1; k <= day; k++) {
  3235. var str = new Date(this.date.replace(/-/g, "/")+'/01').getMonth() + 1 + "月" + k+'日';
  3236. var showStr = new Date(this.date.replace(/-/g, "/")+'/01').getMonth() + 1+'.'+k;
  3237. if ( new Date(this.date.replace(/-/g, "/")+'/01').getFullYear() == new Date(new Date()).getFullYear() &&
  3238. new Date(this.date.replace(/-/g, "/")+'/01').getMonth() == new Date(new Date()).getMonth()) {
  3239. if(sessionStorage.msg) {
  3240. if(parseInt(sessionStorage.msg.split("-")[2]) == k) {
  3241. this.choseDay = k - 1;
  3242. curMonthDay = str;
  3243. }
  3244. } else {
  3245. if (new Date().getDate() == k) {
  3246. this.choseDay = k - 1;
  3247. }
  3248. }
  3249. } else {
  3250. this.choseDay = 0;
  3251. }
  3252. var curDateStr = (this.date +'-'+ (k<10?('0'+k):k));
  3253. var curDateTime = util.formatDate.parse(curDateStr, 'yyyy-MM-dd');
  3254. dayArry.push({date:str, weekDay:this.weekDay[curDateTime.getDay()], showDate:showStr});
  3255. }
  3256. this.allDate = dayArry;
  3257. //不能超过最大日期
  3258. if (this.choseDay > day-1) {
  3259. this.choseDay = day-1;
  3260. }
  3261. //从消息点击跳转过来的,直接加载指定日期
  3262. if (sessionStorage.from == 1 && sessionStorage.msg) {
  3263. this.curDate = sessionStorage.msg;
  3264. sessionStorage.from = 0;
  3265. } else {
  3266. if (curMonthDay != null) {
  3267. this.curDate = curMonthDay;
  3268. } else {
  3269. var d = new Date(this.date.replace(/-/g, "/")+'/01')
  3270. this.curDate = (d.getMonth()+1)+'月'+d.getDate()+'日';
  3271. }
  3272. }
  3273. this.getReportFillStatus();
  3274. },
  3275. getCountDays() {
  3276. var newstr = this.date.replace(/-/g, "/");
  3277. var curDate = new Date(newstr+'/01');
  3278. var curMonth = curDate.getMonth();
  3279. curDate.setMonth(curMonth + 1);
  3280. curDate.setDate(0);
  3281. return curDate.getDate();
  3282. },
  3283. //获取日报列表
  3284. getReportList() {
  3285. this.listLoading = true;
  3286. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  3287. let param = {date: this.date + day};
  3288. if (this.deptId != null) {
  3289. param.deptId = this.deptId;
  3290. }
  3291. if (this.targetUid != null) {
  3292. param.userId = this.targetUid;
  3293. }
  3294. this.http.post( this.port.report.list, param,
  3295. res => {
  3296. this.listLoading = false;
  3297. if (res.code == "ok") {
  3298. this.reportList = res.data;
  3299. document.querySelector("#day"+this.choseDay).scrollIntoView(true);
  3300. // this.dealWith()
  3301. } else {
  3302. this.$message({
  3303. message: res.msg,
  3304. type: "error"
  3305. });
  3306. }
  3307. },
  3308. error => {
  3309. this.listLoading = false;
  3310. this.$message({
  3311. message: error,
  3312. type: "error"
  3313. });
  3314. });
  3315. },
  3316. // 处理数据
  3317. // dealWith() {
  3318. // var tianxie = 0
  3319. // var weixtianxie = 0
  3320. // if(this.selectState == -1) {
  3321. // } else {
  3322. // var arr = []
  3323. // for (var i in this.reportList) {
  3324. // arr.push(this.reportList[i].id)
  3325. // }
  3326. // this.getDealWith(this.dealList.children, tianxie, weixtianxie, arr)
  3327. // }
  3328. // },
  3329. // getDealWith(item, tx, wtx, arr) {
  3330. // // console.log(item,12345)
  3331. // for(var i in item) {
  3332. // if(item[i].children) {
  3333. // this.getDealWith(item[i].children, tx, wtx, arr)
  3334. // } else {
  3335. // console.log(arr.indexOf(item[i].id))
  3336. // console.log(arr)
  3337. // console.log(item[i].id)
  3338. // if(arr.indexOf(item[i].id) != '-1') {
  3339. // tx = +tx + 1
  3340. // }
  3341. // }
  3342. // }
  3343. // console.log(tx, '看看值')
  3344. // },
  3345. //导出员工工时统计
  3346. exportUserTime() {
  3347. this.listLoading = true;
  3348. var param = {};
  3349. if (this.exportParam.dateRange != null) {
  3350. param = {startDate:this.exportParam.dateRange[0], endDate: this.exportParam.dateRange[1]};
  3351. }
  3352. this.http.post('/department/exportDeptStatistic', param,
  3353. res => {
  3354. this.listLoading = false;
  3355. if (res.code == "ok") {
  3356. location.href = res.data;
  3357. this.exportTimeDialog = false;
  3358. } else {
  3359. this.$message({
  3360. message: res.msg,
  3361. type: "error"
  3362. });
  3363. }
  3364. },
  3365. error => {
  3366. this.listLoading = false;
  3367. this.$message({
  3368. message: error,
  3369. type: "error"
  3370. });
  3371. });
  3372. },
  3373. //导出日报
  3374. exportReport() {
  3375. this.listLoading = true;
  3376. var param = {};
  3377. if (this.exportParam.dateRange != null) {
  3378. param = {startDate:this.exportParam.dateRange[0], endDate: this.exportParam.dateRange[1]};
  3379. }
  3380. if (this.exportParam.projectId != null) {
  3381. param.projectId = this.exportParam.projectId;
  3382. }
  3383. if (this.exportParam.departmentId != null) {
  3384. param.departmentId = this.exportParam.departmentId[this.exportParam.departmentId.length - 1]
  3385. }
  3386. param.stateKey = this.stateKey
  3387. // param.departmentId = this.user.departmentId
  3388. this.http.post( this.port.report.export, param,
  3389. res => {
  3390. this.listLoading = false;
  3391. if (res.code == "ok") {
  3392. location.href = res.data;
  3393. this.exportDialog = false;
  3394. } else {
  3395. this.$message({
  3396. message: res.msg,
  3397. type: "error"
  3398. });
  3399. }
  3400. },
  3401. error => {
  3402. this.listLoading = false;
  3403. this.$message({
  3404. message: error,
  3405. type: "error"
  3406. });
  3407. });
  3408. },
  3409. //获取项目列表
  3410. getProjectList() {
  3411. this.listLoading = true;
  3412. this.http.post( this.port.project.list, {},
  3413. res => {
  3414. this.listLoading = false;
  3415. if (res.code == "ok") {
  3416. for(var i in res.data) {
  3417. if(res.data[i].projectCode == null || res.data[i].projectCode == 'null') {
  3418. res.data[i].projectCode = ''
  3419. }
  3420. }
  3421. this.projectList = res.data;
  3422. // console.log("项目列表",this.projectList);
  3423. } else {
  3424. this.$message({
  3425. message: res.msg,
  3426. type: "error"
  3427. });
  3428. }
  3429. },
  3430. error => {
  3431. this.listLoading = false;
  3432. this.$message({
  3433. message: error,
  3434. type: "error"
  3435. });
  3436. });
  3437. },
  3438. // 获取填报日报的项目下拉列表
  3439. getFillProjectList() {
  3440. this.http.post( this.port.project.list, {
  3441. forReport: 1
  3442. },res => {
  3443. if (res.code == "ok") {
  3444. for(var i in res.data) {
  3445. if(res.data[i].projectCode == null || res.data[i].projectCode == 'null') {
  3446. res.data[i].projectCode = ''
  3447. }
  3448. }
  3449. this.fillProjectList = res.data;
  3450. } else {
  3451. this.$message({
  3452. message: res.msg,
  3453. type: "error"
  3454. });
  3455. }
  3456. },
  3457. error => {
  3458. this.$message({
  3459. message: error,
  3460. type: "error"
  3461. });
  3462. });
  3463. },
  3464. getBasecostItemList() {
  3465. this.http.post('/project-basecost-setting/getReportBasecostList', {
  3466. companyId: this.user.companyId
  3467. },
  3468. res => {
  3469. if (res.code == "ok") {
  3470. this.timeBasecostList = res.data;
  3471. }
  3472. });
  3473. },
  3474. // 获取个人某天的日报
  3475. getReport() {
  3476. this.http.post( this.port.report.getPort, {
  3477. date: this.workForm.createDate
  3478. },
  3479. res => {
  3480. if (res.code == "ok") {
  3481. var quanbu = 0
  3482. this.jsDay = 1
  3483. var zhi = ''
  3484. var slp = res.data.report
  3485. for(var i in slp) {
  3486. var sp = +slp[i].workingTime + 0
  3487. zhi = this.jsDay * sp
  3488. quanbu = +quanbu + zhi
  3489. }
  3490. this.jsTime = quanbu
  3491. var list = res.data;
  3492. this.report = list;
  3493. if(list.report.length != 0) {
  3494. var arr = [];
  3495. this.canEdit = false;
  3496. for(var i in list.report) {
  3497. var flg = null
  3498. list.report[i].isOvertime == 1 ? flg = true : flg = false
  3499. arr.push({
  3500. id: list.report[i].id,
  3501. projectId: list.report[i].projectId,
  3502. workingTime: list.report[i].workingTime,
  3503. content: list.report[i].content,
  3504. state: list.report[i].state,
  3505. timeType: list.report[i].timeType,
  3506. subProjectList: list.report[i].subProjectList,
  3507. taskList: list.report[i].taskList,
  3508. subProjectId: list.report[i].subProjectId == 0?null:list.report[i].subProjectId,
  3509. groupId: list.report[i].groupId == 0?null:list.report[i].groupId,
  3510. taskId: list.report[i].taskId,
  3511. // startTime: `Fri May 16 2021 ${list.report[i].startTime}:12 GMT+0800 (中国标准时间)`,
  3512. startTime: list.report[i].startTime,
  3513. // endTime: `Fri May 16 2021 ${list.report[i].endTime}:12 GMT+0800 (中国标准时间)`,
  3514. endTime: list.report[i].endTime,
  3515. isOvertime: flg,
  3516. progress:list.report[i].progress,
  3517. professionProgress: list.report[i].professionProgressList,
  3518. stages:list.report[i].stages,
  3519. stage:list.report[i].stage == '-'?null:list.report[i].stage,
  3520. pics: list.report[i].pics,
  3521. multiWorktime: list.report[i].multiWorktime,
  3522. worktimeList: list.report[i].worktimeList,
  3523. degreeId: list.report[i].degreeId==-1?null:list.report[i].degreeId,
  3524. wuduList: list.report[i].degreeList,
  3525. taskGroups:list.report[i].taskGroups,
  3526. customData: list.report[i].customData,//自定义的数值
  3527. auditUserList: list.report[i].auditUserList,
  3528. projectAuditorId: list.report[i].projectAuditorId,
  3529. projectAuditorName: list.report[i].projectAuditorName,
  3530. overtimeHours: list.report[i].overtimeHours,
  3531. customText: list.report[i].customText,
  3532. basecostId: list.report[i].basecostId,
  3533. })
  3534. if (list.report[i].state >= 2) {
  3535. this.canEdit = true;
  3536. }
  3537. }
  3538. this.workForm = {
  3539. createDate: this.workForm.createDate,
  3540. domains: arr,
  3541. userNames:null,
  3542. userId:null,
  3543. time: list.time
  3544. }
  3545. } else {
  3546. this.workForm = {
  3547. createDate: this.workForm.createDate,
  3548. domains: [{
  3549. id: null,
  3550. projectId: "",
  3551. workingTime: this.reportTimeType.type==3?(this.reportTimeType.allday).toFixed(1):"",
  3552. content: "",
  3553. progress:100,
  3554. state: 2,
  3555. timeType:0,
  3556. multiWorktime: this.reportTimeType.multiWorktime,
  3557. worktimeList:[{}],
  3558. taskGpIncharge:1,
  3559. }],
  3560. userId:null,
  3561. userNames:null,
  3562. time: this.report.time
  3563. }
  3564. if(this.user.timeType.type == 1) {
  3565. var shuzhi = this.user.timeType.allday + ''
  3566. // console.log('执行一次', shuzhi.indexOf('.'))
  3567. this.workForm.domains[0].workingTime = shuzhi.indexOf('.') == '-1' ? shuzhi + '.0' : shuzhi
  3568. }
  3569. if (this.timeBasecostList && this.timeBasecostList.length > 0) {
  3570. //默认给第一个,必填字段
  3571. this.workForm.domains[0].basecostId = this.timeBasecostList[0].id;
  3572. }
  3573. this.canEdit = true;
  3574. }
  3575. } else {
  3576. this.$message({
  3577. message: res.msg,
  3578. type: "error"
  3579. });
  3580. }
  3581. },
  3582. error => {
  3583. this.$message({
  3584. message: error,
  3585. type: "error"
  3586. });
  3587. });
  3588. },
  3589. guanbi() {
  3590. this.falsss = false
  3591. },
  3592. // 打开日报填写
  3593. fillInReport(i, isBatch) {
  3594. // console.log(this.user.timeType.type, '选择时长')
  3595. if(i != 1) {
  3596. this.falsss = false
  3597. } else {
  3598. this.falsss = true
  3599. }
  3600. if (this.isSubstitude) {
  3601. this.getSubstitudeUserDeptList();
  3602. }
  3603. if(i == -1 || this.isSubstitude) {
  3604. this.isDisable = false;
  3605. } else {
  3606. this.isDisable = true;
  3607. }
  3608. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  3609. this.isBatch = isBatch;
  3610. if (this.isBatch == 0 && !this.isSubstitude) {
  3611. this.workForm.createDate = this.date + day; // 获取个人某天的日报
  3612. this.getReport(i);
  3613. } else {
  3614. // console.log('执行到了这里')
  3615. this.jsTime = 0
  3616. this.jsDay = 0
  3617. this.workForm = {
  3618. createDate: null,//批量填报没有日期
  3619. domains: [{
  3620. id: null,
  3621. projectId: "",
  3622. workingTime: this.reportTimeType.type==3?(this.reportTimeType.allday).toFixed(1):"",
  3623. content: "",
  3624. progress:100,
  3625. state: 2,
  3626. timeType:0,
  3627. multiWorktime: this.reportTimeType.multiWorktime,
  3628. worktimeList:[{}],
  3629. }],
  3630. }
  3631. if(this.user.timeType.type == 1) {
  3632. var shuzhi = this.user.timeType.allday + ''
  3633. // console.log('执行二次')
  3634. this.workForm.domains[0].workingTime = shuzhi.indexOf('.') == '-1' ? shuzhi + '.0' : shuzhi
  3635. }
  3636. // console.log(this.workForm)
  3637. if (this.timeBasecostList&&this.timeBasecostList.length>0) {
  3638. this.workForm.domains[0].basecostId = this.timeBasecostList[0].id;
  3639. }
  3640. this.canEdit = true;
  3641. }
  3642. this.dialogVisible = true;
  3643. },
  3644. // 按周填报里内容的填写
  3645. tianxies(item, i, names, row) {
  3646. // console.log(item, i, names, row, '你好')
  3647. var idd = ''
  3648. var obj = {}
  3649. for(var l in this.projectList) {
  3650. if(this.projectList[l].projectName == names) idd = this.projectList[l].id
  3651. }
  3652. obj.projectId = idd
  3653. this.selectProject(obj, 0)
  3654. // console.log(this.workForm.domains[0], '打印出来的')
  3655. this.tianxieDialogVisible = true
  3656. this.scopess = item
  3657. var sss = {}
  3658. sss.projectId = idd;
  3659. sss.con = item.con
  3660. sss.progress = item.progress
  3661. sss.time = item.time
  3662. sss.workingTime = item.workingTime
  3663. sss.projectAuditorId = item.projectAuditorId;
  3664. if (this.timeBasecostList && this.timeBasecostList.length > 0) {
  3665. //默认选中第一个
  3666. sss.basecostId = this.timeBasecostList[0].id;
  3667. }
  3668. var that = this
  3669. setTimeout(() =>{
  3670. if(Object.keys(item).length < 5) {
  3671. // console.log(456)
  3672. sss.subProjectId = that.workForm.domains[0].subProjectId
  3673. sss.stage = that.workForm.domains[0].stage
  3674. sss.subProjectList = that.workForm.domains[0].subProjectList
  3675. sss.stages = that.workForm.domains[0].stages
  3676. sss.taskGroups = that.workForm.domains[0].taskGroups;
  3677. sss.auditUserList = obj.auditUserList;
  3678. } else {
  3679. sss.subProjectId = item.subProjectId
  3680. sss.stage = item.stage
  3681. sss.subProjectList = item.subProjectList
  3682. sss.stages = item.stages
  3683. sss.taskGroups = item.taskGroups;
  3684. sss.auditUserList = obj.auditUserList;
  3685. }
  3686. if (sss.auditUserList != null && sss.auditUserList.length==1) {
  3687. //只有一个审核人,自动设置上去
  3688. sss.projectAuditorId = sss.auditUserList[0].auditorId;
  3689. }
  3690. sss.wuduList = row[0].wuduList
  3691. // console.log(sss, '数据')
  3692. that.zhoBaoIdx = i
  3693. that.zhoBaoName = names
  3694. that.zhoBao = sss
  3695. that.zhis = row
  3696. that.$forceUpdate();
  3697. },500);
  3698. // if(Object.keys(sss).length <= 4) {
  3699. // sss.subProjectId = this.workForm.domains[0].subProjectId
  3700. // sss.stage = this.workForm.domains[0].stage
  3701. // sss.subProjectList = this.workForm.domains[0].subProjectList
  3702. // sss.stages = this.workForm.domains[0].stages
  3703. // } else {
  3704. // sss.subProjectId = item.subProjectId
  3705. // sss.stage = item.stage
  3706. // sss.subProjectList = item.subProjectList
  3707. // sss.stages = item.stages
  3708. // }
  3709. // console.log(sss, '数据')
  3710. // this.zhoBaoIdx = i
  3711. // this.zhoBaoName = names
  3712. // this.zhoBao = sss
  3713. // this.zhis = row
  3714. // this.selectProject(row[0], i)
  3715. },
  3716. // 按周填报里内容的填写点击确定
  3717. btnTianxiaes() {
  3718. if (this.zhoBao.projectAuditorId) {
  3719. let errtips = ''
  3720. if(this.user.timeType.customDegreeStatus == 1 && this.zhoBao.wuduList.length != 0 && !this.zhoBao.degreeId) {
  3721. errtips += this.user.timeType.customDegreeName + '、'
  3722. }
  3723. if(this.user.timeType.customDataStatus == 1 && !this.zhoBao.customData){
  3724. errtips += this.user.timeType.customDataName + '、'
  3725. }
  3726. if(this.user.timeType.customTextStatus == 1 && !this.zhoBao.customText){
  3727. errtips += this.user.timeType.customTextName + '、'
  3728. }
  3729. if(this.user.timeType.workContentState == 1 && !this.zhoBao.con){
  3730. errtips += this.user.companyId==781?'具体内容与结果、':'工作事项、'
  3731. }
  3732. if(errtips){
  3733. errtips = errtips.substring(0,errtips.length - 1)
  3734. this.$message({
  3735. message: '请对' + errtips + '进行填写',
  3736. type: 'warning'
  3737. })
  3738. }else {
  3739. this.tianxieDialogVisible = false
  3740. var zhong = this.zhoData
  3741. zhong[this.zhoBaoIdx][this.zhoBaoName] = this.zhoBao
  3742. this.zhoData = zhong
  3743. if(this.reportTimeType.type == 1) this.zhoXuan(this.zhoBao, this.zhoBaoIdx)
  3744. if(this.reportTimeType.type == 2) this.zhoTimes(this.zhoBao, this.zhoBaoIdx)
  3745. if(this.reportTimeType.type == 3) this.addBli(this.zhoBao, this.zhoBaoIdx)
  3746. }
  3747. } else {
  3748. this.$message({
  3749. message: '请选择审核人',
  3750. type: "error"
  3751. });
  3752. }
  3753. },
  3754. // 获取本周
  3755. getCurrentWeek() {
  3756. const currentDate = new Date()
  3757. const week = currentDate.getDay()
  3758. const millisecond = 1000 * 60 * 60 * 24
  3759. const minusDay = week != 0 ? week - 1 : 4
  3760. const monday = new Date(currentDate.getTime() - minusDay * millisecond)
  3761. var stat = this.dealdate(monday)
  3762. var end
  3763. if(this.user.timeType.fillAhead == 1){
  3764. const endDay = week == 0 || week == 6 ? 0 : 5 - week
  3765. const endDate = new Date(currentDate.getTime() + endDay * millisecond)
  3766. end = this.dealdate(endDate)
  3767. }else{
  3768. end = this.dealdate(currentDate)
  3769. }
  3770. this.zhoRqi = [stat, end]
  3771. console.log('date',currentDate,this.zhoRqi);
  3772. this.zhoRqis()
  3773. this.jiazai()
  3774. },
  3775. // 获取上周
  3776. handleGetPrevWeek() {
  3777. const Time = new Date(this.zhoRqi[0])
  3778. let weekNum = Time.getDay()
  3779. weekNum = weekNum == 0 ? 7 : weekNum
  3780. let lastDate = new Date(Time.getTime() - weekNum * 24 * 60 * 60 * 1000)
  3781. let fitstDate = new Date(
  3782. Time.getTime() - (weekNum + 6) * 24 * 60 * 60 * 1000
  3783. )
  3784. let startDate = `${fitstDate.getFullYear()}-${
  3785. fitstDate.getMonth() + 1 < 10
  3786. ? '0' + (fitstDate.getMonth() + 1)
  3787. : fitstDate.getMonth() + 1
  3788. }-${
  3789. fitstDate.getDate() < 10
  3790. ? '0' + fitstDate.getDate()
  3791. : fitstDate.getDate()
  3792. }`
  3793. let endDate = `${lastDate.getFullYear()}-${
  3794. lastDate.getMonth() + 1 < 10
  3795. ? '0' + (lastDate.getMonth() + 1)
  3796. : lastDate.getMonth() + 1
  3797. }-${
  3798. lastDate.getDate() < 10 ? '0' + lastDate.getDate() : lastDate.getDate()
  3799. }`
  3800. var stat = this.dealdate(startDate)
  3801. var ends = this.dealdate(endDate)
  3802. var end = this.dateChange(-2, ends)
  3803. this.zhoRqi = [stat, end]
  3804. this.zhoRqis()
  3805. this.jiazai()
  3806. },
  3807. // 获取下周
  3808. handleGetNextvWeek() {
  3809. const Time = new Date(this.zhoRqi[1])
  3810. let weekNum = Time.getDay()
  3811. weekNum = weekNum == 0 ? 7 : weekNum
  3812. let fitstDate = new Date(
  3813. Time.getTime() + (7 - weekNum + 1) * 24 * 60 * 60 * 1000
  3814. )
  3815. let lastDate = new Date(
  3816. Time.getTime() + (7 - weekNum + 7) * 24 * 60 * 60 * 1000
  3817. )
  3818. let startDate = `${fitstDate.getFullYear()}-${
  3819. fitstDate.getMonth() + 1 < 10
  3820. ? '0' + (fitstDate.getMonth() + 1)
  3821. : fitstDate.getMonth() + 1
  3822. }-${
  3823. fitstDate.getDate() < 10
  3824. ? '0' + fitstDate.getDate()
  3825. : fitstDate.getDate()
  3826. }`
  3827. let endDate = `${lastDate.getFullYear()}-${
  3828. lastDate.getMonth() + 1 < 10
  3829. ? '0' + (lastDate.getMonth() + 1)
  3830. : lastDate.getMonth() + 1
  3831. }-${
  3832. lastDate.getDate() < 10 ? '0' + lastDate.getDate() : lastDate.getDate()
  3833. }`
  3834. var stat = this.dealdate(startDate)
  3835. var ends = this.dealdate(endDate)
  3836. var end = this.dateChange(-2, ends)
  3837. this.zhoRqi = [stat, end]
  3838. this.zhoRqis()
  3839. this.jiazai()
  3840. },
  3841. // 新增日期
  3842. newDates() {
  3843. // console.log(this.zhoRqi, '看卡')
  3844. let edate = new Date(this.zhoRqi[1])
  3845. let nowdate = new Date()
  3846. let nowdate2
  3847. if(this.user.timeType.fillAhead == 1){
  3848. let week = nowdate.getDay()
  3849. const endDay = week > 5 ? 0 : 5 - week
  3850. const endDate = new Date(nowdate.getTime() + endDay * millisecond)
  3851. nowdate2 = this.dealdate(endDate)
  3852. }else{
  3853. nowdate2 = new Date(nowdate.getFullYear(),nowdate.getMonth(),nowdate.getDate())
  3854. }
  3855. if(edate >= nowdate2){
  3856. return
  3857. }
  3858. this.zhoRqi[1] = this.dateChange(1, this.zhoRqi[1])
  3859. // console.log(this.zhoRqi[1]);
  3860. // console.log(this.zhoRqi[1])
  3861. var obj = {}
  3862. obj.zhoDataTime = this.zhoRqi[1]
  3863. obj.he = 0
  3864. for(var j in this.projectList) {
  3865. var xinzhi = this.projectList[j].projectName
  3866. obj[xinzhi] = {}
  3867. obj[xinzhi].time = ''
  3868. obj[xinzhi].con = ''
  3869. obj[xinzhi].progress = 0
  3870. obj[xinzhi].workingTime = 0
  3871. }
  3872. this.zhoData.push(obj)
  3873. },
  3874. // 减去时间
  3875. dateChange(num = 1,date = false) {
  3876.   if (!date) {
  3877.     date = new Date();//没有传入值时,默认是当前日期
  3878.     date = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
  3879.   }
  3880.   date += " 00:00:00";//设置为当天凌晨12点
  3881.   date = Date.parse(new Date(date))/1000;//转换为时间戳
  3882.   date += (86400) * num;//修改后的时间戳
  3883.   var newDate = new Date(parseInt(date) * 1000);//转换为时间
  3884. var nian = newDate.getFullYear()
  3885. var yue = ''
  3886. var ri = ''
  3887. var yues = (newDate.getMonth() + 1)
  3888. var ris = newDate.getDate()
  3889. yues > 9 ? yue = yues : yue = '0' + yues
  3890. ris > 9 ? ri = ris : ri = '0' + ris
  3891. return nian +'-'+yue+'-'+ri
  3892. },
  3893. // 加载动画
  3894. jiazai() {
  3895. this.zhoLoading = true
  3896. var that = this
  3897. setTimeout(() =>{
  3898. that.zhoLoading = false
  3899. },1000);
  3900. },
  3901. // 转时间格式
  3902. dealdate(date) {
  3903. const dt = new Date(date)
  3904. const y = dt.getFullYear()
  3905. const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  3906. const d = (dt.getDate() + '').padStart(2, '0')
  3907. return `${y}-${m}-${d}`
  3908. },
  3909. // 按周填报
  3910. fillInReportss() {
  3911. window.addEventListener('scroll', this.handleScroll, true)
  3912. this.jiazai()
  3913. this.diasZho = true
  3914. this.getCurrentWeek()
  3915. // 项目数量判断 <=5
  3916. if(this.projectList.length < 5){
  3917. this.selProjectList = this.projectList
  3918. this.selConShow = false
  3919. }
  3920. if (!this.timeBasecostList || this.timeBasecostList.length == 0) {
  3921. //重新获取工时预警类型的预算项
  3922. this.http.post('/project-basecost-setting/getReportBasecostList', {
  3923. companyId: this.user.companyId
  3924. },
  3925. res => {
  3926. if (res.code == "ok") {
  3927. this.timeBasecostList = res.data;
  3928. }
  3929. });
  3930. }
  3931. },
  3932. // 按周填报的项目筛选
  3933. selListFun(){
  3934. this.selProjectList = []
  3935. if(this.selCon.length){
  3936. for (let i = 0; i < this.selCon.length; i++) {
  3937. this.selProjectList.push(this.projectList.find(item => item.id == this.selCon[i]))
  3938. }
  3939. // console.log("已筛选列表",this.selProjectList);
  3940. this.selConShow = false
  3941. }else{
  3942. this.$message({
  3943. message:'请选择要填报的项目',
  3944. type:'error'
  3945. })
  3946. }
  3947. },
  3948. selListqx(){
  3949. this.diasZho = false
  3950. this.selProjectList = []
  3951. this.selCon = []
  3952. },
  3953. handleScroll() {
  3954. this.changdu = this.projectList.length + 1
  3955. },
  3956. // 自动选择时间点的事件
  3957. zhoTimes(item, i, ims, event) {
  3958. var iss = i
  3959. if(item.time == null) {
  3960. return
  3961. } else {
  3962. var zhi = this.zhoData[iss]
  3963. var he = 0
  3964. for(var i in zhi) {
  3965. if(zhi[i].time && zhi[i].time.length > 0 && i != 'zhoDataTime' && i != 'he') {
  3966. var date2 = '2021/12/12 ' + zhi[i].time[1] +':00'
  3967. var date1 = '2021/12/12 ' + zhi[i].time[0] +':00'
  3968. var date3 = new Date(date2).getTime() - new Date(date1).getTime();
  3969. var leave1=date3%(24*3600*1000)
  3970. var hours=Math.floor(leave1/(3600*1000))
  3971. var leave2=leave1%(3600*1000)
  3972. var minutes=Math.floor(leave2/(60*1000))
  3973. var shi = hours+'.'+ minutes
  3974. he += +shi
  3975. }
  3976. }
  3977. zhi.he = he + 'h'
  3978. }
  3979. },
  3980. // 自动选择事件长度的事件
  3981. zhoXuan(item, i) {
  3982. var iss = i
  3983. if(item.time == null) {
  3984. return
  3985. } else {
  3986. var zhi = this.zhoData[iss]
  3987. var he = 0
  3988. for(var i in zhi) {
  3989. if(i != 'zhoDataTime' && i != 'he' && zhi[i].workingTime && zhi[i].workingTime.length > 0) {
  3990. he += +zhi[i].workingTime
  3991. }
  3992. }
  3993. zhi.he = he + 'h'
  3994. }
  3995. },
  3996. // 按时间比例
  3997. addBli(item, i) {
  3998. var iss = i
  3999. if(item.time == null) {
  4000. return
  4001. } else {
  4002. var zhi = this.zhoData[iss]
  4003. var he = 0
  4004. for(var i in zhi) {
  4005. if(i != 'zhoDataTime' && i != 'he' && zhi[i].workingTime && zhi[i].workingTime.length > 0) {
  4006. he += +zhi[i].workingTime
  4007. }
  4008. }
  4009. zhi.he = he.toFixed(1) + 'h'
  4010. }
  4011. },
  4012. zhoRqis() {
  4013. let nowdate = new Date()
  4014. let nowdate2
  4015. if(this.user.timeType.fillAhead == 1){
  4016. const millisecond = 1000 * 60 * 60 * 24
  4017. let week = nowdate.getDay()
  4018. const endDay = week == 0 || week == 6 ? 0 : 5 - week
  4019. const endDate = new Date(nowdate.getTime() + endDay * millisecond)
  4020. nowdate2 = this.dealdate(endDate)
  4021. }else{
  4022. nowdate2 = new Date(nowdate.getFullYear(),nowdate.getMonth(),nowdate.getDate())
  4023. }
  4024. let edate = new Date(this.zhoRqi[1])
  4025. if(edate >= nowdate2){
  4026. let emon = nowdate2.getMonth() + 1
  4027. let eday = nowdate2.getDate()
  4028. let edate2 = nowdate2.getFullYear() + '-' + (emon < 10 ? '0' + emon : emon) + '-' + (eday < 10 ? '0' + eday : eday)
  4029. this.zhoRqi[1] = edate2
  4030. }
  4031. this.zhoData = []
  4032. if(this.zhoRqi) {
  4033. var stime = this.zhoRqi[0]
  4034. var etime = this.zhoRqi[1]
  4035. var zhi = this.getdiffdate(stime, etime)
  4036. var arrst = []
  4037. for(var i in zhi) {
  4038. var obj = {}
  4039. obj.zhoDataTime = zhi[i]
  4040. obj.he = 0
  4041. for(var j in this.projectList) {
  4042. var xinzhi = this.projectList[j].projectName
  4043. obj[xinzhi] = {}
  4044. obj[xinzhi].time = ''
  4045. obj[xinzhi].con = ''
  4046. obj[xinzhi].progress = 0
  4047. obj[xinzhi].workingTime = 0
  4048. }
  4049. arrst.push(obj)
  4050. }
  4051. this.zhoData = arrst
  4052. }
  4053. },
  4054. zhoZhi(res, i) {
  4055. var zhi = 0
  4056. for(var i in res) {
  4057. if(i != 'zhoDataTime' && i != 'he') {
  4058. zhi += +res[i]
  4059. }
  4060. }
  4061. res.he = zhi
  4062. },
  4063. zhoBtn(i) {
  4064. // this.zhoData.split(i, 1)
  4065. var arr = this.zhoData
  4066. arr.splice(i, 1)
  4067. },
  4068. zhoAddlast(){
  4069. this.selConShow = true
  4070. },
  4071. zhoAddqx(){
  4072. this.diasZho = false
  4073. this.selConShow = true
  4074. this.selProjectList = []
  4075. this.selCon = []
  4076. },
  4077. // 提交按周填报
  4078. zhoAdd() {
  4079. var zhi = this.zhoData
  4080. var ll = 0
  4081. // console.log(this.reportTimeType.type)
  4082. // console.log(this.reportTimeType.multiWorktime)
  4083. if(this.reportTimeType.type == 2) {
  4084. for(var i in zhi) {
  4085. this.dateAr = []
  4086. var alp = []
  4087. var zhis = zhi[i]
  4088. for(var j in zhis) {
  4089. if(j != 'zhoDataTime' && j != 'he' && zhis[j].time != null && zhis[j].time != 'null' && zhis[j].time != '') {
  4090. let objs = {}
  4091. objs.s = zhis[j].time[0]
  4092. objs.e = zhis[j].time[1]
  4093. alp.push(objs)
  4094. }
  4095. }
  4096. this.dateAr = alp
  4097. if(this.dateAr.length > 0) {
  4098. let trus = this.fns()
  4099. ll += 1
  4100. if(!trus) {
  4101. this.$message({
  4102. message: '填写的时间段重叠',
  4103. type: 'error'
  4104. })
  4105. return false
  4106. }
  4107. }
  4108. }
  4109. if(ll == 0) {
  4110. this.$message({
  4111. message: '请填写时间',
  4112. type: 'error'
  4113. })
  4114. return false
  4115. }
  4116. } else if(this.reportTimeType.type == 1){
  4117. for(var i in zhi) {
  4118. var zhis = zhi[i]
  4119. for(var j in zhis) {
  4120. if(j != 'zhoDataTime' && j != 'he' && zhis[j].workingTime != null && zhis[j].workingTime != 'null' && zhis[j].workingTime != '') {
  4121. ll += 1
  4122. }
  4123. }
  4124. }
  4125. if(ll == 0) {
  4126. this.$message({
  4127. message: '请选择时间',
  4128. type: 'error'
  4129. })
  4130. return false
  4131. }
  4132. }
  4133. var submits = []
  4134. let formData = new FormData();
  4135. if(this.reportTimeType.multiWorktime == 1){
  4136. for (var i in this.zhoData) {
  4137. var zhoD = this.zhoData[i]
  4138. var flgs = false
  4139. for(var j in zhoD) {
  4140. if(j != 'zhoDataTime' && j != 'he' && zhoD[j].time && zhoD[j].time.length > 0 && zhoD[j].time != null && zhoD[j].time != 'null') {
  4141. flgs = true
  4142. // formData.append("degreeId", "-1");
  4143. formData.append("id", '-1');
  4144. for(var s in this.projectList) {
  4145. if(j == this.projectList[s].projectName) {
  4146. formData.append("projectId", this.projectList[s].id);
  4147. }
  4148. }
  4149. zhoD[j].subProjectId ? formData.append("subProjectId", zhoD[j].subProjectId) : formData.append("subProjectId", '0');
  4150. formData.append("taskId", 0);
  4151. formData.append("reportTimeType", this.reportTimeType.type);
  4152. formData.append("endTime", '');
  4153. formData.append("startTime", '');
  4154. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  4155. var lix = []
  4156. var objjs = {}
  4157. objjs.startTime = zhoD[j].time[0]
  4158. objjs.endTime = zhoD[j].time[1]
  4159. if (zhoD[j].con == null || zhoD[j].con == '') {
  4160. zhoD[j].con == '-'
  4161. }
  4162. objjs.content = zhoD[j].con
  4163. lix.push(objjs)
  4164. var zhiZhi = JSON.stringify(lix)
  4165. zhiZhi = zhiZhi.replace(/,/g,"@");
  4166. formData.append("content", zhiZhi)
  4167. formData.append("isOvertime", 0)
  4168. formData.append("professionProgress", "[]")
  4169. zhoD[j].stage ? formData.append("stage", zhoD[j].stage) : formData.append("stage", '');
  4170. formData.append("createDate",zhoD.zhoDataTime)
  4171. if (zhoD[j].projectAuditorId) {
  4172. formData.append("projectAuditorId",zhoD[j].projectAuditorId)
  4173. }
  4174. if(zhoD[j].basecostId) {
  4175. formData.append("basecostId", zhoD[j].basecostId);
  4176. } else {
  4177. formData.append("basecostId", 0);
  4178. }
  4179. if(this.user.timeType.customDegreeActive && zhoD[j].degreeId){
  4180. formData.append('degreeId',zhoD[j].degreeId)
  4181. }else{
  4182. formData.append("degreeId", "-1");
  4183. }
  4184. if(this.user.timeType.customDataActive && zhoD[j].customData){
  4185. formData.append('customData',zhoD[j].customData)
  4186. }else if(this.user.timeType.customDataActive){
  4187. formData.append('customData',0)
  4188. }
  4189. if(this.user.timeType.customTextActive && zhoD[j].customText){
  4190. formData.append('customText',zhoD[j].customText)
  4191. }else if(this.user.timeType.customTextActive){
  4192. formData.append('customText','-')
  4193. }
  4194. }
  4195. }
  4196. }
  4197. } else {
  4198. for (var i in this.zhoData) {
  4199. var zhoD = this.zhoData[i]
  4200. var flgs = false
  4201. if(this.reportTimeType.type == 2) {
  4202. for(var j in zhoD) {
  4203. if(j != 'zhoDataTime' && j != 'he' && zhoD[j].time && zhoD[j].time.length > 0 && zhoD[j].time != null && zhoD[j].time != 'null') {
  4204. flgs = true
  4205. // formData.append("degreeId", "-1");
  4206. formData.append("id", '-1');
  4207. for(var s in this.projectList) {
  4208. if(j == this.projectList[s].projectName) {
  4209. formData.append("projectId", this.projectList[s].id);
  4210. }
  4211. }
  4212. zhoD[j].subProjectId ? formData.append("subProjectId", zhoD[j].subProjectId) : formData.append("subProjectId", '0');
  4213. formData.append("taskId", 0);
  4214. formData.append("reportTimeType", this.reportTimeType.type);
  4215. formData.append("endTime", zhoD[j].time[1]);
  4216. formData.append("startTime", zhoD[j].time[0]);
  4217. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  4218. zhoD[j].con == '' || zhoD[j].con == null ? formData.append("content", '-') : formData.append("content", zhoD[j].con)
  4219. formData.append("isOvertime", 0)
  4220. formData.append("professionProgress", "[]")
  4221. zhoD[j].stage ? formData.append("stage", zhoD[j].stage) : formData.append("stage", '');
  4222. formData.append("createDate",zhoD.zhoDataTime)
  4223. if (zhoD[j].projectAuditorId) {
  4224. formData.append("projectAuditorId",zhoD[j].projectAuditorId)
  4225. }
  4226. if(zhoD[j].basecostId) {
  4227. formData.append("basecostId", zhoD[j].basecostId);
  4228. } else {
  4229. formData.append("basecostId", 0);
  4230. }
  4231. if(this.user.timeType.customDegreeActive && zhoD[j].degreeId){
  4232. formData.append('degreeId',zhoD[j].degreeId)
  4233. }else{
  4234. formData.append("degreeId", "-1");
  4235. }
  4236. if(this.user.timeType.customDataActive && zhoD[j].customData){
  4237. formData.append('customData',zhoD[j].customData)
  4238. }else if(this.user.timeType.customDataActive){
  4239. formData.append('customData',0)
  4240. }
  4241. if(this.user.timeType.customTextActive && zhoD[j].customText){
  4242. formData.append('customText',zhoD[j].customText)
  4243. }else if(this.user.timeType.customTextActive){
  4244. formData.append('customText','-')
  4245. }
  4246. }
  4247. }
  4248. } else {
  4249. for(var j in zhoD) {
  4250. 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') {
  4251. flgs = true
  4252. // formData.append("degreeId", "-1");
  4253. formData.append("id", '-1');
  4254. for(var s in this.projectList) {
  4255. if(j == this.projectList[s].projectName) {
  4256. formData.append("projectId", this.projectList[s].id);
  4257. }
  4258. }
  4259. zhoD[j].subProjectId ? formData.append("subProjectId", zhoD[j].subProjectId) : formData.append("subProjectId", '0')
  4260. // formData.append("subProjectId", zhoD[j].subProjectId);
  4261. formData.append("taskId", 0);
  4262. formData.append("reportTimeType", this.reportTimeType.type);
  4263. if(this.reportTimeType.type == 1) {
  4264. formData.append("workingTime", zhoD[j].workingTime);
  4265. } else if(this.reportTimeType.type == 2) {
  4266. formData.append("endTime", zhoD[j].time[1]);
  4267. formData.append("startTime", zhoD[j].time[0]);
  4268. } else if(this.reportTimeType.type == 3) {
  4269. formData.append("progress", zhoD[j].progress);
  4270. formData.append("workingTime", zhoD[j].workingTime);
  4271. }
  4272. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  4273. zhoD[j].con == '' || zhoD[j].con == null ? formData.append("content", '-') : formData.append("content", zhoD[j].con)
  4274. formData.append("isOvertime", 0)
  4275. formData.append("professionProgress", "[]")
  4276. zhoD[j].stage ? formData.append("stage", zhoD[j].stage) : formData.append("stage", '');
  4277. formData.append("createDate",zhoD.zhoDataTime)
  4278. if (zhoD[j].projectAuditorId) {
  4279. formData.append("projectAuditorId",zhoD[j].projectAuditorId)
  4280. }
  4281. if(zhoD[j].basecostId) {
  4282. formData.append("basecostId", zhoD[j].basecostId);
  4283. } else {
  4284. formData.append("basecostId", 0);
  4285. }
  4286. if(this.user.timeType.customDegreeActive && zhoD[j].degreeId){
  4287. formData.append('degreeId',zhoD[j].degreeId)
  4288. }else{
  4289. formData.append("degreeId", "-1");
  4290. }
  4291. if(this.user.timeType.customDataActive && zhoD[j].customData){
  4292. formData.append('customData',zhoD[j].customData)
  4293. }else if(this.user.timeType.customDataActive){
  4294. formData.append('customData',0)
  4295. }
  4296. if(this.user.timeType.customTextActive && zhoD[j].customText){
  4297. formData.append('customText',zhoD[j].customText)
  4298. }else if(this.user.timeType.customTextActive){
  4299. formData.append('customText','-')
  4300. }
  4301. }
  4302. }
  4303. }
  4304. }
  4305. }
  4306. // 自定义维度
  4307. this.http.uploadFile( this.port.report.editPort, formData,
  4308. res => {
  4309. // this.listLoading = false;
  4310. if (res.code == "ok") {
  4311. this.$message({
  4312. message: "填报成功",
  4313. type: "success"
  4314. });
  4315. this.diasZho = false
  4316. this.selConShow = true
  4317. this.zhoData = []
  4318. this.zhoRqi = ''
  4319. this.getReportList();
  4320. this.getDepartment();
  4321. // 关闭弹窗 并 清空
  4322. this.selProjectList = []
  4323. this.selCon = []
  4324. } else {
  4325. this.$message({
  4326. message: res.msg,
  4327. type: "error"
  4328. });
  4329. }
  4330. },
  4331. error => {
  4332. this.listLoading = false;
  4333. this.$message({
  4334. message: error,
  4335. type: "error"
  4336. });
  4337. });
  4338. },
  4339. ChangeHourMinutestr (str) {
  4340. if (str !== "0" && str !== "" && str !== null) {
  4341. return ((Math.floor(str / 60)).toString().length < 2 ? "0" + (Math.floor(str / 60)).toString() :
  4342. (Math.floor(str / 60)).toString()) + ":" + ((str % 60).toString().length < 2 ? "0" + (str % 60).toString() : (str % 60).toString());
  4343. } else {
  4344. return "";
  4345. }
  4346. },
  4347. // 得到两个日期中间的日期
  4348. getdiffdate(stime,etime){
  4349. //初始化日期列表,数组
  4350. var diffdate = new Array();
  4351. var i=0;
  4352. //开始日期小于等于结束日期,并循环
  4353. while(stime<=etime){
  4354. diffdate[i] = stime;
  4355. //获取开始日期时间戳
  4356. var stime_ts = new Date(stime).getTime();
  4357. //增加一天时间戳后的日期
  4358. var next_date = stime_ts + (24*60*60*1000);
  4359. //拼接年月日,这里的月份会返回(0-11),所以要+1
  4360. var next_dates_y = new Date(next_date).getFullYear()+'-';
  4361. var next_dates_m = (new Date(next_date).getMonth()+1 < 10)?'0'+(new Date(next_date).getMonth()+1)+'-':(new Date(next_date).getMonth()+1)+'-';
  4362. var next_dates_d = (new Date(next_date).getDate() < 10)?'0'+new Date(next_date).getDate():new Date(next_date).getDate();
  4363. stime = next_dates_y+next_dates_m+next_dates_d;
  4364. //增加数组key
  4365. i++;
  4366. }
  4367. return diffdate;
  4368. },
  4369. // 添加模块
  4370. addDomain(i) {
  4371. var leftProgress = 10;
  4372. if (this.reportTimeType.type == 3) {
  4373. //计算已经待分配工时比例
  4374. let array = this.workForm.domains;
  4375. let totalProgress = 0;
  4376. for (var i=0;i<array.length; i++) {
  4377. totalProgress += array[i].progress;
  4378. }
  4379. if (totalProgress < 100) {
  4380. leftProgress = 100 - totalProgress;
  4381. }
  4382. }
  4383. var addItem = {
  4384. projectId: "",
  4385. workingTime: this.reportTimeType.type == 3?(leftProgress*this.reportTimeType.allday/100).toFixed(1):"",
  4386. content: "",
  4387. progress:leftProgress,
  4388. state:2,//2-表示待提交
  4389. multiWorktime: this.reportTimeType.multiWorktime,
  4390. worktimeList:[{}],
  4391. // degreeId: '',
  4392. };
  4393. if (this.timeBasecostList && this.timeBasecostList.length > 0) {
  4394. //默认给第一个,必填字段
  4395. addItem.basecostId = this.timeBasecostList[0].id;
  4396. }
  4397. this.workForm.domains.push(addItem);
  4398. if (this.reportTimeType.type == 0) {
  4399. //全天上下午模式下,检测时间段数量,达到2个,不能再加了
  4400. var length = this.workForm.domains.length;
  4401. if (length == 2) {
  4402. this.showAddMore = false;
  4403. }
  4404. }
  4405. this.chuji()
  4406. },
  4407. // 移除模块
  4408. delDomain(i) {
  4409. this.workForm.domains.splice(i,1)
  4410. //检测当前剩下的一个,时间类型是否是全天
  4411. if (this.reportTimeType.type == 0) {
  4412. if (this.workForm.domains[0].timeType == 0) {
  4413. this.showAddMore = false;
  4414. } else {
  4415. this.showAddMore = true;
  4416. }
  4417. }
  4418. if(this.user.timeType.multiWorktime == 1) {
  4419. this.iptChangs()
  4420. } else {
  4421. this.seleChn(0)
  4422. }
  4423. },
  4424. // 改变月份
  4425. changeMonth() {
  4426. if (this.isBatch == 0 && !this.isSubstitude) {
  4427. //只有按天填报才能获取当天的日报
  4428. this.getReport()
  4429. }
  4430. },
  4431. // 判断时间段
  4432. fns() {
  4433. for (let k in this.dateAr) {
  4434. if (!this.judege(k)) {
  4435. return false
  4436. }
  4437. }
  4438. return true
  4439. },
  4440. judege(idx){
  4441. for (let k in this.dateAr) {
  4442. if (idx !== k) {
  4443. if (this.dateAr[k].s <= this.dateAr[idx].s && this.dateAr[k].e > this.dateAr[idx].s) {
  4444. return false
  4445. }
  4446. if (this.dateAr[k].s < this.dateAr[idx].e && this.dateAr[k].e >= this.dateAr[idx].e) {
  4447. return false
  4448. }
  4449. }
  4450. }
  4451. return true
  4452. },
  4453. // 保存日报
  4454. submitReport(isDraft) {
  4455. this.isDraft = isDraft;
  4456. this.$refs.workForm.validate(valid => {
  4457. if (valid) {
  4458. this.dateAr = []
  4459. let alp = []
  4460. if(this.user.timeType.multiWorktime != 1) {
  4461. for(var p in this.workForm.domains) {
  4462. if(this.workForm.domains[p].startTime || this.workForm.domains[p].endTime) {
  4463. let objs = {}
  4464. objs.s = this.workForm.domains[p].startTime
  4465. objs.e = this.workForm.domains[p].endTime
  4466. alp.push(objs)
  4467. }
  4468. }
  4469. this.dateAr = alp
  4470. if(this.dateAr.length > 0) {
  4471. let trus = this.fns()
  4472. if(!trus) {
  4473. this.$message({
  4474. message: '填写的时间段重叠',
  4475. type: "error"
  4476. });
  4477. return
  4478. }
  4479. }
  4480. } else {
  4481. for(var p in this.workForm.domains) {
  4482. var slll = this.workForm.domains[p]
  4483. for(var o in slll.worktimeList) {
  4484. if(slll.worktimeList[o].startTime || slll.worktimeList[o].endTime) {
  4485. let objs = {}
  4486. objs.s = slll.worktimeList[o].startTime
  4487. objs.e = slll.worktimeList[o].endTime
  4488. alp.push(objs)
  4489. }
  4490. }
  4491. }
  4492. this.dateAr = alp
  4493. if(this.dateAr.length > 0) {
  4494. let trus = this.fns()
  4495. if(!trus) {
  4496. this.$message({
  4497. message: '填写的时间段重叠',
  4498. type: "error"
  4499. });
  4500. return
  4501. }
  4502. }
  4503. }
  4504. // return
  4505. //代填的情况,检查人员是否已经选择
  4506. if (this.isSubstitude) {
  4507. if (this.workForm.userNames == null || this.workForm.userNames.length == 0) {
  4508. this.$message({
  4509. message: "请选择代填的人员",
  4510. type: "error"
  4511. });
  4512. return;
  4513. }
  4514. }
  4515. //检查时间,全天和上下午不能同时存在
  4516. if (this.reportTimeType.type == 0) {
  4517. var alldayNum = 0;
  4518. var amNum = 0;
  4519. var pmNum = 0;
  4520. for(var i in this.workForm.domains) {
  4521. if (this.workForm.domains[i].timeType == 0) {
  4522. alldayNum ++;
  4523. } else if (this.workForm.domains[i].timeType == 1) {
  4524. amNum++;
  4525. } else if (this.workForm.domains[i].timeType == 2) {
  4526. pmNum++;
  4527. }
  4528. }
  4529. if (alldayNum > 1) {
  4530. this.$message({
  4531. message: "工作时间-全天,只能选择一次",
  4532. type: "error"
  4533. });
  4534. return;
  4535. }
  4536. if (amNum > 1) {
  4537. this.$message({
  4538. message: "工作时间-上午,只能选择一次",
  4539. type: "error"
  4540. });
  4541. return;
  4542. }
  4543. if (pmNum > 1) {
  4544. this.$message({
  4545. message: "工作时间-下午,只能选择一次",
  4546. type: "error"
  4547. });
  4548. return;
  4549. }
  4550. if (alldayNum == 1 && (amNum > 0 || pmNum > 0)) {
  4551. this.$message({
  4552. message: "工作时间-全天,不能和上下午同时存在",
  4553. type: "error"
  4554. });
  4555. return;
  4556. }
  4557. } else if (this.reportTimeType.type == 3) {
  4558. //总百分比不能超过100%
  4559. let total = 0;
  4560. this.workForm.domains.forEach(w=>{total += w.progress});
  4561. if (total > 100) {
  4562. this.$message({
  4563. message: "用时比例之和不能超过100%",
  4564. type: "error"
  4565. });
  4566. return;
  4567. } else if (total < 100) {
  4568. this.$message({
  4569. message: "工时尚未完全分配,无法提交",
  4570. type: "error"
  4571. });
  4572. return;
  4573. }
  4574. }
  4575. this.listLoading = true;
  4576. let formData = new FormData();
  4577. formData.append("draft", this.isDraft);
  4578. //检查workingTime合计
  4579. if (this.reportTimeType.type == 1 && this.workForm.time) {
  4580. var totalTime = 0;
  4581. for (var t=0;t<this.workForm.domains.length; t++) {
  4582. totalTime += parseFloat(this.workForm.domains[t].workingTime);
  4583. }
  4584. if (this.workForm.time.workHours && totalTime > parseFloat(this.workForm.time.workHours)) {
  4585. this.$message({
  4586. message: "填报工时之和"+(totalTime)+"h不能超过考勤总工时("+this.workForm.time.workHours.toFixed(1)+"h)",
  4587. type: "error"
  4588. });
  4589. return;
  4590. }
  4591. }
  4592. for(var i in this.workForm.domains) {
  4593. if(this.workForm.domains[i].degreeId) {
  4594. // var sss = this.workForm.domains[i].degreeId.toString()
  4595. formData.append("degreeId", this.workForm.domains[i].degreeId);
  4596. } else {
  4597. formData.append("degreeId", -1);
  4598. }
  4599. if(this.workForm.domains[i].customData) {
  4600. // var sss = this.workForm.domains[i].degreeId.toString()
  4601. formData.append("customData", this.workForm.domains[i].customData);
  4602. } else {
  4603. formData.append("customData", 0);
  4604. }
  4605. if(this.workForm.domains[i].customText) {
  4606. formData.append("customText", this.workForm.domains[i].customText);
  4607. } else {
  4608. formData.append("customText", '-');
  4609. }
  4610. if (this.workForm.domains[i].id) {
  4611. formData.append("id", this.workForm.domains[i].id);
  4612. } else {
  4613. formData.append("id", -1);
  4614. }
  4615. formData.append("projectId", this.workForm.domains[i].projectId);
  4616. if (this.workForm.domains[i].subProjectId) {
  4617. formData.append("subProjectId", this.workForm.domains[i].subProjectId);
  4618. } else {
  4619. formData.append("subProjectId", 0);
  4620. }
  4621. if (this.workForm.domains[i].groupId) {
  4622. formData.append("groupId", this.workForm.domains[i].groupId);
  4623. } else {
  4624. formData.append("groupId", 0);
  4625. }
  4626. if (this.workForm.domains[i].taskId) {
  4627. formData.append("taskId", this.workForm.domains[i].taskId);
  4628. } else {
  4629. formData.append("taskId", 0);
  4630. }
  4631. if (this.workForm.domains[i].taskFinish == true) {
  4632. formData.append("taskFinish", 1);
  4633. } else {
  4634. formData.append("taskFinish", 0);
  4635. }
  4636. formData.append("reportTimeType", this.reportTimeType.type);
  4637. if (this.reportTimeType.type == 0) {
  4638. formData.append("timeType", this.workForm.domains[i].timeType);
  4639. var workingTime = this.timeType.filter(t=>t.value == this.workForm.domains[i].timeType)[0].hours;
  4640. formData.append("workingTime", workingTime);
  4641. } else if (this.reportTimeType.type == 1){
  4642. formData.append("workingTime", this.workForm.domains[i].workingTime);
  4643. } else if (this.reportTimeType.type == 2) {
  4644. formData.append("endTime", this.workForm.domains[i].endTime);
  4645. formData.append("startTime", this.workForm.domains[i].startTime);
  4646. } else if (this.reportTimeType.type == 3) {
  4647. //按比例分配
  4648. formData.append("progress", this.workForm.domains[i].progress);
  4649. formData.append("workingTime", this.workForm.domains[i].workingTime);
  4650. }
  4651. //处理多个时间事项
  4652. formData.append("multiWorktime", this.workForm.domains[i].multiWorktime);
  4653. if (this.reportTimeType.multiWorktime == 1) {
  4654. //检查时间是否有重叠
  4655. var workList = this.workForm.domains[i].worktimeList;
  4656. for (var j=0;j<workList.length; j++) {
  4657. var curItem = workList[j];
  4658. //检查开始时间是否大于结束时间
  4659. if (curItem.startTime >= curItem.endTime) {
  4660. this.$message({
  4661. message: "时间段"+curItem.startTime+'-'+curItem.endTime+"有误:"+
  4662. "结束时间必须大于开始时间",
  4663. type: "error"
  4664. });
  4665. return;
  4666. }
  4667. for (var p = j+1;p<workList.length; p++) {
  4668. var jItem = workList[p];
  4669. if ((jItem.startTime>=curItem.startTime&&jItem.startTime < curItem.endTime)
  4670. || (jItem.endTime>curItem.startTime&&jItem.endTime <= curItem.endTime)) {
  4671. this.$message({
  4672. message: "时间段"+curItem.startTime+'-'+curItem.endTime+"与"+
  4673. jItem.startTime+'-'+jItem.endTime+ "存在重叠,请修改。",
  4674. type: "error"
  4675. });
  4676. return;
  4677. }
  4678. }
  4679. }
  4680. let m = JSON.stringify(this.workForm.domains[i].worktimeList);
  4681. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  4682. formData.append("content", m);
  4683. } else {
  4684. if (this.workForm.domains[i].content) {
  4685. formData.append("content", this.workForm.domains[i].content);
  4686. } else {
  4687. formData.append("content", '-');
  4688. }
  4689. }
  4690. if (this.isBatch == 0) {
  4691. formData.append("createDate", this.workForm.createDate);
  4692. } else {
  4693. //批量填报,时间范围
  4694. formData.append("createDate", this.workForm.createDate[0]+'@'+this.workForm.createDate[1]);
  4695. }
  4696. if(this.workForm.domains[i].isOvertime) {
  4697. formData.append("isOvertime", 1);
  4698. } else {
  4699. formData.append("isOvertime", 0);
  4700. }
  4701. if(this.workForm.domains[i].overtimeHours && this.workForm.domains[i].isOvertime == 1) {
  4702. formData.append("overtimeHours", this.workForm.domains[i].overtimeHours);
  4703. } else {
  4704. formData.append("overtimeHours", 0);
  4705. }
  4706. if(this.workForm.domains[i].basecostId) {
  4707. formData.append("basecostId", this.workForm.domains[i].basecostId);
  4708. } else {
  4709. formData.append("basecostId", 0);
  4710. }
  4711. if (this.workForm.userId != null) {
  4712. var targetUids = '';
  4713. this.workForm.userId.forEach(u=>{
  4714. targetUids += u + '@';
  4715. });
  4716. if (targetUids.length > 0) {
  4717. targetUids = targetUids.substring(0, targetUids.length -1);
  4718. formData.append("targetUids", targetUids);
  4719. }
  4720. }
  4721. //项目专业进度
  4722. if (this.workForm.domains[i].professionProgress) {
  4723. var m = JSON.stringify(this.workForm.domains[i].professionProgress);
  4724. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  4725. formData.append("professionProgress", m);
  4726. } else {
  4727. formData.append("professionProgress", "[]");
  4728. }
  4729. if (this.workForm.domains[i].stage) {
  4730. formData.append("stage", this.workForm.domains[i].stage);
  4731. } else {
  4732. formData.append("stage", "-");
  4733. }
  4734. if (this.workForm.domains[i].projectAuditorId) {
  4735. formData.append("projectAuditorId", this.workForm.domains[i].projectAuditorId);
  4736. } else {
  4737. if (this.workForm.domains[i].taskGpIncharge == 0) {
  4738. this.$message({
  4739. message: "请指定项目审核人",
  4740. type: "error"
  4741. });
  4742. } else if (this.workForm.domains[i].taskGroups.length == 0) {
  4743. this.$message({
  4744. message: "您在["+this.workForm.domains[i].projectName+"]项目上尚无参与的任务分组",
  4745. type: "error"
  4746. });
  4747. }
  4748. return;
  4749. }
  4750. }
  4751. this.submitingReport = true;
  4752. this.http.uploadFile( this.port.report.editPort, formData,
  4753. res => {
  4754. this.listLoading = false;
  4755. this.submitingReport = false;
  4756. if (res.code == "ok") {
  4757. this.$message({
  4758. message: this.isDraft==0?"提交成功":"暂存成功",
  4759. type: "success"
  4760. });
  4761. this.dialogVisible = false;
  4762. this.jsDay = 0
  4763. this.jsTime = 0
  4764. this.getReportList();
  4765. this.getDepartment();
  4766. } else {
  4767. this.$message({
  4768. message: (this.isDraft==0?'提交失败:':'暂存失败:')+res.msg,
  4769. type: "error"
  4770. });
  4771. }
  4772. },
  4773. error => {
  4774. this.listLoading = false;
  4775. this.submitingReport = false;
  4776. this.$message({
  4777. message: error,
  4778. type: "error"
  4779. });
  4780. });
  4781. }
  4782. });
  4783. },
  4784. cli() {
  4785. },
  4786. // 判断是展示那个工时导入
  4787. imports() {
  4788. if(this.user.timeType.syncCorpwxTime == 0) {
  4789. this.importDialog = true
  4790. } else {
  4791. this.importWxDialog = true
  4792. }
  4793. },
  4794. // 跳转
  4795. junpToDeskTop(id) {
  4796. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  4797. this.$router.push("/desktop/" + id + "/" + this.date +day);
  4798. },
  4799. // 通过日报
  4800. approve(id, item) {
  4801. this.logining = true;
  4802. let day = (this.choseDay + 1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  4803. var ids = item.id;
  4804. // var data = item.data;
  4805. // data.forEach(element => {
  4806. // ids +=(element.id+',');
  4807. // });
  4808. this.http.post( this.port.report.approve, {id: id , date: this.date +day, reportIds: ids},
  4809. res => {
  4810. this.logining = false;
  4811. if (res.code == "ok") {
  4812. this.$message({
  4813. message: "审核成功",
  4814. type: "success"
  4815. });
  4816. this.getReportList();
  4817. this.getDepartment();
  4818. } else {
  4819. this.$message({
  4820. message: res.msg,
  4821. type: "error"
  4822. });
  4823. }
  4824. },
  4825. error => {
  4826. this.logining = false;
  4827. this.$message({
  4828. message: error,
  4829. type: "error"
  4830. });
  4831. });
  4832. },
  4833. //撤回日报
  4834. cancel(item) {
  4835. this.logining = true;
  4836. var ids = '';
  4837. var data = item.data;
  4838. data.forEach(element => {
  4839. ids +=(element.id+',');
  4840. });
  4841. this.http.post(this.port.report.cancelReport, {userId: this.user.id, reportIds: ids},
  4842. res => {
  4843. this.logining = false;
  4844. if (res.code == "ok") {
  4845. this.$message({
  4846. message:"撤回成功",
  4847. type: "success"
  4848. });
  4849. this.getReportList();
  4850. this.getDepartment();
  4851. } else {
  4852. this.$message({
  4853. message: res.msg,
  4854. type: "error"
  4855. });
  4856. }
  4857. },
  4858. error => {
  4859. this.logining = false;
  4860. this.$message({
  4861. message: error,
  4862. type: "error"
  4863. });
  4864. });
  4865. },
  4866. showDenyDialog(id,i, item) {
  4867. this.denyReasonDialog = true;
  4868. let day = (this.choseDay+1) > 9 ? "-" + (this.choseDay + 1) : "-0" + (this.choseDay + 1);
  4869. var ids = item.id;
  4870. // var data = item.data;
  4871. // data.forEach(element => {
  4872. // ids +=(element.id+',');
  4873. // });
  4874. this.denyForm = {id: id ,i:i, date: this.date +day, reportIds: ids, reason:null};
  4875. },
  4876. // 未通过日报
  4877. deny() {
  4878. this.logining = true;
  4879. this.http.post( this.port.report.deny, this.denyForm,
  4880. res => {
  4881. this.logining = false;
  4882. if (res.code == "ok") {
  4883. this.$message({
  4884. message: this.denyForm.i==0?"驳回成功":"撤销成功",
  4885. type: "success"
  4886. });
  4887. this.getReportList();
  4888. this.getDepartment();
  4889. this.denyReasonDialog = false;
  4890. } else {
  4891. this.$message({
  4892. message: res.msg,
  4893. type: "error"
  4894. });
  4895. }
  4896. },
  4897. error => {
  4898. this.logining = false;
  4899. this.$message({
  4900. message: error,
  4901. type: "error"
  4902. });
  4903. });
  4904. },
  4905. // 查看工时记录弹窗
  4906. toView() {
  4907. this.toViewDialogVisible = true
  4908. this.toViewloading = true
  4909. this.getToView()
  4910. },
  4911. getToView() {
  4912. this.http.post( '/report-import-log/getList', this.toViewForm,
  4913. res => {
  4914. this.toViewloading = false;
  4915. if (res.code == "ok") {
  4916. // console.log(res.data, '数据数据')
  4917. this.toViewList = res.data.records
  4918. this.toViewForm.total = res.data.total
  4919. } else {
  4920. this.toViewloading = false;
  4921. this.$message({
  4922. message: res.msg,
  4923. type: "error"
  4924. });
  4925. }
  4926. })
  4927. },
  4928. //分页
  4929. handleCurrentChange(val) {
  4930. this.toViewForm.pageIndex = val;
  4931. this.getToView();
  4932. },
  4933. handleSizeChange(val) {
  4934. this.toViewForm.pageSize = val;
  4935. this.getToView();
  4936. },
  4937. },
  4938. created() {
  4939. let height = window.innerHeight;
  4940. this.tableHeight = height - 178;
  4941. const that = this;
  4942. window.onresize = function temp() {
  4943. that.tableHeight = window.innerHeight - 178;
  4944. };
  4945. this.toViewForm.companyId = this.user.companyId
  4946. },
  4947. mounted() {
  4948. var now = new Date();
  4949. var t = util.formatDate.format(now, 'yyyy-MM-dd');
  4950. var startStr = util.formatDate.format(new Date(), 'yyyy-MM') + "-01";
  4951. this.exportParam.dateRange = [startStr,t];
  4952. this.getAllDate();
  4953. this.getReportList();
  4954. this.getProjectList();
  4955. this.getFillProjectList();
  4956. this.getTimeType();
  4957. this.getDepartment();
  4958. this.scrollFunction()
  4959. this.userssHu();
  4960. if (this.user.company.packageProject == 1) {
  4961. this.getBasecostItemList();
  4962. }
  4963. if(this.user.timeType.lockWorktime){
  4964. this.timeRange = this.timeRange.filter(item => {return item <= this.user.timeType.allday})
  4965. }
  4966. }
  4967. };
  4968. </script>
  4969. <style lang="scss" scoped>
  4970. .paginatis {
  4971. padding: 10px 10px;
  4972. background: #f2f2f2;
  4973. }
  4974. .waiting {
  4975. color:orange;
  4976. }
  4977. .filledReportStyle {
  4978. color:#32CD32;
  4979. }
  4980. .RejectStyle {
  4981. color:red;
  4982. }
  4983. .waitSubmitStyle{
  4984. color: #409eff;
  4985. }
  4986. .chooseDate {
  4987. .waiting {
  4988. color: #20a0ff;
  4989. }
  4990. .filledReportStyle {
  4991. color:#20a0ff;
  4992. }
  4993. .RejectStyle {
  4994. color: #20a0ff;
  4995. }
  4996. .waitSubmitStyle{
  4997. color: #20a0ff;
  4998. }
  4999. }
  5000. .allDaily {
  5001. width:82%;
  5002. }
  5003. .report_title {
  5004. padding:10px 0;
  5005. color:#666;
  5006. }
  5007. .clearfix {
  5008. overflow-x: auto;
  5009. white-space: nowrap;
  5010. padding: 15px 0 10px 0;
  5011. // overflow-y: hidden;
  5012. .date_item {
  5013. padding: 0 3px;
  5014. cursor: pointer;
  5015. position: relative;
  5016. }
  5017. .chooseDate {
  5018. position: absolute;
  5019. bottom: -3px;
  5020. width: 34px;
  5021. height: 2px;
  5022. left: 12px;
  5023. background: #20a0ff;
  5024. }
  5025. }
  5026. .one_daily {
  5027. i {
  5028. color: #9ed0ff;
  5029. margin-right: 5px;
  5030. }
  5031. .one_daily_body {
  5032. padding: 10px 0px;
  5033. p {
  5034. margin: 0;
  5035. line-height: 30px;
  5036. }
  5037. }
  5038. ul {
  5039. padding: 0;
  5040. }
  5041. }
  5042. .checkbtn {
  5043. float: right;
  5044. margin-top: -10px;
  5045. }
  5046. .selConStyle{
  5047. margin-top:9rem;
  5048. margin-bottom:11rem;
  5049. .selConStyle_title{
  5050. height: 3rem;
  5051. text-align: center;
  5052. font-size: 17px;
  5053. }
  5054. .el-select{
  5055. margin: 0 15%;
  5056. width: 70%;
  5057. }
  5058. }
  5059. </style>
  5060. <style lang="scss">
  5061. .daily {
  5062. .el-card__body {
  5063. height: 80%;
  5064. overflow-y: auto;
  5065. }
  5066. .el-card__header {
  5067. padding: 0 20px;
  5068. }
  5069. }
  5070. </style>
  5071. <style scoped>
  5072. /* 项目标签的样式 */
  5073. .el-tag + .el-tag {
  5074. margin-left: 10px;
  5075. }
  5076. .button-new-tag {
  5077. margin-left: 10px;
  5078. height: 32px;
  5079. line-height: 30px;
  5080. padding-top: 0;
  5081. padding-bottom: 0;
  5082. }
  5083. .input-new-tag {
  5084. width: 90px;
  5085. margin-left: 10px;
  5086. vertical-align: bottom;
  5087. }
  5088. .selectworktime .el-table__fixed-body-wrapper{
  5089. top: 48px !important;
  5090. }
  5091. .selectworktime_export .selectworktime_export_l{
  5092. width: 65%;
  5093. float: left;
  5094. height: 42px;
  5095. }
  5096. .approvalProcessBox{
  5097. margin-left: 30px;
  5098. font-size: 14px;
  5099. line-height: 16px;
  5100. cursor: pointer;
  5101. }
  5102. .approvalProcessBox i {
  5103. margin-right: 0;
  5104. height: 16px;
  5105. width: 16px;
  5106. display: inline-block;
  5107. transform: scale(1.2);
  5108. position: relative;
  5109. top: 0.5px;
  5110. color: #409eff;
  5111. }
  5112. .approvalProcessBox .approvalProcessClick{
  5113. cursor: pointer;
  5114. color: #409eff;
  5115. font-size: 14px;
  5116. }
  5117. .approvalProcessBox:hover .approvalProcessClick{
  5118. color: #3485fb;
  5119. }
  5120. </style>
  5121. <style lang="scss" scoped>
  5122. // 加班样式
  5123. .overtime {
  5124. display: inline-block;
  5125. margin-left: 20px;
  5126. input {
  5127. display: inline-block;
  5128. margin-top: 5px;
  5129. }
  5130. }
  5131. .plus {
  5132. display: inline-block;
  5133. }
  5134. // .tages {
  5135. // float: right;
  5136. // }
  5137. .overtime {
  5138. display: inline-block;
  5139. margin-left: 30px;
  5140. }
  5141. .bloks {
  5142. display: inline-block;
  5143. width: 380px;
  5144. }
  5145. .zhiss {
  5146. display: flex;
  5147. justify-content: space-around;
  5148. align-items: center;
  5149. }
  5150. .zhoFel {
  5151. display: flex;
  5152. justify-content: space-between;
  5153. align-items: center;
  5154. }
  5155. </style>