Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

appointment.vue 119KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606
  1. <template>
  2. <div class="main-contain">
  3. <el-dialog
  4. title="提示"
  5. :visible.sync="exportVisible"
  6. width="40%"
  7. >
  8. <div>
  9. 您提交的排班信息已上传成功,系统正在执行导入,请稍候点击当前页面右上角“下载日志”查看导入结果
  10. </div>
  11. <span slot="footer" class="dialog-footer">
  12. <el-button @click="exportVisible = false">取 消</el-button>
  13. <el-button type="primary" @click="exportVisible = false">确 定</el-button>
  14. </span>
  15. </el-dialog>
  16. <el-dialog
  17. title="提示"
  18. :visible.sync="exportLogVisible"
  19. width="40%"
  20. >
  21. <div v-for="(item,index) in logs" :key="index">
  22. <span> {{ item.export_time | parseTime('{y}-{m}-{d} {h}:{i}:{s}') }}</span>
  23. <br/>
  24. <br/>
  25. <span>{{ getContent(item) }}</span>
  26. <span>点击</span>
  27. <span style="color:blue" @click="generateTxt(item)">查看详情</span>
  28. <br/>
  29. <br/>
  30. </div>
  31. <span slot="footer" class="dialog-footer">
  32. <el-button @click="exportLogVisible = false">取 消</el-button>
  33. <el-button type="primary" @click="exportLogVisible = false">确 定</el-button>
  34. </span>
  35. </el-dialog>
  36. <el-dialog
  37. title="提示"
  38. :visible.sync="dialogVisible"
  39. width="40%"
  40. >
  41. <span>您提交的文档不是系统标准导入模板,请检查您的文档或重新下载文档</span>
  42. <span slot="footer" class="dialog-footer">
  43. <el-button @click="dialogVisible = false">取 消</el-button>
  44. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  45. </span>
  46. </el-dialog>
  47. <el-dialog
  48. title="提示"
  49. :visible.sync="isExistRepeatVisible"
  50. width="40%"
  51. >
  52. <span>检查到文档中同一天同个人存在多个排班,请检查并修改您的文档,重新导入</span>
  53. <span slot="footer" class="dialog-footer">
  54. <el-button @click="isExistRepeatVisible = false">取 消</el-button>
  55. <el-button type="primary" @click="isExistRepeatVisible = false">确 定</el-button>
  56. </span>
  57. </el-dialog>
  58. <div class="position">
  59. <bread-crumb :crumbs="crumbs"></bread-crumb>
  60. <div style="display:flex;align-items:center">
  61. <el-button type="primary" size="small" icon="el-icon-printer" @click="printScheduleAction" v-if="activeName !='historyWeek'">打印排班</el-button>
  62. <el-button type="primary" size="small" icon="el-icon-printer" @click="printScheduleActionOne" v-if="activeName == 'historyWeek'">打印排班</el-button>
  63. <el-button type="primary" size="small" icon="el-icon-printer" @click="printScheduleActionTwo">治疗签到</el-button>
  64. <!-- <schedule-upload-excel style="margin-right:10px;" :on-success='handleSuccess' v-if="is_edit"></schedule-upload-excel> -->
  65. <!-- <el-button @click="printTable" type="primary" size="small">打印排班</el-button> -->
  66. <el-button v-if="isShow()" type="primary" size="small" @click="export_file()" :loading="downloadLoading">
  67. 导出排班
  68. </el-button>
  69. <!-- <el-button
  70. @click="generateLog()"
  71. class="filter-item"
  72. type="primary"
  73. v-if="is_edit"
  74. size="small"
  75. >下载日志
  76. </el-button> -->
  77. <el-button type="primary" size="small" icon="el-icon-setting" @click="setScheduleTemplateAction">排班模板
  78. </el-button>
  79. <!-- <el-button type="primary" size="small" @click="copySchedule" v-if="is_edit">复制排班</el-button>
  80. <el-button type="primary" size="small" v-if="is_edit" @click="smartsch">智能排班</el-button> -->
  81. <el-button type="primary" size="small" v-if="!is_edit" @click="editsch">编辑排班</el-button>
  82. <!-- <el-button type="danger" size="small" v-if="is_edit" @click="outisedit">退出编辑</el-button> -->
  83. </div>
  84. </div>
  85. <div class="app-container">
  86. <div style="right:30px;position:absolute;z-index:99">
  87. <span>导出周次:</span>
  88. <el-date-picker
  89. v-model="weekTime"
  90. type="week"
  91. format="yyyy 第 WW 周"
  92. placeholder="选择周"
  93. :picker-options="{'firstDayOfWeek': 1}"
  94. @change="changeWeek"
  95. >
  96. </el-date-picker>
  97. </div>
  98. <el-tabs v-model="activeName" :tab-position="tabPosition" ref="elTabs" @tab-click="handleClick">
  99. <el-tab-pane name="historyWeek">
  100. <span slot="label"><i class="el-icon-date"></i> 历史周期 ({{ theWeek.historyWeek }}) </span>
  101. </el-tab-pane>
  102. <el-tab-pane name="lastWeek">
  103. <span slot="label"><i class="el-icon-date"></i> 上周 ({{ theWeek.lastWeek }})</span>
  104. </el-tab-pane>
  105. <el-tab-pane name="thisWeek">
  106. <span slot="label"><i class="el-icon-date"></i> 本周 ({{ theWeek.thisWeek }})</span>
  107. </el-tab-pane>
  108. <el-tab-pane name="nextWeek">
  109. <span slot="label"><i class="el-icon-date"></i> 下一周 ({{ theWeek.nextWeek }})</span>
  110. </el-tab-pane>
  111. <el-tab-pane name="nextTwoWeek">
  112. <span slot="label"><i class="el-icon-date"></i> 下下周 ({{ theWeek.nextTwoWeek }})</span>
  113. </el-tab-pane>
  114. </el-tabs>
  115. <div v-if="!is_edit">
  116. <table-data ref="tableData" :week-time="activeName" :partitions-prop="partitions"
  117. :schedule-zone-row-prop="scheduleZoneRow"
  118. :schedule-zone-prop="scheduleZone" title="" @event1="changePartition"
  119. @event2="changeSchedule" @event3="changeWeekDay" @event6="changeScheduleType" @guanliu_show="guanliu" v-show="showtableOne">
  120. </table-data>
  121. </div>
  122. <!-- 编辑 -->
  123. <edit-table-data ref="edittableData" :week-time="activeName" :partitions-prop="partitions"
  124. :schedule-zone-row-prop="scheduleZoneRow" :schedule-zone-prop="scheduleZone"
  125. title="" @event1="changePartition"
  126. @event2="changeSchedule" v-if="is_edit" @event3="changeWeekDay">
  127. <div class="position">
  128. <!-- <bread-crumb :crumbs="crumbs"></bread-crumb> -->
  129. <div>
  130. <el-tabs v-model="activeName" :tab-position="tabPosition" ref="elTabs" @tab-click="historyclick">
  131. <el-tab-pane name="beforeWeek">
  132. <span slot="label"><i class="el-icon-date"></i> 上上周 ({{ theWeek.historyWeek }})</span>
  133. </el-tab-pane>
  134. <el-tab-pane name="lastWeek">
  135. <span slot="label"><i class="el-icon-date"></i> 上周 ({{ theWeek.lastWeek }})</span>
  136. </el-tab-pane>
  137. <el-tab-pane name="thisWeek">
  138. <span slot="label"><i class="el-icon-date"></i> 本周 ({{ theWeek.thisWeek }})</span>
  139. </el-tab-pane>
  140. <el-tab-pane name="nextWeek">
  141. <span slot="label"><i class="el-icon-date"></i> 下一周 ({{ theWeek.nextWeek }})</span>
  142. </el-tab-pane>
  143. <el-tab-pane name="nextTwoWeek">
  144. <span slot="label"><i class="el-icon-date"></i> 下下周 ({{ theWeek.nextTwoWeek }})</span>
  145. </el-tab-pane>
  146. </el-tabs>
  147. </div>
  148. <div style="display:flex;align-items:center">
  149. <el-button type="primary" size="small" icon="el-icon-printer" @click="printScheduleAction">打印排班</el-button>
  150. <!-- <schedule-upload-excel style="margin-right:10px;" :on-success='handleSuccess' v-if="is_edit"></schedule-upload-excel> -->
  151. <el-button v-if="isShow()" type="primary" size="small" @click="export_file()" :loading="downloadLoading">
  152. 导出排班
  153. </el-button>
  154. <el-button
  155. @click="generateLog()"
  156. class="filter-item"
  157. type="primary"
  158. v-if="is_edit"
  159. size="small"
  160. >下载日志
  161. </el-button>
  162. <el-button type="primary" size="small" icon="el-icon-setting" @click="setScheduleTemplateAction">排班模板
  163. </el-button>
  164. <el-button type="primary" size="small" @click="copySchedule" v-if="is_edit">复制排班</el-button>
  165. <el-button type="primary" size="small" v-if="is_edit" @click="smartsch">智能排班</el-button>
  166. <el-button type="primary" size="small" v-if="!is_edit" @click="editsch">编辑排班</el-button>
  167. <el-button type="danger" size="small" v-if="is_edit" @click="outisedit">退出编辑</el-button>
  168. </div>
  169. </div>
  170. </edit-table-data>
  171. <!-- 编辑上上周 -->
  172. <beforeweekTable ref="beforeweeks" v-show="beforeshow" :week-time="activeName" :partitions-prop="partitions"
  173. :schedule-zone-row-prop="scheduleZoneRow" :schedule-zone-prop="scheduleZone" @event3="changeWeekDay">
  174. <div class="position">
  175. <div>
  176. <el-tabs v-model="activeName" :tab-position="tabPosition" ref="elTabs" @tab-click="historyclick">
  177. <el-tab-pane name="beforeWeek">
  178. <span slot="label"><i class="el-icon-date"></i> 上上周 ({{ theWeek.historyWeek }})</span>
  179. </el-tab-pane>
  180. <el-tab-pane name="lastWeek">
  181. <span slot="label"><i class="el-icon-date"></i> 上周 ({{ theWeek.lastWeek }})</span>
  182. </el-tab-pane>
  183. <el-tab-pane name="thisWeek">
  184. <span slot="label"><i class="el-icon-date"></i> 本周 ({{ theWeek.thisWeek }})</span>
  185. </el-tab-pane>
  186. <el-tab-pane name="nextWeek">
  187. <span slot="label"><i class="el-icon-date"></i> 下一周 ({{ theWeek.nextWeek }})</span>
  188. </el-tab-pane>
  189. <el-tab-pane name="nextTwoWeek">
  190. <span slot="label"><i class="el-icon-date"></i> 下下周 ({{ theWeek.nextTwoWeek }})</span>
  191. </el-tab-pane>
  192. </el-tabs>
  193. </div>
  194. <div style="display:flex;align-items:center">
  195. <el-button type="primary" size="small" icon="el-icon-printer" @click="printScheduleAction">打印排班</el-button>
  196. <el-button v-if="isShow()" type="primary" size="small" @click="export_file()" :loading="downloadLoading">
  197. 导出排班
  198. </el-button>
  199. <el-button
  200. @click="generateLog()"
  201. class="filter-item"
  202. type="primary"
  203. v-if="is_edit"
  204. size="small"
  205. >下载日志
  206. </el-button>
  207. <el-button type="primary" size="small" icon="el-icon-setting" @click="setScheduleTemplateAction">排班模板
  208. </el-button>
  209. <el-button type="primary" size="small" @click="copySchedule" v-if="is_edit">复制排班</el-button>
  210. <el-button type="primary" size="small" v-if="is_edit" @click="smartsch">智能排班</el-button>
  211. <el-button type="primary" size="small" v-if="!is_edit" @click="editsch">编辑排班</el-button>
  212. <el-button type="danger" size="small" v-if="is_edit" @click="outisedit">退出编辑</el-button>
  213. </div>
  214. </div>
  215. </beforeweekTable>
  216. <!-- 历史 -->
  217. <HistoryWeekTable v-show="showtable" ref="tableDataZero" :week-time="activeName" :partitions-prop="partitions"
  218. :schedule-zone-row-prop="scheduleZoneRow"
  219. :schedule-zone-prop="scheduleZone" title="" >
  220. </HistoryWeekTable>
  221. <el-dialog title="复制排班" width="600px" :visible.sync="newVisible">
  222. <el-form :model="form" ref="form" label-width="90px" :rules="rules">
  223. <el-form-item label="周次:">
  224. <el-radio v-model="form.lastweek" label="1">上周排班信息</el-radio>
  225. <el-radio v-model="form.lastweek" label="2">本周排班信息</el-radio>
  226. </el-form-item>
  227. <el-form-item label="复制到 : " required prop="copyWeek">
  228. <el-select v-model="form.copyWeek" placeholder="请选择">
  229. <el-option
  230. v-for="item in typeOptions"
  231. :key="item.value"
  232. :label="item.label"
  233. :value="item.value">
  234. </el-option>
  235. </el-select>
  236. </el-form-item>
  237. </el-form>
  238. <div slot="footer" class="dialog-footer">
  239. <el-button @click="newVisible=false">取 消</el-button>
  240. <el-button v-loading="copySchLoading" type="primary" @click="submitAction('form')">保 存</el-button>
  241. </div>
  242. </el-dialog>
  243. </div>
  244. </div>
  245. </template>
  246. <script>
  247. import moment from 'moment'
  248. import {parseTime} from '@/utils'
  249. import tableData from './components/tableData'
  250. import {
  251. copyPatientSchedule,
  252. exportSchedule,
  253. getScheduleTemplate,
  254. getThreeWeekList,
  255. getWeekPanels,
  256. initDate,
  257. getAllZones
  258. } from '@/api/schedule'
  259. import {
  260. patientLists
  261. } from '@/api/schedule_template/sch_template'
  262. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  263. import UploadExcel from '@/xt_pages/components/UploadExcel'
  264. import ScheduleUploadExcel from './components/scheduleUploadExcel/index'
  265. import {generateLog} from '@/api/config'
  266. import {uParseTime} from '@/utils/tools'
  267. import EditTableData from "./components/editTableData";
  268. import HistoryWeekTable from './components/historyWeekTable'
  269. import beforeweekTable from './components/beforeweekTable'
  270. export default {
  271. name: 'appointment',
  272. data() {
  273. return {
  274. options:[
  275. {id:0,name:"全部"},
  276. {id:1,name:"上午"},
  277. {id:2,name:"下午"},
  278. {id:3,name:"晚上"},
  279. ],
  280. patientList:[],
  281. scheduleType: [
  282. { id: 1, name: "上午" },
  283. { id: 2, name: "下午" },
  284. { id: 3, name: "晚上" }
  285. ],weekType:[
  286. { id: 1, name: "周一" },
  287. { id: 2, name: "周二" },
  288. { id: 3, name: "周三" },
  289. { id: 4, name: "周四" },
  290. { id: 5, name: "周五" },
  291. { id: 6, name: "周六" },
  292. { id: 7, name: "周日" },
  293. ],
  294. query_date:"",
  295. query_sch_type:"",
  296. query_week_type:"",
  297. query_zone:"",
  298. crumbs: [
  299. {path: false, name: '排班管理'},
  300. {path: '/workforce/appointment', name: '排班管理'}
  301. ],
  302. activeName: 'thisWeek',
  303. tabPosition: 'top',
  304. partitions: {},
  305. scheduleZone: [],
  306. days: [],
  307. logs: [],
  308. showtable:false,
  309. showtableOne:true,
  310. is_edit: false,
  311. schedulingTableVisible:false,//全屏
  312. scheduleZoneRow: [],
  313. downloadLoading: false,
  314. msgTipVisible: false,
  315. dialogVisible: false,
  316. isExistRepeatVisible: false,
  317. exportVisible: false,
  318. exportLogVisible: false,
  319. beforeshow:false,//编辑页面的上上周
  320. // 周期
  321. theWeek: {
  322. historyWeek:0,
  323. lastWeek: 0,
  324. thisWeek: 0,
  325. nextWeek: 0,
  326. nextTwoWeek: 0
  327. },
  328. tableList: [],
  329. weekTime: "",
  330. schedule_type: 0,
  331. partition_id: 0,
  332. zones: [],
  333. start_time: "",
  334. end_time: "",
  335. export_type: 0,
  336. form: {
  337. lastweek: "1",
  338. copyWeek: "",
  339. },
  340. newVisible: false,
  341. copySchLoading:false,
  342. typeOptions: [],
  343. timeOptions: [],
  344. copyWeek: '',
  345. weekList: [],
  346. currentFirstDate1: '',
  347. rules: {
  348. copyWeek: [{required: true, message: "请选择复制时间段", trigger: "blur"}],
  349. },
  350. weekNum: '',
  351. weekDayArr: [],
  352. todayDate: '',
  353. clen: 7,
  354. nowYear: new Date().getFullYear(),
  355. schedule_week: 0,
  356. newDay: [],
  357. templateObj: {},
  358. week_date:"",
  359. guanliu_show:false,
  360. }
  361. },
  362. components: {
  363. EditTableData,
  364. ScheduleUploadExcel,
  365. tableData,
  366. BreadCrumb,
  367. UploadExcel,
  368. HistoryWeekTable,
  369. beforeweekTable
  370. },
  371. methods: {
  372. //
  373. guanliu(value){
  374. this.guanliu_show=value
  375. console.log('1111',value);
  376. this.getThreeWeekList()
  377. },
  378. handleClick(e,tab){
  379. if(e.name == 'historyWeek'){
  380. this.showtable=true
  381. this.showtableOne=false
  382. this.$nextTick(() => {
  383. this.$refs.tableDataZero.start()
  384. })
  385. // console.log('12343545',this.$refs.tableDataZero);
  386. }else{
  387. this.showtable=false
  388. this.showtableOne=true
  389. }
  390. },
  391. // 打开编辑上上周
  392. historyclick(e){
  393. console.log('vvvvwwww',e);
  394. if(e.name=='beforeWeek'){
  395. console.log('gggggwerwe');
  396. this.beforeshow=true
  397. this.schedulingTableVisible=false
  398. this.$nextTick(function() {//, this.days,this.zones
  399. this.$refs.beforeweeks.setEditData(this.patientList, this.$store.getters.treatment_mode, this.days,this.zones)
  400. })
  401. }else{
  402. this.beforeshow=false
  403. this.schedulingTableVisible=true
  404. }
  405. },
  406. dragstart(event, item) {
  407. // console.log('start的索引',item.moveIndex)
  408. // 开始移动的时候将移动的索引值+图片的url存储下来
  409. },
  410. dragend(event,item) {
  411. // console.log('dragend',item)
  412. },
  413. getAllZones(){
  414. getAllZones().then(response=>{
  415. if(response.data.state == 1){
  416. var zones = response.data.data.zones
  417. this.zones = zones
  418. }
  419. })
  420. },
  421. compare(p) { //这是比较函数
  422. return function (m, n) {
  423. var a = m[p];
  424. var b = n[p];
  425. return a - b; //升序
  426. }
  427. },
  428. // printTable(){
  429. // this.$router.push({path: '/scheduleTablePrint?partition_id='+this.partition_id+"&weekTime="+this.activeName})
  430. // },
  431. generateTxt: function (log) {
  432. var content = ''
  433. var errlog = log.err_logs
  434. content = this.getContent(log)
  435. for (let i = 0; i < errlog.length; i++) {
  436. if (content.length == 0) {
  437. content = errlog[i].err_msg
  438. } else {
  439. content = content + '\n' + errlog[i].err_msg
  440. }
  441. }
  442. var url = new Blob(['\ufeff' + content], {type: 'text/txt,charset=UTF-8'})
  443. if (typeof url === 'object' && url instanceof Blob) {
  444. url = URL.createObjectURL(url) // 创建blob地址
  445. }
  446. const aLink = document.createElement('a')
  447. aLink.href = url
  448. aLink.download = this.timestampToTime(log.export_time) + '临时排班导入日志.txt'
  449. aLink.click()
  450. },
  451. timestampToTime(timestamp) {
  452. var date = new Date(timestamp * 1000)//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  453. var Y = date.getFullYear() + '年'
  454. var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '月'
  455. var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + '日 '
  456. var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + '时'
  457. var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + '分'
  458. var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds()) + '秒'
  459. return Y + M + D + h + m + s
  460. },
  461. getContent(log) {
  462. return '您导入的文档共' + log.total_num + '条患者数据' + ',' + '已成功导入' + log.success_num + '条,导入失败' + log.fail_num + '条,'
  463. },
  464. generateLog() {
  465. let params = {
  466. 'log_type': 2
  467. }
  468. generateLog(params).then(
  469. response => {
  470. if (response.data.state === 1) {
  471. this.logs = response.data.data.logs
  472. this.exportLogVisible = true
  473. } else {
  474. this.$message.error(response.data.msg)
  475. }
  476. }
  477. )
  478. },
  479. getWeekPanels() {
  480. // this.scheduleZoneRow = []
  481. // this.scheduleZone = []
  482. getWeekPanels(1, this.partition_id).then(response => {
  483. if (response.data.state == 0) {
  484. return false
  485. }
  486. var partitions = response.data.data.partitions
  487. console.log("分区",response.data.data)
  488. this.theWeek.thisWeek = response.data.data.theWeek
  489. this.theWeek.lastWeek = response.data.data.theLastWeek
  490. this.theWeek.nextWeek = response.data.data.theNextWeek
  491. this.theWeek.nextTwoWeek = response.data.data.theNextSecWeek
  492. this.theWeek.historyWeek = response.data.data.theWeek - 2
  493. // 在控制变量改变的时候进行 强制渲染更新
  494. let childrenRefs = this.$refs.elTabs.$children
  495. this.$nextTick(() => {
  496. childrenRefs.forEach(child => child.$forceUpdate())
  497. })
  498. var that = this
  499. if (partitions.length > 0) {
  500. let arrSort = []
  501. partitions.forEach((item) => {
  502. let num = Math.max.apply(Math, item.jihaos.map(function (o) {
  503. return o.sort
  504. }))
  505. item.sort = num
  506. arrSort.push(item)
  507. })
  508. arrSort.sort(this.compare('sort'))
  509. partitions = arrSort
  510. partitions.forEach(function (partition) {
  511. if (partition.jihaos.length == 0) {
  512. return false
  513. }
  514. that.scheduleZoneRow.push(partition.jihaos.length)
  515. that.partitions[partition.id] = partition
  516. partition.jihaos.forEach(function (jihao) {
  517. var thisPa = {
  518. area: partition.name,
  519. zone_id: partition.id,
  520. zone_type: partition.type,
  521. cut: jihao.number,
  522. jihao_id: jihao.id,
  523. Mon_M: {
  524. schedule_id: 0,
  525. mode_id: 0,
  526. mode_name: '',
  527. dialysis_machine_name:"",
  528. patient_id: 0,
  529. patient: '',
  530. zone_id:partition.id,
  531. jihao_id: jihao.id,
  532. },
  533. Mon_A: {
  534. schedule_id: 0,
  535. mode_id: 0,
  536. mode_name: '',
  537. dialysis_machine_name:"",
  538. patient_id: 0,
  539. patient: '',
  540. zone_id:partition.id,
  541. jihao_id: jihao.id,
  542. },
  543. Mon_N: {
  544. schedule_id: 0,
  545. mode_id: 0,
  546. mode_name: '',
  547. patient_id: 0,
  548. dialysis_machine_name:"",
  549. patient: '',
  550. zone_id:partition.id,
  551. jihao_id: jihao.id,
  552. },
  553. Tue_M: {
  554. schedule_id: 0,
  555. mode_id: 0,
  556. mode_name: '',
  557. dialysis_machine_name:"",
  558. patient_id: 0,
  559. patient: '',
  560. zone_id:partition.id,
  561. jihao_id: jihao.id,
  562. },
  563. Tue_A: {
  564. schedule_id: 0,
  565. mode_id: 0,
  566. mode_name: '',
  567. dialysis_machine_name:"",
  568. patient_id: 0,
  569. patient: '',
  570. zone_id:partition.id,
  571. jihao_id: jihao.id,
  572. },
  573. Tue_N: {
  574. schedule_id: 0,
  575. mode_id: 0,
  576. mode_name: '',
  577. patient_id: 0,
  578. dialysis_machine_name:"",
  579. patient: '',
  580. zone_id:partition.id,
  581. jihao_id: jihao.id,
  582. },
  583. Wed_M: {
  584. schedule_id: 0,
  585. mode_id: 0,
  586. mode_name: '',
  587. patient_id: 0,
  588. dialysis_machine_name:"",
  589. patient: '',
  590. zone_id:partition.id,
  591. jihao_id: jihao.id,
  592. },
  593. Wed_A: {
  594. schedule_id: 0,
  595. mode_id: 0,
  596. mode_name: '',
  597. patient_id: 0,
  598. dialysis_machine_name:"",
  599. patient: '',
  600. zone_id:partition.id,
  601. jihao_id: jihao.id,
  602. },
  603. Wed_N: {
  604. schedule_id: 0,
  605. mode_id: 0,
  606. mode_name: '',
  607. patient_id: 0,
  608. dialysis_machine_name:"",
  609. patient: '',
  610. zone_id:partition.id,
  611. jihao_id: jihao.id,
  612. },
  613. Thurs_M: {
  614. schedule_id: 0,
  615. mode_id: 0,
  616. mode_name: '',
  617. patient_id: 0,
  618. dialysis_machine_name:"",
  619. patient: '',
  620. zone_id:partition.id,
  621. jihao_id: jihao.id,
  622. },
  623. Thurs_A: {
  624. schedule_id: 0,
  625. mode_id: 0,
  626. mode_name: '',
  627. patient_id: 0,
  628. dialysis_machine_name:"",
  629. patient: '',
  630. zone_id:partition.id,
  631. jihao_id: jihao.id,
  632. },
  633. Thurs_N: {
  634. schedule_id: 0,
  635. mode_id: 0,
  636. mode_name: '',
  637. patient_id: 0,
  638. dialysis_machine_name:"",
  639. patient: '',
  640. zone_id:partition.id,
  641. jihao_id: jihao.id,
  642. },
  643. Fri_M: {
  644. schedule_id: 0,
  645. mode_id: 0,
  646. mode_name: '',
  647. dialysis_machine_name:"",
  648. patient_id: 0,
  649. patient: '',
  650. zone_id:partition.id,
  651. jihao_id: jihao.id,
  652. },
  653. Fri_A: {
  654. schedule_id: 0,
  655. mode_id: 0,
  656. mode_name: '',
  657. dialysis_machine_name:"",
  658. patient_id: 0,
  659. patient: '',
  660. zone_id:partition.id,
  661. jihao_id: jihao.id,
  662. },
  663. Fri_N: {
  664. schedule_id: 0,
  665. mode_id: 0,
  666. mode_name: '',
  667. patient_id: 0,
  668. dialysis_machine_name:"",
  669. patient: '',
  670. zone_id:partition.id,
  671. jihao_id: jihao.id,
  672. },
  673. Sat_M: {
  674. schedule_id: 0,
  675. mode_id: 0,
  676. mode_name: '',
  677. patient_id: 0,
  678. dialysis_machine_name:"",
  679. patient: '',
  680. zone_id:partition.id,
  681. jihao_id: jihao.id,
  682. },
  683. Sat_A: {
  684. schedule_id: 0,
  685. mode_id: 0,
  686. mode_name: '',
  687. dialysis_machine_name:"",
  688. patient_id: 0,
  689. patient: '',
  690. zone_id:partition.id,
  691. jihao_id: jihao.id,
  692. },
  693. Sat_N: {
  694. schedule_id: 0,
  695. mode_id: 0,
  696. mode_name: '',
  697. patient_id: 0,
  698. dialysis_machine_name:"",
  699. patient: '',
  700. zone_id:partition.id,
  701. jihao_id: jihao.id,
  702. },
  703. Sun_A: {
  704. schedule_id: 0,
  705. mode_id: 0,
  706. mode_name: '',
  707. patient_id: 0,
  708. dialysis_machine_name:"",
  709. patient: '',
  710. zone_id:partition.id,
  711. jihao_id: jihao.id,
  712. },
  713. Sun_N: {
  714. schedule_id: 0,
  715. mode_id: 0,
  716. mode_name: '',
  717. dialysis_machine_name:"",
  718. patient_id: 0,
  719. patient: '',
  720. zone_id:partition.id,
  721. jihao_id: jihao.id,
  722. },
  723. Sun_M: {
  724. schedule_id: 0,
  725. mode_id: 0,
  726. mode_name: '',
  727. dialysis_machine_name:"",
  728. patient_id: 0,
  729. patient: '',
  730. zone_id:partition.id,
  731. jihao_id: jihao.id,
  732. },
  733. total: 0
  734. }
  735. that.scheduleZone.push(thisPa)
  736. })
  737. })
  738. }
  739. // console.log("111111111")
  740. console.log(that.scheduleZone)
  741. })
  742. },
  743. changeSch(val){
  744. // console.log(this.partitions)
  745. // console.log(this.scheduleZoneRow)
  746. // console.log(this.scheduleZone)
  747. },
  748. changeWeekType(val){
  749. },
  750. changeZone(val){
  751. },
  752. setScheduleTemplateAction: function () {
  753. this.schedulingTableVisible=true
  754. this.$router.push({path: '/workforce/template'})
  755. },
  756. export_file: function () {
  757. // this.getThreeWeekList()
  758. if(this.$refs.tableData.value1==false){
  759. this.guanliu_show=false
  760. // this.export_file_step_two()
  761. }else{
  762. this.guanliu_show=true
  763. // this.export_file_step_two()
  764. }
  765. // this.getWeekPanelsTwo()
  766. this.export_file_step_two()
  767. },
  768. export_file_step_two: function(){
  769. this.downloadLoading = true
  770. import('@/vendor/Export2Excel').then(excel => {
  771. const filterVal = [
  772. '区号',
  773. '机号'
  774. ]
  775. if (this.export_type == 0) {
  776. const multiHeader = [['区号', '机号', '周一' + "(" + this.days[0] + ")", '', '', '周二' + "(" + this.days[1] + ")", '', '', '周三' + "(" + this.days[2] + ")", '', '', '周四' + "(" + this.days[3] + ")", '', '', '周五' + "(" + this.days[4] + ")", '', '', '周六' + "(" + this.days[5] + ")", '', '', '周日' + "(" + this.days[6] + ")", '', '', '周一' + "(" + this.days[7] + ")", '', '', '周二' + "(" + this.days[8] + ")", '', '', '周三' + "(" + this.days[9] + ")", '', '', '周四' + "(" + this.days[10] + ")", '', '', '周五' + "(" + this.days[11] + ")", '', '', '周六' + "(" + this.days[12] + ")", '', '', '周日' + "(" + this.days[13] + ")", '', '', '周一' + "(" + this.days[14] + ")", '', '', '周二' + "(" + this.days[15] + ")", '', '', '周三' + "(" + this.days[16] + ")", '', '', '周四' + "(" + this.days[17] + ")", '', '', '周五' + "(" + this.days[18] + ")", '', '', '周六' + "(" + this.days[19] + ")", '', '', '周日' + "(" + this.days[20] + ")", '', '']]
  777. const header = ['', '', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上']
  778. const merges = ['A1:A2', 'B1:B2', 'C1:E1', 'F1:H1', 'I1:K1', 'L1:N1', 'O1:Q1', 'R1:T1', 'U1:W1', 'X1:Z1', 'AA1:AC1', 'AD1:AF1', 'AG1:AI1', 'AJ1:AL1', 'AM1:AO1', 'AP1:AR1', 'AS1:AU1', 'AV1:AX1', 'AY1:BA1', 'BB1:BD1', 'BE1:BG1', 'BH1:BJ1', 'BK1:BM1']
  779. var list = []
  780. let i = 0
  781. for (let key in this.partitions) {
  782. var tempValue
  783. var jihaos = this.partitions[key].jihaos
  784. if (i == 0) {
  785. let m = 'A3' + ':' + 'A' + (2 + jihaos.length)
  786. tempValue = (2 + jihaos.length)
  787. merges.push(m)
  788. } else {
  789. let m = 'A' + (tempValue + 1) + ':' + 'A' + ((tempValue + 1) + jihaos.length - 1)
  790. tempValue = ((tempValue + 1) + jihaos.length - 1)
  791. merges.push(m)
  792. }
  793. for (let b = 0; b < jihaos.length; b++) {
  794. let obj = {}
  795. obj['区号'] = this.partitions[key].name
  796. obj['机号'] = jihaos[b].number.toString()
  797. list.push(obj)
  798. }
  799. i++
  800. }
  801. var data = []
  802. this.tableList.map(item => {
  803. data.push(Object.values(item))
  804. })
  805. const filename = '排班模版'
  806. console.log('333333333',this.tableList),
  807. excel.export_json_to_excel({
  808. multiHeader,
  809. header,
  810. merges,
  811. data,
  812. filename
  813. })
  814. this.downloadLoading = false
  815. }
  816. if (this.export_type == 1) {
  817. const multiHeader = [['区号', '机号', '周一' + "(" + this.newDay[0] + ")", '', '', '周二' + "(" + this.newDay[1] + ")", '', '', '周三' + "(" + this.newDay[2] + ")", '', '', '周四' + "(" + this.newDay[3] + ")", '', '', '周五' + "(" + this.newDay[4] + ")", '', '', '周六' + "(" + this.newDay[5] + ")", '', '', '周日' + "(" + this.newDay[6] + ")", '', '']]
  818. const header = ['', '', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上']
  819. const merges = ['A1:A2', 'B1:B2', 'C1:E1', 'F1:H1', 'I1:K1', 'L1:N1', 'O1:Q1', 'R1:T1', 'U1:W1', 'X1:Z1', 'AA1:AC1', 'AD1:AF1', 'AG1:AI1', 'AJ1:AL1', 'AM1:AO1', 'AP1:AR1', 'AS1:AU1', 'AV1:AX1', 'AY1:BA1', 'BB1:BD1', 'BE1:BG1', 'BH1:BJ1', 'BK1:BM1']
  820. var list = []
  821. let i = 0
  822. for (let key in this.partitions) {
  823. var tempValue
  824. var jihaos = this.partitions[key].jihaos
  825. if (i == 0) {
  826. let m = 'A3' + ':' + 'A' + (2 + jihaos.length)
  827. tempValue = (2 + jihaos.length)
  828. merges.push(m)
  829. } else {
  830. let m = 'A' + (tempValue + 1) + ':' + 'A' + ((tempValue + 1) + jihaos.length - 1)
  831. tempValue = ((tempValue + 1) + jihaos.length - 1)
  832. merges.push(m)
  833. }
  834. for (let b = 0; b < jihaos.length; b++) {
  835. let obj = {}
  836. obj['区号'] = this.partitions[key].name
  837. obj['机号'] = jihaos[b].number.toString()
  838. list.push(obj)
  839. }
  840. i++
  841. }
  842. var data = []
  843. this.tableList.map(item => {
  844. data.push(Object.values(item))
  845. })
  846. const filename = '排班模版'
  847. if (this.$store.getters.xt_user.org.id == 10234) {
  848. excel.export_json_to_excel1({
  849. multiHeader,
  850. header,
  851. merges,
  852. data,
  853. filename,
  854. ref: this.$refs['tableData'].$refs['table'].$el
  855. })
  856. } else {
  857. excel.export_json_to_excel({
  858. multiHeader,
  859. header,
  860. merges,
  861. data,
  862. filename
  863. })
  864. }
  865. this.downloadLoading = false
  866. }
  867. })
  868. },
  869. export_fileTwo: function () {
  870. import('@/vendor/Export2Excel').then(excel => {
  871. const filterVal = [
  872. '区号',
  873. '机号'
  874. ]
  875. const multiHeader = [['区号', '机号', '周一' + "(" + this.days[0] + ")", '', '', '周二' + "(" + this.days[1] + ")", '', '', '周三' + "(" + this.days[2] + ")", '', '', '周四' + "(" + this.days[3] + ")", '', '', '周五' + "(" + this.days[4] + ")", '', '', '周六' + "(" + this.days[5] + ")", '', '', '周日' + "(" + this.days[6] + ")", '', '', '周一' + "(" + this.days[7] + ")", '', '', '周二' + "(" + this.days[8] + ")", '', '', '周三' + "(" + this.days[9] + ")", '', '', '周四' + "(" + this.days[10] + ")", '', '', '周五' + "(" + this.days[11] + ")", '', '', '周六' + "(" + this.days[12] + ")", '', '', '周日' + "(" + this.days[13] + ")", '', '', '周一' + "(" + this.days[14] + ")", '', '', '周二' + "(" + this.days[15] + ")", '', '', '周三' + "(" + this.days[16] + ")", '', '', '周四' + "(" + this.days[17] + ")", '', '', '周五' + "(" + this.days[18] + ")", '', '', '周六' + "(" + this.days[19] + ")", '', '', '周日' + "(" + this.days[20] + ")", '', '']]
  876. const header = ['', '', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上']
  877. const merges = ['A1:A2', 'B1:B2', 'C1:E1', 'F1:H1', 'I1:K1', 'L1:N1', 'O1:Q1', 'R1:T1', 'U1:W1', 'X1:Z1', 'AA1:AC1', 'AD1:AF1', 'AG1:AI1', 'AJ1:AL1', 'AM1:AO1', 'AP1:AR1', 'AS1:AU1', 'AV1:AX1', 'AY1:BA1', 'BB1:BD1', 'BE1:BG1', 'BH1:BJ1', 'BK1:BM1']
  878. var data = []
  879. // console.log("33333",this.tableList)
  880. this.tableList.map(item => {
  881. data.push(Object.values(item))
  882. })
  883. const filename = '排班模版'
  884. excel.export_json_to_excel({
  885. multiHeader,
  886. header,
  887. merges,
  888. data,
  889. filename
  890. })
  891. })
  892. },
  893. // formatJson(filterVal, jsonData) {
  894. // return jsonData.map(v => filterVal.map(j => v[j]))
  895. // },
  896. formatJson(filterVal, jsonData) {
  897. return jsonData.map(v =>
  898. filterVal.map(j => {
  899. if (j === 'timestamp') {
  900. return parseTime(v[j])
  901. } else {
  902. return v[j]
  903. }
  904. })
  905. )
  906. },
  907. printScheduleAction: function () {
  908. var date = new Date().getTime()
  909. if(this.activeName == 'historyWeek'){
  910. date = date - 14 * 24 * 60 * 60 * 1000
  911. }else if (this.activeName == 'lastWeek') {
  912. date = date - 7 * 24 * 60 * 60 * 1000
  913. } else if (this.activeName == 'nextWeek') {
  914. date = date + 7 * 24 * 60 * 60 * 1000
  915. } else if (this.activeName == 'nextTwoWeek') {
  916. date = date + 14 * 24 * 60 * 60 * 1000
  917. }
  918. console.log("whhwhwhwhwhwh",date)
  919. console.log("this.templateObj.template_id == 1",this.templateObj.template_id)
  920. console.log("week2333333333333333",this.week_date)
  921. console.log("woowowowow",this.schedule_type)
  922. if (this.templateObj.template_id == 1) {
  923. this.$router.push({path: '/workforce/schedule/print', query: {date: date}})
  924. }
  925. if (this.templateObj.template_id == 2) {
  926. this.$router.push({path: '/scheduleTablePrint?partition_id=' + this.partition_id + "&weekTime=" + this.activeName+"&week_date="+this.week_date+"&schedule_type="+this.schedule_type})
  927. }
  928. if (this.templateObj.template_id == 3) {
  929. this.$router.push({path: '/scheduleTablePrintOne?partition_id=' + this.partition_id + "&weekTime=" + this.activeName+"&week_date="+this.week_date+"&schedule_type="+this.schedule_type})
  930. }
  931. if(this.templateObj.template_id == 4){
  932. this.$router.push({path: '/scheduleTablePrintTwo?partition_id=' + this.partition_id + "&weekTime=" + this.activeName+"&week_date="+this.week_date+"&schedule_type="+this.schedule_type})
  933. }
  934. if(this.templateObj.template_id == 5){
  935. this.$router.push({path: '/scheduleTablePrintFive?partition_id=' + this.partition_id + "&weekTime=" + this.activeName+"&week_date="+this.week_date+"&schedule_type="+this.schedule_type})
  936. }
  937. // +"&schedule_type"+scheduleTablePrintFive
  938. },
  939. printScheduleActionOne:function(){
  940. var start_time = this.$refs.tableDataZero.start_time
  941. var end_time = this.$refs.tableDataZero.end_time
  942. var partition_id = this.$refs.tableDataZero.partition_id
  943. var nextTwoWeek = "nextTwoWeek"
  944. var week_date = []
  945. this.$router.push({path:'/scheduleTablePrintThree?partition_id='+partition_id+"&weekTime="+nextTwoWeek+"&week_date="+week_date+"&start_time="+start_time+"&end_time="+end_time})
  946. },
  947. printScheduleActionTwo:function(){
  948. var date = new Date().getTime()
  949. if(this.activeName == 'historyWeek'){
  950. date = date - 14 * 24 * 60 * 60 * 1000
  951. }else if (this.activeName == 'lastWeek') {
  952. date = date - 7 * 24 * 60 * 60 * 1000
  953. } else if (this.activeName == 'nextWeek') {
  954. date = date + 7 * 24 * 60 * 60 * 1000
  955. } else if (this.activeName == 'nextTwoWeek') {
  956. date = date + 14 * 24 * 60 * 60 * 1000
  957. }
  958. this.$router.push({path: '/scheduleTablePrintSix?partition_id=' + this.partition_id + "&weekTime=" + this.activeName+"&week_date="+this.week_date+"&schedule_type="+this.schedule_type})
  959. },
  960. isShow() {
  961. let isShow = false
  962. if (Object.keys(this.partitions).length != 0) {
  963. isShow = true
  964. let i = 0
  965. for (let key in this.partitions) {
  966. if (i == 0) {
  967. if (this.partitions[key].jihaos.length > 0) {
  968. isShow = true
  969. }
  970. }
  971. i++
  972. }
  973. }
  974. return isShow
  975. },
  976. handleSuccess({results, header}) {
  977. let headers = []
  978. for (let key in results[0]) {
  979. headers.push(key)
  980. }
  981. if (header.length == 65) {
  982. var isHas_1 = headers.includes('区号')
  983. var isHas_2 = headers.includes('机号')
  984. var isHas_3 = headers.includes('周一' + "(" + this.days[0] + ")")
  985. var isHas_4 = headers.includes('')
  986. var isHas_5 = headers.includes('_1')
  987. var isHas_6 = headers.includes('周二' + "(" + this.days[1] + ")")
  988. var isHas_7 = headers.includes('_2')
  989. var isHas_8 = headers.includes('_3')
  990. var isHas_9 = headers.includes('周三' + "(" + this.days[2] + ")")
  991. var isHas_10 = headers.includes('_4')
  992. console.log("10" + isHas_10)
  993. var isHas_11 = headers.includes('_5')
  994. console.log("11" + isHas_11)
  995. var isHas_12 = headers.includes('周四' + "(" + this.days[3] + ")")
  996. console.log("12" + isHas_12)
  997. var isHas_13 = headers.includes('_6')
  998. console.log("13" + isHas_13)
  999. var isHas_14 = headers.includes('_7')
  1000. console.log("14" + isHas_14)
  1001. var isHas_15 = headers.includes('周五' + "(" + this.days[4] + ")")
  1002. console.log("15" + isHas_15)
  1003. var isHas_16 = headers.includes('_8')
  1004. console.log("16" + isHas_16)
  1005. var isHas_17 = headers.includes('_9')
  1006. console.log("17" + isHas_17)
  1007. var isHas_18 = headers.includes('周六' + "(" + this.days[5] + ")")
  1008. console.log("18" + isHas_18)
  1009. var isHas_19 = headers.includes('_10')
  1010. console.log("19" + isHas_19)
  1011. var isHas_20 = headers.includes('_11')
  1012. console.log("20" + isHas_20)
  1013. var isHas_21 = headers.includes('周日' + "(" + this.days[6] + ")")
  1014. console.log("21" + isHas_21)
  1015. var isHas_22 = headers.includes('_12')
  1016. console.log("22" + isHas_22)
  1017. var isHas_23 = headers.includes('_13')
  1018. console.log("23" + isHas_23)
  1019. var isHas_24 = headers.includes('周一' + "(" + this.days[7] + ")")
  1020. console.log("24" + isHas_24)
  1021. var isHas_25 = headers.includes('_14')
  1022. console.log("25" + isHas_25)
  1023. var isHas_26 = headers.includes('_15')
  1024. console.log("26" + isHas_26)
  1025. var isHas_27 = headers.includes('周二' + "(" + this.days[8] + ")")
  1026. console.log("27" + isHas_27)
  1027. var isHas_28 = headers.includes('_16')
  1028. console.log("28" + isHas_28)
  1029. var isHas_29 = headers.includes('_17')
  1030. console.log("29" + isHas_29)
  1031. var isHas_30 = headers.includes('周三' + "(" + this.days[9] + ")")
  1032. console.log("30" + isHas_30)
  1033. var isHas_31 = headers.includes('_18')
  1034. console.log("31" + isHas_31)
  1035. var isHas_32 = headers.includes('_19')
  1036. console.log("32" + isHas_32)
  1037. var isHas_33 = headers.includes('周四' + "(" + this.days[10] + ")")
  1038. console.log("33" + isHas_33)
  1039. var isHas_34 = headers.includes('_20')
  1040. console.log("34" + isHas_34)
  1041. var isHas_35 = headers.includes('_21')
  1042. console.log("35" + isHas_35)
  1043. var isHas_36 = headers.includes('周五' + "(" + this.days[11] + ")")
  1044. console.log("36" + isHas_36)
  1045. var isHas_37 = headers.includes('_22')
  1046. console.log("37" + isHas_37)
  1047. var isHas_38 = headers.includes('_23')
  1048. console.log("38" + isHas_38)
  1049. var isHas_39 = headers.includes('周六' + "(" + this.days[12] + ")")
  1050. console.log("39" + isHas_39)
  1051. var isHas_40 = headers.includes('_24')
  1052. console.log("40" + isHas_40)
  1053. var isHas_41 = headers.includes('_25')
  1054. console.log("41" + isHas_41)
  1055. var isHas_42 = headers.includes('周日' + "(" + this.days[13] + ")")
  1056. console.log("42" + isHas_42)
  1057. var isHas_43 = headers.includes('_26')
  1058. console.log("43" + isHas_43)
  1059. var isHas_44 = headers.includes('_27')
  1060. console.log("44" + isHas_44)
  1061. var isHas_45 = headers.includes('周一' + "(" + this.days[14] + ")")
  1062. console.log("45" + isHas_45)
  1063. var isHas_46 = headers.includes('_28')
  1064. console.log("46" + isHas_46)
  1065. var isHas_47 = headers.includes('_29')
  1066. console.log("47" + isHas_47)
  1067. var isHas_48 = headers.includes('周二' + "(" + this.days[15] + ")")
  1068. console.log("48" + isHas_48)
  1069. var isHas_49 = headers.includes('_30')
  1070. console.log("49" + isHas_49)
  1071. var isHas_50 = headers.includes('_31')
  1072. console.log("50" + isHas_50)
  1073. var isHas_51 = headers.includes('周三' + "(" + this.days[16] + ")")
  1074. console.log("51" + isHas_51)
  1075. var isHas_52 = headers.includes('_32')
  1076. console.log("52" + isHas_52)
  1077. var isHas_53 = headers.includes('_33')
  1078. console.log("53" + isHas_53)
  1079. var isHas_54 = headers.includes('周四' + "(" + this.days[17] + ")")
  1080. console.log("54" + isHas_54)
  1081. var isHas_55 = headers.includes('_34')
  1082. console.log("55" + isHas_55)
  1083. var isHas_56 = headers.includes('_35')
  1084. console.log("56" + isHas_56)
  1085. var isHas_57 = headers.includes('周五' + "(" + this.days[18] + ")")
  1086. console.log("57" + isHas_57)
  1087. var isHas_58 = headers.includes('_36')
  1088. console.log("58" + isHas_58)
  1089. var isHas_59 = headers.includes('_37')
  1090. console.log("59" + isHas_59)
  1091. var isHas_60 = headers.includes('周六' + "(" + this.days[19] + ")")
  1092. console.log("60" + isHas_60)
  1093. var isHas_61 = headers.includes('_38')
  1094. console.log("61" + isHas_61)
  1095. var isHas_62 = headers.includes('_39')
  1096. console.log("62" + isHas_62)
  1097. var isHas_63 = headers.includes('周日' + "(" + this.days[20] + ")")
  1098. console.log("63" + isHas_63)
  1099. var isHas_64 = headers.includes('_40')
  1100. console.log("64" + isHas_64)
  1101. var isHas_65 = headers.includes('_41')
  1102. console.log("65" + isHas_65)
  1103. if (!(isHas_1 && isHas_2 && isHas_3 && isHas_4 && isHas_5 &&
  1104. isHas_6 && isHas_7 && isHas_8 && isHas_9 && isHas_10 &&
  1105. isHas_11 && isHas_12 && isHas_13 && isHas_14 && isHas_15 &&
  1106. isHas_16 && isHas_17 && isHas_18 && isHas_19 && isHas_20 &&
  1107. isHas_21 && isHas_22 && isHas_23 && isHas_24 && isHas_25 &&
  1108. isHas_26 && isHas_27 && isHas_28 && isHas_29 && isHas_30 &&
  1109. isHas_31 && isHas_32 && isHas_33 && isHas_34 && isHas_35 &&
  1110. isHas_36 && isHas_37 && isHas_38 && isHas_39 && isHas_40 &&
  1111. isHas_41 && isHas_42 && isHas_43 && isHas_44 && isHas_45 &&
  1112. isHas_46 && isHas_47 && isHas_48 && isHas_49 && isHas_50 &&
  1113. isHas_51 && isHas_52 && isHas_53 && isHas_54 && isHas_55 &&
  1114. isHas_56 && isHas_57 && isHas_58 && isHas_59 && isHas_60 &&
  1115. isHas_61 && isHas_62 && isHas_63 && isHas_64 && isHas_65)) {
  1116. this.dialogVisible = true
  1117. return
  1118. }
  1119. } else if (header.length == 23) {
  1120. var isHas_1 = headers.includes('区号')
  1121. console.log("1" + isHas_1)
  1122. var isHas_2 = headers.includes('机号')
  1123. console.log("2" + isHas_2)
  1124. var isHas_3 = headers.includes('周一' + "(" + this.days[0] + ")")
  1125. console.log("3" + isHas_3)
  1126. var isHas_4 = headers.includes('')
  1127. console.log("4" + isHas_4)
  1128. var isHas_5 = headers.includes('_1')
  1129. console.log("5" + isHas_5)
  1130. var isHas_6 = headers.includes('周二' + "(" + this.days[1] + ")")
  1131. console.log("6" + isHas_6)
  1132. var isHas_7 = headers.includes('_2')
  1133. console.log("7" + isHas_7)
  1134. var isHas_8 = headers.includes('_3')
  1135. console.log("8" + isHas_8)
  1136. var isHas_9 = headers.includes('周三' + "(" + this.days[2] + ")")
  1137. console.log("9" + isHas_9)
  1138. var isHas_10 = headers.includes('_4')
  1139. console.log("10" + isHas_10)
  1140. var isHas_11 = headers.includes('_5')
  1141. console.log("11" + isHas_11)
  1142. var isHas_12 = headers.includes('周四' + "(" + this.days[3] + ")")
  1143. console.log("12" + isHas_12)
  1144. var isHas_13 = headers.includes('_6')
  1145. console.log("13" + isHas_13)
  1146. var isHas_14 = headers.includes('_7')
  1147. console.log("14" + isHas_14)
  1148. var isHas_15 = headers.includes('周五' + "(" + this.days[4] + ")")
  1149. console.log("15" + isHas_15)
  1150. var isHas_16 = headers.includes('_8')
  1151. console.log("16" + isHas_16)
  1152. var isHas_17 = headers.includes('_9')
  1153. console.log("17" + isHas_17)
  1154. var isHas_18 = headers.includes('周六' + "(" + this.days[5] + ")")
  1155. console.log("18" + isHas_18)
  1156. var isHas_19 = headers.includes('_10')
  1157. console.log("19" + isHas_19)
  1158. var isHas_20 = headers.includes('_11')
  1159. console.log("20" + isHas_20)
  1160. var isHas_21 = headers.includes('周日' + "(" + this.days[6] + ")")
  1161. console.log("21" + isHas_21)
  1162. var isHas_22 = headers.includes('_12')
  1163. console.log("22" + isHas_22)
  1164. var isHas_23 = headers.includes('_13')
  1165. console.log("23" + isHas_23)
  1166. if (!(isHas_1 && isHas_2 && isHas_3 && isHas_4 && isHas_5 &&
  1167. isHas_6 && isHas_7 && isHas_8 && isHas_9 && isHas_10 &&
  1168. isHas_11 && isHas_12 && isHas_13 && isHas_14 && isHas_15 &&
  1169. isHas_16 && isHas_17 && isHas_18 && isHas_19 && isHas_20 &&
  1170. isHas_21)) {
  1171. this.dialogVisible = true
  1172. return
  1173. }
  1174. } else {
  1175. this.dialogVisible = true
  1176. return
  1177. }
  1178. let is_system_zone = true
  1179. let is_device_number = true
  1180. let zones = []
  1181. let deviceNumber = []
  1182. for (let i = 0; i < results.length; i++) {
  1183. if (results[i + 1] && results[i + 1]['区号'] != undefined) {
  1184. zones.push(results[i + 1]['区号'])
  1185. }
  1186. if (results[i + 1] && results[i + 1]['机号'] != undefined) {
  1187. deviceNumber.push(results[i + 1]['机号'])
  1188. }
  1189. }
  1190. const obj = {}
  1191. zones = zones.reduce((cur, next) => {
  1192. obj[next] ? '' : obj[next] = true && cur.push(next)
  1193. return cur
  1194. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  1195. const obj2 = {}
  1196. deviceNumber = deviceNumber.reduce((cur, next) => {
  1197. obj2[next] ? '' : obj2[next] = true && cur.push(next)
  1198. return cur
  1199. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  1200. var total_zones = []
  1201. var total_device_number = []
  1202. for (let key in this.partitions) {
  1203. total_zones.push(this.partitions[key].name)
  1204. }
  1205. for (let key in this.partitions) {
  1206. var jihaos = this.partitions[key].jihaos
  1207. for (let i = 0; i < jihaos.length; i++) {
  1208. total_device_number.push(jihaos[i].number)
  1209. }
  1210. }
  1211. for (let i = 0; i < zones.length; i++) {
  1212. if (!total_zones.includes(zones[i])) {
  1213. is_system_zone = false
  1214. }
  1215. }
  1216. for (let i = 0; i < deviceNumber.length; i++) {
  1217. if (!total_device_number.includes(deviceNumber[i])) {
  1218. is_device_number = false
  1219. }
  1220. }
  1221. let tempObj = null
  1222. if (results.length > 0) {
  1223. tempObj = results[0]
  1224. }
  1225. let datas = []
  1226. let failed_datas = []
  1227. console.log("结果22222222222", results)
  1228. for (let i = 0; i < results.length; i++) {
  1229. for (let key in results[i + 1]) {
  1230. let tempObjTwo = {partition_name: '', device_number_name: ''}
  1231. if (key != '区号' && key != '机号' && results[i + 1][key] != "") {
  1232. let obj = {}
  1233. obj['name'] = results[i + 1][key].replace(/\s/g, '')
  1234. if (tempObj[key] == '上午') {
  1235. obj['schedule_type'] = 1
  1236. } else if (tempObj[key] == '下午') {
  1237. obj['schedule_type'] = 2
  1238. } else if (tempObj[key] == '晚上') {
  1239. obj['schedule_type'] = 3
  1240. } else {
  1241. obj['schedule_type'] = 0
  1242. }
  1243. obj['schedule_week'] = this.getWeekByResultsStr(key)
  1244. obj['schedule_date'] = this.getDateByResultsStr(key)
  1245. obj['row'] = this.getRow(key)
  1246. tempObjTwo = obj
  1247. }
  1248. tempObjTwo['partition_name'] = results[i + 1]['区号']
  1249. tempObjTwo['device_number_name'] = results[i + 1]['机号']
  1250. tempObjTwo['index'] = i + 3
  1251. if (tempObjTwo['schedule_week'] != undefined && tempObjTwo['name'] != undefined && tempObjTwo['schedule_type'] != undefined && tempObjTwo['schedule_date'] != undefined) {
  1252. var current_date = new Date()
  1253. var m_year = current_date.getFullYear()
  1254. var m_month = current_date.getMonth() + 1
  1255. m_month = m_month < 10 ? '0' + m_month.toString() : m_month.toString()
  1256. var m_date = current_date.getDate() < 10 ? '0' + current_date.getDate().toString() : current_date.getDate().toString()
  1257. var current_date_two = new Date(m_year + '-' + m_month + '-' + m_date)
  1258. if (new Date(tempObjTwo['schedule_date']).getTime() > new Date(current_date_two).getTime()) {
  1259. datas.push(tempObjTwo)
  1260. } else {
  1261. failed_datas.push(tempObjTwo)
  1262. }
  1263. }
  1264. }
  1265. }
  1266. console.log("datas", datas)
  1267. let date_arr = []
  1268. //校验文档是否规范
  1269. for (let i = 0; i < datas.length; i++) {
  1270. if (datas[i].schedule_date !== '0') {
  1271. date_arr.push(datas[i].schedule_date)
  1272. }
  1273. if (datas[i].device_number_name == undefined) {
  1274. console.log("err1" + datas[i].device_number_name)
  1275. is_device_number = false
  1276. }
  1277. if (datas[i].partition_name == undefined) {
  1278. console.log("err2" + datas[i].partition_name)
  1279. is_system_zone = false
  1280. }
  1281. if (datas[i].schedule_date === '0') {
  1282. console.log("err23" + datas[i].schedule_date)
  1283. is_system_zone = false
  1284. }
  1285. if (datas[i].schedule_week === '0') {
  1286. console.log("err234" + datas[i].schedule_week)
  1287. is_system_zone = false
  1288. }
  1289. if (datas[i].schedule_type === 0) {
  1290. console.log("err2345" + datas[i].schedule_type)
  1291. is_system_zone = false
  1292. }
  1293. }
  1294. console.log("date_arr", date_arr)
  1295. //校验文档中同一天同个人是否存在多个排班
  1296. let is_exist_repeat = false
  1297. const obj3 = {}
  1298. date_arr = date_arr.reduce((cur, next) => {
  1299. obj3[next] ? '' : obj3[next] = true && cur.push(next)
  1300. return cur
  1301. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  1302. let tempObjArr = []
  1303. for (let i = 0; i < date_arr.length; i++) {
  1304. let obj = {}
  1305. let key = date_arr[i]
  1306. let value = []
  1307. for (let b = 0; b < datas.length; b++) {
  1308. if (key == datas[b].schedule_date) {
  1309. value.push(datas[b].name)
  1310. }
  1311. }
  1312. obj[key] = value
  1313. tempObjArr.push(obj)
  1314. }
  1315. for (let i = 0; i < tempObjArr.length; i++) {
  1316. for (let key in tempObjArr[i]) {
  1317. let arr = tempObjArr[i][key]
  1318. const obj = {}
  1319. arr = arr.reduce((cur, next) => {
  1320. obj[next] ? '' : obj[next] = true && cur.push(next)
  1321. return cur
  1322. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  1323. if (tempObjArr[i][key].length > arr.length) { //比对原数组和去重后的原数组总数,不同的话则存在重复元素
  1324. is_exist_repeat = true
  1325. }
  1326. }
  1327. }
  1328. if (headers.length > 65 || !is_system_zone || !is_device_number) {
  1329. this.dialogVisible = true
  1330. return
  1331. } else {
  1332. if (is_exist_repeat) {
  1333. this.isExistRepeatVisible = true
  1334. return
  1335. } else {
  1336. this.exportVisible = true
  1337. this.$alert('您提交的排班信息已上传成功,系统正在执行导入,请稍候点击当前页面右上角“下载日志”查看导入结果', '上传成功', {
  1338. confirmButtonText: '确定',
  1339. callback: action => {
  1340. }
  1341. });
  1342. console.log("data232332233223", datas)
  1343. console.log("failed_datas33332332", failed_datas)
  1344. var newSchedule = datas.sort((a, b) => {
  1345. return a.schedule_date - b.schedule_date
  1346. })
  1347. var start_time = ""
  1348. var type = 0
  1349. if (failed_datas.length > 0) {
  1350. var oldSchedule = failed_datas.sort((a, b) => {
  1351. return a.schedule_date - b.schedule_date
  1352. })
  1353. start_time = oldSchedule[0].schedule_date
  1354. type = 0
  1355. }
  1356. if (failed_datas.length == 0) {
  1357. start_time = newSchedule[0].schedule_date
  1358. type = 1
  1359. }
  1360. console.log("newSchedule2323223", newSchedule)
  1361. console.log("oldSchedule344433434", oldSchedule)
  1362. var length = newSchedule.length - 1
  1363. let params = {
  1364. schedule: datas,
  1365. failed_schedule: failed_datas,
  1366. start_time: start_time,
  1367. end_time: newSchedule[length].schedule_date,
  1368. delete_type: type,
  1369. }
  1370. console.log("param2323233223", params)
  1371. //今天的时间
  1372. var day2 = new Date()
  1373. day2.setTime(day2.getTime())
  1374. var month = day2.getMonth() + 1 < 10 ? '0' + (day2.getMonth() + 1).toString() : (day2.getMonth() + 1).toString()
  1375. var day = day2.getDate() < 10 ? '0' + (day2.getDate()).toString() : (day2.getMonth() + 1).toString()
  1376. var date = day2.getFullYear() + '-' + month + '-' + day
  1377. exportSchedule(params, date).then(response => {
  1378. if (response.data.state == 0) {
  1379. return false
  1380. }
  1381. this.getWeekPanels()
  1382. })
  1383. }
  1384. }
  1385. },
  1386. sortData(a, b) {
  1387. return a.schedule_date - b.schedule_date
  1388. },
  1389. getInitDate() {
  1390. initDate().then(response => {
  1391. if (response.data.state == 0) {
  1392. return false
  1393. }
  1394. this.days = response.data.data.days
  1395. console.log("日期22222222", this.days)
  1396. })
  1397. },
  1398. getWeekByResultsStr(key) {
  1399. switch (key) {
  1400. case '周一' + "(" + this.days[0] + ")":
  1401. return '1'
  1402. break
  1403. case '周一' + "(" + this.days[7] + ")":
  1404. return '1'
  1405. break
  1406. case '周一' + "(" + this.days[14] + ")":
  1407. return '1'
  1408. break
  1409. case '':
  1410. return '1'
  1411. break
  1412. case '_1':
  1413. return '1'
  1414. break
  1415. case '_14':
  1416. return '1'
  1417. break
  1418. case '_15':
  1419. return '1'
  1420. break
  1421. case '_28':
  1422. return '1'
  1423. break
  1424. case '_29':
  1425. return '1'
  1426. break
  1427. case '周二' + "(" + this.days[1] + ")" :
  1428. return '2'
  1429. break
  1430. case '周二' + "(" + this.days[8] + ")":
  1431. return '2'
  1432. break
  1433. case '周二' + "(" + this.days[15] + ")" :
  1434. return '2'
  1435. break
  1436. case '_2':
  1437. return '2'
  1438. break
  1439. case '_3':
  1440. return '2'
  1441. break
  1442. case '_16' :
  1443. return '2'
  1444. break
  1445. case '_17' :
  1446. return '2'
  1447. break
  1448. case '_30':
  1449. return '2'
  1450. break
  1451. case '_31':
  1452. return '2'
  1453. break
  1454. case '周三' + "(" + this.days[2] + ")":
  1455. return '3'
  1456. break
  1457. case '周三' + "(" + this.days[9] + ")":
  1458. return '3'
  1459. break
  1460. case '周三' + "(" + this.days[16] + ")":
  1461. return '3'
  1462. break
  1463. case '_4' :
  1464. return '3'
  1465. break
  1466. case '_5' :
  1467. return '3'
  1468. break
  1469. case '_18' :
  1470. return '3'
  1471. break
  1472. case '_19' :
  1473. return '3'
  1474. break
  1475. case '_32' :
  1476. return '3'
  1477. break
  1478. case '_33' :
  1479. return '3'
  1480. break
  1481. case '周四' + "(" + this.days[3] + ")":
  1482. return '4'
  1483. break
  1484. case '周四' + "(" + this.days[10] + ")" :
  1485. return '4'
  1486. break
  1487. case'周四' + "(" + this.days[17] + ")" :
  1488. return '4'
  1489. break
  1490. case '_6' :
  1491. return '4'
  1492. break
  1493. case '_7':
  1494. return '4'
  1495. break
  1496. case '_20':
  1497. return '4'
  1498. break
  1499. case '_21':
  1500. return '4'
  1501. break
  1502. case '_34':
  1503. return '4'
  1504. break
  1505. case '_35':
  1506. return '4'
  1507. break
  1508. case '周五' + "(" + this.days[4] + ")" :
  1509. return '5'
  1510. break
  1511. case '周五' + "(" + this.days[11] + ")":
  1512. return '5'
  1513. break
  1514. case '周五' + "(" + this.days[18] + ")" :
  1515. return '5'
  1516. break
  1517. case '_8':
  1518. return '5'
  1519. break
  1520. case '_9' :
  1521. return '5'
  1522. break
  1523. case '_22' :
  1524. return '5'
  1525. break
  1526. case '_23':
  1527. return '5'
  1528. break
  1529. case '_36':
  1530. return '5'
  1531. break
  1532. case '_37':
  1533. return '5'
  1534. break
  1535. case '周六' + "(" + this.days[5] + ")":
  1536. return '6'
  1537. break
  1538. case '周六' + "(" + this.days[12] + ")":
  1539. return '6'
  1540. break
  1541. case '周六' + "(" + this.days[19] + ")":
  1542. return '6'
  1543. break
  1544. case '_10' :
  1545. return '6'
  1546. break
  1547. case '_11':
  1548. return '6'
  1549. break
  1550. case '_24' :
  1551. return '6'
  1552. break
  1553. case '_25' :
  1554. return '6'
  1555. break
  1556. case '_38' :
  1557. return '6'
  1558. break
  1559. case '_39':
  1560. return '6'
  1561. break
  1562. case '周日' + "(" + this.days[6] + ")":
  1563. return '7'
  1564. break
  1565. case '周日' + "(" + this.days[13] + ")":
  1566. return '7'
  1567. break
  1568. case '周日' + "(" + this.days[20] + ")":
  1569. return '7'
  1570. break
  1571. case '_12' :
  1572. return '7'
  1573. break
  1574. case '_13' :
  1575. return '7'
  1576. break
  1577. case '_26':
  1578. return '7'
  1579. break
  1580. case '_27':
  1581. return '7'
  1582. break
  1583. case '_40' :
  1584. return '7'
  1585. break
  1586. case '_41':
  1587. return '7'
  1588. break
  1589. default:
  1590. return '0'
  1591. break
  1592. }
  1593. },
  1594. getRow(key) {
  1595. switch (key) {
  1596. case '周一' + "(" + this.days[0] + ")" : //本周一
  1597. return 'C'
  1598. break
  1599. case '': //本周一
  1600. return 'D'
  1601. break
  1602. case '_1': //本周一
  1603. return 'E'
  1604. break
  1605. case '周一' + "(" + this.days[7] + ")": //下周一
  1606. return 'X'
  1607. break
  1608. case '_14': //下周一
  1609. return 'Y'
  1610. break
  1611. case '_15': //下周一
  1612. return 'Z'
  1613. break
  1614. case '周一' + "(" + this.days[14] + ")" : //下下周一
  1615. return 'AS'
  1616. break
  1617. case '_28': //下下周一
  1618. return 'AT'
  1619. break
  1620. case '_29': //下下周一
  1621. return 'AU'
  1622. break
  1623. case '周二' + "(" + this.days[1] + ")" : //本周二
  1624. return 'F'
  1625. break
  1626. case '_2': //本周二
  1627. return 'G'
  1628. break
  1629. case '_3': //本周二
  1630. return 'H'
  1631. break
  1632. case '周二' + "(" + this.days[8] + ")"://下周二
  1633. return 'AA'
  1634. break
  1635. case '_16' ://下周二
  1636. return 'AB'
  1637. break
  1638. case '_17'://下周二
  1639. return 'AC'
  1640. break
  1641. case '周二' + "(" + this.days[15] + ")"://下下周二
  1642. return 'AV'
  1643. break
  1644. case '_30' ://下下周二
  1645. return 'AW'
  1646. break
  1647. case '_31'://下下周二
  1648. return 'AX'
  1649. break
  1650. case '周三' + "(" + this.days[2] + ")": //本周三
  1651. return 'I'
  1652. break
  1653. case '_4': //本周三
  1654. return 'J'
  1655. break
  1656. case '_5': //本周三
  1657. return 'K'
  1658. break
  1659. case '周三' + "(" + this.days[9] + ")": //下周三
  1660. return 'AD'
  1661. break
  1662. case '_18' : //下周三
  1663. return 'AE'
  1664. break
  1665. case '_19': //下周三
  1666. return 'AF'
  1667. break
  1668. case '周三' + "(" + this.days[16] + ")" : //下下周三
  1669. return 'AY'
  1670. break
  1671. case '_32' : //下下周三
  1672. return 'AZ'
  1673. break
  1674. case '_33': //下下周三
  1675. return 'BA'
  1676. break
  1677. case '周四' + "(" + this.days[3] + ")":
  1678. return 'L'
  1679. break
  1680. case '_6' :
  1681. return 'M'
  1682. break
  1683. case '_7':
  1684. return 'N'
  1685. break
  1686. case '周四' + "(" + this.days[10] + ")":
  1687. return 'AG'
  1688. break
  1689. case '_20' :
  1690. return 'AH'
  1691. break
  1692. case '_21':
  1693. return 'AI'
  1694. break
  1695. case '周四' + "(" + this.days[17] + ")":
  1696. return 'BB'
  1697. break
  1698. case '_34':
  1699. return 'BC'
  1700. break
  1701. case '_35':
  1702. return 'BD'
  1703. break
  1704. case '周五' + "(" + this.days[4] + ")":
  1705. return 'O'
  1706. break
  1707. case '_8':
  1708. return 'P'
  1709. break
  1710. case '_9':
  1711. return 'Q'
  1712. break
  1713. case '周五' + "(" + this.days[11] + ")":
  1714. return 'AJ'
  1715. break
  1716. case '_22' :
  1717. return 'AK'
  1718. break
  1719. case '_23':
  1720. return 'AL'
  1721. break
  1722. case '周五' + "(" + this.days[18] + ")":
  1723. return 'BE'
  1724. break
  1725. case '_36':
  1726. return 'BF'
  1727. break
  1728. case '_37':
  1729. return 'BG'
  1730. break
  1731. case '周六' + "(" + this.days[5] + ")" :
  1732. return 'R'
  1733. break
  1734. case '_10' :
  1735. return 'S'
  1736. break
  1737. case '_11':
  1738. return 'T'
  1739. break
  1740. case '周六' + "(" + this.days[12] + ")":
  1741. return 'AM'
  1742. break
  1743. case '_24' :
  1744. return 'AN'
  1745. break
  1746. case '_25':
  1747. return 'AO'
  1748. break
  1749. case '周六' + "(" + this.days[19] + ")":
  1750. return 'BH'
  1751. break
  1752. case '_38' :
  1753. return 'BI'
  1754. break
  1755. case '_39':
  1756. return 'BJ'
  1757. break
  1758. case '周日' + "(" + this.days[6] + ")" :
  1759. return 'U'
  1760. break
  1761. case '_12' :
  1762. return 'V'
  1763. break
  1764. case '_13':
  1765. return 'W'
  1766. break
  1767. case '周日' + "(" + this.days[13] + ")":
  1768. return 'AP'
  1769. break
  1770. case '_26' :
  1771. return 'AQ'
  1772. break
  1773. case '_27':
  1774. return 'AR'
  1775. break
  1776. case '周日' + "(" + this.days[20] + ")":
  1777. return 'BK'
  1778. break
  1779. case '_40':
  1780. return 'BL'
  1781. break
  1782. case '_41':
  1783. return 'BM'
  1784. break
  1785. }
  1786. },
  1787. getDateByResultsStr(key) {
  1788. switch (key) {
  1789. case '周一' + "(" + this.days[0] + ")" : //本周一
  1790. return this.days[0]
  1791. break
  1792. case '': //本周一
  1793. return this.days[0]
  1794. break
  1795. case '_1': //本周一
  1796. return this.days[0]
  1797. break
  1798. case '周一' + "(" + this.days[7] + ")": //下周一
  1799. return this.days[7]
  1800. break
  1801. case '_14': //下周一
  1802. return this.days[7]
  1803. break
  1804. case '_15': //下周一
  1805. return this.days[7]
  1806. break
  1807. case '周一' + "(" + this.days[14] + ")": //下下周一
  1808. return this.days[14]
  1809. break
  1810. case '_28': //下下周一
  1811. return this.days[14]
  1812. break
  1813. case '_29': //下下周一
  1814. return this.days[14]
  1815. break
  1816. case '周二' + "(" + this.days[1] + ")": //本周二
  1817. return this.days[1]
  1818. break
  1819. case '_2': //本周二
  1820. return this.days[1]
  1821. break
  1822. case '_3': //本周二
  1823. return this.days[1]
  1824. break
  1825. case '周二' + "(" + this.days[8] + ")"://下周二
  1826. return this.days[8]
  1827. break
  1828. case '_16' ://下周二
  1829. return this.days[8]
  1830. break
  1831. case '_17'://下周二
  1832. return this.days[8]
  1833. break
  1834. case '周二' + "(" + this.days[15] + ")"://下下周二
  1835. return this.days[15]
  1836. break
  1837. case '_30' ://下下周二
  1838. return this.days[15]
  1839. break
  1840. case '_31'://下下周二
  1841. return this.days[15]
  1842. break
  1843. case '周三' + "(" + this.days[2] + ")" : //本周三
  1844. return this.days[2]
  1845. break
  1846. case '_4': //本周三
  1847. return this.days[2]
  1848. break
  1849. case '_5': //本周三
  1850. return this.days[2]
  1851. break
  1852. case '周三' + "(" + this.days[9] + ")": //下周三
  1853. return this.days[9]
  1854. break
  1855. case '_18' : //下周三
  1856. return this.days[9]
  1857. break
  1858. case '_19': //下周三
  1859. return this.days[9]
  1860. break
  1861. case '周三' + "(" + this.days[16] + ")": //下下周三
  1862. return this.days[16]
  1863. break
  1864. case '_32' : //下下周三
  1865. return this.days[16]
  1866. break
  1867. case '_33': //下下周三
  1868. return this.days[16]
  1869. break
  1870. case '周四' + "(" + this.days[3] + ")":
  1871. return this.days[3]
  1872. break
  1873. case '_6' :
  1874. return this.days[3]
  1875. break
  1876. case '_7':
  1877. return this.days[3]
  1878. break
  1879. case '周四' + "(" + this.days[10] + ")":
  1880. return this.days[10]
  1881. break
  1882. case '_20' :
  1883. return this.days[10]
  1884. break
  1885. case '_21':
  1886. return this.days[10]
  1887. break
  1888. case '周四' + "(" + this.days[17] + ")":
  1889. return this.days[17]
  1890. break
  1891. case '_34':
  1892. return this.days[17]
  1893. break
  1894. case '_35':
  1895. return this.days[17]
  1896. break
  1897. case '周五' + "(" + this.days[4] + ")":
  1898. return this.days[4]
  1899. break
  1900. case '_8':
  1901. return this.days[4]
  1902. break
  1903. case '_9':
  1904. return this.days[4]
  1905. break
  1906. case '周五' + "(" + this.days[11] + ")" :
  1907. return this.days[11]
  1908. break
  1909. case '_22' :
  1910. return this.days[11]
  1911. break
  1912. case '_23':
  1913. return this.days[11]
  1914. break
  1915. case '周五' + "(" + this.days[18] + ")":
  1916. return this.days[18]
  1917. break
  1918. case '_36':
  1919. return this.days[18]
  1920. break
  1921. case '_37':
  1922. return this.days[18]
  1923. break
  1924. case '周六' + "(" + this.days[5] + ")":
  1925. return this.days[5]
  1926. break
  1927. case '_10' :
  1928. return this.days[5]
  1929. break
  1930. case '_11':
  1931. return this.days[5]
  1932. break
  1933. case '周六' + "(" + this.days[12] + ")":
  1934. return this.days[12]
  1935. break
  1936. case '_24' :
  1937. return this.days[12]
  1938. break
  1939. case '_25':
  1940. return this.days[12]
  1941. break
  1942. case '周六' + "(" + this.days[19] + ")":
  1943. return this.days[19]
  1944. break
  1945. case '_38' :
  1946. return this.days[19]
  1947. break
  1948. case '_39':
  1949. return this.days[19]
  1950. break
  1951. case '周日' + "(" + this.days[6] + ")" :
  1952. return this.days[6]
  1953. break
  1954. case '_12' :
  1955. return this.days[6]
  1956. break
  1957. case '_13':
  1958. return this.days[6]
  1959. break
  1960. case '周日' + "(" + this.days[13] + ")":
  1961. return this.days[13]
  1962. break
  1963. case '_26' :
  1964. return this.days[13]
  1965. break
  1966. case '_27':
  1967. return this.days[13]
  1968. break
  1969. case '周日' + "(" + this.days[20] + ")":
  1970. return this.days[20]
  1971. break
  1972. case '_40':
  1973. return this.days[20]
  1974. break
  1975. case '_41':
  1976. return this.days[20]
  1977. break
  1978. default:
  1979. return '0'
  1980. break
  1981. }
  1982. },
  1983. getNextWeek(i) {
  1984. let weekOfDay = parseInt(moment().format('E'));//计算今天是这周第几天
  1985. let next_monday = moment().add((7 - weekOfDay) + 7 * (i - 1) + 1, 'days').format('YYYY-MM-DD');//周一日期
  1986. let next_sunday = moment().add((7 - weekOfDay) + 7 * i, 'days').format('YYYY-MM-DD');//周日日期
  1987. return next_sunday
  1988. },
  1989. getNextWeekOne(i) {
  1990. let weekOfDay = parseInt(moment().format('E'));//计算今天是这周第几天
  1991. let next_monday = moment().add((7 - weekOfDay) + 7 * (i - 1) + 1, 'days').format('YYYY-MM-DD');//周一日期
  1992. return next_monday
  1993. },
  1994. //
  1995. getThreeWeekList() {
  1996. var params = {
  1997. start_time: this.start_time,
  1998. end_time: this.end_time,
  1999. partition_id: this.partition_id,
  2000. schedule_type: this.schedule_type
  2001. }
  2002. // console.log("params32323232323223", params)
  2003. getThreeWeekList(params).then(response => {
  2004. if (response.data.state == 1) {
  2005. var partitions = response.data.data.partitions
  2006. console.log('yyyyyyy',response.data.data);
  2007. const merges = ['A1:A2', 'B1:B2', 'C1:E1', 'F1:H1', 'I1:K1', 'L1:N1', 'O1:Q1', 'R1:T1', 'U1:W1', 'X1:Z1', 'AA1:AC1', 'AD1:AF1', 'AG1:AI1', 'AJ1:AL1', 'AM1:AO1', 'AP1:AR1', 'AS1:AU1', 'AV1:AX1', 'AY1:BA1', 'BB1:BD1', 'BE1:BG1', 'BH1:BJ1', 'BK1:BM1']
  2008. var list = []
  2009. let i = 0
  2010. for (let key in partitions) {
  2011. var tempValue
  2012. var jihaos = partitions[key].jihaos
  2013. jihaos.sort(function(a,b) {
  2014. return a.sort-b.sort
  2015. })
  2016. // console.log('rrrrr',jihaos);
  2017. // for(let i=0;i<jihaos1.length;i++){
  2018. // var jihaos=jihaos1[i].sort
  2019. // }
  2020. // for(let i in jihaos1){
  2021. // var jihaos=jihaos1[i].sort
  2022. // jihaos.sort(function(a,b){
  2023. // return a-b
  2024. // })
  2025. // console.log('wwwww',jihaos);
  2026. // }
  2027. if (i == 0) {
  2028. let m = 'A3' + ':' + 'A' + (2 + jihaos.length)
  2029. tempValue = (2 + jihaos.length)
  2030. merges.push(m)
  2031. } else {
  2032. let m = 'A' + (tempValue + 1) + ':' + 'A' + ((tempValue + 1) + jihaos.length - 1)
  2033. tempValue = ((tempValue + 1) + jihaos.length - 1)
  2034. merges.push(m)
  2035. }
  2036. console.log("jihaos", jihaos)
  2037. for (let b = 0; b < jihaos.length; b++) {
  2038. var obj = {}
  2039. obj['区号'] = partitions[key].name
  2040. obj['机号'] = jihaos[b].number.toString()
  2041. if (this.export_type == 0) {
  2042. obj['shangwu'] = ''
  2043. obj['xiawu'] = ''
  2044. obj['wanshang'] = ''
  2045. obj['shangwu1'] = ''
  2046. obj['xiawu1'] = ''
  2047. obj['wanshang1'] = ''
  2048. obj['shangwu2'] = ''
  2049. obj['xiawu2'] = ''
  2050. obj['wanshang2'] = ''
  2051. obj['shangwu3'] = ''
  2052. obj['xiawu3'] = ''
  2053. obj['wanshang3'] = ''
  2054. obj['shangwu4'] = ''
  2055. obj['xiawu4'] = ''
  2056. obj['wanshang4'] = ''
  2057. obj['shangwu5'] = ''
  2058. obj['xiawu5'] = ''
  2059. obj['wanshang5'] = ''
  2060. obj['shangwu6'] = ''
  2061. obj['xiawu6'] = ''
  2062. obj['wanshang6'] = ''
  2063. obj['shangwu7'] = ''
  2064. obj['xiawu7'] = ''
  2065. obj['wanshang7'] = ''
  2066. obj['shangwu8'] = ''
  2067. obj['xiawu8'] = ''
  2068. obj['wanshang8'] = ''
  2069. obj['shangwu9'] = ''
  2070. obj['xiawu9'] = ''
  2071. obj['wanshang9'] = ''
  2072. obj['shangwu10'] = ''
  2073. obj['xiawu10'] = ''
  2074. obj['wanshang10'] = ''
  2075. obj['shangwu11'] = ''
  2076. obj['xiawu11'] = ''
  2077. obj['wanshang11'] = ''
  2078. obj['shangwu12'] = ''
  2079. obj['xiawu12'] = ''
  2080. obj['wanshang12'] = ''
  2081. obj['shangwu13'] = ''
  2082. obj['xiawu13'] = ''
  2083. obj['wanshang13'] = ''
  2084. obj['shangwu14'] = ''
  2085. obj['xiawu14'] = ''
  2086. obj['wanshang14'] = ''
  2087. obj['shangwu15'] = ''
  2088. obj['xiawu15'] = ''
  2089. obj['wanshang15'] = ''
  2090. obj['shangwu16'] = ''
  2091. obj['xiawu16'] = ''
  2092. obj['wanshang16'] = ''
  2093. obj['shangwu17'] = ''
  2094. obj['xiawu17'] = ''
  2095. obj['wanshang17'] = ''
  2096. obj['shangwu18'] = ''
  2097. obj['xiawu18'] = ''
  2098. obj['wanshang18'] = ''
  2099. obj['shangwu19'] = ''
  2100. obj['xiawu19'] = ''
  2101. obj['wanshang19'] = ''
  2102. obj['shangwu20'] = ''
  2103. obj['xiawu20'] = ''
  2104. obj['wanshang20'] = ''
  2105. }
  2106. if (this.export_type == 1) {
  2107. obj['shangwu'] = ''
  2108. obj['xiawu'] = ''
  2109. obj['wanshang'] = ''
  2110. obj['shangwu1'] = ''
  2111. obj['xiawu1'] = ''
  2112. obj['wanshang1'] = ''
  2113. obj['shangwu2'] = ''
  2114. obj['xiawu2'] = ''
  2115. obj['wanshang2'] = ''
  2116. obj['shangwu3'] = ''
  2117. obj['xiawu3'] = ''
  2118. obj['wanshang3'] = ''
  2119. obj['shangwu4'] = ''
  2120. obj['xiawu4'] = ''
  2121. obj['wanshang4'] = ''
  2122. obj['shangwu5'] = ''
  2123. obj['xiawu5'] = ''
  2124. obj['wanshang5'] = ''
  2125. obj['shangwu6'] = ''
  2126. obj['xiawu6'] = ''
  2127. obj['wanshang6'] = ''
  2128. }
  2129. list.push(obj)
  2130. }
  2131. i++
  2132. }
  2133. const start_time = moment().weekday(1).format('YYYY-MM-DD'); //本周一
  2134. var start = this.getTimestamp(start_time) - 28800
  2135. console.log("start", start)
  2136. const end_time = moment().weekday(7).format('YYYY-MM-DD');
  2137. var end = this.getTimestamp(end_time) - 28800
  2138. console.log("end", end)
  2139. var scheduleList = response.data.data.list
  2140. // console.log('ttttttttt',scheduleList);
  2141. var week = []
  2142. var nextWeek = []
  2143. var lastWeek = []
  2144. var next_start = this.getNextWeekOne(1)
  2145. var nextstart = this.getTimestamp(next_start) - 28800
  2146. var next_end = this.getNextWeek(1)
  2147. var nextend = this.getTimestamp(next_end) - 28800
  2148. var last_start = this.getNextWeekOne(2)
  2149. var last_end = this.getNextWeek(2)
  2150. var laststart = this.getTimestamp(last_start) - 28800
  2151. var lastend = this.getTimestamp(last_end) - 28800
  2152. if (this.export_type == 0) {
  2153. for (let i = 0; i < scheduleList.length; i++) {
  2154. if (scheduleList[i].schedule_date >= start && scheduleList[i].schedule_date <= end) {
  2155. week.push(scheduleList[i])
  2156. }
  2157. if (scheduleList[i].schedule_date >= nextstart && scheduleList[i].schedule_date <= nextend) {
  2158. nextWeek.push(scheduleList[i])
  2159. }
  2160. if (scheduleList[i].schedule_date >= laststart && scheduleList[i].schedule_date <= lastend) {
  2161. lastWeek.push(scheduleList[i])
  2162. }
  2163. }
  2164. }
  2165. if (this.export_type == 1) {
  2166. week = scheduleList
  2167. }
  2168. console.log("list")
  2169. console.log(list)
  2170. console.log("week")
  2171. console.log(lastWeek)
  2172. if (week.length > 0) {
  2173. // console.log('qqqqqqqqq',list);
  2174. // console.log('wwwwwwwww',week);
  2175. for (let i = 0; i < list.length; i++) {
  2176. for (let j = 0; j < week.length; j++) {
  2177. if (list[i].机号 == week[j].number && list[i].区号 == week[j].zon_name) {
  2178. // 周一上午 week[j].number week[j].zon_name
  2179. if (week[j].schedule_week == 1 && week[j].schedule_type == 1) {
  2180. if(this.guanliu_show==false){
  2181. list[i].shangwu = week[j].name
  2182. // console.log('eeeeeee',list[i].shangwu)
  2183. }else{
  2184. list[i].shangwu = week[j].name+" "+week[j].dialysis_machine_name
  2185. // console.log('kkkkkk',list[i].shangwu)
  2186. }
  2187. }
  2188. // 周一下午
  2189. if (week[j].schedule_week == 1 && week[j].schedule_type == 2) {
  2190. if(this.$refs.tableData.value1==false){
  2191. list[i].xiawu = week[j].name
  2192. }else{
  2193. list[i].xiawu = week[j].name+" "+week[j].dialysis_machine_name
  2194. }
  2195. }
  2196. // 周一晚上
  2197. if (week[j].schedule_week == 1 && week[j].schedule_type == 3) {
  2198. if(this.$refs.tableData.value1==false){
  2199. list[i].wanshang = week[j].name
  2200. }else{
  2201. list[i].wanshang = week[j].name+" "+week[j].dialysis_machine_name
  2202. }
  2203. }
  2204. //周二上午
  2205. if (week[j].schedule_week == 2 && week[j].schedule_type == 1) {
  2206. if(this.$refs.tableData.value1==false){
  2207. list[i].shangwu1 = week[j].name
  2208. }else{
  2209. list[i].shangwu1 = week[j].name+" "+week[j].dialysis_machine_name
  2210. }
  2211. }
  2212. //周二下午
  2213. if (week[j].schedule_week == 2 && week[j].schedule_type == 2) {
  2214. if(this.$refs.tableData.value1==false){
  2215. list[i].xiawu1 = week[j].name
  2216. }else{
  2217. list[i].xiawu1 = week[j].name+" "+week[j].dialysis_machine_name
  2218. }
  2219. }
  2220. //周二晚上
  2221. if (week[j].schedule_week == 2 && week[j].schedule_type == 3) {
  2222. if(this.$refs.tableData.value1==false){
  2223. list[i].wanshang1 = week[j].name
  2224. }else{
  2225. list[i].wanshang1 = week[j].name+" "+week[j].dialysis_machine_name
  2226. }
  2227. // list[i].wanshang1 = week[j].name+" "+week[i].dialysis_machine_name
  2228. }
  2229. //周三上午
  2230. if (week[j].schedule_week == 3 && week[j].schedule_type == 1) {
  2231. if(this.$refs.tableData.value1==false){
  2232. list[i].shangwu2 = week[j].name
  2233. }else{
  2234. list[i].shangwu2 = week[j].name+" "+week[j].dialysis_machine_name
  2235. }
  2236. // list[i].shangwu2 = week[j].name+" "+week[j].dialysis_machine_name
  2237. }
  2238. //周三下午
  2239. if (week[j].schedule_week == 3 && week[j].schedule_type == 2) {
  2240. if(this.$refs.tableData.value1==false){
  2241. list[i].xiawu2 = week[j].name
  2242. }else{
  2243. list[i].xiawu2 = week[j].name+" "+week[j].dialysis_machine_name
  2244. }
  2245. // list[i].xiawu2 = week[j].name+" "+week[j].dialysis_machine_name
  2246. }
  2247. //周三晚上
  2248. if (week[j].schedule_week == 3 && week[j].schedule_type == 3) {
  2249. if(this.$refs.tableData.value1==false){
  2250. list[i].wanshang2 = week[j].name
  2251. }else{
  2252. list[i].wanshang2 = week[j].name+" "+week[j].dialysis_machine_name
  2253. }
  2254. // list[i].wanshang2 = week[j].name+" "+week[j].dialysis_machine_name
  2255. }
  2256. //周四上午
  2257. if (week[j].schedule_week == 4 && week[j].schedule_type == 1) {
  2258. if(this.$refs.tableData.value1==false){
  2259. list[i].shangwu3 = week[j].name
  2260. }else{
  2261. list[i].shangwu3 = week[j].name+" "+week[j].dialysis_machine_name
  2262. }
  2263. // list[i].shangwu3 = week[j].name+" "+week[j].dialysis_machine_name
  2264. }
  2265. //周四下午
  2266. if (week[j].schedule_week == 4 && week[j].schedule_type == 2) {
  2267. if(this.$refs.tableData.value1==false){
  2268. list[i].xiawu3 = week[j].name
  2269. }else{
  2270. list[i].xiawu3 = week[j].name+" "+week[j].dialysis_machine_name
  2271. }
  2272. // list[i].xiawu3 = week[j].name+" "+week[j].dialysis_machine_name
  2273. }
  2274. //周四晚上
  2275. if (week[j].schedule_week == 4 && week[j].schedule_type == 3) {
  2276. if(this.$refs.tableData.value1==false){
  2277. list[i].wanshang3 = week[j].name
  2278. }else{
  2279. list[i].wanshang3 = week[j].name+" "+week[j].dialysis_machine_name
  2280. }
  2281. // list[i].wanshang3 = week[j].name+" "+week[j].dialysis_machine_name
  2282. }
  2283. //周五上午
  2284. if (week[j].schedule_week == 5 && week[j].schedule_type == 1) {
  2285. if(this.$refs.tableData.value1==false){
  2286. list[i].shangwu4 = week[j].name
  2287. }else{
  2288. list[i].shangwu4 = week[j].name+" "+week[j].dialysis_machine_name
  2289. }
  2290. // list[i].shangwu4 = week[j].name+" "+week[j].dialysis_machine_name
  2291. }
  2292. //周五下午
  2293. if (week[j].schedule_week == 5 && week[j].schedule_type == 2) {
  2294. if(this.$refs.tableData.value1==false){
  2295. list[i].xiawu4 = week[j].name
  2296. }else{
  2297. list[i].xiawu4 = week[j].name+" "+week[j].dialysis_machine_name
  2298. }
  2299. // list[i].xiawu4 = week[j].name+" "+week[j].dialysis_machine_name
  2300. }
  2301. //周五晚上
  2302. if (week[j].schedule_week == 5 && week[j].schedule_type == 3) {
  2303. if(this.$refs.tableData.value1==false){
  2304. list[i].wanshang4 = week[j].name
  2305. }else{
  2306. list[i].wanshang4 = week[j].name+" "+week[j].dialysis_machine_name
  2307. }
  2308. // list[i].wanshang4 = week[j].name+" "+week[j].dialysis_machine_name
  2309. }
  2310. //周六上午
  2311. if (week[j].schedule_week == 6 && week[j].schedule_type == 1) {
  2312. if(this.$refs.tableData.value1==false){
  2313. list[i].shangwu5 = week[j].name
  2314. }else{
  2315. list[i].shangwu5 = week[j].name+" "+week[j].dialysis_machine_name
  2316. }
  2317. // list[i].shangwu5 = week[j].name+" "+week[j].dialysis_machine_name
  2318. }
  2319. //周六下午
  2320. if (week[j].schedule_week == 6 && week[j].schedule_type == 2) {
  2321. if(this.$refs.tableData.value1==false){
  2322. list[i].xiawu5 = week[j].name
  2323. }else{
  2324. list[i].xiawu5 = week[j].name+" "+week[j].dialysis_machine_name
  2325. }
  2326. // list[i].xiawu5 = week[j].name+" "+week[j].dialysis_machine_name
  2327. }
  2328. //周六晚上
  2329. if (week[j].schedule_week == 6 && week[j].schedule_type == 3) {
  2330. if(this.$refs.tableData.value1==false){
  2331. list[i].wanshang5 = week[j].name
  2332. }else{
  2333. list[i].wanshang5 = week[j].name+" "+week[j].dialysis_machine_name
  2334. }
  2335. // list[i].wanshang5 = week[j].name+" "+week[j].dialysis_machine_name
  2336. }
  2337. //周日上午
  2338. if (week[j].schedule_week == 7 && week[j].schedule_type == 1) {
  2339. if(this.$refs.tableData.value1==false){
  2340. list[i].shangwu6 = week[j].name
  2341. }else{
  2342. list[i].shangwu6 = week[j].name+" "+week[j].dialysis_machine_name
  2343. }
  2344. // list[i].shangwu6 = week[j].name+" "+week[j].dialysis_machine_name
  2345. }
  2346. //周日下午
  2347. if (week[j].schedule_week == 7 && week[j].schedule_type == 2) {
  2348. if(this.$refs.tableData.value1==false){
  2349. list[i].xiawu6 = week[j].name
  2350. }else{
  2351. list[i].xiawu6 = week[j].name+" "+week[j].dialysis_machine_name
  2352. }
  2353. // list[i].xiawu6 = week[j].name+" "+week[j].dialysis_machine_name
  2354. }
  2355. //周日晚上
  2356. if (week[j].schedule_week == 7 && week[j].schedule_type == 3) {
  2357. if(this.$refs.tableData.value1==false){
  2358. list[i].wanshang6 = week[j].name
  2359. }else{
  2360. list[i].wanshang6 = week[j].name+" "+week[j].dialysis_machine_name
  2361. }
  2362. // list[i].wanshang6 = week[j].name+" "+week[j].dialysis_machine_name
  2363. }
  2364. }
  2365. }
  2366. }
  2367. }
  2368. if (nextWeek.length > 0) {
  2369. for (let i = 0; i < list.length; i++) {
  2370. for (let j = 0; j < nextWeek.length; j++) {
  2371. if (list[i].机号 == nextWeek[j].number && list[i].区号 == nextWeek[j].zon_name) {
  2372. //周一
  2373. if (nextWeek[j].schedule_week == 1 && nextWeek[j].schedule_type == 1) {
  2374. if(this.$refs.tableData.value1==false){
  2375. list[i].shangwu7 = nextWeek[j].name
  2376. }else{
  2377. list[i].shangwu7 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2378. }
  2379. // list[i].shangwu7 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2380. }
  2381. //周一下午
  2382. if (nextWeek[j].schedule_week == 1 && nextWeek[j].schedule_type == 2) {
  2383. if(this.$refs.tableData.value1==false){
  2384. list[i].xiawu7 = nextWeek[j].name
  2385. }else{
  2386. list[i].xiawu7 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2387. }
  2388. // list[i].xiawu7 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2389. }
  2390. //周一晚上
  2391. if (nextWeek[j].schedule_week == 1 && nextWeek[j].schedule_type == 3) {
  2392. if(this.$refs.tableData.value1==false){
  2393. list[i].wanshang7 = nextWeek[j].name
  2394. }else{
  2395. list[i].wanshang7 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2396. }
  2397. // list[i].wanshang7 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2398. }
  2399. //周二上午
  2400. if (nextWeek[j].schedule_week == 2 && nextWeek[j].schedule_type == 1) {
  2401. if(this.$refs.tableData.value1==false){
  2402. list[i].shangwu8 = nextWeek[j].name
  2403. }else{
  2404. list[i].shangwu8 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2405. }
  2406. // list[i].shangwu8 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2407. }
  2408. //周二下午
  2409. if (nextWeek[j].schedule_week == 2 && nextWeek[j].schedule_type == 2) {
  2410. if(this.$refs.tableData.value1==false){
  2411. list[i].xiawu8 = nextWeek[j].name
  2412. }else{
  2413. list[i].xiawu8 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2414. }
  2415. // list[i].xiawu8 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2416. }
  2417. //周二晚上
  2418. if (nextWeek[j].schedule_week == 2 && nextWeek[j].schedule_type == 3) {
  2419. if(this.$refs.tableData.value1==false){
  2420. list[i].wanshang8 = nextWeek[j].name
  2421. }else{
  2422. list[i].wanshang8 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2423. }
  2424. // list[i].wanshang8 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2425. }
  2426. //周三上午
  2427. if (nextWeek[j].schedule_week == 3 && nextWeek[j].schedule_type == 1) {
  2428. if(this.$refs.tableData.value1==false){
  2429. list[i].shangwu9 = nextWeek[j].name
  2430. }else{
  2431. list[i].shangwu9 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2432. }
  2433. // list[i].shangwu9 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2434. }
  2435. //周三下午
  2436. if (nextWeek[j].schedule_week == 3 && nextWeek[j].schedule_type == 2) {
  2437. if(this.$refs.tableData.value1==false){
  2438. list[i].xiawu9 = nextWeek[j].name
  2439. }else{
  2440. list[i].xiawu9 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2441. }
  2442. //
  2443. }
  2444. //周三晚上
  2445. if (nextWeek[j].schedule_week == 3 && nextWeek[j].schedule_type == 3) {
  2446. if(this.$refs.tableData.value1==false){
  2447. list[i].wanshang9 = nextWeek[j].name
  2448. }else{
  2449. list[i].wanshang9 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2450. }
  2451. // list[i].wanshang9 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2452. }
  2453. //周四上午
  2454. if (nextWeek[j].schedule_week == 4 && nextWeek[j].schedule_type == 1) {
  2455. if(this.$refs.tableData.value1==false){
  2456. list[i].shangwu10 = nextWeek[j].name
  2457. }else{
  2458. list[i].shangwu10 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2459. }
  2460. // list[i].shangwu10 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2461. }
  2462. //周四下午
  2463. if (nextWeek[j].schedule_week == 4 && nextWeek[j].schedule_type == 2) {
  2464. if(this.$refs.tableData.value1==false){
  2465. list[i].xiawu10 = nextWeek[j].name
  2466. }else{
  2467. list[i].xiawu10 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2468. }
  2469. // list[i].xiawu10 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2470. }
  2471. //周四晚上
  2472. if (nextWeek[j].schedule_week == 4 && nextWeek[j].schedule_type == 3) {
  2473. if(this.$refs.tableData.value1==false){
  2474. list[i].wanshang10 = nextWeek[j].name
  2475. }else{
  2476. list[i].wanshang10 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2477. }
  2478. // list[i].wanshang10 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2479. }
  2480. //周五上午
  2481. if (nextWeek[j].schedule_week == 5 && nextWeek[j].schedule_type == 1) {
  2482. if(this.$refs.tableData.value1==false){
  2483. list[i].shangwu11 = nextWeek[j].name
  2484. }else{
  2485. list[i].shangwu11 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2486. }
  2487. // list[i].shangwu11 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2488. }
  2489. //周五下午
  2490. if (nextWeek[j].schedule_week == 5 && nextWeek[j].schedule_type == 2) {
  2491. if(this.$refs.tableData.value1==false){
  2492. list[i].xiawu11 = nextWeek[j].name
  2493. }else{
  2494. list[i].xiawu11 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2495. }
  2496. // list[i].xiawu11 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2497. }
  2498. //周五晚上
  2499. if (nextWeek[j].schedule_week == 5 && nextWeek[j].schedule_type == 3) {
  2500. if(this.$refs.tableData.value1==false){
  2501. list[i].wanshang11 = nextWeek[j].name
  2502. }else{
  2503. list[i].wanshang11 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2504. }
  2505. // list[i].wanshang11 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2506. }
  2507. //周六上午
  2508. if (nextWeek[j].schedule_week == 6 && nextWeek[j].schedule_type == 1) {
  2509. if(this.$refs.tableData.value1==false){
  2510. list[i].shangwu12 = nextWeek[j].name
  2511. }else{
  2512. list[i].shangwu12 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2513. }
  2514. // list[i].shangwu12 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2515. }
  2516. //周六下午
  2517. if (nextWeek[j].schedule_week == 6 && nextWeek[j].schedule_type == 2) {
  2518. if(this.$refs.tableData.value1==false){
  2519. list[i].xiawu12 = nextWeek[j].name
  2520. }else{
  2521. list[i].xiawu12 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2522. }
  2523. // list[i].xiawu12 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2524. }
  2525. //周六晚上
  2526. if (nextWeek[j].schedule_week == 6 && nextWeek[j].schedule_type == 3) {
  2527. if(this.$refs.tableData.value1==false){
  2528. list[i].wanshang12 = nextWeek[j].name
  2529. }else{
  2530. list[i].wanshang12 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2531. }
  2532. // list[i].wanshang12 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2533. }
  2534. //周日上午
  2535. if (nextWeek[j].schedule_week == 7 && nextWeek[j].schedule_type == 1) {
  2536. if(this.$refs.tableData.value1==false){
  2537. list[i].shangwu13 = nextWeek[j].name
  2538. }else{
  2539. list[i].shangwu13 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2540. }
  2541. // list[i].shangwu13 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2542. }
  2543. //周日下午
  2544. if (nextWeek[j].schedule_week == 7 && nextWeek[j].schedule_type == 2) {
  2545. if(this.$refs.tableData.value1==false){
  2546. list[i].xiawu13 = nextWeek[j].name
  2547. }else{
  2548. list[i].xiawu13 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2549. }
  2550. // list[i].xiawu13 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2551. }
  2552. //周日晚上
  2553. if (nextWeek[j].schedule_week == 7 && nextWeek[j].schedule_type == 3) {
  2554. if(this.$refs.tableData.value1==false){
  2555. list[i].wanshang13 = nextWeek[j].name
  2556. }else{
  2557. list[i].wanshang13 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2558. }
  2559. // list[i].wanshang13 = nextWeek[j].name+" "+nextWeek[j].dialysis_machine_name
  2560. }
  2561. }
  2562. }
  2563. }
  2564. }
  2565. //
  2566. if (lastWeek.length > 0) {
  2567. console.log('ttttt',lastWeek);
  2568. for (let i = 0; i < list.length; i++) {
  2569. for (let j = 0; j < lastWeek.length; j++) {
  2570. if (list[i].机号 == lastWeek[j].number && list[i].区号 == lastWeek[j].zon_name) {
  2571. //周一
  2572. if (lastWeek[j].schedule_week == 1 && lastWeek[j].schedule_type == 1) {
  2573. if(this.guanliu_show==false){
  2574. list[i].shangwu14 = lastWeek[j].name
  2575. }else{
  2576. list[i].shangwu14 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2577. }
  2578. // list[i].shangwu14 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2579. }
  2580. //周一下午
  2581. if (lastWeek[j].schedule_week == 1 && lastWeek[j].schedule_type == 2) {
  2582. if(this.guanliu_show==false){
  2583. list[i].xiawu14 = lastWeek[j].name
  2584. }else{
  2585. list[i].xiawu14 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2586. }
  2587. // list[i].xiawu14 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2588. }
  2589. //周一晚上
  2590. if (lastWeek[j].schedule_week == 1 && lastWeek[j].schedule_type == 3) {
  2591. if(this.guanliu_show==false){
  2592. list[i].wanshang14 = lastWeek[j].name
  2593. }else{
  2594. list[i].wanshang14 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2595. }
  2596. // list[i].wanshang14 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2597. }
  2598. //周二
  2599. if (lastWeek[j].schedule_week == 2 && lastWeek[j].schedule_type == 1) {
  2600. if(this.guanliu_show==false){
  2601. list[i].shangwu15 = lastWeek[j].name
  2602. }else{
  2603. list[i].shangwu15 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2604. }
  2605. // list[i].shangwu15 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2606. }
  2607. //周二下午
  2608. if (lastWeek[j].schedule_week == 2 && lastWeek[j].schedule_type == 2) {
  2609. if(this.guanliu_show==false){
  2610. list[i].xiawu15 = lastWeek[j].name
  2611. console.log('22222',list[i].xiawu15);
  2612. }else{
  2613. list[i].xiawu15 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2614. }
  2615. // list[i].xiawu15 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2616. }
  2617. //周二晚上
  2618. if (lastWeek[j].schedule_week == 2 && lastWeek[j].schedule_type == 3) {
  2619. if(this.guanliu_show==false){
  2620. list[i].wanshang15 = lastWeek[j].name
  2621. }else{
  2622. list[i].wanshang15 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2623. }
  2624. // list[i].wanshang15 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2625. }
  2626. //周三
  2627. if (lastWeek[j].schedule_week == 3 && lastWeek[j].schedule_type == 1) {
  2628. if(this.guanliu_show==false){
  2629. list[i].shangwu16 = lastWeek[j].name
  2630. }else{
  2631. list[i].shangwu16 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2632. }
  2633. // list[i].shangwu16 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2634. }
  2635. //周三下午
  2636. if (lastWeek[j].schedule_week == 3 && lastWeek[j].schedule_type == 2) {
  2637. if(this.guanliu_show==false){
  2638. list[i].xiawu16 = lastWeek[j].name
  2639. }else{
  2640. list[i].xiawu16 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2641. }
  2642. // list[i].xiawu16 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2643. }
  2644. //周三晚上
  2645. if (lastWeek[j].schedule_week == 3 && lastWeek[j].schedule_type == 3) {
  2646. if(this.guanliu_show==false){
  2647. list[i].wanshang16 = lastWeek[j].name
  2648. }else{
  2649. list[i].wanshang16 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2650. }
  2651. // list[i].wanshang16 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2652. }
  2653. //周四
  2654. if (lastWeek[j].schedule_week == 4 && lastWeek[j].schedule_type == 1) {
  2655. if(this.guanliu_show==false){
  2656. list[i].shangwu17 = lastWeek[j].name
  2657. }else{
  2658. list[i].shangwu17 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2659. }
  2660. // list[i].shangwu17 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2661. }
  2662. //周四下午
  2663. if (lastWeek[j].schedule_week == 4 && lastWeek[j].schedule_type == 2) {
  2664. if(this.guanliu_show==false){
  2665. list[i].xiawu17 = lastWeek[j].name
  2666. }else{
  2667. list[i].xiawu17 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2668. }
  2669. // list[i].xiawu17 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2670. }
  2671. //周四晚上
  2672. if (lastWeek[j].schedule_week == 4 && lastWeek[j].schedule_type == 3) {
  2673. if(this.guanliu_show==false){
  2674. list[i].wanshang17 = lastWeek[j].name
  2675. }else{
  2676. list[i].wanshang17 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2677. }
  2678. // list[i].wanshang17 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2679. }
  2680. //周五
  2681. if (lastWeek[j].schedule_week == 5 && lastWeek[j].schedule_type == 1) {
  2682. if(this.guanliu_show==false){
  2683. list[i].shangwu18 = lastWeek[j].name
  2684. }else{
  2685. list[i].shangwu18 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2686. }
  2687. // list[i].shangwu18 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2688. }
  2689. //周五下午
  2690. if (lastWeek[j].schedule_week == 5 && lastWeek[j].schedule_type == 2) {
  2691. if(this.guanliu_show==false){
  2692. list[i].xiawu18 = lastWeek[j].name
  2693. }else{
  2694. list[i].xiawu18 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2695. }
  2696. // list[i].xiawu18 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2697. }
  2698. //周五晚上
  2699. if (lastWeek[j].schedule_week == 5 && lastWeek[j].schedule_type == 3) {
  2700. if(this.guanliu_show==false){
  2701. list[i].wanshang18 = lastWeek[j].name
  2702. }else{
  2703. list[i].wanshang18 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2704. }
  2705. // list[i].wanshang18 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2706. }
  2707. //周六
  2708. if (lastWeek[j].schedule_week == 6 && lastWeek[j].schedule_type == 1) {
  2709. if(this.guanliu_show==false){
  2710. list[i].shangwu19 = lastWeek[j].name
  2711. }else{
  2712. list[i].shangwu19 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2713. }
  2714. // list[i].shangwu19 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2715. }
  2716. //周六下午
  2717. if (lastWeek[j].schedule_week == 6 && lastWeek[j].schedule_type == 2) {
  2718. if(this.guanliu_show==false){
  2719. list[i].xiawu19 = lastWeek[j].name
  2720. }else{
  2721. list[i].xiawu19 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2722. }
  2723. // list[i].xiawu19 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2724. }
  2725. //周六晚上
  2726. if (lastWeek[j].schedule_week == 6 && lastWeek[j].schedule_type == 3) {
  2727. if(this.guanliu_show==false){
  2728. list[i].wanshang19 = lastWeek[j].name
  2729. }else{
  2730. list[i].wanshang19 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2731. }
  2732. // list[i].wanshang19 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2733. }
  2734. //周日
  2735. if (lastWeek[j].schedule_week == 7 && lastWeek[j].schedule_type == 1) {
  2736. if(this.guanliu_show==false){
  2737. list[i].shangwu20 = lastWeek[j].name
  2738. }else{
  2739. list[i].shangwu20 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2740. }
  2741. // list[i].shangwu20 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2742. }
  2743. //周日下午
  2744. if (lastWeek[j].schedule_week == 7 && lastWeek[j].schedule_type == 2) {
  2745. if(this.guanliu_show==false){
  2746. list[i].xiawu20 = lastWeek[j].name
  2747. }else{
  2748. list[i].xiawu20 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2749. }
  2750. // list[i].xiawu20 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2751. }
  2752. //周日晚上
  2753. if (lastWeek[j].schedule_week == 7 && lastWeek[j].schedule_type == 3) {
  2754. if(this.guanliu_show==false){
  2755. list[i].wanshang20 = lastWeek[j].name
  2756. }else{
  2757. list[i].wanshang20 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2758. }
  2759. // list[i].wanshang20 = lastWeek[j].name+" "+lastWeek[j].dialysis_machine_name
  2760. }
  2761. }
  2762. }
  2763. }
  2764. }
  2765. this.tableList = list
  2766. this.start_time = ""
  2767. this.end_time = ""
  2768. }
  2769. })
  2770. },
  2771. changePartition(val) {
  2772. this.partition_id = val
  2773. // this.getThreeWeekList()
  2774. // this.getWeekPanels()
  2775. },
  2776. changeSchedule(val) {
  2777. console.log('3333',val);
  2778. this.schedule_type = val
  2779. this.getThreeWeekList()
  2780. this.getWeekPanels()
  2781. },
  2782. changeWeekDay(val){
  2783. console.log("Val2332322323wo",val)
  2784. var str = val.join(",")
  2785. console.log("stor233233223",str)
  2786. this.week_date = str
  2787. },
  2788. changeScheduleType(val){
  2789. this.schedule_type = val
  2790. },
  2791. changeWeek(val) {
  2792. this.start_time = ""
  2793. this.end_time = ""
  2794. this.newDay = []
  2795. var start = this.getTimestamp(val) - 57600
  2796. this.start_time = this.getTime(start)
  2797. this.newDay.push(this.start_time)
  2798. var next = start + 86400
  2799. var nest_day = this.getTime(next)
  2800. this.newDay.push(nest_day)
  2801. var last_days = start + 172800
  2802. var last_day = this.getTime(last_days)
  2803. this.newDay.push(last_day)
  2804. var tuesdays = start + 259200
  2805. var tuesday = this.getTime(tuesdays)
  2806. this.newDay.push(tuesday)
  2807. var fivdays = start + 345600
  2808. var fiveday = this.getTime(fivdays)
  2809. this.newDay.push(fiveday)
  2810. var sixday = start + 432000
  2811. var sixdays = this.getTime(sixday)
  2812. this.newDay.push(sixdays)
  2813. var end = this.getTimestamp(val) + 460800
  2814. this.end_time = this.getTime(end)
  2815. this.newDay.push(this.end_time)
  2816. this.export_type = 1
  2817. this.getThreeWeekList()
  2818. },
  2819. getTime(val) {
  2820. return uParseTime(val, '{y}-{m}-{d}')
  2821. },
  2822. smartsch(){
  2823. this.$nextTick(function() {
  2824. this.$refs.edittableData.showSmartDialog()
  2825. })
  2826. },
  2827. editsch() {
  2828. this.is_edit = true
  2829. this.schedulingTableVisible=true
  2830. this.$nextTick(function() {//, this.days,this.zones
  2831. this.$refs.edittableData.setEditData(this.patientList, this.$store.getters.treatment_mode, this.days,this.zones)
  2832. })
  2833. },
  2834. outisedit(){
  2835. this.is_edit=false
  2836. this.beforeshow=false
  2837. this.schedulingTableVisible=false
  2838. },
  2839. copySchedule() {
  2840. this.newVisible = true
  2841. },
  2842. getYearWeek(year, month, date) {
  2843. /*
  2844. dateNow是当前日期
  2845. dateFirst是当年第一天
  2846. dataNumber是当前日期是今年第多少天
  2847. 用dataNumber + 当前年的第一天的周差距的和在除以7就是本年第几周
  2848. */
  2849. let dateNow = new Date(year, parseInt(month) - 1, date);
  2850. let dateFirst = new Date(year, 0, 1);
  2851. let dataNumber = Math.round((dateNow.valueOf() - dateFirst.valueOf()) / 86400000);
  2852. return Math.ceil((dataNumber + ((dateFirst.getDay() + 1) - 1)) / 7) - 1;
  2853. },
  2854. getTimestamp(time) { //把时间日期转成时间戳
  2855. return (new Date(time)).getTime() / 1000
  2856. },
  2857. formatDate(date) {
  2858. var year = date.getFullYear() + '.'
  2859. var month = (date.getMonth() + 1) + '.';
  2860. var day = date.getDate();
  2861. return year + month + day
  2862. },
  2863. formatDateTwo(date) {
  2864. var year = date.getFullYear() + '.'
  2865. var month = (date.getMonth() + 1) + '.';
  2866. var day = date.getDate();
  2867. return year + month + day
  2868. },
  2869. addDate(date, n) {
  2870. date.setDate(date.getDate() + n);
  2871. return date;
  2872. },
  2873. //
  2874. setDate(date) {
  2875. var week = date.getDay() - 1;
  2876. date = this.addDate(date, week * -1);
  2877. this.currentFirstDate = new Date(date);
  2878. this.currentDate = new Date(date)
  2879. for (var i = 0; i < this.clen; i++) {
  2880. this.weekDayArr.push(this.formatDate(i == 0 ? date : this.addDate(date, 1)))
  2881. }
  2882. },
  2883. setDate1(date) {
  2884. var week = date.getDay() - 1
  2885. date = this.addDate(date, week * -1)
  2886. this.currentDate = new Date(date)
  2887. let arr1 = []
  2888. for (var i = 0; i < this.clen; i++) {
  2889. arr1.push(this.formatDate(i == 0 ? date : this.addDate(date, 1)))
  2890. }
  2891. this.weekList.push(arr1)
  2892. let num = this.weekNum
  2893. this.currentFirstDate1 = num + 1
  2894. },
  2895. getTimestamp(time) { //把时间日期转成时间戳
  2896. return (new Date(time)).getTime() / 1000
  2897. },
  2898. submitAction(formName) {
  2899. var start_time = ""
  2900. var end_time = ""
  2901. //上周
  2902. if (this.form.lastweek == "1") {
  2903. let weekOfday = parseInt(moment().format('d'))
  2904. start_time = this.getTimestamp(moment().subtract(weekOfday + 6, 'days').format('YYYY-MM-DD')) - 28800
  2905. end_time = this.getTimestamp(moment().subtract(weekOfday, 'days').format('YYYY-MM-DD')) - 28800
  2906. }
  2907. //本周
  2908. if (this.form.lastweek == "2") {
  2909. start_time = this.getTimestamp(this.weekDayArr[0])
  2910. end_time = this.getTimestamp(this.weekDayArr[6])
  2911. }
  2912. var label = ""
  2913. for (let i = 0; i < this.timeOptions.length; i++) {
  2914. if (this.form.copyWeek == this.timeOptions[i].value) {
  2915. label = this.timeOptions[i].label
  2916. }
  2917. }
  2918. var start = label.split('~')
  2919. var copy_startime = this.getTimestamp(start[0])
  2920. var copy_endtime = this.getTimestamp(start[1])
  2921. const params = {
  2922. start_time: start_time,
  2923. end_time: end_time,
  2924. copy_startime: copy_startime,
  2925. copy_endtime: copy_endtime,
  2926. }
  2927. this.$refs[formName].validate(valid => {
  2928. if (valid) {
  2929. if(!this.copySchLoading){
  2930. this.copySchLoading = true
  2931. copyPatientSchedule(params).then(response => {
  2932. if (response.data.state == 1) {
  2933. var msg = response.data.data.msg
  2934. this.$message.success("复制成功")
  2935. this.copySchLoading = false
  2936. this.newVisible = false
  2937. } else {
  2938. this.copySchLoading = false
  2939. this.$message.error("复制失败")
  2940. }
  2941. })
  2942. }
  2943. }
  2944. })
  2945. },
  2946. getlist() {
  2947. getScheduleTemplate().then(response => {
  2948. if (response.data.state == 1) {
  2949. var template = response.data.data.template
  2950. console.log('12243254',response.data.data);
  2951. this.templateObj = template
  2952. }
  2953. })
  2954. },
  2955. getPatientList(){
  2956. patientLists().then(response => {
  2957. if (response.data.state == 1) {
  2958. var patientList = response.data.data.list
  2959. this.patientList = patientList
  2960. console.log("list")
  2961. console.log( this.patientList)
  2962. }
  2963. })
  2964. }
  2965. },
  2966. created() {
  2967. this.getlist()
  2968. this.getPatientList()
  2969. var start_time = moment().weekday(1).format('YYYY-MM-DD');
  2970. this.start_time = start_time
  2971. var end_time = this.getNextWeek(2)
  2972. this.end_time = end_time
  2973. this.getWeekPanels()
  2974. this.getInitDate()
  2975. //获取三周排班数据
  2976. this.getThreeWeekList()
  2977. let year = new Date().getFullYear()
  2978. let month = new Date().getMonth() + 1
  2979. let date = new Date().getDate()
  2980. this.weekNum = this.getYearWeek(year, month, date)
  2981. this.todayDate = this.formatDate(new Date())
  2982. this.setDate(new Date())
  2983. for (var i = 0; i <= 9; i++) {
  2984. this.setDate1(this.addDate(this.currentDate, 7))
  2985. }
  2986. let newNum = 0
  2987. for (let i = 0; i < this.weekList.length; i++) {
  2988. if (this.weekNum + i + 2 <= 53) {
  2989. let num = this.weekNum + i + 2
  2990. let str = this.weekList[i][0] + '~' + this.weekList[i][6] + '(' + num + ')'
  2991. this.typeOptions.push({value: i, label: str})
  2992. let stt = this.weekList[i][0] + "~" + this.weekList[i][6]
  2993. this.timeOptions.push({value: i, label: stt})
  2994. } else {
  2995. newNum++
  2996. let str = this.weekList[i][0] + '~' + this.weekList[i][6] + '(' + newNum + ')'
  2997. this.typeOptions.push({value: i, label: str})
  2998. let stt = this.weekList[i][0] + "~" + this.weekList[i][6]
  2999. this.timeOptions.push({value: i, label: stt})
  3000. }
  3001. }
  3002. },
  3003. // updated(){
  3004. // this.getThreeWeekList()
  3005. // }
  3006. }
  3007. </script>
  3008. <style rel="stylesheet/css" lang="scss">
  3009. .schedule-table-cell-disable {
  3010. background-color: #F5F5F5 !important;
  3011. }
  3012. </style>