血透系统PC前端

tableData.vue 57KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547
  1. <template>
  2. <div id="table_data">
  3. <div class="cell clearfix" v-if="weekTime == 'thisWeek'">
  4. <el-input size="small" style="width: 400px;" class="filter-item" v-model="keywords" placeholder="病人名称/透析号"/>
  5. <el-button size="small" class="filter-item" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
  6. </div>
  7. <el-dialog
  8. :visible.sync="searchTableVisible" width="80%" >
  9. <el-table :data="schedulePatients"
  10. :header-cell-style="{
  11. backgroundColor: 'rgb(245, 247, 250)',
  12. color: '#606266'
  13. }"
  14. :row-style="{ color: '#303133' }"
  15. style="width: 100%" border
  16. >
  17. <el-table-column label="姓名" width="120">
  18. <template slot-scope="scope">
  19. {{scope.row.patient}}
  20. </template>
  21. </el-table-column>
  22. <el-table-column label="透析日期" width="200">
  23. <template slot-scope="scope">
  24. {{getDialysisDate(scope.row)}}
  25. </template>
  26. </el-table-column>
  27. <el-table-column label="分区">
  28. <template slot-scope="scope">
  29. {{scope.row.zone.name}}
  30. </template>
  31. </el-table-column>
  32. <el-table-column label="班次" width="80">
  33. <template slot-scope="scope">
  34. {{getSchedulesType(scope.row.schedule_type)}}
  35. </template>
  36. </el-table-column>
  37. <el-table-column label="机号" width="80">
  38. <template slot-scope="scope">
  39. {{scope.row.number.number}}
  40. </template>
  41. </el-table-column>
  42. <el-table-column label="透析模式" width="100">
  43. <template slot-scope="scope">
  44. {{scope.row.mode.name}}
  45. </template>
  46. </el-table-column>
  47. <el-table-column label="操作" align="center" width="300">
  48. <template slot-scope="scope">
  49. <el-button
  50. size="mini"
  51. type="primary"
  52. @click="CancelSchedule(scope.row.id)">
  53. 取消排班
  54. </el-button>
  55. <el-button
  56. size="mini"
  57. type="primary"
  58. @click="changeMachineNumber(scope.$index, scope.row)">
  59. 调整机号
  60. </el-button>
  61. <el-button
  62. size="mini"
  63. type="primary"
  64. @click="changeMode(scope.$index, scope.row)">
  65. 调整模式
  66. </el-button>
  67. </template>
  68. </el-table-column>
  69. </el-table>
  70. </el-dialog>
  71. <el-table
  72. :row-style="{ color : '#303133'}"
  73. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)',color:'#606266'}"
  74. :data="scheduleZone"
  75. :span-method="objectSpanMethod"
  76. @cell-click="clickThis"
  77. :summary-method="getSummaries"
  78. show-summary
  79. :row-class-name="rowClass"
  80. :cell-class-name="cellClass"
  81. sum-text="总数"
  82. :height="tableContainHeight"
  83. ref="table"
  84. style="width: 100%;cursor: pointer;">
  85. <el-table-column prop="area" label="分区" width="80" align="center" fixed></el-table-column>
  86. <el-table-column prop="cut" label="机号" width="80" align="center" fixed></el-table-column>
  87. <el-table-column :label="'周一 (' + weekTitle[0] +')'" width="215" align="center">
  88. <el-table-column prop="Mon_M" label="上" width="70" align="center">
  89. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Mon_M"></schedule-item>
  90. </el-table-column>
  91. <el-table-column prop="Mon_A" label="下" width="70" align="center">
  92. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Mon_A"></schedule-item>
  93. </el-table-column>
  94. <el-table-column prop="Mon_N" label="晚" width="70" align="center">
  95. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Mon_N"></schedule-item>
  96. </el-table-column>
  97. </el-table-column>
  98. <el-table-column :label="'周二 (' + weekTitle[1] +')'" width="215" align="center">
  99. <el-table-column prop="Tue_M" label="上" width="70" align="center">
  100. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Tue_M"></schedule-item>
  101. </el-table-column>
  102. <el-table-column prop="Tue_A" label="下" width="70" align="center">
  103. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Tue_A"></schedule-item>
  104. </el-table-column>
  105. <el-table-column prop="Tue_N" label="晚" width="70" align="center">
  106. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Tue_N"></schedule-item>
  107. </el-table-column>
  108. </el-table-column>
  109. <el-table-column :label="'周三 (' + weekTitle[2] +')'" width="215" align="center">
  110. <el-table-column prop="Wed_M" label="上" width="70" align="center">
  111. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Wed_M"></schedule-item>
  112. </el-table-column>
  113. <el-table-column prop="Wed_A" label="下" width="70" align="center">
  114. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Wed_A"></schedule-item>
  115. </el-table-column>
  116. <el-table-column prop="Wed_N" label="晚" width="70" align="center">
  117. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Wed_N"></schedule-item>
  118. </el-table-column>
  119. </el-table-column>
  120. <el-table-column :label="'周四 (' + weekTitle[3] +')'" width="215" align="center">
  121. <el-table-column prop="Thurs_M" label="上" width="70" align="center">
  122. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Thurs_M"></schedule-item>
  123. </el-table-column>
  124. <el-table-column prop="Thurs_A" label="下" width="70" align="center">
  125. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Thurs_A"></schedule-item>
  126. </el-table-column>
  127. <el-table-column prop="Thurs_N" label="晚" width="70" align="center">
  128. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Thurs_N"></schedule-item>
  129. </el-table-column>
  130. </el-table-column>
  131. <el-table-column :label="'周五 (' + weekTitle[4] +')'" width="215" align="center">
  132. <el-table-column prop="Fri_M" label="上" width="70" align="center">
  133. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Fri_M"></schedule-item>
  134. </el-table-column>
  135. <el-table-column prop="Fri_A" label="下" width="70" align="center">
  136. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Fri_A"></schedule-item>
  137. </el-table-column>
  138. <el-table-column prop="Fri_N" label="晚" width="70" align="center">
  139. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Fri_N"></schedule-item>
  140. </el-table-column>
  141. </el-table-column>
  142. <el-table-column :label="'周六 (' + weekTitle[5] +')'" width="215" align="center">
  143. <el-table-column prop="Sat_M" label="上" width="70" align="center">
  144. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Sat_M"></schedule-item>
  145. </el-table-column>
  146. <el-table-column prop="Sat_A" label="下" width="70" align="center">
  147. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Sat_A"></schedule-item>
  148. </el-table-column>
  149. <el-table-column prop="Sat_N" label="晚" width="70" align="center">
  150. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Sat_N"></schedule-item>
  151. </el-table-column>
  152. </el-table-column>
  153. <el-table-column :label="'周日 (' + weekTitle[6] +')'" min-width="215" align="center">
  154. <el-table-column prop="Sun_M" label="上" min-width="70" align="center">
  155. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Sun_M"></schedule-item>
  156. </el-table-column>
  157. <el-table-column prop="Sun_A" label="下" min-width="70" align="center">
  158. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Sun_A"></schedule-item>
  159. </el-table-column>
  160. <el-table-column prop="Sun_N" label="晚" min-width="70" align="center">
  161. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Sun_N"></schedule-item>
  162. </el-table-column>
  163. </el-table-column>
  164. <el-table-column prop="total" label="总数" width="60" align="center" fixed="right"></el-table-column>
  165. </el-table>
  166. <el-dialog title="排班" :visible.sync="dialogTableVisible" width="1000px;" :v-model="dialog"
  167. v-loading="creating_schedule">
  168. <div>
  169. <div class="cell clearfix">
  170. <label class="title"><span class="name">当前排班</span> : </label>
  171. <div class="time ">
  172. <ul class="">
  173. <span class="current">日期 : {{currentData.schedule_date}} &nbsp;&nbsp; 班次 : {{currentData.type_name}} &nbsp;&nbsp; 病房 : {{currentData.zone_name}} &nbsp;&nbsp; 透析机 : {{currentData.bed_name}} </span>
  174. </ul>
  175. </div>
  176. </div>
  177. <div class="cell clearfix">
  178. <label class="title"><span class="name">患者搜索</span> : </label>
  179. <div class="time ">
  180. <ul class="">
  181. <el-input size="medium" v-model="searchKey" placeholder="请输入搜索的内容" style="width:260px"></el-input>
  182. <el-button type="primary" icon="el-icon-search" @click="SubmitSearch">搜索</el-button>
  183. </ul>
  184. </div>
  185. </div>
  186. <div class="cell clearfix">
  187. <label class="title"><span class="name">排班</span> : </label>
  188. <div class="time ">
  189. <ul class="">
  190. <li v-for="item in schedulArr" @click="changeSearchSchedule(item.value)" :key="item.value"
  191. :class="patientQuery.schedule==item.value?'active':''">{{item.label}}
  192. </li>
  193. </ul>
  194. </div>
  195. </div>
  196. <!-- <div class="cell clearfix">
  197. <label class="title"><span class="name">标签</span> : </label>
  198. <div class="time ">
  199. <ul class="">
  200. <li v-for="item in tagArr" :key="item.value" >{{item.label}}</li>
  201. </ul>
  202. </div>
  203. </div> -->
  204. <div class="cell clearfix">
  205. <label class="title"><span class="name">传染病</span> : </label>
  206. <div class="time ">
  207. <ul class="">
  208. <li v-for="item in diseasesArr" @click="changeSearchContagion(item.value)" :key="item.value"
  209. :class="patientQuery.contagion==item.value?'active':''">{{item.label}}
  210. </li>
  211. </ul>
  212. </div>
  213. </div>
  214. </div>
  215. <el-table ref="singleTable" :data="patients" border highlight-current-row @current-change="handleCurrentChange"
  216. :header-cell-style="{ backgroundColor: 'rgb(236, 245, 255)'}">
  217. <el-table-column type="index" label="序号" width="89" align="center"></el-table-column>
  218. <el-table-column property="dialysis_no" label="透析号" min-width="110" align="center"></el-table-column>
  219. <el-table-column property="name" label="姓名" min-width="110" align="center"></el-table-column>
  220. <el-table-column property="schedules" label="双周已排" min-width="80" align="center">
  221. <template slot-scope="scope">
  222. <span>{{scope.row.schedules.length}}次</span>
  223. </template>
  224. </el-table-column>
  225. <el-table-column property="solutions" label="治疗频率" min-width="200" align="center">
  226. <template slot-scope="scope">
  227. <span v-for="solution in scope.row.solutions" :key="solution.id">{{solution.name}}({{solution.period}}{{solution.times}}) </span>
  228. </template>
  229. </el-table-column>
  230. </el-table>
  231. <div slot="footer" class="dialog-footer">
  232. <el-button @click="closePatientPanel()">取 消</el-button>
  233. <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary" @click="setSchedule">保
  234. </el-button>
  235. </div>
  236. </el-dialog>
  237. <el-dialog
  238. title="调整排班"
  239. :visible.sync="tzDialogVisible"
  240. width="500px"
  241. >
  242. <div style="width:100%;margin:0 auto">
  243. <el-radio-group v-model="tiaoZhengType" :class="tiaozhengclass">
  244. <el-radio :label="1">取消排班</el-radio>
  245. <el-radio :label="2">调整机号</el-radio>
  246. <el-radio :label="3">调整模式</el-radio>
  247. </el-radio-group>
  248. </div>
  249. <span slot="footer" class="dialog-footer">
  250. <el-button @click="tzDialogVisible = false;tiaoZhengType=1">取 消</el-button>
  251. <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary"
  252. @click="submitTiaoX">保 存</el-button>
  253. </span>
  254. </el-dialog>
  255. <el-dialog
  256. title="调整模式"
  257. :visible.sync="msDialogVisible"
  258. width="500px"
  259. v-loading="changing_mode"
  260. >
  261. <div>
  262. <el-form :model="changeSchedule" ref="changeSchedule" :rules="changeRules">
  263. <el-form-item label="" prop="mode_id">
  264. <el-select v-model="changeSchedule.mode_id" placeholder="请选择" style="width:100%">
  265. <el-option
  266. :disabled="item.id == currentData.mode_id"
  267. v-for="item in modeOptions"
  268. :key="item.id"
  269. :label="item.name"
  270. :value="item.id">
  271. </el-option>
  272. </el-select>
  273. </el-form-item>
  274. </el-form>
  275. </div>
  276. <span slot="footer" class="dialog-footer">
  277. <el-button @click="msDialogVisible = false">取 消</el-button>
  278. <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary"
  279. @click="submitTiaoZMS('changeSchedule')">保 存</el-button>
  280. </span>
  281. </el-dialog>
  282. <el-dialog
  283. title="调整机号"
  284. :visible.sync="jhDialogVisible"
  285. width="500px"
  286. v-loading="changing_bed"
  287. >
  288. <div>
  289. <el-form :model="changeSchedule" ref="changeSchedule" :rules="changeRules" label-width="90px">
  290. <el-form-item label="排班日期: ">
  291. <el-input v-model="currentData.schedule_date" disabled></el-input>
  292. </el-form-item>
  293. <el-form-item label="班次: " prop="schedule_type">
  294. <el-select v-model="changeSchedule.schedule_type" placeholder="请选择" style="width:100%"
  295. @change="changeScheduleType">
  296. <el-option
  297. v-for="item in scheduleType"
  298. :key="item.id"
  299. :label="item.name"
  300. :value="item.id">
  301. </el-option>
  302. </el-select>
  303. </el-form-item>
  304. <el-form-item label="病房: " prop="partition_id">
  305. <el-select v-model="zone_name" placeholder="请选择" style="width:100%" @change="changePartition">
  306. <el-option
  307. v-for="(item,index) in zone_names"
  308. :key="index"
  309. :label="item"
  310. :value="item">
  311. </el-option>
  312. </el-select>
  313. </el-form-item>
  314. <el-form-item label="透析机: " prop="bed_id">
  315. <el-select v-model="device_id" placeholder="请选择" style="width:100%">
  316. <el-option
  317. v-for="item in current_devices"
  318. :key="item.id"
  319. :label="item.number"
  320. :value="item.id">
  321. </el-option>
  322. </el-select>
  323. </el-form-item>
  324. </el-form>
  325. </div>
  326. <span slot="footer" class="dialog-footer">
  327. <el-button @click="jhDialogVisible = false">取 消</el-button>
  328. <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary"
  329. @click="submitTiaoZJH('changeSchedule')">保 存</el-button>
  330. </span>
  331. </el-dialog>
  332. </div>
  333. </template>
  334. <script>
  335. import { uParseTime } from '@/utils/tools'
  336. import {
  337. CancelSchedule,
  338. ChangeSchedule,
  339. CreateSchedule,
  340. getSchedulePatients,
  341. getSchedules,
  342. getSearchResult,
  343. getUrgentScheduleInitData,
  344. getWeekPanels
  345. } from '@/api/schedule'
  346. import ScheduleItem from './ScheduleItem'
  347. let rowNumber = 0
  348. export default {
  349. name: 'tableData',
  350. props: {
  351. weekTime: {
  352. type: String,
  353. default: 'thisWeek'
  354. },
  355. scheduleZoneRowProp: {
  356. type: Array,
  357. dafault: []
  358. },
  359. scheduleZoneProp: {
  360. type: Array,
  361. dafault: []
  362. },
  363. partitionsProp: {
  364. type: Object,
  365. dafault: {}
  366. }
  367. },
  368. data() {
  369. return {
  370. // tableContainHeight:400,
  371. // tableHeight:'window.innerHeight - 0',
  372. rowClass: 'table-row-new-class schedule-table-row',
  373. searchKey: '',
  374. tiaoZhengType: 1,
  375. modeOptions: null,
  376. keywords: '',
  377. schedulePatients: [],
  378. searchTableVisible: false,
  379. dialog: {
  380. tag: ''
  381. },
  382. patients: [],
  383. toDay: '',
  384. schedulArr: [
  385. { value: 0, label: '不限' },
  386. { value: 2, label: '未排班' },
  387. { value: 1, label: '已排班' }
  388. ],
  389. tagArr: [
  390. { value: 1, label: '不限' },
  391. { value: 2, label: '透析记录' },
  392. { value: 3, label: '传染病' }
  393. ],
  394. diseasesArr: [
  395. { value: 0, label: '不限' }
  396. ],
  397. scheduleType: [
  398. { id: 1, name: '上午' }, { id: 2, name: '下午' }, { id: 3, name: '晚上' }
  399. ],
  400. dialogTableVisible: false,
  401. tzDialogVisible: false,
  402. msDialogVisible: false,
  403. jhDialogVisible: false,
  404. scheduleZone: this.scheduleZoneProp,
  405. scheduleZoneRow: -1,
  406. partitions: [],
  407. jihaos: [],
  408. weekTitle: ['', '', '', '', '', '', ''],
  409. weekDays: ['', '', '', '', '', '', ''],
  410. currentData: {
  411. id: 0,
  412. schedule_date: '',
  413. schedule_type: 0,
  414. bed_id: 0,
  415. partition_id: 0,
  416. patient_id: 0,
  417. schedule_week: 0,
  418. mode_id: 0,
  419. type_name: '',
  420. bed_name: '',
  421. partition_type: 0,
  422. contagions: [],
  423. patient: ''
  424. },
  425. changeSchedule: {
  426. mode_id: '',
  427. schedule_type: '',
  428. partition_id: '',
  429. bed_id: '',
  430. schedule_week: '',
  431. partition_type: ''
  432. },
  433. patientQuery: {
  434. keywords: '',
  435. schedule: 0,
  436. contagion: 0
  437. },
  438. tiaozhengclass: 'tiaozhengclass',
  439. changeRules: {
  440. mode_id: [{ required: true, message: '请选择模式', trigger: 'blur' }],
  441. schedule_type: [{ required: true, message: '请选择班次', trigger: 'blur' }],
  442. partition_id: [{ required: true, message: '请选择病房', trigger: 'blur' }],
  443. bed_id: [{ required: true, message: '请选择透析机', trigger: 'blur' }]
  444. },
  445. weekday: 0,
  446. creating_schedule: false,
  447. changing_mode: false,
  448. changing_bed: false,
  449. tableHeight: document.documentElement.clientHeight,
  450. origin_schedules: [],
  451. origin_device_numbers: [],
  452. zone_device_map: {},
  453. device_id: 0,
  454. zone_name: '',
  455. current_devices: [],
  456. zone_names: [],
  457. zone_device_options: []
  458. }
  459. },
  460. watch: {
  461. weekTime: function() {
  462. var theType = this.weekType(this.weekTime)
  463. this.getSchedules(theType)
  464. },
  465. 'scheduleZoneRow': function() {
  466. var theType = this.weekType(this.weekTime)
  467. this.getSchedules(theType)
  468. },
  469. tableHeight(val) {
  470. if (!this.timer) {
  471. this.tableHeight = val
  472. this.timer = true
  473. const that = this
  474. setTimeout(function() {
  475. that.timer = false
  476. }, 400)
  477. }
  478. }
  479. },
  480. methods: {
  481. cellClass({ row, column, rowIndex, columnIndex }) {
  482. if (columnIndex == 0 || columnIndex == 1 || columnIndex == 23) {
  483. return ''
  484. } else {
  485. if (this.weekTime == 'lastWeek') {
  486. return 'schedule-table-cell-disable'
  487. } else if (this.weekTime == 'thisWeek') {
  488. var weekday = Math.floor(((columnIndex - 2) / 3) + 1)
  489. if (weekday < this.weekday) {
  490. return 'schedule-table-cell-disable'
  491. }
  492. }
  493. }
  494. return ''
  495. },
  496. SubmitSearch() {
  497. this.patientQuery.keywords = this.searchKey
  498. this.getSchedulePatients()
  499. },
  500. changeSearchContagion(id) {
  501. this.patientQuery.contagion = id
  502. this.getSchedulePatients()
  503. },
  504. changeSearchSchedule(id) {
  505. this.patientQuery.schedule = id
  506. this.getSchedulePatients()
  507. },
  508. getSummaries(param) {
  509. const { columns, data } = param
  510. const sums = []
  511. columns.forEach((column, index) => {
  512. if (index === 0 || index === 25) {
  513. sums[index] = '总数'
  514. return
  515. }
  516. if (index === 1 || index === 24) {
  517. sums[index] = data.length
  518. return
  519. }
  520. const values = data.map(item => item[column.property])
  521. if (index === 23) {
  522. sums[index] = values.reduce((prev, curr) => {
  523. const value = Number(curr)
  524. if (!isNaN(value)) {
  525. return prev + curr
  526. } else {
  527. return prev
  528. }
  529. }, 0)
  530. sums[index]
  531. return
  532. }
  533. sums[index] = values.reduce((prev, curr) => {
  534. if (typeof (curr['mode_id']) === 'undefined') {
  535. return prev
  536. }
  537. const value = Number(curr['mode_id'])
  538. if (!isNaN(value) && value > 0) {
  539. return prev + 1
  540. } else {
  541. return prev
  542. }
  543. }, 0)
  544. sums[index]
  545. })
  546. return sums
  547. },
  548. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  549. var that = this
  550. var rowNum = 0
  551. rowNumber = 0
  552. var rutrnData = {}
  553. if (columnIndex === 0 || columnIndex == 25) {
  554. var rowLen = this.scheduleZoneRow.length
  555. if (rowLen > 0) {
  556. for (let index = 0; index < rowLen; index++) {
  557. rowNum = this.scheduleZoneRow[index]
  558. rowNumber += rowNum
  559. var f = rowNumber - rowNum
  560. if (f == rowIndex) {
  561. rutrnData = {
  562. rowspan: rowNum,
  563. colspan: 1
  564. }
  565. break
  566. } else if (rowIndex < rowNumber) {
  567. rutrnData = {
  568. rowspan: 0,
  569. colspan: 0
  570. }
  571. break
  572. }
  573. }
  574. return rutrnData
  575. }
  576. }
  577. },
  578. handleCurrentChange(row) {
  579. if (typeof (row) === 'undefined' || row == null) {
  580. this.currentData.patient_id = 0
  581. this.currentData.contagions = []
  582. } else {
  583. this.currentData.patient_id = row.id
  584. this.currentData.contagions = row.contagions
  585. }
  586. },
  587. closePatientPanel(row) {
  588. this.dialogTableVisible = false
  589. this.$refs.singleTable.setCurrentRow(row)
  590. this.currentData.patient_id = 0
  591. },
  592. getSchedules(weekType) {
  593. getSchedules(weekType).then(response => {
  594. if (response.data.state == 1) {
  595. this.weekTitle = response.data.data.weekTitle
  596. this.weekDays = response.data.data.days
  597. this.toDay = response.data.data.today
  598. var theSchedules = response.data.data.schdules
  599. var that = this
  600. this.scheduleZone.forEach(function(zone, index) {
  601. that.scheduleZone[index].Mon_M = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  602. that.scheduleZone[index].Mon_A = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  603. that.scheduleZone[index].Mon_N = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  604. that.scheduleZone[index].Tue_M = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  605. that.scheduleZone[index].Tue_A = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  606. that.scheduleZone[index].Tue_N = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  607. that.scheduleZone[index].Wed_M = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  608. that.scheduleZone[index].Wed_A = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  609. that.scheduleZone[index].Wed_N = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  610. that.scheduleZone[index].Thurs_M = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  611. that.scheduleZone[index].Thurs_A = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  612. that.scheduleZone[index].Thurs_N = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  613. that.scheduleZone[index].Fri_M = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  614. that.scheduleZone[index].Fri_A = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  615. that.scheduleZone[index].Fri_N = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  616. that.scheduleZone[index].Sat_M = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  617. that.scheduleZone[index].Sat_A = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  618. that.scheduleZone[index].Sat_N = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  619. that.scheduleZone[index].Sun_A = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  620. that.scheduleZone[index].Sun_N = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  621. that.scheduleZone[index].Sun_M = { mode_id: 0, mode_name: '', patient_id: 0, patient: '' }
  622. that.scheduleZone[index].total = 0
  623. if (response.data.data.schdules.length > 0) {
  624. theSchedules.forEach(function(schedule, sindex) {
  625. if (zone.jihao_id == schedule.bed_id) {
  626. // if(zone.zone_id == schedule.partition_id && zone.jihao_id == schedule.bed_id) {
  627. var weekPath = that.weekPath(schedule.schedule_week, schedule.schedule_type)
  628. if (weekPath.length == 2) {
  629. console.log(schedule)
  630. var weekPathKey = weekPath[0] + '_' + weekPath[1]
  631. that.scheduleZone[index][weekPathKey] = {
  632. schedule_id: schedule.id,
  633. mode_id: schedule.mode_id,
  634. patient_id: schedule.patient_id,
  635. patient: schedule.patient,
  636. patient_contagions: schedule.patient_contagions,
  637. mode_name: typeof (that.modeOptions[schedule.mode_id]) === 'undefined' ? '' : that.modeOptions[schedule.mode_id].name
  638. }
  639. that.scheduleZone[index].total += 1
  640. }
  641. }
  642. })
  643. }
  644. console.log(that.scheduleZone)
  645. console.log(theSchedules)
  646. })
  647. } else {
  648. this.$message.error('网络错误')
  649. return false
  650. }
  651. })
  652. },
  653. getSchedulePatients() {
  654. getSchedulePatients(this.patientQuery).then(response => {
  655. if (response.data.state == 1) {
  656. this.patients = response.data.data.patients
  657. }
  658. })
  659. },
  660. CancelSchedule(id) {
  661. this.$confirm('确定要取消当前排班?', '提示', {
  662. confirmButtonText: '确定',
  663. cancelButtonText: '取消',
  664. type: 'warning'
  665. }).then(() => {
  666. CancelSchedule(id).then(response => {
  667. if (response.data.state == 0) {
  668. this.$message.error(response.data.msg)
  669. } else {
  670. this.$message({
  671. type: 'success',
  672. message: '排班已取消!'
  673. })
  674. var that = this
  675. var schedule = response.data.data.schedule
  676. this.scheduleZone.forEach(function(zone, index) {
  677. if (zone.zone_id == schedule.partition_id && zone.jihao_id == schedule.bed_id) {
  678. var weekPath = that.weekPath(schedule.schedule_week, schedule.schedule_type)
  679. if (weekPath.length == 2) {
  680. var weekPathKey = weekPath[0] + '_' + weekPath[1]
  681. that.scheduleZone[index][weekPathKey] = {
  682. schedule_id: 0,
  683. mode_id: 0,
  684. patient_id: 0,
  685. patient: '',
  686. mode_name: ''
  687. }
  688. that.scheduleZone[index].total -= 1
  689. }
  690. }
  691. })
  692. this.tzDialogVisible = false
  693. this.searchTableVisible = false
  694. }
  695. })
  696. }).catch(() => {
  697. })
  698. },
  699. changeScheduleActon(formName) {
  700. this.changing_bed = true
  701. ChangeSchedule(this.currentData.id, this.changeSchedule).then(response => {
  702. if (response.data.state == 0) {
  703. this.$message.error(response.data.msg)
  704. } else {
  705. this.$message({
  706. type: 'success',
  707. message: '修改成功!'
  708. })
  709. var that = this
  710. var schedule = response.data.data.schedule
  711. this.scheduleZone.forEach(function(zone, index) {
  712. if (zone.zone_id == schedule.partition_id && zone.jihao_id == schedule.bed_id) {
  713. var weekPath = that.weekPath(schedule.schedule_week, schedule.schedule_type)
  714. if (weekPath.length == 2) {
  715. var weekPathKey = weekPath[0] + '_' + weekPath[1]
  716. that.scheduleZone[index][weekPathKey] = {
  717. schedule_id: schedule.id,
  718. mode_id: schedule.mode_id,
  719. patient_id: schedule.patient_id,
  720. patient: that.currentData.patient,
  721. patient_contagions: that.currentData.contagions,
  722. mode_name: typeof (that.modeOptions[schedule.mode_id]) === 'undefined' ? '' : that.modeOptions[schedule.mode_id].name
  723. }
  724. that.scheduleZone[index].total += 1
  725. }
  726. }
  727. if (zone.zone_id == that.currentData.partition_id && zone.jihao_id == that.currentData.bed_id) {
  728. var weekPath = that.weekPath(that.currentData.schedule_week, that.currentData.schedule_type)
  729. if (weekPath.length == 2) {
  730. var weekPathKey = weekPath[0] + '_' + weekPath[1]
  731. that.scheduleZone[index][weekPathKey] = {
  732. schedule_id: 0,
  733. mode_id: 0,
  734. patient_id: 0,
  735. patient: '',
  736. mode_name: '',
  737. patient_contagions: []
  738. }
  739. that.scheduleZone[index].total -= 1
  740. }
  741. }
  742. })
  743. this.$refs[formName].resetFields()
  744. this.jhDialogVisible = false
  745. }
  746. this.changing_bed = false
  747. }).catch(err => {
  748. this.$message.error(err)
  749. this.changing_bed = false
  750. })
  751. },
  752. CreateSchedule(id, data) {
  753. this.creating_schedule = true
  754. CreateSchedule(id, data).then(response => {
  755. if (response.data.state == 0) {
  756. this.$message.error(response.data.msg)
  757. } else {
  758. this.$message({
  759. type: 'success',
  760. message: '排班成功!'
  761. })
  762. var that = this
  763. var schedule = response.data.data.schedule
  764. this.scheduleZone.forEach(function(zone, index) {
  765. if (zone.zone_id == schedule.partition_id && zone.jihao_id == schedule.bed_id) {
  766. var weekPath = that.weekPath(schedule.schedule_week, schedule.schedule_type)
  767. if (weekPath.length == 2) {
  768. var weekPathKey = weekPath[0] + '_' + weekPath[1]
  769. that.scheduleZone[index][weekPathKey] = {
  770. schedule_id: schedule.id,
  771. mode_id: schedule.mode_id,
  772. patient_id: schedule.patient_id,
  773. patient: schedule.patient,
  774. patient_contagions: that.currentData.contagions,
  775. mode_name: typeof (that.modeOptions[schedule.mode_id]) === 'undefined' ? '' : that.modeOptions[schedule.mode_id].name
  776. }
  777. that.scheduleZone[index].total += 1
  778. }
  779. }
  780. })
  781. this.closePatientPanel()
  782. }
  783. this.creating_schedule = false
  784. }).catch(err => {
  785. this.$message.error(err)
  786. this.creating_schedule = false
  787. })
  788. },
  789. clickThis(row, column, cell, event) {
  790. // debugger
  791. console.log(column.property)
  792. var week = this.weekDay(column.property)
  793. console.log(week)
  794. if (week[0] == -1 || week[1] == -1) {
  795. return false
  796. }
  797. if (this.toDay > this.weekDays[week[0] - 1]) {
  798. return false
  799. }
  800. this.currentData.schedule_date = this.weekDays[week[0] - 1]
  801. this.currentData.schedule_type = week[1]
  802. this.currentData.bed_id = row.jihao_id
  803. this.currentData.partition_id = row.zone_id
  804. this.currentData.schedule_week = week[0]
  805. this.currentData.type_name = this.dayType(week[1])
  806. this.currentData.zone_name = row.area
  807. this.currentData.bed_name = row.cut
  808. this.currentData.partition_type = row.zone_type
  809. console.log(this.currentData)
  810. if (row[column.property].schedule_id > 0) {
  811. this.currentData.mode_id = row[column.property].mode_id
  812. this.currentData.id = row[column.property].schedule_id
  813. this.currentData.patient_id = row[column.property].patient_id
  814. this.currentData.patient = row[column.property].patient
  815. this.currentData.contagions = row[column.property].patient_contagions
  816. this.tiaoZhengType = 1
  817. this.tzDialogVisible = true
  818. } else {
  819. this.currentData.mode_id = 1
  820. this.currentData.id = 0
  821. this.currentData.patient_id = 0
  822. this.currentData.patient = ''
  823. this.currentData.contagions = []
  824. this.getSchedulePatients()
  825. this.dialogTableVisible = true
  826. }
  827. },
  828. submitTiaoZJH(formName) {
  829. this.$refs[formName].validate((valid) => {
  830. if (valid) {
  831. var weekPath = this.weekPath(this.changeSchedule.schedule_week, this.changeSchedule.schedule_type)
  832. if (weekPath.length != 2) {
  833. this.$message.error('数据异常')
  834. return false
  835. }
  836. this.changeSchedule.bed_id = this.device_id
  837. for (let i = 0; i < this.origin_device_numbers.length; i++) {
  838. if (this.origin_device_numbers[i].id == this.device_id) {
  839. this.changeSchedule.partition_id = this.origin_device_numbers[i].zone_id
  840. }
  841. }
  842. // console.log(this.scheduleZone)
  843. this.changeSchedule.change_action = 'change_device'
  844. this.changeScheduleActon(formName)
  845. // this.changeSchedule.spartition_type = this.scheduleZone[index].zone_type
  846. // var weekPathKey = weekPath[0] + '_' + weekPath[1]
  847. // for (var index in this.scheduleZone) {
  848. // if (this.scheduleZone[index].jihao_id == this.changeSchedule.bed_id) {
  849. // if (this.scheduleZone[index][weekPathKey].mode_id > 0) {
  850. // this.$message.error('选中的区域已经存在排班,不能再排班!')
  851. // return false
  852. // }
  853. // break
  854. // }
  855. // }
  856. // 可能
  857. // 患者有传染病,与选择的机器类型(传染病)不匹配
  858. // 患者没有传染病,但机器是某个传染病的专用透析器
  859. // 机器的透析模式与患者不匹配
  860. // if (this.currentData.contagions.length > 0) {
  861. // var cflag = false
  862. // for (var index in this.currentData.contagions) {
  863. // if (this.currentData.contagions[index].disease_id == this.changeSchedule.partition_type) {
  864. // cflag = true
  865. // }
  866. // }
  867. // if (!cflag) {
  868. // this.$confirm('此患者有传染病,与此透析机不匹配,确定在此排班吗?', '提示', { confirmButtonText: '确 定', cancelButtonText: '取 消', type: 'warning' })
  869. // .then(() => {
  870. //
  871. // }).catch(() => {
  872. // })
  873. // } else {
  874. // this.changeSchedule.change_action = 'change_device'
  875. // this.changeScheduleActon(formName)
  876. // }
  877. // } else if (this.changeSchedule.partition_type > 1) {
  878. // this.$confirm('此患者没有传染病,与此透析机不匹配,确定在此排班吗?', '提示', { confirmButtonText: '确 定', cancelButtonText: '取 消', type: 'warning' })
  879. // .then(() => {
  880. // this.changeSchedule.change_action = 'change_device'
  881. // this.changeScheduleActon(formName)
  882. // }).catch(() => {
  883. // })
  884. // } else {
  885. // this.changeSchedule.change_action = 'change_device'
  886. // this.changeScheduleActon(formName)
  887. // }
  888. }
  889. })
  890. },
  891. submitTiaoZMS(formName) {
  892. this.$refs[formName].validate((valid) => {
  893. if (valid) {
  894. this.changing_mode = true
  895. this.changeSchedule.change_action = 'change_mode'
  896. ChangeSchedule(this.currentData.id, this.changeSchedule).then(response => {
  897. if (response.data.state == 0) {
  898. this.$message.error(response.data.msg)
  899. } else {
  900. this.$message({
  901. type: 'success',
  902. message: '修改成功!'
  903. })
  904. var that = this
  905. var schedule = response.data.data.schedule
  906. this.scheduleZone.forEach(function(zone, index) {
  907. if (zone.zone_id == schedule.partition_id && zone.jihao_id == schedule.bed_id) {
  908. var weekPath = that.weekPath(schedule.schedule_week, schedule.schedule_type)
  909. if (weekPath.length == 2) {
  910. var weekPathKey = weekPath[0] + '_' + weekPath[1]
  911. that.scheduleZone[index][weekPathKey].mode_id = schedule.mode_id
  912. that.scheduleZone[index][weekPathKey].mode_name = typeof (that.modeOptions[schedule.mode_id]) === 'undefined' ? '' : that.modeOptions[schedule.mode_id].name
  913. }
  914. }
  915. })
  916. this.$refs[formName].resetFields()
  917. this.msDialogVisible = false
  918. }
  919. this.changing_mode = false
  920. }).catch(err => {
  921. this.$message.error(err)
  922. this.changing_mode = false
  923. })
  924. }
  925. })
  926. },
  927. changePartition(value) {
  928. this.current_devices = this.zone_device_map[value]
  929. this.device_id = this.current_devices[0].id
  930. }, changeScheduleType(schedule_type) {
  931. const params = {
  932. type: schedule_type
  933. }
  934. getUrgentScheduleInitData(params).then(rs => {
  935. if (rs.data.state == 1) {
  936. this.origin_schedules = rs.data.data.schedules
  937. this.patients = rs.data.data.patients
  938. this.modes = rs.data.data.modes
  939. this.origin_device_numbers = rs.data.data.device_numbers
  940. for (let i = this.origin_schedules.length - 1; i >= 0; i--) {
  941. for (let y = this.origin_device_numbers.length - 1; y >= 0; y--) {
  942. if (this.origin_device_numbers[y].id == this.origin_schedules[i].bed_id) {
  943. this.origin_device_numbers.splice(y, 1)
  944. }
  945. }
  946. }
  947. var zone_device_map = {}
  948. for (let index = 0; index < this.origin_device_numbers.length; index++) {
  949. const device_number = this.origin_device_numbers[index]
  950. if (zone_device_map[device_number.zone.name] == null || zone_device_map[device_number.zone.name] == undefined) {
  951. zone_device_map[device_number.zone.name] = []
  952. }
  953. zone_device_map[device_number.zone.name].push(device_number)
  954. }
  955. this.zone_device_map = zone_device_map
  956. // debugger
  957. this.zone_names = Object.keys(this.zone_device_map)
  958. if (this.zone_names.length > 0) {
  959. this.zone_name = this.zone_names[0]
  960. this.current_devices = this.zone_device_map[this.zone_name]
  961. this.device_id = this.current_devices[0].id
  962. }
  963. this.zone_device_options = [
  964. { values: this.zone_names },
  965. // { values: this.getDeviceNumberNames(this.current_devices) },
  966. { values: this.current_devices }
  967. ]
  968. } else {
  969. Toast.fail(rs.data.msg)
  970. }
  971. }).catch(err => {
  972. this.loading = false
  973. Toast.fail(err)
  974. })
  975. },
  976. submitTiaoX() {
  977. // if (this.tiaoZhengType==1) {
  978. // this.$confirm('确定要取消当前排班?', '提示', {
  979. // confirmButtonText: '确定',
  980. // cancelButtonText: '取消',
  981. // type: 'warning'
  982. // }).then(() => {
  983. // this.CancelSchedule(this.currentData.id);
  984. // }).catch(() => {});
  985. // }
  986. switch (this.tiaoZhengType) {
  987. case 1:
  988. this.CancelSchedule(this.currentData.id)
  989. break
  990. case 2:
  991. this.changeSchedule = {
  992. mode_id: this.currentData.mode_id,
  993. schedule_type: this.currentData.schedule_type,
  994. partition_id: this.currentData.partition_id,
  995. bed_id: this.currentData.bed_id,
  996. schedule_week: this.currentData.schedule_week,
  997. partition_type: ''
  998. }
  999. if (typeof (this.partitions[this.currentData.partition_id].jihaos) !== 'undefined') {
  1000. this.jihaos = this.partitions[this.currentData.partition_id].jihaos
  1001. } else {
  1002. this.jihaos = []
  1003. }
  1004. const params = {
  1005. type: this.currentData.schedule_type,
  1006. date: this.currentData.schedule_date
  1007. }
  1008. getUrgentScheduleInitData(params).then(response => {
  1009. if (response.data.state == 0) {
  1010. this.$message.error(response.data.msg)
  1011. } else {
  1012. if (response.data.state == 1) {
  1013. this.origin_schedules = response.data.data.schedules
  1014. this.origin_device_numbers = response.data.data.device_numbers
  1015. for (let i = this.origin_schedules.length - 1; i >= 0; i--) {
  1016. for (let y = this.origin_device_numbers.length - 1; y >= 0; y--) {
  1017. if (this.origin_device_numbers[y].id == this.origin_schedules[i].bed_id) {
  1018. this.origin_device_numbers.splice(y, 1)
  1019. }
  1020. }
  1021. }
  1022. // debugger
  1023. var zone_device_map = {}
  1024. for (let index = 0; index < this.origin_device_numbers.length; index++) {
  1025. const device_number = this.origin_device_numbers[index]
  1026. if (zone_device_map[device_number.zone.name] == null || zone_device_map[device_number.zone.name] == undefined) {
  1027. zone_device_map[device_number.zone.name] = []
  1028. }
  1029. zone_device_map[device_number.zone.name].push(device_number)
  1030. }
  1031. this.zone_device_map = zone_device_map
  1032. this.zone_names = Object.keys(this.zone_device_map)
  1033. if (this.zone_names.length > 0) {
  1034. this.zone_name = this.zone_names[0]
  1035. this.current_devices = this.zone_device_map[this.zone_name]
  1036. this.device_id = this.current_devices[0].id
  1037. }
  1038. this.zone_device_options = [
  1039. { values: this.zone_names },
  1040. // { values: this.getDeviceNumberNames(this.current_devices) },
  1041. { values: this.current_devices }
  1042. ]
  1043. } else {
  1044. Toast.fail(rs.data.msg)
  1045. }
  1046. }
  1047. }).catch(err => {
  1048. this.$message.error(err)
  1049. })
  1050. this.tzDialogVisible = false
  1051. this.jhDialogVisible = true
  1052. break
  1053. case 3:
  1054. this.changeSchedule = {
  1055. mode_id: '',
  1056. schedule_type: '',
  1057. partition_id: '',
  1058. bed_id: '',
  1059. schedule_week: '',
  1060. partition_type: ''
  1061. }
  1062. this.tzDialogVisible = false
  1063. this.msDialogVisible = true
  1064. break
  1065. default:
  1066. break
  1067. }
  1068. },
  1069. setSchedule() {
  1070. var that = this
  1071. var submitFlag = true
  1072. if (this.currentData.patient_id <= 0) {
  1073. this.$message.error('请先选择患者')
  1074. return false
  1075. }
  1076. if (this.currentData.schedule_date.length == 0 || (this.currentData.schedule_type < 1 || this.currentData.schedule_type > 3) || this.currentData.bed_id < 1 || this.currentData.partition_id < 1 || (this.currentData.schedule_week < 1 || this.currentData.schedule_week > 7)) {
  1077. this.$message.error('请先选择排班时间或机号')
  1078. return false
  1079. }
  1080. // 可能
  1081. // 患者有传染病,与选择的机器类型(传染病)不匹配
  1082. // 患者没有传染病,但机器是某个传染病的专用透析器
  1083. // 机器的透析模式与患者不匹配
  1084. if (this.currentData.contagions.length > 0) {
  1085. var cflag = false
  1086. this.currentData.contagions.forEach(function(contagion) {
  1087. if (contagion.disease_id == that.currentData.partition_type) {
  1088. cflag = true
  1089. }
  1090. })
  1091. if (!cflag) {
  1092. this.$confirm('此患者有传染病,与此透析机不匹配,确定在此排班吗?', '提示', {
  1093. confirmButtonText: '确 定',
  1094. cancelButtonText: '取 消',
  1095. type: 'warning'
  1096. })
  1097. .then(() => {
  1098. this.CreateSchedule(this.currentData.patient_id, this.currentData)
  1099. }).catch(() => {
  1100. })
  1101. } else {
  1102. this.CreateSchedule(this.currentData.patient_id, this.currentData)
  1103. }
  1104. } else if (that.currentData.partition_type > 1) {
  1105. this.$confirm('此患者没有传染病,与此透析机不匹配,确定在此排班吗?', '提示', {
  1106. confirmButtonText: '确 定',
  1107. cancelButtonText: '取 消',
  1108. type: 'warning'
  1109. })
  1110. .then(() => {
  1111. this.CreateSchedule(this.currentData.patient_id, this.currentData)
  1112. }).catch(() => {
  1113. })
  1114. } else {
  1115. this.CreateSchedule(this.currentData.patient_id, this.currentData)
  1116. }
  1117. },
  1118. weekType(weekTime) {
  1119. var theType = 2
  1120. switch (weekTime) {
  1121. case 'lastWeek':
  1122. theType = 1
  1123. break
  1124. case 'thisWeek':
  1125. theType = 2
  1126. break
  1127. case 'nextWeek':
  1128. theType = 3
  1129. break
  1130. case 'nextTwoWeek':
  1131. theType = 4
  1132. break
  1133. default:
  1134. theType = 2
  1135. break
  1136. }
  1137. return theType
  1138. },
  1139. dayType(theType) {
  1140. var jType = ''
  1141. switch (theType) {
  1142. case 1:
  1143. jType = '上午'
  1144. break
  1145. case 2:
  1146. jType = '下午'
  1147. break
  1148. case 3:
  1149. jType = '晚上'
  1150. break
  1151. default:
  1152. break
  1153. }
  1154. return jType
  1155. },
  1156. weekPath(week, schedule_type) {
  1157. var weekArr = { 1: 'Mon', 2: 'Tue', 3: 'Wed', 4: 'Thurs', 5: 'Fri', 6: 'Sat', 7: 'Sun' }
  1158. var typeArr = { 1: 'M', 2: 'A', 3: 'N' }
  1159. if (typeof (weekArr[week]) === 'undefined' || typeof (typeArr[schedule_type]) === 'undefined') {
  1160. return []
  1161. }
  1162. return [weekArr[week], typeArr[schedule_type]]
  1163. },
  1164. weekDay(prop) {
  1165. var week = prop.split('_')
  1166. if (week.length != 2) {
  1167. return [-1, -1]
  1168. }
  1169. var w = -1
  1170. var n = -1
  1171. switch (week[0]) {
  1172. case 'Mon':
  1173. w = 1
  1174. break
  1175. case 'Tue':
  1176. w = 2
  1177. break
  1178. case 'Wed':
  1179. w = 3
  1180. break
  1181. case 'Thurs':
  1182. w = 4
  1183. break
  1184. case 'Fri':
  1185. w = 5
  1186. break
  1187. case 'Sat':
  1188. w = 6
  1189. break
  1190. case 'Sun':
  1191. w = 7
  1192. break
  1193. default:
  1194. w = -1
  1195. break
  1196. }
  1197. switch (week[1]) {
  1198. case 'M':
  1199. n = 1
  1200. break
  1201. case 'A':
  1202. n = 2
  1203. break
  1204. case 'N':
  1205. n = 3
  1206. break
  1207. default:
  1208. n = -1
  1209. break
  1210. }
  1211. if (w == -1 || n == -1) {
  1212. return [-1, -1]
  1213. }
  1214. return [w, n]
  1215. }, search: function() {
  1216. const params = {
  1217. keywords: this.keywords
  1218. }
  1219. getSearchResult(params).then(response => {
  1220. if (response.data.state == 1) {
  1221. this.schedulePatients = response.data.data.schdules
  1222. this.searchTableVisible = true
  1223. }
  1224. })
  1225. }, changeMachineNumber: function(index, row) {
  1226. this.currentData.schedule_type = row.schedule_type
  1227. this.currentData.bed_id = row.bed_id
  1228. this.currentData.partition_id = row.partition_id
  1229. this.currentData.schedule_week = row.schedule_week
  1230. switch (row.schedule_type) {
  1231. case 1:
  1232. this.currentData.type_name = '上午'
  1233. break
  1234. case 2:
  1235. this.currentData.type_name = '下午'
  1236. break
  1237. case 3:
  1238. this.currentData.type_name = '晚上'
  1239. break
  1240. }
  1241. this.currentData.zone_name = row.zone.name
  1242. this.currentData.bed_name = row.number.number
  1243. this.currentData.partition_type = row.zone.type
  1244. this.currentData.mode_id = row.mode_id
  1245. this.currentData.patient_id = row.patient_id
  1246. this.currentData.patient = row.patient
  1247. this.currentData.contagions = row.patient_contagions
  1248. this.currentData.id = row.id
  1249. this.changeSchedule = {
  1250. mode_id: row.mode_id,
  1251. schedule_type: row.schedule_type,
  1252. partition_id: row.partition_id,
  1253. bed_id: row.bed_id,
  1254. schedule_week: row.schedule_week,
  1255. partition_type: ''
  1256. }
  1257. this.currentData.schedule_date = uParseTime(row.schedule_date, '{y}-{m}-{d}')
  1258. if (typeof (this.partitions[row.partition_id].jihaos) !== 'undefined') {
  1259. this.jihaos = this.partitions[row.partition_id].jihaos
  1260. } else {
  1261. this.jihaos = []
  1262. }
  1263. const params = {
  1264. type: row.schedule_type
  1265. }
  1266. getUrgentScheduleInitData(params).then(response => {
  1267. if (response.data.state == 0) {
  1268. this.$message.error(response.data.msg)
  1269. } else {
  1270. if (response.data.state == 1) {
  1271. this.origin_schedules = response.data.data.schedules
  1272. this.origin_device_numbers = response.data.data.device_numbers
  1273. for (let i = this.origin_schedules.length - 1; i >= 0; i--) {
  1274. for (let y = this.origin_device_numbers.length - 1; y >= 0; y--) {
  1275. if (this.origin_device_numbers[y].id == this.origin_schedules[i].bed_id) {
  1276. this.origin_device_numbers.splice(y, 1)
  1277. }
  1278. }
  1279. }
  1280. var zone_device_map = {}
  1281. for (let index = 0; index < this.origin_device_numbers.length; index++) {
  1282. const device_number = this.origin_device_numbers[index]
  1283. if (zone_device_map[device_number.zone.name] == null || zone_device_map[device_number.zone.name] == undefined) {
  1284. zone_device_map[device_number.zone.name] = []
  1285. }
  1286. zone_device_map[device_number.zone.name].push(device_number)
  1287. }
  1288. this.zone_device_map = zone_device_map
  1289. this.zone_names = Object.keys(this.zone_device_map)
  1290. if (this.zone_names.length > 0) {
  1291. this.zone_name = this.zone_names[0]
  1292. this.current_devices = this.zone_device_map[this.zone_name]
  1293. this.device_id = this.current_devices[0].id
  1294. }
  1295. this.zone_device_options = [
  1296. { values: this.zone_names },
  1297. // { values: this.getDeviceNumberNames(this.current_devices) },
  1298. { values: this.current_devices }
  1299. ]
  1300. } else {
  1301. Toast.fail(rs.data.msg)
  1302. }
  1303. }
  1304. }).catch(err => {
  1305. this.$message.error(err)
  1306. })
  1307. this.searchTableVisible = false
  1308. this.jhDialogVisible = true
  1309. }, getDialysisDate: function(row) {
  1310. let week = ''
  1311. switch (row.schedule_week) {
  1312. case 7:
  1313. week = '周日'
  1314. break
  1315. case 1:
  1316. week = '周一'
  1317. break
  1318. case 2:
  1319. week = '周二'
  1320. break
  1321. case 3:
  1322. week = '周三'
  1323. break
  1324. case 4:
  1325. week = '周四'
  1326. break
  1327. case 5:
  1328. week = '周五'
  1329. break
  1330. case 6:
  1331. week = '周六'
  1332. break
  1333. }
  1334. return week + '(' + uParseTime(row.schedule_date, '{y}-{m}-{d}') + ')'
  1335. }, getSchedulesType: function(type) {
  1336. let type_name = ''
  1337. switch (type) {
  1338. case 1:
  1339. type_name = '上午'
  1340. break
  1341. case 2:
  1342. type_name = '下午'
  1343. break
  1344. case 3:
  1345. type_name = '晚上'
  1346. break
  1347. }
  1348. return type_name
  1349. }, changeMode: function(index, row) {
  1350. this.changeSchedule = {
  1351. mode_id: '',
  1352. schedule_type: '',
  1353. partition_id: '',
  1354. bed_id: '',
  1355. schedule_week: '',
  1356. partition_type: ''
  1357. }
  1358. this.currentData.id = row.id
  1359. this.searchTableVisible = false
  1360. this.msDialogVisible = true
  1361. }
  1362. },
  1363. components: {
  1364. ScheduleItem
  1365. },
  1366. mounted() {
  1367. console.log(this.tableContainHeight)
  1368. this.tableContainHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 160
  1369. console.log(this.tableContainHeight)
  1370. // var theType = this.weekType(this.weekTime);
  1371. // this.getSchedules(theType);
  1372. const that = this
  1373. window.onresize = () => {
  1374. return (() => {
  1375. window.fullHeight = document.documentElement.clientHeight
  1376. if (window.fullHeight < 200) {
  1377. that.tableHeight = 200
  1378. } else {
  1379. that.tableHeight = window.fullHeight - 200
  1380. }
  1381. })()
  1382. }
  1383. },
  1384. // mounted:function(){
  1385. // this.tableContainHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 160
  1386. // },
  1387. created() {
  1388. rowNumber = 0
  1389. this.modeOptions = this.$store.getters.treatment_mode
  1390. this.partitions = this.partitionsProp
  1391. console.log(this.partitions)
  1392. var contagions = this.$store.getters.contagions
  1393. if (contagions.length > 0) {
  1394. var that = this
  1395. contagions.forEach(function(citem) {
  1396. if (citem.type == 2) {
  1397. that.diseasesArr.push({ value: citem.id, label: citem.name })
  1398. }
  1399. })
  1400. }
  1401. this.scheduleZoneRow = this.scheduleZoneRowProp
  1402. console.log(this.scheduleZoneRow)
  1403. this.weekday = (new Date()).getDay()
  1404. if (this.weekday == 0) {
  1405. this.weekday = 7
  1406. }
  1407. }
  1408. }
  1409. </script>
  1410. <style rel="stylesheet/css" lang="scss" >
  1411. .tiaozhengclass {
  1412. display: block;
  1413. margin: 0 auto;
  1414. }
  1415. // .el-table tr {
  1416. // background-color: #111 !important;
  1417. // }
  1418. .schedule-table-row {
  1419. background: #fff !important;
  1420. }
  1421. .schedule-table-row:hover {
  1422. background: #fff !important;
  1423. }
  1424. .schedule-table-row td:hover {
  1425. background: rgb(88, 162, 236) !important;
  1426. }
  1427. .schedule-table-row td .cell {
  1428. font-size: 12px;
  1429. white-space: nowrap !important;
  1430. }
  1431. .schedule-table-cell-disable {
  1432. background-color: rgb(245, 245, 245) !important;
  1433. }
  1434. #table_data {
  1435. min-height: calc(100vh - 350px);
  1436. }
  1437. #table_data ::-webkit-scrollbar {
  1438. height: 15px;
  1439. }
  1440. .el-table td, .el-table th.is-leaf,.el-table--border, .el-table--group{
  1441. border-color: #d0d3da;
  1442. }
  1443. .el-table--border::after, .el-table--group::after, .el-table::before{
  1444. background-color: #d0d3da;
  1445. }
  1446. .el-table--border th{
  1447. border-color: #d0d3da;
  1448. }
  1449. .el-table--border td{
  1450. border-color: #d0d3da;
  1451. }
  1452. .el-table td{
  1453. border-color: #d0d3da;
  1454. }
  1455. </style>