index.vue 173 KB

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