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

tableData.vue 63KB

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