血透系统PC前端

computer_dialog.vue 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <div>
  3. <el-dialog title="透析上机" :visible.sync="visible" width="854px" :modal-append-to-body="false">
  4. <el-form :model="form" label-width="80px">
  5. <el-form-item label="上机床位">
  6. <el-select v-model="form.bed_id" placeholder="" :disabled="dialysis_order.id != 0">
  7. <el-option v-for="(bed, index) in zone_beds" :key="index" :value="bed.id" :label="bed.number"></el-option>
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="上机护士">
  11. <el-select v-model="form.nurse_id" placeholder="" :disabled="dialysis_order.id != 0">
  12. <el-option v-for="(admin, index) in admins" :key="index" :value="admin.id" :label="admin.name"></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="穿刺护士">
  16. <el-select v-model="form.puncture_nurse_id" placeholder="" :disabled="dialysis_order.id != 0">
  17. <el-option v-for="(admin, index) in admins" :key="index" :value="admin.id" :label="admin.name"></el-option>
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="上机时间 :" style="width:300px">
  21. <el-date-picker
  22. :disabled="dialysis_order.id != 0"
  23. type="datetime"
  24. format="yyyy-MM-dd HH:mm"
  25. value-format="yyyy-MM-dd HH:mm"
  26. placeholder="选择时间"
  27. v-model="form.start_time"
  28. style="width:100%;"
  29. ></el-date-picker>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button v-if="dialysis_order.id == 0" @click="submit" type="primary" :loading="loading">执行上机</el-button>
  33. <el-button v-else type="info" :disabled="true">已上机</el-button>
  34. </el-form-item>
  35. </el-form>
  36. </el-dialog>
  37. </div>
  38. </template>
  39. <script>
  40. import { startDialysis } from '@/api/dialysis_record'
  41. import { parseTime } from '@/utils'
  42. export default {
  43. name: 'ComputerDialog',
  44. data() {
  45. return {
  46. visible: false,
  47. loading: false,
  48. patient_id: 0,
  49. schedule_date: 0,
  50. start_time: 0,
  51. form: {
  52. bed_id: '',
  53. nurse_id: '',
  54. start_time:'',
  55. puncture_nurse_id:'',
  56. }
  57. }
  58. },
  59. props: {
  60. dialysis_order: {
  61. type: Object
  62. },
  63. schedule: {
  64. type: Object
  65. },
  66. admins: {
  67. type: Array
  68. },
  69. device_numbers: {
  70. type: Array
  71. }
  72. },
  73. created() {
  74. this.patient_id = this.$route.query.patient_id
  75. this.schedule_date = this.$route.query.date
  76. this.form.bed_id = this.dialysis_order.id == 0 ? this.schedule.bed_id : this.dialysis_order.bed_id
  77. this.form.nurse_id = this.dialysis_order.id == 0 ? this.$store.getters.xt_user.user.id : this.dialysis_order.start_nurse
  78. this.form.puncture_nurse_id = this.dialysis_order.id == 0 ? this.$store.getters.xt_user.user.id : this.dialysis_order.puncture_nurse
  79. if(this.form.puncture_nurse_id == 0){
  80. this.form.puncture_nurse_id = this.$store.getters.xt_user.user.id
  81. }
  82. },
  83. watch: {
  84. 'schedule.id': function() {
  85. this.form.bed_id = this.dialysis_order.id == 0 ? this.schedule.bed_id : this.dialysis_order.bed_id
  86. },
  87. 'dialysis_order.id': function() {
  88. console.log(this.dialysis_order)
  89. this.form.bed_id = this.dialysis_order.id == 0 ? this.schedule.bed_id : this.dialysis_order.bed_id
  90. this.form.nurse_id = this.dialysis_order.id == 0 ? this.$store.getters.xt_user.user.id : this.dialysis_order.start_nurse
  91. this.form.puncture_nurse_id = this.dialysis_order.id == 0 ? this.$store.getters.xt_user.user.id : this.dialysis_order.puncture_nurse
  92. var nowDate = new Date()
  93. var nowYear = nowDate.getFullYear()
  94. var nowMonth = nowDate.getMonth() + 1
  95. var nowDay = nowDate.getDate()
  96. var nowHours = nowDate.getHours()
  97. var nowMinutes = nowDate.getMinutes()
  98. var nowSeconds = nowDate.getSeconds()
  99. var time =
  100. nowYear +
  101. '-' +
  102. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  103. '-' +
  104. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (nowHours < 10 ? '0' + nowHours : nowHours) + ':' + (nowMinutes < 10 ? '0' + nowMinutes : nowMinutes)
  105. this.form.start_time = this.dialysis_order.id == 0 ? time : this.getTime(this.dialysis_order.start_time, '{y}-{m}-{d} {h}:{i}')
  106. }
  107. },
  108. computed: {
  109. zone_beds: function() {
  110. var beds = []
  111. for (let index = 0; index < this.device_numbers.length; index++) {
  112. const device_number = this.device_numbers[index]
  113. if (device_number.zone_id == this.schedule.partition_id) {
  114. beds.push(device_number)
  115. }
  116. }
  117. return beds
  118. }
  119. },
  120. methods: {
  121. getTime(value, temp) {
  122. if (value != undefined) {
  123. return parseTime(value, temp)
  124. }
  125. return ''
  126. },
  127. show: function() {
  128. this.visible = true
  129. var nowDate = new Date()
  130. var nowYear = nowDate.getFullYear()
  131. var nowMonth = nowDate.getMonth() + 1
  132. var nowDay = nowDate.getDate()
  133. var nowHours = nowDate.getHours()
  134. var nowMinutes = nowDate.getMinutes()
  135. var nowSeconds = nowDate.getSeconds()
  136. if (this.dialysis_order.id != 0) {
  137. this.form.start_time = this.getTime(this.dialysis_order.start_time, '{y}-{m}-{d} {h}:{i}')
  138. } else {
  139. this.form.start_time =
  140. nowYear +
  141. '-' +
  142. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  143. '-' +
  144. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (nowHours < 10 ? '0' + nowHours : nowHours) + ':' + (nowMinutes < 10 ? '0' + nowMinutes : nowMinutes)
  145. }
  146. },
  147. hide: function() {
  148. this.visible = false
  149. },
  150. submit: function() {
  151. this.loading = true
  152. startDialysis(this.patient_id, parseTime(this.schedule_date, '{y}-{m}-{d}'), this.form.nurse_id, this.form.bed_id, this.form.puncture_nurse_id,this.form.start_time).then(rs => {
  153. this.loading = false
  154. var resp = rs.data
  155. if (resp.state == 1) {
  156. var resp_dialysis_order = resp.data.dialysis_order
  157. var this_order = this.dialysis_order
  158. for (const key in resp_dialysis_order) {
  159. this.$set(this_order, key, resp_dialysis_order[key])
  160. }
  161. } else {
  162. this.$message.error(resp.msg)
  163. }
  164. })
  165. }
  166. }
  167. }
  168. </script>
  169. <style scoped>
  170. .txsj {
  171. text-align: center;
  172. margin-bottom: 20px;
  173. }
  174. </style>