weekEdit.vue 118 KB

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