weekEdit.vue 144 KB

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