index.vue 163 KB

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