weekEdit.vue 89 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806
  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. }
  767. },
  768. clickTimePicker(i) {
  769. // if (!this.canEdit) {
  770. // return;
  771. // }
  772. this.clickTimeIndex = i;
  773. if (this.reportTimeType.type == 0) {
  774. this.showPickerTime = true;
  775. } else if (this.reportTimeType.type == 1) {
  776. this.showPickerHours = true;
  777. }
  778. },
  779. getTimeType() {
  780. this.$axios.post('/time-type/getCompanyTimeSetting', { companyId: this.user.companyId})
  781. .then(res => {
  782. if(res.code == "ok") {
  783. var t = res.data;
  784. this.reportTimeType = t;
  785. //转化时间格式
  786. if (t.allday != null) {
  787. this.timeType.push({value:0, label:'全天 - '+t.allday+'小时', hours:t.allday});
  788. }
  789. if (t.am != null) {
  790. this.timeType.push({value:1, label:'上午 - '+t.am+'小时', hours: t.am});
  791. }
  792. if (t.pm != null) {
  793. this.timeType.push({value:2, label:'下午 - '+t.pm+'小时', hours: t.pm});
  794. }
  795. } else {
  796. this.$toast.clear();
  797. this.$toast.fail(res.msg);
  798. }
  799. }).catch(err=> {this.$toast.clear();});
  800. },
  801. // 返回
  802. back() {
  803. history.back();
  804. },
  805. // 时间转换
  806. format(date, pattern) {
  807. pattern = pattern || "yyyy-MM-dd";
  808. var _this = this;
  809. return pattern.replace(/([yMdhsm])(\1*)/g, function ($0) {
  810. switch ($0.charAt(0)) {
  811. case 'y': return _this.padding(date.getFullYear(), $0.length);
  812. case 'M': return _this.padding(date.getMonth() + 1, $0.length);
  813. case 'd': return _this.padding(date.getDate(), $0.length);
  814. case 'w': return date.getDay() + 1;
  815. case 'h': return _this.padding(date.getHours(), $0.length);
  816. case 'm': return _this.padding(date.getMinutes(), $0.length);
  817. case 's': return _this.padding(date.getSeconds(), $0.length);
  818. }
  819. });
  820. },
  821. padding(s, len) {
  822. var len = len - (s + '').length;
  823. for (var i = 0; i < len; i++) { s = '0' + s; }
  824. return s;
  825. },
  826. // 获取项目
  827. getProject() {
  828. const toast = this.$toast.loading({
  829. forbidClick: true,
  830. duration: 0
  831. });
  832. this.$axios.post("/project/getProjectList", {})
  833. .then(res => {
  834. if(res.code == "ok") {
  835. this.$toast.clear();
  836. this.project = res.data;
  837. // if (this.project.length > 0) {
  838. // console.log('this.project[0].id=='+this.project[0].id);
  839. // this.getTaskList(this.project[0].id);
  840. // }
  841. } else {
  842. this.$toast.clear();
  843. this.$toast.fail('获取失败:'+res.msg);
  844. }
  845. }).catch(err=> {this.$toast.clear();});
  846. },
  847. // 获取日报
  848. getReport() {
  849. const toast = this.$toast.loading({
  850. forbidClick: true,
  851. duration: 0
  852. });
  853. this.$axios.post("/report/getReport", {date: this.currentForm.createDate})
  854. .then(res => {
  855. if(res.code == "ok") {
  856. this.$toast.clear();
  857. this.report = res.data;
  858. var t = res.data.timeType;
  859. var timeType=[];
  860. //转化时间格式
  861. if (t.allday != null) {
  862. timeType.push({value:0, label:'全天 - '+t.allday+'小时', hours:t.allday});
  863. }
  864. if (t.am != null) {
  865. timeType.push({value:1, label:'上午 - '+t.am+'小时', hours: t.am});
  866. }
  867. if (t.pm != null) {
  868. timeType.push({value:2, label:'下午 - '+t.pm+'小时', hours: t.pm});
  869. }
  870. var list = res.data.report;
  871. if(list.length != 0) {
  872. // this.canEdit = false;
  873. this.canCancel = false;
  874. let array = [];
  875. for(var i in list) {
  876. var projectName = "";
  877. var flg = (list[i].isOvertime == 1);
  878. for(var j in this.project) {
  879. if(this.project[j].id == list[i].projectId) {
  880. projectName = this.project[j].projectName;
  881. }
  882. }
  883. let tname = '';
  884. if (list[i].taskId != null && list[i].taskList.length > 0) {
  885. let filterList = list[i].taskList.filter(t=>t.taskId == list[i].taskId);
  886. if (filterList.length > 0) {
  887. tname = filterList[0].taskName;
  888. }
  889. }
  890. let mmm = list[i].degreeId
  891. let sss = list[i].degreeList
  892. let wuduName = ''
  893. for (var s in sss) {
  894. if(sss[s].id == mmm) {
  895. wuduName = sss[s].name
  896. }
  897. }
  898. let serverPicArray = [];
  899. console.log('picArray=='+list[i].picStr);
  900. if (list[i].picStr != null && list[i].picStr != '@') {
  901. serverPicArray = JSON.parse(list[i].picStr.replace(/@/g,","));
  902. }
  903. var subProjectName = null;
  904. if (list[i].subProjectId) {
  905. subProjectName = list[i].subProjectList.filter(s=>s.id==list[i].subProjectId)[0].name;
  906. }
  907. array.push({
  908. id: list[i].id,
  909. projectId: list[i].projectId,
  910. projectName: projectName,
  911. workingTime: String(list[i].workingTime),
  912. content: list[i].content,
  913. state: list[i].state,
  914. timeType: list[i].timeType,
  915. label: timeType[list[i].timeType].label,
  916. startTime: list[i].startTime,
  917. endTime: list[i].endTime,
  918. isOvertime: flg,
  919. progress: list[i].progress,
  920. taskList: list[i].taskList,
  921. taskId: list[i].taskId,
  922. taskName:tname,
  923. professionProgress:list[i].professionProgressList,
  924. pics: list[i].pics,
  925. iospics:list[i].pics,
  926. serverPics:serverPicArray,
  927. multiWorktime:t.multiWorktime,
  928. worktimeList:list[i].worktimeList,
  929. wuduList: list[i].degreeList,
  930. weiduName: wuduName,
  931. degreeId: list[i].degreeId,
  932. subProjectId: list[i].subProjectId,
  933. subProjectName: subProjectName,
  934. subProjectList: list[i].subProjectList,
  935. groupId: list[i].groupId == 0?null:list[i].groupId,
  936. groupName: list[i].groupName,
  937. taskGroups:list[i].taskGroups,
  938. stages:list[i].stages,
  939. stage:list[i].stage == '-'?null:list[i].stage,
  940. customData: list[i].customData,
  941. projectAuditorId: list[i].projectAuditorId,
  942. projectAuditorName: list[i].projectAuditorName,
  943. auditUserList: list[i].auditUserList,
  944. overtimeHours: list[i].overtimeHours,
  945. customText: list[i].customText
  946. })
  947. if (list[i].state >= 2) {
  948. // this.canEdit = true;
  949. } else if (list[i].state == 0) {
  950. this.canCancel = true;
  951. }
  952. }
  953. this.currentForm.domains = array;
  954. } else {
  955. this.canCancel = false;
  956. // this.canEdit = true;
  957. //没有填报的可以点击提交
  958. this.currentForm.domains = [{
  959. id: null,
  960. projectId: "",
  961. projectName: "",
  962. workingTime: t.type==3?(t.allday).toFixed(1):"8.0",
  963. content: "",
  964. state: 2,
  965. progress:100,
  966. isOvertime:false,
  967. professionProgress:[],
  968. multiWorktime:t.multiWorktime,
  969. worktimeList:[{}],
  970. }]
  971. // this.canEdit = true;
  972. }
  973. } else {
  974. this.$toast.clear();
  975. this.$toast.fail('获取失败:'+res.msg);
  976. }
  977. // if(localStorage.getItem("formVal")) {
  978. // console.log('触发了')
  979. // var obj = localStorage.getItem("formVal")
  980. // this.form = JSON.parse(obj)
  981. // localStorage.removeItem('formVal')
  982. // }
  983. }).catch(err=> {this.$toast.clear();});
  984. },
  985. // 改变时间
  986. changeTime(time) {
  987. this.currentForm.createDate = this.format(new Date(time),"yyyy-MM-dd");
  988. this.currentDate = time;
  989. this.showPicker = false;
  990. // this.getReport();
  991. },
  992. //点击选择审核人
  993. clickPickAuditor(i, item) {
  994. // if (!this.canEdit) return;
  995. if (item.auditUserList.length<=1) return;
  996. this.clickIndex = i;
  997. item.showPickerAuditor = true;
  998. this.$forceUpdate();
  999. },
  1000. choseAuditor(value, index) {
  1001. this.currentForm.domains[this.clickIndex].projectAuditorId = value.auditorId;
  1002. this.currentForm.domains[this.clickIndex].projectAuditorName = value.auditorName;
  1003. this.currentForm.domains[this.clickIndex].showPickerAuditor = false;
  1004. this.$forceUpdate();
  1005. },
  1006. //点击选择子项目
  1007. clickPickSubProject(i, item) {
  1008. // if (!this.canEdit) return;
  1009. this.clickIndex = i;
  1010. item.showPickerSubProject = true;
  1011. this.$forceUpdate();
  1012. },
  1013. clickPickTaskGroup(i, item) {
  1014. // if (!this.canEdit) return;
  1015. this.clickIndex = i;
  1016. item.showPickerTaskGroup = true;
  1017. this.$forceUpdate();
  1018. },
  1019. clickPickStage(i, item) {
  1020. // if (!this.canEdit) return;
  1021. this.clickIndex = i;
  1022. item.showPickerStage = true;
  1023. this.$forceUpdate();
  1024. },
  1025. // 选择项目
  1026. clickPicker(i, item) {
  1027. // if (!this.canEdit) return;
  1028. // this.clickIndex = i;
  1029. // this.showPickerProject = true;
  1030. console.log(i, item, this.currentForm)
  1031. this.proIdx = i
  1032. this.showPickerUserddp = true
  1033. // this.$router.push({
  1034. // path: '/search',
  1035. // query: {
  1036. // // from: JSON.stringify(this.form)
  1037. // from: this.form,
  1038. // idx: i
  1039. // }
  1040. // });
  1041. },
  1042. clickPickers(i) {
  1043. // if (!this.canEdit) return;
  1044. this.clickIndex = i;
  1045. this.currentForm.domains[this.clickIndex].showPickDegree = true;
  1046. var proId = this.currentForm.domains[this.clickIndex].projectId
  1047. this.dimension(proId)
  1048. },
  1049. //选择任务
  1050. clickPickerTask(i) {
  1051. // if (!this.canEdit) return;
  1052. console.log(i);
  1053. this.clickIndex = i;
  1054. // var proId = this.form.domains[this.clickIndex].projectId
  1055. // this.getTaskList(proId)
  1056. this.currentForm.domains[this.clickIndex].showPickerTask = true;
  1057. this.$forceUpdate();
  1058. },
  1059. choseTask(value, index) {
  1060. this.currentForm.domains[this.clickIndex].taskId = value.taskId;
  1061. this.currentForm.domains[this.clickIndex].taskName = value.taskName;
  1062. this.currentForm.domains[this.clickIndex].showPickerTask = false;
  1063. this.$forceUpdate();
  1064. },
  1065. choseProjects(value, index) {
  1066. // console.log(value)
  1067. this.currentForm.domains[this.clickIndex].weiduName = value.name;
  1068. this.currentForm.domains[this.clickIndex].degreeId = value.id;
  1069. this.currentForm.domains[this.clickIndex].showPickDegree = false;
  1070. this.$forceUpdate();
  1071. },
  1072. choseSubProject(value, index) {
  1073. this.currentForm.domains[this.clickIndex].subProjectId = value.id;
  1074. this.currentForm.domains[this.clickIndex].subProjectName = value.name;
  1075. this.currentForm.domains[this.clickIndex].showPickerSubProject = false;
  1076. this.$forceUpdate();
  1077. },
  1078. choseTaskGroup(value, index) {
  1079. this.currentForm.domains[this.clickIndex].groupId = value.id;
  1080. this.currentForm.domains[this.clickIndex].groupName = value.name;
  1081. this.currentForm.domains[this.clickIndex].showPickerTaskGroup = false;
  1082. var domainItem = this.currentForm.domains[this.clickIndex];
  1083. this.getGroupStages(this.currentForm.domains[this.clickIndex], index);
  1084. //检查当前的项目是否需要获取分组的负责人
  1085. var curProject = this.project.filter(p=>p.id == this.currentForm.domains[this.clickIndex].projectId)[0];
  1086. if (curProject.taskGpIncharge == 1) {
  1087. this.$axios.post("/task-group/getGroupIncharger", {groupId: domainItem.groupId})
  1088. .then(res => {
  1089. if(res.code == "ok") {
  1090. domainItem.auditUserList = res.data;
  1091. if (res.data.length==1) {
  1092. domainItem.projectAuditorId = domainItem.auditUserList[0].auditorId;
  1093. domainItem.projectAuditorName = domainItem.auditUserList[0].auditorName;
  1094. }
  1095. this.$forceUpdate();
  1096. } else {
  1097. this.$toast.fail('获取失败:'+res.msg);
  1098. }
  1099. }).catch(err=> {this.$toast.clear();});
  1100. }
  1101. },
  1102. choseStage(value, index) {
  1103. this.currentForm.domains[this.clickIndex].stage = value.stagesName;
  1104. this.currentForm.domains[this.clickIndex].showPickerStage = false;
  1105. this.$forceUpdate();
  1106. },
  1107. getGroupStages(domain, index) {
  1108. this.$axios.post("/stages/getProjectStagesByGroup", {groupId: domain.groupId})
  1109. .then(res => {
  1110. if(res.code == "ok") {
  1111. domain.stage = '';
  1112. domain.stages = res.data;
  1113. this.$forceUpdate();
  1114. } else {
  1115. this.$toast.fail('获取失败');
  1116. }
  1117. }).catch(err=> {this.$toast.clear();});
  1118. },
  1119. getProjectProfessions(domain, index) {
  1120. console.log(domain, '数据')
  1121. this.$axios.post("/project-profession/getMyProfession", {projectId: domain.projectId})
  1122. .then(res => {
  1123. if(res.code == "ok") {
  1124. this.currentForm.domains[this.clickIndex].professionProgress = res.data;
  1125. console.log(this.currentForm.domains)
  1126. this.$forceUpdate();
  1127. } else {
  1128. this.$toast.fail('获取失败');
  1129. }
  1130. }).catch(err=> {this.$toast.clear();});
  1131. },
  1132. // 获取维度
  1133. dimension(projectId) {
  1134. this.$axios.post("/project/getDegreeList", {projectId: projectId})
  1135. .then(res => {
  1136. if(res.code == "ok") {
  1137. this.currentForm.domains[this.clickIndex].wuduList = res.data;
  1138. this.$forceUpdate();
  1139. } else {
  1140. this.$toast.fail('获取失败');
  1141. }
  1142. }).catch(err=> {this.$toast.clear();});
  1143. },
  1144. getTaskList(projectId) {
  1145. //如果是专业版,需要列出任务列表
  1146. if (this.user.company.packageProject == 1) {
  1147. this.$axios.post("/task/getRecentTask", {projectId: projectId})
  1148. .then(res => {
  1149. if(res.code == "ok") {
  1150. this.currentForm.domains[this.clickIndex].taskList = res.data;
  1151. this.currentForm = this.currentForm;
  1152. // this.$forceUpdate();
  1153. } else {
  1154. this.$toast.fail('获取失败');
  1155. }
  1156. }).catch(err=> {this.$toast.clear();});
  1157. }
  1158. },
  1159. //添加工时
  1160. addNewWorktime(index, item) {
  1161. item.worktimeList.push({});
  1162. },
  1163. // 添加项目
  1164. addNewPro() {
  1165. var leftProgress = 10;
  1166. if (this.reportTimeType.type == 3) {
  1167. //计算已经待分配工时比例
  1168. let array = this.currentForm.domains;
  1169. let totalProgress = 0;
  1170. for (var i=0;i<array.length; i++) {
  1171. totalProgress += array[i].progress;
  1172. }
  1173. if (totalProgress < 100) {
  1174. leftProgress = 100 - totalProgress;
  1175. }
  1176. }
  1177. this.currentForm.domains.push({
  1178. id: null,
  1179. projectId: "",
  1180. projectName: "",
  1181. workingTime: this.reportTimeType.type==3?(leftProgress*this.reportTimeType.allday/100).toFixed(1):"4.0",
  1182. progress:leftProgress,
  1183. content: "",
  1184. state: 2,
  1185. isOvertime:false,
  1186. multiWorktime: this.reportTimeType.multiWorktime,
  1187. worktimeList:[{}],
  1188. degreeId: null
  1189. })
  1190. },
  1191. // 移除项目
  1192. delPro(i) {
  1193. this.$dialog.confirm({
  1194. title: '',
  1195. message: '是否移除当前项目'
  1196. }).then(() => {
  1197. this.currentForm.domains.splice(i,1);
  1198. }).catch(() => {
  1199. });
  1200. },
  1201. // 判断时间段
  1202. fns() {
  1203. for (let k in this.dateAr) {
  1204. if (!this.judege(k)) {
  1205. return false
  1206. }
  1207. }
  1208. return true
  1209. },
  1210. judege(idx){
  1211. for (let k in this.dateAr) {
  1212. if (idx !== k) {
  1213. if (this.dateAr[k].s <= this.dateAr[idx].s && this.dateAr[k].e > this.dateAr[idx].s) {
  1214. return false
  1215. }
  1216. if (this.dateAr[k].s < this.dateAr[idx].e && this.dateAr[k].e >= this.dateAr[idx].e) {
  1217. return false
  1218. }
  1219. }
  1220. }
  1221. return true
  1222. },
  1223. // 清空当前填写信息
  1224. submitClear(){
  1225. this.currentForm.domains = [{
  1226. id: null,
  1227. projectId: "",
  1228. projectName: "",
  1229. workingTime: 8,
  1230. content: "",
  1231. state: 2,
  1232. multiWorktime:0,
  1233. worktimeList:{},
  1234. degreeId: ''
  1235. }],
  1236. console.log(this.currentForm);
  1237. },
  1238. // 提交日报
  1239. submitReport() {
  1240. this.form[this.inbtn] = this.currentForm
  1241. let formData = new URLSearchParams()
  1242. for(let formIndex=0;formIndex<this.form.length;formIndex++){
  1243. this.dateAr = []
  1244. let alp = []
  1245. if(this.user.timeType.multiWorktime == 1) {
  1246. for(var p in this.form[formIndex].domains) {
  1247. var slll = this.form[formIndex].domains[p]
  1248. for(var o in slll.worktimeList) {
  1249. if(slll.worktimeList[o].startTime || slll.worktimeList[o].endTime) {
  1250. let objs = {}
  1251. objs.s = slll.worktimeList[o].startTime
  1252. objs.e = slll.worktimeList[o].endTime
  1253. alp.push(objs)
  1254. }
  1255. }
  1256. }
  1257. this.dateAr = alp
  1258. if(this.dateAr.length > 0) {
  1259. let trus = this.fns()
  1260. if(!trus) {
  1261. this.$toast(this.weekArr[formIndex]+'填写的时间段重叠')
  1262. return
  1263. }
  1264. }
  1265. }
  1266. if (this.reportTimeType.type == 0) {
  1267. var alldayNum = 0;
  1268. var amNum = 0;
  1269. var pmNum = 0;
  1270. for(var i in this.form[formIndex].domains) {
  1271. if (this.form[formIndex].domains[i].timeType == 0) {
  1272. alldayNum ++;
  1273. } else if (this.form[formIndex].domains[i].timeType == 1) {
  1274. amNum++;
  1275. } else if (this.form[formIndex].domains[i].timeType == 2) {
  1276. pmNum++;
  1277. }
  1278. }
  1279. if (alldayNum > 1) {
  1280. this.$toast.fail(this.weekArr[formIndex]+"的工作时间-全天,只能选择一次");
  1281. return;
  1282. }
  1283. if (amNum > 1) {
  1284. this.$toast.fail(this.weekArr[formIndex]+"的工作时间-上午,只能选择一次");
  1285. return;
  1286. }
  1287. if (pmNum > 1) {
  1288. this.$toast.fail(this.weekArr[formIndex]+"的工作时间-下午,只能选择一次");
  1289. return;
  1290. }
  1291. if (alldayNum == 1 && (amNum > 0 || pmNum > 0)) {
  1292. this.$toast.fail(this.weekArr[formIndex]+"的工作时间-全天,不能和上下午同时存在");
  1293. return;
  1294. }
  1295. } else if (this.reportTimeType.type == 3) {
  1296. //总百分比不能超过100%
  1297. let total = 0;
  1298. this.form[formIndex].domains.forEach(w=>{total += w.progress});
  1299. if (total > 100) {
  1300. this.$toast.fail(this.weekArr[formIndex]+"的用时比例之和不能超过100%");
  1301. return;
  1302. } else if (total < 100) {
  1303. this.$toast.fail(this.weekArr[formIndex]+"的工时尚未完全分配,无法提交");
  1304. return;
  1305. }
  1306. }
  1307. formData.append("draft", this.isDraft);
  1308. //填字段
  1309. for(var i in this.form[formIndex].domains) {
  1310. //没有选择项目的,跳过
  1311. if (!this.form[formIndex].domains[i].projectId) {
  1312. continue;
  1313. }
  1314. if (this.user.timeType.customDegreeActive == 1) {
  1315. if(this.form[formIndex].domains[i].degreeId) {
  1316. formData.append("degreeId", this.form[formIndex].domains[i].degreeId);
  1317. } else {
  1318. formData.append("degreeId", -1);
  1319. }
  1320. } else {
  1321. formData.append("degreeId", -1);
  1322. }
  1323. if(this.form[formIndex].domains[i].customData) {
  1324. formData.append("customData", this.form[formIndex].domains[i].customData);
  1325. } else {
  1326. formData.append("customData", "0");
  1327. }
  1328. if(this.form[formIndex].domains[i].customText) {
  1329. formData.append("customText", this.form[formIndex].domains[i].customText);
  1330. } else {
  1331. formData.append("customText", "-");
  1332. }
  1333. if (this.form[formIndex].domains[i].id) {
  1334. formData.append("id", this.form[formIndex].domains[i].id);
  1335. } else {
  1336. formData.append("id", -1);
  1337. }
  1338. formData.append("projectId", parseFloat(this.form[formIndex].domains[i].projectId));
  1339. if (this.form[formIndex].domains[i].subProjectId) {
  1340. formData.append("subProjectId", this.form[formIndex].domains[i].subProjectId);
  1341. } else {
  1342. formData.append("subProjectId", 0);
  1343. }
  1344. if (this.form[formIndex].domains[i].groupId) {
  1345. formData.append("groupId", this.form[formIndex].domains[i].groupId);
  1346. } else {
  1347. formData.append("groupId", 0);
  1348. }
  1349. if (this.form[formIndex].domains[i].stage) {
  1350. formData.append("stage", this.form[formIndex].domains[i].stage);
  1351. } else {
  1352. formData.append("stage", '-');
  1353. }
  1354. formData.append("reportTimeType", this.reportTimeType.type);
  1355. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  1356. if (this.reportTimeType.type == 0) {
  1357. formData.append("timeType", this.form[formIndex].domains[i].timeType);
  1358. formData.append("workingTime", parseFloat(this.form[formIndex].domains[i].workingTime));
  1359. } else if (this.reportTimeType.type == 1) {
  1360. formData.append("workingTime", parseFloat(this.form[formIndex].domains[i].workingTime));
  1361. } else if (this.reportTimeType.type == 2) {
  1362. formData.append("startTime", this.form[formIndex].domains[i].startTime);
  1363. formData.append("endTime",this.form[formIndex].domains[i].endTime);
  1364. } else if (this.reportTimeType.type == 3) {
  1365. formData.append("progress", this.form[formIndex].domains[i].progress);
  1366. formData.append("workingTime",this.form[formIndex].domains[i].workingTime);
  1367. }
  1368. if (this.form[formIndex].domains[i].taskId) {
  1369. formData.append("taskId", this.form[formIndex].domains[i].taskId);
  1370. } else {
  1371. formData.append("taskId", 0);
  1372. }
  1373. if (this.form[formIndex].domains[i].taskFinish == true) {
  1374. formData.append("taskFinish", 1);
  1375. } else {
  1376. formData.append("taskFinish", 0);
  1377. }
  1378. formData.append("createDate", this.form[formIndex].createDate);
  1379. formData.append("isOvertime", this.form[formIndex].domains[i].isOvertime?1:0);
  1380. if (this.form[formIndex].domains[i].overtimeHours && this.form[formIndex].domains[i].isOvertime == 1) {
  1381. formData.append("overtimeHours", this.form[formIndex].domains[i].overtimeHours);
  1382. } else {
  1383. formData.append("overtimeHours", 0);
  1384. }
  1385. //项目专业进度
  1386. if (this.form[formIndex].domains[i].professionProgress) {
  1387. let m = JSON.stringify(this.form[formIndex].domains[i].professionProgress);
  1388. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  1389. formData.append("professionProgress", m);
  1390. } else {
  1391. formData.append("professionProgress", "[]");
  1392. }
  1393. //图片的处理,serverPic是当前所有的照片
  1394. if (this.form[formIndex].domains[i].serverPics) {
  1395. let m = JSON.stringify(this.form[formIndex].domains[i].serverPics);
  1396. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  1397. formData.append("pics", m);
  1398. } else {
  1399. formData.append("pics", "@");
  1400. }
  1401. //处理多个时间事项
  1402. if (this.reportTimeType.multiWorktime == 1) {
  1403. //检查时间是否有重叠
  1404. var workList = this.form[formIndex].domains[i].worktimeList;
  1405. for (var j=0;j<workList.length; j++) {
  1406. var curItem = workList[j];
  1407. if (curItem.startTime == null || curItem.endTime == null) {
  1408. this.$toast.fail("请设置"+this.weekArr[formIndex]+"的工作时间");
  1409. return;
  1410. }
  1411. //检查开始时间是否大于结束时间
  1412. if (curItem.startTime >= curItem.endTime) {
  1413. this.$toast.fail(this.weekArr[formIndex]+"的时间段"+curItem.startTime+'-'+curItem.endTime+"有误:"+
  1414. "结束时间必须大于开始时间");
  1415. return;
  1416. }
  1417. for (var p = j+1;p<workList.length; p++) {
  1418. var jItem = workList[p];
  1419. if ((jItem.startTime>=curItem.startTime&&jItem.startTime < curItem.endTime)
  1420. || (jItem.endTime>curItem.startTime&&jItem.endTime <= curItem.endTime)) {
  1421. this.$toast.fail(this.weekArr[formIndex]+"的时间段"+curItem.startTime+'-'+curItem.endTime+"与"+
  1422. jItem.startTime+'-'+jItem.endTime+ "存在重叠,请修改。");
  1423. return;
  1424. }
  1425. }
  1426. }
  1427. let m = JSON.stringify(this.form[formIndex].domains[i].worktimeList);
  1428. m = m.replace(/,/g,"@");//replaceAll(',','@');企业微信不兼容replaceAll
  1429. formData.append("content", m);
  1430. } else {
  1431. if (this.form[formIndex].domains[i].content) {
  1432. formData.append("content", this.form[formIndex].domains[i].content);
  1433. } else {
  1434. formData.append("content", '-');
  1435. }
  1436. }
  1437. //审核人
  1438. if (this.form[formIndex].domains[i].projectAuditorId) {
  1439. formData.append("projectAuditorId", this.form[formIndex].domains[i].projectAuditorId);
  1440. } else {
  1441. this.$toast.fail('请选择'+this.weekArr[formIndex]+'投入项目的审核人');
  1442. return;
  1443. }
  1444. }
  1445. }
  1446. // return
  1447. const toast = this.$toast.loading({
  1448. forbidClick: true,
  1449. duration: 0
  1450. });
  1451. // let formData = new FormData();
  1452. // if(!this.flgLg) {
  1453. // return
  1454. // }
  1455. // this.flgLg = false
  1456. this.$axios.post("/report/editReport", formData)
  1457. .then(res => {
  1458. // this.flgLg = true
  1459. if(res.code == "ok") {
  1460. this.$toast.clear();
  1461. this.$toast.success(this.isDraft==0?'提交成功':'暂存成功');
  1462. this.$router.push("/index");
  1463. } else {
  1464. this.$toast.clear();
  1465. this.$toast.fail((this.isDraft==0?'提交失败':'暂存失败')+':'+res.msg);
  1466. }
  1467. }).catch(err=> {this.$toast.clear()});
  1468. },
  1469. //初始化参数
  1470. initWxConfig() {
  1471. var curUrl=location.href.split("#")[0];
  1472. this.$axios.post("/wxcorp/getCorpWXConfig", {url: curUrl, token: this.user.id})
  1473. .then(res => {
  1474. if(res.code == "ok") {
  1475. var data=res.data;
  1476. wx.config({
  1477. beta: true,
  1478. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  1479. appId: data.appid, // 必填,公众号的唯一标识
  1480. timestamp: data.timestamp, // 必填,生成签名的时间戳
  1481. nonceStr: data.noncestr, // 必填,生成签名的随机串
  1482. signature: data.sign, // 必填,签名,见附录1
  1483. jsApiList: [
  1484. 'chooseImage',
  1485. 'previewImage',
  1486. 'uploadImage',
  1487. 'downloadImage',
  1488. 'previewFile',
  1489. 'getLocation',
  1490. ]
  1491. });
  1492. var that = this;
  1493. wx.ready(function(){
  1494. // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
  1495. // if (that.user.companyId == 7) {
  1496. // that.$toast('wx init success==7 ');
  1497. // that.getLocation();
  1498. // }
  1499. });
  1500. } else {
  1501. this.$toast.fail('获取失败');
  1502. }
  1503. }).catch(err=> {this.$toast.fail('发生异常'+err);console.log(err)});
  1504. },
  1505. deleteImg(item, index) {
  1506. //删除添加的图片
  1507. if (this.isIOSystem) {
  1508. item.iospics.splice(index,1);
  1509. item.iospics = item.iospics;
  1510. }
  1511. item.pics.splice(index,1);
  1512. item.pics = item.pics;
  1513. //传递到后台的数据也要做同步删除
  1514. item.serverPics.splice(index,1);
  1515. this.$forceUpdate();
  1516. },
  1517. //企业微信获取定位
  1518. getLocation() {
  1519. wx.getLocation({
  1520. type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
  1521. success: function (res) {
  1522. var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
  1523. var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
  1524. alert(JSON.stringify(res));
  1525. }
  1526. });
  1527. }
  1528. },
  1529. mounted() {
  1530. this.getDateRange()
  1531. // if(user.companyId == '817')
  1532. console.log('userId',this.user.companyId);
  1533. // console.log(localStorage.getItem("formVal"))
  1534. var ua = navigator.userAgent.toLowerCase();
  1535. this.isIOSystem = this.isIOS();
  1536. if (ua.indexOf("wxwork") > 0) {
  1537. this.isCorpWX = true;
  1538. } else if (ua.indexOf("micromessenger") > 0) {
  1539. this.isWX = true;
  1540. }
  1541. this.getPeoject() // 获取项目
  1542. //获取传递过来的日期
  1543. // var passDate = this.$route.query.date;
  1544. // if (passDate != null) {
  1545. // this.form.createDate = this.$route.query.date;
  1546. // }
  1547. this.getProject();
  1548. // this.getReport();
  1549. this.getTimeType();
  1550. //初始化微信js-sdk参数
  1551. if (this.isCorpWX) {
  1552. this.initWxConfig();
  1553. }
  1554. // if(localStorage.getItem("formVal")) {
  1555. // var obj = localStorage.getItem("formVal")
  1556. // this.form = JSON.parse(obj)
  1557. // localStorage.removeItem('formVal')
  1558. // }
  1559. },
  1560. beforeDestroy() {
  1561. // localStorage.removeItem('formVal')
  1562. }
  1563. };
  1564. </script>
  1565. <style lang="less" scope>
  1566. .my-swipe .van-swipe-item {
  1567. color: #fff;
  1568. font-size: 20px;
  1569. line-height: 150px;
  1570. text-align: center;
  1571. background-color: #39a9ed;
  1572. }
  1573. .van-field__control:disabled {
  1574. -webkit-text-fill-color:#646566;
  1575. }
  1576. .login_form {
  1577. margin-top: 46px;
  1578. }
  1579. .form_domains {
  1580. position: relative;
  1581. .form_copy {
  1582. position: absolute;
  1583. right: 85px;
  1584. top: 10px;
  1585. }
  1586. .form_addNew {
  1587. text-align: center;
  1588. margin:10px;
  1589. }
  1590. .form_del {
  1591. position: absolute;
  1592. right: 10px;
  1593. top: 10px;
  1594. }
  1595. // .form_del {
  1596. // color: #ff0000;
  1597. // font-size: 22px;
  1598. // position: absolute;
  1599. // right: 15px;
  1600. // top: 10px;
  1601. // }
  1602. }
  1603. .form_tip {
  1604. text-align: center;
  1605. margin-top: 20px;
  1606. color: #afafaf;
  1607. font-size: 14px;
  1608. }
  1609. .card__footer {
  1610. padding-top: 10px;
  1611. }
  1612. .card__tags {
  1613. .van-tag {
  1614. margin-right: 5px;
  1615. }
  1616. }
  1617. .overTimeClas{
  1618. display: flex;
  1619. width: 7.4rem;
  1620. // justify-content: space-between;
  1621. align-items: center;
  1622. }
  1623. .inbtn{
  1624. .selectgxbtn{
  1625. color: #1989fa;
  1626. border-color: #1989fa;
  1627. }
  1628. }
  1629. .selectgxbtn{
  1630. width: 100%;
  1631. }
  1632. </style>
  1633. <style lang="less">
  1634. .van-nav-bar .van-icon , .van-nav-bar__text {
  1635. color: #20a0ff;
  1636. }
  1637. .overtime {
  1638. height: 50px;
  1639. box-sizing: border-box;
  1640. padding-left: 10px;
  1641. display: flex;
  1642. align-items: center;
  1643. }
  1644. .custom-button {
  1645. width: 40px;
  1646. color: #fff;
  1647. font-size: 10px;
  1648. line-height: 16px;
  1649. text-align: center;
  1650. background-color: #1989fa;
  1651. border-radius: 100px;
  1652. }
  1653. .imgList {
  1654. position: relative;
  1655. width: 100px;
  1656. height: 100px;
  1657. display: inline-block;
  1658. }
  1659. .imgList_i {
  1660. position: absolute;
  1661. top: -8px;
  1662. right: -6px;
  1663. z-index: 999;
  1664. }
  1665. .ryuan {
  1666. padding: 0.3rem 0.53333rem;
  1667. // padding: 0 20px;
  1668. // line-height: 40px;
  1669. // height: 40px;
  1670. color: #333;
  1671. border-bottom: 2px solid #f6f6f6;
  1672. width: 100%;
  1673. overflow: hidden;
  1674. text-overflow:ellipsis;
  1675. white-space: nowrap;
  1676. }
  1677. .overListTime {
  1678. margin-left:5px;
  1679. display: inline-block;
  1680. width: 2rem;
  1681. color: #646566;
  1682. }
  1683. .hoveOver {
  1684. color: #C8C9CC;
  1685. }
  1686. .van-checkbox__label {
  1687. color: #646566 !important;
  1688. }
  1689. .van-checkbox__label--disabled {
  1690. color: #c8c9cc !important;
  1691. }
  1692. .submitClear{
  1693. position: absolute;
  1694. right: 0.1rem;
  1695. bottom: -0.95rem;
  1696. z-index: 1;
  1697. }
  1698. </style>