weekEdit.vue 147 KB

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