template.vue 125KB

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