daily.vue 234 KB

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