weekEdit.vue 149 KB

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