index.vue 169 KB

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