index.vue 171 KB

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