index.vue 168 KB

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