血透系统pad前端

ComputerDialog.vue 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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
  8. class="success"
  9. v-if="
  10. this.record.id == 0 ||
  11. this.$store.getters.user.user.id != this.creator
  12. "
  13. ></span>
  14. <span
  15. class="success"
  16. @click="modify()"
  17. v-if="
  18. isPremission || this.$store.getters.user.user.id == this.creator
  19. "
  20. >修改</span
  21. >
  22. </div>
  23. <div class="DialogContent">
  24. <div class="item" @click="select_bed">
  25. <h2 class="name">上机床位</h2>
  26. <div class="content">
  27. <span class="text" style="width: 100px">{{
  28. device_number_map[bed_id].number
  29. }}</span>
  30. <span class="iconfont">&#xe6f9;</span>
  31. </div>
  32. </div>
  33. <div class="item" @click="select_nurse">
  34. <h2 class="name">上机护士</h2>
  35. <div class="content">
  36. <span class="text" style="width: 100px">{{
  37. admin_map[nurse_id].name
  38. }}</span>
  39. <span class="iconfont">&#xe6f9;</span>
  40. </div>
  41. </div>
  42. <div class="item" @click="select_puncture_nurse">
  43. <h2 class="name">穿刺者</h2>
  44. <div class="content">
  45. <span
  46. class="text"
  47. style="width: 100px"
  48. v-if="admin_map[puncture_nurse_id]"
  49. >{{ admin_map[puncture_nurse_id].name }}</span
  50. >
  51. <span class="iconfont">&#xe6f9;</span>
  52. </div>
  53. </div>
  54. <div class="item" v-if="template_id == 6">
  55. <label class="name" for="xll">引血(ml/min)</label>
  56. <div class="content">
  57. <input
  58. type="tel"
  59. @focus="inputFocus"
  60. id="xll"
  61. v-model="blood_drawing"
  62. />
  63. </div>
  64. </div>
  65. <div class="item">
  66. <h2 class="name">上机时间</h2>
  67. <div class="content">
  68. <span
  69. class="text"
  70. style="width: 100px"
  71. @click="selectStartTimeAction"
  72. >{{ start_time_str }}</span
  73. >
  74. <span class="iconfont">&#xe6f9;</span>
  75. </div>
  76. </div>
  77. <div class="perform">
  78. <button @click="commitInfo" v-if="record == null || record.id == ''">
  79. 执行上机
  80. </button>
  81. <button :disabled="true" style="background-color:lightgray;" v-else>
  82. 已上机
  83. </button>
  84. </div>
  85. </div>
  86. </div>
  87. <two-menu ref="selector"></two-menu>
  88. <mt-datetime-picker
  89. ref="start_time_picker"
  90. type="datetime"
  91. @confirm="didSelectStartTime"
  92. v-model="start_time"
  93. ></mt-datetime-picker>
  94. </div>
  95. </template>
  96. <script>
  97. import { startDialysis, PostModifyStartDialysis } from "@/api/dialysis";
  98. import { Toast } from "vant";
  99. import { parseTime } from "@/utils";
  100. import TwoMenu from "./TwoMenu";
  101. export default {
  102. name: "ComputerDialog",
  103. components: {
  104. TwoMenu
  105. },
  106. data() {
  107. return {
  108. start_time: new Date(),
  109. selecting: false,
  110. start_time_str: "",
  111. bed_id: 0,
  112. nurse_id: 0,
  113. puncture_nurse_id: 0,
  114. isPremission: false,
  115. zone_beds: [], // 该排班的区里的床位
  116. creator: 0,
  117. template_id: 0,
  118. blood_drawing: 100
  119. };
  120. },
  121. props: {
  122. schedule: {
  123. type: Object
  124. },
  125. patient_prop: {
  126. type: Object
  127. },
  128. record: {
  129. type: Object
  130. },
  131. admins: {
  132. type: Array
  133. },
  134. device_numbers: {
  135. type: Array
  136. },
  137. admin_map: {
  138. type: Object
  139. },
  140. device_number_map: {
  141. type: Object
  142. },
  143. special_premission: {
  144. type: Array
  145. }
  146. },
  147. mounted() {
  148. if (this.record.id == 0) {
  149. this.start_time_str =
  150. parseTime(this.start_time, "{y}-{m}-{d} {h}:{i}") + ":00";
  151. } else {
  152. if (this.record.start_time == 0) {
  153. this.start_time_str =
  154. parseTime(this.start_time, "{y}-{m}-{d} {h}:{i}") + ":00";
  155. } else {
  156. this.start_time_str =
  157. parseTime(this.record.start_time, "{y}-{m}-{d} {h}:{i}") + ":00";
  158. }
  159. }
  160. },
  161. created() {
  162. this.template_id = this.$store.getters.user.template_info.template_id;
  163. var date = this.$route.query && this.$route.query.date;
  164. date *= 1000;
  165. var newDate = new Date(date);
  166. var y = newDate.getFullYear();
  167. var m = newDate.getMonth() + 1;
  168. var d = newDate.getDate();
  169. if (isNaN(y) || isNaN(m) || isNaN(d)) {
  170. newDate = new Date();
  171. y = newDate.getFullYear();
  172. m = newDate.getMonth() + 1;
  173. d = newDate.getDate();
  174. }
  175. this.record_date =
  176. y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d);
  177. this.bed_id =
  178. this.record == null || this.record.id == ""
  179. ? this.schedule.bed_id
  180. : this.record.bed_id;
  181. this.nurse_id =
  182. this.record == null || this.record.id == ""
  183. ? this.$store.getters.user.user.id
  184. : this.record.start_nurse;
  185. this.puncture_nurse_id =
  186. this.record == null || this.record.id == ""
  187. ? this.$store.getters.user.user.id
  188. : this.record.puncture_nurse;
  189. if (this.puncture_nurse_id == 0) {
  190. this.puncture_nurse_id = this.$store.getters.user.user.id;
  191. }
  192. // var beds = []
  193. // for (let index = 0; index < this.device_numbers.length; index++) {
  194. // const device_number = this.device_numbers[index]
  195. // if (device_number.zone_id == this.schedule.partition_id) {
  196. // beds.push(device_number)
  197. // }
  198. // }
  199. // this.zone_beds = beds
  200. for (let index = 0; index < this.device_numbers.length; index++) {
  201. const device_number = this.device_numbers[index];
  202. this.device_numbers[index]["number"] =
  203. device_number["zone_name"] + "-" + device_number["number"];
  204. }
  205. this.zone_beds = this.device_numbers;
  206. if (this.record.id > 0) {
  207. for (let i = 0; i < this.special_premission.length; i++) {
  208. if (
  209. this.$store.getters.user.user.id ==
  210. this.special_premission[i].admin_user_id
  211. ) {
  212. this.isPremission = true;
  213. }
  214. }
  215. }
  216. if (this.record.id > 0) {
  217. if (this.record.creator == 0) {
  218. this.creator = this.record.start_nurse;
  219. } else {
  220. this.creator = this.record.creator;
  221. }
  222. }
  223. },
  224. methods: {
  225. inputFocus: function(event) {
  226. var input = event.target;
  227. setTimeout(function() {
  228. input.scrollIntoView();
  229. }, 0);
  230. if (input.setSelectionRange) {
  231. setTimeout(function() {
  232. input.setSelectionRange(0, input.value.length);
  233. }, 0);
  234. } else if (input.createTextRange) {
  235. var rng = input.createTextRange();
  236. rng.move("character", input.value.length);
  237. rng.select();
  238. }
  239. },
  240. modify() {
  241. let ParamsQuery = {};
  242. ParamsQuery["id"] = this.record.id;
  243. ParamsQuery["nurse"] = this.nurse_id;
  244. ParamsQuery["bed"] = this.bed_id;
  245. ParamsQuery["start_time"] = this.start_time_str;
  246. ParamsQuery["puncture_nurse"] = this.puncture_nurse_id;
  247. PostModifyStartDialysis(ParamsQuery).then(response => {
  248. if (response.data.state == 0) {
  249. Toast.fail(response.data.msg);
  250. return false;
  251. } else {
  252. Toast.success("修改成功");
  253. this.$emit('did_add_monitor', monitor)
  254. this.$emit("did_start", response.data.data.dialysis_order);
  255. var record = this.record;
  256. for (const key in response.data.data.dialysis_order) {
  257. this.$set(record, key, response.data.data.dialysis_order[key]);
  258. }
  259. }
  260. });
  261. },
  262. didSelectStartTime: function(time) {
  263. this.start_time_str = parseTime(time, "{y}-{m}-{d} {h}:{i}") + ":00";
  264. },
  265. selectStartTimeAction: function() {
  266. if (this.record.id != 0) {
  267. var creator = 0;
  268. if (this.record.creator == 0) {
  269. creator = this.record.start_nurse;
  270. } else {
  271. creator = this.record.creator;
  272. }
  273. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  274. this.$refs.start_time_picker.open();
  275. } else {
  276. return;
  277. }
  278. }
  279. this.$refs.start_time_picker.open();
  280. },
  281. commitInfo: function() {
  282. Toast.loading({ forbidClick: true, duration: 0 });
  283. let ParamsQuery = {};
  284. ParamsQuery["patient_id"] = this.patient_prop.id;
  285. ParamsQuery["record_date"] = this.record_date;
  286. ParamsQuery["nurse"] = this.nurse_id;
  287. ParamsQuery["bed"] = this.bed_id;
  288. ParamsQuery["start_time"] = this.start_time_str;
  289. ParamsQuery["puncture_nurse"] = this.puncture_nurse_id;
  290. ParamsQuery["blood_drawing"] = this.blood_drawing;
  291. startDialysis(ParamsQuery).then(response => {
  292. if (response.data.state == 0) {
  293. Toast.fail(response.data.msg);
  294. return false;
  295. } else {
  296. Toast.success("上机成功");
  297. var monitor = response.data.data.monitor;
  298. // this.$emit('did_add_monitor', monitor)
  299. this.$emit("did_start", response.data.data.dialysis_order);
  300. var record = this.record;
  301. for (const key in response.data.data.dialysis_order) {
  302. this.$set(record, key, response.data.data.dialysis_order[key]);
  303. // this.record[key] = response.data.data.dialysis_order[key]
  304. }
  305. }
  306. });
  307. },
  308. close: function() {
  309. this.$emit("close");
  310. },
  311. select_bed: function() {
  312. if (this.record.id != 0) {
  313. var creator = 0;
  314. if (this.record.creator == 0) {
  315. creator = this.record.start_nurse;
  316. } else {
  317. creator = this.record.creator;
  318. }
  319. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  320. this.selecting = true;
  321. var t = this;
  322. this.$refs.selector.showSingleSelect(
  323. this.zone_beds,
  324. this.bed_id,
  325. "选择床位号",
  326. "number",
  327. "id",
  328. function(select_id) {
  329. t.bed_id = select_id;
  330. },
  331. function() {
  332. t.selecting = false;
  333. }
  334. );
  335. } else {
  336. return;
  337. }
  338. }
  339. this.selecting = true;
  340. var t = this;
  341. this.$refs.selector.showSingleSelect(
  342. this.zone_beds,
  343. this.bed_id,
  344. "选择床位号",
  345. "number",
  346. "id",
  347. function(select_id) {
  348. t.bed_id = select_id;
  349. },
  350. function() {
  351. t.selecting = false;
  352. }
  353. );
  354. },
  355. select_nurse: function() {
  356. if (this.record.id != 0) {
  357. var creator = 0;
  358. if (this.record.creator == 0) {
  359. creator = this.record.start_nurse;
  360. } else {
  361. creator = this.record.creator;
  362. }
  363. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  364. this.selecting = true;
  365. var t = this;
  366. this.$refs.selector.showSingleSelect(
  367. this.admins,
  368. this.nurse_id,
  369. "选择上机护士",
  370. "name",
  371. "id",
  372. function(select_id) {
  373. t.nurse_id = select_id;
  374. },
  375. function() {
  376. t.selecting = false;
  377. }
  378. );
  379. } else {
  380. return;
  381. }
  382. }
  383. this.selecting = true;
  384. var t = this;
  385. this.$refs.selector.showSingleSelect(
  386. this.admins,
  387. this.nurse_id,
  388. "选择上机护士",
  389. "name",
  390. "id",
  391. function(select_id) {
  392. t.nurse_id = select_id;
  393. },
  394. function() {
  395. t.selecting = false;
  396. }
  397. );
  398. },
  399. select_puncture_nurse: function() {
  400. if (this.record.id != 0) {
  401. var creator = 0;
  402. if (this.record.creator == 0) {
  403. creator = this.record.start_nurse;
  404. } else {
  405. creator = this.record.creator;
  406. }
  407. if (this.$store.getters.user.user.id == creator || this.isPremission) {
  408. this.selecting = true;
  409. var t = this;
  410. this.$refs.selector.showSingleSelect(
  411. this.admins,
  412. this.puncture_nurse_id,
  413. "选择穿刺护士",
  414. "name",
  415. "id",
  416. function(select_id) {
  417. t.puncture_nurse_id = select_id;
  418. },
  419. function() {
  420. t.selecting = false;
  421. }
  422. );
  423. } else {
  424. return;
  425. }
  426. }
  427. this.selecting = true;
  428. var t = this;
  429. this.$refs.selector.showSingleSelect(
  430. this.admins,
  431. this.puncture_nurse_id,
  432. "选择穿刺护士",
  433. "name",
  434. "id",
  435. function(select_id) {
  436. t.puncture_nurse_id = select_id;
  437. },
  438. function() {
  439. t.selecting = false;
  440. }
  441. );
  442. },
  443. open: function() {
  444. this.selecting = false;
  445. this.$refs.selector.hide();
  446. }
  447. },
  448. watch: {
  449. "record.id": function(val) {
  450. if (val > 0) {
  451. for (let i = 0; i < this.special_premission.length; i++) {
  452. if (
  453. this.$store.getters.user.user.id ==
  454. this.special_premission[i].admin_user_id
  455. ) {
  456. this.isPremission = true;
  457. }
  458. }
  459. if (this.record.creator == 0) {
  460. this.creator = this.record.start_nurse;
  461. } else {
  462. this.creator = this.record.creator;
  463. }
  464. }
  465. }
  466. }
  467. };
  468. </script>
  469. <style style="stylesheet/scss" lang="scss" scoped>
  470. .perform {
  471. text-align: center;
  472. font-size: 0.3rem;
  473. padding-top: 2rem;
  474. .crew {
  475. color: $pgh-color;
  476. }
  477. button {
  478. background: $main-color;
  479. color: #fff;
  480. font-size: 0.45rem;
  481. text-align: center;
  482. width: 3rem;
  483. height: 1.2rem;
  484. line-height: 1.2rem;
  485. border-radius: 4px;
  486. margin-top: 10px;
  487. }
  488. }
  489. </style>