血透系统PC前端

tableWeeks.vue 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <div>
  3. <div class="cell clearfix" style="float: right" >
  4. <el-button style="float: right" size="small" icon="el-icon-printer" @click="printAction()" type="primary">打印
  5. </el-button>
  6. </div>
  7. <div class="cell clearfix">
  8. <label class="title">
  9. <span class="name">时间</span> :
  10. </label>
  11. <div class="time">
  12. <ul class>
  13. <li
  14. :class="item.id==week_type?'active':''"
  15. @click="selectWeekType(item.id)"
  16. v-for="item in weekArr"
  17. :key="item.id"
  18. >{{item.name}}
  19. </li>
  20. </ul>
  21. </div>
  22. </div>
  23. <el-table
  24. :data="scheduleData"
  25. border
  26. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  27. style="width: 100%">
  28. <el-table-column label="姓名" min-width="120" align="center">
  29. <template slot-scope="scope">
  30. {{ scope.row.patient}}
  31. </template>
  32. </el-table-column>
  33. <el-table-column label="分区" min-width="120" align="center">
  34. <template slot-scope="scope">
  35. {{scope.row.zone.name}}
  36. </template>
  37. </el-table-column>
  38. <el-table-column label="班次" min-width="120" align="center">
  39. <template slot-scope="scope">
  40. {{getSchedulesType(scope.row.schedule_type)}}
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="机号" min-width="120" align="center">
  44. <template slot-scope="scope">
  45. {{scope.row.number.number}}
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="透析模式" min-width="120" align="center">
  49. <template slot-scope="scope">
  50. {{modeOptions[scope.row.mode_id].name}}
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="透析器" min-width="120" align="center">
  54. <template slot-scope="scope">
  55. {{scope.row.prescription.dialyzer_perfusion_apparatus}}
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="抗凝剂" min-width="120" align="center">
  59. <template slot-scope="scope">
  60. {{ scope.row.prescription.anticoagulant ? anticoagulants_confit[scope.row.prescription.anticoagulant].name :
  61. ''}}
  62. </template>
  63. </el-table-column>
  64. <el-table-column label="低分子肝素" min-width="120" align="center">
  65. <template slot-scope="scope">
  66. {{scope.row.prescription.anticoagulant_zongliang?scope.row.prescription.anticoagulant_zongliang:''}}
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="长期医嘱" min-width="120" align="center">
  70. <template slot-scope="scope">
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. </div>
  75. </template>
  76. <script>
  77. import { getSchedules, getScheduleWeekDay } from '@/api/schedule'
  78. import WeekItem from './WeekItem'
  79. export default {
  80. name: 'tableWeeks',
  81. props: {
  82. weekTime: {
  83. type: String,
  84. default: 'thisWeek'
  85. }
  86. },
  87. data() {
  88. return {
  89. weekArr: [
  90. { id: 1, name: '周一' },
  91. { id: 2, name: '周二' },
  92. { id: 3, name: '周三' },
  93. { id: 4, name: '周四' },
  94. { id: 5, name: '周五' },
  95. { id: 6, name: '周六' },
  96. { id: 7, name: '周日' }
  97. ],
  98. anticoagulants_confit: null,
  99. week_type: '1',
  100. weekTitle: ['', '', '', '', '', '', ''],
  101. weekData: {
  102. Monday: [],
  103. Tuesday: [],
  104. Wednesday: [],
  105. Thursday: [],
  106. Friday: [],
  107. Saturday: [],
  108. Sunday: []
  109. },
  110. scheduleData: [],
  111. modeOptions: null
  112. }
  113. },
  114. watch: {
  115. weekTime: function() {
  116. var theType = this.weekType(this.weekTime)
  117. this.getSchedules(theType)
  118. }
  119. },
  120. methods: {
  121. printAction(){
  122. console.log("111111")
  123. this.$router.push({ path: '/schedule/remind/print?week_type=' + this.week_type })
  124. },
  125. getScheduleWeekDay(weekType) {
  126. getScheduleWeekDay(weekType).then(response => {
  127. this.scheduleData = []
  128. if (response.data.state == 1) {
  129. this.scheduleData = response.data.data.schdules
  130. console.log(this.scheduleData)
  131. } else {
  132. this.$message.error('网络错误')
  133. return false
  134. }
  135. })
  136. },
  137. // getSchedules(weekType) {
  138. // getSchedules(weekType).then(response => {
  139. // this.scheduleData = []
  140. // if (response.data.state == 1) {
  141. // this.weekTitle = response.data.data.weekTitle
  142. // var theSchedules = response.data.data.schdules
  143. // var that = this
  144. // theSchedules.forEach(function(schedule) {
  145. // schedule['mode_name'] = typeof (that.modeOptions[schedule.mode_id]) == 'undefined' ? '' : that.modeOptions[schedule.mode_id].name
  146. // var weekPath = that.weekPath(schedule.schedule_week)
  147. // if (weekPath.length > 0) {
  148. // that.weekData[weekPath].push(schedule)
  149. // }
  150. // })
  151. // var rowNum = 0
  152. // console.log(that.weekData)
  153. // for (var index in that.weekData) {
  154. // var thisLen = that.weekData[index].length
  155. // rowNum = rowNum >= thisLen ? rowNum : thisLen
  156. // }
  157. // console.log(rowNum)
  158. // for (let index = 0; index < rowNum; index++) {
  159. // var dataItem = {}
  160. // for (var weekIndex in that.weekData) {
  161. // var weekItem = that.weekData[weekIndex].shift()
  162. // console.log('weekItem', weekItem)
  163. // if (typeof (weekItem) != 'undefined') {
  164. // dataItem[weekIndex] = weekItem
  165. // }
  166. // }
  167. // that.scheduleData.push(dataItem)
  168. // }
  169. //
  170. // console.log(that.scheduleData)
  171. //
  172. // } else {
  173. // this.$message.error('网络错误')
  174. // return false
  175. // }
  176. // })
  177. // },
  178. weekType(weekTime) {
  179. var theType = 2
  180. switch (weekTime) {
  181. case 'lastWeek':
  182. theType = 1
  183. break
  184. case 'thisWeek':
  185. theType = 2
  186. break
  187. case 'nextWeek':
  188. theType = 3
  189. break
  190. case 'nextTwoWeek':
  191. theType = 4
  192. break
  193. default:
  194. theType = 2
  195. break
  196. }
  197. return theType
  198. },
  199. weekPath(week) {
  200. var weekArr = {
  201. 1: 'Monday',
  202. 2: 'Tuesday',
  203. 3: 'Wednesday',
  204. 4: 'Thursday',
  205. 5: 'Friday',
  206. 6: 'Saturday',
  207. 7: 'Sunday'
  208. }
  209. if (typeof (weekArr[week]) == 'undefined') {
  210. return ''
  211. }
  212. return weekArr[week]
  213. }, selectWeekType(type) {
  214. this.week_type = type
  215. let params = {
  216. week_type: this.week_type
  217. }
  218. this.getScheduleWeekDay(params)
  219. }, getSchedulesType: function(type) {
  220. let type_name = ''
  221. switch (type) {
  222. case 1:
  223. type_name = '上午'
  224. break
  225. case 2:
  226. type_name = '下午'
  227. break
  228. case 3:
  229. type_name = '晚上'
  230. break
  231. }
  232. return type_name
  233. }
  234. },
  235. components: {
  236. WeekItem
  237. },
  238. created() {
  239. this.modeOptions = this.$store.getters.treatment_mode
  240. this.anticoagulants_confit = this.$store.getters.anticoagulants_confit
  241. this.week_type = new Date().getDay()
  242. let params = {
  243. week_type: this.week_type
  244. }
  245. this.getScheduleWeekDay(params)
  246. }
  247. }
  248. </script>
  249. <style rel="stylesheet/css" lang="scss" scoped>
  250. </style>