weekEdit.vue 89 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817
  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. for(var i in res.data) {
  476. if(res.data[i].projectCode == 'null' || res.data[i].projectCode == null) {
  477. res.data[i].projectCode = ' '
  478. }
  479. }
  480. this.projectss = res.data;
  481. this.projectss = this.projectss.filter(p=>p.status == 1);
  482. this.proads = res.data
  483. } else {
  484. this.$toast.fail('获取失败:'+res.msg);
  485. }
  486. }).catch(err=> {this.$toast.clear();});
  487. },
  488. sea() {
  489. console.log(this.userName.length)
  490. if(this.userName.length > 0) {
  491. // console.log(123)
  492. // let text = this.userName
  493. // let reg = new RegExp(text)
  494. // // let data = this.proads.filter(item => reg.test(item.projectName)) //返回
  495. // let data = this.proads.filter(item => reg.test(item.projectName)) //返回
  496. // let datas = this.proads.filter(item => reg.test(item.projectCode))
  497. // let dataTree = data.concat(datas)
  498. // let arrList = Array.from(new Set(dataTree))
  499. // // this.projectss = data
  500. // this.projectss = arrList
  501. let data = this.proads.filter(item => {return item.projectName.indexOf(this.userName.toUpperCase()) != '-1'});
  502. let dataList = this.proads.filter(item => {return item.projectCode.indexOf(this.userName.toUpperCase()) != '-1'});
  503. let dataTree = data.concat(dataList)
  504. let arrList = Array.from(new Set(dataTree))
  505. this.projectss = arrList
  506. } else {
  507. console.log(456)
  508. this.projectss = this.proads
  509. }
  510. },
  511. fZr(item,index) {
  512. var domainItem = this.currentForm.domains[this.proIdx];
  513. domainItem.projectId = item.id;
  514. domainItem.projectName = item.projectName;
  515. //清空子项目
  516. domainItem.subProjectId = null;
  517. domainItem.subProjectName = null;
  518. //清空任务
  519. domainItem.taskId = null;
  520. domainItem.taskName = null;
  521. //清空分组和阶段
  522. domainItem.stage = null;
  523. domainItem.groupId = null;
  524. this.showPickerUserddp = false;
  525. //获取子项目
  526. this.getSubprojectList(this.currentForm.domains[this.proIdx]);
  527. //加载项目相关的工程进度
  528. if (this.user.company.packageEngineering == 1){
  529. this.getProjectProfessions(this.currentForm.domains[this.proIdx],index);
  530. }
  531. //获取任务分组
  532. this.getTaskGroups(this.currentForm.domains[this.proIdx], this.proIdx);
  533. // 获取1相关维度
  534. this.getTaskList(domainItem.projectId)
  535. //获取相关日报提交选择人
  536. domainItem.projectAuditorId = null;
  537. domainItem.projectAuditorName = null;
  538. domainItem.auditUserList = null;
  539. //获取项目审核人
  540. var curProject = this.project.filter(p=>p.id == domainItem.projectId)[0];
  541. if (curProject.taskGpIncharge == 0) {
  542. this.getProjectAuditorList(domainItem, index);
  543. }
  544. domainItem.taskGpIncharge = curProject.taskGpIncharge;
  545. },
  546. //获取项目下的任务分组
  547. getTaskGroups(domainItem, index) {
  548. domainItem.groupId=null;
  549. this.$axios.post("/task-group/listMyJoinGroup", {projectId: domainItem.projectId})
  550. .then(res => {
  551. if(res.code == "ok") {
  552. domainItem.taskGroups = res.data;
  553. }
  554. this.$forceUpdate();
  555. }).catch(err=> {this.$toast.clear();});
  556. },
  557. getSubprojectList(domainItem) {
  558. domainItem.subProjectList = [];
  559. this.$axios.post("/sub-project/list", {projectId: domainItem.projectId})
  560. .then(res => {
  561. if(res.code == "ok") {
  562. domainItem.subProjectList = res.data;
  563. }
  564. this.$forceUpdate();
  565. }).catch(err=> {this.$toast.clear();});
  566. },
  567. showEndDialog(timeItem) {
  568. this.curWorktime = timeItem;
  569. this.showWorkEndTime = true;
  570. },
  571. showStartDialog(timeItem) {
  572. this.curWorktime = timeItem;
  573. this.showWorkStartTime = true;
  574. },
  575. removeTimeItem(item, index) {
  576. item.worktimeList.splice(index, 1);
  577. },
  578. isIOS(){
  579. var u = navigator.userAgent;
  580. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
  581. return isiOS;
  582. },
  583. showLargeImg(item, index) {
  584. this.imgShow = true;
  585. this.tmpPics = item;
  586. },
  587. //拍照上传
  588. takePhoto(index) {
  589. var that = this;
  590. wx.chooseImage({
  591. count: 9, // 默认9
  592. sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
  593. sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
  594. defaultCameraMode: "batch", //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
  595. isSaveToAlbum: 0, //整型值,0表示拍照时不保存到系统相册,1表示自动保存,默认值是1
  596. success: function (res) {
  597. var localIds = res.localIds; // 返回选定照片的本地ID列表,
  598. // andriod中localId可以作为img标签的src属性显示图片;
  599. // iOS应当使用 getLocalImgData 获取图片base64数据,从而用于img标签的显示(在img标签内使用 wx.chooseImage 的 localid 显示可能会不成功)
  600. if (that.currentForm.domains[index].pics == null) {
  601. that.currentForm.domains[index].pics = [];
  602. that.currentForm.domains[index].iospics = [];
  603. }
  604. if (that.isIOSystem) {
  605. for (var i=0;i<localIds.length; i++) {
  606. wx.getLocalImgData({
  607. localId: localIds[i], // 图片的localID
  608. success: function (res) {
  609. var localData = res.localData; // localData是图片的base64数据,可以用img标签显示
  610. that.currentForm.domains[index].iospics.push(localData);
  611. that.$forceUpdate();
  612. }
  613. });
  614. }
  615. if (that.user.companyId == 7) {
  616. that.currentForm.domains[index].pics = that.currentForm.domains[index].pics.concat(localIds);
  617. } else {
  618. that.currentForm.domains[index].pics = localIds;
  619. }
  620. } else {
  621. if (that.user.companyId == 7) {
  622. that.currentForm.domains[index].pics = that.currentForm.domains[index].pics.concat(localIds);
  623. } else {
  624. that.currentForm.domains[index].pics = localIds;
  625. }
  626. that.$forceUpdate();
  627. }
  628. // var serverIdList = [];
  629. if (that.currentForm.domains[index].serverPics == null) {
  630. that.currentForm.domains[index].serverPics = [];
  631. }
  632. //立即就上传到企业微信服务器
  633. for (var i=0;i<localIds.length; i++) {
  634. wx.uploadImage({
  635. localId: localIds[i], // 需要上传的图片的本地ID,由chooseImage接口获得
  636. isShowProgressTips: 1, // 默认为1,显示进度提示
  637. success: function (res) {
  638. var serverId = res.serverId; // 返回图片的服务器端ID
  639. // serverIdList.push(serverId);
  640. that.currentForm.domains[index].serverPics.push(serverId);
  641. }
  642. });
  643. }
  644. }
  645. });
  646. },
  647. copyProject(index) {
  648. var leftProgress = 10;
  649. if (this.reportTimeType.type == 3) {
  650. //计算已经待分配工时比例
  651. let array = this.currentForm.domains;
  652. let totalProgress = 0;
  653. for (var i=0;i<array.length; i++) {
  654. totalProgress += array[i].progress;
  655. }
  656. if (totalProgress < 100) {
  657. leftProgress = 100 - totalProgress;
  658. }
  659. }
  660. var newIndex = index+1;
  661. var pName = "";
  662. if (this.currentForm.domains[index].projectId != '') {
  663. pName = this.project.filter(p=>p.id == this.currentForm.domains[index].projectId)[0].projectName;
  664. }
  665. var itemDomain = {
  666. id: null,
  667. projectId: this.currentForm.domains[index].projectId,
  668. projectName: pName,
  669. workingTime: this.reportTimeType.type==3?(leftProgress*this.reportTimeType.allday/100).toFixed(1):"",
  670. progress:leftProgress,
  671. content: "",
  672. state: 2,
  673. isOvertime:false,
  674. };
  675. this.currentForm.domains.splice(newIndex, 0,itemDomain);
  676. },
  677. //删除日报
  678. deleteReport() {
  679. this.$dialog.confirm({
  680. title: '删除日报',
  681. message: '确定要删除当天日报吗?'
  682. }).then(() => {
  683. const toast = this.$toast.loading({
  684. forbidClick: true,
  685. duration: 0
  686. });
  687. this.$axios.post("/report/delete", {userId: this.user.id, date:this.currentForm.createDate})
  688. .then(res => {
  689. if(res.code == "ok") {
  690. this.$toast.clear();
  691. this.$toast.success('删除成功');
  692. window.location.reload();
  693. } else {
  694. this.$toast.clear();
  695. this.$toast.fail('删除失败');
  696. }
  697. }).catch(err=> {this.$toast.clear();});
  698. }).catch(() => {});
  699. },
  700. changeAllTime() {
  701. //总时长发生改变,自动按比例计算
  702. this.currentForm.domains.forEach(d=>{
  703. d.workingTime = (d.progress*this.reportTimeType.allday/100).toFixed(1);
  704. });
  705. },
  706. cancel() {
  707. const toast = this.$toast.loading({
  708. forbidClick: true,
  709. duration: 0
  710. });
  711. var ids = '';
  712. var data = this.currentForm.domains;
  713. data.forEach(element => {
  714. if (element.id != null && element.id != '') {
  715. ids +=(element.id+',');
  716. }
  717. });
  718. this.$axios.post("/report/cancel", {userId: this.user.id, reportIds:ids})
  719. .then(res => {
  720. if(res.code == "ok") {
  721. this.$toast.clear();
  722. this.$toast.success('撤销成功');
  723. // this.getReport();
  724. } else {
  725. this.$toast.clear();
  726. this.$toast.fail('获取失败');
  727. }
  728. }).catch(err=> {this.$toast.clear();});
  729. },
  730. confirmWorkTime(field) {
  731. if (field == 0) {
  732. this.curWorktime.startTime = this.startTime;
  733. this.showWorkStartTime = false;
  734. } else {
  735. this.curWorktime.endTime = this.endTime;
  736. this.showWorkEndTime = false;
  737. }
  738. },
  739. confirmTime(item, field) {
  740. if (field == 0) {
  741. item.startTime = this.startTime;
  742. this.showStartTime = false;
  743. } else {
  744. item.endTime = this.endTime;
  745. this.showEndTime = false;
  746. }
  747. },
  748. filter(type, options) {
  749. if (type === 'minute') {
  750. return options.filter(option => option % 30 === 0);
  751. }
  752. return options;
  753. },
  754. choseTimePick(value, index) {
  755. //选中时间
  756. if (this.reportTimeType.type == 0) {
  757. this.currentForm.domains[this.clickTimeIndex].timeType = value.value;
  758. this.currentForm.domains[this.clickTimeIndex].workingTime = value.hours;
  759. this.currentForm.domains[this.clickTimeIndex].label = value.label;
  760. this.showPickerTime = false;
  761. } else if (this.reportTimeType.type == 1) {
  762. console.log('this.reportTimeType.type=='+value);
  763. this.currentForm.domains[this.clickTimeIndex].workingTime = value;
  764. this.currentForm.domains[this.clickTimeIndex].label = value.toFixed(1)+'小时';
  765. this.showPickerHours = false;
  766. let allhour = 0
  767. for(let i in this.currentForm.domains){
  768. this.currentForm.domains[i].isOvertime = false
  769. delete this.currentForm.domains[i].overtimeHours
  770. allhour += this.currentForm.domains[i].workingTime
  771. }
  772. if(allhour > this.user.timeType.allday){
  773. this.currentForm.domains[this.clickTimeIndex].isOvertime = true
  774. this.currentForm.domains[this.clickTimeIndex].overtimeHours = allhour - this.user.timeType.allday
  775. }
  776. }
  777. },
  778. clickTimePicker(i) {
  779. // if (!this.canEdit) {
  780. // return;
  781. // }
  782. this.clickTimeIndex = i;
  783. if (this.reportTimeType.type == 0) {
  784. this.showPickerTime = true;
  785. } else if (this.reportTimeType.type == 1) {
  786. this.showPickerHours = true;
  787. }
  788. },
  789. getTimeType() {
  790. this.$axios.post('/time-type/getCompanyTimeSetting', { companyId: this.user.companyId})
  791. .then(res => {
  792. if(res.code == "ok") {
  793. var t = res.data;
  794. this.reportTimeType = t;
  795. //转化时间格式
  796. if (t.allday != null) {
  797. this.timeType.push({value:0, label:'全天 - '+t.allday+'小时', hours:t.allday});
  798. }
  799. if (t.am != null) {
  800. this.timeType.push({value:1, label:'上午 - '+t.am+'小时', hours: t.am});
  801. }
  802. if (t.pm != null) {
  803. this.timeType.push({value:2, label:'下午 - '+t.pm+'小时', hours: t.pm});
  804. }
  805. } else {
  806. this.$toast.clear();
  807. this.$toast.fail(res.msg);
  808. }
  809. }).catch(err=> {this.$toast.clear();});
  810. },
  811. // 返回
  812. back() {
  813. history.back();
  814. },
  815. // 时间转换
  816. format(date, pattern) {
  817. pattern = pattern || "yyyy-MM-dd";
  818. var _this = this;
  819. return pattern.replace(/([yMdhsm])(\1*)/g, function ($0) {
  820. switch ($0.charAt(0)) {
  821. case 'y': return _this.padding(date.getFullYear(), $0.length);
  822. case 'M': return _this.padding(date.getMonth() + 1, $0.length);
  823. case 'd': return _this.padding(date.getDate(), $0.length);
  824. case 'w': return date.getDay() + 1;
  825. case 'h': return _this.padding(date.getHours(), $0.length);
  826. case 'm': return _this.padding(date.getMinutes(), $0.length);
  827. case 's': return _this.padding(date.getSeconds(), $0.length);
  828. }
  829. });
  830. },
  831. padding(s, len) {
  832. var len = len - (s + '').length;
  833. for (var i = 0; i < len; i++) { s = '0' + s; }
  834. return s;
  835. },
  836. // 获取项目
  837. getProject() {
  838. const toast = this.$toast.loading({
  839. forbidClick: true,
  840. duration: 0
  841. });
  842. this.$axios.post("/project/getProjectList", {})
  843. .then(res => {
  844. if(res.code == "ok") {
  845. this.$toast.clear();
  846. this.project = res.data;
  847. // if (this.project.length > 0) {
  848. // console.log('this.project[0].id=='+this.project[0].id);
  849. // this.getTaskList(this.project[0].id);
  850. // }
  851. } else {
  852. this.$toast.clear();
  853. this.$toast.fail('获取失败:'+res.msg);
  854. }
  855. }).catch(err=> {this.$toast.clear();});
  856. },
  857. // 获取日报
  858. getReport() {
  859. const toast = this.$toast.loading({
  860. forbidClick: true,
  861. duration: 0
  862. });
  863. this.$axios.post("/report/getReport", {date: this.currentForm.createDate})
  864. .then(res => {
  865. if(res.code == "ok") {
  866. this.$toast.clear();
  867. this.report = res.data;
  868. var t = res.data.timeType;
  869. var timeType=[];
  870. //转化时间格式
  871. if (t.allday != null) {
  872. timeType.push({value:0, label:'全天 - '+t.allday+'小时', hours:t.allday});
  873. }
  874. if (t.am != null) {
  875. timeType.push({value:1, label:'上午 - '+t.am+'小时', hours: t.am});
  876. }
  877. if (t.pm != null) {
  878. timeType.push({value:2, label:'下午 - '+t.pm+'小时', hours: t.pm});
  879. }
  880. var list = res.data.report;
  881. if(list.length != 0) {
  882. // this.canEdit = false;
  883. this.canCancel = false;
  884. let array = [];
  885. for(var i in list) {
  886. var projectName = "";
  887. var flg = (list[i].isOvertime == 1);
  888. for(var j in this.project) {
  889. if(this.project[j].id == list[i].projectId) {
  890. projectName = this.project[j].projectName;
  891. }
  892. }
  893. let tname = '';
  894. if (list[i].taskId != null && list[i].taskList.length > 0) {
  895. let filterList = list[i].taskList.filter(t=>t.taskId == list[i].taskId);
  896. if (filterList.length > 0) {
  897. tname = filterList[0].taskName;
  898. }
  899. }
  900. let mmm = list[i].degreeId
  901. let sss = list[i].degreeList
  902. let wuduName = ''
  903. for (var s in sss) {
  904. if(sss[s].id == mmm) {
  905. wuduName = sss[s].name
  906. }
  907. }
  908. let serverPicArray = [];
  909. console.log('picArray=='+list[i].picStr);
  910. if (list[i].picStr != null && list[i].picStr != '@') {
  911. serverPicArray = JSON.parse(list[i].picStr.replace(/@/g,","));
  912. }
  913. var subProjectName = null;
  914. if (list[i].subProjectId) {
  915. subProjectName = list[i].subProjectList.filter(s=>s.id==list[i].subProjectId)[0].name;
  916. }
  917. array.push({
  918. id: list[i].id,
  919. projectId: list[i].projectId,
  920. projectName: projectName,
  921. workingTime: String(list[i].workingTime),
  922. content: list[i].content,
  923. state: list[i].state,
  924. timeType: list[i].timeType,
  925. label: timeType[list[i].timeType].label,
  926. startTime: list[i].startTime,
  927. endTime: list[i].endTime,
  928. isOvertime: flg,
  929. progress: list[i].progress,
  930. taskList: list[i].taskList,
  931. taskId: list[i].taskId,
  932. taskName:tname,
  933. professionProgress:list[i].professionProgressList,
  934. pics: list[i].pics,
  935. iospics:list[i].pics,
  936. serverPics:serverPicArray,
  937. multiWorktime:t.multiWorktime,
  938. worktimeList:list[i].worktimeList,
  939. wuduList: list[i].degreeList,
  940. weiduName: wuduName,
  941. degreeId: list[i].degreeId,
  942. subProjectId: list[i].subProjectId,
  943. subProjectName: subProjectName,
  944. subProjectList: list[i].subProjectList,
  945. groupId: list[i].groupId == 0?null:list[i].groupId,
  946. groupName: list[i].groupName,
  947. taskGroups:list[i].taskGroups,
  948. stages:list[i].stages,
  949. stage:list[i].stage == '-'?null:list[i].stage,
  950. customData: list[i].customData,
  951. projectAuditorId: list[i].projectAuditorId,
  952. projectAuditorName: list[i].projectAuditorName,
  953. auditUserList: list[i].auditUserList,
  954. overtimeHours: list[i].overtimeHours,
  955. customText: list[i].customText
  956. })
  957. if (list[i].state >= 2) {
  958. // this.canEdit = true;
  959. } else if (list[i].state == 0) {
  960. this.canCancel = true;
  961. }
  962. }
  963. this.currentForm.domains = array;
  964. } else {
  965. this.canCancel = false;
  966. // this.canEdit = true;
  967. //没有填报的可以点击提交
  968. this.currentForm.domains = [{
  969. id: null,
  970. projectId: "",
  971. projectName: "",
  972. workingTime: t.type==3?(t.allday).toFixed(1):"8.0",
  973. content: "",
  974. state: 2,
  975. progress:100,
  976. isOvertime:false,
  977. professionProgress:[],
  978. multiWorktime:t.multiWorktime,
  979. worktimeList:[{}],
  980. }]
  981. // this.canEdit = true;
  982. }
  983. } else {
  984. this.$toast.clear();
  985. this.$toast.fail('获取失败:'+res.msg);
  986. }
  987. // if(localStorage.getItem("formVal")) {
  988. // console.log('触发了')
  989. // var obj = localStorage.getItem("formVal")
  990. // this.form = JSON.parse(obj)
  991. // localStorage.removeItem('formVal')
  992. // }
  993. }).catch(err=> {this.$toast.clear();});
  994. },
  995. // 改变时间
  996. changeTime(time) {
  997. this.currentForm.createDate = this.format(new Date(time),"yyyy-MM-dd");
  998. this.currentDate = time;
  999. this.showPicker = false;
  1000. // this.getReport();
  1001. },
  1002. //点击选择审核人
  1003. clickPickAuditor(i, item) {
  1004. // if (!this.canEdit) return;
  1005. if (item.auditUserList.length<=1) return;
  1006. this.clickIndex = i;
  1007. item.showPickerAuditor = true;
  1008. this.$forceUpdate();
  1009. },
  1010. choseAuditor(value, index) {
  1011. this.currentForm.domains[this.clickIndex].projectAuditorId = value.auditorId;
  1012. this.currentForm.domains[this.clickIndex].projectAuditorName = value.auditorName;
  1013. this.currentForm.domains[this.clickIndex].showPickerAuditor = false;
  1014. this.$forceUpdate();
  1015. },
  1016. //点击选择子项目
  1017. clickPickSubProject(i, item) {
  1018. // if (!this.canEdit) return;
  1019. this.clickIndex = i;
  1020. item.showPickerSubProject = true;
  1021. this.$forceUpdate();
  1022. },
  1023. clickPickTaskGroup(i, item) {
  1024. // if (!this.canEdit) return;
  1025. this.clickIndex = i;
  1026. item.showPickerTaskGroup = true;
  1027. this.$forceUpdate();
  1028. },
  1029. clickPickStage(i, item) {
  1030. // if (!this.canEdit) return;
  1031. this.clickIndex = i;
  1032. item.showPickerStage = true;
  1033. this.$forceUpdate();
  1034. },
  1035. // 选择项目
  1036. clickPicker(i, item) {
  1037. // if (!this.canEdit) return;
  1038. // this.clickIndex = i;
  1039. // this.showPickerProject = true;
  1040. console.log(i, item, this.currentForm)
  1041. this.proIdx = i
  1042. this.showPickerUserddp = true
  1043. // this.$router.push({
  1044. // path: '/search',
  1045. // query: {
  1046. // // from: JSON.stringify(this.form)
  1047. // from: this.form,
  1048. // idx: i
  1049. // }
  1050. // });
  1051. },
  1052. clickPickers(i) {
  1053. // if (!this.canEdit) return;
  1054. this.clickIndex = i;
  1055. this.currentForm.domains[this.clickIndex].showPickDegree = true;
  1056. var proId = this.currentForm.domains[this.clickIndex].projectId
  1057. this.dimension(proId)
  1058. },
  1059. //选择任务
  1060. clickPickerTask(i) {
  1061. // if (!this.canEdit) return;
  1062. console.log(i);
  1063. this.clickIndex = i;
  1064. // var proId = this.form.domains[this.clickIndex].projectId
  1065. // this.getTaskList(proId)
  1066. this.currentForm.domains[this.clickIndex].showPickerTask = true;
  1067. this.$forceUpdate();
  1068. },
  1069. choseTask(value, index) {
  1070. this.currentForm.domains[this.clickIndex].taskId = value.taskId;
  1071. this.currentForm.domains[this.clickIndex].taskName = value.taskName;
  1072. this.currentForm.domains[this.clickIndex].showPickerTask = false;
  1073. this.$forceUpdate();
  1074. },
  1075. choseProjects(value, index) {
  1076. // console.log(value)
  1077. this.currentForm.domains[this.clickIndex].weiduName = value.name;
  1078. this.currentForm.domains[this.clickIndex].degreeId = value.id;
  1079. this.currentForm.domains[this.clickIndex].showPickDegree = false;
  1080. this.$forceUpdate();
  1081. },
  1082. choseSubProject(value, index) {
  1083. this.currentForm.domains[this.clickIndex].subProjectId = value.id;
  1084. this.currentForm.domains[this.clickIndex].subProjectName = value.name;
  1085. this.currentForm.domains[this.clickIndex].showPickerSubProject = false;
  1086. this.$forceUpdate();
  1087. },
  1088. choseTaskGroup(value, index) {
  1089. this.currentForm.domains[this.clickIndex].groupId = value.id;
  1090. this.currentForm.domains[this.clickIndex].groupName = value.name;
  1091. this.currentForm.domains[this.clickIndex].showPickerTaskGroup = false;
  1092. var domainItem = this.currentForm.domains[this.clickIndex];
  1093. this.getGroupStages(this.currentForm.domains[this.clickIndex], index);
  1094. //检查当前的项目是否需要获取分组的负责人
  1095. var curProject = this.project.filter(p=>p.id == this.currentForm.domains[this.clickIndex].projectId)[0];
  1096. if (curProject.taskGpIncharge == 1) {
  1097. this.$axios.post("/task-group/getGroupIncharger", {groupId: domainItem.groupId})
  1098. .then(res => {
  1099. if(res.code == "ok") {
  1100. domainItem.auditUserList = res.data;
  1101. if (res.data.length==1) {
  1102. domainItem.projectAuditorId = domainItem.auditUserList[0].auditorId;
  1103. domainItem.projectAuditorName = domainItem.auditUserList[0].auditorName;
  1104. }
  1105. this.$forceUpdate();
  1106. } else {
  1107. this.$toast.fail('获取失败:'+res.msg);
  1108. }
  1109. }).catch(err=> {this.$toast.clear();});
  1110. }
  1111. },
  1112. choseStage(value, index) {
  1113. this.currentForm.domains[this.clickIndex].stage = value.stagesName;
  1114. this.currentForm.domains[this.clickIndex].showPickerStage = false;
  1115. this.$forceUpdate();
  1116. },
  1117. getGroupStages(domain, index) {
  1118. this.$axios.post("/stages/getProjectStagesByGroup", {groupId: domain.groupId})
  1119. .then(res => {
  1120. if(res.code == "ok") {
  1121. domain.stage = '';
  1122. domain.stages = res.data;
  1123. this.$forceUpdate();
  1124. } else {
  1125. this.$toast.fail('获取失败');
  1126. }
  1127. }).catch(err=> {this.$toast.clear();});
  1128. },
  1129. getProjectProfessions(domain, index) {
  1130. console.log(domain, '数据')
  1131. this.$axios.post("/project-profession/getMyProfession", {projectId: domain.projectId})
  1132. .then(res => {
  1133. if(res.code == "ok") {
  1134. this.currentForm.domains[this.clickIndex].professionProgress = res.data;
  1135. console.log(this.currentForm.domains)
  1136. this.$forceUpdate();
  1137. } else {
  1138. this.$toast.fail('获取失败');
  1139. }
  1140. }).catch(err=> {this.$toast.clear();});
  1141. },
  1142. // 获取维度
  1143. dimension(projectId) {
  1144. this.$axios.post("/project/getDegreeList", {projectId: projectId})
  1145. .then(res => {
  1146. if(res.code == "ok") {
  1147. this.currentForm.domains[this.clickIndex].wuduList = res.data;
  1148. this.$forceUpdate();
  1149. } else {
  1150. this.$toast.fail('获取失败');
  1151. }
  1152. }).catch(err=> {this.$toast.clear();});
  1153. },
  1154. getTaskList(projectId) {
  1155. //如果是专业版,需要列出任务列表
  1156. if (this.user.company.packageProject == 1) {
  1157. this.$axios.post("/task/getRecentTask", {projectId: projectId})
  1158. .then(res => {
  1159. if(res.code == "ok") {
  1160. this.currentForm.domains[this.clickIndex].taskList = res.data;
  1161. this.currentForm = this.currentForm;
  1162. // this.$forceUpdate();
  1163. } else {
  1164. this.$toast.fail('获取失败');
  1165. }
  1166. }).catch(err=> {this.$toast.clear();});
  1167. }
  1168. },
  1169. //添加工时
  1170. addNewWorktime(index, item) {
  1171. item.worktimeList.push({});
  1172. },
  1173. // 添加项目
  1174. addNewPro() {
  1175. var leftProgress = 10;
  1176. if (this.reportTimeType.type == 3) {
  1177. //计算已经待分配工时比例
  1178. let array = this.currentForm.domains;
  1179. let totalProgress = 0;
  1180. for (var i=0;i<array.length; i++) {
  1181. totalProgress += array[i].progress;
  1182. }
  1183. if (totalProgress < 100) {
  1184. leftProgress = 100 - totalProgress;
  1185. }
  1186. }
  1187. this.currentForm.domains.push({
  1188. id: null,
  1189. projectId: "",
  1190. projectName: "",
  1191. workingTime: this.reportTimeType.type==3?(leftProgress*this.reportTimeType.allday/100).toFixed(1):"4.0",
  1192. progress:leftProgress,
  1193. content: "",
  1194. state: 2,
  1195. isOvertime:false,
  1196. multiWorktime: this.reportTimeType.multiWorktime,
  1197. worktimeList:[{}],
  1198. degreeId: null
  1199. })
  1200. },
  1201. // 移除项目
  1202. delPro(i) {
  1203. this.$dialog.confirm({
  1204. title: '',
  1205. message: '是否移除当前项目'
  1206. }).then(() => {
  1207. this.currentForm.domains.splice(i,1);
  1208. }).catch(() => {
  1209. });
  1210. },
  1211. // 判断时间段
  1212. fns() {
  1213. for (let k in this.dateAr) {
  1214. if (!this.judege(k)) {
  1215. return false
  1216. }
  1217. }
  1218. return true
  1219. },
  1220. judege(idx){
  1221. for (let k in this.dateAr) {
  1222. if (idx !== k) {
  1223. if (this.dateAr[k].s <= this.dateAr[idx].s && this.dateAr[k].e > this.dateAr[idx].s) {
  1224. return false
  1225. }
  1226. if (this.dateAr[k].s < this.dateAr[idx].e && this.dateAr[k].e >= this.dateAr[idx].e) {
  1227. return false
  1228. }
  1229. }
  1230. }
  1231. return true
  1232. },
  1233. // 清空当前填写信息
  1234. submitClear(){
  1235. this.currentForm.domains = [{
  1236. id: null,
  1237. projectId: "",
  1238. projectName: "",
  1239. workingTime: 8,
  1240. content: "",
  1241. state: 2,
  1242. multiWorktime:0,
  1243. worktimeList:{},
  1244. degreeId: ''
  1245. }],
  1246. console.log(this.currentForm);
  1247. },
  1248. // 提交日报
  1249. submitReport() {
  1250. this.form[this.inbtn] = this.currentForm
  1251. let formData = new URLSearchParams()
  1252. for(let formIndex=0;formIndex<this.form.length;formIndex++){
  1253. this.dateAr = []
  1254. let alp = []
  1255. if(this.user.timeType.multiWorktime == 1) {
  1256. for(var p in this.form[formIndex].domains) {
  1257. var slll = this.form[formIndex].domains[p]
  1258. for(var o in slll.worktimeList) {
  1259. if(slll.worktimeList[o].startTime || slll.worktimeList[o].endTime) {
  1260. let objs = {}
  1261. objs.s = slll.worktimeList[o].startTime
  1262. objs.e = slll.worktimeList[o].endTime
  1263. alp.push(objs)
  1264. }
  1265. }
  1266. }
  1267. this.dateAr = alp
  1268. if(this.dateAr.length > 0) {
  1269. let trus = this.fns()
  1270. if(!trus) {
  1271. this.$toast(this.weekArr[formIndex]+'填写的时间段重叠')
  1272. return
  1273. }
  1274. }
  1275. }
  1276. if (this.reportTimeType.type == 0) {
  1277. var alldayNum = 0;
  1278. var amNum = 0;
  1279. var pmNum = 0;
  1280. for(var i in this.form[formIndex].domains) {
  1281. if (this.form[formIndex].domains[i].timeType == 0) {
  1282. alldayNum ++;
  1283. } else if (this.form[formIndex].domains[i].timeType == 1) {
  1284. amNum++;
  1285. } else if (this.form[formIndex].domains[i].timeType == 2) {
  1286. pmNum++;
  1287. }
  1288. }
  1289. if (alldayNum > 1) {
  1290. this.$toast.fail(this.weekArr[formIndex]+"的工作时间-全天,只能选择一次");
  1291. return;
  1292. }
  1293. if (amNum > 1) {
  1294. this.$toast.fail(this.weekArr[formIndex]+"的工作时间-上午,只能选择一次");
  1295. return;
  1296. }
  1297. if (pmNum > 1) {
  1298. this.$toast.fail(this.weekArr[formIndex]+"的工作时间-下午,只能选择一次");
  1299. return;
  1300. }
  1301. if (alldayNum == 1 && (amNum > 0 || pmNum > 0)) {
  1302. this.$toast.fail(this.weekArr[formIndex]+"的工作时间-全天,不能和上下午同时存在");
  1303. return;
  1304. }
  1305. } else if (this.reportTimeType.type == 3) {
  1306. //总百分比不能超过100%
  1307. let total = 0;
  1308. this.form[formIndex].domains.forEach(w=>{total += w.progress});
  1309. if (total > 100) {
  1310. this.$toast.fail(this.weekArr[formIndex]+"的用时比例之和不能超过100%");
  1311. return;
  1312. } else if (total < 100) {
  1313. this.$toast.fail(this.weekArr[formIndex]+"的工时尚未完全分配,无法提交");
  1314. return;
  1315. }
  1316. }
  1317. formData.append("draft", this.isDraft);
  1318. //填字段
  1319. for(var i in this.form[formIndex].domains) {
  1320. //没有选择项目的,跳过
  1321. if (!this.form[formIndex].domains[i].projectId) {
  1322. continue;
  1323. }
  1324. if (this.user.timeType.customDegreeActive == 1) {
  1325. if(this.form[formIndex].domains[i].degreeId) {
  1326. formData.append("degreeId", this.form[formIndex].domains[i].degreeId);
  1327. } else {
  1328. formData.append("degreeId", -1);
  1329. }
  1330. } else {
  1331. formData.append("degreeId", -1);
  1332. }
  1333. if(this.form[formIndex].domains[i].customData) {
  1334. formData.append("customData", this.form[formIndex].domains[i].customData);
  1335. } else {
  1336. formData.append("customData", "0");
  1337. }
  1338. if(this.form[formIndex].domains[i].customText) {
  1339. formData.append("customText", this.form[formIndex].domains[i].customText);
  1340. } else {
  1341. formData.append("customText", "-");
  1342. }
  1343. if (this.form[formIndex].domains[i].id) {
  1344. formData.append("id", this.form[formIndex].domains[i].id);
  1345. } else {
  1346. formData.append("id", -1);
  1347. }
  1348. formData.append("projectId", parseFloat(this.form[formIndex].domains[i].projectId));
  1349. if (this.form[formIndex].domains[i].subProjectId) {
  1350. formData.append("subProjectId", this.form[formIndex].domains[i].subProjectId);
  1351. } else {
  1352. formData.append("subProjectId", 0);
  1353. }
  1354. if (this.form[formIndex].domains[i].groupId) {
  1355. formData.append("groupId", this.form[formIndex].domains[i].groupId);
  1356. } else {
  1357. formData.append("groupId", 0);
  1358. }
  1359. if (this.form[formIndex].domains[i].stage) {
  1360. formData.append("stage", this.form[formIndex].domains[i].stage);
  1361. } else {
  1362. formData.append("stage", '-');
  1363. }
  1364. formData.append("reportTimeType", this.reportTimeType.type);
  1365. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  1366. if (this.reportTimeType.type == 0) {
  1367. formData.append("timeType", this.form[formIndex].domains[i].timeType);
  1368. formData.append("workingTime", parseFloat(this.form[formIndex].domains[i].workingTime));
  1369. } else if (this.reportTimeType.type == 1) {
  1370. formData.append("workingTime", parseFloat(this.form[formIndex].domains[i].workingTime));
  1371. } else if (this.reportTimeType.type == 2) {
  1372. formData.append("startTime", this.form[formIndex].domains[i].startTime);
  1373. formData.append("endTime",this.form[formIndex].domains[i].endTime);
  1374. } else if (this.reportTimeType.type == 3) {
  1375. formData.append("progress", this.form[formIndex].domains[i].progress);
  1376. formData.append("workingTime",this.form[formIndex].domains[i].workingTime);
  1377. }
  1378. if (this.form[formIndex].domains[i].taskId) {
  1379. formData.append("taskId", this.form[formIndex].domains[i].taskId);
  1380. } else {
  1381. formData.append("taskId", 0);
  1382. }
  1383. if (this.form[formIndex].domains[i].taskFinish == true) {
  1384. formData.append("taskFinish", 1);
  1385. } else {
  1386. formData.append("taskFinish", 0);
  1387. }
  1388. formData.append("createDate", this.form[formIndex].createDate);
  1389. formData.append("isOvertime", this.form[formIndex].domains[i].isOvertime?1:0);
  1390. if (this.form[formIndex].domains[i].overtimeHours && this.form[formIndex].domains[i].isOvertime == 1) {
  1391. formData.append("overtimeHours", this.form[formIndex].domains[i].overtimeHours);
  1392. } else {
  1393. formData.append("overtimeHours", 0);
  1394. }
  1395. //项目专业进度
  1396. if (this.form[formIndex].domains[i].professionProgress) {
  1397. let m = JSON.stringify(this.form[formIndex].domains[i].professionProgress);
  1398. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  1399. formData.append("professionProgress", m);
  1400. } else {
  1401. formData.append("professionProgress", "[]");
  1402. }
  1403. //图片的处理,serverPic是当前所有的照片
  1404. if (this.form[formIndex].domains[i].serverPics) {
  1405. let m = JSON.stringify(this.form[formIndex].domains[i].serverPics);
  1406. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  1407. formData.append("pics", m);
  1408. } else {
  1409. formData.append("pics", "@");
  1410. }
  1411. //处理多个时间事项
  1412. if (this.reportTimeType.multiWorktime == 1) {
  1413. //检查时间是否有重叠
  1414. var workList = this.form[formIndex].domains[i].worktimeList;
  1415. for (var j=0;j<workList.length; j++) {
  1416. var curItem = workList[j];
  1417. if (curItem.startTime == null || curItem.endTime == null) {
  1418. this.$toast.fail("请设置"+this.weekArr[formIndex]+"的工作时间");
  1419. return;
  1420. }
  1421. //检查开始时间是否大于结束时间
  1422. if (curItem.startTime >= curItem.endTime) {
  1423. this.$toast.fail(this.weekArr[formIndex]+"的时间段"+curItem.startTime+'-'+curItem.endTime+"有误:"+
  1424. "结束时间必须大于开始时间");
  1425. return;
  1426. }
  1427. for (var p = j+1;p<workList.length; p++) {
  1428. var jItem = workList[p];
  1429. if ((jItem.startTime>=curItem.startTime&&jItem.startTime < curItem.endTime)
  1430. || (jItem.endTime>curItem.startTime&&jItem.endTime <= curItem.endTime)) {
  1431. this.$toast.fail(this.weekArr[formIndex]+"的时间段"+curItem.startTime+'-'+curItem.endTime+"与"+
  1432. jItem.startTime+'-'+jItem.endTime+ "存在重叠,请修改。");
  1433. return;
  1434. }
  1435. }
  1436. }
  1437. let m = JSON.stringify(this.form[formIndex].domains[i].worktimeList);
  1438. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  1439. formData.append("content", m);
  1440. } else {
  1441. if (this.form[formIndex].domains[i].content) {
  1442. formData.append("content", this.form[formIndex].domains[i].content);
  1443. } else {
  1444. formData.append("content", '-');
  1445. }
  1446. }
  1447. //审核人
  1448. if (this.form[formIndex].domains[i].projectAuditorId) {
  1449. formData.append("projectAuditorId", this.form[formIndex].domains[i].projectAuditorId);
  1450. } else {
  1451. this.$toast.fail('请选择'+this.weekArr[formIndex]+'投入项目的审核人');
  1452. return;
  1453. }
  1454. }
  1455. }
  1456. // return
  1457. const toast = this.$toast.loading({
  1458. forbidClick: true,
  1459. duration: 0
  1460. });
  1461. // let formData = new FormData();
  1462. // if(!this.flgLg) {
  1463. // return
  1464. // }
  1465. // this.flgLg = false
  1466. this.$axios.post("/report/editReport", formData)
  1467. .then(res => {
  1468. // this.flgLg = true
  1469. if(res.code == "ok") {
  1470. this.$toast.clear();
  1471. this.$toast.success(this.isDraft==0?'提交成功':'暂存成功');
  1472. this.$router.push("/index");
  1473. } else {
  1474. this.$toast.clear();
  1475. this.$toast.fail((this.isDraft==0?'提交失败':'暂存失败')+':'+res.msg);
  1476. }
  1477. }).catch(err=> {this.$toast.clear()});
  1478. },
  1479. //初始化参数
  1480. initWxConfig() {
  1481. var curUrl=location.href.split("#")[0];
  1482. this.$axios.post("/wxcorp/getCorpWXConfig", {url: curUrl, token: this.user.id})
  1483. .then(res => {
  1484. if(res.code == "ok") {
  1485. var data=res.data;
  1486. wx.config({
  1487. beta: true,
  1488. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  1489. appId: data.appid, // 必填,公众号的唯一标识
  1490. timestamp: data.timestamp, // 必填,生成签名的时间戳
  1491. nonceStr: data.noncestr, // 必填,生成签名的随机串
  1492. signature: data.sign, // 必填,签名,见附录1
  1493. jsApiList: [
  1494. 'chooseImage',
  1495. 'previewImage',
  1496. 'uploadImage',
  1497. 'downloadImage',
  1498. 'previewFile',
  1499. 'getLocation',
  1500. ]
  1501. });
  1502. var that = this;
  1503. wx.ready(function(){
  1504. // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
  1505. // if (that.user.companyId == 7) {
  1506. // that.$toast('wx init success==7 ');
  1507. // that.getLocation();
  1508. // }
  1509. });
  1510. } else {
  1511. this.$toast.fail('获取失败');
  1512. }
  1513. }).catch(err=> {this.$toast.fail('发生异常'+err);console.log(err)});
  1514. },
  1515. deleteImg(item, index) {
  1516. //删除添加的图片
  1517. if (this.isIOSystem) {
  1518. item.iospics.splice(index,1);
  1519. item.iospics = item.iospics;
  1520. }
  1521. item.pics.splice(index,1);
  1522. item.pics = item.pics;
  1523. //传递到后台的数据也要做同步删除
  1524. item.serverPics.splice(index,1);
  1525. this.$forceUpdate();
  1526. },
  1527. //企业微信获取定位
  1528. getLocation() {
  1529. wx.getLocation({
  1530. type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
  1531. success: function (res) {
  1532. var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
  1533. var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
  1534. alert(JSON.stringify(res));
  1535. }
  1536. });
  1537. }
  1538. },
  1539. mounted() {
  1540. this.getDateRange()
  1541. // if(user.companyId == '817')
  1542. console.log('userId',this.user.companyId);
  1543. // console.log(localStorage.getItem("formVal"))
  1544. var ua = navigator.userAgent.toLowerCase();
  1545. this.isIOSystem = this.isIOS();
  1546. if (ua.indexOf("wxwork") > 0) {
  1547. this.isCorpWX = true;
  1548. } else if (ua.indexOf("micromessenger") > 0) {
  1549. this.isWX = true;
  1550. }
  1551. this.getPeoject() // 获取项目
  1552. //获取传递过来的日期
  1553. // var passDate = this.$route.query.date;
  1554. // if (passDate != null) {
  1555. // this.form.createDate = this.$route.query.date;
  1556. // }
  1557. this.getProject();
  1558. // this.getReport();
  1559. this.getTimeType();
  1560. //初始化微信js-sdk参数
  1561. if (this.isCorpWX) {
  1562. this.initWxConfig();
  1563. }
  1564. // if(localStorage.getItem("formVal")) {
  1565. // var obj = localStorage.getItem("formVal")
  1566. // this.form = JSON.parse(obj)
  1567. // localStorage.removeItem('formVal')
  1568. // }
  1569. },
  1570. beforeDestroy() {
  1571. // localStorage.removeItem('formVal')
  1572. }
  1573. };
  1574. </script>
  1575. <style lang="less" scope>
  1576. .my-swipe .van-swipe-item {
  1577. color: #fff;
  1578. font-size: 20px;
  1579. line-height: 150px;
  1580. text-align: center;
  1581. background-color: #39a9ed;
  1582. }
  1583. .van-field__control:disabled {
  1584. -webkit-text-fill-color:#646566;
  1585. }
  1586. .login_form {
  1587. margin-top: 46px;
  1588. }
  1589. .form_domains {
  1590. position: relative;
  1591. .form_copy {
  1592. position: absolute;
  1593. right: 85px;
  1594. top: 10px;
  1595. }
  1596. .form_addNew {
  1597. text-align: center;
  1598. margin:10px;
  1599. }
  1600. .form_del {
  1601. position: absolute;
  1602. right: 10px;
  1603. top: 10px;
  1604. }
  1605. // .form_del {
  1606. // color: #ff0000;
  1607. // font-size: 22px;
  1608. // position: absolute;
  1609. // right: 15px;
  1610. // top: 10px;
  1611. // }
  1612. }
  1613. .form_tip {
  1614. text-align: center;
  1615. margin-top: 20px;
  1616. color: #afafaf;
  1617. font-size: 14px;
  1618. }
  1619. .card__footer {
  1620. padding-top: 10px;
  1621. }
  1622. .card__tags {
  1623. .van-tag {
  1624. margin-right: 5px;
  1625. }
  1626. }
  1627. .overTimeClas{
  1628. display: flex;
  1629. width: 7.4rem;
  1630. // justify-content: space-between;
  1631. align-items: center;
  1632. }
  1633. .inbtn{
  1634. .selectgxbtn{
  1635. color: #1989fa;
  1636. border-color: #1989fa;
  1637. }
  1638. }
  1639. .selectgxbtn{
  1640. width: 100%;
  1641. }
  1642. </style>
  1643. <style lang="less">
  1644. .van-nav-bar .van-icon , .van-nav-bar__text {
  1645. color: #20a0ff;
  1646. }
  1647. .overtime {
  1648. height: 50px;
  1649. box-sizing: border-box;
  1650. padding-left: 10px;
  1651. display: flex;
  1652. align-items: center;
  1653. }
  1654. .custom-button {
  1655. width: 40px;
  1656. color: #fff;
  1657. font-size: 10px;
  1658. line-height: 16px;
  1659. text-align: center;
  1660. background-color: #1989fa;
  1661. border-radius: 100px;
  1662. }
  1663. .imgList {
  1664. position: relative;
  1665. width: 100px;
  1666. height: 100px;
  1667. display: inline-block;
  1668. }
  1669. .imgList_i {
  1670. position: absolute;
  1671. top: -8px;
  1672. right: -6px;
  1673. z-index: 999;
  1674. }
  1675. .ryuan {
  1676. padding: 0.3rem 0.53333rem;
  1677. // padding: 0 20px;
  1678. // line-height: 40px;
  1679. // height: 40px;
  1680. color: #333;
  1681. border-bottom: 2px solid #f6f6f6;
  1682. width: 100%;
  1683. overflow: hidden;
  1684. text-overflow:ellipsis;
  1685. white-space: nowrap;
  1686. }
  1687. .overListTime {
  1688. margin-left:5px;
  1689. display: inline-block;
  1690. width: 2rem;
  1691. color: #646566;
  1692. }
  1693. .hoveOver {
  1694. color: #C8C9CC;
  1695. }
  1696. .van-checkbox__label {
  1697. color: #646566 !important;
  1698. }
  1699. .van-checkbox__label--disabled {
  1700. color: #c8c9cc !important;
  1701. }
  1702. .submitClear{
  1703. position: absolute;
  1704. right: 0.1rem;
  1705. bottom: -0.95rem;
  1706. z-index: 1;
  1707. }
  1708. </style>