daily.vue 240 KB

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