daily.vue 261 KB

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