血透系统PC前端

tableData.vue 62KB

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