index.vue 168 KB

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