tableData.vue 73KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421
  1. <template>
  2. <div id="table_data">
  3. <div style="margin-bottom:-30px;margin-left:300px">
  4. <span>分区:</span>
  5. <el-select v-model="partition_id" multiple placeholder="请选择" @change="changePartiton">
  6. <el-option
  7. v-for="item in this.zones"
  8. :key="item.id"
  9. :label="item.name"
  10. :value="item.id">
  11. </el-option>
  12. </el-select>
  13. <!-- <span style="margin-left:100px">班次:</span>
  14. <el-select v-model="schedule_type" placeholder="请选择" @change="changeSchedule_type">
  15. <el-option
  16. v-for="item in options"
  17. :key="item.id"
  18. :label="item.name"
  19. :value="item.id">
  20. </el-option>
  21. </el-select> -->
  22. </div>
  23. <div class="cell clearfix" v-if="weekTime == 'thisWeek' || weekTime == 'nextWeek' || weekTime == 'nextTwoWeek' ">
  24. <el-input
  25. size="small"
  26. style="width: 200px;"
  27. class="filter-item"
  28. v-model.trim="keywords"
  29. placeholder="病人名称/透析号"
  30. @keyup.enter.native='search'
  31. />
  32. <el-button
  33. size="small"
  34. class="filter-item"
  35. type="primary"
  36. icon="el-icon-search"
  37. @click="search"
  38. >搜索</el-button
  39. >
  40. </div>
  41. <el-dialog :visible.sync="searchTableVisible" width="80%">
  42. <el-table
  43. :data="schedulePatients"
  44. :header-cell-style="{
  45. backgroundColor: 'rgb(245, 247, 250)',
  46. color: '#606266'
  47. }"
  48. :row-style="{ color: '#303133' }"
  49. style="width: 100%"
  50. border
  51. >
  52. <el-table-column label="姓名" width="120">
  53. <template slot-scope="scope">
  54. {{ scope.row.patient }}
  55. </template>
  56. </el-table-column>
  57. <el-table-column label="透析日期" width="200">
  58. <template slot-scope="scope">
  59. {{ getDialysisDate(scope.row) }}
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="分区">
  63. <template slot-scope="scope">
  64. {{ scope.row.zone.name }}
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="班次" width="80">
  68. <template slot-scope="scope">
  69. {{ getSchedulesType(scope.row.schedule_type) }}
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="机号" width="80">
  73. <template slot-scope="scope">
  74. {{ scope.row.number.number }}
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="透析模式" width="100">
  78. <template slot-scope="scope">
  79. {{ scope.row.mode.name }}
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="操作" align="center" width="300">
  83. <template slot-scope="scope">
  84. <el-button
  85. size="mini"
  86. type="primary"
  87. @click="CancelSchedule(scope.row.id)"
  88. >
  89. 取消排班
  90. </el-button>
  91. <el-button
  92. size="mini"
  93. type="primary"
  94. @click="changeMachineNumber(scope.$index, scope.row)"
  95. >
  96. 调整机号
  97. </el-button>
  98. <el-button
  99. size="mini"
  100. type="primary"
  101. @click="changeMode(scope.$index, scope.row)"
  102. >
  103. 调整模式
  104. </el-button>
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. </el-dialog>
  109. <el-table
  110. :row-style="{ color: '#303133' }"
  111. :header-cell-style="{
  112. backgroundColor: 'rgb(245, 247, 250)',
  113. color: '#606266'
  114. }"
  115. :data="scheduleZone"
  116. :span-method="objectSpanMethod"
  117. @cell-click="clickThis"
  118. @cell-mouse-enter="hoverMouse"
  119. :summary-method="getSummaries"
  120. show-summary
  121. :row-class-name="tableRowClassName"
  122. :cell-class-name="cellClass"
  123. sum-text="总数"
  124. :height="tableContainHeight"
  125. ref="table"
  126. style="width: 100%;cursor: pointer;"
  127. >
  128. <el-table-column
  129. prop="area"
  130. label="分区"
  131. width="80"
  132. align="center"
  133. fixed
  134. ></el-table-column>
  135. <el-table-column
  136. prop="cut"
  137. label="机号"
  138. width="80"
  139. align="center"
  140. fixed
  141. ></el-table-column>
  142. <el-table-column
  143. :label="'周一 (' + weekTitle[0] + ')'"
  144. width="215"
  145. align="center"
  146. >
  147. <el-table-column prop="Mon_M" label="上" width="70" align="center">
  148. <schedule-item
  149. slot-scope="scope"
  150. :schedule-detail="scope.row.Mon_M"
  151. ></schedule-item>
  152. </el-table-column>
  153. <el-table-column prop="Mon_A" label="下" width="70" align="center">
  154. <schedule-item
  155. slot-scope="scope"
  156. :schedule-detail="scope.row.Mon_A"
  157. ></schedule-item>
  158. </el-table-column>
  159. <el-table-column prop="Mon_N" label="晚" width="70" align="center">
  160. <schedule-item
  161. slot-scope="scope"
  162. :schedule-detail="scope.row.Mon_N"
  163. ></schedule-item>
  164. </el-table-column>
  165. </el-table-column>
  166. <el-table-column
  167. :label="'周二 (' + weekTitle[1] + ')'"
  168. width="215"
  169. align="center"
  170. >
  171. <el-table-column prop="Tue_M" label="上" width="70" align="center">
  172. <schedule-item
  173. slot-scope="scope"
  174. :schedule-detail="scope.row.Tue_M"
  175. ></schedule-item>
  176. </el-table-column>
  177. <el-table-column prop="Tue_A" label="下" width="70" align="center">
  178. <schedule-item
  179. slot-scope="scope"
  180. :schedule-detail="scope.row.Tue_A"
  181. ></schedule-item>
  182. </el-table-column>
  183. <el-table-column prop="Tue_N" label="晚" width="70" align="center">
  184. <schedule-item
  185. slot-scope="scope"
  186. :schedule-detail="scope.row.Tue_N"
  187. ></schedule-item>
  188. </el-table-column>
  189. </el-table-column>
  190. <el-table-column
  191. :label="'周三 (' + weekTitle[2] + ')'"
  192. width="215"
  193. align="center"
  194. >
  195. <el-table-column prop="Wed_M" label="上" width="70" align="center">
  196. <schedule-item
  197. slot-scope="scope"
  198. :schedule-detail="scope.row.Wed_M"
  199. ></schedule-item>
  200. </el-table-column>
  201. <el-table-column prop="Wed_A" label="下" width="70" align="center">
  202. <schedule-item
  203. slot-scope="scope"
  204. :schedule-detail="scope.row.Wed_A"
  205. ></schedule-item>
  206. </el-table-column>
  207. <el-table-column prop="Wed_N" label="晚" width="70" align="center">
  208. <schedule-item
  209. slot-scope="scope"
  210. :schedule-detail="scope.row.Wed_N"
  211. ></schedule-item>
  212. </el-table-column>
  213. </el-table-column>
  214. <el-table-column
  215. :label="'周四 (' + weekTitle[3] + ')'"
  216. width="215"
  217. align="center"
  218. >
  219. <el-table-column prop="Thurs_M" label="上" width="70" align="center">
  220. <schedule-item
  221. slot-scope="scope"
  222. :schedule-detail="scope.row.Thurs_M"
  223. ></schedule-item>
  224. </el-table-column>
  225. <el-table-column prop="Thurs_A" label="下" width="70" align="center">
  226. <schedule-item
  227. slot-scope="scope"
  228. :schedule-detail="scope.row.Thurs_A"
  229. ></schedule-item>
  230. </el-table-column>
  231. <el-table-column prop="Thurs_N" label="晚" width="70" align="center">
  232. <schedule-item
  233. slot-scope="scope"
  234. :schedule-detail="scope.row.Thurs_N"
  235. ></schedule-item>
  236. </el-table-column>
  237. </el-table-column>
  238. <el-table-column
  239. :label="'周五 (' + weekTitle[4] + ')'"
  240. width="215"
  241. align="center"
  242. >
  243. <el-table-column prop="Fri_M" label="上" width="70" align="center">
  244. <schedule-item
  245. slot-scope="scope"
  246. :schedule-detail="scope.row.Fri_M"
  247. ></schedule-item>
  248. </el-table-column>
  249. <el-table-column prop="Fri_A" label="下" width="70" align="center">
  250. <schedule-item
  251. slot-scope="scope"
  252. :schedule-detail="scope.row.Fri_A"
  253. ></schedule-item>
  254. </el-table-column>
  255. <el-table-column prop="Fri_N" label="晚" width="70" align="center">
  256. <schedule-item
  257. slot-scope="scope"
  258. :schedule-detail="scope.row.Fri_N"
  259. ></schedule-item>
  260. </el-table-column>
  261. </el-table-column>
  262. <el-table-column
  263. :label="'周六 (' + weekTitle[5] + ')'"
  264. width="215"
  265. align="center"
  266. >
  267. <el-table-column prop="Sat_M" label="上" width="70" align="center">
  268. <schedule-item
  269. slot-scope="scope"
  270. :schedule-detail="scope.row.Sat_M"
  271. ></schedule-item>
  272. </el-table-column>
  273. <el-table-column prop="Sat_A" label="下" width="70" align="center">
  274. <schedule-item
  275. slot-scope="scope"
  276. :schedule-detail="scope.row.Sat_A"
  277. ></schedule-item>
  278. </el-table-column>
  279. <el-table-column prop="Sat_N" label="晚" width="70" align="center">
  280. <schedule-item
  281. slot-scope="scope"
  282. :schedule-detail="scope.row.Sat_N"
  283. ></schedule-item>
  284. </el-table-column>
  285. </el-table-column>
  286. <el-table-column
  287. :label="'周日 (' + weekTitle[6] + ')'"
  288. min-width="215"
  289. align="center"
  290. >
  291. <el-table-column prop="Sun_M" label="上" min-width="70" align="center">
  292. <schedule-item
  293. slot-scope="scope"
  294. :schedule-detail="scope.row.Sun_M"
  295. ></schedule-item>
  296. </el-table-column>
  297. <el-table-column prop="Sun_A" label="下" min-width="70" align="center">
  298. <schedule-item
  299. slot-scope="scope"
  300. :schedule-detail="scope.row.Sun_A"
  301. ></schedule-item>
  302. </el-table-column>
  303. <el-table-column prop="Sun_N" label="晚" min-width="70" align="center">
  304. <schedule-item
  305. slot-scope="scope"
  306. :schedule-detail="scope.row.Sun_N"
  307. ></schedule-item>
  308. </el-table-column>
  309. </el-table-column>
  310. <el-table-column
  311. prop="total"
  312. label="总数"
  313. width="60"
  314. align="center"
  315. fixed="right"
  316. ></el-table-column>
  317. </el-table>
  318. <el-dialog
  319. title="排班"
  320. :visible.sync="dialogTableVisible"
  321. width="1000px;"
  322. :v-model="dialog"
  323. v-loading="creating_schedule"
  324. >
  325. <div>
  326. <div class="cell clearfix">
  327. <label class="title"><span class="name">当前排班</span> : </label>
  328. <div class="time ">
  329. <ul class="">
  330. <span class="current"
  331. >日期 : {{ currentData.schedule_date }} &nbsp;&nbsp; 班次 :
  332. {{ currentData.type_name }} &nbsp;&nbsp; 病房 :
  333. {{ currentData.zone_name }} &nbsp;&nbsp; 透析机 :
  334. {{ currentData.bed_name }}
  335. </span>
  336. </ul>
  337. </div>
  338. </div>
  339. <div class="cell clearfix">
  340. <label class="title"><span class="name">患者搜索</span> : </label>
  341. <div class="time ">
  342. <ul class="">
  343. <el-input
  344. size="medium"
  345. v-model="searchKey"
  346. placeholder="请输入搜索的内容"
  347. style="width:260px"
  348. @keyup.enter.native='SubmitSearch'
  349. ></el-input>
  350. <el-button
  351. type="primary"
  352. icon="el-icon-search"
  353. @click="SubmitSearch"
  354. >搜索</el-button
  355. >
  356. </ul>
  357. </div>
  358. </div>
  359. <div class="cell clearfix">
  360. <label class="title"><span class="name">排班</span> : </label>
  361. <div class="time ">
  362. <ul class="">
  363. <li
  364. v-for="item in schedulArr"
  365. @click="changeSearchSchedule(item.value)"
  366. :key="item.value"
  367. :class="patientQuery.schedule == item.value ? 'active' : ''"
  368. >
  369. {{ item.label }}
  370. </li>
  371. </ul>
  372. </div>
  373. </div>
  374. <!-- <div class="cell clearfix">
  375. <label class="title"><span class="name">标签</span> : </label>
  376. <div class="time ">
  377. <ul class="">
  378. <li v-for="item in tagArr" :key="item.value" >{{item.label}}</li>
  379. </ul>
  380. </div>
  381. </div> -->
  382. <div class="cell clearfix">
  383. <label class="title"><span class="name">传染病</span> : </label>
  384. <div class="time ">
  385. <ul class="">
  386. <li
  387. v-for="item in diseasesArr"
  388. @click="changeSearchContagion(item.value)"
  389. :key="item.value"
  390. :class="patientQuery.contagion == item.value ? 'active' : ''"
  391. >
  392. {{ item.label }}
  393. </li>
  394. </ul>
  395. </div>
  396. </div>
  397. </div>
  398. <el-table
  399. ref="singleTable"
  400. :data="patients"
  401. border
  402. highlight-current-row
  403. @current-change="handleCurrentChange"
  404. :header-cell-style="{ backgroundColor: 'rgb(236, 245, 255)' }"
  405. >
  406. <el-table-column
  407. type="index"
  408. label="序号"
  409. width="89"
  410. align="center"
  411. ></el-table-column>
  412. <el-table-column
  413. property="dialysis_no"
  414. label="透析号"
  415. min-width="110"
  416. align="center"
  417. ></el-table-column>
  418. <el-table-column
  419. property="name"
  420. label="姓名"
  421. min-width="110"
  422. align="center"
  423. ></el-table-column>
  424. <el-table-column
  425. property="schedules"
  426. label="双周已排"
  427. min-width="80"
  428. align="center"
  429. >
  430. <template slot-scope="scope">
  431. <span>{{ scope.row.schedules.length }}次</span>
  432. </template>
  433. </el-table-column>
  434. <el-table-column
  435. property="solutions"
  436. label="治疗频率"
  437. min-width="200"
  438. align="center"
  439. >
  440. <template slot-scope="scope">
  441. <span v-for="solution in scope.row.solutions" :key="solution.id"
  442. >{{ solution.name }}({{ solution.period }}{{ solution.times }})
  443. </span>
  444. </template>
  445. </el-table-column>
  446. <el-table-column
  447. property="sch_remark"
  448. label="备注"
  449. min-width="200"
  450. align="center"
  451. >
  452. </el-table-column>
  453. </el-table>
  454. <div slot="footer" class="dialog-footer">
  455. <el-button @click="closePatientPanel()">取 消</el-button>
  456. <el-button
  457. :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
  458. type="primary"
  459. @click="setSchedule"
  460. >保 存
  461. </el-button>
  462. </div>
  463. </el-dialog>
  464. <el-dialog title="调整排班" :visible.sync="tzDialogVisible" width="500px">
  465. <div style="width:100%;margin:0 auto">
  466. <el-radio-group v-model="tiaoZhengType" :class="tiaozhengclass">
  467. <el-radio :label="1">取消排班</el-radio>
  468. <el-radio :label="2">调整机号</el-radio>
  469. <el-radio :label="3">调整模式</el-radio>
  470. </el-radio-group>
  471. </div>
  472. <span slot="footer" class="dialog-footer">
  473. <el-button
  474. @click="
  475. tzDialogVisible = false;
  476. tiaoZhengType = 1;
  477. "
  478. >取 消</el-button
  479. >
  480. <el-button
  481. :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
  482. type="primary"
  483. @click="submitTiaoX"
  484. >
  485. <span v-if='tiaoZhengType == 1'>保存</span>
  486. <span v-if='tiaoZhengType == 2'>下一步</span>
  487. <span v-if='tiaoZhengType == 3'>下一步</span>
  488. </el-button>
  489. </span>
  490. </el-dialog>
  491. <el-dialog
  492. title="调整模式"
  493. :visible.sync="msDialogVisible"
  494. width="500px"
  495. v-loading="changing_mode"
  496. >
  497. <div>
  498. <el-form
  499. :model="changeSchedule"
  500. ref="changeSchedule"
  501. :rules="changeRules"
  502. >
  503. <el-form-item label="" prop="mode_id">
  504. <el-select
  505. v-model="changeSchedule.mode_id"
  506. placeholder="请选择"
  507. style="width:100%"
  508. >
  509. <el-option
  510. :disabled="item.id == currentData.mode_id"
  511. v-for="item in modeOptions"
  512. :key="item.id"
  513. :label="item.name"
  514. :value="item.id"
  515. >
  516. </el-option>
  517. </el-select>
  518. </el-form-item>
  519. </el-form>
  520. </div>
  521. <span slot="footer" class="dialog-footer">
  522. <el-button @click="msDialogVisible = false">取 消</el-button>
  523. <el-button
  524. :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
  525. type="primary"
  526. @click="submitMode('changeSchedule')"
  527. >保 存</el-button
  528. >
  529. </span>
  530. </el-dialog>
  531. <el-dialog
  532. title="调整机号"
  533. :visible.sync="jhDialogVisible"
  534. width="500px"
  535. v-loading="changing_bed"
  536. >
  537. <div>
  538. <el-form
  539. :model="changeSchedule"
  540. ref="changeSchedule"
  541. :rules="changeRules"
  542. label-width="90px"
  543. >
  544. <el-form-item label="排班日期: ">
  545. <el-input v-model="currentData.schedule_date" disabled></el-input>
  546. </el-form-item>
  547. <el-form-item label="班次: " prop="schedule_type">
  548. <el-select
  549. v-model="changeSchedule.schedule_type"
  550. placeholder="请选择"
  551. style="width:100%"
  552. @change="changeScheduleType"
  553. >
  554. <el-option
  555. v-for="item in scheduleType"
  556. :key="item.id"
  557. :label="item.name"
  558. :value="item.id"
  559. >
  560. </el-option>
  561. </el-select>
  562. </el-form-item>
  563. <el-form-item label="病房: " prop="partition_id">
  564. <el-select
  565. v-model="zone_name"
  566. placeholder="请选择"
  567. style="width:100%"
  568. @change="changePartition"
  569. >
  570. <el-option
  571. v-for="(item, index) in zone_names"
  572. :key="index"
  573. :label="item"
  574. :value="item"
  575. >
  576. </el-option>
  577. </el-select>
  578. </el-form-item>
  579. <el-form-item label="透析机: " prop="bed_id">
  580. <el-select
  581. v-model="device_id"
  582. placeholder="请选择"
  583. style="width:100%"
  584. >
  585. <el-option
  586. v-for="item in current_devices"
  587. :key="item.id"
  588. :label="item.number"
  589. :value="item.id"
  590. >
  591. </el-option>
  592. </el-select>
  593. </el-form-item>
  594. </el-form>
  595. </div>
  596. <span slot="footer" class="dialog-footer">
  597. <el-button @click="jhDialogVisible = false">取 消</el-button>
  598. <el-button
  599. :disabled="$store.getters.xt_user.subscibe.state == 3 ? true : false"
  600. type="primary"
  601. @click="submitTiaoZJH('changeSchedule')"
  602. >保 存</el-button
  603. >
  604. </span>
  605. </el-dialog>
  606. </div>
  607. </template>
  608. <script>
  609. import { uParseTime } from "@/utils/tools";
  610. import print from 'print-js'
  611. import {
  612. CancelSchedule,
  613. ChangeSchedule,
  614. CreateSchedule,
  615. getSchedulePatients,
  616. getSchedulesOne,
  617. getSearchResult,
  618. getUrgentScheduleInitData,
  619. getWeekPanelsOne,
  620. getAllZones,
  621. } from "@/api/schedule";
  622. import ScheduleItem from "./ScheduleItem";
  623. let rowNumber = 0;
  624. export default {
  625. name: "tableData",
  626. props: {
  627. weekTime: {
  628. type: String,
  629. default: "thisWeek"
  630. },
  631. scheduleZoneRowProp: {
  632. type: Array,
  633. dafault: []
  634. },
  635. // scheduleZoneProp: {
  636. // type: Array,
  637. // dafault: []
  638. // },
  639. partitionsProp: {
  640. type: Object,
  641. dafault: {}
  642. }
  643. },
  644. data() {
  645. return {
  646. // tableContainHeight:400,
  647. // tableHeight:'window.innerHeight - 0',
  648. // rowClass: "table-row-new-class schedule-table-row",
  649. searchKey: "",
  650. tiaoZhengType: 1,
  651. modeOptions: null,
  652. keywords: "",
  653. schedulePatients: [],
  654. searchTableVisible: false,
  655. dialog: {
  656. tag: ""
  657. },
  658. patients: [],
  659. toDay: "",
  660. schedulArr: [
  661. { value: 0, label: "不限" },
  662. { value: 2, label: "未排班" },
  663. { value: 1, label: "已排班" }
  664. ],
  665. tagArr: [
  666. { value: 1, label: "不限" },
  667. { value: 2, label: "透析记录" },
  668. { value: 3, label: "传染病" }
  669. ],
  670. diseasesArr: [{ value: 0, label: "不限" }],
  671. scheduleType: [
  672. { id: 1, name: "上午" },
  673. { id: 2, name: "下午" },
  674. { id: 3, name: "晚上" }
  675. ],
  676. dialogTableVisible: false,
  677. tzDialogVisible: false,
  678. msDialogVisible: false,
  679. jhDialogVisible: false,
  680. // scheduleZone: this.scheduleZoneProp,
  681. scheduleZoneRow: -1,
  682. partitions: [],
  683. jihaos: [],
  684. weekTitle: ["", "", "", "", "", "", ""],
  685. weekDays: ["", "", "", "", "", "", ""],
  686. currentData: {
  687. id: 0,
  688. schedule_date: "",
  689. schedule_type: 0,
  690. bed_id: 0,
  691. partition_id: 0,
  692. patient_id: 0,
  693. schedule_week: 0,
  694. mode_id: 0,
  695. type_name: "",
  696. bed_name: "",
  697. partition_type: 0,
  698. contagions: [],
  699. patient: ""
  700. },
  701. changeSchedule: {
  702. mode_id: "",
  703. schedule_type: "",
  704. partition_id: "",
  705. bed_id: "",
  706. schedule_week: "",
  707. partition_type: ""
  708. },
  709. patientQuery: {
  710. keywords: "",
  711. schedule: 0,
  712. contagion: 0
  713. },
  714. tiaozhengclass: "tiaozhengclass",
  715. changeRules: {
  716. mode_id: [{ required: true, message: "请选择模式", trigger: "blur" }],
  717. schedule_type: [
  718. { required: true, message: "请选择班次", trigger: "blur" }
  719. ],
  720. partition_id: [
  721. { required: true, message: "请选择病房", trigger: "blur" }
  722. ],
  723. bed_id: [{ required: true, message: "请选择透析机", trigger: "blur" }]
  724. },
  725. weekday: 0,
  726. creating_schedule: false,
  727. changing_mode: false,
  728. changing_bed: false,
  729. tableHeight: document.documentElement.clientHeight,
  730. origin_schedules: [],
  731. origin_device_numbers: [],
  732. zone_device_map: {},
  733. device_id: 0,
  734. zone_name: "",
  735. current_devices: [],
  736. zone_names: [],
  737. zone_device_options: [],
  738. options:[
  739. {id:0,name:"全部"},
  740. {id:1,name:"上午"},
  741. {id:2,name:"下午"},
  742. {id:3,name:"晚上"},
  743. ],
  744. partition_id:0,
  745. schedule_type:"",
  746. zones:[],
  747. theType:"",
  748. scheduleZone:[],
  749. theWeek: {
  750. lastWeek: 0,
  751. thisWeek: 0,
  752. nextWeek: 0,
  753. nextTwoWeek: 0
  754. },
  755. zoneIdList:[],
  756. strArr:"",
  757. patient_id_hover:0
  758. };
  759. },
  760. watch: {
  761. weekTime: function() {
  762. var theType = this.weekType(this.weekTime);
  763. // console.log("999999999",theType)
  764. this.theType = theType
  765. this.getSchedules();
  766. },
  767. scheduleZoneRow: function() {
  768. var theType = this.weekType(this.weekTime);
  769. this.theType = theType
  770. this.getSchedules();
  771. },
  772. tableHeight(val) {
  773. if (!this.timer) {
  774. this.tableHeight = val;
  775. this.timer = true;
  776. const that = this;
  777. setTimeout(function() {
  778. that.timer = false;
  779. }, 400);
  780. }
  781. }
  782. },
  783. methods: {
  784. compare(p){ //这是比较函数
  785. return function(m,n){
  786. var a = m[p];
  787. var b = n[p];
  788. return a - b; //升序
  789. }
  790. },
  791. getWeekPanels() {
  792. this.scheduleZone=[]
  793. var partionStr = this.partition_id
  794. var arr = this.zoneIdList.join(',')
  795. var str = ""
  796. if(partionStr == 0){
  797. str = arr
  798. }
  799. if(partionStr != 0){
  800. str = partionStr.join(',')
  801. }
  802. getWeekPanelsOne(1,str).then(response => {
  803. if (response.data.state == 0) {
  804. return false
  805. }
  806. var partitions = response.data.data.partitions
  807. console.log("partitions",partitions)
  808. this.theWeek.thisWeek = response.data.data.theWeek
  809. console.log("这个周",response.data.data.theWeek)
  810. this.theWeek.lastWeek = this.theWeek.thisWeek - 1
  811. this.theWeek.nextWeek = this.theWeek.thisWeek + 1
  812. this.theWeek.nextTwoWeek = this.theWeek.thisWeek + 2
  813. var that = this
  814. if (partitions.length > 0) {
  815. partitions.forEach(function(partition) {
  816. if (partition.jihaos.length == 0) {
  817. return false
  818. }
  819. that.scheduleZoneRow.push(partition.jihaos.length)
  820. that.partitions[partition.id] = partition
  821. partition.jihaos.forEach(function(jihao) {
  822. var thisPa = {
  823. area: partition.name,
  824. zone_id: partition.id,
  825. zone_type: partition.type,
  826. cut: jihao.number,
  827. jihao_id: jihao.id,
  828. sort:jihao.sort,
  829. Mon_M: {
  830. schedule_id: 0,
  831. mode_id: 0,
  832. mode_name: '',
  833. patient_id: 0,
  834. patient: ''
  835. },
  836. Mon_A: {
  837. schedule_id: 0,
  838. mode_id: 0,
  839. mode_name: '',
  840. patient_id: 0,
  841. patient: ''
  842. },
  843. Mon_N: {
  844. schedule_id: 0,
  845. mode_id: 0,
  846. mode_name: '',
  847. patient_id: 0,
  848. patient: ''
  849. },
  850. Tue_M: {
  851. schedule_id: 0,
  852. mode_id: 0,
  853. mode_name: '',
  854. patient_id: 0,
  855. patient: ''
  856. },
  857. Tue_A: {
  858. schedule_id: 0,
  859. mode_id: 0,
  860. mode_name: '',
  861. patient_id: 0,
  862. patient: ''
  863. },
  864. Tue_N: {
  865. schedule_id: 0,
  866. mode_id: 0,
  867. mode_name: '',
  868. patient_id: 0,
  869. patient: ''
  870. },
  871. Wed_M: {
  872. schedule_id: 0,
  873. mode_id: 0,
  874. mode_name: '',
  875. patient_id: 0,
  876. patient: ''
  877. },
  878. Wed_A: {
  879. schedule_id: 0,
  880. mode_id: 0,
  881. mode_name: '',
  882. patient_id: 0,
  883. patient: ''
  884. },
  885. Wed_N: {
  886. schedule_id: 0,
  887. mode_id: 0,
  888. mode_name: '',
  889. patient_id: 0,
  890. patient: ''
  891. },
  892. Thurs_M: {
  893. schedule_id: 0,
  894. mode_id: 0,
  895. mode_name: '',
  896. patient_id: 0,
  897. patient: ''
  898. },
  899. Thurs_A: {
  900. schedule_id: 0,
  901. mode_id: 0,
  902. mode_name: '',
  903. patient_id: 0,
  904. patient: ''
  905. },
  906. Thurs_N: {
  907. schedule_id: 0,
  908. mode_id: 0,
  909. mode_name: '',
  910. patient_id: 0,
  911. patient: ''
  912. },
  913. Fri_M: {
  914. schedule_id: 0,
  915. mode_id: 0,
  916. mode_name: '',
  917. patient_id: 0,
  918. patient: ''
  919. },
  920. Fri_A: {
  921. schedule_id: 0,
  922. mode_id: 0,
  923. mode_name: '',
  924. patient_id: 0,
  925. patient: ''
  926. },
  927. Fri_N: {
  928. schedule_id: 0,
  929. mode_id: 0,
  930. mode_name: '',
  931. patient_id: 0,
  932. patient: ''
  933. },
  934. Sat_M: {
  935. schedule_id: 0,
  936. mode_id: 0,
  937. mode_name: '',
  938. patient_id: 0,
  939. patient: ''
  940. },
  941. Sat_A: {
  942. schedule_id: 0,
  943. mode_id: 0,
  944. mode_name: '',
  945. patient_id: 0,
  946. patient: ''
  947. },
  948. Sat_N: {
  949. schedule_id: 0,
  950. mode_id: 0,
  951. mode_name: '',
  952. patient_id: 0,
  953. patient: ''
  954. },
  955. Sun_A: {
  956. schedule_id: 0,
  957. mode_id: 0,
  958. mode_name: '',
  959. patient_id: 0,
  960. patient: ''
  961. },
  962. Sun_N: {
  963. schedule_id: 0,
  964. mode_id: 0,
  965. mode_name: '',
  966. patient_id: 0,
  967. patient: ''
  968. },
  969. Sun_M: {
  970. schedule_id: 0,
  971. mode_id: 0,
  972. mode_name: '',
  973. patient_id: 0,
  974. patient: ''
  975. },
  976. total: 0
  977. }
  978. that.scheduleZone.push(thisPa)
  979. })
  980. })
  981. }
  982. console.log("34455555566666",this.scheduleZone)
  983. this.scheduleZone.sort(this.compare('sort'))
  984. })
  985. },
  986. cellClass({ row, column, rowIndex, columnIndex }) {
  987. if (columnIndex == 0 || columnIndex == 1 || columnIndex == 23) {
  988. return "";
  989. } else {
  990. if (this.weekTime == "lastWeek") {
  991. if(row[column.property].patient_id > 0 && row[column.property].patient_id == this.patient_id_hover){
  992. return 'hover-td schedule-table-cell-disable'
  993. }else {
  994. return 'schedule-table-cell-disable'
  995. }
  996. // return "schedule-table-cell-disable";
  997. } else if (this.weekTime == "thisWeek") {
  998. var weekday = Math.floor((columnIndex - 2) / 3 + 1);
  999. if (weekday < this.weekday) {
  1000. if(row[column.property].patient_id > 0 && row[column.property].patient_id == this.patient_id_hover){
  1001. return 'hover-td schedule-table-cell-disable'
  1002. }else {
  1003. return 'schedule-table-cell-disable'
  1004. }
  1005. // return "schedule-table-cell-disable";
  1006. }else {
  1007. if(row[column.property].patient_id > 0 && row[column.property].patient_id == this.patient_id_hover){
  1008. return 'hover-td'
  1009. }else {
  1010. return ''
  1011. }
  1012. }
  1013. }
  1014. }
  1015. return "";
  1016. },
  1017. SubmitSearch() {
  1018. this.patientQuery.keywords = this.searchKey;
  1019. this.getSchedulePatients();
  1020. },
  1021. changeSearchContagion(id) {
  1022. this.patientQuery.contagion = id;
  1023. this.getSchedulePatients();
  1024. },
  1025. changeSearchSchedule(id) {
  1026. this.patientQuery.schedule = id;
  1027. this.getSchedulePatients();
  1028. },
  1029. getSummaries(param) {
  1030. const { columns, data } = param;
  1031. const sums = [];
  1032. columns.forEach((column, index) => {
  1033. if (index === 0 || index === 25) {
  1034. sums[index] = "总数";
  1035. return;
  1036. }
  1037. if (index === 1 || index === 24) {
  1038. sums[index] = data.length;
  1039. return;
  1040. }
  1041. const values = data.map(item => item[column.property]);
  1042. if (index === 23) {
  1043. sums[index] = values.reduce((prev, curr) => {
  1044. const value = Number(curr);
  1045. if (!isNaN(value)) {
  1046. return prev + curr;
  1047. } else {
  1048. return prev;
  1049. }
  1050. }, 0);
  1051. sums[index];
  1052. return;
  1053. }
  1054. sums[index] = values.reduce((prev, curr) => {
  1055. if (typeof curr["mode_id"] === "undefined") {
  1056. return prev;
  1057. }
  1058. const value = Number(curr["mode_id"]);
  1059. if (!isNaN(value) && value > 0) {
  1060. return prev + 1;
  1061. } else {
  1062. return prev;
  1063. }
  1064. }, 0);
  1065. sums[index];
  1066. });
  1067. this.$nextTick(() => {
  1068. this.$refs.table.doLayout();
  1069. });
  1070. return sums;
  1071. },
  1072. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  1073. var that = this;
  1074. var rowNum = 0;
  1075. rowNumber = 0;
  1076. var rutrnData = {};
  1077. if (columnIndex === 0 || columnIndex == 25) {
  1078. var rowLen = this.scheduleZoneRow.length;
  1079. if (rowLen > 0) {
  1080. for (let index = 0; index < rowLen; index++) {
  1081. rowNum = this.scheduleZoneRow[index];
  1082. rowNumber += rowNum;
  1083. var f = rowNumber - rowNum;
  1084. if (f == rowIndex) {
  1085. rutrnData = {
  1086. rowspan: rowNum,
  1087. colspan: 1
  1088. };
  1089. break;
  1090. } else if (rowIndex < rowNumber) {
  1091. rutrnData = {
  1092. rowspan: 0,
  1093. colspan: 0
  1094. };
  1095. break;
  1096. }
  1097. }
  1098. return rutrnData;
  1099. }
  1100. }
  1101. },
  1102. handleCurrentChange(row) {
  1103. if (typeof row === "undefined" || row == null) {
  1104. this.currentData.patient_id = 0;
  1105. this.currentData.contagions = [];
  1106. } else {
  1107. this.currentData.patient_id = row.id;
  1108. this.currentData.contagions = row.contagions;
  1109. }
  1110. },
  1111. closePatientPanel(row) {
  1112. this.dialogTableVisible = false;
  1113. this.$refs.singleTable.setCurrentRow(row);
  1114. this.currentData.patient_id = 0;
  1115. },
  1116. getSchedules() {
  1117. var partionStr = this.partition_id
  1118. var arr = this.zoneIdList.join(',')
  1119. var str = ""
  1120. if(partionStr == 0){
  1121. str = arr
  1122. }
  1123. if(partionStr != 0){
  1124. str = partionStr.join(',')
  1125. }
  1126. const params = {
  1127. weekTime:this.theType,
  1128. patitionid:str,
  1129. schedule_type:this.schedule_type,
  1130. }
  1131. getSchedulesOne(params).then(response => {
  1132. if (response.data.state == 1) {
  1133. this.weekTitle = response.data.data.weekTitle;
  1134. this.weekDays = response.data.data.days;
  1135. this.toDay = response.data.data.today;
  1136. var theSchedules = response.data.data.schdules;
  1137. var that = this;
  1138. this.scheduleZone.forEach(function(zone, index) {
  1139. that.scheduleZone[index].Mon_M = {
  1140. mode_id: 0,
  1141. mode_name: "",
  1142. patient_id: 0,
  1143. patient: ""
  1144. };
  1145. that.scheduleZone[index].Mon_A = {
  1146. mode_id: 0,
  1147. mode_name: "",
  1148. patient_id: 0,
  1149. patient: ""
  1150. };
  1151. that.scheduleZone[index].Mon_N = {
  1152. mode_id: 0,
  1153. mode_name: "",
  1154. patient_id: 0,
  1155. patient: ""
  1156. };
  1157. that.scheduleZone[index].Tue_M = {
  1158. mode_id: 0,
  1159. mode_name: "",
  1160. patient_id: 0,
  1161. patient: ""
  1162. };
  1163. that.scheduleZone[index].Tue_A = {
  1164. mode_id: 0,
  1165. mode_name: "",
  1166. patient_id: 0,
  1167. patient: ""
  1168. };
  1169. that.scheduleZone[index].Tue_N = {
  1170. mode_id: 0,
  1171. mode_name: "",
  1172. patient_id: 0,
  1173. patient: ""
  1174. };
  1175. that.scheduleZone[index].Wed_M = {
  1176. mode_id: 0,
  1177. mode_name: "",
  1178. patient_id: 0,
  1179. patient: ""
  1180. };
  1181. that.scheduleZone[index].Wed_A = {
  1182. mode_id: 0,
  1183. mode_name: "",
  1184. patient_id: 0,
  1185. patient: ""
  1186. };
  1187. that.scheduleZone[index].Wed_N = {
  1188. mode_id: 0,
  1189. mode_name: "",
  1190. patient_id: 0,
  1191. patient: ""
  1192. };
  1193. that.scheduleZone[index].Thurs_M = {
  1194. mode_id: 0,
  1195. mode_name: "",
  1196. patient_id: 0,
  1197. patient: ""
  1198. };
  1199. that.scheduleZone[index].Thurs_A = {
  1200. mode_id: 0,
  1201. mode_name: "",
  1202. patient_id: 0,
  1203. patient: ""
  1204. };
  1205. that.scheduleZone[index].Thurs_N = {
  1206. mode_id: 0,
  1207. mode_name: "",
  1208. patient_id: 0,
  1209. patient: ""
  1210. };
  1211. that.scheduleZone[index].Fri_M = {
  1212. mode_id: 0,
  1213. mode_name: "",
  1214. patient_id: 0,
  1215. patient: ""
  1216. };
  1217. that.scheduleZone[index].Fri_A = {
  1218. mode_id: 0,
  1219. mode_name: "",
  1220. patient_id: 0,
  1221. patient: ""
  1222. };
  1223. that.scheduleZone[index].Fri_N = {
  1224. mode_id: 0,
  1225. mode_name: "",
  1226. patient_id: 0,
  1227. patient: ""
  1228. };
  1229. that.scheduleZone[index].Sat_M = {
  1230. mode_id: 0,
  1231. mode_name: "",
  1232. patient_id: 0,
  1233. patient: ""
  1234. };
  1235. that.scheduleZone[index].Sat_A = {
  1236. mode_id: 0,
  1237. mode_name: "",
  1238. patient_id: 0,
  1239. patient: ""
  1240. };
  1241. that.scheduleZone[index].Sat_N = {
  1242. mode_id: 0,
  1243. mode_name: "",
  1244. patient_id: 0,
  1245. patient: ""
  1246. };
  1247. that.scheduleZone[index].Sun_A = {
  1248. mode_id: 0,
  1249. mode_name: "",
  1250. patient_id: 0,
  1251. patient: ""
  1252. };
  1253. that.scheduleZone[index].Sun_N = {
  1254. mode_id: 0,
  1255. mode_name: "",
  1256. patient_id: 0,
  1257. patient: ""
  1258. };
  1259. that.scheduleZone[index].Sun_M = {
  1260. mode_id: 0,
  1261. mode_name: "",
  1262. patient_id: 0,
  1263. patient: ""
  1264. };
  1265. that.scheduleZone[index].total = 0;
  1266. if (response.data.data.schdules.length > 0) {
  1267. theSchedules.forEach(function(schedule, sindex) {
  1268. if (zone.jihao_id == schedule.bed_id) {
  1269. var weekPath = that.weekPath(
  1270. schedule.schedule_week,
  1271. schedule.schedule_type
  1272. );
  1273. if (weekPath.length == 2) {
  1274. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  1275. that.scheduleZone[index][weekPathKey] = {
  1276. schedule_id: schedule.id,
  1277. mode_id: schedule.mode_id,
  1278. patient_id: schedule.patient_id,
  1279. patient: schedule.patient,
  1280. patient_contagions: schedule.patient_contagions,
  1281. mode_name:
  1282. typeof that.modeOptions[schedule.mode_id] ===
  1283. "undefined"
  1284. ? ""
  1285. : that.modeOptions[schedule.mode_id].name
  1286. };
  1287. that.scheduleZone[index].total += 1;
  1288. }
  1289. }
  1290. });
  1291. }
  1292. });
  1293. } else {
  1294. this.$message.error("网络错误");
  1295. return false;
  1296. }
  1297. });
  1298. },
  1299. getSchedulePatients() {
  1300. getSchedulePatients(this.patientQuery).then(response => {
  1301. if (response.data.state == 1) {
  1302. this.patients = response.data.data.patients;
  1303. }
  1304. });
  1305. },
  1306. CancelSchedule(id) {
  1307. this.$confirm("确定要取消当前排班?", "提示", {
  1308. confirmButtonText: "确定",
  1309. cancelButtonText: "取消",
  1310. type: "warning"
  1311. })
  1312. .then(() => {
  1313. CancelSchedule(id).then(response => {
  1314. if (response.data.state == 0) {
  1315. this.$message.error(response.data.msg);
  1316. } else {
  1317. this.$message({
  1318. type: "success",
  1319. message: "排班已取消!"
  1320. });
  1321. var that = this;
  1322. var schedule = response.data.data.schedule;
  1323. this.scheduleZone.forEach(function(zone, index) {
  1324. if (
  1325. zone.zone_id == schedule.partition_id &&
  1326. zone.jihao_id == schedule.bed_id
  1327. ) {
  1328. var weekPath = that.weekPath(
  1329. schedule.schedule_week,
  1330. schedule.schedule_type
  1331. );
  1332. if (weekPath.length == 2) {
  1333. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  1334. that.scheduleZone[index][weekPathKey] = {
  1335. schedule_id: 0,
  1336. mode_id: 0,
  1337. patient_id: 0,
  1338. patient: "",
  1339. mode_name: ""
  1340. };
  1341. that.scheduleZone[index].total -= 1;
  1342. }
  1343. }
  1344. });
  1345. this.tzDialogVisible = false;
  1346. this.searchTableVisible = false;
  1347. }
  1348. });
  1349. })
  1350. .catch(() => {});
  1351. },
  1352. changeScheduleActon(formName) {
  1353. this.changing_bed = true;
  1354. ChangeSchedule(this.currentData.id, this.changeSchedule)
  1355. .then(response => {
  1356. if (response.data.state == 0) {
  1357. this.$message.error(response.data.msg);
  1358. } else {
  1359. this.$message({
  1360. type: "success",
  1361. message: "修改成功!"
  1362. });
  1363. var that = this;
  1364. var schedule = response.data.data.schedule;
  1365. this.scheduleZone.forEach(function(zone, index) {
  1366. if (
  1367. zone.zone_id == schedule.partition_id &&
  1368. zone.jihao_id == schedule.bed_id
  1369. ) {
  1370. var weekPath = that.weekPath(
  1371. schedule.schedule_week,
  1372. schedule.schedule_type
  1373. );
  1374. if (weekPath.length == 2) {
  1375. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  1376. that.scheduleZone[index][weekPathKey] = {
  1377. schedule_id: schedule.id,
  1378. mode_id: schedule.mode_id,
  1379. patient_id: schedule.patient_id,
  1380. patient: that.currentData.patient,
  1381. patient_contagions: that.currentData.contagions,
  1382. mode_name:
  1383. typeof that.modeOptions[schedule.mode_id] === "undefined"
  1384. ? ""
  1385. : that.modeOptions[schedule.mode_id].name
  1386. };
  1387. that.scheduleZone[index].total += 1;
  1388. }
  1389. }
  1390. if (
  1391. zone.zone_id == that.currentData.partition_id &&
  1392. zone.jihao_id == that.currentData.bed_id
  1393. ) {
  1394. var weekPath = that.weekPath(
  1395. that.currentData.schedule_week,
  1396. that.currentData.schedule_type
  1397. );
  1398. if (weekPath.length == 2) {
  1399. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  1400. that.scheduleZone[index][weekPathKey] = {
  1401. schedule_id: 0,
  1402. mode_id: 0,
  1403. patient_id: 0,
  1404. patient: "",
  1405. mode_name: "",
  1406. patient_contagions: []
  1407. };
  1408. that.scheduleZone[index].total -= 1;
  1409. }
  1410. }
  1411. });
  1412. this.$refs[formName].resetFields();
  1413. this.jhDialogVisible = false;
  1414. }
  1415. this.changing_bed = false;
  1416. })
  1417. .catch(err => {
  1418. this.$message.error(err);
  1419. this.changing_bed = false;
  1420. });
  1421. },
  1422. CreateSchedule(id, data) {
  1423. this.creating_schedule = true;
  1424. CreateSchedule(id, data)
  1425. .then(response => {
  1426. if (response.data.state == 0) {
  1427. this.$message.error(response.data.msg);
  1428. } else {
  1429. this.$message({
  1430. type: "success",
  1431. message: "排班成功!"
  1432. });
  1433. var that = this;
  1434. var schedule = response.data.data.schedule;
  1435. this.scheduleZone.forEach(function(zone, index) {
  1436. if (
  1437. zone.zone_id == schedule.partition_id &&
  1438. zone.jihao_id == schedule.bed_id
  1439. ) {
  1440. var weekPath = that.weekPath(
  1441. schedule.schedule_week,
  1442. schedule.schedule_type
  1443. );
  1444. if (weekPath.length == 2) {
  1445. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  1446. that.scheduleZone[index][weekPathKey] = {
  1447. schedule_id: schedule.id,
  1448. mode_id: schedule.mode_id,
  1449. patient_id: schedule.patient_id,
  1450. patient: schedule.patient,
  1451. patient_contagions: that.currentData.contagions,
  1452. mode_name:
  1453. typeof that.modeOptions[schedule.mode_id] === "undefined"
  1454. ? ""
  1455. : that.modeOptions[schedule.mode_id].name
  1456. };
  1457. that.scheduleZone[index].total += 1;
  1458. }
  1459. }
  1460. });
  1461. this.closePatientPanel();
  1462. }
  1463. this.creating_schedule = false;
  1464. })
  1465. .catch(err => {
  1466. this.$message.error(err);
  1467. this.creating_schedule = false;
  1468. });
  1469. },
  1470. hoverMouse(row, column, cell, event){
  1471. if (row[column.property].schedule_id > 0) {
  1472. let patient_id = row[column.property].patient_id
  1473. this.patient_id_hover = patient_id
  1474. } else {
  1475. this.patient_id_hover = -1
  1476. }
  1477. },
  1478. clickThis(row, column, cell, event) {
  1479. // debugger
  1480. var week = this.weekDay(column.property);
  1481. if (week[0] == -1 || week[1] == -1) {
  1482. return false;
  1483. }
  1484. if (this.toDay > this.weekDays[week[0] - 1]) {
  1485. return false;
  1486. }
  1487. this.currentData.schedule_date = this.weekDays[week[0] - 1];
  1488. this.currentData.schedule_type = week[1];
  1489. this.currentData.bed_id = row.jihao_id;
  1490. this.currentData.partition_id = row.zone_id;
  1491. this.currentData.schedule_week = week[0];
  1492. this.currentData.type_name = this.dayType(week[1]);
  1493. this.currentData.zone_name = row.area;
  1494. this.currentData.bed_name = row.cut;
  1495. this.currentData.partition_type = row.zone_type;
  1496. if (row[column.property].schedule_id > 0) {
  1497. this.currentData.mode_id = row[column.property].mode_id;
  1498. this.currentData.id = row[column.property].schedule_id;
  1499. this.currentData.patient_id = row[column.property].patient_id;
  1500. this.currentData.patient = row[column.property].patient;
  1501. this.currentData.contagions = row[column.property].patient_contagions;
  1502. this.tiaoZhengType = 1;
  1503. this.tzDialogVisible = true;
  1504. } else {
  1505. this.currentData.mode_id = 1;
  1506. this.currentData.id = 0;
  1507. this.currentData.patient_id = 0;
  1508. this.currentData.patient = "";
  1509. this.currentData.contagions = [];
  1510. this.getSchedulePatients();
  1511. this.dialogTableVisible = true;
  1512. }
  1513. },
  1514. submitTiaoZJH(formName) {
  1515. this.$refs[formName].validate(valid => {
  1516. if (valid) {
  1517. var weekPath = this.weekPath(
  1518. this.changeSchedule.schedule_week,
  1519. this.changeSchedule.schedule_type
  1520. );
  1521. if (weekPath.length != 2) {
  1522. this.$message.error("数据异常");
  1523. return false;
  1524. }
  1525. this.changeSchedule.bed_id = this.device_id;
  1526. for (let i = 0; i < this.origin_device_numbers.length; i++) {
  1527. if (this.origin_device_numbers[i].id == this.device_id) {
  1528. this.changeSchedule.partition_id = this.origin_device_numbers[
  1529. i
  1530. ].zone_id;
  1531. }
  1532. }
  1533. this.changeSchedule.change_action = "change_device";
  1534. this.changeScheduleActon(formName);
  1535. // this.changeSchedule.spartition_type = this.scheduleZone[index].zone_type
  1536. // var weekPathKey = weekPath[0] + '_' + weekPath[1]
  1537. // for (var index in this.scheduleZone) {
  1538. // if (this.scheduleZone[index].jihao_id == this.changeSchedule.bed_id) {
  1539. // if (this.scheduleZone[index][weekPathKey].mode_id > 0) {
  1540. // this.$message.error('选中的区域已经存在排班,不能再排班!')
  1541. // return false
  1542. // }
  1543. // break
  1544. // }
  1545. // }
  1546. // 可能
  1547. // 患者有传染病,与选择的机器类型(传染病)不匹配
  1548. // 患者没有传染病,但机器是某个传染病的专用透析器
  1549. // 机器的透析模式与患者不匹配
  1550. // if (this.currentData.contagions.length > 0) {
  1551. // var cflag = false
  1552. // for (var index in this.currentData.contagions) {
  1553. // if (this.currentData.contagions[index].disease_id == this.changeSchedule.partition_type) {
  1554. // cflag = true
  1555. // }
  1556. // }
  1557. // if (!cflag) {
  1558. // this.$confirm('此患者有传染病,与此透析机不匹配,确定在此排班吗?', '提示', { confirmButtonText: '确 定', cancelButtonText: '取 消', type: 'warning' })
  1559. // .then(() => {
  1560. //
  1561. // }).catch(() => {
  1562. // })
  1563. // } else {
  1564. // this.changeSchedule.change_action = 'change_device'
  1565. // this.changeScheduleActon(formName)
  1566. // }
  1567. // } else if (this.changeSchedule.partition_type > 1) {
  1568. // this.$confirm('此患者没有传染病,与此透析机不匹配,确定在此排班吗?', '提示', { confirmButtonText: '确 定', cancelButtonText: '取 消', type: 'warning' })
  1569. // .then(() => {
  1570. // this.changeSchedule.change_action = 'change_device'
  1571. // this.changeScheduleActon(formName)
  1572. // }).catch(() => {
  1573. // })
  1574. // } else {
  1575. // this.changeSchedule.change_action = 'change_device'
  1576. // this.changeScheduleActon(formName)
  1577. // }
  1578. }
  1579. });
  1580. },
  1581. submitMode(formName) {
  1582. this.changing_mode = true;
  1583. this.changeSchedule.change_action = "change_mode";
  1584. ChangeSchedule(this.currentData.id, this.changeSchedule)
  1585. .then(response => {
  1586. if (response.data.state == 0) {
  1587. this.$message.error(response.data.msg);
  1588. } else {
  1589. this.$message({
  1590. type: "success",
  1591. message: "修改成功!"
  1592. });
  1593. var that = this;
  1594. var schedule = response.data.data.schedule;
  1595. this.scheduleZone.forEach(function(zone, index) {
  1596. if (
  1597. zone.zone_id == schedule.partition_id &&
  1598. zone.jihao_id == schedule.bed_id
  1599. ) {
  1600. var weekPath = that.weekPath(
  1601. schedule.schedule_week,
  1602. schedule.schedule_type
  1603. );
  1604. if (weekPath.length == 2) {
  1605. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  1606. that.scheduleZone[index][weekPathKey].mode_id =
  1607. schedule.mode_id;
  1608. that.scheduleZone[index][weekPathKey].mode_name =
  1609. typeof that.modeOptions[schedule.mode_id] === "undefined"
  1610. ? ""
  1611. : that.modeOptions[schedule.mode_id].name;
  1612. }
  1613. }
  1614. });
  1615. this.msDialogVisible = false;
  1616. }
  1617. this.changing_mode = false;
  1618. })
  1619. .catch(err => {
  1620. this.$message.error(err);
  1621. this.changing_mode = false;
  1622. });
  1623. },
  1624. submitTiaoZMS(formName) {
  1625. this.$refs[formName].validate(valid => {
  1626. if (valid) {
  1627. this.changing_mode = true;
  1628. this.changeSchedule.change_action = "change_mode";
  1629. ChangeSchedule(this.currentData.id, this.changeSchedule)
  1630. .then(response => {
  1631. if (response.data.state == 0) {
  1632. this.$message.error(response.data.msg);
  1633. } else {
  1634. this.$message({
  1635. type: "success",
  1636. message: "修改成功!"
  1637. });
  1638. var that = this;
  1639. var schedule = response.data.data.schedule;
  1640. this.scheduleZone.forEach(function(zone, index) {
  1641. if (
  1642. zone.zone_id == schedule.partition_id &&
  1643. zone.jihao_id == schedule.bed_id
  1644. ) {
  1645. var weekPath = that.weekPath(
  1646. schedule.schedule_week,
  1647. schedule.schedule_type
  1648. );
  1649. if (weekPath.length == 2) {
  1650. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  1651. that.scheduleZone[index][weekPathKey].mode_id =
  1652. schedule.mode_id;
  1653. that.scheduleZone[index][weekPathKey].mode_name =
  1654. typeof that.modeOptions[schedule.mode_id] ===
  1655. "undefined"
  1656. ? ""
  1657. : that.modeOptions[schedule.mode_id].name;
  1658. }
  1659. }
  1660. });
  1661. this.$refs[formName].resetFields();
  1662. this.msDialogVisible = false;
  1663. }
  1664. this.changing_mode = false;
  1665. })
  1666. .catch(err => {
  1667. this.$message.error(err);
  1668. this.changing_mode = false;
  1669. });
  1670. }
  1671. });
  1672. },
  1673. changePartition(value) {
  1674. this.current_devices = this.zone_device_map[value];
  1675. this.device_id = this.current_devices[0].id;
  1676. },
  1677. changeScheduleType(schedule_type) {
  1678. const params = {
  1679. type: schedule_type,
  1680. date: this.currentData.schedule_date
  1681. };
  1682. getUrgentScheduleInitData(params)
  1683. .then(rs => {
  1684. if (rs.data.state == 1) {
  1685. this.origin_schedules = rs.data.data.schedules;
  1686. this.origin_device_numbers = rs.data.data.device_numbers;
  1687. var zone_device_map = {};
  1688. for (
  1689. let index = 0;
  1690. index < this.origin_device_numbers.length;
  1691. index++
  1692. ) {
  1693. const device_number = this.origin_device_numbers[index];
  1694. if (
  1695. zone_device_map[device_number.zone_name] == null ||
  1696. zone_device_map[device_number.zone_name] == undefined
  1697. ) {
  1698. zone_device_map[device_number.zone_name] = [];
  1699. }
  1700. zone_device_map[device_number.zone_name].push(device_number);
  1701. }
  1702. this.zone_device_map = zone_device_map;
  1703. this.zone_names = Object.keys(this.zone_device_map);
  1704. // console.log('8989898989898989',this.zone_names)
  1705. // console.log(this.current_devices);
  1706. if (this.zone_names.length > 0) {
  1707. this.zone_name = this.zone_names[0];
  1708. this.current_devices = this.zone_device_map[this.zone_name];
  1709. this.device_id = this.current_devices[0].id;
  1710. }
  1711. this.zone_device_options = [
  1712. { values: this.zone_names },
  1713. // { values: this.getDeviceNumberNames(this.current_devices) },
  1714. { values: this.current_devices }
  1715. ];
  1716. } else {
  1717. }
  1718. })
  1719. .catch(err => {
  1720. this.loading = false;
  1721. });
  1722. },
  1723. submitTiaoX() {
  1724. // if (this.tiaoZhengType==1) {
  1725. // this.$confirm('确定要取消当前排班?', '提示', {
  1726. // confirmButtonText: '确定',
  1727. // cancelButtonText: '取消',
  1728. // type: 'warning'
  1729. // }).then(() => {
  1730. // this.CancelSchedule(this.currentData.id);
  1731. // }).catch(() => {});
  1732. // }
  1733. switch (this.tiaoZhengType) {
  1734. case 1:
  1735. this.CancelSchedule(this.currentData.id);
  1736. break;
  1737. case 2:
  1738. this.changeSchedule = {
  1739. mode_id: this.currentData.mode_id,
  1740. schedule_type: this.currentData.schedule_type,
  1741. partition_id: this.currentData.partition_id,
  1742. bed_id: this.currentData.bed_id,
  1743. schedule_week: this.currentData.schedule_week,
  1744. partition_type: ""
  1745. };
  1746. if (
  1747. typeof this.partitions[this.currentData.partition_id].jihaos !==
  1748. "undefined"
  1749. ) {
  1750. this.jihaos = this.partitions[this.currentData.partition_id].jihaos;
  1751. } else {
  1752. this.jihaos = [];
  1753. }
  1754. const params = {
  1755. type: this.currentData.schedule_type,
  1756. date: this.currentData.schedule_date
  1757. };
  1758. getUrgentScheduleInitData(params)
  1759. .then(response => {
  1760. if (response.data.state == 0) {
  1761. this.$message.error(response.data.msg);
  1762. } else {
  1763. if (response.data.state == 1) {
  1764. this.origin_schedules = response.data.data.schedules;
  1765. this.origin_device_numbers =
  1766. response.data.data.device_numbers;
  1767. var zone_device_map = {};
  1768. for (
  1769. let index = 0;
  1770. index < this.origin_device_numbers.length;
  1771. index++
  1772. ) {
  1773. const device_number = this.origin_device_numbers[index];
  1774. if (
  1775. zone_device_map[device_number.zone_name] == null ||
  1776. zone_device_map[device_number.zone_name] == undefined
  1777. ) {
  1778. zone_device_map[device_number.zone_name] = [];
  1779. }
  1780. zone_device_map[device_number.zone_name].push(
  1781. device_number
  1782. );
  1783. }
  1784. this.zone_device_map = zone_device_map;
  1785. this.zone_names = Object.keys(this.zone_device_map);
  1786. if (this.zone_names.length > 0) {
  1787. this.zone_name = this.zone_names[0];
  1788. this.current_devices = this.zone_device_map[this.zone_name];
  1789. this.device_id = this.current_devices[0].id;
  1790. }
  1791. this.zone_device_options = [
  1792. { values: this.zone_names },
  1793. // { values: this.getDeviceNumberNames(this.current_devices) },
  1794. { values: this.current_devices }
  1795. ];
  1796. //
  1797. // for (let i = this.origin_schedules.length - 1; i >= 0; i--) {
  1798. // for (let y = this.origin_device_numbers.length - 1; y >= 0; y--) {
  1799. // if (this.origin_device_numbers[y].id == this.origin_schedules[i].bed_id) {
  1800. // this.origin_device_numbers.splice(y, 1)
  1801. // }
  1802. // }
  1803. // }
  1804. // // debugger
  1805. // var zone_device_map = {}
  1806. // for (let index = 0; index < this.origin_device_numbers.length; index++) {
  1807. // const device_number = this.origin_device_numbers[index]
  1808. // if (zone_device_map[device_number.zone.name] == null || zone_device_map[device_number.zone.name] == undefined) {
  1809. // zone_device_map[device_number.zone.name] = []
  1810. // }
  1811. // zone_device_map[device_number.zone.name].push(device_number)
  1812. // }
  1813. // this.zone_device_map = zone_device_map
  1814. //
  1815. // this.zone_names = Object.keys(this.zone_device_map)
  1816. // if (this.zone_names.length > 0) {
  1817. // this.zone_name = this.zone_names[0]
  1818. // this.current_devices = this.zone_device_map[this.zone_name]
  1819. // this.device_id = this.current_devices[0].id
  1820. // }
  1821. //
  1822. // this.zone_device_options = [
  1823. // { values: this.zone_names },
  1824. // // { values: this.getDeviceNumberNames(this.current_devices) },
  1825. // { values: this.current_devices }
  1826. // ]
  1827. } else {
  1828. }
  1829. }
  1830. })
  1831. .catch(err => {
  1832. this.$message.error(err);
  1833. });
  1834. this.tzDialogVisible = false;
  1835. this.jhDialogVisible = true;
  1836. break;
  1837. case 3:
  1838. this.changeSchedule = {
  1839. mode_id: "",
  1840. schedule_type: "",
  1841. partition_id: "",
  1842. bed_id: "",
  1843. schedule_week: "",
  1844. partition_type: ""
  1845. };
  1846. this.tzDialogVisible = false;
  1847. this.msDialogVisible = true;
  1848. break;
  1849. default:
  1850. break;
  1851. }
  1852. },
  1853. setSchedule() {
  1854. var that = this;
  1855. var submitFlag = true;
  1856. if (this.currentData.patient_id <= 0) {
  1857. this.$message.error("请先选择患者");
  1858. return false;
  1859. }
  1860. if (
  1861. this.currentData.schedule_date.length == 0 ||
  1862. this.currentData.schedule_type < 1 ||
  1863. this.currentData.schedule_type > 3 ||
  1864. this.currentData.bed_id < 1 ||
  1865. this.currentData.partition_id < 1 ||
  1866. this.currentData.schedule_week < 1 ||
  1867. this.currentData.schedule_week > 7
  1868. ) {
  1869. this.$message.error("请先选择排班时间或机号");
  1870. return false;
  1871. }
  1872. // 可能
  1873. // 患者有传染病,与选择的机器类型(传染病)不匹配
  1874. // 患者没有传染病,但机器是某个传染病的专用透析器
  1875. // 机器的透析模式与患者不匹配
  1876. if (this.currentData.contagions.length > 0) {
  1877. var cflag = false;
  1878. this.currentData.contagions.forEach(function(contagion) {
  1879. if (contagion.disease_id == that.currentData.partition_type) {
  1880. cflag = true;
  1881. }
  1882. });
  1883. if (!cflag) {
  1884. this.$confirm(
  1885. "此患者有传染病,与此透析机不匹配,确定在此排班吗?",
  1886. "提示",
  1887. {
  1888. confirmButtonText: "确 定",
  1889. cancelButtonText: "取 消",
  1890. type: "warning"
  1891. }
  1892. )
  1893. .then(() => {
  1894. this.CreateSchedule(
  1895. this.currentData.patient_id,
  1896. this.currentData
  1897. );
  1898. })
  1899. .catch(() => {});
  1900. } else {
  1901. this.CreateSchedule(this.currentData.patient_id, this.currentData);
  1902. }
  1903. } else if (that.currentData.partition_type > 1) {
  1904. this.$confirm(
  1905. "此患者没有传染病,与此透析机不匹配,确定在此排班吗?",
  1906. "提示",
  1907. {
  1908. confirmButtonText: "确 定",
  1909. cancelButtonText: "取 消",
  1910. type: "warning"
  1911. }
  1912. )
  1913. .then(() => {
  1914. this.CreateSchedule(this.currentData.patient_id, this.currentData);
  1915. })
  1916. .catch(() => {});
  1917. } else {
  1918. this.CreateSchedule(this.currentData.patient_id, this.currentData);
  1919. }
  1920. },
  1921. weekType(weekTime) {
  1922. var theType = 2;
  1923. switch (weekTime) {
  1924. case "lastWeek":
  1925. theType = 1;
  1926. break;
  1927. case "thisWeek":
  1928. theType = 2;
  1929. break;
  1930. case "nextWeek":
  1931. theType = 3;
  1932. break;
  1933. case "nextTwoWeek":
  1934. theType = 4;
  1935. break;
  1936. default:
  1937. theType = 2;
  1938. break;
  1939. }
  1940. return theType;
  1941. },
  1942. dayType(theType) {
  1943. var jType = "";
  1944. switch (theType) {
  1945. case 1:
  1946. jType = "上午";
  1947. break;
  1948. case 2:
  1949. jType = "下午";
  1950. break;
  1951. case 3:
  1952. jType = "晚上";
  1953. break;
  1954. default:
  1955. break;
  1956. }
  1957. return jType;
  1958. },
  1959. weekPath(week, schedule_type) {
  1960. var weekArr = {
  1961. 1: "Mon",
  1962. 2: "Tue",
  1963. 3: "Wed",
  1964. 4: "Thurs",
  1965. 5: "Fri",
  1966. 6: "Sat",
  1967. 7: "Sun"
  1968. };
  1969. var typeArr = { 1: "M", 2: "A", 3: "N" };
  1970. if (
  1971. typeof weekArr[week] === "undefined" ||
  1972. typeof typeArr[schedule_type] === "undefined"
  1973. ) {
  1974. return [];
  1975. }
  1976. return [weekArr[week], typeArr[schedule_type]];
  1977. },
  1978. weekDay(prop) {
  1979. var week = prop.split("_");
  1980. if (week.length != 2) {
  1981. return [-1, -1];
  1982. }
  1983. var w = -1;
  1984. var n = -1;
  1985. switch (week[0]) {
  1986. case "Mon":
  1987. w = 1;
  1988. break;
  1989. case "Tue":
  1990. w = 2;
  1991. break;
  1992. case "Wed":
  1993. w = 3;
  1994. break;
  1995. case "Thurs":
  1996. w = 4;
  1997. break;
  1998. case "Fri":
  1999. w = 5;
  2000. break;
  2001. case "Sat":
  2002. w = 6;
  2003. break;
  2004. case "Sun":
  2005. w = 7;
  2006. break;
  2007. default:
  2008. w = -1;
  2009. break;
  2010. }
  2011. switch (week[1]) {
  2012. case "M":
  2013. n = 1;
  2014. break;
  2015. case "A":
  2016. n = 2;
  2017. break;
  2018. case "N":
  2019. n = 3;
  2020. break;
  2021. default:
  2022. n = -1;
  2023. break;
  2024. }
  2025. if (w == -1 || n == -1) {
  2026. return [-1, -1];
  2027. }
  2028. return [w, n];
  2029. },
  2030. search: function() {
  2031. let week_type = 0
  2032. if (this.weekTime == 'thisWeek'){
  2033. week_type = 1
  2034. }else if(this.weekTime == 'nextWeek'){
  2035. week_type = 2
  2036. }else if(this.weekTime == 'nextTwoWeek'){
  2037. week_type = 3
  2038. }
  2039. const params = {
  2040. keywords: this.keywords,
  2041. week_type: week_type,
  2042. };
  2043. getSearchResult(params).then(response => {
  2044. if (response.data.state == 1) {
  2045. this.schedulePatients = response.data.data.schdules;
  2046. this.searchTableVisible = true;
  2047. }
  2048. });
  2049. },
  2050. changeMachineNumber: function(index, row) {
  2051. this.currentData.schedule_type = row.schedule_type;
  2052. this.currentData.bed_id = row.bed_id;
  2053. this.currentData.partition_id = row.partition_id;
  2054. this.currentData.schedule_week = row.schedule_week;
  2055. switch (row.schedule_type) {
  2056. case 1:
  2057. this.currentData.type_name = "上午";
  2058. break;
  2059. case 2:
  2060. this.currentData.type_name = "下午";
  2061. break;
  2062. case 3:
  2063. this.currentData.type_name = "晚上";
  2064. break;
  2065. }
  2066. this.currentData.zone_name = row.zone.name;
  2067. this.currentData.bed_name = row.number.number;
  2068. this.currentData.partition_type = row.zone.type;
  2069. this.currentData.mode_id = row.mode_id;
  2070. this.currentData.patient_id = row.patient_id;
  2071. this.currentData.patient = row.patient;
  2072. this.currentData.contagions = row.patient_contagions;
  2073. this.currentData.id = row.id;
  2074. this.changeSchedule = {
  2075. mode_id: row.mode_id,
  2076. schedule_type: row.schedule_type,
  2077. partition_id: row.partition_id,
  2078. bed_id: row.bed_id,
  2079. schedule_week: row.schedule_week,
  2080. partition_type: ""
  2081. };
  2082. this.currentData.schedule_date = uParseTime(
  2083. row.schedule_date,
  2084. "{y}-{m}-{d}"
  2085. );
  2086. if (typeof this.partitions[row.partition_id].jihaos !== "undefined") {
  2087. this.jihaos = this.partitions[row.partition_id].jihaos;
  2088. } else {
  2089. this.jihaos = [];
  2090. }
  2091. this.searchTableVisible = false;
  2092. this.jhDialogVisible = true;
  2093. },
  2094. getDialysisDate: function(row) {
  2095. let week = "";
  2096. switch (row.schedule_week) {
  2097. case 7:
  2098. week = "周日";
  2099. break;
  2100. case 1:
  2101. week = "周一";
  2102. break;
  2103. case 2:
  2104. week = "周二";
  2105. break;
  2106. case 3:
  2107. week = "周三";
  2108. break;
  2109. case 4:
  2110. week = "周四";
  2111. break;
  2112. case 5:
  2113. week = "周五";
  2114. break;
  2115. case 6:
  2116. week = "周六";
  2117. break;
  2118. }
  2119. return week + "(" + uParseTime(row.schedule_date, "{y}-{m}-{d}") + ")";
  2120. },
  2121. getSchedulesType: function(type) {
  2122. let type_name = "";
  2123. switch (type) {
  2124. case 1:
  2125. type_name = "上午";
  2126. break;
  2127. case 2:
  2128. type_name = "下午";
  2129. break;
  2130. case 3:
  2131. type_name = "晚上";
  2132. break;
  2133. }
  2134. return type_name;
  2135. },
  2136. changeMode: function(index, row) {
  2137. this.changeSchedule = {
  2138. mode_id: "",
  2139. schedule_type: "",
  2140. partition_id: "",
  2141. bed_id: "",
  2142. schedule_week: "",
  2143. partition_type: ""
  2144. };
  2145. this.currentData.id = row.id;
  2146. this.searchTableVisible = false;
  2147. this.msDialogVisible = true;
  2148. },
  2149. tableRowClassName({row, rowIndex}) {
  2150. if(row.zone_type == 1){
  2151. return 'table-row-new-class schedule-table-row'
  2152. }else {
  2153. return 'table-row-new-class schedule-table-row backPurple'
  2154. }
  2155. },
  2156. getAllZones(){
  2157. getAllZones().then(response=>{
  2158. if(response.data.state == 1){
  2159. var zones = response.data.data.zones
  2160. for(let i=0;i<zones.length;i++){
  2161. this.zoneIdList.push(zones[i].id)
  2162. }
  2163. this.zones.push(...zones)
  2164. var strArr = this.zoneIdList.join(",")
  2165. this.strArr = strArr
  2166. this.getWeekPanels()
  2167. }
  2168. })
  2169. },
  2170. changePartiton(val){
  2171. this.$emit('event1', val)
  2172. this.partition_id = val
  2173. this.getWeekPanels()
  2174. this.getSchedules()
  2175. },
  2176. changeSchedule_type(val){
  2177. this.$emit('event2', val)
  2178. this.schedule_type = val
  2179. this.getSchedules()
  2180. },
  2181. },
  2182. components: {
  2183. ScheduleItem
  2184. },
  2185. mounted() {
  2186. this.tableContainHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 120;
  2187. // var theType = this.weekType(this.weekTime);
  2188. // this.getSchedules(theType);
  2189. const that = this;
  2190. window.onresize = () => {
  2191. return (() => {
  2192. window.fullHeight = document.documentElement.clientHeight;
  2193. if (window.fullHeight < 200) {
  2194. that.tableHeight = 200;
  2195. } else {
  2196. that.tableHeight = window.fullHeight - 160;
  2197. }
  2198. })();
  2199. };
  2200. },
  2201. // mounted:function(){
  2202. // this.tableContainHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 160
  2203. // },
  2204. created() {
  2205. this.getAllZones()
  2206. this.changeScheduleType(1)
  2207. rowNumber = 0;
  2208. this.modeOptions = this.$store.getters.treatment_mode;
  2209. this.partitions = this.partitionsProp;
  2210. var contagions = this.$store.getters.contagions;
  2211. if (contagions.length > 0) {
  2212. var that = this;
  2213. contagions.forEach(function(citem) {
  2214. if (citem.type == 2) {
  2215. that.diseasesArr.push({ value: citem.id, label: citem.name });
  2216. }
  2217. });
  2218. }
  2219. this.scheduleZoneRow = this.scheduleZoneRowProp;
  2220. this.weekday = new Date().getDay();
  2221. if (this.weekday == 0) {
  2222. this.weekday = 7;
  2223. }
  2224. }
  2225. };
  2226. </script>
  2227. <style rel="stylesheet/css" lang="scss">
  2228. .tiaozhengclass {
  2229. display: block;
  2230. margin: 0 auto;
  2231. }
  2232. // .el-table tr {
  2233. // background-color: #111 !important;
  2234. // }
  2235. .schedule-table-row {
  2236. background: #fff !important;
  2237. }
  2238. .schedule-table-row:hover {
  2239. background: #fff !important;
  2240. }
  2241. .schedule-table-row td:hover {
  2242. background: rgb(88, 162, 236) !important;
  2243. }
  2244. .schedule-table-row td .cell {
  2245. font-size: 12px;
  2246. white-space: nowrap !important;
  2247. }
  2248. .schedule-table-cell-disable {
  2249. background-color: rgb(245, 245, 245) !important;
  2250. }
  2251. #table_data {
  2252. min-height: calc(100vh - 350px);
  2253. }
  2254. #table_data ::-webkit-scrollbar {
  2255. height: 15px;
  2256. }
  2257. .el-table td,
  2258. .el-table th.is-leaf,
  2259. .el-table--border,
  2260. .el-table--group {
  2261. border-color: #d0d3da;
  2262. }
  2263. .el-table--border::after,
  2264. .el-table--group::after,
  2265. .el-table::before {
  2266. background-color: #d0d3da;
  2267. }
  2268. .el-table--border th {
  2269. border-color: #d0d3da;
  2270. }
  2271. .el-table--border td {
  2272. border-color: #d0d3da;
  2273. }
  2274. .el-table td {
  2275. border-color: #d0d3da;
  2276. }
  2277. // .hover-td{
  2278. // color: red;
  2279. // }
  2280. // .el-table__body tr.current-row > td {
  2281. // background-color: #409eff !important;
  2282. // color: #fff;
  2283. // }
  2284. // .el-table__body tr > td:hover {
  2285. // background-color: #409eff !important;
  2286. // }
  2287. #table_data {
  2288. .el-table__body tr.current-row > td {
  2289. background-color: #ecf5ff !important;
  2290. color: #3a8ee6;
  2291. }
  2292. .el-table__body tr > td:hover {
  2293. background-color: #409eff !important;
  2294. color: #fff;
  2295. }
  2296. .el-table__body tr .hover-td {
  2297. background-color: #409eff !important;
  2298. color: #fff;
  2299. }
  2300. }
  2301. .backPurple{
  2302. color: #08c3df !important;
  2303. }
  2304. </style>