血透系统PC前端

tableData.vue 43KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136
  1. <template>
  2. <div id="table_data">
  3. <el-table
  4. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  5. :data="scheduleZone"
  6. :span-method="objectSpanMethod"
  7. @cell-click="clickThis"
  8. :summary-method="getSummaries"
  9. show-summary
  10. :row-class-name="rowClass"
  11. :cell-class-name="cellClass"
  12. sum-text="总数"
  13. :height="tableContainHeight"
  14. ref="table"
  15. style="width: 100%;cursor: pointer;">
  16. <el-table-column prop="area" label="分区" width="80" align="center" fixed></el-table-column>
  17. <el-table-column prop="cut" label="机号" width="80" align="center" fixed></el-table-column>
  18. <el-table-column :label="'周一 (' + weekTitle[0] +')'" width="215" align="center" >
  19. <el-table-column prop="Mon_M" label="上" width="70" align="center" >
  20. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Mon_M"></schedule-item>
  21. </el-table-column>
  22. <el-table-column prop="Mon_A" label="下" width="70" align="center" >
  23. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Mon_A"></schedule-item>
  24. </el-table-column>
  25. <el-table-column prop="Mon_N" label="晚" width="70" align="center" >
  26. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Mon_N"></schedule-item>
  27. </el-table-column>
  28. </el-table-column>
  29. <el-table-column :label="'周二 (' + weekTitle[1] +')'" width="215" align="center" >
  30. <el-table-column prop="Tue_M" label="上" width="70" align="center">
  31. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Tue_M"></schedule-item>
  32. </el-table-column>
  33. <el-table-column prop="Tue_A" label="下" width="70" align="center">
  34. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Tue_A"></schedule-item>
  35. </el-table-column>
  36. <el-table-column prop="Tue_N" label="晚" width="70" align="center">
  37. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Tue_N"></schedule-item>
  38. </el-table-column>
  39. </el-table-column>
  40. <el-table-column :label="'周三 (' + weekTitle[2] +')'" width="215" align="center" >
  41. <el-table-column prop="Wed_M" label="上" width="70" align="center">
  42. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Wed_M"></schedule-item>
  43. </el-table-column>
  44. <el-table-column prop="Wed_A" label="下" width="70" align="center">
  45. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Wed_A"></schedule-item>
  46. </el-table-column>
  47. <el-table-column prop="Wed_N" label="晚" width="70" align="center">
  48. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Wed_N"></schedule-item>
  49. </el-table-column>
  50. </el-table-column>
  51. <el-table-column :label="'周四 (' + weekTitle[3] +')'" width="215" align="center" >
  52. <el-table-column prop="Thurs_M" label="上" width="70" align="center">
  53. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Thurs_M"></schedule-item>
  54. </el-table-column>
  55. <el-table-column prop="Thurs_A" label="下" width="70" align="center">
  56. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Thurs_A"></schedule-item>
  57. </el-table-column>
  58. <el-table-column prop="Thurs_N" label="晚" width="70" align="center">
  59. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Thurs_N"></schedule-item>
  60. </el-table-column>
  61. </el-table-column>
  62. <el-table-column :label="'周五 (' + weekTitle[4] +')'" width="215" align="center" >
  63. <el-table-column prop="Fri_M" label="上" width="70" align="center">
  64. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Fri_M"></schedule-item>
  65. </el-table-column>
  66. <el-table-column prop="Fri_A" label="下" width="70" align="center">
  67. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Fri_A"></schedule-item>
  68. </el-table-column>
  69. <el-table-column prop="Fri_N" label="晚" width="70" align="center">
  70. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Fri_N"></schedule-item>
  71. </el-table-column>
  72. </el-table-column>
  73. <el-table-column :label="'周六 (' + weekTitle[5] +')'" width="215" align="center" >
  74. <el-table-column prop="Sat_M" label="上" width="70" align="center">
  75. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Sat_M"></schedule-item>
  76. </el-table-column>
  77. <el-table-column prop="Sat_A" label="下" width="70" align="center">
  78. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Sat_A"></schedule-item>
  79. </el-table-column>
  80. <el-table-column prop="Sat_N" label="晚" width="70" align="center">
  81. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Sat_N"></schedule-item>
  82. </el-table-column>
  83. </el-table-column>
  84. <el-table-column :label="'周日 (' + weekTitle[6] +')'" min-width="215" align="center" >
  85. <el-table-column prop="Sun_M" label="上" min-width="70" align="center">
  86. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Sun_M"></schedule-item>
  87. </el-table-column>
  88. <el-table-column prop="Sun_A" label="下" min-width="70" align="center">
  89. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Sun_A"></schedule-item>
  90. </el-table-column>
  91. <el-table-column prop="Sun_N" label="晚" min-width="70" align="center">
  92. <schedule-item slot-scope="scope" :schedule-detail="scope.row.Sun_N"></schedule-item>
  93. </el-table-column>
  94. </el-table-column>
  95. <el-table-column prop="total" label="总数" width="60" align="center" fixed="right"></el-table-column>
  96. </el-table>
  97. <el-dialog title="排班" :visible.sync="dialogTableVisible" width="1000px;" :v-model="dialog" >
  98. <div>
  99. <div class="cell clearfix">
  100. <label class="title"><span class="name">当前排班</span> : </label>
  101. <div class="time ">
  102. <ul class="">
  103. <span class="current">日期 : {{currentData.schedule_date}} &nbsp;&nbsp; 班次 : {{currentData.type_name}} &nbsp;&nbsp; 病房 : {{currentData.zone_name}} &nbsp;&nbsp; 透析机 : {{currentData.bed_name}} </span>
  104. </ul>
  105. </div>
  106. </div>
  107. <div class="cell clearfix">
  108. <label class="title"><span class="name">患者搜索</span> : </label>
  109. <div class="time ">
  110. <ul class="">
  111. <el-input size="medium" v-model="searchKey" placeholder="请输入搜索的内容" style="width:260px"> </el-input>
  112. <el-button type="primary" icon="el-icon-search" @click="SubmitSearch">搜索</el-button>
  113. </ul>
  114. </div>
  115. </div>
  116. <div class="cell clearfix">
  117. <label class="title"><span class="name">排班</span> : </label>
  118. <div class="time ">
  119. <ul class="">
  120. <li v-for="item in schedulArr" @click="changeSearchSchedule(item.value)" :key="item.value" :class="patientQuery.schedule==item.value?'active':''" >{{item.label}}</li>
  121. </ul>
  122. </div>
  123. </div>
  124. <!-- <div class="cell clearfix">
  125. <label class="title"><span class="name">标签</span> : </label>
  126. <div class="time ">
  127. <ul class="">
  128. <li v-for="item in tagArr" :key="item.value" >{{item.label}}</li>
  129. </ul>
  130. </div>
  131. </div> -->
  132. <div class="cell clearfix">
  133. <label class="title"><span class="name">传染病</span> : </label>
  134. <div class="time ">
  135. <ul class="">
  136. <li v-for="item in diseasesArr" @click="changeSearchContagion(item.value)" :key="item.value" :class="patientQuery.contagion==item.value?'active':''" >{{item.label}}</li>
  137. </ul>
  138. </div>
  139. </div>
  140. </div>
  141. <el-table ref="singleTable" :data="patients" border height="250" highlight-current-row @current-change="handleCurrentChange" :header-cell-style="{ backgroundColor: 'rgb(236, 245, 255)'}" >
  142. <el-table-column type="index" label="序号" width="89" align="center"> </el-table-column>
  143. <el-table-column property="dialysis_no" label="透析号" min-width="110" align="center" ></el-table-column>
  144. <el-table-column property="name" label="姓名" min-width="110" align="center" ></el-table-column>
  145. <el-table-column property="schedules" label="双周已排" min-width="80" align="center" >
  146. <template slot-scope="scope">
  147. <span>{{scope.row.schedules.length}}次</span>
  148. </template>
  149. </el-table-column>
  150. <el-table-column property="solutions" label="治疗频率" min-width="200" align="center" >
  151. <template slot-scope="scope">
  152. <span v-for="solution in scope.row.solutions" :key="solution.id" >{{solution.name}}({{solution.period}}{{solution.times}}) </span>
  153. </template>
  154. </el-table-column>
  155. </el-table>
  156. <div slot="footer" class="dialog-footer">
  157. <el-button @click="closePatientPanel()">取 消</el-button>
  158. <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary" @click="setSchedule">保 存</el-button>
  159. </div>
  160. </el-dialog>
  161. <el-dialog
  162. title="调整排班"
  163. :visible.sync="tzDialogVisible"
  164. width="365px"
  165. center>
  166. <div style="width:100%;margin:0 auto">
  167. <el-radio-group v-model="tiaoZhengType" :class="tiaozhengclass" >
  168. <el-radio :label="1">取消排班</el-radio>
  169. <el-radio :label="2">调整机号</el-radio>
  170. <el-radio :label="3">调整模式</el-radio>
  171. </el-radio-group>
  172. </div>
  173. <span slot="footer" class="dialog-footer">
  174. <el-button @click="tzDialogVisible = false;tiaoZhengType=1">取 消</el-button>
  175. <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary" @click="submitTiaoX">保 存</el-button>
  176. </span>
  177. </el-dialog>
  178. <el-dialog
  179. title="调整模式"
  180. :visible.sync="msDialogVisible"
  181. width="350px"
  182. center>
  183. <div style="width:100%;margin:0 auto">
  184. <el-form :model="changeSchedule" ref="changeSchedule" :rules="changeRules" >
  185. <el-form-item label="" prop="mode_id">
  186. <el-select v-model="changeSchedule.mode_id" placeholder="请选择" style="width:100%">
  187. <el-option
  188. :disabled="item.id == currentData.mode_id"
  189. v-for="item in modeOptions"
  190. :key="item.id"
  191. :label="item.name"
  192. :value="item.id">
  193. </el-option>
  194. </el-select>
  195. </el-form-item>
  196. </el-form>
  197. </div>
  198. <span slot="footer" class="dialog-footer">
  199. <el-button @click="msDialogVisible = false">取 消</el-button>
  200. <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary" @click="submitTiaoZMS('changeSchedule')">保 存</el-button>
  201. </span>
  202. </el-dialog>
  203. <el-dialog
  204. title="调整机号"
  205. :visible.sync="jhDialogVisible"
  206. width="400px"
  207. center>
  208. <div style="width:100%;margin:0 auto">
  209. <el-form :model="changeSchedule" ref="changeSchedule" :rules="changeRules" label-width="90px" label-position="left">
  210. <el-form-item label="排班日期">
  211. <el-input v-model="currentData.schedule_date" disabled></el-input>
  212. </el-form-item>
  213. <el-form-item label="班次" prop="schedule_type">
  214. <el-select v-model="changeSchedule.schedule_type" placeholder="请选择" style="width:100%">
  215. <el-option
  216. v-for="item in scheduleType"
  217. :key="item.id"
  218. :label="item.name"
  219. :value="item.id">
  220. </el-option>
  221. </el-select>
  222. </el-form-item>
  223. <el-form-item label="病房" prop="partition_id">
  224. <el-select v-model="changeSchedule.partition_id" placeholder="请选择" style="width:100%" @change="changePartition">
  225. <el-option
  226. v-for="item in partitions"
  227. :key="item.id"
  228. :label="item.name"
  229. :value="item.id">
  230. </el-option>
  231. </el-select>
  232. </el-form-item>
  233. <el-form-item label="透析机" prop="bed_id">
  234. <el-select v-model="changeSchedule.bed_id" placeholder="请选择" style="width:100%">
  235. <el-option
  236. v-for="item in jihaos"
  237. :key="item.id"
  238. :label="item.number"
  239. :value="item.id">
  240. </el-option>
  241. </el-select>
  242. </el-form-item>
  243. </el-form>
  244. </div>
  245. <span slot="footer" class="dialog-footer">
  246. <el-button @click="jhDialogVisible = false">取 消</el-button>
  247. <el-button :disabled="$store.getters.xt_user.subscibe.state==3?true:false" type="primary" @click="submitTiaoZJH('changeSchedule')">保 存</el-button>
  248. </span>
  249. </el-dialog>
  250. </div>
  251. </template>
  252. <script>
  253. import {getWeekPanels,getSchedules,getSchedulePatients,CreateSchedule,CancelSchedule,ChangeSchedule} from '@/api/schedule';
  254. import ScheduleItem from './ScheduleItem';
  255. let rowNumber = 0;
  256. export default {
  257. name:'tableData',
  258. props: {
  259. weekTime: {
  260. type: String,
  261. default: "thisWeek"
  262. },
  263. scheduleZoneRowProp:{
  264. type:Array,
  265. dafault:[],
  266. },
  267. scheduleZoneProp:{
  268. type:Array,
  269. dafault:[],
  270. },
  271. partitionsProp:{
  272. type:Object,
  273. dafault:{},
  274. },
  275. },
  276. data() {
  277. return {
  278. // tableContainHeight:400,
  279. // tableHeight:'window.innerHeight - 0',
  280. rowClass:'table-row-new-class schedule-table-row',
  281. searchKey:'',
  282. tiaoZhengType:1,
  283. modeOptions:null,
  284. dialog:{
  285. tag:''
  286. },
  287. patients:[],
  288. toDay:'',
  289. schedulArr: [
  290. { value: 0, label: "不限" },
  291. { value: 2, label: "未排班" },
  292. { value: 1, label: "已排班" },
  293. ],
  294. tagArr:[
  295. { value: 1, label: "不限" },
  296. { value: 2, label: "透析记录" },
  297. { value: 3, label: "传染病" }
  298. ],
  299. diseasesArr:[
  300. { value: 0, label: "不限" },
  301. ],
  302. scheduleType:[
  303. {id:1, name:'上午'},{id:2, name:'下午'},{id:3, name:'晚上'},
  304. ],
  305. dialogTableVisible: false,
  306. tzDialogVisible:false,
  307. msDialogVisible:false,
  308. jhDialogVisible:false,
  309. scheduleZone:this.scheduleZoneProp,
  310. scheduleZoneRow:-1,
  311. partitions:[],
  312. jihaos:[],
  313. weekTitle:["","","","","","",""],
  314. weekDays:["","","","","","",""],
  315. currentData:{
  316. id:0,
  317. schedule_date:"",
  318. schedule_type:0,
  319. bed_id:0,
  320. partition_id:0,
  321. patient_id:0,
  322. schedule_week:0,
  323. mode_id:0,
  324. type_name:"",
  325. bed_name:"",
  326. partition_type:0,
  327. contagions:[],
  328. patient:"",
  329. },
  330. changeSchedule:{
  331. mode_id:'',
  332. schedule_type:"",
  333. partition_id:'',
  334. bed_id:'',
  335. schedule_week:'',
  336. partition_type:'',
  337. },
  338. patientQuery:{
  339. keywords:"",
  340. schedule:0,
  341. contagion:0,
  342. },
  343. tiaozhengclass:"tiaozhengclass",
  344. changeRules:{
  345. mode_id:[{required:true, message:"请选择模式", trigger:'blur'}],
  346. schedule_type:[{required:true, message:"请选择班次", trigger:'blur'}],
  347. partition_id:[{required:true, message:"请选择病房", trigger:'blur'}],
  348. bed_id:[{required:true, message:"请选择透析机", trigger:"blur"}],
  349. },
  350. weekday: 0,
  351. tableHeight: document.documentElement.clientHeight,
  352. }
  353. },
  354. watch:{
  355. weekTime:function(){
  356. var theType = this.weekType(this.weekTime);
  357. this.getSchedules(theType);
  358. },
  359. "scheduleZoneRow":function(){
  360. var theType = this.weekType(this.weekTime);
  361. this.getSchedules(theType);
  362. },
  363. tableHeight (val) {
  364. if(!this.timer) {
  365. this.tableHeight = val
  366. this.timer = true
  367. let that = this
  368. setTimeout(function (){
  369. that.timer = false
  370. },400)
  371. }
  372. }
  373. },
  374. methods: {
  375. cellClass({ row, column, rowIndex, columnIndex }) {
  376. if (columnIndex == 0 || columnIndex == 1 || columnIndex == 23) {
  377. return ""
  378. } else {
  379. if(this.weekTime == 'lastWeek') {
  380. return "schedule-table-cell-disable"
  381. }else if (this.weekTime == 'thisWeek'){
  382. var weekday = Math.floor(((columnIndex - 2) / 3) + 1)
  383. if (weekday < this.weekday) {
  384. return "schedule-table-cell-disable"
  385. }
  386. }
  387. }
  388. return ""
  389. },
  390. SubmitSearch(){
  391. this.patientQuery.keywords = this.searchKey;
  392. this.getSchedulePatients();
  393. },
  394. changeSearchContagion(id){
  395. this.patientQuery.contagion = id;
  396. this.getSchedulePatients();
  397. },
  398. changeSearchSchedule(id){
  399. this.patientQuery.schedule = id;
  400. this.getSchedulePatients();
  401. },
  402. getSummaries(param) {
  403. const { columns, data } = param;
  404. const sums = [];
  405. columns.forEach((column, index) => {
  406. if (index === 0 || index === 25) {
  407. sums[index] = '总数';
  408. return;
  409. }
  410. if (index === 1 || index === 24) {
  411. sums[index] = data.length;
  412. return;
  413. }
  414. const values = data.map(item => item[column.property]);
  415. if (index === 23) {
  416. sums[index] = values.reduce((prev, curr) => {
  417. const value = Number(curr);
  418. if (!isNaN(value)) {
  419. return prev + curr;
  420. } else {
  421. return prev;
  422. }
  423. }, 0);
  424. sums[index];
  425. return;
  426. }
  427. sums[index] = values.reduce((prev, curr) => {
  428. if (typeof(curr['mode_id']) == 'undefined') {
  429. return prev;
  430. }
  431. const value = Number(curr['mode_id']);
  432. if (!isNaN(value) && value>0) {
  433. return prev + 1;
  434. } else {
  435. return prev;
  436. }
  437. }, 0);
  438. sums[index];
  439. });
  440. return sums;
  441. },
  442. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  443. var that = this;
  444. var rowNum = 0;
  445. rowNumber = 0;
  446. var rutrnData = {};
  447. if (columnIndex === 0 || columnIndex == 25) {
  448. var rowLen = this.scheduleZoneRow.length;
  449. if (rowLen > 0) {
  450. for (let index = 0; index < rowLen; index++) {
  451. rowNum = this.scheduleZoneRow[index];
  452. rowNumber += rowNum;
  453. var f = rowNumber-rowNum;
  454. if (f == rowIndex ) {
  455. rutrnData = {
  456. rowspan: rowNum,
  457. colspan: 1
  458. };
  459. break;
  460. }else if (rowIndex < rowNumber) {
  461. rutrnData = {
  462. rowspan: 0,
  463. colspan: 0
  464. };
  465. break;
  466. }
  467. }
  468. return rutrnData;
  469. }
  470. }
  471. },
  472. handleCurrentChange(row){
  473. if (typeof(row) == "undefined" || row==null) {
  474. this.currentData.patient_id = 0;
  475. this.currentData.contagions = [];
  476. }else {
  477. this.currentData.patient_id = row.id;
  478. this.currentData.contagions = row.contagions;
  479. }
  480. },
  481. closePatientPanel(row){
  482. this.dialogTableVisible = false;
  483. this.$refs.singleTable.setCurrentRow(row);
  484. this.currentData.patient_id = 0;
  485. },
  486. getSchedules(weekType){
  487. getSchedules(weekType).then(response=>{
  488. if(response.data.state==1){
  489. this.weekTitle = response.data.data.weekTitle;
  490. this.weekDays = response.data.data.days;
  491. this.toDay = response.data.data.today;
  492. var theSchedules = response.data.data.schdules;
  493. var that = this;
  494. this.scheduleZone.forEach(function(zone, index){
  495. that.scheduleZone[index].Mon_M = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  496. that.scheduleZone[index].Mon_A = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  497. that.scheduleZone[index].Mon_N = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  498. that.scheduleZone[index].Tue_M = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  499. that.scheduleZone[index].Tue_A = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  500. that.scheduleZone[index].Tue_N = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  501. that.scheduleZone[index].Wed_M = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  502. that.scheduleZone[index].Wed_A = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  503. that.scheduleZone[index].Wed_N = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  504. that.scheduleZone[index].Thurs_M = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  505. that.scheduleZone[index].Thurs_A = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  506. that.scheduleZone[index].Thurs_N = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  507. that.scheduleZone[index].Fri_M = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  508. that.scheduleZone[index].Fri_A = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  509. that.scheduleZone[index].Fri_N = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  510. that.scheduleZone[index].Sat_M = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  511. that.scheduleZone[index].Sat_A = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  512. that.scheduleZone[index].Sat_N = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  513. that.scheduleZone[index].Sun_A = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  514. that.scheduleZone[index].Sun_N = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  515. that.scheduleZone[index].Sun_M = {mode_id:0, mode_name:"", patient_id:0, patient:""};
  516. that.scheduleZone[index].total=0;
  517. if (response.data.data.schdules.length>0) {
  518. theSchedules.forEach(function(schedule, sindex){
  519. if( zone.jihao_id == schedule.bed_id) {
  520. // if(zone.zone_id == schedule.partition_id && zone.jihao_id == schedule.bed_id) {
  521. var weekPath = that.weekPath(schedule.schedule_week, schedule.schedule_type);
  522. if (weekPath.length==2) {
  523. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  524. that.scheduleZone[index][weekPathKey] = {
  525. schedule_id:schedule.id,
  526. mode_id:schedule.mode_id,
  527. patient_id: schedule.patient_id,
  528. patient: schedule.patient,
  529. patient_contagions: schedule.patient_contagions,
  530. mode_name: typeof(that.modeOptions[schedule.mode_id]) == 'undefined' ? '' : that.modeOptions[schedule.mode_id].name,
  531. };
  532. that.scheduleZone[index].total +=1;
  533. }
  534. }
  535. });
  536. }
  537. });
  538. }else {
  539. this.$message.error("网络错误");
  540. return false;
  541. }
  542. });
  543. },
  544. getSchedulePatients(){
  545. getSchedulePatients(this.patientQuery).then(response=>{
  546. if (response.data.state==1) {
  547. this.patients = response.data.data.patients;
  548. }
  549. });
  550. },
  551. CancelSchedule(id){
  552. this.$confirm('确定要取消当前排班?', '提示', {
  553. confirmButtonText: '确定',
  554. cancelButtonText: '取消',
  555. type: 'warning'
  556. }).then(() => {
  557. CancelSchedule(id).then(response=>{
  558. if (response.data.state==0) {
  559. this.$message.error(response.data.msg);
  560. return false;
  561. }else {
  562. this.$message({
  563. type: 'success',
  564. message: '排班已取消!'
  565. });
  566. var that = this;
  567. var schedule = response.data.data.schedule;
  568. this.scheduleZone.forEach(function(zone, index){
  569. if(zone.zone_id == schedule.partition_id && zone.jihao_id == schedule.bed_id) {
  570. var weekPath = that.weekPath(schedule.schedule_week, schedule.schedule_type);
  571. if (weekPath.length==2) {
  572. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  573. that.scheduleZone[index][weekPathKey] = {
  574. schedule_id:0,
  575. mode_id:0,
  576. patient_id: 0,
  577. patient: "",
  578. mode_name: '',
  579. };
  580. that.scheduleZone[index].total -=1;
  581. }
  582. }
  583. });
  584. this.tzDialogVisible = false;
  585. }
  586. });
  587. }).catch(() => {});
  588. },
  589. changeScheduleActon(formName){
  590. ChangeSchedule(this.currentData.id, this.changeSchedule).then(response=>{
  591. if (response.data.state==0) {
  592. this.$message.error(response.data.msg);
  593. return false;
  594. }else {
  595. this.$message({
  596. type: 'success',
  597. message: '修改成功!'
  598. });
  599. var that = this;
  600. var schedule = response.data.data.schedule;
  601. this.scheduleZone.forEach(function(zone, index){
  602. if(zone.zone_id == schedule.partition_id && zone.jihao_id == schedule.bed_id) {
  603. var weekPath = that.weekPath(schedule.schedule_week, schedule.schedule_type);
  604. if (weekPath.length==2) {
  605. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  606. that.scheduleZone[index][weekPathKey] = {
  607. schedule_id:schedule.id,
  608. mode_id:schedule.mode_id,
  609. patient_id: schedule.patient_id,
  610. patient: that.currentData.patient,
  611. patient_contagions: that.currentData.contagions,
  612. mode_name: typeof(that.modeOptions[schedule.mode_id]) == 'undefined' ? '' : that.modeOptions[schedule.mode_id].name,
  613. };
  614. that.scheduleZone[index].total +=1;
  615. }
  616. }
  617. if(zone.zone_id == that.currentData.partition_id && zone.jihao_id == that.currentData.bed_id) {
  618. var weekPath = that.weekPath(that.currentData.schedule_week, that.currentData.schedule_type);
  619. if (weekPath.length==2) {
  620. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  621. that.scheduleZone[index][weekPathKey] = {schedule_id:0,mode_id:0,patient_id: 0,patient: "",mode_name: "",patient_contagions:[]};
  622. that.scheduleZone[index].total -=1;
  623. }
  624. }
  625. });
  626. this.$refs[formName].resetFields();
  627. this.jhDialogVisible = false;
  628. }
  629. });
  630. },
  631. CreateSchedule(id, data){
  632. CreateSchedule(id, data).then(response=>{
  633. if(response.data.state==0) {
  634. this.$message.error(response.data.msg);
  635. return false;
  636. }else {
  637. this.$message({
  638. type: 'success',
  639. message: '排班成功!'
  640. });
  641. var that = this;
  642. var schedule = response.data.data.schedule;
  643. this.scheduleZone.forEach(function(zone, index){
  644. if(zone.zone_id == schedule.partition_id && zone.jihao_id == schedule.bed_id) {
  645. var weekPath = that.weekPath(schedule.schedule_week, schedule.schedule_type);
  646. if (weekPath.length==2) {
  647. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  648. that.scheduleZone[index][weekPathKey] = {
  649. schedule_id:schedule.id,
  650. mode_id:schedule.mode_id,
  651. patient_id: schedule.patient_id,
  652. patient: schedule.patient,
  653. patient_contagions: that.currentData.contagions,
  654. mode_name: typeof(that.modeOptions[schedule.mode_id]) == 'undefined' ? '' : that.modeOptions[schedule.mode_id].name,
  655. };
  656. that.scheduleZone[index].total +=1;
  657. }
  658. }
  659. });
  660. this.closePatientPanel();
  661. }
  662. });
  663. },
  664. clickThis(row, column, cell, event){
  665. var week = this.weekDay(column.property);
  666. if (week[0]==-1 || week[1]==-1) {
  667. return false;
  668. }
  669. if (this.toDay>this.weekDays[week[0]-1]) {
  670. return false;
  671. }
  672. this.currentData.schedule_date = this.weekDays[week[0]-1];
  673. this.currentData.schedule_type = week[1];
  674. this.currentData.bed_id = row.jihao_id;
  675. this.currentData.partition_id = row.zone_id;
  676. this.currentData.schedule_week = week[0];
  677. this.currentData.type_name = this.dayType(week[1]);
  678. this.currentData.zone_name = row.area;
  679. this.currentData.bed_name = row.cut;
  680. this.currentData.partition_type = row.zone_type;
  681. if (row[column.property].schedule_id>0) {
  682. this.currentData.mode_id = row[column.property].mode_id;
  683. this.currentData.id = row[column.property].schedule_id;
  684. this.currentData.patient_id = row[column.property].patient_id;
  685. this.currentData.patient = row[column.property].patient;
  686. this.currentData.contagions = row[column.property].patient_contagions;
  687. this.tiaoZhengType=1;
  688. this.tzDialogVisible = true;
  689. }else {
  690. this.currentData.mode_id = 1;
  691. this.currentData.id = 0;
  692. this.currentData.patient_id=0;
  693. this.currentData.patient = '';
  694. this.currentData.contagions = [];
  695. this.getSchedulePatients();
  696. this.dialogTableVisible = true;
  697. }
  698. },
  699. submitTiaoZJH(formName){
  700. this.$refs[formName].validate((valid)=>{
  701. if (valid) {
  702. var weekPath = this.weekPath(this.changeSchedule.schedule_week, this.changeSchedule.schedule_type);
  703. if (weekPath.length!=2) {
  704. this.$message.error("数据异常");
  705. return false;
  706. }
  707. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  708. for(var index in this.scheduleZone) {
  709. if(this.scheduleZone[index].jihao_id == this.changeSchedule.bed_id ) {
  710. if (this.scheduleZone[index][weekPathKey].mode_id>0) {
  711. this.$message.error("选中的区域已经存在排班,不能再排班!");
  712. return false;
  713. }
  714. this.changeSchedule.partition_type = this.scheduleZone[index].zone_type
  715. break;
  716. }
  717. }
  718. //可能
  719. //患者有传染病,与选择的机器类型(传染病)不匹配
  720. //患者没有传染病,但机器是某个传染病的专用透析器
  721. //机器的透析模式与患者不匹配
  722. if (this.currentData.contagions.length>0){
  723. var cflag = false;
  724. for(var index in this.currentData.contagions) {
  725. if(this.currentData.contagions[index].disease_id==this.changeSchedule.partition_type) {
  726. cflag = true;
  727. }
  728. }
  729. if (!cflag) {
  730. this.$confirm('此患者有传染病,与此透析机不匹配,确定在此排班吗?', '提示', {confirmButtonText: '是',cancelButtonText: '否',type: 'warning'})
  731. .then(() => {
  732. this.changeSchedule.change_action = "change_device";
  733. this.changeScheduleActon(formName);
  734. }).catch(() => {
  735. });
  736. }else {
  737. this.changeSchedule.change_action = "change_device";
  738. this.changeScheduleActon(formName);
  739. }
  740. }else if (this.changeSchedule.partition_type > 1) {
  741. this.$confirm('此患者没有传染病,与此透析机不匹配,确定在此排班吗?', '提示', {confirmButtonText: '是',cancelButtonText: '否',type: 'warning'})
  742. .then(() => {
  743. this.changeSchedule.change_action = "change_device";
  744. this.changeScheduleActon(formName);
  745. }).catch(() => {
  746. });
  747. }else {
  748. this.changeSchedule.change_action = "change_device";
  749. this.changeScheduleActon(formName);
  750. }
  751. }
  752. });
  753. },
  754. submitTiaoZMS(formName){
  755. this.$refs[formName].validate((valid)=>{
  756. if (valid) {
  757. this.changeSchedule.change_action = "change_mode";
  758. ChangeSchedule(this.currentData.id, this.changeSchedule).then(response=>{
  759. if (response.data.state==0) {
  760. this.$message.error(response.data.msg);
  761. return false;
  762. }else {
  763. this.$message({
  764. type: 'success',
  765. message: '修改成功!'
  766. });
  767. var that = this;
  768. var schedule = response.data.data.schedule;
  769. this.scheduleZone.forEach(function(zone, index){
  770. if(zone.zone_id == schedule.partition_id && zone.jihao_id == schedule.bed_id) {
  771. var weekPath = that.weekPath(schedule.schedule_week, schedule.schedule_type);
  772. if (weekPath.length==2) {
  773. var weekPathKey = weekPath[0] + "_" + weekPath[1];
  774. that.scheduleZone[index][weekPathKey].mode_id = schedule.mode_id;
  775. that.scheduleZone[index][weekPathKey].mode_name = typeof(that.modeOptions[schedule.mode_id]) == 'undefined' ? '' : that.modeOptions[schedule.mode_id].name;
  776. }
  777. }
  778. });
  779. this.$refs[formName].resetFields();
  780. this.msDialogVisible = false;
  781. }
  782. });
  783. }
  784. });
  785. },
  786. changePartition(value){
  787. if (typeof(this.partitions[value].jihaos) != 'undefined') {
  788. this.jihaos = this.partitions[value].jihaos;
  789. }else {
  790. this.jihaos = [];
  791. }
  792. this.changeSchedule.bed_id = "";
  793. },
  794. submitTiaoX(){
  795. if (this.tiaoZhengType==1) {
  796. this.$confirm('确定要取消当前排班?', '提示', {
  797. confirmButtonText: '确定',
  798. cancelButtonText: '取消',
  799. type: 'warning'
  800. }).then(() => {
  801. this.CancelSchedule(this.currentData.id);
  802. }).catch(() => {});
  803. }
  804. switch (this.tiaoZhengType) {
  805. case 1:
  806. this.CancelSchedule(this.currentData.id);
  807. break;
  808. case 2:
  809. this.changeSchedule={
  810. mode_id:this.currentData.mode_id,
  811. schedule_type:this.currentData.schedule_type,
  812. partition_id:this.currentData.partition_id,
  813. bed_id:this.currentData.bed_id,
  814. schedule_week:this.currentData.schedule_week,
  815. partition_type:'',
  816. };
  817. if (typeof(this.partitions[this.currentData.partition_id].jihaos) != 'undefined') {
  818. this.jihaos = this.partitions[this.currentData.partition_id].jihaos;
  819. }else {
  820. this.jihaos = [];
  821. }
  822. this.tzDialogVisible = false;
  823. this.jhDialogVisible = true;
  824. break;
  825. case 3:
  826. this.changeSchedule={
  827. mode_id:'',
  828. schedule_type:"",
  829. partition_id:'',
  830. bed_id:'',
  831. schedule_week:'',
  832. partition_type:'',
  833. };
  834. this.tzDialogVisible = false;
  835. this.msDialogVisible = true;
  836. break;
  837. default:
  838. break;
  839. }
  840. },
  841. setSchedule(){
  842. var that = this;
  843. var submitFlag = true;
  844. if(this.currentData.patient_id <= 0) {
  845. this.$message.error("请先选择患者");
  846. return false;
  847. }
  848. 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)) {
  849. this.$message.error("请先选择排班时间或机号");
  850. return false;
  851. }
  852. //可能
  853. //患者有传染病,与选择的机器类型(传染病)不匹配
  854. //患者没有传染病,但机器是某个传染病的专用透析器
  855. //机器的透析模式与患者不匹配
  856. if (this.currentData.contagions.length>0){
  857. var cflag = false;
  858. this.currentData.contagions.forEach(function(contagion){
  859. if(contagion.disease_id==that.currentData.partition_type) {
  860. cflag = true;
  861. }
  862. });
  863. if (!cflag) {
  864. this.$confirm('此患者有传染病,与此透析机不匹配,确定在此排班吗?', '提示', {confirmButtonText: '是',cancelButtonText: '否',type: 'warning'})
  865. .then(() => {
  866. this.CreateSchedule(this.currentData.patient_id, this.currentData);
  867. }).catch(() => {
  868. });
  869. }else {
  870. this.CreateSchedule(this.currentData.patient_id, this.currentData);
  871. }
  872. }else if (that.currentData.partition_type > 1) {
  873. this.$confirm('此患者没有传染病,与此透析机不匹配,确定在此排班吗?', '提示', {confirmButtonText: '是',cancelButtonText: '否',type: 'warning'})
  874. .then(() => {
  875. this.CreateSchedule(this.currentData.patient_id, this.currentData);
  876. }).catch(() => {
  877. });
  878. }else {
  879. this.CreateSchedule(this.currentData.patient_id, this.currentData);
  880. }
  881. },
  882. weekType(weekTime) {
  883. var theType = 2;
  884. switch (weekTime) {
  885. case 'lastWeek':
  886. theType = 1;
  887. break;
  888. case 'thisWeek':
  889. theType = 2;
  890. break;
  891. case 'nextWeek':
  892. theType = 3;
  893. break;
  894. case 'nextTwoWeek':
  895. theType = 4;
  896. break;
  897. default:
  898. theType = 2;
  899. break;
  900. }
  901. return theType;
  902. },
  903. dayType(theType) {
  904. var jType = "";
  905. switch (theType) {
  906. case 1:
  907. jType = "上午";
  908. break;
  909. case 2:
  910. jType = "下午";
  911. break;
  912. case 3:
  913. jType = "晚上";
  914. break;
  915. default:
  916. break;
  917. }
  918. return jType;
  919. },
  920. weekPath(week, schedule_type){
  921. var weekArr = {1:'Mon',2:'Tue',3:'Wed',4:'Thurs',5:'Fri',6:'Sat',7:"Sun"};
  922. var typeArr = {1:'M', 2:'A', 3:'N'};
  923. if (typeof(weekArr[week]) == "undefined" || typeof(typeArr[schedule_type]) == 'undefined') {
  924. return [];
  925. }
  926. return [weekArr[week], typeArr[schedule_type]];
  927. },
  928. weekDay(prop){
  929. var week = prop.split("_");
  930. if (week.length != 2) {
  931. return [-1,-1];
  932. }
  933. var w = -1;
  934. var n = -1;
  935. switch (week[0]) {
  936. case "Mon":
  937. w = 1;
  938. break;
  939. case "Tue":
  940. w = 2;
  941. break;
  942. case "Wed":
  943. w = 3;
  944. break;
  945. case "Thurs":
  946. w = 4;
  947. break;
  948. case "Fri":
  949. w = 5;
  950. break;
  951. case "Sat":
  952. w = 6;
  953. break;
  954. case "Sun":
  955. w = 7;
  956. break;
  957. default:
  958. w = -1;
  959. break;
  960. }
  961. switch (week[1]) {
  962. case "M":
  963. n = 1
  964. break;
  965. case "A":
  966. n = 2
  967. break;
  968. case "N":
  969. n = 3
  970. break;
  971. default:
  972. n = -1;
  973. break;
  974. }
  975. if (w==-1 || n ==-1) {
  976. return [-1, -1];
  977. }
  978. return [w, n];
  979. }
  980. },
  981. components:{
  982. ScheduleItem,
  983. },
  984. mounted() {
  985. console.log(this.tableContainHeight );
  986. this.tableContainHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 160;
  987. console.log(this.tableContainHeight );
  988. // var theType = this.weekType(this.weekTime);
  989. // this.getSchedules(theType);
  990. const that = this
  991. window.onresize = () => {
  992. return (() => {
  993. window.fullHeight = document.documentElement.clientHeight
  994. if (window.fullHeight < 200) {
  995. that.tableHeight = 200
  996. } else {
  997. that.tableHeight = window.fullHeight - 200
  998. }
  999. })()
  1000. }
  1001. },
  1002. // mounted:function(){
  1003. // this.tableContainHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 160
  1004. // },
  1005. created(){
  1006. rowNumber = 0;
  1007. this.modeOptions = this.$store.getters.treatment_mode;
  1008. this.partitions = this.partitionsProp;
  1009. var contagions = this.$store.getters.contagions;
  1010. if (contagions.length>0) {
  1011. var that = this;
  1012. contagions.forEach(function(citem){
  1013. if (citem.type==2) {
  1014. that.diseasesArr.push({value:citem.id, label:citem.name});
  1015. }
  1016. });
  1017. }
  1018. this.scheduleZoneRow = this.scheduleZoneRowProp;
  1019. this.weekday = (new Date()).getDay()
  1020. if (this.weekday == 0) {
  1021. this.weekday = 7
  1022. }
  1023. }
  1024. }
  1025. </script>
  1026. <style rel="stylesheet/css" lang="scss" scoped>
  1027. .tiaozhengclass {
  1028. display: block;
  1029. margin: 0 auto;
  1030. }
  1031. .el-table tr {
  1032. background-color: #111 !important;
  1033. }
  1034. .schedule-table-row {
  1035. background: #fff !important;
  1036. }
  1037. .schedule-table-row:hover{
  1038. background: #fff !important;
  1039. }
  1040. .schedule-table-row td:hover{
  1041. background: rgb(88, 162, 236) !important;
  1042. }
  1043. .schedule-table-row td .cell{
  1044. font-size: 12px;
  1045. white-space:nowrap !important;
  1046. }
  1047. .schedule-table-cell-disable {
  1048. background-color: rgb(245, 245, 245);
  1049. }
  1050. #table_data{
  1051. min-height:calc(100vh - 350px);
  1052. }
  1053. #table_data ::-webkit-scrollbar {
  1054. height: 15px;
  1055. }
  1056. </style>