index.vue 174 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461
  1. <template>
  2. <div class="editClss">
  3. <van-nav-bar :title="substitute ? '代填日报' : '填写日报'" left-text="返回" @click-left="back" fixed left-arrow />
  4. <van-form class="login_form" ref="loginForm">
  5. <div>
  6. <van-field readonly clickable right-icon="arrow" v-if="substitute"
  7. :value="fillingAgent.name" :label="'代填人员'" placeholder="请选择代填人员"
  8. @click="auditorShow = true">
  9. <template #input>
  10. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  11. :openid='fillingAgent.name'></TranslationOpenDataText></span>
  12. <span v-else>{{ fillingAgent.name }}</span>
  13. </template>
  14. </van-field>
  15. <van-cell >
  16. <van-field style="padding:0px" readonly clickable name="datetimePicker" :value="form.createDate" label="时间选择"
  17. placeholder="点击选择时间" @click="showPicker = true" :rules="rules.createDate" >
  18. </van-field>
  19. <template #right-icon>
  20. <!--先开放几家,试一下-->
  21. <span style="color:#20a0ff;" @click="getAIReport()" v-if="!substitute && !hasWrittenReport">智能填报</span>
  22. </template>
  23. </van-cell>
  24. <van-cell>
  25. <template #default>
  26. <div class="attendanceRecord">
  27. <template v-if="user.timeType.syncDingding == 1 || user.timeType.syncCorpwxTime == 1">
  28. <span>打卡:</span>
  29. <template v-if="user.companyId != 7536">
  30. <span v-if="!report.time">暂无考勤记录</span>
  31. <span v-else>{{ report.time.startTime }}-{{ report.time.endTime }}, 工作{{
  32. report.time.workHours }}h
  33. <span v-if="report.time.askLeaveTime">|&nbsp;请假{{ report.time.askLeaveTime
  34. }}h</span>
  35. <span v-if="report.time.otTime" style="color:#DAA520;">|&nbsp;加班{{ report.time.otTime
  36. }}h</span></span>
  37. </template>
  38. </template>
  39. <template v-if="user.companyId == 7536">
  40. <span v-if="!report.time">暂无考勤记录</span>
  41. <span v-else>工作{{
  42. report.time.workHours }}h
  43. <span v-if="report.time.askLeaveTime">|&nbsp;请假{{ report.time.askLeaveTime
  44. }}h</span>
  45. <span v-if="report.time.otTime" style="color:#DAA520;">|&nbsp;加班{{ report.time.otTime
  46. }}h</span></span>
  47. </template>
  48. <span style="margin-left:5px">总填报:</span>
  49. <span>{{ totalReportHours }}h</span>
  50. </div>
  51. </template>
  52. <template #right-icon>
  53. <template v-if="user.companyId != 7536">
  54. <van-button icon="replay" native-type="button" type="default" size="mini"
  55. style="height:0.6rem;padding:0 0.16667rem;" :loading="cardRefLoading" loading-size="0.26667rem"
  56. @click.stop.native="cardtimeRefresh(form.createDate)"
  57. v-if="!substitute && (user.timeType.syncDingding == 1 || user.timeType.syncCorpwxTime == 1)"></van-button>
  58. <van-button icon="replay" native-type="button" type="default" size="mini"
  59. style="height:0.6rem;padding:0 0.16667rem;" :loading="cardRefLoading" loading-size="0.26667rem"
  60. @click.stop.native="cardtimeRefresh(form.createDate, (fillingAgent.id || ''))"
  61. v-if="substitute && fillingAgent.name && (user.timeType.syncDingding == 1 || user.timeType.syncCorpwxTime == 1)"></van-button>
  62. </template>
  63. <template v-if="user.companyId == 7536">
  64. <van-button icon="replay" native-type="button" type="default" size="mini"
  65. style="height:0.6rem;padding:0 0.16667rem;" :loading="cardRefLoading" loading-size="0.26667rem"
  66. @click.stop.native="cardtimeRefreshTwo(form.createDate)"
  67. ></van-button>
  68. </template>
  69. </template>
  70. </van-cell>
  71. <!-- <div v-if="report.time" class="attendanceRecord">
  72. <i class="iconfont firerock-icondakajilu" style="font-size:0.35rem;margin-right:0.12rem"></i>
  73. <span v-if="user.timeType.syncDingding==1&&!report.time">暂无考勤记录</span>
  74. <span v-else>{{report.time.startTime}}-{{report.time.endTime}}, {{report.time.workHours}}小时</span>
  75. </div> -->
  76. </div>
  77. <van-popup v-model="showPicker" position="bottom">
  78. <van-datetime-picker v-model="currentDate" type="date" :min-date="minDate" :max-date="maxDate"
  79. @confirm="changeTime" @cancel="showPicker = false" />
  80. </van-popup>
  81. <van-cell title="总时长(h)" v-if="reportTimeType.type == 3">
  82. <template>
  83. <van-stepper :disabled="(!canEdit || user.timeType.lockWorktime == 1) && !isWeekend"
  84. v-model="form.totalDuration" @change="changeAllTime" min="0.5" :max="reportSettingsRow.maxReportTime || 12" step="0.5"
  85. :decimal-length="1" />
  86. </template>
  87. </van-cell>
  88. <!-- <van-cell title="待分配时长" :value="report.time + 'h'" size="large"></van-cell> -->
  89. <div class="form_domains" v-for="(item, index) in form.domains" :key="item.id">
  90. <div style="float:right;margin-top:10px;margin-right:10px;">
  91. <!-- <van-tag v-if="canEdit&&item.projectName.length>0" color="#fff"
  92. @click="copyProject(index)" style="border: 1px solid #20a0ff;padding:5px;"
  93. icon="plus" type="default" ><span style="color:#666;padding: 0 5px;">复制项目</span></van-tag> -->
  94. <!-- 扫码填报 -->
  95. <van-tag v-if="item.canEdit && user.companyId == 7536" color="#fff"
  96. @click="scanCodeToFillIn(index)" style="border: 1px solid #409eff;padding:5px;margin-left:10px;" icon="plus"
  97. type="default"><span style="color:#409eff;padding: 0 5px;">扫码填报</span>
  98. </van-tag>
  99. <!-- <van-tag v-if="item.canEdit && user.companyId == 7536" color="#fff"
  100. @click="determineQrcode(index)" style="border: 1px solid #409eff;padding:5px;margin-left:10px;" icon="plus"
  101. type="default"><span style="color:#409eff;padding: 0 5px;">扫码填报</span>
  102. </van-tag> -->
  103. <van-tag v-if="(index > 0 || form.domains.length > 1) && item.canEdit" color="#fff"
  104. @click="delPro(index)" style="border: 1px solid #ff0000;padding:5px;margin-left:10px;" icon="plus"
  105. type="default"><span style="color:#666;padding: 0 5px;">删除</span></van-tag>
  106. </div>
  107. <!-- <van-icon v-if="index>0&&canEdit" class="form_del" name="delete" @click="delPro(index)" /> -->
  108. <van-cell-group :title="(user.companyId == 781 ? '任务' : '项目') + (index + 1)">
  109. <van-field readonly name="userReportDeptName" v-if="user.timeType.userWithMultiDept == 1 && userReportDeptList.length > 0"
  110. :value="item.userReportDeptName" :label="'填报部门'" placeholder="请选择部门" :disabled="!item.canEdit" @click="selectDeptPopup(index, item)">
  111. <template #input>
  112. <TranslationOpenDataText type='departmentName' :openid='item.userReportDeptName'></TranslationOpenDataText>
  113. </template>
  114. </van-field>
  115. <!-- <div>请选择投入项目</div> -->
  116. <van-field readonly name="projectId" clickable :value="item.projectName" type="textarea" autosize
  117. :label="user.companyId == 781 ? '工作任务' : '投入项目'" :disabled="!item.canEdit" rows="1"
  118. :placeholder="user.companyId == 781 ? '请选择工作任务' : '请选择项目'" @click="clickPicker(index, item)"
  119. :rules="[{ required: true, message: user.companyId == 781 ? '请选择任务' : '请选择项目' }]" />
  120. <!--昱众不显示子项目-->
  121. <van-field readonly name="subProjectId" :disabled="!item.canEdit"
  122. v-if="user.companyId != yuzhongCompId && item.subProjectList != null && item.subProjectList.length > 0 && user.timeType.mainProjectState != 1"
  123. clickable :value="item.subProjectName" label="子项目" placeholder="请选择子项目"
  124. @click="clickPickSubProject(index, item)" />
  125. <van-popup v-model="item.showPickerSubProject" position="bottom">
  126. <van-picker show-toolbar :columns="item.subProjectList" value-key="name" @confirm="choseSubProject"
  127. @cancel="item.showPickerSubProject = false; $forceUpdate();" />
  128. </van-popup>
  129. <van-field readonly name="extraField1" v-if="user.companyId == yuzhongCompId" clickable
  130. :value="item.extraField1Name" label="角色选择" placeholder="请选择担任的角色" :disabled="!item.canEdit"
  131. @click="clickPickProjectRole(index, item)" />
  132. <van-popup v-model="item.showPickerRole" position="bottom">
  133. <van-picker show-toolbar :columns="roleList" value-key="label" @confirm="choseRole"
  134. @cancel="item.showPickerRole = false; $forceUpdate();" />
  135. </van-popup>
  136. <!--任务分组 -->
  137. <van-field readonly name="groupId" :disabled="!item.canEdit"
  138. v-if="user.company.packageProject == 1 && item.taskGroups != null && item.taskGroups.length > 0 && (user.company.nonProjectSimple==0 || (user.company.nonProjectSimple==1&& (item.projectId && (projectss.filter(p => p.id == item.projectId)[0] || {}).isPublic!=1)))"
  139. clickable :rules="[{ required: user.companyId == 3092 ? true : false, message: '请选择任务分组' }]"
  140. :value="item.groupName" label="任务分组" placeholder="请选择任务分组"
  141. @click="clickPickTaskGroup(index, item)" />
  142. <!-- <van-popup v-model="item.showPickerTaskGroup" position="bottom">
  143. <van-picker show-toolbar :columns="item.taskGroups" value-key="name" @confirm="choseTaskGroup"
  144. @cancel="item.showPickerTaskGroup = false; $forceUpdate();" />
  145. </van-popup> -->
  146. <van-popup v-model="item.showPickerTaskGroup" position="bottom" :style="{ height: '80vh' }" @click-overlay="item.showPickerTaskGroup = false;$forceUpdate();">
  147. <div class="groupingSelection">
  148. <div v-for="(taskItem, taskIndex) in item.taskGroups" :key="taskIndex" class="groupingSelectionItem" @click="choseTaskGroup(taskItem, taskIndex)">
  149. {{ taskItem.name }}
  150. </div>
  151. </div>
  152. </van-popup>
  153. <!--工作职责-->
  154. <van-field readonly name="extraField2" v-if="user.companyId == yuzhongCompId" clickable
  155. :value="item.extraField2Name" label="工作职责" placeholder="请选择工作职责" :disabled="!item.canEdit"
  156. @click="clickPickRespon(index, item)" />
  157. <van-popup v-model="item.showPickerRespon" position="bottom">
  158. <van-picker show-toolbar :columns="item.filteredRespList" value-key="jobRespon"
  159. @confirm="onResponseChosen" @cancel="item.showPickerRespon = false; $forceUpdate();" />
  160. </van-popup>
  161. <!--工作内容-->
  162. <van-field readonly name="extraField3" v-if="user.companyId == yuzhongCompId" clickable
  163. :value="item.extraField3Name" label="工作内容" placeholder="请选择工作内容" :disabled="!item.canEdit"
  164. @click="clickPickWorkContent(index, item)" />
  165. <van-popup v-model="item.showPickerWorkContent" position="bottom">
  166. <van-picker show-toolbar :columns="item.workContentList" value-key="workContext"
  167. @confirm="choseWorkContent" @cancel="item.showPickerWorkContent = false; $forceUpdate();" />
  168. </van-popup>
  169. <!--任务阶段 -->
  170. <van-field readonly name="stage" :disabled="!item.canEdit"
  171. v-if="user.companyId != yuzhongCompId && user.company.packageProject == 1 && !user.timeType.hideStages && item.stages != null && item.stages.length > 0"
  172. clickable :value="item.stage" label="投入阶段" placeholder="请选择投入阶段"
  173. @click="clickPickStage(index, item)" />
  174. <van-popup v-model="item.showPickerStage" position="bottom">
  175. <van-picker show-toolbar :columns="item.stages" value-key="stagesName" @confirm="choseStage"
  176. @cancel="item.showPickerStage = false; $forceUpdate();" />
  177. </van-popup>
  178. <template v-if="item.projectId && doYouWantToDisplayTheWorkOrder">
  179. <!-- 工单号 -->
  180. <van-field readonly name="stage" :disabled="!item.canEdit"
  181. v-if="user.timeType.reportExtraField4Name && doYouWantToDisplayTheWorkOrderGongdan"
  182. clickable :value="item.extraField4" :label="user.timeType.reportExtraField4Name" :placeholder="!item.canEdit ? '' : `请选择`" :right-icon="!item.canEdit ? '' : 'close'"
  183. @click-right-icon.stop="clearClickPickExtraField4(index, item)"
  184. @focus="clickPickExtraField4(index, item)" />
  185. <van-popup v-model="item.showPickerExtraField4" position="bottom" :close-on-click-overlay="false">
  186. <van-picker show-toolbar :columns="(item.reportExtraField4List || [])" value-key="stagesName" @confirm="choseExtraField4"
  187. @cancel="item.showPickerExtraField4 = false; $forceUpdate();" />
  188. </van-popup>
  189. <!-- 行号 -->
  190. <van-field readonly name="stage" :disabled="!item.canEdit"
  191. v-if="user.timeType.reportExtraField5Name"
  192. clickable :value="item.extraField5" :label="user.timeType.reportExtraField5Name" :placeholder="!item.canEdit ? '' : `请选择`"
  193. @focus="clickPickExtraField5(index, item)" />
  194. <van-popup v-model="item.showPickerExtraField5" position="bottom" :close-on-click-overlay="false">
  195. <van-picker v-if="item.showPickerExtraField5" show-toolbar :columns="(item.reportExtraField5List || [])" value-key="stagesName" @confirm="choseExtraField5" @cancel="item.showPickerExtraField5 = false; $forceUpdate();" />
  196. </van-popup>
  197. </template>
  198. <!-- 预算来源 -->
  199. <van-field readonly name="basecostId" :disabled="!item.canEdit"
  200. v-if="user.company.packageProject == 1 && reportBasecostList && reportBasecostList.length > 0"
  201. :value="item.basecostName" label="预算来源" placeholder="请选择预算来源"
  202. @click="clickPickCostId(index, item)" />
  203. <van-popup v-model="item.showPickerCostId" position="bottom">
  204. <van-picker show-toolbar :columns="reportBasecostList" value-key="name" @confirm="choseCostId"
  205. @cancel="item.showPickerCostId = false; $forceUpdate();" />
  206. </van-popup>
  207. <!-- 审核人 -->
  208. <template v-if="user.timeType.reportAuditType != 3">
  209. <van-field readonly name="projectAuditorId" :disabled="!item.canEdit"
  210. v-if="item.auditUserList != null && item.auditUserList.length > 0" clickable
  211. :value="item.projectAuditorName" :label="user.companyId == 781 ? '审核人' : '项目审核人'"
  212. placeholder="请选择审核人" @click="clickPickAuditor(index, item)">
  213. <template #input>
  214. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  215. :openid='item.projectAuditorName'></TranslationOpenDataText></span>
  216. <span v-else>{{ item.projectAuditorName }}</span>
  217. </template>
  218. </van-field>
  219. <van-popup v-model="item.showPickerAuditor" position="bottom">
  220. <van-picker show-toolbar :columns="item.auditUserList" value-key="auditorName"
  221. @confirm="choseAuditor" @cancel="item.showPickerAuditor = false; $forceUpdate();">
  222. <template #option="item">
  223. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  224. :openid='item.auditorName'></TranslationOpenDataText></span>
  225. <span v-else>{{ item.auditorName }}</span>
  226. </template>
  227. </van-picker>
  228. </van-popup>
  229. </template>
  230. <!-- 自选审批人 -->
  231. <template v-if="user.timeType.reportAuditType == 3">
  232. <van-field readonly clickable label="第一审核人" :disabled="!item.canEdit" @click="auditorClick(index, 'auditorFirst')">
  233. <template #input>
  234. <span v-if="!item.auditorFirst"></span>
  235. <span v-else-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  236. :openid='item.auditorFirst.name'></TranslationOpenDataText></span>
  237. <span v-else>{{ item.auditorFirst.name }}</span>
  238. </template>
  239. </van-field>
  240. <van-field readonly clickable label="第二审核人" :disabled="!item.canEdit" @click="auditorClick(index, 'auditorSec')"
  241. v-if="user.timeType.auditLevel > 1">
  242. <template #input>
  243. <span v-if="!item.auditorSec"></span>
  244. <span v-else-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  245. :openid='item.auditorSec.name'></TranslationOpenDataText></span>
  246. <span v-else>{{ item.auditorSec.name }}</span>
  247. </template>
  248. </van-field>
  249. <van-field readonly clickable label="第三审核人" :disabled="!item.canEdit" @click="auditorClick(index, 'auditorThird')"
  250. v-if="user.timeType.auditLevel > 2">
  251. <template #input>
  252. <span v-if="!item.auditorThird"></span>
  253. <span v-else-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  254. :openid='item.auditorThird.name'></TranslationOpenDataText></span>
  255. <span v-else>{{ item.auditorThird.name }}</span>
  256. </template>
  257. </van-field>
  258. <van-field readonly clickable label="抄送人" @click="auditorClick(index, 'ccUserid')">
  259. <template #input>
  260. <span v-if="!item.ccUserid"></span>
  261. <span v-else-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  262. :openid='item.ccUserid.name'></TranslationOpenDataText></span>
  263. <span v-else>{{ item.ccUserid.name }}</span>
  264. </template>
  265. </van-field>
  266. </template>
  267. <!-- 选人 -->
  268. <van-popup v-model="auditorShow" position="bottom">
  269. <van-search v-model="auditor.searchText" placeholder="输入员工姓名搜索" @search="onSearch"
  270. v-if="user.userNameNeedTranslate != '1'"></van-search>
  271. <div style="minHeight:300px;">
  272. <van-radio-group v-model="auditor.item">
  273. <van-radio v-for="uitem in auditor.searchList" :key="uitem.id" :name="uitem"
  274. style="padding:10px">
  275. <span v-if="user.userNameNeedTranslate == '1'"><TranslationOpenDataText type='userName'
  276. :openid='uitem.name'></TranslationOpenDataText></span>
  277. <span v-else>{{ uitem.name ? uitem.name : '' }}</span>
  278. </van-radio>
  279. </van-radio-group>
  280. <van-button style="width:100%;position: -webkit-sticky;position: sticky;bottom: 0;"
  281. @click="searchAuditor()">确定</van-button>
  282. </div>
  283. </van-popup>
  284. <!-- 相关维度 -->
  285. <van-field :value="item.weiduName" v-if="item.projectId && user.timeType.customDegreeActive == 1"
  286. readonly name="id" clickable :label="user.timeType.customDegreeName" placeholder="请选择"
  287. @click="clickPickers(index, item)" :disabled="!item.canEdit" />
  288. <!-- <van-popup v-model="item.showPickDegree" position="bottom">
  289. <van-picker show-toolbar :columns="item.wuduList" value-key="name" @confirm="choseProjects"
  290. @cancel="item.showPickDegree = false; $forceUpdate()" />
  291. </van-popup> -->
  292. <van-popup v-model="item.showPickDegree" position="bottom">
  293. <div class="chooseSomeone">
  294. <div class="chooseSomeoneFlex1">
  295. <!-- 复选 -->
  296. <van-radio-group v-model="item.radioPickDegree" v-if="!user.timeType.customDegreeMultiple">
  297. <van-radio v-for="uitem in item.wuduList" :key="uitem.id" :name="uitem" style="padding:10px">
  298. {{ uitem.name ? uitem.name : '' }}
  299. </van-radio>
  300. </van-radio-group>
  301. <!-- 多选 -->
  302. <van-checkbox-group v-model="item.radioPickDegree" v-else>
  303. <van-checkbox v-for="uitem in item.wuduList" :key="uitem.id" :name="uitem" style="padding:10px">
  304. {{ uitem.name ? uitem.name : '' }}
  305. </van-checkbox>
  306. </van-checkbox-group>
  307. </div>
  308. <van-button @click="choseProjects(item.radioPickDegree)">
  309. 确定
  310. </van-button>
  311. </div>
  312. </van-popup>
  313. <!-- 自定义数值 -->
  314. <van-field v-if="user.timeType.customDataActive == 1" type="number" :disabled="!item.canEdit"
  315. v-model="item.customData" :label="user.timeType.customDataName" placeholder="请输入数字"
  316. :rules="user.timeType.customDataStatus == 1 ? [{ required: true, message: '请输入' + user.timeType.customDataName }] : []"></van-field>
  317. <!-- 自定义文本 -->
  318. <van-field v-if="user.timeType.customTextActive == 1" :disabled="!item.canEdit"
  319. v-model="item.customText" :label="user.timeType.customTextName" placeholder="请输入" maxlength="1000"
  320. :rules="user.timeType.customTextStatus ? [{ required: true, message: '请选择' + user.timeType.customTextName }] : []"
  321. rows="2" type="textarea" show-word-limit autosize></van-field>
  322. <van-cell title="专业进度" v-if="user.company.packageEngineering == 1">
  323. </van-cell>
  324. <van-field :disabled="!item.canEdit" type="number" :name="'progress_' + pItem.professionId"
  325. input-align="right" v-for="pItem in item.professionProgress" :key="pItem.professionId"
  326. :label="'-- ' + pItem.professionName">
  327. <template slot="input">
  328. <van-stepper v-model="pItem.progress" integer min="0" max="100" />%
  329. </template>
  330. </van-field>
  331. <van-field v-if="user.company.packageProject == 1 && !user.timeType.hideTask && (user.company.nonProjectSimple==0 || (user.company.nonProjectSimple==1&& (item.projectId && (projectss.filter(p => p.id == item.projectId)[0] || {}).isPublic!=1)))" readonly name="taskId" :value="item.taskName"
  332. :rules="[{ required: reportTimeType.taskRequired? true : false, message: '请选择任务/里程碑' }]" label="任务/里程碑" :disabled="!item.canEdit"
  333. placeholder="请选择任务/里程碑" @click="clickPickerTask(index, item)"></van-field>
  334. <van-field v-if="user.companyId == 3092" readonly name="sapServiceId" :value="item.sapServiceName"
  335. :rules="[{ required: true, message: '请选择服务' }]" label="服务" placeholder="请选择服务"
  336. @click="clickPickerService(index, item)"></van-field>
  337. <van-field name="taskFinish" label="是否已完成" v-if="item.taskId != null">
  338. <template #input>
  339. <van-checkbox :disabled="!item.canEdit" v-model="item.taskFinish"
  340. shape="square">已完成</van-checkbox>
  341. </template>
  342. </van-field>
  343. <van-popup v-model="item.showPickerTask" position="bottom">
  344. <van-picker show-toolbar :columns="item.taskList" value-key="taskName" @confirm="choseTask"
  345. @cancel="item.showPickerTask = false; $forceUpdate()" />
  346. </van-popup>
  347. <van-popup v-model="item.showPickerService" position="bottom">
  348. <van-picker show-toolbar :columns="item.serviceList" value-key="serviceName" @confirm="choseService"
  349. @cancel="item.showPickerService = false; $forceUpdate()" />
  350. </van-popup>
  351. <!-- <van-field readonly clickable class="form_input" :value="item.workingTime" name="workingTime" label="工作时长" placeholder="请输入工作时长(单位:小时)"
  352. :rules="[{ required: true, message: '请输入工作时长(单位:小时)' }]" @touchstart.native.stop="showNumberKey = true"/>
  353. <van-number-keyboard v-model="item.workingTime" :show="showNumberKey" close-button-text="完成" extra-key="." :maxlength="4" @blur="showNumberKey = false" /> -->
  354. <!-- 常规选择时间的方式 -->
  355. <!-- 全天上下午模式 -->
  356. <div v-if="reportTimeType.multiWorktime == 0 && (!hideWorkingHours || (hideWorkingHours && item.canEdit)) ">
  357. <van-field v-if="reportTimeType.type < 2" readonly clickable :disabled="!item.canEdit"
  358. :value="reportTimeType.type == 0 ? item.label : (parseFloat(item.workingTime).toFixed(1) + 'h')"
  359. label="工作时长" placeholder="请选择工作时长(小时)" @click="clickTimePicker(index, item)"
  360. :rules="[{ required: true, message: '请选择工作时长' }]" />
  361. <van-popup v-model="showPickerTime" position="bottom">
  362. <van-picker show-toolbar :columns="timeType" value-key="label" @confirm="choseTimePick"
  363. @cancel="showPickerTime = false" />
  364. </van-popup>
  365. <!-- 选择数字时间长度模式 -->
  366. <van-popup v-model="showPickerHours" position="bottom">
  367. <van-picker show-toolbar :columns="timeRange" :default-index="15" @confirm="choseTimePick"
  368. @cancel="showPickerHours = false" />
  369. </van-popup>
  370. <!-- 时间段选择模式 -->
  371. <van-field readonly v-if="reportTimeType.type == 2" clickable name="datetimePicker"
  372. :value="item.startTime" label="开始时间" placeholder="点击选择时间"
  373. @click="item.canEdit ? showStartTime = true : '', dailyIndex = index" :disabled="!item.canEdit"
  374. :rules="[{ required: true, message: '请选择开始时间' }]" />
  375. <van-popup v-model="showStartTime" position="bottom">
  376. <van-datetime-picker v-model="startTime" type="time" @confirm="confirmTime(item, 0);"
  377. @cancel="showStartTime = false" :min-hour="0" :max-hour="23" />
  378. <!-- :filter="filter" 原本这个属性在里面 -->
  379. </van-popup>
  380. <van-field v-if="reportTimeType.type == 2" readonly clickable name="datetimePicker"
  381. :value="item.endTime" label="结束时间" placeholder="点击选择时间"
  382. @click="item.canEdit ? showEndTime = true : '', dailyIndex = index" :disabled="!item.canEdit"
  383. :rules="[{ required: true, message: '请选择结束时间' }]" />
  384. <van-popup v-model="showEndTime" position="bottom">
  385. <van-datetime-picker v-model="endTime" type="time" :min-hour="0" :max-hour="23"
  386. @confirm="confirmTime(item, 1)" @cancel="showEndTime = false" />
  387. <!-- :filter="filter" 原本这个属性在里面 -->
  388. </van-popup>
  389. <van-cell v-if="reportTimeType.type == 3">
  390. <template>
  391. <div>
  392. <span>用时占比</span>
  393. <van-slider :disabled="!item.canEdit" :min="0" :step="5"
  394. style="width:120px;display:inline-block;margin-left:50px;" v-model="item.progress"
  395. :value="100"
  396. @change="item.workingTime = (reportTimeType.allday * item.progress / 100).toFixed(1), setTotalReportHours()">
  397. <template #button>
  398. <div class="custom-button">{{ item.progress }}%</div>
  399. </template>
  400. </van-slider>
  401. <span style="margin-left:10px;float:right;">{{ item.workingTime }}小时</span>
  402. </div>
  403. </template>
  404. </van-cell>
  405. <van-field class="form_input" :disabled="!item.canEdit" v-model="item.content" name="content"
  406. type="textarea" :label="user.companyId == 781 ? '具体内容与结果' : '工作事项'" placeholder="请输入"
  407. :rules="user.timeType.workContentState == 1 ? [{ required: true, message: '请填写工作事项' }] : null"
  408. rows="3" autosize />
  409. </div>
  410. <!-- 多个时间和工作事项的选择方式 -->
  411. <div v-if="reportTimeType.multiWorktime == 1 && (!hideWorkingHours || (hideWorkingHours && item.canEdit))">
  412. <div v-for="(timeItem, tindex) in item.worktimeList" :key="tindex"
  413. style="position:relative;border:#ccc 0.5px solid;margin:7px;">
  414. <van-tag v-if="tindex > 0 && item.canEdit"
  415. style="position:absolute; right:-7px;top:-7px;z-index:10;"
  416. @click="removeTimeItem(item, tindex)">X</van-tag>
  417. <!-- 时间段选择模式 -->
  418. <van-field readonly v-if="reportTimeType.type == 2" :clickable="item.canEdit"
  419. name="datetimePicker" :value="timeItem.startTime" label="开始时间" placeholder="点击选择时间"
  420. :rules="[{ required: true, message: '必填项' }]"
  421. @click="item.canEdit ? showStartDialog(timeItem) : ''" />
  422. <van-field v-if="reportTimeType.type == 2" readonly :clickable="canEdit" name="datetimePicker"
  423. :value="timeItem.endTime" label="结束时间" placeholder="点击选择时间"
  424. :rules="[{ required: true, message: '必填项' }]"
  425. @click="item.canEdit ? showEndDialog(timeItem) : ''" />
  426. <van-field v-if="multiOptionData.length>0 && user.canFillMoreOption" readonly :clickable="canEdit" name="multiTimePicker"
  427. :value="timeItem.detail" label="细项" placeholder="点击选择"
  428. :rules="[{ required: true, message: '必填项' }]"
  429. @click="item.canEdit ? showChooseDetail(timeItem) : ''" />
  430. <!-- 工作细项, 美莱德 -->
  431. <van-popup v-model="showMultiOpPicker" position="bottom">
  432. <van-picker show-toolbar :columns="multiOptionData" :default-index="1" @confirm="choseMultiOptionPick"
  433. @cancel="showMultiOpPicker = false" />
  434. </van-popup>
  435. <van-field class="form_input" :disabled="!item.canEdit"
  436. style="color:#333;-webkit-text-fill-color:#646566;" v-model="timeItem.content"
  437. name="content" type="textarea" label="工作事项" placeholder="请输入工作事项"
  438. :rules="user.timeType.workContentState == 1 ? [{ required: true, message: '请填写工作事项' }] : null"
  439. rows="1" autosize />
  440. </div>
  441. <!--时间选择器 , 做统一处理,不能放到循环里,不然会有多个公用showStartTime,最后一个会现在最上层UI,导致BUG -->
  442. <van-popup v-model="showWorkStartTime" position="bottom">
  443. <van-datetime-picker v-model="startTime" type="time" @confirm="confirmWorkTime(0);"
  444. @cancel="showWorkStartTime = false" :min-hour="0" :max-hour="23" />
  445. <!-- :filter="filter" 原本这个属性在里面 -->
  446. </van-popup>
  447. <van-popup v-model="showWorkEndTime" position="bottom">
  448. <van-datetime-picker v-model="endTime" type="time" :min-hour="0" :max-hour="23"
  449. @confirm="confirmWorkTime(1)" @cancel="showWorkEndTime = false" />
  450. <!-- :filter="filter" 原本这个属性在里面 -->
  451. </van-popup>
  452. </div>
  453. <div style="width:100%;" v-if="item.canEdit && reportTimeType.multiWorktime == 1">
  454. <van-tag style="text-align:center;padding:5px;margin-left:15px;border: 1px solid #20a0ff;"
  455. :disabled="!item.canEdit" @click="addNewWorktime(index, item)" icon="plus" color="#ffffff"><span
  456. style="color:#999;text-align:center;padding: 0 5px;"> 添加工时 </span></van-tag>
  457. </div>
  458. <div class="overtime"
  459. v-if="((user.timeType.fillOvertime || (isWeekend && user.timeType.lockWorktime != 1)) || (isCorpWX && canEdit)) && (!hideWorkingHours || (hideWorkingHours && item.canEdit))">
  460. <div class="overTimeClas"
  461. v-if="user.timeType.fillOvertime || (isWeekend && user.timeType.lockWorktime != 1)">
  462. <van-checkbox :disabled="!item.canEdit" v-model="item.isOvertime"
  463. style="width: 4.3rem;">含加班</van-checkbox>
  464. <van-field v-model="item.overtimeHours" type="number"
  465. :disabled="!item.canEdit || item.isOvertime == null || item.isOvertime == 0 || !item.isOvertime"
  466. placeholder="请输入加班时长" style="width: 5.2rem" @input="$forceUpdate()"></van-field>
  467. <span :class="item.canEdit ? 'overListTime' : 'overListTime hoveOver'">小时</span>
  468. </div>
  469. <van-tag style="position:absolute;right:10px;" v-if="user.companyId != 4281 && isCorpWX && item.canEdit" type="primary"
  470. size="large" @click="takePhoto(index)">拍照上传</van-tag>
  471. <!-- <van-tag style="position:absolute;right:10px;" type="primary" size="large" @click="takePhoto(index)">拍照上传</van-tag> -->
  472. <!-- <van-tag style="position:absolute;right:10px;" type="primary" size="large" @click="takePhoto(index)">拍照上传</van-tag> -->
  473. </div>
  474. <div style="padding:5px;text-align:center;" v-if="!isIOSystem">
  475. <span v-for="(p, index) in item.pics" :key="p" style="margin-right:15px;">
  476. <div class="imgList">
  477. <van-icon v-if="item.canEdit && user.companyId == 7" size="20" name="clear"
  478. @click="deleteImg(item, index)" class="imgList_i" />
  479. <img :src="p" style="width:100px; height:100px;" @click="showLargeImg(item.pics, index)" />
  480. </div>
  481. </span>
  482. </div>
  483. <div style="padding:5px;text-align:center;" v-if="isIOSystem">
  484. <span v-for="(p, index) in item.iospics" :key="p" style="margin-right:15px;">
  485. <div class="imgList">
  486. <van-icon v-if="item.canEdit && user.companyId == 7" size="20" name="clear"
  487. @click="deleteImg(item, index)" class="imgList_i" />
  488. <img :src="p" style="width:100px; height:100px;"
  489. @click="showLargeImg(item.iospics, index)" />
  490. </div>
  491. </span>
  492. </div>
  493. <van-popup v-model="imgShow" position="bottom" closeable>
  494. <van-swipe class="my-swipe" indicator-color="white">
  495. <van-swipe-item v-for="(picItem, index) in tmpPics" :key="index">
  496. <img :src="picItem" style="width:100%;" />
  497. </van-swipe-item>
  498. </van-swipe>
  499. </van-popup>
  500. </van-cell-group>
  501. </div>
  502. <div style="text-align:center;" v-if="showAddMore">
  503. <template v-if="reportSettingsRow.type != 3">
  504. <van-tag size="large"
  505. style="text-align:center;margin:10px;padding:12px;margin-bottom:120px;border: 1px solid #20a0ff;"
  506. @click="addNewPro" icon="plus" color="#ffffff">
  507. <span style="color:#999;text-align:center;padding: 0 50px;"> + 新增{{ user.companyId == 781 ? '任务' : '项目' }}</span>
  508. </van-tag>
  509. </template>
  510. <template v-if="reportSettingsRow.type == 3 && canEdit">
  511. <van-tag size="large"
  512. style="text-align:center;margin:10px;padding:12px;margin-bottom:120px;border: 1px solid #20a0ff;"
  513. @click="addNewPro" icon="plus" color="#ffffff">
  514. <span style="color:#999;text-align:center;padding: 0 50px;"> + 新增{{ user.companyId == 781 ? '任务' : '项目' }}</span>
  515. </van-tag>
  516. </template>
  517. <!-- <van-button id="btn-start-recording" @click="startRecording">录音</van-button>
  518. <van-button id="btn-stop-recording" @click="stopRecording">停止</van-button>
  519. <van-button id="btn-play-recording" @click="getRecording">获取文件</van-button> -->
  520. </div>
  521. <div class="form_btn" style="position:fixed; bottom:0px;width:100%;">
  522. <div style="padding-bottom:10px;" v-if="!substitute">
  523. <van-button v-if="canEdit" square block type="info" @click="isDraft = 0; submitReport()"
  524. native-type="submit" style="width: 50%;float:left;">
  525. <div v-if="flgLg">提交</div>
  526. <van-loading type="spinner" v-if="!flgLg" />
  527. </van-button>
  528. <van-button v-if="canEdit" square block type="default" @click="isDraft = 1; submitReport()"
  529. native-type="submit" style="width:50%;float:left;">
  530. <div v-if="flgLg">暂存</div>
  531. <van-loading type="spinner" v-if="!flgLg" />
  532. </van-button>
  533. </div>
  534. <div style="padding-bottom:10px;" v-if="substitute">
  535. <van-button v-if="canEdit" square block type="info" @click="isDraft = 0; submitReport()"
  536. native-type="submit">
  537. <div v-if="flgLg">提交</div>
  538. <van-loading type="spinner" v-if="!flgLg" />
  539. </van-button>
  540. </div>
  541. <van-button v-if="canDeleteReport" square block type="default" @click="deleteReport" native-type="button"
  542. style=""> 删除 </van-button>
  543. <van-button v-if="canCancelInDialog" block type="default" @click="cancel"> 撤回 </van-button>
  544. <!-- <div v-if="canEdit&&form.domains.length>0 && form.domains[0].id != null"
  545. style="display:block;padding-top:30px;font-size:15px;color:#666;margin:0 auto;text-align:center;padding-bottom:10px;background:#ffffff;"
  546. @click="deleteReport"> 删除 </div> -->
  547. <!-- <van-button v-if="canEdit" square block type="default" @click="deleteReport" native-type="button"
  548. style="margin-top:10px;"> 删除 </van-button> -->
  549. </div>
  550. </van-form>
  551. <div class="form_tip" v-if="!canEdit && !canCancel"> 已审核无法修改 </div>
  552. <!-- 选择项目弹窗 -->
  553. <van-popup v-model="showPickerUserddp" position="bottom" style="height: 84%">
  554. <div class="popupDiv">
  555. <!-- <van-search v-model="userName" placeholder="请输入项目名称/编号" @clear="sea()" @blur="sea()" @search="sea()" @input="sea()"/> -->
  556. <div class="popupSearch">
  557. <van-search v-model="userName" shape="round" background="#F4F4F4" placeholder="请输入项目名称/编号"
  558. @clear="sea()" @blur="sea()" @search="sea()" @input="sea()" />
  559. </div>
  560. <div class="popupCon">
  561. <!-- <div class="ryuan" style="color: rgb(185 185 185);">近期选择项目</div>
  562. <div v-for="(item, index) in integrationProjectList" :key="index" class="ryuan" @click="fZr(item, index)">
  563. <p>{{item.projectName}}</p>
  564. <p style="margin-top: 5px;color: #9697B2;">{{item.projectCode}}</p>
  565. </div>
  566. <div class="ryuan" style="color: rgb(185 185 185);">全部项目</div>
  567. <div v-for="(item, index) in projectss" :key="item.id" class="ryuan" @click="fZr(item, index)">
  568. <p>{{item.projectName}}</p>
  569. <p style="margin-top: 5px;color: #9697B2;">{{item.projectCode}}</p>
  570. </div> -->
  571. <div class="popupTitle">近期选择项目</div>
  572. <div v-for="(item, index) in integrationProjectList" :key="index" class="popupItem paddingDiv"
  573. @click="fZr(item, index)">
  574. <div class="popupItemOne" v-if="item.projectName">{{ item.projectName }}</div>
  575. <p class="popupItemTwo" v-if="item.projectCode">{{ item.projectCode }}</p>
  576. </div>
  577. <div class="popupTitle marginTop">全部项目</div>
  578. <div v-for="(item, index) in projectss" :key="item.id" class="popupItem paddingDiv"
  579. @click="fZr(item, index)">
  580. <div class="popupItemOne" v-if="item.projectName">{{ item.projectName }}</div>
  581. <p class="popupItemTwo" v-if="item.projectCode">{{ item.projectCode }}</p>
  582. </div>
  583. <!-- <div class="popupTitle paddingDiv">全部项目</div> -->
  584. </div>
  585. </div>
  586. </van-popup>
  587. <van-popup v-model="showSelectDeptPopup" position="bottom" style="height: 84%">
  588. <div class="popupDiv">
  589. <div class="popupCon">
  590. <div v-for="(item, index) in userReportDeptList" :key="item.value" class="popupItem paddingDiv"
  591. @click="selectedDeptId(item, index)">
  592. <p class="popupItemOne">
  593. <TranslationOpenDataText type='departmentName' :openid='item.departmentName'></TranslationOpenDataText>
  594. </p>
  595. </div>
  596. </div>
  597. </div>
  598. </van-popup>
  599. <!-- 扫码 -->
  600. <div class="qrcodeClass" v-if="showQrcode">
  601. <Qrcode @closeQrcode="closeQrcode" @determineQrcode="determineQrcode" />
  602. </div>
  603. </div>
  604. </template>
  605. <script>
  606. import timetoolVue from '../timetool/timetool.vue';
  607. import Qrcode from '../../components/qrcode.vue'
  608. // Vue.prototype.$wx = wx
  609. // import { Recorder } from '../../assets/record/recorder'
  610. // var recorder = null
  611. export default {
  612. components: { Qrcode },
  613. data() {
  614. return {
  615. roleList: [{ value: 1, label: 'CRC&LM' }, { value: 2, label: 'PM' }],
  616. jobResponseList: [],
  617. yuzhongCompId: 3385,
  618. dailyIndex: 0,
  619. showQrcode: false,
  620. integrationProjectList: [],
  621. cardRefLoading: false,
  622. today: '',
  623. hasWrittenReport: false,
  624. showPickerStage: false,
  625. showPickerTaskGroup: false,
  626. showPickerSubProject: false,
  627. showPickerCostId: false,
  628. isDraft: 0,
  629. showWorkStartTime: false,
  630. showWorkEndTime: false,
  631. curWorktime: null,
  632. isIOSystem: false,
  633. imgShow: false,
  634. isCorpWX: false,
  635. isWX: false,
  636. showPickerTask: false,
  637. canCancel: false,
  638. canDeleteReport: false,
  639. canCancelInDialog: false,
  640. canEdit: false,
  641. showEndTime: false,
  642. showStartTime: false,
  643. startTime: '09:00',
  644. endTime: '18:00',
  645. nowTime: new Date(),
  646. showPickerHours: false,
  647. timeRange: [],
  648. selectTime: null,
  649. reportTimeType: {},
  650. user: JSON.parse(localStorage.userInfo),
  651. minDate: new Date(2010, 0, 1),
  652. maxDate: new Date(),
  653. currentDate: new Date(),
  654. showPickerTime: false,
  655. showPicker: false,
  656. showPickerProject: false,
  657. showPickDegree: false,
  658. clickIndex: 0,
  659. clickTimeIndex: 0,
  660. showNumberKey: false,
  661. canClick: 2,
  662. timeType: [],
  663. form: {
  664. createDate: this.format(new Date(new Date()), "yyyy-MM-dd"),
  665. totalDuration: 8,
  666. domains: [{
  667. id: null,
  668. projectId: "",
  669. projectName: "",
  670. workingTime: "0",
  671. content: "",
  672. state: 2,
  673. multiWorktime: 0,
  674. worktimeList: {},
  675. degreeId: '',
  676. extraField4: '',
  677. extraField5: '',
  678. // pics:["https://worktime.ttkuaiban.com/upload/bc4df504fa724e6cab69872e2c1cfb35.png",
  679. // "https://worktime.ttkuaiban.com/upload/bc4df504fa724e6cab69872e2c1cfb35.png",
  680. // "https://worktime.ttkuaiban.com/upload/bc4df504fa724e6cab69872e2c1cfb35.png",]
  681. }],
  682. },
  683. rules: {
  684. createDate: [{ required: true, message: '请选择填报日期' }],
  685. },
  686. project: [],
  687. report: {},
  688. showMultiOpPicker: false,
  689. loading: false,
  690. finished: false,
  691. // isOvertime: false
  692. tmpPics: [],
  693. dateAr: [],
  694. showPickerUserddp: false, // 选择项目弹窗
  695. projectss: [],
  696. proads: [],
  697. userName: '',
  698. flgLg: true,
  699. reportBasecostList: [],
  700. isWeekend: false,
  701. multiOptionData:[],
  702. auditorShow: false,
  703. auditor: {
  704. index: 0,
  705. auditorIndex: 'auditorFirst',
  706. searchText: '',
  707. item: {},
  708. list: [],
  709. searchList: []
  710. },
  711. // vacationTime: {},
  712. totalReportHours: 0,
  713. // leftDataList:[],
  714. // rightDataList:[],
  715. substitute: false, // 是否为代填日报
  716. fillingAgent: {
  717. name: '',
  718. id: ''
  719. }, // 代填人员信息
  720. userReportDeptList: [], // 可选部门
  721. showSelectDeptPopup: false,
  722. showAddMore: false,
  723. businessTripsArray: [],
  724. doYouWantToDisplayTheWorkOrder: true,
  725. doYouWantToDisplayTheWorkOrderGongdan: true,
  726. hideWorkingHours: false,
  727. reportSettingsRow: {},
  728. };
  729. },
  730. created() {
  731. },
  732. watch: {},
  733. computed: {
  734. // totalReportHours(){
  735. // let domains = this.form.domains
  736. // let hours = 0
  737. // for(let i in domains){
  738. // if(domains[i].projectId){
  739. // // hours += parseFloat(domains[i].workingTime)
  740. // if(this.reportTimeType.multiWorktime == 1){
  741. // for(let m in domains[i].worktimeList){
  742. // if(domains[i].worktimeList[m].startTime && domains[i].worktimeList[m].endTime){
  743. // hours += this.getHour(domains[i].worktimeList[m].startTime, domains[i].worktimeList[m].endTime)
  744. // }
  745. // }
  746. // }else{
  747. // if(this.user.timeType.type == 2){
  748. // if(domains[i].startTime && domains[i].endTime){
  749. // let selectionTime = this.getHour(domains[i].startTime, domains[i].endTime)
  750. // let subtractedData = 0
  751. // let arr = JSON.parse(JSON.stringify(this.vacationTime))
  752. // arr.unshift({s: domains[i].startTime, e: domains[i].endTime})
  753. // for(var j in arr) {
  754. // subtractedData += +this.timeOverlap(j, arr)
  755. // }
  756. // console.log(selectionTime, subtractedData)
  757. // hours += +selectionTime - +subtractedData
  758. // console.log(hours)
  759. // }
  760. // } else {
  761. // hours += domains[i].workingTime ? parseFloat(domains[i].workingTime) : 0
  762. // }
  763. // }
  764. // }
  765. // }
  766. // return hours.toFixed(2)
  767. // },
  768. },
  769. methods: {
  770. scanCodeToFillIn(index) {
  771. this.clickIndex = index
  772. this.showQrcode = true
  773. },
  774. closeQrcode() {
  775. this.showQrcode = false
  776. },
  777. determineQrcode(val) {
  778. // this.clickIndex = val
  779. // const { line, orderId, projectId, projectName, trueProjectId } = JSON.parse(`{"id":1,"line":1,"orderId":"MO-2021-08-0004","projectId":"HH-EQ-2101003","projectName":"行走轴样机","status":4,"trueProjectId":"642188"}`)
  780. // const { line, orderId, projectId, projectName, trueProjectId } = JSON.parse(localStorage.getItem('scanTheCode') || `{}`)
  781. const { line, orderId, projectId, projectName, trueProjectId } = JSON.parse(val || '{}')
  782. if(!trueProjectId) {
  783. this.$toast.fail(`请扫描正确的二维码`);
  784. return
  785. }
  786. if(!this.form.domains[this.clickIndex].canEdit) {
  787. this.$toast.fail(`待审核的日报扫码无效`);
  788. return
  789. }
  790. const projectList = this.projectss || []
  791. console.log(projectList, '<==== projectList')
  792. console.log(trueProjectId, '<==== trueProjectId')
  793. const rows = projectList.filter(item => item.id == trueProjectId)
  794. if(rows.length <= 0) {
  795. this.$toast.fail(`暂未参与该项目`);
  796. return
  797. }
  798. this.closeQrcode()
  799. this.form.domains[this.clickIndex] = {
  800. ...this.form.domains[this.clickIndex],
  801. extraField4: orderId,
  802. extraField5: line,
  803. projectName: projectName,
  804. projectId: trueProjectId,
  805. };
  806. const { reportExtraField4Name, reportExtraField5Name } = this.user.timeType
  807. const item = { id: trueProjectId, projectName: projectName, projectCode: projectId }
  808. this.fZr(item, this.scanCodeIndex, true)
  809. if(reportExtraField4Name || reportExtraField5Name) {
  810. this.getInfoByProjectId(item.projectCode, this.clickIndex, false)
  811. }
  812. },
  813. //选中角色
  814. choseRole(value, index) {
  815. if (value) {
  816. this.form.domains[this.clickIndex].extraField1 = value.value;
  817. this.form.domains[this.clickIndex].extraField1Name = value.label;
  818. }
  819. this.form.domains[this.clickIndex].showPickerRole = false;
  820. this.updateResponse(this.form.domains[this.clickIndex]);
  821. this.$forceUpdate();
  822. },
  823. choseWorkContent(value, index) {
  824. if (value) {
  825. this.form.domains[this.clickIndex].extraField3 = value.id;
  826. this.form.domains[this.clickIndex].extraField3Name = value.workContext;
  827. }
  828. this.form.domains[this.clickIndex].showPickerWorkContent = false;
  829. this.$forceUpdate();
  830. },
  831. onResponseChosen(value, index) {
  832. if (value) {
  833. this.form.domains[this.clickIndex].extraField2 = value.id;
  834. this.form.domains[this.clickIndex].extraField2Name = value.jobRespon;
  835. this.form.domains[this.clickIndex].extraField3 = null;
  836. this.form.domains[this.clickIndex].extraField3Name = null;
  837. }
  838. this.form.domains[this.clickIndex].showPickerRespon = false;
  839. this.updateJobContent(this.form.domains[this.clickIndex]);
  840. },
  841. clickPickWorkContent(i, item) {
  842. if (!item.canEdit) return;
  843. this.clickIndex = i;
  844. item.showPickerWorkContent = true;
  845. this.$forceUpdate();
  846. },
  847. clickPickRespon(i, item) {
  848. if (!item.canEdit) return;
  849. this.clickIndex = i;
  850. item.showPickerRespon = true;
  851. this.$forceUpdate();
  852. },
  853. //更新工作内容列表
  854. updateJobContent(domainItem) {
  855. var that = this;
  856. this.$axios.post('/project/getFunWorkContextList', { id: domainItem.extraField2 })
  857. .then(res => {
  858. if (res.code == 'ok') {
  859. that.$set(domainItem, 'extraField3', null);
  860. that.$set(domainItem, 'workContentList', res.data);
  861. }
  862. }).catch(err => { })
  863. },
  864. updateResponse(domainItem) {
  865. console.log(111);
  866. var that = this;
  867. var selectPid = domainItem.projectId;
  868. domainItem.extraField2 = null;
  869. domainItem.extraField3 = null;
  870. domainItem.extraField2Name = null;
  871. domainItem.extraField3Name = null;
  872. if (selectPid && domainItem.extraField1) {
  873. //是否非项目
  874. var isPublic = this.projectss.filter(p => p.id == selectPid)[0].isPublic;
  875. console.log('==========', 'isPublic==' + isPublic);
  876. var filteredRespList = this.jobResponseList.filter(j => j.timeType == (isPublic ? '非项目工时' : '项目工时') && j.role == (this.roleList.filter(r => r.value == domainItem.extraField1)[0].label));
  877. domainItem.filteredRespList = filteredRespList;
  878. }
  879. },
  880. getJobResponList() {
  881. this.$axios.post('/project/getFunctionalDivisionList', {})
  882. .then(res => {
  883. if (res.code == 'ok') {
  884. this.jobResponseList = res.data;
  885. }
  886. }).catch(err => { })
  887. },
  888. getRecentlyProject(userId) {
  889. this.$axios.post('/project/nearProject', {userId: userId})
  890. .then(res => {
  891. if (res.code == 'ok') {
  892. this.integrationProjectList = res.data;
  893. //去掉全部项目中没有的
  894. this.setTimeout(() => {
  895. this.integrationProjectList = this.integrationProjectList.filter(near => this.getProjectAuditorList.find(pItem => pItem.id == near.id) != null);
  896. }, 1000);
  897. }
  898. }).catch(err => { this.$toast.clear(); this.cardRefLoading = false; })
  899. },
  900. // 判断两个时间段是否重叠
  901. timeOverlap(idx, dateAr) {
  902. let zhi = 0
  903. for (let k in dateAr) {
  904. if (idx !== k) {
  905. if (((dateAr[k].s <= dateAr[idx].s && dateAr[k].e >= dateAr[idx].s) || (dateAr[k].s <= dateAr[idx].s && dateAr[k].e <= dateAr[idx].e))) {
  906. // 选择的时间包含设置的休息时间段 (选择的开始时间和结束时间大于设置的休息时间段)
  907. if (dateAr[idx].s > dateAr[k].s && dateAr[idx].e < dateAr[k].e) {
  908. // zhi += 2
  909. zhi += +this.getHour(dateAr[idx].s, dateAr[idx].e)
  910. }
  911. // 选择的时间包含在设置的休息时间 (选择的开始时间和结束时间都处于在设置的休息时间段内)
  912. if (dateAr[idx].s > dateAr[k].s && dateAr[idx].e > dateAr[k].e) {
  913. zhi += +this.getHour(dateAr[idx].s, dateAr[k].e)
  914. } else if (dateAr[idx].s < dateAr[k].s && dateAr[idx].e > dateAr[k].e) {
  915. zhi += +this.getHour(dateAr[k].e, dateAr[idx].s)
  916. } else {
  917. // 选择的结束时间处于设置的休息时间段内 (选择的结束时间处于的休息时间段)
  918. if (dateAr[k].e < dateAr[idx].e && dateAr[k].e > dateAr[idx].s) {
  919. zhi += +this.getHour(dateAr[k].e, dateAr[idx].e)
  920. }
  921. // 选择的开始时间处于设置的休息时间段内 (选择的开始时间处于的休息时间段)
  922. if (dateAr[idx].s > dateAr[k].s && dateAr[idx].s < dateAr[k].e) {
  923. zhi += +this.getHour(dateAr[k].e, dateAr[idx].s)
  924. }
  925. }
  926. }
  927. }
  928. }
  929. return zhi
  930. },
  931. getHour(s1, s2) {
  932. var reDate = /\d{4}-\d{1,2}-\d{1,2} /;
  933. s1 = new Date((reDate.test(s1) ? s1 : '2018-1-1 ' + s1).replace(/-/g, '/'));
  934. s2 = new Date((reDate.test(s2) ? s2 : '2018-1-1 ' + s2).replace(/-/g, '/'));
  935. var ms = s2.getTime() - s1.getTime();
  936. if (ms < 0) return 0;
  937. let ma = ms / 1000 / 60 / 60
  938. return ma; //小时
  939. },
  940. cardtimeRefresh(workdate, userId) { // 考勤记录刷新
  941. console.log(userId, '<==== userId')
  942. if (!workdate) return;
  943. this.cardRefLoading = true;
  944. this.$axios.post(this.user.timeType.syncDingding == 1?'/dingding/refreshUserCardTime':'/user-corpwx-time/getPunchRecordBySelf', {
  945. date: workdate,
  946. companyId: this.user.companyId,
  947. userId: userId ? userId : this.user.id
  948. })
  949. .then(res => {
  950. if (res.code == 'ok') {
  951. this.cardRefLoading = false;
  952. this.report.time = this.user.timeType.syncDingding == 1?res.data:res.data.time;
  953. } else {
  954. this.cardRefLoading = false;
  955. this.$toast.fail('获取失败:' + res.msg);
  956. }
  957. }).catch(err => { this.$toast.clear(); this.cardRefLoading = false; })
  958. },
  959. cardtimeRefreshTwo(workdate) { // 考勤记录刷新
  960. if (!workdate) return;
  961. this.cardRefLoading = true;
  962. this.$axios.post('/user-fv-time/syncHongHuFvTime', {
  963. startDate: workdate,
  964. endDate: workdate,
  965. userId: this.user.id
  966. })
  967. .then(res => {
  968. if (res.code == 'ok') {
  969. this.cardRefLoading = false;
  970. this.report.time = res.data;
  971. } else {
  972. this.cardRefLoading = false;
  973. this.$toast.fail('获取失败:' + res.msg);
  974. }
  975. }).catch(err => { this.$toast.clear(); this.cardRefLoading = false; })
  976. },
  977. auditorClick(domainIndex, auditorIndex) {
  978. if (this.canEdit) {
  979. this.auditor.index = domainIndex
  980. this.auditor.auditorIndex = auditorIndex
  981. this.auditor.searchList.forEach(u => {
  982. if (this.form.domains[domainIndex][auditorIndex] && u.id == this.form.domains[domainIndex][auditorIndex].id) {
  983. this.auditor.item = u
  984. }
  985. })
  986. this.auditorShow = true
  987. }
  988. },
  989. onSearch(val) {
  990. console.log(val);
  991. this.auditor.searchList = [];
  992. this.auditor.list.forEach(u => {
  993. if (u.name.startsWith(val)) {
  994. this.auditor.searchList.push(u);
  995. }
  996. })
  997. },
  998. searchAuditor() {
  999. if(!this.substitute) {
  1000. this.form.domains[this.auditor.index][this.auditor.auditorIndex] = this.auditor.item
  1001. }
  1002. this.auditorShow = false
  1003. if(this.substitute) {
  1004. const { id, name } = this.auditor.item
  1005. this.fillingAgent = { id, name }
  1006. this.getProject(this.fillingAgent.id);
  1007. this.getTargetUserCardTime();
  1008. }
  1009. },
  1010. getAllUsersList() {
  1011. this.$axios.post('/user/getSimpleActiveUserList', {})
  1012. .then(res => {
  1013. if (res.code == 'ok') {
  1014. this.auditor.list = res.data
  1015. this.auditor.searchList = res.data
  1016. } else {
  1017. this.$toast.fail('获取失败:' + res.msg);
  1018. }
  1019. }).catch(err => { this.$toast.clear(); })
  1020. },
  1021. requiredRule(val) {
  1022. console.log('requiredRule', val);
  1023. return false
  1024. },
  1025. // 获取预算来源
  1026. getReportBasecostList() {
  1027. this.$axios.post('/project-basecost-setting/getReportBasecostList', {
  1028. companyId: this.user.companyId
  1029. }).then(res => {
  1030. if (res.code == 'ok') {
  1031. this.reportBasecostList = res.data
  1032. } else {
  1033. this.$toast.fail('获取失败:' + res.msg);
  1034. }
  1035. }).catch(err => { this.$toast.clear(); })
  1036. },
  1037. //获取项目审核人
  1038. getProjectAuditorList(domainItem) {
  1039. this.$axios.post("/project-auditor/getList", { projectId: domainItem.projectId })
  1040. .then(res => {
  1041. if (res.code == "ok") {
  1042. domainItem.auditUserList = res.data;
  1043. if (res.data.length == 1) {
  1044. domainItem.projectAuditorId = domainItem.auditUserList[0].auditorId;
  1045. domainItem.projectAuditorName = domainItem.auditUserList[0].auditorName;
  1046. }
  1047. this.$forceUpdate();
  1048. } else {
  1049. this.$toast.fail('获取失败:' + res.msg);
  1050. }
  1051. }).catch(err => { this.$toast.clear(); });
  1052. },
  1053. updateTxt() {
  1054. this.$forceUpdate();
  1055. },
  1056. // 获取项目
  1057. getProject(userId) {
  1058. this.$axios.post("/project/getProjectList", { forReport: 1, userId: userId})
  1059. .then(res => {
  1060. if (res.code == "ok") {
  1061. for (var i in res.data) {
  1062. if (res.data[i].projectCode == 'null' || res.data[i].projectCode == null) {
  1063. res.data[i].projectCode = ' '
  1064. }
  1065. }
  1066. this.projectss = res.data;
  1067. this.project = res.data;
  1068. this.projectss = this.projectss.filter(p => p.status == 1 || p.status == 4);
  1069. this.proads = res.data
  1070. this.getRecentlyProject(userId)
  1071. } else {
  1072. this.$toast.fail('获取失败:' + res.msg);
  1073. }
  1074. }).catch(err => { this.$toast.clear(); });
  1075. },
  1076. sea() {
  1077. // console.log(this.userName.length)
  1078. if (this.userName.length > 0) {
  1079. // let text = this.userName
  1080. // let reg = new RegExp(text)
  1081. // let data = this.proads.filter(item => reg.test(item.projectName)) //返回
  1082. // let datas = this.proads.filter(item => reg.test(item.projectCode))
  1083. // let dataTree = data.concat(datas)
  1084. // let arrList = Array.from(new Set(dataTree))
  1085. // this.projectss = arrList
  1086. // console.log(this.userName.toUpperCase())
  1087. let data = this.proads.filter(item => { return item.projectName.toUpperCase().indexOf(this.userName.toUpperCase()) != '-1' });
  1088. let dataList = this.proads.filter(item => { return item.projectCode.toUpperCase().indexOf(this.userName.toUpperCase()) != '-1' });
  1089. let dataTree = data.concat(dataList)
  1090. let arrList = Array.from(new Set(dataTree))
  1091. this.projectss = arrList
  1092. } else {
  1093. // console.log(456)
  1094. this.projectss = this.proads
  1095. }
  1096. },
  1097. selectDegreeId(domain, index, domainItem, list) {
  1098. this.$axios.post("/report/defaultDegree", {
  1099. projectId: domain.id
  1100. })
  1101. .then(res => {
  1102. if (res.code == "ok") {
  1103. var arr = domainItem.wuduList
  1104. for (var i in arr) {
  1105. if (arr[i].id == res.data.id) {
  1106. domainItem.weiduName = arr[i].name
  1107. domainItem.degreeId = res.data.id
  1108. }
  1109. }
  1110. this.$forceUpdate();
  1111. } else {
  1112. this.$toast.fail('获取失败:' + res.msg);
  1113. }
  1114. }).catch(err => { this.$toast.clear(); });
  1115. },
  1116. fZr(item, index, flag = false) {
  1117. var domainItem = this.form.domains[this.clickIndex];
  1118. domainItem.projectId = item.id;
  1119. domainItem.projectName = item.projectName;
  1120. //清空子项目
  1121. domainItem.subProjectId = null;
  1122. domainItem.subProjectName = null;
  1123. //清空任务
  1124. domainItem.taskId = null;
  1125. domainItem.taskName = null;
  1126. //清空分组和阶段
  1127. domainItem.stage = null;
  1128. domainItem.groupId = null;
  1129. domainItem.weiduName = null;
  1130. this.showPickerUserddp = false;
  1131. //获取子项目
  1132. if (this.user.timeType.mainProjectState != 1) {
  1133. this.getSubprojectList(this.form.domains[this.clickIndex]);
  1134. }
  1135. //加载项目相关的工程进度
  1136. if (this.user.company.packageEngineering == 1) {
  1137. this.getProjectProfessions(this.form.domains[this.clickIndex], index);
  1138. }
  1139. //获取任务分组
  1140. this.getTaskGroups(this.form.domains[flag ? index : this.clickIndex], this.clickIndex);
  1141. // 获取1相关维度
  1142. this.getTaskList(domainItem)
  1143. this.dimension(domainItem.projectId)
  1144. //获取相关日报提交选择人
  1145. domainItem.projectAuditorId = null;
  1146. domainItem.projectAuditorName = null;
  1147. domainItem.auditUserList = null;
  1148. //获取项目审核人
  1149. // console.log(domainItem.projectId,this.project);
  1150. var curProject = this.project.filter(p => p.id == domainItem.projectId)[0];
  1151. if (curProject && (this.user.timeType.reportAuditType == 0 || this.user.timeType.reportAuditType == 4)) {
  1152. this.getProjectAuditorList(domainItem, index);
  1153. }
  1154. console.log(item, '数据')
  1155. if (this.user.timeType.customDegreeActive == 1 && item) {
  1156. var that = this
  1157. setTimeout(() => {
  1158. that.selectDegreeId(item, index, that.form.domains[that.clickIndex])
  1159. }, 500)
  1160. }
  1161. //加载昱众的工作职责
  1162. if (this.user.companyId == this.yuzhongCompId) {
  1163. this.updateResponse(domainItem);
  1164. }
  1165. // 工单号,行号
  1166. // const { reportExtraField4Name, reportExtraField5Name } = this.user.timeType
  1167. // if((reportExtraField4Name || reportExtraField5Name) && !flag) {
  1168. // this.getInfoByProjectId(item.projectCode)
  1169. // }
  1170. },
  1171. getInfoByProjectId(projectCode, index = null, flag = true) {
  1172. const { projectId, groupId = '' } = this.form.domains[this.clickIndex];
  1173. this.$axios.post("/erpOrderInfo/getInfoByProjectIdAndGroupId", {
  1174. projectId: projectCode,
  1175. date: this.form.createDate,
  1176. groupId: groupId
  1177. })
  1178. .then(res => {
  1179. if (res.code == "ok") {
  1180. if(flag) {
  1181. this.form.domains[index == null ? this.clickIndex : index].extraField4 = ''
  1182. this.form.domains[index == null ? this.clickIndex : index].extraField5 = ''
  1183. }
  1184. // if((res.data.orderIds || []).length > 0) {
  1185. // this.form.domains[index == null ? this.clickIndex : index].extraField4 = res.data.orderIds[0]
  1186. // }
  1187. this.form.domains[index == null ? this.clickIndex : index].reportExtraField4List = res.data.orderIds || []
  1188. this.form.domains[index == null ? this.clickIndex : index].reportExtraField5List = res.data.lines || []
  1189. }
  1190. this.$forceUpdate();
  1191. }).catch(err => { this.$toast.clear(); });
  1192. },
  1193. //获取项目下的任务分组
  1194. getTaskGroups(domainItem, index) {
  1195. domainItem.groupId = null;
  1196. domainItem.groupName = null;
  1197. this.$axios.post("/task-group/listMyJoinGroup", { projectId: domainItem.projectId })
  1198. .then(res => {
  1199. if (res.code == "ok") {
  1200. domainItem.taskGroups = res.data;
  1201. const projectIdStr = domainItem.projectId;
  1202. const businessTripsArray = this.businessTripsArray
  1203. const list = businessTripsArray.filter(item => item.projectId == projectIdStr)
  1204. if(list.length > 0) {
  1205. const obj = res.data.find(item => item.name.indexOf('出差工时') != -1) || {}
  1206. domainItem.groupId = obj.id || ''
  1207. domainItem.groupName = obj.name || ''
  1208. }
  1209. this.$forceUpdate();
  1210. }
  1211. this.$forceUpdate();
  1212. }).catch(err => { this.$toast.clear(); });
  1213. },
  1214. getSubprojectList(domainItem) {
  1215. domainItem.subProjectList = [];
  1216. this.$axios.post("/sub-project/list", { projectId: domainItem.projectId,isReport:true })
  1217. .then(res => {
  1218. if (res.code == "ok") {
  1219. domainItem.subProjectList = res.data;
  1220. }
  1221. this.$forceUpdate();
  1222. }).catch(err => { this.$toast.clear(); });
  1223. },
  1224. showChooseDetail(timeItem) {
  1225. this.curWorktime = timeItem;
  1226. this.showMultiOpPicker=true;
  1227. },
  1228. choseMultiOptionPick(value) {
  1229. this.curWorktime.detail = value;
  1230. this.showMultiOpPicker = false;
  1231. },
  1232. showEndDialog(timeItem) {
  1233. this.curWorktime = timeItem;
  1234. this.showWorkEndTime = true;
  1235. },
  1236. showStartDialog(timeItem) {
  1237. this.curWorktime = timeItem;
  1238. this.showWorkStartTime = true;
  1239. },
  1240. removeTimeItem(item, index) {
  1241. item.worktimeList.splice(index, 1);
  1242. },
  1243. isIOS() {
  1244. var u = navigator.userAgent;
  1245. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
  1246. return isiOS;
  1247. },
  1248. showLargeImg(item, index) {
  1249. this.imgShow = true;
  1250. this.tmpPics = item;
  1251. },
  1252. //拍照上传
  1253. takePhoto(index) {
  1254. var that = this;
  1255. wx.chooseImage({
  1256. count: 9, // 默认9
  1257. sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
  1258. sourceType: that.user.timeType.choseFromAlbum == 1 ? ['camera', 'album'] : ['camera'], // 可以指定来源是相册还是相机,默认二者都有
  1259. defaultCameraMode: "batch", //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
  1260. isSaveToAlbum: 0, //整型值,0表示拍照时不保存到系统相册,1表示自动保存,默认值是1
  1261. success: function (res) {
  1262. var localIds = res.localIds; // 返回选定照片的本地ID列表,
  1263. // andriod中localId可以作为img标签的src属性显示图片;
  1264. // iOS应当使用 getLocalImgData 获取图片base64数据,从而用于img标签的显示(在img标签内使用 wx.chooseImage 的 localid 显示可能会不成功)
  1265. if (that.form.domains[index].pics == null) {
  1266. that.form.domains[index].pics = [];
  1267. that.form.domains[index].iospics = [];
  1268. }
  1269. if (that.isIOSystem) {
  1270. for (var i = 0; i < localIds.length; i++) {
  1271. wx.getLocalImgData({
  1272. localId: localIds[i], // 图片的localID
  1273. success: function (res) {
  1274. var localData = res.localData; // localData是图片的base64数据,可以用img标签显示
  1275. that.form.domains[index].iospics.push(localData);
  1276. that.$forceUpdate();
  1277. }
  1278. });
  1279. }
  1280. if (that.user.companyId == 7) {
  1281. that.form.domains[index].pics = that.form.domains[index].pics.concat(localIds);
  1282. } else {
  1283. that.form.domains[index].pics = localIds;
  1284. }
  1285. } else {
  1286. if (that.user.companyId == 7) {
  1287. that.form.domains[index].pics = that.form.domains[index].pics.concat(localIds);
  1288. } else {
  1289. that.form.domains[index].pics = localIds;
  1290. }
  1291. that.$forceUpdate();
  1292. }
  1293. // var serverIdList = [];
  1294. if (that.form.domains[index].serverPics == null) {
  1295. that.form.domains[index].serverPics = [];
  1296. }
  1297. //立即就上传到企业微信服务器
  1298. for (var i = 0; i < localIds.length; i++) {
  1299. wx.uploadImage({
  1300. localId: localIds[i], // 需要上传的图片的本地ID,由chooseImage接口获得
  1301. isShowProgressTips: 1, // 默认为1,显示进度提示
  1302. success: function (res) {
  1303. var serverId = res.serverId; // 返回图片的服务器端ID
  1304. // serverIdList.push(serverId);
  1305. that.form.domains[index].serverPics.push(serverId);
  1306. }
  1307. });
  1308. }
  1309. }
  1310. });
  1311. },
  1312. copyProject(index) {
  1313. var leftProgress = 10;
  1314. if (this.reportTimeType.type == 3) {
  1315. //计算已经待分配工时比例
  1316. let array = this.form.domains;
  1317. let totalProgress = 0;
  1318. for (var i = 0; i < array.length; i++) {
  1319. totalProgress += array[i].progress;
  1320. }
  1321. if (totalProgress < 100) {
  1322. leftProgress = 100 - totalProgress;
  1323. }
  1324. }
  1325. var newIndex = index + 1;
  1326. var pName = "";
  1327. if (this.form.domains[index].projectId != '') {
  1328. pName = this.project.filter(p => p.id == this.form.domains[index].projectId)[0].projectName;
  1329. }
  1330. var itemDomain = {
  1331. id: null,
  1332. projectId: this.form.domains[index].projectId,
  1333. projectName: pName,
  1334. workingTime: this.reportTimeType.type == 3 ? (leftProgress * this.reportTimeType.allday / 100).toFixed(1) : "",
  1335. progress: leftProgress,
  1336. content: "",
  1337. state: 2,
  1338. isOvertime: false,
  1339. };
  1340. this.form.domains.splice(newIndex, 0, itemDomain);
  1341. },
  1342. //删除日报
  1343. deleteReport() {
  1344. this.$dialog.confirm({
  1345. title: '删除日报',
  1346. message: '确定要删除当天日报吗?'
  1347. }).then(() => {
  1348. const toast = this.$toast.loading({
  1349. forbidClick: true,
  1350. duration: 0
  1351. });
  1352. this.$axios.post("/report/delete", { userId: this.user.id, date: this.form.createDate })
  1353. .then(res => {
  1354. if (res.code == "ok") {
  1355. this.$toast.clear();
  1356. this.$toast.success('删除成功');
  1357. window.location.reload();
  1358. } else {
  1359. this.$toast.clear();
  1360. this.$toast.fail('删除失败');
  1361. }
  1362. }).catch(err => { this.$toast.clear(); });
  1363. }).catch(() => { });
  1364. },
  1365. changeAllTime() {
  1366. //总时长发生改变,自动按比例计算
  1367. this.form.domains.forEach(d => {
  1368. // d.workingTime = (d.progress * this.reportTimeType.allday / 100).toFixed(1);
  1369. d.workingTime = (d.progress * this.form.totalDuration / 100).toFixed(1);
  1370. });
  1371. },
  1372. cancel() {
  1373. this.$dialog.confirm({
  1374. title: '撤回日报',
  1375. message: '确定要撤回当天日报吗?'
  1376. }).then(() => {
  1377. const toast = this.$toast.loading({
  1378. forbidClick: true,
  1379. duration: 0
  1380. });
  1381. var ids = '';
  1382. var data = this.form.domains;
  1383. data.forEach(element => {
  1384. if (element.id != null && element.id != '') {
  1385. if (element.id) {
  1386. ids += (element.id + ',');
  1387. }
  1388. }
  1389. });
  1390. this.$axios.post("/report/cancel", { userId: this.user.id, reportIds: ids })
  1391. .then(res => {
  1392. if (res.code == "ok") {
  1393. this.$toast.clear();
  1394. this.$toast.success('撤销成功');
  1395. this.getReport();
  1396. } else {
  1397. this.$toast.clear();
  1398. this.$toast.fail('获取失败');
  1399. }
  1400. }).catch(err => { this.$toast.clear(); });
  1401. }).catch(() => { });
  1402. },
  1403. confirmWorkTime(field) {
  1404. if (field == 0) {
  1405. this.curWorktime.startTime = this.startTime;
  1406. this.showWorkStartTime = false;
  1407. } else {
  1408. this.curWorktime.endTime = this.endTime;
  1409. this.showWorkEndTime = false;
  1410. }
  1411. this.setTotalReportHours()
  1412. },
  1413. confirmTime(item, field, index) {
  1414. if (field == 0) {
  1415. console.log(this.dailyIndex)
  1416. // item.startTime = this.startTime;
  1417. this.form.domains[this.dailyIndex].startTime = this.startTime;
  1418. this.showStartTime = false;
  1419. } else {
  1420. this.form.domains[this.dailyIndex].endTime = this.endTime;
  1421. // item.endTime = this.endTime;
  1422. this.showEndTime = false;
  1423. }
  1424. console.log(this.form.domains)
  1425. this.setTotalReportHours()
  1426. },
  1427. setTotalReportHours() {
  1428. let domains = this.form.domains
  1429. let hours = 0
  1430. let arrNum = [] // 用于时间段计算加班时间
  1431. let timeArr = []
  1432. for (let i in domains) {
  1433. if (this.reportTimeType.multiWorktime == 1) {
  1434. for (let m in domains[i].worktimeList) {
  1435. if (domains[i].worktimeList[m].startTime && domains[i].worktimeList[m].endTime) {
  1436. // hours += this.getHour(domains[i].worktimeList[m].startTime, domains[i].worktimeList[m].endTime)
  1437. timeArr.push({ startTime: domains[i].worktimeList[m].startTime, endTime: domains[i].worktimeList[m].endTime })
  1438. }
  1439. }
  1440. } else {
  1441. if (this.user.timeType.type == 2) {
  1442. if (domains[i].startTime && domains[i].endTime) {
  1443. // let selectionTime = this.getHour(domains[i].startTime, domains[i].endTime)
  1444. // let subtractedData = 0
  1445. // let arr = JSON.parse(JSON.stringify(this.vacationTime))
  1446. // arr.unshift({s: domains[i].startTime, e: domains[i].endTime})
  1447. // for(var j in arr) {
  1448. // subtractedData += +this.timeOverlap(j, arr)
  1449. // }
  1450. // console.log(selectionTime, subtractedData)
  1451. // hours += +selectionTime - +subtractedData
  1452. // console.log(hours)
  1453. // arrNum.push(+selectionTime - +subtractedData)
  1454. timeArr.push({ startTime: domains[i].startTime, endTime: domains[i].endTime })
  1455. }
  1456. } else {
  1457. hours += domains[i].workingTime ? parseFloat(domains[i].workingTime) : 0
  1458. }
  1459. }
  1460. }
  1461. // this.totalReportHours = hours.toFixed(2)
  1462. console.log('timeArr', timeArr)
  1463. if (this.reportTimeType.multiWorktime == 1 || this.user.timeType.type == 2) {
  1464. const { timeCanOverlap } = this.reportTimeType // timeCanOverlap 为零时校验不允许重叠
  1465. if(timeCanOverlap == 0) {
  1466. this.getTimeHours(timeArr)
  1467. } else {
  1468. const newTimeArr = this.mergeTimeIntervals(timeArr)
  1469. this.getTimeHours(newTimeArr)
  1470. }
  1471. } else {
  1472. this.totalReportHours = hours.toFixed(2)
  1473. }
  1474. },
  1475. // 处理重叠时间段
  1476. mergeTimeIntervals(timeIntervals) {
  1477. // 按照开始时间排序
  1478. timeIntervals.sort((a, b) => a.startTime.localeCompare(b.startTime));
  1479. const mergedIntervals = [];
  1480. for (const interval of timeIntervals) {
  1481. if (
  1482. mergedIntervals.length === 0 ||
  1483. interval.startTime > mergedIntervals[mergedIntervals.length - 1].endTime
  1484. ) {
  1485. // 当前时间段与存储数组中的时间段没有重叠,直接加入存储数组
  1486. mergedIntervals.push(interval);
  1487. } else if (interval.endTime > mergedIntervals[mergedIntervals.length - 1].endTime) {
  1488. // 当前时间段与存储数组中的时间段有重叠,但是未完全包含,需要合并时间段
  1489. mergedIntervals[mergedIntervals.length - 1].endTime = interval.endTime;
  1490. }
  1491. }
  1492. return mergedIntervals;
  1493. },
  1494. getTimeHours(arr) {
  1495. this.$axios.post("/report/getHoursByTimeRange", { timeJsonStr: JSON.stringify(arr) })
  1496. .then(res => {
  1497. if (res.code == "ok") {
  1498. this.totalReportHours = res.data
  1499. } else {
  1500. this.$toast.clear();
  1501. this.$toast.fail(res.msg);
  1502. }
  1503. }).catch(err => { this.$toast.clear(); });
  1504. },
  1505. filter(type, options) {
  1506. if (type === 'minute') {
  1507. return options.filter(option => option % 30 === 0);
  1508. }
  1509. return options;
  1510. },
  1511. choseTimePick(value, index) {
  1512. if (!value) {
  1513. return
  1514. }
  1515. //选中时间
  1516. if (this.reportTimeType.type == 0) {
  1517. this.form.domains[this.clickTimeIndex].timeType = value.value;
  1518. this.form.domains[this.clickTimeIndex].workingTime = value.hours;
  1519. this.form.domains[this.clickTimeIndex].label = value.label;
  1520. this.showPickerTime = false;
  1521. } else if (this.reportTimeType.type == 1) {
  1522. // console.log('this.reportTimeType.type=='+value,this.form.domains);
  1523. this.form.domains[this.clickTimeIndex].workingTime = value;
  1524. this.form.domains[this.clickTimeIndex].label = value.toFixed(1) + '小时';
  1525. this.showPickerHours = false;
  1526. let allhour = 0
  1527. for (let i in this.form.domains) {
  1528. if (this.isWeekend) {
  1529. this.form.domains[i].isOvertime = true
  1530. this.form.domains[i].overtimeHours = this.form.domains[i].workingTime
  1531. } else {
  1532. this.form.domains[i].isOvertime = false
  1533. delete this.form.domains[i].overtimeHours
  1534. }
  1535. allhour += this.form.domains[i].workingTime * 1
  1536. }
  1537. if (allhour > this.user.timeType.allday && !this.isWeekend) {
  1538. this.form.domains[this.clickTimeIndex].isOvertime = true
  1539. this.form.domains[this.clickTimeIndex].overtimeHours = allhour - this.user.timeType.allday
  1540. }
  1541. }
  1542. this.setTotalReportHours()
  1543. },
  1544. clickTimePicker(i, item) {
  1545. if (!item.canEdit) {
  1546. return;
  1547. }
  1548. this.clickTimeIndex = i;
  1549. if (this.reportTimeType.type == 0) {
  1550. this.showPickerTime = true;
  1551. } else if (this.reportTimeType.type == 1) {
  1552. this.showPickerHours = true;
  1553. }
  1554. },
  1555. getTargetUserCardTime() {
  1556. if (this.user.timeType.showCorpwxCardtime && this.form.createDate && this.fillingAgent.name) {
  1557. //获取代填人的考勤
  1558. var that = this;
  1559. this.$axios.post('/user-corpwx-time/getUserCardTime', {userId: this.fillingAgent.id, date: this.form.createDate})
  1560. .then(res => {
  1561. if (res.code == "ok") {
  1562. // that.report.time = res.data;
  1563. this.$set(that.report, 'time', res.data);
  1564. } else {
  1565. this.$toast.clear();
  1566. this.$toast.fail(res.msg);
  1567. }
  1568. }).catch(err => { this.$toast.clear(); });
  1569. }
  1570. },
  1571. getMultiOptionData() {
  1572. this.$axios.post('/company-dict/getAll', { companyId: this.user.companyId,code: 'multiOption' })
  1573. .then(res => {
  1574. if (res.code == "ok") {
  1575. var list = res.data;
  1576. this.multiOptionData = [];
  1577. for (var i in list) {
  1578. this.multiOptionData.push(list[i].value);
  1579. }
  1580. }
  1581. }).catch(err => { this.$toast.clear(); });
  1582. },
  1583. getTimeType() {
  1584. this.$axios.post('/time-type/getCompanyTimeSetting', { companyId: this.user.companyId })
  1585. .then(res => {
  1586. if (res.code == "ok") {
  1587. var t = res.data;
  1588. this.reportTimeType = t;
  1589. if (this.reportTimeType.type > 0) {
  1590. this.showAddMore = true;
  1591. }
  1592. //转化时间格式
  1593. if (t.allday != null) {
  1594. this.timeType.push({ value: 0, label: '全天 - ' + t.allday + '小时', hours: t.allday });
  1595. }
  1596. if (t.am != null) {
  1597. this.timeType.push({ value: 1, label: '上午 - ' + t.am + '小时', hours: t.am });
  1598. }
  1599. if (t.pm != null) {
  1600. this.timeType.push({ value: 2, label: '下午 - ' + t.pm + '小时', hours: t.pm });
  1601. }
  1602. let arr = []
  1603. for (var i in res.data.excludeTimeList) {
  1604. let obj = {
  1605. s: res.data.excludeTimeList[i].startTime,
  1606. e: res.data.excludeTimeList[i].endTime,
  1607. }
  1608. arr.push(obj)
  1609. }
  1610. this.vacationTime = arr
  1611. } else {
  1612. this.$toast.clear();
  1613. this.$toast.fail(res.msg);
  1614. }
  1615. }).catch(err => { this.$toast.clear(); });
  1616. },
  1617. // 返回
  1618. back() {
  1619. history.back();
  1620. },
  1621. // 时间转换
  1622. format(date, pattern) {
  1623. pattern = pattern || "yyyy-MM-dd";
  1624. var _this = this;
  1625. return pattern.replace(/([yMdhsm])(\1*)/g, function ($0) {
  1626. switch ($0.charAt(0)) {
  1627. case 'y': return _this.padding(date.getFullYear(), $0.length);
  1628. case 'M': return _this.padding(date.getMonth() + 1, $0.length);
  1629. case 'd': return _this.padding(date.getDate(), $0.length);
  1630. case 'w': return date.getDay() + 1;
  1631. case 'h': return _this.padding(date.getHours(), $0.length);
  1632. case 'm': return _this.padding(date.getMinutes(), $0.length);
  1633. case 's': return _this.padding(date.getSeconds(), $0.length);
  1634. }
  1635. });
  1636. },
  1637. padding(s, len) {
  1638. var len = len - (s + '').length;
  1639. for (var i = 0; i < len; i++) { s = '0' + s; }
  1640. return s;
  1641. },
  1642. getAIReport(createDate) {
  1643. const toast = this.$toast.loading({
  1644. forbidClick: true,
  1645. duration: 0
  1646. });
  1647. this.$axios.post('/report/getAIReport', {})
  1648. .then(res => {
  1649. if (res.code == "ok") {
  1650. var quanbu = 0
  1651. this.jsDay = 1
  1652. var zhi = ''
  1653. var slp = res.data
  1654. for(var i in slp) {
  1655. var sp = +slp[i].workingTime + 0
  1656. zhi = this.jsDay * sp
  1657. quanbu = +quanbu + zhi
  1658. }
  1659. this.jsTime = quanbu
  1660. var aiReportData = res.data;
  1661. this.canCancelInDialog = false
  1662. if(aiReportData.length != 0) {
  1663. var arr = [];
  1664. var list = aiReportData;
  1665. for(var i in list) {
  1666. var subProjectName = null;
  1667. if (list[i].subProjectId) {
  1668. subProjectName = list[i].subProjectList.filter(s => s.id == list[i].subProjectId)[0].name;
  1669. }
  1670. var projectName = list[i].projectName;
  1671. var t = this.user.timeType;
  1672. let mmm = !t.customDegreeMultiple ? list[i].degreeId : (list[i].multiDegrIdList || [])
  1673. let sss = list[i].degreeList || []
  1674. let radioPickDegree = ''
  1675. let wuduName = ''
  1676. if(!t.customDegreeMultiple) {
  1677. for (var s in sss) {
  1678. if (sss[s].id == mmm) {
  1679. wuduName = sss[s].name
  1680. }
  1681. }
  1682. radioPickDegree = sss.filter(s => s.id == mmm)[0]
  1683. } else {
  1684. let arr = sss.filter(s => mmm.includes(s.id)).map(s => s.name);
  1685. radioPickDegree = sss.filter(s => mmm.includes(s.id))
  1686. wuduName = arr.join(',')
  1687. }
  1688. let copyReport = {
  1689. projectId: list[i].projectId,
  1690. projectName: projectName,
  1691. workingTime: String(list[i].workingTime),
  1692. content: list[i].content,
  1693. state: list[i].state,
  1694. timeType: list[i].timeType,
  1695. // label: timeType[list[i].timeType].label,
  1696. startTime: list[i].startTime,
  1697. endTime: list[i].endTime,
  1698. isOvertime: 0,
  1699. progress: list[i].progress,
  1700. taskList: list[i].taskList,
  1701. taskId: list[i].taskId ? list[i].taskId : null,
  1702. taskName: list[i].taskName,
  1703. professionProgress: list[i].professionProgressList,
  1704. pics: null,
  1705. multiWorktime: list[i].multiWorktime,
  1706. worktimeList: list[i].worktimeList,
  1707. wuduList: list[i].degreeList,
  1708. weiduName: wuduName,
  1709. degreeId: list[i].degreeId==-1?null:list[i].degreeId,
  1710. subProjectId: list[i].subProjectId,
  1711. subProjectName: subProjectName,
  1712. subProjectList: list[i].subProjectList,
  1713. groupId: list[i].groupId == 0 ? null : list[i].groupId,
  1714. groupName: list[i].groupName,
  1715. taskGroups: list[i].taskGroups,
  1716. stages: list[i].stages,
  1717. stage: list[i].stage == '-' ? null : list[i].stage,
  1718. customData: list[i].customData,
  1719. projectAuditorId: list[i].projectAuditorId,
  1720. projectAuditorName: list[i].projectAuditorName,
  1721. auditUserList: list[i].auditUserList,
  1722. overtimeHours: list[i].overtimeHours,
  1723. customText: list[i].customText,
  1724. basecostId: list[i].basecostId,
  1725. //basecostName: basecostName,
  1726. canEdit: true,
  1727. auditorFirst: list[i].auditorFirst ? list[i].auditorFirst : { name: '', id: '' },
  1728. auditorSec: list[i].auditorSec ? list[i].auditorSec : { name: '', id: '' },
  1729. auditorThird: list[i].auditorThird ? list[i].auditorThird : { name: '', id: '' },
  1730. ccUserid: list[i].ccUserid ? list[i].ccUserid : { name: '', id: '' },
  1731. extraField1: list[i].extraField1,
  1732. extraField1Name: list[i].extraField1Name,
  1733. extraField2: list[i].extraField2,
  1734. extraField2Name: list[i].extraField2Name,
  1735. extraField3: list[i].extraField3,
  1736. extraField3Name: list[i].extraField3Name,
  1737. workContentList: list[i].workContentList,
  1738. sapServiceId: list[i].sapServiceId,
  1739. sapServiceName: list[i].sapServiceName,
  1740. serviceList: list[i].serviceList,
  1741. userReportDeptName: list[i].userReportDeptName,
  1742. reportTargetDeptId: list[i].deptId,
  1743. content: list[i].content
  1744. }
  1745. arr.push(copyReport)
  1746. }
  1747. this.form.domains = arr;
  1748. } else {
  1749. }
  1750. this.canEdit = true;
  1751. this.originCanEdit = true;
  1752. this.seleChn()
  1753. } else {
  1754. this.$toast.fail(res.msg);
  1755. }
  1756. }).catch(err => { this.$toast.clear(); });
  1757. },
  1758. // 获取日报
  1759. getReport() {
  1760. this.isWeekend = false
  1761. let weekday = new Date(this.form.createDate).getDay()
  1762. if (this.user.companyId == 817) {
  1763. if (weekday == 0) {
  1764. this.isWeekend = true
  1765. }
  1766. } else {
  1767. if (weekday == 0 || weekday == 6) {
  1768. this.isWeekend = true
  1769. }
  1770. }
  1771. const toast = this.$toast.loading({
  1772. forbidClick: true,
  1773. duration: 0
  1774. });
  1775. this.$axios.post("/report/getReport", { date: this.form.createDate })
  1776. .then(res => {
  1777. if (res.code == "ok") {
  1778. this.$toast.clear();
  1779. this.report = res.data;
  1780. this.businessTripsArray = res.data.businessTrips || []
  1781. var t = res.data.timeType;
  1782. this.reportSettingsRow = res.data.timeType
  1783. var timeType = [];
  1784. //转化时间格式
  1785. if (t.allday != null) {
  1786. timeType.push({ value: 0, label: '全天 - ' + t.allday + '小时', hours: t.allday });
  1787. }
  1788. if (t.am != null) {
  1789. timeType.push({ value: 1, label: '上午 - ' + t.am + '小时', hours: t.am });
  1790. }
  1791. if (t.pm != null) {
  1792. timeType.push({ value: 2, label: '下午 - ' + t.pm + '小时', hours: t.pm });
  1793. }
  1794. var list = res.data.report;
  1795. this.canCancelInDialog = false
  1796. this.hasWrittenReport = list.length != 0;
  1797. if (list.length != 0 && !this.substitute) {
  1798. this.canEdit = false;
  1799. this.canCancel = false;
  1800. this.canDeleteReport = true
  1801. let array = [];
  1802. for (var i in list) {
  1803. var projectName = list[i].projectName;
  1804. var flg = (list[i].isOvertime == 1);
  1805. for (var j in this.project) {
  1806. if (this.project[j].id == list[i].projectId) {
  1807. projectName = this.project[j].projectName;
  1808. }
  1809. }
  1810. console.log(projectName);
  1811. let tname = '';
  1812. if (list[i].taskId != null && list[i].taskList.length > 0) {
  1813. let filterList = list[i].taskList.filter(t => t.taskId == list[i].taskId);
  1814. if (filterList.length > 0) {
  1815. tname = filterList[0].taskName;
  1816. }
  1817. }
  1818. let mmm = !t.customDegreeMultiple ? list[i].degreeId : (list[i].multiDegrIdList || [])
  1819. let sss = list[i].degreeList || []
  1820. let radioPickDegree = ''
  1821. let wuduName = ''
  1822. if(!t.customDegreeMultiple) {
  1823. for (var s in sss) {
  1824. if (sss[s].id == mmm) {
  1825. wuduName = sss[s].name
  1826. }
  1827. }
  1828. radioPickDegree = sss.filter(s => s.id == mmm)[0]
  1829. } else {
  1830. let arr = sss.filter(s => mmm.includes(s.id)).map(s => s.name);
  1831. radioPickDegree = sss.filter(s => mmm.includes(s.id))
  1832. wuduName = arr.join(',')
  1833. }
  1834. let serverPicArray = [];
  1835. // console.log('picArray=='+list[i].picStr);
  1836. if (list[i].picStr != null && list[i].picStr != '@') {
  1837. serverPicArray = JSON.parse(list[i].picStr.replace(/@/g, ","));
  1838. }
  1839. var subProjectName = null;
  1840. if (list[i].subProjectId) {
  1841. subProjectName = list[i].subProjectList.filter(s => s.id == list[i].subProjectId)[0].name;
  1842. }
  1843. let basecostName = ''
  1844. if (res.data.timeBasecostList && res.data.timeBasecostList.length > 0) {
  1845. for (let m in res.data.timeBasecostList) {
  1846. if (res.data.timeBasecostList[m].id == list[i].basecostId) {
  1847. basecostName = res.data.timeBasecostList[m].name
  1848. }
  1849. }
  1850. }
  1851. var targetP = this.project.filter(p => p.id == list[i].projectId);
  1852. var filteredRespList = [];
  1853. if (targetP.length > 0 && list[i].extraField1) {
  1854. list[i].extraField1Name = this.roleList.find(r => r.value == list[i].extraField1).label;
  1855. var isPublic = targetP[0].isPublic;
  1856. filteredRespList = this.jobResponseList.filter(j => j.timeType == (isPublic ? '非项目工时' : '项目工时') && j.role == this.roleList.filter(r => r.value == list[i].extraField1)[0].label);
  1857. if (list[i].extraField2) {
  1858. list[i].extraField2Name = filteredRespList.find(f => f.id == list[i].extraField2).jobRespon;
  1859. }
  1860. if (list[i].extraField3) {
  1861. list[i].extraField3Name = list[i].workContentList.find(w => w.id == list[i].extraField3).workContext;
  1862. }
  1863. }
  1864. let copyData = {
  1865. id: list[i].id,
  1866. projectId: list[i].projectId,
  1867. projectName: projectName,
  1868. workingTime: String(list[i].workingTime),
  1869. content: list[i].content,
  1870. state: list[i].state,
  1871. timeType: list[i].timeType,
  1872. label: timeType[list[i].timeType].label,
  1873. startTime: list[i].startTime,
  1874. endTime: list[i].endTime,
  1875. isOvertime: flg,
  1876. progress: list[i].progress,
  1877. taskList: list[i].taskList,
  1878. taskId: list[i].taskId ? list[i].taskId : null,
  1879. taskName: tname,
  1880. professionProgress: list[i].professionProgressList,
  1881. pics: list[i].pics,
  1882. iospics: list[i].pics,
  1883. serverPics: serverPicArray,
  1884. multiWorktime: t.multiWorktime,
  1885. worktimeList: list[i].worktimeList,
  1886. wuduList: list[i].degreeList,
  1887. weiduName: wuduName,
  1888. degreeId: !t.customDegreeMultiple ? list[i].degreeId : list[i].multiDegrIdList,
  1889. radioPickDegree: radioPickDegree,
  1890. subProjectId: list[i].subProjectId,
  1891. subProjectName: subProjectName,
  1892. subProjectList: list[i].subProjectList,
  1893. groupId: list[i].groupId == 0 ? null : list[i].groupId,
  1894. groupName: list[i].groupName,
  1895. taskGroups: list[i].taskGroups,
  1896. stages: list[i].stages,
  1897. stage: list[i].stage == '-' ? null : list[i].stage,
  1898. customData: list[i].customData,
  1899. auditUserList: list[i].auditUserList,
  1900. overtimeHours: list[i].overtimeHours,
  1901. customText: list[i].customText,
  1902. basecostId: list[i].basecostId,
  1903. basecostName: basecostName,
  1904. canEdit: list[i].state >= 2 ? true : false,
  1905. auditorFirst: list[i].auditorFirst ? list[i].auditorFirst : { name: '', id: '' },
  1906. auditorSec: list[i].auditorSec ? list[i].auditorSec : { name: '', id: '' },
  1907. auditorThird: list[i].auditorThird ? list[i].auditorThird : { name: '', id: '' },
  1908. ccUserid: list[i].ccUserid ? list[i].ccUserid : { name: '', id: '' },
  1909. extraField1: list[i].extraField1,
  1910. extraField1Name: list[i].extraField1Name,
  1911. extraField2: list[i].extraField2,
  1912. extraField2Name: list[i].extraField2Name,
  1913. extraField3: list[i].extraField3,
  1914. extraField3Name: list[i].extraField3Name,
  1915. extraField4: list[i].extraField4,
  1916. extraField5: list[i].extraField5,
  1917. workContentList: list[i].workContentList,
  1918. filteredRespList: filteredRespList,
  1919. sapServiceId: list[i].sapServiceId,
  1920. sapServiceName: list[i].sapServiceName,
  1921. serviceList: list[i].serviceList,
  1922. userReportDeptName: list[i].userReportDeptName,
  1923. reportTargetDeptId: list[i].deptId
  1924. }
  1925. if (this.user.timeType.reportAuditType != 1 && this.user.timeType.reportAuditType != 2 && this.user.timeType.reportAuditType != 9) {
  1926. //分组负责人审核的情况下,前端不需要显示,无需设置
  1927. copyData.projectAuditorId = list[i].projectAuditorId;
  1928. copyData.projectAuditorName = list[i].projectAuditorName;
  1929. }
  1930. console.log(copyData);
  1931. array.push(copyData);
  1932. if (list[i].state >= 2) {
  1933. this.canEdit = true;
  1934. } else {
  1935. this.canDeleteReport = false
  1936. }
  1937. if (list[i].state == 0) {
  1938. this.canCancel = true;
  1939. this.canCancelInDialog = true
  1940. }
  1941. const { reportExtraField4Name, reportExtraField5Name } = this.user.timeType
  1942. if((reportExtraField4Name || reportExtraField5Name) && copyData.extraField4) {
  1943. const { projectCode } = this.proads.find(item => item.id == list[i].projectId)
  1944. this.getInfoByProjectId(projectCode, i, false)
  1945. }
  1946. if(res.data.timeType.type == 3) {
  1947. const reportCalculationReportList = res.data.report || []
  1948. this.form.totalDuration = reportCalculationReportList.reduce((accumulator, current) => {
  1949. const workingTime = current.workingTime || 0;
  1950. return accumulator + workingTime;
  1951. }, 0);
  1952. }
  1953. }
  1954. this.form.domains = array;
  1955. this.setTotalReportHours()
  1956. } else {
  1957. this.totalReportHours = 0
  1958. this.canCancel = false;
  1959. this.canEdit = true;
  1960. var shuzhi = this.user.timeType.allday + ''
  1961. if(res.data.timeType.type == 3) {
  1962. this.form.totalDuration = this.user.timeType.allday
  1963. }
  1964. //没有填报的可以点击提交
  1965. this.form.domains = [{
  1966. id: null,
  1967. projectId: "",
  1968. projectName: "",
  1969. // workingTime: t.type==3?(t.allday).toFixed(1):"8.0",
  1970. workingTime: t.type == 3 ? (t.allday).toFixed(1) : shuzhi.indexOf('.') == '-1' ? shuzhi + '.0' : shuzhi,
  1971. content: "",
  1972. state: 2,
  1973. progress: 100,
  1974. isOvertime: false,
  1975. professionProgress: [],
  1976. multiWorktime: t.multiWorktime,
  1977. worktimeList: [{}],
  1978. canEdit: true,
  1979. auditorFirst: { name: '', id: '' },
  1980. auditorSec: { name: '', id: '' },
  1981. auditorThird: { name: '', id: '' },
  1982. ccUserid: { name: '', id: '' }
  1983. }]
  1984. // businessTrips 有数据的情况下
  1985. const businessTrips = res.data.businessTrips || []
  1986. if(businessTrips.length > 0) {
  1987. this.form.domains = businessTrips.map((item, index) => {
  1988. const projectItens = this.projectss.find(pro => pro.id == item.projectId) || {}
  1989. return {
  1990. id: null,
  1991. projectId: projectItens.id,
  1992. projectName: projectItens.projectName,
  1993. // workingTime: t.type==3?(t.allday).toFixed(1):"8.0",
  1994. workingTime: t.type == 3 ? (t.allday).toFixed(1) : shuzhi.indexOf('.') == '-1' ? shuzhi + '.0' : shuzhi,
  1995. content: "",
  1996. state: 2,
  1997. progress: 100,
  1998. isOvertime: false,
  1999. professionProgress: [],
  2000. multiWorktime: t.multiWorktime,
  2001. worktimeList: [{}],
  2002. canEdit: true,
  2003. auditorFirst: { name: '', id: '' },
  2004. auditorSec: { name: '', id: '' },
  2005. auditorThird: { name: '', id: '' },
  2006. ccUserid: { name: '', id: '' }
  2007. }
  2008. })
  2009. const { reportExtraField4Name, reportExtraField5Name } = this.user.timeType
  2010. for(let domainsIndex in this.form.domains) {
  2011. const projectItens = this.projectss.find(pro => pro.id == this.form.domains[domainsIndex].projectId) || {}
  2012. this.fZr(projectItens, domainsIndex, true)
  2013. if(reportExtraField4Name || reportExtraField5Name) {
  2014. this.getInfoByProjectId(projectItens.projectCode, domainsIndex, false)
  2015. }
  2016. }
  2017. }
  2018. console.log(this.form.domains, '<===== this.form.domains')
  2019. if (this.isWeekend && this.user.timeType.lockWorktime != 1) {
  2020. this.$set(this.form.domains[0], 'isOvertime', true)
  2021. if (t.type != 2 && t.type != 0) {
  2022. this.$set(this.form.domains[0], 'overtimeHours', t.allday.toFixed(0))
  2023. }
  2024. }
  2025. if (this.report.timeBasecostList.length != 0 && this.user.company.packageProject == 1) {
  2026. this.form.domains[0].basecostId = this.report.timeBasecostList[0].id;
  2027. this.form.domains[0].basecostName = this.report.timeBasecostList[0].name;
  2028. }
  2029. this.canEdit = true;
  2030. this.setTotalReportHours()
  2031. }
  2032. } else {
  2033. this.$toast.clear();
  2034. this.$toast.fail('获取失败:' + res.msg);
  2035. }
  2036. if (localStorage.getItem("formVal")) {
  2037. // console.log('触发了')
  2038. var obj = localStorage.getItem("formVal")
  2039. this.form = JSON.parse(obj)
  2040. localStorage.removeItem('formVal')
  2041. }
  2042. }).catch(err => { this.$toast.clear(); });
  2043. },
  2044. initFormData() {
  2045. this.totalReportHours = 0
  2046. this.canCancel = false;
  2047. this.canEdit = true;
  2048. var shuzhi = this.user.timeType.allday + '';
  2049. var t = this.user.timeType;
  2050. //没有填报的可以点击提交
  2051. this.form.domains = [{
  2052. id: null,
  2053. projectId: "",
  2054. projectName: "",
  2055. // workingTime: t.type==3?(t.allday).toFixed(1):"8.0",
  2056. workingTime: t.type == 3 ? (t.allday).toFixed(1) : shuzhi.indexOf('.') == '-1' ? shuzhi + '.0' : shuzhi,
  2057. content: "",
  2058. state: 2,
  2059. progress: 100,
  2060. isOvertime: false,
  2061. professionProgress: [],
  2062. multiWorktime: t.multiWorktime,
  2063. worktimeList: [{}],
  2064. canEdit: true,
  2065. auditorFirst: { name: '', id: '' },
  2066. auditorSec: { name: '', id: '' },
  2067. auditorThird: { name: '', id: '' },
  2068. ccUserid: { name: '', id: '' }
  2069. }]
  2070. if (this.isWeekend && this.user.timeType.lockWorktime != 1) {
  2071. this.$set(this.form.domains[0], 'isOvertime', true)
  2072. if (t.type != 2 && t.type != 0) {
  2073. this.$set(this.form.domains[0], 'overtimeHours', t.allday.toFixed(0))
  2074. }
  2075. }
  2076. this.canEdit = true;
  2077. this.setTotalReportHours()
  2078. },
  2079. // 改变时间
  2080. changeTime(time) {
  2081. this.form.createDate = this.format(new Date(time), "yyyy-MM-dd");
  2082. this.currentDate = time;
  2083. this.showPicker = false;
  2084. if (this.substitute) {
  2085. this.getTargetUserCardTime();
  2086. } else {
  2087. this.getReport();
  2088. }
  2089. },
  2090. //点击选择审核人
  2091. clickPickAuditor(i, item) {
  2092. if (!item.canEdit) return;
  2093. if (item.auditUserList.length <= 1) return;
  2094. this.clickIndex = i;
  2095. item.showPickerAuditor = true;
  2096. this.$forceUpdate();
  2097. },
  2098. choseAuditor(value, index) {
  2099. if (value) {
  2100. this.form.domains[this.clickIndex].projectAuditorId = value.auditorId;
  2101. this.form.domains[this.clickIndex].projectAuditorName = value.auditorName;
  2102. }
  2103. this.form.domains[this.clickIndex].showPickerAuditor = false;
  2104. this.$forceUpdate();
  2105. },
  2106. //点击选择角色
  2107. clickPickProjectRole(i, item) {
  2108. if (!item.canEdit) return;
  2109. this.clickIndex = i;
  2110. item.showPickerRole = true;
  2111. this.$forceUpdate();
  2112. },
  2113. //点击选择子项目
  2114. clickPickSubProject(i, item) {
  2115. if (!item.canEdit) return;
  2116. this.clickIndex = i;
  2117. item.showPickerSubProject = true;
  2118. this.$forceUpdate();
  2119. },
  2120. clickPickCostId(i, item) {
  2121. if (!item.canEdit) return;
  2122. this.clickIndex = i;
  2123. item.showPickerCostId = true;
  2124. this.$forceUpdate();
  2125. },
  2126. clickPickTaskGroup(i, item) {
  2127. if (!item.canEdit) return;
  2128. this.clickIndex = i;
  2129. item.showPickerTaskGroup = true;
  2130. this.$forceUpdate();
  2131. },
  2132. clickPickStage(i, item) {
  2133. if (!item.canEdit) return;
  2134. this.clickIndex = i;
  2135. item.showPickerStage = true;
  2136. this.$forceUpdate();
  2137. },
  2138. clickPickExtraField4(i, item) {
  2139. if (!item.canEdit) return;
  2140. this.clickIndex = i;
  2141. item.showPickerExtraField4 = true;
  2142. this.$forceUpdate();
  2143. },
  2144. clearClickPickExtraField4(i, item) {
  2145. if (!item.canEdit) return;
  2146. this.clickIndex = i;
  2147. this.form.domains[this.clickIndex].extraField4 = ''
  2148. this.form.domains[this.clickIndex].extraField5 = ''
  2149. this.$forceUpdate();
  2150. },
  2151. clickPickExtraField5(i, item) {
  2152. if (!item.canEdit) return;
  2153. this.clickIndex = i;
  2154. item.showPickerExtraField5 = true;
  2155. this.$forceUpdate();
  2156. },
  2157. clearClickPickExtraField5(i, item) {
  2158. if (!item.canEdit) return;
  2159. this.clickIndex = i;
  2160. this.form.domains[this.clickIndex].extraField5 = ''
  2161. this.$forceUpdate();
  2162. },
  2163. selectDeptPopup(i, item) {
  2164. this.clickIndex = i;
  2165. this.showSelectDeptPopup = true;
  2166. this.$forceUpdate();
  2167. },
  2168. selectedDeptId(item) {
  2169. const { label, value } = item
  2170. this.form.domains[this.clickIndex].userReportDeptName = label
  2171. this.form.domains[this.clickIndex].reportTargetDeptId = value
  2172. this.showSelectDeptPopup = false;
  2173. this.$forceUpdate();
  2174. },
  2175. // 选择项目
  2176. clickPicker(i, item) {
  2177. if (!item.canEdit) return;
  2178. this.clickIndex = i
  2179. this.showPickerUserddp = true
  2180. },
  2181. clickPickers(i, item) {
  2182. // console.log('wudulist',item.wuduList);
  2183. if (!item.canEdit) return;
  2184. this.clickIndex = i;
  2185. // item.showPickDegree = true;
  2186. this.$set(item, 'showPickDegree', true)
  2187. // var proId = this.form.domains[this.clickIndex].projectId
  2188. // this.dimension(proId)
  2189. },
  2190. //选择服务
  2191. clickPickerService(i, item) {
  2192. if (!item.canEdit) return;
  2193. // console.log(i);
  2194. this.clickIndex = i;
  2195. // var proId = this.form.domains[this.clickIndex].projectId
  2196. // this.getTaskList(proId)
  2197. // console.log(this.form.domains[this.clickIndex].taskList);
  2198. this.$toast.clear();
  2199. if (!this.form.domains[this.clickIndex].serviceList || this.form.domains[this.clickIndex].serviceList.length == 0) {
  2200. this.$toast.fail('当前任务暂无服务');
  2201. } else {
  2202. this.form.domains[this.clickIndex].showPickerService = true;
  2203. this.$forceUpdate();
  2204. }
  2205. },
  2206. choseService(value, index) {
  2207. if (value) {
  2208. this.form.domains[this.clickIndex].sapServiceId = value.id;
  2209. this.form.domains[this.clickIndex].sapServiceName = value.serviceName;
  2210. }
  2211. this.form.domains[this.clickIndex].showPickerService = false;
  2212. this.$forceUpdate();
  2213. },
  2214. //选择任务
  2215. clickPickerTask(i, item) {
  2216. if (!item.canEdit) return;
  2217. this.clickIndex = i;
  2218. this.$toast.clear();
  2219. if (!this.form.domains[this.clickIndex].taskList || this.form.domains[this.clickIndex].taskList.length == 0) {
  2220. this.$toast.fail('当前项目暂无可选的任务/里程碑');
  2221. } else {
  2222. this.form.domains[this.clickIndex].showPickerTask = true;
  2223. this.$forceUpdate();
  2224. }
  2225. },
  2226. choseTask(value, index) {
  2227. if (value) {
  2228. this.form.domains[this.clickIndex].taskId = value.taskId;
  2229. this.form.domains[this.clickIndex].taskName = value.taskName;
  2230. }
  2231. this.form.domains[this.clickIndex].showPickerTask = false;
  2232. this.$forceUpdate();
  2233. if (this.user.companyId == 3092) {
  2234. //依斯贝,加载服务
  2235. this.$axios.post("/task/getMyTaskService", { taskId: value.taskId })
  2236. .then(res => {
  2237. if (res.code == "ok") {
  2238. this.$set(this.form.domains[this.clickIndex], 'sapServiceId', null);
  2239. this.$set(this.form.domains[this.clickIndex], 'sapServiceName', null);
  2240. this.$set(this.form.domains[this.clickIndex], 'serviceList', res.data);
  2241. this.$forceUpdate();
  2242. } else {
  2243. this.$toast.fail('获取失败:' + res.msg);
  2244. }
  2245. }).catch(err => { this.$toast.clear(); });
  2246. }
  2247. },
  2248. choseProjects(value, index) {
  2249. const { timeType } = this.user
  2250. console.log(value, timeType)
  2251. if (value) {
  2252. if(!timeType.customDegreeMultiple) { // 单选
  2253. this.form.domains[this.clickIndex].weiduName = value.name;
  2254. this.form.domains[this.clickIndex].degreeId = value.id;
  2255. }
  2256. if(timeType.customDegreeMultiple) { // 多选
  2257. this.form.domains[this.clickIndex].weiduName = value.map(item => item.name).join(',');
  2258. this.form.domains[this.clickIndex].degreeId = value.map(item => item.id).join(',');
  2259. }
  2260. this.$forceUpdate();
  2261. }
  2262. this.form.domains[this.clickIndex].showPickDegree = false;
  2263. },
  2264. choseSubProject(value, index) {
  2265. if (value) {
  2266. this.form.domains[this.clickIndex].subProjectId = value.id;
  2267. this.form.domains[this.clickIndex].subProjectName = value.name;
  2268. }
  2269. this.form.domains[this.clickIndex].showPickerSubProject = false;
  2270. this.$forceUpdate();
  2271. },
  2272. choseTaskGroup(value, index) {
  2273. if (!value) {
  2274. return
  2275. }
  2276. this.form.domains[this.clickIndex].groupId = value.id;
  2277. this.form.domains[this.clickIndex].groupName = value.name;
  2278. this.form.domains[this.clickIndex].showPickerTaskGroup = false;
  2279. var domainItem = this.form.domains[this.clickIndex];
  2280. if(this.user.companyId == '7536') {
  2281. const extraField4 = this.form.domains[this.clickIndex].extraField4
  2282. const extraField5 = this.form.domains[this.clickIndex].extraField5
  2283. console.log(this.form.domains[this.clickIndex])
  2284. if((value.name.indexOf('出差工时') != -1 || value.name.indexOf('研发工时') != -1 || value.name.indexOf('入库后工时') != -1) && (extraField4 || extraField5)) {
  2285. this.form.domains[this.clickIndex].extraField4 = ''
  2286. this.form.domains[this.clickIndex].extraField5 = ''
  2287. }
  2288. if(value.name.indexOf('研发工时') != -1) {
  2289. this.doYouWantToDisplayTheWorkOrder = false
  2290. } else {
  2291. this.doYouWantToDisplayTheWorkOrder = true
  2292. }
  2293. if(value.name.indexOf('出差工时') != -1 || value.name.indexOf('入库后工时') != -1) {
  2294. this.doYouWantToDisplayTheWorkOrderGongdan = false
  2295. } else {
  2296. this.doYouWantToDisplayTheWorkOrderGongdan = true
  2297. }
  2298. const { reportExtraField4Name, reportExtraField5Name } = this.user.timeType
  2299. if((reportExtraField4Name || reportExtraField5Name) && value.id) {
  2300. console.log(this.form.domains[this.clickIndex], '<==== this.form.domains[this.clickIndex]')
  2301. const { projectId } = this.form.domains[this.clickIndex]
  2302. const { projectCode } = this.proads.find(item => item.id == projectId)
  2303. this.getInfoByProjectId(projectCode)
  2304. }
  2305. }
  2306. this.getGroupStages(this.form.domains[this.clickIndex], index);
  2307. //检查当前的项目是否需要获取分组的负责人
  2308. var curProject = this.project.filter(p => p.id == this.form.domains[this.clickIndex].projectId)[0];
  2309. if (curProject && (this.user.timeType.reportAuditType == 1 || this.user.timeType.reportAuditType == 2)) {
  2310. this.$axios.post("/task-group/getGroupIncharger", { groupId: domainItem.groupId })
  2311. .then(res => {
  2312. if (res.code == "ok") {
  2313. domainItem.auditUserList = res.data;
  2314. if (res.data.length == 1) {
  2315. domainItem.projectAuditorId = domainItem.auditUserList[0].auditorId;
  2316. domainItem.projectAuditorName = domainItem.auditUserList[0].auditorName;
  2317. }
  2318. this.$forceUpdate();
  2319. } else {
  2320. this.$toast.fail('获取失败:' + res.msg);
  2321. }
  2322. }).catch(err => { this.$toast.clear(); });
  2323. }
  2324. },
  2325. choseStage(value, index) {
  2326. if (value) {
  2327. this.form.domains[this.clickIndex].stage = value.stagesName;
  2328. }
  2329. this.form.domains[this.clickIndex].showPickerStage = false;
  2330. this.getTaskList(this.form.domains[this.clickIndex]);
  2331. this.$forceUpdate();
  2332. },
  2333. choseExtraField4(value) {
  2334. if (value) {
  2335. this.form.domains[this.clickIndex].extraField4 = value
  2336. }
  2337. if(!value) {
  2338. this.form.domains[this.clickIndex].extraField5 = ''
  2339. }
  2340. this.form.domains[this.clickIndex].showPickerExtraField4 = false;
  2341. this.$forceUpdate();
  2342. },
  2343. choseExtraField5(value) {
  2344. if (value) {
  2345. this.form.domains[this.clickIndex].extraField5 = value
  2346. }
  2347. this.form.domains[this.clickIndex].showPickerExtraField5 = false;
  2348. this.$forceUpdate();
  2349. },
  2350. choseCostId(value, index) {
  2351. if (value) {
  2352. this.form.domains[this.clickIndex].basecostId = value.id;
  2353. this.form.domains[this.clickIndex].basecostName = value.name;
  2354. }
  2355. this.form.domains[this.clickIndex].showPickerCostId = false;
  2356. this.$forceUpdate();
  2357. },
  2358. getGroupStages(domain, index) {
  2359. this.$axios.post("/stages/getProjectStagesByGroup", { groupId: domain.groupId })
  2360. .then(res => {
  2361. if (res.code == "ok") {
  2362. domain.stage = '';
  2363. domain.stages = res.data;
  2364. this.getTaskList(domain);
  2365. this.$forceUpdate();
  2366. } else {
  2367. this.$toast.fail('获取失败');
  2368. }
  2369. }).catch(err => { this.$toast.clear(); });
  2370. },
  2371. getProjectProfessions(domain, index) {
  2372. // console.log(domain, '数据')
  2373. this.$axios.post("/project-profession/getMyProfession", { projectId: domain.projectId })
  2374. .then(res => {
  2375. if (res.code == "ok") {
  2376. this.form.domains[this.clickIndex].professionProgress = res.data;
  2377. // console.log(this.form.domains)
  2378. this.$forceUpdate();
  2379. } else {
  2380. this.$toast.fail('获取失败');
  2381. }
  2382. }).catch(err => { this.$toast.clear(); });
  2383. },
  2384. // 获取维度
  2385. dimension(projectId) {
  2386. this.$axios.post("/project/getDegreeList", { projectId: projectId })
  2387. .then(res => {
  2388. if (res.code == "ok") {
  2389. this.form.domains[this.clickIndex].wuduList = res.data;
  2390. this.$forceUpdate();
  2391. } else {
  2392. this.$toast.fail('获取失败');
  2393. }
  2394. }).catch(err => { this.$toast.clear(); });
  2395. },
  2396. getTaskList(domainItem) {
  2397. //如果是专业版,需要列出任务列表
  2398. if (this.user.company.packageProject == 1) {
  2399. //清空选中的任务
  2400. this.$set(domainItem, 'taskId', null);
  2401. this.$set(domainItem, 'taskName', null);
  2402. this.$set(domainItem, 'sapServiceId', null);
  2403. this.$set(domainItem, 'sapServiceName', null);
  2404. this.$set(domainItem, 'serviceList', null);
  2405. var param = { projectId: domainItem.projectId }
  2406. if (domainItem.groupId) {
  2407. param.groupId = domainItem.groupId;
  2408. }
  2409. if (domainItem.stage) {
  2410. param.stage = domainItem.stage;
  2411. }
  2412. this.$axios.post("/task/getRecentTask", param)
  2413. .then(res => {
  2414. if (res.code == "ok") {
  2415. this.form.domains[this.clickIndex].allTaskList = res.data;
  2416. this.form.domains[this.clickIndex].taskList = res.data;
  2417. this.form = this.form;
  2418. } else {
  2419. this.$toast.fail('获取失败');
  2420. }
  2421. }).catch(err => { this.$toast.clear(); });
  2422. }
  2423. },
  2424. //添加工时
  2425. addNewWorktime(index, item) {
  2426. item.worktimeList.push({});
  2427. },
  2428. // 添加项目
  2429. addNewPro() {
  2430. var leftProgress = 10;
  2431. if (this.reportTimeType.type == 3) {
  2432. //计算已经待分配工时比例
  2433. let array = this.form.domains;
  2434. let totalProgress = 0;
  2435. for (var i = 0; i < array.length; i++) {
  2436. totalProgress += array[i].progress;
  2437. }
  2438. if (totalProgress < 100) {
  2439. leftProgress = 100 - totalProgress;
  2440. }
  2441. }
  2442. let item = {
  2443. id: null,
  2444. projectId: "",
  2445. projectName: "",
  2446. workingTime: this.reportTimeType.type == 3 ? (leftProgress * this.reportTimeType.allday / 100).toFixed(1) : "4.0",
  2447. progress: leftProgress,
  2448. content: "",
  2449. state: 2,
  2450. isOvertime: false,
  2451. multiWorktime: this.reportTimeType.multiWorktime,
  2452. worktimeList: [{}],
  2453. degreeId: null,
  2454. canEdit: true
  2455. }
  2456. if (this.isWeekend && this.user.timeType.lockWorktime != 1) {
  2457. this.$set(item, 'isOvertime', true)
  2458. if (this.reportTimeType.type == 3) {
  2459. this.$set(item, 'overtimeHours', (leftProgress * this.reportTimeType.allday / 100).toFixed(1))
  2460. } else {
  2461. this.$set(item, 'overtimeHours', 4)
  2462. }
  2463. }
  2464. if (this.report.timeBasecostList && this.report.timeBasecostList.length != 0 && this.user.company.packageProject == 1) {
  2465. this.$set(item, 'basecostId', this.report.timeBasecostList[0].id)
  2466. this.$set(item, 'basecostName', this.report.timeBasecostList[0].name)
  2467. }
  2468. this.form.domains.push(item)
  2469. if (this.reportTimeType.type == 0) {
  2470. //全天上下午模式下,检测时间段数量,达到2个,不能再加了
  2471. var length = this.form.domains.length;
  2472. if (length == 2) {
  2473. this.showAddMore = false;
  2474. }
  2475. }
  2476. //重新计算总时长
  2477. this.setTotalReportHours();
  2478. this.canEdit = true
  2479. this.$forceUpdate()
  2480. },
  2481. // 移除项目
  2482. delPro(i) {
  2483. this.$dialog.confirm({
  2484. title: '',
  2485. message: '是否移除当前项目'
  2486. }).then(() => {
  2487. this.form.domains.splice(i, 1);
  2488. //检测当前剩下的一个,时间类型是否是全天
  2489. if (this.reportTimeType.type == 0) {
  2490. if (this.form.domains[0].timeType == 0) {
  2491. this.showAddMore = false;
  2492. } else {
  2493. this.showAddMore = true;
  2494. }
  2495. }
  2496. //重新计算总时长
  2497. this.setTotalReportHours();
  2498. }).catch(() => {
  2499. });
  2500. },
  2501. // 判断时间段
  2502. fns() {
  2503. for (let k in this.dateAr) {
  2504. if (!this.judege(k)) {
  2505. return false
  2506. }
  2507. }
  2508. return true
  2509. },
  2510. judege(idx) {
  2511. for (let k in this.dateAr) {
  2512. if (idx !== k) {
  2513. if (this.dateAr[k].s <= this.dateAr[idx].s && this.dateAr[k].e > this.dateAr[idx].s) {
  2514. return false
  2515. }
  2516. if (this.dateAr[k].s < this.dateAr[idx].e && this.dateAr[k].e >= this.dateAr[idx].e) {
  2517. return false
  2518. }
  2519. }
  2520. }
  2521. return true
  2522. },
  2523. // 提交日报
  2524. submitReport() {
  2525. this.$refs.loginForm.validate().then(
  2526. () => {
  2527. // 验证通过
  2528. if (this.isDraft == 1) {
  2529. //暂存操作
  2530. this.submitReportSon()
  2531. } else {
  2532. if (this.user.companyId == 5978) {
  2533. //调接口,先检查工时是否存在异常
  2534. var totalTime = 0;
  2535. for (var t=0;t<this.form.domains.length; t++) {
  2536. totalTime += parseFloat(this.form.domains[t].workingTime);
  2537. }
  2538. var array = [];
  2539. var workData = {date: this.form.createDate, workingTime: totalTime};
  2540. array.push(workData)
  2541. this.flgLg = false
  2542. var passUserId = this.user.id;
  2543. this.$axios.post("/report/checkBeiSengCardTime", { userId:passUserId, dateWorkingTime:JSON.stringify(array)})
  2544. .then(res => {
  2545. this.flgLg = true
  2546. if (res.code == "ok") {
  2547. this.submitReportSon()
  2548. } else {
  2549. this.$dialog.confirm({
  2550. title: '提示',
  2551. message: res.msg + ',是否忽略并提交?'
  2552. }).then(() => {
  2553. this.submitReportSon()
  2554. }).catch(() => { })
  2555. }
  2556. }).catch(err => { this.$toast.clear(); });
  2557. } else if (this.user.companyId == 469) {
  2558. //校验填报的与考勤时长
  2559. if (this.totalReportHours > this.report.time.workHours) {
  2560. this.$toast('填报工时不得超过考勤时长')
  2561. } else if (this.totalReportHours < this.report.time.workHours) {
  2562. this.$dialog.confirm({
  2563. title: '提示',
  2564. message: '还剩余'+(this.report.time.workHours-this.totalReportHours).toFixed(1)+'h考勤时长尚未分配,是否确定提交'
  2565. }).then(() => {
  2566. this.submitReportSon()
  2567. }).catch(() => { })
  2568. } else {
  2569. this.submitReportSon()
  2570. }
  2571. } else {
  2572. //提交时,做工时时长不足的提醒
  2573. if (this.totalReportHours < this.user.timeType.allday) {
  2574. this.$dialog.confirm({
  2575. title: '提示',
  2576. message: '当日工时不足' + this.user.timeType.allday.toFixed(1) + '小时,是否确定提交?'
  2577. }).then(() => {
  2578. this.submitReportSon()
  2579. }).catch(() => { })
  2580. } else {
  2581. this.submitReportSon()
  2582. }
  2583. }
  2584. }
  2585. }).catch((err) => {
  2586. console.log('验证失败', err);
  2587. return
  2588. })
  2589. },
  2590. submitReportSon() {
  2591. this.dateAr = []
  2592. let alp = []
  2593. if (this.user.timeType.multiWorktime == 1) {
  2594. for (var p in this.form.domains) {
  2595. var slll = this.form.domains[p]
  2596. for (var o in slll.worktimeList) {
  2597. if (slll.worktimeList[o].startTime || slll.worktimeList[o].endTime) {
  2598. let objs = {}
  2599. objs.s = slll.worktimeList[o].startTime
  2600. objs.e = slll.worktimeList[o].endTime
  2601. alp.push(objs)
  2602. }
  2603. }
  2604. }
  2605. } else {
  2606. for (let i in this.form.domains) {
  2607. let objs = {}
  2608. objs.s = this.form.domains[i].startTime
  2609. objs.e = this.form.domains[i].endTime
  2610. alp.push(objs)
  2611. }
  2612. }
  2613. this.dateAr = alp
  2614. const { timeCanOverlap } = this.reportTimeType // timeCanOverlap 为零时校验不允许重叠
  2615. if (this.dateAr.length > 0 && timeCanOverlap == 0) {
  2616. let trus = this.fns()
  2617. if (!trus) {
  2618. this.$toast('填写的时间段重叠')
  2619. return
  2620. }
  2621. }
  2622. //检查子项目
  2623. if (this.user.timeType.subProMustFill == 1) {
  2624. for (var p in this.form.domains) {
  2625. var oneProItem = this.form.domains[p]
  2626. if (oneProItem.subProjectList && oneProItem.subProjectList.length > 0 && !oneProItem.subProjectId) {
  2627. //没有选择子项目
  2628. this.$toast('子项目必填,请检查')
  2629. return
  2630. }
  2631. }
  2632. }
  2633. //昱众需要检查新增的角色,工作职责,工作内容是否填写
  2634. if (this.user.companyId == this.yuzhongCompId) {
  2635. for (var p in this.form.domains) {
  2636. var oneProItem = this.form.domains[p]
  2637. if (!oneProItem.extraField1) {
  2638. this.$toast('角色必填,请检查')
  2639. return
  2640. }
  2641. if (!oneProItem.extraField2) {
  2642. this.$toast('工作职责必填,请检查')
  2643. return
  2644. }
  2645. if (!oneProItem.extraField3) {
  2646. this.$toast('工作内容必填,请检查')
  2647. return
  2648. }
  2649. }
  2650. }
  2651. // return
  2652. const toast = this.$toast.loading({
  2653. forbidClick: true,
  2654. duration: 0
  2655. });
  2656. // let formData = new FormData();
  2657. let formData = new URLSearchParams()
  2658. formData.append("draft", this.isDraft);
  2659. if (this.reportTimeType.type == 0) {
  2660. var alldayNum = 0;
  2661. var amNum = 0;
  2662. var pmNum = 0;
  2663. for (var i in this.form.domains) {
  2664. if (this.form.domains[i].timeType == 0) {
  2665. alldayNum++;
  2666. } else if (this.form.domains[i].timeType == 1) {
  2667. amNum++;
  2668. } else if (this.form.domains[i].timeType == 2) {
  2669. pmNum++;
  2670. }
  2671. }
  2672. if (alldayNum > 1) {
  2673. this.$toast.fail("工作时间-全天,只能选择一次");
  2674. return;
  2675. }
  2676. if (amNum > 1) {
  2677. this.$toast.fail("工作时间-上午,只能选择一次");
  2678. return;
  2679. }
  2680. if (pmNum > 1) {
  2681. this.$toast.fail("工作时间-下午,只能选择一次");
  2682. return;
  2683. }
  2684. if (alldayNum == 1 && (amNum > 0 || pmNum > 0)) {
  2685. this.$toast.fail("工作时间-全天,不能和上下午同时存在");
  2686. return;
  2687. }
  2688. } else if (this.reportTimeType.type == 3) {
  2689. //总百分比不能超过100%
  2690. let total = 0;
  2691. this.form.domains.forEach(w => { total += w.progress });
  2692. if (total > 100) {
  2693. this.$toast.fail("用时比例之和不能超过100%");
  2694. return;
  2695. } else if (total < 100) {
  2696. this.$toast.fail("工时尚未完全分配,无法提交");
  2697. return;
  2698. }
  2699. }
  2700. //非代填情况下要校验考勤
  2701. if (!this.substitute && this.user.timeType.notAllowedNoAttendance == 1 && this.isDraft == 0) {
  2702. if (this.report.time) {
  2703. if (this.report.time.workHours == 0) {
  2704. this.$toast.fail('无考勤记录不可填报')
  2705. return
  2706. }
  2707. } else {
  2708. this.$toast.fail('无考勤记录不可填报')
  2709. return
  2710. }
  2711. }
  2712. //针对凡己,不校验考勤时长
  2713. if (!this.substitute && this.user.companyId != 3918 && this.user.companyId != 5978 && this.user.companyId != 4281 && this.user.companyId != 7536 && this.reportTimeType.type == 1 && this.report.time) {
  2714. var totalTime = 0;
  2715. for (var t = 0; t < this.form.domains.length; t++) {
  2716. totalTime += parseFloat(this.form.domains[t].workingTime);
  2717. }
  2718. if (this.report.time.workHours && totalTime > parseFloat(this.report.time.workHours)) {
  2719. this.$toast.fail("填报工时之和" + (totalTime) + "h不能超过考勤总工时(" + this.report.time.workHours.toFixed(1) + "h)");
  2720. return;
  2721. }
  2722. }
  2723. const { reportExtraField4Name, reportExtraField5Name } = this.user.timeType
  2724. //填字段
  2725. for (var i in this.form.domains) {
  2726. // 检查任务/里程碑是否为必填
  2727. let taskRequired = this.user.timeType.taskRequired
  2728. if(taskRequired == 1) {
  2729. if(!this.form.domains[i].taskId) {
  2730. this.$toast.fail(`【${this.form.domains[i].projectName}】请选择 任务/里程碑`);
  2731. return
  2732. }
  2733. }
  2734. if (this.user.timeType.reportAuditType == 3) {
  2735. let audItem = {}
  2736. let auditRule = ''
  2737. if (this.form.domains[i].id) {
  2738. audItem.reportId = this.form.domains[i].id
  2739. }
  2740. if (this.user.timeType.auditLevel > 0) {
  2741. if (!this.form.domains[i].auditorFirst.id) { auditRule += '第一、' }
  2742. audItem.auditorFirst = this.form.domains[i].auditorFirst.id
  2743. }
  2744. if (this.user.timeType.auditLevel > 1) {
  2745. // if(!this.form.domains[i].auditorSec.id){ auditRule += '第二、' }
  2746. audItem.auditorSec = this.form.domains[i].auditorSec.id
  2747. }
  2748. if (this.user.timeType.auditLevel > 2) {
  2749. // if(!this.form.domains[i].auditorThird.id){ auditRule += '第三、' }
  2750. audItem.auditorThird = this.form.domains[i].auditorThird.id
  2751. }
  2752. if (this.form.domains[i].ccUserid.id) {
  2753. audItem.ccUserid = this.form.domains[i].ccUserid.id
  2754. }
  2755. if (auditRule) {
  2756. auditRule = auditRule.substring(0, auditRule.length - 1)
  2757. this.$toast.fail('请指定' + auditRule + '审核人')
  2758. return
  2759. }
  2760. formData.append("auditorSettingArray", JSON.stringify(audItem).replace(/,/g, "@"));
  2761. }
  2762. if (this.user.timeType.customDegreeActive == 1) {
  2763. let customDegreeMultiple = this.user.timeType.customDegreeMultiple
  2764. if (this.form.domains[i].degreeId) {
  2765. if(!customDegreeMultiple) { // 单选
  2766. formData.append("degreeId", this.form.domains[i].degreeId);
  2767. } else {
  2768. let newDegreeId = Array.isArray(this.form.domains[i].degreeId) ? this.form.domains[i].degreeId : this.form.domains[i].degreeId.split(',')
  2769. formData.append("multiDegrId", JSON.stringify(newDegreeId).replace(/,/g, '@'))
  2770. }
  2771. } else {
  2772. if (this.user.timeType.customDegreeStatus && !this.form.domains[i].degreeId) {
  2773. this.$toast.fail('请选择' + this.user.timeType.customDegreeName)
  2774. return
  2775. } else {
  2776. if (!customDegreeMultiple) {
  2777. formData.append("degreeId", -1);
  2778. } else {
  2779. formData.append("multiDegrId", '[]');
  2780. }
  2781. }
  2782. }
  2783. } else {
  2784. formData.append("degreeId", -1);
  2785. }
  2786. if (this.form.domains[i].customData) {
  2787. formData.append("customData", this.form.domains[i].customData);
  2788. } else {
  2789. formData.append("customData", "0");
  2790. }
  2791. if (this.form.domains[i].customText) {
  2792. formData.append("customText", this.form.domains[i].customText);
  2793. } else {
  2794. formData.append("customText", "-");
  2795. }
  2796. if (this.form.domains[i].id) {
  2797. formData.append("id", this.form.domains[i].id);
  2798. } else {
  2799. formData.append("id", -1);
  2800. }
  2801. formData.append("projectId", parseFloat(this.form.domains[i].projectId));
  2802. if (this.form.domains[i].subProjectId) {
  2803. formData.append("subProjectId", this.form.domains[i].subProjectId);
  2804. } else {
  2805. formData.append("subProjectId", 0);
  2806. }
  2807. if (this.form.domains[i].groupId) {
  2808. formData.append("groupId", this.form.domains[i].groupId);
  2809. } else {
  2810. formData.append("groupId", 0);
  2811. }
  2812. if (this.form.domains[i].stage) {
  2813. formData.append("stage", this.form.domains[i].stage);
  2814. } else {
  2815. formData.append("stage", '-');
  2816. }
  2817. formData.append("reportTimeType", this.reportTimeType.type);
  2818. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  2819. if (this.reportTimeType.type == 0) {
  2820. formData.append("timeType", this.form.domains[i].timeType);
  2821. formData.append("workingTime", parseFloat(this.form.domains[i].workingTime));
  2822. } else if (this.reportTimeType.type == 1) {
  2823. formData.append("workingTime", parseFloat(this.form.domains[i].workingTime));
  2824. } else if (this.reportTimeType.type == 2) {
  2825. formData.append("startTime", this.form.domains[i].startTime);
  2826. formData.append("endTime", this.form.domains[i].endTime);
  2827. } else if (this.reportTimeType.type == 3) {
  2828. formData.append("progress", this.form.domains[i].progress);
  2829. formData.append("workingTime", this.form.domains[i].workingTime);
  2830. }
  2831. if (this.form.domains[i].taskId) {
  2832. formData.append("taskId", this.form.domains[i].taskId);
  2833. } else {
  2834. formData.append("taskId", 0);
  2835. }
  2836. if (this.form.domains[i].taskFinish == true) {
  2837. formData.append("taskFinish", 1);
  2838. } else {
  2839. formData.append("taskFinish", 0);
  2840. }
  2841. // formData.append("createDate", this.form.createDate);
  2842. if(this.substitute) {
  2843. formData.append("createDate", `${this.form.createDate}@${this.form.createDate}`);
  2844. formData.append("targetUids", this.fillingAgent.id || '');
  2845. } else {
  2846. formData.append("createDate", this.form.createDate);
  2847. }
  2848. formData.append("isOvertime", this.form.domains[i].isOvertime && this.user.timeType.fillOvertime ? 1 : 0);
  2849. if (this.form.domains[i].overtimeHours && this.form.domains[i].isOvertime == 1 && this.user.timeType.fillOvertime) {
  2850. formData.append("overtimeHours", this.form.domains[i].overtimeHours);
  2851. } else {
  2852. formData.append("overtimeHours", 0);
  2853. }
  2854. if (this.form.domains[i].basecostId) {
  2855. formData.append("basecostId", this.form.domains[i].basecostId);
  2856. }
  2857. //项目专业进度
  2858. if (this.form.domains[i].professionProgress) {
  2859. let m = JSON.stringify(this.form.domains[i].professionProgress);
  2860. m = m.replace(/,/g, "@");//replaceAll(',','@');企业微信不兼容replaceAll
  2861. formData.append("professionProgress", m);
  2862. } else {
  2863. formData.append("professionProgress", "[]");
  2864. }
  2865. //图片的处理,serverPic是当前所有的照片
  2866. if (this.form.domains[i].serverPics) {
  2867. let m = JSON.stringify(this.form.domains[i].serverPics);
  2868. m = m.replace(/,/g, "@");//replaceAll(',','@');企业微信不兼容replaceAll
  2869. formData.append("pics", m);
  2870. } else {
  2871. formData.append("pics", "@");
  2872. }
  2873. //处理多个时间事项
  2874. if (this.reportTimeType.multiWorktime == 1) {
  2875. //检查时间是否有重叠
  2876. var workList = this.form.domains[i].worktimeList;
  2877. for (var j = 0; j < workList.length; j++) {
  2878. var curItem = workList[j];
  2879. if (curItem.startTime == null || curItem.endTime == null) {
  2880. this.$toast.fail("请设置工作时间");
  2881. return;
  2882. }
  2883. //检查开始时间是否大于结束时间
  2884. if (curItem.startTime >= curItem.endTime) {
  2885. this.$toast.fail("时间段" + curItem.startTime + '-' + curItem.endTime + "有误:" +
  2886. "结束时间必须大于开始时间");
  2887. return;
  2888. }
  2889. //时间段不可重叠
  2890. if (this.reportTimeType.timeCanOverlap == 0) {
  2891. for (var p = j + 1; p < workList.length; p++) {
  2892. var jItem = workList[p];
  2893. if ((jItem.startTime >= curItem.startTime && jItem.startTime < curItem.endTime)
  2894. || (jItem.endTime > curItem.startTime && jItem.endTime <= curItem.endTime)) {
  2895. this.$toast.fail("时间段" + curItem.startTime + '-' + curItem.endTime + "与" +
  2896. jItem.startTime + '-' + jItem.endTime + "存在重叠,请修改。");
  2897. return;
  2898. }
  2899. }
  2900. }
  2901. }
  2902. let m = JSON.stringify(this.form.domains[i].worktimeList);
  2903. m = m.replace(/,/g, "@");//replaceAll(',','@');企业微信不兼容replaceAll
  2904. formData.append("content", m);
  2905. } else {
  2906. if (this.form.domains[i].content) {
  2907. formData.append("content", this.form.domains[i].content);
  2908. } else {
  2909. formData.append("content", '-');
  2910. }
  2911. }
  2912. //审核人
  2913. if (this.form.domains[i].projectAuditorId) {
  2914. formData.append("projectAuditorId", this.form.domains[i].projectAuditorId);
  2915. } else {
  2916. if (this.user.timeType.reportAuditType == 0) {
  2917. this.$toast.fail("请指定[" + this.form.domains[i].projectName + ']项目的审核人');
  2918. return;
  2919. } else if (this.user.timeType.reportAuditType == 1 || this.user.timeType.reportAuditType == 2 || this.user.timeType.reportAuditType == 9) {
  2920. if (this.form.domains[i].taskGroups.length == 0) {
  2921. this.$toast.fail("您在[" + this.form.domains[i].projectName + "]项目上尚无参与的任务分组");
  2922. return;
  2923. } else if (!this.form.domains[i].groupId) {
  2924. this.$toast.fail("请选择[" + this.form.domains[i].projectName + "]项目的任务分组");
  2925. return;
  2926. }
  2927. }
  2928. }
  2929. if (this.user.companyId == this.yuzhongCompId) {
  2930. formData.append('extraField1', this.form.domains[i].extraField1);
  2931. formData.append('extraField2', this.form.domains[i].extraField2);
  2932. formData.append('extraField3', this.form.domains[i].extraField3);
  2933. }
  2934. if (this.user.companyId == 3092) {
  2935. formData.append('sapServiceId', this.form.domains[i].sapServiceId);
  2936. }
  2937. if(this.user.timeType.taskGroupRequired == 1 && !this.form.domains[i].groupId) {
  2938. this.$toast.fail("请选择[" + this.form.domains[i].projectName + "]项目的任务分组");
  2939. return;
  2940. }
  2941. if(this.user.timeType.userWithMultiDept == 1 && this.userReportDeptList.length > 0) {
  2942. if(this.form.domains[i].reportTargetDeptId) {
  2943. formData.append('reportTargetDeptId', this.form.domains[i].reportTargetDeptId || -1);
  2944. } else {
  2945. this.$toast.fail("请选择[" + this.form.domains[i].projectName + "]填报部门");
  2946. return;
  2947. }
  2948. }
  2949. if(reportExtraField4Name || reportExtraField5Name) {
  2950. formData.append('extraField4', this.form.domains[i].extraField4 || '');
  2951. formData.append('extraField5', this.form.domains[i].extraField5 || '');
  2952. }
  2953. }
  2954. if (!this.flgLg) {
  2955. return
  2956. }
  2957. this.flgLg = false
  2958. this.$axios.post("/report/editReport", formData)
  2959. .then(res => {
  2960. this.flgLg = true
  2961. if (res.code == "ok") {
  2962. this.$toast.clear();
  2963. if (res.msg != null) {
  2964. this.$dialog.alert({
  2965. message: res.msg,
  2966. }).then(() => {
  2967. // on close
  2968. this.$router.push("/index");
  2969. });
  2970. } else {
  2971. this.$toast.success(this.isDraft == 0 ? '提交成功' : '暂存成功');
  2972. setTimeout(() => {
  2973. this.$router.push("/index");
  2974. }, 500);
  2975. }
  2976. } else {
  2977. this.$toast.clear();
  2978. this.$toast.fail((this.isDraft == 0 ? '提交失败' : '暂存失败') + ':' + res.msg);
  2979. }
  2980. }).catch(err => { this.$toast.clear(); this.flgLg = true });
  2981. },
  2982. //初始化参数
  2983. initWxConfig() {
  2984. var curUrl = location.href.split("#")[0];
  2985. this.$axios.post("/wxcorp/getCorpWXConfig", { url: curUrl, token: this.user.id })
  2986. .then(res => {
  2987. if (res.code == "ok") {
  2988. var data = res.data;
  2989. wx.config({
  2990. beta: true,
  2991. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  2992. appId: data.appid, // 必填,公众号的唯一标识
  2993. timestamp: data.timestamp, // 必填,生成签名的时间戳
  2994. nonceStr: data.noncestr, // 必填,生成签名的随机串
  2995. signature: data.sign, // 必填,签名,见附录1
  2996. jsApiList: [
  2997. 'chooseImage',
  2998. 'previewImage',
  2999. 'uploadImage',
  3000. 'downloadImage',
  3001. 'previewFile',
  3002. 'getLocation',
  3003. ]
  3004. });
  3005. var that = this;
  3006. wx.ready(function () {
  3007. // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
  3008. // if (that.user.companyId == 7) {
  3009. // that.$toast('wx init success==7 ');
  3010. // that.getLocation();
  3011. // }
  3012. });
  3013. } else {
  3014. this.$toast.fail('获取失败');
  3015. }
  3016. }).catch(err => { this.$toast.fail('发生异常' + err); console.log(err) });
  3017. },
  3018. deleteImg(item, index) {
  3019. //删除添加的图片
  3020. if (this.isIOSystem) {
  3021. item.iospics.splice(index, 1);
  3022. item.iospics = item.iospics;
  3023. }
  3024. item.pics.splice(index, 1);
  3025. item.pics = item.pics;
  3026. //传递到后台的数据也要做同步删除
  3027. item.serverPics.splice(index, 1);
  3028. this.$forceUpdate();
  3029. },
  3030. //企业微信获取定位
  3031. getLocation() {
  3032. wx.getLocation({
  3033. type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
  3034. success: function (res) {
  3035. var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
  3036. var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
  3037. alert(JSON.stringify(res));
  3038. }
  3039. });
  3040. },
  3041. // 获取可选部门
  3042. getReportDeptList() {
  3043. this.$axios.post("/user/getUserInfo", {userId: this.user.id})
  3044. .then(res => {
  3045. if(res.code == "ok") {
  3046. let lists = res.data.userReportDeptList || []
  3047. const optimizedList = lists.map(item => ({
  3048. ...item,
  3049. label: item.departmentName,
  3050. value: item.departmentId,
  3051. }));
  3052. this.userReportDeptList = optimizedList
  3053. console.log(this.userReportDeptList, '<==== 返回的数据')
  3054. } else {
  3055. this.$toast.fail('获取失败:'+res.msg);
  3056. }
  3057. }).catch(err=> {this.$toast.clear();});
  3058. }
  3059. },
  3060. mounted() {
  3061. const { substitute } = this.$route.query;
  3062. if (substitute) {
  3063. this.substitute = true;
  3064. }
  3065. this.today = this.format(new Date(), 'yyyy-MM-dd')
  3066. this.timeRange = []
  3067. const { functionList } = this.user
  3068. for (let i in functionList) {
  3069. if(functionList[i].name == '隐藏工时数') {
  3070. this.hideWorkingHours = true
  3071. }
  3072. }
  3073. let i = 0.0;
  3074. while(true) {
  3075. if (i < 48) {
  3076. //校验上下限
  3077. if (i >= this.user.timeType.minReportTime && i <= this.user.timeType.maxReportTime) {
  3078. this.timeRange.push(i);
  3079. }
  3080. i += 0.5;
  3081. } else {
  3082. break;
  3083. }
  3084. }
  3085. // console.log('user',this.user)
  3086. var ua = navigator.userAgent.toLowerCase();
  3087. this.isIOSystem = this.isIOS();
  3088. if (ua.indexOf("wxwork") > 0) {
  3089. this.isCorpWX = true;
  3090. } else if (ua.indexOf("micromessenger") > 0) {
  3091. this.isWX = true;
  3092. }
  3093. this.getProject() //获取项目
  3094. this.getReportBasecostList()
  3095. //获取传递过来的日期
  3096. var passDate = this.$route.query.date;
  3097. if (passDate != null) {
  3098. this.form.createDate = this.$route.query.date;
  3099. }
  3100. if (this.substitute) {
  3101. //代填日报
  3102. this.initFormData();
  3103. } else {
  3104. //个人自己填报
  3105. setTimeout(() => {
  3106. this.getReport();
  3107. }, 1000);
  3108. }
  3109. this.getAllUsersList()
  3110. this.getTimeType();
  3111. this.getMultiOptionData();
  3112. //初始化微信js-sdk参数
  3113. if (this.isCorpWX) {
  3114. this.initWxConfig();
  3115. }
  3116. if (this.user.timeType.lockWorktime) {
  3117. this.timeRange = this.timeRange.filter(item => { return item <= this.user.timeType.allday })
  3118. }
  3119. if (this.user.companyId == this.yuzhongCompId) {
  3120. this.getJobResponList();
  3121. }
  3122. if(this.user.timeType.userWithMultiDept) {
  3123. this.getReportDeptList()
  3124. }
  3125. if(this.$route.query.scanTheCode == 1) {
  3126. setTimeout(() => {
  3127. this.scanCodeToFillIn(0)
  3128. // this.determineQrcode(0)
  3129. }, 1000)
  3130. }
  3131. },
  3132. beforeDestroy() {
  3133. localStorage.removeItem('formVal')
  3134. }
  3135. };
  3136. </script>
  3137. <style lang="less" scope>
  3138. .groupingSelection {
  3139. height: 100%;
  3140. overflow-y: auto;
  3141. padding: 10px 0;
  3142. .groupingSelectionItem {
  3143. padding: 15px 15px;
  3144. border-bottom: 1px solid #c2c2c2;
  3145. }
  3146. }
  3147. .chooseSomeone {
  3148. height: 80vh;
  3149. display: flex;
  3150. flex-direction: column;
  3151. .chooseSomeoneFlex1 {
  3152. flex: 1;
  3153. overflow: auto;
  3154. }
  3155. .chooseSomeoneBtn {
  3156. width:100%;
  3157. }
  3158. }
  3159. .my-swipe .van-swipe-item {
  3160. color: #fff;
  3161. font-size: 20px;
  3162. line-height: 150px;
  3163. text-align: center;
  3164. background-color: #39a9ed;
  3165. }
  3166. .van-field__control:disabled {
  3167. -webkit-text-fill-color: #646566;
  3168. }
  3169. .login_form {
  3170. margin-top: 46px;
  3171. position: relative;
  3172. }
  3173. .attendanceRecord {
  3174. // position: absolute;
  3175. // top: 0.26667rem;
  3176. // right: 0.42667rem;
  3177. color: #969799;
  3178. text-align: center;
  3179. font-size: 0.35rem;
  3180. line-height: 0.64rem;
  3181. }
  3182. .form_domains {
  3183. position: relative;
  3184. .form_copy {
  3185. position: absolute;
  3186. right: 85px;
  3187. top: 10px;
  3188. }
  3189. .form_addNew {
  3190. text-align: center;
  3191. margin: 10px;
  3192. }
  3193. .form_del {
  3194. position: absolute;
  3195. right: 10px;
  3196. top: 10px;
  3197. }
  3198. // .form_del {
  3199. // color: #ff0000;
  3200. // font-size: 22px;
  3201. // position: absolute;
  3202. // right: 15px;
  3203. // top: 10px;
  3204. // }
  3205. }
  3206. .form_tip {
  3207. text-align: center;
  3208. margin-top: 20px;
  3209. color: #afafaf;
  3210. font-size: 14px;
  3211. }
  3212. .card__footer {
  3213. padding-top: 10px;
  3214. }
  3215. .card__tags {
  3216. .van-tag {
  3217. margin-right: 5px;
  3218. }
  3219. }
  3220. .overTimeClas {
  3221. display: flex;
  3222. width: 7.4rem;
  3223. // justify-content: space-between;
  3224. align-items: center;
  3225. }
  3226. </style>
  3227. <style lang="less">
  3228. .van-nav-bar .van-icon,
  3229. .van-nav-bar__text {
  3230. color: #20a0ff;
  3231. }
  3232. .overtime {
  3233. height: 50px;
  3234. box-sizing: border-box;
  3235. padding-left: 10px;
  3236. display: flex;
  3237. align-items: center;
  3238. }
  3239. .custom-button {
  3240. width: 40px;
  3241. color: #fff;
  3242. font-size: 10px;
  3243. line-height: 16px;
  3244. text-align: center;
  3245. background-color: #1989fa;
  3246. border-radius: 100px;
  3247. }
  3248. .imgList {
  3249. position: relative;
  3250. width: 100px;
  3251. height: 100px;
  3252. display: inline-block;
  3253. }
  3254. .imgList_i {
  3255. position: absolute;
  3256. top: -8px;
  3257. right: -6px;
  3258. z-index: 999;
  3259. }
  3260. .ryuan {
  3261. padding: 0.3rem 0.53333rem;
  3262. // line-height: 40px;
  3263. // height: 40px;
  3264. overflow: auto;
  3265. color: #333;
  3266. border-bottom: 2px solid #f6f6f6;
  3267. width: 100%;
  3268. overflow: hidden;
  3269. text-overflow: ellipsis;
  3270. white-space: nowrap;
  3271. }
  3272. .overListTime {
  3273. margin-left: 5px;
  3274. display: inline-block;
  3275. width: 2rem;
  3276. color: #646566;
  3277. }
  3278. .hoveOver {
  3279. color: #C8C9CC;
  3280. }
  3281. .van-checkbox__label {
  3282. color: #646566 !important;
  3283. }
  3284. .van-checkbox__label--disabled {
  3285. color: #c8c9cc !important;
  3286. }
  3287. </style>