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

template.vue 125KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285
  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){
  2348. var tempDataOne = []
  2349. for(let i = 0; i < val.length; i++){
  2350. tempDataOne.push(val[i])
  2351. }
  2352. this.$refs.table.SetSmartSch(tempDataOne)
  2353. },
  2354. getWeekPanels(val) {
  2355. getWeekPanels(1,val).then(response => {
  2356. if (response.data.state == 0) {
  2357. return false
  2358. }
  2359. var partitions = response.data.data.partitions
  2360. var that = this
  2361. if (partitions.length > 0) {
  2362. partitions.forEach(function (partition) {
  2363. if (partition.jihaos.length == 0) {
  2364. return false
  2365. }
  2366. that.partitions[partition.id] = partition
  2367. partition.jihaos.forEach(function (jihao) {
  2368. var thisPa = {
  2369. area: partition.name,
  2370. zone_id: partition.id,
  2371. zone_type: partition.type,
  2372. cut: jihao.number,
  2373. jihao_id: jihao.id,
  2374. Mon_M: {
  2375. schedule_id: 0,
  2376. mode_id: 0,
  2377. mode_name: '',
  2378. patient_id: 0,
  2379. patient: ''
  2380. },
  2381. Mon_A: {
  2382. schedule_id: 0,
  2383. mode_id: 0,
  2384. mode_name: '',
  2385. patient_id: 0,
  2386. patient: ''
  2387. },
  2388. Mon_N: {
  2389. schedule_id: 0,
  2390. mode_id: 0,
  2391. mode_name: '',
  2392. patient_id: 0,
  2393. patient: ''
  2394. },
  2395. Tue_M: {
  2396. schedule_id: 0,
  2397. mode_id: 0,
  2398. mode_name: '',
  2399. patient_id: 0,
  2400. patient: ''
  2401. },
  2402. Tue_A: {
  2403. schedule_id: 0,
  2404. mode_id: 0,
  2405. mode_name: '',
  2406. patient_id: 0,
  2407. patient: ''
  2408. },
  2409. Tue_N: {
  2410. schedule_id: 0,
  2411. mode_id: 0,
  2412. mode_name: '',
  2413. patient_id: 0,
  2414. patient: ''
  2415. },
  2416. Wed_M: {
  2417. schedule_id: 0,
  2418. mode_id: 0,
  2419. mode_name: '',
  2420. patient_id: 0,
  2421. patient: ''
  2422. },
  2423. Wed_A: {
  2424. schedule_id: 0,
  2425. mode_id: 0,
  2426. mode_name: '',
  2427. patient_id: 0,
  2428. patient: ''
  2429. },
  2430. Wed_N: {
  2431. schedule_id: 0,
  2432. mode_id: 0,
  2433. mode_name: '',
  2434. patient_id: 0,
  2435. patient: ''
  2436. },
  2437. Thurs_M: {
  2438. schedule_id: 0,
  2439. mode_id: 0,
  2440. mode_name: '',
  2441. patient_id: 0,
  2442. patient: ''
  2443. },
  2444. Thurs_A: {
  2445. schedule_id: 0,
  2446. mode_id: 0,
  2447. mode_name: '',
  2448. patient_id: 0,
  2449. patient: ''
  2450. },
  2451. Thurs_N: {
  2452. schedule_id: 0,
  2453. mode_id: 0,
  2454. mode_name: '',
  2455. patient_id: 0,
  2456. patient: ''
  2457. },
  2458. Fri_M: {
  2459. schedule_id: 0,
  2460. mode_id: 0,
  2461. mode_name: '',
  2462. patient_id: 0,
  2463. patient: ''
  2464. },
  2465. Fri_A: {
  2466. schedule_id: 0,
  2467. mode_id: 0,
  2468. mode_name: '',
  2469. patient_id: 0,
  2470. patient: ''
  2471. },
  2472. Fri_N: {
  2473. schedule_id: 0,
  2474. mode_id: 0,
  2475. mode_name: '',
  2476. patient_id: 0,
  2477. patient: ''
  2478. },
  2479. Sat_M: {
  2480. schedule_id: 0,
  2481. mode_id: 0,
  2482. mode_name: '',
  2483. patient_id: 0,
  2484. patient: ''
  2485. },
  2486. Sat_A: {
  2487. schedule_id: 0,
  2488. mode_id: 0,
  2489. mode_name: '',
  2490. patient_id: 0,
  2491. patient: ''
  2492. },
  2493. Sat_N: {
  2494. schedule_id: 0,
  2495. mode_id: 0,
  2496. mode_name: '',
  2497. patient_id: 0,
  2498. patient: ''
  2499. },
  2500. Sun_A: {
  2501. schedule_id: 0,
  2502. mode_id: 0,
  2503. mode_name: '',
  2504. patient_id: 0,
  2505. patient: ''
  2506. },
  2507. Sun_N: {
  2508. schedule_id: 0,
  2509. mode_id: 0,
  2510. mode_name: '',
  2511. patient_id: 0,
  2512. patient: ''
  2513. },
  2514. Sun_M: {
  2515. schedule_id: 0,
  2516. mode_id: 0,
  2517. mode_name: '',
  2518. patient_id: 0,
  2519. patient: ''
  2520. },
  2521. total: 0
  2522. }
  2523. })
  2524. })
  2525. }
  2526. })
  2527. },editClick:function (){
  2528. this.$nextTick(function() {
  2529. if(this.activeName == "first"){
  2530. this.activeName = "first"
  2531. this.$refs.table.showSmartDialog()
  2532. }else if(this.activeName == "second"){
  2533. this.activeName = "second"
  2534. this.$refs.table.showSmartDialog()
  2535. }else if(this.activeName == "third"){
  2536. this.activeName = "third"
  2537. this.$refs.table.showSmartDialog()
  2538. }else {
  2539. this.activeName = "four"
  2540. this.$refs.table.showSmartDialog()
  2541. }
  2542. })
  2543. },saveClick:function (){
  2544. if(this.template_mode.mode == 0){
  2545. // this.$router.go(-1)
  2546. this.$router.back()
  2547. }else{
  2548. this.$message.success("保存成功")
  2549. this.$router.back()
  2550. }
  2551. },
  2552. setScheduleTemplateAction: function () {
  2553. this.$refs.setup_dialog.show()
  2554. },
  2555. didChangeTemplateMode: function (mode) {
  2556. if (this.origin_mode != mode) {
  2557. if (this.origin_mode == 0) { // 0 -> 1 或 0 -> 2
  2558. // 不处理模板 item
  2559. } else if (mode == 0) { // 1 -> 0 或 2 -> 0 清除所有模板的 item
  2560. this.first_template.items.splice(0, this.first_template.items.length)
  2561. this.second_template.items.splice(0, this.second_template.items.length)
  2562. this.third_template.items.splice(0, this.third_template.items.length)
  2563. this.four_template.items.splice(0, this.four_template.items.length)
  2564. } else if (this.origin_mode == 1 && mode == 2) { // 1 -> 2
  2565. // 不处理模板 item
  2566. }else if (this.origin_mode == 1 && mode == 3) { // 1 -> 2
  2567. // 不处理模板 item
  2568. }else if (this.origin_mode == 1 && mode == 4) { // 1 -> 2
  2569. // 不处理模板 item
  2570. } else if (this.origin_mode == 2 && mode == 1) { // 2 -> 1 清除第二个模板的 item
  2571. this.second_template.items.splice(0, this.second_template.items.length)
  2572. }else if (this.origin_mode == 3 && mode == 1) { // 2 -> 1 清除第二个模板的 item
  2573. this.second_template.items.splice(0, this.second_template.items.length)
  2574. this.third_template.items.splice(0, this.third_template.items.length)
  2575. }else if (this.origin_mode == 3 && mode == 2){
  2576. this.third_template.items.splice(0, this.third_template.items.length)
  2577. }else if (this.origin_mode == 4 && mode == 1) {
  2578. this.second_template.items.splice(0, this.second_template.items.length)
  2579. this.third_template.items.splice(0, this.third_template.items.length)
  2580. this.four_template.items.splice(0, this.four_template.items.length)
  2581. }else if (this.origin_mode == 4 && mode == 2) {
  2582. this.third_template.items.splice(0, this.third_template.items.length)
  2583. this.four_template.items.splice(0, this.four_template.items.length)
  2584. }else if (this.origin_mode == 4 && mode == 3) {
  2585. this.four_template.items.splice(0, this.four_template.items.length)
  2586. }
  2587. this.origin_mode = mode
  2588. let params = {
  2589. patitionid:""
  2590. }
  2591. getTemplateInitData(params).then(rs => {
  2592. var resp = rs.data
  2593. if (resp.state == 1) {
  2594. var mode = resp.data.template_mode
  2595. var device_numbers = resp.data.device_numbers
  2596. var templates = resp.data.templates
  2597. this.templates = templates
  2598. if(templates.length > 0){
  2599. this.firstWeekData = templates[0].items
  2600. this.first_template = templates[0]
  2601. }
  2602. if(templates.length > 1){
  2603. this.secondWeekData = templates[1].items
  2604. this.second_template = templates[1]
  2605. }
  2606. if(templates.length > 2){
  2607. this.thirdWeekData = templates[2].items
  2608. this.third_template = templates[2]
  2609. }
  2610. if(templates.length > 3){
  2611. this.fourWeekData = templates[3].items
  2612. this.four_template = templates[3]
  2613. }
  2614. var patients = resp.data.patients
  2615. // var schedules = resp.data.schedules
  2616. this.template_mode = mode
  2617. this.origin_mode = mode.mode
  2618. this.device_numbers = device_numbers
  2619. this.patients = patients
  2620. this.$refs.table.setEditData(this.patients,this.first_template,this.device_numbers,this.templates, this.activeName)
  2621. // this.$refs.table_two.setEditData(this.patients,this.second_template,this.device_numbers)
  2622. // this.$refs.table_three.setEditData(this.patients,this.third_template,this.device_numbers)
  2623. // this.$refs.table_four.setEditData(this.patients,this.four_template,this.device_numbers)
  2624. var fakeTemplateItems = []
  2625. // for (let index = 0; index < schedules.length; index++) {
  2626. // const schedule = schedules[index]
  2627. // var item = {}
  2628. // this.$set(item, 'id', schedule.id)
  2629. // this.$set(item, 'template_id', 0)
  2630. // this.$set(item, 'device_number_id', schedule.bed_id)
  2631. // this.$set(item, 'treat_mode', schedule.mode_id)
  2632. // this.$set(item, 'weekday', schedule.schedule_week)
  2633. // this.$set(item, 'time_type', schedule.schedule_type)
  2634. // var patient = {}
  2635. // this.$set(patient, 'id', schedule.patient_id)
  2636. // this.$set(patient, 'name', schedule.patient)
  2637. // this.$set(item, 'patient', patient)
  2638. //
  2639. // fakeTemplateItems.push(item)
  2640. // }
  2641. this.this_week_schedules.items = fakeTemplateItems
  2642. } else {
  2643. this.$message(resp.msg)
  2644. }
  2645. })
  2646. }
  2647. },
  2648. formatJson(filterVal, jsonData) {
  2649. return jsonData.map(v =>
  2650. filterVal.map(j => {
  2651. return v[j]
  2652. })
  2653. )
  2654. },
  2655. import_file: function () {
  2656. this.downloadLoading = true
  2657. import('@/vendor/Export2Excel').then(excel => {
  2658. const filterVal = [
  2659. '区号',
  2660. '机号'
  2661. ]
  2662. const multiHeaderForModeOne = [['区号', '机号', '周一', '', '', '周二', '', '', '周三', '', '', '周四', '', '', '周五', '', '', '周六', '', '', '周日', '', '']]
  2663. const multiHeaderForModeTwo = [['区号', '机号', '周一', '', '', '周二', '', '', '周三', '', '', '周四', '', '', '周五', '', '', '周六', '', '', '周日', '', '', '周一', '', '', '周二', '', '', '周三', '', '', '周四', '', '', '周五', '', '', '周六', '', '', '周日', '', '']]
  2664. const multiHeaderForModeThree = [['区号', '机号', '周一', '', '', '周二', '', '', '周三', '', '', '周四', '', '', '周五', '', '', '周六', '', '', '周日', '', '', '周一', '', '', '周二', '', '', '周三', '', '', '周四', '', '', '周五', '', '', '周六', '', '', '周日', '', '', '周一', '', '', '周二', '', '', '周三', '', '', '周四', '', '', '周五', '', '', '周六', '', '', '周日', '', '']]
  2665. const multiHeaderForModeFour = [['区号', '机号', '周一', '', '', '周二', '', '', '周三', '', '', '周四', '', '', '周五', '', '', '周六', '', '', '周日', '', '', '周一', '', '', '周二', '', '', '周三', '', '', '周四', '', '', '周五', '', '', '周六', '', '', '周日', '', '','周一', '', '', '周二', '', '', '周三', '', '', '周四', '', '', '周五', '', '', '周六', '', '', '周日', '', '','周一', '', '', '周二', '', '', '周三', '', '', '周四', '', '', '周五', '', '', '周六', '', '', '周日', '', '']]
  2666. const headerForModeOne = ['', '', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上']
  2667. const headerForModeTwo = ['', '', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上']
  2668. const headerForModeThree = ['', '', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上']
  2669. const headerForModeFour = ['', '', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上', '上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上','上午', '下午', '晚上']
  2670. const merges = ['A1:A2', 'B1:B2', 'C1:E1', 'F1:H1', 'I1:K1', 'L1:N1', 'O1:Q1', 'R1:T1', 'U1:W1']
  2671. 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']
  2672. 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']
  2673. 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']
  2674. var list = []
  2675. let i = 0
  2676. for (let key in this.partitions) {
  2677. var tempValue
  2678. var jihaos = this.partitions[key].jihaos
  2679. if (i == 0) {
  2680. let m = 'A3' + ':' + 'A' + (2 + jihaos.length)
  2681. tempValue = (2 + jihaos.length)
  2682. mergesFour.push(m)
  2683. } else {
  2684. let m = 'A' + (tempValue + 1) + ':' + 'A' + ((tempValue + 1) + jihaos.length - 1)
  2685. tempValue = ((tempValue + 1) + jihaos.length - 1)
  2686. mergesFour.push(m)
  2687. }
  2688. for (let b = 0; b < jihaos.length; b++) {
  2689. let obj = {}
  2690. obj['区号'] = this.partitions[key].name
  2691. obj['机号'] = jihaos[b].number.toString()
  2692. obj['shangwu'] = ''
  2693. obj['xiawu'] = ''
  2694. obj['wanshang'] = ''
  2695. obj['shangwu1'] = ''
  2696. obj['xiawu1'] = ''
  2697. obj['wanshang1'] = ''
  2698. obj['shangwu2'] = ''
  2699. obj['xiawu2'] = ''
  2700. obj['wanshang2'] = ''
  2701. obj['shangwu3'] = ''
  2702. obj['xiawu3'] = ''
  2703. obj['wanshang3'] = ''
  2704. obj['shangwu4'] = ''
  2705. obj['xiawu4'] = ''
  2706. obj['wanshang4'] = ''
  2707. obj['shangwu5'] = ''
  2708. obj['xiawu5'] = ''
  2709. obj['wanshang5'] = ''
  2710. obj['shangwu6'] = ''
  2711. obj['xiawu6'] = ''
  2712. obj['wanshang6'] = ''
  2713. obj['shangwu7'] = ''
  2714. obj['xiawu7'] = ''
  2715. obj['wanshang7'] = ''
  2716. obj['shangwu8'] = ''
  2717. obj['xiawu8'] = ''
  2718. obj['wanshang8'] = ''
  2719. obj['shangwu9'] = ''
  2720. obj['xiawu9'] = ''
  2721. obj['wanshang9'] = ''
  2722. obj['shangwu10'] = ''
  2723. obj['xiawu10'] = ''
  2724. obj['wanshang10'] = ''
  2725. obj['shangwu11'] = ''
  2726. obj['xiawu11'] = ''
  2727. obj['wanshang11'] = ''
  2728. obj['shangwu12'] = ''
  2729. obj['xiawu12'] = ''
  2730. obj['wanshang12'] = ''
  2731. obj['shangwu13'] = ''
  2732. obj['xiawu13'] = ''
  2733. obj['wanshang13'] = ''
  2734. obj['shangwu14'] = ''
  2735. obj['xiawu14'] = ''
  2736. obj['wanshang14'] = ''
  2737. obj['shangwu15'] = ''
  2738. obj['xiawu15'] = ''
  2739. obj['wanshang15'] = ''
  2740. obj['shangwu16'] = ''
  2741. obj['xiawu16'] = ''
  2742. obj['wanshang16'] = ''
  2743. obj['shangwu17'] = ''
  2744. obj['xiawu17'] = ''
  2745. obj['wanshang17'] = ''
  2746. obj['shangwu18'] = ''
  2747. obj['xiawu18'] = ''
  2748. obj['wanshang18'] = ''
  2749. obj['shangwu19'] = ''
  2750. obj['xiawu19'] = ''
  2751. obj['wanshang19'] = ''
  2752. obj['shangwu20'] = ''
  2753. obj['xiawu20'] = ''
  2754. obj['wanshang20'] = ''
  2755. obj['shangwu21'] = ''
  2756. obj['xiawu21'] = ''
  2757. obj['wanshang21'] = ''
  2758. obj['shangwu22'] = ''
  2759. obj['xiawu22'] = ''
  2760. obj['wanshang22'] = ''
  2761. obj['shangwu23'] = ''
  2762. obj['xiawu23'] = ''
  2763. obj['wanshang23'] = ''
  2764. obj['shangwu24'] = ''
  2765. obj['xiawu24'] = ''
  2766. obj['wanshang24'] = ''
  2767. obj['shangwu25'] = ''
  2768. obj['xiawu25'] = ''
  2769. obj['wanshang25'] = ''
  2770. obj['shangwu26'] = ''
  2771. obj['xiawu26'] = ''
  2772. obj['wanshang26'] = ''
  2773. obj['shangwu27'] = ''
  2774. obj['xiawu27'] = ''
  2775. obj['wanshang27'] = ''
  2776. list.push(obj)
  2777. }
  2778. i++
  2779. }
  2780. for (let i = 0; i < this.firstWeekData.length; i++) {
  2781. this.firstWeekData[i].name = ""
  2782. this.firstWeekData[i].number_name = ""
  2783. }
  2784. for (let i = 0; i < this.secondWeekData.length; i++) {
  2785. this.secondWeekData[i].name = ""
  2786. this.secondWeekData[i].number_name = ""
  2787. }
  2788. for (let i = 0; i < this.thirdWeekData.length; i++) {
  2789. this.thirdWeekData[i].name = ""
  2790. this.thirdWeekData[i].number_name = ""
  2791. }
  2792. for (let i = 0; i < this.fourWeekData.length; i++) {
  2793. this.fourWeekData[i].name = ""
  2794. this.fourWeekData[i].number_name = ""
  2795. }
  2796. console.log(this.firstWeekData)
  2797. console.log(this.device_numbers)
  2798. for (let i = 0; i < this.firstWeekData.length; i++) {
  2799. for (let j = 0; j < this.device_numbers.length; j++) {
  2800. if (this.firstWeekData[i].device_number_id == this.device_numbers[j].id) {
  2801. this.firstWeekData[i].number_name = this.device_numbers[j].number
  2802. }
  2803. }
  2804. }
  2805. for (let i = 0; i < this.secondWeekData.length; i++) {
  2806. for (let j = 0; j < this.device_numbers.length; j++) {
  2807. if (this.secondWeekData[i].device_number_id == this.device_numbers[j].id) {
  2808. this.secondWeekData[i].number_name = this.device_numbers[j].number
  2809. }
  2810. }
  2811. }
  2812. for (let i = 0; i < this.thirdWeekData.length; i++) {
  2813. for (let j = 0; j < this.device_numbers.length; j++) {
  2814. if (this.thirdWeekData[i].device_number_id == this.device_numbers[j].id) {
  2815. this.thirdWeekData[i].number_name = this.device_numbers[j].number
  2816. }
  2817. }
  2818. }
  2819. for (let i = 0; i < this.fourWeekData.length; i++) {
  2820. for (let j = 0; j < this.device_numbers.length; j++) {
  2821. if (this.fourWeekData[i].device_number_id == this.device_numbers[j].id) {
  2822. this.fourWeekData[i].number_name = this.device_numbers[j].number
  2823. }
  2824. }
  2825. }
  2826. for (let i = 0; i < this.firstWeekData.length; i++) {
  2827. for (let j = 0; j < this.patients.length; j++) {
  2828. if (this.firstWeekData[i].patient_id == this.patients[j].id) {
  2829. this.firstWeekData[i].name = this.patients[j].name
  2830. if(this.firstWeekData.length > 0){
  2831. this.firstWeekData[i].name = this.firstWeekData[i].name +"-" + this.getMode(this.firstWeekData[i].treat_mode)
  2832. }
  2833. }
  2834. }
  2835. }
  2836. for (let i = 0; i < this.secondWeekData.length; i++) {
  2837. for (let j = 0; j < this.patients.length; j++) {
  2838. if (this.secondWeekData[i].patient_id == this.patients[j].id) {
  2839. this.secondWeekData[i].name = this.patients[j].name
  2840. if(this.secondWeekData.length > 0){
  2841. this.secondWeekData[i].name = this.secondWeekData[i].name +"-" + this.getMode(this.secondWeekData[i].treat_mode)
  2842. }
  2843. }
  2844. }
  2845. }
  2846. for (let i = 0; i < this.thirdWeekData.length; i++) {
  2847. for (let j = 0; j < this.patients.length; j++) {
  2848. if (this.thirdWeekData[i].patient_id == this.patients[j].id) {
  2849. this.thirdWeekData[i].name = this.patients[j].name
  2850. if(this.thirdWeekData.length > 0){
  2851. this.thirdWeekData[i].name = this.thirdWeekData[i].name +"-" + this.getMode(this.thirdWeekData[i].treat_mode)
  2852. }
  2853. }
  2854. }
  2855. }
  2856. for (let i = 0; i < this.fourWeekData.length; i++) {
  2857. for (let j = 0; j < this.patients.length; j++) {
  2858. if (this.fourWeekData[i].patient_id == this.patients[j].id) {
  2859. this.fourWeekData[i].name = this.patients[j].name
  2860. if(this.fourWeekData.length > 0){
  2861. this.fourWeekData[i].name = this.fourWeekData[i].name +"-" + this.getMode(this.fourWeekData[i].treat_mode)
  2862. }
  2863. }
  2864. }
  2865. }
  2866. for (let i = 0; i < this.firstWeekData.length; i++) {
  2867. for (let j = 0; j < list.length; j++) {
  2868. if (this.firstWeekData[i].number_name == list[j].机号 && this.firstWeekData[i].devices.zone.name == list[j].区号) {
  2869. //第一周周一上午
  2870. if (this.firstWeekData[i].weekday == 1 && this.firstWeekData[i].time_type == 1) {
  2871. list[j].shangwu = this.firstWeekData[i].name
  2872. }
  2873. //第一周周一下午
  2874. if (this.firstWeekData[i].weekday == 1 && this.firstWeekData[i].time_type == 2) {
  2875. list[j].xiawu = this.firstWeekData[i].name
  2876. }
  2877. //第一周晚上
  2878. if (this.firstWeekData[i].weekday == 1 && this.firstWeekData[i].time_type == 3) {
  2879. list[j].wanshang = this.firstWeekData[i].name
  2880. }
  2881. //第一周周二上午
  2882. if (this.firstWeekData[i].weekday == 2 && this.firstWeekData[i].time_type == 1) {
  2883. list[j].shangwu1 = this.firstWeekData[i].name
  2884. }
  2885. //第一周周二下午
  2886. if (this.firstWeekData[i].weekday == 2 && this.firstWeekData[i].time_type == 2) {
  2887. list[j].xiawu1 = this.firstWeekData[i].name
  2888. }
  2889. //第一周周二晚上
  2890. if (this.firstWeekData[i].weekday == 2 && this.firstWeekData[i].time_type == 3) {
  2891. list[j].wanshang1 = this.firstWeekData[i].name
  2892. }
  2893. //第一周周三上午
  2894. if (this.firstWeekData[i].weekday == 3 && this.firstWeekData[i].time_type == 1) {
  2895. list[j].shangwu2 = this.firstWeekData[i].name
  2896. }
  2897. //第一周周三下午
  2898. if (this.firstWeekData[i].weekday == 3 && this.firstWeekData[i].time_type == 2) {
  2899. list[j].xiawu2 = this.firstWeekData[i].name
  2900. }
  2901. //第一周周三晚上
  2902. if (this.firstWeekData[i].weekday == 3 && this.firstWeekData[i].time_type == 3) {
  2903. list[j].wanshang2 = this.firstWeekData[i].name
  2904. }
  2905. //第一周周四上午
  2906. if (this.firstWeekData[i].weekday == 4 && this.firstWeekData[i].time_type == 1) {
  2907. list[j].shangwu3 = this.firstWeekData[i].name
  2908. }
  2909. //第一周周四下午
  2910. if (this.firstWeekData[i].weekday == 4 && this.firstWeekData[i].time_type == 2) {
  2911. list[j].xiawu3 = this.firstWeekData[i].name
  2912. }
  2913. //第一周周四晚上
  2914. if (this.firstWeekData[i].weekday == 4 && this.firstWeekData[i].time_type == 3) {
  2915. list[j].wanshang3 = this.firstWeekData[i].name
  2916. }
  2917. //第一周周五上午
  2918. if (this.firstWeekData[i].weekday == 5 && this.firstWeekData[i].time_type == 1) {
  2919. list[j].shangwu4 = this.firstWeekData[i].name
  2920. }
  2921. //第一周周五下午
  2922. if (this.firstWeekData[i].weekday == 5 && this.firstWeekData[i].time_type == 2) {
  2923. list[j].xiawu4 = this.firstWeekData[i].name
  2924. }
  2925. //第一周周五晚上
  2926. if (this.firstWeekData[i].weekday == 5 && this.firstWeekData[i].time_type == 3) {
  2927. list[j].wanshang4 = this.firstWeekData[i].name
  2928. }
  2929. //第一周周六上午
  2930. if (this.firstWeekData[i].weekday == 6 && this.firstWeekData[i].time_type == 1) {
  2931. list[j].shangwu5 = this.firstWeekData[i].name
  2932. }
  2933. //第一周周六下午
  2934. if (this.firstWeekData[i].weekday == 6 && this.firstWeekData[i].time_type == 2) {
  2935. list[j].xiawu5 = this.firstWeekData[i].name
  2936. }
  2937. //第一周周六晚上
  2938. if (this.firstWeekData[i].weekday == 6 && this.firstWeekData[i].time_type == 3) {
  2939. list[j].wanshang5 = this.firstWeekData[i].name
  2940. }
  2941. //第一周周日上午
  2942. if (this.firstWeekData[i].weekday == 7 && this.firstWeekData[i].time_type == 1) {
  2943. list[j].shangwu6 = this.firstWeekData[i].name
  2944. }
  2945. //第一周周日下午
  2946. if (this.firstWeekData[i].weekday == 7 && this.firstWeekData[i].time_type == 2) {
  2947. list[j].xiawu6 = this.firstWeekData[i].name
  2948. }
  2949. //第一周周日晚上
  2950. if (this.firstWeekData[i].weekday == 7 && this.firstWeekData[i].time_type == 3) {
  2951. list[j].wanshang6 = this.firstWeekData[i].name
  2952. }
  2953. }
  2954. }
  2955. }
  2956. for (let i = 0; i < this.secondWeekData.length; i++) {
  2957. for (let j = 0; j < list.length; j++) {
  2958. if (list[j].机号 == this.secondWeekData[i].number_name && this.secondWeekData[i].devices.zone.name == list[j].区号) {
  2959. //第二周周一上午
  2960. if (this.secondWeekData[i].weekday == 1 && this.secondWeekData[i].time_type == 1) {
  2961. list[j].shangwu7 = this.secondWeekData[i].name
  2962. }
  2963. //第二周周一下午
  2964. if (this.secondWeekData[i].weekday == 1 && this.secondWeekData[i].time_type == 2) {
  2965. list[j].xiawu7 = this.secondWeekData[i].name
  2966. }
  2967. //第二周周一晚上
  2968. if (this.secondWeekData[i].weekday == 1 && this.secondWeekData[i].time_type == 3) {
  2969. list[j].wanshang7 = this.secondWeekData[i].name
  2970. }
  2971. //第二周周二上午
  2972. if (this.secondWeekData[i].weekday == 2 && this.secondWeekData[i].time_type == 1) {
  2973. list[j].shangwu8 = this.secondWeekData[i].name
  2974. }
  2975. //第二周周二下午
  2976. if (this.secondWeekData[i].weekday == 2 && this.secondWeekData[i].time_type == 2) {
  2977. list[j].xiawu8 = this.secondWeekData[i].name
  2978. }
  2979. //第二周周二晚上
  2980. if (this.secondWeekData[i].weekday == 2 && this.secondWeekData[i].time_type == 3) {
  2981. list[j].wanshang8 = this.secondWeekData[i].name
  2982. }
  2983. //第二周周三上午
  2984. if (this.secondWeekData[i].weekday == 3 && this.secondWeekData[i].time_type == 1) {
  2985. list[j].shangwu9 = this.secondWeekData[i].name
  2986. }
  2987. //第二周周三下午
  2988. if (this.secondWeekData[i].weekday == 3 && this.secondWeekData[i].time_type == 2) {
  2989. list[j].xiawu9 = this.secondWeekData[i].name
  2990. }
  2991. //第二周周三晚上
  2992. if (this.secondWeekData[i].weekday == 3 && this.secondWeekData[i].time_type == 3) {
  2993. list[j].wanshang9 = this.secondWeekData[i].name
  2994. }
  2995. //第二周周四上午
  2996. if (this.secondWeekData[i].weekday == 4 && this.secondWeekData[i].time_type == 1) {
  2997. list[j].shangwu10 = this.secondWeekData[i].name
  2998. }
  2999. //第二周周四下午
  3000. if (this.secondWeekData[i].weekday == 4 && this.secondWeekData[i].time_type == 2) {
  3001. list[j].xiawu10 = this.secondWeekData[i].name
  3002. }
  3003. //第二周周四晚上
  3004. if (this.secondWeekData[i].weekday == 4 && this.secondWeekData[i].time_type == 3) {
  3005. list[j].wanshang10 = this.secondWeekData[i].name
  3006. }
  3007. //第二周周五上午
  3008. if (this.secondWeekData[i].weekday == 5 && this.secondWeekData[i].time_type == 1) {
  3009. list[j].shangwu11 = this.secondWeekData[i].name
  3010. }
  3011. //第二周周五下午
  3012. if (this.secondWeekData[i].weekday == 5 && this.secondWeekData[i].time_type == 2) {
  3013. list[j].xiawu11 = this.secondWeekData[i].name
  3014. }
  3015. //第二周周五晚上
  3016. if (this.secondWeekData[i].weekday == 5 && this.secondWeekData[i].time_type == 3) {
  3017. list[j].wanshang11 = this.secondWeekData[i].name
  3018. }
  3019. //第二周周六上午
  3020. if (this.secondWeekData[i].weekday == 6 && this.secondWeekData[i].time_type == 1) {
  3021. list[j].shangwu12 = this.secondWeekData[i].name
  3022. }
  3023. //第二周周六下午
  3024. if (this.secondWeekData[i].weekday == 6 && this.secondWeekData[i].time_type == 2) {
  3025. list[j].xiawu12 = this.secondWeekData[i].name
  3026. }
  3027. //第二周周六晚上
  3028. if (this.secondWeekData[i].weekday == 6 && this.secondWeekData[i].time_type == 3) {
  3029. list[j].wanshang12 = this.secondWeekData[i].name
  3030. }
  3031. //第二周周日上午
  3032. if (this.secondWeekData[i].weekday == 7 && this.secondWeekData[i].time_type == 1) {
  3033. list[j].shangwu13 = this.secondWeekData[i].name
  3034. }
  3035. //第二周周日下午
  3036. if (this.secondWeekData[i].weekday == 7 && this.secondWeekData[i].time_type == 2) {
  3037. list[j].xiawu13 = this.secondWeekData[i].name
  3038. }
  3039. //第二周周日晚上
  3040. if (this.secondWeekData[i].weekday == 7 && this.secondWeekData[i].time_type == 3) {
  3041. list[j].wanshang13 = this.secondWeekData[i].name
  3042. }
  3043. }
  3044. }
  3045. }
  3046. for (let i = 0; i < this.thirdWeekData.length; i++) {
  3047. for (let j = 0; j < list.length; j++) {
  3048. if (list[j].机号 == this.thirdWeekData[i].number_name && this.thirdWeekData[i].devices.zone.name == list[j].区号) {
  3049. //第二周周一上午
  3050. if (this.thirdWeekData[i].weekday == 1 && this.thirdWeekData[i].time_type == 1) {
  3051. list[j].shangwu14 = this.thirdWeekData[i].name
  3052. }
  3053. //第二周周一下午
  3054. if (this.thirdWeekData[i].weekday == 1 && this.thirdWeekData[i].time_type == 2) {
  3055. list[j].xiawu14 = this.thirdWeekData[i].name
  3056. }
  3057. //第二周周一晚上
  3058. if (this.thirdWeekData[i].weekday == 1 && this.thirdWeekData[i].time_type == 3) {
  3059. list[j].wanshang14 = this.thirdWeekData[i].name
  3060. }
  3061. //第二周周二上午
  3062. if (this.thirdWeekData[i].weekday == 2 && this.thirdWeekData[i].time_type == 1) {
  3063. list[j].shangwu15 = this.thirdWeekData[i].name
  3064. }
  3065. //第二周周二下午
  3066. if (this.thirdWeekData[i].weekday == 2 && this.thirdWeekData[i].time_type == 2) {
  3067. list[j].xiawu15 = this.thirdWeekData[i].name
  3068. }
  3069. //第二周周二晚上
  3070. if (this.thirdWeekData[i].weekday == 2 && this.thirdWeekData[i].time_type == 3) {
  3071. list[j].wanshang15 = this.thirdWeekData[i].name
  3072. }
  3073. //第二周周三上午
  3074. if (this.thirdWeekData[i].weekday == 3 && this.thirdWeekData[i].time_type == 1) {
  3075. list[j].shangwu16 = this.thirdWeekData[i].name
  3076. }
  3077. //第二周周三下午
  3078. if (this.thirdWeekData[i].weekday == 3 && this.thirdWeekData[i].time_type == 2) {
  3079. list[j].xiawu16 = this.thirdWeekData[i].name
  3080. }
  3081. //第二周周三晚上
  3082. if (this.thirdWeekData[i].weekday == 3 && this.thirdWeekData[i].time_type == 3) {
  3083. list[j].wanshang16 = this.thirdWeekData[i].name
  3084. }
  3085. //第二周周四上午
  3086. if (this.thirdWeekData[i].weekday == 4 && this.thirdWeekData[i].time_type == 1) {
  3087. list[j].shangwu17 = this.thirdWeekData[i].name
  3088. }
  3089. //第二周周四下午
  3090. if (this.thirdWeekData[i].weekday == 4 && this.thirdWeekData[i].time_type == 2) {
  3091. list[j].xiawu17 = this.thirdWeekData[i].name
  3092. }
  3093. //第二周周四晚上
  3094. if (this.thirdWeekData[i].weekday == 4 && this.thirdWeekData[i].time_type == 3) {
  3095. list[j].wanshang17 = this.thirdWeekData[i].name
  3096. }
  3097. //第二周周五上午
  3098. if (this.thirdWeekData[i].weekday == 5 && this.thirdWeekData[i].time_type == 1) {
  3099. list[j].shangwu18 = this.thirdWeekData[i].name
  3100. }
  3101. //第二周周五下午
  3102. if (this.thirdWeekData[i].weekday == 5 && this.thirdWeekData[i].time_type == 2) {
  3103. list[j].xiawu18 = this.thirdWeekData[i].name
  3104. }
  3105. //第二周周五晚上
  3106. if (this.thirdWeekData[i].weekday == 5 && this.thirdWeekData[i].time_type == 3) {
  3107. list[j].wanshang18 = this.thirdWeekData[i].name
  3108. }
  3109. //第二周周六上午
  3110. if (this.thirdWeekData[i].weekday == 6 && this.thirdWeekData[i].time_type == 1) {
  3111. list[j].shangwu19 = this.thirdWeekData[i].name
  3112. }
  3113. //第二周周六下午
  3114. if (this.thirdWeekData[i].weekday == 6 && this.thirdWeekData[i].time_type == 2) {
  3115. list[j].xiawu19 = this.thirdWeekData[i].name
  3116. }
  3117. //第二周周六晚上
  3118. if (this.thirdWeekData[i].weekday == 6 && this.thirdWeekData[i].time_type == 3) {
  3119. list[j].wanshang19 = this.thirdWeekData[i].name
  3120. }
  3121. //第二周周日上午
  3122. if (this.thirdWeekData[i].weekday == 7 && this.thirdWeekData[i].time_type == 1) {
  3123. list[j].shangwu20 = this.thirdWeekData[i].name
  3124. }
  3125. //第二周周日下午
  3126. if (this.thirdWeekData[i].weekday == 7 && this.thirdWeekData[i].time_type == 2) {
  3127. list[j].xiawu20 = this.thirdWeekData[i].name
  3128. }
  3129. //第二周周日晚上
  3130. if (this.thirdWeekData[i].weekday == 7 && this.thirdWeekData[i].time_type == 3) {
  3131. list[j].wanshang20 = this.thirdWeekData[i].name
  3132. }
  3133. }
  3134. }
  3135. }
  3136. for (let i = 0; i < this.fourWeekData.length; i++) {
  3137. for (let j = 0; j < list.length; j++) {
  3138. if (list[j].机号 == this.fourWeekData[i].number_name && this.fourWeekData[i].devices.zone.name == list[j].区号) {
  3139. //第二周周一上午
  3140. if (this.fourWeekData[i].weekday == 1 && this.fourWeekData[i].time_type == 1) {
  3141. list[j].shangwu21 = this.fourWeekData[i].name
  3142. }
  3143. //第二周周一下午
  3144. if (this.fourWeekData[i].weekday == 1 && this.fourWeekData[i].time_type == 2) {
  3145. list[j].xiawu21 = this.fourWeekData[i].name
  3146. }
  3147. //第二周周一晚上
  3148. if (this.fourWeekData[i].weekday == 1 && this.fourWeekData[i].time_type == 3) {
  3149. list[j].wanshang21 = this.fourWeekData[i].name
  3150. }
  3151. //第二周周二上午
  3152. if (this.fourWeekData[i].weekday == 2 && this.fourWeekData[i].time_type == 1) {
  3153. list[j].shangwu22 = this.fourWeekData[i].name
  3154. }
  3155. //第二周周二下午
  3156. if (this.fourWeekData[i].weekday == 2 && this.fourWeekData[i].time_type == 2) {
  3157. list[j].xiawu22 = this.fourWeekData[i].name
  3158. }
  3159. //第二周周二晚上
  3160. if (this.fourWeekData[i].weekday == 2 && this.fourWeekData[i].time_type == 3) {
  3161. list[j].wanshang22 = this.fourWeekData[i].name
  3162. }
  3163. //第二周周三上午
  3164. if (this.fourWeekData[i].weekday == 3 && this.fourWeekData[i].time_type == 1) {
  3165. list[j].shangwu23 = this.fourWeekData[i].name
  3166. }
  3167. //第二周周三下午
  3168. if (this.fourWeekData[i].weekday == 3 && this.fourWeekData[i].time_type == 2) {
  3169. list[j].xiawu23 = this.fourWeekData[i].name
  3170. }
  3171. //第二周周三晚上
  3172. if (this.fourWeekData[i].weekday == 3 && this.fourWeekData[i].time_type == 3) {
  3173. list[j].wanshang23 = this.fourWeekData[i].name
  3174. }
  3175. //第二周周四上午
  3176. if (this.fourWeekData[i].weekday == 4 && this.fourWeekData[i].time_type == 1) {
  3177. list[j].shangwu24 = this.fourWeekData[i].name
  3178. }
  3179. //第二周周四下午
  3180. if (this.fourWeekData[i].weekday == 4 && this.fourWeekData[i].time_type == 2) {
  3181. list[j].xiawu24 = this.fourWeekData[i].name
  3182. }
  3183. //第二周周四晚上
  3184. if (this.fourWeekData[i].weekday == 4 && this.fourWeekData[i].time_type == 3) {
  3185. list[j].wanshang24 = this.fourWeekData[i].name
  3186. }
  3187. //第二周周五上午
  3188. if (this.fourWeekData[i].weekday == 5 && this.fourWeekData[i].time_type == 1) {
  3189. list[j].shangwu25 = this.fourWeekData[i].name
  3190. }
  3191. //第二周周五下午
  3192. if (this.fourWeekData[i].weekday == 5 && this.fourWeekData[i].time_type == 2) {
  3193. list[j].xiawu25 = this.fourWeekData[i].name
  3194. }
  3195. //第二周周五晚上
  3196. if (this.fourWeekData[i].weekday == 5 && this.fourWeekData[i].time_type == 3) {
  3197. list[j].wanshang25 = this.fourWeekData[i].name
  3198. }
  3199. //第二周周六上午
  3200. if (this.fourWeekData[i].weekday == 6 && this.fourWeekData[i].time_type == 1) {
  3201. list[j].shangwu26 = this.fourWeekData[i].name
  3202. }
  3203. //第二周周六下午
  3204. if (this.fourWeekData[i].weekday == 6 && this.fourWeekData[i].time_type == 2) {
  3205. list[j].xiawu26 = this.fourWeekData[i].name
  3206. }
  3207. //第二周周六晚上
  3208. if (this.fourWeekData[i].weekday == 6 && this.fourWeekData[i].time_type == 3) {
  3209. list[j].wanshang26 = this.fourWeekData[i].name
  3210. }
  3211. //第二周周日上午
  3212. if (this.fourWeekData[i].weekday == 7 && this.fourWeekData[i].time_type == 1) {
  3213. list[j].shangwu27 = this.fourWeekData[i].name
  3214. }
  3215. //第二周周日下午
  3216. if (this.fourWeekData[i].weekday == 7 && this.fourWeekData[i].time_type == 2) {
  3217. list[j].xiawu27 = this.fourWeekData[i].name
  3218. }
  3219. //第二周周日晚上
  3220. if (this.fourWeekData[i].weekday == 7 && this.fourWeekData[i].time_type == 3) {
  3221. list[j].wanshang27 = this.fourWeekData[i].name
  3222. }
  3223. }
  3224. }
  3225. }
  3226. var multiHeader
  3227. var header
  3228. this.tableList = list
  3229. const filename = "排班模版"
  3230. var data = []
  3231. this.tableList.map(item => {
  3232. data.push(Object.values(item))
  3233. })
  3234. multiHeader = multiHeaderForModeFour
  3235. header = headerForModeFour
  3236. excel.export_json_to_excel({
  3237. multiHeader,
  3238. header,
  3239. mergesFour,
  3240. data,
  3241. filename
  3242. })
  3243. this.downloadLoading = false
  3244. })
  3245. },
  3246. setData() {
  3247. this.newVisible = true
  3248. }, getMode(id) {
  3249. let name = "";
  3250. this.treatment_mode = Object.values(this.$store.getters.treatment_mode);
  3251. this.treatment_mode.map((item) => {
  3252. if (item.id == id) {
  3253. name = item.name;
  3254. }
  3255. });
  3256. return name;
  3257. },getModeId(name) {
  3258. let id = "1";
  3259. this.treatment_mode = Object.values(this.$store.getters.treatment_mode);
  3260. this.treatment_mode.map((item) => {
  3261. if (item.name == name) {
  3262. id = item.id.toString();
  3263. }
  3264. });
  3265. return id;
  3266. },
  3267. submitAction() {
  3268. var template
  3269. if (this.form.firstWeek == 1) {
  3270. template = this.first_template
  3271. }
  3272. if (this.form.firstWeek == 2) {
  3273. template = this.second_template
  3274. }
  3275. if (this.form.firstWeek == 3) {
  3276. template = this.third_template
  3277. }
  3278. if (this.form.firstWeek == 4) {
  3279. template = this.four_template
  3280. }
  3281. var label = ""
  3282. for (let i = 0; i < this.timeOptions.length; i++) {
  3283. if (this.form.copyWeek == this.timeOptions[i].value) {
  3284. label = this.timeOptions[i].label
  3285. }
  3286. }
  3287. var start = label.split('~')
  3288. var copy_startime = this.getTimestamp(start[0])
  3289. var copy_endtime = this.getTimestamp(start[1])
  3290. var params = {
  3291. template_id: template.id,
  3292. copy_startime: copy_startime,
  3293. copy_endtime: copy_endtime,
  3294. }
  3295. synchroSchedule(params).then(response => {
  3296. if (response.data.state == 1) {
  3297. var msg = response.data.data.msg
  3298. this.$message.success("同步成功!")
  3299. this.newVisible = false
  3300. }
  3301. })
  3302. },
  3303. getPatientScheduleTemplate() {
  3304. getPatientScheduleTemplate().then(response => {
  3305. if (response.data.state == 1) {
  3306. var schedule = response.data.data.schedule
  3307. this.schedule = schedule
  3308. }
  3309. })
  3310. }
  3311. }
  3312. }
  3313. </script>
  3314. <style scoped>
  3315. </style>