index.vue 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766
  1. <template>
  2. <div>
  3. <van-nav-bar title="填写日报" left-text="返回" @click-left="back" fixed left-arrow/>
  4. <van-form class="login_form" @submit="submitReport">
  5. <div>
  6. <van-field readonly clickable name="datetimePicker" :value="form.createDate" label="时间选择" placeholder="点击选择时间"
  7. @click="showPicker = true" :rules="rules.createDate" />
  8. <div v-if="report.time" class="attendanceRecord">
  9. <i class="iconfont firerock-icondakajilu" style="font-size:0.35rem;margin-right:0.12rem"></i>
  10. <span v-if="user.timeType.syncDingding==1&&!report.time">暂无考勤记录</span>
  11. <span v-else>{{report.time.startTime}}-{{report.time.endTime}}, {{report.time.workHours}}小时</span>
  12. </div>
  13. </div>
  14. <van-popup v-model="showPicker" position="bottom">
  15. <van-datetime-picker v-model="currentDate" type="date" :min-date="minDate" :max-date="maxDate" @confirm="changeTime" @cancel="showPicker = false"/>
  16. </van-popup>
  17. <van-cell title="总时长(h)" v-if="reportTimeType.type == 3">
  18. <template>
  19. <van-stepper :disabled="!canEdit || user.timeType.lockWorktime == 1" v-model="reportTimeType.allday" @change="changeAllTime" min="0.5" max="12" step="0.5" :decimal-length="1" />
  20. </template>
  21. </van-cell>
  22. <!-- <van-cell title="待分配时长" :value="report.time + 'h'" size="large"></van-cell> -->
  23. <div class="form_domains" v-for="(item,index) in form.domains" :key="item.id">
  24. <div style="float:right;margin-top:10px;margin-right:10px;">
  25. <!-- <van-tag v-if="canEdit&&item.projectName.length>0" color="#fff"
  26. @click="copyProject(index)" style="border: 1px solid #20a0ff;padding:5px;"
  27. icon="plus" type="default" ><span style="color:#666;padding: 0 5px;">复制项目</span></van-tag> -->
  28. <van-tag v-if="index>0&&canEdit" color="#fff"
  29. @click="delPro(index)" style="border: 1px solid #ff0000;padding:5px;margin-left:10px;"
  30. icon="plus" type="default" ><span style="color:#666;padding: 0 5px;">删除</span></van-tag>
  31. </div>
  32. <!-- <van-icon v-if="index>0&&canEdit" class="form_del" name="delete" @click="delPro(index)" /> -->
  33. <van-cell-group :title="(user.companyId==781?'任务':'项目') + (index+1)">
  34. <!-- <div>请选择投入项目</div> -->
  35. <van-field readonly name="projectId" clickable :value="item.projectName" :label="user.companyId==781?'工作任务':'投入项目'" :placeholder="user.companyId==781?'请选择工作任务':'请选择项目'" @click="clickPicker(index, item)"
  36. :rules="[{ required: true, message: user.companyId==781?'请选择任务':'请选择项目' }]" />
  37. <van-field readonly name="subProjectId" v-if="item.subProjectList != null && item.subProjectList.length > 0 && user.timeType.mainProjectState != 1" clickable
  38. :value="item.subProjectName" label="子项目" placeholder="请选择子项目"
  39. @click="clickPickSubProject(index, item)" />
  40. <van-popup v-model="item.showPickerSubProject" position="bottom">
  41. <van-picker show-toolbar :columns="item.subProjectList" value-key="name" @confirm="choseSubProject"
  42. @cancel="item.showPickerSubProject = false;$forceUpdate();" />
  43. </van-popup>
  44. <!--任务分组 -->
  45. <van-field readonly name="groupId" v-if="item.taskGpIncharge == 1 || (user.company.packageProject==1&&item.taskGroups != null && item.taskGroups.length > 0)" clickable
  46. :value="item.groupName" label="任务分组" placeholder="请选择任务分组"
  47. @click="clickPickTaskGroup(index, item)" />
  48. <van-popup v-model="item.showPickerTaskGroup" position="bottom">
  49. <van-picker show-toolbar :columns="item.taskGroups" value-key="name" @confirm="choseTaskGroup"
  50. @cancel="item.showPickerTaskGroup = false;$forceUpdate();" />
  51. </van-popup>
  52. <!--任务阶段 -->
  53. <van-field readonly name="stage" v-if="user.company.packageProject==1&&item.stages != null && item.stages.length > 0" clickable
  54. :value="item.stage" label="投入阶段" placeholder="请选择投入阶段"
  55. @click="clickPickStage(index, item)" />
  56. <van-popup v-model="item.showPickerStage" position="bottom">
  57. <van-picker show-toolbar :columns="item.stages" value-key="stagesName" @confirm="choseStage"
  58. @cancel="item.showPickerStage = false;$forceUpdate();" />
  59. </van-popup>
  60. <!-- 预算来源 -->
  61. <van-field readonly name="basecostId" v-if="user.company.packageProject==1&&reportBasecostList &&reportBasecostList.length>0"
  62. :value="item.basecostName" label="预算来源" placeholder="请选择预算来源"
  63. @click="clickPickCostId(index, item)" />
  64. <van-popup v-model="item.showPickerCostId" position="bottom">
  65. <van-picker show-toolbar :columns="reportBasecostList" value-key="name" @confirm="choseCostId"
  66. @cancel="item.showPickerCostId = false;$forceUpdate();" />
  67. </van-popup>
  68. <!-- 审核人 -->
  69. <van-field readonly name="projectAuditorId" v-if="item.auditUserList != null && item.auditUserList.length > 0" clickable
  70. :value="item.projectAuditorName" :label="user.companyId==781?'审核人':'项目审核人'" placeholder="请选择审核人"
  71. @click="clickPickAuditor(index, item)" />
  72. <van-popup v-model="item.showPickerAuditor" position="bottom">
  73. <van-picker show-toolbar :columns="item.auditUserList" value-key="auditorName" @confirm="choseAuditor"
  74. @cancel="item.showPickerAuditor = false;$forceUpdate();" />
  75. </van-popup>
  76. <!-- 相关维度 -->
  77. <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)"/>
  78. <van-popup v-model="item.showPickDegree" position="bottom">
  79. <van-picker show-toolbar :columns="item.wuduList" value-key="name" @confirm="choseProjects" @cancel="item.showPickDegree = false;$forceUpdate()" />
  80. </van-popup>
  81. <!-- 自定义数值 -->
  82. <van-field v-if="user.timeType.customDataActive==1" type="number" :disabled="!canEdit" v-model="item.customData" :label="user.timeType.customDataName" placeholder="请输入数字" :rules="user.timeType.customDataStatus == 1 ? [{ required: true, message: '请输入' + user.timeType.customDataName }] : []"></van-field>
  83. <!-- 自定义文本 -->
  84. <van-field v-if="user.timeType.customTextActive==1" :disabled="!canEdit" v-model="item.customText" :label="user.timeType.customTextName" placeholder="请输入" maxlength="25" :rules="user.timeType.customTextStatus ? [{ required: true, message: '请选择' + user.timeType.customTextName }] : []"></van-field>
  85. <van-cell title="专业进度" v-if="user.company.packageEngineering == 1">
  86. </van-cell>
  87. <van-field :disabled="!canEdit"
  88. type="number" :name="'progress_'+pItem.professionId" input-align="right"
  89. v-for="pItem in item.professionProgress" :key="pItem.professionId"
  90. :label="'-- '+pItem.professionName"
  91. >
  92. <template slot="input">
  93. <van-stepper v-model="pItem.progress" integer min="0" max="100" />%
  94. </template>
  95. </van-field>
  96. <van-field v-if="user.company.packageProject == 1" readonly name="taskId" :value="item.taskName" label="关联任务" placeholder="请选择关联任务" @click="clickPickerTask(index)"
  97. ></van-field>
  98. <van-field name="taskFinish" label="是否已完成" v-if="item.taskId != null">
  99. <template #input>
  100. <van-checkbox :disabled="!canEdit" v-model="item.taskFinish" shape="square">已完成</van-checkbox>
  101. </template>
  102. </van-field>
  103. <van-popup v-model="item.showPickerTask" position="bottom">
  104. <van-picker show-toolbar :columns="item.taskList" value-key="taskName" @confirm="choseTask" @cancel="item.showPickerTask = false;$forceUpdate()" />
  105. </van-popup>
  106. <!-- <van-field readonly clickable class="form_input" :value="item.workingTime" name="workingTime" label="工作时长" placeholder="请输入工作时长(单位:小时)"
  107. :rules="[{ required: true, message: '请输入工作时长(单位:小时)' }]" @touchstart.native.stop="showNumberKey = true"/>
  108. <van-number-keyboard v-model="item.workingTime" :show="showNumberKey" close-button-text="完成" extra-key="." :maxlength="4" @blur="showNumberKey = false" /> -->
  109. <!-- 常规选择时间的方式 -->
  110. <!-- 全天上下午模式 -->
  111. <div v-if="reportTimeType.multiWorktime==0">
  112. <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)"
  113. :rules="[{ required: true, message: '请选择工作时长' }]"/>
  114. <van-popup v-model="showPickerTime" position="bottom">
  115. <van-picker show-toolbar :columns="timeType" value-key="label" @confirm="choseTimePick" @cancel="showPickerTime = false" />
  116. </van-popup>
  117. <!-- 选择数字时间长度模式 -->
  118. <van-popup v-model="showPickerHours" position="bottom">
  119. <van-picker show-toolbar :columns="timeRange"
  120. :default-index="15"
  121. @confirm="choseTimePick" @cancel="showPickerHours = false" />
  122. </van-popup>
  123. <!-- 时间段选择模式 -->
  124. <van-field readonly v-if="reportTimeType.type == 2" clickable name="datetimePicker" :value="item.startTime" label="开始时间" placeholder="点击选择时间"
  125. @click="canEdit?showStartTime = true:''" :disabled="!canEdit"
  126. :rules="[{ required: true, message: '请选择开始时间' }]"
  127. />
  128. <van-popup v-model="showStartTime" position="bottom">
  129. <van-datetime-picker
  130. v-model="startTime"
  131. type="time"
  132. @confirm="confirmTime(item,0);"
  133. @cancel="showStartTime = false"
  134. :min-hour="0"
  135. :max-hour="23"
  136. />
  137. <!-- :filter="filter" 原本这个属性在里面 -->
  138. </van-popup>
  139. <van-field v-if="reportTimeType.type == 2" readonly clickable name="datetimePicker" :value="item.endTime" label="结束时间" placeholder="点击选择时间"
  140. @click="canEdit?showEndTime = true:''" :disabled="!canEdit"
  141. :rules="[{ required: true, message: '请选择结束时间' }]" />
  142. <van-popup v-model="showEndTime" position="bottom" >
  143. <van-datetime-picker
  144. v-model="endTime"
  145. type="time"
  146. :min-hour="0"
  147. :max-hour="23"
  148. @confirm="confirmTime(item,1)"
  149. @cancel="showEndTime = false"
  150. />
  151. <!-- :filter="filter" 原本这个属性在里面 -->
  152. </van-popup>
  153. <van-cell v-if="reportTimeType.type == 3" >
  154. <template >
  155. <div>
  156. <span>用时占比</span>
  157. <van-slider :disabled="!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)" >
  158. <template #button>
  159. <div class="custom-button">{{ item.progress }}%</div>
  160. </template>
  161. </van-slider>
  162. <span style="margin-left:10px;float:right;">{{item.workingTime}}小时</span>
  163. </div>
  164. </template>
  165. </van-cell>
  166. <van-field class="form_input" :disabled = "!canEdit"
  167. v-model="item.content" name="content" type="textarea" :label="user.companyId==781?'具体内容与结果':'工作事项'" placeholder="请输入" :rules="user.timeType.workContentState == 1 ? [{ required: true, message: '请填写工作事项' }] : null"
  168. rows="3" autosize />
  169. </div>
  170. <!-- 多个时间和工作事项的选择方式 -->
  171. <div v-if="reportTimeType.multiWorktime==1">
  172. <div v-for="(timeItem, tindex) in item.worktimeList" :key="tindex" style="position:relative;border:#ccc 0.5px solid;margin:7px;">
  173. <van-tag v-if="tindex>0 && canEdit" style="position:absolute; right:-7px;top:-7px;z-index:10;"
  174. @click="removeTimeItem(item,tindex)">X</van-tag>
  175. <!-- 时间段选择模式 -->
  176. <van-field readonly v-if="reportTimeType.type == 2" :clickable="canEdit" name="datetimePicker"
  177. :value="timeItem.startTime" label="开始时间" placeholder="点击选择时间"
  178. :rules="[{ required: true, message: '必填项' }]"
  179. @click="canEdit?showStartDialog(timeItem):''" />
  180. <van-field v-if="reportTimeType.type == 2" readonly :clickable="canEdit" name="datetimePicker"
  181. :value="timeItem.endTime" label="结束时间" placeholder="点击选择时间"
  182. :rules="[{ required: true, message: '必填项' }]"
  183. @click="canEdit?showEndDialog(timeItem):''" />
  184. <van-field class="form_input" :disabled="!canEdit" style="color:#333;-webkit-text-fill-color:#646566;"
  185. v-model="timeItem.content" name="content" type="textarea" label="工作事项" placeholder="请输入工作事项"
  186. :rules="user.timeType.workContentState == 1 ? [{ required: true, message: '请填写工作事项' }] : null"
  187. rows="1" autosize />
  188. </div>
  189. <!--时间选择器 , 做统一处理,不能放到循环里,不然会有多个公用showStartTime,最后一个会现在最上层UI,导致BUG -->
  190. <van-popup v-model="showWorkStartTime" position="bottom">
  191. <van-datetime-picker
  192. v-model="startTime"
  193. type="time"
  194. @confirm="confirmWorkTime(0);"
  195. @cancel="showWorkStartTime = false"
  196. :min-hour="0"
  197. :max-hour="23"
  198. />
  199. <!-- :filter="filter" 原本这个属性在里面 -->
  200. </van-popup>
  201. <van-popup v-model="showWorkEndTime" position="bottom" >
  202. <van-datetime-picker
  203. v-model="endTime"
  204. type="time"
  205. :min-hour="0"
  206. :max-hour="23"
  207. @confirm="confirmWorkTime(1)"
  208. @cancel="showWorkEndTime = false"
  209. />
  210. <!-- :filter="filter" 原本这个属性在里面 -->
  211. </van-popup>
  212. </div>
  213. <div style="width:100%;" v-if="canEdit&&reportTimeType.multiWorktime==1">
  214. <van-tag style="text-align:center;padding:5px;margin-left:15px;border: 1px solid #20a0ff;"
  215. :disabled="!canEdit" @click="addNewWorktime(index, item)"
  216. icon="plus" color="#ffffff" ><span style="color:#999;text-align:center;padding: 0 5px;"> 添加工时 </span></van-tag>
  217. </div>
  218. <div class="overtime" v-if="!user.timeType.lockWorktime">
  219. <div class="overTimeClas">
  220. <van-checkbox :disabled="!canEdit" v-model="item.isOvertime" style="width: 4.3rem;">含加班</van-checkbox>
  221. <van-field v-model="item.overtimeHours" type="number" :disabled="!canEdit || item.isOvertime==null||item.isOvertime==0"
  222. placeholder="请输入加班时长" style="width: 5rem"></van-field>
  223. <span :class="canEdit ? 'overListTime' : 'overListTime hoveOver'">小时</span>
  224. </div>
  225. <van-tag style="position:absolute;right:10px;" v-if="isCorpWX&&canEdit" type="primary" size="large" @click="takePhoto(index)">拍照上传</van-tag>
  226. <!-- <van-tag style="position:absolute;right:10px;" type="primary" size="large" @click="takePhoto(index)">拍照上传</van-tag> -->
  227. <!-- <van-tag style="position:absolute;right:10px;" type="primary" size="large" @click="takePhoto(index)">拍照上传</van-tag> -->
  228. </div>
  229. <div style="padding:5px;text-align:center;" v-if="!isIOSystem">
  230. <span v-for="(p, index) in item.pics" :key="p" style="margin-right:15px;">
  231. <div class="imgList">
  232. <van-icon v-if="canEdit && user.companyId==7" size="20" name="clear" @click="deleteImg(item, index)" class="imgList_i"/>
  233. <img :src="p" style="width:100px; height:100px;" @click="showLargeImg(item.pics, index)"/>
  234. </div>
  235. </span>
  236. </div>
  237. <div style="padding:5px;text-align:center;" v-if="isIOSystem">
  238. <span v-for="(p, index) in item.iospics" :key="p" style="margin-right:15px;">
  239. <div class="imgList">
  240. <van-icon v-if="canEdit && user.companyId==7" size="20" name="clear" @click="deleteImg(item, index)" class="imgList_i"/>
  241. <img :src="p" style="width:100px; height:100px;" @click="showLargeImg(item.iospics, index)"/>
  242. </div>
  243. </span>
  244. </div>
  245. <van-popup v-model="imgShow" position="bottom" closeable >
  246. <van-swipe class="my-swipe" indicator-color="white">
  247. <van-swipe-item v-for="(picItem, index) in tmpPics" :key="index">
  248. <img :src="picItem" style="width:100%;" />
  249. </van-swipe-item>
  250. </van-swipe>
  251. </van-popup>
  252. </van-cell-group>
  253. </div>
  254. <div style="text-align:center;" >
  255. <van-tag v-if="canEdit" size="large" style="text-align:center;margin:10px;padding:12px;margin-bottom:120px;border: 1px solid #20a0ff;"
  256. :disabled="!canEdit" @click="addNewPro"
  257. icon="plus" color="#ffffff" ><span style="color:#999;text-align:center;padding: 0 50px;"> + 新增{{user.companyId==781?'任务':'项目'}} </span></van-tag>
  258. </div>
  259. <div class="form_btn" style="position:fixed; bottom:0px;width:100%;">
  260. <div style="padding-bottom:10px;">
  261. <van-button v-if="canEdit" square block type="info" @click="isDraft=0" native-type="submit" style="width:50%;float:left;">
  262. <div v-if="flgLg">提交</div>
  263. <van-loading type="spinner" v-if="!flgLg" />
  264. </van-button>
  265. <van-button v-if="canEdit" square block type="default" @click="isDraft=1" native-type="submit" style="width:50%;float:left;">
  266. <div v-if="flgLg">暂存</div>
  267. <van-loading type="spinner" v-if="!flgLg" />
  268. </van-button>
  269. </div>
  270. <van-button v-if="canEdit&&form.domains.length>0 && form.domains[0].id != null"
  271. square block type="default" @click="deleteReport" native-type="button"
  272. style=""> 删除 </van-button>
  273. <!-- <div v-if="canEdit&&form.domains.length>0 && form.domains[0].id != null"
  274. style="display:block;padding-top:30px;font-size:15px;color:#666;margin:0 auto;text-align:center;padding-bottom:10px;background:#ffffff;"
  275. @click="deleteReport"> 删除 </div> -->
  276. <!-- <van-button v-if="canEdit" square block type="default" @click="deleteReport" native-type="button"
  277. style="margin-top:10px;"> 删除 </van-button> -->
  278. </div>
  279. </van-form>
  280. <div style="position:fixed; bottom:0px;width:100%;">
  281. <van-button v-if="canCancel" block type="default" @click="cancel"> 撤销 </van-button>
  282. </div>
  283. <div class="form_tip" v-if="!canEdit && !canCancel"> 已审核无法修改 </div>
  284. <!-- 选择项目弹窗 -->
  285. <van-popup v-model="showPickerUserddp" position="bottom" style="height: 80%">
  286. <!-- <van-search v-model="userName" placeholder="输入项目名称搜索" @clear="sea()" @blur="sea()" @search="sea()"></van-search> -->
  287. <van-search v-model="userName" placeholder="请输入项目名称/编号" @clear="sea()" @blur="sea()" @search="sea()" @input="sea()"/>
  288. <div style="minHeight:300px;">
  289. <div v-for="(item, index) in projectss" :key="item.id" class="ryuan" @click="fZr(item, index)">
  290. <p>{{item.projectName}}</p>
  291. <p style="margin-top: 5px;color: #9697B2;">{{item.projectCode}}</p>
  292. </div>
  293. </div>
  294. </van-popup>
  295. </div>
  296. </template>
  297. <script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
  298. <script>
  299. import wx from 'weixin-js-sdk'
  300. // Vue.prototype.$wx = wx
  301. export default {
  302. data() {
  303. return {
  304. showPickerStage: false,
  305. showPickerTaskGroup: false,
  306. showPickerSubProject: false,
  307. showPickerCostId: false,
  308. isDraft:0,
  309. showWorkStartTime:false,
  310. showWorkEndTime:false,
  311. curWorktime:null,
  312. isIOSystem:false,
  313. imgShow: false,
  314. isCorpWX:false,
  315. isWX: false,
  316. showPickerTask:false,
  317. canCancel:false,
  318. canEdit:false,
  319. showEndTime: false,
  320. showStartTime: false,
  321. startTime:'09:00',
  322. endTime: '18:00',
  323. nowTime:new Date(),
  324. showPickerHours: false,
  325. 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],
  326. selectTime:null,
  327. reportTimeType:{},
  328. user: JSON.parse(localStorage.userInfo),
  329. minDate: new Date(2010, 0, 1),
  330. maxDate: new Date(),
  331. currentDate: new Date(),
  332. showPickerTime: false,
  333. showPicker: false,
  334. showPickerProject: false,
  335. showPickDegree: false,
  336. clickIndex: 0,
  337. clickTimeIndex: 0,
  338. showNumberKey: false,
  339. canClick: 2,
  340. timeType:[],
  341. form: {
  342. createDate: this.format(new Date(new Date()),"yyyy-MM-dd"),
  343. domains: [{
  344. id: null,
  345. projectId: "",
  346. projectName: "",
  347. workingTime: "",
  348. content: "",
  349. state: 2,
  350. multiWorktime:0,
  351. worktimeList:{},
  352. degreeId: ''
  353. // pics:["https://worktime.ttkuaiban.com/upload/bc4df504fa724e6cab69872e2c1cfb35.png",
  354. // "https://worktime.ttkuaiban.com/upload/bc4df504fa724e6cab69872e2c1cfb35.png",
  355. // "https://worktime.ttkuaiban.com/upload/bc4df504fa724e6cab69872e2c1cfb35.png",]
  356. }],
  357. },
  358. rules: {
  359. createDate: [{ required: true, message: '请选择填报日期' }],
  360. },
  361. project: [],
  362. report: "",
  363. loading: false,
  364. finished: false,
  365. // isOvertime: false
  366. tmpPics:[],
  367. dateAr: [],
  368. showPickerUserddp: false, // 选择项目弹窗
  369. projectss: [],
  370. proads: [],
  371. userName: '',
  372. flgLg: true,
  373. reportBasecostList: []
  374. };
  375. },
  376. created() {
  377. },
  378. methods: {
  379. // 获取预算来源
  380. getReportBasecostList(){
  381. this.$axios.post('/project-basecost-setting/getReportBasecostList',{
  382. companyId: this.user.companyId
  383. }).then(res => {
  384. if(res.code == 'ok'){
  385. this.reportBasecostList = res.data
  386. }else{
  387. this.$toast.fail('获取失败:'+res.msg);
  388. }
  389. }).catch(err => {this.$toast.clear();})
  390. },
  391. //获取项目审核人
  392. getProjectAuditorList(domainItem) {
  393. this.$axios.post("/project-auditor/getList", {projectId: domainItem.projectId})
  394. .then(res => {
  395. if(res.code == "ok") {
  396. domainItem.auditUserList = res.data;
  397. if (res.data.length==1) {
  398. domainItem.projectAuditorId = domainItem.auditUserList[0].auditorId;
  399. domainItem.projectAuditorName = domainItem.auditUserList[0].auditorName;
  400. }
  401. this.$forceUpdate();
  402. } else {
  403. this.$toast.fail('获取失败:'+res.msg);
  404. }
  405. }).catch(err=> {this.$toast.clear();});
  406. },
  407. updateTxt() {
  408. this.$forceUpdate();
  409. },
  410. // 获取项目
  411. getPeoject() {
  412. this.$axios.post("/project/getProjectList", {})
  413. .then(res => {
  414. if(res.code == "ok") {
  415. for(var i in res.data) {
  416. if(res.data[i].projectCode == 'null' || res.data[i].projectCode == null) {
  417. res.data[i].projectCode = ' '
  418. }
  419. }
  420. this.projectss = res.data;
  421. this.project = res.data;
  422. this.projectss = this.projectss.filter(p=>p.status == 1 || p.status == 4);
  423. this.proads = res.data
  424. } else {
  425. this.$toast.fail('获取失败:'+res.msg);
  426. }
  427. }).catch(err=> {this.$toast.clear();});
  428. },
  429. sea() {
  430. // console.log(this.userName.length)
  431. if(this.userName.length > 0) {
  432. // let text = this.userName
  433. // let reg = new RegExp(text)
  434. // let data = this.proads.filter(item => reg.test(item.projectName)) //返回
  435. // let datas = this.proads.filter(item => reg.test(item.projectCode))
  436. // let dataTree = data.concat(datas)
  437. // let arrList = Array.from(new Set(dataTree))
  438. // this.projectss = arrList
  439. // console.log(this.userName.toUpperCase())
  440. let data = this.proads.filter(item => {return item.projectName.indexOf(this.userName.toUpperCase()) != '-1'});
  441. let dataList = this.proads.filter(item => {return item.projectCode.indexOf(this.userName.toUpperCase()) != '-1'});
  442. let dataTree = data.concat(dataList)
  443. let arrList = Array.from(new Set(dataTree))
  444. this.projectss = arrList
  445. } else {
  446. // console.log(456)
  447. this.projectss = this.proads
  448. }
  449. },
  450. fZr(item,index) {
  451. var domainItem = this.form.domains[this.clickIndex];
  452. domainItem.projectId = item.id;
  453. domainItem.projectName = item.projectName;
  454. //清空子项目
  455. domainItem.subProjectId = null;
  456. domainItem.subProjectName = null;
  457. //清空任务
  458. domainItem.taskId = null;
  459. domainItem.taskName = null;
  460. //清空分组和阶段
  461. domainItem.stage = null;
  462. domainItem.groupId = null;
  463. domainItem.weiduName = null;
  464. this.showPickerUserddp = false;
  465. //获取子项目
  466. if(this.user.timeType.mainProjectState != 1){
  467. this.getSubprojectList(this.form.domains[this.clickIndex]);
  468. }
  469. //加载项目相关的工程进度
  470. if (this.user.company.packageEngineering == 1){
  471. this.getProjectProfessions(this.form.domains[this.clickIndex],index);
  472. }
  473. //获取任务分组
  474. this.getTaskGroups(this.form.domains[this.clickIndex], this.clickIndex);
  475. // 获取1相关维度
  476. this.getTaskList(domainItem.projectId)
  477. this.dimension(domainItem.projectId)
  478. //获取相关日报提交选择人
  479. domainItem.projectAuditorId = null;
  480. domainItem.projectAuditorName = null;
  481. domainItem.auditUserList = null;
  482. //获取项目审核人
  483. console.log(domainItem.projectId,this.project);
  484. var curProject = this.project.filter(p=>p.id == domainItem.projectId)[0];
  485. if (curProject && curProject.taskGpIncharge == 0) {
  486. this.getProjectAuditorList(domainItem, index);
  487. }
  488. domainItem.taskGpIncharge = curProject.taskGpIncharge;
  489. },
  490. //获取项目下的任务分组
  491. getTaskGroups(domainItem, index) {
  492. domainItem.groupId=null;
  493. domainItem.groupName=null;
  494. this.$axios.post("/task-group/listMyJoinGroup", {projectId: domainItem.projectId})
  495. .then(res => {
  496. if(res.code == "ok") {
  497. domainItem.taskGroups = res.data;
  498. }
  499. this.$forceUpdate();
  500. }).catch(err=> {this.$toast.clear();});
  501. },
  502. getSubprojectList(domainItem) {
  503. domainItem.subProjectList = [];
  504. this.$axios.post("/sub-project/list", {projectId: domainItem.projectId})
  505. .then(res => {
  506. if(res.code == "ok") {
  507. domainItem.subProjectList = res.data;
  508. }
  509. this.$forceUpdate();
  510. }).catch(err=> {this.$toast.clear();});
  511. },
  512. showEndDialog(timeItem) {
  513. this.curWorktime = timeItem;
  514. this.showWorkEndTime = true;
  515. },
  516. showStartDialog(timeItem) {
  517. this.curWorktime = timeItem;
  518. this.showWorkStartTime = true;
  519. },
  520. removeTimeItem(item, index) {
  521. item.worktimeList.splice(index, 1);
  522. },
  523. isIOS(){
  524. var u = navigator.userAgent;
  525. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
  526. return isiOS;
  527. },
  528. showLargeImg(item, index) {
  529. this.imgShow = true;
  530. this.tmpPics = item;
  531. },
  532. //拍照上传
  533. takePhoto(index) {
  534. var that = this;
  535. wx.chooseImage({
  536. count: 9, // 默认9
  537. sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
  538. sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
  539. defaultCameraMode: "batch", //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
  540. isSaveToAlbum: 0, //整型值,0表示拍照时不保存到系统相册,1表示自动保存,默认值是1
  541. success: function (res) {
  542. var localIds = res.localIds; // 返回选定照片的本地ID列表,
  543. // andriod中localId可以作为img标签的src属性显示图片;
  544. // iOS应当使用 getLocalImgData 获取图片base64数据,从而用于img标签的显示(在img标签内使用 wx.chooseImage 的 localid 显示可能会不成功)
  545. if (that.form.domains[index].pics == null) {
  546. that.form.domains[index].pics = [];
  547. that.form.domains[index].iospics = [];
  548. }
  549. if (that.isIOSystem) {
  550. for (var i=0;i<localIds.length; i++) {
  551. wx.getLocalImgData({
  552. localId: localIds[i], // 图片的localID
  553. success: function (res) {
  554. var localData = res.localData; // localData是图片的base64数据,可以用img标签显示
  555. that.form.domains[index].iospics.push(localData);
  556. that.$forceUpdate();
  557. }
  558. });
  559. }
  560. if (that.user.companyId == 7) {
  561. that.form.domains[index].pics = that.form.domains[index].pics.concat(localIds);
  562. } else {
  563. that.form.domains[index].pics = localIds;
  564. }
  565. } else {
  566. if (that.user.companyId == 7) {
  567. that.form.domains[index].pics = that.form.domains[index].pics.concat(localIds);
  568. } else {
  569. that.form.domains[index].pics = localIds;
  570. }
  571. that.$forceUpdate();
  572. }
  573. // var serverIdList = [];
  574. if (that.form.domains[index].serverPics == null) {
  575. that.form.domains[index].serverPics = [];
  576. }
  577. //立即就上传到企业微信服务器
  578. for (var i=0;i<localIds.length; i++) {
  579. wx.uploadImage({
  580. localId: localIds[i], // 需要上传的图片的本地ID,由chooseImage接口获得
  581. isShowProgressTips: 1, // 默认为1,显示进度提示
  582. success: function (res) {
  583. var serverId = res.serverId; // 返回图片的服务器端ID
  584. // serverIdList.push(serverId);
  585. that.form.domains[index].serverPics.push(serverId);
  586. }
  587. });
  588. }
  589. }
  590. });
  591. },
  592. copyProject(index) {
  593. var leftProgress = 10;
  594. if (this.reportTimeType.type == 3) {
  595. //计算已经待分配工时比例
  596. let array = this.form.domains;
  597. let totalProgress = 0;
  598. for (var i=0;i<array.length; i++) {
  599. totalProgress += array[i].progress;
  600. }
  601. if (totalProgress < 100) {
  602. leftProgress = 100 - totalProgress;
  603. }
  604. }
  605. var newIndex = index+1;
  606. var pName = "";
  607. if (this.form.domains[index].projectId != '') {
  608. pName = this.project.filter(p=>p.id == this.form.domains[index].projectId)[0].projectName;
  609. }
  610. var itemDomain = {
  611. id: null,
  612. projectId: this.form.domains[index].projectId,
  613. projectName: pName,
  614. workingTime: this.reportTimeType.type==3?(leftProgress*this.reportTimeType.allday/100).toFixed(1):"",
  615. progress:leftProgress,
  616. content: "",
  617. state: 2,
  618. isOvertime:false,
  619. };
  620. this.form.domains.splice(newIndex, 0,itemDomain);
  621. },
  622. //删除日报
  623. deleteReport() {
  624. this.$dialog.confirm({
  625. title: '删除日报',
  626. message: '确定要删除当天日报吗?'
  627. }).then(() => {
  628. const toast = this.$toast.loading({
  629. forbidClick: true,
  630. duration: 0
  631. });
  632. this.$axios.post("/report/delete", {userId: this.user.id, date:this.form.createDate})
  633. .then(res => {
  634. if(res.code == "ok") {
  635. this.$toast.clear();
  636. this.$toast.success('删除成功');
  637. window.location.reload();
  638. } else {
  639. this.$toast.clear();
  640. this.$toast.fail('删除失败');
  641. }
  642. }).catch(err=> {this.$toast.clear();});
  643. }).catch(() => {});
  644. },
  645. changeAllTime() {
  646. //总时长发生改变,自动按比例计算
  647. this.form.domains.forEach(d=>{
  648. d.workingTime = (d.progress*this.reportTimeType.allday/100).toFixed(1);
  649. });
  650. },
  651. cancel() {
  652. const toast = this.$toast.loading({
  653. forbidClick: true,
  654. duration: 0
  655. });
  656. var ids = '';
  657. var data = this.form.domains;
  658. data.forEach(element => {
  659. if (element.id != null && element.id != '') {
  660. ids +=(element.id+',');
  661. }
  662. });
  663. this.$axios.post("/report/cancel", {userId: this.user.id, reportIds:ids})
  664. .then(res => {
  665. if(res.code == "ok") {
  666. this.$toast.clear();
  667. this.$toast.success('撤销成功');
  668. this.getReport();
  669. } else {
  670. this.$toast.clear();
  671. this.$toast.fail('获取失败');
  672. }
  673. }).catch(err=> {this.$toast.clear();});
  674. },
  675. confirmWorkTime(field) {
  676. if (field == 0) {
  677. this.curWorktime.startTime = this.startTime;
  678. this.showWorkStartTime = false;
  679. } else {
  680. this.curWorktime.endTime = this.endTime;
  681. this.showWorkEndTime = false;
  682. }
  683. },
  684. confirmTime(item, field) {
  685. if (field == 0) {
  686. item.startTime = this.startTime;
  687. this.showStartTime = false;
  688. } else {
  689. item.endTime = this.endTime;
  690. this.showEndTime = false;
  691. }
  692. },
  693. filter(type, options) {
  694. if (type === 'minute') {
  695. return options.filter(option => option % 30 === 0);
  696. }
  697. return options;
  698. },
  699. choseTimePick(value, index) {
  700. //选中时间
  701. if (this.reportTimeType.type == 0) {
  702. this.form.domains[this.clickTimeIndex].timeType = value.value;
  703. this.form.domains[this.clickTimeIndex].workingTime = value.hours;
  704. this.form.domains[this.clickTimeIndex].label = value.label;
  705. this.showPickerTime = false;
  706. } else if (this.reportTimeType.type == 1) {
  707. // console.log('this.reportTimeType.type=='+value,this.form.domains);
  708. this.form.domains[this.clickTimeIndex].workingTime = value;
  709. this.form.domains[this.clickTimeIndex].label = value.toFixed(1)+'小时';
  710. this.showPickerHours = false;
  711. let allhour = 0
  712. for(let i in this.form.domains){
  713. this.form.domains[i].isOvertime = false
  714. delete this.form.domains[i].overtimeHours
  715. allhour += this.form.domains[i].workingTime
  716. }
  717. if(allhour > this.user.timeType.allday){
  718. this.form.domains[this.clickTimeIndex].isOvertime = true
  719. this.form.domains[this.clickTimeIndex].overtimeHours = allhour - this.user.timeType.allday
  720. }
  721. }
  722. },
  723. clickTimePicker(i) {
  724. if (!this.canEdit) {
  725. return;
  726. }
  727. this.clickTimeIndex = i;
  728. if (this.reportTimeType.type == 0) {
  729. this.showPickerTime = true;
  730. } else if (this.reportTimeType.type == 1) {
  731. this.showPickerHours = true;
  732. }
  733. },
  734. getTimeType() {
  735. this.$axios.post('/time-type/getCompanyTimeSetting', { companyId: this.user.companyId})
  736. .then(res => {
  737. if(res.code == "ok") {
  738. var t = res.data;
  739. this.reportTimeType = t;
  740. //转化时间格式
  741. if (t.allday != null) {
  742. this.timeType.push({value:0, label:'全天 - '+t.allday+'小时', hours:t.allday});
  743. }
  744. if (t.am != null) {
  745. this.timeType.push({value:1, label:'上午 - '+t.am+'小时', hours: t.am});
  746. }
  747. if (t.pm != null) {
  748. this.timeType.push({value:2, label:'下午 - '+t.pm+'小时', hours: t.pm});
  749. }
  750. } else {
  751. this.$toast.clear();
  752. this.$toast.fail(res.msg);
  753. }
  754. }).catch(err=> {this.$toast.clear();});
  755. },
  756. // 返回
  757. back() {
  758. history.back();
  759. },
  760. // 时间转换
  761. format(date, pattern) {
  762. pattern = pattern || "yyyy-MM-dd";
  763. var _this = this;
  764. return pattern.replace(/([yMdhsm])(\1*)/g, function ($0) {
  765. switch ($0.charAt(0)) {
  766. case 'y': return _this.padding(date.getFullYear(), $0.length);
  767. case 'M': return _this.padding(date.getMonth() + 1, $0.length);
  768. case 'd': return _this.padding(date.getDate(), $0.length);
  769. case 'w': return date.getDay() + 1;
  770. case 'h': return _this.padding(date.getHours(), $0.length);
  771. case 'm': return _this.padding(date.getMinutes(), $0.length);
  772. case 's': return _this.padding(date.getSeconds(), $0.length);
  773. }
  774. });
  775. },
  776. padding(s, len) {
  777. var len = len - (s + '').length;
  778. for (var i = 0; i < len; i++) { s = '0' + s; }
  779. return s;
  780. },
  781. // 获取项目
  782. getProject() {
  783. const toast = this.$toast.loading({
  784. forbidClick: true,
  785. duration: 0
  786. });
  787. this.$axios.post("/project/getProjectList", {})
  788. .then(res => {
  789. if(res.code == "ok") {
  790. this.$toast.clear();
  791. // if (this.project.length > 0) {
  792. // console.log('this.project[0].id=='+this.project[0].id);
  793. // this.getTaskList(this.project[0].id);
  794. // }
  795. } else {
  796. this.$toast.clear();
  797. this.$toast.fail('获取失败:'+res.msg);
  798. }
  799. }).catch(err=> {this.$toast.clear();});
  800. },
  801. // 获取日报
  802. getReport() {
  803. const toast = this.$toast.loading({
  804. forbidClick: true,
  805. duration: 0
  806. });
  807. this.$axios.post("/report/getReport", {date: this.form.createDate})
  808. .then(res => {
  809. if(res.code == "ok") {
  810. this.$toast.clear();
  811. this.report = res.data;
  812. var t = res.data.timeType;
  813. var timeType=[];
  814. //转化时间格式
  815. if (t.allday != null) {
  816. timeType.push({value:0, label:'全天 - '+t.allday+'小时', hours:t.allday});
  817. }
  818. if (t.am != null) {
  819. timeType.push({value:1, label:'上午 - '+t.am+'小时', hours: t.am});
  820. }
  821. if (t.pm != null) {
  822. timeType.push({value:2, label:'下午 - '+t.pm+'小时', hours: t.pm});
  823. }
  824. var list = res.data.report;
  825. if(list.length != 0) {
  826. this.canEdit = false;
  827. this.canCancel = false;
  828. let array = [];
  829. for(var i in list) {
  830. var projectName = "";
  831. var flg = (list[i].isOvertime == 1);
  832. for(var j in this.project) {
  833. if(this.project[j].id == list[i].projectId) {
  834. projectName = this.project[j].projectName;
  835. }
  836. }
  837. let tname = '';
  838. if (list[i].taskId != null && list[i].taskList.length > 0) {
  839. let filterList = list[i].taskList.filter(t=>t.taskId == list[i].taskId);
  840. if (filterList.length > 0) {
  841. tname = filterList[0].taskName;
  842. }
  843. }
  844. let mmm = list[i].degreeId
  845. let sss = list[i].degreeList
  846. let wuduName = ''
  847. for (var s in sss) {
  848. if(sss[s].id == mmm) {
  849. wuduName = sss[s].name
  850. }
  851. }
  852. let serverPicArray = [];
  853. // console.log('picArray=='+list[i].picStr);
  854. if (list[i].picStr != null && list[i].picStr != '@') {
  855. serverPicArray = JSON.parse(list[i].picStr.replace(/@/g,","));
  856. }
  857. var subProjectName = null;
  858. if (list[i].subProjectId) {
  859. subProjectName = list[i].subProjectList.filter(s=>s.id==list[i].subProjectId)[0].name;
  860. }
  861. array.push({
  862. id: list[i].id,
  863. projectId: list[i].projectId,
  864. projectName: projectName,
  865. workingTime: String(list[i].workingTime),
  866. content: list[i].content,
  867. state: list[i].state,
  868. timeType: list[i].timeType,
  869. label: timeType[list[i].timeType].label,
  870. startTime: list[i].startTime,
  871. endTime: list[i].endTime,
  872. isOvertime: flg,
  873. progress: list[i].progress,
  874. taskList: list[i].taskList,
  875. taskId: list[i].taskId,
  876. taskName:tname,
  877. professionProgress:list[i].professionProgressList,
  878. pics: list[i].pics,
  879. iospics:list[i].pics,
  880. serverPics:serverPicArray,
  881. multiWorktime:t.multiWorktime,
  882. worktimeList:list[i].worktimeList,
  883. wuduList: list[i].degreeList,
  884. weiduName: wuduName,
  885. degreeId: list[i].degreeId,
  886. subProjectId: list[i].subProjectId,
  887. subProjectName: subProjectName,
  888. subProjectList: list[i].subProjectList,
  889. groupId: list[i].groupId == 0?null:list[i].groupId,
  890. groupName: list[i].groupName,
  891. taskGroups:list[i].taskGroups,
  892. stages:list[i].stages,
  893. stage:list[i].stage == '-'?null:list[i].stage,
  894. customData: list[i].customData,
  895. projectAuditorId: list[i].projectAuditorId,
  896. projectAuditorName: list[i].projectAuditorName,
  897. auditUserList: list[i].auditUserList,
  898. overtimeHours: list[i].overtimeHours,
  899. customText: list[i].customText
  900. })
  901. if (list[i].state >= 2) {
  902. this.canEdit = true;
  903. } else if (list[i].state == 0) {
  904. this.canCancel = true;
  905. }
  906. }
  907. this.form.domains = array;
  908. } else {
  909. this.canCancel = false;
  910. this.canEdit = true;
  911. var shuzhi = this.user.timeType.allday + ''
  912. //没有填报的可以点击提交
  913. this.form.domains = [{
  914. id: null,
  915. projectId: "",
  916. projectName: "",
  917. // workingTime: t.type==3?(t.allday).toFixed(1):"8.0",
  918. workingTime: t.type==3?(t.allday).toFixed(1):shuzhi.indexOf('.') == '-1' ? shuzhi + '.0' : shuzhi,
  919. content: "",
  920. state: 2,
  921. progress:100,
  922. isOvertime:false,
  923. professionProgress:[],
  924. multiWorktime:t.multiWorktime,
  925. worktimeList:[{}],
  926. }]
  927. this.canEdit = true;
  928. }
  929. } else {
  930. this.$toast.clear();
  931. this.$toast.fail('获取失败:'+res.msg);
  932. }
  933. if(localStorage.getItem("formVal")) {
  934. // console.log('触发了')
  935. var obj = localStorage.getItem("formVal")
  936. this.form = JSON.parse(obj)
  937. localStorage.removeItem('formVal')
  938. }
  939. }).catch(err=> {this.$toast.clear();});
  940. },
  941. // 改变时间
  942. changeTime(time) {
  943. this.form.createDate = this.format(new Date(time),"yyyy-MM-dd");
  944. this.currentDate = time;
  945. this.showPicker = false;
  946. this.getReport();
  947. },
  948. //点击选择审核人
  949. clickPickAuditor(i, item) {
  950. if (!this.canEdit) return;
  951. if (item.auditUserList.length<=1) return;
  952. this.clickIndex = i;
  953. item.showPickerAuditor = true;
  954. this.$forceUpdate();
  955. },
  956. choseAuditor(value, index) {
  957. this.form.domains[this.clickIndex].projectAuditorId = value.auditorId;
  958. this.form.domains[this.clickIndex].projectAuditorName = value.auditorName;
  959. this.form.domains[this.clickIndex].showPickerAuditor = false;
  960. this.$forceUpdate();
  961. },
  962. //点击选择子项目
  963. clickPickSubProject(i, item) {
  964. if (!this.canEdit) return;
  965. this.clickIndex = i;
  966. item.showPickerSubProject = true;
  967. this.$forceUpdate();
  968. },
  969. clickPickCostId(i, item) {
  970. if (!this.canEdit) return;
  971. this.clickIndex = i;
  972. item.showPickerCostId = true;
  973. this.$forceUpdate();
  974. },
  975. clickPickTaskGroup(i, item) {
  976. if (!this.canEdit) return;
  977. this.clickIndex = i;
  978. item.showPickerTaskGroup = true;
  979. this.$forceUpdate();
  980. },
  981. clickPickStage(i, item) {
  982. if (!this.canEdit) return;
  983. this.clickIndex = i;
  984. item.showPickerStage = true;
  985. this.$forceUpdate();
  986. },
  987. // 选择项目
  988. clickPicker(i, item) {
  989. if (!this.canEdit) return;
  990. // this.clickIndex = i;
  991. // this.showPickerProject = true;
  992. // console.log(i, item, this.form)
  993. this.clickIndex = i
  994. this.showPickerUserddp = true
  995. // console.log(item);
  996. // this.dimension()
  997. // this.$router.push({
  998. // path: '/search',
  999. // query: {
  1000. // // from: JSON.stringify(this.form)
  1001. // from: this.form,
  1002. // idx: i
  1003. // }
  1004. // });
  1005. },
  1006. clickPickers(i,item) {
  1007. // console.log('wudulist',item.wuduList);
  1008. if (!this.canEdit) return;
  1009. this.clickIndex = i;
  1010. // item.showPickDegree = true;
  1011. this.$set(item,'showPickDegree',true)
  1012. // var proId = this.form.domains[this.clickIndex].projectId
  1013. // this.dimension(proId)
  1014. },
  1015. //选择任务
  1016. clickPickerTask(i) {
  1017. if (!this.canEdit) return;
  1018. // console.log(i);
  1019. this.clickIndex = i;
  1020. // var proId = this.form.domains[this.clickIndex].projectId
  1021. // this.getTaskList(proId)
  1022. this.form.domains[this.clickIndex].showPickerTask = true;
  1023. this.$forceUpdate();
  1024. },
  1025. choseTask(value, index) {
  1026. this.form.domains[this.clickIndex].taskId = value.taskId;
  1027. this.form.domains[this.clickIndex].taskName = value.taskName;
  1028. this.form.domains[this.clickIndex].showPickerTask = false;
  1029. this.$forceUpdate();
  1030. },
  1031. choseProjects(value, index) {
  1032. // console.log(value)
  1033. if(value){
  1034. this.form.domains[this.clickIndex].weiduName = value.name;
  1035. this.form.domains[this.clickIndex].degreeId = value.id;
  1036. this.$forceUpdate();}
  1037. this.form.domains[this.clickIndex].showPickDegree = false;
  1038. },
  1039. choseSubProject(value, index) {
  1040. this.form.domains[this.clickIndex].subProjectId = value.id;
  1041. this.form.domains[this.clickIndex].subProjectName = value.name;
  1042. this.form.domains[this.clickIndex].showPickerSubProject = false;
  1043. this.$forceUpdate();
  1044. },
  1045. choseTaskGroup(value, index) {
  1046. this.form.domains[this.clickIndex].groupId = value.id;
  1047. this.form.domains[this.clickIndex].groupName = value.name;
  1048. this.form.domains[this.clickIndex].showPickerTaskGroup = false;
  1049. var domainItem = this.form.domains[this.clickIndex];
  1050. this.getGroupStages(this.form.domains[this.clickIndex], index);
  1051. //检查当前的项目是否需要获取分组的负责人
  1052. var curProject = this.project.filter(p=>p.id == this.form.domains[this.clickIndex].projectId)[0];
  1053. if (curProject && curProject.taskGpIncharge == 1) {
  1054. this.$axios.post("/task-group/getGroupIncharger", {groupId: domainItem.groupId})
  1055. .then(res => {
  1056. if(res.code == "ok") {
  1057. domainItem.auditUserList = res.data;
  1058. if (res.data.length==1) {
  1059. domainItem.projectAuditorId = domainItem.auditUserList[0].auditorId;
  1060. domainItem.projectAuditorName = domainItem.auditUserList[0].auditorName;
  1061. }
  1062. this.$forceUpdate();
  1063. } else {
  1064. this.$toast.fail('获取失败:'+res.msg);
  1065. }
  1066. }).catch(err=> {this.$toast.clear();});
  1067. }
  1068. },
  1069. choseStage(value, index) {
  1070. this.form.domains[this.clickIndex].stage = value.stagesName;
  1071. this.form.domains[this.clickIndex].showPickerStage = false;
  1072. this.$forceUpdate();
  1073. },
  1074. choseCostId(value,index){
  1075. this.form.domains[this.clickIndex].basecostId = value.id;
  1076. this.form.domains[this.clickIndex].basecostName = value.name;
  1077. this.form.domains[this.clickIndex].showPickerCostId = false;
  1078. this.$forceUpdate();
  1079. },
  1080. getGroupStages(domain, index) {
  1081. this.$axios.post("/stages/getProjectStagesByGroup", {groupId: domain.groupId})
  1082. .then(res => {
  1083. if(res.code == "ok") {
  1084. domain.stage = '';
  1085. domain.stages = res.data;
  1086. this.$forceUpdate();
  1087. } else {
  1088. this.$toast.fail('获取失败');
  1089. }
  1090. }).catch(err=> {this.$toast.clear();});
  1091. },
  1092. getProjectProfessions(domain, index) {
  1093. // console.log(domain, '数据')
  1094. this.$axios.post("/project-profession/getMyProfession", {projectId: domain.projectId})
  1095. .then(res => {
  1096. if(res.code == "ok") {
  1097. this.form.domains[this.clickIndex].professionProgress = res.data;
  1098. // console.log(this.form.domains)
  1099. this.$forceUpdate();
  1100. } else {
  1101. this.$toast.fail('获取失败');
  1102. }
  1103. }).catch(err=> {this.$toast.clear();});
  1104. },
  1105. // 获取维度
  1106. dimension(projectId) {
  1107. this.$axios.post("/project/getDegreeList", {projectId: projectId})
  1108. .then(res => {
  1109. if(res.code == "ok") {
  1110. this.form.domains[this.clickIndex].wuduList = res.data;
  1111. this.$forceUpdate();
  1112. } else {
  1113. this.$toast.fail('获取失败');
  1114. }
  1115. }).catch(err=> {this.$toast.clear();});
  1116. },
  1117. getTaskList(projectId) {
  1118. //如果是专业版,需要列出任务列表
  1119. if (this.user.company.packageProject == 1) {
  1120. this.$axios.post("/task/getRecentTask", {projectId: projectId})
  1121. .then(res => {
  1122. if(res.code == "ok") {
  1123. this.form.domains[this.clickIndex].taskList = res.data;
  1124. this.form = this.form;
  1125. // this.$forceUpdate();
  1126. } else {
  1127. this.$toast.fail('获取失败');
  1128. }
  1129. }).catch(err=> {this.$toast.clear();});
  1130. }
  1131. },
  1132. //添加工时
  1133. addNewWorktime(index, item) {
  1134. item.worktimeList.push({});
  1135. },
  1136. // 添加项目
  1137. addNewPro() {
  1138. var leftProgress = 10;
  1139. if (this.reportTimeType.type == 3) {
  1140. //计算已经待分配工时比例
  1141. let array = this.form.domains;
  1142. let totalProgress = 0;
  1143. for (var i=0;i<array.length; i++) {
  1144. totalProgress += array[i].progress;
  1145. }
  1146. if (totalProgress < 100) {
  1147. leftProgress = 100 - totalProgress;
  1148. }
  1149. }
  1150. this.form.domains.push({
  1151. id: null,
  1152. projectId: "",
  1153. projectName: "",
  1154. workingTime: this.reportTimeType.type==3?(leftProgress*this.reportTimeType.allday/100).toFixed(1):"4.0",
  1155. progress:leftProgress,
  1156. content: "",
  1157. state: 2,
  1158. isOvertime:false,
  1159. multiWorktime: this.reportTimeType.multiWorktime,
  1160. worktimeList:[{}],
  1161. degreeId: null
  1162. })
  1163. },
  1164. // 移除项目
  1165. delPro(i) {
  1166. this.$dialog.confirm({
  1167. title: '',
  1168. message: '是否移除当前项目'
  1169. }).then(() => {
  1170. this.form.domains.splice(i,1);
  1171. }).catch(() => {
  1172. });
  1173. },
  1174. // 判断时间段
  1175. fns() {
  1176. for (let k in this.dateAr) {
  1177. if (!this.judege(k)) {
  1178. return false
  1179. }
  1180. }
  1181. return true
  1182. },
  1183. judege(idx){
  1184. for (let k in this.dateAr) {
  1185. if (idx !== k) {
  1186. if (this.dateAr[k].s <= this.dateAr[idx].s && this.dateAr[k].e > this.dateAr[idx].s) {
  1187. return false
  1188. }
  1189. if (this.dateAr[k].s < this.dateAr[idx].e && this.dateAr[k].e >= this.dateAr[idx].e) {
  1190. return false
  1191. }
  1192. }
  1193. }
  1194. return true
  1195. },
  1196. // 提交日报
  1197. submitReport() {
  1198. this.dateAr = []
  1199. let alp = []
  1200. if(this.user.timeType.multiWorktime == 1) {
  1201. for(var p in this.form.domains) {
  1202. var slll = this.form.domains[p]
  1203. for(var o in slll.worktimeList) {
  1204. if(slll.worktimeList[o].startTime || slll.worktimeList[o].endTime) {
  1205. let objs = {}
  1206. objs.s = slll.worktimeList[o].startTime
  1207. objs.e = slll.worktimeList[o].endTime
  1208. alp.push(objs)
  1209. }
  1210. }
  1211. }
  1212. this.dateAr = alp
  1213. if(this.dateAr.length > 0) {
  1214. let trus = this.fns()
  1215. if(!trus) {
  1216. this.$toast('填写的时间段重叠')
  1217. return
  1218. }
  1219. }
  1220. }
  1221. // return
  1222. const toast = this.$toast.loading({
  1223. forbidClick: true,
  1224. duration: 0
  1225. });
  1226. // let formData = new FormData();
  1227. let formData = new URLSearchParams()
  1228. formData.append("draft", this.isDraft);
  1229. if (this.reportTimeType.type == 0) {
  1230. var alldayNum = 0;
  1231. var amNum = 0;
  1232. var pmNum = 0;
  1233. for(var i in this.form.domains) {
  1234. if (this.form.domains[i].timeType == 0) {
  1235. alldayNum ++;
  1236. } else if (this.form.domains[i].timeType == 1) {
  1237. amNum++;
  1238. } else if (this.form.domains[i].timeType == 2) {
  1239. pmNum++;
  1240. }
  1241. }
  1242. if (alldayNum > 1) {
  1243. this.$toast.fail("工作时间-全天,只能选择一次");
  1244. return;
  1245. }
  1246. if (amNum > 1) {
  1247. this.$toast.fail("工作时间-上午,只能选择一次");
  1248. return;
  1249. }
  1250. if (pmNum > 1) {
  1251. this.$toast.fail("工作时间-下午,只能选择一次");
  1252. return;
  1253. }
  1254. if (alldayNum == 1 && (amNum > 0 || pmNum > 0)) {
  1255. this.$toast.fail("工作时间-全天,不能和上下午同时存在");
  1256. return;
  1257. }
  1258. } else if (this.reportTimeType.type == 3) {
  1259. //总百分比不能超过100%
  1260. let total = 0;
  1261. this.form.domains.forEach(w=>{total += w.progress});
  1262. if (total > 100) {
  1263. this.$toast.fail("用时比例之和不能超过100%");
  1264. return;
  1265. } else if (total < 100) {
  1266. this.$toast.fail("工时尚未完全分配,无法提交");
  1267. return;
  1268. }
  1269. }
  1270. if (this.reportTimeType.type == 1 && this.report.time) {
  1271. var totalTime = 0;
  1272. for (var t=0;t<this.form.domains.length; t++) {
  1273. totalTime += parseFloat(this.form.domains[t].workingTime);
  1274. }
  1275. if (this.report.time.workHours && totalTime > parseFloat(this.report.time.workHours)) {
  1276. this.$toast.fail("填报工时之和"+(totalTime)+"h不能超过考勤总工时("+this.report.time.workHours.toFixed(1)+"h)");
  1277. return;
  1278. }
  1279. }
  1280. //填字段
  1281. for(var i in this.form.domains) {
  1282. if (this.user.timeType.customDegreeActive == 1) {
  1283. if(this.form.domains[i].degreeId) {
  1284. formData.append("degreeId", this.form.domains[i].degreeId);
  1285. } else {
  1286. if(this.user.timeType.customDegreeStatus && this.form.domains[i].wuduList.length){
  1287. this.$toast.fail('请选择' + this.user.timeType.customDegreeName)
  1288. return
  1289. }else{
  1290. formData.append("degreeId", -1);
  1291. }
  1292. }
  1293. } else {
  1294. formData.append("degreeId", -1);
  1295. }
  1296. if(this.form.domains[i].customData) {
  1297. formData.append("customData", this.form.domains[i].customData);
  1298. } else {
  1299. formData.append("customData", "0");
  1300. }
  1301. if(this.form.domains[i].customText) {
  1302. formData.append("customText", this.form.domains[i].customText);
  1303. } else {
  1304. formData.append("customText", "-");
  1305. }
  1306. if (this.form.domains[i].id) {
  1307. formData.append("id", this.form.domains[i].id);
  1308. } else {
  1309. formData.append("id", -1);
  1310. }
  1311. formData.append("projectId", parseFloat(this.form.domains[i].projectId));
  1312. if (this.form.domains[i].subProjectId) {
  1313. formData.append("subProjectId", this.form.domains[i].subProjectId);
  1314. } else {
  1315. formData.append("subProjectId", 0);
  1316. }
  1317. if (this.form.domains[i].groupId) {
  1318. formData.append("groupId", this.form.domains[i].groupId);
  1319. } else {
  1320. formData.append("groupId", 0);
  1321. }
  1322. if (this.form.domains[i].stage) {
  1323. formData.append("stage", this.form.domains[i].stage);
  1324. } else {
  1325. formData.append("stage", '-');
  1326. }
  1327. formData.append("reportTimeType", this.reportTimeType.type);
  1328. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  1329. if (this.reportTimeType.type == 0) {
  1330. formData.append("timeType", this.form.domains[i].timeType);
  1331. formData.append("workingTime", parseFloat(this.form.domains[i].workingTime));
  1332. } else if (this.reportTimeType.type == 1) {
  1333. formData.append("workingTime", parseFloat(this.form.domains[i].workingTime));
  1334. } else if (this.reportTimeType.type == 2) {
  1335. formData.append("startTime", this.form.domains[i].startTime);
  1336. formData.append("endTime",this.form.domains[i].endTime);
  1337. } else if (this.reportTimeType.type == 3) {
  1338. formData.append("progress", this.form.domains[i].progress);
  1339. formData.append("workingTime",this.form.domains[i].workingTime);
  1340. }
  1341. if (this.form.domains[i].taskId) {
  1342. formData.append("taskId", this.form.domains[i].taskId);
  1343. } else {
  1344. formData.append("taskId", 0);
  1345. }
  1346. if (this.form.domains[i].taskFinish == true) {
  1347. formData.append("taskFinish", 1);
  1348. } else {
  1349. formData.append("taskFinish", 0);
  1350. }
  1351. formData.append("createDate", this.form.createDate);
  1352. formData.append("isOvertime", this.form.domains[i].isOvertime?1:0);
  1353. if (this.form.domains[i].overtimeHours && this.form.domains[i].isOvertime == 1) {
  1354. formData.append("overtimeHours", this.form.domains[i].overtimeHours);
  1355. } else {
  1356. formData.append("overtimeHours", 0);
  1357. }
  1358. //项目专业进度
  1359. if (this.form.domains[i].professionProgress) {
  1360. let m = JSON.stringify(this.form.domains[i].professionProgress);
  1361. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  1362. formData.append("professionProgress", m);
  1363. } else {
  1364. formData.append("professionProgress", "[]");
  1365. }
  1366. //图片的处理,serverPic是当前所有的照片
  1367. if (this.form.domains[i].serverPics) {
  1368. let m = JSON.stringify(this.form.domains[i].serverPics);
  1369. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  1370. formData.append("pics", m);
  1371. } else {
  1372. formData.append("pics", "@");
  1373. }
  1374. //处理多个时间事项
  1375. if (this.reportTimeType.multiWorktime == 1) {
  1376. //检查时间是否有重叠
  1377. var workList = this.form.domains[i].worktimeList;
  1378. for (var j=0;j<workList.length; j++) {
  1379. var curItem = workList[j];
  1380. if (curItem.startTime == null || curItem.endTime == null) {
  1381. this.$toast.fail("请设置工作时间");
  1382. return;
  1383. }
  1384. //检查开始时间是否大于结束时间
  1385. if (curItem.startTime >= curItem.endTime) {
  1386. this.$toast.fail("时间段"+curItem.startTime+'-'+curItem.endTime+"有误:"+
  1387. "结束时间必须大于开始时间");
  1388. return;
  1389. }
  1390. for (var p = j+1;p<workList.length; p++) {
  1391. var jItem = workList[p];
  1392. if ((jItem.startTime>=curItem.startTime&&jItem.startTime < curItem.endTime)
  1393. || (jItem.endTime>curItem.startTime&&jItem.endTime <= curItem.endTime)) {
  1394. this.$toast.fail("时间段"+curItem.startTime+'-'+curItem.endTime+"与"+
  1395. jItem.startTime+'-'+jItem.endTime+ "存在重叠,请修改。");
  1396. return;
  1397. }
  1398. }
  1399. }
  1400. let m = JSON.stringify(this.form.domains[i].worktimeList);
  1401. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  1402. formData.append("content", m);
  1403. } else {
  1404. if (this.form.domains[i].content) {
  1405. formData.append("content", this.form.domains[i].content);
  1406. } else {
  1407. formData.append("content", '-');
  1408. }
  1409. }
  1410. //审核人
  1411. if (this.form.domains[i].projectAuditorId) {
  1412. formData.append("projectAuditorId", this.form.domains[i].projectAuditorId);
  1413. } else {
  1414. if (this.form.domains[i].taskGpIncharge == 0) {
  1415. this.$toast.fail("请指定["+this.form.domains[i].projectName+']项目的审核人');
  1416. } else if (this.form.domains[i].taskGroups.length == 0) {
  1417. this.$toast.fail("您在["+this.form.domains[i].projectName+"]项目上尚无参与的任务分组");
  1418. }
  1419. return;
  1420. }
  1421. }
  1422. if(!this.flgLg) {
  1423. return
  1424. }
  1425. this.flgLg = false
  1426. this.$axios.post("/report/editReport", formData)
  1427. .then(res => {
  1428. this.flgLg = true
  1429. if(res.code == "ok") {
  1430. this.$toast.clear();
  1431. this.$toast.success(this.isDraft==0?'提交成功':'暂存成功');
  1432. this.$router.push("/index");
  1433. } else {
  1434. this.$toast.clear();
  1435. this.$toast.fail((this.isDraft==0?'提交失败':'暂存失败')+':'+res.msg);
  1436. }
  1437. }).catch(err=> {this.$toast.clear(); this.flgLg = true});
  1438. },
  1439. //初始化参数
  1440. initWxConfig() {
  1441. var curUrl=location.href.split("#")[0];
  1442. this.$axios.post("/wxcorp/getCorpWXConfig", {url: curUrl, token: this.user.id})
  1443. .then(res => {
  1444. if(res.code == "ok") {
  1445. var data=res.data;
  1446. wx.config({
  1447. beta: true,
  1448. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  1449. appId: data.appid, // 必填,公众号的唯一标识
  1450. timestamp: data.timestamp, // 必填,生成签名的时间戳
  1451. nonceStr: data.noncestr, // 必填,生成签名的随机串
  1452. signature: data.sign, // 必填,签名,见附录1
  1453. jsApiList: [
  1454. 'chooseImage',
  1455. 'previewImage',
  1456. 'uploadImage',
  1457. 'downloadImage',
  1458. 'previewFile',
  1459. 'getLocation',
  1460. ]
  1461. });
  1462. var that = this;
  1463. wx.ready(function(){
  1464. // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
  1465. // if (that.user.companyId == 7) {
  1466. // that.$toast('wx init success==7 ');
  1467. // that.getLocation();
  1468. // }
  1469. });
  1470. } else {
  1471. this.$toast.fail('获取失败');
  1472. }
  1473. }).catch(err=> {this.$toast.fail('发生异常'+err);console.log(err)});
  1474. },
  1475. deleteImg(item, index) {
  1476. //删除添加的图片
  1477. if (this.isIOSystem) {
  1478. item.iospics.splice(index,1);
  1479. item.iospics = item.iospics;
  1480. }
  1481. item.pics.splice(index,1);
  1482. item.pics = item.pics;
  1483. //传递到后台的数据也要做同步删除
  1484. item.serverPics.splice(index,1);
  1485. this.$forceUpdate();
  1486. },
  1487. //企业微信获取定位
  1488. getLocation() {
  1489. wx.getLocation({
  1490. type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
  1491. success: function (res) {
  1492. var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
  1493. var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
  1494. alert(JSON.stringify(res));
  1495. }
  1496. });
  1497. }
  1498. },
  1499. mounted() {
  1500. // console.log('user',this.user)
  1501. var ua = navigator.userAgent.toLowerCase();
  1502. this.isIOSystem = this.isIOS();
  1503. if (ua.indexOf("wxwork") > 0) {
  1504. this.isCorpWX = true;
  1505. } else if (ua.indexOf("micromessenger") > 0) {
  1506. this.isWX = true;
  1507. }
  1508. this.getPeoject() // 获取项目
  1509. console.log('mounted');
  1510. this.getReportBasecostList()
  1511. //获取传递过来的日期
  1512. var passDate = this.$route.query.date;
  1513. if (passDate != null) {
  1514. this.form.createDate = this.$route.query.date;
  1515. }
  1516. // this.getProject();
  1517. this.getReport();
  1518. this.getTimeType();
  1519. //初始化微信js-sdk参数
  1520. if (this.isCorpWX) {
  1521. this.initWxConfig();
  1522. }
  1523. if(this.user.timeType.lockWorktime){
  1524. this.timeRange = this.timeRange.filter(item => {return item <= this.user.timeType.allday})
  1525. }
  1526. // if(localStorage.getItem("formVal")) {
  1527. // var obj = localStorage.getItem("formVal")
  1528. // this.form = JSON.parse(obj)
  1529. // localStorage.removeItem('formVal')
  1530. // }
  1531. },
  1532. beforeDestroy() {
  1533. localStorage.removeItem('formVal')
  1534. }
  1535. };
  1536. </script>
  1537. <style lang="less" scope>
  1538. .my-swipe .van-swipe-item {
  1539. color: #fff;
  1540. font-size: 20px;
  1541. line-height: 150px;
  1542. text-align: center;
  1543. background-color: #39a9ed;
  1544. }
  1545. .van-field__control:disabled {
  1546. -webkit-text-fill-color:#646566;
  1547. }
  1548. .login_form {
  1549. margin-top: 46px;
  1550. position: relative;
  1551. }
  1552. .attendanceRecord{
  1553. position: absolute;
  1554. top: 0.26667rem;
  1555. right: 0.42667rem;
  1556. color: #969799;
  1557. font-size: 0.35rem;
  1558. line-height: 0.64rem;
  1559. }
  1560. .form_domains {
  1561. position: relative;
  1562. .form_copy {
  1563. position: absolute;
  1564. right: 85px;
  1565. top: 10px;
  1566. }
  1567. .form_addNew {
  1568. text-align: center;
  1569. margin:10px;
  1570. }
  1571. .form_del {
  1572. position: absolute;
  1573. right: 10px;
  1574. top: 10px;
  1575. }
  1576. // .form_del {
  1577. // color: #ff0000;
  1578. // font-size: 22px;
  1579. // position: absolute;
  1580. // right: 15px;
  1581. // top: 10px;
  1582. // }
  1583. }
  1584. .form_tip {
  1585. text-align: center;
  1586. margin-top: 20px;
  1587. color: #afafaf;
  1588. font-size: 14px;
  1589. }
  1590. .card__footer {
  1591. padding-top: 10px;
  1592. }
  1593. .card__tags {
  1594. .van-tag {
  1595. margin-right: 5px;
  1596. }
  1597. }
  1598. .overTimeClas{
  1599. display: flex;
  1600. width: 7.4rem;
  1601. // justify-content: space-between;
  1602. align-items: center;
  1603. }
  1604. </style>
  1605. <style lang="less">
  1606. .van-nav-bar .van-icon , .van-nav-bar__text {
  1607. color: #20a0ff;
  1608. }
  1609. .overtime {
  1610. height: 50px;
  1611. box-sizing: border-box;
  1612. padding-left: 10px;
  1613. display: flex;
  1614. align-items: center;
  1615. }
  1616. .custom-button {
  1617. width: 40px;
  1618. color: #fff;
  1619. font-size: 10px;
  1620. line-height: 16px;
  1621. text-align: center;
  1622. background-color: #1989fa;
  1623. border-radius: 100px;
  1624. }
  1625. .imgList {
  1626. position: relative;
  1627. width: 100px;
  1628. height: 100px;
  1629. display: inline-block;
  1630. }
  1631. .imgList_i {
  1632. position: absolute;
  1633. top: -8px;
  1634. right: -6px;
  1635. z-index: 999;
  1636. }
  1637. .ryuan {
  1638. padding: 0.3rem 0.53333rem;
  1639. // line-height: 40px;
  1640. // height: 40px;
  1641. color: #333;
  1642. border-bottom: 2px solid #f6f6f6;
  1643. width: 100%;
  1644. overflow: hidden;
  1645. text-overflow:ellipsis;
  1646. white-space: nowrap;
  1647. }
  1648. .overListTime {
  1649. margin-left:5px;
  1650. display: inline-block;
  1651. width: 2rem;
  1652. color: #646566;
  1653. }
  1654. .hoveOver {
  1655. color: #C8C9CC;
  1656. }
  1657. .van-checkbox__label {
  1658. color: #646566 !important;
  1659. }
  1660. .van-checkbox__label--disabled {
  1661. color: #c8c9cc !important;
  1662. }
  1663. </style>