weekEdit.vue 145 KB

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