index.vue 138 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838
  1. <template>
  2. <div class="editClss">
  3. <van-nav-bar :title="substitute ? '代填日报' : '填写日报'" left-text="返回" @click-left="back" fixed left-arrow />
  4. <van-form class="login_form" ref="loginForm">
  5. <div>
  6. <van-field readonly clickable right-icon="arrow" v-if="substitute"
  7. :value="fillingAgent.name" :label="'代填人员'" placeholder="请选择代填人员"
  8. @click="auditorShow = true">
  9. <template #input>
  10. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName'
  11. :openid='fillingAgent.name'></ww-open-data></span>
  12. <span v-else>{{ fillingAgent.name }}</span>
  13. </template>
  14. </van-field>
  15. <van-field readonly clickable name="datetimePicker" :value="form.createDate" label="时间选择"
  16. placeholder="点击选择时间" @click="showPicker = true" :rules="rules.createDate" />
  17. <van-cell>
  18. <template #default>
  19. <div class="attendanceRecord">
  20. <template v-if="user.timeType.syncDingding == 1 || user.timeType.syncCorpwxTime == 1">
  21. <span>打卡:</span>
  22. <span v-if="!report.time">暂无考勤记录</span>
  23. <span v-else>{{ report.time.startTime }}-{{ report.time.endTime }}, 工作{{
  24. report.time.workHours }}h
  25. <span v-if="report.time.askLeaveTime">|&nbsp;请假{{ report.time.askLeaveTime
  26. }}h</span></span>
  27. </template>
  28. <span style="margin-left:5px">总填报:</span>
  29. <span>{{ totalReportHours }}h</span>
  30. </div>
  31. </template>
  32. <template #right-icon>
  33. <van-button icon="replay" native-type="button" type="default" size="mini"
  34. style="height:0.6rem;padding:0 0.16667rem;" :loading="cardRefLoading" loading-size="0.26667rem"
  35. @click.stop.native="cardtimeRefresh(form.createDate)"
  36. v-if="user.timeType.syncCorpwxTime == 1 && (user.timeType.syncDingding == 1 || user.timeType.syncCorpwxTime == 1)"></van-button>
  37. </template>
  38. </van-cell>
  39. <!-- <div v-if="report.time" class="attendanceRecord">
  40. <i class="iconfont firerock-icondakajilu" style="font-size:0.35rem;margin-right:0.12rem"></i>
  41. <span v-if="user.timeType.syncDingding==1&&!report.time">暂无考勤记录</span>
  42. <span v-else>{{report.time.startTime}}-{{report.time.endTime}}, {{report.time.workHours}}小时</span>
  43. </div> -->
  44. </div>
  45. <van-popup v-model="showPicker" position="bottom">
  46. <van-datetime-picker v-model="currentDate" type="date" :min-date="minDate" :max-date="maxDate"
  47. @confirm="changeTime" @cancel="showPicker = false" />
  48. </van-popup>
  49. <van-cell title="总时长(h)" v-if="reportTimeType.type == 3">
  50. <template>
  51. <van-stepper :disabled="(!canEdit || user.timeType.lockWorktime == 1) && !isWeekend"
  52. v-model="reportTimeType.allday" @change="changeAllTime" min="0.5" max="12" step="0.5"
  53. :decimal-length="1" />
  54. </template>
  55. </van-cell>
  56. <!-- <van-cell title="待分配时长" :value="report.time + 'h'" size="large"></van-cell> -->
  57. <div class="form_domains" v-for="(item, index) in form.domains" :key="item.id">
  58. <div style="float:right;margin-top:10px;margin-right:10px;">
  59. <!-- <van-tag v-if="canEdit&&item.projectName.length>0" color="#fff"
  60. @click="copyProject(index)" style="border: 1px solid #20a0ff;padding:5px;"
  61. icon="plus" type="default" ><span style="color:#666;padding: 0 5px;">复制项目</span></van-tag> -->
  62. <van-tag v-if="(index > 0 || form.domains.length > 1) && item.canEdit" color="#fff"
  63. @click="delPro(index)" style="border: 1px solid #ff0000;padding:5px;margin-left:10px;" icon="plus"
  64. type="default"><span style="color:#666;padding: 0 5px;">删除</span></van-tag>
  65. </div>
  66. <!-- <van-icon v-if="index>0&&canEdit" class="form_del" name="delete" @click="delPro(index)" /> -->
  67. <van-cell-group :title="(user.companyId == 781 ? '任务' : '项目') + (index + 1)">
  68. <!-- <div>请选择投入项目</div> -->
  69. <van-field readonly name="projectId" clickable :value="item.projectName"
  70. :label="user.companyId == 781 ? '工作任务' : '投入项目'"
  71. :placeholder="user.companyId == 781 ? '请选择工作任务' : '请选择项目'" @click="clickPicker(index, item)"
  72. :rules="[{ required: true, message: user.companyId == 781 ? '请选择任务' : '请选择项目' }]" />
  73. <!--昱众不显示子项目-->
  74. <van-field readonly name="subProjectId"
  75. v-if="user.companyId != yuzhongCompId && item.subProjectList != null && item.subProjectList.length > 0 && user.timeType.mainProjectState != 1"
  76. clickable :value="item.subProjectName" label="子项目" placeholder="请选择子项目"
  77. @click="clickPickSubProject(index, item)" />
  78. <van-popup v-model="item.showPickerSubProject" position="bottom">
  79. <van-picker show-toolbar :columns="item.subProjectList" value-key="name" @confirm="choseSubProject"
  80. @cancel="item.showPickerSubProject = false; $forceUpdate();" />
  81. </van-popup>
  82. <van-field readonly name="extraField1" v-if="user.companyId == yuzhongCompId" clickable
  83. :value="item.extraField1Name" label="角色选择" placeholder="请选择担任的角色"
  84. @click="clickPickProjectRole(index, item)" />
  85. <van-popup v-model="item.showPickerRole" position="bottom">
  86. <van-picker show-toolbar :columns="roleList" value-key="label" @confirm="choseRole"
  87. @cancel="item.showPickerRole = false; $forceUpdate();" />
  88. </van-popup>
  89. <!--任务分组 -->
  90. <van-field readonly name="groupId"
  91. v-if="user.company.packageProject == 1 && item.taskGroups != null && item.taskGroups.length > 0 && (user.company.nonProjectSimple==0 || (user.company.nonProjectSimple==1&& (item.projectId && projectss.filter(p => p.id == item.projectId)[0].isPublic!=1)))"
  92. clickable :rules="[{ required: user.companyId == 3092 ? true : false, message: '请选择任务分组' }]"
  93. :value="item.groupName" label="任务分组" placeholder="请选择任务分组"
  94. @click="clickPickTaskGroup(index, item)" />
  95. <!-- <van-popup v-model="item.showPickerTaskGroup" position="bottom">
  96. <van-picker show-toolbar :columns="item.taskGroups" value-key="name" @confirm="choseTaskGroup"
  97. @cancel="item.showPickerTaskGroup = false; $forceUpdate();" />
  98. </van-popup> -->
  99. <van-popup v-model="item.showPickerTaskGroup" position="bottom" :style="{ height: '80vh' }" @click-overlay="item.showPickerTaskGroup = false;$forceUpdate();">
  100. <div class="groupingSelection">
  101. <div v-for="(taskItem, taskIndex) in item.taskGroups" :key="taskIndex" class="groupingSelectionItem" @click="choseTaskGroup(taskItem, taskIndex)">
  102. {{ taskItem.name }}
  103. </div>
  104. </div>
  105. </van-popup>
  106. <!--工作职责-->
  107. <van-field readonly name="extraField2" v-if="user.companyId == yuzhongCompId" clickable
  108. :value="item.extraField2Name" label="工作职责" placeholder="请选择工作职责"
  109. @click="clickPickRespon(index, item)" />
  110. <van-popup v-model="item.showPickerRespon" position="bottom">
  111. <van-picker show-toolbar :columns="item.filteredRespList" value-key="jobRespon"
  112. @confirm="onResponseChosen" @cancel="item.showPickerRespon = false; $forceUpdate();" />
  113. </van-popup>
  114. <!--工作内容-->
  115. <van-field readonly name="extraField3" v-if="user.companyId == yuzhongCompId" clickable
  116. :value="item.extraField3Name" label="工作内容" placeholder="请选择工作内容"
  117. @click="clickPickWorkContent(index, item)" />
  118. <van-popup v-model="item.showPickerWorkContent" position="bottom">
  119. <van-picker show-toolbar :columns="item.workContentList" value-key="workContext"
  120. @confirm="choseWorkContent" @cancel="item.showPickerWorkContent = false; $forceUpdate();" />
  121. </van-popup>
  122. <!--任务阶段 -->
  123. <van-field readonly name="stage"
  124. v-if="user.companyId != yuzhongCompId && user.company.packageProject == 1 && !user.timeType.hideStages && item.stages != null && item.stages.length > 0"
  125. clickable :value="item.stage" label="投入阶段" placeholder="请选择投入阶段"
  126. @click="clickPickStage(index, item)" />
  127. <van-popup v-model="item.showPickerStage" position="bottom">
  128. <van-picker show-toolbar :columns="item.stages" value-key="stagesName" @confirm="choseStage"
  129. @cancel="item.showPickerStage = false; $forceUpdate();" />
  130. </van-popup>
  131. <!-- 预算来源 -->
  132. <van-field readonly name="basecostId"
  133. v-if="user.company.packageProject == 1 && reportBasecostList && reportBasecostList.length > 0"
  134. :value="item.basecostName" label="预算来源" placeholder="请选择预算来源"
  135. @click="clickPickCostId(index, item)" />
  136. <van-popup v-model="item.showPickerCostId" position="bottom">
  137. <van-picker show-toolbar :columns="reportBasecostList" value-key="name" @confirm="choseCostId"
  138. @cancel="item.showPickerCostId = false; $forceUpdate();" />
  139. </van-popup>
  140. <!-- 审核人 -->
  141. <template v-if="user.timeType.reportAuditType != 3">
  142. <van-field readonly name="projectAuditorId"
  143. v-if="item.auditUserList != null && item.auditUserList.length > 0" clickable
  144. :value="item.projectAuditorName" :label="user.companyId == 781 ? '审核人' : '项目审核人'"
  145. placeholder="请选择审核人" @click="clickPickAuditor(index, item)">
  146. <template #input>
  147. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName'
  148. :openid='item.projectAuditorName'></ww-open-data></span>
  149. <span v-else>{{ item.projectAuditorName }}</span>
  150. </template>
  151. </van-field>
  152. <van-popup v-model="item.showPickerAuditor" position="bottom">
  153. <van-picker show-toolbar :columns="item.auditUserList" value-key="auditorName"
  154. @confirm="choseAuditor" @cancel="item.showPickerAuditor = false; $forceUpdate();">
  155. <template #option="item">
  156. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName'
  157. :openid='item.auditorName'></ww-open-data></span>
  158. <span v-else>{{ item.auditorName }}</span>
  159. </template>
  160. </van-picker>
  161. </van-popup>
  162. </template>
  163. <!-- 自选审批人 -->
  164. <template v-if="user.timeType.reportAuditType == 3">
  165. <van-field readonly clickable label="第一审核人" @click="auditorClick(index, 'auditorFirst')">
  166. <template #input>
  167. <span v-if="!item.auditorFirst"></span>
  168. <span v-else-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName'
  169. :openid='item.auditorFirst.name'></ww-open-data></span>
  170. <span v-else>{{ item.auditorFirst.name }}</span>
  171. </template>
  172. </van-field>
  173. <van-field readonly clickable label="第二审核人" @click="auditorClick(index, 'auditorSec')"
  174. v-if="user.timeType.auditLevel > 1">
  175. <template #input>
  176. <span v-if="!item.auditorSec"></span>
  177. <span v-else-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName'
  178. :openid='item.auditorSec.name'></ww-open-data></span>
  179. <span v-else>{{ item.auditorSec.name }}</span>
  180. </template>
  181. </van-field>
  182. <van-field readonly clickable label="第三审核人" @click="auditorClick(index, 'auditorThird')"
  183. v-if="user.timeType.auditLevel > 2">
  184. <template #input>
  185. <span v-if="!item.auditorThird"></span>
  186. <span v-else-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName'
  187. :openid='item.auditorThird.name'></ww-open-data></span>
  188. <span v-else>{{ item.auditorThird.name }}</span>
  189. </template>
  190. </van-field>
  191. <van-field readonly clickable label="抄送人" @click="auditorClick(index, 'ccUserid')">
  192. <template #input>
  193. <span v-if="!item.ccUserid"></span>
  194. <span v-else-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName'
  195. :openid='item.ccUserid.name'></ww-open-data></span>
  196. <span v-else>{{ item.ccUserid.name }}</span>
  197. </template>
  198. </van-field>
  199. </template>
  200. <!-- 选人 -->
  201. <van-popup v-model="auditorShow" position="bottom">
  202. <van-search v-model="auditor.searchText" placeholder="输入员工姓名搜索" @search="onSearch"
  203. v-if="user.userNameNeedTranslate != '1'"></van-search>
  204. <div style="minHeight:300px;">
  205. <van-radio-group v-model="auditor.item">
  206. <van-radio v-for="uitem in auditor.searchList" :key="uitem.id" :name="uitem"
  207. style="padding:10px">
  208. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName'
  209. :openid='uitem.name'></ww-open-data></span>
  210. <span v-else>{{ uitem.name ? uitem.name : '' }}</span>
  211. </van-radio>
  212. </van-radio-group>
  213. <van-button style="width:100%;position: -webkit-sticky;position: sticky;bottom: 0;"
  214. @click="searchAuditor()">确定</van-button>
  215. </div>
  216. </van-popup>
  217. <!-- 相关维度 -->
  218. <van-field :value="item.weiduName" v-if="item.projectId && user.timeType.customDegreeActive == 1"
  219. readonly name="id" clickable :label="user.timeType.customDegreeName" placeholder="请选择"
  220. @click="clickPickers(index, item)" />
  221. <!-- <van-popup v-model="item.showPickDegree" position="bottom">
  222. <van-picker show-toolbar :columns="item.wuduList" value-key="name" @confirm="choseProjects"
  223. @cancel="item.showPickDegree = false; $forceUpdate()" />
  224. </van-popup> -->
  225. <van-popup v-model="item.showPickDegree" position="bottom">
  226. <div class="chooseSomeone">
  227. <div class="chooseSomeoneFlex1">
  228. <!-- 复选 -->
  229. <van-radio-group v-model="item.radioPickDegree" v-if="!user.timeType.customDegreeMultiple">
  230. <van-radio v-for="uitem in item.wuduList" :key="uitem.id" :name="uitem" style="padding:10px">
  231. {{ uitem.name ? uitem.name : '' }}
  232. </van-radio>
  233. </van-radio-group>
  234. <!-- 多选 -->
  235. <van-checkbox-group v-model="item.radioPickDegree" v-else>
  236. <van-checkbox v-for="uitem in item.wuduList" :key="uitem.id" :name="uitem" style="padding:10px">
  237. {{ uitem.name ? uitem.name : '' }}
  238. </van-checkbox>
  239. </van-checkbox-group>
  240. </div>
  241. <van-button @click="choseProjects(item.radioPickDegree)">
  242. 确定
  243. </van-button>
  244. </div>
  245. </van-popup>
  246. <!-- 自定义数值 -->
  247. <van-field v-if="user.timeType.customDataActive == 1" type="number" :disabled="!item.canEdit"
  248. v-model="item.customData" :label="user.timeType.customDataName" placeholder="请输入数字"
  249. :rules="user.timeType.customDataStatus == 1 ? [{ required: true, message: '请输入' + user.timeType.customDataName }] : []"></van-field>
  250. <!-- 自定义文本 -->
  251. <van-field v-if="user.timeType.customTextActive == 1" :disabled="!item.canEdit"
  252. v-model="item.customText" :label="user.timeType.customTextName" placeholder="请输入" maxlength="1000"
  253. :rules="user.timeType.customTextStatus ? [{ required: true, message: '请选择' + user.timeType.customTextName }] : []"
  254. rows="2" type="textarea" show-word-limit autosize></van-field>
  255. <van-cell title="专业进度" v-if="user.company.packageEngineering == 1">
  256. </van-cell>
  257. <van-field :disabled="!item.canEdit" type="number" :name="'progress_' + pItem.professionId"
  258. input-align="right" v-for="pItem in item.professionProgress" :key="pItem.professionId"
  259. :label="'-- ' + pItem.professionName">
  260. <template slot="input">
  261. <van-stepper v-model="pItem.progress" integer min="0" max="100" />%
  262. </template>
  263. </van-field>
  264. <van-field v-if="user.company.packageProject == 1 && !user.timeType.hideTask && (user.company.nonProjectSimple==0 || (user.company.nonProjectSimple==1&& (item.projectId && projectss.filter(p => p.id == item.projectId)[0].isPublic!=1)))" readonly name="taskId" :value="item.taskName"
  265. :rules="[{ required: reportTimeType.taskRequired? true : false, message: '请选择任务/里程碑' }]" label="任务/里程碑"
  266. placeholder="请选择任务/里程碑" @click="clickPickerTask(index, item)"></van-field>
  267. <van-field v-if="user.companyId == 3092" readonly name="sapServiceId" :value="item.sapServiceName"
  268. :rules="[{ required: true, message: '请选择服务' }]" label="服务" placeholder="请选择服务"
  269. @click="clickPickerService(index, item)"></van-field>
  270. <van-field name="taskFinish" label="是否已完成" v-if="item.taskId != null">
  271. <template #input>
  272. <van-checkbox :disabled="!item.canEdit" v-model="item.taskFinish"
  273. shape="square">已完成</van-checkbox>
  274. </template>
  275. </van-field>
  276. <van-popup v-model="item.showPickerTask" position="bottom">
  277. <van-picker show-toolbar :columns="item.taskList" value-key="taskName" @confirm="choseTask"
  278. @cancel="item.showPickerTask = false; $forceUpdate()" />
  279. </van-popup>
  280. <van-popup v-model="item.showPickerService" position="bottom">
  281. <van-picker show-toolbar :columns="item.serviceList" value-key="serviceName" @confirm="choseService"
  282. @cancel="item.showPickerService = false; $forceUpdate()" />
  283. </van-popup>
  284. <!-- <van-field readonly clickable class="form_input" :value="item.workingTime" name="workingTime" label="工作时长" placeholder="请输入工作时长(单位:小时)"
  285. :rules="[{ required: true, message: '请输入工作时长(单位:小时)' }]" @touchstart.native.stop="showNumberKey = true"/>
  286. <van-number-keyboard v-model="item.workingTime" :show="showNumberKey" close-button-text="完成" extra-key="." :maxlength="4" @blur="showNumberKey = false" /> -->
  287. <!-- 常规选择时间的方式 -->
  288. <!-- 全天上下午模式 -->
  289. <div v-if="reportTimeType.multiWorktime == 0">
  290. <van-field v-if="reportTimeType.type < 2" readonly clickable
  291. :value="reportTimeType.type == 0 ? item.label : (parseFloat(item.workingTime).toFixed(1) + 'h')"
  292. label="工作时长" placeholder="请选择工作时长(小时)" @click="clickTimePicker(index, item)"
  293. :rules="[{ required: true, message: '请选择工作时长' }]" />
  294. <van-popup v-model="showPickerTime" position="bottom">
  295. <van-picker show-toolbar :columns="timeType" value-key="label" @confirm="choseTimePick"
  296. @cancel="showPickerTime = false" />
  297. </van-popup>
  298. <!-- 选择数字时间长度模式 -->
  299. <van-popup v-model="showPickerHours" position="bottom">
  300. <van-picker show-toolbar :columns="timeRange" :default-index="15" @confirm="choseTimePick"
  301. @cancel="showPickerHours = false" />
  302. </van-popup>
  303. <!-- 时间段选择模式 -->
  304. <van-field readonly v-if="reportTimeType.type == 2" clickable name="datetimePicker"
  305. :value="item.startTime" label="开始时间" placeholder="点击选择时间"
  306. @click="item.canEdit ? showStartTime = true : '', dailyIndex = index" :disabled="!item.canEdit"
  307. :rules="[{ required: true, message: '请选择开始时间' }]" />
  308. <van-popup v-model="showStartTime" position="bottom">
  309. <van-datetime-picker v-model="startTime" type="time" @confirm="confirmTime(item, 0);"
  310. @cancel="showStartTime = false" :min-hour="0" :max-hour="23" />
  311. <!-- :filter="filter" 原本这个属性在里面 -->
  312. </van-popup>
  313. <van-field v-if="reportTimeType.type == 2" readonly clickable name="datetimePicker"
  314. :value="item.endTime" label="结束时间" placeholder="点击选择时间"
  315. @click="item.canEdit ? showEndTime = true : '', dailyIndex = index" :disabled="!item.canEdit"
  316. :rules="[{ required: true, message: '请选择结束时间' }]" />
  317. <van-popup v-model="showEndTime" position="bottom">
  318. <van-datetime-picker v-model="endTime" type="time" :min-hour="0" :max-hour="23"
  319. @confirm="confirmTime(item, 1)" @cancel="showEndTime = false" />
  320. <!-- :filter="filter" 原本这个属性在里面 -->
  321. </van-popup>
  322. <van-cell v-if="reportTimeType.type == 3">
  323. <template>
  324. <div>
  325. <span>用时占比</span>
  326. <van-slider :disabled="!item.canEdit" :min="0" :step="5"
  327. style="width:120px;display:inline-block;margin-left:50px;" v-model="item.progress"
  328. :value="100"
  329. @change="item.workingTime = (reportTimeType.allday * item.progress / 100).toFixed(1), setTotalReportHours()">
  330. <template #button>
  331. <div class="custom-button">{{ item.progress }}%</div>
  332. </template>
  333. </van-slider>
  334. <span style="margin-left:10px;float:right;">{{ item.workingTime }}小时</span>
  335. </div>
  336. </template>
  337. </van-cell>
  338. <van-field class="form_input" :disabled="!item.canEdit" v-model="item.content" name="content"
  339. type="textarea" :label="user.companyId == 781 ? '具体内容与结果' : '工作事项'" placeholder="请输入"
  340. :rules="user.timeType.workContentState == 1 ? [{ required: true, message: '请填写工作事项' }] : null"
  341. rows="3" autosize />
  342. </div>
  343. <!-- 多个时间和工作事项的选择方式 -->
  344. <div v-if="reportTimeType.multiWorktime == 1">
  345. <div v-for="(timeItem, tindex) in item.worktimeList" :key="tindex"
  346. style="position:relative;border:#ccc 0.5px solid;margin:7px;">
  347. <van-tag v-if="tindex > 0 && item.canEdit"
  348. style="position:absolute; right:-7px;top:-7px;z-index:10;"
  349. @click="removeTimeItem(item, tindex)">X</van-tag>
  350. <!-- 时间段选择模式 -->
  351. <van-field readonly v-if="reportTimeType.type == 2" :clickable="item.canEdit"
  352. name="datetimePicker" :value="timeItem.startTime" label="开始时间" placeholder="点击选择时间"
  353. :rules="[{ required: true, message: '必填项' }]"
  354. @click="item.canEdit ? showStartDialog(timeItem) : ''" />
  355. <van-field v-if="reportTimeType.type == 2" readonly :clickable="canEdit" name="datetimePicker"
  356. :value="timeItem.endTime" label="结束时间" placeholder="点击选择时间"
  357. :rules="[{ required: true, message: '必填项' }]"
  358. @click="item.canEdit ? showEndDialog(timeItem) : ''" />
  359. <van-field class="form_input" :disabled="!item.canEdit"
  360. style="color:#333;-webkit-text-fill-color:#646566;" v-model="timeItem.content"
  361. name="content" type="textarea" label="工作事项" placeholder="请输入工作事项"
  362. :rules="user.timeType.workContentState == 1 ? [{ required: true, message: '请填写工作事项' }] : null"
  363. rows="1" autosize />
  364. </div>
  365. <!--时间选择器 , 做统一处理,不能放到循环里,不然会有多个公用showStartTime,最后一个会现在最上层UI,导致BUG -->
  366. <van-popup v-model="showWorkStartTime" position="bottom">
  367. <van-datetime-picker v-model="startTime" type="time" @confirm="confirmWorkTime(0);"
  368. @cancel="showWorkStartTime = false" :min-hour="0" :max-hour="23" />
  369. <!-- :filter="filter" 原本这个属性在里面 -->
  370. </van-popup>
  371. <van-popup v-model="showWorkEndTime" position="bottom">
  372. <van-datetime-picker v-model="endTime" type="time" :min-hour="0" :max-hour="23"
  373. @confirm="confirmWorkTime(1)" @cancel="showWorkEndTime = false" />
  374. <!-- :filter="filter" 原本这个属性在里面 -->
  375. </van-popup>
  376. </div>
  377. <div style="width:100%;" v-if="item.canEdit && reportTimeType.multiWorktime == 1">
  378. <van-tag style="text-align:center;padding:5px;margin-left:15px;border: 1px solid #20a0ff;"
  379. :disabled="!item.canEdit" @click="addNewWorktime(index, item)" icon="plus" color="#ffffff"><span
  380. style="color:#999;text-align:center;padding: 0 5px;"> 添加工时 </span></van-tag>
  381. </div>
  382. <div class="overtime"
  383. v-if="((user.timeType.fillOvertime || (isWeekend && user.timeType.lockWorktime != 1)) || (isCorpWX && canEdit))">
  384. <div class="overTimeClas"
  385. v-if="user.timeType.fillOvertime || (isWeekend && user.timeType.lockWorktime != 1)">
  386. <van-checkbox :disabled="!item.canEdit" v-model="item.isOvertime"
  387. style="width: 4.3rem;">含加班</van-checkbox>
  388. <van-field v-model="item.overtimeHours" type="number"
  389. :disabled="!item.canEdit || item.isOvertime == null || item.isOvertime == 0 || !item.isOvertime"
  390. placeholder="请输入加班时长" style="width: 5.2rem"></van-field>
  391. <span :class="item.canEdit ? 'overListTime' : 'overListTime hoveOver'">小时</span>
  392. </div>
  393. <van-tag style="position:absolute;right:10px;" v-if="isCorpWX && item.canEdit" type="primary"
  394. size="large" @click="takePhoto(index)">拍照上传</van-tag>
  395. <!-- <van-tag style="position:absolute;right:10px;" type="primary" size="large" @click="takePhoto(index)">拍照上传</van-tag> -->
  396. <!-- <van-tag style="position:absolute;right:10px;" type="primary" size="large" @click="takePhoto(index)">拍照上传</van-tag> -->
  397. </div>
  398. <div style="padding:5px;text-align:center;" v-if="!isIOSystem">
  399. <span v-for="(p, index) in item.pics" :key="p" style="margin-right:15px;">
  400. <div class="imgList">
  401. <van-icon v-if="item.canEdit && user.companyId == 7" size="20" name="clear"
  402. @click="deleteImg(item, index)" class="imgList_i" />
  403. <img :src="p" style="width:100px; height:100px;" @click="showLargeImg(item.pics, index)" />
  404. </div>
  405. </span>
  406. </div>
  407. <div style="padding:5px;text-align:center;" v-if="isIOSystem">
  408. <span v-for="(p, index) in item.iospics" :key="p" style="margin-right:15px;">
  409. <div class="imgList">
  410. <van-icon v-if="item.canEdit && user.companyId == 7" size="20" name="clear"
  411. @click="deleteImg(item, index)" class="imgList_i" />
  412. <img :src="p" style="width:100px; height:100px;"
  413. @click="showLargeImg(item.iospics, index)" />
  414. </div>
  415. </span>
  416. </div>
  417. <van-popup v-model="imgShow" position="bottom" closeable>
  418. <van-swipe class="my-swipe" indicator-color="white">
  419. <van-swipe-item v-for="(picItem, index) in tmpPics" :key="index">
  420. <img :src="picItem" style="width:100%;" />
  421. </van-swipe-item>
  422. </van-swipe>
  423. </van-popup>
  424. </van-cell-group>
  425. </div>
  426. <div style="text-align:center;">
  427. <van-tag size="large"
  428. style="text-align:center;margin:10px;padding:12px;margin-bottom:120px;border: 1px solid #20a0ff;"
  429. @click="addNewPro" icon="plus" color="#ffffff"><span
  430. style="color:#999;text-align:center;padding: 0 50px;"> + 新增{{ user.companyId == 781 ? '任务' : '项目' }}
  431. </span></van-tag>
  432. <!-- <van-button id="btn-start-recording" @click="startRecording">录音</van-button>
  433. <van-button id="btn-stop-recording" @click="stopRecording">停止</van-button>
  434. <van-button id="btn-play-recording" @click="getRecording">获取文件</van-button> -->
  435. </div>
  436. <div class="form_btn" style="position:fixed; bottom:0px;width:100%;">
  437. <div style="padding-bottom:10px;" v-if="!substitute">
  438. <van-button v-if="canEdit" square block type="info" @click="isDraft = 0; submitReport()"
  439. native-type="submit" style="width: 50%;float:left;">
  440. <div v-if="flgLg">提交</div>
  441. <van-loading type="spinner" v-if="!flgLg" />
  442. </van-button>
  443. <van-button v-if="canEdit" square block type="default" @click="isDraft = 1; submitReport()"
  444. native-type="submit" style="width:50%;float:left;">
  445. <div v-if="flgLg">暂存</div>
  446. <van-loading type="spinner" v-if="!flgLg" />
  447. </van-button>
  448. </div>
  449. <div style="padding-bottom:10px;" v-if="substitute">
  450. <van-button v-if="canEdit" square block type="info" @click="isDraft = 0; submitReport()"
  451. native-type="submit">
  452. <div v-if="flgLg">提交</div>
  453. <van-loading type="spinner" v-if="!flgLg" />
  454. </van-button>
  455. </div>
  456. <van-button v-if="canDeleteReport" square block type="default" @click="deleteReport" native-type="button"
  457. style=""> 删除 </van-button>
  458. <van-button v-if="canCancelInDialog" block type="default" @click="cancel"> 撤回 </van-button>
  459. <!-- <div v-if="canEdit&&form.domains.length>0 && form.domains[0].id != null"
  460. style="display:block;padding-top:30px;font-size:15px;color:#666;margin:0 auto;text-align:center;padding-bottom:10px;background:#ffffff;"
  461. @click="deleteReport"> 删除 </div> -->
  462. <!-- <van-button v-if="canEdit" square block type="default" @click="deleteReport" native-type="button"
  463. style="margin-top:10px;"> 删除 </van-button> -->
  464. </div>
  465. </van-form>
  466. <div class="form_tip" v-if="!canEdit && !canCancel"> 已审核无法修改 </div>
  467. <!-- 选择项目弹窗 -->
  468. <van-popup v-model="showPickerUserddp" position="bottom" style="height: 84%">
  469. <div class="popupDiv">
  470. <!-- <van-search v-model="userName" placeholder="请输入项目名称/编号" @clear="sea()" @blur="sea()" @search="sea()" @input="sea()"/> -->
  471. <div class="popupSearch">
  472. <van-search v-model="userName" shape="round" background="#F4F4F4" placeholder="请输入项目名称/编号"
  473. @clear="sea()" @blur="sea()" @search="sea()" @input="sea()" />
  474. </div>
  475. <div class="popupCon">
  476. <!-- <div class="ryuan" style="color: rgb(185 185 185);">近期选择项目</div>
  477. <div v-for="(item, index) in integrationProjectList" :key="index" class="ryuan" @click="fZr(item, index)">
  478. <p>{{item.projectName}}</p>
  479. <p style="margin-top: 5px;color: #9697B2;">{{item.projectCode}}</p>
  480. </div>
  481. <div class="ryuan" style="color: rgb(185 185 185);">全部项目</div>
  482. <div v-for="(item, index) in projectss" :key="item.id" class="ryuan" @click="fZr(item, index)">
  483. <p>{{item.projectName}}</p>
  484. <p style="margin-top: 5px;color: #9697B2;">{{item.projectCode}}</p>
  485. </div> -->
  486. <div class="popupTitle">近期选择项目</div>
  487. <div v-for="(item, index) in integrationProjectList" :key="index" class="popupItem paddingDiv"
  488. @click="fZr(item, index)">
  489. <p class="popupItemOne" v-if="item.projectName">{{ item.projectName }}</p>
  490. <p class="popupItemTwo" v-if="item.projectCode">{{ item.projectCode }}</p>
  491. </div>
  492. <div class="popupTitle marginTop">全部项目</div>
  493. <div v-for="(item, index) in projectss" :key="item.id" class="popupItem paddingDiv"
  494. @click="fZr(item, index)">
  495. <p class="popupItemOne" v-if="item.projectName">{{ item.projectName }}</p>
  496. <p class="popupItemTwo" v-if="item.projectCode">{{ item.projectCode }}</p>
  497. </div>
  498. <!-- <div class="popupTitle paddingDiv">全部项目</div> -->
  499. </div>
  500. </div>
  501. </van-popup>
  502. </div>
  503. </template>
  504. <script>
  505. import timetoolVue from '../timetool/timetool.vue';
  506. // Vue.prototype.$wx = wx
  507. // import { Recorder } from '../../assets/record/recorder'
  508. // var recorder = null
  509. export default {
  510. data() {
  511. return {
  512. roleList: [{ value: 1, label: 'CRC&LM' }, { value: 2, label: 'PM' }],
  513. jobResponseList: [],
  514. yuzhongCompId: 3385,
  515. dailyIndex: 0,
  516. integrationProjectList: [],
  517. cardRefLoading: false,
  518. today: '',
  519. showPickerStage: false,
  520. showPickerTaskGroup: false,
  521. showPickerSubProject: false,
  522. showPickerCostId: false,
  523. isDraft: 0,
  524. showWorkStartTime: false,
  525. showWorkEndTime: false,
  526. curWorktime: null,
  527. isIOSystem: false,
  528. imgShow: false,
  529. isCorpWX: false,
  530. isWX: false,
  531. showPickerTask: false,
  532. canCancel: false,
  533. canDeleteReport: false,
  534. canCancelInDialog: false,
  535. canEdit: false,
  536. showEndTime: false,
  537. showStartTime: false,
  538. startTime: '09:00',
  539. endTime: '18:00',
  540. nowTime: new Date(),
  541. showPickerHours: false,
  542. timeRange: [],
  543. selectTime: null,
  544. reportTimeType: {},
  545. user: JSON.parse(localStorage.userInfo),
  546. minDate: new Date(2010, 0, 1),
  547. maxDate: new Date(),
  548. currentDate: new Date(),
  549. showPickerTime: false,
  550. showPicker: false,
  551. showPickerProject: false,
  552. showPickDegree: false,
  553. clickIndex: 0,
  554. clickTimeIndex: 0,
  555. showNumberKey: false,
  556. canClick: 2,
  557. timeType: [],
  558. form: {
  559. createDate: this.format(new Date(new Date()), "yyyy-MM-dd"),
  560. domains: [{
  561. id: null,
  562. projectId: "",
  563. projectName: "",
  564. workingTime: "",
  565. content: "",
  566. state: 2,
  567. multiWorktime: 0,
  568. worktimeList: {},
  569. degreeId: ''
  570. // pics:["https://worktime.ttkuaiban.com/upload/bc4df504fa724e6cab69872e2c1cfb35.png",
  571. // "https://worktime.ttkuaiban.com/upload/bc4df504fa724e6cab69872e2c1cfb35.png",
  572. // "https://worktime.ttkuaiban.com/upload/bc4df504fa724e6cab69872e2c1cfb35.png",]
  573. }],
  574. },
  575. rules: {
  576. createDate: [{ required: true, message: '请选择填报日期' }],
  577. },
  578. project: [],
  579. report: "",
  580. loading: false,
  581. finished: false,
  582. // isOvertime: false
  583. tmpPics: [],
  584. dateAr: [],
  585. showPickerUserddp: false, // 选择项目弹窗
  586. projectss: [],
  587. proads: [],
  588. userName: '',
  589. flgLg: true,
  590. reportBasecostList: [],
  591. isWeekend: false,
  592. auditorShow: false,
  593. auditor: {
  594. index: 0,
  595. auditorIndex: 'auditorFirst',
  596. searchText: '',
  597. item: {},
  598. list: [],
  599. searchList: []
  600. },
  601. // vacationTime: {},
  602. totalReportHours: 0,
  603. // leftDataList:[],
  604. // rightDataList:[],
  605. substitute: false, // 是否为代填日报
  606. fillingAgent: {
  607. name: '',
  608. id: ''
  609. }, // 代填人员信息
  610. };
  611. },
  612. created() {
  613. },
  614. watch: {},
  615. computed: {
  616. // totalReportHours(){
  617. // let domains = this.form.domains
  618. // let hours = 0
  619. // for(let i in domains){
  620. // if(domains[i].projectId){
  621. // // hours += parseFloat(domains[i].workingTime)
  622. // if(this.reportTimeType.multiWorktime == 1){
  623. // for(let m in domains[i].worktimeList){
  624. // if(domains[i].worktimeList[m].startTime && domains[i].worktimeList[m].endTime){
  625. // hours += this.getHour(domains[i].worktimeList[m].startTime, domains[i].worktimeList[m].endTime)
  626. // }
  627. // }
  628. // }else{
  629. // if(this.user.timeType.type == 2){
  630. // if(domains[i].startTime && domains[i].endTime){
  631. // let selectionTime = this.getHour(domains[i].startTime, domains[i].endTime)
  632. // let subtractedData = 0
  633. // let arr = JSON.parse(JSON.stringify(this.vacationTime))
  634. // arr.unshift({s: domains[i].startTime, e: domains[i].endTime})
  635. // for(var j in arr) {
  636. // subtractedData += +this.timeOverlap(j, arr)
  637. // }
  638. // console.log(selectionTime, subtractedData)
  639. // hours += +selectionTime - +subtractedData
  640. // console.log(hours)
  641. // }
  642. // } else {
  643. // hours += domains[i].workingTime ? parseFloat(domains[i].workingTime) : 0
  644. // }
  645. // }
  646. // }
  647. // }
  648. // return hours.toFixed(2)
  649. // },
  650. },
  651. methods: {
  652. //选中角色
  653. choseRole(value, index) {
  654. if (value) {
  655. this.form.domains[this.clickIndex].extraField1 = value.value;
  656. this.form.domains[this.clickIndex].extraField1Name = value.label;
  657. }
  658. this.form.domains[this.clickIndex].showPickerRole = false;
  659. this.updateResponse(this.form.domains[this.clickIndex]);
  660. this.$forceUpdate();
  661. },
  662. choseWorkContent(value, index) {
  663. if (value) {
  664. this.form.domains[this.clickIndex].extraField3 = value.id;
  665. this.form.domains[this.clickIndex].extraField3Name = value.workContext;
  666. }
  667. this.form.domains[this.clickIndex].showPickerWorkContent = false;
  668. this.$forceUpdate();
  669. },
  670. onResponseChosen(value, index) {
  671. if (value) {
  672. this.form.domains[this.clickIndex].extraField2 = value.id;
  673. this.form.domains[this.clickIndex].extraField2Name = value.jobRespon;
  674. this.form.domains[this.clickIndex].extraField3 = null;
  675. this.form.domains[this.clickIndex].extraField3Name = null;
  676. }
  677. this.form.domains[this.clickIndex].showPickerRespon = false;
  678. this.updateJobContent(this.form.domains[this.clickIndex]);
  679. },
  680. clickPickWorkContent(i, item) {
  681. if (!item.canEdit) return;
  682. this.clickIndex = i;
  683. item.showPickerWorkContent = true;
  684. this.$forceUpdate();
  685. },
  686. clickPickRespon(i, item) {
  687. if (!item.canEdit) return;
  688. this.clickIndex = i;
  689. item.showPickerRespon = true;
  690. this.$forceUpdate();
  691. },
  692. //更新工作内容列表
  693. updateJobContent(domainItem) {
  694. var that = this;
  695. this.$axios.post('/project/getFunWorkContextList', { id: domainItem.extraField2 })
  696. .then(res => {
  697. if (res.code == 'ok') {
  698. that.$set(domainItem, 'extraField3', null);
  699. that.$set(domainItem, 'workContentList', res.data);
  700. }
  701. }).catch(err => { })
  702. },
  703. updateResponse(domainItem) {
  704. console.log(111);
  705. var that = this;
  706. var selectPid = domainItem.projectId;
  707. domainItem.extraField2 = null;
  708. domainItem.extraField3 = null;
  709. domainItem.extraField2Name = null;
  710. domainItem.extraField3Name = null;
  711. if (selectPid && domainItem.extraField1) {
  712. //是否非项目
  713. var isPublic = this.projectss.filter(p => p.id == selectPid)[0].isPublic;
  714. console.log('==========', 'isPublic==' + isPublic);
  715. var filteredRespList = this.jobResponseList.filter(j => j.timeType == (isPublic ? '非项目工时' : '项目工时') && j.role == (this.roleList.filter(r => r.value == domainItem.extraField1)[0].label));
  716. domainItem.filteredRespList = filteredRespList;
  717. }
  718. },
  719. getJobResponList() {
  720. this.$axios.post('/project/getFunctionalDivisionList', {})
  721. .then(res => {
  722. if (res.code == 'ok') {
  723. this.jobResponseList = res.data;
  724. }
  725. }).catch(err => { })
  726. },
  727. getRecentlyProject() {
  728. this.$axios.post('/project/nearProject', {})
  729. .then(res => {
  730. if (res.code == 'ok') {
  731. this.integrationProjectList = res.data;
  732. //去掉全部项目中没有的
  733. this.setTimeout(() => {
  734. this.integrationProjectList = this.integrationProjectList.filter(near => this.getProjectAuditorList.find(pItem => pItem.id == near.id) != null);
  735. }, 1000);
  736. }
  737. }).catch(err => { this.$toast.clear(); this.cardRefLoading = false; })
  738. },
  739. // 判断两个时间段是否重叠
  740. timeOverlap(idx, dateAr) {
  741. let zhi = 0
  742. for (let k in dateAr) {
  743. if (idx !== k) {
  744. if (((dateAr[k].s <= dateAr[idx].s && dateAr[k].e >= dateAr[idx].s) || (dateAr[k].s <= dateAr[idx].s && dateAr[k].e <= dateAr[idx].e))) {
  745. // 选择的时间包含设置的休息时间段 (选择的开始时间和结束时间大于设置的休息时间段)
  746. if (dateAr[idx].s > dateAr[k].s && dateAr[idx].e < dateAr[k].e) {
  747. // zhi += 2
  748. zhi += +this.getHour(dateAr[idx].s, dateAr[idx].e)
  749. }
  750. // 选择的时间包含在设置的休息时间 (选择的开始时间和结束时间都处于在设置的休息时间段内)
  751. if (dateAr[idx].s > dateAr[k].s && dateAr[idx].e > dateAr[k].e) {
  752. zhi += +this.getHour(dateAr[idx].s, dateAr[k].e)
  753. } else if (dateAr[idx].s < dateAr[k].s && dateAr[idx].e > dateAr[k].e) {
  754. zhi += +this.getHour(dateAr[k].e, dateAr[idx].s)
  755. } else {
  756. // 选择的结束时间处于设置的休息时间段内 (选择的结束时间处于的休息时间段)
  757. if (dateAr[k].e < dateAr[idx].e && dateAr[k].e > dateAr[idx].s) {
  758. zhi += +this.getHour(dateAr[k].e, dateAr[idx].e)
  759. }
  760. // 选择的开始时间处于设置的休息时间段内 (选择的开始时间处于的休息时间段)
  761. if (dateAr[idx].s > dateAr[k].s && dateAr[idx].s < dateAr[k].e) {
  762. zhi += +this.getHour(dateAr[k].e, dateAr[idx].s)
  763. }
  764. }
  765. }
  766. }
  767. }
  768. return zhi
  769. },
  770. getHour(s1, s2) {
  771. var reDate = /\d{4}-\d{1,2}-\d{1,2} /;
  772. s1 = new Date((reDate.test(s1) ? s1 : '2018-1-1 ' + s1).replace(/-/g, '/'));
  773. s2 = new Date((reDate.test(s2) ? s2 : '2018-1-1 ' + s2).replace(/-/g, '/'));
  774. var ms = s2.getTime() - s1.getTime();
  775. if (ms < 0) return 0;
  776. let ma = ms / 1000 / 60 / 60
  777. return ma; //小时
  778. },
  779. cardtimeRefresh(workdate) { // 考勤记录刷新
  780. if (!workdate) return;
  781. this.cardRefLoading = true;
  782. this.$axios.post('/user-corpwx-time/getPunchRecordBySelf', {
  783. date: workdate
  784. })
  785. .then(res => {
  786. if (res.code == 'ok') {
  787. this.cardRefLoading = false;
  788. this.report.time = res.data.time;
  789. } else {
  790. this.cardRefLoading = false;
  791. this.$toast.fail('获取失败:' + res.msg);
  792. }
  793. }).catch(err => { this.$toast.clear(); this.cardRefLoading = false; })
  794. },
  795. auditorClick(domainIndex, auditorIndex) {
  796. if (this.canEdit) {
  797. this.auditor.index = domainIndex
  798. this.auditor.auditorIndex = auditorIndex
  799. this.auditor.searchList.forEach(u => {
  800. if (this.form.domains[domainIndex][auditorIndex] && u.id == this.form.domains[domainIndex][auditorIndex].id) {
  801. this.auditor.item = u
  802. }
  803. })
  804. this.auditorShow = true
  805. }
  806. },
  807. onSearch(val) {
  808. console.log(val);
  809. this.auditor.searchList = [];
  810. this.auditor.list.forEach(u => {
  811. if (u.name.startsWith(val)) {
  812. this.auditor.searchList.push(u);
  813. }
  814. })
  815. },
  816. searchAuditor() {
  817. if(!this.substitute) {
  818. this.form.domains[this.auditor.index][this.auditor.auditorIndex] = this.auditor.item
  819. }
  820. if(this.substitute) {
  821. const { id, name } = this.auditor.item
  822. this.fillingAgent = { id, name }
  823. }
  824. this.auditorShow = false
  825. console.log('searchAuditor');
  826. },
  827. getAllUsersList() {
  828. this.$axios.post('/user/getSimpleActiveUserList', {})
  829. .then(res => {
  830. if (res.code == 'ok') {
  831. this.auditor.list = res.data
  832. this.auditor.searchList = res.data
  833. } else {
  834. this.$toast.fail('获取失败:' + res.msg);
  835. }
  836. }).catch(err => { this.$toast.clear(); })
  837. },
  838. requiredRule(val) {
  839. console.log('requiredRule', val);
  840. return false
  841. },
  842. // 获取预算来源
  843. getReportBasecostList() {
  844. this.$axios.post('/project-basecost-setting/getReportBasecostList', {
  845. companyId: this.user.companyId
  846. }).then(res => {
  847. if (res.code == 'ok') {
  848. this.reportBasecostList = res.data
  849. } else {
  850. this.$toast.fail('获取失败:' + res.msg);
  851. }
  852. }).catch(err => { this.$toast.clear(); })
  853. },
  854. //获取项目审核人
  855. getProjectAuditorList(domainItem) {
  856. this.$axios.post("/project-auditor/getList", { projectId: domainItem.projectId })
  857. .then(res => {
  858. if (res.code == "ok") {
  859. domainItem.auditUserList = res.data;
  860. if (res.data.length == 1) {
  861. domainItem.projectAuditorId = domainItem.auditUserList[0].auditorId;
  862. domainItem.projectAuditorName = domainItem.auditUserList[0].auditorName;
  863. }
  864. this.$forceUpdate();
  865. } else {
  866. this.$toast.fail('获取失败:' + res.msg);
  867. }
  868. }).catch(err => { this.$toast.clear(); });
  869. },
  870. updateTxt() {
  871. this.$forceUpdate();
  872. },
  873. // 获取项目
  874. getPeoject() {
  875. this.$axios.post("/project/getProjectList", { forReport: 1 })
  876. .then(res => {
  877. if (res.code == "ok") {
  878. for (var i in res.data) {
  879. if (res.data[i].projectCode == 'null' || res.data[i].projectCode == null) {
  880. res.data[i].projectCode = ' '
  881. }
  882. }
  883. this.projectss = res.data;
  884. this.project = res.data;
  885. this.projectss = this.projectss.filter(p => p.status == 1 || p.status == 4);
  886. this.proads = res.data
  887. this.getRecentlyProject()
  888. } else {
  889. this.$toast.fail('获取失败:' + res.msg);
  890. }
  891. }).catch(err => { this.$toast.clear(); });
  892. },
  893. sea() {
  894. // console.log(this.userName.length)
  895. if (this.userName.length > 0) {
  896. // let text = this.userName
  897. // let reg = new RegExp(text)
  898. // let data = this.proads.filter(item => reg.test(item.projectName)) //返回
  899. // let datas = this.proads.filter(item => reg.test(item.projectCode))
  900. // let dataTree = data.concat(datas)
  901. // let arrList = Array.from(new Set(dataTree))
  902. // this.projectss = arrList
  903. // console.log(this.userName.toUpperCase())
  904. let data = this.proads.filter(item => { return item.projectName.indexOf(this.userName.toUpperCase()) != '-1' });
  905. let dataList = this.proads.filter(item => { return item.projectCode.indexOf(this.userName.toUpperCase()) != '-1' });
  906. let dataTree = data.concat(dataList)
  907. let arrList = Array.from(new Set(dataTree))
  908. this.projectss = arrList
  909. } else {
  910. // console.log(456)
  911. this.projectss = this.proads
  912. }
  913. },
  914. selectDegreeId(domain, index, domainItem, list) {
  915. this.$axios.post("/report/defaultDegree", {
  916. projectId: domain.id
  917. })
  918. .then(res => {
  919. if (res.code == "ok") {
  920. var arr = domainItem.wuduList
  921. for (var i in arr) {
  922. if (arr[i].id == res.data.id) {
  923. domainItem.weiduName = arr[i].name
  924. domainItem.degreeId = res.data.id
  925. }
  926. }
  927. this.$forceUpdate();
  928. } else {
  929. this.$toast.fail('获取失败:' + res.msg);
  930. }
  931. }).catch(err => { this.$toast.clear(); });
  932. },
  933. fZr(item, index) {
  934. var domainItem = this.form.domains[this.clickIndex];
  935. domainItem.projectId = item.id;
  936. domainItem.projectName = item.projectName;
  937. //清空子项目
  938. domainItem.subProjectId = null;
  939. domainItem.subProjectName = null;
  940. //清空任务
  941. domainItem.taskId = null;
  942. domainItem.taskName = null;
  943. //清空分组和阶段
  944. domainItem.stage = null;
  945. domainItem.groupId = null;
  946. domainItem.weiduName = null;
  947. this.showPickerUserddp = false;
  948. //获取子项目
  949. if (this.user.timeType.mainProjectState != 1) {
  950. this.getSubprojectList(this.form.domains[this.clickIndex]);
  951. }
  952. //加载项目相关的工程进度
  953. if (this.user.company.packageEngineering == 1) {
  954. this.getProjectProfessions(this.form.domains[this.clickIndex], index);
  955. }
  956. //获取任务分组
  957. this.getTaskGroups(this.form.domains[this.clickIndex], this.clickIndex);
  958. // 获取1相关维度
  959. this.getTaskList(domainItem)
  960. this.dimension(domainItem.projectId)
  961. //获取相关日报提交选择人
  962. domainItem.projectAuditorId = null;
  963. domainItem.projectAuditorName = null;
  964. domainItem.auditUserList = null;
  965. //获取项目审核人
  966. // console.log(domainItem.projectId,this.project);
  967. var curProject = this.project.filter(p => p.id == domainItem.projectId)[0];
  968. if (curProject && (this.user.timeType.reportAuditType == 0 || this.user.timeType.reportAuditType == 4)) {
  969. this.getProjectAuditorList(domainItem, index);
  970. }
  971. console.log(item, '数据')
  972. if (this.user.timeType.customDegreeActive == 1 && item) {
  973. var that = this
  974. setTimeout(() => {
  975. that.selectDegreeId(item, index, that.form.domains[that.clickIndex])
  976. }, 500)
  977. }
  978. //加载昱众的工作职责
  979. if (this.user.companyId == this.yuzhongCompId) {
  980. this.updateResponse(domainItem);
  981. }
  982. },
  983. //获取项目下的任务分组
  984. getTaskGroups(domainItem, index) {
  985. domainItem.groupId = null;
  986. domainItem.groupName = null;
  987. this.$axios.post("/task-group/listMyJoinGroup", { projectId: domainItem.projectId })
  988. .then(res => {
  989. if (res.code == "ok") {
  990. domainItem.taskGroups = res.data;
  991. }
  992. this.$forceUpdate();
  993. }).catch(err => { this.$toast.clear(); });
  994. },
  995. getSubprojectList(domainItem) {
  996. domainItem.subProjectList = [];
  997. this.$axios.post("/sub-project/list", { projectId: domainItem.projectId })
  998. .then(res => {
  999. if (res.code == "ok") {
  1000. domainItem.subProjectList = res.data;
  1001. }
  1002. this.$forceUpdate();
  1003. }).catch(err => { this.$toast.clear(); });
  1004. },
  1005. showEndDialog(timeItem) {
  1006. this.curWorktime = timeItem;
  1007. this.showWorkEndTime = true;
  1008. },
  1009. showStartDialog(timeItem) {
  1010. this.curWorktime = timeItem;
  1011. this.showWorkStartTime = true;
  1012. },
  1013. removeTimeItem(item, index) {
  1014. item.worktimeList.splice(index, 1);
  1015. },
  1016. isIOS() {
  1017. var u = navigator.userAgent;
  1018. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
  1019. return isiOS;
  1020. },
  1021. showLargeImg(item, index) {
  1022. this.imgShow = true;
  1023. this.tmpPics = item;
  1024. },
  1025. //拍照上传
  1026. takePhoto(index) {
  1027. var that = this;
  1028. wx.chooseImage({
  1029. count: 9, // 默认9
  1030. sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
  1031. sourceType: that.user.timeType.choseFromAlbum == 1 ? ['camera', 'album'] : ['camera'], // 可以指定来源是相册还是相机,默认二者都有
  1032. defaultCameraMode: "batch", //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
  1033. isSaveToAlbum: 0, //整型值,0表示拍照时不保存到系统相册,1表示自动保存,默认值是1
  1034. success: function (res) {
  1035. var localIds = res.localIds; // 返回选定照片的本地ID列表,
  1036. // andriod中localId可以作为img标签的src属性显示图片;
  1037. // iOS应当使用 getLocalImgData 获取图片base64数据,从而用于img标签的显示(在img标签内使用 wx.chooseImage 的 localid 显示可能会不成功)
  1038. if (that.form.domains[index].pics == null) {
  1039. that.form.domains[index].pics = [];
  1040. that.form.domains[index].iospics = [];
  1041. }
  1042. if (that.isIOSystem) {
  1043. for (var i = 0; i < localIds.length; i++) {
  1044. wx.getLocalImgData({
  1045. localId: localIds[i], // 图片的localID
  1046. success: function (res) {
  1047. var localData = res.localData; // localData是图片的base64数据,可以用img标签显示
  1048. that.form.domains[index].iospics.push(localData);
  1049. that.$forceUpdate();
  1050. }
  1051. });
  1052. }
  1053. if (that.user.companyId == 7) {
  1054. that.form.domains[index].pics = that.form.domains[index].pics.concat(localIds);
  1055. } else {
  1056. that.form.domains[index].pics = localIds;
  1057. }
  1058. } else {
  1059. if (that.user.companyId == 7) {
  1060. that.form.domains[index].pics = that.form.domains[index].pics.concat(localIds);
  1061. } else {
  1062. that.form.domains[index].pics = localIds;
  1063. }
  1064. that.$forceUpdate();
  1065. }
  1066. // var serverIdList = [];
  1067. if (that.form.domains[index].serverPics == null) {
  1068. that.form.domains[index].serverPics = [];
  1069. }
  1070. //立即就上传到企业微信服务器
  1071. for (var i = 0; i < localIds.length; i++) {
  1072. wx.uploadImage({
  1073. localId: localIds[i], // 需要上传的图片的本地ID,由chooseImage接口获得
  1074. isShowProgressTips: 1, // 默认为1,显示进度提示
  1075. success: function (res) {
  1076. var serverId = res.serverId; // 返回图片的服务器端ID
  1077. // serverIdList.push(serverId);
  1078. that.form.domains[index].serverPics.push(serverId);
  1079. }
  1080. });
  1081. }
  1082. }
  1083. });
  1084. },
  1085. copyProject(index) {
  1086. var leftProgress = 10;
  1087. if (this.reportTimeType.type == 3) {
  1088. //计算已经待分配工时比例
  1089. let array = this.form.domains;
  1090. let totalProgress = 0;
  1091. for (var i = 0; i < array.length; i++) {
  1092. totalProgress += array[i].progress;
  1093. }
  1094. if (totalProgress < 100) {
  1095. leftProgress = 100 - totalProgress;
  1096. }
  1097. }
  1098. var newIndex = index + 1;
  1099. var pName = "";
  1100. if (this.form.domains[index].projectId != '') {
  1101. pName = this.project.filter(p => p.id == this.form.domains[index].projectId)[0].projectName;
  1102. }
  1103. var itemDomain = {
  1104. id: null,
  1105. projectId: this.form.domains[index].projectId,
  1106. projectName: pName,
  1107. workingTime: this.reportTimeType.type == 3 ? (leftProgress * this.reportTimeType.allday / 100).toFixed(1) : "",
  1108. progress: leftProgress,
  1109. content: "",
  1110. state: 2,
  1111. isOvertime: false,
  1112. };
  1113. this.form.domains.splice(newIndex, 0, itemDomain);
  1114. },
  1115. //删除日报
  1116. deleteReport() {
  1117. this.$dialog.confirm({
  1118. title: '删除日报',
  1119. message: '确定要删除当天日报吗?'
  1120. }).then(() => {
  1121. const toast = this.$toast.loading({
  1122. forbidClick: true,
  1123. duration: 0
  1124. });
  1125. this.$axios.post("/report/delete", { userId: this.user.id, date: this.form.createDate })
  1126. .then(res => {
  1127. if (res.code == "ok") {
  1128. this.$toast.clear();
  1129. this.$toast.success('删除成功');
  1130. window.location.reload();
  1131. } else {
  1132. this.$toast.clear();
  1133. this.$toast.fail('删除失败');
  1134. }
  1135. }).catch(err => { this.$toast.clear(); });
  1136. }).catch(() => { });
  1137. },
  1138. changeAllTime() {
  1139. //总时长发生改变,自动按比例计算
  1140. this.form.domains.forEach(d => {
  1141. d.workingTime = (d.progress * this.reportTimeType.allday / 100).toFixed(1);
  1142. });
  1143. },
  1144. cancel() {
  1145. const toast = this.$toast.loading({
  1146. forbidClick: true,
  1147. duration: 0
  1148. });
  1149. var ids = '';
  1150. var data = this.form.domains;
  1151. data.forEach(element => {
  1152. if (element.id != null && element.id != '') {
  1153. if (element.id) {
  1154. ids += (element.id + ',');
  1155. }
  1156. }
  1157. });
  1158. this.$axios.post("/report/cancel", { userId: this.user.id, reportIds: ids })
  1159. .then(res => {
  1160. if (res.code == "ok") {
  1161. this.$toast.clear();
  1162. this.$toast.success('撤销成功');
  1163. this.getReport();
  1164. } else {
  1165. this.$toast.clear();
  1166. this.$toast.fail('获取失败');
  1167. }
  1168. }).catch(err => { this.$toast.clear(); });
  1169. },
  1170. confirmWorkTime(field) {
  1171. if (field == 0) {
  1172. this.curWorktime.startTime = this.startTime;
  1173. this.showWorkStartTime = false;
  1174. } else {
  1175. this.curWorktime.endTime = this.endTime;
  1176. this.showWorkEndTime = false;
  1177. }
  1178. this.setTotalReportHours()
  1179. },
  1180. confirmTime(item, field, index) {
  1181. if (field == 0) {
  1182. console.log(this.dailyIndex)
  1183. // item.startTime = this.startTime;
  1184. this.form.domains[this.dailyIndex].startTime = this.startTime;
  1185. this.showStartTime = false;
  1186. } else {
  1187. this.form.domains[this.dailyIndex].endTime = this.endTime;
  1188. // item.endTime = this.endTime;
  1189. this.showEndTime = false;
  1190. }
  1191. console.log(this.form.domains)
  1192. this.setTotalReportHours()
  1193. },
  1194. setTotalReportHours() {
  1195. let domains = this.form.domains
  1196. let hours = 0
  1197. let arrNum = [] // 用于时间段计算加班时间
  1198. let timeArr = []
  1199. for (let i in domains) {
  1200. if (this.reportTimeType.multiWorktime == 1) {
  1201. for (let m in domains[i].worktimeList) {
  1202. if (domains[i].worktimeList[m].startTime && domains[i].worktimeList[m].endTime) {
  1203. // hours += this.getHour(domains[i].worktimeList[m].startTime, domains[i].worktimeList[m].endTime)
  1204. timeArr.push({ startTime: domains[i].worktimeList[m].startTime, endTime: domains[i].worktimeList[m].endTime })
  1205. }
  1206. }
  1207. } else {
  1208. if (this.user.timeType.type == 2) {
  1209. if (domains[i].startTime && domains[i].endTime) {
  1210. // let selectionTime = this.getHour(domains[i].startTime, domains[i].endTime)
  1211. // let subtractedData = 0
  1212. // let arr = JSON.parse(JSON.stringify(this.vacationTime))
  1213. // arr.unshift({s: domains[i].startTime, e: domains[i].endTime})
  1214. // for(var j in arr) {
  1215. // subtractedData += +this.timeOverlap(j, arr)
  1216. // }
  1217. // console.log(selectionTime, subtractedData)
  1218. // hours += +selectionTime - +subtractedData
  1219. // console.log(hours)
  1220. // arrNum.push(+selectionTime - +subtractedData)
  1221. timeArr.push({ startTime: domains[i].startTime, endTime: domains[i].endTime })
  1222. }
  1223. } else {
  1224. hours += domains[i].workingTime ? parseFloat(domains[i].workingTime) : 0
  1225. }
  1226. }
  1227. }
  1228. // this.totalReportHours = hours.toFixed(2)
  1229. console.log('timeArr', timeArr)
  1230. if (this.reportTimeType.multiWorktime == 1 || this.user.timeType.type == 2) {
  1231. const { timeCanOverlap } = this.reportTimeType // timeCanOverlap 为零时校验不允许重叠
  1232. if(timeCanOverlap == 0) {
  1233. this.getTimeHours(timeArr)
  1234. } else {
  1235. const newTimeArr = this.mergeTimeIntervals(timeArr)
  1236. this.getTimeHours(newTimeArr)
  1237. }
  1238. } else {
  1239. this.totalReportHours = hours.toFixed(2)
  1240. }
  1241. },
  1242. // 处理重叠时间段
  1243. mergeTimeIntervals(timeIntervals) {
  1244. // 按照开始时间排序
  1245. timeIntervals.sort((a, b) => a.startTime.localeCompare(b.startTime));
  1246. const mergedIntervals = [];
  1247. for (const interval of timeIntervals) {
  1248. if (
  1249. mergedIntervals.length === 0 ||
  1250. interval.startTime > mergedIntervals[mergedIntervals.length - 1].endTime
  1251. ) {
  1252. // 当前时间段与存储数组中的时间段没有重叠,直接加入存储数组
  1253. mergedIntervals.push(interval);
  1254. } else if (interval.endTime > mergedIntervals[mergedIntervals.length - 1].endTime) {
  1255. // 当前时间段与存储数组中的时间段有重叠,但是未完全包含,需要合并时间段
  1256. mergedIntervals[mergedIntervals.length - 1].endTime = interval.endTime;
  1257. }
  1258. }
  1259. return mergedIntervals;
  1260. },
  1261. getTimeHours(arr) {
  1262. this.$axios.post("/report/getHoursByTimeRange", { timeJsonStr: JSON.stringify(arr) })
  1263. .then(res => {
  1264. if (res.code == "ok") {
  1265. this.totalReportHours = res.data
  1266. } else {
  1267. this.$toast.clear();
  1268. this.$toast.fail(res.msg);
  1269. }
  1270. }).catch(err => { this.$toast.clear(); });
  1271. },
  1272. filter(type, options) {
  1273. if (type === 'minute') {
  1274. return options.filter(option => option % 30 === 0);
  1275. }
  1276. return options;
  1277. },
  1278. choseTimePick(value, index) {
  1279. if (!value) {
  1280. return
  1281. }
  1282. //选中时间
  1283. if (this.reportTimeType.type == 0) {
  1284. this.form.domains[this.clickTimeIndex].timeType = value.value;
  1285. this.form.domains[this.clickTimeIndex].workingTime = value.hours;
  1286. this.form.domains[this.clickTimeIndex].label = value.label;
  1287. this.showPickerTime = false;
  1288. } else if (this.reportTimeType.type == 1) {
  1289. // console.log('this.reportTimeType.type=='+value,this.form.domains);
  1290. this.form.domains[this.clickTimeIndex].workingTime = value;
  1291. this.form.domains[this.clickTimeIndex].label = value.toFixed(1) + '小时';
  1292. this.showPickerHours = false;
  1293. let allhour = 0
  1294. for (let i in this.form.domains) {
  1295. if (this.isWeekend) {
  1296. this.form.domains[i].isOvertime = true
  1297. this.form.domains[i].overtimeHours = this.form.domains[i].workingTime
  1298. } else {
  1299. this.form.domains[i].isOvertime = false
  1300. delete this.form.domains[i].overtimeHours
  1301. }
  1302. allhour += this.form.domains[i].workingTime * 1
  1303. }
  1304. if (allhour > this.user.timeType.allday && !this.isWeekend) {
  1305. this.form.domains[this.clickTimeIndex].isOvertime = true
  1306. this.form.domains[this.clickTimeIndex].overtimeHours = allhour - this.user.timeType.allday
  1307. }
  1308. }
  1309. this.setTotalReportHours()
  1310. },
  1311. clickTimePicker(i, item) {
  1312. if (!item.canEdit) {
  1313. return;
  1314. }
  1315. this.clickTimeIndex = i;
  1316. if (this.reportTimeType.type == 0) {
  1317. this.showPickerTime = true;
  1318. } else if (this.reportTimeType.type == 1) {
  1319. this.showPickerHours = true;
  1320. }
  1321. },
  1322. getTimeType() {
  1323. this.$axios.post('/time-type/getCompanyTimeSetting', { companyId: this.user.companyId })
  1324. .then(res => {
  1325. if (res.code == "ok") {
  1326. var t = res.data;
  1327. this.reportTimeType = t;
  1328. //转化时间格式
  1329. if (t.allday != null) {
  1330. this.timeType.push({ value: 0, label: '全天 - ' + t.allday + '小时', hours: t.allday });
  1331. }
  1332. if (t.am != null) {
  1333. this.timeType.push({ value: 1, label: '上午 - ' + t.am + '小时', hours: t.am });
  1334. }
  1335. if (t.pm != null) {
  1336. this.timeType.push({ value: 2, label: '下午 - ' + t.pm + '小时', hours: t.pm });
  1337. }
  1338. let arr = []
  1339. for (var i in res.data.excludeTimeList) {
  1340. let obj = {
  1341. s: res.data.excludeTimeList[i].startTime,
  1342. e: res.data.excludeTimeList[i].endTime,
  1343. }
  1344. arr.push(obj)
  1345. }
  1346. this.vacationTime = arr
  1347. } else {
  1348. this.$toast.clear();
  1349. this.$toast.fail(res.msg);
  1350. }
  1351. }).catch(err => { this.$toast.clear(); });
  1352. },
  1353. // 返回
  1354. back() {
  1355. history.back();
  1356. },
  1357. // 时间转换
  1358. format(date, pattern) {
  1359. pattern = pattern || "yyyy-MM-dd";
  1360. var _this = this;
  1361. return pattern.replace(/([yMdhsm])(\1*)/g, function ($0) {
  1362. switch ($0.charAt(0)) {
  1363. case 'y': return _this.padding(date.getFullYear(), $0.length);
  1364. case 'M': return _this.padding(date.getMonth() + 1, $0.length);
  1365. case 'd': return _this.padding(date.getDate(), $0.length);
  1366. case 'w': return date.getDay() + 1;
  1367. case 'h': return _this.padding(date.getHours(), $0.length);
  1368. case 'm': return _this.padding(date.getMinutes(), $0.length);
  1369. case 's': return _this.padding(date.getSeconds(), $0.length);
  1370. }
  1371. });
  1372. },
  1373. padding(s, len) {
  1374. var len = len - (s + '').length;
  1375. for (var i = 0; i < len; i++) { s = '0' + s; }
  1376. return s;
  1377. },
  1378. // 获取项目
  1379. getProject() {
  1380. const toast = this.$toast.loading({
  1381. forbidClick: true,
  1382. duration: 0
  1383. });
  1384. this.$axios.post("/project/getProjectList", {})
  1385. .then(res => {
  1386. if (res.code == "ok") {
  1387. this.$toast.clear();
  1388. // if (this.project.length > 0) {
  1389. // console.log('this.project[0].id=='+this.project[0].id);
  1390. // this.getTaskList(this.project[0].id);
  1391. // }
  1392. } else {
  1393. this.$toast.clear();
  1394. this.$toast.fail('获取失败:' + res.msg);
  1395. }
  1396. }).catch(err => { this.$toast.clear(); });
  1397. },
  1398. // 获取日报
  1399. getReport() {
  1400. this.isWeekend = false
  1401. let weekday = new Date(this.form.createDate).getDay()
  1402. if (this.user.companyId == 817) {
  1403. if (weekday == 0) {
  1404. this.isWeekend = true
  1405. }
  1406. } else {
  1407. if (weekday == 0 || weekday == 6) {
  1408. this.isWeekend = true
  1409. }
  1410. }
  1411. const toast = this.$toast.loading({
  1412. forbidClick: true,
  1413. duration: 0
  1414. });
  1415. this.$axios.post("/report/getReport", { date: this.form.createDate })
  1416. .then(res => {
  1417. if (res.code == "ok") {
  1418. this.$toast.clear();
  1419. this.report = res.data;
  1420. var t = res.data.timeType;
  1421. var timeType = [];
  1422. //转化时间格式
  1423. if (t.allday != null) {
  1424. timeType.push({ value: 0, label: '全天 - ' + t.allday + '小时', hours: t.allday });
  1425. }
  1426. if (t.am != null) {
  1427. timeType.push({ value: 1, label: '上午 - ' + t.am + '小时', hours: t.am });
  1428. }
  1429. if (t.pm != null) {
  1430. timeType.push({ value: 2, label: '下午 - ' + t.pm + '小时', hours: t.pm });
  1431. }
  1432. var list = res.data.report;
  1433. this.canCancelInDialog = false
  1434. if (list.length != 0 && !this.substitute) {
  1435. this.canEdit = false;
  1436. this.canCancel = false;
  1437. this.canDeleteReport = true
  1438. let array = [];
  1439. for (var i in list) {
  1440. var projectName = list[i].projectName;
  1441. var flg = (list[i].isOvertime == 1);
  1442. for (var j in this.project) {
  1443. if (this.project[j].id == list[i].projectId) {
  1444. projectName = this.project[j].projectName;
  1445. }
  1446. }
  1447. let tname = '';
  1448. if (list[i].taskId != null && list[i].taskList.length > 0) {
  1449. let filterList = list[i].taskList.filter(t => t.taskId == list[i].taskId);
  1450. if (filterList.length > 0) {
  1451. tname = filterList[0].taskName;
  1452. }
  1453. }
  1454. let mmm = !t.customDegreeMultiple ? list[i].degreeId : (list[i].multiDegrIdList || [])
  1455. let sss = list[i].degreeList || []
  1456. let radioPickDegree = ''
  1457. let wuduName = ''
  1458. if(!t.customDegreeMultiple) {
  1459. for (var s in sss) {
  1460. if (sss[s].id == mmm) {
  1461. wuduName = sss[s].name
  1462. }
  1463. }
  1464. radioPickDegree = sss.filter(s => s.id == mmm)[0]
  1465. } else {
  1466. let arr = sss.filter(s => mmm.includes(s.id)).map(s => s.name);
  1467. radioPickDegree = sss.filter(s => mmm.includes(s.id))
  1468. wuduName = arr.join(',')
  1469. }
  1470. let serverPicArray = [];
  1471. // console.log('picArray=='+list[i].picStr);
  1472. if (list[i].picStr != null && list[i].picStr != '@') {
  1473. serverPicArray = JSON.parse(list[i].picStr.replace(/@/g, ","));
  1474. }
  1475. var subProjectName = null;
  1476. if (list[i].subProjectId) {
  1477. subProjectName = list[i].subProjectList.filter(s => s.id == list[i].subProjectId)[0].name;
  1478. }
  1479. let basecostName = ''
  1480. if (res.data.timeBasecostList && res.data.timeBasecostList.length > 0) {
  1481. for (let m in res.data.timeBasecostList) {
  1482. if (res.data.timeBasecostList[m].id == list[i].basecostId) {
  1483. basecostName = res.data.timeBasecostList[m].name
  1484. }
  1485. }
  1486. }
  1487. var targetP = this.project.filter(p => p.id == list[i].projectId);
  1488. var filteredRespList = [];
  1489. if (targetP.length > 0 && list[i].extraField1) {
  1490. list[i].extraField1Name = this.roleList.find(r => r.value == list[i].extraField1).label;
  1491. var isPublic = targetP[0].isPublic;
  1492. filteredRespList = this.jobResponseList.filter(j => j.timeType == (isPublic ? '非项目工时' : '项目工时') && j.role == this.roleList.filter(r => r.value == list[i].extraField1)[0].label);
  1493. if (list[i].extraField2) {
  1494. list[i].extraField2Name = filteredRespList.find(f => f.id == list[i].extraField2).jobRespon;
  1495. }
  1496. if (list[i].extraField3) {
  1497. list[i].extraField3Name = list[i].workContentList.find(w => w.id == list[i].extraField3).workContext;
  1498. }
  1499. }
  1500. array.push({
  1501. id: list[i].id,
  1502. projectId: list[i].projectId,
  1503. projectName: projectName,
  1504. workingTime: String(list[i].workingTime),
  1505. content: list[i].content,
  1506. state: list[i].state,
  1507. timeType: list[i].timeType,
  1508. label: timeType[list[i].timeType].label,
  1509. startTime: list[i].startTime,
  1510. endTime: list[i].endTime,
  1511. isOvertime: flg,
  1512. progress: list[i].progress,
  1513. taskList: list[i].taskList,
  1514. taskId: list[i].taskId ? list[i].taskId : null,
  1515. taskName: tname,
  1516. professionProgress: list[i].professionProgressList,
  1517. pics: list[i].pics,
  1518. iospics: list[i].pics,
  1519. serverPics: serverPicArray,
  1520. multiWorktime: t.multiWorktime,
  1521. worktimeList: list[i].worktimeList,
  1522. wuduList: list[i].degreeList,
  1523. weiduName: wuduName,
  1524. degreeId: !t.customDegreeMultiple ? list[i].degreeId : list[i].multiDegrIdList,
  1525. radioPickDegree: radioPickDegree,
  1526. subProjectId: list[i].subProjectId,
  1527. subProjectName: subProjectName,
  1528. subProjectList: list[i].subProjectList,
  1529. groupId: list[i].groupId == 0 ? null : list[i].groupId,
  1530. groupName: list[i].groupName,
  1531. taskGroups: list[i].taskGroups,
  1532. stages: list[i].stages,
  1533. stage: list[i].stage == '-' ? null : list[i].stage,
  1534. customData: list[i].customData,
  1535. projectAuditorId: list[i].projectAuditorId,
  1536. projectAuditorName: list[i].projectAuditorName,
  1537. auditUserList: list[i].auditUserList,
  1538. overtimeHours: list[i].overtimeHours,
  1539. customText: list[i].customText,
  1540. basecostId: list[i].basecostId,
  1541. basecostName: basecostName,
  1542. canEdit: list[i].state >= 2 ? true : false,
  1543. auditorFirst: list[i].auditorFirst ? list[i].auditorFirst : { name: '', id: '' },
  1544. auditorSec: list[i].auditorSec ? list[i].auditorSec : { name: '', id: '' },
  1545. auditorThird: list[i].auditorThird ? list[i].auditorThird : { name: '', id: '' },
  1546. ccUserid: list[i].ccUserid ? list[i].ccUserid : { name: '', id: '' },
  1547. extraField1: list[i].extraField1,
  1548. extraField1Name: list[i].extraField1Name,
  1549. extraField2: list[i].extraField2,
  1550. extraField2Name: list[i].extraField2Name,
  1551. extraField3: list[i].extraField3,
  1552. extraField3Name: list[i].extraField3Name,
  1553. workContentList: list[i].workContentList,
  1554. filteredRespList: filteredRespList,
  1555. sapServiceId: list[i].sapServiceId,
  1556. sapServiceName: list[i].sapServiceName,
  1557. serviceList: list[i].serviceList,
  1558. })
  1559. if (list[i].state >= 2) {
  1560. this.canEdit = true;
  1561. } else {
  1562. this.canDeleteReport = false
  1563. }
  1564. if (list[i].state == 0) {
  1565. this.canCancel = true;
  1566. this.canCancelInDialog = true
  1567. }
  1568. }
  1569. this.form.domains = array;
  1570. // console.log('执行One')
  1571. this.setTotalReportHours()
  1572. } else {
  1573. // console.log('执行TWO')
  1574. this.totalReportHours = 0
  1575. this.canCancel = false;
  1576. this.canEdit = true;
  1577. var shuzhi = this.user.timeType.allday + ''
  1578. //没有填报的可以点击提交
  1579. this.form.domains = [{
  1580. id: null,
  1581. projectId: "",
  1582. projectName: "",
  1583. // workingTime: t.type==3?(t.allday).toFixed(1):"8.0",
  1584. workingTime: t.type == 3 ? (t.allday).toFixed(1) : shuzhi.indexOf('.') == '-1' ? shuzhi + '.0' : shuzhi,
  1585. content: "",
  1586. state: 2,
  1587. progress: 100,
  1588. isOvertime: false,
  1589. professionProgress: [],
  1590. multiWorktime: t.multiWorktime,
  1591. worktimeList: [{}],
  1592. canEdit: true,
  1593. auditorFirst: { name: '', id: '' },
  1594. auditorSec: { name: '', id: '' },
  1595. auditorThird: { name: '', id: '' },
  1596. ccUserid: { name: '', id: '' }
  1597. }]
  1598. if (this.isWeekend && this.user.timeType.lockWorktime != 1) {
  1599. this.$set(this.form.domains[0], 'isOvertime', true)
  1600. if (t.type != 2 && t.type != 0) {
  1601. this.$set(this.form.domains[0], 'overtimeHours', t.allday.toFixed(0))
  1602. }
  1603. }
  1604. if (this.report.timeBasecostList.length != 0 && this.user.company.packageProject == 1) {
  1605. this.form.domains[0].basecostId = this.report.timeBasecostList[0].id;
  1606. this.form.domains[0].basecostName = this.report.timeBasecostList[0].name;
  1607. }
  1608. this.canEdit = true;
  1609. this.setTotalReportHours()
  1610. }
  1611. } else {
  1612. this.$toast.clear();
  1613. this.$toast.fail('获取失败:' + res.msg);
  1614. }
  1615. if (localStorage.getItem("formVal")) {
  1616. // console.log('触发了')
  1617. var obj = localStorage.getItem("formVal")
  1618. this.form = JSON.parse(obj)
  1619. localStorage.removeItem('formVal')
  1620. }
  1621. }).catch(err => { this.$toast.clear(); });
  1622. },
  1623. // 改变时间
  1624. changeTime(time) {
  1625. this.form.createDate = this.format(new Date(time), "yyyy-MM-dd");
  1626. this.currentDate = time;
  1627. this.showPicker = false;
  1628. this.getReport();
  1629. },
  1630. //点击选择审核人
  1631. clickPickAuditor(i, item) {
  1632. if (!item.canEdit) return;
  1633. if (item.auditUserList.length <= 1) return;
  1634. this.clickIndex = i;
  1635. item.showPickerAuditor = true;
  1636. this.$forceUpdate();
  1637. },
  1638. choseAuditor(value, index) {
  1639. if (value) {
  1640. this.form.domains[this.clickIndex].projectAuditorId = value.auditorId;
  1641. this.form.domains[this.clickIndex].projectAuditorName = value.auditorName;
  1642. }
  1643. this.form.domains[this.clickIndex].showPickerAuditor = false;
  1644. this.$forceUpdate();
  1645. },
  1646. //点击选择角色
  1647. clickPickProjectRole(i, item) {
  1648. if (!item.canEdit) return;
  1649. this.clickIndex = i;
  1650. item.showPickerRole = true;
  1651. this.$forceUpdate();
  1652. },
  1653. //点击选择子项目
  1654. clickPickSubProject(i, item) {
  1655. if (!item.canEdit) return;
  1656. this.clickIndex = i;
  1657. item.showPickerSubProject = true;
  1658. this.$forceUpdate();
  1659. },
  1660. clickPickCostId(i, item) {
  1661. if (!item.canEdit) return;
  1662. this.clickIndex = i;
  1663. item.showPickerCostId = true;
  1664. this.$forceUpdate();
  1665. },
  1666. clickPickTaskGroup(i, item) {
  1667. if (!item.canEdit) return;
  1668. this.clickIndex = i;
  1669. item.showPickerTaskGroup = true;
  1670. this.$forceUpdate();
  1671. },
  1672. clickPickStage(i, item) {
  1673. if (!item.canEdit) return;
  1674. this.clickIndex = i;
  1675. item.showPickerStage = true;
  1676. this.$forceUpdate();
  1677. },
  1678. // 选择项目
  1679. clickPicker(i, item) {
  1680. if (!item.canEdit) return;
  1681. this.clickIndex = i
  1682. this.showPickerUserddp = true
  1683. },
  1684. clickPickers(i, item) {
  1685. // console.log('wudulist',item.wuduList);
  1686. if (!item.canEdit) return;
  1687. this.clickIndex = i;
  1688. // item.showPickDegree = true;
  1689. this.$set(item, 'showPickDegree', true)
  1690. // var proId = this.form.domains[this.clickIndex].projectId
  1691. // this.dimension(proId)
  1692. },
  1693. //选择服务
  1694. clickPickerService(i, item) {
  1695. if (!item.canEdit) return;
  1696. // console.log(i);
  1697. this.clickIndex = i;
  1698. // var proId = this.form.domains[this.clickIndex].projectId
  1699. // this.getTaskList(proId)
  1700. // console.log(this.form.domains[this.clickIndex].taskList);
  1701. this.$toast.clear();
  1702. if (!this.form.domains[this.clickIndex].serviceList || this.form.domains[this.clickIndex].serviceList.length == 0) {
  1703. this.$toast.fail('当前任务暂无服务');
  1704. } else {
  1705. this.form.domains[this.clickIndex].showPickerService = true;
  1706. this.$forceUpdate();
  1707. }
  1708. },
  1709. choseService(value, index) {
  1710. if (value) {
  1711. this.form.domains[this.clickIndex].sapServiceId = value.id;
  1712. this.form.domains[this.clickIndex].sapServiceName = value.serviceName;
  1713. }
  1714. this.form.domains[this.clickIndex].showPickerService = false;
  1715. this.$forceUpdate();
  1716. },
  1717. //选择任务
  1718. clickPickerTask(i, item) {
  1719. if (!item.canEdit) return;
  1720. this.clickIndex = i;
  1721. this.$toast.clear();
  1722. if (!this.form.domains[this.clickIndex].taskList || this.form.domains[this.clickIndex].taskList.length == 0) {
  1723. this.$toast.fail('当前项目暂无可选的任务/里程碑');
  1724. } else {
  1725. this.form.domains[this.clickIndex].showPickerTask = true;
  1726. this.$forceUpdate();
  1727. }
  1728. },
  1729. choseTask(value, index) {
  1730. if (value) {
  1731. this.form.domains[this.clickIndex].taskId = value.taskId;
  1732. this.form.domains[this.clickIndex].taskName = value.taskName;
  1733. }
  1734. this.form.domains[this.clickIndex].showPickerTask = false;
  1735. this.$forceUpdate();
  1736. if (this.user.companyId == 3092) {
  1737. //依斯贝,加载服务
  1738. this.$axios.post("/task/getMyTaskService", { taskId: value.taskId })
  1739. .then(res => {
  1740. if (res.code == "ok") {
  1741. this.$set(this.form.domains[this.clickIndex], 'sapServiceId', null);
  1742. this.$set(this.form.domains[this.clickIndex], 'sapServiceName', null);
  1743. this.$set(this.form.domains[this.clickIndex], 'serviceList', res.data);
  1744. this.$forceUpdate();
  1745. } else {
  1746. this.$toast.fail('获取失败:' + res.msg);
  1747. }
  1748. }).catch(err => { this.$toast.clear(); });
  1749. }
  1750. },
  1751. choseProjects(value, index) {
  1752. const { timeType } = this.user
  1753. console.log(value, timeType)
  1754. if (value) {
  1755. if(!timeType.customDegreeMultiple) { // 单选
  1756. this.form.domains[this.clickIndex].weiduName = value.name;
  1757. this.form.domains[this.clickIndex].degreeId = value.id;
  1758. }
  1759. if(timeType.customDegreeMultiple) { // 多选
  1760. this.form.domains[this.clickIndex].weiduName = value.map(item => item.name).join(',');
  1761. this.form.domains[this.clickIndex].degreeId = value.map(item => item.id).join(',');
  1762. }
  1763. this.$forceUpdate();
  1764. }
  1765. this.form.domains[this.clickIndex].showPickDegree = false;
  1766. },
  1767. choseSubProject(value, index) {
  1768. if (value) {
  1769. this.form.domains[this.clickIndex].subProjectId = value.id;
  1770. this.form.domains[this.clickIndex].subProjectName = value.name;
  1771. }
  1772. this.form.domains[this.clickIndex].showPickerSubProject = false;
  1773. this.$forceUpdate();
  1774. },
  1775. choseTaskGroup(value, index) {
  1776. if (!value) {
  1777. return
  1778. }
  1779. this.form.domains[this.clickIndex].groupId = value.id;
  1780. this.form.domains[this.clickIndex].groupName = value.name;
  1781. this.form.domains[this.clickIndex].showPickerTaskGroup = false;
  1782. var domainItem = this.form.domains[this.clickIndex];
  1783. this.getGroupStages(this.form.domains[this.clickIndex], index);
  1784. //检查当前的项目是否需要获取分组的负责人
  1785. var curProject = this.project.filter(p => p.id == this.form.domains[this.clickIndex].projectId)[0];
  1786. if (curProject && (this.user.timeType.reportAuditType == 1 || this.user.timeType.reportAuditType == 2)) {
  1787. this.$axios.post("/task-group/getGroupIncharger", { groupId: domainItem.groupId })
  1788. .then(res => {
  1789. if (res.code == "ok") {
  1790. domainItem.auditUserList = res.data;
  1791. if (res.data.length == 1) {
  1792. domainItem.projectAuditorId = domainItem.auditUserList[0].auditorId;
  1793. domainItem.projectAuditorName = domainItem.auditUserList[0].auditorName;
  1794. }
  1795. this.$forceUpdate();
  1796. } else {
  1797. this.$toast.fail('获取失败:' + res.msg);
  1798. }
  1799. }).catch(err => { this.$toast.clear(); });
  1800. }
  1801. },
  1802. choseStage(value, index) {
  1803. if (value) {
  1804. this.form.domains[this.clickIndex].stage = value.stagesName;
  1805. }
  1806. this.form.domains[this.clickIndex].showPickerStage = false;
  1807. this.getTaskList(this.form.domains[this.clickIndex]);
  1808. this.$forceUpdate();
  1809. },
  1810. choseCostId(value, index) {
  1811. if (value) {
  1812. this.form.domains[this.clickIndex].basecostId = value.id;
  1813. this.form.domains[this.clickIndex].basecostName = value.name;
  1814. }
  1815. this.form.domains[this.clickIndex].showPickerCostId = false;
  1816. this.$forceUpdate();
  1817. },
  1818. getGroupStages(domain, index) {
  1819. this.$axios.post("/stages/getProjectStagesByGroup", { groupId: domain.groupId })
  1820. .then(res => {
  1821. if (res.code == "ok") {
  1822. domain.stage = '';
  1823. domain.stages = res.data;
  1824. this.getTaskList(domain);
  1825. this.$forceUpdate();
  1826. } else {
  1827. this.$toast.fail('获取失败');
  1828. }
  1829. }).catch(err => { this.$toast.clear(); });
  1830. },
  1831. getProjectProfessions(domain, index) {
  1832. // console.log(domain, '数据')
  1833. this.$axios.post("/project-profession/getMyProfession", { projectId: domain.projectId })
  1834. .then(res => {
  1835. if (res.code == "ok") {
  1836. this.form.domains[this.clickIndex].professionProgress = res.data;
  1837. // console.log(this.form.domains)
  1838. this.$forceUpdate();
  1839. } else {
  1840. this.$toast.fail('获取失败');
  1841. }
  1842. }).catch(err => { this.$toast.clear(); });
  1843. },
  1844. // 获取维度
  1845. dimension(projectId) {
  1846. this.$axios.post("/project/getDegreeList", { projectId: projectId })
  1847. .then(res => {
  1848. if (res.code == "ok") {
  1849. this.form.domains[this.clickIndex].wuduList = res.data;
  1850. this.$forceUpdate();
  1851. } else {
  1852. this.$toast.fail('获取失败');
  1853. }
  1854. }).catch(err => { this.$toast.clear(); });
  1855. },
  1856. getTaskList(domainItem) {
  1857. //如果是专业版,需要列出任务列表
  1858. if (this.user.company.packageProject == 1) {
  1859. //清空选中的任务
  1860. this.$set(domainItem, 'taskId', null);
  1861. this.$set(domainItem, 'taskName', null);
  1862. this.$set(domainItem, 'sapServiceId', null);
  1863. this.$set(domainItem, 'sapServiceName', null);
  1864. this.$set(domainItem, 'serviceList', null);
  1865. var param = { projectId: domainItem.projectId }
  1866. if (domainItem.groupId) {
  1867. param.groupId = domainItem.groupId;
  1868. }
  1869. if (domainItem.stage) {
  1870. param.stage = domainItem.stage;
  1871. }
  1872. this.$axios.post("/task/getRecentTask", param)
  1873. .then(res => {
  1874. if (res.code == "ok") {
  1875. this.form.domains[this.clickIndex].allTaskList = res.data;
  1876. this.form.domains[this.clickIndex].taskList = res.data;
  1877. this.form = this.form;
  1878. } else {
  1879. this.$toast.fail('获取失败');
  1880. }
  1881. }).catch(err => { this.$toast.clear(); });
  1882. }
  1883. },
  1884. //添加工时
  1885. addNewWorktime(index, item) {
  1886. item.worktimeList.push({});
  1887. },
  1888. // 添加项目
  1889. addNewPro() {
  1890. var leftProgress = 10;
  1891. if (this.reportTimeType.type == 3) {
  1892. //计算已经待分配工时比例
  1893. let array = this.form.domains;
  1894. let totalProgress = 0;
  1895. for (var i = 0; i < array.length; i++) {
  1896. totalProgress += array[i].progress;
  1897. }
  1898. if (totalProgress < 100) {
  1899. leftProgress = 100 - totalProgress;
  1900. }
  1901. }
  1902. let item = {
  1903. id: null,
  1904. projectId: "",
  1905. projectName: "",
  1906. workingTime: this.reportTimeType.type == 3 ? (leftProgress * this.reportTimeType.allday / 100).toFixed(1) : "4.0",
  1907. progress: leftProgress,
  1908. content: "",
  1909. state: 2,
  1910. isOvertime: false,
  1911. multiWorktime: this.reportTimeType.multiWorktime,
  1912. worktimeList: [{}],
  1913. degreeId: null,
  1914. canEdit: true
  1915. }
  1916. if (this.isWeekend && this.user.timeType.lockWorktime != 1) {
  1917. this.$set(item, 'isOvertime', true)
  1918. if (this.reportTimeType.type == 3) {
  1919. this.$set(item, 'overtimeHours', (leftProgress * this.reportTimeType.allday / 100).toFixed(1))
  1920. } else {
  1921. this.$set(item, 'overtimeHours', 4)
  1922. }
  1923. }
  1924. if (this.report.timeBasecostList.length != 0 && this.user.company.packageProject == 1) {
  1925. this.$set(item, 'basecostId', this.report.timeBasecostList[0].id)
  1926. this.$set(item, 'basecostName', this.report.timeBasecostList[0].name)
  1927. }
  1928. this.form.domains.push(item)
  1929. //重新计算总时长
  1930. this.setTotalReportHours();
  1931. this.canEdit = true
  1932. this.$forceUpdate()
  1933. },
  1934. // 移除项目
  1935. delPro(i) {
  1936. this.$dialog.confirm({
  1937. title: '',
  1938. message: '是否移除当前项目'
  1939. }).then(() => {
  1940. this.form.domains.splice(i, 1);
  1941. //重新计算总时长
  1942. this.setTotalReportHours();
  1943. }).catch(() => {
  1944. });
  1945. },
  1946. // 判断时间段
  1947. fns() {
  1948. for (let k in this.dateAr) {
  1949. if (!this.judege(k)) {
  1950. return false
  1951. }
  1952. }
  1953. return true
  1954. },
  1955. judege(idx) {
  1956. for (let k in this.dateAr) {
  1957. if (idx !== k) {
  1958. if (this.dateAr[k].s <= this.dateAr[idx].s && this.dateAr[k].e > this.dateAr[idx].s) {
  1959. return false
  1960. }
  1961. if (this.dateAr[k].s < this.dateAr[idx].e && this.dateAr[k].e >= this.dateAr[idx].e) {
  1962. return false
  1963. }
  1964. }
  1965. }
  1966. return true
  1967. },
  1968. // 提交日报
  1969. submitReport() {
  1970. this.$refs.loginForm.validate().then(
  1971. () => {
  1972. // 验证通过
  1973. if (this.isDraft == 1) {
  1974. //暂存操作
  1975. this.submitReportSon()
  1976. } else {
  1977. if (this.user.companyId == 5978) {
  1978. //调接口,先检查工时是否存在异常
  1979. var totalTime = 0;
  1980. for (var t=0;t<this.form.domains.length; t++) {
  1981. totalTime += parseFloat(this.form.domains[t].workingTime);
  1982. }
  1983. var array = [];
  1984. var workData = {date: this.form.createDate, workingTime: totalTime};
  1985. array.push(workData)
  1986. this.flgLg = false
  1987. var passUserId = this.user.id;
  1988. this.$axios.post("/report/checkBeiSengCardTime", { userId:passUserId, dateWorkingTime:JSON.stringify(array)})
  1989. .then(res => {
  1990. this.flgLg = true
  1991. if (res.code == "ok") {
  1992. this.submitReportSon()
  1993. } else {
  1994. this.$dialog.confirm({
  1995. title: '提示',
  1996. message: res.msg + ',是否忽略并提交?'
  1997. }).then(() => {
  1998. this.submitReportSon()
  1999. }).catch(() => { })
  2000. }
  2001. }).catch(err => { this.$toast.clear(); });
  2002. } else {
  2003. //提交时,做工时时长不足的提醒
  2004. if (this.totalReportHours < this.user.timeType.allday) {
  2005. this.$dialog.confirm({
  2006. title: '提示',
  2007. message: '当日工时不足' + this.user.timeType.allday.toFixed(1) + '小时,是否确定提交?'
  2008. }).then(() => {
  2009. this.submitReportSon()
  2010. }).catch(() => { })
  2011. } else {
  2012. this.submitReportSon()
  2013. }
  2014. }
  2015. }
  2016. }).catch((err) => {
  2017. console.log('验证失败', err);
  2018. return
  2019. })
  2020. },
  2021. submitReportSon() {
  2022. this.dateAr = []
  2023. let alp = []
  2024. if (this.user.timeType.multiWorktime == 1) {
  2025. for (var p in this.form.domains) {
  2026. var slll = this.form.domains[p]
  2027. for (var o in slll.worktimeList) {
  2028. if (slll.worktimeList[o].startTime || slll.worktimeList[o].endTime) {
  2029. let objs = {}
  2030. objs.s = slll.worktimeList[o].startTime
  2031. objs.e = slll.worktimeList[o].endTime
  2032. alp.push(objs)
  2033. }
  2034. }
  2035. }
  2036. } else {
  2037. for (let i in this.form.domains) {
  2038. let objs = {}
  2039. objs.s = this.form.domains[i].startTime
  2040. objs.e = this.form.domains[i].endTime
  2041. alp.push(objs)
  2042. }
  2043. }
  2044. this.dateAr = alp
  2045. console.log(this.reportTimeType, this.dateAr, '<=== this.reportTimeType')
  2046. const { timeCanOverlap } = this.reportTimeType // timeCanOverlap 为零时校验不允许重叠
  2047. if (this.dateAr.length > 0 && timeCanOverlap == 0) {
  2048. let trus = this.fns()
  2049. if (!trus) {
  2050. this.$toast('填写的时间段重叠')
  2051. return
  2052. }
  2053. }
  2054. //检查子项目
  2055. if (this.user.timeType.subProMustFill == 1) {
  2056. for (var p in this.form.domains) {
  2057. var oneProItem = this.form.domains[p]
  2058. if (oneProItem.subProjectList.length > 0 && !oneProItem.subProjectId) {
  2059. //没有选择子项目
  2060. this.$toast('子项目必填,请检查')
  2061. return
  2062. }
  2063. }
  2064. }
  2065. //昱众需要检查新增的角色,工作职责,工作内容是否填写
  2066. if (this.user.companyId == this.yuzhongCompId) {
  2067. for (var p in this.form.domains) {
  2068. var oneProItem = this.form.domains[p]
  2069. if (!oneProItem.extraField1) {
  2070. this.$toast('角色必填,请检查')
  2071. return
  2072. }
  2073. if (!oneProItem.extraField2) {
  2074. this.$toast('工作职责必填,请检查')
  2075. return
  2076. }
  2077. if (!oneProItem.extraField3) {
  2078. this.$toast('工作内容必填,请检查')
  2079. return
  2080. }
  2081. }
  2082. }
  2083. // return
  2084. const toast = this.$toast.loading({
  2085. forbidClick: true,
  2086. duration: 0
  2087. });
  2088. // let formData = new FormData();
  2089. let formData = new URLSearchParams()
  2090. formData.append("draft", this.isDraft);
  2091. if (this.reportTimeType.type == 0) {
  2092. var alldayNum = 0;
  2093. var amNum = 0;
  2094. var pmNum = 0;
  2095. for (var i in this.form.domains) {
  2096. if (this.form.domains[i].timeType == 0) {
  2097. alldayNum++;
  2098. } else if (this.form.domains[i].timeType == 1) {
  2099. amNum++;
  2100. } else if (this.form.domains[i].timeType == 2) {
  2101. pmNum++;
  2102. }
  2103. }
  2104. if (alldayNum > 1) {
  2105. this.$toast.fail("工作时间-全天,只能选择一次");
  2106. return;
  2107. }
  2108. if (amNum > 1) {
  2109. this.$toast.fail("工作时间-上午,只能选择一次");
  2110. return;
  2111. }
  2112. if (pmNum > 1) {
  2113. this.$toast.fail("工作时间-下午,只能选择一次");
  2114. return;
  2115. }
  2116. if (alldayNum == 1 && (amNum > 0 || pmNum > 0)) {
  2117. this.$toast.fail("工作时间-全天,不能和上下午同时存在");
  2118. return;
  2119. }
  2120. } else if (this.reportTimeType.type == 3) {
  2121. //总百分比不能超过100%
  2122. let total = 0;
  2123. this.form.domains.forEach(w => { total += w.progress });
  2124. if (total > 100) {
  2125. this.$toast.fail("用时比例之和不能超过100%");
  2126. return;
  2127. } else if (total < 100) {
  2128. this.$toast.fail("工时尚未完全分配,无法提交");
  2129. return;
  2130. }
  2131. }
  2132. if (this.user.timeType.notAllowedNoAttendance == 1 && this.isDraft == 0) {
  2133. if (this.report.time) {
  2134. if (this.report.time.workHours == 0) {
  2135. this.$toast.fail('无考勤记录不可填报')
  2136. return
  2137. }
  2138. } else {
  2139. this.$toast.fail('无考勤记录不可填报')
  2140. return
  2141. }
  2142. }
  2143. //针对凡己,不校验考勤时长
  2144. if (this.user.companyId != 3918 && this.user.companyId != 5978 && this.reportTimeType.type == 1 && this.report.time) {
  2145. var totalTime = 0;
  2146. for (var t = 0; t < this.form.domains.length; t++) {
  2147. totalTime += parseFloat(this.form.domains[t].workingTime);
  2148. }
  2149. if (this.report.time.workHours && totalTime > parseFloat(this.report.time.workHours)) {
  2150. this.$toast.fail("填报工时之和" + (totalTime) + "h不能超过考勤总工时(" + this.report.time.workHours.toFixed(1) + "h)");
  2151. return;
  2152. }
  2153. }
  2154. //填字段
  2155. for (var i in this.form.domains) {
  2156. // 检查任务/里程碑是否为必填
  2157. let taskRequired = this.user.timeType.taskRequired
  2158. if(taskRequired == 1) {
  2159. if(!this.form.domains[i].taskId) {
  2160. this.$toast.fail(`【${this.form.domains[i].projectName}】请选择 任务/里程碑`);
  2161. return
  2162. }
  2163. }
  2164. if (this.user.timeType.reportAuditType == 3) {
  2165. let audItem = {}
  2166. let auditRule = ''
  2167. if (this.form.domains[i].id) {
  2168. audItem.reportId = this.form.domains[i].id
  2169. }
  2170. if (this.user.timeType.auditLevel > 0) {
  2171. if (!this.form.domains[i].auditorFirst.id) { auditRule += '第一、' }
  2172. audItem.auditorFirst = this.form.domains[i].auditorFirst.id
  2173. }
  2174. if (this.user.timeType.auditLevel > 1) {
  2175. // if(!this.form.domains[i].auditorSec.id){ auditRule += '第二、' }
  2176. audItem.auditorSec = this.form.domains[i].auditorSec.id
  2177. }
  2178. if (this.user.timeType.auditLevel > 2) {
  2179. // if(!this.form.domains[i].auditorThird.id){ auditRule += '第三、' }
  2180. audItem.auditorThird = this.form.domains[i].auditorThird.id
  2181. }
  2182. if (this.form.domains[i].ccUserid.id) {
  2183. audItem.ccUserid = this.form.domains[i].ccUserid.id
  2184. }
  2185. if (auditRule) {
  2186. auditRule = auditRule.substring(0, auditRule.length - 1)
  2187. this.$toast.fail('请指定' + auditRule + '审核人')
  2188. return
  2189. }
  2190. formData.append("auditorSettingArray", JSON.stringify(audItem).replace(/,/g, "@"));
  2191. }
  2192. if (this.user.timeType.customDegreeActive == 1) {
  2193. let customDegreeMultiple = this.user.timeType.customDegreeMultiple
  2194. if (this.form.domains[i].degreeId) {
  2195. if(!customDegreeMultiple) { // 单选
  2196. formData.append("degreeId", this.form.domains[i].degreeId);
  2197. } else {
  2198. let newDegreeId = this.form.domains[i].degreeId.split(',')
  2199. formData.append("multiDegrId", JSON.stringify(newDegreeId).replace(/,/g, '@'))
  2200. }
  2201. } else {
  2202. if (this.user.timeType.customDegreeStatus && !this.form.domains[i].degreeId) {
  2203. this.$toast.fail('请选择' + this.user.timeType.customDegreeName)
  2204. return
  2205. } else {
  2206. if (!customDegreeMultiple) {
  2207. formData.append("degreeId", -1);
  2208. } else {
  2209. formData.append("multiDegrId", '[]');
  2210. }
  2211. }
  2212. }
  2213. } else {
  2214. formData.append("degreeId", -1);
  2215. }
  2216. if (this.form.domains[i].customData) {
  2217. formData.append("customData", this.form.domains[i].customData);
  2218. } else {
  2219. formData.append("customData", "0");
  2220. }
  2221. if (this.form.domains[i].customText) {
  2222. formData.append("customText", this.form.domains[i].customText);
  2223. } else {
  2224. formData.append("customText", "-");
  2225. }
  2226. if (this.form.domains[i].id) {
  2227. formData.append("id", this.form.domains[i].id);
  2228. } else {
  2229. formData.append("id", -1);
  2230. }
  2231. formData.append("projectId", parseFloat(this.form.domains[i].projectId));
  2232. if (this.form.domains[i].subProjectId) {
  2233. formData.append("subProjectId", this.form.domains[i].subProjectId);
  2234. } else {
  2235. formData.append("subProjectId", 0);
  2236. }
  2237. if (this.form.domains[i].groupId) {
  2238. formData.append("groupId", this.form.domains[i].groupId);
  2239. } else {
  2240. formData.append("groupId", 0);
  2241. }
  2242. if (this.form.domains[i].stage) {
  2243. formData.append("stage", this.form.domains[i].stage);
  2244. } else {
  2245. formData.append("stage", '-');
  2246. }
  2247. formData.append("reportTimeType", this.reportTimeType.type);
  2248. formData.append("multiWorktime", this.reportTimeType.multiWorktime);
  2249. if (this.reportTimeType.type == 0) {
  2250. formData.append("timeType", this.form.domains[i].timeType);
  2251. formData.append("workingTime", parseFloat(this.form.domains[i].workingTime));
  2252. } else if (this.reportTimeType.type == 1) {
  2253. formData.append("workingTime", parseFloat(this.form.domains[i].workingTime));
  2254. } else if (this.reportTimeType.type == 2) {
  2255. formData.append("startTime", this.form.domains[i].startTime);
  2256. formData.append("endTime", this.form.domains[i].endTime);
  2257. } else if (this.reportTimeType.type == 3) {
  2258. formData.append("progress", this.form.domains[i].progress);
  2259. formData.append("workingTime", this.form.domains[i].workingTime);
  2260. }
  2261. if (this.form.domains[i].taskId) {
  2262. formData.append("taskId", this.form.domains[i].taskId);
  2263. } else {
  2264. formData.append("taskId", 0);
  2265. }
  2266. if (this.form.domains[i].taskFinish == true) {
  2267. formData.append("taskFinish", 1);
  2268. } else {
  2269. formData.append("taskFinish", 0);
  2270. }
  2271. // formData.append("createDate", this.form.createDate);
  2272. if(this.substitute) {
  2273. formData.append("createDate", `${this.form.createDate}@${this.form.createDate}`);
  2274. formData.append("targetUids", this.fillingAgent.id || '');
  2275. } else {
  2276. formData.append("createDate", this.form.createDate);
  2277. }
  2278. formData.append("isOvertime", this.form.domains[i].isOvertime && this.user.timeType.fillOvertime ? 1 : 0);
  2279. if (this.form.domains[i].overtimeHours && this.form.domains[i].isOvertime == 1 && this.user.timeType.fillOvertime) {
  2280. formData.append("overtimeHours", this.form.domains[i].overtimeHours);
  2281. } else {
  2282. formData.append("overtimeHours", 0);
  2283. }
  2284. if (this.form.domains[i].basecostId) {
  2285. formData.append("basecostId", this.form.domains[i].basecostId);
  2286. }
  2287. //项目专业进度
  2288. if (this.form.domains[i].professionProgress) {
  2289. let m = JSON.stringify(this.form.domains[i].professionProgress);
  2290. m = m.replace(/,/g, "@");//replaceAll(',','@');企业微信不兼容replaceAll
  2291. formData.append("professionProgress", m);
  2292. } else {
  2293. formData.append("professionProgress", "[]");
  2294. }
  2295. //图片的处理,serverPic是当前所有的照片
  2296. if (this.form.domains[i].serverPics) {
  2297. let m = JSON.stringify(this.form.domains[i].serverPics);
  2298. m = m.replace(/,/g, "@");//replaceAll(',','@');企业微信不兼容replaceAll
  2299. formData.append("pics", m);
  2300. } else {
  2301. formData.append("pics", "@");
  2302. }
  2303. //处理多个时间事项
  2304. if (this.reportTimeType.multiWorktime == 1) {
  2305. //检查时间是否有重叠
  2306. var workList = this.form.domains[i].worktimeList;
  2307. for (var j = 0; j < workList.length; j++) {
  2308. var curItem = workList[j];
  2309. if (curItem.startTime == null || curItem.endTime == null) {
  2310. this.$toast.fail("请设置工作时间");
  2311. return;
  2312. }
  2313. //检查开始时间是否大于结束时间
  2314. if (curItem.startTime >= curItem.endTime) {
  2315. this.$toast.fail("时间段" + curItem.startTime + '-' + curItem.endTime + "有误:" +
  2316. "结束时间必须大于开始时间");
  2317. return;
  2318. }
  2319. //时间段不可重叠
  2320. if (this.reportTimeType.timeCanOverlap == 0) {
  2321. for (var p = j + 1; p < workList.length; p++) {
  2322. var jItem = workList[p];
  2323. if ((jItem.startTime >= curItem.startTime && jItem.startTime < curItem.endTime)
  2324. || (jItem.endTime > curItem.startTime && jItem.endTime <= curItem.endTime)) {
  2325. this.$toast.fail("时间段" + curItem.startTime + '-' + curItem.endTime + "与" +
  2326. jItem.startTime + '-' + jItem.endTime + "存在重叠,请修改。");
  2327. return;
  2328. }
  2329. }
  2330. }
  2331. }
  2332. let m = JSON.stringify(this.form.domains[i].worktimeList);
  2333. m = m.replace(/,/g, "@");//replaceAll(',','@');企业微信不兼容replaceAll
  2334. formData.append("content", m);
  2335. } else {
  2336. if (this.form.domains[i].content) {
  2337. formData.append("content", this.form.domains[i].content);
  2338. } else {
  2339. formData.append("content", '-');
  2340. }
  2341. }
  2342. //审核人
  2343. if (this.form.domains[i].projectAuditorId) {
  2344. formData.append("projectAuditorId", this.form.domains[i].projectAuditorId);
  2345. } else {
  2346. if (this.user.timeType.reportAuditType == 0) {
  2347. this.$toast.fail("请指定[" + this.form.domains[i].projectName + ']项目的审核人');
  2348. return;
  2349. } else if (this.user.timeType.reportAuditType == 1 || this.user.timeType.reportAuditType == 2) {
  2350. if (this.form.domains[i].taskGroups.length == 0) {
  2351. this.$toast.fail("您在[" + this.form.domains[i].projectName + "]项目上尚无参与的任务分组");
  2352. return;
  2353. } else if (!this.form.domains[i].groupId) {
  2354. this.$toast.fail("请选择[" + this.form.domains[i].projectName + "]项目的任务分组");
  2355. return;
  2356. } else {
  2357. this.$toast.fail("请先设置[" + this.form.domains[i].projectName + ']-[' + this.form.domains[i].groupName + ']的分组负责人');
  2358. return;
  2359. }
  2360. }
  2361. }
  2362. if (this.user.companyId == this.yuzhongCompId) {
  2363. formData.append('extraField1', this.form.domains[i].extraField1);
  2364. formData.append('extraField2', this.form.domains[i].extraField2);
  2365. formData.append('extraField3', this.form.domains[i].extraField3);
  2366. }
  2367. if (this.user.companyId == 3092) {
  2368. formData.append('sapServiceId', this.form.domains[i].sapServiceId);
  2369. }
  2370. if(this.user.timeType.taskGroupRequired == 1 && !this.form.domains[i].groupId) {
  2371. this.$toast.fail("请选择[" + this.form.domains[i].projectName + "]项目的任务分组");
  2372. return;
  2373. }
  2374. }
  2375. if (!this.flgLg) {
  2376. return
  2377. }
  2378. this.flgLg = false
  2379. this.$axios.post("/report/editReport", formData)
  2380. .then(res => {
  2381. this.flgLg = true
  2382. if (res.code == "ok") {
  2383. this.$toast.clear();
  2384. if (res.msg != null) {
  2385. this.$dialog.alert({
  2386. message: res.msg,
  2387. }).then(() => {
  2388. // on close
  2389. this.$router.push("/index");
  2390. });
  2391. } else {
  2392. this.$toast.success(this.isDraft == 0 ? '提交成功' : '暂存成功');
  2393. setTimeout(() => {
  2394. this.$router.push("/index");
  2395. }, 500);
  2396. }
  2397. } else {
  2398. this.$toast.clear();
  2399. this.$toast.fail((this.isDraft == 0 ? '提交失败' : '暂存失败') + ':' + res.msg);
  2400. }
  2401. }).catch(err => { this.$toast.clear(); this.flgLg = true });
  2402. },
  2403. //初始化参数
  2404. initWxConfig() {
  2405. var curUrl = location.href.split("#")[0];
  2406. this.$axios.post("/wxcorp/getCorpWXConfig", { url: curUrl, token: this.user.id })
  2407. .then(res => {
  2408. if (res.code == "ok") {
  2409. var data = res.data;
  2410. wx.config({
  2411. beta: true,
  2412. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  2413. appId: data.appid, // 必填,公众号的唯一标识
  2414. timestamp: data.timestamp, // 必填,生成签名的时间戳
  2415. nonceStr: data.noncestr, // 必填,生成签名的随机串
  2416. signature: data.sign, // 必填,签名,见附录1
  2417. jsApiList: [
  2418. 'chooseImage',
  2419. 'previewImage',
  2420. 'uploadImage',
  2421. 'downloadImage',
  2422. 'previewFile',
  2423. 'getLocation',
  2424. ]
  2425. });
  2426. var that = this;
  2427. wx.ready(function () {
  2428. // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
  2429. // if (that.user.companyId == 7) {
  2430. // that.$toast('wx init success==7 ');
  2431. // that.getLocation();
  2432. // }
  2433. });
  2434. } else {
  2435. this.$toast.fail('获取失败');
  2436. }
  2437. }).catch(err => { this.$toast.fail('发生异常' + err); console.log(err) });
  2438. },
  2439. deleteImg(item, index) {
  2440. //删除添加的图片
  2441. if (this.isIOSystem) {
  2442. item.iospics.splice(index, 1);
  2443. item.iospics = item.iospics;
  2444. }
  2445. item.pics.splice(index, 1);
  2446. item.pics = item.pics;
  2447. //传递到后台的数据也要做同步删除
  2448. item.serverPics.splice(index, 1);
  2449. this.$forceUpdate();
  2450. },
  2451. //企业微信获取定位
  2452. getLocation() {
  2453. wx.getLocation({
  2454. type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
  2455. success: function (res) {
  2456. var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
  2457. var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
  2458. alert(JSON.stringify(res));
  2459. }
  2460. });
  2461. },
  2462. },
  2463. mounted() {
  2464. const { substitute } = this.$route.query;
  2465. if (substitute) {
  2466. this.substitute = true;
  2467. }
  2468. this.today = this.format(new Date(), 'yyyy-MM-dd')
  2469. this.timeRange = []
  2470. let i = 0.0;
  2471. while(true) {
  2472. if (i < 24) {
  2473. //校验上下限
  2474. if (i >= this.user.timeType.minReportTime && i <= this.user.timeType.maxReportTime) {
  2475. this.timeRange.push(i);
  2476. }
  2477. i += 0.5;
  2478. } else {
  2479. break;
  2480. }
  2481. }
  2482. // console.log('user',this.user)
  2483. var ua = navigator.userAgent.toLowerCase();
  2484. this.isIOSystem = this.isIOS();
  2485. if (ua.indexOf("wxwork") > 0) {
  2486. this.isCorpWX = true;
  2487. } else if (ua.indexOf("micromessenger") > 0) {
  2488. this.isWX = true;
  2489. }
  2490. this.getPeoject() // 获取项目
  2491. // console.log('mounted');
  2492. this.getReportBasecostList()
  2493. //获取传递过来的日期
  2494. var passDate = this.$route.query.date;
  2495. if (passDate != null) {
  2496. this.form.createDate = this.$route.query.date;
  2497. }
  2498. // this.getProject();
  2499. this.getReport();
  2500. this.getAllUsersList()
  2501. this.getTimeType();
  2502. //初始化微信js-sdk参数
  2503. if (this.isCorpWX) {
  2504. this.initWxConfig();
  2505. }
  2506. if (this.user.timeType.lockWorktime) {
  2507. this.timeRange = this.timeRange.filter(item => { return item <= this.user.timeType.allday })
  2508. }
  2509. if (this.user.companyId == this.yuzhongCompId) {
  2510. this.getJobResponList();
  2511. }
  2512. // if(localStorage.getItem("formVal")) {
  2513. // var obj = localStorage.getItem("formVal")
  2514. // this.form = JSON.parse(obj)
  2515. // localStorage.removeItem('formVal')
  2516. // }
  2517. },
  2518. beforeDestroy() {
  2519. localStorage.removeItem('formVal')
  2520. }
  2521. };
  2522. </script>
  2523. <style lang="less" scope>
  2524. .groupingSelection {
  2525. height: 100%;
  2526. overflow-y: auto;
  2527. padding: 10px 0;
  2528. .groupingSelectionItem {
  2529. padding: 15px 15px;
  2530. border-bottom: 1px solid #c2c2c2;
  2531. }
  2532. }
  2533. .chooseSomeone {
  2534. height: 80vh;
  2535. display: flex;
  2536. flex-direction: column;
  2537. .chooseSomeoneFlex1 {
  2538. flex: 1;
  2539. overflow: auto;
  2540. }
  2541. .chooseSomeoneBtn {
  2542. width:100%;
  2543. }
  2544. }
  2545. .my-swipe .van-swipe-item {
  2546. color: #fff;
  2547. font-size: 20px;
  2548. line-height: 150px;
  2549. text-align: center;
  2550. background-color: #39a9ed;
  2551. }
  2552. .van-field__control:disabled {
  2553. -webkit-text-fill-color: #646566;
  2554. }
  2555. .login_form {
  2556. margin-top: 46px;
  2557. position: relative;
  2558. }
  2559. .attendanceRecord {
  2560. // position: absolute;
  2561. // top: 0.26667rem;
  2562. // right: 0.42667rem;
  2563. color: #969799;
  2564. text-align: center;
  2565. font-size: 0.35rem;
  2566. line-height: 0.64rem;
  2567. }
  2568. .form_domains {
  2569. position: relative;
  2570. .form_copy {
  2571. position: absolute;
  2572. right: 85px;
  2573. top: 10px;
  2574. }
  2575. .form_addNew {
  2576. text-align: center;
  2577. margin: 10px;
  2578. }
  2579. .form_del {
  2580. position: absolute;
  2581. right: 10px;
  2582. top: 10px;
  2583. }
  2584. // .form_del {
  2585. // color: #ff0000;
  2586. // font-size: 22px;
  2587. // position: absolute;
  2588. // right: 15px;
  2589. // top: 10px;
  2590. // }
  2591. }
  2592. .form_tip {
  2593. text-align: center;
  2594. margin-top: 20px;
  2595. color: #afafaf;
  2596. font-size: 14px;
  2597. }
  2598. .card__footer {
  2599. padding-top: 10px;
  2600. }
  2601. .card__tags {
  2602. .van-tag {
  2603. margin-right: 5px;
  2604. }
  2605. }
  2606. .overTimeClas {
  2607. display: flex;
  2608. width: 7.4rem;
  2609. // justify-content: space-between;
  2610. align-items: center;
  2611. }
  2612. </style>
  2613. <style lang="less">
  2614. .van-nav-bar .van-icon,
  2615. .van-nav-bar__text {
  2616. color: #20a0ff;
  2617. }
  2618. .overtime {
  2619. height: 50px;
  2620. box-sizing: border-box;
  2621. padding-left: 10px;
  2622. display: flex;
  2623. align-items: center;
  2624. }
  2625. .custom-button {
  2626. width: 40px;
  2627. color: #fff;
  2628. font-size: 10px;
  2629. line-height: 16px;
  2630. text-align: center;
  2631. background-color: #1989fa;
  2632. border-radius: 100px;
  2633. }
  2634. .imgList {
  2635. position: relative;
  2636. width: 100px;
  2637. height: 100px;
  2638. display: inline-block;
  2639. }
  2640. .imgList_i {
  2641. position: absolute;
  2642. top: -8px;
  2643. right: -6px;
  2644. z-index: 999;
  2645. }
  2646. .ryuan {
  2647. padding: 0.3rem 0.53333rem;
  2648. // line-height: 40px;
  2649. // height: 40px;
  2650. overflow: auto;
  2651. color: #333;
  2652. border-bottom: 2px solid #f6f6f6;
  2653. width: 100%;
  2654. overflow: hidden;
  2655. text-overflow: ellipsis;
  2656. white-space: nowrap;
  2657. }
  2658. .overListTime {
  2659. margin-left: 5px;
  2660. display: inline-block;
  2661. width: 2rem;
  2662. color: #646566;
  2663. }
  2664. .hoveOver {
  2665. color: #C8C9CC;
  2666. }
  2667. .van-checkbox__label {
  2668. color: #646566 !important;
  2669. }
  2670. .van-checkbox__label--disabled {
  2671. color: #c8c9cc !important;
  2672. }
  2673. </style>