index.vue 117 KB

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