weekEdit.vue 88 KB

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