血透系统pad前端

PlaneDialog.vue 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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.state == 1 || 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_nurse">
  12. <h2 class="name">下机护士</h2>
  13. <div class="content">
  14. <span class="text" style="width: 100px">{{ nurse_id == 0 ? '' : admin_map[nurse_id].name }}</span>
  15. <span class="iconfont">&#xe6f9;</span>
  16. </div>
  17. </div>
  18. <div class="item">
  19. <h2 class="name">下机时间</h2>
  20. <div class="content">
  21. <span class="text" style="width: 100px" @click="selectStartTimeAction">{{ end_time_str }}</span>
  22. <span class="iconfont">&#xe6f9;</span>
  23. </div>
  24. </div>
  25. <div class="perform">
  26. <button @click="commitInfo" v-show="(record != null && record.id != '' && record.stage == 1)">执行下机</button>
  27. <button :disabled="true" style="background-color:lightgray;" v-show="(record != null && record.id != '' && record.stage == 2)">已下机</button>
  28. <button :disabled="true" style="background-color:lightgray;" v-show="record == null || record.id == ''">未上机</button>
  29. </div>
  30. </div>
  31. </div>
  32. <two-menu ref="selector"></two-menu>
  33. <mt-datetime-picker
  34. ref="start_time_picker"
  35. type="datetime"
  36. @confirm="didSelectStartTime"
  37. v-model="end_time"
  38. ></mt-datetime-picker>
  39. </div>
  40. </template>
  41. <script>
  42. import {
  43. finish,PostModifyEndDialysis
  44. } from "@/api/dialysis";
  45. import { Toast } from 'vant';
  46. import TwoMenu from './TwoMenu'
  47. import { parseTime } from "@/utils";
  48. export default {
  49. name: "PlaneDialog",
  50. components: {
  51. TwoMenu
  52. },
  53. data() {
  54. return {
  55. selecting: false,
  56. end_time_str: "",
  57. end_time:new Date(),
  58. nurse_id: 0,
  59. isPremission:false,
  60. creator:0,
  61. }
  62. },
  63. props:{
  64. patient_prop: {
  65. type: Object,
  66. },
  67. record: {
  68. type: Object,
  69. },
  70. admins: {
  71. type: Array,
  72. },
  73. admin_map: {
  74. type: Object,
  75. },
  76. special_premission: {
  77. type: Array,
  78. },
  79. last_monitor_record: {
  80. type: Object,
  81. }
  82. },mounted() {
  83. if(this.last_monitor_record.id == 0){
  84. this.end_time_str = parseTime(this.end_time, "{y}-{m}-{d} {h}:{i}") + ":00";
  85. }else{
  86. this.end_time_str = parseTime(this.last_monitor_record.operate_time, "{y}-{m}-{d} {h}:{i}") + ":00";
  87. }
  88. },
  89. created(){
  90. var date = this.$route.query && this.$route.query.date;
  91. date *= 1000;
  92. var newDate = new Date(date);
  93. var y = newDate.getFullYear();
  94. var m = newDate.getMonth() + 1;
  95. var d = newDate.getDate();
  96. if (isNaN(y) || isNaN(m) || isNaN(d)) {
  97. newDate = new Date();
  98. y = newDate.getFullYear();
  99. m = newDate.getMonth() + 1;
  100. d = newDate.getDate();
  101. }
  102. this.record_date = y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);
  103. if (this.record == null || this.record.id == '') {
  104. this.nurse_id = 0
  105. } else if (this.record.stage == 1) {
  106. this.nurse_id = this.$store.getters.user.user.id
  107. } else {
  108. this.nurse_id = this.record.finish_nurse
  109. }
  110. console.log("下机:"+this.nurse_id)
  111. if (this.record.id > 0) {
  112. for (let i = 0; i < this.special_premission.length; i++) {
  113. if (this.$store.getters.user.user.id == this.special_premission[i].admin_user_id) {
  114. this.isPremission = true
  115. }
  116. }
  117. }
  118. if (this.record.id > 0) {
  119. if (this.record.finish_creator == 0) {
  120. this.creator = this.record.finish_nurse
  121. } else {
  122. this.creator = this.record.finish_creator
  123. }
  124. }
  125. },
  126. methods: {
  127. set_last_monitor_record(monitor) {
  128. this.last_monitor_record = monitor
  129. this.end_time_str = parseTime(this.last_monitor_record.operate_time, "{y}-{m}-{d} {h}:{i}") + ":00";
  130. },
  131. modify(){
  132. let ParamsQuery = {}
  133. ParamsQuery['id'] = this.record.id
  134. ParamsQuery["nurse"] = this.nurse_id
  135. ParamsQuery["end_time"] = this.end_time_str
  136. PostModifyEndDialysis(ParamsQuery).then(response => {
  137. if (response.data.state == 0) {
  138. Toast.fail(response.data.msg)
  139. return false
  140. } else {
  141. Toast.success('修改成功')
  142. this.$emit('did_off', response.data.data.dialysis_order)
  143. var record = this.record
  144. for (const key in response.data.data.dialysis_order) {
  145. this.$set(record, key, response.data.data.dialysis_order[key])
  146. }
  147. }
  148. })
  149. },
  150. didSelectStartTime: function(time) {
  151. this.end_time_str = parseTime(time, "{y}-{m}-{d} {h}:{i}") + ":00";
  152. },
  153. selectStartTimeAction: function() {
  154. if (this.record.id != 0) {
  155. if(this.record.end_time > 0){
  156. var creator = 0
  157. if (this.record.finish_creator == 0) {
  158. creator = this.record.finish_nurse
  159. } else {
  160. creator = this.record.finish_creator
  161. }
  162. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  163. this.$refs.start_time_picker.open()
  164. } else {
  165. return
  166. }
  167. }else{
  168. this.$refs.start_time_picker.open();
  169. }
  170. }else{
  171. this.$refs.start_time_picker.open();
  172. }
  173. },
  174. commitInfo: function () {
  175. Toast.loading({forbidClick: true, duration: 0})
  176. let ParamsQuery = {}
  177. ParamsQuery['patient'] = this.patient_prop.id
  178. ParamsQuery['record_date'] = this.record_date
  179. ParamsQuery["nurse"] = this.nurse_id
  180. ParamsQuery["end_time"] = this.end_time_str
  181. finish(ParamsQuery).then(response => {
  182. if (response.data.state == 0) {
  183. Toast.fail(response.data.msg);
  184. return false;
  185. } else {debugger
  186. Toast.success("下机成功");
  187. this.$emit('did_off', response.data.data.assessmentAfterDislysis);
  188. var record = this.record
  189. for (const key in response.data.data.dialysisOrder) {
  190. this.$set(record, key, response.data.data.dialysisOrder[key])
  191. // record[key] = response.data.data.dialysisOrder[key]
  192. }
  193. // console.log(this.record)
  194. }
  195. });
  196. },
  197. close: function() {
  198. this.$emit('close')
  199. },
  200. select_nurse: function() {
  201. if (this.record != null && this.record.id != '') {
  202. if(this.record.stage == 1){
  203. this.selecting = true
  204. var t = this
  205. this.$refs.selector.showSingleSelect(this.admins, this.nurse_id, "选择下机护士", "name", "id", function(select_id) {
  206. console.log("nurse id: ", select_id)
  207. t.nurse_id = select_id
  208. }, function() {
  209. t.selecting = false
  210. })
  211. }else{
  212. var creator = 0
  213. if (this.record.finish_creator == 0) {
  214. creator = this.record.finish_nurse
  215. } else {
  216. creator = this.record.finish_creator
  217. }
  218. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  219. this.selecting = true
  220. var t = this
  221. this.$refs.selector.showSingleSelect(this.admins, this.nurse_id, "选择下机护士", "name", "id", function(select_id) {
  222. console.log("nurse id: ", select_id)
  223. t.nurse_id = select_id
  224. }, function() {
  225. t.selecting = false
  226. })
  227. } else {
  228. return
  229. }
  230. }
  231. }
  232. },
  233. open:function(){
  234. this.selecting = false;
  235. this.$refs.selector.hide();
  236. }
  237. }, watch: {
  238. 'record.stage': function (val) {
  239. if (val == 2) {
  240. for (let i = 0; i < this.special_premission.length; i++) {
  241. if (this.$store.getters.user.user.id == this.special_premission[i].admin_user_id) {
  242. this.isPremission = true
  243. }
  244. }
  245. if (this.record.finish_nurse == 0) {
  246. this.creator = this.record.finish_nurse
  247. } else {
  248. this.creator = this.record.finish_creator
  249. }
  250. }
  251. console.log(this.creator)
  252. console.log(this.$store.getters.user.user.id)
  253. }
  254. }
  255. };
  256. </script>
  257. <style style="stylesheet/scss" lang="scss" scoped>
  258. .perform{
  259. text-align: center;
  260. font-size: 0.3rem;
  261. padding-top: 2rem;
  262. .crew{
  263. color: $pgh-color;
  264. }
  265. button{
  266. background:$main-color;
  267. color: #fff;
  268. font-size: 0.3rem;
  269. text-align:center;
  270. width: 3rem;
  271. height: 0.7rem;
  272. line-height: 0.7rem;
  273. border-radius:4px;
  274. margin-top:10px;
  275. }
  276. }
  277. </style>