index.vue 90 KB

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