血透系统pad前端

ComputerDialog.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <div>
  3. <div class="Dialog" v-show="!selecting">
  4. <div class="DialogTit">
  5. <span @click="close()" class="iconfont">&#xe6e9;</span>
  6. <h1 class="name">透析上机</h1>
  7. <span class="success" v-if="this.record.id == 0 || this.$store.getters.user.user.id != this.creator"></span>
  8. <span class="success" @click="modify()" v-if="isPremission|| this.$store.getters.user.user.id == this.creator">修改</span>
  9. </div>
  10. <div class="DialogContent ">
  11. <div class="item" @click="select_bed">
  12. <h2 class="name">上机床位</h2>
  13. <div class="content">
  14. <span class="text" style="width: 100px">{{ device_number_map[bed_id].number }}</span>
  15. <span class="iconfont">&#xe6f9;</span>
  16. </div>
  17. </div>
  18. <div class="item" @click="select_nurse">
  19. <h2 class="name">上机护士</h2>
  20. <div class="content">
  21. <span class="text" style="width: 100px">{{ admin_map[nurse_id].name }}</span>
  22. <span class="iconfont">&#xe6f9;</span>
  23. </div>
  24. </div>
  25. <div class="item" @click="select_puncture_nurse">
  26. <h2 class="name">穿刺者</h2>
  27. <div class="content">
  28. <span class="text" style="width: 100px" v-if="admin_map[puncture_nurse_id]">{{ admin_map[puncture_nurse_id].name}}</span>
  29. <span class="iconfont">&#xe6f9;</span>
  30. </div>
  31. </div>
  32. <div class="item">
  33. <h2 class="name">上机时间</h2>
  34. <div class="content">
  35. <span class="text" style="width: 100px" @click="selectStartTimeAction">{{ start_time_str }}</span>
  36. <span class="iconfont">&#xe6f9;</span>
  37. </div>
  38. </div>
  39. <div class="perform">
  40. <button @click="commitInfo" v-if="(record == null || record.id == '')">执行上机</button>
  41. <button :disabled="true" style="background-color:lightgray;" v-else>已上机</button>
  42. </div>
  43. </div>
  44. </div>
  45. <two-menu ref="selector"></two-menu>
  46. <mt-datetime-picker
  47. ref="start_time_picker"
  48. type="datetime"
  49. @confirm="didSelectStartTime"
  50. v-model="start_time"
  51. ></mt-datetime-picker>
  52. </div>
  53. </template>
  54. <script>
  55. import {startDialysis,PostModifyStartDialysis} from '@/api/dialysis'
  56. import {Toast} from 'vant'
  57. import {parseTime} from '@/utils'
  58. import TwoMenu from './TwoMenu'
  59. export default {
  60. name: 'ComputerDialog',
  61. components: {
  62. TwoMenu
  63. },
  64. data () {
  65. return {
  66. start_time: new Date(),
  67. selecting: false,
  68. start_time_str: '',
  69. bed_id: 0,
  70. nurse_id: 0,
  71. puncture_nurse_id: 0,
  72. isPremission: false,
  73. zone_beds: [], // 该排班的区里的床位
  74. creator: 0,
  75. }
  76. },
  77. props: {
  78. schedule: {
  79. type: Object,
  80. },
  81. patient_prop: {
  82. type: Object,
  83. },
  84. record: {
  85. type: Object,
  86. },
  87. admins: {
  88. type: Array,
  89. },
  90. device_numbers: {
  91. type: Array,
  92. },
  93. admin_map: {
  94. type: Object,
  95. },
  96. device_number_map: {
  97. type: Object,
  98. },
  99. special_premission: {
  100. type: Array,
  101. },
  102. }, mounted () {
  103. if (this.record.id == 0) {
  104. this.start_time_str = parseTime(this.start_time, '{y}-{m}-{d} {h}:{i}') + ':00'
  105. } else {
  106. if (this.record.start_time == 0) {
  107. this.start_time_str = parseTime(this.start_time, '{y}-{m}-{d} {h}:{i}') + ':00'
  108. } else {
  109. this.start_time_str = parseTime(this.record.start_time, '{y}-{m}-{d} {h}:{i}') + ':00'
  110. }
  111. }
  112. },
  113. created () {
  114. var date = this.$route.query && this.$route.query.date
  115. date *= 1000
  116. var newDate = new Date(date)
  117. var y = newDate.getFullYear()
  118. var m = newDate.getMonth() + 1
  119. var d = newDate.getDate()
  120. if (isNaN(y) || isNaN(m) || isNaN(d)) {
  121. newDate = new Date()
  122. y = newDate.getFullYear()
  123. m = newDate.getMonth() + 1
  124. d = newDate.getDate()
  125. }
  126. this.record_date = y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d)
  127. this.bed_id = (this.record == null || this.record.id == '') ? this.schedule.bed_id : this.record.bed_id
  128. this.nurse_id = (this.record == null || this.record.id == '') ? this.$store.getters.user.user.id : this.record.start_nurse
  129. this.puncture_nurse_id = (this.record == null || this.record.id == '') ? this.$store.getters.user.user.id : this.record.puncture_nurse
  130. if (this.puncture_nurse_id == 0) {
  131. this.puncture_nurse_id = this.$store.getters.user.user.id
  132. }
  133. // var beds = []
  134. // for (let index = 0; index < this.device_numbers.length; index++) {
  135. // const device_number = this.device_numbers[index]
  136. // if (device_number.zone_id == this.schedule.partition_id) {
  137. // beds.push(device_number)
  138. // }
  139. // }
  140. // this.zone_beds = beds
  141. for (let index = 0; index < this.device_numbers.length; index++) {
  142. const device_number = this.device_numbers[index]
  143. this.device_numbers[index]['number'] = device_number['zone_name']+'-'+device_number['number']
  144. }
  145. this.zone_beds = this.device_numbers
  146. if (this.record.id > 0) {
  147. for (let i = 0; i < this.special_premission.length; i++) {
  148. if (this.$store.getters.user.user.id == this.special_premission[i].admin_user_id) {
  149. this.isPremission = true
  150. }
  151. }
  152. }
  153. if (this.record.id > 0) {
  154. if (this.record.creator == 0) {
  155. this.creator = this.record.start_nurse
  156. } else {
  157. this.creator = this.record.creator
  158. }
  159. }
  160. },
  161. methods: {
  162. modify(){
  163. let ParamsQuery = {}
  164. ParamsQuery['id'] = this.record.id
  165. ParamsQuery['nurse'] = this.nurse_id
  166. ParamsQuery['bed'] = this.bed_id
  167. ParamsQuery['start_time'] = this.start_time_str
  168. ParamsQuery['puncture_nurse'] = this.puncture_nurse_id
  169. PostModifyStartDialysis(ParamsQuery).then(response => {
  170. if (response.data.state == 0) {
  171. Toast.fail(response.data.msg)
  172. return false
  173. } else {
  174. Toast.success('修改成功')
  175. this.$emit('did_start', response.data.data.dialysis_order)
  176. var record = this.record
  177. for (const key in response.data.data.dialysis_order) {
  178. this.$set(record, key, response.data.data.dialysis_order[key])
  179. }
  180. }
  181. })
  182. },
  183. didSelectStartTime: function (time) {
  184. this.start_time_str = parseTime(time, '{y}-{m}-{d} {h}:{i}') + ':00'
  185. },
  186. selectStartTimeAction: function () {
  187. if (this.record.id != 0) {
  188. var creator = 0
  189. if (this.record.creator == 0) {
  190. creator = this.record.start_nurse
  191. } else {
  192. creator = this.record.creator
  193. }
  194. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  195. this.$refs.start_time_picker.open()
  196. } else {
  197. return
  198. }
  199. }
  200. this.$refs.start_time_picker.open()
  201. },
  202. commitInfo: function () {
  203. Toast.loading({forbidClick: true, duration: 0})
  204. let ParamsQuery = {}
  205. ParamsQuery['patient_id'] = this.patient_prop.id
  206. ParamsQuery['record_date'] = this.record_date
  207. ParamsQuery['nurse'] = this.nurse_id
  208. ParamsQuery['bed'] = this.bed_id
  209. ParamsQuery['start_time'] = this.start_time_str
  210. ParamsQuery['puncture_nurse'] = this.puncture_nurse_id
  211. startDialysis(ParamsQuery).then(response => {
  212. if (response.data.state == 0) {
  213. Toast.fail(response.data.msg)
  214. return false
  215. } else {
  216. Toast.success('上机成功')
  217. this.$emit('did_start', response.data.data.dialysis_order)
  218. var record = this.record
  219. for (const key in response.data.data.dialysis_order) {
  220. this.$set(record, key, response.data.data.dialysis_order[key])
  221. // this.record[key] = response.data.data.dialysis_order[key]
  222. }
  223. }
  224. })
  225. },
  226. close: function () {
  227. this.$emit('close')
  228. },
  229. select_bed: function () {
  230. if (this.record.id != 0) {
  231. var creator = 0
  232. if (this.record.creator == 0) {
  233. creator = this.record.start_nurse
  234. } else {
  235. creator = this.record.creator
  236. }
  237. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  238. this.selecting = true
  239. var t = this
  240. this.$refs.selector.showSingleSelect(this.zone_beds, this.bed_id, '选择床位号', 'number', 'id', function (select_id) {
  241. t.bed_id = select_id
  242. }, function () {
  243. t.selecting = false
  244. })
  245. } else {
  246. return
  247. }
  248. }
  249. this.selecting = true
  250. var t = this
  251. this.$refs.selector.showSingleSelect(this.zone_beds, this.bed_id, '选择床位号', 'number', 'id', function (select_id) {
  252. t.bed_id = select_id
  253. }, function () {
  254. t.selecting = false
  255. })
  256. },
  257. select_nurse: function () {
  258. if (this.record.id != 0) {
  259. var creator = 0
  260. if (this.record.creator == 0) {
  261. creator = this.record.start_nurse
  262. } else {
  263. creator = this.record.creator
  264. }
  265. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  266. this.selecting = true
  267. var t = this
  268. this.$refs.selector.showSingleSelect(this.admins, this.nurse_id, '选择上机护士', 'name', 'id', function (select_id) {
  269. t.nurse_id = select_id
  270. }, function () {
  271. t.selecting = false
  272. })
  273. } else {
  274. return
  275. }
  276. }
  277. this.selecting = true
  278. var t = this
  279. this.$refs.selector.showSingleSelect(this.admins, this.nurse_id, '选择上机护士', 'name', 'id', function (select_id) {
  280. t.nurse_id = select_id
  281. }, function () {
  282. t.selecting = false
  283. })
  284. }, select_puncture_nurse: function () {
  285. if (this.record.id != 0) {
  286. var creator = 0
  287. if (this.record.creator == 0) {
  288. creator = this.record.start_nurse
  289. } else {
  290. creator = this.record.creator
  291. }
  292. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  293. this.selecting = true
  294. var t = this
  295. this.$refs.selector.showSingleSelect(this.admins, this.puncture_nurse_id, '选择穿刺护士', 'name', 'id', function (select_id) {
  296. t.puncture_nurse_id = select_id
  297. }, function () {
  298. t.selecting = false
  299. })
  300. } else {
  301. return
  302. }
  303. }
  304. this.selecting = true
  305. var t = this
  306. this.$refs.selector.showSingleSelect(this.admins, this.puncture_nurse_id, '选择穿刺护士', 'name', 'id', function (select_id) {
  307. t.puncture_nurse_id = select_id
  308. }, function () {
  309. t.selecting = false
  310. })
  311. },
  312. open: function () {
  313. this.selecting = false
  314. this.$refs.selector.hide()
  315. }
  316. }, watch: {
  317. 'record.id': function (val) {
  318. if (val > 0) {
  319. for (let i = 0; i < this.special_premission.length; i++) {
  320. if (this.$store.getters.user.user.id == this.special_premission[i].admin_user_id) {
  321. this.isPremission = true
  322. }
  323. }
  324. if (this.record.creator == 0) {
  325. this.creator = this.record.start_nurse
  326. } else {
  327. this.creator = this.record.creator
  328. }
  329. }
  330. }
  331. }
  332. }
  333. </script>
  334. <style style="stylesheet/scss" lang="scss" scoped>
  335. .perform{
  336. text-align: center;
  337. font-size: 0.3rem;
  338. padding-top: 2rem;
  339. .crew{
  340. color: $pgh-color;
  341. }
  342. button{
  343. background:$main-color;
  344. color: #fff;
  345. font-size: 0.3rem;
  346. text-align:center;
  347. width: 3rem;
  348. height: 0.7rem;
  349. line-height: 0.7rem;
  350. border-radius:4px;
  351. margin-top:10px;
  352. }
  353. }
  354. </style>